Skip to content

Commit f0c32d4

Browse files
Add test scripts for THNETDIR cluster
Base on CHIP-Specifications/chip-test-plans#4322 but contains some additional steps which will be added to the test plan. Some validations depend on PR #34487 and are commented out.
1 parent fc0ef7e commit f0c32d4

File tree

3 files changed

+258
-0
lines changed

3 files changed

+258
-0
lines changed

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

+8
Original file line numberDiff line numberDiff line change
@@ -10199,3 +10199,11 @@ PICS:
1019910199

1020010200
- label: "Does the device implement the ActiveEndpoints attribute?"
1020110201
id: PWRTL.S.A0001
10202+
10203+
#
10204+
# Thread Network Directory Cluster
10205+
#
10206+
- label:
10207+
"Does the device implement the Thread Network Directory cluster as a
10208+
server"
10209+
id: THNETDIR.S
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Copyright (c) 2024 Project CHIP Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: "[TC-THNETDIR-2.1] Simple Attributes check with DUT as Server"
16+
17+
PICS:
18+
- THNETDIR.S
19+
20+
config:
21+
nodeId: 0x12344321
22+
cluster: Thread Network Directory
23+
endpoint: 1
24+
25+
tests:
26+
- label: "Wait for the commissioned device to be retrieved"
27+
cluster: DelayCommands
28+
command: WaitForCommissionee
29+
arguments:
30+
values:
31+
- name: nodeId
32+
value: nodeId
33+
34+
- label: "TH reads SupportedFabrics attribute from DUT"
35+
command: readAttribute
36+
endpoint: 0
37+
cluster: Operational Credentials
38+
attribute: SupportedFabrics
39+
response:
40+
saveAs: supportedFabrics
41+
constraints:
42+
type: int8u
43+
44+
- label: "TH reads ThreadNetworkTableSize attribute from DUT"
45+
command: readAttribute
46+
attribute: ThreadNetworkTableSize
47+
response:
48+
constraints:
49+
type: int8u
50+
minValue: 10 # assume 5 supported fabrics
51+
# python: value >= 2 * supportedFabrics
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,199 @@
1+
# Copyright (c) 2024 Project CHIP Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
name: "[TC-THNETDIR-2.2] Verification for Add/Remove/Get commands"
16+
17+
PICS:
18+
- THNETDIR.S
19+
20+
config:
21+
nodeId: 0x12344321
22+
cluster: Thread Network Directory
23+
endpoint: 1
24+
25+
# Note: TestNetwork* values need to match what's encoded in TestNetworkDataset
26+
TestNetworkDataset:
27+
type: octet_string
28+
defaultValue: "hex:0e080000000000000001000300000f350407fff800020839758ec8144b07fb0708fdf1f1add0797dc00510f366cec7a446bab978d90d27abe38f23030f4f70656e5468726561642d353933380102593804103ca67c969efb0d0c74a4d8ee923b576c0c0402a0f7f8"
29+
TestNetworkExtendedPanId:
30+
type: octet_string
31+
defaultValue: "hex:39758ec8144b07fb"
32+
TestNetworkName: "OpenThread-5938"
33+
TestNetworkChannel: 15
34+
TestNetworkActiveTimestamp: 1
35+
36+
tests:
37+
- label: "Wait for the commissioned device to be retrieved"
38+
cluster: DelayCommands
39+
command: WaitForCommissionee
40+
arguments:
41+
values:
42+
- name: nodeId
43+
value: nodeId
44+
45+
- label: "TH reads ThreadNetworks attribute from DUT"
46+
command: readAttribute
47+
attribute: ThreadNetworks
48+
response:
49+
saveAs: initialNetworks
50+
constraints:
51+
type: list
52+
53+
- label: "TH reads PreferredExtendedPanID attribute from DUT"
54+
command: readAttribute
55+
attribute: PreferredExtendedPanID
56+
response:
57+
constraints:
58+
type: octet_string
59+
minLength: 8
60+
maxLength: 8
61+
notValue: TestNetworkExtendedPanId
62+
63+
- label:
64+
"TH writes ExtendedPanID from TestNetwork to PreferredExtendedPanID on
65+
DUT"
66+
command: writeAttribute
67+
attribute: PreferredExtendedPanID
68+
arguments:
69+
value: TestNetworkExtendedPanId
70+
response:
71+
error: CONSTRAINT_ERROR # TestNetwork is not in ThreadNetworks
72+
73+
- label:
74+
"TH sends GetOperationalDataset command to DUT with ExtendedPanID of
75+
TestNetwork"
76+
command: GetOperationalDataset
77+
arguments:
78+
values:
79+
- name: ExtendedPanID
80+
value: TestNetworkExtendedPanId
81+
response:
82+
error: NOT_FOUND
83+
84+
- label: "TH sends AddNetwork command to DUT without a timed interaction"
85+
command: AddNetwork
86+
arguments:
87+
values:
88+
- name: OperationalDataset
89+
value: TestNetworkDataset
90+
response:
91+
error: NEEDS_TIMED_INTERACTION
92+
93+
- label: "TH sends AddNetwork command to DUT with TestNetwork dataset"
94+
command: AddNetwork
95+
timedInteractionTimeoutMs: 2000
96+
arguments:
97+
values:
98+
- name: OperationalDataset
99+
value: TestNetworkDataset
100+
101+
- label: "TH reads ThreadNetworks attribute from DUT"
102+
command: readAttribute
103+
attribute: ThreadNetworks
104+
response:
105+
constraints:
106+
type: list
107+
# python: |
108+
# # Split the list into test (our TestNetwork) and rest (everything else)
109+
# test = next((n for n in value if n['ExtendedPanID'] == TestNetworkExtendedPanId), None)
110+
# rest = [n for n in value if n != test]
111+
# # Check test has the expected values and rest == initialNetworks (ignoring order)
112+
# return (test is not None and
113+
# test['NetworkName'] == TestNetworkName and
114+
# test['Channel'] == TestNetworkChannel and
115+
# test['ActiveTimestamp'] == TestNetworkActiveTimestamp and
116+
# len(value) == len(initialNetworks) + 1 and
117+
# len(rest) == len(initialNetworks) and
118+
# all(n in initialNetworks for n in rest))
119+
120+
- label:
121+
"TH sends GetOperationalDataset command to DUT with ExtendedPanID from
122+
TestNetwork"
123+
command: GetOperationalDataset
124+
arguments:
125+
values:
126+
- name: ExtendedPanID
127+
value: TestNetworkExtendedPanId
128+
response:
129+
values:
130+
- name: OperationalDataset
131+
value: TestNetworkDataset
132+
133+
- label:
134+
"TH writes ExtendedPanID from TestNetwork to PreferredExtendedPanID on
135+
DUT"
136+
command: writeAttribute
137+
attribute: PreferredExtendedPanID
138+
arguments:
139+
value: TestNetworkExtendedPanId
140+
141+
- label: "TH reads PreferredExtendedPanID attribute from DUT"
142+
command: readAttribute
143+
attribute: PreferredExtendedPanID
144+
response:
145+
value: TestNetworkExtendedPanId
146+
147+
- label: "TH sends RemoveNetwork command to DUT without a timed interaction"
148+
command: RemoveNetwork
149+
arguments:
150+
values:
151+
- name: ExtendedPanID
152+
value: TestNetworkExtendedPanId
153+
response:
154+
error: NEEDS_TIMED_INTERACTION
155+
156+
- label:
157+
"TH sends RemoveNetwork command to DUT with ExtendedPanID of
158+
TestNetwork while it is the preferred network"
159+
command: RemoveNetwork
160+
timedInteractionTimeoutMs: 2000
161+
arguments:
162+
values:
163+
- name: ExtendedPanID
164+
value: TestNetworkExtendedPanId
165+
response:
166+
error: CONSTRAINT_ERROR # Preferred network cannot be removed
167+
168+
- label: "TH writes null to PreferredExtendedPanID on DUT"
169+
command: writeAttribute
170+
attribute: PreferredExtendedPanID
171+
arguments:
172+
value: null
173+
174+
- label: "TH reads PreferredExtendedPanID attribute from DUT"
175+
command: readAttribute
176+
attribute: PreferredExtendedPanID
177+
response:
178+
value: null
179+
180+
- label:
181+
"TH sends RemoveNetwork command to DUT with ExtendedPanID of
182+
TestNetwork"
183+
command: RemoveNetwork
184+
timedInteractionTimeoutMs: 2000
185+
arguments:
186+
values:
187+
- name: ExtendedPanID
188+
value: TestNetworkExtendedPanId
189+
190+
- label: "TH reads ThreadNetworks attribute from DUT"
191+
command: readAttribute
192+
attribute: ThreadNetworks
193+
response:
194+
constraints:
195+
type: list
196+
# python: |
197+
# # value == initialNetworks (ignoring order)
198+
# return (len(value) == len(initialNetworks) and
199+
# all(n in initialNetworks for n in value))

0 commit comments

Comments
 (0)