Skip to content

Commit 1075730

Browse files
vivien-applepull[bot]
authored andcommitted
[matter_yamltests] Allow endpoint, cluster, command, attribute, event to use a variable (#26678)
1 parent b90e1b3 commit 1075730

File tree

8 files changed

+214
-187
lines changed

8 files changed

+214
-187
lines changed

scripts/py_matter_yamltests/matter_yamltests/parser.py

+10
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,16 @@ def __init__(self, test: _TestStepWithPlaceholders, step_index: int, runtime_con
482482
self._test.run_if)
483483
self._test.event_number = self._config_variable_substitution(
484484
self._test.event_number)
485+
self._test.cluster = self._config_variable_substitution(
486+
self._test.cluster)
487+
self._test.command = self._config_variable_substitution(
488+
self._test.command)
489+
self._test.attribute = self._config_variable_substitution(
490+
self._test.attribute)
491+
self._test.event = self._config_variable_substitution(
492+
self._test.event)
493+
self._test.endpoint = self._config_variable_substitution(
494+
self._test.endpoint)
485495
test.update_arguments(self.arguments)
486496
test.update_responses(self.responses)
487497

scripts/py_matter_yamltests/matter_yamltests/yaml_loader.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def __check_test_step(self, content):
9090
'nodeId': int,
9191
'runIf': str, # Should be a variable.
9292
'groupId': int,
93-
'endpoint': int,
93+
'endpoint': (int, str), # Can be a variable
9494
'cluster': str,
9595
'attribute': str,
9696
'command': str,

scripts/py_matter_yamltests/test_yaml_loader.py

+17-1
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,6 @@ def test_key_tests_step_int_keys(self):
249249
keys = [
250250
'nodeId',
251251
'groupId',
252-
'endpoint',
253252
'minInterval',
254253
'maxInterval',
255254
'timedInteractionTimeoutMs',
@@ -307,6 +306,23 @@ def test_key_tests_step_response_key(self):
307306
x = content.format(value=value)
308307
self.assertRaises(TestStepInvalidTypeError, load, x)
309308

309+
def test_key_tests_step_endpoint_number_key(self):
310+
load = YamlLoader().load
311+
312+
content = ('tests:\n'
313+
' - endpoint: {value}')
314+
315+
_, _, _, _, tests = load(content.format(value=1))
316+
self.assertEqual(tests, [{'endpoint': 1}])
317+
318+
_, _, _, _, tests = load(content.format(value='TestKey'))
319+
self.assertEqual(tests, [{'endpoint': 'TestKey'}])
320+
321+
wrong_values = self._get_wrong_values([str, int], spaces=6)
322+
for value in wrong_values:
323+
x = content.format(value=value)
324+
self.assertRaises(TestStepInvalidTypeError, load, x)
325+
310326
def test_key_tests_step_event_number_key(self):
311327
load = YamlLoader().load
312328

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

+8-8
Original file line numberDiff line numberDiff line change
@@ -136,35 +136,35 @@ tests:
136136
command: "readAttribute"
137137
attribute: "PacketRxCount"
138138
response:
139-
saveAs: PacketRxCount
139+
saveAs: PacketRxCountValue
140140

141141
- label: "TH reads PacketTxCount attribute value from DUT"
142142
PICS: DGETH.S.A0003
143143
command: "readAttribute"
144144
attribute: "PacketTxCount"
145145
response:
146-
saveAs: PacketTxCount
146+
saveAs: PacketTxCountValue
147147

148148
- label: "TH reads TxErrCount attribute value from DUT"
149149
PICS: DGETH.S.A0004
150150
command: "readAttribute"
151151
attribute: "TxErrCount"
152152
response:
153-
saveAs: TxErrCount
153+
saveAs: TxErrCountValue
154154

155155
- label: "TH reads CollisionCount attribute value from DUT"
156156
PICS: DGETH.S.A0005
157157
command: "readAttribute"
158158
attribute: "CollisionCount"
159159
response:
160-
saveAs: CollisionCount
160+
saveAs: CollisionCountValue
161161

162162
- label: "TH reads OverrunCount attribute value from DUT"
163163
PICS: DGETH.S.A0006
164164
command: "readAttribute"
165165
attribute: "OverrunCount"
166166
response:
167-
saveAs: OverrunCount
167+
saveAs: OverrunCountValue
168168

169169
#issue #13648
170170
- label: "Sends ResetCounts command"
@@ -215,20 +215,20 @@ tests:
215215
attribute: "TxErrCount"
216216
response:
217217
constraints:
218-
maxValue: TxErrCount
218+
maxValue: TxErrCountValue
219219

220220
- label: "TH reads CollisionCount attribute value from DUT"
221221
PICS: DGETH.S.A0005
222222
command: "readAttribute"
223223
attribute: "CollisionCount"
224224
response:
225225
constraints:
226-
maxValue: CollisionCount
226+
maxValue: CollisionCountValue
227227

228228
- label: "TH reads OverrunCount attribute value from DUT"
229229
PICS: DGETH.S.A0006
230230
command: "readAttribute"
231231
attribute: "OverrunCount"
232232
response:
233233
constraints:
234-
maxValue: OverrunCount
234+
maxValue: OverrunCountValue

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

+22-21
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ tests:
4747
command: "readAttribute"
4848
attribute: "MinSetpointDeadBand"
4949
response:
50-
saveAs: MinSetpointDeadBand
50+
saveAs: MinSetpointDeadBandValue
5151

5252
- label:
5353
"Saving value for comparision in step 6 read AbsMaxCoolSetpointLimit
@@ -65,7 +65,7 @@ tests:
6565
command: "readAttribute"
6666
attribute: "MinCoolSetpointLimit"
6767
response:
68-
saveAs: MinCoolSetpointLimit
68+
saveAs: MinCoolSetpointLimitValue
6969

7070
- label:
7171
"Saving value for comparision in step 17 read MaxCoolSetpointLimit
@@ -74,14 +74,14 @@ tests:
7474
command: "readAttribute"
7575
attribute: "MaxCoolSetpointLimit"
7676
response:
77-
saveAs: MaxCoolSetpointLimit
77+
saveAs: MaxCoolSetpointLimitValue
7878

7979
- label: "Saving value for comparision in step 17 read MaxHeatSetpointLimit"
8080
PICS: TSTAT.S.A0016
8181
command: "readAttribute"
8282
attribute: "MaxHeatSetpointLimit"
8383
response:
84-
saveAs: MaxHeatSetpointLimit
84+
saveAs: MaxHeatSetpointLimitValue
8585

8686
- label:
8787
"Saving value for comparision in step 13 read attribute
@@ -90,7 +90,7 @@ tests:
9090
command: "readAttribute"
9191
attribute: "OccupiedCoolingSetpoint"
9292
response:
93-
saveAs: OccupiedCoolingSetpoint
93+
saveAs: OccupiedCoolingSetpointValue
9494

9595
- label:
9696
"Saving value for comparision in step 15 read attribute
@@ -99,7 +99,7 @@ tests:
9999
command: "readAttribute"
100100
attribute: "AbsMinHeatSetpointLimit"
101101
response:
102-
saveAs: AbsMinHeat
102+
saveAs: AbsMinHeatValue
103103

104104
- label:
105105
"Saving value for comparision in step 15 read attribute
@@ -108,7 +108,7 @@ tests:
108108
command: "readAttribute"
109109
attribute: "AbsMaxHeatSetpointLimit"
110110
response:
111-
saveAs: AbsMaxHeat
111+
saveAs: AbsMaxHeatValue
112112

113113
- label:
114114
"Saving value for comparision in step 16 read
@@ -117,7 +117,7 @@ tests:
117117
command: "readAttribute"
118118
attribute: "UnoccupiedCoolingSetpoint"
119119
response:
120-
saveAs: UnoccupiedCoolingSetpoint
120+
saveAs: UnoccupiedCoolingSetpointValue
121121

122122
- label: "Reads mandatory attributes from DUT: LocalTemperature"
123123
command: "readAttribute"
@@ -157,7 +157,7 @@ tests:
157157
response:
158158
constraints:
159159
type: int16s
160-
maxValue: AbsMinCoolSetpointLimitStep5 - MinSetpointDeadBand
160+
maxValue: AbsMinCoolSetpointLimitStep5 - MinSetpointDeadBandValue
161161

162162
- label:
163163
"Read attribute AbsMinHeatSetpointLimit if TSTAT.S.F05 feature is
@@ -257,8 +257,8 @@ tests:
257257
response:
258258
constraints:
259259
type: int16s
260-
minValue: MinCoolSetpointLimit
261-
maxValue: MaxCoolSetpointLimit
260+
minValue: MinCoolSetpointLimitValue
261+
maxValue: MaxCoolSetpointLimitValue
262262

263263
- label: "Read attribute OccupiedCoolingSetpoint from the DUT"
264264
PICS: TSTAT.S.F01 && !TSTAT.S.A0017 && !TSTAT.S.A0018
@@ -280,7 +280,7 @@ tests:
280280
constraints:
281281
type: int16s
282282
minValue: AbsMinCoolSetpointLimitStep5
283-
maxValue: OccupiedCoolingSetpoint - MinSetpointDeadBand
283+
maxValue: OccupiedCoolingSetpointValue - MinSetpointDeadBandValue
284284

285285
- label: "Read attribute OccupiedHeatingSetpoint from the DUT"
286286
PICS: TSTAT.S.F00 && !TSTAT.S.F05
@@ -299,8 +299,8 @@ tests:
299299
response:
300300
constraints:
301301
type: int16s
302-
minValue: AbsMinHeat
303-
maxValue: AbsMaxHeat
302+
minValue: AbsMinHeatValue
303+
maxValue: AbsMaxHeatValue
304304

305305
- label: "Read UnoccupiedCoolingSetpoint attribute from the DUT"
306306
PICS: TSTAT.S.F01 && TSTAT.S.F02 && !TSTAT.S.F05
@@ -320,7 +320,8 @@ tests:
320320
constraints:
321321
type: int16s
322322
minValue: 700
323-
maxValue: UnoccupiedCoolingSetpoint - MinSetpointDeadBand
323+
maxValue:
324+
UnoccupiedCoolingSetpointValue - MinSetpointDeadBandValue
324325

325326
- label: "Read UnoccupiedHeatingSetpoint attribute from the DUT"
326327
PICS: TSTAT.S.F00 && TSTAT.S.F02 && !TSTAT.S.F05
@@ -340,7 +341,7 @@ tests:
340341
constraints:
341342
type: int16s
342343
minValue: 700
343-
maxValue: MinCoolSetpointLimit - MinSetpointDeadBand
344+
maxValue: MinCoolSetpointLimitValue - MinSetpointDeadBandValue
344345

345346
- label:
346347
"Reads MinHeatSetpointLimit attribute from Server DUT and verifies
@@ -351,8 +352,8 @@ tests:
351352
response:
352353
constraints:
353354
type: int16s
354-
minValue: AbsMinHeat
355-
maxValue: MaxHeatSetpointLimit
355+
minValue: AbsMinHeatValue
356+
maxValue: MaxHeatSetpointLimitValue
356357

357358
#Using hard coded values when optional attributes are not available
358359
- label:
@@ -385,7 +386,7 @@ tests:
385386
constraints:
386387
type: int16s
387388
minValue: 700
388-
maxValue: MaxCoolSetpointLimit - MinSetpointDeadBand
389+
maxValue: MaxCoolSetpointLimitValue - MinSetpointDeadBandValue
389390

390391
- label: "Read attribute MinCoolSetpointLimit from DUT"
391392
PICS: TSTAT.S.A0017 && TSTAT.S.A0018 && TSTAT.S.A0005
@@ -395,7 +396,7 @@ tests:
395396
constraints:
396397
type: int16s
397398
minValue: AbsMinCoolSetpointLimitStep5
398-
maxValue: MaxCoolSetpointLimit
399+
maxValue: MaxCoolSetpointLimitValue
399400

400401
- label: "Read attribute MinCoolSetpointLimit from DUT"
401402
PICS: TSTAT.S.A0017 && !TSTAT.S.A0018 && !TSTAT.S.A0005
@@ -414,7 +415,7 @@ tests:
414415
response:
415416
constraints:
416417
type: int16s
417-
minValue: MinCoolSetpointLimit
418+
minValue: MinCoolSetpointLimitValue
418419
maxValue: AbsMaxCoolSetpointLimitStep6
419420

420421
- label: "Read attribute MinSetpointDeadBand from DUT"

0 commit comments

Comments
 (0)