blob: 7044303716866f91f8db8c2e01b64995fc08d871 [file] [log] [blame]
Rahul Maheshwariad676bf2017-06-22 15:06:05 -05001*** Settings ***
2
3Documentation Test dump functionality of OpenBMC.
4
George Keishingfb3f9a52019-07-18 13:13:58 -05005Resource ../../lib/openbmc_ffdc.robot
6Resource ../../lib/rest_client.robot
7Resource ../../lib/dump_utils.robot
8Resource ../../lib/boot_utils.robot
9Resource ../../lib/utils.robot
George Keishingbac0c572019-08-08 23:19:45 -050010Resource ../../lib/state_manager.robot
George Keishingfb3f9a52019-07-18 13:13:58 -050011Library ../../lib/bmc_ssh_utils.py
Rahul Maheshwariad676bf2017-06-22 15:06:05 -050012
Rahul Maheshwaria89ff9e2020-09-25 05:04:33 -050013Suite Setup Suite Setup Execution
Rahul Maheshwariad676bf2017-06-22 15:06:05 -050014Test Setup Open Connection And Log In
George Keishing40b7ee02017-11-13 05:12:41 -060015Test Teardown Test Teardown Execution
Rahul Maheshwariad676bf2017-06-22 15:06:05 -050016
17*** Test Cases ***
18
Anusha Dathatrieda09492019-02-26 08:30:13 -060019Verify Dump After Host Watchdog Error Injection
20 [Documentation] Inject host watchdog error and verify whether dump is generated.
21 [Tags] Verify_Dump_After_Host_Watchdog_Error_Injection
22
George Keishingfb3f9a52019-07-18 13:13:58 -050023 Redfish Power On
Anusha Dathatrieda09492019-02-26 08:30:13 -060024
Tim Leec4238a82021-12-16 11:25:16 +080025 Run Keyword And Ignore Error Redfish Delete All BMC Dumps
Anusha Dathatrieda09492019-02-26 08:30:13 -060026
27 # Enable auto reboot
28 Set Auto Reboot ${1}
29
Tim Lee3edb0242021-12-23 14:04:58 +080030 Set Watchdog Interval Using Busctl 2000
Anusha Dathatrieda09492019-02-26 08:30:13 -060031
32 Wait Until Keyword Succeeds 300 sec 20 sec Is Host Rebooted
33
34 #Get dump details
35 @{dump_entry_list}= Read Properties ${DUMP_ENTRY_URI}
36
George Keishing16b3c7b2021-01-28 09:23:37 -060037 # Verifying that there is only one dump
Anusha Dathatrieda09492019-02-26 08:30:13 -060038 ${length}= Get length ${dump_entry_list}
39 Should Be Equal As Integers ${length} ${1}
40
41 # Get dump id
42 ${value}= Get From List ${dump_entry_list} 0
43 @{split_value}= Split String ${value} /
44 ${dump_id}= Get From List ${split_value} -1
45
46 # Max size for dump is 200k = 200x1024
47 ${dump_size}= Read Attribute ${DUMP_ENTRY_URI}${dump_id} Size
48 Should Be True 0 < ${dump_size} < 204800
49
50
Naman Navin Hegdeebd4d682019-07-22 02:39:35 -050051Verify Download BMC Dump
52 [Documentation] Verify that a BMC dump can be downloaded to the local machine.
53 [Tags] Verify_Download_BMC_Dump
54
Tim Lee792e31e2021-12-10 14:10:46 +080055 ${dump_id}= Create User Initiated BMC Dump Via Redfish
Naman Navin Hegdeebd4d682019-07-22 02:39:35 -050056 ${dump_dict}= Get Dump Dict
57 ${bmc_dump_name}= Fetch From Right ${dump_dict['${dump_id}']} /
58 ${bmc_dump_checksum} ${stderr} ${rc}= BMC Execute Command
59 ... md5sum ${dump_dict['${dump_id}']}|awk '{print$1}'
60 ${bmc_dump_size} ${stderr} ${rc}= BMC Execute Command
61 ... stat -c "%s" ${dump_dict['${dump_id}']}
62
63 ${response}= OpenBMC Get Request ${DUMP_DOWNLOAD_URI}${dump_id}
64 ... quiet=${1}
65 Should Be Equal As Strings ${response.status_code} ${HTTP_OK}
66 Create Binary File ${EXECDIR}${/}dumps ${response.content}
67 Run tar -xvf ${EXECDIR}${/}dumps
68 ${download_dump_name}= Fetch From Left ${bmc_dump_name} .
69 ${download_dump_checksum}= Run md5sum ${EXECDIR}/dumps|awk '{print$1}'
70 ${download_dump_size}= Run stat -c "%s" ${EXECDIR}${/}dumps
71
72 OperatingSystem.Directory Should Exist ${EXECDIR}/${download_dump_name}
73 ... msg=Created dump name and downloaded dump name don't match.
74 Should Be Equal As Strings ${bmc_dump_checksum} ${download_dump_checksum}
75 Should Be Equal As Strings ${bmc_dump_size} ${download_dump_size}
76
77 Run rm -rf ${EXECDIR}${/}${download_dump_name};rm ${EXECDIR}${/}dumps
78
79
Rahul Maheshwariad676bf2017-06-22 15:06:05 -050080*** Keywords ***
81
Rahul Maheshwaria89ff9e2020-09-25 05:04:33 -050082Suite Setup Execution
83 [Documentation] Do initial suite setup tasks.
84
85 ${resp}= OpenBMC Get Request ${DUMP_URI}
86 Run Keyword If '${resp.status_code}' == '${HTTP_NOT_FOUND}'
87 ... Run Keywords Set Suite Variable ${DUMP_URI} /xyz/openbmc_project/dump/ AND
88 ... Set Suite Variable ${DUMP_ENTRY_URI} /xyz/openbmc_project/dump/entry/
89
90
George Keishing40b7ee02017-11-13 05:12:41 -060091Test Teardown Execution
Rahul Maheshwariad676bf2017-06-22 15:06:05 -050092 [Documentation] Do the post test teardown.
93
Rahul Maheshwari953038b2017-10-17 05:08:59 -050094 Wait Until Keyword Succeeds 3 min 15 sec Verify No Dump In Progress
Rahul Maheshwariad676bf2017-06-22 15:06:05 -050095 FFDC On Test Case Fail
Rahul Maheshwaribf9024f2017-10-25 10:51:39 -050096 Delete All BMC Dump
Rahul Maheshwariad676bf2017-06-22 15:06:05 -050097 Close All Connections