Skip to content

Commit dec73c6

Browse files
RVC DirectModeChange Feature Update for RVCCLEANM and RVCRUNM (#34994)
* 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 * Python Script TC_RVCOPSTATE_2_4.py * Updated TC_RVCOPSTATE_2_4.py with steps numbers update * Restyled by autopep8 * 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 * Python Script TC_RVCOPSTATE_2_4.py * Updated TC_RVCOPSTATE_2_4.py with steps numbers update * Restyled by autopep8 * 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 * Restyled by autopep8 * Updated CI PICS Value For TC_RVCOPSTATE_2_4.py * Updated PICS.yaml For TC_RVCOPSTATE_2_4.py * Updated CI PICS file by removing RVCOPSTATE.S.C128.Rsp * Updated RVC PICS value at location examples/rvc-app/rvc-common/pics/rvc-app-pics-values --------- Co-authored-by: Restyled.io <commits@restyled.io>
1 parent 96ee61e commit dec73c6

File tree

6 files changed

+72
-23
lines changed

6 files changed

+72
-23
lines changed

examples/rvc-app/rvc-common/pics/rvc-app-pics-values

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ RVCOPSTATE.S.E01=1
2020
RVCOPSTATE.S.C00.Rsp=1
2121
RVCOPSTATE.S.C03.Rsp=1
2222
RVCOPSTATE.S.C04.Tx=1
23-
RVCOPSTATE.S.C128.Rsp=1
23+
RVCOPSTATE.S.C80.Rsp=1
2424
RVCOPSTATE.S.M.ST_STOPPED=1
2525
RVCOPSTATE.S.M.ST_RUNNING=1
2626
RVCOPSTATE.S.M.ST_PAUSED=1
@@ -77,4 +77,4 @@ SEAR.S.M.HAS_MANUAL_SKIP_STATE_CONTROL=1
7777
SEAR.S.M.INVALID_STATE_FOR_SKIP=1
7878
SEAR.S.M.NO_SELAREA_FOR_SKIP=1
7979
SEAR.S.M.VALID_STATE_FOR_SKIP=1
80-
SEAR.S.M.HAS_MANUAL_OPERATING_STATE_CONTROL=1
80+
SEAR.S.M.HAS_MANUAL_OPERATING_STATE_CONTROL=1

src/app/tests/suites/certification/PICS.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9740,7 +9740,7 @@ PICS:
97409740
id: RVCOPSTATE.S.C03.Rsp
97419741

97429742
- label: "Does the device implement receiving the GoHome command?"
9743-
id: RVCOPSTATE.S.C128.Rsp
9743+
id: RVCOPSTATE.S.C80.Rsp
97449744

97459745
#Commands generated
97469746
- label:

src/app/tests/suites/certification/ci-pics-values

+2-1
Original file line numberDiff line numberDiff line change
@@ -2532,7 +2532,7 @@ RVCOPSTATE.S.C01.Rsp=0
25322532
RVCOPSTATE.S.C02.Rsp=0
25332533
RVCOPSTATE.S.C03.Rsp=1
25342534
RVCOPSTATE.S.C04.Tx=1
2535-
RVCOPSTATE.S.C128.Rsp=1
2535+
RVCOPSTATE.S.C80.Rsp=1
25362536
RVCOPSTATE.S.M.ST_STOPPED=1
25372537
RVCOPSTATE.S.M.ST_RUNNING=1
25382538
RVCOPSTATE.S.M.ST_PAUSED=1
@@ -2618,6 +2618,7 @@ PIXIT.RVCRUNM.MODE_CHANGE_OK=0
26182618
# RVCOPSTATE.S.C02.Rsp=0
26192619
# RVCOPSTATE.S.C03.Rsp=1
26202620
# RVCOPSTATE.S.C04.Tx=1
2621+
# RVCOPSTATE.S.C80.Rsp=1
26212622
# RVCOPSTATE.S.C128.Rsp=1
26222623
# RVCOPSTATE.C.C00.Tx=1
26232624
# RVCOPSTATE.C.C01.Tx=1

src/python_testing/TC_RVCCLEANM_2_2.py

+33-5
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,22 @@
2727
# 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
2828
# === END CI TEST ARGUMENTS ===
2929

30+
import enum
3031
from time import sleep
3132

3233
import chip.clusters as Clusters
33-
from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main
34+
from matter_testing_support import MatterBaseTest, async_test_body, default_matter_test_main, type_matches
3435
from mobly import asserts
3536

3637

38+
class RvcStatusEnum(enum.IntEnum):
39+
# TODO remove this class once InvalidInMode response code is implemented in python SDK
40+
Success = 0x0
41+
UnsupportedMode = 0x1
42+
GenericFailure = 0x2
43+
InvalidInMode = 0x3
44+
45+
3746
class TC_RVCCLEANM_2_2(MatterBaseTest):
3847

3948
def __init__(self, *args):
@@ -64,6 +73,11 @@ async def read_clean_supported_modes(self) -> Clusters.Objects.RvcCleanMode.Attr
6473
Clusters.RvcCleanMode.Attributes.SupportedModes)
6574
return ret
6675

