Rahul Maheshwari | ad676bf | 2017-06-22 15:06:05 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation This module provides general keywords for dump. |
| 3 | |
Rahul Maheshwari | 1612ac9 | 2017-08-30 14:42:32 -0500 | [diff] [blame] | 4 | Library bmc_ssh_utils.py |
Rahul Maheshwari | ad676bf | 2017-06-22 15:06:05 -0500 | [diff] [blame] | 5 | |
| 6 | *** Variables *** |
| 7 | |
| 8 | *** Keywords *** |
| 9 | |
| 10 | Create User Initiated Dump |
| 11 | [Documentation] Generate user initiated dump and return |
Steven Sombar | a011c02 | 2019-01-16 18:13:52 -0600 | [diff] [blame] | 12 | ... the dump id number (e.g., "5"). Optionally return EMPTY |
| 13 | ... if out of dump space. |
| 14 | [Arguments] ${check_out_of_space}=${False} |
| 15 | |
| 16 | # Description of Argument(s): |
| 17 | # check_out_of_space If ${False}, a dump will be created and |
| 18 | # its dump_id will be returned. |
| 19 | # If ${True}, either the dump_id will be |
| 20 | # returned, or the value ${EMPTY} will be |
| 21 | # returned if out of dump space was |
| 22 | # detected when creating the dump. |
Rahul Maheshwari | ad676bf | 2017-06-22 15:06:05 -0500 | [diff] [blame] | 23 | |
George Keishing | 1dc8a1e | 2021-08-03 04:49:38 -0500 | [diff] [blame] | 24 | ${resp}= OpenBMC Get Request ${REST_DUMP_URI} |
Rahul Maheshwari | a89ff9e | 2020-09-25 05:04:33 -0500 | [diff] [blame] | 25 | Run Keyword If '${resp.status_code}' == '${HTTP_NOT_FOUND}' |
George Keishing | 1dc8a1e | 2021-08-03 04:49:38 -0500 | [diff] [blame] | 26 | ... Set Global Variable ${REST_DUMP_URI} /xyz/openbmc_project/dump/ |
Rahul Maheshwari | a89ff9e | 2020-09-25 05:04:33 -0500 | [diff] [blame] | 27 | |
Rahul Maheshwari | ad676bf | 2017-06-22 15:06:05 -0500 | [diff] [blame] | 28 | ${data}= Create Dictionary data=@{EMPTY} |
| 29 | ${resp}= OpenBMC Post Request |
George Keishing | 1dc8a1e | 2021-08-03 04:49:38 -0500 | [diff] [blame] | 30 | ... ${REST_DUMP_URI}action/CreateDump data=${data} quiet=${1} |
Steven Sombar | a011c02 | 2019-01-16 18:13:52 -0600 | [diff] [blame] | 31 | |
| 32 | Run Keyword If '${check_out_of_space}' == '${False}' |
George Keishing | 656eb4a | 2019-09-03 03:48:01 -0500 | [diff] [blame] | 33 | ... Run Keyword And Return Get The Dump Id ${resp} |
| 34 | ... ELSE |
| 35 | ... Run Keyword And Return Check For Too Many Dumps ${resp} |
Steven Sombar | a011c02 | 2019-01-16 18:13:52 -0600 | [diff] [blame] | 36 | |
| 37 | |
| 38 | Get The Dump Id |
| 39 | [Documentation] Wait for the dump to be created. Return the |
| 40 | ... dump id number (e.g., "5"). |
| 41 | [Arguments] ${resp} |
| 42 | |
| 43 | # Description of Argument(s): |
| 44 | # resp Response object from action/Create Dump attempt. |
| 45 | # Example object: |
| 46 | # { |
| 47 | # "data": 5, |
| 48 | # "message": "200 OK", |
| 49 | # "status": "ok" |
| 50 | # }, |
| 51 | # The "data" field conveys the id number of the created dump. |
Rahul Maheshwari | ad676bf | 2017-06-22 15:06:05 -0500 | [diff] [blame] | 52 | |
| 53 | Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} |
| 54 | ${json}= To JSON ${resp.content} |
George Keishing | 73c4ebf | 2017-11-13 07:10:28 -0600 | [diff] [blame] | 55 | |
George Keishing | 73c4ebf | 2017-11-13 07:10:28 -0600 | [diff] [blame] | 56 | Run Keyword If ${json["data"]} == ${None} |
| 57 | ... Fail Dump id returned null. |
| 58 | |
Rahul Maheshwari | ad676bf | 2017-06-22 15:06:05 -0500 | [diff] [blame] | 59 | ${dump_id}= Set Variable ${json["data"]} |
| 60 | |
Rahul Maheshwari | e2cd17f | 2017-09-26 21:26:50 -0500 | [diff] [blame] | 61 | Wait Until Keyword Succeeds 3 min 15 sec Check Dump Existence |
Rahul Maheshwari | ad676bf | 2017-06-22 15:06:05 -0500 | [diff] [blame] | 62 | ... ${dump_id} |
| 63 | |
| 64 | [Return] ${dump_id} |
| 65 | |
| 66 | |
Steven Sombar | a011c02 | 2019-01-16 18:13:52 -0600 | [diff] [blame] | 67 | Check For Too Many Dumps |
| 68 | [Documentation] Return the dump_id number, or return ${EMPTY} if dump |
| 69 | ... creation failed due to too many dumps. |
| 70 | [Arguments] ${resp} |
| 71 | |
| 72 | # Description of Argument(s): |
| 73 | # resp Response object from action/Create Dump attempt. |
| 74 | # Example object if there are too many dumps: |
George Keishing | 506756e | 2019-08-06 01:07:55 -0500 | [diff] [blame] | 75 | # { |
Steven Sombar | a011c02 | 2019-01-16 18:13:52 -0600 | [diff] [blame] | 76 | # "data": { |
George Keishing | 506756e | 2019-08-06 01:07:55 -0500 | [diff] [blame] | 77 | # "description": "xyz.openbmc_project.Dump.Create.Error.QuotaExceeded" |
| 78 | # }, |
| 79 | # "message": "Dump not captured due to a cap.", |
Steven Sombar | a011c02 | 2019-01-16 18:13:52 -0600 | [diff] [blame] | 80 | # "status": "error" |
George Keishing | 506756e | 2019-08-06 01:07:55 -0500 | [diff] [blame] | 81 | # } |
Steven Sombar | a011c02 | 2019-01-16 18:13:52 -0600 | [diff] [blame] | 82 | |
| 83 | # If dump was created normally, return the dump_id number. |
| 84 | Run Keyword If '${resp.status_code}' == '${HTTP_OK}' |
| 85 | ... Run Keyword And Return Get The Dump Id ${resp} |
| 86 | |
George Keishing | 506756e | 2019-08-06 01:07:55 -0500 | [diff] [blame] | 87 | ${json}= To JSON ${resp.content} |
| 88 | ${exception}= Set Variable ${json["message"]} |
Steven Sombar | a011c02 | 2019-01-16 18:13:52 -0600 | [diff] [blame] | 89 | ${at_capacity}= Set Variable Dump not captured due to a cap |
| 90 | ${too_many_dumps}= Evaluate $at_capacity in $exception |
Michael Walsh | c108e42 | 2019-03-28 12:27:18 -0500 | [diff] [blame] | 91 | Printn |
Steven Sombar | a011c02 | 2019-01-16 18:13:52 -0600 | [diff] [blame] | 92 | Rprint Vars exception too_many_dumps |
| 93 | # If there are too many dumps, return ${EMPTY}, otherwise Fail. |
| 94 | ${status}= Run Keyword If ${too_many_dumps} Set Variable ${EMPTY} |
| 95 | ... ELSE Fail msg=${exception}. |
| 96 | |
| 97 | [Return] ${status} |
| 98 | |
| 99 | |
Rahul Maheshwari | 953038b | 2017-10-17 05:08:59 -0500 | [diff] [blame] | 100 | Verify No Dump In Progress |
| 101 | [Documentation] Verify no dump in progress. |
| 102 | |
Rahul Maheshwari | 4cfdc39 | 2017-10-25 09:44:47 -0500 | [diff] [blame] | 103 | ${dump_progress} ${stderr} ${rc}= BMC Execute Command ls /tmp |
| 104 | Should Not Contain ${dump_progress} obmcdump |
Rahul Maheshwari | 953038b | 2017-10-17 05:08:59 -0500 | [diff] [blame] | 105 | |
| 106 | |
Rahul Maheshwari | ad676bf | 2017-06-22 15:06:05 -0500 | [diff] [blame] | 107 | Check Dump Existence |
| 108 | [Documentation] Verify if given dump exist. |
| 109 | [Arguments] ${dump_id} |
| 110 | |
| 111 | # Description of Argument(s): |
| 112 | # dump_id An integer value that identifies a particular dump |
| 113 | # object(e.g. 1, 3, 5). |
| 114 | |
George Keishing | 1dc8a1e | 2021-08-03 04:49:38 -0500 | [diff] [blame] | 115 | ${resp}= OpenBMC Get Request ${REST_DUMP_URI} |
Rahul Maheshwari | a89ff9e | 2020-09-25 05:04:33 -0500 | [diff] [blame] | 116 | Run Keyword If '${resp.status_code}' == '${HTTP_NOT_FOUND}' |
George Keishing | 73d8f24 | 2021-03-19 08:51:56 -0500 | [diff] [blame] | 117 | ... Set Global Variable ${DUMP_ENTRY_URI} /xyz/openbmc_project/dump/entry/ |
Rahul Maheshwari | a89ff9e | 2020-09-25 05:04:33 -0500 | [diff] [blame] | 118 | |
George Keishing | 8d69338 | 2018-12-18 12:15:04 -0600 | [diff] [blame] | 119 | ${resp}= OpenBMC Get Request ${DUMP_ENTRY_URI}${dump_id} |
Rahul Maheshwari | ad676bf | 2017-06-22 15:06:05 -0500 | [diff] [blame] | 120 | Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} |
| 121 | |
| 122 | |
| 123 | Delete BMC Dump |
| 124 | [Documentation] Deletes a given bmc dump. |
| 125 | [Arguments] ${dump_id} |
| 126 | |
| 127 | # Description of Argument(s): |
Gunnar Mills | 28e403b | 2017-10-25 16:16:38 -0500 | [diff] [blame] | 128 | # dump_id An integer value that identifies a particular dump (e.g. 1, 3). |
Rahul Maheshwari | ad676bf | 2017-06-22 15:06:05 -0500 | [diff] [blame] | 129 | |
George Keishing | 1dc8a1e | 2021-08-03 04:49:38 -0500 | [diff] [blame] | 130 | ${resp}= OpenBMC Get Request ${REST_DUMP_URI} |
Rahul Maheshwari | a89ff9e | 2020-09-25 05:04:33 -0500 | [diff] [blame] | 131 | Run Keyword If '${resp.status_code}' == '${HTTP_NOT_FOUND}' |
George Keishing | 73d8f24 | 2021-03-19 08:51:56 -0500 | [diff] [blame] | 132 | ... Set Global Variable ${DUMP_ENTRY_URI} /xyz/openbmc_project/dump/entry/ |
Rahul Maheshwari | a89ff9e | 2020-09-25 05:04:33 -0500 | [diff] [blame] | 133 | |
Rahul Maheshwari | ad676bf | 2017-06-22 15:06:05 -0500 | [diff] [blame] | 134 | ${data}= Create Dictionary data=@{EMPTY} |
| 135 | ${resp}= OpenBMC Post Request |
George Keishing | 8d69338 | 2018-12-18 12:15:04 -0600 | [diff] [blame] | 136 | ... ${DUMP_ENTRY_URI}${dump_id}/action/Delete data=${data} |
Rahul Maheshwari | ad676bf | 2017-06-22 15:06:05 -0500 | [diff] [blame] | 137 | |
| 138 | Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} |
| 139 | |
| 140 | Delete All Dumps |
| 141 | [Documentation] Delete all dumps. |
| 142 | |
George Keishing | 1dc8a1e | 2021-08-03 04:49:38 -0500 | [diff] [blame] | 143 | ${resp}= OpenBMC Get Request ${REST_DUMP_URI} |
Rahul Maheshwari | a89ff9e | 2020-09-25 05:04:33 -0500 | [diff] [blame] | 144 | Run Keyword If '${resp.status_code}' == '${HTTP_NOT_FOUND}' |
George Keishing | 73d8f24 | 2021-03-19 08:51:56 -0500 | [diff] [blame] | 145 | ... Set Global Variable ${DUMP_ENTRY_URI} /xyz/openbmc_project/dump/entry/ |
Rahul Maheshwari | a89ff9e | 2020-09-25 05:04:33 -0500 | [diff] [blame] | 146 | |
Rahul Maheshwari | ad676bf | 2017-06-22 15:06:05 -0500 | [diff] [blame] | 147 | # Check if dump entries exist, if not return. |
George Keishing | 6a6e76d | 2017-09-14 08:19:17 -0500 | [diff] [blame] | 148 | ${resp}= OpenBMC Get Request ${DUMP_ENTRY_URI}list quiet=${1} |
Rahul Maheshwari | ad676bf | 2017-06-22 15:06:05 -0500 | [diff] [blame] | 149 | Return From Keyword If ${resp.status_code} == ${HTTP_NOT_FOUND} |
| 150 | |
| 151 | # Get the list of dump entries and delete them all. |
| 152 | ${dump_entries}= Get URL List ${DUMP_ENTRY_URI} |
Marissa Garza | 20ccfc7 | 2020-06-19 12:51:10 -0500 | [diff] [blame] | 153 | FOR ${entry} IN @{dump_entries} |
| 154 | ${dump_id}= Fetch From Right ${entry} / |
| 155 | Delete BMC Dump ${dump_id} |
| 156 | END |
George Keishing | c9fcd09 | 2017-09-20 09:24:37 -0500 | [diff] [blame] | 157 | |
Rahul Maheshwari | de5d6f1 | 2020-10-14 02:08:00 -0500 | [diff] [blame] | 158 | |
Rahul Maheshwari | 95cbceb | 2020-10-21 23:25:08 -0500 | [diff] [blame] | 159 | Redfish Delete BMC Dump |
| 160 | [Documentation] Deletes a given BMC dump via Redfish.. |
| 161 | [Arguments] ${dump_id} |
| 162 | |
| 163 | # Description of Argument(s): |
| 164 | # dump_id An integer value that identifies a particular dump (e.g. 1, 3). |
| 165 | |
| 166 | Redfish.Delete /redfish/v1/Managers/bmc/LogServices/Dump/Entries/${dump_id} |
| 167 | |
| 168 | |
Rahul Maheshwari | de5d6f1 | 2020-10-14 02:08:00 -0500 | [diff] [blame] | 169 | Redfish Delete All BMC Dumps |
| 170 | [Documentation] Delete all BMC dumps via Redfish. |
| 171 | |
| 172 | # Check if dump entries exist, if not return. |
| 173 | ${resp}= Redfish.Get /redfish/v1/Managers/bmc/LogServices/Dump/Entries |
| 174 | Return From Keyword If ${resp.dict["Members@odata.count"]} == ${0} |
| 175 | |
| 176 | Redfish.Post /redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.ClearLog |
| 177 | |
| 178 | |
George Keishing | 2ef6a7d | 2021-05-19 09:05:32 -0500 | [diff] [blame] | 179 | Redfish Delete All System Dumps |
| 180 | [Documentation] Delete all system dumps via Redfish. |
| 181 | |
| 182 | Redfish.Post /redfish/v1/Systems/system/LogServices/Dump/Actions/LogService.ClearLog |
| 183 | |
| 184 | |
George Keishing | c9fcd09 | 2017-09-20 09:24:37 -0500 | [diff] [blame] | 185 | Delete All BMC Dump |
| 186 | [Documentation] Delete all BMC dump entries using "DeleteAll" interface. |
| 187 | |
George Keishing | 1dc8a1e | 2021-08-03 04:49:38 -0500 | [diff] [blame] | 188 | ${resp}= OpenBMC Get Request ${REST_DUMP_URI} |
Rahul Maheshwari | a89ff9e | 2020-09-25 05:04:33 -0500 | [diff] [blame] | 189 | Run Keyword If '${resp.status_code}' == '${HTTP_NOT_FOUND}' |
George Keishing | 1dc8a1e | 2021-08-03 04:49:38 -0500 | [diff] [blame] | 190 | ... Set Global Variable ${REST_DUMP_URI} /xyz/openbmc_project/dump/ |
Rahul Maheshwari | a89ff9e | 2020-09-25 05:04:33 -0500 | [diff] [blame] | 191 | |
George Keishing | c9fcd09 | 2017-09-20 09:24:37 -0500 | [diff] [blame] | 192 | ${data}= Create Dictionary data=@{EMPTY} |
George Keishing | 1dc8a1e | 2021-08-03 04:49:38 -0500 | [diff] [blame] | 193 | ${resp}= Openbmc Post Request ${REST_DUMP_URI}action/DeleteAll data=${data} |
George Keishing | c9fcd09 | 2017-09-20 09:24:37 -0500 | [diff] [blame] | 194 | Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} |
George Keishing | dc42876 | 2017-11-11 12:37:12 -0600 | [diff] [blame] | 195 | |
George Keishing | dc42876 | 2017-11-11 12:37:12 -0600 | [diff] [blame] | 196 | Dump Should Not Exist |
| 197 | [Documentation] Verify that BMC dumps do not exist. |
| 198 | |
George Keishing | 1dc8a1e | 2021-08-03 04:49:38 -0500 | [diff] [blame] | 199 | ${resp}= OpenBMC Get Request ${REST_DUMP_URI} |
Rahul Maheshwari | a89ff9e | 2020-09-25 05:04:33 -0500 | [diff] [blame] | 200 | Run Keyword If '${resp.status_code}' == '${HTTP_NOT_FOUND}' |
George Keishing | 73d8f24 | 2021-03-19 08:51:56 -0500 | [diff] [blame] | 201 | ... Set Global Variable ${DUMP_ENTRY_URI} /xyz/openbmc_project/dump/entry/ |
Rahul Maheshwari | a89ff9e | 2020-09-25 05:04:33 -0500 | [diff] [blame] | 202 | |
George Keishing | 8d69338 | 2018-12-18 12:15:04 -0600 | [diff] [blame] | 203 | ${resp}= OpenBMC Get Request ${DUMP_ENTRY_URI}list quiet=${1} |
George Keishing | dc42876 | 2017-11-11 12:37:12 -0600 | [diff] [blame] | 204 | Should Be Equal As Strings ${resp.status_code} ${HTTP_NOT_FOUND} |
| 205 | |
Steven Sombar | 336fa97 | 2019-11-07 13:12:58 -0600 | [diff] [blame] | 206 | Check Existence Of BMC Dump File |
Sivas SRR | 7aabd79 | 2017-10-18 21:28:23 -0500 | [diff] [blame] | 207 | [Documentation] Verify existence of BMC dump file. |
| 208 | [Arguments] ${dump_id} |
| 209 | |
| 210 | # Description of argument(s): |
| 211 | # dump_id BMC dump identifier |
| 212 | |
| 213 | ${dump_check_cmd}= Set Variable |
| 214 | ... ls /var/lib/phosphor-debug-collector/dumps |
| 215 | |
| 216 | # Output of sample BMC Execute command with '2' as dump id is as follows |
| 217 | # ls /var/lib/phosphor-debug-collector/dumps/2 |
| 218 | # obmcdump_2_XXXXXXXXXX.tar.xz |
| 219 | ${file_there} ${stderr} ${rc}= BMC Execute Command |
| 220 | ... ${dump_check_cmd}/${dump_id} |
| 221 | Should End With ${file_there} tar.xz msg=BMC dump file not found. |
Rahul Maheshwari | 1612ac9 | 2017-08-30 14:42:32 -0500 | [diff] [blame] | 222 | |
| 223 | Get Dump Entries |
| 224 | [Documentation] Return dump entries list. |
| 225 | |
George Keishing | 1dc8a1e | 2021-08-03 04:49:38 -0500 | [diff] [blame] | 226 | ${resp}= OpenBMC Get Request ${REST_DUMP_URI} |
Rahul Maheshwari | a89ff9e | 2020-09-25 05:04:33 -0500 | [diff] [blame] | 227 | Run Keyword If '${resp.status_code}' == '${HTTP_NOT_FOUND}' |
George Keishing | 73d8f24 | 2021-03-19 08:51:56 -0500 | [diff] [blame] | 228 | ... Set Global Variable ${DUMP_ENTRY_URI} /xyz/openbmc_project/dump/entry/ |
Rahul Maheshwari | a89ff9e | 2020-09-25 05:04:33 -0500 | [diff] [blame] | 229 | |
Rahul Maheshwari | 1612ac9 | 2017-08-30 14:42:32 -0500 | [diff] [blame] | 230 | ${dump_entries}= Get URL List ${DUMP_ENTRY_URI} |
| 231 | [Return] ${dump_entries} |
| 232 | |
Rahul Maheshwari | 1612ac9 | 2017-08-30 14:42:32 -0500 | [diff] [blame] | 233 | Trigger Core Dump |
| 234 | [Documentation] Trigger core dump. |
| 235 | |
| 236 | # Find the pid of the active ipmid and kill it. |
George Keishing | bfd5c8f | 2018-07-11 10:27:28 -0500 | [diff] [blame] | 237 | ${cmd_buf}= Catenate kill -s SEGV $(ps | egrep ' ipmid$' | |
Rahul Maheshwari | 1612ac9 | 2017-08-30 14:42:32 -0500 | [diff] [blame] | 238 | ... egrep -v grep | \ cut -c1-6) |
| 239 | |
| 240 | ${cmd_output} ${stderr} ${rc}= BMC Execute Command ${cmd_buf} |
| 241 | Should Be Empty ${stderr} msg=BMC execute command error. |
| 242 | Should Be Equal As Integers ${rc} ${0} |
| 243 | ... msg=BMC execute command return code is not zero. |
Anusha Dathatri | fd35022 | 2021-04-08 06:07:49 -0500 | [diff] [blame] | 244 | |
Tim Lee | 792e31e | 2021-12-10 14:10:46 +0800 | [diff] [blame] | 245 | Create User Initiated BMC Dump Via Redfish |
| 246 | [Documentation] Generate user initiated BMC dump via Redfish and return the dump id number (e.g., "5"). |
Anusha Dathatri | fd35022 | 2021-04-08 06:07:49 -0500 | [diff] [blame] | 247 | |
| 248 | ${payload}= Create Dictionary DiagnosticDataType=Manager |
Tim Lee | 792e31e | 2021-12-10 14:10:46 +0800 | [diff] [blame] | 249 | ${resp}= Redfish.Post /redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.CollectDiagnosticData |
| 250 | ... body=${payload} valid_status_codes=[${HTTP_ACCEPTED}] |
Anusha Dathatri | fd35022 | 2021-04-08 06:07:49 -0500 | [diff] [blame] | 251 | |
| 252 | # Example of response from above Redfish POST request. |
| 253 | # "@odata.id": "/redfish/v1/TaskService/Tasks/0", |
| 254 | # "@odata.type": "#Task.v1_4_3.Task", |
| 255 | # "Id": "0", |
| 256 | # "TaskState": "Running", |
| 257 | # "TaskStatus": "OK" |
| 258 | |
Tim Lee | 792e31e | 2021-12-10 14:10:46 +0800 | [diff] [blame] | 259 | Wait Until Keyword Succeeds 5 min 15 sec Check Task Completion ${resp.dict['Id']} |
Anusha Dathatri | fd35022 | 2021-04-08 06:07:49 -0500 | [diff] [blame] | 260 | ${task_id}= Set Variable ${resp.dict['Id']} |
Tim Lee | 792e31e | 2021-12-10 14:10:46 +0800 | [diff] [blame] | 261 | |
| 262 | ${task_dict}= Redfish.Get Properties /redfish/v1/TaskService/Tasks/${task_id} |
| 263 | |
| 264 | # Example of HttpHeaders field of task details. |
| 265 | # "Payload": { |
| 266 | # "HttpHeaders": [ |
| 267 | # "Host: <BMC_IP>", |
| 268 | # "Accept-Encoding: identity", |
| 269 | # "Connection: Keep-Alive", |
| 270 | # "Accept: */*", |
| 271 | # "Content-Length: 33", |
| 272 | # "Location: /redfish/v1/Managers/bmc/LogServices/Dump/Entries/2"] |
| 273 | # ], |
| 274 | # "HttpOperation": "POST", |
| 275 | # "JsonBody": "{\"DiagnosticDataType\":\"Manager\"}", |
| 276 | # "TargetUri": "/redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.CollectDiagnosticData" |
| 277 | # } |
| 278 | |
| 279 | [Return] ${task_dict["Payload"]["HttpHeaders"][-1].split("/")[-1]} |
Anusha Dathatri | fd35022 | 2021-04-08 06:07:49 -0500 | [diff] [blame] | 280 | |
| 281 | Auto Generate BMC Dump |
| 282 | [Documentation] Auto generate BMC dump. |
| 283 | |
Anusha Dathatri | 2196147 | 2021-06-10 03:16:35 -0500 | [diff] [blame] | 284 | ${cmd}= Catenate busctl --verbose call xyz.openbmc_project.Dump.Manager |
Anusha Dathatri | f09efb8 | 2021-08-18 10:09:33 -0500 | [diff] [blame] | 285 | ... /xyz/openbmc_project/dump/bmc xyz.openbmc_project.Dump.Create CreateDump a{sv} 0 |
Anusha Dathatri | 2196147 | 2021-06-10 03:16:35 -0500 | [diff] [blame] | 286 | ${stdout} ${stderr} ${rc}= |
| 287 | ... BMC Execute Command ${cmd} |
Anusha Dathatri | fd35022 | 2021-04-08 06:07:49 -0500 | [diff] [blame] | 288 | [Return] ${stdout} ${stderr} ${rc} |
| 289 | |
| 290 | Get Dump Size |
| 291 | [Documentation] Get dump size. |
Anusha Dathatri | eed0e59 | 2021-04-21 03:17:12 -0500 | [diff] [blame] | 292 | [Arguments] ${dump_uri} |
Anusha Dathatri | fd35022 | 2021-04-08 06:07:49 -0500 | [diff] [blame] | 293 | |
| 294 | # Description of argument(s): |
Anusha Dathatri | eed0e59 | 2021-04-21 03:17:12 -0500 | [diff] [blame] | 295 | # dump_uri Dump URI |
| 296 | # (Eg. /xyz/openbmc_project/dump/bmc/entry/1). |
Anusha Dathatri | fd35022 | 2021-04-08 06:07:49 -0500 | [diff] [blame] | 297 | |
Anusha Dathatri | eed0e59 | 2021-04-21 03:17:12 -0500 | [diff] [blame] | 298 | # Example of Dump entry. |
| 299 | # "data": { |
| 300 | # "CompletedTime": 1616760931, |
| 301 | # "Elapsed": 1616760931, |
| 302 | # "OffloadUri": "", |
| 303 | # "Offloaded": false, |
| 304 | # "Password": "", |
| 305 | # "Size": 3056, |
| 306 | # "SourceDumpId": 117440513, |
| 307 | # "StartTime": 1616760931, |
| 308 | # "Status": "xyz.openbmc_project.Common.Progress.OperationStatus.Completed", |
| 309 | # "VSPString": "" |
| 310 | # }, |
Anusha Dathatri | fd35022 | 2021-04-08 06:07:49 -0500 | [diff] [blame] | 311 | |
Anusha Dathatri | eed0e59 | 2021-04-21 03:17:12 -0500 | [diff] [blame] | 312 | Log ${dump_uri} |
| 313 | ${dump_data}= Redfish.Get Properties ${dump_uri} |
| 314 | [Return] ${dump_data["data"]["Size"]} |
Anusha Dathatri | fd35022 | 2021-04-08 06:07:49 -0500 | [diff] [blame] | 315 | |
| 316 | Get Dump ID |
Anusha Dathatri | eed0e59 | 2021-04-21 03:17:12 -0500 | [diff] [blame] | 317 | [Documentation] Return dump ID. |
Anusha Dathatri | fd35022 | 2021-04-08 06:07:49 -0500 | [diff] [blame] | 318 | [Arguments] ${task_id} |
| 319 | |
| 320 | # Description of argument(s): |
| 321 | # task_id Task ID. |
| 322 | |
| 323 | # Example of HttpHeaders field of task details. |
| 324 | # "Payload": { |
| 325 | # "HttpHeaders": [ |
| 326 | # "Host: <BMC_IP>", |
| 327 | # "Accept-Encoding: identity", |
| 328 | # "Connection: Keep-Alive", |
| 329 | # "Accept: */*", |
| 330 | # "Content-Length: 33", |
| 331 | # "Location: /redfish/v1/Managers/bmc/LogServices/Dump/Entries/2"] |
| 332 | # ], |
| 333 | # "HttpOperation": "POST", |
| 334 | # "JsonBody": "{\"DiagnosticDataType\":\"Manager\"}", |
| 335 | # "TargetUri": |
| 336 | # "/redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.CollectDiagnosticData" |
| 337 | # } |
| 338 | |
| 339 | ${task_dict}= Redfish.Get Properties /redfish/v1/TaskService/Tasks/${task_id} |
| 340 | ${key} ${value}= Set Variable ${task_dict["Payload"]["HttpHeaders"][-1].split(":")} |
| 341 | Run Keyword If '${key}' != 'Location' Fail |
Anusha Dathatri | fa4209e | 2021-06-30 00:48:39 -0500 | [diff] [blame] | 342 | [Return] ${value.strip('/').split('/')[-1]} |
Anusha Dathatri | fd35022 | 2021-04-08 06:07:49 -0500 | [diff] [blame] | 343 | |
| 344 | Get Task Status |
| 345 | [Documentation] Return task status. |
| 346 | [Arguments] ${task_id} |
| 347 | |
| 348 | # Description of argument(s): |
| 349 | # task_id Task ID. |
| 350 | |
| 351 | ${resp}= Redfish.Get Properties /redfish/v1/TaskService/Tasks/${task_id} |
| 352 | [Return] ${resp['TaskState']} |
| 353 | |
Anusha Dathatri | eed0e59 | 2021-04-21 03:17:12 -0500 | [diff] [blame] | 354 | Check Task Completion |
| 355 | [Documentation] Check if the task is complete. |
| 356 | [Arguments] ${task_id} |
| 357 | |
| 358 | # Description of argument(s): |
| 359 | # task_id Task ID. |
| 360 | |
Tim Lee | 792e31e | 2021-12-10 14:10:46 +0800 | [diff] [blame] | 361 | ${task_dict}= Redfish.Get Properties /redfish/v1/TaskService/Tasks/${task_id} |
| 362 | Should Be Equal As Strings ${task_dict['TaskState']} Completed |
Anusha Dathatri | eed0e59 | 2021-04-21 03:17:12 -0500 | [diff] [blame] | 363 | |
Anusha Dathatri | fd35022 | 2021-04-08 06:07:49 -0500 | [diff] [blame] | 364 | Get Dump ID And Status |
| 365 | [Documentation] Return dump ID and status. |
| 366 | [Arguments] ${task_id} |
| 367 | |
| 368 | # Description of argument(s): |
| 369 | # task_id Task ID. |
| 370 | |
Anusha Dathatri | 66af3c4 | 2022-08-08 10:18:48 -0500 | [diff] [blame] | 371 | Wait Until Keyword Succeeds 10 min 15 sec Check Task Completion ${task_id} |
| 372 | ${dump_id}= Get Dump ID ${task_id} |
| 373 | [Return] ${dump_id} Completed |