Skip to content

Commit

Permalink
Add src/app/tests/suites/Test_AddNewFabricFromExistingFabric.yaml tes…
Browse files Browse the repository at this point in the history
…t working with the chip-tool python yaml runner
  • Loading branch information
vivien-apple committed Apr 6, 2023
1 parent 33d8192 commit 60532dd
Show file tree
Hide file tree
Showing 2 changed files with 159 additions and 1 deletion.
4 changes: 3 additions & 1 deletion scripts/tests/chiptest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ def _GetInDevelopmentTests() -> Set[str]:
Currently this is empty and returns an empty set, but this is kept around in case
there are tests that are a work in progress.
"""
return set()
return {
"Test_AddNewFabricFromExistingFabric.yaml", # chip-repl does not support GetCommissionerRootCertificate and IssueNocChain command
}


def _AllYamlTests():
Expand Down
156 changes: 156 additions & 0 deletions src/app/tests/suites/Test_AddNewFabricFromExistingFabric.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
# Copyright (c) 2023 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: Test

config:
nodeId: 0x12344321
endpoint: 0

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

- label: "Read the fabrics list from alpha"
command: "readAttribute"
cluster: "Operational Credentials"
attribute: "Fabrics"
response:
value: [{ Label: "", NodeID: nodeId }]
constraints:
type: list

- label:
"Send ArmFailSafe command to target device with ExpiryLengthSeconds 60
seconds"
cluster: "General Commissioning"
command: "ArmFailSafe"
arguments:
values:
- name: "ExpiryLengthSeconds"
value: 60
- name: "Breadcrumb"
value: 0

- label: "Send CSRRequest command from alpha"
command: "CSRRequest"
cluster: "Operational Credentials"
arguments:
values:
- name: CSRNonce
value: "\x00\x01\x02\x03\x04\x05\x06\x07\x00\x01\x02\x03\x04\x05\x06\x07\x00\x01\x02\x03\x04\x05\x06\x07\x00\x01\x02\x03\x04\x05\x06\x07"
response:
values:
- name: "NOCSRElements"
saveAs: NOCSRElements
- name: "AttestationSignature"
saveAs: attestationSignature

- label: "Read the commissioner node ID from the beta fabric"
identity: "beta"
cluster: "CommissionerCommands"
command: "GetCommissionerNodeId"
response:
values:
- name: "nodeId"
saveAs: commissionerNodeIdBeta

- label: "Read the commissioner root certificate from the beta fabric"
identity: "beta"
cluster: "CommissionerCommands"
command: "GetCommissionerRootCertificate"
response:
values:
- name: "RCAC"
saveAs: commissionerRCACBeta

- label:
"Create a NOC chain for commissioner beta with the results of the
CSRRequest from alpha"
identity: "beta"
cluster: "CommissionerCommands"
command: "IssueNocChain"
arguments:
values:
- name: "Elements"
value: NOCSRElements
- name: "nodeId"
value: 0x43211234
response:
values:
- name: "NOC"
saveAs: noc
- name: "ICAC"
saveAs: icac
- name: "IPK"
saveAs: ipk

- label: "Send AddTrustedRootCertificate command from alpha"
command: "AddTrustedRootCertificate"
cluster: "Operational Credentials"
arguments:
values:
- name: "RootCACertificate"
value: commissionerRCACBeta

- label: "Send AddNOC command from alpha"
command: "AddNOC"
cluster: "Operational Credentials"
arguments:
values:
- name: "NOCValue"
value: noc
- name: "ICACValue"
value: icac
- name: "IPKValue"
value: ipk
- name: "CaseAdminSubject"
value: commissionerNodeIdBeta
- name: "AdminVendorId"
value: 0xFFF1
response:
values:
- name: "StatusCode"
value: 0

- label: "Send Commissioning Complete command from beta"
nodeId: 0x43211234
identity: "beta"
cluster: "General Commissioning"
command: "CommissioningComplete"

- label: "Read the fabrics list again from alpha"
command: "readAttribute"
cluster: "Operational Credentials"
attribute: "Fabrics"
response:
value: [{ Label: "", NodeID: nodeId }]
constraints:
type: list

- label: "Read the fabrics list from beta this time"
identity: "beta"
nodeId: 0x43211234
command: "readAttribute"
cluster: "Operational Credentials"
attribute: "Fabrics"
response:
value: [{ Label: "", NodeID: 0x43211234 }]
constraints:
type: list

0 comments on commit 60532dd

Please sign in to comment.