Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RVCOPSTATE-2.3] Add a check for PICS #28588

55 changes: 28 additions & 27 deletions src/python_testing/TC_RVCOPSTATE_2_3.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ async def test_TC_RVCOPSTATE_2_3(self):

self.endpoint = self.matter_test_config.global_test_params['PIXIT_ENDPOINT']

asserts.assert_true(self.check_pics("RVCOPSTATE.S.A0002"), "RVCOPSTATE.S.A0002 must be supported")
asserts.assert_true(self.check_pics("RVCOPSTATE.S.A0003"), "RVCOPSTATE.S.A0003 must be supported")
asserts.assert_true(self.check_pics("RVCOPSTATE.S.A0004"), "RVCOPSTATE.S.A0004 must be supported")
asserts.assert_true(self.check_pics("RVCOPSTATE.S.C00.Rsp"), "RVCOPSTATE.S.C00.Rsp must be supported")
Expand Down Expand Up @@ -86,32 +85,34 @@ async def test_TC_RVCOPSTATE_2_3(self):
asserts.assert_equal(ret.commandResponseState.errorStateID, Clusters.OperationalState.Enums.ErrorStateEnum.kNoError,
plauric marked this conversation as resolved.
Show resolved Hide resolved
"errorStateID(%s) should be NoError(0x00)" % ret.commandResponseState.errorStateID)

self.print_step(5, "Read OperationalState attribute")
operational_state = await self.read_mod_attribute_expect_success(endpoint=self.endpoint,
attribute=attributes.OperationalState)
logging.info("OperationalState: %s" % (operational_state))
asserts.assert_equal(operational_state, Clusters.OperationalState.Enums.OperationalStateEnum.kPaused,
"OperationalState(%s) should be Paused(0x02)" % operational_state)

self.print_step(6, "Read CountdownTime attribute")
initial_countdown_time = await self.read_mod_attribute_expect_success(endpoint=self.endpoint,
attribute=attributes.CountdownTime)
logging.info("CountdownTime: %s" % (initial_countdown_time))
if initial_countdown_time is not NullValue:
in_range = (1 <= initial_countdown_time <= 259200)
asserts.assert_true(initial_countdown_time is NullValue or in_range,
"invalid CountdownTime(%s). Must be in between 1 and 259200, or null" % initial_countdown_time)

self.print_step(7, "Waiting for 5 seconds")
time.sleep(5)

self.print_step(8, "Read CountdownTime attribute")
countdown_time = await self.read_mod_attribute_expect_success(endpoint=self.endpoint, attribute=attributes.CountdownTime)
logging.info("CountdownTime: %s" % (countdown_time))
asserts.assert_true(countdown_time != 0 or countdown_time == NullValue,
"invalid CountdownTime(%s). Must be a non zero integer, or null" % countdown_time)
asserts.assert_equal(countdown_time, initial_countdown_time,
"CountdownTime(%s) does not equal to the intial CountdownTime (%s)" % (countdown_time, initial_countdown_time))
if self.check_pics("RVCOPSTATE.S.M.ST_PAUSED"):
plauric marked this conversation as resolved.
Show resolved Hide resolved
self.print_step(5, "Read OperationalState attribute")
operational_state = await self.read_mod_attribute_expect_success(endpoint=self.endpoint,
attribute=attributes.OperationalState)
logging.info("OperationalState: %s" % (operational_state))
asserts.assert_equal(operational_state, Clusters.OperationalState.Enums.OperationalStateEnum.kPaused,
"OperationalState(%s) should be Paused(0x02)" % operational_state)

if self.check_pics("RVCOPSTATE.S.A0002"):
self.print_step(6, "Read CountdownTime attribute")
initial_countdown_time = await self.read_mod_attribute_expect_success(endpoint=self.endpoint,
attribute=attributes.CountdownTime)
logging.info("CountdownTime: %s" % (initial_countdown_time))
if initial_countdown_time is not NullValue:
in_range = (1 <= initial_countdown_time <= 259200)
asserts.assert_true(initial_countdown_time is NullValue or in_range,
"invalid CountdownTime(%s). Must be in between 1 and 259200, or null" % initial_countdown_time)

self.print_step(7, "Waiting for 5 seconds")
time.sleep(5)

self.print_step(8, "Read CountdownTime attribute")
countdown_time = await self.read_mod_attribute_expect_success(endpoint=self.endpoint, attribute=attributes.CountdownTime)
logging.info("CountdownTime: %s" % (countdown_time))
asserts.assert_true(countdown_time != 0 or countdown_time == NullValue,
"invalid CountdownTime(%s). Must be a non zero integer, or null" % countdown_time)
asserts.assert_equal(countdown_time, initial_countdown_time,
plauric marked this conversation as resolved.
Show resolved Hide resolved
"CountdownTime(%s) does not equal to the intial CountdownTime (%s)" % (countdown_time, initial_countdown_time))

self.print_step(9, "Send Pause command")
ret = await self.send_pause_cmd()
Expand Down