From 95a4042be37e7e5ea25f438c5b5c9831d0aa918c Mon Sep 17 00:00:00 2001 From: mkardous-silabs <84793247+mkardous-silabs@users.noreply.github.com> Date: Tue, 14 Nov 2023 17:10:17 -0500 Subject: [PATCH] [ICD] Update ICDM 2.1 test (#30319) * update ICDM 2.1 test * Restyled by autopep8 * fix logger object * Restyled by autopep8 * Restyled by isort --------- Co-authored-by: Restyled.io --- src/python_testing/TC_ICDM_2_1.py | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/python_testing/TC_ICDM_2_1.py b/src/python_testing/TC_ICDM_2_1.py index bf6f2a3f117717..20770c400ddd3f 100644 --- a/src/python_testing/TC_ICDM_2_1.py +++ b/src/python_testing/TC_ICDM_2_1.py @@ -14,10 +14,15 @@ # See the License for the specific language governing permissions and # limitations under the License. # +import logging + import chip.clusters as Clusters from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main from mobly import asserts +logger = logging.getLogger('PythonMatterControllerTEST') +logger.setLevel(logging.INFO) + class TC_ICDM_2_1(MatterBaseTest): async def read_icdm_attribute_expect_success(self, endpoint, attribute): @@ -27,13 +32,17 @@ async def read_icdm_attribute_expect_success(self, endpoint, attribute): @async_test_body async def test_TC_ICDM_2_1(self): + if not self.check_pics("ICDM.S"): + logger.info("Test skipped because PICS ICDM.S is not set") + return + endpoint = self.user_params.get("endpoint", 0) self.print_step(1, "Commissioning, already done") attributes = Clusters.IcdManagement.Attributes idleModeDuration = 0 - # Idle Mode Interval attribute test + # Idle Mode Duration attribute test if (self.check_pics("ICDM.S.A0000")): self.print_step(2, "Read IdleModeDuration Attribute") @@ -44,7 +53,7 @@ async def test_TC_ICDM_2_1(self): else: asserts.assert_true(False, "IdleModeDuration is a mandatory attribute and must be present in the PICS file") - # Active Mode Interval attribute test + # Active Mode Duration attribute test if (self.check_pics("ICDM.S.A0001")): self.print_step(2, "Read ActiveModeDuration Attribute") @@ -80,8 +89,10 @@ async def test_TC_ICDM_2_1(self): if (self.check_pics("ICDM.S.A0003")): self.print_step(2, "Read ICDCounter Attribute") - await self.read_icdm_attribute_expect_success(endpoint=endpoint, - attribute=attributes.ICDCounter) + ICDCounter = await self.read_icdm_attribute_expect_success(endpoint=endpoint, + attribute=attributes.ICDCounter) + asserts.assert_true(0 <= ICDCounter <= 4294967295, + "ICDCounter attribute does not fit in a uint32.") # ClientsSupportedPerFabric attribute test if (self.check_pics("ICDM.S.A0003")): @@ -89,8 +100,10 @@ async def test_TC_ICDM_2_1(self): clientsSupportedPerFabric = await self.read_icdm_attribute_expect_success(endpoint=endpoint, attribute=attributes.ClientsSupportedPerFabric) + asserts.assert_true(0 <= clientsSupportedPerFabric <= 65535, + "ActiveModeThreshold ClientsSupportedPerFabric does not fit in a uint16.") asserts.assert_greater_equal(clientsSupportedPerFabric, 1, - "ActiveModeThreshold attribute is smaller than minimum value (300).") + "ClientsSupportedPerFabric attribute is smaller than minimum value (1).") if __name__ == "__main__":