diff --git a/src/python_testing/TC_RVCCLEANM_1_2.py b/src/python_testing/TC_RVCCLEANM_1_2.py index b755d727561c71..2a3a38f02b4fb9 100644 --- a/src/python_testing/TC_RVCCLEANM_1_2.py +++ b/src/python_testing/TC_RVCCLEANM_1_2.py @@ -61,7 +61,7 @@ def __init__(self, *args): self.supported_modes_dut = [] async def read_mod_attribute_expect_success(self, endpoint, attribute): - cluster = Clusters.Objects.RvcCleanMode + cluster = Clusters.RvcCleanMode return await self.read_single_attribute_check_success(endpoint=endpoint, cluster=cluster, attribute=attribute) def pics_TC_RVCCLEANM_1_2(self) -> list[str]: @@ -71,60 +71,60 @@ def pics_TC_RVCCLEANM_1_2(self) -> list[str]: async def test_TC_RVCCLEANM_1_2(self): self.endpoint = self.get_endpoint() - attributes = Clusters.RvcCleanMode.Attributes + RVCClean_cluster = Clusters.RvcCleanMode + attributes = RVCClean_cluster.Attributes self.print_step(1, "Commissioning, already done") - if self.check_pics("RVCCLEANM.S.A0000"): - self.print_step(2, "Read SupportedModes attribute") - supported_modes = await self.read_mod_attribute_expect_success(endpoint=self.endpoint, attribute=attributes.SupportedModes) - - logging.info("SupportedModes: %s" % (supported_modes)) - - # Verify that the list has at least 2 and at most 255 entries - asserts.assert_greater_equal(len(supported_modes), 2, "SupportedModes must have at least 2 entries!") - asserts.assert_less_equal(len(supported_modes), 255, "SupportedModes must have at most 255 entries!") - - # Verify that each ModeOptionsStruct entry has a unique Mode field value - for m in supported_modes: - if m.mode in self.supported_modes_dut: - asserts.fail("SupportedModes must have unique mode values!") - else: - self.supported_modes_dut.append(m.mode) - - # Verify that each ModeOptionsStruct entry has a unique Label field value - labels = [] - for m in supported_modes: - if m.label in labels: - asserts.fail("SupportedModes must have unique mode label values!") - else: - labels.append(m.label) - - # Verify that each ModeOptionsStruct entry's ModeTags field has: - for m in supported_modes: - # * at least one entry - if len(m.modeTags) == 0: - asserts.fail("SupportedModes must have at least one mode tag!") - - at_least_one_common_or_clean_tag = False - for t in m.modeTags: - # * the values of the Value fields that are not larger than 16 bits - if t.value > 0xFFFF or t.value < 0: - asserts.fail("Mode tag values must not be larger than 16 bits!") - - # * for each Value field: {isCommonOrDerivedOrMfgTagsVal} - is_mfg = (0x8000 <= t.value <= 0xBFFF) - if (t.value not in self.commonTags and - t.value not in self.cleanTags and - not is_mfg): - asserts.fail("Mode tag value is not a common tag, clean tag or vendor tag!") - - # * for at least one Value field: {isCommonOrDerivedTagsVal} - if not is_mfg: - at_least_one_common_or_clean_tag = True - - if not at_least_one_common_or_clean_tag: - asserts.fail("At least one mode tag must be a common tag or clean tag!") + self.print_step(2, "Read SupportedModes attribute") + supported_modes = await self.read_mod_attribute_expect_success(endpoint=self.endpoint, attribute=attributes.SupportedModes) + + logging.info("SupportedModes: %s" % (supported_modes)) + + # Verify that the list has at least 2 and at most 255 entries + asserts.assert_greater_equal(len(supported_modes), 2, "SupportedModes must have at least 2 entries!") + asserts.assert_less_equal(len(supported_modes), 255, "SupportedModes must have at most 255 entries!") + + # Verify that each ModeOptionsStruct entry has a unique Mode field value + for m in supported_modes: + if m.mode in self.supported_modes_dut: + asserts.fail("SupportedModes must have unique mode values!") + else: + self.supported_modes_dut.append(m.mode) + + # Verify that each ModeOptionsStruct entry has a unique Label field value + labels = [] + for m in supported_modes: + if m.label in labels: + asserts.fail("SupportedModes must have unique mode label values!") + else: + labels.append(m.label) + + # Verify that each ModeOptionsStruct entry's ModeTags field has: + for m in supported_modes: + # * at least one entry + if len(m.modeTags) == 0: + asserts.fail("SupportedModes must have at least one mode tag!") + + at_least_one_common_or_clean_tag = False + for t in m.modeTags: + # * the values of the Value fields that are not larger than 16 bits + if t.value > 0xFFFF or t.value < 0: + asserts.fail("Mode tag values must not be larger than 16 bits!") + + # * for each Value field: {isCommonOrDerivedOrMfgTagsVal} + is_mfg = (0x8000 <= t.value <= 0xBFFF) + if (t.value not in self.commonTags and + t.value not in self.cleanTags and + not is_mfg): + asserts.fail("Mode tag value is not a common tag, clean tag or vendor tag!") + + # * for at least one Value field: {isCommonOrDerivedTagsVal} + if not is_mfg: + at_least_one_common_or_clean_tag = True + + if not at_least_one_common_or_clean_tag: + asserts.fail("At least one mode tag must be a common tag or clean tag!") # Verify that at least one ModeOptionsStruct entry includes either the # Vacuum(0x4001) mode tag or the Mop(0x4002)mode tag in the ModeTags field @@ -138,12 +138,11 @@ async def test_TC_RVCCLEANM_1_2(self): asserts.assert_true(has_vacuum_or_mop_mode_tag, "At least one ModeOptionsStruct entry must include either the Vacuum or Mop mode tag") - if self.check_pics("RVCCLEANM.S.A0001"): - self.print_step(3, "Read CurrentMode attribute") - current_mode = await self.read_mod_attribute_expect_success(endpoint=self.endpoint, attribute=attributes.CurrentMode) + self.print_step(3, "Read CurrentMode attribute") + current_mode = await self.read_mod_attribute_expect_success(endpoint=self.endpoint, attribute=attributes.CurrentMode) - logging.info("CurrentMode: %s" % (current_mode)) - asserts.assert_true(current_mode in self.supported_modes_dut, "CurrentMode is not a supported mode!") + logging.info("CurrentMode: %s" % (current_mode)) + asserts.assert_true(current_mode in self.supported_modes_dut, "CurrentMode is not a supported mode!") if __name__ == "__main__": diff --git a/src/python_testing/TC_RVCCLEANM_2_1.py b/src/python_testing/TC_RVCCLEANM_2_1.py index 5c5271e0be01ae..23032013f29648 100644 --- a/src/python_testing/TC_RVCCLEANM_2_1.py +++ b/src/python_testing/TC_RVCCLEANM_2_1.py @@ -98,12 +98,20 @@ async def test_TC_RVCCLEANM_2_1(self): asserts.fail("The --app-pid flag must be set when PICS_SDK_CI_ONLY is set") self.app_pipe = self.app_pipe + str(app_pid) - 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") - asserts.assert_true(self.check_pics("RVCCLEANM.S.C00.Rsp"), "RVCCLEANM.S.C00.Rsp must be supported") - asserts.assert_true(self.check_pics("RVCCLEANM.S.C01.Tx"), "RVCCLEANM.S.C01.Tx must be supported") + RVCClean_cluster = Clusters.RvcCleanMode + attributes = RVCClean_cluster.Attributes - attributes = Clusters.RvcCleanMode.Attributes + # Gathering Accepted and Generated Commands and associated ids + commands = RVCClean_cluster.Commands + RVCClean_gencmd_list = attributes.GeneratedCommandList + generated_cmd_list = await self.read_single_attribute_check_success(endpoint=self.endpoint, cluster=RVCClean_cluster, attribute=RVCClean_gencmd_list) + chg_rsp_cmd_id = commands.ChangeToModeResponse.command_id + + if not await self.command_guard(endpoint=self.endpoint, command=commands.ChangeToMode): + asserts.fail("Change To Mode receiving commands needs to be supported") + + if chg_rsp_cmd_id not in generated_cmd_list: + asserts.fail("Change To Mode Response to transmit commands needs to be supported") self.print_step(1, "Commissioning, already done") diff --git a/src/python_testing/TC_RVCCLEANM_2_2.py b/src/python_testing/TC_RVCCLEANM_2_2.py index a34d0cda2a12a5..88f843f47acc19 100644 --- a/src/python_testing/TC_RVCCLEANM_2_2.py +++ b/src/python_testing/TC_RVCCLEANM_2_2.py @@ -107,16 +107,13 @@ async def test_TC_RVCCLEANM_2_2(self): self.directmodech_bit_mask = Clusters.RvcCleanMode.Bitmaps.Feature.kDirectModeChange self.endpoint = self.get_endpoint() self.is_ci = self.check_pics("PICS_SDK_CI_ONLY") + app_pid = self.matter_test_config.app_pid if self.is_ci: app_pid = self.matter_test_config.app_pid if app_pid == 0: - asserts.fail("The --app-pid flag must be set when PICS_SDK_CI_ONLY is set.c") + asserts.fail("The --app-pid flag must be set when PICS_SDK_CI_ONLY is set") self.app_pipe = self.app_pipe + str(app_pid) - asserts.assert_true(self.check_pics("RVCCLEANM.S"), "RVCCLEANM.S must be supported") - 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") - self.print_step(1, "Commissioning, already done") # Ensure that the device is in the correct state @@ -125,8 +122,10 @@ async def test_TC_RVCCLEANM_2_2(self): self.print_step( 2, "Manually put the device in a state in which the RVC Run Mode cluster’s CurrentMode attribute is set to a mode without the Idle mode tag.") + if self.is_ci: await self.send_run_change_to_mode_cmd(1) + else: self.wait_for_user_input( prompt_msg="Manually put the device in a state in which the RVC Run Mode cluster’s CurrentMode attribute is set to a mode without the Idle mode tag, and press Enter when done.") diff --git a/src/python_testing/TC_RVCRUNM_1_2.py b/src/python_testing/TC_RVCRUNM_1_2.py index 369df1ddc6424f..b18a626ec219d0 100644 --- a/src/python_testing/TC_RVCRUNM_1_2.py +++ b/src/python_testing/TC_RVCRUNM_1_2.py @@ -75,94 +75,92 @@ async def test_TC_RVCRUNM_1_2(self): self.print_step(1, "Commissioning, already done") - if self.check_pics("RVCRUNM.S.A0000"): - self.print_step(2, "Read SupportedModes attribute") - supported_modes = await self.read_mod_attribute_expect_success(endpoint=self.endpoint, attribute=attributes.SupportedModes) - - logging.info("SupportedModes: %s" % (supported_modes)) - - # Verify that the list has at least 2 and at most 255 entries - asserts.assert_greater_equal(len(supported_modes), 2, "SupportedModes must have at least 2 entries!") - asserts.assert_less_equal(len(supported_modes), 255, "SupportedModes must have at most 255 entries!") - - # Verify that each ModeOptionsStruct entry has a unique Mode field value - for m in supported_modes: - if m.mode in self.supported_modes_dut: - asserts.fail("SupportedModes must have unique mode values!") - else: - self.supported_modes_dut.append(m.mode) - - # Verify that each ModeOptionsStruct entry has a unique Label field value - labels = [] - for m in supported_modes: - if m.label in labels: - asserts.fail("SupportedModes must have unique mode label values!") - else: - labels.append(m.label) - - # Verify that each ModeOptionsStruct entry's ModeTags field has: - for m in supported_modes: - # * at least one entry - if len(m.modeTags) == 0: - asserts.fail("SupportedModes must have at least one mode tag!") - - at_least_one_common_or_run_tag = False - for t in m.modeTags: - # * the values of the Value fields that are not larger than 16 bits - if t.value > 0xFFFF or t.value < 0: - asserts.fail("Mode tag values must not be larger than 16 bits!") - - # * for each Value field: {isCommonOrDerivedOrMfgTagsVal} - is_mfg = (0x8000 <= t.value <= 0xBFFF) - if (t.value not in self.commonTags and - t.value not in self.runTags and - not is_mfg): - asserts.fail("Mode tag value is not a common tag, run tag or vendor tag!") - - # * for at least one Value field: {isCommonOrDerivedTagsVal} - if not is_mfg: - at_least_one_common_or_run_tag = True - - if not at_least_one_common_or_run_tag: - asserts.fail("At least one mode tag must be a common tag or run tag!") - - # Verify that at least one ModeOptionsStruct entry includes the Idle(0x4000) - # mode tag in the ModeTags field - at_least_one_idle_mode_tag = False - # Verify that at least one ModeOptionsStruct entry includes the Cleaning(0x4001) - # mode tag in the ModeTags field - at_least_one_cleaning_mode_tag = False - for m in supported_modes: - # Verify that each ModeOptionsStruct entry includes at most one of the following - # mode tags: Idle(0x4000), Cleaning(0x4001), _Mapping(0x4002) - count_of_idle_cleaning_or_mapping_mode_tags = 0 - for t in m.modeTags: - if t.value == Clusters.RvcRunMode.Enums.ModeTag.kIdle: - at_least_one_idle_mode_tag = True - count_of_idle_cleaning_or_mapping_mode_tags += 1 - - if t.value == Clusters.RvcRunMode.Enums.ModeTag.kCleaning: - at_least_one_cleaning_mode_tag = True - count_of_idle_cleaning_or_mapping_mode_tags += 1 - - if t.value == Clusters.RvcRunMode.Enums.ModeTag.kMapping: - count_of_idle_cleaning_or_mapping_mode_tags += 1 - - if count_of_idle_cleaning_or_mapping_mode_tags > 1: - asserts.fail("A ModeOptionsStruct entry includes more than one of the following " - "mode tags: Idle(0x4000), Cleaning(0x4001), Mapping(0x4002)!") - - asserts.assert_true(at_least_one_idle_mode_tag, - "The Supported Modes does not have an entry of Idle(0x4000)") - asserts.assert_true(at_least_one_cleaning_mode_tag, - "The Supported Modes does not have an entry of Cleaning(0x4001)") - - if self.check_pics("RVCRUNM.S.A0001"): - self.print_step(3, "Read CurrentMode attribute") - current_mode = await self.read_mod_attribute_expect_success(endpoint=self.endpoint, attribute=attributes.CurrentMode) - - logging.info("CurrentMode: %s" % (current_mode)) - asserts.assert_true(current_mode in self.supported_modes_dut, "CurrentMode is not a supported mode!") + self.print_step(2, "Read SupportedModes attribute") + supported_modes = await self.read_mod_attribute_expect_success(endpoint=self.endpoint, attribute=attributes.SupportedModes) + + logging.info("SupportedModes: %s" % (supported_modes)) + + # Verify that the list has at least 2 and at most 255 entries + asserts.assert_greater_equal(len(supported_modes), 2, "SupportedModes must have at least 2 entries!") + asserts.assert_less_equal(len(supported_modes), 255, "SupportedModes must have at most 255 entries!") + + # Verify that each ModeOptionsStruct entry has a unique Mode field value + for m in supported_modes: + if m.mode in self.supported_modes_dut: + asserts.fail("SupportedModes must have unique mode values!") + else: + self.supported_modes_dut.append(m.mode) + + # Verify that each ModeOptionsStruct entry has a unique Label field value + labels = [] + for m in supported_modes: + if m.label in labels: + asserts.fail("SupportedModes must have unique mode label values!") + else: + labels.append(m.label) + + # Verify that each ModeOptionsStruct entry's ModeTags field has: + for m in supported_modes: + # * at least one entry + if len(m.modeTags) == 0: + asserts.fail("SupportedModes must have at least one mode tag!") + + at_least_one_common_or_run_tag = False + for t in m.modeTags: + # * the values of the Value fields that are not larger than 16 bits + if t.value > 0xFFFF or t.value < 0: + asserts.fail("Mode tag values must not be larger than 16 bits!") + + # * for each Value field: {isCommonOrDerivedOrMfgTagsVal} + is_mfg = (0x8000 <= t.value <= 0xBFFF) + if (t.value not in self.commonTags and + t.value not in self.runTags and + not is_mfg): + asserts.fail("Mode tag value is not a common tag, run tag or vendor tag!") + + # * for at least one Value field: {isCommonOrDerivedTagsVal} + if not is_mfg: + at_least_one_common_or_run_tag = True + + if not at_least_one_common_or_run_tag: + asserts.fail("At least one mode tag must be a common tag or run tag!") + + # Verify that at least one ModeOptionsStruct entry includes the Idle(0x4000) + # mode tag in the ModeTags field + at_least_one_idle_mode_tag = False + # Verify that at least one ModeOptionsStruct entry includes the Cleaning(0x4001) + # mode tag in the ModeTags field + at_least_one_cleaning_mode_tag = False + for m in supported_modes: + # Verify that each ModeOptionsStruct entry includes at most one of the following + # mode tags: Idle(0x4000), Cleaning(0x4001), _Mapping(0x4002) + count_of_idle_cleaning_or_mapping_mode_tags = 0 + for t in m.modeTags: + if t.value == Clusters.RvcRunMode.Enums.ModeTag.kIdle: + at_least_one_idle_mode_tag = True + count_of_idle_cleaning_or_mapping_mode_tags += 1 + + if t.value == Clusters.RvcRunMode.Enums.ModeTag.kCleaning: + at_least_one_cleaning_mode_tag = True + count_of_idle_cleaning_or_mapping_mode_tags += 1 + + if t.value == Clusters.RvcRunMode.Enums.ModeTag.kMapping: + count_of_idle_cleaning_or_mapping_mode_tags += 1 + + if count_of_idle_cleaning_or_mapping_mode_tags > 1: + asserts.fail("A ModeOptionsStruct entry includes more than one of the following " + "mode tags: Idle(0x4000), Cleaning(0x4001), Mapping(0x4002)!") + + asserts.assert_true(at_least_one_idle_mode_tag, + "The Supported Modes does not have an entry of Idle(0x4000)") + asserts.assert_true(at_least_one_cleaning_mode_tag, + "The Supported Modes does not have an entry of Cleaning(0x4001)") + + self.print_step(3, "Read CurrentMode attribute") + current_mode = await self.read_mod_attribute_expect_success(endpoint=self.endpoint, attribute=attributes.CurrentMode) + + logging.info("CurrentMode: %s" % (current_mode)) + asserts.assert_true(current_mode in self.supported_modes_dut, "CurrentMode is not a supported mode!") if __name__ == "__main__": diff --git a/src/python_testing/TC_RVCRUNM_2_1.py b/src/python_testing/TC_RVCRUNM_2_1.py index 802c87fad52f0f..6afe436e70e511 100644 --- a/src/python_testing/TC_RVCRUNM_2_1.py +++ b/src/python_testing/TC_RVCRUNM_2_1.py @@ -90,15 +90,23 @@ async def test_TC_RVCRUNM_2_1(self): if self.is_ci: app_pid = self.matter_test_config.app_pid if app_pid == 0: - asserts.fail("The --app-pid flag must be set when PICS_SDK_CI_ONLY is set.c") + asserts.fail("The --app-pid flag must be set when PICS_SDK_CI_ONLY is set") self.app_pipe = self.app_pipe + str(app_pid) - 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") - asserts.assert_true(self.check_pics("RVCRUNM.S.C00.Rsp"), "RVCRUNM.S.C00.Rsp must be supported") - asserts.assert_true(self.check_pics("RVCRUNM.S.C01.Tx"), "RVCRUNM.S.C01.Tx must be supported") + RVCRun_cluster = Clusters.RvcRunMode + attributes = RVCRun_cluster.Attributes - attributes = Clusters.RvcRunMode.Attributes + # Gathering Accepted and Generated Commands and associated ids + commands = RVCRun_cluster.Commands + RVCRun_gencmd_list = attributes.GeneratedCommandList + generated_cmd_list = await self.read_single_attribute_check_success(endpoint=self.endpoint, cluster=RVCRun_cluster, attribute=RVCRun_gencmd_list) + chg_rsp_cmd_id = commands.ChangeToModeResponse.command_id + + if not await self.command_guard(endpoint=self.endpoint, command=commands.ChangeToMode): + asserts.fail("Change To Mode receiving commands needs to be supported") + + if chg_rsp_cmd_id not in generated_cmd_list: + asserts.fail("Change To Mode Response to send commands needs to be supported") self.print_step(1, "Commissioning, already done") diff --git a/src/python_testing/TC_RVCRUNM_2_2.py b/src/python_testing/TC_RVCRUNM_2_2.py index 55c5a6ef17d61c..5068e075e636be 100644 --- a/src/python_testing/TC_RVCRUNM_2_2.py +++ b/src/python_testing/TC_RVCRUNM_2_2.py @@ -135,21 +135,21 @@ async def test_TC_RVCRUNM_2_2(self): self.directmodech_bit_mask = Clusters.RvcRunMode.Bitmaps.Feature.kDirectModeChange self.endpoint = self.get_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'] self.mode_b = self.matter_test_config.global_test_params['PIXIT.RVCRUNM.MODE_B'] + self.is_ci = self.check_pics("PICS_SDK_CI_ONLY") if self.is_ci: app_pid = self.matter_test_config.app_pid if app_pid == 0: - asserts.fail("The --app-pid flag must be set when PICS_SDK_CI_ONLY is set.c") + asserts.fail("The --app-pid flag must be set when PICS_SDK_CI_ONLY is set") self.app_pipe = self.app_pipe + str(app_pid) - asserts.assert_true(self.check_pics("RVCRUNM.S"), "RVCRUNM.S must be supported") - # I think that the following PICS should be listed in the preconditions section in the test plan as if either - # of these PICS is not supported, this test would not be useful. - 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") - asserts.assert_true(self.check_pics("RVCRUNM.S.C00.Rsp"), "RVCRUNM.S.C00.Rsp must be supported") + RVCRun_cluster = Clusters.RvcRunMode + commands = RVCRun_cluster.Commands + + if not await self.command_guard(endpoint=self.endpoint, command=commands.ChangeToMode): + asserts.fail("Change To Mode receiving commands needs to be supported") + asserts.assert_true(self.check_pics("RVCRUNM.S.M.CAN_MANUALLY_CONTROLLED"), "RVCRUNM.S.M.CAN_MANUALLY_CONTROLLED must be supported")