Skip to content

Commit

Permalink
Add draft test scripts for THNETDIR cluster
Browse files Browse the repository at this point in the history
  • Loading branch information
ksperling-apple committed Jul 24, 2024
1 parent fc0ef7e commit 76dd4be
Show file tree
Hide file tree
Showing 2 changed files with 207 additions and 0 deletions.
40 changes: 40 additions & 0 deletions src/app/tests/suites/certification/Test_TC_THNETDIR_2_1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# 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.1] Simple Attributes check with DUT as Server"

PICS:
- THNETDIR.S

config:
nodeId: 0x12344321
cluster: Thread Network Directory
endpoint: 1

tests:
- label: "Wait for the commissioned device to be retrieved"
cluster: DelayCommands
command: WaitForCommissionee
arguments:
values:
- name: nodeId
value: nodeId

- label: "Step 1: TH reads from the DUT the (0x0002) ThreadNetworkTableSize attribute"
command: readAttribute
attribute: ThreadNetworkTableSize
response:
constraints:
type: int8u
minValue: 10 # 2 * SupportedFabrics, with SupportedFabrics >= 5
167 changes: 167 additions & 0 deletions src/app/tests/suites/certification/Test_TC_THNETDIR_2_2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
# 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

TestNetworkDataset:
type: octet_string
defaultValue: "hex:0e080000000000000001000300000f350407fff800020839758ec8144b07fb0708fdf1f1add0797dc00510f366cec7a446bab978d90d27abe38f23030f4f70656e5468726561642d353933380102593804103ca67c969efb0d0c74a4d8ee923b576c0c0402a0f7f8"
TestNetworkExtendedPanId:
type: octet_string
defaultValue: "hex:39758ec8144b07fb"

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:
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 sends GetOperationalDataset command to DUT with ExtendedPanID from TestNetwork" # ADDED
command: GetOperationalDataset
arguments:
values:
- name: ExtendedPanID
value: TestNetworkExtendedPanId
response:
error: NOT_FOUND

- label: "TH sends AddNetwork command to DUT without a timed interaction" # ADDED
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"
command: readAttribute
attribute: ThreadNetworks
response:
constraints:
type: list # TODO: Verify one entry matching TestNetwork has been added

- 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 writes ExtendedPanID from TestNetwork to PreferredExtendedPanID on DUT"
command: writeAttribute
attribute: PreferredExtendedPanID
arguments:
value: TestNetworkExtendedPanId

- label: "TH reads PreferredExtendedPanID attribute from DUT"
command: readAttribute
attribute: PreferredExtendedPanID
response:
value: TestNetworkExtendedPanId

- label: "TH sends RemoveNetwork command to DUT without a timed interaction" # ADDED
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"
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"
command: readAttribute
attribute: ThreadNetworks
response:
value: initialNetworks # TODO: Ignore order

0 comments on commit 76dd4be

Please sign in to comment.