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

RVC TC 2.1 - PIXIT to test mode failure #28338

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 23 additions & 17 deletions src/python_testing/TC_RVCCLEANM_2_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,14 @@ async def test_TC_RVCCLEANM_2_1(self):
asserts.assert_true('PIXIT_MODEFAIL' in self.matter_test_config.global_test_params,
"PIXIT_MODEFAIL must be included on the command line in "
"the --int-arg flag as PIXIT_MODEFAIL:<mode id>")
asserts.assert_true('pixit_can_test_mode_failure' in self.matter_test_config.global_test_params,
"PIXIT_CAN_TEST_MODE_FAILURE must be included on the command line in "
"the --bool-arg flag as PIXIT_CAN_TEST_MODE_FAILURE:<true/false>")

self.endpoint = self.matter_test_config.global_test_params['PIXIT_ENDPOINT']
self.modeok = self.matter_test_config.global_test_params['PIXIT_MODEOK']
self.modefail = self.matter_test_config.global_test_params['PIXIT_MODEFAIL']
self.can_test_mode_failure = self.matter_test_config.global_test_params['pixit_can_test_mode_failure']

asserts.assert_true(self.check_pics("RVCCLEANM.S.A0000"), "RVCCLEANM.S.A0000 must be supported")
asserts.assert_true(self.check_pics("RVCCLEANM.S.A0001"), "RVCCLEANM.S.A0001 must be supported")
Expand Down Expand Up @@ -97,30 +101,32 @@ class CommonCodes(Enum):
ret = await self.send_change_to_mode_cmd(newMode=old_current_mode)
asserts.assert_true(ret.status == CommonCodes.SUCCESS.value, "Changing the mode to the current mode should be a no-op")

self.print_step(5, "Manually put the device in a state from which it will FAIL to transition to mode %d" % (self.modefail))
input("Press Enter when done.\n")
if self.can_test_mode_failure is True:
self.print_step(5, "Manually put the device in a state from which it will FAIL to transition to mode %d" % (self.modefail))
input("Press Enter when done.\n")

self.print_step(6, "Read CurrentMode attribute")
old_current_mode = await self.read_mod_attribute_expect_success(endpoint=self.endpoint, attribute=attributes.CurrentMode)
self.print_step(6, "Read CurrentMode attribute")
old_current_mode = await self.read_mod_attribute_expect_success(endpoint=self.endpoint, attribute=attributes.CurrentMode)

logging.info("CurrentMode: %s" % (old_current_mode))
logging.info("CurrentMode: %s" % (old_current_mode))

self.print_step(7, "Send ChangeToMode command with NewMode set to %d" % (self.modefail))
self.print_step(7, "Send ChangeToMode command with NewMode set to %d" % (self.modefail))

ret = await self.send_change_to_mode_cmd(newMode=self.modefail)
st = ret.status
is_mfg_code = st in range(0x80, 0xC0)
is_err_code = (st == CommonCodes.GENERIC_FAILURE.value) or (st in rvcCleanCodes) or is_mfg_code
asserts.assert_true(is_err_code, "Changing to mode %d must fail due to the current state of the device" % (self.modefail))
st_text_len = len(ret.statusText)
asserts.assert_true(st_text_len in range(1, 65), "StatusText length (%d) must be between 1 and 64" % (st_text_len))
ret = await self.send_change_to_mode_cmd(newMode=self.modefail)
st = ret.status
is_mfg_code = st in range(0x80, 0xC0)
is_err_code = (st == CommonCodes.GENERIC_FAILURE.value) or (st in rvcCleanCodes) or is_mfg_code
asserts.assert_true(
is_err_code, "Changing to mode %d must fail due to the current state of the device" % (self.modefail))
st_text_len = len(ret.statusText)
asserts.assert_true(st_text_len in range(1, 65), "StatusText length (%d) must be between 1 and 64" % (st_text_len))

self.print_step(8, "Read CurrentMode attribute")
current_mode = await self.read_mod_attribute_expect_success(endpoint=self.endpoint, attribute=attributes.CurrentMode)
self.print_step(8, "Read CurrentMode attribute")
current_mode = await self.read_mod_attribute_expect_success(endpoint=self.endpoint, attribute=attributes.CurrentMode)

logging.info("CurrentMode: %s" % (current_mode))
logging.info("CurrentMode: %s" % (current_mode))

asserts.assert_true(current_mode == old_current_mode, "CurrentMode changed after failed ChangeToMode command!")
asserts.assert_true(current_mode == old_current_mode, "CurrentMode changed after failed ChangeToMode command!")

