Skip to content

Commit

Permalink
Possible fix for mts issue #228:
Browse files Browse the repository at this point in the history
- Removed PICS from python RVC Clean and RVC Run tests
- Replaced with commands and attributes gathered from DUT.
  • Loading branch information
j-ororke committed Aug 21, 2024
1 parent 8b97b28 commit 1067460
Show file tree
Hide file tree
Showing 6 changed files with 132 additions and 51 deletions.
14 changes: 9 additions & 5 deletions src/python_testing/TC_RVCCLEANM_1_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,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]:
Expand All @@ -62,11 +62,16 @@ def pics_TC_RVCCLEANM_1_2(self) -> list[str]:
async def test_TC_RVCCLEANM_1_2(self):
self.endpoint = self.matter_test_config.endpoint

attributes = Clusters.RvcCleanMode.Attributes
RVCClean_cluster = Clusters.RvcCleanMode
attributes = RVCClean_cluster.Attributes
RVCClean_attr_list = attributes.AttributeList
attribute_list = await self.read_single_attribute_check_success(endpoint=self.endpoint, cluster=RVCClean_cluster, attribute=RVCClean_attr_list)
supported_modes_attr_id = attributes.SupportedModes.attribute_id
current_mode_attr_id = attributes.CurrentMode.attribute_id

self.print_step(1, "Commissioning, already done")

if self.check_pics("RVCCLEANM.S.A0000"):
if supported_modes_attr_id in attribute_list:
self.print_step(2, "Read SupportedModes attribute")
supported_modes = await self.read_mod_attribute_expect_success(endpoint=self.endpoint, attribute=attributes.SupportedModes)

Expand Down Expand Up @@ -129,13 +134,12 @@ 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"):
if current_mode_attr_id in attribute_list:
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__":
default_matter_test_main()
43 changes: 32 additions & 11 deletions src/python_testing/TC_RVCCLEANM_2_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,19 +89,40 @@ async def test_TC_RVCCLEANM_2_1(self):
self.endpoint = self.matter_test_config.endpoint
self.mode_ok = self.matter_test_config.global_test_params['PIXIT.RVCCLEANM.MODE_CHANGE_OK']
self.mode_fail = self.matter_test_config.global_test_params['PIXIT.RVCCLEANM.MODE_CHANGE_FAIL']
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")
app_pid = self.matter_test_config.app_pid
if app_pid != 0:
self.is_ci = True
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")

attributes = Clusters.RvcCleanMode.Attributes
RVCClean_cluster = Clusters.RvcCleanMode

# Gathering Available Attributes and associated ids
attributes = RVCClean_cluster.Attributes
RVCClean_attr_list = attributes.AttributeList
attribute_list = await self.read_single_attribute_check_success(endpoint=self.endpoint, cluster=RVCClean_cluster, attribute=RVCClean_attr_list)
supported_modes_attr_id = attributes.SupportedModes.attribute_id
current_mode_attr_id = attributes.CurrentMode.attribute_id

# Gathering Accepted and Generated Commands and associated ids
commands = RVCClean_cluster.Commands
RVCClean_accptcmd_list = attributes.AcceptedCommandList
RVCClean_gencmd_list = attributes.GeneratedCommandList
accepted_cmd_list = await self.read_single_attribute_check_success(endpoint=self.endpoint, cluster=RVCClean_cluster, attribute=RVCClean_accptcmd_list)
generated_cmd_list = await self.read_single_attribute_check_success(endpoint=self.endpoint, cluster=RVCClean_cluster, attribute=RVCClean_gencmd_list)
chg_mode_cmd_id = commands.ChangeToMode.command_id
chg_rsp_cmd_id = commands.ChangeToModeResponse.command_id

if supported_modes_attr_id not in attribute_list:
asserts.fail("supported modes needs to be supported attribute")

if current_mode_attr_id not in attribute_list:
asserts.fail("Current mode needs to be supported attribute")