76+
async def read_feature_map_attribute(self):
77+
ret = await self.read_mod_attribute_expect_success(Clusters.RvcCleanMode,
78+
Clusters.RvcCleanMode.Attributes.FeatureMap)
79+
return ret
80+
6781
async def send_clean_change_to_mode_cmd(self, newMode) -> Clusters.Objects.RvcCleanMode.Commands.ChangeToModeResponse:
6882
ret = await self.send_single_cmd(cmd=Clusters.Objects.RvcCleanMode.Commands.ChangeToMode(newMode=newMode), endpoint=self.endpoint)
6983
return ret
@@ -90,6 +104,9 @@ def write_to_app_pipe(self, command):
90104

91105
@async_test_body
92106
async def test_TC_RVCCLEANM_2_2(self):
107+
# TODO Replace 0x8000 with python object of RVCCLEAN FEATURE bit map when implemented
108+
# 0x8000 corresponds to 16 bit DIRECTMODECH Feature map
109+
self.directmodech_bit_mask = 0x8000
93110
self.endpoint = self.matter_test_config.endpoint
94111
self.is_ci = self.check_pics("PICS_SDK_CI_ONLY")
95112
if self.is_ci:
@@ -157,11 +174,22 @@ async def test_TC_RVCCLEANM_2_2(self):
157174
self.new_clean_mode_th = mode
158175
break
159176

160-
self.print_step(7, "Send ChangeToMode command")
177+
self.print_step("7a", "Read FeatureMap Attribute")
178+
feature_map = await self.read_feature_map_attribute()
179+
directmode_enabled = feature_map & self.directmodech_bit_mask
180+
181+
self.print_step("7b", "Send ChangeToMode command")
161182
response = await self.send_clean_change_to_mode_cmd(self.new_clean_mode_th)
162-
asserts.assert_equal(response.status, 3,
163-
"The response should contain a ChangeToModeResponse command "
164-
"with the Status set to InvalidInMode(0x03).")
183+
asserts.assert_true(type_matches(response, Clusters.RvcCleanMode.Commands.ChangeToModeResponse),
184+
"The response should ChangeToModeResponse command")
185+
if directmode_enabled:
186+
asserts.assert_equal(response.status, RvcStatusEnum.Success,
187+
"The response should contain a ChangeToModeResponse command "
188+
"with the Status set to Success(0x0).")
189+
else:
190+
asserts.assert_equal(response.status, RvcStatusEnum.InvalidInMode,
191+
"The response should contain a ChangeToModeResponse command "
192+
"with the Status set to InvalidInMode(0x03).")
165193

166194

167195
if __name__ == "__main__":

src/python_testing/TC_RVCOPSTATE_2_4.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ async def test_TC_RVCOPSTATE_2_4(self):
114114

115115
asserts.assert_true(self.check_pics("RVCOPSTATE.S.A0004"), "RVCOPSTATE.S.A0004 must be supported")
116116
asserts.assert_true(self.check_pics("RVCOPSTATE.S.C04.Tx"), "RVCOPSTATE.S.C04.Tx must be supported")
117-
asserts.assert_true(self.check_pics("RVCOPSTATE.S.C128.Rsp"), "RVCOPSTATE.S.C128.Rsp must be supported")
117+
asserts.assert_true(self.check_pics("RVCOPSTATE.S.C80.Rsp"), "RVCOPSTATE.S.C80.Rsp must be supported")
118118

119119
op_states = Clusters.OperationalState.Enums.OperationalStateEnum
120120
rvc_op_states = Clusters.RvcOperationalState.Enums.OperationalStateEnum
@@ -170,16 +170,16 @@ async def test_TC_RVCOPSTATE_2_4(self):
170170

171171
if self.check_pics("PICS_M_ST_SEEKING_CHARGER"):
172172
step_name = "Manually put the device in the SEEKING CHARGER operational state"
173-
self.print_step(8, step_name)
173+
self.print_step(11, step_name)
174174
if self.is_ci:
175175
await self.send_run_change_to_mode_cmd(rvc_app_run_mode_cleaning)
176176
await self.send_run_change_to_mode_cmd(rvc_app_run_mode_idle)
177177
else:
178178
self.wait_for_user_input(prompt_msg=f"{step_name}, and press Enter when ready.")
179179

180-
await self.read_operational_state_with_check(9, rvc_op_states.kSeekingCharger)
180+
await self.read_operational_state_with_check(12, rvc_op_states.kSeekingCharger)
181181

182-
await self.send_go_home_cmd_with_check(10, op_errors.kNoError)
182+
await self.send_go_home_cmd_with_check(13, op_errors.kNoError)
183183

184184

185185
if __name__ == "__main__":

src/python_testing/TC_RVCRUNM_2_2.py

+30-10
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
# 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
2828
# === END CI TEST ARGUMENTS ===
2929

30+
import enum
3031
from time import sleep
3132

