-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/
Test_TC_THNETDIR_2_2.yaml
300 lines (271 loc) · 10.1 KB
/
Test_TC_THNETDIR_2_2.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
# Copyright (c) 2024 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: "[TC-THNETDIR-2.2] Verification for Add/Remove/Get commands"
PICS:
- THNETDIR.S
config:
nodeId: 0x12344321
cluster: Thread Network Directory
endpoint: 1
# Note: TestNetwork* values need to match what's encoded in TestNetworkDataset
TestNetworkDataset:
type: octet_string
defaultValue: "hex:0e0800000000000c0001000300000f350407fff800020839758ec8144b07fb0708fdf1f1add0797dc00510f366cec7a446bab978d90d27abe38f23030f4f70656e5468726561642d353933380102593804103ca67c969efb0d0c74a4d8ee923b576c0c0402a0f7f8"
TestNetworkExtendedPanId:
type: octet_string
defaultValue: "hex:39758ec8144b07fb"
TestNetworkName: "OpenThread-5938"
TestNetworkChannel: 15
TestNetworkActiveTimestamp: 0xc0001
TestNetworkUpdatedDataset:
type: octet_string
defaultValue: "hex:0e0800000000000d0001000300000f350407fff800020839758ec8144b07fb0708fdf1f1add0797dc00510f366cec7a446bab978d90d27abe38f23030f4f70656e5468726561642d353933380102593804103ca67c969efb0d0c74a4d8ee923b576c0c0402a0f7f8"
tests:
- label: "Wait for the commissioned device to be retrieved"
cluster: DelayCommands
command: WaitForCommissionee
arguments:
values:
- name: nodeId
value: nodeId
- label: "TH reads ThreadNetworks attribute from DUT"
command: readAttribute
attribute: ThreadNetworks
response:
saveAs: initialNetworks
constraints:
type: list
- label: "TH reads PreferredExtendedPanID attribute from DUT"
command: readAttribute
attribute: PreferredExtendedPanID
response:
saveAs: initialPreferredExtendedPanID
constraints:
type: octet_string
minLength: 8
maxLength: 8
notValue: TestNetworkExtendedPanId
- label:
"TH writes ExtendedPanID from TestNetwork to PreferredExtendedPanID on
DUT"
command: writeAttribute
attribute: PreferredExtendedPanID
arguments:
value: TestNetworkExtendedPanId
response:
error: CONSTRAINT_ERROR # TestNetwork is not in ThreadNetworks
- label:
"TH reads PreferredExtendedPanID attribute from DUT, verifying that
the value did not change"
command: readAttribute
attribute: PreferredExtendedPanID
response:
value: initialPreferredExtendedPanID
- label:
"TH sends GetOperationalDataset command to DUT with ExtendedPanID of
TestNetwork"
command: GetOperationalDataset
arguments:
values:
- name: ExtendedPanID
value: TestNetworkExtendedPanId
response:
error: NOT_FOUND
# Note: Unsupported with darwin-framework-tool because it automatically performs a timed invoke
- label: "TH sends AddNetwork command to DUT without a timed interaction"
command: AddNetwork
arguments:
values:
- name: OperationalDataset
value: TestNetworkDataset
response:
error: NEEDS_TIMED_INTERACTION
- label: "TH sends AddNetwork command to DUT with TestNetwork dataset"
command: AddNetwork
timedInteractionTimeoutMs: 2000
arguments:
values:
- name: OperationalDataset
value: TestNetworkDataset
- label:
"TH reads ThreadNetworks attribute from DUT, verifying that the
network has been added"
command: readAttribute
attribute: ThreadNetworks
response:
constraints:
type: list
python: |
# Split the list into test (our TestNetwork) and rest (everything else)
test = next((n for n in value if n['ExtendedPanID'] == TestNetworkExtendedPanId), None)
rest = [n for n in value if n != test]
# Check test has the expected values and rest == initialNetworks (ignoring order)
return (test is not None and
test['NetworkName'] == TestNetworkName and
test['Channel'] == TestNetworkChannel and
test['ActiveTimestamp'] == TestNetworkActiveTimestamp and
len(value) == len(initialNetworks) + 1 and
len(rest) == len(initialNetworks) and
all(n in initialNetworks for n in rest))
- label:
"TH sends GetOperationalDataset command to DUT with ExtendedPanID from
TestNetwork"
command: GetOperationalDataset
arguments:
values:
- name: ExtendedPanID
value: TestNetworkExtendedPanId
response:
values:
- name: OperationalDataset
value: TestNetworkDataset
- label:
"TH sends AddNetwork command to DUT with TestNetwork dataset matching
existing Active Timestamp"
command: AddNetwork
timedInteractionTimeoutMs: 2000
arguments:
values:
- name: OperationalDataset
value: TestNetworkDataset
response:
error: INVALID_IN_STATE
- label:
"TH sends GetOperationalDataset command to DUT with ExtendedPanID from
TestNetwork"
command: GetOperationalDataset
arguments:
values:
- name: ExtendedPanID
value: TestNetworkExtendedPanId
response:
values:
- name: OperationalDataset
value: TestNetworkDataset
- label:
"TH sends AddNetwork command to DUT with updated TestNetwork dataset
with larger Active Timestamp"
command: AddNetwork
timedInteractionTimeoutMs: 2000
arguments:
values:
- name: OperationalDataset
value: TestNetworkUpdatedDataset
- label:
"TH sends GetOperationalDataset command to DUT with ExtendedPanID from
TestNetwork"
command: GetOperationalDataset
arguments:
values:
- name: ExtendedPanID
value: TestNetworkExtendedPanId
response:
values:
- name: OperationalDataset
value: TestNetworkUpdatedDataset
- label:
"TH sends AddNetwork command to DUT with original TestNetwork dataset"
command: AddNetwork
timedInteractionTimeoutMs: 2000
arguments:
values:
- name: OperationalDataset
value: TestNetworkDataset
response:
error: INVALID_IN_STATE
- label:
"TH sends GetOperationalDataset command to DUT with ExtendedPanID from
TestNetwork"
command: GetOperationalDataset
arguments:
values:
- name: ExtendedPanID
value: TestNetworkExtendedPanId
response:
values:
- name: OperationalDataset
value: TestNetworkUpdatedDataset
- label:
"TH writes ExtendedPanID from TestNetwork to PreferredExtendedPanID on
DUT"
command: writeAttribute
attribute: PreferredExtendedPanID
arguments:
value: TestNetworkExtendedPanId
- label:
"TH reads PreferredExtendedPanID attribute from DUT, verifying that
the value was written"
command: readAttribute
attribute: PreferredExtendedPanID
response:
value: TestNetworkExtendedPanId
# Note: Unsupported with darwin-framework-tool because it automatically performs a timed invoke
- label: "TH sends RemoveNetwork command to DUT without a timed interaction"
command: RemoveNetwork
arguments:
values:
- name: ExtendedPanID
value: TestNetworkExtendedPanId
response:
error: NEEDS_TIMED_INTERACTION
- label:
"TH sends RemoveNetwork command to DUT with ExtendedPanID of
TestNetwork while it is the preferred network"
command: RemoveNetwork
timedInteractionTimeoutMs: 2000
arguments:
values:
- name: ExtendedPanID
value: TestNetworkExtendedPanId
response:
error: CONSTRAINT_ERROR # Preferred network cannot be removed
- label: "TH writes null to PreferredExtendedPanID on DUT"
command: writeAttribute
attribute: PreferredExtendedPanID
arguments:
value: null
- label:
"TH reads PreferredExtendedPanID attribute from DUT, verifying that
the value was cleared"
command: readAttribute
attribute: PreferredExtendedPanID
response:
value: null
- label:
"TH sends RemoveNetwork command to DUT with ExtendedPanID of
TestNetwork"
command: RemoveNetwork
timedInteractionTimeoutMs: 2000
arguments:
values:
- name: ExtendedPanID
value: TestNetworkExtendedPanId
- label:
"TH reads ThreadNetworks attribute from DUT, verifying that the
network was removed"
command: readAttribute
attribute: ThreadNetworks
response:
constraints:
type: list
python: |
# value == initialNetworks (ignoring order)
return (len(value) == len(initialNetworks) and
all(n in initialNetworks for n in value))
- label:
"TH writes PreferredExtendedPanID to DUT, restoring the initial value"
command: writeAttribute
attribute: PreferredExtendedPanID
arguments:
value: initialPreferredExtendedPanID