| Rahul Maheshwari | ad676bf | 2017-06-22 15:06:05 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | |
| 3 | Documentation Test dump functionality of OpenBMC. |
| 4 | |
| George Keishing | fb3f9a5 | 2019-07-18 13:13:58 -0500 | [diff] [blame] | 5 | Resource ../../lib/openbmc_ffdc.robot |
| 6 | Resource ../../lib/rest_client.robot |
| 7 | Resource ../../lib/dump_utils.robot |
| 8 | Resource ../../lib/boot_utils.robot |
| 9 | Resource ../../lib/utils.robot |
| George Keishing | bac0c57 | 2019-08-08 23:19:45 -0500 | [diff] [blame] | 10 | Resource ../../lib/state_manager.robot |
| George Keishing | fb3f9a5 | 2019-07-18 13:13:58 -0500 | [diff] [blame] | 11 | Library ../../lib/bmc_ssh_utils.py |
| Rahul Maheshwari | ad676bf | 2017-06-22 15:06:05 -0500 | [diff] [blame] | 12 | |
| Rahul Maheshwari | a89ff9e | 2020-09-25 05:04:33 -0500 | [diff] [blame] | 13 | Suite Setup Suite Setup Execution |
| Rahul Maheshwari | ad676bf | 2017-06-22 15:06:05 -0500 | [diff] [blame] | 14 | Test Setup Open Connection And Log In |
| George Keishing | 40b7ee0 | 2017-11-13 05:12:41 -0600 | [diff] [blame] | 15 | Test Teardown Test Teardown Execution |
| Rahul Maheshwari | ad676bf | 2017-06-22 15:06:05 -0500 | [diff] [blame] | 16 | |
| Igor Kanyuka | feb79d6 | 2025-10-20 21:24:03 +0100 | [diff] [blame^] | 17 | Test Tags BMC_Dump |
| 18 | |
| Rahul Maheshwari | ad676bf | 2017-06-22 15:06:05 -0500 | [diff] [blame] | 19 | *** Test Cases *** |
| 20 | |
| Anusha Dathatri | eda0949 | 2019-02-26 08:30:13 -0600 | [diff] [blame] | 21 | Verify Dump After Host Watchdog Error Injection |
| 22 | [Documentation] Inject host watchdog error and verify whether dump is generated. |
| 23 | [Tags] Verify_Dump_After_Host_Watchdog_Error_Injection |
| 24 | |
| George Keishing | fb3f9a5 | 2019-07-18 13:13:58 -0500 | [diff] [blame] | 25 | Redfish Power On |
| Anusha Dathatri | eda0949 | 2019-02-26 08:30:13 -0600 | [diff] [blame] | 26 | |
| Tim Lee | c4238a8 | 2021-12-16 11:25:16 +0800 | [diff] [blame] | 27 | Run Keyword And Ignore Error Redfish Delete All BMC Dumps |
| Anusha Dathatri | eda0949 | 2019-02-26 08:30:13 -0600 | [diff] [blame] | 28 | |
| 29 | # Enable auto reboot |
| 30 | Set Auto Reboot ${1} |
| 31 | |
| Tim Lee | 3edb024 | 2021-12-23 14:04:58 +0800 | [diff] [blame] | 32 | Set Watchdog Interval Using Busctl 2000 |
| Anusha Dathatri | eda0949 | 2019-02-26 08:30:13 -0600 | [diff] [blame] | 33 | |
| 34 | Wait Until Keyword Succeeds 300 sec 20 sec Is Host Rebooted |
| 35 | |
| 36 | #Get dump details |
| 37 | @{dump_entry_list}= Read Properties ${DUMP_ENTRY_URI} |
| 38 | |
| George Keishing | 16b3c7b | 2021-01-28 09:23:37 -0600 | [diff] [blame] | 39 | # Verifying that there is only one dump |
| Anusha Dathatri | eda0949 | 2019-02-26 08:30:13 -0600 | [diff] [blame] | 40 | ${length}= Get length ${dump_entry_list} |
| 41 | Should Be Equal As Integers ${length} ${1} |
| 42 | |
| 43 | # Get dump id |
| 44 | ${value}= Get From List ${dump_entry_list} 0 |
| 45 | @{split_value}= Split String ${value} / |
| 46 | ${dump_id}= Get From List ${split_value} -1 |
| 47 | |
| 48 | # Max size for dump is 200k = 200x1024 |
| 49 | ${dump_size}= Read Attribute ${DUMP_ENTRY_URI}${dump_id} Size |
| 50 | Should Be True 0 < ${dump_size} < 204800 |
| 51 | |
| 52 | |
| Naman Navin Hegde | ebd4d68 | 2019-07-22 02:39:35 -0500 | [diff] [blame] | 53 | Verify Download BMC Dump |
| 54 | [Documentation] Verify that a BMC dump can be downloaded to the local machine. |
| 55 | [Tags] Verify_Download_BMC_Dump |
| 56 | |
| Tim Lee | 792e31e | 2021-12-10 14:10:46 +0800 | [diff] [blame] | 57 | ${dump_id}= Create User Initiated BMC Dump Via Redfish |
| Naman Navin Hegde | ebd4d68 | 2019-07-22 02:39:35 -0500 | [diff] [blame] | 58 | ${dump_dict}= Get Dump Dict |
| 59 | ${bmc_dump_name}= Fetch From Right ${dump_dict['${dump_id}']} / |
| 60 | ${bmc_dump_checksum} ${stderr} ${rc}= BMC Execute Command |
| 61 | ... md5sum ${dump_dict['${dump_id}']}|awk '{print$1}' |
| 62 | ${bmc_dump_size} ${stderr} ${rc}= BMC Execute Command |
| 63 | ... stat -c "%s" ${dump_dict['${dump_id}']} |
| 64 | |
| 65 | ${response}= OpenBMC Get Request ${DUMP_DOWNLOAD_URI}${dump_id} |
| 66 | ... quiet=${1} |
| 67 | Should Be Equal As Strings ${response.status_code} ${HTTP_OK} |
| 68 | Create Binary File ${EXECDIR}${/}dumps ${response.content} |
| 69 | Run tar -xvf ${EXECDIR}${/}dumps |
| 70 | ${download_dump_name}= Fetch From Left ${bmc_dump_name} . |
| 71 | ${download_dump_checksum}= Run md5sum ${EXECDIR}/dumps|awk '{print$1}' |
| 72 | ${download_dump_size}= Run stat -c "%s" ${EXECDIR}${/}dumps |
| 73 | |
| 74 | OperatingSystem.Directory Should Exist ${EXECDIR}/${download_dump_name} |
| 75 | ... msg=Created dump name and downloaded dump name don't match. |
| 76 | Should Be Equal As Strings ${bmc_dump_checksum} ${download_dump_checksum} |
| 77 | Should Be Equal As Strings ${bmc_dump_size} ${download_dump_size} |
| 78 | |
| 79 | Run rm -rf ${EXECDIR}${/}${download_dump_name};rm ${EXECDIR}${/}dumps |
| 80 | |
| 81 | |
| Rahul Maheshwari | ad676bf | 2017-06-22 15:06:05 -0500 | [diff] [blame] | 82 | *** Keywords *** |
| 83 | |
| Rahul Maheshwari | a89ff9e | 2020-09-25 05:04:33 -0500 | [diff] [blame] | 84 | Suite Setup Execution |
| 85 | [Documentation] Do initial suite setup tasks. |
| 86 | |
| 87 | ${resp}= OpenBMC Get Request ${DUMP_URI} |
| George Keishing | 7dc4847 | 2025-05-07 20:23:47 +0530 | [diff] [blame] | 88 | IF '${resp.status_code}' == '${HTTP_NOT_FOUND}' |
| 89 | Set Suite Variable ${DUMP_URI} /xyz/openbmc_project/dump/ |
| 90 | Set Suite Variable ${DUMP_ENTRY_URI} /xyz/openbmc_project/dump/entry/ |
| 91 | END |
| Rahul Maheshwari | a89ff9e | 2020-09-25 05:04:33 -0500 | [diff] [blame] | 92 | |
| 93 | |
| George Keishing | 40b7ee0 | 2017-11-13 05:12:41 -0600 | [diff] [blame] | 94 | Test Teardown Execution |
| Rahul Maheshwari | ad676bf | 2017-06-22 15:06:05 -0500 | [diff] [blame] | 95 | [Documentation] Do the post test teardown. |
| 96 | |
| Rahul Maheshwari | 953038b | 2017-10-17 05:08:59 -0500 | [diff] [blame] | 97 | Wait Until Keyword Succeeds 3 min 15 sec Verify No Dump In Progress |
| Rahul Maheshwari | ad676bf | 2017-06-22 15:06:05 -0500 | [diff] [blame] | 98 | FFDC On Test Case Fail |
| Rahul Maheshwari | bf9024f | 2017-10-25 10:51:39 -0500 | [diff] [blame] | 99 | Delete All BMC Dump |
| Rahul Maheshwari | ad676bf | 2017-06-22 15:06:05 -0500 | [diff] [blame] | 100 | Close All Connections |