3233
import chip.clusters as Clusters
@@ -38,17 +39,25 @@
3839
# --int-arg PIXIT.RVCRUNM.MODE_A:<mode id> PIXIT.RVCRUNM.MODE_B:<mode id>
3940

4041

42+
class RvcStatusEnum(enum.IntEnum):
43+
# TODO remove this class once InvalidInMode response code is implemented in python SDK
44+
Success = 0x0
45+
UnsupportedMode = 0x1
46+
GenericFailure = 0x2
47+
InvalidInMode = 0x3
48+
49+
4150
def error_enum_to_text(error_enum):
4251
try:
4352
return f'{Clusters.RvcRunMode.Enums.ModeTag(error_enum).name} 0x{error_enum:02x}'
4453
except AttributeError:
45-
if error_enum == 0:
54+
if error_enum == RvcStatusEnum.Success:
4655
return "Success(0x00)"
47-
elif error_enum == 0x1:
56+
elif error_enum == RvcStatusEnum.UnsupportedMode:
4857
return "UnsupportedMode(0x01)"
49-
elif error_enum == 0x2:
58+
elif error_enum == RvcStatusEnum.GenericFailure:
5059
return "GenericFailure(0x02)"
51-
elif error_enum == 0x3:
60+
elif error_enum == RvcStatusEnum.InvalidInMode:
5261
return "InvalidInMode(0x03)"
5362

5463
raise AttributeError("Unknown Enum value")
@@ -122,6 +131,9 @@ async def test_TC_RVCRUNM_2_2(self):
122131
"PIXIT.RVCRUNM.MODE_A:<mode id> \n"
123132
"PIXIT.RVCRUNM.MODE_B:<mode id>")
124133

134+
# TODO Replace 0x8000 with python object of RVCRUN FEATURE bit when implemented
135+
# 0x8000 corresponds to 16 bit DIRECTMODECH Feature map
136+
self.directmodech_bit_mask = 0x8000
125137
self.endpoint = self.matter_test_config.endpoint
126138
self.is_ci = self.check_pics("PICS_SDK_CI_ONLY")
127139
self.mode_a = self.matter_test_config.global_test_params['PIXIT.RVCRUNM.MODE_A']
@@ -193,15 +205,23 @@ async def test_TC_RVCRUNM_2_2(self):
193205
asserts.assert_true(idle_tag_present, "The device must be in a mode with the Idle (0x4000) mode tag.")
194206

195207
self.print_step(5, "Send ChangeToMode MODE_A command")
196-
await self.send_change_to_mode_with_check(self.mode_a, 0)
208+
await self.send_change_to_mode_with_check(self.mode_a, RvcStatusEnum.Success)
197209
# This step is not described in the test plan, but it ought to be
198210
await self.read_current_mode_with_check(self.mode_a)
199211

200-
self.print_step(6, "Send ChangeToMode MODE_B command")
201-
await self.send_change_to_mode_with_check(self.mode_b, 3)
212+
self.print_step("6a", "Read Attribute FeatureMap")
213+
feature_map = await self.read_mod_attribute_expect_success(cluster=Clusters.RvcRunMode,
214+
attribute=Clusters.RvcRunMode.Attributes.FeatureMap)
215+
directmode_enabled = feature_map & self.directmodech_bit_mask
216+
217+
self.print_step('6b', "Send ChangeToMode MODE_B command")
218+
if directmode_enabled:
219+
await self.send_change_to_mode_with_check(self.mode_b, RvcStatusEnum.Success)
220+
else:
221+
await self.send_change_to_mode_with_check(self.mode_b, RvcStatusEnum.InvalidInMode)
202222

203223
self.print_step(7, "Send ChangeToMode idle command")
204-
await self.send_change_to_mode_with_check(self.idle_mode_dut, 0)
224+
await self.send_change_to_mode_with_check(self.idle_mode_dut, RvcStatusEnum.Success)
205225
# This step is not described in the test plan, but it ought to be
206226
await self.read_current_mode_with_check(self.idle_mode_dut)
207227

@@ -228,12 +248,12 @@ async def test_TC_RVCRUNM_2_2(self):
228248
"Expected RVCOPSTATE's OperationalState attribute to be one of Stopped(0x00), Paused(0x02), Charging(0x41) or Docked(0x42)")
229249

230250
self.print_step(11, "Send ChangeToMode MODE_B command")
231-
await self.send_change_to_mode_with_check(self.mode_b, 0)
251+
await self.send_change_to_mode_with_check(self.mode_b, RvcStatusEnum.Success)
232252
# This step is not described in the test plan, but it ought to be
233253
await self.read_current_mode_with_check(self.mode_b)
234254

235255
self.print_step(12, "Send ChangeToMode idle command")
236-
await self.send_change_to_mode_with_check(self.idle_mode_dut, 0)
256+
await self.send_change_to_mode_with_check(self.idle_mode_dut, RvcStatusEnum.Success)
237257
# This step is not described in the test plan, but it ought to be
238258
await self.read_current_mode_with_check(self.idle_mode_dut)
239259

0 commit comments

Comments
 (0)