Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | |
| 3 | Documentation Test BMC dump functionality of OpenBMC. |
| 4 | |
George Keishing | 88ec280 | 2021-08-04 03:04:22 -0500 | [diff] [blame] | 5 | Resource ../../lib/bmc_redfish_resource.robot |
| 6 | Resource ../../lib/boot_utils.robot |
Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 7 | Resource ../../lib/dump_utils.robot |
George Keishing | 88ec280 | 2021-08-04 03:04:22 -0500 | [diff] [blame] | 8 | Resource ../../lib/openbmc_ffdc.robot |
Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 9 | |
George Keishing | f514ccb | 2021-02-02 23:55:56 -0600 | [diff] [blame] | 10 | Suite Setup Redfish.Login |
Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 11 | Test Setup Redfish Delete All BMC Dumps |
| 12 | Test Teardown Test Teardown Execution |
| 13 | |
Tim Lee | de2d130 | 2021-06-18 01:24:11 +0800 | [diff] [blame] | 14 | *** Variables *** |
| 15 | |
| 16 | # Total size of the dump in kilo bytes |
| 17 | ${BMC_DUMP_TOTAL_SIZE} ${1024} |
| 18 | |
| 19 | # Minimum space required for one bmc dump in kilo bytes |
| 20 | ${BMC_DUMP_MIN_SPACE_REQD} ${20} |
Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 21 | |
| 22 | *** Test Cases *** |
| 23 | |
| 24 | Verify User Initiated BMC Dump When Host Powered Off |
| 25 | [Documentation] Create user initiated BMC dump at host off state and |
| 26 | ... verify dump entry for it. |
| 27 | [Tags] Verify_User_Initiated_BMC_Dump_When_Host_Powered_Off |
| 28 | |
| 29 | Redfish Power Off stack_mode=skip |
Rahul Maheshwari | bd38aa4 | 2021-08-04 01:24:39 -0500 | [diff] [blame] | 30 | ${dump_id}= Create User Initiated BMC Dump Via Redfish |
Rahul Maheshwari | bcefdf2 | 2020-10-16 07:51:34 -0500 | [diff] [blame] | 31 | ${dump_entries}= Get BMC Dump Entries |
Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 32 | Length Should Be ${dump_entries} 1 |
| 33 | List Should Contain Value ${dump_entries} ${dump_id} |
| 34 | |
Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 35 | Verify User Initiated BMC Dump When Host Booted |
| 36 | [Documentation] Create user initiated BMC dump at host booted state and |
| 37 | ... verify dump entry for it. |
| 38 | [Tags] Verify_User_Initiated_BMC_Dump_When_Host_Booted |
| 39 | |
| 40 | Redfish Power On stack_mode=skip |
Rahul Maheshwari | bd38aa4 | 2021-08-04 01:24:39 -0500 | [diff] [blame] | 41 | ${dump_id}= Create User Initiated BMC Dump Via Redfish |
Rahul Maheshwari | bcefdf2 | 2020-10-16 07:51:34 -0500 | [diff] [blame] | 42 | ${dump_entries}= Get BMC Dump Entries |
Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 43 | Length Should Be ${dump_entries} 1 |
| 44 | List Should Contain Value ${dump_entries} ${dump_id} |
| 45 | |
| 46 | |
Rahul Maheshwari | e8e9d0c | 2020-10-30 02:39:01 -0500 | [diff] [blame] | 47 | Verify User Initiated BMC Dump Size |
| 48 | [Documentation] Verify user initiated BMC dump size is under 200 KB. |
| 49 | [Tags] Verify_User_Initiated_BMC_Dump_Size |
| 50 | |
Rahul Maheshwari | bd38aa4 | 2021-08-04 01:24:39 -0500 | [diff] [blame] | 51 | ${dump_id}= Create User Initiated BMC Dump Via Redfish |
Rahul Maheshwari | e8e9d0c | 2020-10-30 02:39:01 -0500 | [diff] [blame] | 52 | ${resp}= Redfish.Get Properties /redfish/v1/Managers/bmc/LogServices/Dump/Entries/${dump_id} |
| 53 | |
| 54 | # Example of response from above Redfish GET request. |
| 55 | # "@odata.type": "#LogEntry.v1_7_0.LogEntry", |
| 56 | # "AdditionalDataSizeBytes": 31644, |
| 57 | # "AdditionalDataURI": "/redfish/v1/Managers/bmc/LogServices/Dump/attachment/9", |
| 58 | # "Created": "2020-10-23T06:32:53+00:00", |
| 59 | # "DiagnosticDataType": "Manager", |
| 60 | # "EntryType": "Event", |
| 61 | # "Id": "9", |
| 62 | # "Name": "BMC Dump Entry" |
| 63 | |
| 64 | # Max size for dump is 200 KB = 200x1024 Byte. |
| 65 | Should Be True 0 < ${resp["AdditionalDataSizeBytes"]} < 204800 |
| 66 | |
| 67 | |
Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 68 | Verify Dump Persistency On Dump Service Restart |
| 69 | [Documentation] Create user dump, restart dump manager service and verify dump |
| 70 | ... persistency. |
| 71 | [Tags] Verify_Dump_Persistency_On_Dump_Service_Restart |
| 72 | |
Rahul Maheshwari | bd38aa4 | 2021-08-04 01:24:39 -0500 | [diff] [blame] | 73 | Create User Initiated BMC Dump Via Redfish |
Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 74 | ${dump_entries_before}= redfish_utils.get_member_list /redfish/v1/Managers/bmc/LogServices/Dump/Entries |
| 75 | |
| 76 | # Restart dump service. |
| 77 | BMC Execute Command systemctl restart xyz.openbmc_project.Dump.Manager.service |
| 78 | Sleep 10s reason=Wait for BMC dump service to restart properly |
| 79 | |
| 80 | ${dump_entries_after}= redfish_utils.get_member_list /redfish/v1/Managers/bmc/LogServices/Dump/Entries |
| 81 | Lists Should Be Equal ${dump_entries_before} ${dump_entries_after} |
| 82 | |
| 83 | |
| 84 | Verify Dump Persistency On BMC Reset |
| 85 | [Documentation] Create user dump, reset BMC and verify dump persistency. |
| 86 | [Tags] Verify_Dump_Persistency_On_BMC_Reset |
| 87 | |
Rahul Maheshwari | bd38aa4 | 2021-08-04 01:24:39 -0500 | [diff] [blame] | 88 | Create User Initiated BMC Dump Via Redfish |
Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 89 | ${dump_entries_before}= redfish_utils.get_member_list /redfish/v1/Managers/bmc/LogServices/Dump/Entries |
| 90 | |
| 91 | # Reset BMC. |
George Keishing | 88ec280 | 2021-08-04 03:04:22 -0500 | [diff] [blame] | 92 | OBMC Reboot (off) stack_mode=skip |
Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 93 | |
| 94 | ${dump_entries_after}= redfish_utils.get_member_list /redfish/v1/Managers/bmc/LogServices/Dump/Entries |
| 95 | Lists Should Be Equal ${dump_entries_before} ${dump_entries_after} |
| 96 | |
| 97 | |
Rahul Maheshwari | 95cbceb | 2020-10-21 23:25:08 -0500 | [diff] [blame] | 98 | Delete User Initiated BMC Dump And Verify |
| 99 | [Documentation] Delete user initiated BMC dump and verify. |
| 100 | [Tags] Delete_User_Initiated_BMC_Dump_And_Verify |
| 101 | |
Rahul Maheshwari | bd38aa4 | 2021-08-04 01:24:39 -0500 | [diff] [blame] | 102 | ${dump_id}= Create User Initiated BMC Dump Via Redfish |
Rahul Maheshwari | 95cbceb | 2020-10-21 23:25:08 -0500 | [diff] [blame] | 103 | Redfish Delete BMC Dump ${dump_id} |
| 104 | |
| 105 | ${dump_entries}= Get BMC Dump Entries |
| 106 | Should Be Empty ${dump_entries} |
| 107 | |
| 108 | |
| 109 | Delete All User Initiated BMC Dumps And Verify |
| 110 | [Documentation] Delete all user initiated BMC dumps and verify. |
| 111 | [Tags] Delete_All_User_Initiated_BMC_Dumps_And_Verify |
| 112 | |
| 113 | # Create some BMC dump. |
Rahul Maheshwari | bd38aa4 | 2021-08-04 01:24:39 -0500 | [diff] [blame] | 114 | Create User Initiated BMC Dump Via Redfish |
| 115 | Create User Initiated BMC Dump Via Redfish |
Rahul Maheshwari | 95cbceb | 2020-10-21 23:25:08 -0500 | [diff] [blame] | 116 | |
| 117 | Redfish Delete All BMC Dumps |
| 118 | ${dump_entries}= Get BMC Dump Entries |
| 119 | Should Be Empty ${dump_entries} |
| 120 | |
| 121 | |
Rahul Maheshwari | 4f338ab | 2020-10-21 23:28:40 -0500 | [diff] [blame] | 122 | Create Two User Initiated BMC Dumps |
| 123 | [Documentation] Create two user initiated BMC dumps. |
| 124 | [Tags] Create_Two_User_Initiated_BMC_Dumps |
| 125 | |
Rahul Maheshwari | bd38aa4 | 2021-08-04 01:24:39 -0500 | [diff] [blame] | 126 | ${dump_id1}= Create User Initiated BMC Dump Via Redfish |
| 127 | ${dump_id2}= Create User Initiated BMC Dump Via Redfish |
Rahul Maheshwari | 4f338ab | 2020-10-21 23:28:40 -0500 | [diff] [blame] | 128 | |
| 129 | ${dump_entries}= Get BMC Dump Entries |
| 130 | Length Should Be ${dump_entries} 2 |
| 131 | Should Contain ${dump_entries} ${dump_id1} |
| 132 | Should Contain ${dump_entries} ${dump_id2} |
| 133 | |
| 134 | |
| 135 | Create Two User Initiated BMC Dumps And Delete One |
| 136 | [Documentation] Create two dumps and delete the first. |
| 137 | [Tags] Create_Two_User_Initiated_BMC_Dumps_And_Delete_One |
| 138 | |
Rahul Maheshwari | bd38aa4 | 2021-08-04 01:24:39 -0500 | [diff] [blame] | 139 | ${dump_id1}= Create User Initiated BMC Dump Via Redfish |
| 140 | ${dump_id2}= Create User Initiated BMC Dump Via Redfish |
Rahul Maheshwari | 4f338ab | 2020-10-21 23:28:40 -0500 | [diff] [blame] | 141 | |
| 142 | Redfish Delete BMC Dump ${dump_id1} |
| 143 | |
| 144 | ${dump_entries}= Get BMC Dump Entries |
| 145 | Length Should Be ${dump_entries} 1 |
| 146 | List Should Contain Value ${dump_entries} ${dump_id2} |
| 147 | |
| 148 | |
| 149 | Create And Delete User Initiated BMC Dump Multiple Times |
| 150 | [Documentation] Create and delete user initiated BMC dump multiple times. |
| 151 | [Tags] Create_And_Delete_User_Initiated_BMC_Dump_Multiple_Times |
| 152 | |
| 153 | FOR ${INDEX} IN 1 10 |
Rahul Maheshwari | bd38aa4 | 2021-08-04 01:24:39 -0500 | [diff] [blame] | 154 | ${dump_id}= Create User Initiated BMC Dump Via Redfish |
Rahul Maheshwari | 4f338ab | 2020-10-21 23:28:40 -0500 | [diff] [blame] | 155 | Redfish Delete BMC Dump ${dump_id} |
| 156 | END |
| 157 | |
| 158 | |
Rahul Maheshwari | d709c8d | 2020-11-01 23:03:51 -0600 | [diff] [blame] | 159 | Verify Maximum BMC Dump Creation |
| 160 | [Documentation] Create maximum BMC dump and verify error when dump runs out of space. |
| 161 | [Tags] Verify_Maximum_BMC_Dump_Creation |
| 162 | [Teardown] Redfish Delete All BMC Dumps |
| 163 | |
| 164 | # Maximum allowed space for dump is 1024 KB. BMC typically hold 8-14 dumps |
| 165 | # before running out of this dump space. So trying to create dumps in 20 |
| 166 | # iterations to run out of space. |
| 167 | |
| 168 | FOR ${n} IN RANGE 0 20 |
Rahul Maheshwari | bd38aa4 | 2021-08-04 01:24:39 -0500 | [diff] [blame] | 169 | Create User Initiated BMC Dump Via Redfish |
Rahul Maheshwari | d709c8d | 2020-11-01 23:03:51 -0600 | [diff] [blame] | 170 | ${dump_space}= Get Disk Usage For Dumps |
Tim Lee | de2d130 | 2021-06-18 01:24:11 +0800 | [diff] [blame] | 171 | Exit For Loop If ${dump_space} >= (${BMC_DUMP_TOTAL_SIZE} - ${BMC_DUMP_MIN_SPACE_REQD}) |
Rahul Maheshwari | d709c8d | 2020-11-01 23:03:51 -0600 | [diff] [blame] | 172 | END |
| 173 | |
| 174 | # Check error while creating dump when dump size is full. |
| 175 | ${payload}= Create Dictionary DiagnosticDataType=Manager |
| 176 | Redfish.Post /redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.CollectDiagnosticData |
| 177 | ... body=${payload} valid_status_codes=[${HTTP_INTERNAL_SERVER_ERROR}] |
| 178 | |
| 179 | |
Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 180 | *** Keywords *** |
| 181 | |
Rahul Maheshwari | bd38aa4 | 2021-08-04 01:24:39 -0500 | [diff] [blame] | 182 | Create User Initiated BMC Dump Via Redfish |
| 183 | [Documentation] Generate user initiated BMC dump via Redfish and return the dump id number (e.g., "5"). |
Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 184 | |
| 185 | ${payload}= Create Dictionary DiagnosticDataType=Manager |
| 186 | ${resp}= Redfish.Post /redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.CollectDiagnosticData |
| 187 | ... body=${payload} valid_status_codes=[${HTTP_ACCEPTED}] |
| 188 | |
| 189 | # Example of response from above Redfish POST request. |
| 190 | # "@odata.id": "/redfish/v1/TaskService/Tasks/0", |
| 191 | # "@odata.type": "#Task.v1_4_3.Task", |
| 192 | # "Id": "0", |
| 193 | # "TaskState": "Running", |
| 194 | # "TaskStatus": "OK" |
| 195 | |
| 196 | Wait Until Keyword Succeeds 5 min 15 sec Is Task Completed ${resp.dict['Id']} |
| 197 | ${task_id}= Set Variable ${resp.dict['Id']} |
| 198 | |
| 199 | ${task_dict}= Redfish.Get Properties /redfish/v1/TaskService/Tasks/${task_id} |
| 200 | |
| 201 | # Example of HttpHeaders field of task details. |
| 202 | # "Payload": { |
| 203 | # "HttpHeaders": [ |
| 204 | # "Host: <BMC_IP>", |
| 205 | # "Accept-Encoding: identity", |
| 206 | # "Connection: Keep-Alive", |
| 207 | # "Accept: */*", |
| 208 | # "Content-Length: 33", |
Tim Lee | cdaf03f | 2021-06-17 09:53:02 +0800 | [diff] [blame] | 209 | # "Location: /redfish/v1/Managers/bmc/LogServices/Dump/Entries/2"] |
Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 210 | # ], |
| 211 | # "HttpOperation": "POST", |
| 212 | # "JsonBody": "{\"DiagnosticDataType\":\"Manager\"}", |
| 213 | # "TargetUri": "/redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.CollectDiagnosticData" |
| 214 | # } |
| 215 | |
Tim Lee | cdaf03f | 2021-06-17 09:53:02 +0800 | [diff] [blame] | 216 | [Return] ${task_dict["Payload"]["HttpHeaders"][-1].split("/")[-1]} |
Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 217 | |
| 218 | |
Rahul Maheshwari | bcefdf2 | 2020-10-16 07:51:34 -0500 | [diff] [blame] | 219 | Get BMC Dump Entries |
| 220 | [Documentation] Return BMC dump ids list. |
| 221 | |
| 222 | ${dump_uris}= redfish_utils.get_member_list /redfish/v1/Managers/bmc/LogServices/Dump/Entries |
| 223 | ${dump_ids}= Create List |
| 224 | |
| 225 | FOR ${dump_uri} IN @{dump_uris} |
| 226 | ${dump_id}= Fetch From Right ${dump_uri} / |
| 227 | Append To List ${dump_ids} ${dump_id} |
| 228 | END |
| 229 | |
| 230 | [Return] ${dump_ids} |
| 231 | |
| 232 | |
Rahul Maheshwari | d709c8d | 2020-11-01 23:03:51 -0600 | [diff] [blame] | 233 | Get Disk Usage For Dumps |
| 234 | [Documentation] Return disk usage in kilobyte for BMC dumps. |
| 235 | |
| 236 | ${usage_output} ${stderr} ${rc}= BMC Execute Command du -s /var/lib/phosphor-debug-collector/dumps |
| 237 | |
| 238 | # Example of output from above BMC cli command. |
| 239 | # $ du -s /var/lib/phosphor-debug-collector/dumps |
| 240 | # 516 /var/lib/phosphor-debug-collector/dumps |
| 241 | |
| 242 | ${usage_output}= Fetch From Left ${usage_output} / |
| 243 | ${usage_output}= Convert To Integer ${usage_output} |
| 244 | |
| 245 | [return] ${usage_output} |
| 246 | |
| 247 | |
Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 248 | Is Task Completed |
| 249 | [Documentation] Verify if the given task is completed. |
| 250 | [Arguments] ${task_id} |
| 251 | |
| 252 | # Description of argument(s): |
| 253 | # task_id Id of task which needs to be checked. |
| 254 | |
| 255 | ${task_dict}= Redfish.Get Properties /redfish/v1/TaskService/Tasks/${task_id} |
| 256 | Should Be Equal As Strings ${task_dict['TaskState']} Completed |
| 257 | |
| 258 | |
| 259 | Test Teardown Execution |
| 260 | [Documentation] Do test teardown operation. |
| 261 | |
| 262 | FFDC On Test Case Fail |
| 263 | Close All Connections |