if chg_mode_cmd_id not in accepted_cmd_list:
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")

Expand Down
28 changes: 19 additions & 9 deletions src/python_testing/TC_RVCCLEANM_2_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def print_instruction(self, step_number, instruction):
def pics_TC_RVCCLEANM_2_2(self) -> list[str]:
return ["RVCCLEANM.S"]

# Sends and out-of-band command to the rvc-app
# Sends an out-of-band command to the rvc-app
def write_to_app_pipe(self, command):
with open(self.app_pipe, "w") as app_pipe:
app_pipe.write(command + "\n")
Expand All @@ -108,16 +108,24 @@ async def test_TC_RVCCLEANM_2_2(self):
# 0x8000 corresponds to 16 bit DIRECTMODECH Feature map
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:
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")
app_pid = self.matter_test_config.app_pid
if app_pid != 0:
self.is_ci = True
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")
# replaces the RVCRUNM attributes from PICS file
RVCRun_cluster = Clusters.RvcRunMode
attributes = Clusters.RvcRunMode.Attributes
RVCRun_attr_list = attributes.AttributeList
attribute_list = await self.read_single_attribute_check_success(endpoint=self.endpoint, cluster=RVCRun_cluster, attribute=RVCRun_attr_list)
supported_modes_attr_id = attributes.SupportedModes.attribute_id
current_mode_attr_id = attributes.CurrentMode.attribute_id

if supported_modes_attr_id not in attribute_list:
asserts.fail("Supported modes needs to be supported attribute")

if current_mode_attr_id not in attribute_list:
asserts.fail("Current mode needs to be supported attribute")

self.print_step(1, "Commissioning, already done")

Expand All @@ -127,8 +135,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.")
Expand Down
9 changes: 7 additions & 2 deletions src/python_testing/TC_RVCRUNM_1_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,16 @@ def pics_TC_RVCRUNM_1_2(self) -> list[str]:
async def test_TC_RVCRUNM_1_2(self):
self.endpoint = self.matter_test_config.endpoint

RVCRun_cluster = Clusters.RvcRunMode
attributes = Clusters.RvcRunMode.Attributes
RVCRun_attr_list = attributes.AttributeList
attribute_list = await self.read_single_attribute_check_success(endpoint=self.endpoint, cluster=RVCRun_cluster, attribute=RVCRun_attr_list)
supported_modes_attr_id = attributes.SupportedModes.attribute_id
current_mode_attr_id = attributes.CurrentMode.attribute_id

self.print_step(1, "Commissioning, already done")

if self.check_pics("RVCRUNM.S.A0000"):
if supported_modes_attr_id in attribute_list:
self.print_step(2, "Read SupportedModes attribute")
supported_modes = await self.read_mod_attribute_expect_success(endpoint=self.endpoint, attribute=attributes.SupportedModes)

Expand Down Expand Up @@ -148,7 +153,7 @@ async def test_TC_RVCRUNM_1_2(self):
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"):
if current_mode_attr_id in attribute_list:
self.print_step(3, "Read CurrentMode attribute")
current_mode = await self.read_mod_attribute_expect_success(endpoint=self.endpoint, attribute=attributes.CurrentMode)

Expand Down
41 changes: 29 additions & 12 deletions src/python_testing/TC_RVCRUNM_2_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,19 +84,36 @@ async def test_TC_RVCRUNM_2_1(self):
self.endpoint = self.matter_test_config.endpoint
self.mode_ok = self.matter_test_config.global_test_params['PIXIT.RVCRUNM.MODE_CHANGE_OK']
self.mode_fail = self.matter_test_config.global_test_params['PIXIT.RVCRUNM.MODE_CHANGE_FAIL']
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")
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")

attributes = Clusters.RvcRunMode.Attributes
RVCRun_cluster = Clusters.RvcRunMode

