From ea9c1c9cef2297386afb15f6cc8ad2a8115790df Mon Sep 17 00:00:00 2001 From: manjunath-grl Date: Thu, 1 Feb 2024 16:20:20 +0530 Subject: [PATCH] Automated tests: TC_DEMM_1_1 TC_DEMM_2_1 TC_EEVSE_1_1 TC_EEVSE_2_1 TC_REFALM_2_2 TC_EEVSEM_1_1 TC_EEVSEM_2_1 TC_EEVSEM_3_1 TC_EEVSEM_3_2 TC_EEVSEM_3_3 Manual tests: TC_DEMM_1_2 TC_EEVSEM_1_2 --- .../templates/tests/ciTests.json | 6 + scripts/tests/chiptest/__init__.py | 4 + src/app/tests/suites/certification/PICS.yaml | 78 + .../certification/Test_TC_DEMM_1_1.yaml | 116 + .../certification/Test_TC_DEMM_1_2.yaml | 112 + .../certification/Test_TC_DEMM_2_1.yaml | 219 ++ .../certification/Test_TC_EEVSEM_1_1.yaml | 116 + .../certification/Test_TC_EEVSEM_1_2.yaml | 95 + .../certification/Test_TC_EEVSEM_2_1.yaml | 219 ++ .../certification/Test_TC_EEVSEM_3_1.yaml | 134 + .../certification/Test_TC_EEVSEM_3_2.yaml | 172 + .../certification/Test_TC_EEVSEM_3_3.yaml | 189 + .../certification/Test_TC_EEVSE_1_1.yaml | 396 +- .../certification/Test_TC_EEVSE_2_1.yaml | 489 ++- .../suites/certification/Test_TC_LWM_2_1.yaml | 2 +- .../certification/Test_TC_REFALM_2_2.yaml | 227 +- .../tests/suites/certification/ci-pics-values | 126 +- src/app/tests/suites/ciTests.json | 12 + src/app/tests/suites/manualTests.json | 4 + .../zap-generated/test/Commands.h | 3230 ++++++++++++++++- 20 files changed, 5434 insertions(+), 512 deletions(-) create mode 100644 src/app/tests/suites/certification/Test_TC_DEMM_1_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_DEMM_1_2.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_DEMM_2_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_EEVSEM_1_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_EEVSEM_1_2.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_EEVSEM_2_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_EEVSEM_3_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_EEVSEM_3_2.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_EEVSEM_3_3.yaml diff --git a/examples/darwin-framework-tool/templates/tests/ciTests.json b/examples/darwin-framework-tool/templates/tests/ciTests.json index 7554f6bfb93dbb..6e8e2cccd21ca2 100644 --- a/examples/darwin-framework-tool/templates/tests/ciTests.json +++ b/examples/darwin-framework-tool/templates/tests/ciTests.json @@ -21,6 +21,8 @@ "Test_TC_APPLAUNCHER_3_7", "Test_TC_APPLAUNCHER_3_8", "Test_TC_APPLAUNCHER_3_9", + "TC_MEDIAPLAYBACK_6_8", + "TC_MEDIAPLAYBACK_6_9", "Test_TC_BINFO_2_1", "Test_TC_SWTCH_2_1", "Test_TC_G_2_1", @@ -67,6 +69,10 @@ "Test_TC_OTCCM_3_1", "Test_TC_OTCCM_3_2", "Test_TC_OTCCM_3_3", + "Test_TC_EEVSEM_2_1", + "Test_TC_EEVSEM_3_1", + "Test_TC_EEVSEM_3_2", + "Test_TC_EEVSEM_3_3", "Disabled because darwin-framework-tool does not support constraints arithmetic operations", "Test_TC_FLW_2_1", "Test_TC_RH_2_1", diff --git a/scripts/tests/chiptest/__init__.py b/scripts/tests/chiptest/__init__.py index b7b541c0869819..38d221b5eb2595 100644 --- a/scripts/tests/chiptest/__init__.py +++ b/scripts/tests/chiptest/__init__.py @@ -205,6 +205,10 @@ def _GetChipReplUnsupportedTests() -> Set[str]: "Test_TC_RVCCLEANM_3_3.yaml", # chip-repl does not support EqualityCommands pseudo-cluster "Test_TC_BINFO_2_1.yaml", # chip-repl does not support EqualityCommands pseudo-cluster "TestDiagnosticLogs.yaml", # chip-repl does not implement a BDXTransferServerDelegate + "Test_TC_EEVSEM_2_1.yaml", # chip-repl does not support EqualityCommands pseudo-cluster + "Test_TC_EEVSEM_3_1.yaml", # chip-repl does not support EqualityCommands pseudo-cluster + "Test_TC_EEVSEM_3_2.yaml", # chip-repl does not support EqualityCommands pseudo-cluster + "Test_TC_EEVSEM_3_3.yaml", # chip-repl does not support EqualityCommands pseudo-cluster } diff --git a/src/app/tests/suites/certification/PICS.yaml b/src/app/tests/suites/certification/PICS.yaml index 252b13743079e1..1b16584c9e64f7 100644 --- a/src/app/tests/suites/certification/PICS.yaml +++ b/src/app/tests/suites/certification/PICS.yaml @@ -9962,3 +9962,81 @@ PICS: # Commands generated - label: "Does the device implement sending the GetTargetsResponse command?" id: EEVSE.S.C00.Tx + + # Energy EVSE Mode Cluster + # server / attributes + - label: "Does the device implement the Energy EVSE cluster as a server?" + id: EEVSEM.S + + - label: "Does the device implement the SupportedModes attribute?" + id: EEVSEM.S.A0000 + + - label: "Does the device implement the CurrentMode attribute?" + id: EEVSEM.S.A0001 + + - label: "Does the device implement the StartUpMode attribute?" + id: EEVSEM.S.A0002 + + - label: "Does the device implement the OnMode attribute?" + id: EEVSEM.S.A0003 + + # Commands received + - label: "Does the device implement sending the ChangeToMode command?" + id: EEVSEM.S.C00.Rsp + + # Commands generated + - label: + "Does the device implement sending the ChangeToModeResponse command?" + id: EEVSEM.S.C01.Tx + + # Manual controllable + - label: "Does the DUT support testing the failed ChangeToMode command?" + id: EEVSEM.S.M.CAN_TEST_MODE_FAILURE + + - label: "Can the mode change be manually controlled?" + id: EEVSEM.S.M.CAN_MANUALLY_CONTROLLED + + #Feature + - label: "Does the DUT(server) support the Hue/Saturation feature?" + id: EEVSEM.S.F00 + + # + # Device Energy Management Mode Cluster + # server / attributes + + - label: "Does the device implement the DEMM cluster as a server?" + id: DEMM.S + + - label: "Does the device implement the SupportedModes attribute?" + id: DEMM.S.A0000 + + - label: "Does the device implement the CurrentMode attribute?" + id: DEMM.S.A0001 + + - label: "Does the device implement the StartUpMode attribute?" + id: DEMM.S.A0002 + + - label: "Does the device implement the OnMode attribute?" + id: DEMM.S.A0003 + + # Commands received + - label: "Does the device implement sending the ChangeToMode command?" + id: DEMM.S.C00.Rsp + + # Commands generated + - label: + "Does the device implement sending the ChangeToModeResponse command?" + id: DEMM.S.C01.Tx + + - label: "Does the DUT support testing the failed ChangeToMode command?" + id: DEMM.S.M.CAN_TEST_MODE_FAILURE + + - label: "Can the mode change be manually controlled?" + id: DEMM.S.M.CAN_MANUALLY_CONTROLLED + + # Manual controllable + - label: "Does the DUT support testing the failed ChangeToMode command?" + id: EEVSEM.S.M.CAN_TEST_MODE_FAILURE + + - label: "Can the mode change be manually controlled?" + id: EEVSEM.S.M.CAN_MANUALLY_CONTROLLED diff --git a/src/app/tests/suites/certification/Test_TC_DEMM_1_1.yaml b/src/app/tests/suites/certification/Test_TC_DEMM_1_1.yaml new file mode 100644 index 00000000000000..832b21e12ac63b --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_DEMM_1_1.yaml @@ -0,0 +1,116 @@ +# Copyright (c) 2024 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: 241.1.1. [TC-DEMM-1.1] Global attributes with DUT as Server + +PICS: + - DEMM.S + +config: + nodeId: 0x12344321 + cluster: "Device Energy Management Mode" + endpoint: 1 + +tests: + - label: + "Step 1: Commission DUT to TH (can be skipped if done in a preceding + test)." + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "Step 2: TH reads from the DUT the ClusterRevision attribute" + command: "readAttribute" + attribute: "ClusterRevision" + response: + value: 1 + constraints: + type: int16u + + #https://github.com/project-chip/connectedhomeip/issues/31599 + - label: "Step 3: TH reads from the DUT the FeatureMap attribute" + verification: | + ./chip-tool deviceenergymanagementmode read feature-map 1 1 + + On the TH(Chip-tool) Log, Verify featureMap value is 0 and below is the sample log provided for the raspi platform: + + [1705923720.577354][23553:23555] CHIP:DMG: } + [1705923720.577393][23553:23555] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_009F Attribute 0x0000_FFFC DataVersion: 2217281174 + [1705923720.577412][23553:23555] CHIP:TOO: FeatureMap: 1 + cluster: "LogCommands" + command: "UserPrompt" + PICS: PICS_SKIP_SAMPLE_APP + arguments: + values: + - name: "message" + value: "Enter 'y' after success" + - name: "expectedValue" + value: "y" + + - label: "Step 4: TH reads from the DUT the AttributeList attribute." + PICS: PICS_EVENT_LIST_ENABLED + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [0, 1, 65528, 65529, 65530, 65531, 65532, 65533] + + - label: "Step 4a: TH reads from the DUT the AttributeList attribute." + PICS: "!PICS_EVENT_LIST_ENABLED" + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [0, 1, 65528, 65529, 65531, 65532, 65533] + + - label: + "Step 4b: TH reads optional attribute (StartUpMode) in AttributeList + from DUT" + PICS: DEMM.S.A0002 + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [2] + + - label: "Step 5: TH reads from the DUT the EventList attribute." + PICS: PICS_EVENT_LIST_ENABLED + command: "readAttribute" + attribute: "EventList" + response: + value: [] + constraints: + type: list + + - label: "Step 6: TH reads from the DUT the AcceptedCommandList attribute." + command: "readAttribute" + attribute: "AcceptedCommandList" + response: + value: [0] + constraints: + type: list + + - label: "Step 7: TH reads from the DUT the GeneratedCommandList attribute." + command: "readAttribute" + attribute: "GeneratedCommandList" + response: + value: [1] + constraints: + type: list diff --git a/src/app/tests/suites/certification/Test_TC_DEMM_1_2.yaml b/src/app/tests/suites/certification/Test_TC_DEMM_1_2.yaml new file mode 100644 index 00000000000000..55aa1400ec1ac5 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_DEMM_1_2.yaml @@ -0,0 +1,112 @@ +# Copyright (c) 2024 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. +# Auto-generated scripts for harness use only, please review before automation. The endpoints and cluster names are currently set to default + +name: 241.1.2. [TC-DEMM-1.2] Cluster attributes with DUT as Server + +PICS: + - DEMM.S + +config: + nodeId: 0x12344321 + cluster: "Basic Information" + endpoint: 1 + +tests: + - label: "Step 1: TH reads from the DUT the SupportedModes attribute" + PICS: DEMM.S.A0000 + verification: | + ./chip-tool deviceenergymanagementmode read supported-modes 1 1 + + - Verify that the DUT response contains a list of ModeOptionsStruct entries + - Verify that the list has at least 2 and at most 255 entries + - Verify that each ModeOptionsStruct entry has a unique Mode field value + - Verify that each ModeOptionsStruct entry has a unique Label field value + - Verify that each ModeOptionsStruct entry’s ModeTags field has: + at least one entry the values of the Value fields that are not larger than 16 bits + - for each Value field: Is the mode tag value a defined common tag value (Auto(0x0000), Quick(0x0001), Quiet(0x0002), LowNoise(0x0003), LowEnergy(0x0004), Vacation(0x0005), Min(0x0006), Max(0x0007), Night(0x0008), Day(0x0009)) or a defined cluster-derived tag value (No Optimization, Device Optimization, Local Optimization, Grid Optimization) or in the MfgTags (0x8000 to 0xBFFF) range + - for at least one Value field: Is the mode tag value a defined common tag value (Auto(0x0000), Quick(0x0001), Quiet(0x0002), LowNoise(0x0003), LowEnergy(0x0004), Vacation(0x0005), Min(0x0006), Max(0x0007), Night(0x0008), Day(0x0009)) or a derived cluster value (RapidCool, RapidFreeze) + - if the Value field is in the MfgTags (0x8000 to 0xBFFF) range, the TagName field is a string with a length between 1 and 64 + - Verify that at least one ModeOptionsStruct entry includes either the RapidCool semantic tag or the RapidFreeze semantic tag in the SemanticTags field + - Save the Mode field values as supported_modes_dut on the TH (Chip-tool) and below is the sample log provided for the raspi platform: + + + [1705923890.093456][23589:23591] CHIP:DMG: } + [1705923890.094137][23589:23591] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_009F Attribute 0x0000_0000 DataVersion: 2217281174 + [1705923890.094312][23589:23591] CHIP:TOO: SupportedModes: 5 entries + [1705923890.094403][23589:23591] CHIP:TOO: [1]: { + [1705923890.094423][23589:23591] CHIP:TOO: Label: No energy management (forecast only) + [1705923890.094458][23589:23591] CHIP:TOO: Mode: 0 + [1705923890.094483][23589:23591] CHIP:TOO: ModeTags: 1 entries + [1705923890.094513][23589:23591] CHIP:TOO: [1]: { + [1705923890.094531][23589:23591] CHIP:TOO: Value: 16384 + [1705923890.094542][23589:23591] CHIP:TOO: } + [1705923890.094552][23589:23591] CHIP:TOO: } + [1705923890.094579][23589:23591] CHIP:TOO: [2]: { + [1705923890.094590][23589:23591] CHIP:TOO: Label: Device optimizes (no local or grid control) + [1705923890.094601][23589:23591] CHIP:TOO: Mode: 1 + [1705923890.094615][23589:23591] CHIP:TOO: ModeTags: 1 entries + [1705923890.094632][23589:23591] CHIP:TOO: [1]: { + [1705923890.094642][23589:23591] CHIP:TOO: Value: 16385 + [1705923890.094653][23589:23591] CHIP:TOO: } + [1705923890.094664][23589:23591] CHIP:TOO: } + [1705923890.094687][23589:23591] CHIP:TOO: [3]: { + [1705923890.094697][23589:23591] CHIP:TOO: Label: Optimized within building + [1705923890.094706][23589:23591] CHIP:TOO: Mode: 2 + [1705923890.094722][23589:23591] CHIP:TOO: ModeTags: 2 entries + [1705923890.094738][23589:23591] CHIP:TOO: [1]: { + [1705923890.094748][23589:23591] CHIP:TOO: Value: 16386 + [1705923890.094759][23589:23591] CHIP:TOO: } + [1705923890.094773][23589:23591] CHIP:TOO: [2]: { + [1705923890.094784][23589:23591] CHIP:TOO: Value: 16385 + [1705923890.094794][23589:23591] CHIP:TOO: } + [1705923890.094804][23589:23591] CHIP:TOO: } + [1705923890.094827][23589:23591] CHIP:TOO: [4]: { + [1705923890.094836][23589:23591] CHIP:TOO: Label: Optimized for grid + [1705923890.094846][23589:23591] CHIP:TOO: Mode: 3 + [1705923890.094861][23589:23591] CHIP:TOO: ModeTags: 2 entries + [1705923890.094876][23589:23591] CHIP:TOO: [1]: { + [1705923890.094886][23589:23591] CHIP:TOO: Value: 16385 + [1705923890.094893][23589:23591] CHIP:TOO: } + [1705923890.094908][23589:23591] CHIP:TOO: [2]: { + [1705923890.094917][23589:23591] CHIP:TOO: Value: 16387 + [1705923890.094927][23589:23591] CHIP:TOO: } + [1705923890.094935][23589:23591] CHIP:TOO: } + [1705923890.094960][23589:23591] CHIP:TOO: [5]: { + [1705923890.094971][23589:23591] CHIP:TOO: Label: Optimized for grid and building + [1705923890.094980][23589:23591] CHIP:TOO: Mode: 4 + [1705923890.094998][23589:23591] CHIP:TOO: ModeTags: 3 entries + [1705923890.095013][23589:23591] CHIP:TOO: [1]: { + [1705923890.095022][23589:23591] CHIP:TOO: Value: 16386 + [1705923890.095032][23589:23591] CHIP:TOO: } + [1705923890.095047][23589:23591] CHIP:TOO: [2]: { + [1705923890.095057][23589:23591] CHIP:TOO: Value: 16385 + [1705923890.095066][23589:23591] CHIP:TOO: } + [1705923890.095080][23589:23591] CHIP:TOO: [3]: { + [1705923890.095090][23589:23591] CHIP:TOO: Value: 16387 + [1705923890.095099][23589:23591] CHIP:TOO: } + [1705923890.095109][23589:23591] CHIP:TOO: } + disabled: true + + - label: "Step 2: TH reads from the DUT the CurrentMode attribute" + PICS: DEMM.S.A0001 + verification: | + ./chip-tool deviceenergymanagementmode read current-mode 1 1 + + Verify on TH(chip-tool) logs, CurrentMode attribute value is an integer value from supported_modes_dut, below is the sample log provided for the raspi platform, Here CurrentMode attribute value is 0 + + [1705923927.418159][23602:23604] CHIP:DMG: } + [1705923927.418327][23602:23604] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_009F Attribute 0x0000_0001 DataVersion: 2217281174 + [1705923927.418389][23602:23604] CHIP:TOO: CurrentMode: 0 + disabled: true diff --git a/src/app/tests/suites/certification/Test_TC_DEMM_2_1.yaml b/src/app/tests/suites/certification/Test_TC_DEMM_2_1.yaml new file mode 100644 index 00000000000000..a1d225750c25cf --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_DEMM_2_1.yaml @@ -0,0 +1,219 @@ +# Copyright (c) 2024 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: 241.2.1. [TC-DEMM-2.1] Change to Mode functionality with DUT as Server + +PICS: + - DEMM.S + +config: + nodeId: 0x12344321 + cluster: "Device Energy Management Mode" + endpoint: 1 + + #PIXIT.DEMM.MODE_CHANGE_OK + PIXIT.DEMM.MODE_CHANGE_OK: + type: int8u + defaultValue: 2 + #PIXIT.DEMM.MODE_CHANGE_FAIL + PIXIT.DEMM.MODE_CHANGE_FAIL: + type: int8u + defaultValue: 10 + invalid_mode_th: + type: int8u + defaultValue: 15 + +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 reads from the DUT the SupportedModes attribute." + PICS: DEMM.S.A0000 + command: "readAttribute" + attribute: "SupportedModes" + response: + saveAs: supported_mode_dut + constraints: + type: list + minLength: 2 + + - label: "Step 3: TH reads from the DUT the CurrentMode attribute." + PICS: DEMM.S.A0001 + command: "readAttribute" + attribute: "CurrentMode" + response: + saveAs: old_current_mode_dut + constraints: + type: int8u + minValue: 0 + maxValue: 255 + + - label: + "Step 4: TH sends a ChangeToMode command to the DUT with NewMode set + to old_current_mode_dut" + PICS: DEMM.S.C00.Rsp + command: "ChangeToMode" + arguments: + values: + - name: "NewMode" + value: old_current_mode_dut + response: + values: + - name: "Status" + value: 0x00 + + - label: + "Step 5: Manually put the device in a state from which it will FAIL to + transition to PIXIT.DEMM.MODE_CHANGE_FAIL" + PICS: + DEMM.S.M.CAN_TEST_MODE_FAILURE && DEMM.S.M.CAN_MANUALLY_CONTROLLED && + PICS_SKIP_SAMPLE_APP + verification: | + Manual operation required + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "Enter 'y' after success" + - name: "expectedValue" + value: "y" + + - label: "Step 6: TH reads from the DUT the CurrentMode attribute" + PICS: DEMM.S.A0001 && DEMM.S.M.CAN_MANUALLY_CONTROLLED + command: "readAttribute" + attribute: "CurrentMode" + response: + saveAs: Step6_current_mode_dut + constraints: + type: int8u + minValue: 0 + maxValue: 255 + + #Skipping test-7 because SDK is not enabled with this failure response + - label: + "Step 7: TH sends a ChangeToMode command to the DUT with NewMode set + to PIXIT.DEMM.MODE_CHANGE_FAIL" + PICS: + DEMM.S.M.CAN_TEST_MODE_FAILURE && DEMM.S.C00.Rsp && + PICS_SKIP_SAMPLE_APP + verification: | + Note : Please skip this step as SDK is not enabled with this failure response + + ./chip-tool energyevsemode change-to-mode 2 1 1 + + Verify on TH(chip-tool) log, DUT responds contains a ChangeToModeResponse command with Status field is set to GenericFailure(0x02), InvalidInMode(0x03) , or in the MfgCodes (0x80 to 0xBF) range and StatusText field has a length between 1 and 64, below is the sample log provided for the raspi platform: + + [1705995550.805161][7567:7569] CHIP:DMG: }, + [1705995550.805185][7567:7569] CHIP:DMG: Received Command Response Data, Endpoint=1 Cluster=0x0000_009D Command=0x0000_0001 + [1705995550.805197][7567:7569] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_009D Command 0x0000_0001 + [1705995550.805221][7567:7569] CHIP:TOO: ChangeToModeResponse: { + [1705995550.805228][7567:7569] CHIP:TOO: status: 0 + [1705995550.805232][7567:7569] CHIP:TOO: } + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "Enter 'y' after success" + - name: "expectedValue" + value: "y" + + - label: "Step 8: TH reads from the DUT the CurrentMode attribute." + PICS: DEMM.S.A0001 + command: "readAttribute" + attribute: "CurrentMode" + response: + value: old_current_mode_dut + constraints: + type: int16u + + - label: + "Step 9: Manually put the device in a state from which it will + SUCCESSFULLY transition to PIXIT.DEMM.MODE_CHANGE_OK" + PICS: PICS_SKIP_SAMPLE_APP && DEMM.S.M.CAN_MANUALLY_CONTROLLED + verification: | + Manual operation required + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "Enter 'y' after success" + - name: "expectedValue" + value: "y" + + - label: "Step 10: TH reads from the DUT the CurrentMode attribute." + PICS: DEMM.S.A0001 && DEMM.S.M.CAN_MANUALLY_CONTROLLED + command: "readAttribute" + attribute: "CurrentMode" + response: + saveAs: Step10_current_mode_dut + constraints: + type: int8u + minValue: 0 + maxValue: 255 + + - label: + "Step 11: TH sends a ChangeToMode command to the DUT with NewMode set + to PIXIT.DEMM.MODE_CHANGE_OK" + PICS: DEMM.S.C00.Rsp + command: "ChangeToMode" + arguments: + values: + - name: "NewMode" + value: PIXIT.DEMM.MODE_CHANGE_OK + response: + values: + - name: "Status" + value: 0x00 + + - label: + "Step 12: TH reads from the DUT the CurrentMode attribute. Verify that + the DUT response contains an integer value equal to + PIXIT.RVCRUNM.MODE_CHANGE_OK" + PICS: DEMM.S.A0001 + command: "readAttribute" + attribute: "CurrentMode" + response: + value: PIXIT.DEMM.MODE_CHANGE_OK + + - label: + "Step 13: TH sends a ChangeToMode command to the DUT with NewMode set + to invalid_mode_th" + PICS: DEMM.S.C00.Rsp + command: "ChangeToMode" + arguments: + values: + - name: "NewMode" + value: invalid_mode_th + response: + values: + - name: "Status" + value: 0x01 + + - label: + "Step 14: TH reads from the DUT the CurrentMode attribute. Verify that + the DUT response contains an integer value equal to + PIXIT.RVCRUNM.MODE_CHANGE_OK" + PICS: DEMM.S.A0001 + command: "readAttribute" + attribute: "CurrentMode" + response: + value: PIXIT.DEMM.MODE_CHANGE_OK diff --git a/src/app/tests/suites/certification/Test_TC_EEVSEM_1_1.yaml b/src/app/tests/suites/certification/Test_TC_EEVSEM_1_1.yaml new file mode 100644 index 00000000000000..ea416ee91e96b3 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_EEVSEM_1_1.yaml @@ -0,0 +1,116 @@ +# Copyright (c) 2024 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: 265.1.1. [TC-EEVSEM-1.1] Global Attributes with DUT as Server + +PICS: + - EEVSEM.S + +config: + nodeId: 0x12344321 + cluster: "Energy EVSE Mode" + endpoint: 1 + +tests: + - label: + "Step 1: Commission DUT to TH (can be skipped if done in a preceding + test)." + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "Step 2: TH reads from the DUT the ClusterRevision attribute" + command: "readAttribute" + attribute: "ClusterRevision" + response: + value: 1 + constraints: + type: int16u + + #https://github.com/project-chip/connectedhomeip/issues/31599 + - label: "Step 3: TH reads from the DUT the FeatureMap attribute" + verification: | + ./chip-tool energyevsemode read feature-map 1 1 + + On the TH(Chip-tool) Log, Verify featureMap value is 0 and below is the sample log provided for the raspi platform: + + [1705995388.110138][7525:7527] CHIP:DMG: } + [1705995388.110173][7525:7527] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_009D Attribute 0x0000_FFFC DataVersion: 1324786556 + [1705995388.110192][7525:7527] CHIP:TOO: FeatureMap: 1 + cluster: "LogCommands" + command: "UserPrompt" + PICS: PICS_SKIP_SAMPLE_APP + arguments: + values: + - name: "message" + value: "Enter 'y' after success" + - name: "expectedValue" + value: "y" + + - label: "Step 4: TH reads from the DUT the AttributeList attribute" + PICS: PICS_EVENT_LIST_ENABLED + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [0, 1, 65528, 65529, 65530, 65531, 65532, 65533] + + - label: "Step 4a: TH reads AttributeList from DUT" + PICS: "!PICS_EVENT_LIST_ENABLED" + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [0, 1, 65528, 65529, 65531, 65532, 65533] + + - label: + "Step 4b: TH reads optional attribute (StartUpMode) in AttributeList + from DUT" + PICS: EEVSEM.S.A0002 + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [2] + + - label: "Step 5: TH reads EventList from DUT" + PICS: PICS_EVENT_LIST_ENABLED + command: "readAttribute" + attribute: "EventList" + response: + value: [] + constraints: + type: list + + - label: "Step 6: TH reads AcceptedCommandList from DUT" + command: "readAttribute" + attribute: "AcceptedCommandList" + response: + value: [0] + constraints: + type: list + + - label: "Step 7: TH reads GeneratedCommandList from DUT" + command: "readAttribute" + attribute: "GeneratedCommandList" + response: + value: [1] + constraints: + type: list diff --git a/src/app/tests/suites/certification/Test_TC_EEVSEM_1_2.yaml b/src/app/tests/suites/certification/Test_TC_EEVSEM_1_2.yaml new file mode 100644 index 00000000000000..642dc5f09912dd --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_EEVSEM_1_2.yaml @@ -0,0 +1,95 @@ +# Copyright (c) 2024 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. +# Auto-generated scripts for harness use only, please review before automation. The endpoints and cluster names are currently set to default + +name: 269.1.2. [TC-EEVSEM-1.2] Cluster attributes with DUT as Server + +PICS: + - EEVSEM.S + +config: + nodeId: 0x12344321 + cluster: "Basic Information" + endpoint: 1 + +tests: + - label: "Step 1: TH reads from the DUT the SupportedModes attribute" + PICS: EEVSEM.S.A0000 + verification: | + ./chip-tool energyevsemode read supported-modes 1 1 + + - Verify that the DUT response contains a list of ModeOptionsStruct entries + - Verify that the list has at least 2 and at most 255 entries + - Verify that each ModeOptionsStruct entry has a unique Mode field value + - Verify that each ModeOptionsStruct entry has a unique Label field value + - Verify that each ModeOptionsStruct entry’s ModeTags field has: + at least one entry the values of the Value fields that are not larger than 16 bits + - for each Value field: Is the mode tag value a defined common tag value (Auto(0x0000), Quick(0x0001), Quiet(0x0002), LowNoise(0x0003), LowEnergy(0x0004), Vacation(0x0005), Min(0x0006), Max(0x0007), Night(0x0008), Day(0x0009)) or a defined cluster-derived tag value (Manual, Time of Use, (T_SOLAR_CHARGING)) or in the MfgTags (0x8000 to 0xBFFF) range + - for at least one Value field: Is the mode tag value a defined common tag value (Auto(0x0000), Quick(0x0001), Quiet(0x0002), LowNoise(0x0003), LowEnergy(0x0004), Vacation(0x0005), Min(0x0006), Max(0x0007), Night(0x0008), Day(0x0009)) or a derived cluster value (Bake(0x4000), Convection(0x4001), Grill(0x4002), Roast(0x4003), Clean(0x4004), Convection Bake(0x4005), Convection Roast(0x4006), Warming(0x4007), Proofing(0x4008)) + - if the Value field is in the MfgTags (0x8000 to 0xBFFF) range, the TagName field is a string with a length between 1 and 64 + - Verify that at least one ModeOptionsStruct entry includes the Manual mode tag + - Save the Mode field values as supported_modes_dut on the TH (Chip-tool) and below is the sample log provided for the raspi platform: + + + [1705995452.973731][7546:7548] CHIP:DMG: } + [1705995452.973843][7546:7548] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_009D Attribute 0x0000_0000 DataVersion: 1324786556 + [1705995452.973865][7546:7548] CHIP:TOO: SupportedModes: 4 entries + [1705995452.973883][7546:7548] CHIP:TOO: [1]: { + [1705995452.973886][7546:7548] CHIP:TOO: Label: Manual + [1705995452.973892][7546:7548] CHIP:TOO: Mode: 0 + [1705995452.973898][7546:7548] CHIP:TOO: ModeTags: 1 entries + [1705995452.973903][7546:7548] CHIP:TOO: [1]: { + [1705995452.973906][7546:7548] CHIP:TOO: Value: 16384 + [1705995452.973909][7546:7548] CHIP:TOO: } + [1705995452.973912][7546:7548] CHIP:TOO: } + [1705995452.973918][7546:7548] CHIP:TOO: [2]: { + [1705995452.973921][7546:7548] CHIP:TOO: Label: Auto-scheduled + [1705995452.973923][7546:7548] CHIP:TOO: Mode: 1 + [1705995452.973926][7546:7548] CHIP:TOO: ModeTags: 1 entries + [1705995452.973930][7546:7548] CHIP:TOO: [1]: { + [1705995452.973933][7546:7548] CHIP:TOO: Value: 16385 + [1705995452.973935][7546:7548] CHIP:TOO: } + [1705995452.973938][7546:7548] CHIP:TOO: } + [1705995452.973943][7546:7548] CHIP:TOO: [3]: { + [1705995452.973946][7546:7548] CHIP:TOO: Label: Solar + [1705995452.973948][7546:7548] CHIP:TOO: Mode: 2 + [1705995452.973951][7546:7548] CHIP:TOO: ModeTags: 1 entries + [1705995452.973955][7546:7548] CHIP:TOO: [1]: { + [1705995452.973957][7546:7548] CHIP:TOO: Value: 16386 + [1705995452.973960][7546:7548] CHIP:TOO: } + [1705995452.973962][7546:7548] CHIP:TOO: } + [1705995452.973968][7546:7548] CHIP:TOO: [4]: { + [1705995452.973971][7546:7548] CHIP:TOO: Label: Auto-scheduled with Solar charging + [1705995452.973973][7546:7548] CHIP:TOO: Mode: 3 + [1705995452.973977][7546:7548] CHIP:TOO: ModeTags: 2 entries + [1705995452.973981][7546:7548] CHIP:TOO: [1]: { + [1705995452.973983][7546:7548] CHIP:TOO: Value: 16385 + [1705995452.973986][7546:7548] CHIP:TOO: } + [1705995452.973989][7546:7548] CHIP:TOO: [2]: { + [1705995452.973992][7546:7548] CHIP:TOO: Value: 16386 + [1705995452.973994][7546:7548] CHIP:TOO: } + [1705995452.973996][7546:7548] CHIP:TOO: } + disabled: true + + - label: "Step 2: TH reads from the DUT the CurrentMode attribute" + PICS: EEVSEM.S.A0001 + verification: | + ./chip-tool energyevsemode read current-mode 1 1 + + Verify on TH(chip-tool) logs, CurrentMode attribute value is an integer value from supported_modes_dut, below is the sample log provided for the raspi platform, Here CurrentMode attribute value is 0 + + [1705995474.391307][7551:7553] CHIP:DMG: } + [1705995474.391347][7551:7553] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_009D Attribute 0x0000_0001 DataVersion: 1324786556 + [1705995474.391367][7551:7553] CHIP:TOO: CurrentMode: 0 + disabled: true diff --git a/src/app/tests/suites/certification/Test_TC_EEVSEM_2_1.yaml b/src/app/tests/suites/certification/Test_TC_EEVSEM_2_1.yaml new file mode 100644 index 00000000000000..90bdf0a46218f6 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_EEVSEM_2_1.yaml @@ -0,0 +1,219 @@ +# Copyright (c) 2024 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: 269.2.1. [TC-EEVSEM-2.1] Change to Mode functionality with DUT as Server + +PICS: + - EEVSEM.S + +config: + nodeId: 0x12344321 + cluster: "Energy EVSE Mode" + endpoint: 1 + + #PIXIT.EEVSEM.MODE_CHANGE_OK + PIXIT.EEVSEM.MODE_CHANGE_OK: + type: int8u + defaultValue: 2 + #PIXIT.EEVSEM.MODE_CHANGE_FAIL + PIXIT.EEVSEM.MODE_CHANGE_FAIL: + type: int8u + defaultValue: 10 + invalid_mode_th: + type: int8u + defaultValue: 15 + +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 reads from the DUT the SupportedModes attribute." + PICS: EEVSEM.S.A0000 + command: "readAttribute" + attribute: "SupportedModes" + response: + saveAs: supported_mode_dut + constraints: + type: list + minLength: 2 + + - label: "Step 3: TH reads from the DUT the CurrentMode attribute." + PICS: EEVSEM.S.A0001 + command: "readAttribute" + attribute: "CurrentMode" + response: + saveAs: old_current_mode_dut + constraints: + type: int8u + minValue: 0 + maxValue: 255 + + - label: + "Step 4: TH sends a ChangeToMode command to the DUT with NewMode set + to old_current_mode_dut" + PICS: EEVSEM.S.C00.Rsp + command: "ChangeToMode" + arguments: + values: + - name: "NewMode" + value: old_current_mode_dut + response: + values: + - name: "Status" + value: 0x00 + + - label: + "Step 5: Manually put the device in a state from which it will FAIL to + transition to PIXIT.EEVSEM.MODE_CHANGE_FAIL" + PICS: + " EEVSEM.S.M.CAN_TEST_MODE_FAILURE && + EEVSEM.S.M.CAN_MANUALLY_CONTROLLED && PICS_SKIP_SAMPLE_APP " + verification: | + Manual operation required + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "Enter 'y' after success" + - name: "expectedValue" + value: "y" + + - label: "Step 6: TH reads from the DUT the CurrentMode attribute" + PICS: EEVSEM.S.A0001 && EEVSEM.S.M.CAN_MANUALLY_CONTROLLED + command: "readAttribute" + attribute: "CurrentMode" + response: + saveAs: Step6_current_mode_dut + constraints: + type: int8u + minValue: 0 + maxValue: 255 + + #Skipping test-7 because SDK is not enabled with this failure response + - label: + "Step 7: TH sends a ChangeToMode command to the DUT with NewMode set + to PIXIT.EEVSEM.MODE_CHANGE_FAIL" + PICS: + EEVSEM.S.M.CAN_TEST_MODE_FAILURE && EEVSEM.S.C00.Rsp && + PICS_SKIP_SAMPLE_APP + verification: | + Note : Please skip this step as SDK is not enabled with this failure response + + ./chip-tool energyevsemode change-to-mode 2 1 1 + + Verify on TH(chip-tool) log, DUT responds contains a ChangeToModeResponse command with Status field is set to GenericFailure(0x02), InvalidInMode(0x03) , or in the MfgCodes (0x80 to 0xBF) range and StatusText field has a length between 1 and 64, below is the sample log provided for the raspi platform: + + [1705995550.805161][7567:7569] CHIP:DMG: }, + [1705995550.805185][7567:7569] CHIP:DMG: Received Command Response Data, Endpoint=1 Cluster=0x0000_009D Command=0x0000_0001 + [1705995550.805197][7567:7569] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_009D Command 0x0000_0001 + [1705995550.805221][7567:7569] CHIP:TOO: ChangeToModeResponse: { + [1705995550.805228][7567:7569] CHIP:TOO: status: 0 + [1705995550.805232][7567:7569] CHIP:TOO: } + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "Enter 'y' after success" + - name: "expectedValue" + value: "y" + + - label: "Step 8: TH reads from the DUT the CurrentMode attribute." + PICS: EEVSEM.S.A0001 + command: "readAttribute" + attribute: "CurrentMode" + response: + value: old_current_mode_dut + constraints: + type: int16u + + - label: + "Step 9: Manually put the device in a state from which it will + SUCCESSFULLY transition to PIXIT.EEVSEM.MODE_CHANGE_OK" + PICS: PICS_SKIP_SAMPLE_APP + verification: | + Manual operation required + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "Enter 'y' after success" + - name: "expectedValue" + value: "y" + + - label: "Step 10: TH reads from the DUT the CurrentMode attribute." + PICS: EEVSEM.S.A0001 && EEVSEM.S.M.CAN_MANUALLY_CONTROLLED + command: "readAttribute" + attribute: "CurrentMode" + response: + saveAs: Step10_current_mode_dut + constraints: + type: int8u + minValue: 0 + maxValue: 255 + + - label: + "Step 11: TH sends a ChangeToMode command to the DUT with NewMode set + to PIXIT.EEVSEM.MODE_CHANGE_OK" + PICS: EEVSEM.S.C00.Rsp + command: "ChangeToMode" + arguments: + values: + - name: "NewMode" + value: PIXIT.EEVSEM.MODE_CHANGE_OK + response: + values: + - name: "Status" + value: 0x00 + + - label: + "Step 12: TH reads from the DUT the CurrentMode attribute. Verify that + the DUT response contains an integer value equal to + PIXIT.EEVSEM.MODE_CHANGE_OK" + PICS: EEVSEM.S.A0001 + command: "readAttribute" + attribute: "CurrentMode" + response: + value: PIXIT.EEVSEM.MODE_CHANGE_OK + + - label: + "Step 13: TH sends a ChangeToMode command to the DUT with NewMode set + to invalid_mode_th" + PICS: EEVSEM.S.C00.Rsp + command: "ChangeToMode" + arguments: + values: + - name: "NewMode" + value: invalid_mode_th + response: + values: + - name: "Status" + value: 0x01 + + - label: + "Step 14: TH reads from the DUT the CurrentMode attribute. Verify that + the DUT response contains an integer value equal to + PIXIT.EEVSEM.MODE_CHANGE_OK" + PICS: EEVSEM.S.A0001 + command: "readAttribute" + attribute: "CurrentMode" + response: + value: PIXIT.EEVSEM.MODE_CHANGE_OK diff --git a/src/app/tests/suites/certification/Test_TC_EEVSEM_3_1.yaml b/src/app/tests/suites/certification/Test_TC_EEVSEM_3_1.yaml new file mode 100644 index 00000000000000..3cf2c6f997742c --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_EEVSEM_3_1.yaml @@ -0,0 +1,134 @@ +# Copyright (c) 2024 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: 183.3.1. [TC-EEVSEM-3.1] On Mode functionality with DUT as Server + +PICS: + - EEVSEM.S.A0003 + - MOD.S.F00 + - OO.S.C00.Rsp + - OO.S.C01.Rsp + +config: + nodeId: 0x12344321 + cluster: "Energy EVSE Mode" + endpoint: 1 + + ConfigureOnMode: + type: int8u + defaultValue: 0 + new_mode_th: + type: int8u + defaultValue: 2 + +tests: + - label: + "Step 1: Commission DUT to TH (can be skipped if done in a preceding + test)." + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: + "Precondition: TH writes from the DUT the OnMode attribute.NOTE: To + execute this test case set onmode to any integer value because as + default it value has null." + PICS: EEVSEM.S.A0003 && MOD.S.F00 + command: "writeAttribute" + attribute: "OnMode" + arguments: + value: ConfigureOnMode + + - label: "Step 2: TH reads from the DUT the OnMode attribute." + PICS: EEVSEM.S.A0003 && MOD.S.F00 + command: "readAttribute" + attribute: "OnMode" + response: + saveAs: on_mode_dut + constraints: + type: int8u + minValue: 0 + maxValue: 254 + + - label: "Step 3: TH reads from the DUT the CurrentMode attribute." + PICS: EEVSEM.S.A0001 && MOD.S.F00 + command: "readAttribute" + attribute: "CurrentMode" + response: + saveAs: old_current_mode_dut + constraints: + type: int8u + minValue: 0 + maxValue: 254 + + - label: + "If on_mode_dut is equal to old_current_mode_dut proceed to step 4. + Else proceed to step 6." + cluster: "EqualityCommands" + command: "UnsignedNumberEquals" + arguments: + values: + - name: "Value1" + value: on_mode_dut + - name: "Value2" + value: old_current_mode_dut + response: + - values: + - name: "Equals" + saveAs: IsExpectedValue + + - label: "Step 4: TH reads from the DUT the SupportedModes attribute." + runIf: IsExpectedValue + PICS: EEVSEM.S.A0000 && MOD.S.F00 + command: "readAttribute" + attribute: "SupportedModes" + response: + constraints: + type: list + minLength: 2 + + - label: + "Step 5: TH sends a ChangeToMode command to the DUT with NewMode set + to new_mode_th" + runIf: IsExpectedValue + PICS: EEVSEM.S.C00.Rsp && MOD.S.F00 + command: "ChangeToMode" + arguments: + values: + - name: "NewMode" + value: new_mode_th + response: + values: + - name: "Status" + value: 0x00 + + - label: "Step 6:TH sends a Off command to the DUT" + PICS: OO.S.C00.Rsp + cluster: "On/Off" + command: "Off" + + - label: "Step 7:TH sends a On command to the DUT" + PICS: OO.S.C01.Rsp + cluster: "On/Off" + command: "On" + + - label: "Step 8: TH reads from the DUT the CurrentMode attribute." + PICS: EEVSEM.S.A0001 + command: "readAttribute" + attribute: "CurrentMode" + response: + value: on_mode_dut diff --git a/src/app/tests/suites/certification/Test_TC_EEVSEM_3_2.yaml b/src/app/tests/suites/certification/Test_TC_EEVSEM_3_2.yaml new file mode 100644 index 00000000000000..0251528f9ffe94 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_EEVSEM_3_2.yaml @@ -0,0 +1,172 @@ +# Copyright (c) 2024 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: 269.3.2. [TC-EEVSEM-3.2] Startup Mode functionality with DUT as Server + +PICS: + - EEVSEM.S.A0002 + +config: + nodeId: 0x12344321 + cluster: "Energy EVSE Mode" + endpoint: 1 + + new_start_up_mode_th: + type: int8u + defaultValue: 0 + new_mode_th: + type: int8u + defaultValue: 1 + +tests: + - label: + "Step 1: Commission DUT to TH (can be skipped if done in a preceding + test)." + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "Step 2: TH reads from the DUT the StartUpMode attribute." + PICS: EEVSEM.S.A0002 + command: "readAttribute" + attribute: "StartUpMode" + response: + saveAs: startup_mode_dut + + - label: + "Step 2: If startup_mode_dut is null proceed to step 3. Else save + startup_mode_dut as new_start_up_mode_th and proceed to step 5." + PICS: EEVSEM.S.A0002 + cluster: "EqualityCommands" + command: "UnsignedNumberEquals" + arguments: + values: + - name: "Value1" + value: startup_mode_dut + - name: "Value2" + value: null + response: + - values: + - name: "Equals" + saveAs: IsExpectedValue + + - label: "Step 3: TH reads from the DUT the SupportedModes attribute." + runIf: IsExpectedValue + PICS: EEVSEM.S.A0000 + command: "readAttribute" + attribute: "SupportedModes" + response: + saveAs: supported_modes_dut + constraints: + type: list + minLength: 2 + - label: + "Step 4: TH writes to the DUT the StartUpMode attribute with the + new_start_up_mode_th value" + PICS: EEVSEM.S.A0002 + runIf: IsExpectedValue + command: "writeAttribute" + attribute: "StartUpMode" + arguments: + value: new_start_up_mode_th + + - label: "Step 5: TH reads from the DUT the CurrentMode attribute." + PICS: EEVSEM.S.A0001 + command: "readAttribute" + attribute: "CurrentMode" + response: + saveAs: old_current_mode_dut + + - label: + "Step 5: If startup_mode_dut is equal to old_current_mode_dut proceed + to step 6. Else proceed to step 8." + PICS: EEVSEM.S.A0001 && EEVSEM.S.A0002 + cluster: "EqualityCommands" + command: "UnsignedNumberEquals" + arguments: + values: + - name: "Value1" + value: startup_mode_dut + - name: "Value2" + value: old_current_mode_dut + response: + - values: + - name: "Equals" + saveAs: Step5_IsExpectedValue + + - label: "Step 6: TH reads from the DUT the SupportedModes attribute." + PICS: EEVSEM.S.A0000 + runIf: Step5_IsExpectedValue + command: "readAttribute" + attribute: "SupportedModes" + response: + saveAs: Step6_supported_modes_dut + constraints: + type: list + minLength: 2 + + - label: + "Step 7: TH sends a ChangeToMode command to the DUT with NewMode set + to new_mode_th" + PICS: EEVSEM.S.C00.Rsp + runIf: Step5_IsExpectedValue + command: "ChangeToMode" + arguments: + values: + - name: "NewMode" + value: new_mode_th + response: + values: + - name: "Status" + value: 0x00 + + - label: "Step 8: Physically power cycle the device" + verification: | + Physically power cycle the device. + cluster: "LogCommands" + command: "UserPrompt" + PICS: PICS_USER_PROMPT + arguments: + values: + - name: "message" + value: "Please enter 'y' for success" + - name: "expectedValue" + value: "y" + + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "Step 9: TH reads from the DUT the StartUpMode attribute." + PICS: EEVSEM.S.A0002 && PICS_USER_PROMPT + command: "readAttribute" + attribute: "StartUpMode" + response: + saveAs: new_start_up_mode_dut + constraints: + anyOf: [startup_mode_dut, new_start_up_mode_th] + + - label: "Step 10: TH reads from the DUT the CurrentMode attribute." + PICS: EEVSEM.S.A0001 && PICS_USER_PROMPT + command: "readAttribute" + attribute: "CurrentMode" + response: + value: new_start_up_mode_dut diff --git a/src/app/tests/suites/certification/Test_TC_EEVSEM_3_3.yaml b/src/app/tests/suites/certification/Test_TC_EEVSEM_3_3.yaml new file mode 100644 index 00000000000000..e60aa1ca60c740 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_EEVSEM_3_3.yaml @@ -0,0 +1,189 @@ +# Copyright (c) 2024 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: + 269.3.3. [TC-EEVSEM-3.3] On Mode and Startup Mode functionality with DUT as + Server + +PICS: + - EEVSEM.S.A0002 + - EEVSEM.S.A0003 + - MOD.S.F00 + - OO.S.A4003 + +config: + nodeId: 0x12344321 + cluster: "Energy EVSE Mode" + endpoint: 1 + + new_start_up_mode_th: + type: int8u + defaultValue: 0 + new_mode_th: + type: int8u + defaultValue: 1 + +tests: + - label: + "Step 1: Commission DUT to TH (can be skipped if done in a preceding + test)." + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "Step 2: TH reads from the DUT the StartUpMode attribute." + PICS: EEVSEM.S.A0002 + command: "readAttribute" + attribute: "StartUpMode" + response: + saveAs: startup_mode_dut + + - label: + "Step 2: If startup_mode_dut is null proceed to step 3. Else save + startup_mode_dut as new_start_up_mode_th and proceed to step 5." + PICS: EEVSEM.S.A0002 + cluster: "EqualityCommands" + command: "UnsignedNumberEquals" + arguments: + values: + - name: "Value1" + value: startup_mode_dut + - name: "Value2" + value: null + response: + - values: + - name: "Equals" + saveAs: IsExpectedValue + + - label: "Step 3: TH reads from the DUT the SupportedModes attribute." + runIf: IsExpectedValue + PICS: EEVSEM.S.A0000 + command: "readAttribute" + attribute: "SupportedModes" + response: + saveAs: supported_modes_dut + constraints: + type: list + minLength: 2 + + - label: + "Step 4: TH writes to the DUT the StartUpMode attribute with the + new_start_up_mode_th value" + PICS: EEVSEM.S.A0002 + runIf: IsExpectedValue + command: "writeAttribute" + attribute: "StartUpMode" + arguments: + value: new_start_up_mode_th + + - label: "Step 5: TH reads from the DUT the OnMode attribute." + PICS: EEVSEM.S.A0003 && EEVSEM.S.A0002 + command: "readAttribute" + attribute: "OnMode" + response: + saveAs: old_on_mode_dut + + - label: + "Step 5: If startup_mode_dut is equal to old_on_mode_dut proceed to + step 6. Else proceed to step 8." + PICS: EEVSEM.S.A0002 + cluster: "EqualityCommands" + command: "UnsignedNumberEquals" + arguments: + values: + - name: "Value1" + value: old_on_mode_dut + - name: "Value2" + value: startup_mode_dut + response: + - values: + - name: "Equals" + saveAs: Step5_IsExpectedValue + + - label: "Step 6: TH reads from the DUT the SupportedModes attribute." + PICS: EEVSEM.S.A0000 && EEVSEM.S.A0002 + runIf: Step5_IsExpectedValue + command: "readAttribute" + attribute: "SupportedModes" + response: + saveAs: Step6_supported_modes_dut + constraints: + type: list + minLength: 2 + + - label: + "Step 7: TH writes to the DUT the OnMode attribute with the + new_mode_th value" + PICS: EEVSEM.S.A0003 + runIf: Step5_IsExpectedValue + command: "writeAttribute" + attribute: "OnMode" + arguments: + value: new_mode_th + + - label: "Step 8: TH reads from the DUT the OnMode attribute." + PICS: EEVSEM.S.A0003 && MOD.S.F00 + command: "readAttribute" + attribute: "OnMode" + response: + saveAs: new_on_mode_dut + + - label: + "Step 9: TH writes to the DUT the StartUpOnOff attribute with the + value 1." + PICS: OO.S.A4003 + cluster: "On/Off" + command: "writeAttribute" + attribute: "StartUpOnOff" + arguments: + value: 1 + + - label: "Step 10: Physically power cycle the device" + verification: | + Physically power cycle the device. + cluster: "LogCommands" + command: "UserPrompt" + PICS: PICS_USER_PROMPT + arguments: + values: + - name: "message" + value: "Please enter 'y' for success" + - name: "expectedValue" + value: "y" + + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "Step 11: TH reads from the DUT the StartUpMode attribute." + PICS: EEVSEM.S.A0002 && PICS_USER_PROMPT + command: "readAttribute" + attribute: "StartUpMode" + response: + constraints: + anyOf: [new_start_up_mode_th, startup_mode_dut] + + - label: "Step 12: TH reads from the DUT the CurrentMode attribute." + PICS: EEVSEM.S.A0001 && PICS_USER_PROMPT + command: "readAttribute" + attribute: "CurrentMode" + response: + value: new_on_mode_dut diff --git a/src/app/tests/suites/certification/Test_TC_EEVSE_1_1.yaml b/src/app/tests/suites/certification/Test_TC_EEVSE_1_1.yaml index 44932851b0343c..0be6a9015ed5e9 100644 --- a/src/app/tests/suites/certification/Test_TC_EEVSE_1_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_EEVSE_1_1.yaml @@ -1,4 +1,4 @@ -# Copyright (c) 2023 Project CHIP Authors +# Copyright (c) 2024 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. @@ -11,129 +11,291 @@ # 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. -# Auto-generated scripts for harness use only, please review before automation. The endpoints and cluster names are currently set to default -name: 272.1.1. [TC-EEVSE-1.1] Global Attributes with DUT as Server +name: 265.1.1. [TC-EEVSE-1.1] Global Attributes with DUT as Server PICS: - EEVSE.S config: nodeId: 0x12344321 - cluster: "Basic Information" - endpoint: 0 + cluster: "Energy EVSE" + endpoint: 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 reads from the DUT the ClusterRevision attribute" + command: "readAttribute" + attribute: "ClusterRevision" + response: + value: 2 + constraints: + type: int16u + + - label: "Step 3a: TH reads from the DUT the FeatureMap attribute" + PICS: + "!EEVSE.S.F00 && !EEVSE.S.F01 && !EEVSE.S.F02 && !EEVSE.S.F03 && + !EEVSE.S.F04" + command: "readAttribute" + attribute: "FeatureMap" + response: + value: 0 + constraints: + type: bitmap32 + + - label: + "Step 3b: Given EEVSE.S.F00(ChargingPreferences) ensure featuremap has + the correct bit set" + PICS: EEVSE.S.F00 + command: "readAttribute" + attribute: "FeatureMap" + response: + constraints: + type: bitmap32 + hasMasksSet: [0x1] + + - label: + "Step 3b: Given EEVSE.S.F01(SoCReporting) ensure featuremap has the + correct bit set" + PICS: EEVSE.S.F01 + command: "readAttribute" + attribute: "FeatureMap" + response: + constraints: + type: bitmap32 + hasMasksSet: [0x2] + + - label: + "Step 3b: Given EEVSE.S.F02(PlugAndCharge) ensure featuremap has the + correct bit set" + PICS: EEVSE.S.F02 + command: "readAttribute" + attribute: "FeatureMap" + response: + constraints: + type: bitmap32 + hasMasksSet: [0x4] + + - label: + "Step 3b: Given EEVSE.S.F03(RFID) ensure featuremap has the correct + bit set" + PICS: EEVSE.S.F03 + command: "readAttribute" + attribute: "FeatureMap" + response: + constraints: + type: bitmap32 + hasMasksSet: [0x8] + + - label: + "Step 3b: Given EEVSE.S.F04(V2X) ensure featuremap has the correct bit + set" + PICS: EEVSE.S.F04 + command: "readAttribute" + attribute: "FeatureMap" + response: + constraints: + type: bitmap32 + hasMasksSet: [0x10] + + - label: "Step 4a: TH reads from the DUT the AttributeList attribute" + PICS: PICS_EVENT_LIST_ENABLED + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: + [ + 0, + 1, + 2, + 3, + 5, + 6, + 7, + 64, + 65, + 66, + 65528, + 65529, + 65530, + 65531, + 65532, + 65533, + ] + + - label: "Step 4a: TH reads AttributeList from DUT" + PICS: "!PICS_EVENT_LIST_ENABLED" + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: + [ + 0, + 1, + 2, + 3, + 5, + 6, + 7, + 64, + 65, + 66, + 65528, + 65529, + 65531, + 65532, + 65533, + ] + + - label: + "Step 4b: TH reads optional attribute (UserMaximumChargeCurrent) in + AttributeList from DUT" + PICS: EEVSE.S.A0009 + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [9] + + - label: + "Step 4c: TH reads optional attribute (RandomizationDelayWindow) in + AttributeList from DUT" + PICS: EEVSE.S.A000A + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [10] + + - label: + "Step 4d: TH reads optional attribute (V2X) in AttributeList from DUT" + PICS: EEVSE.S.F04 + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [4, 8, 67] + + - label: + "Step 4e: TH reads optional attribute (ChargingPreferences) in + AttributeList from DUT" + PICS: EEVSE.S.F00 + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [35, 36, 37, 38, 39] + + - label: + "Step 4e: TH reads optional attribute (SoCReporting) in AttributeList + from DUT" + PICS: EEVSE.S.F01 + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [48, 49] + + - label: + "Step 4f: TH reads optional attribute (PlugAndCharge) in AttributeList + from DUT" + PICS: EEVSE.S.F02 + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [50] + + - label: "Step 5a: TH reads EventList from DUT" + PICS: PICS_EVENT_LIST_ENABLED + command: "readAttribute" + attribute: "EventList" + response: + constraints: + type: list + contains: [0, 1, 2, 3, 4] + + - label: "Step 5b: TH reads optional attribute (RFID) in EventList from DUT" + PICS: EEVSE.S.F03 && PICS_EVENT_LIST_ENABLED + command: "readAttribute" + attribute: "EventList" + response: + constraints: + type: list + contains: [5] + + - label: "Step 6a: TH reads AcceptedCommandList from DUT" + command: "readAttribute" + attribute: "AcceptedCommandList" + response: + constraints: + type: list + contains: [1, 2] + + - label: + "Step 6b: TH reads the optional (StartDiagnostics) command in + AcceptedCommandList" + PICS: EEVSE.S.C04.Rsp + command: "readAttribute" + attribute: "AcceptedCommandList" + response: + constraints: + type: list + contains: [4] + - label: - "Step 1: Commission DUT to TH (can be skipped if done in a preceding - test)." - verification: | - - disabled: true - - - label: "Step 2: TH reads from the DUT the ClusterRevision attribute." - verification: | - ./chip-tool energyevse read cluster-revision 1 1 - - On TH(chip-tool), Verify the ClusterRevision attribute value as 2: - Below mentioned log is based on the RPI implementation, Value may vary on real DUT - - [1703744384.239486][1259:1261] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0099 Attribute 0x0000_FFFD DataVersion: 1471857723 - [1703744384.239529][1259:1261] CHIP:TOO: ClusterRevision: 2 - disabled: true - - - label: "Step 3: TH reads from the DUT the FeatureMap attribute." - verification: | - ./chip-tool energyevse read feature-map 1 1 - - Via the TH (chip-tool), verify that theFeatureMap attribute contains the value. Below mentioned log is based on the RPI implementation, Value may vary on real DUT - - - [1703744496.721907][1265:1267] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0099 Attribute 0x0000_FFFC DataVersion: 1471857723 - [1703744496.721955][1265:1267] CHIP:TOO: FeatureMap: 31 - disabled: true - - - label: "Step 4: TH reads from the DUT the AttributeList attribute." - verification: | - ./chip-tool energyevse read attribute-list 1 1 - - Via the TH (chip-tool), verify that theAttributeListattribute contains - - Mandatory entries:0x0000, 0x0001, 0x0002, 0x0003, 0x0005, 0x0006, 0x0007, 0x0040, 0x0041, 0x0042 0xfff8, 0xfff9, 0xfffb, 0xfffc and 0xfffd - - Optional entries: 0x0009, 0x000A - - Based on feature support:- 0x0004, 0x0008, 0x0043, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0030, 0x0031, 0x0032 - Below mentioned log is based on the RPI implementation, Value may vary on real DUT - - [1705654173.130338][6375:6377] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0099 Attribute 0x0000_FFFB DataVersion: 1462274739 - [1705654173.130427][6375:6377] CHIP:TOO: AttributeList: 28 entries - [1705654173.130469][6375:6377] CHIP:TOO: [1]: 0 - [1705654173.130506][6375:6377] CHIP:TOO: [2]: 1 - [1705654173.130529][6375:6377] CHIP:TOO: [3]: 2 - [1705654173.130551][6375:6377] CHIP:TOO: [4]: 3 - [1705654173.130574][6375:6377] CHIP:TOO: [5]: 4 - [1705654173.130608][6375:6377] CHIP:TOO: [6]: 5 - [1705654173.130631][6375:6377] CHIP:TOO: [7]: 6 - [1705654173.130664][6375:6377] CHIP:TOO: [8]: 7 - [1705654173.130687][6375:6377] CHIP:TOO: [9]: 8 - [1705654173.130710][6375:6377] CHIP:TOO: [10]: 9 - [1705654173.130744][6375:6377] CHIP:TOO: [11]: 10 - [1705654173.130769][6375:6377] CHIP:TOO: [12]: 35 - [1705654173.130801][6375:6377] CHIP:TOO: [13]: 36 - [1705654173.130826][6375:6377] CHIP:TOO: [14]: 37 - [1705654173.130849][6375:6377] CHIP:TOO: [15]: 38 - [1705654173.130883][6375:6377] CHIP:TOO: [16]: 39 - [1705654173.130907][6375:6377] CHIP:TOO: [17]: 48 - [1705654173.130930][6375:6377] CHIP:TOO: [18]: 49 - [1705654173.130964][6375:6377] CHIP:TOO: [19]: 50 - [1705654173.130988][6375:6377] CHIP:TOO: [20]: 64 - [1705654173.131021][6375:6377] CHIP:TOO: [21]: 65 - [1705654173.131045][6375:6377] CHIP:TOO: [22]: 66 - [1705654173.131068][6375:6377] CHIP:TOO: [23]: 67 - [1705654173.131101][6375:6377] CHIP:TOO: [24]: 65528 - [1705654173.131126][6375:6377] CHIP:TOO: [25]: 65529 - [1705654173.131149][6375:6377] CHIP:TOO: [26]: 65531 - [1705654173.131182][6375:6377] CHIP:TOO: [27]: 65532 - [1705654173.131205][6375:6377] CHIP:TOO: [28]: 65533 - disabled: true - - - label: "Step 5*: TH reads from the DUT the EventList attribute." - verification: | - EventList is currently not supported and SHALL be skipped. - - ./chip-tool energyevse read event-list 1 1 - - Via the TH (chip-tool), verify that the EventList attribute. Below mentioned log is based on the RPI implementation, Value may vary on real DUT - - [1703745599.166331][1300:1302] CHIP:DMG: StatusIB = - [1703745599.166364][1300:1302] CHIP:DMG: { - [1703745599.166419][1300:1302] CHIP:DMG: status = 0x86 (UNSUPPORTED_ATTRIBUTE), - [1703745599.166450][1300:1302] CHIP:DMG: }, - disabled: true - - - label: "Step 6: TH reads from the DUT the AcceptedCommandList attribute." - verification: | - ./chip-tool energyevse read accepted-command-list 1 1 - - On TH(chip-tool), Verify the AcceptedCommandList attribute that contains 7 entries: - Below mentioned log is based on the RPI implementation, Value may vary on real DUT - - [1703745620.007744][1304:1306] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0099 Attribute 0x0000_FFF9 DataVersion: 1471857723 - [1703745620.007809][1304:1306] CHIP:TOO: AcceptedCommandList: 7 entries - [1703745620.007838][1304:1306] CHIP:TOO: [1]: 1 - [1703745620.007862][1304:1306] CHIP:TOO: [2]: 2 - [1703745620.007886][1304:1306] CHIP:TOO: [3]: 3 - [1703745620.007909][1304:1306] CHIP:TOO: [4]: 5 - [1703745620.007931][1304:1306] CHIP:TOO: [5]: 6 - [1703745620.007954][1304:1306] CHIP:TOO: [6]: 7 - [1703745620.007977][1304:1306] CHIP:TOO: [7]: 4 - disabled: true - - - label: "Step 7: TH reads from the DUT the GeneratedCommandList attribute." - verification: | - ./chip-tool energyevse read generated-command-list 1 1 - - On TH(chip-tool), Verify the GeneratedCommandList attribute that contains 1 entries: - - [1703745647.799108][1307:1309] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0099 Attribute 0x0000_FFF8 DataVersion: 1471857723 - [1703745647.799167][1307:1309] CHIP:TOO: GeneratedCommandList: 1 entries - [1703745647.799197][1307:1309] CHIP:TOO: [1]: 0 - disabled: true + "Step 6c: TH reads Feature dependent commands(EEVSE.S.F04) in + AcceptedCommandList" + PICS: EEVSE.S.F04 + command: "readAttribute" + attribute: "AcceptedCommandList" + response: + constraints: + type: list + contains: [3] + + - label: + "Step 6d: TH reads Feature dependent commands(ChargingPreferences) in + AcceptedCommandList" + PICS: EEVSE.S.F00 + command: "readAttribute" + attribute: "AcceptedCommandList" + response: + constraints: + type: list + contains: [5, 6, 7] + + - label: "Step 7a: TH reads GeneratedCommandList from DUT" + PICS: " !EEVSE.S.F00 " + command: "readAttribute" + attribute: "GeneratedCommandList" + response: + value: [] + constraints: + type: list + + - label: "Step 7b: TH reads GeneratedCommandList from DUT" + PICS: EEVSE.S.F00 + command: "readAttribute" + attribute: "GeneratedCommandList" + response: + constraints: + type: list + contains: [0] diff --git a/src/app/tests/suites/certification/Test_TC_EEVSE_2_1.yaml b/src/app/tests/suites/certification/Test_TC_EEVSE_2_1.yaml index f1ea0b28385634..a448a969c7e44e 100644 --- a/src/app/tests/suites/certification/Test_TC_EEVSE_2_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_EEVSE_2_1.yaml @@ -11,333 +11,278 @@ # 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. -# Auto-generated scripts for harness use only, please review before automation. The endpoints and cluster names are currently set to default -name: 266.1.2. [TC-EEVSE-2.1] Attributes with DUT as Server +name: 265.1.2. [TC-EEVSE-2.1] Attributes with DUT as Server PICS: - EEVSE.S config: - nodeId: "0x12344321" - cluster: "Basic Information" - endpoint: 0 + nodeId: 0x12344321 + cluster: "Energy EVSE" + endpoint: 1 tests: - - label: - "Step 1: Commission DUT to TH (can be skipped if done in a preceding - test)." - verification: | - - disabled: true - - - label: "Step 2: TH reads from the DUT the State attribute." - verification: | - ./chip-tool energyevse read state 1 1 - - On TH(chip-tool), Verify the State value between 0 and 6 inclusive. - - [1703746501.478667][1324:1326] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0099 Attribute 0x0000_0000 DataVersion: 1471857723 - [1703746501.482885][1324:1326] CHIP:TOO: State: 0 - disabled: true - - - label: "Step 3: TH reads from the DUT the SupplyState attribute." + - 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 reads from the DUT the State attribute" + command: "readAttribute" + attribute: "State" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 6 + + - label: "Step 3: TH reads from the DUT the SupplyState attribute" PICS: EEVSE.S.A0001 - verification: | - ./chip-tool energyevse read supply-state 1 1 - - On TH(chip-tool), Verify the SupplyState value between 0 and 4 inclusive. - - [1703746567.014836][1331:1333] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0099 Attribute 0x0000_0001 DataVersion: 1471857723 - [1703746567.014912][1331:1333] CHIP:TOO: SupplyState: 0 - disabled: true - - - label: "Step 4: TH reads from the DUT the FaultState attribute." + command: "readAttribute" + attribute: "SupplyState" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 4 + + - label: "Step 4: TH reads from the DUT the FaultState attribute" PICS: EEVSE.S.A0002 - verification: | - ./chip-tool energyevse read fault-state 1 1 - - On TH(chip-tool), Verify the FaultState value between 0 to 15 and 255 inclusive. - - [1703746609.539647][1339:1341] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0099 Attribute 0x0000_0002 DataVersion: 1471857723 - [1703746609.539748][1339:1341] CHIP:TOO: FaultState: 0 - disabled: true - - - label: "Step 5: TH reads from the DUT the ChargingEnabledUntil attribute." + command: "readAttribute" + attribute: "FaultState" + response: + constraints: + type: enum8 + anyOf: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 255] + + - label: "Step 5: TH reads from the DUT the ChargingEnabledUntil attribut" PICS: EEVSE.S.A0003 - verification: | - ./chip-tool energyevse read charging-enabled-until 1 1 - - On TH(chip-tool), Verify the ChargingEnabledUntil attribute contains epoch-s value or null. - - [1703746659.995945][1410:1412] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0099 Attribute 0x0000_0003 DataVersion: 1471857723 - [1703746659.996071][1410:1412] CHIP:TOO: ChargingEnabledUntil: null - disabled: true + command: "readAttribute" + attribute: "ChargingEnabledUntil" + response: + constraints: + type: epoch-s + minValue: 0 + maxValue: 4294967295 - label: - "Step 6: TH reads from the DUT the DischargingEnabledUntil attribute." + "Step 6: TH reads from the DUT the DischargingEnabledUntil attribute" PICS: EEVSE.S.A0004 - verification: | - ./chip-tool energyevse read discharging-enabled-until 1 1 - - On TH(chip-tool), Verify the DischargingEnabledUntil attribute contains epoch-s value or null. - - [1703746787.751096][1849:1851] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0099 Attribute 0x0000_0004 DataVersion: 1471857723 - [1703746787.751173][1849:1851] CHIP:TOO: DischargingEnabledUntil: null - disabled: true - - - label: "Step 7: TH reads from the DUT the CircuitCapacity attribute." + command: "readAttribute" + attribute: "DischargingEnabledUntil" + response: + constraints: + type: epoch-s + minValue: 0 + maxValue: 4294967295 + + - label: "Step 7: TH reads from the DUT the CircuitCapacity attribute" PICS: EEVSE.S.A0005 - verification: | - ./chip-tool energyevse read circuit-capacity 1 1 - - On TH(chip-tool), Verify the CircuitCapacity contains an amperage-mA value is in the range of 0 to 80000. - - [1703746836.529283][1855:1857] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0099 Attribute 0x0000_0005 DataVersion: 1471857723 - [1703746836.529406][1855:1857] CHIP:TOO: CircuitCapacity: 0 - disabled: true - - - label: "Step 8: TH reads from the DUT the MinimumChargeCurrent attribute." + command: "readAttribute" + attribute: "CircuitCapacity" + response: + constraints: + type: amperage_ma + minValue: 0 + maxValue: 80000 + + - label: "Step 8: TH reads from the DUT the MinimumChargeCurrent attribute" PICS: EEVSE.S.A0006 - verification: | - ./chip-tool energyevse read minimum-charge-current 1 1 - - On TH(chip-tool), Verify the MinimumChargeCurrent contains an amperage-mA value is in the range of 0 to 80000. - - [1703746900.151431][1861:1863] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0099 Attribute 0x0000_0006 DataVersion: 1471857723 - [1703746900.151511][1861:1863] CHIP:TOO: MinimumChargeCurrent: 6000 - disabled: true - - - label: "Step 9: TH reads from the DUT the MaximumChargeCurrent attribute." + command: "readAttribute" + attribute: "MinimumChargeCurrent" + response: + constraints: + type: amperage_ma + minValue: 0 + maxValue: 80000 + + - label: "Step 9: TH reads from the DUT the MaximumChargeCurrent attribute" PICS: EEVSE.S.A0007 - verification: | - ./chip-tool energyevse read maximum-charge-current 1 1 - - On TH(chip-tool), Verify the MaximumChargeCurrent contains an amperage-mA value is in the range of 0 80000. - - [1703746980.955341][1866:1868] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0099 Attribute 0x0000_0007 DataVersion: 1471857723 - [1703746980.955401][1866:1868] CHIP:TOO: MaximumChargeCurrent: 0 - disabled: true + command: "readAttribute" + attribute: "MaximumChargeCurrent" + response: + constraints: + type: amperage_ma + minValue: 0 + maxValue: 80000 - label: - "Step 10: TH reads from the DUT the MaximumDischargeCurrent attribute." + "Step 10: TH reads from the DUT the MaximumDischargeCurrent attribute" PICS: EEVSE.S.A0008 - verification: | - ./chip-tool energyevse read maximum-discharge-current 1 1 - - On TH(chip-tool), Verify the MaximumDischargeCurrent contains an amperage-mA value is in the range of 0 80000. - - [1703747035.548962][1870:1872] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0099 Attribute 0x0000_0008 DataVersion: 1471857723 - [1703747035.549016][1870:1872] CHIP:TOO: MaximumDischargeCurrent: 0 - disabled: true + command: "readAttribute" + attribute: "MaximumDischargeCurrent" + response: + constraints: + type: amperage_ma + minValue: 0 + maxValue: 80000 - label: "Step 11: TH writes to the DUT the UserMaximumChargeCurrent attribute - value 30000." + value 3000" PICS: EEVSE.S.A0009 - verification: | - ./chip-tool energyevse write user-maximum-charge-current 30000 1 1 - - On TH(chip-tool), Verify the SUCCESS response for UserMaximumChargeCurrent attribute successful write. - - [1703747211.562507][1880:1882] CHIP:DMG: StatusIB = - [1703747211.562536][1880:1882] CHIP:DMG: { - [1703747211.562599][1880:1882] CHIP:DMG: status = 0x00 (SUCCESS), - [1703747211.562629][1880:1882] CHIP:DMG: }, - [1703747211.562677][1880:1882] CHIP:DMG: - [1703747211.562703][1880:1882] CHIP:DMG: }, - disabled: true + command: "writeAttribute" + attribute: "UserMaximumChargeCurrent" + arguments: + value: 30000 - label: "Step 11a: TH reads from the DUT the UserMaximumChargeCurrent - attribute." + attribute" PICS: EEVSE.S.A0009 - verification: | - ./chip-tool energyevse read user-maximum-charge-current 1 1 - - On TH(chip-tool), Verify the UserMaximumChargeCurrent attribute contains the amperage-mA value 30000. - - [1703747252.643892][1886:1888] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0099 Attribute 0x0000_0009 DataVersion: 1471857725 - [1703747252.643979][1886:1888] CHIP:TOO: UserMaximumChargeCurrent: 30000 - disabled: true + command: "readAttribute" + attribute: "UserMaximumChargeCurrent" + response: + value: 30000 + constraints: + type: amperage_ma - label: "Step 12: TH writes to the DUT the RandomizationDelayWindow attribute - value 600." + value 600" PICS: EEVSE.S.A000A - verification: | - ./chip-tool energyevse write randomization-delay-window 600 1 1 - - On TH(chip-tool), Verify the SUCCESS response for RandomizationDelayWindow attribute successful write. - - [1703747329.583214][1890:1892] CHIP:DMG: StatusIB = - [1703747329.583244][1890:1892] CHIP:DMG: { - [1703747329.583273][1890:1892] CHIP:DMG: status = 0x00 (SUCCESS), - [1703747329.583301][1890:1892] CHIP:DMG: }, - disabled: true + command: "writeAttribute" + attribute: "RandomizationDelayWindow" + arguments: + value: 600 - label: "Step 12a: TH reads from the DUT the RandomizationDelayWindow - attribute." + attribute" PICS: EEVSE.S.A000A - verification: | - ./chip-tool energyevse read randomization-delay-window 1 1 - - On TH(chip-tool), Verify the RandomizationDelayWindow attribute contains elapsed-s value 600. - - [1703747373.495538][1893:1895] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0099 Attribute 0x0000_000A DataVersion: 1471857726 - [1703747373.495591][1893:1895] CHIP:TOO: RandomizationDelayWindow: 600 - disabled: true - - - label: "Step 13: TH reads from the DUT the NextChargeStartTime attribute." + command: "readAttribute" + attribute: "RandomizationDelayWindow" + response: + value: 600 + constraints: + type: elapsed_s + + - label: "Step 13: TH reads from the DUT the NextChargeStartTime attribute" PICS: EEVSE.S.A0023 - verification: | - ./chip-tool energyevse read next-charge-start-time 1 1 - - On TH(chip-tool), Verify the NextChargeStartTime attribute contains epoch-s value or null. - - [1703747468.300635][1902:1904] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0099 Attribute 0x0000_0023 DataVersion: 1471857726 - [1703747468.300690][1902:1904] CHIP:TOO: NextChargeStartTime: null - disabled: true - - - label: - "Step 14: TH reads from the DUT the NextChargeTargetTime attribute." + command: "readAttribute" + attribute: "NextChargeStartTime" + response: + constraints: + type: epoch-s + minValue: 0 + maxValue: 4294967295 + + - label: "Step 14: TH reads from the DUT the NextChargeTargetTime attribute" PICS: EEVSE.S.A0024 - verification: | - ./chip-tool energyevse read next-charge-target-time 1 1 - - On TH(chip-tool), Verify the NextChargeTargetTime attribute contains epoch-s value or null. - - [1703747509.059648][1906:1908] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0099 Attribute 0x0000_0024 DataVersion: 1471857726 - [1703747509.059700][1906:1908] CHIP:TOO: NextChargeTargetTime: null - disabled: true + command: "readAttribute" + attribute: "NextChargeTargetTime" + response: + constraints: + type: epoch-s + minValue: 0 + maxValue: 4294967295 - label: - "Step 15: TH reads from the DUT the NextChargeRequiredEnergy - attribute." + "Step 15: TH reads from the DUT the NextChargeRequiredEnergy attribute" PICS: EEVSE.S.A0025 - verification: | - ./chip-tool energyevse read next-charge-required-energy 1 1 - - On TH(chip-tool), Verify the NextChargeRequiredEnergy attribute energy-mWh value is in the valid range(min 0) or null. - - [1703747579.793082][1917:1919] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0099 Attribute 0x0000_0025 DataVersion: 1471857726 - [1703747579.793170][1917:1919] CHIP:TOO: NextChargeRequiredEnergy: null - disabled: true - - - label: "Step 16: TH reads from the DUT the NextChargeTargetSoC attribute." + command: "readAttribute" + attribute: "NextChargeRequiredEnergy" + response: + constraints: + type: energy-mWh + minValue: 0 + + - label: "Step 16: TH reads from the DUT the NextChargeTargetSoC attribute" PICS: EEVSE.S.A0026 - verification: | - ./chip-tool energyevse read next-charge-target-so-c 1 1 - - On TH(chip-tool), Verify the NextChargeTargetSoC attribute contains a percent value, or null. - - [1703747625.575922][1922:1924] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0099 Attribute 0x0000_0026 DataVersion: 1471857726 - [1703747625.576013][1922:1924] CHIP:TOO: NextChargeTargetSoC: null - disabled: true + command: "readAttribute" + attribute: "NextChargeTargetSoC" + response: + constraints: + type: percent + minValue: 0 + maxValue: 100 - label: "Step 17: TH writes to the DUT the ApproximateEVEfficiency attribute - value 3500." + value 3500" PICS: EEVSE.S.A0027 - verification: | - ./chip-tool energyevse write approximate-evefficiency 3500 1 1 - - On TH(chip-tool), Verify the SUCCESS response for ApproximateEVEfficiency attribute successful write. - - [1703747688.527575][1927:1929] CHIP:DMG: StatusIB = - [1703747688.527603][1927:1929] CHIP:DMG: { - [1703747688.527631][1927:1929] CHIP:DMG: status = 0x00 (SUCCESS), - [1703747688.527678][1927:1929] CHIP:DMG: }, - disabled: true + command: "writeAttribute" + attribute: "ApproximateEVEfficiency" + arguments: + value: 3500 - label: - "Step 17a: TH reads from the DUT the ApproximateEVEfficiency - attribute." + "Step 17a: TH reads from the DUT the ApproximateEVEfficiency attribute" PICS: EEVSE.S.A0027 - verification: | - ./chip-tool energyevse read approximate-evefficiency 1 1 - - On TH(chip-tool), Verify the ApproximateEVEfficiency attribute contains the uint16 value 3500. - - [1703747727.592819][1930:1932] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0099 Attribute 0x0000_0027 DataVersion: 1471857728 - [1703747727.592870][1930:1932] CHIP:TOO: ApproximateEVEfficiency: 3500 - disabled: true - - - label: "Step 18: TH reads from the DUT the StateOfCharge attribute." + command: "readAttribute" + attribute: "ApproximateEVEfficiency" + response: + value: 3500 + constraints: + type: int16u + + - label: "Step 18: TH reads from the DUT the StateOfCharge attribute" PICS: EEVSE.S.A0030 - verification: | - ./chip-tool energyevse read state-of-charge 1 1 - - On TH(chip-tool), Verify the StateOfCharge attribute contains a percent value, or null. - - [1703747792.711492][1934:1936] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0099 Attribute 0x0000_0030 DataVersion: 1471857728 - [1703747792.711546][1934:1936] CHIP:TOO: StateOfCharge: null - disabled: true - - - label: "Step 19: TH reads from the DUT the BatteryCapacity attribute." + command: "readAttribute" + attribute: "StateOfCharge" + response: + constraints: + type: percent + minValue: 0 + maxValue: 100 + + - label: "Step 19: TH reads from the DUT the BatteryCapacity attribute" PICS: EEVSE.S.A0031 - verification: | - ./chip-tool energyevse read battery-capacity 1 1 - - On TH(chip-tool), Verify the BatteryCapacity attribute contains an energy-mWh value or null. - - [1703747831.580988][1942:1944] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0099 Attribute 0x0000_0031 DataVersion: 1471857728 - [1703747831.581068][1942:1944] CHIP:TOO: BatteryCapacity: null - disabled: true - - - label: "Step 20: TH reads from the DUT the VehicleID attribute." + command: "readAttribute" + attribute: "BatteryCapacity" + response: + constraints: + type: energy-mWh + minValue: 0 + + - label: "Step 20: TH reads from the DUT the VehicleID attribute" PICS: EEVSE.S.A0032 - verification: | - ./chip-tool energyevse read vehicle-id 1 1 - - On TH(chip-tool), Verify the VehicleID attribute contains a string value, or null. - - [1703747885.083733][1948:1950] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0099 Attribute 0x0000_0032 DataVersion: 1471857728 - [1703747885.083795][1948:1950] CHIP:TOO: VehicleID: null - disabled: true - - - label: "Step 21: TH reads from the DUT the SessionID attribute." + command: "readAttribute" + attribute: "VehicleID" + response: + constraints: + type: char_string + maxLength: 32 + + - label: "Step 21: TH reads from the DUT the SessionID attribute" PICS: EEVSE.S.A0040 - verification: | - ./chip-tool energyevse read session-id 1 1 - - On TH(chip-tool), Verify the SessionID attribute contains a uint32 value, or null. - [1703747940.652133][1953:1955] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0099 Attribute 0x0000_0040 DataVersion: 1471857728 - [1703747940.652210][1953:1955] CHIP:TOO: SessionID: null - disabled: true - - - label: "Step 22: TH reads from the DUT the SessionDuration attribute." + command: "readAttribute" + attribute: "SessionID" + response: + constraints: + type: int32u + minValue: 0 + maxValue: 2147483647 + + - label: "Step 22: TH reads from the DUT the SessionDuration attribute" PICS: EEVSE.S.A0041 - verification: | - ./chip-tool energyevse read session-duration 1 1 - - On TH(chip-tool), Verify the SessionDuration attribute contains an elapsed-s value or null. - - [1703747993.886193][1957:1959] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0099 Attribute 0x0000_0041 DataVersion: 1471857728 - [1703747993.886248][1957:1959] CHIP:TOO: SessionDuration: null - disabled: true - - - label: - "Step 23: TH reads from the DUT the SessionEnergyCharged attribute." + command: "readAttribute" + attribute: "SessionDuration" + response: + constraints: + type: elapsed_s + minValue: 0 + maxValue: 2147483647 + + - label: "Step 23: TH reads from the DUT the SessionEnergyCharged attribute" PICS: EEVSE.S.A0042 - verification: | - ./chip-tool energyevse read session-energy-charged 1 1 - - On TH(chip-tool), Verify the SessionEnergyCharged attribute energy-mWh value is in the valid range(min 0) or null. - - [1703748035.855732][1962:1964] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0099 Attribute 0x0000_0042 DataVersion: 1471857728 - [1703748035.855811][1962:1964] CHIP:TOO: SessionEnergyCharged: null - disabled: true + command: "readAttribute" + attribute: "SessionEnergyCharged" + response: + constraints: + type: energy-mWh + minValue: 0 - label: - "Step 24: TH reads from the DUT the SessionEnergyDischarged attribute." + "Step 24: TH reads from the DUT the SessionEnergyDischarged attribute" PICS: EEVSE.S.A0043 - verification: | - ./chip-tool energyevse read session-energy-discharged 1 1 - - On TH(chip-tool), Verify the SessionEnergyDischarged attribute energy-mWh value is in the valid range(min 0) or null. - - [1703748130.507623][1967:1970] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0099 Attribute 0x0000_0043 DataVersion: 1471857728 - [1703748130.507701][1967:1970] CHIP:TOO: SessionEnergyDischarged: null - disabled: true + command: "readAttribute" + attribute: "SessionEnergyDischarged" + response: + constraints: + type: energy-mWh + minValue: 0 diff --git a/src/app/tests/suites/certification/Test_TC_LWM_2_1.yaml b/src/app/tests/suites/certification/Test_TC_LWM_2_1.yaml index a6a916f1b2e2d8..b3535b13ceec51 100644 --- a/src/app/tests/suites/certification/Test_TC_LWM_2_1.yaml +++ b/src/app/tests/suites/certification/Test_TC_LWM_2_1.yaml @@ -177,7 +177,7 @@ tests: command: "readAttribute" attribute: "CurrentMode" response: - value: Step6_current_mode_dut + value: old_current_mode_dut constraints: type: int8u minValue: 0 diff --git a/src/app/tests/suites/certification/Test_TC_REFALM_2_2.yaml b/src/app/tests/suites/certification/Test_TC_REFALM_2_2.yaml index 3404d4ff6d9ed2..54a872047dc99d 100644 --- a/src/app/tests/suites/certification/Test_TC_REFALM_2_2.yaml +++ b/src/app/tests/suites/certification/Test_TC_REFALM_2_2.yaml @@ -11,7 +11,6 @@ # 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. -# Auto-generated scripts for harness use only, please review before automation. The endpoints and cluster names are currently set to default name: 223.2.2. [TC-REFALM-2.2] Primary functionality with DUT as Server @@ -20,117 +19,189 @@ PICS: config: nodeId: 0x12344321 - cluster: "Basic Information" - endpoint: 0 + cluster: "Refrigerator Alarm" + endpoint: 1 + PIXIT.REFALM.AlarmThreshold: + type: int16u + defaultValue: 5 tests: - - label: "Note" - verification: | - This is a simulated example log for instructional purposes only. In real scenarios, the actual log may vary depending on the feature implementation in Reference App. - disabled: true - - label: "Step 1: Commission DUT to TH (can be skipped if done in a preceding test)" - verification: | - - disabled: true + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId - label: "Step 2: Ensure that the door on the DUT is closed" verification: | Ensure that the door on the DUT is closed - disabled: true - - - label: "Step 3: TH reads from the DUT the State attribute" + cluster: "LogCommands" + command: "UserPrompt" + PICS: PICS_USER_PROMPT + arguments: + values: + - name: "message" + value: "Enter 'y' after success" + - name: "expectedValue" + value: "y" + + - label: "Step 3:TH reads from the DUT the State attribute" + command: "readAttribute" + attribute: "State" PICS: REFALM.S.A0002 - verification: | - ./chip-tool refrigeratoralarm read state 1 1 - On TH(chip-tool), Verify that the DUT response contains a 32-bit value with bit 0 set to 0. - - [1688447820.603249][4247:4249] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0057 Attribute 0x0000_0002 DataVersion: 1795162772 - [1688447820.603415][4247:4249] CHIP:TOO: State: 1 - [1688447820.603708][4247:4249] CHIP:EM: <<< [E:2198i S:4260 M:156565261 (Ack:46517349)] (S) Msg TX to 1:0000000000000001 [10DB] --- Type 0000:10 (SecureChannel:StandaloneAck) - disabled: true + response: + constraints: + type: bitmap32 + hasMasksClear: [0x1] - label: "Step 4: Manually open the door on the DUT" verification: | Manually open the door on the DUT - disabled: true + cluster: "LogCommands" + command: "UserPrompt" + PICS: PICS_USER_PROMPT + arguments: + values: + - name: "message" + value: "Enter 'y' after success" + - name: "expectedValue" + value: "y" - label: "Step 5: Wait for the time defined in PIXIT.REFALM.AlarmThreshold" - verification: | - Wait for the time defined in PIXIT.REFALM.AlarmThreshold - disabled: true + cluster: "DelayCommands" + command: "WaitForMs" + PICS: PICS_USER_PROMPT + arguments: + values: + - name: "ms" + value: PIXIT.REFALM.AlarmThreshold * 1000 - label: "Step 6: TH reads from the DUT the State attribute" - PICS: REFALM.S.A0002 - verification: | - ./chip-tool refrigeratoralarm read state 1 1 - On TH(chip-tool), Verify that the DUT response contains a 32-bit value with bit 0 set to 1. - - [1688447820.603249][4247:4249] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0057 Attribute 0x0000_0002 DataVersion: 1795162772 - [1688447820.603415][4247:4249] CHIP:TOO: State: 1 - [1688447820.603708][4247:4249] CHIP:EM: <<< [E:2198i S:4260 M:156565261 (Ack:46517349)] (S) Msg TX to 1:0000000000000001 [10DB] --- Type 0000:10 (SecureChannel:StandaloneAck) - disabled: true + command: "readAttribute" + attribute: "State" + PICS: REFALM.S.A0002 && PICS_USER_PROMPT + response: + constraints: + type: bitmap32 + hasMasksSet: [0x1] - label: "Step 7: Ensure that the door on the DUT is closed" verification: | Ensure that the door on the DUT is closed - disabled: true + cluster: "LogCommands" + command: "UserPrompt" + PICS: PICS_USER_PROMPT + arguments: + values: + - name: "message" + value: "Enter 'y' after success" + - name: "expectedValue" + value: "y" - label: "Step 8: TH reads from the DUT the State attribute" - PICS: REFALM.S.A0002 - verification: | - ./chip-tool refrigeratoralarm read state 1 1 - On TH(chip-tool), Verify that the DUT response contains a 32-bit value with bit 0 set to 0. - - [1688447820.603249][4247:4249] CHIP:TOO: Endpoint: 1 Cluster: 0x0000_0057 Attribute 0x0000_0002 DataVersion: 1795162772 - [1688447820.603415][4247:4249] CHIP:TOO: State: 0 - [1688447820.603708][4247:4249] CHIP:EM: <<< [E:2198i S:4260 M:156565261 (Ack:46517349)] (S) Msg TX to 1:0000000000000001 [10DB] --- Type 0000:10 (SecureChannel:StandaloneAck) - disabled: true - + command: "readAttribute" + attribute: "State" + PICS: REFALM.S.A0002 PICS_USER_PROMPT + response: + constraints: + type: bitmap32 + hasMasksClear: [0x1] + + # Issue: https://github.com/project-chip/connectedhomeip/issues/28325 + # Issue: https://github.com/project-chip/connectedhomeip/issues/27235 - label: "Step 9: TH sends Reset command to the DUT" - PICS: REFALM.S.C00.Rsp + PICS: REFALM.S.C00.Rsp && PICS_USER_PROMPT verification: | Reset command is not implemeted in Chip-tool - disabled: true + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "Enter 'y' after success" + - name: "expectedValue" + value: "y" - label: "Step 10: TH sends ModifyEnabledAlarms command to the DUT" - PICS: REFALM.S.C01.Rsp + PICS: REFALM.S.C01.Rsp && PICS_USER_PROMPT verification: | ModifyEnabledAlarms is not implemeted in Chip-tool - disabled: true + cluster: "LogCommands" + command: "UserPrompt" + arguments: + values: + - name: "message" + value: "Enter 'y' after success" + - name: "expectedValue" + value: "y" - label: "Step 11: Set up subscription to the Notify event." PICS: REFALM.S.E00 && REFALM.S.A0002 + command: "subscribeEvent" + event: "Notify" + minInterval: 2 + maxInterval: 10 + + - label: "Step 12a: Repeating step 4 Manually open the door on the DUT" verification: | - Please use Interactive mode to subscribe the OperationalError event - Here the command to enter interactive mode after provision :- - ./chip-tool interactive start - - Please subscribe to the Notify event by sending below mentioned command - refrigeratoralarm subscribe-event notify 2 10 1 1 - - [1690959967.087585][3549:3551] CHIP:EM: Rxd Ack; Removing MessageCounter:144404037 from Retrans Table on exchange 19895i - [1690959967.087651][3549:3551] CHIP:DMG: ReportDataMessage = - [1690959967.087684][3549:3551] CHIP:DMG: { - [1690959967.087712][3549:3551] CHIP:DMG: SubscriptionId = 0x959257ec, - [1690959967.087743][3549:3551] CHIP:DMG: InteractionModelRevision = 1 - [1690959967.087770][3549:3551] CHIP:DMG: } - [1690959967.087813][3549:3551] CHIP:DMG: MoveToState ReadClient[0xffff80010ac0]: Moving to [AwaitingSu] - [1690959967.087923][3549:3551] CHIP:EM: <<< [E:19895i S:58037 M:144404038 (Ack:133694741)] (S) Msg TX to 1:0000000000000001 [7C8C] --- Type 0001:01 (IM:StatusResponse) - [1690959967.087966][3549:3551] CHIP:IN: (S) Sending msg 144404038 on secure session with LSID: 58037 - disabled: true - - - label: "Step 12: Repeat steps 4 then 5" - PICS: REFALM.S.E00 - verification: | - Repeat steps 4 - Manually open the door on the DUT - then 5 - Wait for the time defined in PIXIT.REFALM.AlarmThreshold - disabled: true + Manually open the door on the DUT + cluster: "LogCommands" + command: "UserPrompt" + PICS: PICS_USER_PROMPT + arguments: + values: + - name: "message" + value: "Enter 'y' after success" + - name: "expectedValue" + value: "y" + + - label: + "Step 12b: Repeat step 5 Wait for the time defined in + PIXIT.REFALM.AlarmThreshold" + cluster: "DelayCommands" + command: "WaitForMs" + PICS: PICS_USER_PROMPT + arguments: + values: + - name: "ms" + value: PIXIT.REFALM.AlarmThreshold * 1000 - - label: "Step 13: Repeat step 7" - PICS: REFALM.S.E00 + - label: + "Step 12c: After step 5 (repeated), receive a Notify event with the + State attribute bit 0 set to 1." + command: "readAttribute" + attribute: "State" + PICS: REFALM.S.A0002 && PICS_USER_PROMPT + response: + constraints: + type: bitmap32 + hasMasksSet: [0x1] + + - label: + "Step 13a : Repeat step 7 Ensure that the door on the DUT is closed" verification: | - Repeat step 7 - that is Ensure that the door on the DUT is closed - disabled: true + Manually open the door on the DUT + cluster: "LogCommands" + command: "UserPrompt" + PICS: PICS_USER_PROMPT + arguments: + values: + - name: "message" + value: "Enter 'y' after success" + - name: "expectedValue" + value: "y" + + - label: + "Step 13b: Receive a Notify event with the State attribute bit 0 set + to 0" + command: "readAttribute" + attribute: "State" + PICS: REFALM.S.A0002 && PICS_USER_PROMPT + response: + constraints: + type: bitmap32 + hasMasksClear: [0x1] diff --git a/src/app/tests/suites/certification/ci-pics-values b/src/app/tests/suites/certification/ci-pics-values index 31ecfc445117ea..97a178197bcfa7 100644 --- a/src/app/tests/suites/certification/ci-pics-values +++ b/src/app/tests/suites/certification/ci-pics-values @@ -2802,56 +2802,96 @@ OTCCM.S.M.CAN_MANUALLY_CONTROLLED=0 #Energy EVSE Cluster EEVSE.S=0 -EEVSE.S.A0000=0 -EEVSE.S.A0001=0 -EEVSE.S.A0002=0 -EEVSE.S.A0003=0 -EEVSE.S.A0004=0 -EEVSE.S.A0005=0 -EEVSE.S.A0006=0 -EEVSE.S.A0007=0 -EEVSE.S.A0008=0 -EEVSE.S.A0009=0 -EEVSE.S.A000A=0 -EEVSE.S.A0023=0 -EEVSE.S.A0024=0 -EEVSE.S.A0025=0 -EEVSE.S.A0026=0 -EEVSE.S.A0027=0 -EEVSE.S.A0030=0 -EEVSE.S.A0031=0 -EEVSE.S.A0032=0 -EEVSE.S.A0040=0 -EEVSE.S.A0041=0 -EEVSE.S.A0042=0 -EEVSE.S.A0043=0 +EEVSE.S.A0000=1 +EEVSE.S.A0001=1 +EEVSE.S.A0002=1 +EEVSE.S.A0003=1 +EEVSE.S.A0004=1 +EEVSE.S.A0005=1 +EEVSE.S.A0006=1 +EEVSE.S.A0007=1 +EEVSE.S.A0008=1 +EEVSE.S.A0009=1 +EEVSE.S.A000A=1 +EEVSE.S.A0023=1 +EEVSE.S.A0024=1 +EEVSE.S.A0025=1 +EEVSE.S.A0026=1 +EEVSE.S.A0027=1 +EEVSE.S.A0030=1 +EEVSE.S.A0031=1 +EEVSE.S.A0032=1 +EEVSE.S.A0040=1 +EEVSE.S.A0041=1 +EEVSE.S.A0042=1 +EEVSE.S.A0043=1 #Commands received -EEVSE.S.C01.Rsp=0 -EEVSE.S.C02.Rsp=0 -EEVSE.S.C03.Rsp=0 -EEVSE.S.C04.Rsp=0 -EEVSE.S.C05.Rsp=0 -EEVSE.S.C06.Rsp=0 -EEVSE.S.C07.Rsp=0 +EEVSE.S.C01.Rsp=1 +EEVSE.S.C02.Rsp=1 +EEVSE.S.C03.Rsp=1 +EEVSE.S.C04.Rsp=1 +EEVSE.S.C05.Rsp=1 +EEVSE.S.C06.Rsp=1 +EEVSE.S.C07.Rsp=1 # Commands generated -EEVSE.S.C00.Tx=0 +EEVSE.S.C00.Tx=1 #Manual controllable -EEVSE.S.M.ManuallyControlledPluggedIn=0 +EEVSE.S.M.ManuallyControlledPluggedIn=1 #Features -EEVSE.S.F00=0 -EEVSE.S.F01=0 -EEVSE.S.F02=0 -EEVSE.S.F03=0 -EEVSE.S.F04=0 +EEVSE.S.F00=1 +EEVSE.S.F01=1 +EEVSE.S.F02=1 +EEVSE.S.F03=1 +EEVSE.S.F04=1 #Events -EEVSE.S.E00=0 -EEVSE.S.E01=0 -EEVSE.S.E02=0 -EEVSE.S.E03=0 -EEVSE.S.E04=0 -EEVSE.S.E05=0 +EEVSE.S.E00=1 +EEVSE.S.E01=1 +EEVSE.S.E02=1 +EEVSE.S.E03=1 +EEVSE.S.E04=1 +EEVSE.S.E05=1 + +# Energy EVSE Mode Cluster + +#Feature +EEVSEM.S.F00=1 +#Server +EEVSEM.S=1 +EEVSEM.S.A0000=1 +EEVSEM.S.A0001=1 +EEVSEM.S.A0002=0 +EEVSEM.S.A0003=0 + +#Commands received +EEVSEM.S.C00.Rsp=1 + +#Commands generated +EEVSEM.S.C01.Tx=1 + +#Manual controllable +EEVSEM.S.M.CAN_TEST_MODE_FAILURE=1 +EEVSEM.S.M.CAN_MANUALLY_CONTROLLED=1 + +# Device Energy Management Mode Cluster + +#Server +DEMM.S=1 +DEMM.S.A0000=1 +DEMM.S.A0001=1 +DEMM.S.A0002=0 +DEMM.S.A0003=1 + +#Commands received +DEMM.S.C00.Rsp=1 + +#Commands generated +DEMM.S.C01.Tx=1 + +#Manual controllable +DEMM.S.M.CAN_TEST_MODE_FAILURE=1 +DEMM.S.M.CAN_MANUALLY_CONTROLLED=1 diff --git a/src/app/tests/suites/ciTests.json b/src/app/tests/suites/ciTests.json index 73ceb2eb4add19..41fd9639a6f56b 100644 --- a/src/app/tests/suites/ciTests.json +++ b/src/app/tests/suites/ciTests.json @@ -50,12 +50,21 @@ "Test_TC_CNET_1_3" ], "Descriptor": ["Test_TC_DESC_1_1"], + "DeviceEnergyManagementMode": ["Test_TC_DEMM_1_1", "Test_TC_DEMM_2_1"], "EthernetNetworkDiagnostics": [ "Test_TC_DGETH_1_1", "Test_TC_DGETH_2_1", "Test_TC_DGETH_2_2" ], "DiagnosticsLogs": ["Test_TC_DLOG_1_1"], + "EnergyEVSE": ["Test_TC_EEVSE_1_1", "Test_TC_EEVSE_2_1"], + "EnergyEVSEMode": [ + "Test_TC_EEVSEM_1_1", + "Test_TC_EEVSEM_2_1", + "Test_TC_EEVSEM_3_1", + "Test_TC_EEVSEM_3_2", + "Test_TC_EEVSEM_3_3" + ], "FlowMeasurement": ["Test_TC_FLW_1_1", "Test_TC_FLW_2_1"], "FixedLabel": ["Test_TC_FLABEL_1_1", "Test_TC_FLABEL_2_1"], "FanControl": [ @@ -395,9 +404,12 @@ "ConcentrationMeasurement", "ContentAppObserver", "DeviceManagement", + "DeviceEnergyManagementMode", "Descriptor", "DiagnosticsLogs", "EthernetNetworkDiagnostics", + "EnergyEVSE", + "EnergyEVSEMode", "FlowMeasurement", "FixedLabel", "FanControl", diff --git a/src/app/tests/suites/manualTests.json b/src/app/tests/suites/manualTests.json index be6b4a3f110308..e57e76cbe0b782 100644 --- a/src/app/tests/suites/manualTests.json +++ b/src/app/tests/suites/manualTests.json @@ -113,6 +113,8 @@ "Test_TC_DLOG_3_1" ], "Descriptor": ["Test_TC_DESC_2_1"], + "DeviceEnergyManagementMode": ["Test_TC_DEMM_1_2"], + "EnergyEVSEMode": ["Test_TC_EEVSEM_1_2"], "FanControl": [], "GeneralCommissioning": ["Test_TC_CGEN_2_2"], "GeneralDiagnostics": ["Test_TC_DGGEN_2_2"], @@ -319,9 +321,11 @@ "DishwasherAlarm", "DishwasherMode", "Descriptor", + "DeviceEnergyManagementMode", "FanControl", "EthernetNetworkDiagnostics", "EnergyEVSE", + "EnergyEVSEMode", "GeneralCommissioning", "GeneralDiagnostics", "IcdManagement", 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 475046c98699b0..3f3262542f85fb 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h @@ -89,11 +89,16 @@ class TestList : public Command { printf("Test_TC_OPCREDS_1_2\n"); printf("Test_TC_BINFO_1_1\n"); printf("Test_TC_CNET_1_3\n"); + printf("Test_TC_DEMM_1_1\n"); + printf("Test_TC_DEMM_2_1\n"); printf("Test_TC_DESC_1_1\n"); printf("Test_TC_DLOG_1_1\n"); printf("Test_TC_DGETH_1_1\n"); printf("Test_TC_DGETH_2_1\n"); printf("Test_TC_DGETH_2_2\n"); + printf("Test_TC_EEVSE_1_1\n"); + printf("Test_TC_EEVSE_2_1\n"); + printf("Test_TC_EEVSEM_1_1\n"); printf("Test_TC_FLW_1_1\n"); printf("Test_TC_FLABEL_1_1\n"); printf("Test_TC_FAN_1_1\n"); @@ -47075,6 +47080,905 @@ class Test_TC_CNET_1_3 : public TestCommandBridge { } }; +class Test_TC_DEMM_1_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_DEMM_1_1() + : TestCommandBridge("Test_TC_DEMM_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_DEMM_1_1() + { + } + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_DEMM_1_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DEMM_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 : Step 1: Commission DUT to TH (can be skipped if done in a preceding test).\n"); + err = TestStep1CommissionDutToThCanBeSkippedIfDoneInAPrecedingTest_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Step 2: TH reads from the DUT the ClusterRevision attribute\n"); + err = TestStep2ThReadsFromTheDutTheClusterRevisionAttribute_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Step 3: TH reads from the DUT the FeatureMap attribute\n"); + if (ShouldSkip("PICS_SKIP_SAMPLE_APP")) { + NextTest(); + return; + } + err = TestStep3ThReadsFromTheDutTheFeatureMapAttribute_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Step 4: TH reads from the DUT the AttributeList attribute.\n"); + if (ShouldSkip("PICS_EVENT_LIST_ENABLED")) { + NextTest(); + return; + } + err = TestStep4ThReadsFromTheDutTheAttributeListAttribute_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Step 4a: TH reads from the DUT the AttributeList attribute.\n"); + if (ShouldSkip("!PICS_EVENT_LIST_ENABLED")) { + NextTest(); + return; + } + err = TestStep4aThReadsFromTheDutTheAttributeListAttribute_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Step 4b: TH reads optional attribute (StartUpMode) in AttributeList from DUT\n"); + if (ShouldSkip("DEMM.S.A0002")) { + NextTest(); + return; + } + err = TestStep4bThReadsOptionalAttributeStartUpModeInAttributeListFromDut_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Step 5: TH reads from the DUT the EventList attribute.\n"); + if (ShouldSkip("PICS_EVENT_LIST_ENABLED")) { + NextTest(); + return; + } + NextTest(); + return; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Step 6: TH reads from the DUT the AcceptedCommandList attribute.\n"); + err = TestStep6ThReadsFromTheDutTheAcceptedCommandListAttribute_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Step 7: TH reads from the DUT the GeneratedCommandList attribute.\n"); + err = TestStep7ThReadsFromTheDutTheGeneratedCommandListAttribute_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 TestStep1CommissionDutToThCanBeSkippedIfDoneInAPrecedingTest_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestStep2ThReadsFromTheDutTheClusterRevisionAttribute_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagementMode alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 2: TH reads from the DUT the ClusterRevision attribute: Error: %@", err); + } else { + NSLog(@"Step 2: TH reads from the DUT the ClusterRevision attribute: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 1U)); + } + + VerifyOrReturn(CheckConstraintType("clusterRevision", "int16u", "int16u")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep3ThReadsFromTheDutTheFeatureMapAttribute_2() + { + + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt("alpha", value); + } + + CHIP_ERROR TestStep4ThReadsFromTheDutTheAttributeListAttribute_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagementMode alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 4: TH reads from the DUT the AttributeList attribute.: Error: %@", err); + } else { + NSLog(@"Step 4: TH reads from the DUT the AttributeList attribute.: Success"); + } + + 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, 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 TestStep4aThReadsFromTheDutTheAttributeListAttribute_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagementMode alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 4a: TH reads from the DUT the AttributeList attribute.: Error: %@", err); + } else { + NSLog(@"Step 4a: TH reads from the DUT the AttributeList attribute.: Success"); + } + + 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, 65528UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65533UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep4bThReadsOptionalAttributeStartUpModeInAttributeListFromDut_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagementMode alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 4b: TH reads optional attribute (StartUpMode) in AttributeList from DUT: Error: %@", err); + } else { + NSLog(@"Step 4b: TH reads optional attribute (StartUpMode) in AttributeList from DUT: Success"); + } + + 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 TestStep6ThReadsFromTheDutTheAcceptedCommandListAttribute_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagementMode alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 6: TH reads from the DUT the AcceptedCommandList attribute.: Error: %@", err); + } else { + NSLog(@"Step 6: TH reads from the DUT the AcceptedCommandList attribute.: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("AcceptedCommandList", [actualValue count], static_cast(1))); + VerifyOrReturn(CheckValue("", actualValue[0], 0UL)); + } + + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep7ThReadsFromTheDutTheGeneratedCommandListAttribute_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagementMode alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 7: TH reads from the DUT the GeneratedCommandList attribute.: Error: %@", err); + } else { + NSLog(@"Step 7: TH reads from the DUT the GeneratedCommandList attribute.: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("GeneratedCommandList", [actualValue count], static_cast(1))); + VerifyOrReturn(CheckValue("", actualValue[0], 1UL)); + } + + VerifyOrReturn(CheckConstraintType("generatedCommandList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_DEMM_2_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_DEMM_2_1() + : TestCommandBridge("Test_TC_DEMM_2_1") + , mTestIndex(0) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("PIXIT.DEMM.MODE_CHANGE_OK", 0, UINT8_MAX, &mPixitdemmmodeChangeOk); + AddArgument("PIXIT.DEMM.MODE_CHANGE_FAIL", 0, UINT8_MAX, &mPixitdemmmodeChangeFail); + AddArgument("invalid_mode_th", 0, UINT8_MAX, &mInvalidModeTh); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + // NOLINTEND(clang-analyzer-nullability.NullPassedToNonnull) + + ~Test_TC_DEMM_2_1() + { + } + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_DEMM_2_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_DEMM_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 : 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 reads from the DUT the SupportedModes attribute.\n"); + if (ShouldSkip("DEMM.S.A0000")) { + NextTest(); + return; + } + err = TestStep2ThReadsFromTheDutTheSupportedModesAttribute_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Step 3: TH reads from the DUT the CurrentMode attribute.\n"); + if (ShouldSkip("DEMM.S.A0001")) { + NextTest(); + return; + } + err = TestStep3ThReadsFromTheDutTheCurrentModeAttribute_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Step 4: TH sends a ChangeToMode command to the DUT with NewMode set to old_current_mode_dut\n"); + if (ShouldSkip("DEMM.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestStep4ThSendsAChangeToModeCommandToTheDutWithNewModeSetToOldCurrentModeDut_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Step 5: Manually put the device in a state from which it will FAIL to transition to PIXIT.DEMM.MODE_CHANGE_FAIL\n"); + if (ShouldSkip("DEMM.S.M.CAN_TEST_MODE_FAILURE && DEMM.S.M.CAN_MANUALLY_CONTROLLED && PICS_SKIP_SAMPLE_APP")) { + NextTest(); + return; + } + err = TestStep5ManuallyPutTheDeviceInAStateFromWhichItWillFailToTransitionToPixitdemmmodeChangeFail_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Step 6: TH reads from the DUT the CurrentMode attribute\n"); + if (ShouldSkip("DEMM.S.A0001 && DEMM.S.M.CAN_MANUALLY_CONTROLLED")) { + NextTest(); + return; + } + err = TestStep6ThReadsFromTheDutTheCurrentModeAttribute_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Step 7: TH sends a ChangeToMode command to the DUT with NewMode set to PIXIT.DEMM.MODE_CHANGE_FAIL\n"); + if (ShouldSkip("DEMM.S.M.CAN_TEST_MODE_FAILURE && DEMM.S.C00.Rsp && PICS_SKIP_SAMPLE_APP")) { + NextTest(); + return; + } + err = TestStep7ThSendsAChangeToModeCommandToTheDutWithNewModeSetToPixitdemmmodeChangeFail_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Step 8: TH reads from the DUT the CurrentMode attribute.\n"); + if (ShouldSkip("DEMM.S.A0001")) { + NextTest(); + return; + } + err = TestStep8ThReadsFromTheDutTheCurrentModeAttribute_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Step 9: Manually put the device in a state from which it will SUCCESSFULLY transition to PIXIT.DEMM.MODE_CHANGE_OK\n"); + if (ShouldSkip("PICS_SKIP_SAMPLE_APP && DEMM.S.M.CAN_MANUALLY_CONTROLLED")) { + NextTest(); + return; + } + err = TestStep9ManuallyPutTheDeviceInAStateFromWhichItWillSuccessfullyTransitionToPixitdemmmodeChangeOk_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Step 10: TH reads from the DUT the CurrentMode attribute.\n"); + if (ShouldSkip("DEMM.S.A0001 && DEMM.S.M.CAN_MANUALLY_CONTROLLED")) { + NextTest(); + return; + } + err = TestStep10ThReadsFromTheDutTheCurrentModeAttribute_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : Step 11: TH sends a ChangeToMode command to the DUT with NewMode set to PIXIT.DEMM.MODE_CHANGE_OK\n"); + if (ShouldSkip("DEMM.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestStep11ThSendsAChangeToModeCommandToTheDutWithNewModeSetToPixitdemmmodeChangeOk_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : Step 12: TH reads from the DUT the CurrentMode attribute. Verify that the DUT response contains an integer value equal to PIXIT.RVCRUNM.MODE_CHANGE_OK\n"); + if (ShouldSkip("DEMM.S.A0001")) { + NextTest(); + return; + } + err = TestStep12ThReadsFromTheDutTheCurrentModeAttributeVerifyThatTheDutResponseContainsAnIntegerValueEqualToPixitrvcrunmmodeChangeOk_11(); + break; + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : Step 13: TH sends a ChangeToMode command to the DUT with NewMode set to invalid_mode_th\n"); + if (ShouldSkip("DEMM.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestStep13ThSendsAChangeToModeCommandToTheDutWithNewModeSetToInvalidModeTh_12(); + break; + case 13: + ChipLogProgress(chipTool, " ***** Test Step 13 : Step 14: TH reads from the DUT the CurrentMode attribute. Verify that the DUT response contains an integer value equal to PIXIT.RVCRUNM.MODE_CHANGE_OK\n"); + if (ShouldSkip("DEMM.S.A0001")) { + NextTest(); + return; + } + err = TestStep14ThReadsFromTheDutTheCurrentModeAttributeVerifyThatTheDutResponseContainsAnIntegerValueEqualToPixitrvcrunmmodeChangeOk_13(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + void OnStatusUpdate(const chip::app::StatusIB & status) override + { + switch (mTestIndex - 1) { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 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; + } + + // Go on to the next test. + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + + chip::System::Clock::Timeout GetWaitDuration() const override { return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 14; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mPixitdemmmodeChangeOk; + chip::Optional mPixitdemmmodeChangeFail; + chip::Optional mInvalidModeTh; + chip::Optional mTimeout; + + CHIP_ERROR TestStep1WaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + NSArray * _Nonnull supported_mode_dut; + + CHIP_ERROR TestStep2ThReadsFromTheDutTheSupportedModesAttribute_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagementMode alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeSupportedModesWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 2: TH reads from the DUT the SupportedModes attribute.: Error: %@", err); + } else { + NSLog(@"Step 2: TH reads from the DUT the SupportedModes attribute.: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("supportedModes", "list", "list")); + VerifyOrReturn(CheckConstraintMinLength("supportedModes", value, 2)); + { + supported_mode_dut = value; + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + NSNumber * _Nonnull old_current_mode_dut; + + CHIP_ERROR TestStep3ThReadsFromTheDutTheCurrentModeAttribute_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagementMode alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeCurrentModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 3: TH reads from the DUT the CurrentMode attribute.: Error: %@", err); + } else { + NSLog(@"Step 3: TH reads from the DUT the CurrentMode attribute.: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("currentMode", "int8u", "int8u")); + VerifyOrReturn(CheckConstraintMinValue("currentMode", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("currentMode", [value unsignedCharValue], 255U)); + { + old_current_mode_dut = value; + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep4ThSendsAChangeToModeCommandToTheDutWithNewModeSetToOldCurrentModeDut_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagementMode alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRDeviceEnergyManagementModeClusterChangeToModeParams alloc] init]; + params.newMode = + [old_current_mode_dut copy]; + [cluster changeToModeWithParams:params completion: + ^(MTRDeviceEnergyManagementModeClusterChangeToModeResponseParams * _Nullable values, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 4: TH sends a ChangeToMode command to the DUT with NewMode set to old_current_mode_dut: Error: %@", err); + } else { + NSLog(@"Step 4: TH sends a ChangeToMode command to the DUT with NewMode set to old_current_mode_dut: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = values.status; + VerifyOrReturn(CheckValue("Status", actualValue, 0U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep5ManuallyPutTheDeviceInAStateFromWhichItWillFailToTransitionToPixitdemmmodeChangeFail_4() + { + + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt("alpha", value); + } + NSNumber * _Nonnull Step6_current_mode_dut; + + CHIP_ERROR TestStep6ThReadsFromTheDutTheCurrentModeAttribute_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagementMode alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeCurrentModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 6: TH reads from the DUT the CurrentMode attribute: Error: %@", err); + } else { + NSLog(@"Step 6: TH reads from the DUT the CurrentMode attribute: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("currentMode", "int8u", "int8u")); + VerifyOrReturn(CheckConstraintMinValue("currentMode", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("currentMode", [value unsignedCharValue], 255U)); + { + Step6_current_mode_dut = value; + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep7ThSendsAChangeToModeCommandToTheDutWithNewModeSetToPixitdemmmodeChangeFail_6() + { + + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt("alpha", value); + } + + CHIP_ERROR TestStep8ThReadsFromTheDutTheCurrentModeAttribute_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagementMode alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeCurrentModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 8: TH reads from the DUT the CurrentMode attribute.: Error: %@", err); + } else { + NSLog(@"Step 8: TH reads from the DUT the CurrentMode attribute.: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("CurrentMode", actualValue, old_current_mode_dut)); + } + + VerifyOrReturn(CheckConstraintType("currentMode", "int8u", "int16u")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep9ManuallyPutTheDeviceInAStateFromWhichItWillSuccessfullyTransitionToPixitdemmmodeChangeOk_8() + { + + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt("alpha", value); + } + NSNumber * _Nonnull Step10_current_mode_dut; + + CHIP_ERROR TestStep10ThReadsFromTheDutTheCurrentModeAttribute_9() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagementMode alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeCurrentModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 10: TH reads from the DUT the CurrentMode attribute.: Error: %@", err); + } else { + NSLog(@"Step 10: TH reads from the DUT the CurrentMode attribute.: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("currentMode", "int8u", "int8u")); + VerifyOrReturn(CheckConstraintMinValue("currentMode", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("currentMode", [value unsignedCharValue], 255U)); + { + Step10_current_mode_dut = value; + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep11ThSendsAChangeToModeCommandToTheDutWithNewModeSetToPixitdemmmodeChangeOk_10() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagementMode alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRDeviceEnergyManagementModeClusterChangeToModeParams alloc] init]; + params.newMode = mPixitdemmmodeChangeOk.HasValue() ? [NSNumber numberWithUnsignedChar:mPixitdemmmodeChangeOk.Value()] : [NSNumber numberWithUnsignedChar:2U]; + [cluster changeToModeWithParams:params completion: + ^(MTRDeviceEnergyManagementModeClusterChangeToModeResponseParams * _Nullable values, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 11: TH sends a ChangeToMode command to the DUT with NewMode set to PIXIT.DEMM.MODE_CHANGE_OK: Error: %@", err); + } else { + NSLog(@"Step 11: TH sends a ChangeToMode command to the DUT with NewMode set to PIXIT.DEMM.MODE_CHANGE_OK: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = values.status; + VerifyOrReturn(CheckValue("Status", actualValue, 0U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep12ThReadsFromTheDutTheCurrentModeAttributeVerifyThatTheDutResponseContainsAnIntegerValueEqualToPixitrvcrunmmodeChangeOk_11() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagementMode alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeCurrentModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 12: TH reads from the DUT the CurrentMode attribute. Verify that the DUT response contains an integer value equal to PIXIT.RVCRUNM.MODE_CHANGE_OK: Error: %@", err); + } else { + NSLog(@"Step 12: TH reads from the DUT the CurrentMode attribute. Verify that the DUT response contains an integer value equal to PIXIT.RVCRUNM.MODE_CHANGE_OK: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("CurrentMode", actualValue, mPixitdemmmodeChangeOk.HasValue() ? mPixitdemmmodeChangeOk.Value() : 2U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep13ThSendsAChangeToModeCommandToTheDutWithNewModeSetToInvalidModeTh_12() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagementMode alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + __auto_type * params = [[MTRDeviceEnergyManagementModeClusterChangeToModeParams alloc] init]; + params.newMode = mInvalidModeTh.HasValue() ? [NSNumber numberWithUnsignedChar:mInvalidModeTh.Value()] : [NSNumber numberWithUnsignedChar:15U]; + [cluster changeToModeWithParams:params completion: + ^(MTRDeviceEnergyManagementModeClusterChangeToModeResponseParams * _Nullable values, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 13: TH sends a ChangeToMode command to the DUT with NewMode set to invalid_mode_th: Error: %@", err); + } else { + NSLog(@"Step 13: TH sends a ChangeToMode command to the DUT with NewMode set to invalid_mode_th: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = values.status; + VerifyOrReturn(CheckValue("Status", actualValue, 1U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep14ThReadsFromTheDutTheCurrentModeAttributeVerifyThatTheDutResponseContainsAnIntegerValueEqualToPixitrvcrunmmodeChangeOk_13() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterDeviceEnergyManagementMode alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeCurrentModeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 14: TH reads from the DUT the CurrentMode attribute. Verify that the DUT response contains an integer value equal to PIXIT.RVCRUNM.MODE_CHANGE_OK: Error: %@", err); + } else { + NSLog(@"Step 14: TH reads from the DUT the CurrentMode attribute. Verify that the DUT response contains an integer value equal to PIXIT.RVCRUNM.MODE_CHANGE_OK: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("CurrentMode", actualValue, mPixitdemmmodeChangeOk.HasValue() ? mPixitdemmmodeChangeOk.Value() : 2U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + class Test_TC_DESC_1_1 : public TestCommandBridge { public: // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced @@ -49915,6 +50819,2325 @@ class Test_TC_DGETH_2_2 : public TestCommandBridge { } }; +class Test_TC_EEVSE_1_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_EEVSE_1_1() + : TestCommandBridge("Test_TC_EEVSE_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_EEVSE_1_1() + { + } + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_EEVSE_1_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_EEVSE_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 : 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 reads from the DUT the ClusterRevision attribute\n"); + err = TestStep2ThReadsFromTheDutTheClusterRevisionAttribute_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Step 3a: TH reads from the DUT the FeatureMap attribute\n"); + if (ShouldSkip("!EEVSE.S.F00 && !EEVSE.S.F01 && !EEVSE.S.F02 && !EEVSE.S.F03 && !EEVSE.S.F04")) { + NextTest(); + return; + } + err = TestStep3aThReadsFromTheDutTheFeatureMapAttribute_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Step 3b: Given EEVSE.S.F00(ChargingPreferences) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("EEVSE.S.F00")) { + NextTest(); + return; + } + err = TestStep3bGivenEEVSESF00ChargingPreferencesEnsureFeaturemapHasTheCorrectBitSet_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Step 3b: Given EEVSE.S.F01(SoCReporting) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("EEVSE.S.F01")) { + NextTest(); + return; + } + err = TestStep3bGivenEEVSESF01SoCReportingEnsureFeaturemapHasTheCorrectBitSet_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Step 3b: Given EEVSE.S.F02(PlugAndCharge) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("EEVSE.S.F02")) { + NextTest(); + return; + } + err = TestStep3bGivenEEVSESF02PlugAndChargeEnsureFeaturemapHasTheCorrectBitSet_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Step 3b: Given EEVSE.S.F03(RFID) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("EEVSE.S.F03")) { + NextTest(); + return; + } + err = TestStep3bGivenEevsesf03rfidEnsureFeaturemapHasTheCorrectBitSet_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Step 3b: Given EEVSE.S.F04(V2X) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("EEVSE.S.F04")) { + NextTest(); + return; + } + err = TestStep3bGivenEevsesf04v2xEnsureFeaturemapHasTheCorrectBitSet_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Step 4a: TH reads from the DUT the AttributeList attribute\n"); + if (ShouldSkip("PICS_EVENT_LIST_ENABLED")) { + NextTest(); + return; + } + err = TestStep4aThReadsFromTheDutTheAttributeListAttribute_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Step 4a: TH reads AttributeList from DUT\n"); + if (ShouldSkip("!PICS_EVENT_LIST_ENABLED")) { + NextTest(); + return; + } + err = TestStep4aThReadsAttributeListFromDut_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : Step 4b: TH reads optional attribute (UserMaximumChargeCurrent) in AttributeList from DUT\n"); + if (ShouldSkip("EEVSE.S.A0009")) { + NextTest(); + return; + } + err = TestStep4bThReadsOptionalAttributeUserMaximumChargeCurrentInAttributeListFromDut_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : Step 4c: TH reads optional attribute (RandomizationDelayWindow) in AttributeList from DUT\n"); + if (ShouldSkip("EEVSE.S.A000A")) { + NextTest(); + return; + } + err = TestStep4cThReadsOptionalAttributeRandomizationDelayWindowInAttributeListFromDut_11(); + break; + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : Step 4d: TH reads optional attribute (V2X) in AttributeList from DUT\n"); + if (ShouldSkip("EEVSE.S.F04")) { + NextTest(); + return; + } + err = TestStep4dThReadsOptionalAttributeV2xInAttributeListFromDut_12(); + break; + case 13: + ChipLogProgress(chipTool, " ***** Test Step 13 : Step 4e: TH reads optional attribute (ChargingPreferences) in AttributeList from DUT\n"); + if (ShouldSkip("EEVSE.S.F00")) { + NextTest(); + return; + } + err = TestStep4eThReadsOptionalAttributeChargingPreferencesInAttributeListFromDut_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : Step 4e: TH reads optional attribute (SoCReporting) in AttributeList from DUT\n"); + if (ShouldSkip("EEVSE.S.F01")) { + NextTest(); + return; + } + err = TestStep4eThReadsOptionalAttributeSoCReportingInAttributeListFromDut_14(); + break; + case 15: + ChipLogProgress(chipTool, " ***** Test Step 15 : Step 4f: TH reads optional attribute (PlugAndCharge) in AttributeList from DUT\n"); + if (ShouldSkip("EEVSE.S.F02")) { + NextTest(); + return; + } + err = TestStep4fThReadsOptionalAttributePlugAndChargeInAttributeListFromDut_15(); + break; + case 16: + ChipLogProgress(chipTool, " ***** Test Step 16 : Step 5a: TH reads EventList from DUT\n"); + if (ShouldSkip("PICS_EVENT_LIST_ENABLED")) { + NextTest(); + return; + } + NextTest(); + return; + case 17: + ChipLogProgress(chipTool, " ***** Test Step 17 : Step 5b: TH reads optional attribute (RFID) in EventList from DUT\n"); + if (ShouldSkip("EEVSE.S.F03 && PICS_EVENT_LIST_ENABLED")) { + NextTest(); + return; + } + NextTest(); + return; + case 18: + ChipLogProgress(chipTool, " ***** Test Step 18 : Step 6a: TH reads AcceptedCommandList from DUT\n"); + err = TestStep6aThReadsAcceptedCommandListFromDut_18(); + break; + case 19: + ChipLogProgress(chipTool, " ***** Test Step 19 : Step 6b: TH reads the optional (StartDiagnostics) command in AcceptedCommandList\n"); + if (ShouldSkip("EEVSE.S.C04.Rsp")) { + NextTest(); + return; + } + err = TestStep6bThReadsTheOptionalStartDiagnosticsCommandInAcceptedCommandList_19(); + break; + case 20: + ChipLogProgress(chipTool, " ***** Test Step 20 : Step 6c: TH reads Feature dependent commands(EEVSE.S.F04) in AcceptedCommandList\n"); + if (ShouldSkip("EEVSE.S.F04")) { + NextTest(); + return; + } + err = TestStep6cThReadsFeatureDependentCommandsEEVSESF04InAcceptedCommandList_20(); + break; + case 21: + ChipLogProgress(chipTool, " ***** Test Step 21 : Step 6d: TH reads Feature dependent commands(ChargingPreferences) in AcceptedCommandList\n"); + if (ShouldSkip("EEVSE.S.F00")) { + NextTest(); + return; + } + err = TestStep6dThReadsFeatureDependentCommandsChargingPreferencesInAcceptedCommandList_21(); + break; + case 22: + ChipLogProgress(chipTool, " ***** Test Step 22 : Step 7a: TH reads GeneratedCommandList from DUT\n"); + if (ShouldSkip(" !EEVSE.S.F00 ")) { + NextTest(); + return; + } + err = TestStep7aThReadsGeneratedCommandListFromDut_22(); + break; + case 23: + ChipLogProgress(chipTool, " ***** Test Step 23 : Step 7b: TH reads GeneratedCommandList from DUT\n"); + if (ShouldSkip("EEVSE.S.F00")) { + NextTest(); + return; + } + err = TestStep7bThReadsGeneratedCommandListFromDut_23(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + void OnStatusUpdate(const chip::app::StatusIB & status) override + { + switch (mTestIndex - 1) { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 18: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 20: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 21: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 22: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 23: + 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 = 24; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestStep1WaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestStep2ThReadsFromTheDutTheClusterRevisionAttribute_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 2: TH reads from the DUT the ClusterRevision attribute: Error: %@", err); + } else { + NSLog(@"Step 2: TH reads from the DUT the ClusterRevision attribute: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 2U)); + } + + VerifyOrReturn(CheckConstraintType("clusterRevision", "int16u", "int16u")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep3aThReadsFromTheDutTheFeatureMapAttribute_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 3a: TH reads from the DUT the FeatureMap attribute: Error: %@", err); + } else { + NSLog(@"Step 3a: TH reads from the DUT the FeatureMap attribute: Success"); + } + + 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 TestStep3bGivenEEVSESF00ChargingPreferencesEnsureFeaturemapHasTheCorrectBitSet_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 3b: Given EEVSE.S.F00(ChargingPreferences) ensure featuremap has the correct bit set: Error: %@", err); + } else { + NSLog(@"Step 3b: Given EEVSE.S.F00(ChargingPreferences) ensure featuremap has the correct bit set: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep3bGivenEEVSESF01SoCReportingEnsureFeaturemapHasTheCorrectBitSet_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 3b: Given EEVSE.S.F01(SoCReporting) ensure featuremap has the correct bit set: Error: %@", err); + } else { + NSLog(@"Step 3b: Given EEVSE.S.F01(SoCReporting) ensure featuremap has the correct bit set: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep3bGivenEEVSESF02PlugAndChargeEnsureFeaturemapHasTheCorrectBitSet_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 3b: Given EEVSE.S.F02(PlugAndCharge) ensure featuremap has the correct bit set: Error: %@", err); + } else { + NSLog(@"Step 3b: Given EEVSE.S.F02(PlugAndCharge) ensure featuremap has the correct bit set: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep3bGivenEevsesf03rfidEnsureFeaturemapHasTheCorrectBitSet_6() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 3b: Given EEVSE.S.F03(RFID) ensure featuremap has the correct bit set: Error: %@", err); + } else { + NSLog(@"Step 3b: Given EEVSE.S.F03(RFID) ensure featuremap has the correct bit set: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep3bGivenEevsesf04v2xEnsureFeaturemapHasTheCorrectBitSet_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 3b: Given EEVSE.S.F04(V2X) ensure featuremap has the correct bit set: Error: %@", err); + } else { + NSLog(@"Step 3b: Given EEVSE.S.F04(V2X) ensure featuremap has the correct bit set: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep4aThReadsFromTheDutTheAttributeListAttribute_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 4a: TH reads from the DUT the AttributeList attribute: Error: %@", err); + } else { + NSLog(@"Step 4a: TH reads from the DUT the AttributeList attribute: Success"); + } + + 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, 3UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 5UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 6UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 7UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 64UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 66UL)); + 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 TestStep4aThReadsAttributeListFromDut_9() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 4a: TH reads AttributeList from DUT: Error: %@", err); + } else { + NSLog(@"Step 4a: TH reads AttributeList from DUT: Success"); + } + + 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, 3UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 5UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 6UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 7UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 64UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 66UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65528UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65533UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep4bThReadsOptionalAttributeUserMaximumChargeCurrentInAttributeListFromDut_10() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 4b: TH reads optional attribute (UserMaximumChargeCurrent) in AttributeList from DUT: Error: %@", err); + } else { + NSLog(@"Step 4b: TH reads optional attribute (UserMaximumChargeCurrent) in AttributeList from DUT: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 9UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep4cThReadsOptionalAttributeRandomizationDelayWindowInAttributeListFromDut_11() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 4c: TH reads optional attribute (RandomizationDelayWindow) in AttributeList from DUT: Error: %@", err); + } else { + NSLog(@"Step 4c: TH reads optional attribute (RandomizationDelayWindow) in AttributeList from DUT: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 10UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep4dThReadsOptionalAttributeV2xInAttributeListFromDut_12() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 4d: TH reads optional attribute (V2X) in AttributeList from DUT: Error: %@", err); + } else { + NSLog(@"Step 4d: TH reads optional attribute (V2X) in AttributeList from DUT: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 4UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 8UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 67UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep4eThReadsOptionalAttributeChargingPreferencesInAttributeListFromDut_13() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 4e: TH reads optional attribute (ChargingPreferences) in AttributeList from DUT: Error: %@", err); + } else { + NSLog(@"Step 4e: TH reads optional attribute (ChargingPreferences) in AttributeList from DUT: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 35UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 36UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 37UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 38UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 39UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep4eThReadsOptionalAttributeSoCReportingInAttributeListFromDut_14() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 4e: TH reads optional attribute (SoCReporting) in AttributeList from DUT: Error: %@", err); + } else { + NSLog(@"Step 4e: TH reads optional attribute (SoCReporting) in AttributeList from DUT: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 48UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 49UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep4fThReadsOptionalAttributePlugAndChargeInAttributeListFromDut_15() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 4f: TH reads optional attribute (PlugAndCharge) in AttributeList from DUT: Error: %@", err); + } else { + NSLog(@"Step 4f: TH reads optional attribute (PlugAndCharge) in AttributeList from DUT: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 50UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep6aThReadsAcceptedCommandListFromDut_18() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 6a: TH reads AcceptedCommandList from DUT: Error: %@", err); + } else { + NSLog(@"Step 6a: TH reads AcceptedCommandList from DUT: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("acceptedCommandList", value, 1UL)); + VerifyOrReturn(CheckConstraintContains("acceptedCommandList", value, 2UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep6bThReadsTheOptionalStartDiagnosticsCommandInAcceptedCommandList_19() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 6b: TH reads the optional (StartDiagnostics) command in AcceptedCommandList: Error: %@", err); + } else { + NSLog(@"Step 6b: TH reads the optional (StartDiagnostics) command in AcceptedCommandList: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("acceptedCommandList", value, 4UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep6cThReadsFeatureDependentCommandsEEVSESF04InAcceptedCommandList_20() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 6c: TH reads Feature dependent commands(EEVSE.S.F04) in AcceptedCommandList: Error: %@", err); + } else { + NSLog(@"Step 6c: TH reads Feature dependent commands(EEVSE.S.F04) in AcceptedCommandList: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("acceptedCommandList", value, 3UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep6dThReadsFeatureDependentCommandsChargingPreferencesInAcceptedCommandList_21() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 6d: TH reads Feature dependent commands(ChargingPreferences) in AcceptedCommandList: Error: %@", err); + } else { + NSLog(@"Step 6d: TH reads Feature dependent commands(ChargingPreferences) in AcceptedCommandList: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("acceptedCommandList", value, 5UL)); + VerifyOrReturn(CheckConstraintContains("acceptedCommandList", value, 6UL)); + VerifyOrReturn(CheckConstraintContains("acceptedCommandList", value, 7UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep7aThReadsGeneratedCommandListFromDut_22() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 7a: TH reads GeneratedCommandList from DUT: Error: %@", err); + } else { + NSLog(@"Step 7a: TH reads GeneratedCommandList from DUT: Success"); + } + + 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; + } + + CHIP_ERROR TestStep7bThReadsGeneratedCommandListFromDut_23() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 7b: TH reads GeneratedCommandList from DUT: Error: %@", err); + } else { + NSLog(@"Step 7b: TH reads GeneratedCommandList from DUT: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("generatedCommandList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("generatedCommandList", value, 0UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_EEVSE_2_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_EEVSE_2_1() + : TestCommandBridge("Test_TC_EEVSE_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_EEVSE_2_1() + { + } + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_EEVSE_2_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_EEVSE_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 : 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 reads from the DUT the State attribute\n"); + err = TestStep2ThReadsFromTheDutTheStateAttribute_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Step 3: TH reads from the DUT the SupplyState attribute\n"); + if (ShouldSkip("EEVSE.S.A0001")) { + NextTest(); + return; + } + err = TestStep3ThReadsFromTheDutTheSupplyStateAttribute_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Step 4: TH reads from the DUT the FaultState attribute\n"); + if (ShouldSkip("EEVSE.S.A0002")) { + NextTest(); + return; + } + err = TestStep4ThReadsFromTheDutTheFaultStateAttribute_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Step 5: TH reads from the DUT the ChargingEnabledUntil attribut\n"); + if (ShouldSkip("EEVSE.S.A0003")) { + NextTest(); + return; + } + err = TestStep5ThReadsFromTheDutTheChargingEnabledUntilAttribut_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Step 6: TH reads from the DUT the DischargingEnabledUntil attribute\n"); + if (ShouldSkip("EEVSE.S.A0004")) { + NextTest(); + return; + } + err = TestStep6ThReadsFromTheDutTheDischargingEnabledUntilAttribute_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Step 7: TH reads from the DUT the CircuitCapacity attribute\n"); + if (ShouldSkip("EEVSE.S.A0005")) { + NextTest(); + return; + } + err = TestStep7ThReadsFromTheDutTheCircuitCapacityAttribute_6(); + break; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Step 8: TH reads from the DUT the MinimumChargeCurrent attribute\n"); + if (ShouldSkip("EEVSE.S.A0006")) { + NextTest(); + return; + } + err = TestStep8ThReadsFromTheDutTheMinimumChargeCurrentAttribute_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Step 9: TH reads from the DUT the MaximumChargeCurrent attribute\n"); + if (ShouldSkip("EEVSE.S.A0007")) { + NextTest(); + return; + } + err = TestStep9ThReadsFromTheDutTheMaximumChargeCurrentAttribute_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Step 10: TH reads from the DUT the MaximumDischargeCurrent attribute\n"); + if (ShouldSkip("EEVSE.S.A0008")) { + NextTest(); + return; + } + err = TestStep10ThReadsFromTheDutTheMaximumDischargeCurrentAttribute_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : Step 11: TH writes to the DUT the UserMaximumChargeCurrent attribute value 3000\n"); + if (ShouldSkip("EEVSE.S.A0009")) { + NextTest(); + return; + } + err = TestStep11ThWritesToTheDutTheUserMaximumChargeCurrentAttributeValue3000_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : Step 11a: TH reads from the DUT the UserMaximumChargeCurrent attribute\n"); + if (ShouldSkip("EEVSE.S.A0009")) { + NextTest(); + return; + } + err = TestStep11aThReadsFromTheDutTheUserMaximumChargeCurrentAttribute_11(); + break; + case 12: + ChipLogProgress(chipTool, " ***** Test Step 12 : Step 12: TH writes to the DUT the RandomizationDelayWindow attribute value 600\n"); + if (ShouldSkip("EEVSE.S.A000A")) { + NextTest(); + return; + } + err = TestStep12ThWritesToTheDutTheRandomizationDelayWindowAttributeValue600_12(); + break; + case 13: + ChipLogProgress(chipTool, " ***** Test Step 13 : Step 12a: TH reads from the DUT the RandomizationDelayWindow attribute\n"); + if (ShouldSkip("EEVSE.S.A000A")) { + NextTest(); + return; + } + err = TestStep12aThReadsFromTheDutTheRandomizationDelayWindowAttribute_13(); + break; + case 14: + ChipLogProgress(chipTool, " ***** Test Step 14 : Step 13: TH reads from the DUT the NextChargeStartTime attribute\n"); + if (ShouldSkip("EEVSE.S.A0023")) { + NextTest(); + return; + } + err = TestStep13ThReadsFromTheDutTheNextChargeStartTimeAttribute_14(); + break; + case 15: + ChipLogProgress(chipTool, " ***** Test Step 15 : Step 14: TH reads from the DUT the NextChargeTargetTime attribute\n"); + if (ShouldSkip("EEVSE.S.A0024")) { + NextTest(); + return; + } + err = TestStep14ThReadsFromTheDutTheNextChargeTargetTimeAttribute_15(); + break; + case 16: + ChipLogProgress(chipTool, " ***** Test Step 16 : Step 15: TH reads from the DUT the NextChargeRequiredEnergy attribute\n"); + if (ShouldSkip("EEVSE.S.A0025")) { + NextTest(); + return; + } + err = TestStep15ThReadsFromTheDutTheNextChargeRequiredEnergyAttribute_16(); + break; + case 17: + ChipLogProgress(chipTool, " ***** Test Step 17 : Step 16: TH reads from the DUT the NextChargeTargetSoC attribute\n"); + if (ShouldSkip("EEVSE.S.A0026")) { + NextTest(); + return; + } + err = TestStep16ThReadsFromTheDutTheNextChargeTargetSoCAttribute_17(); + break; + case 18: + ChipLogProgress(chipTool, " ***** Test Step 18 : Step 17: TH writes to the DUT the ApproximateEVEfficiency attribute value 3500\n"); + if (ShouldSkip("EEVSE.S.A0027")) { + NextTest(); + return; + } + err = TestStep17ThWritesToTheDutTheApproximateEVEfficiencyAttributeValue3500_18(); + break; + case 19: + ChipLogProgress(chipTool, " ***** Test Step 19 : Step 17a: TH reads from the DUT the ApproximateEVEfficiency attribute\n"); + if (ShouldSkip("EEVSE.S.A0027")) { + NextTest(); + return; + } + err = TestStep17aThReadsFromTheDutTheApproximateEVEfficiencyAttribute_19(); + break; + case 20: + ChipLogProgress(chipTool, " ***** Test Step 20 : Step 18: TH reads from the DUT the StateOfCharge attribute\n"); + if (ShouldSkip("EEVSE.S.A0030")) { + NextTest(); + return; + } + err = TestStep18ThReadsFromTheDutTheStateOfChargeAttribute_20(); + break; + case 21: + ChipLogProgress(chipTool, " ***** Test Step 21 : Step 19: TH reads from the DUT the BatteryCapacity attribute\n"); + if (ShouldSkip("EEVSE.S.A0031")) { + NextTest(); + return; + } + err = TestStep19ThReadsFromTheDutTheBatteryCapacityAttribute_21(); + break; + case 22: + ChipLogProgress(chipTool, " ***** Test Step 22 : Step 20: TH reads from the DUT the VehicleID attribute\n"); + if (ShouldSkip("EEVSE.S.A0032")) { + NextTest(); + return; + } + err = TestStep20ThReadsFromTheDutTheVehicleIDAttribute_22(); + break; + case 23: + ChipLogProgress(chipTool, " ***** Test Step 23 : Step 21: TH reads from the DUT the SessionID attribute\n"); + if (ShouldSkip("EEVSE.S.A0040")) { + NextTest(); + return; + } + err = TestStep21ThReadsFromTheDutTheSessionIDAttribute_23(); + break; + case 24: + ChipLogProgress(chipTool, " ***** Test Step 24 : Step 22: TH reads from the DUT the SessionDuration attribute\n"); + if (ShouldSkip("EEVSE.S.A0041")) { + NextTest(); + return; + } + err = TestStep22ThReadsFromTheDutTheSessionDurationAttribute_24(); + break; + case 25: + ChipLogProgress(chipTool, " ***** Test Step 25 : Step 23: TH reads from the DUT the SessionEnergyCharged attribute\n"); + if (ShouldSkip("EEVSE.S.A0042")) { + NextTest(); + return; + } + err = TestStep23ThReadsFromTheDutTheSessionEnergyChargedAttribute_25(); + break; + case 26: + ChipLogProgress(chipTool, " ***** Test Step 26 : Step 24: TH reads from the DUT the SessionEnergyDischarged attribute\n"); + if (ShouldSkip("EEVSE.S.A0043")) { + NextTest(); + return; + } + err = TestStep24ThReadsFromTheDutTheSessionEnergyDischargedAttribute_26(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + void OnStatusUpdate(const chip::app::StatusIB & status) override + { + switch (mTestIndex - 1) { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 12: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 13: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 14: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 15: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 16: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 17: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 18: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 19: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 20: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 21: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 22: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 23: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 24: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 25: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 26: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + } + + // Go on to the next test. + 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 = 27; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestStep1WaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestStep2ThReadsFromTheDutTheStateAttribute_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 2: TH reads from the DUT the State attribute: Error: %@", err); + } else { + NSLog(@"Step 2: TH reads from the DUT the State attribute: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("state", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("state", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("state", [value unsignedCharValue], 6U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep3ThReadsFromTheDutTheSupplyStateAttribute_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeSupplyStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 3: TH reads from the DUT the SupplyState attribute: Error: %@", err); + } else { + NSLog(@"Step 3: TH reads from the DUT the SupplyState attribute: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("supplyState", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("supplyState", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("supplyState", [value unsignedCharValue], 4U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep4ThReadsFromTheDutTheFaultStateAttribute_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFaultStateWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 4: TH reads from the DUT the FaultState attribute: Error: %@", err); + } else { + NSLog(@"Step 4: TH reads from the DUT the FaultState attribute: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("faultState", "enum8", "enum8")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep5ThReadsFromTheDutTheChargingEnabledUntilAttribut_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeChargingEnabledUntilWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 5: TH reads from the DUT the ChargingEnabledUntil attribut: Error: %@", err); + } else { + NSLog(@"Step 5: TH reads from the DUT the ChargingEnabledUntil attribut: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("chargingEnabledUntil", "epoch_s", "epoch-s")); + VerifyOrReturn(CheckConstraintMinValue("chargingEnabledUntil", [value unsignedIntValue], 0UL)); + VerifyOrReturn(CheckConstraintMaxValue("chargingEnabledUntil", [value unsignedIntValue], 4294967295UL)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep6ThReadsFromTheDutTheDischargingEnabledUntilAttribute_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeDischargingEnabledUntilWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 6: TH reads from the DUT the DischargingEnabledUntil attribute: Error: %@", err); + } else { + NSLog(@"Step 6: TH reads from the DUT the DischargingEnabledUntil attribute: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("dischargingEnabledUntil", "epoch_s", "epoch-s")); + VerifyOrReturn(CheckConstraintMinValue("dischargingEnabledUntil", [value unsignedIntValue], 0UL)); + VerifyOrReturn(CheckConstraintMaxValue("dischargingEnabledUntil", [value unsignedIntValue], 4294967295UL)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep7ThReadsFromTheDutTheCircuitCapacityAttribute_6() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeCircuitCapacityWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 7: TH reads from the DUT the CircuitCapacity attribute: Error: %@", err); + } else { + NSLog(@"Step 7: TH reads from the DUT the CircuitCapacity attribute: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("circuitCapacity", "amperage_ma", "amperage_ma")); + VerifyOrReturn(CheckConstraintMinValue("circuitCapacity", [value longLongValue], 0LL)); + VerifyOrReturn(CheckConstraintMaxValue("circuitCapacity", [value longLongValue], 80000LL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep8ThReadsFromTheDutTheMinimumChargeCurrentAttribute_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMinimumChargeCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 8: TH reads from the DUT the MinimumChargeCurrent attribute: Error: %@", err); + } else { + NSLog(@"Step 8: TH reads from the DUT the MinimumChargeCurrent attribute: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("minimumChargeCurrent", "amperage_ma", "amperage_ma")); + VerifyOrReturn(CheckConstraintMinValue("minimumChargeCurrent", [value longLongValue], 0LL)); + VerifyOrReturn(CheckConstraintMaxValue("minimumChargeCurrent", [value longLongValue], 80000LL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep9ThReadsFromTheDutTheMaximumChargeCurrentAttribute_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMaximumChargeCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 9: TH reads from the DUT the MaximumChargeCurrent attribute: Error: %@", err); + } else { + NSLog(@"Step 9: TH reads from the DUT the MaximumChargeCurrent attribute: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("maximumChargeCurrent", "amperage_ma", "amperage_ma")); + VerifyOrReturn(CheckConstraintMinValue("maximumChargeCurrent", [value longLongValue], 0LL)); + VerifyOrReturn(CheckConstraintMaxValue("maximumChargeCurrent", [value longLongValue], 80000LL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep10ThReadsFromTheDutTheMaximumDischargeCurrentAttribute_9() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeMaximumDischargeCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 10: TH reads from the DUT the MaximumDischargeCurrent attribute: Error: %@", err); + } else { + NSLog(@"Step 10: TH reads from the DUT the MaximumDischargeCurrent attribute: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("maximumDischargeCurrent", "amperage_ma", "amperage_ma")); + VerifyOrReturn(CheckConstraintMinValue("maximumDischargeCurrent", [value longLongValue], 0LL)); + VerifyOrReturn(CheckConstraintMaxValue("maximumDischargeCurrent", [value longLongValue], 80000LL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep11ThWritesToTheDutTheUserMaximumChargeCurrentAttributeValue3000_10() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id userMaximumChargeCurrentArgument; + userMaximumChargeCurrentArgument = + [NSNumber numberWithLongLong:30000LL]; + [cluster writeAttributeUserMaximumChargeCurrentWithValue:userMaximumChargeCurrentArgument completion:^(NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 11: TH writes to the DUT the UserMaximumChargeCurrent attribute value 3000: Error: %@", err); + } else { + NSLog(@"Step 11: TH writes to the DUT the UserMaximumChargeCurrent attribute value 3000: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep11aThReadsFromTheDutTheUserMaximumChargeCurrentAttribute_11() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeUserMaximumChargeCurrentWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 11a: TH reads from the DUT the UserMaximumChargeCurrent attribute: Error: %@", err); + } else { + NSLog(@"Step 11a: TH reads from the DUT the UserMaximumChargeCurrent attribute: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("UserMaximumChargeCurrent", actualValue, 30000LL)); + } + + VerifyOrReturn(CheckConstraintType("userMaximumChargeCurrent", "amperage_ma", "amperage_ma")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep12ThWritesToTheDutTheRandomizationDelayWindowAttributeValue600_12() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id randomizationDelayWindowArgument; + randomizationDelayWindowArgument = + [NSNumber numberWithUnsignedInt:600UL]; + [cluster writeAttributeRandomizationDelayWindowWithValue:randomizationDelayWindowArgument completion:^(NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 12: TH writes to the DUT the RandomizationDelayWindow attribute value 600: Error: %@", err); + } else { + NSLog(@"Step 12: TH writes to the DUT the RandomizationDelayWindow attribute value 600: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep12aThReadsFromTheDutTheRandomizationDelayWindowAttribute_13() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeRandomizationDelayWindowWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 12a: TH reads from the DUT the RandomizationDelayWindow attribute: Error: %@", err); + } else { + NSLog(@"Step 12a: TH reads from the DUT the RandomizationDelayWindow attribute: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("RandomizationDelayWindow", actualValue, 600UL)); + } + + VerifyOrReturn(CheckConstraintType("randomizationDelayWindow", "elapsed_s", "elapsed_s")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep13ThReadsFromTheDutTheNextChargeStartTimeAttribute_14() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeNextChargeStartTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 13: TH reads from the DUT the NextChargeStartTime attribute: Error: %@", err); + } else { + NSLog(@"Step 13: TH reads from the DUT the NextChargeStartTime attribute: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("nextChargeStartTime", "epoch_s", "epoch-s")); + VerifyOrReturn(CheckConstraintMinValue("nextChargeStartTime", [value unsignedIntValue], 0UL)); + VerifyOrReturn(CheckConstraintMaxValue("nextChargeStartTime", [value unsignedIntValue], 4294967295UL)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep14ThReadsFromTheDutTheNextChargeTargetTimeAttribute_15() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeNextChargeTargetTimeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 14: TH reads from the DUT the NextChargeTargetTime attribute: Error: %@", err); + } else { + NSLog(@"Step 14: TH reads from the DUT the NextChargeTargetTime attribute: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("nextChargeTargetTime", "epoch_s", "epoch-s")); + VerifyOrReturn(CheckConstraintMinValue("nextChargeTargetTime", [value unsignedIntValue], 0UL)); + VerifyOrReturn(CheckConstraintMaxValue("nextChargeTargetTime", [value unsignedIntValue], 4294967295UL)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep15ThReadsFromTheDutTheNextChargeRequiredEnergyAttribute_16() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeNextChargeRequiredEnergyWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 15: TH reads from the DUT the NextChargeRequiredEnergy attribute: Error: %@", err); + } else { + NSLog(@"Step 15: TH reads from the DUT the NextChargeRequiredEnergy attribute: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("nextChargeRequiredEnergy", "energy_mwh", "energy-mWh")); + VerifyOrReturn(CheckConstraintMinValue("nextChargeRequiredEnergy", [value longLongValue], 0LL)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep16ThReadsFromTheDutTheNextChargeTargetSoCAttribute_17() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeNextChargeTargetSoCWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 16: TH reads from the DUT the NextChargeTargetSoC attribute: Error: %@", err); + } else { + NSLog(@"Step 16: TH reads from the DUT the NextChargeTargetSoC attribute: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("nextChargeTargetSoC", "percent", "percent")); + VerifyOrReturn(CheckConstraintMinValue("nextChargeTargetSoC", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("nextChargeTargetSoC", [value unsignedCharValue], 100U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep17ThWritesToTheDutTheApproximateEVEfficiencyAttributeValue3500_18() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + id approximateEVEfficiencyArgument; + approximateEVEfficiencyArgument = + [NSNumber numberWithUnsignedShort:3500U]; + [cluster writeAttributeApproximateEVEfficiencyWithValue:approximateEVEfficiencyArgument completion:^(NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 17: TH writes to the DUT the ApproximateEVEfficiency attribute value 3500: Error: %@", err); + } else { + NSLog(@"Step 17: TH writes to the DUT the ApproximateEVEfficiency attribute value 3500: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep17aThReadsFromTheDutTheApproximateEVEfficiencyAttribute_19() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeApproximateEVEfficiencyWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 17a: TH reads from the DUT the ApproximateEVEfficiency attribute: Error: %@", err); + } else { + NSLog(@"Step 17a: TH reads from the DUT the ApproximateEVEfficiency attribute: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValueNonNull("ApproximateEVEfficiency", actualValue)); + VerifyOrReturn(CheckValue("ApproximateEVEfficiency", actualValue, 3500U)); + } + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("approximateEVEfficiency", "int16u", "int16u")); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep18ThReadsFromTheDutTheStateOfChargeAttribute_20() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeStateOfChargeWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 18: TH reads from the DUT the StateOfCharge attribute: Error: %@", err); + } else { + NSLog(@"Step 18: TH reads from the DUT the StateOfCharge attribute: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("stateOfCharge", "percent", "percent")); + VerifyOrReturn(CheckConstraintMinValue("stateOfCharge", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("stateOfCharge", [value unsignedCharValue], 100U)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep19ThReadsFromTheDutTheBatteryCapacityAttribute_21() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeBatteryCapacityWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 19: TH reads from the DUT the BatteryCapacity attribute: Error: %@", err); + } else { + NSLog(@"Step 19: TH reads from the DUT the BatteryCapacity attribute: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("batteryCapacity", "energy_mwh", "energy-mWh")); + VerifyOrReturn(CheckConstraintMinValue("batteryCapacity", [value longLongValue], 0LL)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep20ThReadsFromTheDutTheVehicleIDAttribute_22() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeVehicleIDWithCompletion:^(NSString * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 20: TH reads from the DUT the VehicleID attribute: Error: %@", err); + } else { + NSLog(@"Step 20: TH reads from the DUT the VehicleID attribute: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("vehicleID", "char_string", "char_string")); + VerifyOrReturn(CheckConstraintMaxLength("vehicleID", value, 32)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep21ThReadsFromTheDutTheSessionIDAttribute_23() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeSessionIDWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 21: TH reads from the DUT the SessionID attribute: Error: %@", err); + } else { + NSLog(@"Step 21: TH reads from the DUT the SessionID attribute: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("sessionID", "int32u", "int32u")); + VerifyOrReturn(CheckConstraintMinValue("sessionID", [value unsignedIntValue], 0UL)); + VerifyOrReturn(CheckConstraintMaxValue("sessionID", [value unsignedIntValue], 2147483647UL)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep22ThReadsFromTheDutTheSessionDurationAttribute_24() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeSessionDurationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 22: TH reads from the DUT the SessionDuration attribute: Error: %@", err); + } else { + NSLog(@"Step 22: TH reads from the DUT the SessionDuration attribute: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("sessionDuration", "elapsed_s", "elapsed_s")); + VerifyOrReturn(CheckConstraintMinValue("sessionDuration", [value unsignedIntValue], 0UL)); + VerifyOrReturn(CheckConstraintMaxValue("sessionDuration", [value unsignedIntValue], 2147483647UL)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep23ThReadsFromTheDutTheSessionEnergyChargedAttribute_25() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeSessionEnergyChargedWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 23: TH reads from the DUT the SessionEnergyCharged attribute: Error: %@", err); + } else { + NSLog(@"Step 23: TH reads from the DUT the SessionEnergyCharged attribute: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("sessionEnergyCharged", "energy_mwh", "energy-mWh")); + VerifyOrReturn(CheckConstraintMinValue("sessionEnergyCharged", [value longLongValue], 0LL)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep24ThReadsFromTheDutTheSessionEnergyDischargedAttribute_26() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterEnergyEVSE alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeSessionEnergyDischargedWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 24: TH reads from the DUT the SessionEnergyDischarged attribute: Error: %@", err); + } else { + NSLog(@"Step 24: TH reads from the DUT the SessionEnergyDischarged attribute: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + if (value != nil) { + + VerifyOrReturn(CheckConstraintType("sessionEnergyDischarged", "energy_mwh", "energy-mWh")); + VerifyOrReturn(CheckConstraintMinValue("sessionEnergyDischarged", [value longLongValue], 0LL)); + } + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_EEVSEM_1_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_EEVSEM_1_1() + : TestCommandBridge("Test_TC_EEVSEM_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_EEVSEM_1_1() + { + } + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_EEVSEM_1_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_EEVSEM_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 : Step 1: Commission DUT to TH (can be skipped if done in a preceding test).\n"); + err = TestStep1CommissionDutToThCanBeSkippedIfDoneInAPrecedingTest_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Step 2: TH reads from the DUT the ClusterRevision attribute\n"); + err = TestStep2ThReadsFromTheDutTheClusterRevisionAttribute_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Step 3: TH reads from the DUT the FeatureMap attribute\n"); + if (ShouldSkip("PICS_SKIP_SAMPLE_APP")) { + NextTest(); + return; + } + err = TestStep3ThReadsFromTheDutTheFeatureMapAttribute_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : Step 4: TH reads from the DUT the AttributeList attribute\n"); + if (ShouldSkip("PICS_EVENT_LIST_ENABLED")) { + NextTest(); + return; + } + err = TestStep4ThReadsFromTheDutTheAttributeListAttribute_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : Step 4a: TH reads AttributeList from DUT\n"); + if (ShouldSkip("!PICS_EVENT_LIST_ENABLED")) { + NextTest(); + return; + } + err = TestStep4aThReadsAttributeListFromDut_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Step 4b: TH reads optional attribute (StartUpMode) in AttributeList from DUT\n"); + if (ShouldSkip("EEVSEM.S.A0002")) { + NextTest(); + return; + } + err = TestStep4bThReadsOptionalAttributeStartUpModeInAttributeListFromDut_5(); + break; + case 6: + ChipLogProgress(chipTool, " ***** Test Step 6 : Step 5: TH reads EventList from DUT\n"); + if (ShouldSkip("PICS_EVENT_LIST_ENABLED")) { + NextTest(); + return; + } + NextTest(); + return; + case 7: + ChipLogProgress(chipTool, " ***** Test Step 7 : Step 6: TH reads AcceptedCommandList from DUT\n"); + err = TestStep6ThReadsAcceptedCommandListFromDut_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Step 7: TH reads GeneratedCommandList from DUT\n"); + err = TestStep7ThReadsGeneratedCommandListFromDut_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 TestStep1CommissionDutToThCanBeSkippedIfDoneInAPrecedingTest_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestStep2ThReadsFromTheDutTheClusterRevisionAttribute_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterEnergyEVSEMode alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 2: TH reads from the DUT the ClusterRevision attribute: Error: %@", err); + } else { + NSLog(@"Step 2: TH reads from the DUT the ClusterRevision attribute: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 1U)); + } + + VerifyOrReturn(CheckConstraintType("clusterRevision", "int16u", "int16u")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep3ThReadsFromTheDutTheFeatureMapAttribute_2() + { + + chip::app::Clusters::LogCommands::Commands::UserPrompt::Type value; + value.message = chip::Span("Enter 'y' after successgarbage: not in length on purpose", 23); + value.expectedValue.Emplace(); + value.expectedValue.Value() = chip::Span("ygarbage: not in length on purpose", 1); + return UserPrompt("alpha", value); + } + + CHIP_ERROR TestStep4ThReadsFromTheDutTheAttributeListAttribute_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterEnergyEVSEMode alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 4: TH reads from the DUT the AttributeList attribute: Error: %@", err); + } else { + NSLog(@"Step 4: TH reads from the DUT the AttributeList attribute: Success"); + } + + 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, 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 TestStep4aThReadsAttributeListFromDut_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterEnergyEVSEMode alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 4a: TH reads AttributeList from DUT: Error: %@", err); + } else { + NSLog(@"Step 4a: TH reads AttributeList from DUT: Success"); + } + + 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, 65528UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65533UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep4bThReadsOptionalAttributeStartUpModeInAttributeListFromDut_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterEnergyEVSEMode alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 4b: TH reads optional attribute (StartUpMode) in AttributeList from DUT: Error: %@", err); + } else { + NSLog(@"Step 4b: TH reads optional attribute (StartUpMode) in AttributeList from DUT: Success"); + } + + 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 TestStep6ThReadsAcceptedCommandListFromDut_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterEnergyEVSEMode alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 6: TH reads AcceptedCommandList from DUT: Error: %@", err); + } else { + NSLog(@"Step 6: TH reads AcceptedCommandList from DUT: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("AcceptedCommandList", [actualValue count], static_cast(1))); + VerifyOrReturn(CheckValue("", actualValue[0], 0UL)); + } + + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestStep7ThReadsGeneratedCommandListFromDut_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterEnergyEVSEMode alloc] initWithDevice:device endpointID:@(1) queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + if (err != nil) { + NSLog(@"Step 7: TH reads GeneratedCommandList from DUT: Error: %@", err); + } else { + NSLog(@"Step 7: TH reads GeneratedCommandList from DUT: Success"); + } + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("GeneratedCommandList", [actualValue count], static_cast(1))); + VerifyOrReturn(CheckValue("", actualValue[0], 1UL)); + } + + VerifyOrReturn(CheckConstraintType("generatedCommandList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + class Test_TC_FLW_1_1 : public TestCommandBridge { public: // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced @@ -69116,7 +72339,7 @@ class Test_TC_LWM_2_1 : public TestCommandBridge { { id actualValue = value; - VerifyOrReturn(CheckValue("CurrentMode", actualValue, Step6_current_mode_dut)); + VerifyOrReturn(CheckValue("CurrentMode", actualValue, old_current_mode_dut)); } VerifyOrReturn(CheckConstraintType("currentMode", "int8u", "int8u")); @@ -193893,11 +197116,16 @@ void registerCommandsTests(Commands & commands) make_unique(), make_unique(), make_unique(), + make_unique(), + make_unique(), make_unique(), make_unique(), make_unique(), make_unique(), make_unique(), + make_unique(), + make_unique(), + make_unique(), make_unique(), make_unique(), make_unique(),