diff --git a/src/app/tests/suites/certification/Test_TC_CADMIN_1_21.yaml b/src/app/tests/suites/certification/Test_TC_CADMIN_1_21.yaml deleted file mode 100644 index f6e7332a9d1f91..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_CADMIN_1_21.yaml +++ /dev/null @@ -1,123 +0,0 @@ -# Copyright (c) 2021 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: - 30.1.21. [TC-CADMIN-1.21] Open commissioning window - durations max and - max+1 [BCM] [DUT - Commissionee] - -PICS: - - CADMIN.S - - CADMIN.S.F00 - -config: - nodeId: 0x12344321 - timeout: 950 - endpoint: 0 - payload: - type: char_string - defaultValue: "MT:-24J0AFN00KA0648G00" - -tests: - - label: "Precondition: Reset Devices to factory defaults" - PICS: PICS_SDK_CI_ONLY - cluster: "SystemCommands" - command: "FactoryReset" - - - label: "Precondition: Reset Devices to factory defaults" - verification: | - Reset Devices to factory defaults - cluster: "LogCommands" - command: "UserPrompt" - PICS: PICS_SKIP_SAMPLE_APP - arguments: - values: - - name: "message" - value: "Factory Reset the DUT and enter 'y' after success" - - name: "expectedValue" - value: "y" - - - label: "Step 1: TH_CR1 starts a commissioning process with DUT_CE" - cluster: "CommissionerCommands" - command: "PairWithCode" - PICS: CADMIN.S - arguments: - values: - - name: "nodeId" - value: nodeId - - name: "payload" - value: payload - - - label: "Step 1: TH_CR1 commissioned with DUT_CE" - cluster: "DelayCommands" - command: "WaitForCommissionee" - PICS: CADMIN.S - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: - "Step 2: TH_CR1 opens a commissioning window on DUT_CE using BCM with - a value of 900 seconds" - cluster: "Administrator Commissioning" - command: "OpenBasicCommissioningWindow" - timedInteractionTimeoutMs: 10000 - PICS: CADMIN.S.C01.Rsp - arguments: - values: - - name: "CommissioningTimeout" - value: 900 - - - label: "Step 3: Wait 901 seconds for commissioning Window to be closed" - PICS: CADMIN.S.C01.Rsp - cluster: "DelayCommands" - command: "WaitForMs" - arguments: - values: - - name: "ms" - value: 901000 - - - label: - "Step 4: TH_CR1 reads the window status to verify the DUT_CE window is - closed" - cluster: "Administrator Commissioning" - command: "readAttribute" - attribute: "WindowStatus" - PICS: CADMIN.S.A0000 - response: - value: 0 - - - label: - "Step 5: TH_CR1 opens a commissioning window on DUT_CE using BCM with - a value of 901 seconds" - cluster: "Administrator Commissioning" - command: "OpenBasicCommissioningWindow" - PICS: CADMIN.S.C01.Rsp - timedInteractionTimeoutMs: 10000 - arguments: - values: - - name: "CommissioningTimeout" - value: 901 - response: - error: INVALID_COMMAND - - - label: - "Step 6: TH_CR1 reads the window status to verify the DUT_CE window is - closed" - cluster: "Administrator Commissioning" - command: "readAttribute" - attribute: "WindowStatus" - PICS: CADMIN.S.A0000 - response: - value: 0 diff --git a/src/app/tests/suites/certification/Test_TC_CADMIN_1_22.yaml b/src/app/tests/suites/certification/Test_TC_CADMIN_1_22.yaml deleted file mode 100644 index 4b94b6518a7529..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_CADMIN_1_22.yaml +++ /dev/null @@ -1,199 +0,0 @@ -# Copyright (c) 2021 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: - 30.1.22. [TC-CADMIN-1.22] Open commissioning window - durations max and - max+1 [ECM] [DUT - Commissionee] - -PICS: - - CADMIN.S - -config: - nodeId: 0x12344321 - timeout: 950 - endpoint: 0 - payload: - type: char_string - defaultValue: "MT:-24J0AFN00KA0648G00" - discriminator: - type: int16u - defaultValue: 3840 - PakeVerifier: - type: octet_string - defaultValue: "hex:b96170aae803346884724fe9a3b287c30330c2a660375d17bb205a8cf1aecb350457f8ab79ee253ab6a8e46bb09e543ae422736de501e3db37d441fe344920d09548e4c18240630c4ff4913c53513839b7c07fcc0627a1b8573a149fcd1fa466cf" - -tests: - - label: "Precondition: Reset Devices to factory defaults" - cluster: "SystemCommands" - PICS: PICS_SDK_CI_ONLY - command: "FactoryReset" - - - label: "Precondition: Reset Devices to factory defaults" - verification: | - Reset Devices to factory defaults - cluster: "LogCommands" - command: "UserPrompt" - PICS: PICS_SKIP_SAMPLE_APP - arguments: - values: - - name: "message" - value: "Factory Reset the DUT and enter 'y' after success" - - name: "expectedValue" - value: "y" - - - label: "Step 1: TH_CR1 starts a commissioning process with DUT_CE" - cluster: "CommissionerCommands" - command: "PairWithCode" - PICS: CADMIN.S - arguments: - values: - - name: "nodeId" - value: nodeId - - name: "payload" - value: payload - - - label: "Step 1: TH_CR1 commissioned with DUT_CE" - cluster: "DelayCommands" - command: "WaitForCommissionee" - PICS: CADMIN.S.C00.Rsp - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: - "Step 2: TH_CR1 opens a commissioning window on DUT_CE using ECM with - a value of 900 seconds" - verification: | - On TH_CR1 - (chip tool), open commissioning window - - ./chip-tool pairing open-commissioning-window 1 1 900 1000 3840 - - Verify Manual pairing code on TH_CR1(chip-tool) Log - - [1635925713.966786][9695:9700] CHIP:SC: Success status report received. Session was established - [1635925713.966839][9695:9700] CHIP:IN: New secure session created for device 0x0000000000000001, key 33!! - [1635925713.966938][9695:9700] CHIP:CTL: OpenCommissioningWindow for device ID 1 - [1635925713.972601][9695:9700] CHIP:DMG: ICR moving to [AddingComm] - [1635925713.972705][9695:9700] CHIP:DMG: ICR moving to [AddedComma] - [1635925713.972815][9695:9700] CHIP:IN: Prepared encrypted message 0xaaaad9b57d10 to 0x0000000000000001 of type 0x8 and protocolId (0, 1) on exchange 31056i with MessageCounter:0. - [1635925713.972876][9695:9700] CHIP:IN: Sending encrypted msg 0xaaaad9b57d10 with MessageCounter:0 to 0x0000000000000001 at monotonic time: 13449459 msec - [1635925713.973006][9695:9700] CHIP:DMG: ICR moving to [CommandSen] - [1635925713.973061][9695:9700] CHIP:CTL: Manual pairing code: [35484132896] - [1635925713.973120][9695:9700] CHIP:CTL: SetupQRCode: [MT:00000CQM00A7F87ZT10] - [1635925713.973178][9695:9700] CHIP:EM: Sending Standalone Ack for MessageCounter:1964916542 on exchange 31055i - cluster: "LogCommands" - command: "UserPrompt" - PICS: PICS_SKIP_SAMPLE_APP && CADMIN.S.C00.Rsp - arguments: - values: - - name: "message" - value: "Enter 'y' after success" - - name: "expectedValue" - value: "y" - - - label: - "Step 2a: TH_CR1 opens a commissioning window on DUT_CE using ECM with - a value of 900 seconds" - cluster: "Administrator Commissioning" - command: "OpenCommissioningWindow" - PICS: CADMIN.S.C00.Rsp && PICS_SDK_CI_ONLY - timedInteractionTimeoutMs: 10000 - arguments: - values: - - name: "CommissioningTimeout" - value: 900 - - name: "PAKEPasscodeVerifier" - value: PakeVerifier - - name: "Discriminator" - value: discriminator - - name: "Iterations" - value: 1000 - - name: "Salt" - value: "SPAKE2P Key Salt" - - - label: "Step 3: Wait for commissioning Window to 901 seconds" - PICS: CADMIN.S.C00.Rsp - cluster: "DelayCommands" - command: "WaitForMs" - arguments: - values: - - name: "ms" - value: 901000 - - - label: - "Step 4: TH_CR1 reads the window status to verify the DUT_CE window is - closed" - cluster: "Administrator Commissioning" - command: "readAttribute" - attribute: "WindowStatus" - PICS: CADMIN.S.A0000 - response: - value: 0 - - - label: - "Step 5: TH_CR1 opens a commissioning window on DUT_CE using ECM with - a value of 901 seconds" - verification: | - On TH_CR1 (chip tool), open commissioning window - - ./chip-tool pairing open-commissioning-window 1 1 901 2000 3841 - - Verify DUT_CE responds General error 0x85 on TH_CR1 (chip-tool) log - - CHIP:DMG: Received Command Response Status for Endpoint=0 Cluster=0x0000_003C Command=0x0000_0001 Status=0x85 - [1652860801.225084][9512:9517] CHIP:TOO: Error: IM Error 0x00000585: General error: 0x85 (INVALID_COMMAND) - [1652860801.225173][9512:9517] CHIP:DMG: ICR moving to [AwaitingDe] - [1652860801.225294][9512:9517] CHIP:EM: Sending Standalone Ack for MessageCounter:4191961 on exchange 37827i - cluster: "LogCommands" - command: "UserPrompt" - PICS: PICS_SKIP_SAMPLE_APP && CADMIN.S.C00.Rsp - arguments: - values: - - name: "message" - value: "Enter 'y' after success" - - name: "expectedValue" - value: "y" - - - label: - "Step 5a: TH_CR1 opens a commissioning window on DUT_CE using ECM with - a value of 901 seconds" - cluster: "Administrator Commissioning" - command: "OpenCommissioningWindow" - PICS: CADMIN.S.C00.Rsp && PICS_SDK_CI_ONLY - timedInteractionTimeoutMs: 10000 - arguments: - values: - - name: "CommissioningTimeout" - value: 901 - - name: "PAKEPasscodeVerifier" - value: PakeVerifier - - name: "Discriminator" - value: discriminator - - name: "Iterations" - value: 1000 - - name: "Salt" - value: "SPAKE2P Key Salt" - response: - error: INVALID_COMMAND - - - label: - "Step 6: TH_CR1 reads the window status to verify the DUT_CE window is - closed" - cluster: "Administrator Commissioning" - command: "readAttribute" - attribute: "WindowStatus" - PICS: CADMIN.S.A0000 - response: - value: 0 diff --git a/src/app/tests/suites/certification/Test_TC_CADMIN_1_23.yaml b/src/app/tests/suites/certification/Test_TC_CADMIN_1_23.yaml deleted file mode 100644 index 9aab51aa3876d2..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_CADMIN_1_23.yaml +++ /dev/null @@ -1,124 +0,0 @@ -# Copyright (c) 2021 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: - 24.1.23. [TC-CADMIN-1.23] Open commissioning window - durations max and - max+1 [BCM] [DUT - Commissionee] - -PICS: - - CADMIN.S - - CADMIN.S.F00 - -config: - nodeId: 0x12344321 - timeout: 200 - endpoint: 0 - payload: - type: char_string - defaultValue: "MT:-24J0AFN00KA0648G00" - -tests: - - label: "Precondition: Reset Devices to factory defaults" - PICS: PICS_SDK_CI_ONLY - cluster: "SystemCommands" - command: "FactoryReset" - - - label: "Precondition: Reset Devices to factory defaults" - verification: | - Reset Devices to factory defaults - cluster: "LogCommands" - command: "UserPrompt" - PICS: PICS_SKIP_SAMPLE_APP - arguments: - values: - - name: "message" - value: "Factory Reset the DUT and enter 'y' after success" - - name: "expectedValue" - value: "y" - - - label: "Step 1: TH_CR1 starts a commissioning process with DUT_CE" - cluster: "CommissionerCommands" - command: "PairWithCode" - PICS: CADMIN.S - arguments: - values: - - name: "nodeId" - value: nodeId - - name: "payload" - value: payload - - - label: "Step 1: TH_CR1 commissioned with DUT_CE" - cluster: "DelayCommands" - command: "WaitForCommissionee" - PICS: CADMIN.S.C01.Rsp - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: - "Step 2: TH_CR1 opens a commissioning window on DUT_CE using BCM with - a value of 180 seconds" - cluster: "Administrator Commissioning" - command: "OpenBasicCommissioningWindow" - PICS: CADMIN.S.C01.Rsp - timedInteractionTimeoutMs: 10000 - arguments: - values: - - name: "CommissioningTimeout" - value: 180 - - - label: - "Step 3: Wait for 181 seconds for commissioning Window to be closed" - PICS: CADMIN.S.C01.Rsp - cluster: "DelayCommands" - command: "WaitForMs" - arguments: - values: - - name: "ms" - value: 181000 - - - label: - "Step 4: TH_CR1 reads the window status to verify the DUT_CE window is - closed" - cluster: "Administrator Commissioning" - command: "readAttribute" - attribute: "WindowStatus" - PICS: CADMIN.S.A0000 - response: - value: 0 - - - label: - "Step 5: TH_CR1 opens a commissioning window on DUT_CE using BCM with - a value of 179 seconds" - cluster: "Administrator Commissioning" - command: "OpenBasicCommissioningWindow" - PICS: CADMIN.S.C01.Rsp - timedInteractionTimeoutMs: 10000 - arguments: - values: - - name: "CommissioningTimeout" - value: 179 - response: - error: INVALID_COMMAND - - - label: - "Step 6: TH_CR1 reads the window status to verify the DUT_CE window is - closed" - cluster: "Administrator Commissioning" - command: "readAttribute" - attribute: "WindowStatus" - PICS: CADMIN.S.A0000 - response: - value: 0 diff --git a/src/app/tests/suites/certification/Test_TC_CADMIN_1_24.yaml b/src/app/tests/suites/certification/Test_TC_CADMIN_1_24.yaml deleted file mode 100644 index 8e201988cc87db..00000000000000 --- a/src/app/tests/suites/certification/Test_TC_CADMIN_1_24.yaml +++ /dev/null @@ -1,199 +0,0 @@ -# Copyright (c) 2021 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: - 24.1.24. [TC-CADMIN-1.24] Open commissioning window - durations max and - max+1 [ECM] [DUT - Commissionee] - -PICS: - - CADMIN.S - -config: - nodeId: 0x12344321 - timeout: 200 - endpoint: 0 - payload: - type: char_string - defaultValue: "MT:-24J0AFN00KA0648G00" - discriminator: - type: int16u - defaultValue: 3840 - PakeVerifier: - type: octet_string - defaultValue: "hex:b96170aae803346884724fe9a3b287c30330c2a660375d17bb205a8cf1aecb350457f8ab79ee253ab6a8e46bb09e543ae422736de501e3db37d441fe344920d09548e4c18240630c4ff4913c53513839b7c07fcc0627a1b8573a149fcd1fa466cf" - -tests: - - label: "Precondition: Reset Devices to factory defaults" - cluster: "SystemCommands" - PICS: PICS_SDK_CI_ONLY - command: "FactoryReset" - - - label: "Precondition: Reset Devices to factory defaults" - verification: | - Reset Devices to factory defaults - cluster: "LogCommands" - command: "UserPrompt" - PICS: PICS_SKIP_SAMPLE_APP - arguments: - values: - - name: "message" - value: "Factory Reset the DUT and enter 'y' after success" - - name: "expectedValue" - value: "y" - - - label: "Step 1: TH_CR1 starts a commissioning process with DUT_CE" - cluster: "CommissionerCommands" - command: "PairWithCode" - PICS: CADMIN.S - arguments: - values: - - name: "nodeId" - value: nodeId - - name: "payload" - value: payload - - - label: "Step 1: TH_CR1 commissioned with DUT_CE" - cluster: "DelayCommands" - command: "WaitForCommissionee" - PICS: CADMIN.S.C00.Rsp - arguments: - values: - - name: "nodeId" - value: nodeId - - - label: - "Step 2: TH_CR1 opens a commissioning window on DUT_CE using ECM with - a value of 180 seconds" - verification: | - On TH_CR1 ( chip tool), open commissioning window - - ./chip-tool pairing open-commissioning-window 1 1 180 1000 3840 - - Verify Manual pairing code on TH_CR1(chip-tool) Log - - [1635925713.966786][9695:9700] CHIP:SC: Success status report received. Session was established - [1635925713.966839][9695:9700] CHIP:IN: New secure session created for device 0x0000000000000001, key 33!! - [1635925713.966938][9695:9700] CHIP:CTL: OpenCommissioningWindow for device ID 1 - [1635925713.972601][9695:9700] CHIP:DMG: ICR moving to [AddingComm] - [1635925713.972705][9695:9700] CHIP:DMG: ICR moving to [AddedComma] - [1635925713.972815][9695:9700] CHIP:IN: Prepared encrypted message 0xaaaad9b57d10 to 0x0000000000000001 of type 0x8 and protocolId (0, 1) on exchange 31056i with MessageCounter:0. - [1635925713.972876][9695:9700] CHIP:IN: Sending encrypted msg 0xaaaad9b57d10 with MessageCounter:0 to 0x0000000000000001 at monotonic time: 13449459 msec - [1635925713.973006][9695:9700] CHIP:DMG: ICR moving to [CommandSen] - [1635925713.973061][9695:9700] CHIP:CTL: Manual pairing code: [35484132896] - [1635925713.973120][9695:9700] CHIP:CTL: SetupQRCode: [MT:00000CQM00A7F87ZT10] - [1635925713.973178][9695:9700] CHIP:EM: Sending Standalone Ack for MessageCounter:1964916542 on exchange 31055i - cluster: "LogCommands" - command: "UserPrompt" - PICS: PICS_SKIP_SAMPLE_APP && CADMIN.S.C00.Rsp - arguments: - values: - - name: "message" - value: "Enter 'y' after success" - - name: "expectedValue" - value: "y" - - - label: - "Step 2a: TH_CR1 opens a commissioning window on DUT_CE using ECM with - a value of 180 seconds" - cluster: "Administrator Commissioning" - command: "OpenCommissioningWindow" - PICS: CADMIN.S.C00.Rsp && PICS_SDK_CI_ONLY - timedInteractionTimeoutMs: 10000 - arguments: - values: - - name: "CommissioningTimeout" - value: 180 - - name: "PAKEPasscodeVerifier" - value: PakeVerifier - - name: "Discriminator" - value: discriminator - - name: "Iterations" - value: 1000 - - name: "Salt" - value: "SPAKE2P Key Salt" - - - label: "Step 3: Wait for commissioning Window to 181 seconds" - PICS: CADMIN.S.C00.Rsp - cluster: "DelayCommands" - command: "WaitForMs" - arguments: - values: - - name: "ms" - value: 181000 - - - label: - "Step 4: TH_CR1 reads the window status to verify the DUT_CE window is - closed" - cluster: "Administrator Commissioning" - command: "readAttribute" - attribute: "WindowStatus" - PICS: CADMIN.S.A0000 - response: - value: 0 - - - label: - "Step 5: TH_CR1 opens a commissioning window on DUT_CE using ECM with - a value of 179 seconds" - verification: | - On TH_CR1 ( chip tool), open commissioning window - - ./chip-tool pairing open-commissioning-window 1 1 179 2000 3841 - - Verify DUT_CE responds General error 0x85 on TH_CR1 (chip-tool) log - - CHIP:DMG: Received Command Response Status for Endpoint=0 Cluster=0x0000_003C Command=0x0000_0001 Status=0x85 - [1652860801.225084][9512:9517] CHIP:TOO: Error: IM Error 0x00000585: General error: 0x85 (INVALID_COMMAND) - [1652860801.225173][9512:9517] CHIP:DMG: ICR moving to [AwaitingDe] - [1652860801.225294][9512:9517] CHIP:EM: Sending Standalone Ack for MessageCounter:4191961 on exchange 37827i - cluster: "LogCommands" - command: "UserPrompt" - PICS: PICS_SKIP_SAMPLE_APP && CADMIN.S.C00.Rsp - arguments: - values: - - name: "message" - value: "Enter 'y' after success" - - name: "expectedValue" - value: "y" - - - label: - "Step 5a: TH_CR1 opens a commissioning window on DUT_CE using ECM with - a value of 179 seconds" - cluster: "Administrator Commissioning" - command: "OpenCommissioningWindow" - PICS: CADMIN.S.C00.Rsp && PICS_SDK_CI_ONLY - timedInteractionTimeoutMs: 10000 - arguments: - values: - - name: "CommissioningTimeout" - value: 179 - - name: "PAKEPasscodeVerifier" - value: PakeVerifier - - name: "Discriminator" - value: discriminator - - name: "Iterations" - value: 1000 - - name: "Salt" - value: "SPAKE2P Key Salt" - response: - error: INVALID_COMMAND - - - label: - "Step 6: TH_CR1 reads the window status to verify the DUT_CE window is - closed" - cluster: "Administrator Commissioning" - command: "readAttribute" - attribute: "WindowStatus" - PICS: CADMIN.S.A0000 - response: - value: 0 diff --git a/src/app/tests/suites/manualTests.json b/src/app/tests/suites/manualTests.json index 01d98213b3e279..ce47e05f3dbef5 100644 --- a/src/app/tests/suites/manualTests.json +++ b/src/app/tests/suites/manualTests.json @@ -179,17 +179,12 @@ "Test_TC_CADMIN_1_18", "Test_TC_CADMIN_1_19", "Test_TC_CADMIN_1_20", - "Test_TC_CADMIN_1_21", - "Test_TC_CADMIN_1_22", "Test_TC_CADMIN_1_3", "Test_TC_CADMIN_1_4", "Test_TC_CADMIN_1_5", "Test_TC_CADMIN_1_6", - "Test_TC_CADMIN_1_9", "Test_TC_CADMIN_1_10", "Test_TC_CADMIN_1_13", - "Test_TC_CADMIN_1_23", - "Test_TC_CADMIN_1_24", "Test_TC_CADMIN_1_25", "Test_TC_CADMIN_1_26" ], diff --git a/src/python_testing/TC_CADMIN_1_22_24.py b/src/python_testing/TC_CADMIN_1_22_24.py new file mode 100644 index 00000000000000..c1b8199c697c78 --- /dev/null +++ b/src/python_testing/TC_CADMIN_1_22_24.py @@ -0,0 +1,172 @@ +# +# Copyright (c) 2024 Project CHIP Authors +# All rights reserved. +# +# 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. +# +# === BEGIN CI TEST ARGUMENTS === +# test-runner-runs: +# run1: +# app: ${ALL_CLUSTERS_APP} +# app-args: --discriminator 1234 --KVS kvs1 --trace-to json:${TRACE_APP}.json +# script-args: > +# --storage-path admin_storage.json +# --commissioning-method on-network +# --discriminator 1234 +# --passcode 20202021 +# --trace-to json:${TRACE_TEST_JSON}.json +# --trace-to perfetto:${TRACE_TEST_PERFETTO}.perfetto +# --PICS src/app/tests/suites/certification/ci-pics-values +# factory-reset: true +# quiet: false +# === END CI TEST ARGUMENTS === + +import logging +import random +from time import sleep + +import chip.clusters as Clusters +from chip.ChipDeviceCtrl import CommissioningParameters +from chip.exceptions import ChipStackError +from chip.testing.matter_testing import MatterBaseTest, TestStep, async_test_body, default_matter_test_main +from mobly import asserts + + +class TC_CADMIN_1_22_24(MatterBaseTest): + async def OpenCommissioningWindow(self) -> CommissioningParameters: + try: + params = await self.th1.OpenCommissioningWindow( + nodeid=self.dut_node_id, timeout=self.max_window_duration, iteration=10000, discriminator=self.discriminator, option=1) + return params + + except Exception as e: + logging.exception('Error running OpenCommissioningWindow %s', e) + asserts.fail('Failed to open commissioning window') + + async def get_window_status(self) -> int: + AC_cluster = Clusters.AdministratorCommissioning + window_status = await self.read_single_attribute_check_success(dev_ctrl=self.th1, fabric_filtered=False, endpoint=0, cluster=AC_cluster, attribute=AC_cluster.Attributes.WindowStatus) + return window_status + + def pics_TC_CADMIN_1_22(self) -> list[str]: + return ["CADMIN.S"] + + def steps_TC_CADMIN_1_22(self) -> list[TestStep]: + return [ + TestStep(1, "Commissioning, already done", is_commissioning=True), + TestStep(2, "TH_CR1 opens a commissioning window on DUT_CE using ECM with a value of 900 seconds", + "DUT_CE opens its Commissioning window to allow a second commissioning"), + TestStep(3, "TH_CR1 sends an RevokeCommissioning command to the DUT"), + TestStep(4, "TH_CR1 reads the window status to verify the DUT_CE window is closed", + "DUT_CE windows status shows the window is closed"), + TestStep(5, "TH_CR1 opens a commissioning window on DUT_CE using ECM with a value of 901 seconds", + "DUT_CE does not open its Commissioning window to allow a second commissioning. DUT_CE shows 'Failed to open commissioning window. Global status 0x85'"), + TestStep(6, "TH_CR1 reads the window status to verify the DUT_CE window is closed", + "DUT_CE windows status shows the window is closed"), + ] + + @async_test_body + async def test_TC_CADMIN_1_22(self): + self.step(1) + self.th1 = self.default_controller + self.discriminator = random.randint(0, 4095) + + self.step(2) + await self.th1.OpenCommissioningWindow( + nodeid=self.dut_node_id, timeout=900, iteration=10000, discriminator=self.discriminator, option=1) + + self.step(3) + revokeCmd = Clusters.AdministratorCommissioning.Commands.RevokeCommissioning() + await self.th1.SendCommand(nodeid=self.dut_node_id, endpoint=0, payload=revokeCmd, timedRequestTimeoutMs=6000) + # The failsafe cleanup is scheduled after the command completes, so give it a bit of time to do that + sleep(1) + + self.step(4) + window_status = await self.get_window_status() + if window_status != Clusters.AdministratorCommissioning.Enums.CommissioningWindowStatusEnum.kWindowNotOpen: + asserts.assert_equal(await window_status, Clusters.AdministratorCommissioning.Enums.CommissioningWindowStatusEnum.kWindowNotOpen, "Commissioning window is expected to be closed, but was found to be open") + + self.step(5) + try: + await self.th1.OpenCommissioningWindow( + nodeid=self.dut_node_id, timeout=901, iteration=10000, discriminator=self.discriminator, option=1) + + except ChipStackError as e: + # Since we provided 901 seconds as the timeout duration, + # we should not be able to open comm window as duration is too long. + # we are expected receive Failed to open commissioning window: IM Error 0x00000585: General error: 0x85 (INVALID_COMMAND) + asserts.assert_equal(e.err, 0x00000585, + "Expected to error as we provided failure value for opening commissioning window") + + self.step(6) + window_status2 = await self.get_window_status() + if window_status2 != Clusters.AdministratorCommissioning.Enums.CommissioningWindowStatusEnum.kWindowNotOpen: + asserts.assert_equal(await window_status, Clusters.AdministratorCommissioning.Enums.CommissioningWindowStatusEnum.kWindowNotOpen, "Commissioning window is expected to be closed, but was found to be open") + + def pics_TC_CADMIN_1_24(self) -> list[str]: + return ["CADMIN.S"] + + def steps_TC_CADMIN_1_24(self) -> list[TestStep]: + return [ + TestStep(1, "Commissioning, already done", is_commissioning=True), + TestStep(2, "TH_CR1 opens a commissioning window on DUT_CE using ECM with a value of 180 seconds", + "DUT_CE opens its Commissioning window to allow a second commissioning"), + TestStep(3, "TH_CR1 sends an RevokeCommissioning command to the DUT"), + TestStep(4, "TH_CR1 reads the window status to verify the DUT_CE window is closed", + "DUT_CE windows status shows the window is closed"), + TestStep(5, "TH_CR1 opens a commissioning window on DUT_CE using ECM with a value of 179 seconds", + "DUT_CE does not open its Commissioning window to allow a second commissioning. DUT_CE shows 'Failed to open commissioning window. Global status 0x85'"), + TestStep(6, "TH_CR1 reads the window status to verify the DUT_CE window is closed", + "DUT_CE windows status shows the window is closed"), + ] + + @async_test_body + async def test_TC_CADMIN_1_24(self): + self.step(1) + self.th1 = self.default_controller + self.discriminator = random.randint(0, 4095) + + self.step(2) + await self.th1.OpenCommissioningWindow( + nodeid=self.dut_node_id, timeout=180, iteration=10000, discriminator=self.discriminator, option=1) + + self.step(3) + revokeCmd = Clusters.AdministratorCommissioning.Commands.RevokeCommissioning() + await self.th1.SendCommand(nodeid=self.dut_node_id, endpoint=0, payload=revokeCmd, timedRequestTimeoutMs=6000) + # The failsafe cleanup is scheduled after the command completes, so give it a bit of time to do that + sleep(1) + + self.step(4) + window_status = await self.get_window_status() + if window_status != Clusters.AdministratorCommissioning.Enums.CommissioningWindowStatusEnum.kWindowNotOpen: + asserts.assert_equal(await window_status, Clusters.AdministratorCommissioning.Enums.CommissioningWindowStatusEnum.kWindowNotOpen, "Commissioning window is expected to be closed, but was found to be open") + + self.step(5) + try: + await self.th1.OpenCommissioningWindow( + nodeid=self.dut_node_id, timeout=179, iteration=10000, discriminator=self.discriminator, option=1) + + except ChipStackError as e: + # Since we provided 179 seconds as the timeout duration, + # we should not be able to open comm window as duration is too long. + # we are expected receive Failed to open commissioning window: IM Error 0x00000585: General error: 0x85 (INVALID_COMMAND) + asserts.assert_equal(e.err, 0x00000585, + "Expected to error as we provided failure value for opening commissioning window") + + self.step(6) + window_status2 = await self.get_window_status() + if window_status2 != Clusters.AdministratorCommissioning.Enums.CommissioningWindowStatusEnum.kWindowNotOpen: + asserts.assert_equal(await window_status, Clusters.AdministratorCommissioning.Enums.CommissioningWindowStatusEnum.kWindowNotOpen, "Commissioning window is expected to be closed, but was found to be open") + +if __name__ == "__main__": + default_matter_test_main()