diff --git a/src/python_testing/TC_ICDM_2_1.py b/src/python_testing/TC_ICDM_2_1.py index ac20cf2c001fb0..63b27c64d6d8fa 100644 --- a/src/python_testing/TC_ICDM_2_1.py +++ b/src/python_testing/TC_ICDM_2_1.py @@ -109,6 +109,7 @@ def steps_TC_ICDM_2_1(self) -> list[TestStep]: TestStep( 9, "TH reads from the DUT the UserActiveModeTriggerInstruction attribute"), TestStep(10, "TH reads from the DUT the OperatingMode attribute."), + TestStep(11, "TH reads from the DUT the MaximumCheckInBackoff attribute."), ] return steps @@ -254,8 +255,9 @@ async def test_TC_ICDM_2_1(self): "UserActiveModeTriggerInstruction is not in the correct format for the associated UserActiveModeTriggerHint") if uatHintInstructionDepedentBitmap > 0 and uatHintInstructionDepedentBitmap in kUatColorInstructionBitMask: - # TODO: https://github.com/CHIP-Specifications/connectedhomeip-spec/issues/9194 - asserts.assert_true(False, "Nothing to do for now") + pattern = re.compile(r'^[0-9A-F]{6}$') + asserts.assert_true(pattern.match(userActiveModeTriggerInstruction), + "UserActiveModeTriggerInstruction is not in the correct format for the associated UserActiveModeTriggerHint") else: # Check if the UserActiveModeTriggerInstruction was required asserts.assert_false(uatHintInstructionDepedentBitmap in kUatInstructionMandatoryBitMask, @@ -272,6 +274,16 @@ async def test_TC_ICDM_2_1(self): asserts.assert_less( operatingMode, modes.kUnknownEnumValue, "OperatingMode can only have 0 and 1 as valid values") + self.step(11) + if self.pics_guard(self.check_pics("ICDM.S.A0009")): + maximumCheckInBackOff = await self._read_icdm_attribute_expect_success(attributes.MaximumCheckInBackOff) + + asserts.assert_true(self.is_valid_uint32_value(maximumCheckInBackOff), + "MaximumCheckInBackOff attribute is not a valid uint32.") + asserts.assert_greater_equal(maximumCheckInBackOff, idleModeDuration, + "MaximumCheckInBack attribute is not greater or euqal to the IdleModeDuration") + asserts.assert_less_equal(maximumCheckInBackOff, 64800, + "MaximumCheckInBackOff attribute is greater than maximum value (64800).") if __name__ == "__main__": diff --git a/src/python_testing/test_testing/test_TC_ICDM_2_1.py b/src/python_testing/test_testing/test_TC_ICDM_2_1.py index 5069eb6ed9d0a7..a337b91ccef41d 100755 --- a/src/python_testing/test_testing/test_TC_ICDM_2_1.py +++ b/src/python_testing/test_testing/test_TC_ICDM_2_1.py @@ -41,6 +41,7 @@ class ICDMData(): UserActiveModeTriggerHint: int UserActiveModeTriggerInstruction: string OperatingMode: c.Enums.OperatingModeEnum + MaximumCheckInBackOff: int expect_pass: bool @@ -57,145 +58,161 @@ class ICDMData(): # -------- # IdleModeDuration under minimum (< 1) ICDMData(0, 0, 0, 100, [], 0, 2, 0, "", - c.Enums.OperatingModeEnum.kSit, False), + c.Enums.OperatingModeEnum.kSit, 64800, False), # IdleModeDuration at minimum ICDMData(0, 1, 0, 100, [], 0, 2, 0, "", - c.Enums.OperatingModeEnum.kSit, True), + c.Enums.OperatingModeEnum.kSit, 64800, True), # IdleModeDuration at maximum ICDMData(0, 64800, 100, 100, [], 0, 2, 0, "", - c.Enums.OperatingModeEnum.kSit, True), + c.Enums.OperatingModeEnum.kSit, 64800, True), # IdleModeDuration over maximum (>64800) ICDMData(0, 64801, 100, 100, [], 0, 2, 0, "", - c.Enums.OperatingModeEnum.kSit, False), + c.Enums.OperatingModeEnum.kSit, 64800, False), # IdleModeDuration < ActiveModeDuration ICDMData(0, 1, 1001, 100, [], 0, 2, 0, "", - c.Enums.OperatingModeEnum.kSit, False), + c.Enums.OperatingModeEnum.kSit, 64800, False), # -------- # Test cases to validate ActiveModeDuration # -------- # ActiveModeDuration under minimum ICDMData(0, 100, -1, 100, [], 0, 2, 0, "", - c.Enums.OperatingModeEnum.kSit, False), + c.Enums.OperatingModeEnum.kSit, 64800, False), # ActiveModeDuration at minimum ICDMData(0, 100, 0, 100, [], 0, 2, 0, "", - c.Enums.OperatingModeEnum.kSit, True), + c.Enums.OperatingModeEnum.kSit, 64800, True), # ActiveModeDuration at maximum - value is max IdleModeDuration value - 1 ICDMData(0, 64800, 0x3DCC4FF, 100, [], 0, 2, 0, "", - c.Enums.OperatingModeEnum.kSit, True), + c.Enums.OperatingModeEnum.kSit, 64800, True), # -------- # Test cases to validate ActiveModeThreshold # -------- # ActiveModeThreshold < minimum ICDMData(0, 1, 0, -1, [], 0, 2, 0, "", - c.Enums.OperatingModeEnum.kSit, False), + c.Enums.OperatingModeEnum.kSit, 64800, False), # ActiveModeThreshold at SIT minimum ICDMData(0, 1, 0, 0, [], 0, 2, 0, "", - c.Enums.OperatingModeEnum.kSit, True), + c.Enums.OperatingModeEnum.kSit, 64800, True), # ActiveModeThreshold under LIT minimum ICDMData(0x7, 1, 0, 4999, [], 0, 2, 0, "", - c.Enums.OperatingModeEnum.kLit, False), + c.Enums.OperatingModeEnum.kLit, 64800, False), # ActiveModeThreshold at LIT minimum ICDMData(0x7, 1, 0, 5000, [], 0, 2, 0, "", - c.Enums.OperatingModeEnum.kLit, True), + c.Enums.OperatingModeEnum.kLit, 64800, True), # ActiveModeThreshold at Maximum ICDMData(0, 1, 0, 0xFFFF, [], 0, 2, 0, "", - c.Enums.OperatingModeEnum.kSit, True), + c.Enums.OperatingModeEnum.kSit, 64800, True), # ActiveModeThreshold over Maximum ICDMData(0, 1, 0, 0x10000, [], 0, 2, 0, "", - c.Enums.OperatingModeEnum.kSit, False), + c.Enums.OperatingModeEnum.kSit, 64800, False), # -------- # Test cases to validate ClientsSupportedPerFabric # -------- # ClientsSupportedPerFabric under minimum (< 1) ICDMData(0, 1, 0, 100, [], 0, 0, 0, "", - c.Enums.OperatingModeEnum.kLit, False), + c.Enums.OperatingModeEnum.kLit, 64800, False), # ClientsSupportedPerFabric at minimum ICDMData(0, 1, 0, 100, [], 0, 1, 0, "", - c.Enums.OperatingModeEnum.kLit, True), + c.Enums.OperatingModeEnum.kLit, 64800, True), # ClientsSupportedPerFabric at maximum ICDMData(0, 1, 0, 100, [], 0, 255, 0, "", - c.Enums.OperatingModeEnum.kLit, True), + c.Enums.OperatingModeEnum.kLit, 64800, True), # ClientsSupportedPerFabric > maximum ICDMData(0, 1, 0, 100, [], 0, 256, 0, "", - c.Enums.OperatingModeEnum.kLit, True), + c.Enums.OperatingModeEnum.kLit, 64800, True), # -------- # Test cases to validate RegisteredClients # -------- # Incorrect type ICDMData(0, 1, 0, 100, 0, 0, 1, 0, "", - c.Enums.OperatingModeEnum.kLit, False), + c.Enums.OperatingModeEnum.kLit, 64800, False), # Correct type ICDMData(0, 1, 0, 100, [], 0, 1, 0, "", - c.Enums.OperatingModeEnum.kLit, True), + c.Enums.OperatingModeEnum.kLit, 64800, True), # -------- # Test cases to validate ICDCounter # -------- # ICDCounter under minimum (< 0) ICDMData(0, 1, 0, 100, [], -1, 1, 0, "", - c.Enums.OperatingModeEnum.kLit, False), + c.Enums.OperatingModeEnum.kLit, 64800, False), # ICDCounter at minimum ICDMData(0, 1, 0, 100, [], 0, 1, 0, "", - c.Enums.OperatingModeEnum.kLit, True), + c.Enums.OperatingModeEnum.kLit, 64800, True), # ICDCounter at maximum ICDMData(0, 1, 0, 100, [], 0xFFFFFFFF, 1, 0, "", - c.Enums.OperatingModeEnum.kLit, True), + c.Enums.OperatingModeEnum.kLit, 64800, True), # ICDCounter over maximum ICDMData(0, 1, 0, 100, [], 0x100000000, 1, 0, "", - c.Enums.OperatingModeEnum.kLit, False), + c.Enums.OperatingModeEnum.kLit, 64800, False), # -------- # Test cases to validate UserActiveModeTriggerHint # -------- # UserActiveModeTriggerHint outsite valid range ICDMData(0, 1, 0, 100, [], 0, 1, 0x1FFFF, "", - c.Enums.OperatingModeEnum.kLit, False), + c.Enums.OperatingModeEnum.kLit, 64800, False), # UserActiveModeTriggerHint outsite valid range ICDMData(0, 1, 0, 100, [], 0, 1, -1, "", - c.Enums.OperatingModeEnum.kLit, False), + c.Enums.OperatingModeEnum.kLit, 64800, False), # UserActiveModeTriggerHint with no hints ICDMData(0, 1, 0, 100, [], 0, 1, 0, "", - c.Enums.OperatingModeEnum.kLit, True), + c.Enums.OperatingModeEnum.kLit, 64800, True), # UserActiveModeTriggerHint wiht two instruction depedent bits set ICDMData(0, 1, 0, 100, [], 0, 1, uat.kCustomInstruction | uat.kActuateSensorSeconds, "", - c.Enums.OperatingModeEnum.kLit, False), + c.Enums.OperatingModeEnum.kLit, 64800, False), # -------- # Test cases to validate UserActiveModeTriggerInstruction # -------- # UserActiveModeTriggerInstruction with wrong encoding ICDMData(0, 1, 0, 100, [], 0, 1, uat.kCustomInstruction, "Hello\uD83D\uDE00World", - c.Enums.OperatingModeEnum.kLit, False), + c.Enums.OperatingModeEnum.kLit, 64800, False), # UserActiveModeTriggerInstruction with empty string ICDMData(0, 1, 0, 100, [], 0, 1, uat.kCustomInstruction, "", - c.Enums.OperatingModeEnum.kLit, True), + c.Enums.OperatingModeEnum.kLit, 64800, True), # UserActiveModeTriggerInstruction with empty string ICDMData(0, 1, 0, 100, [], 0, 1, uat.kCustomInstruction, "", - c.Enums.OperatingModeEnum.kLit, True), + c.Enums.OperatingModeEnum.kLit, 64800, True), # UserActiveModeTriggerInstruction with max string length ICDMData(0, 1, 0, 100, [], 0, 1, uat.kCustomInstruction, long_string, - c.Enums.OperatingModeEnum.kLit, True), + c.Enums.OperatingModeEnum.kLit, 64800, True), # UserActiveModeTriggerInstruction > max string length ICDMData(0, 1, 0, 100, [], 0, 1, uat.kCustomInstruction, too_long_string, - c.Enums.OperatingModeEnum.kLit, False), + c.Enums.OperatingModeEnum.kLit, 64800, False), # UserActiveModeTriggerInstruction invalid number - Trailing 0s ICDMData(0, 1, 0, 100, [], 0, 1, uat.kActuateSensorSeconds, "001", - c.Enums.OperatingModeEnum.kLit, False), + c.Enums.OperatingModeEnum.kLit, 64800, False), # UserActiveModeTriggerInstruction invalid number - Letters ICDMData(0, 1, 0, 100, [], 0, 1, uat.kActuateSensorSeconds, "not a number", - c.Enums.OperatingModeEnum.kLit, False), + c.Enums.OperatingModeEnum.kLit, 64800, False), # UserActiveModeTriggerInstruction Valid number ICDMData(0, 1, 0, 100, [], 0, 1, uat.kActuateSensorSeconds, "100000", - c.Enums.OperatingModeEnum.kLit, True), + c.Enums.OperatingModeEnum.kLit, 64800, True), + ICDMData(0, 1, 0, 100, [], 0, 1, uat.kActuateSensorLightsBlink, "", c.Enums.OperatingModeEnum.kLit, 64800, False), + ICDMData(0, 1, 0, 100, [], 0, 1, uat.kActuateSensorLightsBlink, "AAAAAAA", c.Enums.OperatingModeEnum.kLit, 64800, False), + ICDMData(0, 1, 0, 100, [], 0, 1, uat.kActuateSensorLightsBlink, "AAAAA", c.Enums.OperatingModeEnum.kLit, 64800, False), + ICDMData(0, 1, 0, 100, [], 0, 1, uat.kActuateSensorLightsBlink, "AAAAAK", c.Enums.OperatingModeEnum.kLit, 64800, False), + ICDMData(0, 1, 0, 100, [], 0, 1, uat.kActuateSensorLightsBlink, "012345", c.Enums.OperatingModeEnum.kLit, 64800, True), # -------- # Test cases to validate OpertingMode # -------- # OpertingMode with negative value ICDMData(0, 1, 0, 100, [], 0, 1, uat.kActuateSensorSeconds, "100000", - -1, False), + -1, 64800, False), # OpertingMode with Accepted value ICDMData(0, 1, 0, 100, [], 0, 1, uat.kActuateSensorSeconds, "100000", - c.Enums.OperatingModeEnum.kLit, True), + c.Enums.OperatingModeEnum.kLit, 64800, True), # OpertingMode with unkown value ICDMData(0, 1, 0, 100, [], 0, 1, uat.kActuateSensorSeconds, "100000", - c.Enums.OperatingModeEnum.kUnknownEnumValue, False), + c.Enums.OperatingModeEnum.kUnknownEnumValue, 64800, False), + # -------- + # Test cases to validate MaximumCheckInBackOff + # -------- + ICDMData(0, 1, 0, 100, [], 0, 1, uat.kActuateSensorSeconds, "100000", + c.Enums.OperatingModeEnum.kUnknownEnumValue, 0, False), + ICDMData(0, 1, 0, 100, [], 0, 1, uat.kActuateSensorSeconds, "100000", + c.Enums.OperatingModeEnum.kSit, 1, True), + ICDMData(0, 1, 0, 100, [], 0, 1, uat.kActuateSensorSeconds, "100000", + c.Enums.OperatingModeEnum.kSit, 64800, True), + ICDMData(0, 1, 0, 100, [], 0, 1, uat.kActuateSensorSeconds, "100000", + c.Enums.OperatingModeEnum.kSit, 64801, False), ] @@ -205,13 +222,13 @@ def test_spec_to_attribute_cache(test_icdm: ICDMData) -> Attribute.AsyncReadTran resp.attributes = {0: {c: {attr.FeatureMap: test_icdm.FeatureMap, attr.IdleModeDuration: test_icdm.IdleModeDuration, attr.ActiveModeDuration: test_icdm.ActiveModeDuration, attr.ActiveModeThreshold: test_icdm.ActiveModeThreshold, attr.RegisteredClients: test_icdm.RegisteredClients, attr.ICDCounter: test_icdm.ICDCounter, attr.ClientsSupportedPerFabric: test_icdm.ClientsSupportedPerFabric, attr.UserActiveModeTriggerHint: test_icdm.UserActiveModeTriggerHint, - attr.UserActiveModeTriggerInstruction: test_icdm.UserActiveModeTriggerInstruction, attr.OperatingMode: test_icdm.OperatingMode}}} + attr.UserActiveModeTriggerInstruction: test_icdm.UserActiveModeTriggerInstruction, attr.OperatingMode: test_icdm.OperatingMode, attr.MaximumCheckInBackOff: test_icdm.MaximumCheckInBackOff}}} return resp def main(): pics = {"ICDM.S.A0000": True, "ICDM.S.A0001": True, "ICDM.S.A0002": True, "ICDM.S.A0003": True, "ICDM.S.A0004": True, - "ICDM.S.A0005": True, "ICDM.S.A0006": True, "ICDM.S.A0007": True, "ICDM.S.A0008": True, } + "ICDM.S.A0005": True, "ICDM.S.A0006": True, "ICDM.S.A0007": True, "ICDM.S.A0008": True, "ICDM.S.A0009": True, } test_runner = MockTestRunner( 'TC_ICDM_2_1', 'TC_ICDM_2_1', 'test_TC_ICDM_2_1', 0, pics)