# 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.1.15. [TC-DD-1.15] Onboarding Payload Verification - Unique Discriminator
    and Passcode Values [DUT - Commissionee]
PICS:
    - MCORE.ROLE.COMMISSIONEE

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

tests:
    - label: "Preconditions"
      verification: |
          1 - 5.1 - Onboarding payload is printed on the device or in additional provided materials (ex: manual, companion app, web service) through a QR Code, a Manual Pairing Code or as content in an NFC tag.
      disabled: true

    - label:
          "Step 1a: Using the TH Onboarding payload reader, scan or read the
          Onboarding payload from DUT1"
      verification: |
          1.Run DUT. Example for DUT=all-clusters app
          ./chip-all-clusters-app --version 0 --vendor-id 0xFFF1 --product-id 0x8001 --custom-flow 2 --capabilities 4 --discriminator 3840 --passcode 20202021

          2. Parse payload for DUT1
          ./chip-tool payload parse-setup-payload MT:-24J029Q00KA0648G00

          Verify in TH (CHIP-TOOL)

          [1667815270.314685][10645:10645] CHIP:SPL: Parsing base38Representation: MT:-24J029Q00KA0648G00
          [1667815270.315022][10645:10645] CHIP:SPL: Version:             0
          [1667815270.315088][10645:10645] CHIP:SPL: VendorID:            65521
          [1667815270.315134][10645:10645] CHIP:SPL: ProductID:           32769
          [1667815270.315183][10645:10645] CHIP:SPL: Custom flow:         2    (CUSTOM)
          [1667815270.315238][10645:10645] CHIP:SPL: Discovery Bitmask:   0x04 (On IP network)
          [1667815270.315295][10645:10645] CHIP:SPL: Long discriminator:  3840   (0xf00)
          [1667815270.315346][10645:10645] CHIP:SPL: Passcode:            20202021
      disabled: true

    - label:
          "Step 1b: Using the TH, parse the Onboarding payload from previous
          step and verify that the Discriminator and Passcode for DUT1 are
          present."
      verification: |
          DUT1 Descriminator: 3840
          DUT1 Passcode: 20202021
      disabled: true

    - label:
          "Step 2a: Using the TH Onboarding payload reader, scan or read the
          Onboarding payload from DUT2"
      verification: |
          1.Run DUT. Example for DUT=all-clusters app
          ./chip-all-clusters-app --version 0 --vendor-id 0xFFF1 --product-id 0x8001 --custom-flow 2 --capabilities 4 --discriminator 3841 --passcode 20202022

          2. Parse payload for DUT2

          ./chip-tool payload parse-setup-payload MT:-24J0ALY010O0648G00
          Verify in TH (CHIP-TOOL)

          [1651194577916] [16053:466154] CHIP: [SPL] Parsing base38Representation: MT:-24J0IRV01WCCN68G00
          [1651194577916] [16053:466154] CHIP: [SPL] CommissioningFlow: 0
          [1651194577916] [16053:466154] CHIP: [SPL] VendorID: 65521
          [1651194577916] [16053:466154] CHIP: [SPL] Version: 0
          [1651194577916] [16053:466154] CHIP: [SPL] ProductID: 32769
          [1651194577916] [16053:466154] CHIP: [SPL] Discriminator: 3841
          [1651194577916] [16053:466154] CHIP: [SPL] SetUpPINCode: 20212022
          [1651194577916] [16053:466154] CHIP: [SPL] RendezvousInformation: 4
      disabled: true

    - label:
          "Step 2b: Using the TH, parse the Onboarding payload from previous
          step and verify that the Discriminator and Passcode for DUT2 are
          present."
      verification: |
          DUT2 Descriminator: 3841
          DUT2 Passcode: 20212022
      disabled: true

    - label:
          "Step 3: Compare the Discriminator values for DUT1 (Step 1.b) and DUT2
          (Step 2b)"
      verification: |
          1. Verify DUT1 Descriminator in Step 1.b is NOT equal to DUT2 Descriminator in Step 2.b
      disabled: true

    - label:
          "Step 4: Compare the Passcode values for DUT1 (Step 1.b) and DUT2
          (Step 2b)"
      verification: |
          Verify DUT1 Passcode in step 1b is not equal DUT2 Passcode in step 2b
      disabled: true
