# 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-TBRM-2.4] Verify that getting Active or Pending Dataset in the PASE
    session results in unsupported access"

PICS:
    - TBRM.S

config:
    nodeId: 0x12344321
    cluster: Thread Border Router Management
    endpoint: 1

    EcmPayload: "MT:00000EBQ15J.JP67600"
    EcmDiscriminator: 3501
    EcmPakeVerifier:
        type: octet_string
        defaultValue: "hex:d0e8a02db8629e9d172dfd40719c89204ff395651a6a2612839a71469880ec2404687d05cf0642b91242c712b5405b6905070c2a4bd80bdc8437ae5a2aded0cf3de91318d16f0ce9450d1c802cc01f39b8761de87cc7eeeb7f52b51308353da49a"

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

    - label: "Open Commissioning Window"
      endpoint: 0
      cluster: Administrator Commissioning
      command: OpenCommissioningWindow
      timedInteractionTimeoutMs: 2000
      arguments:
          values:
              - name: CommissioningTimeout
                value: 180
              - name: PAKEPasscodeVerifier
                value: EcmPakeVerifier
              - name: Discriminator
                value: EcmDiscriminator
              - name: Iterations
                value: 1000
              - name: Salt
                value: "SPAKE2P Key Salt"

    - label: "TH2  establishes a PASE session with the DUT"
      identity: beta
      cluster: CommissionerCommands
      endpoint: 0
      command: EstablishPASESession
      arguments:
          values:
              - name: nodeId
                value: nodeId
              - name: payload
                value: EcmPayload

    - label:
          "TH2 send GetActiveDatasetRequest command to the DUT in PASE session"
      identity: beta
      command: GetActiveDatasetRequest
      response:
          error: UNSUPPORTED_ACCESS

    - label:
          "TH2 send GetPendingDatasetRequest command to the DUT in PASE session"
      identity: beta
      command: GetPendingDatasetRequest
      response:
          error: UNSUPPORTED_ACCESS

    - label: "Cleanup: Close the commissioning window"
      endpoint: 0
      cluster: Administrator Commissioning
      command: RevokeCommissioning
      timedInteractionTimeoutMs: 2000
