From 6560a6936d88b8d3fba7bc9f1ebe00f685ef2ebf Mon Sep 17 00:00:00 2001 From: Harshith-GRL Date: Wed, 14 Aug 2024 23:03:39 +0530 Subject: [PATCH 01/12] Python Scripts TC_RVCCLEANM_2_2.py and TC_RVCRUNM_2_2.py updated * Updated the python script TC_RVCCLEANM_2_2.py with two new steps '7a' For reading FeatureMap Attribute and '7b' for send ChangeToMode Command * Updated the python script TC_RVCRUNM_2_2.py with two new steps '6a' For reading FeatureMap Attribute and '6b' for send ChangeToMode Command * Updated TC_RVCOPSTATE_2_4.py with updated PICS as per Test Plan --- src/python_testing/TC_RVCCLEANM_2_2.py | 41 +++++++++++++++++++++---- src/python_testing/TC_RVCOPSTATE_2_4.py | 2 +- src/python_testing/TC_RVCRUNM_2_2.py | 39 +++++++++++++++++------ 3 files changed, 65 insertions(+), 17 deletions(-) diff --git a/src/python_testing/TC_RVCCLEANM_2_2.py b/src/python_testing/TC_RVCCLEANM_2_2.py index 8aaae7ff78738f..c380a2b08cf0a7 100644 --- a/src/python_testing/TC_RVCCLEANM_2_2.py +++ b/src/python_testing/TC_RVCCLEANM_2_2.py @@ -27,12 +27,19 @@ # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto # === END CI TEST ARGUMENTS === +import enum from time import sleep import chip.clusters as Clusters -from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main +from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main, type_matches from mobly import asserts +class RvcStatusEnum(enum.IntEnum): + # TODO remove this class once InvalidInMode response code is implemented in python SDK + Success = 0x0 + UnsupportedMode = 0x1 + GenericFailure = 0x2 + InvalidInMode = 0x3 class TC_RVCCLEANM_2_2(MatterBaseTest): @@ -64,6 +71,11 @@ async def read_clean_supported_modes(self) -> Clusters.Objects.RvcCleanMode.Attr Clusters.RvcCleanMode.Attributes.SupportedModes) return ret + async def read_feature_map_attribute(self): + ret = await self.read_mod_attribute_expect_success(Clusters.RvcCleanMode, + Clusters.RvcCleanMode.Attributes.FeatureMap) + return ret + async def send_clean_change_to_mode_cmd(self, newMode) -> Clusters.Objects.RvcCleanMode.Commands.ChangeToModeResponse: ret = await self.send_single_cmd(cmd=Clusters.Objects.RvcCleanMode.Commands.ChangeToMode(newMode=newMode), endpoint=self.endpoint) return ret @@ -90,6 +102,9 @@ def write_to_app_pipe(self, command): @async_test_body async def test_TC_RVCCLEANM_2_2(self): + # TODO Replace 0x8000 with python object of RVCCLEAN FEATURE bit map when implemented + # 0x8000 corresponds to 16 bit DIRECTMODECH Feature map + self.directmodech_bit_map = 0x8000 self.endpoint = self.matter_test_config.endpoint self.is_ci = self.check_pics("PICS_SDK_CI_ONLY") if self.is_ci: @@ -157,11 +172,25 @@ async def test_TC_RVCCLEANM_2_2(self): self.new_clean_mode_th = mode break - self.print_step(7, "Send ChangeToMode command") - response = await self.send_clean_change_to_mode_cmd(self.new_clean_mode_th) - asserts.assert_equal(response.status, 3, - "The response should contain a ChangeToModeResponse command " - "with the Status set to InvalidInMode(0x03).") + self.print_step("7a", "Read FeatureMap Attribute") + directmodech = await self.read_feature_map_attribute() + directmode_enabled = directmodech & self.directmodech_bit_map + + self.print_step("7b", "Send ChangeToMode command") + if directmode_enabled: + response = await self.send_clean_change_to_mode_cmd(self.new_clean_mode_th) + asserts.assert_true(type_matches(response, Clusters.RvcCleanMode.Commands.ChangeToModeResponse), + "The response should ChangeToModeResponse command") + asserts.assert_equal(response.status, RvcStatusEnum.Success, + "The response should contain a ChangeToModeResponse command " + "with the Status set to Success(0x0).") + else: + response = await self.send_clean_change_to_mode_cmd(self.new_clean_mode_th) + asserts.assert_true(type_matches(response, Clusters.RvcCleanMode.Commands.ChangeToModeResponse), + "The response should ChangeToModeResponse command") + asserts.assert_equal(response.status, RvcStatusEnum.InvalidInMode, + "The response should contain a ChangeToModeResponse command " + "with the Status set to InvalidInMode(0x03).") if __name__ == "__main__": diff --git a/src/python_testing/TC_RVCOPSTATE_2_4.py b/src/python_testing/TC_RVCOPSTATE_2_4.py index b680453b06c287..d5f07fe9c74936 100644 --- a/src/python_testing/TC_RVCOPSTATE_2_4.py +++ b/src/python_testing/TC_RVCOPSTATE_2_4.py @@ -114,7 +114,7 @@ async def test_TC_RVCOPSTATE_2_4(self): asserts.assert_true(self.check_pics("RVCOPSTATE.S.A0004"), "RVCOPSTATE.S.A0004 must be supported") asserts.assert_true(self.check_pics("RVCOPSTATE.S.C04.Tx"), "RVCOPSTATE.S.C04.Tx must be supported") - asserts.assert_true(self.check_pics("RVCOPSTATE.S.C128.Rsp"), "RVCOPSTATE.S.C128.Rsp must be supported") + asserts.assert_true(self.check_pics("RVCOPSTATE.S.C80.Rsp"), "RVCOPSTATE.S.C80.Rsp must be supported") op_states = Clusters.OperationalState.Enums.OperationalStateEnum rvc_op_states = Clusters.RvcOperationalState.Enums.OperationalStateEnum diff --git a/src/python_testing/TC_RVCRUNM_2_2.py b/src/python_testing/TC_RVCRUNM_2_2.py index dca866adb9f62e..ca3cf1e34d1223 100644 --- a/src/python_testing/TC_RVCRUNM_2_2.py +++ b/src/python_testing/TC_RVCRUNM_2_2.py @@ -27,6 +27,7 @@ # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto --int-arg PIXIT.RVCRUNM.MODE_A:1 PIXIT.RVCRUNM.MODE_B:2 # === END CI TEST ARGUMENTS === +import enum from time import sleep import chip.clusters as Clusters @@ -37,18 +38,25 @@ # Run the test with # --int-arg PIXIT.RVCRUNM.MODE_A: PIXIT.RVCRUNM.MODE_B: +class RvcStatusEnum(enum.IntEnum): + # TODO remove this class once InvalidInMode response code is implemented in python SDK + Success = 0x0 + UnsupportedMode = 0x1 + GenericFailure = 0x2 + InvalidInMode = 0x3 + def error_enum_to_text(error_enum): try: return f'{Clusters.RvcRunMode.Enums.ModeTag(error_enum).name} 0x{error_enum:02x}' except AttributeError: - if error_enum == 0: + if error_enum == RvcStatusEnum.Success: return "Success(0x00)" - elif error_enum == 0x1: + elif error_enum == RvcStatusEnum.UnsupportedMode: return "UnsupportedMode(0x01)" - elif error_enum == 0x2: + elif error_enum == RvcStatusEnum.GenericFailure: return "GenericFailure(0x02)" - elif error_enum == 0x3: + elif error_enum == RvcStatusEnum.InvalidInMode: return "InvalidInMode(0x03)" raise AttributeError("Unknown Enum value") @@ -122,6 +130,9 @@ async def test_TC_RVCRUNM_2_2(self): "PIXIT.RVCRUNM.MODE_A: \n" "PIXIT.RVCRUNM.MODE_B:") + # TODO Replace 0x8000 with python object of RVCRUN FEATURE bit when implemented + # 0x8000 corresponds to 16 bit DIRECTMODECH Feature map + self.directmodech_bit_map = 0x8000 self.endpoint = self.matter_test_config.endpoint self.is_ci = self.check_pics("PICS_SDK_CI_ONLY") self.mode_a = self.matter_test_config.global_test_params['PIXIT.RVCRUNM.MODE_A'] @@ -193,15 +204,23 @@ async def test_TC_RVCRUNM_2_2(self): asserts.assert_true(idle_tag_present, "The device must be in a mode with the Idle (0x4000) mode tag.") self.print_step(5, "Send ChangeToMode MODE_A command") - await self.send_change_to_mode_with_check(self.mode_a, 0) + await self.send_change_to_mode_with_check(self.mode_a, RvcStatusEnum.Success) # This step is not described in the test plan, but it ought to be await self.read_current_mode_with_check(self.mode_a) - self.print_step(6, "Send ChangeToMode MODE_B command") - await self.send_change_to_mode_with_check(self.mode_b, 3) + self.print_step("6a", "Read Attribute FeatureMap") + directmodech = await self.read_mod_attribute_expect_success(cluster=Clusters.RvcRunMode, + attribute=Clusters.RvcRunMode.Attributes.FeatureMap) + directmode_enabled = directmodech & self.directmodech_bit_map + + self.print_step('6b', "Send ChangeToMode MODE_B command") + if directmode_enabled: + await self.send_change_to_mode_with_check(self.mode_b, RvcStatusEnum.Success) + else: + await self.send_change_to_mode_with_check(self.mode_b, RvcStatusEnum.InvalidInMode) self.print_step(7, "Send ChangeToMode idle command") - await self.send_change_to_mode_with_check(self.idle_mode_dut, 0) + await self.send_change_to_mode_with_check(self.idle_mode_dut, RvcStatusEnum.Success) # This step is not described in the test plan, but it ought to be await self.read_current_mode_with_check(self.idle_mode_dut) @@ -228,12 +247,12 @@ async def test_TC_RVCRUNM_2_2(self): "Expected RVCOPSTATE's OperationalState attribute to be one of Stopped(0x00), Paused(0x02), Charging(0x41) or Docked(0x42)") self.print_step(11, "Send ChangeToMode MODE_B command") - await self.send_change_to_mode_with_check(self.mode_b, 0) + await self.send_change_to_mode_with_check(self.mode_b, RvcStatusEnum.Success) # This step is not described in the test plan, but it ought to be await self.read_current_mode_with_check(self.mode_b) self.print_step(12, "Send ChangeToMode idle command") - await self.send_change_to_mode_with_check(self.idle_mode_dut, 0) + await self.send_change_to_mode_with_check(self.idle_mode_dut, RvcStatusEnum.Success) # This step is not described in the test plan, but it ought to be await self.read_current_mode_with_check(self.idle_mode_dut) From 7ab76360687efc888b0c350134244ae480c9259e Mon Sep 17 00:00:00 2001 From: Harshith-GRL Date: Thu, 15 Aug 2024 00:04:57 +0530 Subject: [PATCH 02/12] Python Script TC_RVCOPSTATE_2_4.py * Updated TC_RVCOPSTATE_2_4.py with steps numbers update --- src/python_testing/TC_RVCOPSTATE_2_4.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/python_testing/TC_RVCOPSTATE_2_4.py b/src/python_testing/TC_RVCOPSTATE_2_4.py index d5f07fe9c74936..7f03d33b196833 100644 --- a/src/python_testing/TC_RVCOPSTATE_2_4.py +++ b/src/python_testing/TC_RVCOPSTATE_2_4.py @@ -170,16 +170,16 @@ async def test_TC_RVCOPSTATE_2_4(self): if self.check_pics("PICS_M_ST_SEEKING_CHARGER"): step_name = "Manually put the device in the SEEKING CHARGER operational state" - self.print_step(8, step_name) + self.print_step(11, step_name) if self.is_ci: await self.send_run_change_to_mode_cmd(rvc_app_run_mode_cleaning) await self.send_run_change_to_mode_cmd(rvc_app_run_mode_idle) else: self.wait_for_user_input(prompt_msg=f"{step_name}, and press Enter when ready.") - await self.read_operational_state_with_check(9, rvc_op_states.kSeekingCharger) + await self.read_operational_state_with_check(12, rvc_op_states.kSeekingCharger) - await self.send_go_home_cmd_with_check(10, op_errors.kNoError) + await self.send_go_home_cmd_with_check(13, op_errors.kNoError) if __name__ == "__main__": From ad9bf1b7de0c80e316be61fbeab88dc0697e5c20 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Wed, 14 Aug 2024 18:43:36 +0000 Subject: [PATCH 03/12] Restyled by autopep8 --- src/python_testing/TC_RVCCLEANM_2_2.py | 2 ++ src/python_testing/TC_RVCRUNM_2_2.py | 1 + 2 files changed, 3 insertions(+) diff --git a/src/python_testing/TC_RVCCLEANM_2_2.py b/src/python_testing/TC_RVCCLEANM_2_2.py index c380a2b08cf0a7..91e3291a7eedc0 100644 --- a/src/python_testing/TC_RVCCLEANM_2_2.py +++ b/src/python_testing/TC_RVCCLEANM_2_2.py @@ -34,6 +34,7 @@ from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main, type_matches from mobly import asserts + class RvcStatusEnum(enum.IntEnum): # TODO remove this class once InvalidInMode response code is implemented in python SDK Success = 0x0 @@ -41,6 +42,7 @@ class RvcStatusEnum(enum.IntEnum): GenericFailure = 0x2 InvalidInMode = 0x3 + class TC_RVCCLEANM_2_2(MatterBaseTest): def __init__(self, *args): diff --git a/src/python_testing/TC_RVCRUNM_2_2.py b/src/python_testing/TC_RVCRUNM_2_2.py index ca3cf1e34d1223..44afb661946fe6 100644 --- a/src/python_testing/TC_RVCRUNM_2_2.py +++ b/src/python_testing/TC_RVCRUNM_2_2.py @@ -38,6 +38,7 @@ # Run the test with # --int-arg PIXIT.RVCRUNM.MODE_A: PIXIT.RVCRUNM.MODE_B: + class RvcStatusEnum(enum.IntEnum): # TODO remove this class once InvalidInMode response code is implemented in python SDK Success = 0x0 From bfc0753e51f08bcb623e5667b7b4b80ee9f74270 Mon Sep 17 00:00:00 2001 From: Harshith-GRL Date: Wed, 14 Aug 2024 23:03:39 +0530 Subject: [PATCH 04/12] Python Scripts TC_RVCCLEANM_2_2.py and TC_RVCRUNM_2_2.py updated * Updated the python script TC_RVCCLEANM_2_2.py with two new steps '7a' For reading FeatureMap Attribute and '7b' for send ChangeToMode Command * Updated the python script TC_RVCRUNM_2_2.py with two new steps '6a' For reading FeatureMap Attribute and '6b' for send ChangeToMode Command * Updated TC_RVCOPSTATE_2_4.py with updated PICS as per Test Plan --- src/python_testing/TC_RVCCLEANM_2_2.py | 41 +++++++++++++++++++++---- src/python_testing/TC_RVCOPSTATE_2_4.py | 2 +- src/python_testing/TC_RVCRUNM_2_2.py | 39 +++++++++++++++++------ 3 files changed, 65 insertions(+), 17 deletions(-) diff --git a/src/python_testing/TC_RVCCLEANM_2_2.py b/src/python_testing/TC_RVCCLEANM_2_2.py index 8aaae7ff78738f..c380a2b08cf0a7 100644 --- a/src/python_testing/TC_RVCCLEANM_2_2.py +++ b/src/python_testing/TC_RVCCLEANM_2_2.py @@ -27,12 +27,19 @@ # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto # === END CI TEST ARGUMENTS === +import enum from time import sleep import chip.clusters as Clusters -from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main +from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main, type_matches from mobly import asserts +class RvcStatusEnum(enum.IntEnum): + # TODO remove this class once InvalidInMode response code is implemented in python SDK + Success = 0x0 + UnsupportedMode = 0x1 + GenericFailure = 0x2 + InvalidInMode = 0x3 class TC_RVCCLEANM_2_2(MatterBaseTest): @@ -64,6 +71,11 @@ async def read_clean_supported_modes(self) -> Clusters.Objects.RvcCleanMode.Attr Clusters.RvcCleanMode.Attributes.SupportedModes) return ret + async def read_feature_map_attribute(self): + ret = await self.read_mod_attribute_expect_success(Clusters.RvcCleanMode, + Clusters.RvcCleanMode.Attributes.FeatureMap) + return ret + async def send_clean_change_to_mode_cmd(self, newMode) -> Clusters.Objects.RvcCleanMode.Commands.ChangeToModeResponse: ret = await self.send_single_cmd(cmd=Clusters.Objects.RvcCleanMode.Commands.ChangeToMode(newMode=newMode), endpoint=self.endpoint) return ret @@ -90,6 +102,9 @@ def write_to_app_pipe(self, command): @async_test_body async def test_TC_RVCCLEANM_2_2(self): + # TODO Replace 0x8000 with python object of RVCCLEAN FEATURE bit map when implemented + # 0x8000 corresponds to 16 bit DIRECTMODECH Feature map + self.directmodech_bit_map = 0x8000 self.endpoint = self.matter_test_config.endpoint self.is_ci = self.check_pics("PICS_SDK_CI_ONLY") if self.is_ci: @@ -157,11 +172,25 @@ async def test_TC_RVCCLEANM_2_2(self): self.new_clean_mode_th = mode break - self.print_step(7, "Send ChangeToMode command") - response = await self.send_clean_change_to_mode_cmd(self.new_clean_mode_th) - asserts.assert_equal(response.status, 3, - "The response should contain a ChangeToModeResponse command " - "with the Status set to InvalidInMode(0x03).") + self.print_step("7a", "Read FeatureMap Attribute") + directmodech = await self.read_feature_map_attribute() + directmode_enabled = directmodech & self.directmodech_bit_map + + self.print_step("7b", "Send ChangeToMode command") + if directmode_enabled: + response = await self.send_clean_change_to_mode_cmd(self.new_clean_mode_th) + asserts.assert_true(type_matches(response, Clusters.RvcCleanMode.Commands.ChangeToModeResponse), + "The response should ChangeToModeResponse command") + asserts.assert_equal(response.status, RvcStatusEnum.Success, + "The response should contain a ChangeToModeResponse command " + "with the Status set to Success(0x0).") + else: + response = await self.send_clean_change_to_mode_cmd(self.new_clean_mode_th) + asserts.assert_true(type_matches(response, Clusters.RvcCleanMode.Commands.ChangeToModeResponse), + "The response should ChangeToModeResponse command") + asserts.assert_equal(response.status, RvcStatusEnum.InvalidInMode, + "The response should contain a ChangeToModeResponse command " + "with the Status set to InvalidInMode(0x03).") if __name__ == "__main__": diff --git a/src/python_testing/TC_RVCOPSTATE_2_4.py b/src/python_testing/TC_RVCOPSTATE_2_4.py index b680453b06c287..d5f07fe9c74936 100644 --- a/src/python_testing/TC_RVCOPSTATE_2_4.py +++ b/src/python_testing/TC_RVCOPSTATE_2_4.py @@ -114,7 +114,7 @@ async def test_TC_RVCOPSTATE_2_4(self): asserts.assert_true(self.check_pics("RVCOPSTATE.S.A0004"), "RVCOPSTATE.S.A0004 must be supported") asserts.assert_true(self.check_pics("RVCOPSTATE.S.C04.Tx"), "RVCOPSTATE.S.C04.Tx must be supported") - asserts.assert_true(self.check_pics("RVCOPSTATE.S.C128.Rsp"), "RVCOPSTATE.S.C128.Rsp must be supported") + asserts.assert_true(self.check_pics("RVCOPSTATE.S.C80.Rsp"), "RVCOPSTATE.S.C80.Rsp must be supported") op_states = Clusters.OperationalState.Enums.OperationalStateEnum rvc_op_states = Clusters.RvcOperationalState.Enums.OperationalStateEnum diff --git a/src/python_testing/TC_RVCRUNM_2_2.py b/src/python_testing/TC_RVCRUNM_2_2.py index dca866adb9f62e..ca3cf1e34d1223 100644 --- a/src/python_testing/TC_RVCRUNM_2_2.py +++ b/src/python_testing/TC_RVCRUNM_2_2.py @@ -27,6 +27,7 @@ # test-runner-run/run1/script-args: --storage-path admin_storage.json --commissioning-method on-network --discriminator 1234 --passcode 20202021 --PICS examples/rvc-app/rvc-common/pics/rvc-app-pics-values --endpoint 1 --trace-to json:${TRACE_TEST_JSON}.json --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto --int-arg PIXIT.RVCRUNM.MODE_A:1 PIXIT.RVCRUNM.MODE_B:2 # === END CI TEST ARGUMENTS === +import enum from time import sleep import chip.clusters as Clusters @@ -37,18 +38,25 @@ # Run the test with # --int-arg PIXIT.RVCRUNM.MODE_A: PIXIT.RVCRUNM.MODE_B: +class RvcStatusEnum(enum.IntEnum): + # TODO remove this class once InvalidInMode response code is implemented in python SDK + Success = 0x0 + UnsupportedMode = 0x1 + GenericFailure = 0x2 + InvalidInMode = 0x3 + def error_enum_to_text(error_enum): try: return f'{Clusters.RvcRunMode.Enums.ModeTag(error_enum).name} 0x{error_enum:02x}' except AttributeError: - if error_enum == 0: + if error_enum == RvcStatusEnum.Success: return "Success(0x00)" - elif error_enum == 0x1: + elif error_enum == RvcStatusEnum.UnsupportedMode: return "UnsupportedMode(0x01)" - elif error_enum == 0x2: + elif error_enum == RvcStatusEnum.GenericFailure: return "GenericFailure(0x02)" - elif error_enum == 0x3: + elif error_enum == RvcStatusEnum.InvalidInMode: return "InvalidInMode(0x03)" raise AttributeError("Unknown Enum value") @@ -122,6 +130,9 @@ async def test_TC_RVCRUNM_2_2(self): "PIXIT.RVCRUNM.MODE_A: \n" "PIXIT.RVCRUNM.MODE_B:") + # TODO Replace 0x8000 with python object of RVCRUN FEATURE bit when implemented + # 0x8000 corresponds to 16 bit DIRECTMODECH Feature map + self.directmodech_bit_map = 0x8000 self.endpoint = self.matter_test_config.endpoint self.is_ci = self.check_pics("PICS_SDK_CI_ONLY") self.mode_a = self.matter_test_config.global_test_params['PIXIT.RVCRUNM.MODE_A'] @@ -193,15 +204,23 @@ async def test_TC_RVCRUNM_2_2(self): asserts.assert_true(idle_tag_present, "The device must be in a mode with the Idle (0x4000) mode tag.") self.print_step(5, "Send ChangeToMode MODE_A command") - await self.send_change_to_mode_with_check(self.mode_a, 0) + await self.send_change_to_mode_with_check(self.mode_a, RvcStatusEnum.Success) # This step is not described in the test plan, but it ought to be await self.read_current_mode_with_check(self.mode_a) - self.print_step(6, "Send ChangeToMode MODE_B command") - await self.send_change_to_mode_with_check(self.mode_b, 3) + self.print_step("6a", "Read Attribute FeatureMap") + directmodech = await self.read_mod_attribute_expect_success(cluster=Clusters.RvcRunMode, + attribute=Clusters.RvcRunMode.Attributes.FeatureMap) + directmode_enabled = directmodech & self.directmodech_bit_map + + self.print_step('6b', "Send ChangeToMode MODE_B command") + if directmode_enabled: + await self.send_change_to_mode_with_check(self.mode_b, RvcStatusEnum.Success) + else: + await self.send_change_to_mode_with_check(self.mode_b, RvcStatusEnum.InvalidInMode) self.print_step(7, "Send ChangeToMode idle command") - await self.send_change_to_mode_with_check(self.idle_mode_dut, 0) + await self.send_change_to_mode_with_check(self.idle_mode_dut, RvcStatusEnum.Success) # This step is not described in the test plan, but it ought to be await self.read_current_mode_with_check(self.idle_mode_dut) @@ -228,12 +247,12 @@ async def test_TC_RVCRUNM_2_2(self): "Expected RVCOPSTATE's OperationalState attribute to be one of Stopped(0x00), Paused(0x02), Charging(0x41) or Docked(0x42)") self.print_step(11, "Send ChangeToMode MODE_B command") - await self.send_change_to_mode_with_check(self.mode_b, 0) + await self.send_change_to_mode_with_check(self.mode_b, RvcStatusEnum.Success) # This step is not described in the test plan, but it ought to be await self.read_current_mode_with_check(self.mode_b) self.print_step(12, "Send ChangeToMode idle command") - await self.send_change_to_mode_with_check(self.idle_mode_dut, 0) + await self.send_change_to_mode_with_check(self.idle_mode_dut, RvcStatusEnum.Success) # This step is not described in the test plan, but it ought to be await self.read_current_mode_with_check(self.idle_mode_dut) From f2ea8ee7b84fe9b5da9211fef16d9f1d6cdbc6e1 Mon Sep 17 00:00:00 2001 From: Harshith-GRL Date: Thu, 15 Aug 2024 00:04:57 +0530 Subject: [PATCH 05/12] Python Script TC_RVCOPSTATE_2_4.py * Updated TC_RVCOPSTATE_2_4.py with steps numbers update --- src/python_testing/TC_RVCOPSTATE_2_4.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/python_testing/TC_RVCOPSTATE_2_4.py b/src/python_testing/TC_RVCOPSTATE_2_4.py index d5f07fe9c74936..7f03d33b196833 100644 --- a/src/python_testing/TC_RVCOPSTATE_2_4.py +++ b/src/python_testing/TC_RVCOPSTATE_2_4.py @@ -170,16 +170,16 @@ async def test_TC_RVCOPSTATE_2_4(self): if self.check_pics("PICS_M_ST_SEEKING_CHARGER"): step_name = "Manually put the device in the SEEKING CHARGER operational state" - self.print_step(8, step_name) + self.print_step(11, step_name) if self.is_ci: await self.send_run_change_to_mode_cmd(rvc_app_run_mode_cleaning) await self.send_run_change_to_mode_cmd(rvc_app_run_mode_idle) else: self.wait_for_user_input(prompt_msg=f"{step_name}, and press Enter when ready.") - await self.read_operational_state_with_check(9, rvc_op_states.kSeekingCharger) + await self.read_operational_state_with_check(12, rvc_op_states.kSeekingCharger) - await self.send_go_home_cmd_with_check(10, op_errors.kNoError) + await self.send_go_home_cmd_with_check(13, op_errors.kNoError) if __name__ == "__main__": From d92c804f5b7472dcce234d246f517a08a7bd1768 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Wed, 14 Aug 2024 18:43:36 +0000 Subject: [PATCH 06/12] Restyled by autopep8 --- src/python_testing/TC_RVCCLEANM_2_2.py | 2 ++ src/python_testing/TC_RVCRUNM_2_2.py | 1 + 2 files changed, 3 insertions(+) diff --git a/src/python_testing/TC_RVCCLEANM_2_2.py b/src/python_testing/TC_RVCCLEANM_2_2.py index c380a2b08cf0a7..91e3291a7eedc0 100644 --- a/src/python_testing/TC_RVCCLEANM_2_2.py +++ b/src/python_testing/TC_RVCCLEANM_2_2.py @@ -34,6 +34,7 @@ from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main, type_matches from mobly import asserts + class RvcStatusEnum(enum.IntEnum): # TODO remove this class once InvalidInMode response code is implemented in python SDK Success = 0x0 @@ -41,6 +42,7 @@ class RvcStatusEnum(enum.IntEnum): GenericFailure = 0x2 InvalidInMode = 0x3 + class TC_RVCCLEANM_2_2(MatterBaseTest): def __init__(self, *args): diff --git a/src/python_testing/TC_RVCRUNM_2_2.py b/src/python_testing/TC_RVCRUNM_2_2.py index ca3cf1e34d1223..44afb661946fe6 100644 --- a/src/python_testing/TC_RVCRUNM_2_2.py +++ b/src/python_testing/TC_RVCRUNM_2_2.py @@ -38,6 +38,7 @@ # Run the test with # --int-arg PIXIT.RVCRUNM.MODE_A: PIXIT.RVCRUNM.MODE_B: + class RvcStatusEnum(enum.IntEnum): # TODO remove this class once InvalidInMode response code is implemented in python SDK Success = 0x0 From 3a4d168b3723f2f99473a3d2558c4d6fb0e9e27f Mon Sep 17 00:00:00 2001 From: Harshith-GRL Date: Fri, 16 Aug 2024 11:55:16 +0530 Subject: [PATCH 07/12] Python Script TC_RVCRUNM_2_2.py and TC_RVCCLEANM_2_2.py * Updated TC_RVCRUNM_2_2.py and TC_RVCCLEANM_2_2.py as per comments from ROB --- src/python_testing/TC_RVCCLEANM_2_2.py | 15 ++++++--------- src/python_testing/TC_RVCRUNM_2_2.py | 6 +++--- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/src/python_testing/TC_RVCCLEANM_2_2.py b/src/python_testing/TC_RVCCLEANM_2_2.py index 91e3291a7eedc0..e3a92033b3bdf4 100644 --- a/src/python_testing/TC_RVCCLEANM_2_2.py +++ b/src/python_testing/TC_RVCCLEANM_2_2.py @@ -106,7 +106,7 @@ def write_to_app_pipe(self, command): async def test_TC_RVCCLEANM_2_2(self): # TODO Replace 0x8000 with python object of RVCCLEAN FEATURE bit map when implemented # 0x8000 corresponds to 16 bit DIRECTMODECH Feature map - self.directmodech_bit_map = 0x8000 + self.directmodech_bit_mask = 0x8000 self.endpoint = self.matter_test_config.endpoint self.is_ci = self.check_pics("PICS_SDK_CI_ONLY") if self.is_ci: @@ -175,21 +175,18 @@ async def test_TC_RVCCLEANM_2_2(self): break self.print_step("7a", "Read FeatureMap Attribute") - directmodech = await self.read_feature_map_attribute() - directmode_enabled = directmodech & self.directmodech_bit_map + feature_map = await self.read_feature_map_attribute() + directmode_enabled = feature_map & self.directmodech_bit_mask self.print_step("7b", "Send ChangeToMode command") + response = await self.send_clean_change_to_mode_cmd(self.new_clean_mode_th) + asserts.assert_true(type_matches(response, Clusters.RvcCleanMode.Commands.ChangeToModeResponse), + "The response should ChangeToModeResponse command") if directmode_enabled: - response = await self.send_clean_change_to_mode_cmd(self.new_clean_mode_th) - asserts.assert_true(type_matches(response, Clusters.RvcCleanMode.Commands.ChangeToModeResponse), - "The response should ChangeToModeResponse command") asserts.assert_equal(response.status, RvcStatusEnum.Success, "The response should contain a ChangeToModeResponse command " "with the Status set to Success(0x0).") else: - response = await self.send_clean_change_to_mode_cmd(self.new_clean_mode_th) - asserts.assert_true(type_matches(response, Clusters.RvcCleanMode.Commands.ChangeToModeResponse), - "The response should ChangeToModeResponse command") asserts.assert_equal(response.status, RvcStatusEnum.InvalidInMode, "The response should contain a ChangeToModeResponse command " "with the Status set to InvalidInMode(0x03).") diff --git a/src/python_testing/TC_RVCRUNM_2_2.py b/src/python_testing/TC_RVCRUNM_2_2.py index 44afb661946fe6..218ebf0e8cabf4 100644 --- a/src/python_testing/TC_RVCRUNM_2_2.py +++ b/src/python_testing/TC_RVCRUNM_2_2.py @@ -133,7 +133,7 @@ async def test_TC_RVCRUNM_2_2(self): # TODO Replace 0x8000 with python object of RVCRUN FEATURE bit when implemented # 0x8000 corresponds to 16 bit DIRECTMODECH Feature map - self.directmodech_bit_map = 0x8000 + self.directmodech_bit_mask = 0x8000 self.endpoint = self.matter_test_config.endpoint self.is_ci = self.check_pics("PICS_SDK_CI_ONLY") self.mode_a = self.matter_test_config.global_test_params['PIXIT.RVCRUNM.MODE_A'] @@ -210,9 +210,9 @@ async def test_TC_RVCRUNM_2_2(self): await self.read_current_mode_with_check(self.mode_a) self.print_step("6a", "Read Attribute FeatureMap") - directmodech = await self.read_mod_attribute_expect_success(cluster=Clusters.RvcRunMode, + feature_map = await self.read_mod_attribute_expect_success(cluster=Clusters.RvcRunMode, attribute=Clusters.RvcRunMode.Attributes.FeatureMap) - directmode_enabled = directmodech & self.directmodech_bit_map + directmode_enabled = feature_map & self.directmodech_bit_mask self.print_step('6b', "Send ChangeToMode MODE_B command") if directmode_enabled: From ca18f85d4f9c7768f04d8aa5ab081d44c0e51f4c Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Fri, 16 Aug 2024 16:41:34 +0000 Subject: [PATCH 08/12] Restyled by autopep8 --- src/python_testing/TC_RVCRUNM_2_2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/python_testing/TC_RVCRUNM_2_2.py b/src/python_testing/TC_RVCRUNM_2_2.py index 218ebf0e8cabf4..b0d1233010f932 100644 --- a/src/python_testing/TC_RVCRUNM_2_2.py +++ b/src/python_testing/TC_RVCRUNM_2_2.py @@ -211,7 +211,7 @@ async def test_TC_RVCRUNM_2_2(self): self.print_step("6a", "Read Attribute FeatureMap") feature_map = await self.read_mod_attribute_expect_success(cluster=Clusters.RvcRunMode, - attribute=Clusters.RvcRunMode.Attributes.FeatureMap) + attribute=Clusters.RvcRunMode.Attributes.FeatureMap) directmode_enabled = feature_map & self.directmodech_bit_mask self.print_step('6b', "Send ChangeToMode MODE_B command") From de0d5f0f8650557b10ecdfd0895b2612aae717fc Mon Sep 17 00:00:00 2001 From: Harshith-GRL Date: Fri, 16 Aug 2024 22:36:26 +0530 Subject: [PATCH 09/12] Updated CI PICS Value For TC_RVCOPSTATE_2_4.py --- src/app/tests/suites/certification/ci-pics-values | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/app/tests/suites/certification/ci-pics-values b/src/app/tests/suites/certification/ci-pics-values index f64941bb688890..724852060035be 100644 --- a/src/app/tests/suites/certification/ci-pics-values +++ b/src/app/tests/suites/certification/ci-pics-values @@ -2532,6 +2532,7 @@ RVCOPSTATE.S.C01.Rsp=0 RVCOPSTATE.S.C02.Rsp=0 RVCOPSTATE.S.C03.Rsp=1 RVCOPSTATE.S.C04.Tx=1 +RVCOPSTATE.S.C80.Rsp=1 RVCOPSTATE.S.C128.Rsp=1 RVCOPSTATE.S.M.ST_STOPPED=1 RVCOPSTATE.S.M.ST_RUNNING=1 @@ -2618,6 +2619,7 @@ PIXIT.RVCRUNM.MODE_CHANGE_OK=0 # RVCOPSTATE.S.C02.Rsp=0 # RVCOPSTATE.S.C03.Rsp=1 # RVCOPSTATE.S.C04.Tx=1 +# RVCOPSTATE.S.C80.Rsp=1 # RVCOPSTATE.S.C128.Rsp=1 # RVCOPSTATE.C.C00.Tx=1 # RVCOPSTATE.C.C01.Tx=1 From ba86d9bc91539173f6e4244d7abc99d45136cae7 Mon Sep 17 00:00:00 2001 From: Harshith-GRL Date: Fri, 16 Aug 2024 23:34:37 +0530 Subject: [PATCH 10/12] Updated PICS.yaml For TC_RVCOPSTATE_2_4.py --- src/app/tests/suites/certification/PICS.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/tests/suites/certification/PICS.yaml b/src/app/tests/suites/certification/PICS.yaml index 1fc182bd9ba867..c575bd348fc518 100644 --- a/src/app/tests/suites/certification/PICS.yaml +++ b/src/app/tests/suites/certification/PICS.yaml @@ -9740,7 +9740,7 @@ PICS: id: RVCOPSTATE.S.C03.Rsp - label: "Does the device implement receiving the GoHome command?" - id: RVCOPSTATE.S.C128.Rsp + id: RVCOPSTATE.S.C80.Rsp #Commands generated - label: From de29e34684951997bcc43f0cde2ec9bb4c839441 Mon Sep 17 00:00:00 2001 From: Harshith-GRL Date: Fri, 16 Aug 2024 23:48:26 +0530 Subject: [PATCH 11/12] Updated CI PICS file by removing RVCOPSTATE.S.C128.Rsp --- src/app/tests/suites/certification/ci-pics-values | 1 - 1 file changed, 1 deletion(-) diff --git a/src/app/tests/suites/certification/ci-pics-values b/src/app/tests/suites/certification/ci-pics-values index 724852060035be..9109f30bec4d73 100644 --- a/src/app/tests/suites/certification/ci-pics-values +++ b/src/app/tests/suites/certification/ci-pics-values @@ -2533,7 +2533,6 @@ RVCOPSTATE.S.C02.Rsp=0 RVCOPSTATE.S.C03.Rsp=1 RVCOPSTATE.S.C04.Tx=1 RVCOPSTATE.S.C80.Rsp=1 -RVCOPSTATE.S.C128.Rsp=1 RVCOPSTATE.S.M.ST_STOPPED=1 RVCOPSTATE.S.M.ST_RUNNING=1 RVCOPSTATE.S.M.ST_PAUSED=1 From 83631f9912776b753a02b59a46b126b1bdd50531 Mon Sep 17 00:00:00 2001 From: Harshith-GRL Date: Mon, 19 Aug 2024 11:08:41 +0530 Subject: [PATCH 12/12] Updated RVC PICS value at location examples/rvc-app/rvc-common/pics/rvc-app-pics-values --- examples/rvc-app/rvc-common/pics/rvc-app-pics-values | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/rvc-app/rvc-common/pics/rvc-app-pics-values b/examples/rvc-app/rvc-common/pics/rvc-app-pics-values index c38f0c1b7e00a0..4ad084ec618dd4 100644 --- a/examples/rvc-app/rvc-common/pics/rvc-app-pics-values +++ b/examples/rvc-app/rvc-common/pics/rvc-app-pics-values @@ -20,7 +20,7 @@ RVCOPSTATE.S.E01=1 RVCOPSTATE.S.C00.Rsp=1 RVCOPSTATE.S.C03.Rsp=1 RVCOPSTATE.S.C04.Tx=1 -RVCOPSTATE.S.C128.Rsp=1 +RVCOPSTATE.S.C80.Rsp=1 RVCOPSTATE.S.M.ST_STOPPED=1 RVCOPSTATE.S.M.ST_RUNNING=1 RVCOPSTATE.S.M.ST_PAUSED=1 @@ -77,4 +77,4 @@ SEAR.S.M.HAS_MANUAL_SKIP_STATE_CONTROL=1 SEAR.S.M.INVALID_STATE_FOR_SKIP=1 SEAR.S.M.NO_SELAREA_FOR_SKIP=1 SEAR.S.M.VALID_STATE_FOR_SKIP=1 -SEAR.S.M.HAS_MANUAL_OPERATING_STATE_CONTROL=1 \ No newline at end of file +SEAR.S.M.HAS_MANUAL_OPERATING_STATE_CONTROL=1