From d97b3b119ac52e70849b8901bb75dc146862bd3f Mon Sep 17 00:00:00 2001 From: juandediosg Date: Mon, 17 Feb 2025 13:02:09 -0600 Subject: [PATCH 1/6] Implement TC_OTCCM_1_2 with Python --- src/python_testing/TC_OTCCM_1_2.py | 110 +++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 src/python_testing/TC_OTCCM_1_2.py diff --git a/src/python_testing/TC_OTCCM_1_2.py b/src/python_testing/TC_OTCCM_1_2.py new file mode 100644 index 00000000000000..e2854ae29fc8eb --- /dev/null +++ b/src/python_testing/TC_OTCCM_1_2.py @@ -0,0 +1,110 @@ +# +# Copyright (c) 2025 Project CHIP Authors +# All rights reserved. +# +# 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. +# + +# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments +# for details about the block below. +# +# FIXME: https://github.com/project-chip/connectedhomeip/issues/36885 +# === BEGIN CI TEST ARGUMENTS === +# test-runner-runs: +# run1: +# app: ${CHIP_MICROWAVE_OVEN_APP} +# app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json +# script-args: > +# --storage-path admin_storage.json +# --commissioning-method on-network +# --discriminator 1234 +# --passcode 20202021 +# --PICS src/app/tests/suites/certification/ci-pics-values +# --endpoint 1 +# --trace-to json:${TRACE_TEST_JSON}.json +# --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# factory-reset: true +# quiet: true +# === END CI TEST ARGUMENTS === + + +import chip.clusters as Clusters +from chip.testing.matter_testing import MatterBaseTest, TestStep, async_test_body, default_matter_test_main +from modebase_cluster_check import ModeBaseClusterChecks + +CLUSTER = Clusters.RefrigeratorAndTemperatureControlledCabinetMode + + +class TC_OTCCM_1_2(MatterBaseTest, ModeBaseClusterChecks): + + def __init__(self, *args): + MatterBaseTest.__init__(self, *args) + ModeBaseClusterChecks.__init__(self, + modebase_derived_cluster=CLUSTER) + + def desc_TC_OTCCM_1_2(self) -> str: + return "[TC-OTCCM-1.2] Cluster attributes with DUT as Server" + + def steps_TC_OTCCM_1_2(self) -> list[TestStep]: + steps = [ + TestStep(1, "Commissioning, already done", is_commissioning=True), + TestStep(2, "TH reads from the DUT the SupportedModes attribute."), + TestStep(3, "TH reads from the DUT the CurrentMode attribute."), + TestStep(4, "TH reads from the DUT the OnMode attribute."), + TestStep(5, "TH reads from the DUT the StartUpMode attribute.") + ] + return steps + + def pics_TC_OTCCM_1_2(self) -> list[str]: + pics = [ + "OTCCM.S" + ] + return pics + + @async_test_body + async def test_TC_OTCCM_1_2(self): + + # Setup common mode check + endpoint = self.get_endpoint(default=1) + + self.step(1) + + self.step(2) + # Verify common checks for Mode Base as described in the TC-OTCCM-1.2 + supported_modes = await self.check_supported_modes_and_labels(endpoint=endpoint) + # According to the spec, there should be at least one RapidCool or RapidFreeze tag in + # the ones supported. + additional_tags = [CLUSTER.Enums.ModeTag.kRapidCool, + CLUSTER.Enums.ModeTag.kRapidFreeze] + self.check_tags_in_lists(supported_modes=supported_modes, required_tags=additional_tags) + + self.step(3) + # Verify that the CurrentMode attribute has a valid value. + mode = self.cluster.Attributes.CurrentMode + await self.read_and_check_mode(endpoint=endpoint, mode=mode, supported_modes=supported_modes) + + self.step(4) + # Verify that the OnMode attribute has a valid value or null. + mode = self.cluster.Attributes.OnMode + await self.read_and_check_mode(endpoint=endpoint, mode=mode, + supported_modes=supported_modes, is_nullable=True) + + self.step(5) + # Verify that the StartUpMode has a valid value or null + mode = self.cluster.Attributes.StartUpMode + await self.read_and_check_mode(endpoint=endpoint, mode=mode, + supported_modes=supported_modes, is_nullable=True) + + +if __name__ == "__main__": + default_matter_test_main() From 5e6ef97225ec68ccb4b73b750e3cbf011dc1634b Mon Sep 17 00:00:00 2001 From: juandediosg Date: Mon, 17 Feb 2025 19:21:02 -0600 Subject: [PATCH 2/6] Implemented functionality to validate OTCCM in tests --- src/python_testing/TC_OTCCM_1_2.py | 37 +++++++++++++++--------------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/src/python_testing/TC_OTCCM_1_2.py b/src/python_testing/TC_OTCCM_1_2.py index e2854ae29fc8eb..b7bfcafb9dec35 100644 --- a/src/python_testing/TC_OTCCM_1_2.py +++ b/src/python_testing/TC_OTCCM_1_2.py @@ -42,7 +42,7 @@ from chip.testing.matter_testing import MatterBaseTest, TestStep, async_test_body, default_matter_test_main from modebase_cluster_check import ModeBaseClusterChecks -CLUSTER = Clusters.RefrigeratorAndTemperatureControlledCabinetMode +CLUSTER = Clusters.OvenMode class TC_OTCCM_1_2(MatterBaseTest, ModeBaseClusterChecks): @@ -60,8 +60,8 @@ def steps_TC_OTCCM_1_2(self) -> list[TestStep]: TestStep(1, "Commissioning, already done", is_commissioning=True), TestStep(2, "TH reads from the DUT the SupportedModes attribute."), TestStep(3, "TH reads from the DUT the CurrentMode attribute."), - TestStep(4, "TH reads from the DUT the OnMode attribute."), - TestStep(5, "TH reads from the DUT the StartUpMode attribute.") + # TestStep(4, "TH reads from the DUT the OnMode attribute."), + # TestStep(5, "TH reads from the DUT the StartUpMode attribute.") ] return steps @@ -82,10 +82,11 @@ async def test_TC_OTCCM_1_2(self): self.step(2) # Verify common checks for Mode Base as described in the TC-OTCCM-1.2 supported_modes = await self.check_supported_modes_and_labels(endpoint=endpoint) - # According to the spec, there should be at least one RapidCool or RapidFreeze tag in - # the ones supported. - additional_tags = [CLUSTER.Enums.ModeTag.kRapidCool, - CLUSTER.Enums.ModeTag.kRapidFreeze] + # According to the spec, there should be at least one like + # Bake, Convection, Grill, Roast, Clean, Convection Bake, Convection Roast, Warming, Proofing + # tag in the ones supported. + additional_tags = [CLUSTER.Enums.ModeTag.kBake, + CLUSTER.Enums.ModeTag.kConvection] self.check_tags_in_lists(supported_modes=supported_modes, required_tags=additional_tags) self.step(3) @@ -93,17 +94,17 @@ async def test_TC_OTCCM_1_2(self): mode = self.cluster.Attributes.CurrentMode await self.read_and_check_mode(endpoint=endpoint, mode=mode, supported_modes=supported_modes) - self.step(4) - # Verify that the OnMode attribute has a valid value or null. - mode = self.cluster.Attributes.OnMode - await self.read_and_check_mode(endpoint=endpoint, mode=mode, - supported_modes=supported_modes, is_nullable=True) - - self.step(5) - # Verify that the StartUpMode has a valid value or null - mode = self.cluster.Attributes.StartUpMode - await self.read_and_check_mode(endpoint=endpoint, mode=mode, - supported_modes=supported_modes, is_nullable=True) + # self.step(4) + # # Verify that the OnMode attribute has a valid value or null. + # mode = self.cluster.Attributes.OnMode + # await self.read_and_check_mode(endpoint=endpoint, mode=mode, + # supported_modes=supported_modes, is_nullable=True) + + # self.step(5) + # # Verify that the StartUpMode has a valid value or null + # mode = self.cluster.Attributes.StartUpMode + # await self.read_and_check_mode(endpoint=endpoint, mode=mode, + # supported_modes=supported_modes, is_nullable=True) if __name__ == "__main__": From 4fd9321cf30228601ebd1a3fa5c4f78cc1f1403a Mon Sep 17 00:00:00 2001 From: juandediosg Date: Wed, 19 Feb 2025 07:09:29 -0600 Subject: [PATCH 3/6] Fixed: Updated CI test arguments and Removed OTCCM implemetation (OnMode and StartUpMode). --- src/python_testing/TC_OTCCM_1_2.py | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/src/python_testing/TC_OTCCM_1_2.py b/src/python_testing/TC_OTCCM_1_2.py index b7bfcafb9dec35..ff4e4d56afaf34 100644 --- a/src/python_testing/TC_OTCCM_1_2.py +++ b/src/python_testing/TC_OTCCM_1_2.py @@ -15,21 +15,19 @@ # limitations under the License. # -# See https://github.com/project-chip/connectedhomeip/blob/master/docs/testing/python.md#defining-the-ci-test-arguments -# for details about the block below. -# -# FIXME: https://github.com/project-chip/connectedhomeip/issues/36885 # === BEGIN CI TEST ARGUMENTS === # test-runner-runs: # run1: -# app: ${CHIP_MICROWAVE_OVEN_APP} -# app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json +# app: ${ALL_CLUSTERS_APP} +# app-args: > +# --discriminator 1234 +# --KVS kvs1 +# --trace-to json:${TRACE_APP}.json # script-args: > # --storage-path admin_storage.json # --commissioning-method on-network # --discriminator 1234 # --passcode 20202021 -# --PICS src/app/tests/suites/certification/ci-pics-values # --endpoint 1 # --trace-to json:${TRACE_TEST_JSON}.json # --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto @@ -60,8 +58,6 @@ def steps_TC_OTCCM_1_2(self) -> list[TestStep]: TestStep(1, "Commissioning, already done", is_commissioning=True), TestStep(2, "TH reads from the DUT the SupportedModes attribute."), TestStep(3, "TH reads from the DUT the CurrentMode attribute."), - # TestStep(4, "TH reads from the DUT the OnMode attribute."), - # TestStep(5, "TH reads from the DUT the StartUpMode attribute.") ] return steps @@ -94,18 +90,6 @@ async def test_TC_OTCCM_1_2(self): mode = self.cluster.Attributes.CurrentMode await self.read_and_check_mode(endpoint=endpoint, mode=mode, supported_modes=supported_modes) - # self.step(4) - # # Verify that the OnMode attribute has a valid value or null. - # mode = self.cluster.Attributes.OnMode - # await self.read_and_check_mode(endpoint=endpoint, mode=mode, - # supported_modes=supported_modes, is_nullable=True) - - # self.step(5) - # # Verify that the StartUpMode has a valid value or null - # mode = self.cluster.Attributes.StartUpMode - # await self.read_and_check_mode(endpoint=endpoint, mode=mode, - # supported_modes=supported_modes, is_nullable=True) - if __name__ == "__main__": default_matter_test_main() From 5eeb93d824db315bbd0ebad6346ffa16c3790b4f Mon Sep 17 00:00:00 2001 From: juandediosg Date: Thu, 20 Feb 2025 18:38:41 -0600 Subject: [PATCH 4/6] Fixed: Renamed CLUSTER to cluster_otccm_mode for clarity. --- src/python_testing/TC_OTCCM_1_2.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/python_testing/TC_OTCCM_1_2.py b/src/python_testing/TC_OTCCM_1_2.py index ff4e4d56afaf34..13da4860e921c7 100644 --- a/src/python_testing/TC_OTCCM_1_2.py +++ b/src/python_testing/TC_OTCCM_1_2.py @@ -40,7 +40,7 @@ from chip.testing.matter_testing import MatterBaseTest, TestStep, async_test_body, default_matter_test_main from modebase_cluster_check import ModeBaseClusterChecks -CLUSTER = Clusters.OvenMode +cluster_otccm_mode = Clusters.OvenMode class TC_OTCCM_1_2(MatterBaseTest, ModeBaseClusterChecks): @@ -48,7 +48,7 @@ class TC_OTCCM_1_2(MatterBaseTest, ModeBaseClusterChecks): def __init__(self, *args): MatterBaseTest.__init__(self, *args) ModeBaseClusterChecks.__init__(self, - modebase_derived_cluster=CLUSTER) + modebase_derived_cluster=cluster_otccm_mode) def desc_TC_OTCCM_1_2(self) -> str: return "[TC-OTCCM-1.2] Cluster attributes with DUT as Server" @@ -81,8 +81,8 @@ async def test_TC_OTCCM_1_2(self): # According to the spec, there should be at least one like # Bake, Convection, Grill, Roast, Clean, Convection Bake, Convection Roast, Warming, Proofing # tag in the ones supported. - additional_tags = [CLUSTER.Enums.ModeTag.kBake, - CLUSTER.Enums.ModeTag.kConvection] + additional_tags = [cluster_otccm_mode.Enums.ModeTag.kBake, + cluster_otccm_mode.Enums.ModeTag.kConvection] self.check_tags_in_lists(supported_modes=supported_modes, required_tags=additional_tags) self.step(3) From 747aafc0830d0b0a6a8e2ecd266456348111a67b Mon Sep 17 00:00:00 2001 From: juandediosg Date: Wed, 5 Mar 2025 06:36:43 -0600 Subject: [PATCH 5/6] Fixed: Cluster variable as cluster_otccm. --- src/python_testing/TC_OTCCM_1_2.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/python_testing/TC_OTCCM_1_2.py b/src/python_testing/TC_OTCCM_1_2.py index 13da4860e921c7..7e03e022396f54 100644 --- a/src/python_testing/TC_OTCCM_1_2.py +++ b/src/python_testing/TC_OTCCM_1_2.py @@ -40,7 +40,7 @@ from chip.testing.matter_testing import MatterBaseTest, TestStep, async_test_body, default_matter_test_main from modebase_cluster_check import ModeBaseClusterChecks -cluster_otccm_mode = Clusters.OvenMode +cluster_otccm = Clusters.OvenMode class TC_OTCCM_1_2(MatterBaseTest, ModeBaseClusterChecks): @@ -81,8 +81,8 @@ async def test_TC_OTCCM_1_2(self): # According to the spec, there should be at least one like # Bake, Convection, Grill, Roast, Clean, Convection Bake, Convection Roast, Warming, Proofing # tag in the ones supported. - additional_tags = [cluster_otccm_mode.Enums.ModeTag.kBake, - cluster_otccm_mode.Enums.ModeTag.kConvection] + additional_tags = [cluster_otccm.Enums.ModeTag.kBake, + cluster_otccm.Enums.ModeTag.kConvection] self.check_tags_in_lists(supported_modes=supported_modes, required_tags=additional_tags) self.step(3) From 2bef02375600f559eee90f8774f2da232155149d Mon Sep 17 00:00:00 2001 From: juandediosg Date: Wed, 5 Mar 2025 06:40:16 -0600 Subject: [PATCH 6/6] Fixed: Renamed back to cluster_otccm_mode for clarity. --- src/python_testing/TC_OTCCM_1_2.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/python_testing/TC_OTCCM_1_2.py b/src/python_testing/TC_OTCCM_1_2.py index 7e03e022396f54..13da4860e921c7 100644 --- a/src/python_testing/TC_OTCCM_1_2.py +++ b/src/python_testing/TC_OTCCM_1_2.py @@ -40,7 +40,7 @@ from chip.testing.matter_testing import MatterBaseTest, TestStep, async_test_body, default_matter_test_main from modebase_cluster_check import ModeBaseClusterChecks -cluster_otccm = Clusters.OvenMode +cluster_otccm_mode = Clusters.OvenMode class TC_OTCCM_1_2(MatterBaseTest, ModeBaseClusterChecks): @@ -81,8 +81,8 @@ async def test_TC_OTCCM_1_2(self): # According to the spec, there should be at least one like # Bake, Convection, Grill, Roast, Clean, Convection Bake, Convection Roast, Warming, Proofing # tag in the ones supported. - additional_tags = [cluster_otccm.Enums.ModeTag.kBake, - cluster_otccm.Enums.ModeTag.kConvection] + additional_tags = [cluster_otccm_mode.Enums.ModeTag.kBake, + cluster_otccm_mode.Enums.ModeTag.kConvection] self.check_tags_in_lists(supported_modes=supported_modes, required_tags=additional_tags) self.step(3)