From 14c375fb665b934078c3e9ed9092817645ec9f08 Mon Sep 17 00:00:00 2001 From: Vivien Nicolas Date: Tue, 12 Dec 2023 17:35:39 +0100 Subject: [PATCH] Add more YAML tests for the diagnostic logs cluster but related to BDX this time --- scripts/tests/chiptest/__init__.py | 1 + src/app/tests/suites/TestDiagnosticLogs.yaml | 469 ++++++++++++++++--- 2 files changed, 403 insertions(+), 67 deletions(-) diff --git a/scripts/tests/chiptest/__init__.py b/scripts/tests/chiptest/__init__.py index 6e52020cb9a9ee..f72647f272e5b3 100644 --- a/scripts/tests/chiptest/__init__.py +++ b/scripts/tests/chiptest/__init__.py @@ -199,6 +199,7 @@ def _GetChipReplUnsupportedTests() -> Set[str]: "Test_TC_ACL_2_5.yaml", # chip-repl does not support LastReceivedEventNumber : https://github.com/project-chip/connectedhomeip/issues/28884 "Test_TC_ACL_2_6.yaml", # chip-repl does not support LastReceivedEventNumber : https://github.com/project-chip/connectedhomeip/issues/28884 "Test_TC_RVCCLEANM_3_3.yaml", # chip-repl does not support EqualityCommands pseudo-cluster + "TestDiagnosticLogs.yaml", # chip-repl does not implement a BDXTransferServerDelegate } diff --git a/src/app/tests/suites/TestDiagnosticLogs.yaml b/src/app/tests/suites/TestDiagnosticLogs.yaml index 6b3b17d0ea0163..cf31a96b8ddf58 100644 --- a/src/app/tests/suites/TestDiagnosticLogs.yaml +++ b/src/app/tests/suites/TestDiagnosticLogs.yaml @@ -28,6 +28,9 @@ config: 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" + tests: # # Set up the test by adding some destination log files for the target accessory: @@ -67,6 +70,36 @@ tests: 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" @@ -98,26 +131,16 @@ tests: response: values: - name: "Status" - value: 2 # NoLogs + value: 0 # Success - name: "LogContent" - value: "" - - - 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: "Read End User Support log intent" + - label: "Read NetworkDiag intent" command: "RetrieveLogsRequest" arguments: values: - name: "Intent" - value: 0 # EndUserSupport + value: 1 # NetworkDiag - name: "RequestedProtocol" value: 0 # ResponsePayload response: @@ -125,39 +148,39 @@ tests: - name: "Status" value: 0 # Success - name: "LogContent" - value: end_user_support_log_file_content + value: network_diagnostics_log_file_content - - label: "Read NetworkDiag intent" + - label: "Read CrashLogs intent" command: "RetrieveLogsRequest" arguments: values: - name: "Intent" - value: 1 # NetworkDiag + value: 2 # CrashLogs - name: "RequestedProtocol" value: 0 # ResponsePayload response: values: - name: "Status" - value: 2 # NoLogs + value: 0 # Success - name: "LogContent" - value: "" + value: crash_log_file_content - - label: "Create NetworkDiag logs" + - label: "Write End User Support logs to be over the 1024 bytes limit" cluster: "SystemCommands" command: "CreateFile" arguments: values: - name: "filePath" - value: network_diagnostics_log_file_path + value: end_user_support_log_file_path - name: "fileContent" - value: network_diagnostics_log_file_content + value: end_user_support_log_file_content_long - - label: "Read NetworkDiag intent" + - label: "Read End User Support log intent" command: "RetrieveLogsRequest" arguments: values: - name: "Intent" - value: 1 # NetworkDiag + value: 0 # EndUserSupport - name: "RequestedProtocol" value: 0 # ResponsePayload response: @@ -165,47 +188,42 @@ tests: - 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: 2 # NoLogs - - name: "LogContent" - value: "" + constraints: + minLength: 1024 + maxLength: 1024 - - label: "Create CrashLogs logs" + - label: "Write End User Support logs back to the previous value" cluster: "SystemCommands" command: "CreateFile" arguments: values: - name: "filePath" - value: crash_log_file_path + value: end_user_support_log_file_path - name: "fileContent" - value: crash_log_file_content + value: end_user_support_log_file_content - - label: "Read CrashLogs intent" + # + # 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: 2 # CrashLogs + value: 0 # EndUserSupport - name: "RequestedProtocol" - value: 0 # ResponsePayload + value: 1 # BDX + - name: "TransferFileDesignator" + value: "ItDoesNotMatterForThisTest" response: values: - name: "Status" - value: 0 # Success + value: 1 # Exhausted - name: "LogContent" - value: crash_log_file_content + value: end_user_support_log_file_content - label: "Write End User Support logs to be over the 1024 bytes limit" cluster: "SystemCommands" @@ -217,40 +235,82 @@ tests: - name: "fileContent" value: end_user_support_log_file_content_long - - label: "Read End User Support log intent" + # 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: 0 # ResponsePayload + value: 1 # BDX + - name: "TransferFileDesignator" + value: bdx_transfer_file_name response: values: - name: "Status" value: 0 # Success - name: "LogContent" - constraints: - minLength: 1024 - maxLength: 1024 + value: "" - - label: "Write End User Support logs back to the previous 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: "CreateFile" + command: "CompareFiles" arguments: values: - - name: "filePath" + - name: "file1" value: end_user_support_log_file_path - - name: "fileContent" - value: end_user_support_log_file_content + - name: "file2" + value: bdx_transfer_file_path - # - # 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" + # 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: @@ -259,13 +319,13 @@ tests: - name: "RequestedProtocol" value: 1 # BDX - name: "TransferFileDesignator" - value: "ItDoesNotMatterForThisTest" + value: "Error:OnTransferBegin" # Should issue an error when SendInit is received. response: values: - name: "Status" - value: 1 # Exhausted + value: 4 # Denied - name: "LogContent" - value: end_user_support_log_file_content + 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. @@ -323,3 +383,278 @@ tests: 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