# 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.2.2. [TC-DGWIFI-2.2] Event Functionality [DUT as Server]

PICS:
    - DGWIFI.S

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

tests:
    - label: "Step 1: Commission DUT to TH"
      verification: |

      disabled: true

    - label:
          "Step 2: Disconnect node WiFi as a result of de-authentication or
          dis-association."
      PICS: DGWIFI.S.E00
      verification: |
          Disconnection is an optional event so its not compulsory to get the expected outcome,Below is the log of RPI the result may be vary on the basis of dut implementation.

          ./chip-tool wifinetworkdiagnostics read-event disconnection 1 0

          Via the TH (chip-tool), verify that the Disconnection event contains Reason code is in the type of uint16.

          [1655734228.476828][18708:18713] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_0036 Event 0x0000_0000
          [1655734228.476890][18708:18713] CHIP:TOO:          Event number: 2
          [1655734228.476945][18708:18713] CHIP:TOO:          Priority: Info
          [1655734228.476998][18708:18713] CHIP:TOO:          Timestamp: 30160685
          [1655734228.477141][18708:18713] CHIP:TOO:   Disconnection: {
          [1655734228.477215][18708:18713] CHIP:TOO:     ReasonCode: 65533
          [1655734228.477271][18708:18713] CHIP:TOO:    }
      disabled: true

    - label:
          "Step 3: Disconnect node WiFi as a result of de-authentication or
          dis-association. DUT exhausts all internal retries."
      PICS: DGWIFI.S.E01
      verification: |
          AssociationFailure is an Optional event so its not compulsory to get the expected outcome, Below is the log of RPI the result may be vary on the basis of dut implementation.

          ./chip-tool wifinetworkdiagnostics read-event association-failure 1 0

          Via the TH (chip-tool), verify:
          -that the AssociationFailure event contains AssociationFailure cause and status field values.
          -that AssociationFailure cause value is match with AssociationFailure cause(0 to 3) enum table.
          -that Status field value is match with spec.

           CHIP:DMG: ReportDataMessage =
          [1651574380.297222][8941:8946] CHIP:DMG: {
          [1651574380.297245][8941:8946] CHIP:DMG:         SuppressResponse = true,
          [1651574380.297270][8941:8946] CHIP:DMG:         InteractionModelRevision = 1
          [1651574380.297293][8941:8946] CHIP:DMG: }
          [1651574380.297374][8941:8946] CHIP:EM: Sending Standalone Ack for MessageCounter:12534430 on exchange 15170i
      disabled: true

    - label: "Step 4: Disconnect and reconnect node WiFi."
      PICS: DGWIFI.S.E02
      verification: |
          ConnectionStatus is an Optional event so its not compulsory to get the expected outcome, Below is the log of RPI the result may be vary on the basis of dut implementation.

          ./chip-tool wifinetworkdiagnostics read-event connection-status 1 0

          Via the TH (chip-tool), verify:
          -that the ConnectionStatus event contains ConnectionStatus value.
          -that value either 0 or 1 as per ConnectionStatus ENUM table.

          [1655734276.513474][18731:18736] CHIP:TOO: Endpoint: 0 Cluster: 0x0000_0036 Event 0x0000_0002
          [1655734276.513504][18731:18736] CHIP:TOO:          Event number: 3
          [1655734276.513526][18731:18736] CHIP:TOO:          Priority: Info
          [1655734276.513548][18731:18736] CHIP:TOO:          Timestamp: 30160685
          [1655734276.513621][18731:18736] CHIP:TOO:   ConnectionStatus: {
          [1655734276.513659][18731:18736] CHIP:TOO:     ConnectionStatus: 0
          [1655734276.513733][18731:18736] CHIP:TOO:    }
      disabled: true
