# 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.
# Auto-generated scripts for harness use only, please review before automation. The endpoints and cluster names are currently set to default

name:
    3.3.18. [TC-DD-3.18] Commissioning Flow - Commissioning Multiple Devices
    [DUT - Commissioner]

PICS:
    - MCORE.ROLE.COMMISSIONER
    - MCORE.DD.QR_COMMISSIONING

config:
    nodeId: 0x12344321
    cluster: "Basic Information"
    endpoint: 0

tests:
    - label: "Note"
      verification: |
          Chip-tool command used below are an example to verify the DUT as commissioner test cases. For certification test, we expect DUT should have a capability or way to run the equivalent command.
      disabled: true

    - label: "Preconditions"
      verification: |
          1 - DUT is on an operational network and has accurate date, time, timezone, regulatory, and fabric information available.
          2 - 5.1.3 - QR code is printed on the Commissionee devices or in additional provided materials (ex: manual).
      disabled: true

    - label:
          "Step 1a: Place TH1 into commissioning mode using the TH manufacturers
          means to be discovered by a commissioner"
      verification: |
          1. After launching all-clusters-app using discriminator 3841 using below command
          ./chip-all-clusters-app --wifi --discriminator 3841
          No applicable TH or DUT logs.

           dns-sd -B _matterc._udp,_L3841
          Browsing for _matterc._udp,_L3841
          DATE: ---Thu 07 Jul 2022---
          17:39:06.762  ...STARTING...
          Timestamp     A/R    Flags  if Domain               Service Type         Instance Name
          17:39:06.764  Add        2   7 local.               _matterc._udp.       930430C7C701B844
      disabled: true

    - label:
          "Step 1b: Place TH2 into commissioning mode using the TH manufacturers
          means to be discovered by a commissioner"
      verification: |
          1. After launching all-clusters-app using discriminator 3844 using below command
          ./chip-all-clusters-app --wifi --discriminator 3844
          No applicable TH or DUT logs.

           dns-sd -B _matterc._udp,_L3844
          Browsing for _matterc._udp,_L3844
          DATE: ---Thu 07 Jul 2022---
          17:39:35.265  ...STARTING...
          Timestamp     A/R    Flags  if Domain               Service Type         Instance Name
          17:40:17.959  Add        2   7 local.               _matterc._udp.       8F1FEB734CE46129
      disabled: true

    - label: "Step 2a: Scan TH1s QR code using the DUT Commissioner."
      PICS: MCORE.DD.SCAN_QR_CODE
      verification: |
          1. Verify the QR code is scanned by DUT
          Note: chip-tool does not support physically scanning QR codes
      disabled: true

    - label:
          "Step 2b: DUT parses TH1s QR code. Follow any steps needed for the
          Commissioner/Commissionee to complete the commissioning process over
          the TH Commissionees method of device discovery"
      verification: |
          Verify on the TH1 (All-cluster-app):
          [1657240914.891250][372173:372173] CHIP:SVR: Commissioning completed successfully
          [1657240914.891297][372173:372173] CHIP:DIS: Updating services using commissioning mode 0

          Verify in DUT (Chip-tool):
           ./chip-tool pairing code 1 MT:-24J0IRV01KA0648G00

          [1657240914764] [32262:16895870] CHIP: [CTL] Successfully finished commissioning step 'Cleanup'
          [1657240914764] [32262:16895870] CHIP: [TOO] Device commissioning completed with success
      disabled: true

    - label: "Step 3a: Scan TH2s QR code using the DUT Commissioner."
      PICS: MCORE.DD.SCAN_QR_CODE
      verification: |
          1. Verify the QR code is scanned by DUT
          Note: chip-tool does not support physically scanning QR codes
      disabled: true

    - label:
          "Step 3b: DUT parses TH2s QR code. Follow any steps needed for the
          Commissioner/Commissionee to complete the commissioning process over
          the TH Commissionees method of device discovery"
      verification: |
          Verify on the TH2 (All-cluster-app):
          [1657240985.801360][112581:112581] CHIP:SVR: Commissioning completed successfully
          [1657240985.801406][112581:112581] CHIP:DIS: Updating services using commissioning mode 0

          Verify in DUT (Chip-tool):
           ./chip-tool pairing code 2 MT:-24J04QI14KA0648G00

          [1657240985682] [32264:16896797] CHIP: [CTL] Successfully finished commissioning step 'Cleanup'
          [1657240985682] [32264:16896797] CHIP: [TOO] Device commissioning completed with success
      disabled: true

    - label:
          "Step 4a: Verify the Commissioner can still interact with TH1 (ex:
          Read any clusters attribute from TH1)"
      verification: |
          ./chip-tool  basicinformation read reachable 1 0

          Verify in DUT (Chip-tool):

          [1657241043430] [32266:16897416] CHIP: [TOO] Endpoint: 0 Cluster: 0x0000_0028 Attribute 0x0000_0011 DataVersion: 131004400
          [1657241043432] [32266:16897416] CHIP: [TOO]   Reachable: TRUE
      disabled: true

    - label:
          "Step 4b: Verify the Commissioner can still interact with TH2 (ex:
          Read any clusters attribute from TH2)"
      verification: |
          ./chip-tool  basicinformation read reachable 2 0

          Verify in DUT (Chip-tool):

          [1657241066927] [32267:16897671] CHIP: [TOO] Endpoint: 0 Cluster: 0x0000_0028 Attribute 0x0000_0011 DataVersion: 2450774961
          [1657241066927] [32267:16897671] CHIP: [TOO]   Reachable: TRUE
      disabled: true
