blob: 2e512d962678c3ac59fb9efcf742322be82e2d02 [file] [log] [blame]
# 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.
name: Diagnostic Logs Tests
config:
nodeId: 0x12344321
cluster: "Diagnostic Logs"
endpoint: 0
timeout: 120
end_user_support_log_file_path: "/tmp/end_user_support_log.txt"
end_user_support_log_file_content: "End User Support Log Content"
end_user_support_log_file_content_long:
"End User Support Log Content is more than 1024
bytes............................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................X"
network_diagnostics_log_file_path: "/tmp/network_diagnostics_log.txt"
network_diagnostics_log_file_content: "Network Diagnostic Log Content"
crash_log_file_path: "/tmp/crash_log.txt"
crash_log_file_content: "Crash Log Content"
bdx_transfer_file_path: "/tmp/end_user_support_bdx_output.txt"
bdx_transfer_file_name: "end_user_support_bdx_output.txt"
bdx_transfer_file_path_1: "/tmp/bdx_log_output_1.txt"
bdx_transfer_file_name_1: "bdx_log_output_1.txt"
bdx_transfer_file_path_2: "/tmp/bdx_log_output_2.txt"
bdx_transfer_file_name_2: "bdx_log_output_2.txt"
long_log_file_content:
"This is a long log content...
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
.......................................................
......................................................."
tests:
#
# Set up the test by adding some destination log files for the target accessory:
# 1. End User Support
# 2. Network Diagnostics
# 3. Crash
#
# The first thing to do is to delete them if they exist. It could be some
# left over from a previous test run.
#
- label: "Delete EndUserSupport logs"
cluster: "SystemCommands"
command: "DeleteFile"
arguments:
values:
- name: "filePath"
value: end_user_support_log_file_path
- label: "Delete NetworkDiag logs"
cluster: "SystemCommands"
command: "DeleteFile"
arguments:
values:
- name: "filePath"
value: network_diagnostics_log_file_path
- label: "Delete CrashLogs logs"
cluster: "SystemCommands"
command: "DeleteFile"
arguments:
values:
- name: "filePath"
value: crash_log_file_path
- label: "Stop the accessory"
cluster: "SystemCommands"
command: "Stop"
- label: "Create End User Support logs"
cluster: "SystemCommands"
command: "CreateFile"
arguments:
values:
- name: "filePath"
value: end_user_support_log_file_path
- name: "fileContent"
value: end_user_support_log_file_content
- label: "Create NetworkDiag logs"
cluster: "SystemCommands"
command: "CreateFile"
arguments:
values:
- name: "filePath"
value: network_diagnostics_log_file_path
- name: "fileContent"
value: network_diagnostics_log_file_content
- label: "Create CrashLogs logs"
cluster: "SystemCommands"
command: "CreateFile"
arguments:
values:
- name: "filePath"
value: crash_log_file_path
- name: "fileContent"
value: crash_log_file_content
- label: "Start the accessory with the destination logs files"
cluster: "SystemCommands"
command: "Start"
arguments:
values:
- name: "endUserSupportLogPath"
value: end_user_support_log_file_path
- name: "networkDiagnosticsLogPath"
value: network_diagnostics_log_file_path
- name: "crashLogPath"
value: crash_log_file_path
- label: "Wait for the commissioned device to be retrieved"
cluster: "DelayCommands"
command: "WaitForCommissionee"
arguments:
values:
- name: "nodeId"
value: nodeId
- label: "Read End User Support log intent"
command: "RetrieveLogsRequest"
arguments:
values:
- name: "Intent"
value: 0 # EndUserSupport
- name: "RequestedProtocol"
value: 0 # ResponsePayload
response:
values:
- name: "Status"
value: 0 # Success
- name: "LogContent"
value: end_user_support_log_file_content
- label: "Read NetworkDiag intent"
command: "RetrieveLogsRequest"
arguments:
values:
- name: "Intent"
value: 1 # NetworkDiag
- name: "RequestedProtocol"
value: 0 # ResponsePayload
response:
values:
- name: "Status"
value: 0 # Success
- name: "LogContent"
value: network_diagnostics_log_file_content
- label: "Read CrashLogs intent"
command: "RetrieveLogsRequest"
arguments:
values:
- name: "Intent"
value: 2 # CrashLogs
- name: "RequestedProtocol"
value: 0 # ResponsePayload
response:
values:
- name: "Status"
value: 0 # Success
- name: "LogContent"
value: crash_log_file_content
- label: "Write End User Support logs to be over the 1024 bytes limit"
cluster: "SystemCommands"
command: "CreateFile"
arguments:
values:
- name: "filePath"
value: end_user_support_log_file_path
- name: "fileContent"
value: end_user_support_log_file_content_long
- label: "Read End User Support log intent"
command: "RetrieveLogsRequest"
arguments:
values:
- name: "Intent"
value: 0 # EndUserSupport
- name: "RequestedProtocol"
value: 0 # ResponsePayload
response:
values:
- name: "Status"
value: 0 # Success
- name: "LogContent"
constraints:
minLength: 1024
maxLength: 1024
- label: "Write End User Support logs back to the previous value"
cluster: "SystemCommands"
command: "CreateFile"
arguments:
values:
- name: "filePath"
value: end_user_support_log_file_path
- name: "fileContent"
value: end_user_support_log_file_content
#
# Check BDX Implementation
#
# In the case where the Node is able to fit the entirety of the requested logs within the LogContent field, the Status field of
# the RetrieveLogsResponse SHALL be set to Exhausted and a BDX session SHALL NOT be initiated.
- label: "Read End User Support log using BDX"
command: "RetrieveLogsRequest"
arguments:
values:
- name: "Intent"
value: 0 # EndUserSupport
- name: "RequestedProtocol"
value: 1 # BDX
- name: "TransferFileDesignator"
value: "ItDoesNotMatterForThisTest"
response:
values:
- name: "Status"
value: 1 # Exhausted
- name: "LogContent"
value: end_user_support_log_file_content
- label: "Write End User Support logs to be over the 1024 bytes limit"
cluster: "SystemCommands"
command: "CreateFile"
arguments:
values:
- name: "filePath"
value: end_user_support_log_file_path
- name: "fileContent"
value: end_user_support_log_file_content_long
# If the RequestedProtocol is set to BDX the Node SHOULD immediately realize the RetrieveLogsResponse command by initiating a BDX
# Transfer, sending a BDX SendInit message with the File Designator field of the message set to the value of the TransferFileDesignator
# field of the RetrieveLogsRequest.
# On reception of a BDX SendAccept message the Node SHALL send a RetrieveLogsResponse command with a Status field set to Success and
# proceed with the log transfer over BDX.
- label: "Delete possible leftover from previous run"
cluster: "SystemCommands"
command: "DeleteFile"
arguments:
values:
- name: "filePath"
value: bdx_transfer_file_path
- label: "BDX: Request End User Support"
command: "RetrieveLogsRequest"
arguments:
values:
- name: "Intent"
value: 0 # EndUserSupport
- name: "RequestedProtocol"
value: 1 # BDX
- name: "TransferFileDesignator"
value: bdx_transfer_file_name
response:
values:
- name: "Status"
value: 0 # Success
- name: "LogContent"
value: ""
- label:
"BDX: Request End User Support while the previous request is running"
command: "RetrieveLogsRequest"
arguments:
values:
- name: "Intent"
value: 0 # EndUserSupport
- name: "RequestedProtocol"
value: 1 # BDX
- name: "TransferFileDesignator"
value: "ItDoesNotMatterForThisBusyTest"
response:
values:
- name: "Status"
value: 3 # Busy
- name: "LogContent"
value: ""
- label: "BDX: Wait for 'Diagnostic logs transfer: Success' message"
cluster: "DelayCommands"
command: "WaitForMessage"
arguments:
values:
- name: "registerKey"
value: "default"
- name: "message"
value: "Diagnostic logs transfer: Success"
- label:
"Compare the content the original log and the file that has been
created as the result of the BDX transfer"
cluster: "SystemCommands"
command: "CompareFiles"
arguments:
values:
- name: "file1"
value: end_user_support_log_file_path
- name: "file2"
value: bdx_transfer_file_path
# If a failure StatusReport is received in response to the SendInit message, the Node SHALL send a RetrieveLogsResponse command with a
# Status of Denied.
- label:
"BDX: Request End User Support log with a special
TransferFileDesignator name that forces the responder to issue an
error when SendInit is received"
command: "RetrieveLogsRequest"
arguments:
values:
- name: "Intent"
value: 0 # EndUserSupport
- name: "RequestedProtocol"
value: 1 # BDX
- name: "TransferFileDesignator"
value: "Error:OnTransferBegin" # Should issue an error when SendInit is received.
response:
values:
- name: "Status"
value: 4 # Denied
- name: "LogContent"
value: ""
#
# If the Intent and/or the RequestedProtocol arguments contain invalid (out of range) values the command SHALL fail with a Status Code of INVALID_COMMAND.
#
- label: "Read unknown log intent"
command: "RetrieveLogsRequest"
arguments:
values:
- name: "Intent"
value: IntentEnum.UnknownEnumValue(128)
- name: "RequestedProtocol"
value: 0 # ResponsePayload
response:
error: "INVALID_COMMAND"
- label: "Read known log intent on unknown protocol"
command: "RetrieveLogsRequest"
arguments:
values:
- name: "Intent"
value: 0 # EndUserSupport
- name: "RequestedProtocol"
value: TransferProtocolEnum.UnknownEnumValue(128)
response:
error: "INVALID_COMMAND"
#
# If the RequestedProtocol is set to BDX and there is no TransferFileDesignator the command SHALL fail with a Status Code of INVALID_COMMAND.
#
- label:
"Read End User Support log intent using BDX but without a
TransferFileDesignator"
command: "RetrieveLogsRequest"
arguments:
values:
- name: "Intent"
value: 0 # EndUserSupport
- name: "RequestedProtocol"
value: 1 # BDX
response:
error: "INVALID_COMMAND"
- label:
"Read End User Support log intent using BDX but with a
TransferFileDesignator that is longer than the kMaxFileDesignatorLen
character limit"
command: "RetrieveLogsRequest"
arguments:
values:
- name: "Intent"
value: 0 # EndUserSupport
- name: "RequestedProtocol"
value: 1 # BDX
- name: "TransferFileDesignator"
value: "ThisNameIsLongerThanThekMaxFileDesignatorLenCharacterConstraint"
response:
error: "CONSTRAINT_ERROR"
#
# Validate that a new BDX transfer can be started after a previous successful BDX transfer
#
- label: "Delete the result of the previous run"
cluster: "SystemCommands"
command: "DeleteFile"
arguments:
values:
- name: "filePath"
value: bdx_transfer_file_path
- label: "BDX: Request End User Support"
command: "RetrieveLogsRequest"
arguments:
values:
- name: "Intent"
value: 0 # EndUserSupport
- name: "RequestedProtocol"
value: 1 # BDX
- name: "TransferFileDesignator"
value: bdx_transfer_file_name
response:
values:
- name: "Status"
value: 0 # Success
- name: "LogContent"
value: ""
- label: "BDX: Wait for 'Diagnostic logs transfer: Success' message"
cluster: "DelayCommands"
command: "WaitForMessage"
arguments:
values:
- name: "registerKey"
value: "default"
- name: "message"
value: "Diagnostic logs transfer: Success"
- label:
"Compare the content the original log and the file that has been
created as the result of the BDX transfer"
cluster: "SystemCommands"
command: "CompareFiles"
arguments:
values:
- name: "file1"
value: end_user_support_log_file_path
- name: "file2"
value: bdx_transfer_file_path
- label: "Delete the result of the previous run"
cluster: "SystemCommands"
command: "DeleteFile"
arguments:
values:
- name: "filePath"
value: bdx_transfer_file_path
- label: "BDX: Request End User Support"
command: "RetrieveLogsRequest"
arguments:
values:
- name: "Intent"
value: 0 # EndUserSupport
- name: "RequestedProtocol"
value: 1 # BDX
- name: "TransferFileDesignator"
value: bdx_transfer_file_name
response:
values:
- name: "Status"
value: 0 # Success
- name: "LogContent"
value: ""
- label: "BDX: Wait for 'Diagnostic logs transfer: Success' message"
cluster: "DelayCommands"
command: "WaitForMessage"
arguments:
values:
- name: "registerKey"
value: "default"
- name: "message"
value: "Diagnostic logs transfer: Success"
- label:
"Compare the content the original log and the file that has been
created as the result of the BDX transfer"
cluster: "SystemCommands"
command: "CompareFiles"
arguments:
values:
- name: "file1"
value: end_user_support_log_file_path
- name: "file2"
value: bdx_transfer_file_path
- label: "Delete the result of the previous run"
cluster: "SystemCommands"
command: "DeleteFile"
arguments:
values:
- name: "filePath"
value: bdx_transfer_file_path
#
# Validate that a new BDX transfer can be started after a previous unsuccessful BDX transfer
#
- label: "Delete the result of the previous run"
cluster: "SystemCommands"
command: "DeleteFile"
arguments:
values:
- name: "filePath"
value: bdx_transfer_file_path
- label: "BDX: Request End User Support"
command: "RetrieveLogsRequest"
arguments:
values:
- name: "Intent"
value: 0 # EndUserSupport
- name: "RequestedProtocol"
value: 1 # BDX
- name: "TransferFileDesignator"
value: "Error:OnTransferBegin" # Should issue an error when SendInit is received.
response:
values:
- name: "Status"
value: 4 # kDenied
- name: "LogContent"
value: ""
- label: "BDX: Request End User Support"
command: "RetrieveLogsRequest"
arguments:
values:
- name: "Intent"
value: 0 # EndUserSupport
- name: "RequestedProtocol"
value: 1 # BDX
- name: "TransferFileDesignator"
value: bdx_transfer_file_name
response:
values:
- name: "Status"
value: 0 # Success
- name: "LogContent"
value: ""
- label: "BDX: Wait for 'Diagnostic logs transfer: Success' message"
cluster: "DelayCommands"
command: "WaitForMessage"
arguments:
values:
- name: "registerKey"
value: "default"
- name: "message"
value: "Diagnostic logs transfer: Success"
- label:
"Compare the content the original log and the file that has been
created as the result of the BDX transfer"
cluster: "SystemCommands"
command: "CompareFiles"
arguments:
values:
- name: "file1"
value: end_user_support_log_file_path
- name: "file2"
value: bdx_transfer_file_path
- label: "Delete the result of the previous run"
cluster: "SystemCommands"
command: "DeleteFile"
arguments:
values:
- name: "filePath"
value: bdx_transfer_file_path
#
# Validate that a new BDX transfer can be started after a previous unsuccessful BDX transfer
# stopped once the RetrieveLogsResponse has been sent/received.
#
- label: "Delete the result of the previous run"
cluster: "SystemCommands"
command: "DeleteFile"
arguments:
values:
- name: "filePath"
value: bdx_transfer_file_path
- label: "Delete possible leftover from previous run"
cluster: "SystemCommands"
command: "DeleteFile"
arguments:
values:
- name: "filePath"
value: "/tmp/Error:OnTransferData"
- label: "BDX: Request End User Support"
command: "RetrieveLogsRequest"
arguments:
values:
- name: "Intent"
value: 0 # EndUserSupport
- name: "RequestedProtocol"
value: 1 # BDX
- name: "TransferFileDesignator"
value: "Error:OnTransferData" # Should issue an error after SendInit is received.
response:
values:
- name: "Status"
value: 0 # kSuccess
- name: "LogContent"
value: ""
- label:
"BDX: Wait for 'Diagnostic logs transfer: StatusReport Error' message"
cluster: "DelayCommands"
command: "WaitForMessage"
arguments:
values:
- name: "registerKey"
value: "default"
- name: "message"
value: "Diagnostic logs transfer: StatusReport Error"
- label: "BDX: Request End User Support"
command: "RetrieveLogsRequest"
arguments:
values:
- name: "Intent"
value: 0 # EndUserSupport
- name: "RequestedProtocol"
value: 1 # BDX
- name: "TransferFileDesignator"
value: bdx_transfer_file_name
response:
values:
- name: "Status"
value: 0 # Success
- name: "LogContent"
value: ""
- label: "BDX: Wait for 'Diagnostic logs transfer: Success' message"
cluster: "DelayCommands"
command: "WaitForMessage"
arguments:
values:
- name: "registerKey"
value: "default"
- name: "message"
value: "Diagnostic logs transfer: Success"
- label:
"Compare the content the original log and the file that has been
created as the result of the BDX transfer"
cluster: "SystemCommands"
command: "CompareFiles"
arguments:
values:
- name: "file1"
value: end_user_support_log_file_path
- name: "file2"
value: bdx_transfer_file_path
- label: "Delete the result of the previous run"
cluster: "SystemCommands"
command: "DeleteFile"
arguments:
values:
- name: "filePath"
value: bdx_transfer_file_path
#
# Validate that multiple BDX transfers can run in parallels.
#
- label: "Delete possible leftover from previous run"
cluster: "SystemCommands"
command: "DeleteFile"
arguments:
values:
- name: "filePath"
value: bdx_transfer_file_path_1
- label: "Delete possible leftover from previous run"
cluster: "SystemCommands"
command: "DeleteFile"
arguments:
values:
- name: "filePath"
value: bdx_transfer_file_path_2
- label: "Update End User Support logs with a long log"
cluster: "SystemCommands"
command: "CreateFile"
arguments:
values:
- name: "filePath"
value: end_user_support_log_file_path
- name: "fileContent"
value: long_log_file_content
- label: "Update Network Diagnostic logs with a long log"
cluster: "SystemCommands"
command: "CreateFile"
arguments:
values:
- name: "filePath"
value: network_diagnostics_log_file_path
- name: "fileContent"
value: long_log_file_content
- label: "Start a second accessory"
cluster: "SystemCommands"
command: "Start"
arguments:
values:
- name: "discriminator"
value: 50
- name: "port"
value: 5601
- name: "kvs"
value: "/tmp/chip_kvs_second"
- name: "endUserSupportLogPath"
value: end_user_support_log_file_path
- name: "networkDiagnosticsLogPath"
value: network_diagnostics_log_file_path
- name: "registerKey"
value: "default#2"
- label: "Commission second accessory from beta"
identity: "beta"
cluster: "CommissionerCommands"
command: "PairWithCode"
arguments:
values:
- name: "nodeId"
value: nodeId
- name: "payload"
value: "MT:-24J0IX4122-.548G00"
- label: "Wait for the second commissioned device to be retrieved for beta"
identity: "beta"
cluster: "DelayCommands"
command: "WaitForCommissionee"
arguments:
values:
- name: "nodeId"
value: nodeId
- label: "BDX: Request End User Support from the first accessory"
command: "RetrieveLogsRequest"
identity: "alpha"
arguments:
values:
- name: "Intent"
value: 1 # NetworkDiagnostics
- name: "RequestedProtocol"
value: 1 # BDX
- name: "TransferFileDesignator"
value: bdx_transfer_file_name_1
response:
values:
- name: "Status"
value: 0 # Success
- name: "LogContent"
value: ""
- label: "BDX: Request End User Support from the second accessory"
command: "RetrieveLogsRequest"
identity: "beta"
arguments:
values:
- name: "Intent"
value: 1 # NetworkDiagnostics
- name: "RequestedProtocol"
value: 1 # BDX
- name: "TransferFileDesignator"
value: bdx_transfer_file_name_2
response:
values:
- name: "Status"
value: 0 # Success
- name: "LogContent"
value: ""
- label:
"BDX: Wait for 'Diagnostic logs transfer: Success' message from the
first accessory"
cluster: "DelayCommands"
command: "WaitForMessage"
arguments:
values:
- name: "registerKey"
value: "default"
- name: "message"
value: "Diagnostic logs transfer: Success"
- label:
"BDX: Wait for 'Diagnostic logs transfer: Success' message from the
second accessory"
cluster: "DelayCommands"
command: "WaitForMessage"
arguments:
values:
- name: "registerKey"
value: "default#2"
- name: "message"
value: "Diagnostic logs transfer: Success"
- label:
"Compare the content the original log and the file that has been
created as the result of the BDX transfer"
cluster: "SystemCommands"
command: "CompareFiles"
arguments:
values:
- name: "file1"
value: end_user_support_log_file_path
- name: "file2"
value: bdx_transfer_file_path_1
- label:
"Compare the content the original log and the file that has been
created as the result of the BDX transfer"
cluster: "SystemCommands"
command: "CompareFiles"
arguments:
values:
- name: "file1"
value: network_diagnostics_log_file_path
- name: "file2"
value: bdx_transfer_file_path_2
- label: "Delete the result of the previous run"
cluster: "SystemCommands"
command: "DeleteFile"
arguments:
values:
- name: "filePath"
value: bdx_transfer_file_path_1
- label: "Delete the result of the previous run"
cluster: "SystemCommands"
command: "DeleteFile"
arguments:
values:
- name: "filePath"
value: bdx_transfer_file_path_2