# Copyright (c) 2023 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.

# !!!!!!!!!! TEST INFORMATION !!!!!!!!!!!!!!!!!!
# This test covers multi fabric support for scenes cluster attributes such as LastConfiguredBy and FabricSceneInfo

name: Scenes Multi-fabric testing

PICS:
    - MCORE.ROLE.COMMISSIONEE
    - APPDEVICE.S
    - S.S
    - S.S.F03
    - S.S.A0007

config:
    nodeId: 0x12344321
    cluster: "Scenes Management"
    endpoint: 1
    payload:
        type: char_string
        defaultValue: "MT:-24J0AFN00KA0648G00"
    discriminator:
        type: int16u
        defaultValue: 3840
    waitAfterCommissioning:
        type: int16u
        defaultValue: 5000
    PakeVerifier:
        type: octet_string
        defaultValue: "hex:b96170aae803346884724fe9a3b287c30330c2a660375d17bb205a8cf1aecb350457f8ab79ee253ab6a8e46bb09e543ae422736de501e3db37d441fe344920d09548e4c18240630c4ff4913c53513839b7c07fcc0627a1b8573a149fcd1fa466cf"
    G1:
        type: group_id
        defaultValue: 0x0001
    G2:
        type: group_id
        defaultValue: 0x0002

tests:
    - label: "Commission DUT to TH1"
      cluster: "DelayCommands"
      command: "WaitForCommissionee"
      arguments:
          values:
              - name: "nodeId"
                value: nodeId

    - label: "TH1 reads the fabric index"
      cluster: "Operational Credentials"
      endpoint: 0
      command: "readAttribute"
      attribute: "CurrentFabricIndex"
      response:
          saveAs: th1FabricIndex

    - label: "Read the commissioner node ID from the alpha fabric"
      identity: "alpha"
      endpoint: 0
      cluster: "CommissionerCommands"
      command: "GetCommissionerNodeId"
      response:
          values:
              - name: "nodeId"
                saveAs: commissionerNodeIdAlpha

    - label: "Open Commissioning Window from alpha"
      endpoint: 0
      cluster: "Administrator Commissioning"
      command: "OpenCommissioningWindow"
      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: "Waiting after opening commissioning window"
      cluster: "DelayCommands"
      command: "WaitForMs"
      arguments:
          values:
              - name: "ms"
                value: waitAfterCommissioning

    - label: "Commission from TH2"
      identity: "beta"
      endpoint: 0
      cluster: "CommissionerCommands"
      command: "PairWithCode"
      arguments:
          values:
              - name: "nodeId"
                value: nodeId
              - name: "payload"
                value: payload

    - label: "Wait for the commissioned device to be retrieved for TH2"
      endpoint: 0
      identity: beta
      cluster: "DelayCommands"
      command: "WaitForCommissionee"
      arguments:
          values:
              - name: "nodeId"
                value: nodeId

    - label: "Step 4: TH2 reads the fabric index"
      identity: "beta"
      endpoint: 0
      cluster: "Operational Credentials"
      command: "readAttribute"
      attribute: "CurrentFabricIndex"
      response:
          saveAs: th2FabricIndex

    - label: "Read the commissioner node ID from the beta fabric"
      identity: "beta"
      endpoint: 0
      cluster: "CommissionerCommands"
      command: "GetCommissionerNodeId"
      response:
          values:
              - name: "nodeId"
                saveAs: commissionerNodeIdBeta

    - label: "Read the FabricSceneInfo attribute (0x0007) "
      command: "readAttribute"
      attribute: "FabricSceneInfo"
      response:
          constraints:
              type: list

    - label: "TH reads from the DUT the (0x0006) SceneTableSize attribute"
      command: "readAttribute"
      attribute: "SceneTableSize"
      response:
          values:
              - name: "SceneTableSize"
                saveAs: maxScenes

    - label: "Arithmetic operation to get the maxScenes - 1"
      cluster: "Unit Testing"
      command: "TestAddArguments"
      arguments:
          values:
              - name: "arg1"
                value: maxScenes - 1
              - name: "arg2"
                value: 0
      response:
          values:
              - name: "returnValue"
                saveAs: maxScenesMinusOne
                value: maxScenes - 1

    - label: "Arithmetic operation to get the fabric Capacity"
      cluster: "Unit Testing"
      command: "TestAddArguments"
      arguments:
          values:
              - name: "arg1"
                value: maxScenesMinusOne / 2
              - name: "arg2"
                value: 0
      response:
          values:
              - name: "returnValue"
                saveAs: fabricCapacity
                value: maxScenesMinusOne / 2

    - label: "Preparation step : TH 1 Add Group KeySet."
      cluster: "Group Key Management"
      endpoint: 0
      command: "KeySetWrite"
      arguments:
          values:
              - name: "GroupKeySet"
                value:
                    {
                        GroupKeySetID: 0x01a1,
                        GroupKeySecurityPolicy: 0,
                        EpochKey0: "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf",
                        EpochStartTime0: 1110000,
                        EpochKey1: "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf",
                        EpochStartTime1: 1110001,
                        EpochKey2: "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf",
                        EpochStartTime2: 1110002,
                    }

    - label: "Preparation step TH1 Map KeySets to GroupId."
      cluster: "Group Key Management"
      endpoint: 0
      command: "writeAttribute"
      attribute: "GroupKeyMap"
      arguments:
          value:
              [
                  { FabricIndex: 0, GroupId: G1, GroupKeySetID: 0x01a1 },
                  { FabricIndex: 0, GroupId: G2, GroupKeySetID: 0x01a1 },
              ]

    - label: "TH1 sends a RemoveAllGroups command to DUT."
      cluster: "Groups"
      command: "RemoveAllGroups"

    - label: "TH1 sends a AddGroup command to DUT for G1."
      cluster: "Groups"
      command: "AddGroup"
      arguments:
          values:
              - name: "GroupID"
                value: G1
              - name: "GroupName"
                value: "Group1"
      response:
          values:
              - name: "Status"
                value: 0
              - name: "GroupID"
                value: G1

    - label: "TH1 sends a AddGroup command to DUT for G2."
      cluster: "Groups"
      command: "AddGroup"
      arguments:
          values:
              - name: "GroupID"
                value: G2
              - name: "GroupName"
                value: "Group2"
      response:
          values:
              - name: "Status"
                value: 0
              - name: "GroupID"
                value: G2

    - label: "Preparation step : TH 2 Add Group KeySet."
      identity: "beta"
      cluster: "Group Key Management"
      endpoint: 0
      command: "KeySetWrite"
      arguments:
          values:
              - name: "GroupKeySet"
                value:
                    {
                        GroupKeySetID: 0x01a2,
                        GroupKeySecurityPolicy: 0,
                        EpochKey0: "\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf",
                        EpochStartTime0: 1120000,
                        EpochKey1: "\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf",
                        EpochStartTime1: 1120001,
                        EpochKey2: "\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf",
                        EpochStartTime2: 1120002,
                    }

    - label: "Preparation step TH1 Map KeySets to GroupId."
      identity: "beta"
      cluster: "Group Key Management"
      endpoint: 0
      command: "writeAttribute"
      attribute: "GroupKeyMap"
      arguments:
          value: [{ FabricIndex: 0, GroupId: G1, GroupKeySetID: 0x01a2 }]

    - label: "TH2 sends a AddGroup command to DUT for G1."
      identity: "beta"
      cluster: "Groups"
      command: "AddGroup"
      arguments:
          values:
              - name: "GroupID"
                value: G1
              - name: "GroupName"
                value: "Group1"
      response:
          values:
              - name: "Status"
                value: 0
              - name: "GroupID"
                value: G1

    - label: "TH1 confirms the Fabric Capacity is Maximum"
      command: "GetSceneMembership"
      arguments:
          values:
              - name: "GroupID"
                value: G1
      response:
          values:
              - name: "Status"
                value: 0x00
              - name: "Capacity"
                value: fabricCapacity
              - name: "GroupID"
                value: G1

    - label: "TH1 Reads LastConfiguredBy attribute"
      command: "readAttribute"
      attribute: "LastConfiguredBy"
      response:
          value: null

    - label: "TH2 reads LastConfiguredBy attribute"
      identity: "beta"
      command: "readAttribute"
      attribute: "LastConfiguredBy"
      response:
          value: null

    - label: "TH1 sends an AddScene command to DUT for Scene 1 G1"
      command: "AddScene"
      arguments:
          values:
              - name: "GroupID"
                value: G1
              - name: "SceneID"
                value: 0x01
              - name: "TransitionTime"
                value: 1000
              - name: "SceneName"
                value: "Scene1"
              - name: "ExtensionFieldSets"
                value:
                    [
                        {
                            ClusterID: 0x0006,
                            AttributeValueList:
                                [{ AttributeID: 0x0000, ValueUnsigned8: 0x01 }],
                        },
                        {
                            ClusterID: 0x0008,
                            AttributeValueList:
                                [{ AttributeID: 0x0000, ValueUnsigned8: 0x64 }],
                        },
                    ]
      response:
          values:
              - name: "Status"
                value: 0x00
              - name: "GroupID"
                value: G1
              - name: "SceneID"
                value: 0x01

    - label:
          "TH1 confirms the Scene was added to the Scene table by
          GetSceneMembership"
      command: "GetSceneMembership"
      arguments:
          values:
              - name: "GroupID"
                value: G1
      response:
          values:
              - name: "Status"
                value: 0x00
              - name: "Capacity"
                value: fabricCapacity -1
              - name: "GroupID"
                value: G1

    - label: "TH2 confirms the Scene membership wasn't affected for fabric 2"
      identity: "beta"
      command: "GetSceneMembership"
      arguments:
          values:
              - name: "GroupID"
                value: G1
      response:
          values:
              - name: "Status"
                value: 0x00
              - name: "Capacity"
                value: fabricCapacity
              - name: "GroupID"
                value: G1

    - label: "TH1 Read the FabricSceneInfo attribute (0x0007) "
      command: "readAttribute"
      attribute: "FabricSceneInfo"
      response:
          value:
              [
                  {
                      SceneCount: 1,
                      CurrentScene: 0x00,
                      CurrentGroup: 0x00,
                      FabricIndex: th1FabricIndex,
                      SceneValid: false,
                      RemainingCapacity: fabricCapacity - 1,
                  },
              ]

    - label: "TH2 Read the FabricSceneInfo attribute (0x0007) "
      identity: "beta"
      command: "readAttribute"
      attribute: "FabricSceneInfo"
      response:
          value: []
          # TODO : Have FabricSceneInfo initialized on adding a new fabric

    - label: "TH1 reads LastConfiguredBy attribute, should be TH1's nodeId"
      command: "readAttribute"
      attribute: "LastConfiguredBy"
      response:
          value: commissionerNodeIdAlpha

    - label: "TH2 reads LastConfiguredBy attribute, should be TH1's nodeId"
      identity: "beta"
      command: "readAttribute"
      attribute: "LastConfiguredBy"
      response:
          value: commissionerNodeIdAlpha

    - label: "TH2 sends an AddScene command to DUT for Scene 1 G1"
      identity: "beta"
      command: "AddScene"
      arguments:
          values:
              - name: "GroupID"
                value: G1
              - name: "SceneID"
                value: 0x01
              - name: "TransitionTime"
                value: 1000
              - name: "SceneName"
                value: "Scene1"
              - name: "ExtensionFieldSets"
                value:
                    [
                        {
                            ClusterID: 0x0006,
                            AttributeValueList:
                                [{ AttributeID: 0x0000, ValueUnsigned8: 0x01 }],
                        },
                        {
                            ClusterID: 0x0008,
                            AttributeValueList:
                                [{ AttributeID: 0x0000, ValueUnsigned8: 0x64 }],
                        },
                    ]
      response:
          values:
              - name: "Status"
                value: 0x00
              - name: "GroupID"
                value: G1
              - name: "SceneID"
                value: 0x01

    - label: "TH1 reads LastConfiguredBy attribute, should be TH2's nodeId"
      command: "readAttribute"
      attribute: "LastConfiguredBy"
      response:
          value: commissionerNodeIdBeta

    - label: "TH2 reads LastConfiguredBy attribute, should be TH2's nodeId"
      identity: "beta"
      command: "readAttribute"
      attribute: "LastConfiguredBy"
      response:
          value: commissionerNodeIdBeta

    - label: "TH2 sends a RecallScene command for Scene 1 Group 1"
      identity: "beta"
      command: "RecallScene"
      arguments:
          values:
              - name: "GroupID"
                value: G1
              - name: "SceneID"
                value: 0x01

    - label: "TH2 confirms the FabricSceneInfo attribute was properly updated"
      identity: "beta"
      command: "readAttribute"
      attribute: "FabricSceneInfo"
      response:
          value:
              [
                  {
                      SceneCount: 1,
                      CurrentScene: 0x01,
                      CurrentGroup: G1,
                      FabricIndex: th2FabricIndex,
                      SceneValid: true,
                      RemainingCapacity: fabricCapacity - 1,
                  },
              ]

    - label:
          "TH1 confirms there were no change to its FabricSceneInfo attribute"
      command: "readAttribute"
      attribute: "FabricSceneInfo"
      response:
          value:
              [
                  {
                      SceneCount: 1,
                      CurrentScene: 0x00,
                      CurrentGroup: 0x00,
                      FabricIndex: th1FabricIndex,
                      SceneValid: false,
                      RemainingCapacity: fabricCapacity - 1,
                  },
              ]

    - label: "TH1 copies Scene 1 from G1 to Scene 2 in G1"
      command: "CopyScene"
      arguments:
          values:
              - name: "Mode"
                value: 0x00
              - name: "GroupIdentifierFrom"
                value: G1
              - name: "SceneIdentifierFrom"
                value: 0x01
              - name: "GroupIdentifierTo"
                value: G1
              - name: "SceneIdentifierTo"
                value: 0x02
      response:
          values:
              - name: "Status"
                value: 0x00
              - name: "GroupIdentifierFrom"
                value: G1
              - name: "SceneIdentifierFrom"
                value: 0x01

    - label: "TH1 reads LastConfiguredBy attribute, should be TH1's nodeId"
      command: "readAttribute"
      attribute: "LastConfiguredBy"
      response:
          value: commissionerNodeIdAlpha

    - label: "TH2 reads LastConfiguredBy attribute, should be TH1's nodeId"
      identity: "beta"
      command: "readAttribute"
      attribute: "LastConfiguredBy"
      response:
          value: commissionerNodeIdAlpha

    - label: "TH2 confirms the FabricSceneInfo didn't change"
      identity: "beta"
      command: "readAttribute"
      attribute: "FabricSceneInfo"
      response:
          value:
              [
                  {
                      SceneCount: 1,
                      CurrentScene: 0x01,
                      CurrentGroup: G1,
                      FabricIndex: th2FabricIndex,
                      SceneValid: true,
                      RemainingCapacity: fabricCapacity - 1,
                  },
              ]

    - label:
          "TH1 confirms the update of FabricSceneInfo attribute with scene Valid
          still false"
      command: "readAttribute"
      attribute: "FabricSceneInfo"
      response:
          value:
              [
                  {
                      SceneCount: 2,
                      CurrentScene: 0x00,
                      CurrentGroup: 0x00,
                      FabricIndex: th1FabricIndex,
                      SceneValid: false,
                      RemainingCapacity: fabricCapacity - 2,
                  },
              ]

    - label: "TH2 Remove Scene 1 from G1"
      identity: "beta"
      command: "RemoveScene"
      arguments:
          values:
              - name: "GroupID"
                value: G1
              - name: "SceneID"
                value: 0x01
      response:
          values:
              - name: "Status"
                value: 0x00
              - name: "GroupID"
                value: G1
              - name: "SceneID"
                value: 0x01

    - label: "TH1 reads LastConfiguredBy attribute, should be TH2's nodeId"
      command: "readAttribute"
      attribute: "LastConfiguredBy"
      response:
          value: commissionerNodeIdBeta

    - label: "TH2 reads LastConfiguredBy attribute, should be TH2's nodeId"
      identity: "beta"
      command: "readAttribute"
      attribute: "LastConfiguredBy"
      response:
          value: commissionerNodeIdBeta

    - label: "TH2 confirms the FabricSceneInfo's update"
      identity: "beta"
      command: "readAttribute"
      attribute: "FabricSceneInfo"
      response:
          value:
              [
                  {
                      SceneCount: 0,
                      CurrentScene: 0x01,
                      CurrentGroup: G1,
                      FabricIndex: th2FabricIndex,
                      SceneValid: false,
                      RemainingCapacity: fabricCapacity,
                  },
              ]

    - label: "TH1 confirms its FabricSceneInfo remained unchanged"
      command: "readAttribute"
      attribute: "FabricSceneInfo"
      response:
          value:
              [
                  {
                      SceneCount: 2,
                      CurrentScene: 0x00,
                      CurrentGroup: 0x00,
                      FabricIndex: th1FabricIndex,
                      SceneValid: false,
                      RemainingCapacity: fabricCapacity - 2,
                  },
              ]

    - label: "TH1 copies all Scenes from G1 to G1"
      command: "CopyScene"
      arguments:
          values:
              - name: "Mode"
                value: 0x01
              - name: "GroupIdentifierFrom"
                value: G1
              - name: "SceneIdentifierFrom"
                value: 0x00
              - name: "GroupIdentifierTo"
                value: G2
              - name: "SceneIdentifierTo"
                value: 0x00
      response:
          values:
              - name: "Status"
                value: 0x00
              - name: "GroupIdentifierFrom"
                value: G1
              - name: "SceneIdentifierFrom"
                value: 0x00

    - label: "TH1 reads LastConfiguredBy attribute, should be TH1's nodeId"
      command: "readAttribute"
      attribute: "LastConfiguredBy"
      response:
          value: commissionerNodeIdAlpha

    - label: "TH2 reads LastConfiguredBy attribute, should be TH1's nodeId"
      identity: "beta"
      command: "readAttribute"
      attribute: "LastConfiguredBy"
      response:
          value: commissionerNodeIdAlpha

    - label: "TH2 confirms its FabricSceneInfo remained unchanged"
      identity: "beta"
      command: "readAttribute"
      attribute: "FabricSceneInfo"
      response:
          value:
              [
                  {
                      SceneCount: 0,
                      CurrentScene: 0x01,
                      CurrentGroup: G1,
                      FabricIndex: th2FabricIndex,
                      SceneValid: false,
                      RemainingCapacity: fabricCapacity,
                  },
              ]

    - label: "TH1 confirms its FabricSceneInfo was updated"
      command: "readAttribute"
      attribute: "FabricSceneInfo"
      response:
          value:
              [
                  {
                      SceneCount: 4,
                      CurrentScene: 0x00,
                      CurrentGroup: 0x00,
                      FabricIndex: th1FabricIndex,
                      SceneValid: false,
                      RemainingCapacity: fabricCapacity - 4,
                  },
              ]

    - label: "TH1 sends a RecallScene command for Scene 1 Group 2"
      command: "RecallScene"
      arguments:
          values:
              - name: "GroupID"
                value: G2
              - name: "SceneID"
                value: 0x01

    - label: "TH2 confirms its FabricSceneInfo remained unchanged"
      identity: "beta"
      command: "readAttribute"
      attribute: "FabricSceneInfo"
      response:
          value:
              [
                  {
                      SceneCount: 0,
                      CurrentScene: 0x01,
                      CurrentGroup: G1,
                      FabricIndex: th2FabricIndex,
                      SceneValid: false,
                      RemainingCapacity: fabricCapacity,
                  },
              ]

    - label: "TH1 confirms its FabricSceneInfo was updated"
      command: "readAttribute"
      attribute: "FabricSceneInfo"
      response:
          value:
              [
                  {
                      SceneCount: 4,
                      CurrentScene: 0x01,
                      CurrentGroup: G2,
                      FabricIndex: th1FabricIndex,
                      SceneValid: true,
                      RemainingCapacity: fabricCapacity - 4,
                  },
              ]

    - label: "TH2 Store the current DUT state to a new scene"
      identity: "beta"
      command: "StoreScene"
      arguments:
          values:
              - name: "GroupID"
                value: G1
              - name: "SceneID"
                value: 0x02
      response:
          values:
              - name: "Status"
                value: 0x00
              - name: "GroupID"
                value: G1
              - name: "SceneID"
                value: 0x02

    - label: "TH1 reads LastConfiguredBy attribute, should be TH2's nodeId"
      command: "readAttribute"
      attribute: "LastConfiguredBy"
      response:
          value: commissionerNodeIdBeta

    - label: "TH2 reads LastConfiguredBy attribute, should be TH2's nodeId"
      identity: "beta"
      command: "readAttribute"
      attribute: "LastConfiguredBy"
      response:
          value: commissionerNodeIdBeta

    - label: "TH2 confirms its FabricSceneInfo was updated"
      identity: "beta"
      command: "readAttribute"
      attribute: "FabricSceneInfo"
      response:
          value:
              [
                  {
                      SceneCount: 1,
                      CurrentScene: 0x02,
                      CurrentGroup: G1,
                      FabricIndex: th2FabricIndex,
                      SceneValid: true,
                      RemainingCapacity: fabricCapacity - 1,
                  },
              ]

    - label:
          "TH1 confirms its FabricSceneInfo's field SceneValid remains unchanged"
      command: "readAttribute"
      attribute: "FabricSceneInfo"
      response:
          value:
              [
                  {
                      SceneCount: 4,
                      CurrentScene: 0x01,
                      CurrentGroup: G2,
                      FabricIndex: th1FabricIndex,
                      SceneValid: true,
                      RemainingCapacity: fabricCapacity - 4,
                  },
              ]

    - label: "TH1 removes all scenes from G1"
      command: "RemoveAllScenes"
      arguments:
          values:
              - name: "GroupID"
                value: G1
      response:
          values:
              - name: "Status"
                value: 0
              - name: "GroupID"
                value: G1

    - label: "TH1 reads LastConfiguredBy attribute, should be TH1's nodeId"
      command: "readAttribute"
      attribute: "LastConfiguredBy"
      response:
          value: commissionerNodeIdAlpha

    - label: "TH2 reads LastConfiguredBy attribute, should be TH1's nodeId"
      identity: "beta"
      command: "readAttribute"
      attribute: "LastConfiguredBy"
      response:
          value: commissionerNodeIdAlpha

    - label: "TH2 confirms its FabricSceneInfo remained unchanged"
      identity: "beta"
      command: "readAttribute"
      attribute: "FabricSceneInfo"
      response:
          value:
              [
                  {
                      SceneCount: 1,
                      CurrentScene: 0x02,
                      CurrentGroup: G1,
                      FabricIndex: th2FabricIndex,
                      SceneValid: true,
                      RemainingCapacity: fabricCapacity - 1,
                  },
              ]

    - label:
          "TH1 confirms its FabricSceneInfo's field SceneCount and
          RemainingCapacity were updated"
      command: "readAttribute"
      attribute: "FabricSceneInfo"
      response:
          value:
              [
                  {
                      SceneCount: 2,
                      CurrentScene: 0x01,
                      CurrentGroup: G2,
                      FabricIndex: th1FabricIndex,
                      SceneValid: true,
                      RemainingCapacity: fabricCapacity - 2,
                  },
              ]

    - label: "TH2 Remove Scene 2 from G1"
      identity: "beta"
      command: "RemoveScene"
      arguments:
          values:
              - name: "GroupID"
                value: G1
              - name: "SceneID"
                value: 0x02
      response:
          values:
              - name: "Status"
                value: 0x00
              - name: "GroupID"
                value: G1
              - name: "SceneID"
                value: 0x02

    - label: "TH1 reads LastConfiguredBy attribute, should be TH2's nodeId"
      command: "readAttribute"
      attribute: "LastConfiguredBy"
      response:
          value: commissionerNodeIdBeta

    - label: "TH2 reads LastConfiguredBy attribute, should be TH2's nodeId"
      identity: "beta"
      command: "readAttribute"
      attribute: "LastConfiguredBy"
      response:
          value: commissionerNodeIdBeta

    - label: "TH2 confirms its FabricSceneInfo was updated"
      identity: "beta"
      command: "readAttribute"
      attribute: "FabricSceneInfo"
      response:
          value:
              [
                  {
                      SceneCount: 0,
                      CurrentScene: 0x02,
                      CurrentGroup: G1,
                      FabricIndex: th2FabricIndex,
                      SceneValid: false,
                      RemainingCapacity: fabricCapacity,
                  },
              ]

    - label: "TH1 confirms its FabricSceneInfo remained unchanged"
      command: "readAttribute"
      attribute: "FabricSceneInfo"
      response:
          value:
              [
                  {
                      SceneCount: 2,
                      CurrentScene: 0x01,
                      CurrentGroup: G2,
                      FabricIndex: th1FabricIndex,
                      SceneValid: true,
                      RemainingCapacity: fabricCapacity - 2,
                  },
              ]

    - label: "TH1 removes all scenes from G2"
      command: "RemoveAllScenes"
      arguments:
          values:
              - name: "GroupID"
                value: G2
      response:
          values:
              - name: "Status"
                value: 0
              - name: "GroupID"
                value: G2

    - label: "TH1 reads LastConfiguredBy attribute, should be TH2's nodeId"
      command: "readAttribute"
      attribute: "LastConfiguredBy"
      response:
          value: commissionerNodeIdAlpha

    - label: "TH2 reads LastConfiguredBy attribute, should be TH2's nodeId"
      identity: "beta"
      command: "readAttribute"
      attribute: "LastConfiguredBy"
      response:
          value: commissionerNodeIdAlpha

    - label: "TH2 confirms its FabricSceneInfo remained unchanged"
      identity: "beta"
      command: "readAttribute"
      attribute: "FabricSceneInfo"
      response:
          value:
              [
                  {
                      SceneCount: 0,
                      CurrentScene: 0x02,
                      CurrentGroup: G1,
                      FabricIndex: th2FabricIndex,
                      SceneValid: false,
                      RemainingCapacity: fabricCapacity,
                  },
              ]

    - label: "TH1 confirms its FabricSceneInfo was updated"
      command: "readAttribute"
      attribute: "FabricSceneInfo"
      response:
          value:
              [
                  {
                      SceneCount: 0,
                      CurrentScene: 0x01,
                      CurrentGroup: G2,
                      FabricIndex: th1FabricIndex,
                      SceneValid: false,
                      RemainingCapacity: fabricCapacity,
                  },
              ]
