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