# Gathering Available Attributes and associated ids
attributes = RVCRun_cluster.Attributes
RVCRun_attr_list = attributes.AttributeList
attribute_list = await self.read_single_attribute_check_success(endpoint=self.endpoint, cluster=RVCRun_cluster, attribute=RVCRun_attr_list)
supported_modes_attr_id = attributes.SupportedModes.attribute_id
current_mode_attr_id = attributes.CurrentMode.attribute_id

# Gathering Accepted and Generated Commands and associated ids
commands = RVCRun_cluster.Commands
RVCRun_accptcmd_list = attributes.AcceptedCommandList
RVCRun_gencmd_list = attributes.GeneratedCommandList
accepted_cmd_list = await self.read_single_attribute_check_success(endpoint=self.endpoint, cluster=RVCRun_cluster, attribute=RVCRun_accptcmd_list)
generated_cmd_list = await self.read_single_attribute_check_success(endpoint=self.endpoint, cluster=RVCRun_cluster, attribute=RVCRun_gencmd_list)
chg_mode_cmd_id = commands.ChangeToMode.command_id
chg_rsp_cmd_id = commands.ChangeToModeResponse.command_id

if supported_modes_attr_id not in attribute_list:
asserts.fail("supported modes needs to be supported attribute")

if current_mode_attr_id not in attribute_list:
asserts.fail("Current mode needs to be supported attribute")

if chg_mode_cmd_id not in accepted_cmd_list:
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")

Expand Down
48 changes: 36 additions & 12 deletions src/python_testing/TC_RVCRUNM_2_2.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,23 +135,47 @@ async def test_TC_RVCRUNM_2_2(self):
# 0x8000 corresponds to 16 bit DIRECTMODECH Feature map
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']
self.mode_b = self.matter_test_config.global_test_params['PIXIT.RVCRUNM.MODE_B']
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")
app_pid = self.matter_test_config.app_pid
if app_pid != 0:
self.is_ci = True
self.app_pipe = self.app_pipe + str(app_pid)


app_pid = self.matter_test_config.app_pid
if app_pid != 0:
self.is_ci = True
self.app_pipe = self.app_pipe + str(app_pid)

RVCRun_cluster = Clusters.RvcRunMode

# Gathering Available Attributes and associated ids
attributes = RVCRun_cluster.Attributes
RVCRun_attr_list = attributes.AttributeList
attribute_list = await self.read_single_attribute_check_success(endpoint=self.endpoint, cluster=RVCRun_cluster, attribute=RVCRun_attr_list)
supported_modes_attr_id = attributes.SupportedModes.attribute_id
current_mode_attr_id = attributes.CurrentMode.attribute_id

# Gathering Accepted and Generated Commands and associated ids
commands = RVCRun_cluster.Commands
RVCRun_accptcmd_list = attributes.AcceptedCommandList
RVCRun_gencmd_list = attributes.GeneratedCommandList
accepted_cmd_list = await self.read_single_attribute_check_success(endpoint=self.endpoint, cluster=RVCRun_cluster, attribute=RVCRun_accptcmd_list)
generated_cmd_list = await self.read_single_attribute_check_success(endpoint=self.endpoint, cluster=RVCRun_cluster, attribute=RVCRun_gencmd_list)
chg_mode_cmd_id = commands.ChangeToMode.command_id

if supported_modes_attr_id not in attribute_list:
asserts.fail("Supported modes needs to be supported attribute")

if current_mode_attr_id not in attribute_list:
asserts.fail("Current mode needs to be supported attribute")

if chg_mode_cmd_id not in accepted_cmd_list:
asserts.fail("Change To Mode receiving commands needs to be supported")

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")
asserts.assert_true(self.check_pics("RVCRUNM.S.M.CAN_MANUALLY_CONTROLLED"),
"RVCRUNM.S.M.CAN_MANUALLY_CONTROLLED must be supported")
"RVCRUNM.S.M.CAN_MANUALLY_CONTROLLED must be supported")

# Starting the test steps
self.print_step(1, "Commissioning, already done")
Expand Down

0 comments on commit 1067460

Please sign in to comment.