self.print_step(9, "Manually put the device in a state from which it will SUCCESSFULLY transition to mode %d" % (self.modeok))
input("Press Enter when done.\n")
Expand Down
40 changes: 23 additions & 17 deletions src/python_testing/TC_RVCRUNM_2_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,14 @@ async def test_TC_RVCRUNM_2_1(self):
asserts.assert_true('PIXIT_MODEFAIL' in self.matter_test_config.global_test_params,
"PIXIT_MODEFAIL must be included on the command line in "
"the --int-arg flag as PIXIT_MODEFAIL:<mode id>")
asserts.assert_true('pixit_can_test_mode_failure' in self.matter_test_config.global_test_params,
"PIXIT_CAN_TEST_MODE_FAILURE must be included on the command line in "
"the --bool-arg flag as PIXIT_CAN_TEST_MODE_FAILURE:<true/false>")

self.endpoint = self.matter_test_config.global_test_params['PIXIT_ENDPOINT']
self.modeok = self.matter_test_config.global_test_params['PIXIT_MODEOK']
self.modefail = self.matter_test_config.global_test_params['PIXIT_MODEFAIL']
self.can_test_mode_failure = self.matter_test_config.global_test_params['pixit_can_test_mode_failure']

asserts.assert_true(self.check_pics("RVCRUNM.S.A0000"), "RVCRUNM.S.A0000 must be supported")
asserts.assert_true(self.check_pics("RVCRUNM.S.A0001"), "RVCRUNM.S.A0001 must be supported")
Expand Down Expand Up @@ -97,30 +101,32 @@ class CommonCodes(Enum):
ret = await self.send_change_to_mode_cmd(newMode=old_current_mode)
asserts.assert_true(ret.status == CommonCodes.SUCCESS.value, "Changing the mode to the current mode should be a no-op")

self.print_step(5, "Manually put the device in a state from which it will FAIL to transition to mode %d" % (self.modefail))
input("Press Enter when done.\n")
if self.can_test_mode_failure is True:
self.print_step(5, "Manually put the device in a state from which it will FAIL to transition to mode %d" % (self.modefail))
input("Press Enter when done.\n")

self.print_step(6, "Read CurrentMode attribute")
old_current_mode = await self.read_mod_attribute_expect_success(endpoint=self.endpoint, attribute=attributes.CurrentMode)
self.print_step(6, "Read CurrentMode attribute")
old_current_mode = await self.read_mod_attribute_expect_success(endpoint=self.endpoint, attribute=attributes.CurrentMode)

logging.info("CurrentMode: %s" % (old_current_mode))
logging.info("CurrentMode: %s" % (old_current_mode))

self.print_step(7, "Send ChangeToMode command with NewMode set to %d" % (self.modefail))
self.print_step(7, "Send ChangeToMode command with NewMode set to %d" % (self.modefail))

ret = await self.send_change_to_mode_cmd(newMode=self.modefail)
st = ret.status
is_mfg_code = st in range(0x80, 0xC0)
is_err_code = (st == CommonCodes.GENERIC_FAILURE.value) or (st in rvcRunCodes) or is_mfg_code
asserts.assert_true(is_err_code, "Changing to mode %d must fail due to the current state of the device" % (self.modefail))
st_text_len = len(ret.statusText)
asserts.assert_true(st_text_len in range(1, 65), "StatusText length (%d) must be between 1 and 64" % (st_text_len))
ret = await self.send_change_to_mode_cmd(newMode=self.modefail)
st = ret.status
is_mfg_code = st in range(0x80, 0xC0)
is_err_code = (st == CommonCodes.GENERIC_FAILURE.value) or (st in rvcRunCodes) or is_mfg_code
asserts.assert_true(
is_err_code, "Changing to mode %d must fail due to the current state of the device" % (self.modefail))
st_text_len = len(ret.statusText)
asserts.assert_true(st_text_len in range(1, 65), "StatusText length (%d) must be between 1 and 64" % (st_text_len))

self.print_step(8, "Read CurrentMode attribute")
current_mode = await self.read_mod_attribute_expect_success(endpoint=self.endpoint, attribute=attributes.CurrentMode)
self.print_step(8, "Read CurrentMode attribute")
current_mode = await self.read_mod_attribute_expect_success(endpoint=self.endpoint, attribute=attributes.CurrentMode)

logging.info("CurrentMode: %s" % (current_mode))
logging.info("CurrentMode: %s" % (current_mode))

asserts.assert_true(current_mode == old_current_mode, "CurrentMode changed after failed ChangeToMode command!")
asserts.assert_true(current_mode == old_current_mode, "CurrentMode changed after failed ChangeToMode command!")

self.print_step(9, "Manually put the device in a state from which it will SUCCESSFULLY transition to mode %d" % (self.modeok))
input("Press Enter when done.\n")
Expand Down