From 56a87346b158c166d3792098d41c13150cf8e70e Mon Sep 17 00:00:00 2001 From: Vivien Nicolas Date: Fri, 9 Jun 2023 03:02:01 +0200 Subject: [PATCH 1/5] [matter_yamltests] Add single/double constraint type supports (#27075) --- .../matter_chip_tool_adapter/decoder.py | 3 ++- .../matter_yamltests/constraints.py | 20 ++++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/examples/chip-tool/py_matter_chip_tool_adapter/matter_chip_tool_adapter/decoder.py b/examples/chip-tool/py_matter_chip_tool_adapter/matter_chip_tool_adapter/decoder.py index 15522f8dcb3144..929b80570b9acd 100644 --- a/examples/chip-tool/py_matter_chip_tool_adapter/matter_chip_tool_adapter/decoder.py +++ b/examples/chip-tool/py_matter_chip_tool_adapter/matter_chip_tool_adapter/decoder.py @@ -258,7 +258,8 @@ class FloatConverter(BaseConverter): def maybe_convert(self, typename, value): if typename == 'single': - value = float('%g' % value) + float_representation = float("%.16f" % value) + value = float('%g' % float_representation) return value diff --git a/scripts/py_matter_yamltests/matter_yamltests/constraints.py b/scripts/py_matter_yamltests/matter_yamltests/constraints.py index 7c3e2f99cc5dfd..93558330e18ed6 100644 --- a/scripts/py_matter_yamltests/matter_yamltests/constraints.py +++ b/scripts/py_matter_yamltests/matter_yamltests/constraints.py @@ -360,6 +360,10 @@ def check_response(self, value, value_type_name) -> bool: success = value >= -36028797018963967 and value <= 36028797018963967 elif self._type == 'nullable_int64s' and type(value) is int: success = value >= -9223372036854775807 and value <= 9223372036854775807 + elif self._type == 'single' and type(value) is float: + success = self._is_single(value) + elif self._type == 'double' and type(value) is float: + success = self._is_double(value) else: success = self._type == value_type_name return success @@ -502,6 +506,12 @@ def get_reason(self, value, value_type_name) -> str: if value >= -9223372036854775807 and value <= 9223372036854775807: types.append('nullable_int64s') + if self._is_single(value): + types.append('single') + + if self._is_double(value): + types.append('double') + types.sort(key=lambda input_type: [int(c) if c.isdigit( ) else c for c in re.split('([0-9]+)', input_type)]) @@ -509,11 +519,19 @@ def get_reason(self, value, value_type_name) -> str: types.append(value_type_name) if len(types) == 1: - reason = f'The response type {types[0]}) does not match the constraint.' + reason = f'The response type ({types[0]}) does not match the constraint.' else: reason = f'The response value ({value}) is of one of those types: {types}.' return reason + def _is_single(self, value): + return (value >= -1.7976931348623157E+308 and value <= -2.2250738585072014E-308) or value == 0.0 or ( + value >= 2.2250738585072014E-308 and value <= 1.7976931348623157E+308) or math.isnan(value) or math.isinf(value) + + def _is_double(self, value): + return (value >= -1.7976931348623157E+308 and value <= -2.2250738585072014E-308) or value == 0.0 or ( + value >= 2.2250738585072014E-308 and value <= 1.7976931348623157E+308) or math.isnan(value) or math.isinf(value) + class _ConstraintMinLength(BaseConstraint): def __init__(self, context, min_length): From 9e0d56dd5e05b8c8206f95ee5dd3b1a7a20e73a5 Mon Sep 17 00:00:00 2001 From: C Freeman Date: Thu, 8 Jun 2023 21:04:03 -0400 Subject: [PATCH 2/5] Fix cleanup steps for TC-ACE-1.3/4 (#27050) * Fix cleanup steps for TC-ACE-1.3/4 * Whoops, missed a line. --- src/python_testing/TC_ACE_1_3.py | 12 ++++++++---- src/python_testing/TC_ACE_1_4.py | 6 +++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/python_testing/TC_ACE_1_3.py b/src/python_testing/TC_ACE_1_3.py index 3fa0383219be03..a24db8aa18de67 100644 --- a/src/python_testing/TC_ACE_1_3.py +++ b/src/python_testing/TC_ACE_1_3.py @@ -60,9 +60,7 @@ async def test_TC_ACE_1_3(self): logging.info('cat1v1 0x%x', cat1v1) self.print_step(1, "Commissioning, already done") - TH0 = self.default_controller - # _ = TH0 Hack for flake8 F841 local variable 'TH0' is assigned to but never used - _ = TH0 + fabric_admin = self.certificate_authority_manager.activeCaList[0].adminList[0] TH0_nodeid = self.matter_test_config.controller_node_id @@ -343,7 +341,13 @@ async def test_TC_ACE_1_3(self): self.print_step(58, "TH0 writes ACL back to default") - acl = [TH0_admin_acl] + full_acl = Clusters.AccessControl.Structs.AccessControlEntryStruct( + privilege=Clusters.AccessControl.Enums.AccessControlEntryPrivilegeEnum.kAdminister, + authMode=Clusters.AccessControl.Enums.AccessControlEntryAuthModeEnum.kCase, + subjects=[TH0_nodeid], + targets=[]) + + acl = [full_acl] await self.write_acl(acl) diff --git a/src/python_testing/TC_ACE_1_4.py b/src/python_testing/TC_ACE_1_4.py index 0878e7d8e57395..2808be4559ae98 100644 --- a/src/python_testing/TC_ACE_1_4.py +++ b/src/python_testing/TC_ACE_1_4.py @@ -336,13 +336,13 @@ async def test_TC_ACE_1_4(self): self.check_read_success(appcluster_wildcard, self.endpoint, self.cluster, self.attribute) self.print_step(48, "TH1 resets ACL") - descriptor_appendpoint_view = Clusters.AccessControl.Structs.AccessControlEntryStruct( - privilege=Clusters.AccessControl.Enums.AccessControlEntryPrivilegeEnum.kView, + full_acl = Clusters.AccessControl.Structs.AccessControlEntryStruct( + privilege=Clusters.AccessControl.Enums.AccessControlEntryPrivilegeEnum.kAdminister, authMode=Clusters.AccessControl.Enums.AccessControlEntryAuthModeEnum.kCase, subjects=[self.matter_test_config.controller_node_id], targets=[]) - acl = [admin_acl, descriptor_appendpoint_view] + acl = [full_acl] await self.write_acl(acl) From 130da696789dae5aa70dd162a5068882e2288b0e Mon Sep 17 00:00:00 2001 From: tianfeng-yang <130436698+tianfeng-yang@users.noreply.github.com> Date: Fri, 9 Jun 2023 09:08:25 +0800 Subject: [PATCH 3/5] [Python] AttributeReadResult export dataversion (#26943) * [Python] export dataversion field * dataversion does not need a default value * fix CI --- src/controller/python/chip/ChipDeviceCtrl.py | 2 +- src/controller/python/chip/clusters/Attribute.py | 1 + src/controller/python/chip/interaction_model/delegate.py | 1 + src/test_driver/openiotsdk/integration-tests/common/utils.py | 3 ++- 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/controller/python/chip/ChipDeviceCtrl.py b/src/controller/python/chip/ChipDeviceCtrl.py index 7982e3f644911c..d9f3eab9a5a6a5 100644 --- a/src/controller/python/chip/ChipDeviceCtrl.py +++ b/src/controller/python/chip/ChipDeviceCtrl.py @@ -1158,7 +1158,7 @@ def ZCLReadAttribute(self, cluster, attribute, nodeid, endpoint, groupid, blocki nodeid, [(endpoint, attributeType)])) path = ClusterAttribute.AttributePath( EndpointId=endpoint, Attribute=attributeType) - return im.AttributeReadResult(path=im.AttributePath(nodeId=nodeid, endpointId=path.EndpointId, clusterId=path.ClusterId, attributeId=path.AttributeId), status=0, value=result[endpoint][clusterType][attributeType]) + return im.AttributeReadResult(path=im.AttributePath(nodeId=nodeid, endpointId=path.EndpointId, clusterId=path.ClusterId, attributeId=path.AttributeId), status=0, value=result[endpoint][clusterType][attributeType], dataVersion=result[endpoint][clusterType][ClusterAttribute.DataVersion]) def ZCLWriteAttribute(self, cluster: str, attribute: str, nodeid, endpoint, groupid, value, dataVersion=0, blocking=True): req = None diff --git a/src/controller/python/chip/clusters/Attribute.py b/src/controller/python/chip/clusters/Attribute.py index 4eab3700fac7c5..382279bccaf15f 100644 --- a/src/controller/python/chip/clusters/Attribute.py +++ b/src/controller/python/chip/clusters/Attribute.py @@ -266,6 +266,7 @@ class AttributeWriteRequest(AttributeDescriptorWithEndpoint): @dataclass class AttributeReadResult(AttributeStatus): Data: Any = None + DataVersion: int = 0 @dataclass diff --git a/src/controller/python/chip/interaction_model/delegate.py b/src/controller/python/chip/interaction_model/delegate.py index f5aa54c89dbef7..4c52cabf1a767a 100644 --- a/src/controller/python/chip/interaction_model/delegate.py +++ b/src/controller/python/chip/interaction_model/delegate.py @@ -92,6 +92,7 @@ class AttributeReadResult: path: AttributePath status: int value: 'typing.Any' + dataVersion: int @dataclass diff --git a/src/test_driver/openiotsdk/integration-tests/common/utils.py b/src/test_driver/openiotsdk/integration-tests/common/utils.py index 52b52839a6b21b..1a93d27a988865 100644 --- a/src/test_driver/openiotsdk/integration-tests/common/utils.py +++ b/src/test_driver/openiotsdk/integration-tests/common/utils.py @@ -221,7 +221,8 @@ def read_zcl_attribute(devCtrl, cluster: str, attribute: str, nodeId: int, endpo EndpointId=endpoint, Attribute=attributeObj) res = IM.AttributeReadResult(path=IM.AttributePath(nodeId=nodeId, endpointId=path.EndpointId, clusterId=path.ClusterId, - attributeId=path.AttributeId), status=0, value=result[endpoint][clusterObj][attributeObj]) + attributeId=path.AttributeId), status=0, value=result[endpoint][clusterObj][attributeObj], + dataVersion=result[endpoint][clusterObj][ClusterAttribute.DataVersion]) except exceptions.ChipStackException as ex: log.error("An exception occurred during processing ZCL attribute: {}".format(str(ex))) From 16ef27914461bf9f6bee0bd14b6f987d56938c14 Mon Sep 17 00:00:00 2001 From: Tobiasgraf <4622393+tobiasgraf@users.noreply.github.com> Date: Fri, 9 Jun 2023 03:09:42 +0200 Subject: [PATCH 4/5] Add Test Script for Replaceable Monitoring Clusters (#26882) * Add Test scripts for HepaFilterMonitoring Cluster #26842 * Update Test scripts for Hepa Filter Monitoring #26842 * Add Test Scripts for the remaining Replaceable Monitoring Aliased clusters #26842 * Update ciTests.json and PICS.yaml * Update generated code * Fix minor formatting * Fix minor formatting * Add Replaceable Monitoring Ci-pics-values * Update Generated Code * Update Replaceable Monitoring Ci-pics-values * Apply restyler patch * Add 2 more Tests - test that checks that attribute 3 is present if the right PICS is set. - test that checks for command 0 if the right PICS is set. * Update Generated Code * Apply restyled patch * Add missing PICS to ci-pics-values * Update ciTests.json Fix Naming confusion Replaceable vs Resource Monitoring --- src/app/tests/suites/certification/PICS.yaml | 492 + .../certification/Test_TC_ACFREMON_1_1.yaml | 133 + .../certification/Test_TC_ACFREMON_2_1.yaml | 70 + .../certification/Test_TC_CFREMON_1_1.yaml | 133 + .../certification/Test_TC_CFREMON_2_1.yaml | 70 + .../certification/Test_TC_ESFREMON_1_1.yaml | 133 + .../certification/Test_TC_ESFREMON_2_1.yaml | 70 + .../certification/Test_TC_FTREMON_1_1.yaml | 133 + .../certification/Test_TC_FTREMON_2_1.yaml | 70 + .../certification/Test_TC_HEPAFREMON_1_1.yaml | 134 + .../certification/Test_TC_HEPAFREMON_2_1.yaml | 70 + .../certification/Test_TC_INKCREMON_1_1.yaml | 134 + .../certification/Test_TC_INKCREMON_2_1.yaml | 70 + .../certification/Test_TC_IONFREMON_1_1.yaml | 134 + .../certification/Test_TC_IONFREMON_2_1.yaml | 70 + .../certification/Test_TC_OZFREMON_1_1.yaml | 133 + .../certification/Test_TC_OZFREMON_2_1.yaml | 70 + .../certification/Test_TC_TCREMON_1_1.yaml | 133 + .../certification/Test_TC_TCREMON_2_1.yaml | 70 + .../certification/Test_TC_UVFREMON_1_1.yaml | 133 + .../certification/Test_TC_UVFREMON_2_1.yaml | 70 + .../certification/Test_TC_WTREMON_1_1.yaml | 133 + .../certification/Test_TC_WTREMON_2_1.yaml | 70 + .../certification/Test_TC_ZEOFREMON_1_1.yaml | 134 + .../certification/Test_TC_ZEOFREMON_2_1.yaml | 70 + .../tests/suites/certification/ci-pics-values | 132 + src/app/tests/suites/ciTests.json | 29 +- .../chip-tool/zap-generated/test/Commands.h | 4488 +++++++++ .../zap-generated/test/Commands.h | 8184 +++++++++++++++++ 29 files changed, 15764 insertions(+), 1 deletion(-) create mode 100644 src/app/tests/suites/certification/Test_TC_ACFREMON_1_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_ACFREMON_2_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_CFREMON_1_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_CFREMON_2_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_ESFREMON_1_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_ESFREMON_2_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_FTREMON_1_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_FTREMON_2_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_HEPAFREMON_1_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_HEPAFREMON_2_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_INKCREMON_1_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_INKCREMON_2_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_IONFREMON_1_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_IONFREMON_2_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_OZFREMON_1_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_OZFREMON_2_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_TCREMON_1_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_TCREMON_2_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_UVFREMON_1_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_UVFREMON_2_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_WTREMON_1_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_WTREMON_2_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_ZEOFREMON_1_1.yaml create mode 100644 src/app/tests/suites/certification/Test_TC_ZEOFREMON_2_1.yaml diff --git a/src/app/tests/suites/certification/PICS.yaml b/src/app/tests/suites/certification/PICS.yaml index 179a21d48923dc..ed767818f71afb 100644 --- a/src/app/tests/suites/certification/PICS.yaml +++ b/src/app/tests/suites/certification/PICS.yaml @@ -3763,6 +3763,498 @@ PICS: AddGroupIfIdentifying Command?" id: G.C.C05.Tx + # HEPA Filter Monitoring Cluster Test Plan + - label: + "Does the device implement the HEPA Filter Monitoring cluster as a + server?" + id: HEPAFREMON.S + + - label: + "Does the device implement the HEPA Filter Monitoring cluster as a + client?" + id: HEPAFREMON.C + + # + # server / attributes + # + - label: "Does the device implement the Condition attribute?" + id: HEPAFREMON.S.A0000 + + - label: "Does the device implement the DegradationDirection attribute?" + id: HEPAFREMON.S.A0001 + + - label: "Does the device implement the ChangeIndication attribute?" + id: HEPAFREMON.S.A0002 + + - label: "Does the device implement the InPlaceIndicator attribute?" + id: HEPAFREMON.S.A0003 + + # + # server / features + # + - label: "Does the device support the Condition feature?" + id: HEPAFREMON.S.F00 + + - label: "Does the device support the Warning feature?" + id: HEPAFREMON.S.F01 + + # + # server / commandsReceived + # + - label: "Does the device implement receiving the ResetCondition command?" + id: HEPAFREMON.S.C00.Rsp + + # Activated Carbon Filter Monitoring Cluster Test Plan + - label: + "Does the device implement the Activated Carbon Filter Monitoring + cluster as a server?" + id: ACFREMON.S + + - label: + "Does the device implement the Activated Carbon Filter Monitoring + cluster as a client?" + id: ACFREMON.C + + # + # server / attributes + # + - label: "Does the device implement the Condition attribute?" + id: ACFREMON.S.A0000 + + - label: "Does the device implement the DegradationDirection attribute?" + id: ACFREMON.S.A0001 + + - label: "Does the device implement the ChangeIndication attribute?" + id: ACFREMON.S.A0002 + + - label: "Does the device implement the InPlaceIndicator attribute?" + id: ACFREMON.S.A0003 + + # + # server / features + # + - label: "Does the device support the Condition feature?" + id: ACFREMON.S.F00 + + - label: "Does the device support the Warning feature?" + id: ACFREMON.S.F01 + + # + # server / commandsReceived + # + - label: "Does the device implement receiving the ResetCondition command?" + id: ACFREMON.S.C00.Rsp + + # Ceramic Filter Monitoring Cluster Test Plan + - label: + "Does the device implement the Ceramic Filter Monitoring cluster as a + server?" + id: CFREMON.S + + - label: + "Does the device implement the Ceramic Filter Monitoring cluster as a + client?" + id: CFREMON.C + + # + # server / attributes + # + - label: "Does the device implement the Condition attribute?" + id: CFREMON.S.A0000 + + - label: "Does the device implement the DegradationDirection attribute?" + id: CFREMON.S.A0001 + + - label: "Does the device implement the ChangeIndication attribute?" + id: CFREMON.S.A0002 + + - label: "Does the device implement the InPlaceIndicator attribute?" + id: CFREMON.S.A0003 + + # + # server / features + # + - label: "Does the device support the Condition feature?" + id: CFREMON.S.F00 + + - label: "Does the device support the Warning feature?" + id: CFREMON.S.F01 + + # + # server / commandsReceived + # + - label: "Does the device implement receiving the ResetCondition command?" + id: CFREMON.S.C00.Rsp + + # Electrostatic Filter Monitoring Cluster Test Plan + - label: + "Does the device implement the Electrostatic Filter Monitoring cluster + as a server?" + id: ESFREMON.S + + - label: + "Does the device implement the Electrostatic Filter Monitoring cluster + as a client?" + id: ESFREMON.C + + # + # server / attributes + # + - label: "Does the device implement the Condition attribute?" + id: ESFREMON.S.A0000 + + - label: "Does the device implement the DegradationDirection attribute?" + id: ESFREMON.S.A0001 + + - label: "Does the device implement the ChangeIndication attribute?" + id: ESFREMON.S.A0002 + + - label: "Does the device implement the InPlaceIndicator attribute?" + id: ESFREMON.S.A0003 + + # + # server / features + # + - label: "Does the device support the Condition feature?" + id: ESFREMON.S.F00 + + - label: "Does the device support the Warning feature?" + id: ESFREMON.S.F01 + + # + # server / commandsReceived + # + - label: "Does the device implement receiving the ResetCondition command?" + id: ESFREMON.S.C00.Rsp + + # Fuel Tank Monitoring Cluster Test Plan + - label: + "Does the device implement the Fuel Tank Monitoring cluster as a + server?" + id: FTREMON.S + + - label: + "Does the device implement the Fuel Tank Monitoring cluster as a + client?" + id: FTREMON.C + + # + # server / attributes + # + - label: "Does the device implement the Condition attribute?" + id: FTREMON.S.A0000 + + - label: "Does the device implement the DegradationDirection attribute?" + id: FTREMON.S.A0001 + + - label: "Does the device implement the ChangeIndication attribute?" + id: FTREMON.S.A0002 + + - label: "Does the device implement the InPlaceIndicator attribute?" + id: FTREMON.S.A0003 + + # + # server / features + # + - label: "Does the device support the Condition feature?" + id: FTREMON.S.F00 + + - label: "Does the device support the Warning feature?" + id: FTREMON.S.F01 + + # + # server / commandsReceived + # + - label: "Does the device implement receiving the ResetCondition command?" + id: FTREMON.S.C00.Rsp + + # Ink Cartridge Monitoring Cluster Test Plan + - label: + "Does the device implement the Ink Cartridge Monitoring cluster as a + server?" + id: INKCREMON.S + + - label: + "Does the device implement the Ink Cartridge Monitoring cluster as a + client?" + id: INKCREMON.C + + # + # server / attributes + # + - label: "Does the device implement the Condition attribute?" + id: INKCREMON.S.A0000 + + - label: "Does the device implement the DegradationDirection attribute?" + id: INKCREMON.S.A0001 + + - label: "Does the device implement the ChangeIndication attribute?" + id: INKCREMON.S.A0002 + + - label: "Does the device implement the InPlaceIndicator attribute?" + id: INKCREMON.S.A0003 + + # + # server / features + # + - label: "Does the device support the Condition feature?" + id: INKCREMON.S.F00 + + - label: "Does the device support the Warning feature?" + id: INKCREMON.S.F01 + + # + # server / commandsReceived + # + - label: "Does the device implement receiving the ResetCondition command?" + id: INKCREMON.S.C00.Rsp + + # Ionizing Filter Monitoring Cluster Test Plan + - label: + "Does the device implement the Ionizing Filter Monitoring cluster as a + server?" + id: IONFREMON.S + + - label: + "Does the device implement the Ionizing Filter Monitoring cluster as a + client?" + id: IONFREMON.C + + # + # server / attributes + # + - label: "Does the device implement the Condition attribute?" + id: IONFREMON.S.A0000 + + - label: "Does the device implement the DegradationDirection attribute?" + id: IONFREMON.S.A0001 + + - label: "Does the device implement the ChangeIndication attribute?" + id: IONFREMON.S.A0002 + + - label: "Does the device implement the InPlaceIndicator attribute?" + id: IONFREMON.S.A0003 + + # + # server / features + # + - label: "Does the device support the Condition feature?" + id: IONFREMON.S.F00 + + - label: "Does the device support the Warning feature?" + id: IONFREMON.S.F01 + + # + # server / commandsReceived + # + - label: "Does the device implement receiving the ResetCondition command?" + id: IONFREMON.S.C00.Rsp + + # Ozone Filter Monitoring Cluster Test Plan + - label: + "Does the device implement the Ozone Filter Monitoring cluster as a + server?" + id: OZFREMON.S + + - label: + "Does the device implement the Ozone Filter Monitoring cluster as a + client?" + id: OZFREMON.C + + # + # server / attributes + # + - label: "Does the device implement the Condition attribute?" + id: OZFREMON.S.A0000 + + - label: "Does the device implement the DegradationDirection attribute?" + id: OZFREMON.S.A0001 + + - label: "Does the device implement the ChangeIndication attribute?" + id: OZFREMON.S.A0002 + + - label: "Does the device implement the InPlaceIndicator attribute?" + id: OZFREMON.S.A0003 + + # + # server / features + # + - label: "Does the device support the Condition feature?" + id: OZFREMON.S.F00 + + - label: "Does the device support the Warning feature?" + id: OZFREMON.S.F01 + + # + # server / commandsReceived + # + - label: "Does the device implement receiving the ResetCondition command?" + id: OZFREMON.S.C00.Rsp + + # Toner Cartridge Monitoring Cluster Test Plan + - label: + "Does the device implement the Toner Cartridge Monitoring cluster as a + server?" + id: TCREMON.S + + - label: + "Does the device implement the Toner Cartridge Monitoring cluster as a + client?" + id: TCREMON.C + + # + # server / attributes + # + - label: "Does the device implement the Condition attribute?" + id: TCREMON.S.A0000 + + - label: "Does the device implement the DegradationDirection attribute?" + id: TCREMON.S.A0001 + + - label: "Does the device implement the ChangeIndication attribute?" + id: TCREMON.S.A0002 + + - label: "Does the device implement the InPlaceIndicator attribute?" + id: TCREMON.S.A0003 + + # + # server / features + # + - label: "Does the device support the Condition feature?" + id: TCREMON.S.F00 + + - label: "Does the device support the Warning feature?" + id: TCREMON.S.F01 + + # + # server / commandsReceived + # + - label: "Does the device implement receiving the ResetCondition command?" + id: TCREMON.S.C00.Rsp + + # UV Filter Monitoring Cluster Test Plan + - label: + "Does the device implement the UV Filter Monitoring cluster as a + server?" + id: UVFREMON.S + + - label: + "Does the device implement the UV Filter Monitoring cluster as a + client?" + id: UVFREMON.C + + # + # server / attributes + # + - label: "Does the device implement the Condition attribute?" + id: UVFREMON.S.A0000 + + - label: "Does the device implement the DegradationDirection attribute?" + id: UVFREMON.S.A0001 + + - label: "Does the device implement the ChangeIndication attribute?" + id: UVFREMON.S.A0002 + + - label: "Does the device implement the InPlaceIndicator attribute?" + id: UVFREMON.S.A0003 + + # + # server / features + # + - label: "Does the device support the Condition feature?" + id: UVFREMON.S.F00 + + - label: "Does the device support the Warning feature?" + id: UVFREMON.S.F01 + + # + # server / commandsReceived + # + - label: "Does the device implement receiving the ResetCondition command?" + id: UVFREMON.S.C00.Rsp + + # Water Tank Monitoring Cluster Test Plan + - label: + "Does the device implement the Water Tank Monitoring cluster as a + server?" + id: WTREMON.S + + - label: + "Does the device implement the Water Tank Monitoring cluster as a + client?" + id: WTREMON.C + + # + # server / attributes + # + - label: "Does the device implement the Condition attribute?" + id: WTREMON.S.A0000 + + - label: "Does the device implement the DegradationDirection attribute?" + id: WTREMON.S.A0001 + + - label: "Does the device implement the ChangeIndication attribute?" + id: WTREMON.S.A0002 + + - label: "Does the device implement the InPlaceIndicator attribute?" + id: WTREMON.S.A0003 + + # + # server / features + # + - label: "Does the device support the Condition feature?" + id: WTREMON.S.F00 + + - label: "Does the device support the Warning feature?" + id: WTREMON.S.F01 + + # + # server / commandsReceived + # + - label: "Does the device implement receiving the ResetCondition command?" + id: WTREMON.S.C00.Rsp + + # Zeolite Filter Monitoring Cluster Test Plan + - label: + "Does the device implement the Zeolite Filter Monitoring cluster as a + server?" + id: ZEOFREMON.S + + - label: + "Does the device implement the Zeolite Filter Monitoring cluster as a + client?" + id: ZEOFREMON.C + + # + # server / attributes + # + - label: "Does the device implement the Condition attribute?" + id: ZEOFREMON.S.A0000 + + - label: "Does the device implement the DegradationDirection attribute?" + id: ZEOFREMON.S.A0001 + + - label: "Does the device implement the ChangeIndication attribute?" + id: ZEOFREMON.S.A0002 + + - label: "Does the device implement the InPlaceIndicator attribute?" + id: ZEOFREMON.S.A0003 + + # + # server / features + # + - label: "Does the device support the Condition feature?" + id: ZEOFREMON.S.F00 + + - label: "Does the device support the Warning feature?" + id: ZEOFREMON.S.F01 + + # + # server / commandsReceived + # + - label: "Does the device implement receiving the ResetCondition command?" + id: ZEOFREMON.S.C00.Rsp + # Identify Cluster Test Plan - label: "Does the device implement the Identify cluster as a server?" id: I.S diff --git a/src/app/tests/suites/certification/Test_TC_ACFREMON_1_1.yaml b/src/app/tests/suites/certification/Test_TC_ACFREMON_1_1.yaml new file mode 100644 index 00000000000000..1e6d2f87c4074a --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_ACFREMON_1_1.yaml @@ -0,0 +1,133 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 165.1.1. [TC-ACFREMON-1.1] Global Attributes with DUT as Server + +PICS: + - ACFREMON.S + +config: + nodeId: 0x12344321 + cluster: "Activated Carbon Filter Monitoring" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "Read the global attribute: ClusterRevision" + command: "readAttribute" + attribute: "ClusterRevision" + response: + value: 1 + constraints: + type: int16u + + - label: "Read the global attribute: FeatureMap" + command: "readAttribute" + attribute: "FeatureMap" + PICS: "!ACFREMON.S.F00 && !ACFREMON.S.F01" + response: + value: 0 + constraints: + type: bitmap32 + + - label: + "Given ACFREMON.S.F00(Condition) ensure featuremap has the correct bit + set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: ACFREMON.S.F00 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x1] + + - label: + "Given ACFREMON.S.F01(Warning) ensure featuremap has the correct bit + set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: ACFREMON.S.F01 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x2] + + - label: "Read the global attribute: AttributeList" + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [2, 65528, 65529, 65530, 65531, 65532, 65533] + + - label: + "Read the feature dependent(ACFREMON.S.F00) attribute in AttributeList" + PICS: ACFREMON.S.F00 + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [0, 1] + + - label: + "Read the optional attribute InPlaceIndicator (ACFREMON.S.A0002) in + AttributeList" + PICS: ACFREMON.S.A0002 + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [3] + + - label: "Read the global attribute: AcceptedCommandList" + command: "readAttribute" + attribute: "AcceptedCommandList" + response: + constraints: + type: list + contains: [] + + - label: "Read the optional command (ResetCondition) in AcceptedCommandList" + PICS: ACFREMON.S.C00.Rsp + command: "readAttribute" + attribute: "AcceptedCommandList" + response: + constraints: + type: list + contains: [0] + + - label: "Read the global attribute: GeneratedCommandList" + command: "readAttribute" + attribute: "GeneratedCommandList" + response: + value: [] + constraints: + type: list + + - label: "TH reads EventList attribute from DUT" + command: "readAttribute" + attribute: "EventList" + response: + value: [] + constraints: + type: list diff --git a/src/app/tests/suites/certification/Test_TC_ACFREMON_2_1.yaml b/src/app/tests/suites/certification/Test_TC_ACFREMON_2_1.yaml new file mode 100644 index 00000000000000..b3a1fa14045a8b --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_ACFREMON_2_1.yaml @@ -0,0 +1,70 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 165.2.1. [TC-ACFREMON-2.1] Attributes with server as DUT + +PICS: + - ACFREMON.S + +config: + nodeId: 0x12344321 + cluster: "Activated Carbon Filter Monitoring" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "TH reads from the DUT the Condition attribute." + PICS: ACFREMON.S.A0000 + command: "readAttribute" + attribute: "Condition" + response: + constraints: + type: percent + minValue: 0 + maxValue: 100 + + - label: "TH reads from the DUT the DegradationDirection attribute.." + PICS: ACFREMON.S.A0001 + command: "readAttribute" + attribute: "DegradationDirection" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 1 + + - label: "TH reads from the DUT the ChangeIndication attribute." + PICS: ACFREMON.S.A0002 + command: "readAttribute" + attribute: "ChangeIndication" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 2 + + - label: "TH reads from the DUT the InPlaceIndicator attribute" + PICS: ACFREMON.S.A0003 + command: "readAttribute" + attribute: "InPlaceIndicator" + response: + constraints: + type: boolean diff --git a/src/app/tests/suites/certification/Test_TC_CFREMON_1_1.yaml b/src/app/tests/suites/certification/Test_TC_CFREMON_1_1.yaml new file mode 100644 index 00000000000000..aa148d15104ae3 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_CFREMON_1_1.yaml @@ -0,0 +1,133 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 165.1.1. [TC-CFREMON-1.1] Global Attributes with DUT as Server + +PICS: + - CFREMON.S + +config: + nodeId: 0x12344321 + cluster: "Ceramic Filter Monitoring" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "Read the global attribute: ClusterRevision" + command: "readAttribute" + attribute: "ClusterRevision" + response: + value: 1 + constraints: + type: int16u + + - label: "Read the global attribute: FeatureMap" + command: "readAttribute" + attribute: "FeatureMap" + PICS: "!CFREMON.S.F00 && !CFREMON.S.F01" + response: + value: 0 + constraints: + type: bitmap32 + + - label: + "Given CFREMON.S.F00(Condition) ensure featuremap has the correct bit + set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: CFREMON.S.F00 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x1] + + - label: + "Given CFREMON.S.F01(Warning) ensure featuremap has the correct bit + set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: CFREMON.S.F01 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x2] + + - label: "Read the global attribute: AttributeList" + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [2, 65528, 65529, 65530, 65531, 65532, 65533] + + - label: + "Read the feature dependent(CFREMON.S.F00) attribute in AttributeList" + PICS: CFREMON.S.F00 + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [0, 1] + + - label: + "Read the optional attribute InPlaceIndicator (CFREMON.S.A0002) in + AttributeList" + PICS: CFREMON.S.A0002 + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [3] + + - label: "Read the global attribute: AcceptedCommandList" + command: "readAttribute" + attribute: "AcceptedCommandList" + response: + constraints: + type: list + contains: [] + + - label: "Read the optional command (ResetCondition) in AcceptedCommandList" + PICS: CFREMON.S.C00.Rsp + command: "readAttribute" + attribute: "AcceptedCommandList" + response: + constraints: + type: list + contains: [0] + + - label: "Read the global attribute: GeneratedCommandList" + command: "readAttribute" + attribute: "GeneratedCommandList" + response: + value: [] + constraints: + type: list + + - label: "TH reads EventList attribute from DUT" + command: "readAttribute" + attribute: "EventList" + response: + value: [] + constraints: + type: list diff --git a/src/app/tests/suites/certification/Test_TC_CFREMON_2_1.yaml b/src/app/tests/suites/certification/Test_TC_CFREMON_2_1.yaml new file mode 100644 index 00000000000000..4d98d1f40e2d2a --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_CFREMON_2_1.yaml @@ -0,0 +1,70 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 165.2.1. [TC-CFREMON-2.1] Attributes with server as DUT + +PICS: + - CFREMON.S + +config: + nodeId: 0x12344321 + cluster: "Ceramic Filter Monitoring" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "TH reads from the DUT the Condition attribute." + PICS: CFREMON.S.A0000 + command: "readAttribute" + attribute: "Condition" + response: + constraints: + type: percent + minValue: 0 + maxValue: 100 + + - label: "TH reads from the DUT the DegradationDirection attribute.." + PICS: CFREMON.S.A0001 + command: "readAttribute" + attribute: "DegradationDirection" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 1 + + - label: "TH reads from the DUT the ChangeIndication attribute." + PICS: CFREMON.S.A0002 + command: "readAttribute" + attribute: "ChangeIndication" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 2 + + - label: "TH reads from the DUT the InPlaceIndicator attribute" + PICS: CFREMON.S.A0003 + command: "readAttribute" + attribute: "InPlaceIndicator" + response: + constraints: + type: boolean diff --git a/src/app/tests/suites/certification/Test_TC_ESFREMON_1_1.yaml b/src/app/tests/suites/certification/Test_TC_ESFREMON_1_1.yaml new file mode 100644 index 00000000000000..72375e898f6122 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_ESFREMON_1_1.yaml @@ -0,0 +1,133 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 165.1.1. [TC-ESFREMON-1.1] Global Attributes with DUT as Server + +PICS: + - ESFREMON.S + +config: + nodeId: 0x12344321 + cluster: "Electrostatic Filter Monitoring" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "Read the global attribute: ClusterRevision" + command: "readAttribute" + attribute: "ClusterRevision" + response: + value: 1 + constraints: + type: int16u + + - label: "Read the global attribute: FeatureMap" + command: "readAttribute" + attribute: "FeatureMap" + PICS: "!ESFREMON.S.F00 && !ESFREMON.S.F01" + response: + value: 0 + constraints: + type: bitmap32 + + - label: + "Given ESFREMON.S.F00(Condition) ensure featuremap has the correct bit + set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: ESFREMON.S.F00 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x1] + + - label: + "Given ESFREMON.S.F01(Warning) ensure featuremap has the correct bit + set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: ESFREMON.S.F01 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x2] + + - label: "Read the global attribute: AttributeList" + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [2, 65528, 65529, 65530, 65531, 65532, 65533] + + - label: + "Read the feature dependent(ESFREMON.S.F00) attribute in AttributeList" + PICS: ESFREMON.S.F00 + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [0, 1] + + - label: + "Read the optional attribute InPlaceIndicator (ESFREMON.S.A0002) in + AttributeList" + PICS: ESFREMON.S.A0002 + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [3] + + - label: "Read the global attribute: AcceptedCommandList" + command: "readAttribute" + attribute: "AcceptedCommandList" + response: + constraints: + type: list + contains: [] + + - label: "Read the optional command (ResetCondition) in AcceptedCommandList" + PICS: ESFREMON.S.C00.Rsp + command: "readAttribute" + attribute: "AcceptedCommandList" + response: + constraints: + type: list + contains: [0] + + - label: "Read the global attribute: GeneratedCommandList" + command: "readAttribute" + attribute: "GeneratedCommandList" + response: + value: [] + constraints: + type: list + + - label: "TH reads EventList attribute from DUT" + command: "readAttribute" + attribute: "EventList" + response: + value: [] + constraints: + type: list diff --git a/src/app/tests/suites/certification/Test_TC_ESFREMON_2_1.yaml b/src/app/tests/suites/certification/Test_TC_ESFREMON_2_1.yaml new file mode 100644 index 00000000000000..9fccbc32d10826 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_ESFREMON_2_1.yaml @@ -0,0 +1,70 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 165.2.1. [TC-ESFREMON-2.1] Attributes with server as DUT + +PICS: + - ESFREMON.S + +config: + nodeId: 0x12344321 + cluster: "Electrostatic Filter Monitoring" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "TH reads from the DUT the Condition attribute." + PICS: ESFREMON.S.A0000 + command: "readAttribute" + attribute: "Condition" + response: + constraints: + type: percent + minValue: 0 + maxValue: 100 + + - label: "TH reads from the DUT the DegradationDirection attribute.." + PICS: ESFREMON.S.A0001 + command: "readAttribute" + attribute: "DegradationDirection" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 1 + + - label: "TH reads from the DUT the ChangeIndication attribute." + PICS: ESFREMON.S.A0002 + command: "readAttribute" + attribute: "ChangeIndication" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 2 + + - label: "TH reads from the DUT the InPlaceIndicator attribute" + PICS: ESFREMON.S.A0003 + command: "readAttribute" + attribute: "InPlaceIndicator" + response: + constraints: + type: boolean diff --git a/src/app/tests/suites/certification/Test_TC_FTREMON_1_1.yaml b/src/app/tests/suites/certification/Test_TC_FTREMON_1_1.yaml new file mode 100644 index 00000000000000..00449d882cd1aa --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_FTREMON_1_1.yaml @@ -0,0 +1,133 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 165.1.1. [TC-FTREMON-1.1] Global Attributes with DUT as Server + +PICS: + - FTREMON.S + +config: + nodeId: 0x12344321 + cluster: "Fuel Tank Monitoring" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "Read the global attribute: ClusterRevision" + command: "readAttribute" + attribute: "ClusterRevision" + response: + value: 1 + constraints: + type: int16u + + - label: "Read the global attribute: FeatureMap" + command: "readAttribute" + attribute: "FeatureMap" + PICS: "!FTREMON.S.F00 && !FTREMON.S.F01" + response: + value: 0 + constraints: + type: bitmap32 + + - label: + "Given FTREMON.S.F00(Condition) ensure featuremap has the correct bit + set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: FTREMON.S.F00 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x1] + + - label: + "Given FTREMON.S.F01(Warning) ensure featuremap has the correct bit + set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: FTREMON.S.F01 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x2] + + - label: "Read the global attribute: AttributeList" + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [2, 65528, 65529, 65530, 65531, 65532, 65533] + + - label: + "Read the feature dependent(FTREMON.S.F00) attribute in AttributeList" + PICS: FTREMON.S.F00 + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [0, 1] + + - label: + "Read the optional attribute InPlaceIndicator (FTREMON.S.A0002) in + AttributeList" + PICS: FTREMON.S.A0002 + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [3] + + - label: "Read the global attribute: AcceptedCommandList" + command: "readAttribute" + attribute: "AcceptedCommandList" + response: + constraints: + type: list + contains: [] + + - label: "Read the optional command (ResetCondition) in AcceptedCommandList" + PICS: FTREMON.S.C00.Rsp + command: "readAttribute" + attribute: "AcceptedCommandList" + response: + constraints: + type: list + contains: [0] + + - label: "Read the global attribute: GeneratedCommandList" + command: "readAttribute" + attribute: "GeneratedCommandList" + response: + value: [] + constraints: + type: list + + - label: "TH reads EventList attribute from DUT" + command: "readAttribute" + attribute: "EventList" + response: + value: [] + constraints: + type: list diff --git a/src/app/tests/suites/certification/Test_TC_FTREMON_2_1.yaml b/src/app/tests/suites/certification/Test_TC_FTREMON_2_1.yaml new file mode 100644 index 00000000000000..864fff73f2535f --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_FTREMON_2_1.yaml @@ -0,0 +1,70 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 165.2.1. [TC-FTREMON-2.1] Attributes with server as DUT + +PICS: + - FTREMON.S + +config: + nodeId: 0x12344321 + cluster: "Fuel Tank Monitoring" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "TH reads from the DUT the Condition attribute." + PICS: FTREMON.S.A0000 + command: "readAttribute" + attribute: "Condition" + response: + constraints: + type: percent + minValue: 0 + maxValue: 100 + + - label: "TH reads from the DUT the DegradationDirection attribute.." + PICS: FTREMON.S.A0001 + command: "readAttribute" + attribute: "DegradationDirection" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 1 + + - label: "TH reads from the DUT the ChangeIndication attribute." + PICS: FTREMON.S.A0002 + command: "readAttribute" + attribute: "ChangeIndication" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 2 + + - label: "TH reads from the DUT the InPlaceIndicator attribute" + PICS: FTREMON.S.A0003 + command: "readAttribute" + attribute: "InPlaceIndicator" + response: + constraints: + type: boolean diff --git a/src/app/tests/suites/certification/Test_TC_HEPAFREMON_1_1.yaml b/src/app/tests/suites/certification/Test_TC_HEPAFREMON_1_1.yaml new file mode 100644 index 00000000000000..d783404ad34534 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_HEPAFREMON_1_1.yaml @@ -0,0 +1,134 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 165.1.1. [TC-HEPAFREMON-1.1] Global Attributes with DUT as Server + +PICS: + - HEPAFREMON.S + +config: + nodeId: 0x12344321 + cluster: "HEPA Filter Monitoring" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "Read the global attribute: ClusterRevision" + command: "readAttribute" + attribute: "ClusterRevision" + response: + value: 1 + constraints: + type: int16u + + - label: "Read the global attribute: FeatureMap" + command: "readAttribute" + attribute: "FeatureMap" + PICS: "!HEPAFREMON.S.F00 && !HEPAFREMON.S.F01" + response: + value: 0 + constraints: + type: bitmap32 + + - label: + "Given HEPAFREMON.S.F00(Condition) ensure featuremap has the correct + bit set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: HEPAFREMON.S.F00 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x1] + + - label: + "Given HEPAFREMON.S.F01(Warning) ensure featuremap has the correct bit + set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: HEPAFREMON.S.F01 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x2] + + - label: "Read the global attribute: AttributeList" + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [2, 65528, 65529, 65530, 65531, 65532, 65533] + + - label: + "Read the feature dependent(HEPAFREMON.S.F00) attribute in + AttributeList" + PICS: HEPAFREMON.S.F00 + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [0, 1] + + - label: + "Read the optional attribute InPlaceIndicator (HEPAFREMON.S.A0002) in + AttributeList" + PICS: HEPAFREMON.S.A0002 + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [3] + + - label: "Read the global attribute: AcceptedCommandList" + command: "readAttribute" + attribute: "AcceptedCommandList" + response: + constraints: + type: list + contains: [] + + - label: "Read the optional command (ResetCondition) in AcceptedCommandList" + PICS: HEPAFREMON.S.C00.Rsp + command: "readAttribute" + attribute: "AcceptedCommandList" + response: + constraints: + type: list + contains: [0] + + - label: "Read the global attribute: GeneratedCommandList" + command: "readAttribute" + attribute: "GeneratedCommandList" + response: + value: [] + constraints: + type: list + + - label: "TH reads EventList attribute from DUT" + command: "readAttribute" + attribute: "EventList" + response: + value: [] + constraints: + type: list diff --git a/src/app/tests/suites/certification/Test_TC_HEPAFREMON_2_1.yaml b/src/app/tests/suites/certification/Test_TC_HEPAFREMON_2_1.yaml new file mode 100644 index 00000000000000..af9f1c26218e71 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_HEPAFREMON_2_1.yaml @@ -0,0 +1,70 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 165.2.1. [TC-HEPAFREMON-2.1] Attributes with server as DUT + +PICS: + - HEPAFREMON.S + +config: + nodeId: 0x12344321 + cluster: "HEPA Filter Monitoring" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "TH reads from the DUT the Condition attribute." + PICS: HEPAFREMON.S.A0000 + command: "readAttribute" + attribute: "Condition" + response: + constraints: + type: percent + minValue: 0 + maxValue: 100 + + - label: "TH reads from the DUT the DegradationDirection attribute.." + PICS: HEPAFREMON.S.A0001 + command: "readAttribute" + attribute: "DegradationDirection" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 1 + + - label: "TH reads from the DUT the ChangeIndication attribute." + PICS: HEPAFREMON.S.A0002 + command: "readAttribute" + attribute: "ChangeIndication" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 2 + + - label: "TH reads from the DUT the InPlaceIndicator attribute" + PICS: HEPAFREMON.S.A0003 + command: "readAttribute" + attribute: "InPlaceIndicator" + response: + constraints: + type: boolean diff --git a/src/app/tests/suites/certification/Test_TC_INKCREMON_1_1.yaml b/src/app/tests/suites/certification/Test_TC_INKCREMON_1_1.yaml new file mode 100644 index 00000000000000..303dbfd9538671 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_INKCREMON_1_1.yaml @@ -0,0 +1,134 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 165.1.1. [TC-INKCREMON-1.1] Global Attributes with DUT as Server + +PICS: + - INKCREMON.S + +config: + nodeId: 0x12344321 + cluster: "Ink Cartridge Monitoring" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "Read the global attribute: ClusterRevision" + command: "readAttribute" + attribute: "ClusterRevision" + response: + value: 1 + constraints: + type: int16u + + - label: "Read the global attribute: FeatureMap" + command: "readAttribute" + attribute: "FeatureMap" + PICS: "!INKCREMON.S.F00 && !INKCREMON.S.F01" + response: + value: 0 + constraints: + type: bitmap32 + + - label: + "Given INKCREMON.S.F00(Condition) ensure featuremap has the correct + bit set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: INKCREMON.S.F00 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x1] + + - label: + "Given INKCREMON.S.F01(Warning) ensure featuremap has the correct bit + set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: INKCREMON.S.F01 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x2] + + - label: "Read the global attribute: AttributeList" + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [2, 65528, 65529, 65530, 65531, 65532, 65533] + + - label: + "Read the feature dependent(INKCREMON.S.F00) attribute in + AttributeList" + PICS: INKCREMON.S.F00 + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [0, 1] + + - label: + "Read the optional attribute InPlaceIndicator (INKCREMON.S.A0002) in + AttributeList" + PICS: INKCREMON.S.A0002 + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [3] + + - label: "Read the global attribute: AcceptedCommandList" + command: "readAttribute" + attribute: "AcceptedCommandList" + response: + constraints: + type: list + contains: [] + + - label: "Read the optional command (ResetCondition) in AcceptedCommandList" + PICS: INKCREMON.S.C00.Rsp + command: "readAttribute" + attribute: "AcceptedCommandList" + response: + constraints: + type: list + contains: [0] + + - label: "Read the global attribute: GeneratedCommandList" + command: "readAttribute" + attribute: "GeneratedCommandList" + response: + value: [] + constraints: + type: list + + - label: "TH reads EventList attribute from DUT" + command: "readAttribute" + attribute: "EventList" + response: + value: [] + constraints: + type: list diff --git a/src/app/tests/suites/certification/Test_TC_INKCREMON_2_1.yaml b/src/app/tests/suites/certification/Test_TC_INKCREMON_2_1.yaml new file mode 100644 index 00000000000000..b2be9f2b8eeae7 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_INKCREMON_2_1.yaml @@ -0,0 +1,70 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 165.2.1. [TC-INKCREMON-2.1] Attributes with server as DUT + +PICS: + - INKCREMON.S + +config: + nodeId: 0x12344321 + cluster: "Ink Cartridge Monitoring" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "TH reads from the DUT the Condition attribute." + PICS: INKCREMON.S.A0000 + command: "readAttribute" + attribute: "Condition" + response: + constraints: + type: percent + minValue: 0 + maxValue: 100 + + - label: "TH reads from the DUT the DegradationDirection attribute.." + PICS: INKCREMON.S.A0001 + command: "readAttribute" + attribute: "DegradationDirection" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 1 + + - label: "TH reads from the DUT the ChangeIndication attribute." + PICS: INKCREMON.S.A0002 + command: "readAttribute" + attribute: "ChangeIndication" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 2 + + - label: "TH reads from the DUT the InPlaceIndicator attribute" + PICS: INKCREMON.S.A0003 + command: "readAttribute" + attribute: "InPlaceIndicator" + response: + constraints: + type: boolean diff --git a/src/app/tests/suites/certification/Test_TC_IONFREMON_1_1.yaml b/src/app/tests/suites/certification/Test_TC_IONFREMON_1_1.yaml new file mode 100644 index 00000000000000..7e085c8766e2e3 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_IONFREMON_1_1.yaml @@ -0,0 +1,134 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 165.1.1. [TC-IONFREMON-1.1] Global Attributes with DUT as Server + +PICS: + - IONFREMON.S + +config: + nodeId: 0x12344321 + cluster: "Ionizing Filter Monitoring" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "Read the global attribute: ClusterRevision" + command: "readAttribute" + attribute: "ClusterRevision" + response: + value: 1 + constraints: + type: int16u + + - label: "Read the global attribute: FeatureMap" + command: "readAttribute" + attribute: "FeatureMap" + PICS: "!IONFREMON.S.F00 && !IONFREMON.S.F01" + response: + value: 0 + constraints: + type: bitmap32 + + - label: + "Given IONFREMON.S.F00(Condition) ensure featuremap has the correct + bit set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: IONFREMON.S.F00 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x1] + + - label: + "Given IONFREMON.S.F01(Warning) ensure featuremap has the correct bit + set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: IONFREMON.S.F01 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x2] + + - label: "Read the global attribute: AttributeList" + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [2, 65528, 65529, 65530, 65531, 65532, 65533] + + - label: + "Read the feature dependent(IONFREMON.S.F00) attribute in + AttributeList" + PICS: IONFREMON.S.F00 + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [0, 1] + + - label: + "Read the optional attribute InPlaceIndicator (IONFREMON.S.A0002) in + AttributeList" + PICS: IONFREMON.S.A0002 + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [3] + + - label: "Read the global attribute: AcceptedCommandList" + command: "readAttribute" + attribute: "AcceptedCommandList" + response: + constraints: + type: list + contains: [] + + - label: "Read the optional command (ResetCondition) in AcceptedCommandList" + PICS: IONFREMON.S.C00.Rsp + command: "readAttribute" + attribute: "AcceptedCommandList" + response: + constraints: + type: list + contains: [0] + + - label: "Read the global attribute: GeneratedCommandList" + command: "readAttribute" + attribute: "GeneratedCommandList" + response: + value: [] + constraints: + type: list + + - label: "TH reads EventList attribute from DUT" + command: "readAttribute" + attribute: "EventList" + response: + value: [] + constraints: + type: list diff --git a/src/app/tests/suites/certification/Test_TC_IONFREMON_2_1.yaml b/src/app/tests/suites/certification/Test_TC_IONFREMON_2_1.yaml new file mode 100644 index 00000000000000..4e8dd20e5e9e0e --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_IONFREMON_2_1.yaml @@ -0,0 +1,70 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 165.2.1. [TC-IONFREMON-2.1] Attributes with server as DUT + +PICS: + - IONFREMON.S + +config: + nodeId: 0x12344321 + cluster: "Ionizing Filter Monitoring" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "TH reads from the DUT the Condition attribute." + PICS: IONFREMON.S.A0000 + command: "readAttribute" + attribute: "Condition" + response: + constraints: + type: percent + minValue: 0 + maxValue: 100 + + - label: "TH reads from the DUT the DegradationDirection attribute.." + PICS: IONFREMON.S.A0001 + command: "readAttribute" + attribute: "DegradationDirection" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 1 + + - label: "TH reads from the DUT the ChangeIndication attribute." + PICS: IONFREMON.S.A0002 + command: "readAttribute" + attribute: "ChangeIndication" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 2 + + - label: "TH reads from the DUT the InPlaceIndicator attribute" + PICS: IONFREMON.S.A0003 + command: "readAttribute" + attribute: "InPlaceIndicator" + response: + constraints: + type: boolean diff --git a/src/app/tests/suites/certification/Test_TC_OZFREMON_1_1.yaml b/src/app/tests/suites/certification/Test_TC_OZFREMON_1_1.yaml new file mode 100644 index 00000000000000..6c780be2faa5a0 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_OZFREMON_1_1.yaml @@ -0,0 +1,133 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 165.1.1. [TC-OZFREMON-1.1] Global Attributes with DUT as Server + +PICS: + - OZFREMON.S + +config: + nodeId: 0x12344321 + cluster: "Ozone Filter Monitoring" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "Read the global attribute: ClusterRevision" + command: "readAttribute" + attribute: "ClusterRevision" + response: + value: 1 + constraints: + type: int16u + + - label: "Read the global attribute: FeatureMap" + command: "readAttribute" + attribute: "FeatureMap" + PICS: "!OZFREMON.S.F00 && !OZFREMON.S.F01" + response: + value: 0 + constraints: + type: bitmap32 + + - label: + "Given OZFREMON.S.F00(Condition) ensure featuremap has the correct bit + set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: OZFREMON.S.F00 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x1] + + - label: + "Given OZFREMON.S.F01(Warning) ensure featuremap has the correct bit + set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: OZFREMON.S.F01 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x2] + + - label: "Read the global attribute: AttributeList" + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [2, 65528, 65529, 65530, 65531, 65532, 65533] + + - label: + "Read the feature dependent(OZFREMON.S.F00) attribute in AttributeList" + PICS: OZFREMON.S.F00 + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [0, 1] + + - label: + "Read the optional attribute InPlaceIndicator (OZFREMON.S.A0002) in + AttributeList" + PICS: OZFREMON.S.A0002 + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [3] + + - label: "Read the global attribute: AcceptedCommandList" + command: "readAttribute" + attribute: "AcceptedCommandList" + response: + constraints: + type: list + contains: [] + + - label: "Read the optional command (ResetCondition) in AcceptedCommandList" + PICS: OZFREMON.S.C00.Rsp + command: "readAttribute" + attribute: "AcceptedCommandList" + response: + constraints: + type: list + contains: [0] + + - label: "Read the global attribute: GeneratedCommandList" + command: "readAttribute" + attribute: "GeneratedCommandList" + response: + value: [] + constraints: + type: list + + - label: "TH reads EventList attribute from DUT" + command: "readAttribute" + attribute: "EventList" + response: + value: [] + constraints: + type: list diff --git a/src/app/tests/suites/certification/Test_TC_OZFREMON_2_1.yaml b/src/app/tests/suites/certification/Test_TC_OZFREMON_2_1.yaml new file mode 100644 index 00000000000000..485746f366cd00 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_OZFREMON_2_1.yaml @@ -0,0 +1,70 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 165.2.1. [TC-OZFREMON-2.1] Attributes with server as DUT + +PICS: + - OZFREMON.S + +config: + nodeId: 0x12344321 + cluster: "Ozone Filter Monitoring" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "TH reads from the DUT the Condition attribute." + PICS: OZFREMON.S.A0000 + command: "readAttribute" + attribute: "Condition" + response: + constraints: + type: percent + minValue: 0 + maxValue: 100 + + - label: "TH reads from the DUT the DegradationDirection attribute.." + PICS: OZFREMON.S.A0001 + command: "readAttribute" + attribute: "DegradationDirection" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 1 + + - label: "TH reads from the DUT the ChangeIndication attribute." + PICS: OZFREMON.S.A0002 + command: "readAttribute" + attribute: "ChangeIndication" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 2 + + - label: "TH reads from the DUT the InPlaceIndicator attribute" + PICS: OZFREMON.S.A0003 + command: "readAttribute" + attribute: "InPlaceIndicator" + response: + constraints: + type: boolean diff --git a/src/app/tests/suites/certification/Test_TC_TCREMON_1_1.yaml b/src/app/tests/suites/certification/Test_TC_TCREMON_1_1.yaml new file mode 100644 index 00000000000000..68fc52252a7030 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_TCREMON_1_1.yaml @@ -0,0 +1,133 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 165.1.1. [TC-TCREMON-1.1] Global Attributes with DUT as Server + +PICS: + - TCREMON.S + +config: + nodeId: 0x12344321 + cluster: "Toner Cartridge Monitoring" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "Read the global attribute: ClusterRevision" + command: "readAttribute" + attribute: "ClusterRevision" + response: + value: 1 + constraints: + type: int16u + + - label: "Read the global attribute: FeatureMap" + command: "readAttribute" + attribute: "FeatureMap" + PICS: "!TCREMON.S.F00 && !TCREMON.S.F01" + response: + value: 0 + constraints: + type: bitmap32 + + - label: + "Given TCREMON.S.F00(Condition) ensure featuremap has the correct bit + set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: TCREMON.S.F00 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x1] + + - label: + "Given TCREMON.S.F01(Warning) ensure featuremap has the correct bit + set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: TCREMON.S.F01 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x2] + + - label: "Read the global attribute: AttributeList" + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [2, 65528, 65529, 65530, 65531, 65532, 65533] + + - label: + "Read the feature dependent(TCREMON.S.F00) attribute in AttributeList" + PICS: TCREMON.S.F00 + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [0, 1] + + - label: + "Read the optional attribute InPlaceIndicator (TCREMON.S.A0002) in + AttributeList" + PICS: TCREMON.S.A0002 + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [3] + + - label: "Read the global attribute: AcceptedCommandList" + command: "readAttribute" + attribute: "AcceptedCommandList" + response: + constraints: + type: list + contains: [] + + - label: "Read the optional command (ResetCondition) in AcceptedCommandList" + PICS: TCREMON.S.C00.Rsp + command: "readAttribute" + attribute: "AcceptedCommandList" + response: + constraints: + type: list + contains: [0] + + - label: "Read the global attribute: GeneratedCommandList" + command: "readAttribute" + attribute: "GeneratedCommandList" + response: + value: [] + constraints: + type: list + + - label: "TH reads EventList attribute from DUT" + command: "readAttribute" + attribute: "EventList" + response: + value: [] + constraints: + type: list diff --git a/src/app/tests/suites/certification/Test_TC_TCREMON_2_1.yaml b/src/app/tests/suites/certification/Test_TC_TCREMON_2_1.yaml new file mode 100644 index 00000000000000..6fec88313ff8e3 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_TCREMON_2_1.yaml @@ -0,0 +1,70 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 165.2.1. [TC-TCREMON-2.1] Attributes with server as DUT + +PICS: + - TCREMON.S + +config: + nodeId: 0x12344321 + cluster: "Toner Cartridge Monitoring" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "TH reads from the DUT the Condition attribute." + PICS: TCREMON.S.A0000 + command: "readAttribute" + attribute: "Condition" + response: + constraints: + type: percent + minValue: 0 + maxValue: 100 + + - label: "TH reads from the DUT the DegradationDirection attribute.." + PICS: TCREMON.S.A0001 + command: "readAttribute" + attribute: "DegradationDirection" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 1 + + - label: "TH reads from the DUT the ChangeIndication attribute." + PICS: TCREMON.S.A0002 + command: "readAttribute" + attribute: "ChangeIndication" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 2 + + - label: "TH reads from the DUT the InPlaceIndicator attribute" + PICS: TCREMON.S.A0003 + command: "readAttribute" + attribute: "InPlaceIndicator" + response: + constraints: + type: boolean diff --git a/src/app/tests/suites/certification/Test_TC_UVFREMON_1_1.yaml b/src/app/tests/suites/certification/Test_TC_UVFREMON_1_1.yaml new file mode 100644 index 00000000000000..fcafe4738d74cd --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_UVFREMON_1_1.yaml @@ -0,0 +1,133 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 165.1.1. [TC-UVFREMON-1.1] Global Attributes with DUT as Server + +PICS: + - UVFREMON.S + +config: + nodeId: 0x12344321 + cluster: "UV Filter Monitoring" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "Read the global attribute: ClusterRevision" + command: "readAttribute" + attribute: "ClusterRevision" + response: + value: 1 + constraints: + type: int16u + + - label: "Read the global attribute: FeatureMap" + command: "readAttribute" + attribute: "FeatureMap" + PICS: "!UVFREMON.S.F00 && !UVFREMON.S.F01" + response: + value: 0 + constraints: + type: bitmap32 + + - label: + "Given UVFREMON.S.F00(Condition) ensure featuremap has the correct bit + set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: UVFREMON.S.F00 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x1] + + - label: + "Given UVFREMON.S.F01(Warning) ensure featuremap has the correct bit + set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: UVFREMON.S.F01 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x2] + + - label: "Read the global attribute: AttributeList" + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [2, 65528, 65529, 65530, 65531, 65532, 65533] + + - label: + "Read the feature dependent(UVFREMON.S.F00) attribute in AttributeList" + PICS: UVFREMON.S.F00 + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [0, 1] + + - label: + "Read the optional attribute InPlaceIndicator (UVFREMON.S.A0002) in + AttributeList" + PICS: UVFREMON.S.A0002 + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [3] + + - label: "Read the global attribute: AcceptedCommandList" + command: "readAttribute" + attribute: "AcceptedCommandList" + response: + constraints: + type: list + contains: [] + + - label: "Read the optional command (ResetCondition) in AcceptedCommandList" + PICS: UVFREMON.S.C00.Rsp + command: "readAttribute" + attribute: "AcceptedCommandList" + response: + constraints: + type: list + contains: [0] + + - label: "Read the global attribute: GeneratedCommandList" + command: "readAttribute" + attribute: "GeneratedCommandList" + response: + value: [] + constraints: + type: list + + - label: "TH reads EventList attribute from DUT" + command: "readAttribute" + attribute: "EventList" + response: + value: [] + constraints: + type: list diff --git a/src/app/tests/suites/certification/Test_TC_UVFREMON_2_1.yaml b/src/app/tests/suites/certification/Test_TC_UVFREMON_2_1.yaml new file mode 100644 index 00000000000000..39eb219fec51c1 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_UVFREMON_2_1.yaml @@ -0,0 +1,70 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 165.2.1. [TC-UVFREMON-2.1] Attributes with server as DUT + +PICS: + - UVFREMON.S + +config: + nodeId: 0x12344321 + cluster: "UV Filter Monitoring" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "TH reads from the DUT the Condition attribute." + PICS: UVFREMON.S.A0000 + command: "readAttribute" + attribute: "Condition" + response: + constraints: + type: percent + minValue: 0 + maxValue: 100 + + - label: "TH reads from the DUT the DegradationDirection attribute.." + PICS: UVFREMON.S.A0001 + command: "readAttribute" + attribute: "DegradationDirection" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 1 + + - label: "TH reads from the DUT the ChangeIndication attribute." + PICS: UVFREMON.S.A0002 + command: "readAttribute" + attribute: "ChangeIndication" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 2 + + - label: "TH reads from the DUT the InPlaceIndicator attribute" + PICS: UVFREMON.S.A0003 + command: "readAttribute" + attribute: "InPlaceIndicator" + response: + constraints: + type: boolean diff --git a/src/app/tests/suites/certification/Test_TC_WTREMON_1_1.yaml b/src/app/tests/suites/certification/Test_TC_WTREMON_1_1.yaml new file mode 100644 index 00000000000000..94cb40c07d2505 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_WTREMON_1_1.yaml @@ -0,0 +1,133 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 165.1.1. [TC-WTREMON-1.1] Global Attributes with DUT as Server + +PICS: + - WTREMON.S + +config: + nodeId: 0x12344321 + cluster: "Water Tank Monitoring" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "Read the global attribute: ClusterRevision" + command: "readAttribute" + attribute: "ClusterRevision" + response: + value: 1 + constraints: + type: int16u + + - label: "Read the global attribute: FeatureMap" + command: "readAttribute" + attribute: "FeatureMap" + PICS: "!WTREMON.S.F00 && !WTREMON.S.F01" + response: + value: 0 + constraints: + type: bitmap32 + + - label: + "Given WTREMON.S.F00(Condition) ensure featuremap has the correct bit + set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: WTREMON.S.F00 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x1] + + - label: + "Given WTREMON.S.F01(Warning) ensure featuremap has the correct bit + set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: WTREMON.S.F01 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x2] + + - label: "Read the global attribute: AttributeList" + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [2, 65528, 65529, 65530, 65531, 65532, 65533] + + - label: + "Read the feature dependent(WTREMON.S.F00) attribute in AttributeList" + PICS: WTREMON.S.F00 + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [0, 1] + + - label: + "Read the optional attribute InPlaceIndicator (WTREMON.S.A0002) in + AttributeList" + PICS: WTREMON.S.A0002 + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [3] + + - label: "Read the global attribute: AcceptedCommandList" + command: "readAttribute" + attribute: "AcceptedCommandList" + response: + constraints: + type: list + contains: [] + + - label: "Read the optional command (ResetCondition) in AcceptedCommandList" + PICS: WTREMON.S.C00.Rsp + command: "readAttribute" + attribute: "AcceptedCommandList" + response: + constraints: + type: list + contains: [0] + + - label: "Read the global attribute: GeneratedCommandList" + command: "readAttribute" + attribute: "GeneratedCommandList" + response: + value: [] + constraints: + type: list + + - label: "TH reads EventList attribute from DUT" + command: "readAttribute" + attribute: "EventList" + response: + value: [] + constraints: + type: list diff --git a/src/app/tests/suites/certification/Test_TC_WTREMON_2_1.yaml b/src/app/tests/suites/certification/Test_TC_WTREMON_2_1.yaml new file mode 100644 index 00000000000000..717ec77a4e9a10 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_WTREMON_2_1.yaml @@ -0,0 +1,70 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 165.2.1. [TC-WTREMON-2.1] Attributes with server as DUT + +PICS: + - WTREMON.S + +config: + nodeId: 0x12344321 + cluster: "Water Tank Monitoring" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "TH reads from the DUT the Condition attribute." + PICS: WTREMON.S.A0000 + command: "readAttribute" + attribute: "Condition" + response: + constraints: + type: percent + minValue: 0 + maxValue: 100 + + - label: "TH reads from the DUT the DegradationDirection attribute.." + PICS: WTREMON.S.A0001 + command: "readAttribute" + attribute: "DegradationDirection" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 1 + + - label: "TH reads from the DUT the ChangeIndication attribute." + PICS: WTREMON.S.A0002 + command: "readAttribute" + attribute: "ChangeIndication" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 2 + + - label: "TH reads from the DUT the InPlaceIndicator attribute" + PICS: WTREMON.S.A0003 + command: "readAttribute" + attribute: "InPlaceIndicator" + response: + constraints: + type: boolean diff --git a/src/app/tests/suites/certification/Test_TC_ZEOFREMON_1_1.yaml b/src/app/tests/suites/certification/Test_TC_ZEOFREMON_1_1.yaml new file mode 100644 index 00000000000000..306f0094ca4537 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_ZEOFREMON_1_1.yaml @@ -0,0 +1,134 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 165.1.1. [TC-ZEOFREMON-1.1] Global Attributes with DUT as Server + +PICS: + - ZEOFREMON.S + +config: + nodeId: 0x12344321 + cluster: "Zeolite Filter Monitoring" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "Read the global attribute: ClusterRevision" + command: "readAttribute" + attribute: "ClusterRevision" + response: + value: 1 + constraints: + type: int16u + + - label: "Read the global attribute: FeatureMap" + command: "readAttribute" + attribute: "FeatureMap" + PICS: "!ZEOFREMON.S.F00 && !ZEOFREMON.S.F01" + response: + value: 0 + constraints: + type: bitmap32 + + - label: + "Given ZEOFREMON.S.F00(Condition) ensure featuremap has the correct + bit set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: ZEOFREMON.S.F00 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x1] + + - label: + "Given ZEOFREMON.S.F01(Warning) ensure featuremap has the correct bit + set" + command: "readAttribute" + attribute: "FeatureMap" + PICS: ZEOFREMON.S.F01 + response: + constraints: + type: bitmap32 + hasMasksSet: [0x2] + + - label: "Read the global attribute: AttributeList" + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [2, 65528, 65529, 65530, 65531, 65532, 65533] + + - label: + "Read the feature dependent(ZEOFREMON.S.F00) attribute in + AttributeList" + PICS: ZEOFREMON.S.F00 + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [0, 1] + + - label: + "Read the optional attribute InPlaceIndicator (ZEOFREMON.S.A0002) in + AttributeList" + PICS: ZEOFREMON.S.A0002 + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [3] + + - label: "Read the global attribute: AcceptedCommandList" + command: "readAttribute" + attribute: "AcceptedCommandList" + response: + constraints: + type: list + contains: [] + + - label: "Read the optional command (ResetCondition) in AcceptedCommandList" + PICS: ZEOFREMON.S.C00.Rsp + command: "readAttribute" + attribute: "AcceptedCommandList" + response: + constraints: + type: list + contains: [0] + + - label: "Read the global attribute: GeneratedCommandList" + command: "readAttribute" + attribute: "GeneratedCommandList" + response: + value: [] + constraints: + type: list + + - label: "TH reads EventList attribute from DUT" + command: "readAttribute" + attribute: "EventList" + response: + value: [] + constraints: + type: list diff --git a/src/app/tests/suites/certification/Test_TC_ZEOFREMON_2_1.yaml b/src/app/tests/suites/certification/Test_TC_ZEOFREMON_2_1.yaml new file mode 100644 index 00000000000000..73fce963100c64 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_ZEOFREMON_2_1.yaml @@ -0,0 +1,70 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: 165.2.1. [TC-ZEOFREMON-2.1] Attributes with server as DUT + +PICS: + - ZEOFREMON.S + +config: + nodeId: 0x12344321 + cluster: "Zeolite Filter Monitoring" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "TH reads from the DUT the Condition attribute." + PICS: ZEOFREMON.S.A0000 + command: "readAttribute" + attribute: "Condition" + response: + constraints: + type: percent + minValue: 0 + maxValue: 100 + + - label: "TH reads from the DUT the DegradationDirection attribute.." + PICS: ZEOFREMON.S.A0001 + command: "readAttribute" + attribute: "DegradationDirection" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 1 + + - label: "TH reads from the DUT the ChangeIndication attribute." + PICS: ZEOFREMON.S.A0002 + command: "readAttribute" + attribute: "ChangeIndication" + response: + constraints: + type: enum8 + minValue: 0 + maxValue: 2 + + - label: "TH reads from the DUT the InPlaceIndicator attribute" + PICS: ZEOFREMON.S.A0003 + command: "readAttribute" + attribute: "InPlaceIndicator" + response: + constraints: + type: boolean diff --git a/src/app/tests/suites/certification/ci-pics-values b/src/app/tests/suites/certification/ci-pics-values index b8919a98b1c958..c80574b3b2d6fa 100644 --- a/src/app/tests/suites/certification/ci-pics-values +++ b/src/app/tests/suites/certification/ci-pics-values @@ -2100,6 +2100,138 @@ TIMESYNC.S.C05.Rsp=1 TIMESYNC.S.C03.Tx=1 TIMESYNC.C=0 +# HEPA Filter Monitoring Cluster +HEPAFREMON.S=1 +HEPAFREMON.C=0 +HEPAFREMON.S.F00=1 +HEPAFREMON.S.F01=1 +HEPAFREMON.S.A0000=1 +HEPAFREMON.S.A0001=1 +HEPAFREMON.S.A0002=1 +HEPAFREMON.S.A0003=1 +HEPAFREMON.S.C00.Rsp=0 + +# Activated Carbon Filter Monitoring Cluster +ACFREMON.S=1 +ACFREMON.C=0 +ACFREMON.S.F00=1 +ACFREMON.S.F01=1 +ACFREMON.S.A0000=1 +ACFREMON.S.A0001=1 +ACFREMON.S.A0002=1 +ACFREMON.S.A0003=1 +ACFREMON.S.C00.Rsp=0 + +# Ceramic Filter Monitoring Cluster +CFREMON.S=1 +CFREMON.C=0 +CFREMON.S.F00=1 +CFREMON.S.F01=1 +CFREMON.S.A0000=1 +CFREMON.S.A0001=1 +CFREMON.S.A0002=1 +CFREMON.S.A0003=1 +CFREMON.S.C00.Rsp=0 + +# Electrostatic Filter Monitoring Cluster +ESFREMON.S=1 +ESFREMON.C=0 +ESFREMON.S.F00=1 +ESFREMON.S.F01=1 +ESFREMON.S.A0000=1 +ESFREMON.S.A0001=1 +ESFREMON.S.A0002=1 +ESFREMON.S.A0003=1 +ESFREMON.S.C00.Rsp=0 + +# Fuel Tank Monitoring Cluster +FTREMON.S=1 +FTREMON.C=0 +FTREMON.S.F00=1 +FTREMON.S.F01=1 +FTREMON.S.A0000=1 +FTREMON.S.A0001=1 +FTREMON.S.A0002=1 +FTREMON.S.A0003=1 +FTREMON.S.C00.Rsp=0 + +# Ink Cartridge Monitoring Cluster +INKCREMON.S=1 +INKCREMON.C=0 +INKCREMON.S.F00=1 +INKCREMON.S.F01=1 +INKCREMON.S.A0000=1 +INKCREMON.S.A0001=1 +INKCREMON.S.A0002=1 +INKCREMON.S.A0003=1 +INKCREMON.S.C00.Rsp=0 + +# Ionizing Filter Monitoring Cluster +IONFREMON.S=1 +IONFREMON.C=0 +IONFREMON.S.F00=1 +IONFREMON.S.F01=1 +IONFREMON.S.A0000=1 +IONFREMON.S.A0001=1 +IONFREMON.S.A0002=1 +IONFREMON.S.A0003=1 +IONFREMON.S.C00.Rsp=0 + +# Ozone Filter Monitoring Cluster +OZFREMON.S=1 +OZFREMON.C=0 +OZFREMON.S.F00=1 +OZFREMON.S.F01=1 +OZFREMON.S.A0000=1 +OZFREMON.S.A0001=1 +OZFREMON.S.A0002=1 +OZFREMON.S.A0003=1 +OZFREMON.S.C00.Rsp=0 + +# Toner Cartridge Monitoring Cluster +TCREMON.S=1 +TCREMON.C=0 +TCREMON.S.F00=1 +TCREMON.S.F01=1 +TCREMON.S.A0000=1 +TCREMON.S.A0001=1 +TCREMON.S.A0002=1 +TCREMON.S.A0003=1 +TCREMON.S.C00.Rsp=0 + +# UV Filter Monitoring Cluster +UVFREMON.S=1 +UVFREMON.C=0 +UVFREMON.S.F00=1 +UVFREMON.S.F01=1 +UVFREMON.S.A0000=1 +UVFREMON.S.A0001=1 +UVFREMON.S.A0002=1 +UVFREMON.S.A0003=1 +UVFREMON.S.C00.Rsp=0 + +# Water Tank Monitoring Cluster +WTREMON.S=1 +WTREMON.C=0 +WTREMON.S.F00=1 +WTREMON.S.F01=1 +WTREMON.S.A0000=1 +WTREMON.S.A0001=1 +WTREMON.S.A0002=1 +WTREMON.S.A0003=1 +WTREMON.S.C00.Rsp=0 + +# Zeolite Filter Monitoring Cluster +ZEOFREMON.S=1 +ZEOFREMON.C=0 +ZEOFREMON.S.F00=1 +ZEOFREMON.S.F01=1 +ZEOFREMON.S.A0000=1 +ZEOFREMON.S.A0001=1 +ZEOFREMON.S.A0002=1 +ZEOFREMON.S.A0003=1 +ZEOFREMON.S.C00.Rsp=0 + # Air Quality AIRQUAL.C=0 AIRQUAL.S=1 diff --git a/src/app/tests/suites/ciTests.json b/src/app/tests/suites/ciTests.json index 0cab61e18fdc61..80a913df8b3765 100644 --- a/src/app/tests/suites/ciTests.json +++ b/src/app/tests/suites/ciTests.json @@ -274,6 +274,32 @@ "Test_TC_G_2_1" ], "Scenes": ["Test_TC_S_1_1"], + "ReplaceableMonitoring": [ + "Test_TC_ACFREMON_1_1", + "Test_TC_ACFREMON_2_1", + "Test_TC_CFREMON_1_1", + "Test_TC_CFREMON_2_1", + "Test_TC_ESFREMON_1_1", + "Test_TC_ESFREMON_2_1", + "Test_TC_FTREMON_1_1", + "Test_TC_FTREMON_2_1", + "Test_TC_HEPAFREMON_1_1", + "Test_TC_HEPAFREMON_2_1", + "Test_TC_INKCREMON_1_1", + "Test_TC_INKCREMON_2_1", + "Test_TC_IONFREMON_1_1", + "Test_TC_IONFREMON_2_1", + "Test_TC_OZFREMON_1_1", + "Test_TC_OZFREMON_2_1", + "Test_TC_TCREMON_1_1", + "Test_TC_TCREMON_2_1", + "Test_TC_UVFREMON_1_1", + "Test_TC_UVFREMON_2_1", + "Test_TC_WTREMON_1_1", + "Test_TC_WTREMON_2_1", + "Test_TC_ZEOFREMON_1_1", + "Test_TC_ZEOFREMON_2_1" + ], "AirQuality": ["Test_TC_AIRQUAL_1_1", "Test_TC_AIRQUAL_2_1"], "collection": [ "AccessControl", @@ -325,6 +351,7 @@ "SoftwareDiagnostics", "Subscriptions", "DoorLock", - "Groups" + "Groups", + "ReplaceableMonitoring" ] } diff --git a/zzz_generated/chip-tool/zap-generated/test/Commands.h b/zzz_generated/chip-tool/zap-generated/test/Commands.h index eaac169bea6546..dbf8227542040d 100644 --- a/zzz_generated/chip-tool/zap-generated/test/Commands.h +++ b/zzz_generated/chip-tool/zap-generated/test/Commands.h @@ -275,6 +275,30 @@ class TestList : public Command printf("TestGroupKeyManagementCluster\n"); printf("Test_TC_G_1_1\n"); printf("Test_TC_G_2_1\n"); + printf("Test_TC_ACFREMON_1_1\n"); + printf("Test_TC_ACFREMON_2_1\n"); + printf("Test_TC_CFREMON_1_1\n"); + printf("Test_TC_CFREMON_2_1\n"); + printf("Test_TC_ESFREMON_1_1\n"); + printf("Test_TC_ESFREMON_2_1\n"); + printf("Test_TC_FTREMON_1_1\n"); + printf("Test_TC_FTREMON_2_1\n"); + printf("Test_TC_HEPAFREMON_1_1\n"); + printf("Test_TC_HEPAFREMON_2_1\n"); + printf("Test_TC_INKCREMON_1_1\n"); + printf("Test_TC_INKCREMON_2_1\n"); + printf("Test_TC_IONFREMON_1_1\n"); + printf("Test_TC_IONFREMON_2_1\n"); + printf("Test_TC_OZFREMON_1_1\n"); + printf("Test_TC_OZFREMON_2_1\n"); + printf("Test_TC_TCREMON_1_1\n"); + printf("Test_TC_TCREMON_2_1\n"); + printf("Test_TC_UVFREMON_1_1\n"); + printf("Test_TC_UVFREMON_2_1\n"); + printf("Test_TC_WTREMON_1_1\n"); + printf("Test_TC_WTREMON_2_1\n"); + printf("Test_TC_ZEOFREMON_1_1\n"); + printf("Test_TC_ZEOFREMON_2_1\n"); return CHIP_NO_ERROR; } @@ -97318,6 +97342,4446 @@ class Test_TC_G_2_1Suite : public TestCommand } }; +class Test_TC_ACFREMON_1_1Suite : public TestCommand +{ +public: + Test_TC_ACFREMON_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_ACFREMON_1_1", 12, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_ACFREMON_1_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("clusterRevision", value, 1U)); + VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("featureMap", value, 0UL)); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65530UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); + } + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("generatedCommandList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("eventList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "Read the global attribute: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ActivatedCarbonFilterMonitoring::Id, + ActivatedCarbonFilterMonitoring::Attributes::ClusterRevision::Id, true, chip::NullOptional); + } + case 2: { + LogStep(2, "Read the global attribute: FeatureMap"); + VerifyOrDo(!ShouldSkip("!ACFREMON.S.F00 && !ACFREMON.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ActivatedCarbonFilterMonitoring::Id, + ActivatedCarbonFilterMonitoring::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 3: { + LogStep(3, "Given ACFREMON.S.F00(Condition) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("ACFREMON.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ActivatedCarbonFilterMonitoring::Id, + ActivatedCarbonFilterMonitoring::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 4: { + LogStep(4, "Given ACFREMON.S.F01(Warning) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("ACFREMON.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ActivatedCarbonFilterMonitoring::Id, + ActivatedCarbonFilterMonitoring::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 5: { + LogStep(5, "Read the global attribute: AttributeList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ActivatedCarbonFilterMonitoring::Id, + ActivatedCarbonFilterMonitoring::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 6: { + LogStep(6, "Read the feature dependent(ACFREMON.S.F00) attribute in AttributeList"); + VerifyOrDo(!ShouldSkip("ACFREMON.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ActivatedCarbonFilterMonitoring::Id, + ActivatedCarbonFilterMonitoring::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 7: { + LogStep(7, "Read the optional attribute InPlaceIndicator (ACFREMON.S.A0002) in AttributeList"); + VerifyOrDo(!ShouldSkip("ACFREMON.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ActivatedCarbonFilterMonitoring::Id, + ActivatedCarbonFilterMonitoring::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 8: { + LogStep(8, "Read the global attribute: AcceptedCommandList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ActivatedCarbonFilterMonitoring::Id, + ActivatedCarbonFilterMonitoring::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); + } + case 9: { + LogStep(9, "Read the optional command (ResetCondition) in AcceptedCommandList"); + VerifyOrDo(!ShouldSkip("ACFREMON.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ActivatedCarbonFilterMonitoring::Id, + ActivatedCarbonFilterMonitoring::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); + } + case 10: { + LogStep(10, "Read the global attribute: GeneratedCommandList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ActivatedCarbonFilterMonitoring::Id, + ActivatedCarbonFilterMonitoring::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); + } + case 11: { + LogStep(11, "TH reads EventList attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ActivatedCarbonFilterMonitoring::Id, + ActivatedCarbonFilterMonitoring::Attributes::EventList::Id, true, chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_ACFREMON_2_1Suite : public TestCommand +{ +public: + Test_TC_ACFREMON_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_ACFREMON_2_1", 5, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_ACFREMON_2_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::Percent value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "percent", "percent")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 100U)); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::ActivatedCarbonFilterMonitoring::DegradationDirectionEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 1U)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::ActivatedCarbonFilterMonitoring::ChangeIndicationEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "boolean", "boolean")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "TH reads from the DUT the Condition attribute."); + VerifyOrDo(!ShouldSkip("ACFREMON.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ActivatedCarbonFilterMonitoring::Id, + ActivatedCarbonFilterMonitoring::Attributes::Condition::Id, true, chip::NullOptional); + } + case 2: { + LogStep(2, "TH reads from the DUT the DegradationDirection attribute.."); + VerifyOrDo(!ShouldSkip("ACFREMON.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ActivatedCarbonFilterMonitoring::Id, + ActivatedCarbonFilterMonitoring::Attributes::DegradationDirection::Id, true, chip::NullOptional); + } + case 3: { + LogStep(3, "TH reads from the DUT the ChangeIndication attribute."); + VerifyOrDo(!ShouldSkip("ACFREMON.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ActivatedCarbonFilterMonitoring::Id, + ActivatedCarbonFilterMonitoring::Attributes::ChangeIndication::Id, true, chip::NullOptional); + } + case 4: { + LogStep(4, "TH reads from the DUT the InPlaceIndicator attribute"); + VerifyOrDo(!ShouldSkip("ACFREMON.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ActivatedCarbonFilterMonitoring::Id, + ActivatedCarbonFilterMonitoring::Attributes::InPlaceIndicator::Id, true, chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_CFREMON_1_1Suite : public TestCommand +{ +public: + Test_TC_CFREMON_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_CFREMON_1_1", 12, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_CFREMON_1_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("clusterRevision", value, 1U)); + VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("featureMap", value, 0UL)); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65530UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); + } + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("generatedCommandList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("eventList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "Read the global attribute: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CeramicFilterMonitoring::Id, + CeramicFilterMonitoring::Attributes::ClusterRevision::Id, true, chip::NullOptional); + } + case 2: { + LogStep(2, "Read the global attribute: FeatureMap"); + VerifyOrDo(!ShouldSkip("!CFREMON.S.F00 && !CFREMON.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CeramicFilterMonitoring::Id, + CeramicFilterMonitoring::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 3: { + LogStep(3, "Given CFREMON.S.F00(Condition) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("CFREMON.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CeramicFilterMonitoring::Id, + CeramicFilterMonitoring::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 4: { + LogStep(4, "Given CFREMON.S.F01(Warning) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("CFREMON.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CeramicFilterMonitoring::Id, + CeramicFilterMonitoring::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 5: { + LogStep(5, "Read the global attribute: AttributeList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CeramicFilterMonitoring::Id, + CeramicFilterMonitoring::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 6: { + LogStep(6, "Read the feature dependent(CFREMON.S.F00) attribute in AttributeList"); + VerifyOrDo(!ShouldSkip("CFREMON.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CeramicFilterMonitoring::Id, + CeramicFilterMonitoring::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 7: { + LogStep(7, "Read the optional attribute InPlaceIndicator (CFREMON.S.A0002) in AttributeList"); + VerifyOrDo(!ShouldSkip("CFREMON.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CeramicFilterMonitoring::Id, + CeramicFilterMonitoring::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 8: { + LogStep(8, "Read the global attribute: AcceptedCommandList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CeramicFilterMonitoring::Id, + CeramicFilterMonitoring::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); + } + case 9: { + LogStep(9, "Read the optional command (ResetCondition) in AcceptedCommandList"); + VerifyOrDo(!ShouldSkip("CFREMON.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CeramicFilterMonitoring::Id, + CeramicFilterMonitoring::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); + } + case 10: { + LogStep(10, "Read the global attribute: GeneratedCommandList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CeramicFilterMonitoring::Id, + CeramicFilterMonitoring::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); + } + case 11: { + LogStep(11, "TH reads EventList attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CeramicFilterMonitoring::Id, + CeramicFilterMonitoring::Attributes::EventList::Id, true, chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_CFREMON_2_1Suite : public TestCommand +{ +public: + Test_TC_CFREMON_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_CFREMON_2_1", 5, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_CFREMON_2_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::Percent value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "percent", "percent")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 100U)); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::CeramicFilterMonitoring::DegradationDirectionEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 1U)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::CeramicFilterMonitoring::ChangeIndicationEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "boolean", "boolean")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "TH reads from the DUT the Condition attribute."); + VerifyOrDo(!ShouldSkip("CFREMON.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CeramicFilterMonitoring::Id, + CeramicFilterMonitoring::Attributes::Condition::Id, true, chip::NullOptional); + } + case 2: { + LogStep(2, "TH reads from the DUT the DegradationDirection attribute.."); + VerifyOrDo(!ShouldSkip("CFREMON.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CeramicFilterMonitoring::Id, + CeramicFilterMonitoring::Attributes::DegradationDirection::Id, true, chip::NullOptional); + } + case 3: { + LogStep(3, "TH reads from the DUT the ChangeIndication attribute."); + VerifyOrDo(!ShouldSkip("CFREMON.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CeramicFilterMonitoring::Id, + CeramicFilterMonitoring::Attributes::ChangeIndication::Id, true, chip::NullOptional); + } + case 4: { + LogStep(4, "TH reads from the DUT the InPlaceIndicator attribute"); + VerifyOrDo(!ShouldSkip("CFREMON.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), CeramicFilterMonitoring::Id, + CeramicFilterMonitoring::Attributes::InPlaceIndicator::Id, true, chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_ESFREMON_1_1Suite : public TestCommand +{ +public: + Test_TC_ESFREMON_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_ESFREMON_1_1", 12, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_ESFREMON_1_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("clusterRevision", value, 1U)); + VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("featureMap", value, 0UL)); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65530UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); + } + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("generatedCommandList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("eventList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "Read the global attribute: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ElectrostaticFilterMonitoring::Id, + ElectrostaticFilterMonitoring::Attributes::ClusterRevision::Id, true, chip::NullOptional); + } + case 2: { + LogStep(2, "Read the global attribute: FeatureMap"); + VerifyOrDo(!ShouldSkip("!ESFREMON.S.F00 && !ESFREMON.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ElectrostaticFilterMonitoring::Id, + ElectrostaticFilterMonitoring::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 3: { + LogStep(3, "Given ESFREMON.S.F00(Condition) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("ESFREMON.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ElectrostaticFilterMonitoring::Id, + ElectrostaticFilterMonitoring::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 4: { + LogStep(4, "Given ESFREMON.S.F01(Warning) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("ESFREMON.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ElectrostaticFilterMonitoring::Id, + ElectrostaticFilterMonitoring::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 5: { + LogStep(5, "Read the global attribute: AttributeList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ElectrostaticFilterMonitoring::Id, + ElectrostaticFilterMonitoring::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 6: { + LogStep(6, "Read the feature dependent(ESFREMON.S.F00) attribute in AttributeList"); + VerifyOrDo(!ShouldSkip("ESFREMON.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ElectrostaticFilterMonitoring::Id, + ElectrostaticFilterMonitoring::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 7: { + LogStep(7, "Read the optional attribute InPlaceIndicator (ESFREMON.S.A0002) in AttributeList"); + VerifyOrDo(!ShouldSkip("ESFREMON.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ElectrostaticFilterMonitoring::Id, + ElectrostaticFilterMonitoring::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 8: { + LogStep(8, "Read the global attribute: AcceptedCommandList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ElectrostaticFilterMonitoring::Id, + ElectrostaticFilterMonitoring::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); + } + case 9: { + LogStep(9, "Read the optional command (ResetCondition) in AcceptedCommandList"); + VerifyOrDo(!ShouldSkip("ESFREMON.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ElectrostaticFilterMonitoring::Id, + ElectrostaticFilterMonitoring::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); + } + case 10: { + LogStep(10, "Read the global attribute: GeneratedCommandList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ElectrostaticFilterMonitoring::Id, + ElectrostaticFilterMonitoring::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); + } + case 11: { + LogStep(11, "TH reads EventList attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ElectrostaticFilterMonitoring::Id, + ElectrostaticFilterMonitoring::Attributes::EventList::Id, true, chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_ESFREMON_2_1Suite : public TestCommand +{ +public: + Test_TC_ESFREMON_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_ESFREMON_2_1", 5, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_ESFREMON_2_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::Percent value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "percent", "percent")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 100U)); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::ElectrostaticFilterMonitoring::DegradationDirectionEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 1U)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::ElectrostaticFilterMonitoring::ChangeIndicationEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "boolean", "boolean")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "TH reads from the DUT the Condition attribute."); + VerifyOrDo(!ShouldSkip("ESFREMON.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ElectrostaticFilterMonitoring::Id, + ElectrostaticFilterMonitoring::Attributes::Condition::Id, true, chip::NullOptional); + } + case 2: { + LogStep(2, "TH reads from the DUT the DegradationDirection attribute.."); + VerifyOrDo(!ShouldSkip("ESFREMON.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ElectrostaticFilterMonitoring::Id, + ElectrostaticFilterMonitoring::Attributes::DegradationDirection::Id, true, chip::NullOptional); + } + case 3: { + LogStep(3, "TH reads from the DUT the ChangeIndication attribute."); + VerifyOrDo(!ShouldSkip("ESFREMON.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ElectrostaticFilterMonitoring::Id, + ElectrostaticFilterMonitoring::Attributes::ChangeIndication::Id, true, chip::NullOptional); + } + case 4: { + LogStep(4, "TH reads from the DUT the InPlaceIndicator attribute"); + VerifyOrDo(!ShouldSkip("ESFREMON.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ElectrostaticFilterMonitoring::Id, + ElectrostaticFilterMonitoring::Attributes::InPlaceIndicator::Id, true, chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_FTREMON_1_1Suite : public TestCommand +{ +public: + Test_TC_FTREMON_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_FTREMON_1_1", 12, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_FTREMON_1_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("clusterRevision", value, 1U)); + VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("featureMap", value, 0UL)); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65530UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); + } + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("generatedCommandList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("eventList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "Read the global attribute: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FuelTankMonitoring::Id, + FuelTankMonitoring::Attributes::ClusterRevision::Id, true, chip::NullOptional); + } + case 2: { + LogStep(2, "Read the global attribute: FeatureMap"); + VerifyOrDo(!ShouldSkip("!FTREMON.S.F00 && !FTREMON.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FuelTankMonitoring::Id, + FuelTankMonitoring::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 3: { + LogStep(3, "Given FTREMON.S.F00(Condition) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("FTREMON.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FuelTankMonitoring::Id, + FuelTankMonitoring::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 4: { + LogStep(4, "Given FTREMON.S.F01(Warning) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("FTREMON.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FuelTankMonitoring::Id, + FuelTankMonitoring::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 5: { + LogStep(5, "Read the global attribute: AttributeList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FuelTankMonitoring::Id, + FuelTankMonitoring::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 6: { + LogStep(6, "Read the feature dependent(FTREMON.S.F00) attribute in AttributeList"); + VerifyOrDo(!ShouldSkip("FTREMON.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FuelTankMonitoring::Id, + FuelTankMonitoring::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 7: { + LogStep(7, "Read the optional attribute InPlaceIndicator (FTREMON.S.A0002) in AttributeList"); + VerifyOrDo(!ShouldSkip("FTREMON.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FuelTankMonitoring::Id, + FuelTankMonitoring::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 8: { + LogStep(8, "Read the global attribute: AcceptedCommandList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FuelTankMonitoring::Id, + FuelTankMonitoring::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); + } + case 9: { + LogStep(9, "Read the optional command (ResetCondition) in AcceptedCommandList"); + VerifyOrDo(!ShouldSkip("FTREMON.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FuelTankMonitoring::Id, + FuelTankMonitoring::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); + } + case 10: { + LogStep(10, "Read the global attribute: GeneratedCommandList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FuelTankMonitoring::Id, + FuelTankMonitoring::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); + } + case 11: { + LogStep(11, "TH reads EventList attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FuelTankMonitoring::Id, + FuelTankMonitoring::Attributes::EventList::Id, true, chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_FTREMON_2_1Suite : public TestCommand +{ +public: + Test_TC_FTREMON_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_FTREMON_2_1", 5, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_FTREMON_2_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::Percent value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "percent", "percent")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 100U)); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::FuelTankMonitoring::DegradationDirectionEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 1U)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::FuelTankMonitoring::ChangeIndicationEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "boolean", "boolean")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "TH reads from the DUT the Condition attribute."); + VerifyOrDo(!ShouldSkip("FTREMON.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FuelTankMonitoring::Id, + FuelTankMonitoring::Attributes::Condition::Id, true, chip::NullOptional); + } + case 2: { + LogStep(2, "TH reads from the DUT the DegradationDirection attribute.."); + VerifyOrDo(!ShouldSkip("FTREMON.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FuelTankMonitoring::Id, + FuelTankMonitoring::Attributes::DegradationDirection::Id, true, chip::NullOptional); + } + case 3: { + LogStep(3, "TH reads from the DUT the ChangeIndication attribute."); + VerifyOrDo(!ShouldSkip("FTREMON.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FuelTankMonitoring::Id, + FuelTankMonitoring::Attributes::ChangeIndication::Id, true, chip::NullOptional); + } + case 4: { + LogStep(4, "TH reads from the DUT the InPlaceIndicator attribute"); + VerifyOrDo(!ShouldSkip("FTREMON.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), FuelTankMonitoring::Id, + FuelTankMonitoring::Attributes::InPlaceIndicator::Id, true, chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_HEPAFREMON_1_1Suite : public TestCommand +{ +public: + Test_TC_HEPAFREMON_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_HEPAFREMON_1_1", 12, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_HEPAFREMON_1_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("clusterRevision", value, 1U)); + VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("featureMap", value, 0UL)); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65530UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); + } + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("generatedCommandList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("eventList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "Read the global attribute: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), HepaFilterMonitoring::Id, + HepaFilterMonitoring::Attributes::ClusterRevision::Id, true, chip::NullOptional); + } + case 2: { + LogStep(2, "Read the global attribute: FeatureMap"); + VerifyOrDo(!ShouldSkip("!HEPAFREMON.S.F00 && !HEPAFREMON.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), HepaFilterMonitoring::Id, + HepaFilterMonitoring::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 3: { + LogStep(3, "Given HEPAFREMON.S.F00(Condition) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("HEPAFREMON.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), HepaFilterMonitoring::Id, + HepaFilterMonitoring::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 4: { + LogStep(4, "Given HEPAFREMON.S.F01(Warning) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("HEPAFREMON.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), HepaFilterMonitoring::Id, + HepaFilterMonitoring::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 5: { + LogStep(5, "Read the global attribute: AttributeList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), HepaFilterMonitoring::Id, + HepaFilterMonitoring::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 6: { + LogStep(6, "Read the feature dependent(HEPAFREMON.S.F00) attribute in AttributeList"); + VerifyOrDo(!ShouldSkip("HEPAFREMON.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), HepaFilterMonitoring::Id, + HepaFilterMonitoring::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 7: { + LogStep(7, "Read the optional attribute InPlaceIndicator (HEPAFREMON.S.A0002) in AttributeList"); + VerifyOrDo(!ShouldSkip("HEPAFREMON.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), HepaFilterMonitoring::Id, + HepaFilterMonitoring::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 8: { + LogStep(8, "Read the global attribute: AcceptedCommandList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), HepaFilterMonitoring::Id, + HepaFilterMonitoring::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); + } + case 9: { + LogStep(9, "Read the optional command (ResetCondition) in AcceptedCommandList"); + VerifyOrDo(!ShouldSkip("HEPAFREMON.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), HepaFilterMonitoring::Id, + HepaFilterMonitoring::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); + } + case 10: { + LogStep(10, "Read the global attribute: GeneratedCommandList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), HepaFilterMonitoring::Id, + HepaFilterMonitoring::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); + } + case 11: { + LogStep(11, "TH reads EventList attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), HepaFilterMonitoring::Id, + HepaFilterMonitoring::Attributes::EventList::Id, true, chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_HEPAFREMON_2_1Suite : public TestCommand +{ +public: + Test_TC_HEPAFREMON_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_HEPAFREMON_2_1", 5, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_HEPAFREMON_2_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::Percent value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "percent", "percent")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 100U)); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::HepaFilterMonitoring::DegradationDirectionEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 1U)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::HepaFilterMonitoring::ChangeIndicationEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "boolean", "boolean")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "TH reads from the DUT the Condition attribute."); + VerifyOrDo(!ShouldSkip("HEPAFREMON.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), HepaFilterMonitoring::Id, + HepaFilterMonitoring::Attributes::Condition::Id, true, chip::NullOptional); + } + case 2: { + LogStep(2, "TH reads from the DUT the DegradationDirection attribute.."); + VerifyOrDo(!ShouldSkip("HEPAFREMON.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), HepaFilterMonitoring::Id, + HepaFilterMonitoring::Attributes::DegradationDirection::Id, true, chip::NullOptional); + } + case 3: { + LogStep(3, "TH reads from the DUT the ChangeIndication attribute."); + VerifyOrDo(!ShouldSkip("HEPAFREMON.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), HepaFilterMonitoring::Id, + HepaFilterMonitoring::Attributes::ChangeIndication::Id, true, chip::NullOptional); + } + case 4: { + LogStep(4, "TH reads from the DUT the InPlaceIndicator attribute"); + VerifyOrDo(!ShouldSkip("HEPAFREMON.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), HepaFilterMonitoring::Id, + HepaFilterMonitoring::Attributes::InPlaceIndicator::Id, true, chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_INKCREMON_1_1Suite : public TestCommand +{ +public: + Test_TC_INKCREMON_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_INKCREMON_1_1", 12, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_INKCREMON_1_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("clusterRevision", value, 1U)); + VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("featureMap", value, 0UL)); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65530UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); + } + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("generatedCommandList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("eventList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "Read the global attribute: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), InkCartridgeMonitoring::Id, + InkCartridgeMonitoring::Attributes::ClusterRevision::Id, true, chip::NullOptional); + } + case 2: { + LogStep(2, "Read the global attribute: FeatureMap"); + VerifyOrDo(!ShouldSkip("!INKCREMON.S.F00 && !INKCREMON.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), InkCartridgeMonitoring::Id, + InkCartridgeMonitoring::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 3: { + LogStep(3, "Given INKCREMON.S.F00(Condition) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("INKCREMON.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), InkCartridgeMonitoring::Id, + InkCartridgeMonitoring::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 4: { + LogStep(4, "Given INKCREMON.S.F01(Warning) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("INKCREMON.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), InkCartridgeMonitoring::Id, + InkCartridgeMonitoring::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 5: { + LogStep(5, "Read the global attribute: AttributeList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), InkCartridgeMonitoring::Id, + InkCartridgeMonitoring::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 6: { + LogStep(6, "Read the feature dependent(INKCREMON.S.F00) attribute in AttributeList"); + VerifyOrDo(!ShouldSkip("INKCREMON.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), InkCartridgeMonitoring::Id, + InkCartridgeMonitoring::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 7: { + LogStep(7, "Read the optional attribute InPlaceIndicator (INKCREMON.S.A0002) in AttributeList"); + VerifyOrDo(!ShouldSkip("INKCREMON.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), InkCartridgeMonitoring::Id, + InkCartridgeMonitoring::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 8: { + LogStep(8, "Read the global attribute: AcceptedCommandList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), InkCartridgeMonitoring::Id, + InkCartridgeMonitoring::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); + } + case 9: { + LogStep(9, "Read the optional command (ResetCondition) in AcceptedCommandList"); + VerifyOrDo(!ShouldSkip("INKCREMON.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), InkCartridgeMonitoring::Id, + InkCartridgeMonitoring::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); + } + case 10: { + LogStep(10, "Read the global attribute: GeneratedCommandList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), InkCartridgeMonitoring::Id, + InkCartridgeMonitoring::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); + } + case 11: { + LogStep(11, "TH reads EventList attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), InkCartridgeMonitoring::Id, + InkCartridgeMonitoring::Attributes::EventList::Id, true, chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_INKCREMON_2_1Suite : public TestCommand +{ +public: + Test_TC_INKCREMON_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_INKCREMON_2_1", 5, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_INKCREMON_2_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::Percent value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "percent", "percent")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 100U)); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::InkCartridgeMonitoring::DegradationDirectionEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 1U)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::InkCartridgeMonitoring::ChangeIndicationEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "boolean", "boolean")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "TH reads from the DUT the Condition attribute."); + VerifyOrDo(!ShouldSkip("INKCREMON.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), InkCartridgeMonitoring::Id, + InkCartridgeMonitoring::Attributes::Condition::Id, true, chip::NullOptional); + } + case 2: { + LogStep(2, "TH reads from the DUT the DegradationDirection attribute.."); + VerifyOrDo(!ShouldSkip("INKCREMON.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), InkCartridgeMonitoring::Id, + InkCartridgeMonitoring::Attributes::DegradationDirection::Id, true, chip::NullOptional); + } + case 3: { + LogStep(3, "TH reads from the DUT the ChangeIndication attribute."); + VerifyOrDo(!ShouldSkip("INKCREMON.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), InkCartridgeMonitoring::Id, + InkCartridgeMonitoring::Attributes::ChangeIndication::Id, true, chip::NullOptional); + } + case 4: { + LogStep(4, "TH reads from the DUT the InPlaceIndicator attribute"); + VerifyOrDo(!ShouldSkip("INKCREMON.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), InkCartridgeMonitoring::Id, + InkCartridgeMonitoring::Attributes::InPlaceIndicator::Id, true, chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_IONFREMON_1_1Suite : public TestCommand +{ +public: + Test_TC_IONFREMON_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_IONFREMON_1_1", 12, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_IONFREMON_1_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("clusterRevision", value, 1U)); + VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("featureMap", value, 0UL)); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65530UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); + } + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("generatedCommandList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("eventList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "Read the global attribute: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), IonizingFilterMonitoring::Id, + IonizingFilterMonitoring::Attributes::ClusterRevision::Id, true, chip::NullOptional); + } + case 2: { + LogStep(2, "Read the global attribute: FeatureMap"); + VerifyOrDo(!ShouldSkip("!IONFREMON.S.F00 && !IONFREMON.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), IonizingFilterMonitoring::Id, + IonizingFilterMonitoring::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 3: { + LogStep(3, "Given IONFREMON.S.F00(Condition) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("IONFREMON.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), IonizingFilterMonitoring::Id, + IonizingFilterMonitoring::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 4: { + LogStep(4, "Given IONFREMON.S.F01(Warning) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("IONFREMON.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), IonizingFilterMonitoring::Id, + IonizingFilterMonitoring::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 5: { + LogStep(5, "Read the global attribute: AttributeList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), IonizingFilterMonitoring::Id, + IonizingFilterMonitoring::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 6: { + LogStep(6, "Read the feature dependent(IONFREMON.S.F00) attribute in AttributeList"); + VerifyOrDo(!ShouldSkip("IONFREMON.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), IonizingFilterMonitoring::Id, + IonizingFilterMonitoring::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 7: { + LogStep(7, "Read the optional attribute InPlaceIndicator (IONFREMON.S.A0002) in AttributeList"); + VerifyOrDo(!ShouldSkip("IONFREMON.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), IonizingFilterMonitoring::Id, + IonizingFilterMonitoring::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 8: { + LogStep(8, "Read the global attribute: AcceptedCommandList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), IonizingFilterMonitoring::Id, + IonizingFilterMonitoring::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); + } + case 9: { + LogStep(9, "Read the optional command (ResetCondition) in AcceptedCommandList"); + VerifyOrDo(!ShouldSkip("IONFREMON.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), IonizingFilterMonitoring::Id, + IonizingFilterMonitoring::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); + } + case 10: { + LogStep(10, "Read the global attribute: GeneratedCommandList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), IonizingFilterMonitoring::Id, + IonizingFilterMonitoring::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); + } + case 11: { + LogStep(11, "TH reads EventList attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), IonizingFilterMonitoring::Id, + IonizingFilterMonitoring::Attributes::EventList::Id, true, chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_IONFREMON_2_1Suite : public TestCommand +{ +public: + Test_TC_IONFREMON_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_IONFREMON_2_1", 5, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_IONFREMON_2_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::Percent value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "percent", "percent")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 100U)); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::IonizingFilterMonitoring::DegradationDirectionEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 1U)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::IonizingFilterMonitoring::ChangeIndicationEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "boolean", "boolean")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "TH reads from the DUT the Condition attribute."); + VerifyOrDo(!ShouldSkip("IONFREMON.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), IonizingFilterMonitoring::Id, + IonizingFilterMonitoring::Attributes::Condition::Id, true, chip::NullOptional); + } + case 2: { + LogStep(2, "TH reads from the DUT the DegradationDirection attribute.."); + VerifyOrDo(!ShouldSkip("IONFREMON.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), IonizingFilterMonitoring::Id, + IonizingFilterMonitoring::Attributes::DegradationDirection::Id, true, chip::NullOptional); + } + case 3: { + LogStep(3, "TH reads from the DUT the ChangeIndication attribute."); + VerifyOrDo(!ShouldSkip("IONFREMON.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), IonizingFilterMonitoring::Id, + IonizingFilterMonitoring::Attributes::ChangeIndication::Id, true, chip::NullOptional); + } + case 4: { + LogStep(4, "TH reads from the DUT the InPlaceIndicator attribute"); + VerifyOrDo(!ShouldSkip("IONFREMON.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), IonizingFilterMonitoring::Id, + IonizingFilterMonitoring::Attributes::InPlaceIndicator::Id, true, chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_OZFREMON_1_1Suite : public TestCommand +{ +public: + Test_TC_OZFREMON_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_OZFREMON_1_1", 12, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_OZFREMON_1_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("clusterRevision", value, 1U)); + VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("featureMap", value, 0UL)); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65530UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); + } + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("generatedCommandList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("eventList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "Read the global attribute: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneFilterMonitoring::Id, + OzoneFilterMonitoring::Attributes::ClusterRevision::Id, true, chip::NullOptional); + } + case 2: { + LogStep(2, "Read the global attribute: FeatureMap"); + VerifyOrDo(!ShouldSkip("!OZFREMON.S.F00 && !OZFREMON.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneFilterMonitoring::Id, + OzoneFilterMonitoring::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 3: { + LogStep(3, "Given OZFREMON.S.F00(Condition) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("OZFREMON.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneFilterMonitoring::Id, + OzoneFilterMonitoring::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 4: { + LogStep(4, "Given OZFREMON.S.F01(Warning) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("OZFREMON.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneFilterMonitoring::Id, + OzoneFilterMonitoring::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 5: { + LogStep(5, "Read the global attribute: AttributeList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneFilterMonitoring::Id, + OzoneFilterMonitoring::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 6: { + LogStep(6, "Read the feature dependent(OZFREMON.S.F00) attribute in AttributeList"); + VerifyOrDo(!ShouldSkip("OZFREMON.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneFilterMonitoring::Id, + OzoneFilterMonitoring::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 7: { + LogStep(7, "Read the optional attribute InPlaceIndicator (OZFREMON.S.A0002) in AttributeList"); + VerifyOrDo(!ShouldSkip("OZFREMON.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneFilterMonitoring::Id, + OzoneFilterMonitoring::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 8: { + LogStep(8, "Read the global attribute: AcceptedCommandList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneFilterMonitoring::Id, + OzoneFilterMonitoring::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); + } + case 9: { + LogStep(9, "Read the optional command (ResetCondition) in AcceptedCommandList"); + VerifyOrDo(!ShouldSkip("OZFREMON.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneFilterMonitoring::Id, + OzoneFilterMonitoring::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); + } + case 10: { + LogStep(10, "Read the global attribute: GeneratedCommandList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneFilterMonitoring::Id, + OzoneFilterMonitoring::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); + } + case 11: { + LogStep(11, "TH reads EventList attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneFilterMonitoring::Id, + OzoneFilterMonitoring::Attributes::EventList::Id, true, chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_OZFREMON_2_1Suite : public TestCommand +{ +public: + Test_TC_OZFREMON_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_OZFREMON_2_1", 5, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_OZFREMON_2_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::Percent value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "percent", "percent")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 100U)); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::OzoneFilterMonitoring::DegradationDirectionEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 1U)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::OzoneFilterMonitoring::ChangeIndicationEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "boolean", "boolean")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "TH reads from the DUT the Condition attribute."); + VerifyOrDo(!ShouldSkip("OZFREMON.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneFilterMonitoring::Id, + OzoneFilterMonitoring::Attributes::Condition::Id, true, chip::NullOptional); + } + case 2: { + LogStep(2, "TH reads from the DUT the DegradationDirection attribute.."); + VerifyOrDo(!ShouldSkip("OZFREMON.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneFilterMonitoring::Id, + OzoneFilterMonitoring::Attributes::DegradationDirection::Id, true, chip::NullOptional); + } + case 3: { + LogStep(3, "TH reads from the DUT the ChangeIndication attribute."); + VerifyOrDo(!ShouldSkip("OZFREMON.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneFilterMonitoring::Id, + OzoneFilterMonitoring::Attributes::ChangeIndication::Id, true, chip::NullOptional); + } + case 4: { + LogStep(4, "TH reads from the DUT the InPlaceIndicator attribute"); + VerifyOrDo(!ShouldSkip("OZFREMON.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), OzoneFilterMonitoring::Id, + OzoneFilterMonitoring::Attributes::InPlaceIndicator::Id, true, chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_TCREMON_1_1Suite : public TestCommand +{ +public: + Test_TC_TCREMON_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_TCREMON_1_1", 12, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_TCREMON_1_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("clusterRevision", value, 1U)); + VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("featureMap", value, 0UL)); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65530UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); + } + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("generatedCommandList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("eventList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "Read the global attribute: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TonerCartridgeMonitoring::Id, + TonerCartridgeMonitoring::Attributes::ClusterRevision::Id, true, chip::NullOptional); + } + case 2: { + LogStep(2, "Read the global attribute: FeatureMap"); + VerifyOrDo(!ShouldSkip("!TCREMON.S.F00 && !TCREMON.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TonerCartridgeMonitoring::Id, + TonerCartridgeMonitoring::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 3: { + LogStep(3, "Given TCREMON.S.F00(Condition) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("TCREMON.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TonerCartridgeMonitoring::Id, + TonerCartridgeMonitoring::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 4: { + LogStep(4, "Given TCREMON.S.F01(Warning) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("TCREMON.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TonerCartridgeMonitoring::Id, + TonerCartridgeMonitoring::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 5: { + LogStep(5, "Read the global attribute: AttributeList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TonerCartridgeMonitoring::Id, + TonerCartridgeMonitoring::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 6: { + LogStep(6, "Read the feature dependent(TCREMON.S.F00) attribute in AttributeList"); + VerifyOrDo(!ShouldSkip("TCREMON.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TonerCartridgeMonitoring::Id, + TonerCartridgeMonitoring::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 7: { + LogStep(7, "Read the optional attribute InPlaceIndicator (TCREMON.S.A0002) in AttributeList"); + VerifyOrDo(!ShouldSkip("TCREMON.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TonerCartridgeMonitoring::Id, + TonerCartridgeMonitoring::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 8: { + LogStep(8, "Read the global attribute: AcceptedCommandList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TonerCartridgeMonitoring::Id, + TonerCartridgeMonitoring::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); + } + case 9: { + LogStep(9, "Read the optional command (ResetCondition) in AcceptedCommandList"); + VerifyOrDo(!ShouldSkip("TCREMON.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TonerCartridgeMonitoring::Id, + TonerCartridgeMonitoring::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); + } + case 10: { + LogStep(10, "Read the global attribute: GeneratedCommandList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TonerCartridgeMonitoring::Id, + TonerCartridgeMonitoring::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); + } + case 11: { + LogStep(11, "TH reads EventList attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TonerCartridgeMonitoring::Id, + TonerCartridgeMonitoring::Attributes::EventList::Id, true, chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_TCREMON_2_1Suite : public TestCommand +{ +public: + Test_TC_TCREMON_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_TCREMON_2_1", 5, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_TCREMON_2_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::Percent value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "percent", "percent")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 100U)); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::TonerCartridgeMonitoring::DegradationDirectionEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 1U)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::TonerCartridgeMonitoring::ChangeIndicationEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "boolean", "boolean")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "TH reads from the DUT the Condition attribute."); + VerifyOrDo(!ShouldSkip("TCREMON.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TonerCartridgeMonitoring::Id, + TonerCartridgeMonitoring::Attributes::Condition::Id, true, chip::NullOptional); + } + case 2: { + LogStep(2, "TH reads from the DUT the DegradationDirection attribute.."); + VerifyOrDo(!ShouldSkip("TCREMON.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TonerCartridgeMonitoring::Id, + TonerCartridgeMonitoring::Attributes::DegradationDirection::Id, true, chip::NullOptional); + } + case 3: { + LogStep(3, "TH reads from the DUT the ChangeIndication attribute."); + VerifyOrDo(!ShouldSkip("TCREMON.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TonerCartridgeMonitoring::Id, + TonerCartridgeMonitoring::Attributes::ChangeIndication::Id, true, chip::NullOptional); + } + case 4: { + LogStep(4, "TH reads from the DUT the InPlaceIndicator attribute"); + VerifyOrDo(!ShouldSkip("TCREMON.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), TonerCartridgeMonitoring::Id, + TonerCartridgeMonitoring::Attributes::InPlaceIndicator::Id, true, chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_UVFREMON_1_1Suite : public TestCommand +{ +public: + Test_TC_UVFREMON_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_UVFREMON_1_1", 12, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_UVFREMON_1_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("clusterRevision", value, 1U)); + VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("featureMap", value, 0UL)); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65530UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); + } + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("generatedCommandList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("eventList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "Read the global attribute: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UvFilterMonitoring::Id, + UvFilterMonitoring::Attributes::ClusterRevision::Id, true, chip::NullOptional); + } + case 2: { + LogStep(2, "Read the global attribute: FeatureMap"); + VerifyOrDo(!ShouldSkip("!UVFREMON.S.F00 && !UVFREMON.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UvFilterMonitoring::Id, + UvFilterMonitoring::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 3: { + LogStep(3, "Given UVFREMON.S.F00(Condition) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("UVFREMON.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UvFilterMonitoring::Id, + UvFilterMonitoring::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 4: { + LogStep(4, "Given UVFREMON.S.F01(Warning) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("UVFREMON.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UvFilterMonitoring::Id, + UvFilterMonitoring::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 5: { + LogStep(5, "Read the global attribute: AttributeList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UvFilterMonitoring::Id, + UvFilterMonitoring::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 6: { + LogStep(6, "Read the feature dependent(UVFREMON.S.F00) attribute in AttributeList"); + VerifyOrDo(!ShouldSkip("UVFREMON.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UvFilterMonitoring::Id, + UvFilterMonitoring::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 7: { + LogStep(7, "Read the optional attribute InPlaceIndicator (UVFREMON.S.A0002) in AttributeList"); + VerifyOrDo(!ShouldSkip("UVFREMON.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UvFilterMonitoring::Id, + UvFilterMonitoring::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 8: { + LogStep(8, "Read the global attribute: AcceptedCommandList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UvFilterMonitoring::Id, + UvFilterMonitoring::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); + } + case 9: { + LogStep(9, "Read the optional command (ResetCondition) in AcceptedCommandList"); + VerifyOrDo(!ShouldSkip("UVFREMON.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UvFilterMonitoring::Id, + UvFilterMonitoring::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); + } + case 10: { + LogStep(10, "Read the global attribute: GeneratedCommandList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UvFilterMonitoring::Id, + UvFilterMonitoring::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); + } + case 11: { + LogStep(11, "TH reads EventList attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UvFilterMonitoring::Id, + UvFilterMonitoring::Attributes::EventList::Id, true, chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_UVFREMON_2_1Suite : public TestCommand +{ +public: + Test_TC_UVFREMON_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_UVFREMON_2_1", 5, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_UVFREMON_2_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::Percent value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "percent", "percent")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 100U)); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::UvFilterMonitoring::DegradationDirectionEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 1U)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::UvFilterMonitoring::ChangeIndicationEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "boolean", "boolean")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "TH reads from the DUT the Condition attribute."); + VerifyOrDo(!ShouldSkip("UVFREMON.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UvFilterMonitoring::Id, + UvFilterMonitoring::Attributes::Condition::Id, true, chip::NullOptional); + } + case 2: { + LogStep(2, "TH reads from the DUT the DegradationDirection attribute.."); + VerifyOrDo(!ShouldSkip("UVFREMON.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UvFilterMonitoring::Id, + UvFilterMonitoring::Attributes::DegradationDirection::Id, true, chip::NullOptional); + } + case 3: { + LogStep(3, "TH reads from the DUT the ChangeIndication attribute."); + VerifyOrDo(!ShouldSkip("UVFREMON.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UvFilterMonitoring::Id, + UvFilterMonitoring::Attributes::ChangeIndication::Id, true, chip::NullOptional); + } + case 4: { + LogStep(4, "TH reads from the DUT the InPlaceIndicator attribute"); + VerifyOrDo(!ShouldSkip("UVFREMON.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), UvFilterMonitoring::Id, + UvFilterMonitoring::Attributes::InPlaceIndicator::Id, true, chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_WTREMON_1_1Suite : public TestCommand +{ +public: + Test_TC_WTREMON_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_WTREMON_1_1", 12, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_WTREMON_1_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("clusterRevision", value, 1U)); + VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("featureMap", value, 0UL)); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65530UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); + } + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("generatedCommandList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("eventList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "Read the global attribute: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WaterTankMonitoring::Id, + WaterTankMonitoring::Attributes::ClusterRevision::Id, true, chip::NullOptional); + } + case 2: { + LogStep(2, "Read the global attribute: FeatureMap"); + VerifyOrDo(!ShouldSkip("!WTREMON.S.F00 && !WTREMON.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WaterTankMonitoring::Id, + WaterTankMonitoring::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 3: { + LogStep(3, "Given WTREMON.S.F00(Condition) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("WTREMON.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WaterTankMonitoring::Id, + WaterTankMonitoring::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 4: { + LogStep(4, "Given WTREMON.S.F01(Warning) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("WTREMON.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WaterTankMonitoring::Id, + WaterTankMonitoring::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 5: { + LogStep(5, "Read the global attribute: AttributeList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WaterTankMonitoring::Id, + WaterTankMonitoring::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 6: { + LogStep(6, "Read the feature dependent(WTREMON.S.F00) attribute in AttributeList"); + VerifyOrDo(!ShouldSkip("WTREMON.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WaterTankMonitoring::Id, + WaterTankMonitoring::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 7: { + LogStep(7, "Read the optional attribute InPlaceIndicator (WTREMON.S.A0002) in AttributeList"); + VerifyOrDo(!ShouldSkip("WTREMON.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WaterTankMonitoring::Id, + WaterTankMonitoring::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 8: { + LogStep(8, "Read the global attribute: AcceptedCommandList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WaterTankMonitoring::Id, + WaterTankMonitoring::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); + } + case 9: { + LogStep(9, "Read the optional command (ResetCondition) in AcceptedCommandList"); + VerifyOrDo(!ShouldSkip("WTREMON.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WaterTankMonitoring::Id, + WaterTankMonitoring::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); + } + case 10: { + LogStep(10, "Read the global attribute: GeneratedCommandList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WaterTankMonitoring::Id, + WaterTankMonitoring::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); + } + case 11: { + LogStep(11, "TH reads EventList attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WaterTankMonitoring::Id, + WaterTankMonitoring::Attributes::EventList::Id, true, chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_WTREMON_2_1Suite : public TestCommand +{ +public: + Test_TC_WTREMON_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_WTREMON_2_1", 5, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_WTREMON_2_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::Percent value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "percent", "percent")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 100U)); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::WaterTankMonitoring::DegradationDirectionEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 1U)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::WaterTankMonitoring::ChangeIndicationEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "boolean", "boolean")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "TH reads from the DUT the Condition attribute."); + VerifyOrDo(!ShouldSkip("WTREMON.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WaterTankMonitoring::Id, + WaterTankMonitoring::Attributes::Condition::Id, true, chip::NullOptional); + } + case 2: { + LogStep(2, "TH reads from the DUT the DegradationDirection attribute.."); + VerifyOrDo(!ShouldSkip("WTREMON.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WaterTankMonitoring::Id, + WaterTankMonitoring::Attributes::DegradationDirection::Id, true, chip::NullOptional); + } + case 3: { + LogStep(3, "TH reads from the DUT the ChangeIndication attribute."); + VerifyOrDo(!ShouldSkip("WTREMON.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WaterTankMonitoring::Id, + WaterTankMonitoring::Attributes::ChangeIndication::Id, true, chip::NullOptional); + } + case 4: { + LogStep(4, "TH reads from the DUT the InPlaceIndicator attribute"); + VerifyOrDo(!ShouldSkip("WTREMON.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), WaterTankMonitoring::Id, + WaterTankMonitoring::Attributes::InPlaceIndicator::Id, true, chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_ZEOFREMON_1_1Suite : public TestCommand +{ +public: + Test_TC_ZEOFREMON_1_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_ZEOFREMON_1_1", 12, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_ZEOFREMON_1_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint16_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("clusterRevision", value, 1U)); + VerifyOrReturn(CheckConstraintType("value", "int16u", "int16u")); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckValue("featureMap", value, 0UL)); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 1UL)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + uint32_t value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "bitmap32", "bitmap32")); + VerifyOrReturn(CheckConstraintHasMasksSet("value", value, 2UL)); + } + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65528UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65530UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 65533UL)); + } + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("value", value, 1UL)); + } + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 3UL)); + } + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + VerifyOrReturn(CheckConstraintContains("value", value, 0UL)); + } + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("generatedCommandList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::DataModel::DecodableList value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + { + auto iter_0 = value.begin(); + VerifyOrReturn(CheckNoMoreListItems("eventList", iter_0, 0)); + } + VerifyOrReturn(CheckConstraintType("value", "list", "list")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "Read the global attribute: ClusterRevision"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ZeoliteFilterMonitoring::Id, + ZeoliteFilterMonitoring::Attributes::ClusterRevision::Id, true, chip::NullOptional); + } + case 2: { + LogStep(2, "Read the global attribute: FeatureMap"); + VerifyOrDo(!ShouldSkip("!ZEOFREMON.S.F00 && !ZEOFREMON.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ZeoliteFilterMonitoring::Id, + ZeoliteFilterMonitoring::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 3: { + LogStep(3, "Given ZEOFREMON.S.F00(Condition) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("ZEOFREMON.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ZeoliteFilterMonitoring::Id, + ZeoliteFilterMonitoring::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 4: { + LogStep(4, "Given ZEOFREMON.S.F01(Warning) ensure featuremap has the correct bit set"); + VerifyOrDo(!ShouldSkip("ZEOFREMON.S.F01"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ZeoliteFilterMonitoring::Id, + ZeoliteFilterMonitoring::Attributes::FeatureMap::Id, true, chip::NullOptional); + } + case 5: { + LogStep(5, "Read the global attribute: AttributeList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ZeoliteFilterMonitoring::Id, + ZeoliteFilterMonitoring::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 6: { + LogStep(6, "Read the feature dependent(ZEOFREMON.S.F00) attribute in AttributeList"); + VerifyOrDo(!ShouldSkip("ZEOFREMON.S.F00"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ZeoliteFilterMonitoring::Id, + ZeoliteFilterMonitoring::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 7: { + LogStep(7, "Read the optional attribute InPlaceIndicator (ZEOFREMON.S.A0002) in AttributeList"); + VerifyOrDo(!ShouldSkip("ZEOFREMON.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ZeoliteFilterMonitoring::Id, + ZeoliteFilterMonitoring::Attributes::AttributeList::Id, true, chip::NullOptional); + } + case 8: { + LogStep(8, "Read the global attribute: AcceptedCommandList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ZeoliteFilterMonitoring::Id, + ZeoliteFilterMonitoring::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); + } + case 9: { + LogStep(9, "Read the optional command (ResetCondition) in AcceptedCommandList"); + VerifyOrDo(!ShouldSkip("ZEOFREMON.S.C00.Rsp"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ZeoliteFilterMonitoring::Id, + ZeoliteFilterMonitoring::Attributes::AcceptedCommandList::Id, true, chip::NullOptional); + } + case 10: { + LogStep(10, "Read the global attribute: GeneratedCommandList"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ZeoliteFilterMonitoring::Id, + ZeoliteFilterMonitoring::Attributes::GeneratedCommandList::Id, true, chip::NullOptional); + } + case 11: { + LogStep(11, "TH reads EventList attribute from DUT"); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ZeoliteFilterMonitoring::Id, + ZeoliteFilterMonitoring::Attributes::EventList::Id, true, chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + +class Test_TC_ZEOFREMON_2_1Suite : public TestCommand +{ +public: + Test_TC_ZEOFREMON_2_1Suite(CredentialIssuerCommands * credsIssuerConfig) : + TestCommand("Test_TC_ZEOFREMON_2_1", 5, credsIssuerConfig) + { + AddArgument("nodeId", 0, UINT64_MAX, &mNodeId); + AddArgument("cluster", &mCluster); + AddArgument("endpoint", 0, UINT16_MAX, &mEndpoint); + AddArgument("timeout", 0, UINT16_MAX, &mTimeout); + } + + ~Test_TC_ZEOFREMON_2_1Suite() {} + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + chip::EndpointId GetEndpoint(chip::EndpointId endpoint) { return mEndpoint.HasValue() ? mEndpoint.Value() : endpoint; } + + // + // Tests methods + // + + void OnResponse(const chip::app::StatusIB & status, chip::TLV::TLVReader * data) override + { + bool shouldContinue = false; + + switch (mTestIndex - 1) + { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + shouldContinue = true; + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::Percent value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "percent", "percent")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 100U)); + } + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::ZeoliteFilterMonitoring::DegradationDirectionEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 1U)); + } + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + chip::app::Clusters::ZeoliteFilterMonitoring::ChangeIndicationEnum value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("value", value, 0U)); + VerifyOrReturn(CheckConstraintMaxValue("value", value, 2U)); + } + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + { + bool value; + VerifyOrReturn(CheckDecodeValue(chip::app::DataModel::Decode(*data, value))); + VerifyOrReturn(CheckConstraintType("value", "boolean", "boolean")); + } + break; + default: + LogErrorOnFailure(ContinueOnChipMainThread(CHIP_ERROR_INVALID_ARGUMENT)); + } + + if (shouldContinue) + { + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + } + + CHIP_ERROR DoTestStep(uint16_t testIndex) override + { + using namespace chip::app::Clusters; + switch (testIndex) + { + case 0: { + LogStep(0, "Wait for the commissioned device to be retrieved"); + ListFreer listFreer; + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee(kIdentityAlpha, value); + } + case 1: { + LogStep(1, "TH reads from the DUT the Condition attribute."); + VerifyOrDo(!ShouldSkip("ZEOFREMON.S.A0000"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ZeoliteFilterMonitoring::Id, + ZeoliteFilterMonitoring::Attributes::Condition::Id, true, chip::NullOptional); + } + case 2: { + LogStep(2, "TH reads from the DUT the DegradationDirection attribute.."); + VerifyOrDo(!ShouldSkip("ZEOFREMON.S.A0001"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ZeoliteFilterMonitoring::Id, + ZeoliteFilterMonitoring::Attributes::DegradationDirection::Id, true, chip::NullOptional); + } + case 3: { + LogStep(3, "TH reads from the DUT the ChangeIndication attribute."); + VerifyOrDo(!ShouldSkip("ZEOFREMON.S.A0002"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ZeoliteFilterMonitoring::Id, + ZeoliteFilterMonitoring::Attributes::ChangeIndication::Id, true, chip::NullOptional); + } + case 4: { + LogStep(4, "TH reads from the DUT the InPlaceIndicator attribute"); + VerifyOrDo(!ShouldSkip("ZEOFREMON.S.A0003"), return ContinueOnChipMainThread(CHIP_NO_ERROR)); + return ReadAttribute(kIdentityAlpha, GetEndpoint(1), ZeoliteFilterMonitoring::Id, + ZeoliteFilterMonitoring::Attributes::InPlaceIndicator::Id, true, chip::NullOptional); + } + } + return CHIP_NO_ERROR; + } +}; + class Test_TC_DD_1_5Suite : public TestCommand { public: @@ -122837,6 +127301,30 @@ void registerCommandsTests(Commands & commands, CredentialIssuerCommands * creds make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), + make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), make_unique(credsIssuerConfig), diff --git a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h index b84f964799fccb..54567b27ed5ba4 100644 --- a/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h +++ b/zzz_generated/darwin-framework-tool/zap-generated/test/Commands.h @@ -245,6 +245,30 @@ class TestList : public Command { printf("TestGroupsCluster\n"); printf("TestGroupKeyManagementCluster\n"); printf("Test_TC_G_1_1\n"); + printf("Test_TC_ACFREMON_1_1\n"); + printf("Test_TC_ACFREMON_2_1\n"); + printf("Test_TC_CFREMON_1_1\n"); + printf("Test_TC_CFREMON_2_1\n"); + printf("Test_TC_ESFREMON_1_1\n"); + printf("Test_TC_ESFREMON_2_1\n"); + printf("Test_TC_FTREMON_1_1\n"); + printf("Test_TC_FTREMON_2_1\n"); + printf("Test_TC_HEPAFREMON_1_1\n"); + printf("Test_TC_HEPAFREMON_2_1\n"); + printf("Test_TC_INKCREMON_1_1\n"); + printf("Test_TC_INKCREMON_2_1\n"); + printf("Test_TC_IONFREMON_1_1\n"); + printf("Test_TC_IONFREMON_2_1\n"); + printf("Test_TC_OZFREMON_1_1\n"); + printf("Test_TC_OZFREMON_2_1\n"); + printf("Test_TC_TCREMON_1_1\n"); + printf("Test_TC_TCREMON_2_1\n"); + printf("Test_TC_UVFREMON_1_1\n"); + printf("Test_TC_UVFREMON_2_1\n"); + printf("Test_TC_WTREMON_1_1\n"); + printf("Test_TC_WTREMON_2_1\n"); + printf("Test_TC_ZEOFREMON_1_1\n"); + printf("Test_TC_ZEOFREMON_2_1\n"); return CHIP_NO_ERROR; } @@ -146536,6 +146560,8142 @@ class Test_TC_G_1_1 : public TestCommandBridge { } }; +class Test_TC_ACFREMON_1_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_ACFREMON_1_1() + : TestCommandBridge("Test_TC_ACFREMON_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_ACFREMON_1_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_ACFREMON_1_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_ACFREMON_1_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute: ClusterRevision\n"); + err = TestReadTheGlobalAttributeClusterRevision_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: FeatureMap\n"); + if (ShouldSkip("!ACFREMON.S.F00 && !ACFREMON.S.F01")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeFeatureMap_2(); + break; + case 3: + ChipLogProgress( + chipTool, " ***** Test Step 3 : Given ACFREMON.S.F00(Condition) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("ACFREMON.S.F00")) { + NextTest(); + return; + } + err = TestGivenACFREMONSF00ConditionEnsureFeaturemapHasTheCorrectBitSet_3(); + break; + case 4: + ChipLogProgress( + chipTool, " ***** Test Step 4 : Given ACFREMON.S.F01(Warning) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("ACFREMON.S.F01")) { + NextTest(); + return; + } + err = TestGivenACFREMONSF01WarningEnsureFeaturemapHasTheCorrectBitSet_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_5(); + break; + case 6: + ChipLogProgress( + chipTool, " ***** Test Step 6 : Read the feature dependent(ACFREMON.S.F00) attribute in AttributeList\n"); + if (ShouldSkip("ACFREMON.S.F00")) { + NextTest(); + return; + } + err = TestReadTheFeatureDependentACFREMONSF00AttributeInAttributeList_6(); + break; + case 7: + ChipLogProgress(chipTool, + " ***** Test Step 7 : Read the optional attribute InPlaceIndicator (ACFREMON.S.A0002) in AttributeList\n"); + if (ShouldSkip("ACFREMON.S.A0002")) { + NextTest(); + return; + } + err = TestReadTheOptionalAttributeInPlaceIndicatorAcfremonsa0002InAttributeList_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Read the global attribute: AcceptedCommandList\n"); + err = TestReadTheGlobalAttributeAcceptedCommandList_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Read the optional command (ResetCondition) in AcceptedCommandList\n"); + if (ShouldSkip("ACFREMON.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestReadTheOptionalCommandResetConditionInAcceptedCommandList_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : Read the global attribute: GeneratedCommandList\n"); + err = TestReadTheGlobalAttributeGeneratedCommandList_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : TH reads EventList attribute from DUT\n"); + err = TestThReadsEventListAttributeFromDut_11(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + void OnStatusUpdate(const chip::app::StatusIB & status) override + { + switch (mTestIndex - 1) { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + } + + // Go on to the next test. + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 12; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterActivatedCarbonFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: ClusterRevision Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 1U)); + } + + VerifyOrReturn(CheckConstraintType("clusterRevision", "int16u", "int16u")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeFeatureMap_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterActivatedCarbonFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: FeatureMap Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("FeatureMap", actualValue, 0UL)); + } + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenACFREMONSF00ConditionEnsureFeaturemapHasTheCorrectBitSet_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterActivatedCarbonFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given ACFREMON.S.F00(Condition) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenACFREMONSF01WarningEnsureFeaturemapHasTheCorrectBitSet_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterActivatedCarbonFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given ACFREMON.S.F01(Warning) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterActivatedCarbonFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65528UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65530UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65533UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheFeatureDependentACFREMONSF00AttributeInAttributeList_6() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterActivatedCarbonFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the feature dependent(ACFREMON.S.F00) attribute in AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 1UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeInPlaceIndicatorAcfremonsa0002InAttributeList_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterActivatedCarbonFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional attribute InPlaceIndicator (ACFREMON.S.A0002) in AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 3UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterActivatedCarbonFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalCommandResetConditionInAcceptedCommandList_9() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterActivatedCarbonFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional command (ResetCondition) in AcceptedCommandList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("acceptedCommandList", value, 0UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_10() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterActivatedCarbonFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: GeneratedCommandList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("GeneratedCommandList", [actualValue count], static_cast(0))); + } + + VerifyOrReturn(CheckConstraintType("generatedCommandList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsEventListAttributeFromDut_11() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterActivatedCarbonFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads EventList attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("EventList", [actualValue count], static_cast(0))); + } + + VerifyOrReturn(CheckConstraintType("eventList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_ACFREMON_2_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_ACFREMON_2_1() + : TestCommandBridge("Test_TC_ACFREMON_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_ACFREMON_2_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_ACFREMON_2_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_ACFREMON_2_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads from the DUT the Condition attribute.\n"); + if (ShouldSkip("ACFREMON.S.A0000")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheConditionAttribute_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads from the DUT the DegradationDirection attribute..\n"); + if (ShouldSkip("ACFREMON.S.A0001")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheDegradationDirectionAttribute_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : TH reads from the DUT the ChangeIndication attribute.\n"); + if (ShouldSkip("ACFREMON.S.A0002")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheChangeIndicationAttribute_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : TH reads from the DUT the InPlaceIndicator attribute\n"); + if (ShouldSkip("ACFREMON.S.A0003")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheInPlaceIndicatorAttribute_4(); + 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; + } + + // 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 = 5; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestThReadsFromTheDutTheConditionAttribute_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterActivatedCarbonFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeConditionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the Condition attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("condition", "percent", "percent")); + VerifyOrReturn(CheckConstraintMinValue("condition", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("condition", [value unsignedCharValue], 100U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheDegradationDirectionAttribute_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterActivatedCarbonFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeDegradationDirectionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the DegradationDirection attribute.. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("degradationDirection", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("degradationDirection", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("degradationDirection", [value unsignedCharValue], 1U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheChangeIndicationAttribute_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterActivatedCarbonFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeChangeIndicationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the ChangeIndication attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("changeIndication", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("changeIndication", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("changeIndication", [value unsignedCharValue], 2U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheInPlaceIndicatorAttribute_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterActivatedCarbonFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeInPlaceIndicatorWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the InPlaceIndicator attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("inPlaceIndicator", "boolean", "boolean")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_CFREMON_1_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_CFREMON_1_1() + : TestCommandBridge("Test_TC_CFREMON_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_CFREMON_1_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_CFREMON_1_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_CFREMON_1_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute: ClusterRevision\n"); + err = TestReadTheGlobalAttributeClusterRevision_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: FeatureMap\n"); + if (ShouldSkip("!CFREMON.S.F00 && !CFREMON.S.F01")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeFeatureMap_2(); + break; + case 3: + ChipLogProgress( + chipTool, " ***** Test Step 3 : Given CFREMON.S.F00(Condition) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("CFREMON.S.F00")) { + NextTest(); + return; + } + err = TestGivenCFREMONSF00ConditionEnsureFeaturemapHasTheCorrectBitSet_3(); + break; + case 4: + ChipLogProgress( + chipTool, " ***** Test Step 4 : Given CFREMON.S.F01(Warning) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("CFREMON.S.F01")) { + NextTest(); + return; + } + err = TestGivenCFREMONSF01WarningEnsureFeaturemapHasTheCorrectBitSet_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_5(); + break; + case 6: + ChipLogProgress( + chipTool, " ***** Test Step 6 : Read the feature dependent(CFREMON.S.F00) attribute in AttributeList\n"); + if (ShouldSkip("CFREMON.S.F00")) { + NextTest(); + return; + } + err = TestReadTheFeatureDependentCFREMONSF00AttributeInAttributeList_6(); + break; + case 7: + ChipLogProgress( + chipTool, " ***** Test Step 7 : Read the optional attribute InPlaceIndicator (CFREMON.S.A0002) in AttributeList\n"); + if (ShouldSkip("CFREMON.S.A0002")) { + NextTest(); + return; + } + err = TestReadTheOptionalAttributeInPlaceIndicatorCfremonsa0002InAttributeList_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Read the global attribute: AcceptedCommandList\n"); + err = TestReadTheGlobalAttributeAcceptedCommandList_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Read the optional command (ResetCondition) in AcceptedCommandList\n"); + if (ShouldSkip("CFREMON.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestReadTheOptionalCommandResetConditionInAcceptedCommandList_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : Read the global attribute: GeneratedCommandList\n"); + err = TestReadTheGlobalAttributeGeneratedCommandList_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : TH reads EventList attribute from DUT\n"); + err = TestThReadsEventListAttributeFromDut_11(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + void OnStatusUpdate(const chip::app::StatusIB & status) override + { + switch (mTestIndex - 1) { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + } + + // Go on to the next test. + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 12; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCeramicFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: ClusterRevision Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 1U)); + } + + VerifyOrReturn(CheckConstraintType("clusterRevision", "int16u", "int16u")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeFeatureMap_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCeramicFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: FeatureMap Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("FeatureMap", actualValue, 0UL)); + } + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenCFREMONSF00ConditionEnsureFeaturemapHasTheCorrectBitSet_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCeramicFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given CFREMON.S.F00(Condition) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenCFREMONSF01WarningEnsureFeaturemapHasTheCorrectBitSet_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCeramicFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given CFREMON.S.F01(Warning) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCeramicFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65528UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65530UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65533UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheFeatureDependentCFREMONSF00AttributeInAttributeList_6() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCeramicFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the feature dependent(CFREMON.S.F00) attribute in AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 1UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeInPlaceIndicatorCfremonsa0002InAttributeList_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCeramicFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional attribute InPlaceIndicator (CFREMON.S.A0002) in AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 3UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCeramicFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalCommandResetConditionInAcceptedCommandList_9() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCeramicFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional command (ResetCondition) in AcceptedCommandList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("acceptedCommandList", value, 0UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_10() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCeramicFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: GeneratedCommandList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("GeneratedCommandList", [actualValue count], static_cast(0))); + } + + VerifyOrReturn(CheckConstraintType("generatedCommandList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsEventListAttributeFromDut_11() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCeramicFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads EventList attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("EventList", [actualValue count], static_cast(0))); + } + + VerifyOrReturn(CheckConstraintType("eventList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_CFREMON_2_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_CFREMON_2_1() + : TestCommandBridge("Test_TC_CFREMON_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_CFREMON_2_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_CFREMON_2_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_CFREMON_2_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads from the DUT the Condition attribute.\n"); + if (ShouldSkip("CFREMON.S.A0000")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheConditionAttribute_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads from the DUT the DegradationDirection attribute..\n"); + if (ShouldSkip("CFREMON.S.A0001")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheDegradationDirectionAttribute_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : TH reads from the DUT the ChangeIndication attribute.\n"); + if (ShouldSkip("CFREMON.S.A0002")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheChangeIndicationAttribute_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : TH reads from the DUT the InPlaceIndicator attribute\n"); + if (ShouldSkip("CFREMON.S.A0003")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheInPlaceIndicatorAttribute_4(); + 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; + } + + // 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 = 5; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestThReadsFromTheDutTheConditionAttribute_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCeramicFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeConditionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the Condition attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("condition", "percent", "percent")); + VerifyOrReturn(CheckConstraintMinValue("condition", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("condition", [value unsignedCharValue], 100U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheDegradationDirectionAttribute_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCeramicFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeDegradationDirectionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the DegradationDirection attribute.. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("degradationDirection", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("degradationDirection", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("degradationDirection", [value unsignedCharValue], 1U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheChangeIndicationAttribute_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCeramicFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeChangeIndicationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the ChangeIndication attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("changeIndication", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("changeIndication", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("changeIndication", [value unsignedCharValue], 2U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheInPlaceIndicatorAttribute_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterCeramicFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeInPlaceIndicatorWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the InPlaceIndicator attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("inPlaceIndicator", "boolean", "boolean")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_ESFREMON_1_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_ESFREMON_1_1() + : TestCommandBridge("Test_TC_ESFREMON_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_ESFREMON_1_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_ESFREMON_1_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_ESFREMON_1_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute: ClusterRevision\n"); + err = TestReadTheGlobalAttributeClusterRevision_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: FeatureMap\n"); + if (ShouldSkip("!ESFREMON.S.F00 && !ESFREMON.S.F01")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeFeatureMap_2(); + break; + case 3: + ChipLogProgress( + chipTool, " ***** Test Step 3 : Given ESFREMON.S.F00(Condition) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("ESFREMON.S.F00")) { + NextTest(); + return; + } + err = TestGivenESFREMONSF00ConditionEnsureFeaturemapHasTheCorrectBitSet_3(); + break; + case 4: + ChipLogProgress( + chipTool, " ***** Test Step 4 : Given ESFREMON.S.F01(Warning) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("ESFREMON.S.F01")) { + NextTest(); + return; + } + err = TestGivenESFREMONSF01WarningEnsureFeaturemapHasTheCorrectBitSet_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_5(); + break; + case 6: + ChipLogProgress( + chipTool, " ***** Test Step 6 : Read the feature dependent(ESFREMON.S.F00) attribute in AttributeList\n"); + if (ShouldSkip("ESFREMON.S.F00")) { + NextTest(); + return; + } + err = TestReadTheFeatureDependentESFREMONSF00AttributeInAttributeList_6(); + break; + case 7: + ChipLogProgress(chipTool, + " ***** Test Step 7 : Read the optional attribute InPlaceIndicator (ESFREMON.S.A0002) in AttributeList\n"); + if (ShouldSkip("ESFREMON.S.A0002")) { + NextTest(); + return; + } + err = TestReadTheOptionalAttributeInPlaceIndicatorEsfremonsa0002InAttributeList_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Read the global attribute: AcceptedCommandList\n"); + err = TestReadTheGlobalAttributeAcceptedCommandList_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Read the optional command (ResetCondition) in AcceptedCommandList\n"); + if (ShouldSkip("ESFREMON.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestReadTheOptionalCommandResetConditionInAcceptedCommandList_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : Read the global attribute: GeneratedCommandList\n"); + err = TestReadTheGlobalAttributeGeneratedCommandList_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : TH reads EventList attribute from DUT\n"); + err = TestThReadsEventListAttributeFromDut_11(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + void OnStatusUpdate(const chip::app::StatusIB & status) override + { + switch (mTestIndex - 1) { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + } + + // Go on to the next test. + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 12; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterElectrostaticFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: ClusterRevision Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 1U)); + } + + VerifyOrReturn(CheckConstraintType("clusterRevision", "int16u", "int16u")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeFeatureMap_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterElectrostaticFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: FeatureMap Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("FeatureMap", actualValue, 0UL)); + } + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenESFREMONSF00ConditionEnsureFeaturemapHasTheCorrectBitSet_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterElectrostaticFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given ESFREMON.S.F00(Condition) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenESFREMONSF01WarningEnsureFeaturemapHasTheCorrectBitSet_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterElectrostaticFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given ESFREMON.S.F01(Warning) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterElectrostaticFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65528UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65530UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65533UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheFeatureDependentESFREMONSF00AttributeInAttributeList_6() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterElectrostaticFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the feature dependent(ESFREMON.S.F00) attribute in AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 1UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeInPlaceIndicatorEsfremonsa0002InAttributeList_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterElectrostaticFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional attribute InPlaceIndicator (ESFREMON.S.A0002) in AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 3UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterElectrostaticFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalCommandResetConditionInAcceptedCommandList_9() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterElectrostaticFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional command (ResetCondition) in AcceptedCommandList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("acceptedCommandList", value, 0UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_10() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterElectrostaticFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: GeneratedCommandList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("GeneratedCommandList", [actualValue count], static_cast(0))); + } + + VerifyOrReturn(CheckConstraintType("generatedCommandList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsEventListAttributeFromDut_11() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterElectrostaticFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads EventList attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("EventList", [actualValue count], static_cast(0))); + } + + VerifyOrReturn(CheckConstraintType("eventList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_ESFREMON_2_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_ESFREMON_2_1() + : TestCommandBridge("Test_TC_ESFREMON_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_ESFREMON_2_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_ESFREMON_2_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_ESFREMON_2_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads from the DUT the Condition attribute.\n"); + if (ShouldSkip("ESFREMON.S.A0000")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheConditionAttribute_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads from the DUT the DegradationDirection attribute..\n"); + if (ShouldSkip("ESFREMON.S.A0001")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheDegradationDirectionAttribute_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : TH reads from the DUT the ChangeIndication attribute.\n"); + if (ShouldSkip("ESFREMON.S.A0002")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheChangeIndicationAttribute_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : TH reads from the DUT the InPlaceIndicator attribute\n"); + if (ShouldSkip("ESFREMON.S.A0003")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheInPlaceIndicatorAttribute_4(); + 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; + } + + // 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 = 5; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestThReadsFromTheDutTheConditionAttribute_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterElectrostaticFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeConditionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the Condition attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("condition", "percent", "percent")); + VerifyOrReturn(CheckConstraintMinValue("condition", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("condition", [value unsignedCharValue], 100U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheDegradationDirectionAttribute_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterElectrostaticFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeDegradationDirectionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the DegradationDirection attribute.. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("degradationDirection", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("degradationDirection", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("degradationDirection", [value unsignedCharValue], 1U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheChangeIndicationAttribute_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterElectrostaticFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeChangeIndicationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the ChangeIndication attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("changeIndication", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("changeIndication", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("changeIndication", [value unsignedCharValue], 2U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheInPlaceIndicatorAttribute_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterElectrostaticFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeInPlaceIndicatorWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the InPlaceIndicator attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("inPlaceIndicator", "boolean", "boolean")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_FTREMON_1_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_FTREMON_1_1() + : TestCommandBridge("Test_TC_FTREMON_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_FTREMON_1_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_FTREMON_1_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_FTREMON_1_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute: ClusterRevision\n"); + err = TestReadTheGlobalAttributeClusterRevision_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: FeatureMap\n"); + if (ShouldSkip("!FTREMON.S.F00 && !FTREMON.S.F01")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeFeatureMap_2(); + break; + case 3: + ChipLogProgress( + chipTool, " ***** Test Step 3 : Given FTREMON.S.F00(Condition) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("FTREMON.S.F00")) { + NextTest(); + return; + } + err = TestGivenFTREMONSF00ConditionEnsureFeaturemapHasTheCorrectBitSet_3(); + break; + case 4: + ChipLogProgress( + chipTool, " ***** Test Step 4 : Given FTREMON.S.F01(Warning) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("FTREMON.S.F01")) { + NextTest(); + return; + } + err = TestGivenFTREMONSF01WarningEnsureFeaturemapHasTheCorrectBitSet_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_5(); + break; + case 6: + ChipLogProgress( + chipTool, " ***** Test Step 6 : Read the feature dependent(FTREMON.S.F00) attribute in AttributeList\n"); + if (ShouldSkip("FTREMON.S.F00")) { + NextTest(); + return; + } + err = TestReadTheFeatureDependentFTREMONSF00AttributeInAttributeList_6(); + break; + case 7: + ChipLogProgress( + chipTool, " ***** Test Step 7 : Read the optional attribute InPlaceIndicator (FTREMON.S.A0002) in AttributeList\n"); + if (ShouldSkip("FTREMON.S.A0002")) { + NextTest(); + return; + } + err = TestReadTheOptionalAttributeInPlaceIndicatorFtremonsa0002InAttributeList_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Read the global attribute: AcceptedCommandList\n"); + err = TestReadTheGlobalAttributeAcceptedCommandList_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Read the optional command (ResetCondition) in AcceptedCommandList\n"); + if (ShouldSkip("FTREMON.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestReadTheOptionalCommandResetConditionInAcceptedCommandList_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : Read the global attribute: GeneratedCommandList\n"); + err = TestReadTheGlobalAttributeGeneratedCommandList_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : TH reads EventList attribute from DUT\n"); + err = TestThReadsEventListAttributeFromDut_11(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + void OnStatusUpdate(const chip::app::StatusIB & status) override + { + switch (mTestIndex - 1) { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + } + + // Go on to the next test. + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 12; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFuelTankMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: ClusterRevision Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 1U)); + } + + VerifyOrReturn(CheckConstraintType("clusterRevision", "int16u", "int16u")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeFeatureMap_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFuelTankMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: FeatureMap Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("FeatureMap", actualValue, 0UL)); + } + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenFTREMONSF00ConditionEnsureFeaturemapHasTheCorrectBitSet_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFuelTankMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given FTREMON.S.F00(Condition) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenFTREMONSF01WarningEnsureFeaturemapHasTheCorrectBitSet_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFuelTankMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given FTREMON.S.F01(Warning) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFuelTankMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65528UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65530UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65533UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheFeatureDependentFTREMONSF00AttributeInAttributeList_6() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFuelTankMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the feature dependent(FTREMON.S.F00) attribute in AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 1UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeInPlaceIndicatorFtremonsa0002InAttributeList_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFuelTankMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional attribute InPlaceIndicator (FTREMON.S.A0002) in AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 3UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFuelTankMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalCommandResetConditionInAcceptedCommandList_9() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFuelTankMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional command (ResetCondition) in AcceptedCommandList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("acceptedCommandList", value, 0UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_10() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFuelTankMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: GeneratedCommandList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("GeneratedCommandList", [actualValue count], static_cast(0))); + } + + VerifyOrReturn(CheckConstraintType("generatedCommandList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsEventListAttributeFromDut_11() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFuelTankMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads EventList attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("EventList", [actualValue count], static_cast(0))); + } + + VerifyOrReturn(CheckConstraintType("eventList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_FTREMON_2_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_FTREMON_2_1() + : TestCommandBridge("Test_TC_FTREMON_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_FTREMON_2_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_FTREMON_2_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_FTREMON_2_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads from the DUT the Condition attribute.\n"); + if (ShouldSkip("FTREMON.S.A0000")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheConditionAttribute_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads from the DUT the DegradationDirection attribute..\n"); + if (ShouldSkip("FTREMON.S.A0001")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheDegradationDirectionAttribute_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : TH reads from the DUT the ChangeIndication attribute.\n"); + if (ShouldSkip("FTREMON.S.A0002")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheChangeIndicationAttribute_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : TH reads from the DUT the InPlaceIndicator attribute\n"); + if (ShouldSkip("FTREMON.S.A0003")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheInPlaceIndicatorAttribute_4(); + 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; + } + + // 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 = 5; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestThReadsFromTheDutTheConditionAttribute_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFuelTankMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeConditionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the Condition attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("condition", "percent", "percent")); + VerifyOrReturn(CheckConstraintMinValue("condition", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("condition", [value unsignedCharValue], 100U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheDegradationDirectionAttribute_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFuelTankMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeDegradationDirectionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the DegradationDirection attribute.. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("degradationDirection", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("degradationDirection", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("degradationDirection", [value unsignedCharValue], 1U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheChangeIndicationAttribute_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFuelTankMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeChangeIndicationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the ChangeIndication attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("changeIndication", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("changeIndication", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("changeIndication", [value unsignedCharValue], 2U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheInPlaceIndicatorAttribute_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterFuelTankMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeInPlaceIndicatorWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the InPlaceIndicator attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("inPlaceIndicator", "boolean", "boolean")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_HEPAFREMON_1_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_HEPAFREMON_1_1() + : TestCommandBridge("Test_TC_HEPAFREMON_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_HEPAFREMON_1_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_HEPAFREMON_1_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_HEPAFREMON_1_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute: ClusterRevision\n"); + err = TestReadTheGlobalAttributeClusterRevision_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: FeatureMap\n"); + if (ShouldSkip("!HEPAFREMON.S.F00 && !HEPAFREMON.S.F01")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeFeatureMap_2(); + break; + case 3: + ChipLogProgress( + chipTool, " ***** Test Step 3 : Given HEPAFREMON.S.F00(Condition) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("HEPAFREMON.S.F00")) { + NextTest(); + return; + } + err = TestGivenHEPAFREMONSF00ConditionEnsureFeaturemapHasTheCorrectBitSet_3(); + break; + case 4: + ChipLogProgress( + chipTool, " ***** Test Step 4 : Given HEPAFREMON.S.F01(Warning) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("HEPAFREMON.S.F01")) { + NextTest(); + return; + } + err = TestGivenHEPAFREMONSF01WarningEnsureFeaturemapHasTheCorrectBitSet_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_5(); + break; + case 6: + ChipLogProgress( + chipTool, " ***** Test Step 6 : Read the feature dependent(HEPAFREMON.S.F00) attribute in AttributeList\n"); + if (ShouldSkip("HEPAFREMON.S.F00")) { + NextTest(); + return; + } + err = TestReadTheFeatureDependentHEPAFREMONSF00AttributeInAttributeList_6(); + break; + case 7: + ChipLogProgress(chipTool, + " ***** Test Step 7 : Read the optional attribute InPlaceIndicator (HEPAFREMON.S.A0002) in AttributeList\n"); + if (ShouldSkip("HEPAFREMON.S.A0002")) { + NextTest(); + return; + } + err = TestReadTheOptionalAttributeInPlaceIndicatorHepafremonsa0002InAttributeList_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Read the global attribute: AcceptedCommandList\n"); + err = TestReadTheGlobalAttributeAcceptedCommandList_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Read the optional command (ResetCondition) in AcceptedCommandList\n"); + if (ShouldSkip("HEPAFREMON.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestReadTheOptionalCommandResetConditionInAcceptedCommandList_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : Read the global attribute: GeneratedCommandList\n"); + err = TestReadTheGlobalAttributeGeneratedCommandList_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : TH reads EventList attribute from DUT\n"); + err = TestThReadsEventListAttributeFromDut_11(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + void OnStatusUpdate(const chip::app::StatusIB & status) override + { + switch (mTestIndex - 1) { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + } + + // Go on to the next test. + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 12; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: ClusterRevision Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 1U)); + } + + VerifyOrReturn(CheckConstraintType("clusterRevision", "int16u", "int16u")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeFeatureMap_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: FeatureMap Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("FeatureMap", actualValue, 0UL)); + } + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenHEPAFREMONSF00ConditionEnsureFeaturemapHasTheCorrectBitSet_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given HEPAFREMON.S.F00(Condition) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenHEPAFREMONSF01WarningEnsureFeaturemapHasTheCorrectBitSet_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given HEPAFREMON.S.F01(Warning) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65528UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65530UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65533UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheFeatureDependentHEPAFREMONSF00AttributeInAttributeList_6() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the feature dependent(HEPAFREMON.S.F00) attribute in AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 1UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeInPlaceIndicatorHepafremonsa0002InAttributeList_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional attribute InPlaceIndicator (HEPAFREMON.S.A0002) in AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 3UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalCommandResetConditionInAcceptedCommandList_9() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional command (ResetCondition) in AcceptedCommandList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("acceptedCommandList", value, 0UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_10() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: GeneratedCommandList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("GeneratedCommandList", [actualValue count], static_cast(0))); + } + + VerifyOrReturn(CheckConstraintType("generatedCommandList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsEventListAttributeFromDut_11() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads EventList attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("EventList", [actualValue count], static_cast(0))); + } + + VerifyOrReturn(CheckConstraintType("eventList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_HEPAFREMON_2_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_HEPAFREMON_2_1() + : TestCommandBridge("Test_TC_HEPAFREMON_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_HEPAFREMON_2_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_HEPAFREMON_2_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_HEPAFREMON_2_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads from the DUT the Condition attribute.\n"); + if (ShouldSkip("HEPAFREMON.S.A0000")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheConditionAttribute_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads from the DUT the DegradationDirection attribute..\n"); + if (ShouldSkip("HEPAFREMON.S.A0001")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheDegradationDirectionAttribute_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : TH reads from the DUT the ChangeIndication attribute.\n"); + if (ShouldSkip("HEPAFREMON.S.A0002")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheChangeIndicationAttribute_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : TH reads from the DUT the InPlaceIndicator attribute\n"); + if (ShouldSkip("HEPAFREMON.S.A0003")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheInPlaceIndicatorAttribute_4(); + 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; + } + + // 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 = 5; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestThReadsFromTheDutTheConditionAttribute_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeConditionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the Condition attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("condition", "percent", "percent")); + VerifyOrReturn(CheckConstraintMinValue("condition", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("condition", [value unsignedCharValue], 100U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheDegradationDirectionAttribute_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeDegradationDirectionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the DegradationDirection attribute.. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("degradationDirection", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("degradationDirection", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("degradationDirection", [value unsignedCharValue], 1U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheChangeIndicationAttribute_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeChangeIndicationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the ChangeIndication attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("changeIndication", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("changeIndication", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("changeIndication", [value unsignedCharValue], 2U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheInPlaceIndicatorAttribute_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterHEPAFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeInPlaceIndicatorWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the InPlaceIndicator attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("inPlaceIndicator", "boolean", "boolean")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_INKCREMON_1_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_INKCREMON_1_1() + : TestCommandBridge("Test_TC_INKCREMON_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_INKCREMON_1_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_INKCREMON_1_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_INKCREMON_1_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute: ClusterRevision\n"); + err = TestReadTheGlobalAttributeClusterRevision_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: FeatureMap\n"); + if (ShouldSkip("!INKCREMON.S.F00 && !INKCREMON.S.F01")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeFeatureMap_2(); + break; + case 3: + ChipLogProgress( + chipTool, " ***** Test Step 3 : Given INKCREMON.S.F00(Condition) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("INKCREMON.S.F00")) { + NextTest(); + return; + } + err = TestGivenINKCREMONSF00ConditionEnsureFeaturemapHasTheCorrectBitSet_3(); + break; + case 4: + ChipLogProgress( + chipTool, " ***** Test Step 4 : Given INKCREMON.S.F01(Warning) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("INKCREMON.S.F01")) { + NextTest(); + return; + } + err = TestGivenINKCREMONSF01WarningEnsureFeaturemapHasTheCorrectBitSet_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_5(); + break; + case 6: + ChipLogProgress( + chipTool, " ***** Test Step 6 : Read the feature dependent(INKCREMON.S.F00) attribute in AttributeList\n"); + if (ShouldSkip("INKCREMON.S.F00")) { + NextTest(); + return; + } + err = TestReadTheFeatureDependentINKCREMONSF00AttributeInAttributeList_6(); + break; + case 7: + ChipLogProgress(chipTool, + " ***** Test Step 7 : Read the optional attribute InPlaceIndicator (INKCREMON.S.A0002) in AttributeList\n"); + if (ShouldSkip("INKCREMON.S.A0002")) { + NextTest(); + return; + } + err = TestReadTheOptionalAttributeInPlaceIndicatorInkcremonsa0002InAttributeList_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Read the global attribute: AcceptedCommandList\n"); + err = TestReadTheGlobalAttributeAcceptedCommandList_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Read the optional command (ResetCondition) in AcceptedCommandList\n"); + if (ShouldSkip("INKCREMON.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestReadTheOptionalCommandResetConditionInAcceptedCommandList_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : Read the global attribute: GeneratedCommandList\n"); + err = TestReadTheGlobalAttributeGeneratedCommandList_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : TH reads EventList attribute from DUT\n"); + err = TestThReadsEventListAttributeFromDut_11(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + void OnStatusUpdate(const chip::app::StatusIB & status) override + { + switch (mTestIndex - 1) { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + } + + // Go on to the next test. + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 12; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterInkCartridgeMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: ClusterRevision Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 1U)); + } + + VerifyOrReturn(CheckConstraintType("clusterRevision", "int16u", "int16u")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeFeatureMap_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterInkCartridgeMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: FeatureMap Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("FeatureMap", actualValue, 0UL)); + } + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenINKCREMONSF00ConditionEnsureFeaturemapHasTheCorrectBitSet_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterInkCartridgeMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given INKCREMON.S.F00(Condition) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenINKCREMONSF01WarningEnsureFeaturemapHasTheCorrectBitSet_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterInkCartridgeMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given INKCREMON.S.F01(Warning) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterInkCartridgeMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65528UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65530UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65533UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheFeatureDependentINKCREMONSF00AttributeInAttributeList_6() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterInkCartridgeMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the feature dependent(INKCREMON.S.F00) attribute in AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 1UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeInPlaceIndicatorInkcremonsa0002InAttributeList_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterInkCartridgeMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional attribute InPlaceIndicator (INKCREMON.S.A0002) in AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 3UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterInkCartridgeMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalCommandResetConditionInAcceptedCommandList_9() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterInkCartridgeMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional command (ResetCondition) in AcceptedCommandList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("acceptedCommandList", value, 0UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_10() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterInkCartridgeMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: GeneratedCommandList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("GeneratedCommandList", [actualValue count], static_cast(0))); + } + + VerifyOrReturn(CheckConstraintType("generatedCommandList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsEventListAttributeFromDut_11() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterInkCartridgeMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads EventList attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("EventList", [actualValue count], static_cast(0))); + } + + VerifyOrReturn(CheckConstraintType("eventList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_INKCREMON_2_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_INKCREMON_2_1() + : TestCommandBridge("Test_TC_INKCREMON_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_INKCREMON_2_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_INKCREMON_2_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_INKCREMON_2_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads from the DUT the Condition attribute.\n"); + if (ShouldSkip("INKCREMON.S.A0000")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheConditionAttribute_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads from the DUT the DegradationDirection attribute..\n"); + if (ShouldSkip("INKCREMON.S.A0001")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheDegradationDirectionAttribute_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : TH reads from the DUT the ChangeIndication attribute.\n"); + if (ShouldSkip("INKCREMON.S.A0002")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheChangeIndicationAttribute_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : TH reads from the DUT the InPlaceIndicator attribute\n"); + if (ShouldSkip("INKCREMON.S.A0003")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheInPlaceIndicatorAttribute_4(); + 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; + } + + // 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 = 5; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestThReadsFromTheDutTheConditionAttribute_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterInkCartridgeMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeConditionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the Condition attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("condition", "percent", "percent")); + VerifyOrReturn(CheckConstraintMinValue("condition", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("condition", [value unsignedCharValue], 100U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheDegradationDirectionAttribute_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterInkCartridgeMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeDegradationDirectionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the DegradationDirection attribute.. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("degradationDirection", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("degradationDirection", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("degradationDirection", [value unsignedCharValue], 1U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheChangeIndicationAttribute_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterInkCartridgeMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeChangeIndicationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the ChangeIndication attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("changeIndication", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("changeIndication", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("changeIndication", [value unsignedCharValue], 2U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheInPlaceIndicatorAttribute_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterInkCartridgeMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeInPlaceIndicatorWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the InPlaceIndicator attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("inPlaceIndicator", "boolean", "boolean")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_IONFREMON_1_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_IONFREMON_1_1() + : TestCommandBridge("Test_TC_IONFREMON_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_IONFREMON_1_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_IONFREMON_1_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_IONFREMON_1_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute: ClusterRevision\n"); + err = TestReadTheGlobalAttributeClusterRevision_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: FeatureMap\n"); + if (ShouldSkip("!IONFREMON.S.F00 && !IONFREMON.S.F01")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeFeatureMap_2(); + break; + case 3: + ChipLogProgress( + chipTool, " ***** Test Step 3 : Given IONFREMON.S.F00(Condition) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("IONFREMON.S.F00")) { + NextTest(); + return; + } + err = TestGivenIONFREMONSF00ConditionEnsureFeaturemapHasTheCorrectBitSet_3(); + break; + case 4: + ChipLogProgress( + chipTool, " ***** Test Step 4 : Given IONFREMON.S.F01(Warning) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("IONFREMON.S.F01")) { + NextTest(); + return; + } + err = TestGivenIONFREMONSF01WarningEnsureFeaturemapHasTheCorrectBitSet_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_5(); + break; + case 6: + ChipLogProgress( + chipTool, " ***** Test Step 6 : Read the feature dependent(IONFREMON.S.F00) attribute in AttributeList\n"); + if (ShouldSkip("IONFREMON.S.F00")) { + NextTest(); + return; + } + err = TestReadTheFeatureDependentIONFREMONSF00AttributeInAttributeList_6(); + break; + case 7: + ChipLogProgress(chipTool, + " ***** Test Step 7 : Read the optional attribute InPlaceIndicator (IONFREMON.S.A0002) in AttributeList\n"); + if (ShouldSkip("IONFREMON.S.A0002")) { + NextTest(); + return; + } + err = TestReadTheOptionalAttributeInPlaceIndicatorIonfremonsa0002InAttributeList_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Read the global attribute: AcceptedCommandList\n"); + err = TestReadTheGlobalAttributeAcceptedCommandList_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Read the optional command (ResetCondition) in AcceptedCommandList\n"); + if (ShouldSkip("IONFREMON.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestReadTheOptionalCommandResetConditionInAcceptedCommandList_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : Read the global attribute: GeneratedCommandList\n"); + err = TestReadTheGlobalAttributeGeneratedCommandList_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : TH reads EventList attribute from DUT\n"); + err = TestThReadsEventListAttributeFromDut_11(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + void OnStatusUpdate(const chip::app::StatusIB & status) override + { + switch (mTestIndex - 1) { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + } + + // Go on to the next test. + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 12; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIonizingFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: ClusterRevision Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 1U)); + } + + VerifyOrReturn(CheckConstraintType("clusterRevision", "int16u", "int16u")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeFeatureMap_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIonizingFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: FeatureMap Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("FeatureMap", actualValue, 0UL)); + } + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenIONFREMONSF00ConditionEnsureFeaturemapHasTheCorrectBitSet_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIonizingFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given IONFREMON.S.F00(Condition) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenIONFREMONSF01WarningEnsureFeaturemapHasTheCorrectBitSet_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIonizingFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given IONFREMON.S.F01(Warning) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIonizingFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65528UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65530UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65533UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheFeatureDependentIONFREMONSF00AttributeInAttributeList_6() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIonizingFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the feature dependent(IONFREMON.S.F00) attribute in AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 1UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeInPlaceIndicatorIonfremonsa0002InAttributeList_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIonizingFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional attribute InPlaceIndicator (IONFREMON.S.A0002) in AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 3UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIonizingFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalCommandResetConditionInAcceptedCommandList_9() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIonizingFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional command (ResetCondition) in AcceptedCommandList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("acceptedCommandList", value, 0UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_10() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIonizingFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: GeneratedCommandList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("GeneratedCommandList", [actualValue count], static_cast(0))); + } + + VerifyOrReturn(CheckConstraintType("generatedCommandList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsEventListAttributeFromDut_11() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIonizingFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads EventList attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("EventList", [actualValue count], static_cast(0))); + } + + VerifyOrReturn(CheckConstraintType("eventList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_IONFREMON_2_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_IONFREMON_2_1() + : TestCommandBridge("Test_TC_IONFREMON_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_IONFREMON_2_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_IONFREMON_2_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_IONFREMON_2_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads from the DUT the Condition attribute.\n"); + if (ShouldSkip("IONFREMON.S.A0000")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheConditionAttribute_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads from the DUT the DegradationDirection attribute..\n"); + if (ShouldSkip("IONFREMON.S.A0001")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheDegradationDirectionAttribute_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : TH reads from the DUT the ChangeIndication attribute.\n"); + if (ShouldSkip("IONFREMON.S.A0002")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheChangeIndicationAttribute_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : TH reads from the DUT the InPlaceIndicator attribute\n"); + if (ShouldSkip("IONFREMON.S.A0003")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheInPlaceIndicatorAttribute_4(); + 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; + } + + // 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 = 5; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestThReadsFromTheDutTheConditionAttribute_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIonizingFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeConditionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the Condition attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("condition", "percent", "percent")); + VerifyOrReturn(CheckConstraintMinValue("condition", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("condition", [value unsignedCharValue], 100U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheDegradationDirectionAttribute_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIonizingFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeDegradationDirectionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the DegradationDirection attribute.. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("degradationDirection", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("degradationDirection", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("degradationDirection", [value unsignedCharValue], 1U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheChangeIndicationAttribute_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIonizingFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeChangeIndicationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the ChangeIndication attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("changeIndication", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("changeIndication", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("changeIndication", [value unsignedCharValue], 2U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheInPlaceIndicatorAttribute_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterIonizingFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeInPlaceIndicatorWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the InPlaceIndicator attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("inPlaceIndicator", "boolean", "boolean")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_OZFREMON_1_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_OZFREMON_1_1() + : TestCommandBridge("Test_TC_OZFREMON_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_OZFREMON_1_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_OZFREMON_1_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OZFREMON_1_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute: ClusterRevision\n"); + err = TestReadTheGlobalAttributeClusterRevision_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: FeatureMap\n"); + if (ShouldSkip("!OZFREMON.S.F00 && !OZFREMON.S.F01")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeFeatureMap_2(); + break; + case 3: + ChipLogProgress( + chipTool, " ***** Test Step 3 : Given OZFREMON.S.F00(Condition) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("OZFREMON.S.F00")) { + NextTest(); + return; + } + err = TestGivenOZFREMONSF00ConditionEnsureFeaturemapHasTheCorrectBitSet_3(); + break; + case 4: + ChipLogProgress( + chipTool, " ***** Test Step 4 : Given OZFREMON.S.F01(Warning) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("OZFREMON.S.F01")) { + NextTest(); + return; + } + err = TestGivenOZFREMONSF01WarningEnsureFeaturemapHasTheCorrectBitSet_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_5(); + break; + case 6: + ChipLogProgress( + chipTool, " ***** Test Step 6 : Read the feature dependent(OZFREMON.S.F00) attribute in AttributeList\n"); + if (ShouldSkip("OZFREMON.S.F00")) { + NextTest(); + return; + } + err = TestReadTheFeatureDependentOZFREMONSF00AttributeInAttributeList_6(); + break; + case 7: + ChipLogProgress(chipTool, + " ***** Test Step 7 : Read the optional attribute InPlaceIndicator (OZFREMON.S.A0002) in AttributeList\n"); + if (ShouldSkip("OZFREMON.S.A0002")) { + NextTest(); + return; + } + err = TestReadTheOptionalAttributeInPlaceIndicatorOzfremonsa0002InAttributeList_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Read the global attribute: AcceptedCommandList\n"); + err = TestReadTheGlobalAttributeAcceptedCommandList_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Read the optional command (ResetCondition) in AcceptedCommandList\n"); + if (ShouldSkip("OZFREMON.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestReadTheOptionalCommandResetConditionInAcceptedCommandList_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : Read the global attribute: GeneratedCommandList\n"); + err = TestReadTheGlobalAttributeGeneratedCommandList_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : TH reads EventList attribute from DUT\n"); + err = TestThReadsEventListAttributeFromDut_11(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + void OnStatusUpdate(const chip::app::StatusIB & status) override + { + switch (mTestIndex - 1) { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + } + + // Go on to the next test. + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 12; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOzoneFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: ClusterRevision Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 1U)); + } + + VerifyOrReturn(CheckConstraintType("clusterRevision", "int16u", "int16u")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeFeatureMap_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOzoneFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: FeatureMap Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("FeatureMap", actualValue, 0UL)); + } + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenOZFREMONSF00ConditionEnsureFeaturemapHasTheCorrectBitSet_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOzoneFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given OZFREMON.S.F00(Condition) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenOZFREMONSF01WarningEnsureFeaturemapHasTheCorrectBitSet_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOzoneFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given OZFREMON.S.F01(Warning) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOzoneFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65528UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65530UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65533UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheFeatureDependentOZFREMONSF00AttributeInAttributeList_6() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOzoneFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the feature dependent(OZFREMON.S.F00) attribute in AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 1UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeInPlaceIndicatorOzfremonsa0002InAttributeList_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOzoneFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional attribute InPlaceIndicator (OZFREMON.S.A0002) in AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 3UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOzoneFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalCommandResetConditionInAcceptedCommandList_9() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOzoneFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional command (ResetCondition) in AcceptedCommandList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("acceptedCommandList", value, 0UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_10() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOzoneFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: GeneratedCommandList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("GeneratedCommandList", [actualValue count], static_cast(0))); + } + + VerifyOrReturn(CheckConstraintType("generatedCommandList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsEventListAttributeFromDut_11() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOzoneFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads EventList attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("EventList", [actualValue count], static_cast(0))); + } + + VerifyOrReturn(CheckConstraintType("eventList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_OZFREMON_2_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_OZFREMON_2_1() + : TestCommandBridge("Test_TC_OZFREMON_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_OZFREMON_2_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_OZFREMON_2_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_OZFREMON_2_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads from the DUT the Condition attribute.\n"); + if (ShouldSkip("OZFREMON.S.A0000")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheConditionAttribute_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads from the DUT the DegradationDirection attribute..\n"); + if (ShouldSkip("OZFREMON.S.A0001")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheDegradationDirectionAttribute_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : TH reads from the DUT the ChangeIndication attribute.\n"); + if (ShouldSkip("OZFREMON.S.A0002")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheChangeIndicationAttribute_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : TH reads from the DUT the InPlaceIndicator attribute\n"); + if (ShouldSkip("OZFREMON.S.A0003")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheInPlaceIndicatorAttribute_4(); + 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; + } + + // 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 = 5; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestThReadsFromTheDutTheConditionAttribute_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOzoneFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeConditionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the Condition attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("condition", "percent", "percent")); + VerifyOrReturn(CheckConstraintMinValue("condition", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("condition", [value unsignedCharValue], 100U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheDegradationDirectionAttribute_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOzoneFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeDegradationDirectionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the DegradationDirection attribute.. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("degradationDirection", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("degradationDirection", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("degradationDirection", [value unsignedCharValue], 1U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheChangeIndicationAttribute_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOzoneFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeChangeIndicationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the ChangeIndication attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("changeIndication", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("changeIndication", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("changeIndication", [value unsignedCharValue], 2U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheInPlaceIndicatorAttribute_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterOzoneFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeInPlaceIndicatorWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the InPlaceIndicator attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("inPlaceIndicator", "boolean", "boolean")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_TCREMON_1_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_TCREMON_1_1() + : TestCommandBridge("Test_TC_TCREMON_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_TCREMON_1_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_TCREMON_1_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_TCREMON_1_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute: ClusterRevision\n"); + err = TestReadTheGlobalAttributeClusterRevision_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: FeatureMap\n"); + if (ShouldSkip("!TCREMON.S.F00 && !TCREMON.S.F01")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeFeatureMap_2(); + break; + case 3: + ChipLogProgress( + chipTool, " ***** Test Step 3 : Given TCREMON.S.F00(Condition) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("TCREMON.S.F00")) { + NextTest(); + return; + } + err = TestGivenTCREMONSF00ConditionEnsureFeaturemapHasTheCorrectBitSet_3(); + break; + case 4: + ChipLogProgress( + chipTool, " ***** Test Step 4 : Given TCREMON.S.F01(Warning) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("TCREMON.S.F01")) { + NextTest(); + return; + } + err = TestGivenTCREMONSF01WarningEnsureFeaturemapHasTheCorrectBitSet_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_5(); + break; + case 6: + ChipLogProgress( + chipTool, " ***** Test Step 6 : Read the feature dependent(TCREMON.S.F00) attribute in AttributeList\n"); + if (ShouldSkip("TCREMON.S.F00")) { + NextTest(); + return; + } + err = TestReadTheFeatureDependentTCREMONSF00AttributeInAttributeList_6(); + break; + case 7: + ChipLogProgress( + chipTool, " ***** Test Step 7 : Read the optional attribute InPlaceIndicator (TCREMON.S.A0002) in AttributeList\n"); + if (ShouldSkip("TCREMON.S.A0002")) { + NextTest(); + return; + } + err = TestReadTheOptionalAttributeInPlaceIndicatorTcremonsa0002InAttributeList_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Read the global attribute: AcceptedCommandList\n"); + err = TestReadTheGlobalAttributeAcceptedCommandList_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Read the optional command (ResetCondition) in AcceptedCommandList\n"); + if (ShouldSkip("TCREMON.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestReadTheOptionalCommandResetConditionInAcceptedCommandList_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : Read the global attribute: GeneratedCommandList\n"); + err = TestReadTheGlobalAttributeGeneratedCommandList_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : TH reads EventList attribute from DUT\n"); + err = TestThReadsEventListAttributeFromDut_11(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + void OnStatusUpdate(const chip::app::StatusIB & status) override + { + switch (mTestIndex - 1) { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + } + + // Go on to the next test. + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 12; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterTonerCartridgeMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: ClusterRevision Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 1U)); + } + + VerifyOrReturn(CheckConstraintType("clusterRevision", "int16u", "int16u")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeFeatureMap_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterTonerCartridgeMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: FeatureMap Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("FeatureMap", actualValue, 0UL)); + } + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenTCREMONSF00ConditionEnsureFeaturemapHasTheCorrectBitSet_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterTonerCartridgeMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given TCREMON.S.F00(Condition) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenTCREMONSF01WarningEnsureFeaturemapHasTheCorrectBitSet_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterTonerCartridgeMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given TCREMON.S.F01(Warning) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterTonerCartridgeMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65528UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65530UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65533UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheFeatureDependentTCREMONSF00AttributeInAttributeList_6() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterTonerCartridgeMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the feature dependent(TCREMON.S.F00) attribute in AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 1UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeInPlaceIndicatorTcremonsa0002InAttributeList_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterTonerCartridgeMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional attribute InPlaceIndicator (TCREMON.S.A0002) in AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 3UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterTonerCartridgeMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalCommandResetConditionInAcceptedCommandList_9() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterTonerCartridgeMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional command (ResetCondition) in AcceptedCommandList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("acceptedCommandList", value, 0UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_10() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterTonerCartridgeMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: GeneratedCommandList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("GeneratedCommandList", [actualValue count], static_cast(0))); + } + + VerifyOrReturn(CheckConstraintType("generatedCommandList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsEventListAttributeFromDut_11() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterTonerCartridgeMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads EventList attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("EventList", [actualValue count], static_cast(0))); + } + + VerifyOrReturn(CheckConstraintType("eventList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_TCREMON_2_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_TCREMON_2_1() + : TestCommandBridge("Test_TC_TCREMON_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_TCREMON_2_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_TCREMON_2_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_TCREMON_2_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads from the DUT the Condition attribute.\n"); + if (ShouldSkip("TCREMON.S.A0000")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheConditionAttribute_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads from the DUT the DegradationDirection attribute..\n"); + if (ShouldSkip("TCREMON.S.A0001")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheDegradationDirectionAttribute_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : TH reads from the DUT the ChangeIndication attribute.\n"); + if (ShouldSkip("TCREMON.S.A0002")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheChangeIndicationAttribute_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : TH reads from the DUT the InPlaceIndicator attribute\n"); + if (ShouldSkip("TCREMON.S.A0003")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheInPlaceIndicatorAttribute_4(); + 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; + } + + // 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 = 5; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestThReadsFromTheDutTheConditionAttribute_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterTonerCartridgeMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeConditionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the Condition attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("condition", "percent", "percent")); + VerifyOrReturn(CheckConstraintMinValue("condition", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("condition", [value unsignedCharValue], 100U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheDegradationDirectionAttribute_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterTonerCartridgeMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeDegradationDirectionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the DegradationDirection attribute.. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("degradationDirection", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("degradationDirection", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("degradationDirection", [value unsignedCharValue], 1U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheChangeIndicationAttribute_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterTonerCartridgeMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeChangeIndicationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the ChangeIndication attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("changeIndication", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("changeIndication", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("changeIndication", [value unsignedCharValue], 2U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheInPlaceIndicatorAttribute_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterTonerCartridgeMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeInPlaceIndicatorWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the InPlaceIndicator attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("inPlaceIndicator", "boolean", "boolean")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_UVFREMON_1_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_UVFREMON_1_1() + : TestCommandBridge("Test_TC_UVFREMON_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_UVFREMON_1_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_UVFREMON_1_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_UVFREMON_1_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute: ClusterRevision\n"); + err = TestReadTheGlobalAttributeClusterRevision_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: FeatureMap\n"); + if (ShouldSkip("!UVFREMON.S.F00 && !UVFREMON.S.F01")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeFeatureMap_2(); + break; + case 3: + ChipLogProgress( + chipTool, " ***** Test Step 3 : Given UVFREMON.S.F00(Condition) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("UVFREMON.S.F00")) { + NextTest(); + return; + } + err = TestGivenUVFREMONSF00ConditionEnsureFeaturemapHasTheCorrectBitSet_3(); + break; + case 4: + ChipLogProgress( + chipTool, " ***** Test Step 4 : Given UVFREMON.S.F01(Warning) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("UVFREMON.S.F01")) { + NextTest(); + return; + } + err = TestGivenUVFREMONSF01WarningEnsureFeaturemapHasTheCorrectBitSet_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_5(); + break; + case 6: + ChipLogProgress( + chipTool, " ***** Test Step 6 : Read the feature dependent(UVFREMON.S.F00) attribute in AttributeList\n"); + if (ShouldSkip("UVFREMON.S.F00")) { + NextTest(); + return; + } + err = TestReadTheFeatureDependentUVFREMONSF00AttributeInAttributeList_6(); + break; + case 7: + ChipLogProgress(chipTool, + " ***** Test Step 7 : Read the optional attribute InPlaceIndicator (UVFREMON.S.A0002) in AttributeList\n"); + if (ShouldSkip("UVFREMON.S.A0002")) { + NextTest(); + return; + } + err = TestReadTheOptionalAttributeInPlaceIndicatorUvfremonsa0002InAttributeList_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Read the global attribute: AcceptedCommandList\n"); + err = TestReadTheGlobalAttributeAcceptedCommandList_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Read the optional command (ResetCondition) in AcceptedCommandList\n"); + if (ShouldSkip("UVFREMON.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestReadTheOptionalCommandResetConditionInAcceptedCommandList_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : Read the global attribute: GeneratedCommandList\n"); + err = TestReadTheGlobalAttributeGeneratedCommandList_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : TH reads EventList attribute from DUT\n"); + err = TestThReadsEventListAttributeFromDut_11(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + void OnStatusUpdate(const chip::app::StatusIB & status) override + { + switch (mTestIndex - 1) { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + } + + // Go on to the next test. + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 12; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterUVFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: ClusterRevision Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 1U)); + } + + VerifyOrReturn(CheckConstraintType("clusterRevision", "int16u", "int16u")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeFeatureMap_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterUVFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: FeatureMap Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("FeatureMap", actualValue, 0UL)); + } + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenUVFREMONSF00ConditionEnsureFeaturemapHasTheCorrectBitSet_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterUVFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given UVFREMON.S.F00(Condition) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenUVFREMONSF01WarningEnsureFeaturemapHasTheCorrectBitSet_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterUVFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given UVFREMON.S.F01(Warning) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterUVFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65528UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65530UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65533UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheFeatureDependentUVFREMONSF00AttributeInAttributeList_6() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterUVFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the feature dependent(UVFREMON.S.F00) attribute in AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 1UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeInPlaceIndicatorUvfremonsa0002InAttributeList_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterUVFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional attribute InPlaceIndicator (UVFREMON.S.A0002) in AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 3UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterUVFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalCommandResetConditionInAcceptedCommandList_9() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterUVFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional command (ResetCondition) in AcceptedCommandList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("acceptedCommandList", value, 0UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_10() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterUVFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: GeneratedCommandList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("GeneratedCommandList", [actualValue count], static_cast(0))); + } + + VerifyOrReturn(CheckConstraintType("generatedCommandList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsEventListAttributeFromDut_11() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterUVFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads EventList attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("EventList", [actualValue count], static_cast(0))); + } + + VerifyOrReturn(CheckConstraintType("eventList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_UVFREMON_2_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_UVFREMON_2_1() + : TestCommandBridge("Test_TC_UVFREMON_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_UVFREMON_2_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_UVFREMON_2_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_UVFREMON_2_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads from the DUT the Condition attribute.\n"); + if (ShouldSkip("UVFREMON.S.A0000")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheConditionAttribute_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads from the DUT the DegradationDirection attribute..\n"); + if (ShouldSkip("UVFREMON.S.A0001")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheDegradationDirectionAttribute_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : TH reads from the DUT the ChangeIndication attribute.\n"); + if (ShouldSkip("UVFREMON.S.A0002")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheChangeIndicationAttribute_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : TH reads from the DUT the InPlaceIndicator attribute\n"); + if (ShouldSkip("UVFREMON.S.A0003")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheInPlaceIndicatorAttribute_4(); + 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; + } + + // 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 = 5; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestThReadsFromTheDutTheConditionAttribute_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterUVFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeConditionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the Condition attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("condition", "percent", "percent")); + VerifyOrReturn(CheckConstraintMinValue("condition", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("condition", [value unsignedCharValue], 100U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheDegradationDirectionAttribute_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterUVFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeDegradationDirectionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the DegradationDirection attribute.. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("degradationDirection", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("degradationDirection", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("degradationDirection", [value unsignedCharValue], 1U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheChangeIndicationAttribute_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterUVFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeChangeIndicationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the ChangeIndication attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("changeIndication", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("changeIndication", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("changeIndication", [value unsignedCharValue], 2U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheInPlaceIndicatorAttribute_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterUVFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeInPlaceIndicatorWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the InPlaceIndicator attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("inPlaceIndicator", "boolean", "boolean")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_WTREMON_1_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_WTREMON_1_1() + : TestCommandBridge("Test_TC_WTREMON_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_WTREMON_1_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_WTREMON_1_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_WTREMON_1_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute: ClusterRevision\n"); + err = TestReadTheGlobalAttributeClusterRevision_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: FeatureMap\n"); + if (ShouldSkip("!WTREMON.S.F00 && !WTREMON.S.F01")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeFeatureMap_2(); + break; + case 3: + ChipLogProgress( + chipTool, " ***** Test Step 3 : Given WTREMON.S.F00(Condition) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("WTREMON.S.F00")) { + NextTest(); + return; + } + err = TestGivenWTREMONSF00ConditionEnsureFeaturemapHasTheCorrectBitSet_3(); + break; + case 4: + ChipLogProgress( + chipTool, " ***** Test Step 4 : Given WTREMON.S.F01(Warning) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("WTREMON.S.F01")) { + NextTest(); + return; + } + err = TestGivenWTREMONSF01WarningEnsureFeaturemapHasTheCorrectBitSet_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_5(); + break; + case 6: + ChipLogProgress( + chipTool, " ***** Test Step 6 : Read the feature dependent(WTREMON.S.F00) attribute in AttributeList\n"); + if (ShouldSkip("WTREMON.S.F00")) { + NextTest(); + return; + } + err = TestReadTheFeatureDependentWTREMONSF00AttributeInAttributeList_6(); + break; + case 7: + ChipLogProgress( + chipTool, " ***** Test Step 7 : Read the optional attribute InPlaceIndicator (WTREMON.S.A0002) in AttributeList\n"); + if (ShouldSkip("WTREMON.S.A0002")) { + NextTest(); + return; + } + err = TestReadTheOptionalAttributeInPlaceIndicatorWtremonsa0002InAttributeList_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Read the global attribute: AcceptedCommandList\n"); + err = TestReadTheGlobalAttributeAcceptedCommandList_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Read the optional command (ResetCondition) in AcceptedCommandList\n"); + if (ShouldSkip("WTREMON.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestReadTheOptionalCommandResetConditionInAcceptedCommandList_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : Read the global attribute: GeneratedCommandList\n"); + err = TestReadTheGlobalAttributeGeneratedCommandList_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : TH reads EventList attribute from DUT\n"); + err = TestThReadsEventListAttributeFromDut_11(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + void OnStatusUpdate(const chip::app::StatusIB & status) override + { + switch (mTestIndex - 1) { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + } + + // Go on to the next test. + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 12; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterWaterTankMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: ClusterRevision Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 1U)); + } + + VerifyOrReturn(CheckConstraintType("clusterRevision", "int16u", "int16u")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeFeatureMap_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterWaterTankMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: FeatureMap Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("FeatureMap", actualValue, 0UL)); + } + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenWTREMONSF00ConditionEnsureFeaturemapHasTheCorrectBitSet_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterWaterTankMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given WTREMON.S.F00(Condition) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenWTREMONSF01WarningEnsureFeaturemapHasTheCorrectBitSet_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterWaterTankMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given WTREMON.S.F01(Warning) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterWaterTankMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65528UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65530UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65533UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheFeatureDependentWTREMONSF00AttributeInAttributeList_6() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterWaterTankMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the feature dependent(WTREMON.S.F00) attribute in AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 1UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeInPlaceIndicatorWtremonsa0002InAttributeList_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterWaterTankMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional attribute InPlaceIndicator (WTREMON.S.A0002) in AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 3UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterWaterTankMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalCommandResetConditionInAcceptedCommandList_9() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterWaterTankMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional command (ResetCondition) in AcceptedCommandList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("acceptedCommandList", value, 0UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_10() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterWaterTankMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: GeneratedCommandList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("GeneratedCommandList", [actualValue count], static_cast(0))); + } + + VerifyOrReturn(CheckConstraintType("generatedCommandList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsEventListAttributeFromDut_11() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterWaterTankMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads EventList attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("EventList", [actualValue count], static_cast(0))); + } + + VerifyOrReturn(CheckConstraintType("eventList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_WTREMON_2_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_WTREMON_2_1() + : TestCommandBridge("Test_TC_WTREMON_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_WTREMON_2_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_WTREMON_2_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_WTREMON_2_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads from the DUT the Condition attribute.\n"); + if (ShouldSkip("WTREMON.S.A0000")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheConditionAttribute_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads from the DUT the DegradationDirection attribute..\n"); + if (ShouldSkip("WTREMON.S.A0001")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheDegradationDirectionAttribute_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : TH reads from the DUT the ChangeIndication attribute.\n"); + if (ShouldSkip("WTREMON.S.A0002")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheChangeIndicationAttribute_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : TH reads from the DUT the InPlaceIndicator attribute\n"); + if (ShouldSkip("WTREMON.S.A0003")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheInPlaceIndicatorAttribute_4(); + 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; + } + + // 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 = 5; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestThReadsFromTheDutTheConditionAttribute_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterWaterTankMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeConditionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the Condition attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("condition", "percent", "percent")); + VerifyOrReturn(CheckConstraintMinValue("condition", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("condition", [value unsignedCharValue], 100U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheDegradationDirectionAttribute_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterWaterTankMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeDegradationDirectionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the DegradationDirection attribute.. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("degradationDirection", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("degradationDirection", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("degradationDirection", [value unsignedCharValue], 1U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheChangeIndicationAttribute_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterWaterTankMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeChangeIndicationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the ChangeIndication attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("changeIndication", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("changeIndication", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("changeIndication", [value unsignedCharValue], 2U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheInPlaceIndicatorAttribute_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterWaterTankMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeInPlaceIndicatorWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the InPlaceIndicator attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("inPlaceIndicator", "boolean", "boolean")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_ZEOFREMON_1_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_ZEOFREMON_1_1() + : TestCommandBridge("Test_TC_ZEOFREMON_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_ZEOFREMON_1_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_ZEOFREMON_1_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_ZEOFREMON_1_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : Read the global attribute: ClusterRevision\n"); + err = TestReadTheGlobalAttributeClusterRevision_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : Read the global attribute: FeatureMap\n"); + if (ShouldSkip("!ZEOFREMON.S.F00 && !ZEOFREMON.S.F01")) { + NextTest(); + return; + } + err = TestReadTheGlobalAttributeFeatureMap_2(); + break; + case 3: + ChipLogProgress( + chipTool, " ***** Test Step 3 : Given ZEOFREMON.S.F00(Condition) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("ZEOFREMON.S.F00")) { + NextTest(); + return; + } + err = TestGivenZEOFREMONSF00ConditionEnsureFeaturemapHasTheCorrectBitSet_3(); + break; + case 4: + ChipLogProgress( + chipTool, " ***** Test Step 4 : Given ZEOFREMON.S.F01(Warning) ensure featuremap has the correct bit set\n"); + if (ShouldSkip("ZEOFREMON.S.F01")) { + NextTest(); + return; + } + err = TestGivenZEOFREMONSF01WarningEnsureFeaturemapHasTheCorrectBitSet_4(); + break; + case 5: + ChipLogProgress(chipTool, " ***** Test Step 5 : Read the global attribute: AttributeList\n"); + err = TestReadTheGlobalAttributeAttributeList_5(); + break; + case 6: + ChipLogProgress( + chipTool, " ***** Test Step 6 : Read the feature dependent(ZEOFREMON.S.F00) attribute in AttributeList\n"); + if (ShouldSkip("ZEOFREMON.S.F00")) { + NextTest(); + return; + } + err = TestReadTheFeatureDependentZEOFREMONSF00AttributeInAttributeList_6(); + break; + case 7: + ChipLogProgress(chipTool, + " ***** Test Step 7 : Read the optional attribute InPlaceIndicator (ZEOFREMON.S.A0002) in AttributeList\n"); + if (ShouldSkip("ZEOFREMON.S.A0002")) { + NextTest(); + return; + } + err = TestReadTheOptionalAttributeInPlaceIndicatorZeofremonsa0002InAttributeList_7(); + break; + case 8: + ChipLogProgress(chipTool, " ***** Test Step 8 : Read the global attribute: AcceptedCommandList\n"); + err = TestReadTheGlobalAttributeAcceptedCommandList_8(); + break; + case 9: + ChipLogProgress(chipTool, " ***** Test Step 9 : Read the optional command (ResetCondition) in AcceptedCommandList\n"); + if (ShouldSkip("ZEOFREMON.S.C00.Rsp")) { + NextTest(); + return; + } + err = TestReadTheOptionalCommandResetConditionInAcceptedCommandList_9(); + break; + case 10: + ChipLogProgress(chipTool, " ***** Test Step 10 : Read the global attribute: GeneratedCommandList\n"); + err = TestReadTheGlobalAttributeGeneratedCommandList_10(); + break; + case 11: + ChipLogProgress(chipTool, " ***** Test Step 11 : TH reads EventList attribute from DUT\n"); + err = TestThReadsEventListAttributeFromDut_11(); + break; + } + + if (CHIP_NO_ERROR != err) { + ChipLogError(chipTool, " ***** Test Failure: %s\n", chip::ErrorStr(err)); + SetCommandExitStatus(err); + } + } + + void OnStatusUpdate(const chip::app::StatusIB & status) override + { + switch (mTestIndex - 1) { + case 0: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 1: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 2: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 3: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 4: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 5: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 6: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 7: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 8: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 9: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 10: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + case 11: + VerifyOrReturn(CheckValue("status", chip::to_underlying(status.mStatus), 0)); + break; + } + + // Go on to the next test. + ContinueOnChipMainThread(CHIP_NO_ERROR); + } + + chip::System::Clock::Timeout GetWaitDuration() const override + { + return chip::System::Clock::Seconds16(mTimeout.ValueOr(kTimeoutInSeconds)); + } + +private: + std::atomic_uint16_t mTestIndex; + const uint16_t mTestCount = 12; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestReadTheGlobalAttributeClusterRevision_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterZeoliteFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeClusterRevisionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: ClusterRevision Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("ClusterRevision", actualValue, 1U)); + } + + VerifyOrReturn(CheckConstraintType("clusterRevision", "int16u", "int16u")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeFeatureMap_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterZeoliteFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: FeatureMap Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("FeatureMap", actualValue, 0UL)); + } + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenZEOFREMONSF00ConditionEnsureFeaturemapHasTheCorrectBitSet_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterZeoliteFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given ZEOFREMON.S.F00(Condition) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestGivenZEOFREMONSF01WarningEnsureFeaturemapHasTheCorrectBitSet_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterZeoliteFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeFeatureMapWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"Given ZEOFREMON.S.F01(Warning) ensure featuremap has the correct bit set Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("featureMap", "bitmap32", "bitmap32")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAttributeList_5() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterZeoliteFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 2UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65528UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65529UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65530UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65531UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65532UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 65533UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheFeatureDependentZEOFREMONSF00AttributeInAttributeList_6() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterZeoliteFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the feature dependent(ZEOFREMON.S.F00) attribute in AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 0UL)); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 1UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalAttributeInPlaceIndicatorZeofremonsa0002InAttributeList_7() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterZeoliteFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAttributeListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional attribute InPlaceIndicator (ZEOFREMON.S.A0002) in AttributeList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("attributeList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("attributeList", value, 3UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeAcceptedCommandList_8() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterZeoliteFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: AcceptedCommandList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheOptionalCommandResetConditionInAcceptedCommandList_9() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterZeoliteFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeAcceptedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the optional command (ResetCondition) in AcceptedCommandList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("acceptedCommandList", "list", "list")); + VerifyOrReturn(CheckConstraintContains("acceptedCommandList", value, 0UL)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestReadTheGlobalAttributeGeneratedCommandList_10() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterZeoliteFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeGeneratedCommandListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"Read the global attribute: GeneratedCommandList Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("GeneratedCommandList", [actualValue count], static_cast(0))); + } + + VerifyOrReturn(CheckConstraintType("generatedCommandList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsEventListAttributeFromDut_11() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterZeoliteFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeEventListWithCompletion:^(NSArray * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads EventList attribute from DUT Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + { + id actualValue = value; + VerifyOrReturn(CheckValue("EventList", [actualValue count], static_cast(0))); + } + + VerifyOrReturn(CheckConstraintType("eventList", "list", "list")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + +class Test_TC_ZEOFREMON_2_1 : public TestCommandBridge { +public: + // NOLINTBEGIN(clang-analyzer-nullability.NullPassedToNonnull): Test constructor nullability not enforced + Test_TC_ZEOFREMON_2_1() + : TestCommandBridge("Test_TC_ZEOFREMON_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_ZEOFREMON_2_1() {} + + /////////// TestCommand Interface ///////// + void NextTest() override + { + CHIP_ERROR err = CHIP_NO_ERROR; + + if (0 == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Start: Test_TC_ZEOFREMON_2_1\n"); + } + + if (mTestCount == mTestIndex) { + ChipLogProgress(chipTool, " **** Test Complete: Test_TC_ZEOFREMON_2_1\n"); + SetCommandExitStatus(CHIP_NO_ERROR); + return; + } + + Wait(); + + // Ensure we increment mTestIndex before we start running the relevant + // command. That way if we lose the timeslice after we send the message + // but before our function call returns, we won't end up with an + // incorrect mTestIndex value observed when we get the response. + switch (mTestIndex++) { + case 0: + ChipLogProgress(chipTool, " ***** Test Step 0 : Wait for the commissioned device to be retrieved\n"); + err = TestWaitForTheCommissionedDeviceToBeRetrieved_0(); + break; + case 1: + ChipLogProgress(chipTool, " ***** Test Step 1 : TH reads from the DUT the Condition attribute.\n"); + if (ShouldSkip("ZEOFREMON.S.A0000")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheConditionAttribute_1(); + break; + case 2: + ChipLogProgress(chipTool, " ***** Test Step 2 : TH reads from the DUT the DegradationDirection attribute..\n"); + if (ShouldSkip("ZEOFREMON.S.A0001")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheDegradationDirectionAttribute_2(); + break; + case 3: + ChipLogProgress(chipTool, " ***** Test Step 3 : TH reads from the DUT the ChangeIndication attribute.\n"); + if (ShouldSkip("ZEOFREMON.S.A0002")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheChangeIndicationAttribute_3(); + break; + case 4: + ChipLogProgress(chipTool, " ***** Test Step 4 : TH reads from the DUT the InPlaceIndicator attribute\n"); + if (ShouldSkip("ZEOFREMON.S.A0003")) { + NextTest(); + return; + } + err = TestThReadsFromTheDutTheInPlaceIndicatorAttribute_4(); + 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; + } + + // 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 = 5; + + chip::Optional mNodeId; + chip::Optional mCluster; + chip::Optional mEndpoint; + chip::Optional mTimeout; + + CHIP_ERROR TestWaitForTheCommissionedDeviceToBeRetrieved_0() + { + + chip::app::Clusters::DelayCommands::Commands::WaitForCommissionee::Type value; + value.nodeId = mNodeId.HasValue() ? mNodeId.Value() : 305414945ULL; + return WaitForCommissionee("alpha", value); + } + + CHIP_ERROR TestThReadsFromTheDutTheConditionAttribute_1() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterZeoliteFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeConditionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the Condition attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("condition", "percent", "percent")); + VerifyOrReturn(CheckConstraintMinValue("condition", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("condition", [value unsignedCharValue], 100U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheDegradationDirectionAttribute_2() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterZeoliteFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeDegradationDirectionWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the DegradationDirection attribute.. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("degradationDirection", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("degradationDirection", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("degradationDirection", [value unsignedCharValue], 1U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheChangeIndicationAttribute_3() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterZeoliteFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeChangeIndicationWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the ChangeIndication attribute. Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("changeIndication", "enum8", "enum8")); + VerifyOrReturn(CheckConstraintMinValue("changeIndication", [value unsignedCharValue], 0U)); + VerifyOrReturn(CheckConstraintMaxValue("changeIndication", [value unsignedCharValue], 2U)); + + NextTest(); + }]; + + return CHIP_NO_ERROR; + } + + CHIP_ERROR TestThReadsFromTheDutTheInPlaceIndicatorAttribute_4() + { + + MTRBaseDevice * device = GetDevice("alpha"); + __auto_type * cluster = [[MTRBaseClusterZeoliteFilterMonitoring alloc] initWithDevice:device + endpointID:@(1) + queue:mCallbackQueue]; + VerifyOrReturnError(cluster != nil, CHIP_ERROR_INCORRECT_STATE); + + [cluster readAttributeInPlaceIndicatorWithCompletion:^(NSNumber * _Nullable value, NSError * _Nullable err) { + NSLog(@"TH reads from the DUT the InPlaceIndicator attribute Error: %@", err); + + VerifyOrReturn(CheckValue("status", err ? err.code : 0, 0)); + + VerifyOrReturn(CheckConstraintType("inPlaceIndicator", "boolean", "boolean")); + NextTest(); + }]; + + return CHIP_NO_ERROR; + } +}; + #endif // CONFIG_ENABLE_YAML_TESTS void registerCommandsTests(Commands & commands) @@ -146755,6 +154915,30 @@ 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(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), + make_unique(), #endif // CONFIG_ENABLE_YAML_TESTS }; From b611144792c9f572676837582eb1d91b7200db31 Mon Sep 17 00:00:00 2001 From: marktrayer Date: Thu, 8 Jun 2023 20:10:20 -0500 Subject: [PATCH 5/5] YAML for OpState TC 1.1. First draft. (#26769) * YAML for OpState TC 1.1. First draft. * Address review comments: - copyright date - command id correction (should be pause=0, stop=1, start=2, resume=3) * Correct the PICS code and Command ID for Pause and Start * Restyled by whitespace * Restyled by prettier-yaml --------- Co-authored-by: Restyled.io --- .../certification/Test_TC_OPSTATE_1_1.yaml | 138 ++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100644 src/app/tests/suites/certification/Test_TC_OPSTATE_1_1.yaml diff --git a/src/app/tests/suites/certification/Test_TC_OPSTATE_1_1.yaml b/src/app/tests/suites/certification/Test_TC_OPSTATE_1_1.yaml new file mode 100644 index 00000000000000..3f5e2e062c46f8 --- /dev/null +++ b/src/app/tests/suites/certification/Test_TC_OPSTATE_1_1.yaml @@ -0,0 +1,138 @@ +# Copyright (c) 2023 Project CHIP Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: xx.1.1. [TC-OPSTATE-1.1] Global attributes with server as DUT + +PICS: + - OPSTATE.S + +config: + nodeId: 0x12344321 + cluster: "Operational State" + endpoint: 1 + +tests: + - label: "Wait for the commissioned device to be retrieved" + cluster: "DelayCommands" + command: "WaitForCommissionee" + arguments: + values: + - name: "nodeId" + value: nodeId + + - label: "TH reads the ClusterRevision attribute from the DUT" + PICS: OPSTATE.S.Afffd + command: "readAttribute" + attribute: "ClusterRevision" + response: + value: 1 + constraints: + type: int16u + + - label: "TH reads the FeatureMap attribute from the DUT" + PICS: OPSTATE.S.Afffc + command: "readAttribute" + attribute: "FeatureMap" + response: + value: 0 + constraints: + type: bitmap32 + + - label: "TH reads the AttributeList attribute from the DUT" + PICS: OPSTATE.S.Afffb + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: + [0, 1, 3, 4, 5, 65528, 65529, 65530, 65531, 65532, 65533] + + - label: + "TH reads from the DUT the optional attribute(CountdownTime) in the + AttributeList from the DUT" + PICS: OPSTATE.S.A0002 && OPSTATE.S.Afffb + command: "readAttribute" + attribute: "AttributeList" + response: + constraints: + type: list + contains: [2] + + - label: "TH reads from the DUT the EventList attribute." + PICS: OPSTATE.S.Afffa + command: "readAttribute" + attribute: "EventList" + response: + constraints: + type: list + contains: [0x00] + + - label: + "TH reads from the DUT the optional event(OperationCompletion) in + EventList." + PICS: OPSTATE.S.E01 && OPSTATE.S.Afffa + command: "readAttribute" + attribute: "EventList" + response: + constraints: + type: list + contains: [0x01] + + - label: "Read the optional command(Start) in AcceptedCommandList" + PICS: OPSTATE.S.C02 && OPSTATE.S.Afff9 + command: "readAttribute" + attribute: "AcceptedCommandList" + response: + constraints: + type: list + contains: [1, 2] + + - label: "Read the optional command(Stop) in AcceptedCommandList" + PICS: OPSTATE.S.C01 && OPSTATE.S.Afff9 + command: "readAttribute" + attribute: "AcceptedCommandList" + response: + constraints: + type: list + contains: [1] + + - label: "Read the optional command(Pause) in AcceptedCommandList" + PICS: OPSTATE.S.C00 && OPSTATE.S.Afff9 + command: "readAttribute" + attribute: "AcceptedCommandList" + response: + constraints: + type: list + contains: [0, 3] + + - label: "Read the optional command(Resume) in AcceptedCommandList" + PICS: OPSTATE.S.C03 && OPSTATE.S.Afff9 + command: "readAttribute" + attribute: "AcceptedCommandList" + response: + constraints: + type: list + contains: [0, 3] + + - label: "Read the global attribute: GeneratedCommandList" + PICS: + OPSTATE.S.Afff8 && (OPSTATE.S.C00 || OPSTATE.S.C01 || OPSTATE.S.C02 || + OPSTATE.S.C03) + command: "readAttribute" + attribute: "GeneratedCommandList" + response: + constraints: + type: list + contains: [4]