George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Methods to execute commands on BMC and collect |
| 3 | ... data to a list of FFDC files |
| 4 | |
Michael Walsh | 265ae41 | 2018-11-16 15:32:03 -0600 | [diff] [blame] | 5 | Resource openbmc_ffdc_utils.robot |
| 6 | Resource rest_client.robot |
| 7 | Resource utils.robot |
| 8 | Resource list_utils.robot |
| 9 | Resource logging_utils.robot |
Steven Sombar | 2da175f | 2019-02-04 10:32:58 -0600 | [diff] [blame] | 10 | Resource bmc_redfish_resource.robot |
Michael Walsh | 265ae41 | 2018-11-16 15:32:03 -0600 | [diff] [blame] | 11 | Library SSHLibrary |
| 12 | Library OperatingSystem |
| 13 | Library Collections |
| 14 | Library String |
| 15 | Library gen_print.py |
| 16 | Library gen_cmd.py |
| 17 | Library gen_robot_keyword.py |
| 18 | Library dump_utils.py |
| 19 | Library logging_utils.py |
Gunnar Mills | 7e2cda2 | 2016-10-11 15:37:34 -0500 | [diff] [blame] | 20 | |
Michael Walsh | de5e937 | 2018-11-15 11:28:23 -0600 | [diff] [blame] | 21 | *** Variables *** |
| 22 | |
Michael Walsh | 265ae41 | 2018-11-16 15:32:03 -0600 | [diff] [blame] | 23 | ${FFDC_CMD_TIMEOUT} 240 |
Michael Walsh | de5e937 | 2018-11-15 11:28:23 -0600 | [diff] [blame] | 24 | |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 25 | *** Keywords *** |
| 26 | |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 27 | # Method : Call FFDC Methods # |
| 28 | # Execute the user define keywords from the FFDC List # |
| 29 | # Unlike any other keywords this will call into the # |
| 30 | # list of keywords defined in the FFDC list at one go # |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 31 | |
| 32 | Call FFDC Methods |
Michael Walsh | e844e9a | 2017-04-20 16:51:10 -0500 | [diff] [blame] | 33 | [Documentation] Call into FFDC Keyword index list. |
| 34 | [Arguments] ${ffdc_function_list}=${EMPTY} |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 35 | |
Michael Walsh | e844e9a | 2017-04-20 16:51:10 -0500 | [diff] [blame] | 36 | # Description of argument(s): |
| 37 | # ffdc_function_list A colon-delimited list naming the kinds of FFDC that |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 38 | # are to be collected |
Michael Walsh | e844e9a | 2017-04-20 16:51:10 -0500 | [diff] [blame] | 39 | # (e.g. "FFDC Generic Report:BMC Specific Files"). |
| 40 | # Acceptable values can be found in the description |
| 41 | # field of FFDC_METHOD_CALL in |
| 42 | # lib/openbmc_ffdc_list.py. Those values can be |
| 43 | # obtained via a call to 'Get FFDC Method Desc' (also |
| 44 | # from lib/openbmc_ffdc_list.py). |
| 45 | |
| 46 | @{entries}= Get FFDC Method Index |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 47 | # Example entries: |
| 48 | # entries: |
| 49 | # entries[0]: BMC LOGS |
| 50 | |
| 51 | @{ffdc_file_list}= Create List |
Sushil Singh | 1988855 | 2020-06-08 02:14:52 -0500 | [diff] [blame] | 52 | FOR ${index} IN @{entries} |
| 53 | ${ffdc_file_sub_list}= Method Call Keyword List ${index} ${ffdc_function_list} |
| 54 | ${ffdc_file_list}= Smart Combine Lists ${ffdc_file_list} ${ffdc_file_sub_list} |
| 55 | END |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 56 | |
Michael Walsh | 6bad841 | 2017-06-27 14:09:36 -0500 | [diff] [blame] | 57 | Run Key U SSHLibrary.Close All Connections |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 58 | |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 59 | [Return] ${ffdc_file_list} |
| 60 | |
Steven Sombar | 2da175f | 2019-02-04 10:32:58 -0600 | [diff] [blame] | 61 | |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 62 | Method Call Keyword List |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 63 | [Documentation] Process FFDC request and return a list of generated files. |
Michael Walsh | e844e9a | 2017-04-20 16:51:10 -0500 | [diff] [blame] | 64 | [Arguments] ${index} ${ffdc_function_list}=${EMPTY} |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 65 | |
Michael Walsh | e844e9a | 2017-04-20 16:51:10 -0500 | [diff] [blame] | 66 | # Description of argument(s): |
| 67 | # index The index into the FFDC_METHOD_CALL dictionary (e.g. |
| 68 | # 'BMC LOGS'). |
| 69 | # ffdc_function_list See ffdc_function_list description in |
| 70 | # "Call FFDC Methods" (above). |
| 71 | |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 72 | @{method_list}= Get FFDC Method Call ${index} |
| 73 | # Example method_list: |
| 74 | # method_list: |
| 75 | # method_list[0]: |
| 76 | # method_list[0][0]: FFDC Generic Report |
| 77 | # method_list[0][1]: BMC FFDC Manifest |
| 78 | # method_list[1]: |
| 79 | # method_list[1][0]: Get Request FFDC |
| 80 | # method_list[1][1]: BMC FFDC Get Requests |
| 81 | # (etc.) |
Michael Walsh | e844e9a | 2017-04-20 16:51:10 -0500 | [diff] [blame] | 82 | |
| 83 | # If function list is empty assign default (i.e. a list of all allowable |
| 84 | # values). In either case, convert ffdc_function_list from a string to |
| 85 | # a list. |
| 86 | @{ffdc_function_list}= |
| 87 | ... Run Keyword If '${ffdc_function_list}' == '${EMPTY}' |
| 88 | ... Get FFDC Method Desc ${index} |
| 89 | ... ELSE |
| 90 | ... Split String ${ffdc_function_list} separator=: |
| 91 | |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 92 | @{ffdc_file_list}= Create List |
Sushil Singh | 1988855 | 2020-06-08 02:14:52 -0500 | [diff] [blame] | 93 | FOR ${method} IN @{method_list} |
| 94 | ${ffdc_file_sub_list}= Execute Keyword Method ${method[0]} ${method[1]} @{ffdc_function_list} |
| 95 | ${ffdc_file_list}= Smart Combine Lists ${ffdc_file_list} ${ffdc_file_sub_list} |
| 96 | END |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 97 | |
| 98 | [Return] ${ffdc_file_list} |
| 99 | |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 100 | |
| 101 | Execute Keyword Method |
Michael Walsh | e844e9a | 2017-04-20 16:51:10 -0500 | [diff] [blame] | 102 | [Documentation] Call into BMC method keywords. Don't let one |
| 103 | ... failure skip the remaining. Get whatever data |
| 104 | ... it could gather at worse case scenario. |
| 105 | [Arguments] ${description} ${keyword_name} @{ffdc_function_list} |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 106 | |
Michael Walsh | e844e9a | 2017-04-20 16:51:10 -0500 | [diff] [blame] | 107 | # Description of argument(s): |
| 108 | # description The description of the FFDC to be collected. This |
| 109 | # would be any value returned by |
| 110 | # 'Get FFDC Method Desc' (e.g. "FFDC Generic Report"). |
| 111 | # keyword_name The name of the keyword to call to collect the FFDC |
| 112 | # data (again, see FFDC_METHOD_CALL). |
| 113 | # ffdc_function_list See ffdc_function_list description in |
| 114 | # "Call FFDC Methods" (above). The only difference is |
| 115 | # in this case, it should be a list rather than a |
| 116 | # colon-delimited value. |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 117 | |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 118 | @{ffdc_file_list}= Create List |
Michael Walsh | e844e9a | 2017-04-20 16:51:10 -0500 | [diff] [blame] | 119 | |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 120 | ${index}= Get Index From List ${ffdc_function_list} ${description} |
| 121 | Run Keyword If '${index}' == '${-1}' Return from Keyword |
| 122 | ... ${ffdc_file_list} |
| 123 | |
| 124 | ${status} ${ffdc_file_list}= Run Key ${keyword_name} ignore=1 |
| 125 | [Return] ${ffdc_file_list} |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 126 | |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 127 | # Method : BMC FFDC Manifest # |
| 128 | # Execute command on BMC and write to ffdc_report.txt # |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 129 | |
| 130 | BMC FFDC Manifest |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 131 | [Documentation] Run the ssh commands from FFDC_BMC_CMD and return a list |
| 132 | ... of generated files. |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 133 | |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 134 | @{ffdc_file_list}= Create List ${FFDC_FILE_PATH} |
| 135 | @{entries}= Get FFDC Cmd Index |
Sushil Singh | 1988855 | 2020-06-08 02:14:52 -0500 | [diff] [blame] | 136 | |
| 137 | FOR ${index} IN @{entries} |
| 138 | Iterate BMC Command List Pairs ${index} |
| 139 | END |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 140 | |
| 141 | [Return] ${ffdc_file_list} |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 142 | |
| 143 | |
| 144 | Iterate BMC Command List Pairs |
| 145 | [Documentation] Feed in key pair list from dictionary to execute |
| 146 | [Arguments] ${key_index} |
| 147 | |
| 148 | @{cmd_list}= Get ffdc bmc cmd ${key_index} |
| 149 | Set Suite Variable ${ENTRY_INDEX} ${key_index} |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 150 | |
Sushil Singh | 1988855 | 2020-06-08 02:14:52 -0500 | [diff] [blame] | 151 | FOR ${cmd} IN @{cmd_list} |
| 152 | Execute Command and Write FFDC ${cmd[0]} ${cmd[1]} |
| 153 | END |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 154 | |
| 155 | Execute Command and Write FFDC |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 156 | [Documentation] Run a command on the BMC or OS, write the output to the |
| 157 | ... specified file and return a list of generated files. |
| 158 | [Arguments] ${key_index} ${cmd} ${logpath}=${FFDC_FILE_PATH} |
| 159 | ... ${target}=BMC |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 160 | |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 161 | Run Keyword If '${logpath}' == '${FFDC_FILE_PATH}' |
| 162 | ... Write Cmd Output to FFDC File ${key_index} ${cmd} |
| 163 | |
| 164 | @{ffdc_file_list}= Create List ${log_path} |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 165 | |
Michael Walsh | e53e47a | 2017-06-30 17:03:24 -0500 | [diff] [blame] | 166 | ${cmd_buf}= Catenate ${target} Execute Command \ ${cmd} \ ignore_err=${1} |
Michael Walsh | 265ae41 | 2018-11-16 15:32:03 -0600 | [diff] [blame] | 167 | ... \ time_out=${FFDC_CMD_TIMEOUT} |
Michael Walsh | e53e47a | 2017-06-30 17:03:24 -0500 | [diff] [blame] | 168 | ${status} ${ret_values}= Run Key ${cmd_buf} ignore=${1} |
Michael Walsh | de5e937 | 2018-11-15 11:28:23 -0600 | [diff] [blame] | 169 | # If the command times out, status will be 'FAIL'. |
| 170 | Return From Keyword If '${status}' == 'FAIL' ${ffdc_file_list} |
Michael Walsh | e53e47a | 2017-06-30 17:03:24 -0500 | [diff] [blame] | 171 | |
Sushil Singh | 1988855 | 2020-06-08 02:14:52 -0500 | [diff] [blame] | 172 | ${stdout}= Set Variable ${ret_values}[0] |
| 173 | ${stderr}= Set Variable ${ret_values}[1] |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 174 | |
Jeff Whitlock | 7d805b2 | 2017-01-20 14:04:33 -0600 | [diff] [blame] | 175 | # Write stdout on success and stderr/stdout to the file on failure. |
| 176 | Run Keyword If $stderr == '${EMPTY}' |
Sweta Potthuri | 15e6d2f | 2017-02-28 03:10:02 -0600 | [diff] [blame] | 177 | ... Write Data To File ${stdout}${\n} ${logpath} |
| 178 | ... ELSE Write Data To File |
Jeff Whitlock | 7d805b2 | 2017-01-20 14:04:33 -0600 | [diff] [blame] | 179 | ... ERROR output:${\n}${stderr}${\n}Output:${\n}${stdout}${\n} |
| 180 | ... ${logpath} |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 181 | |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 182 | [Return] ${ffdc_file_list} |
| 183 | |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 184 | |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 185 | # Method : BMC FFDC Files # |
| 186 | # Execute command on BMC and write to individual file # |
| 187 | # based on the file name pre-defined in the list # |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 188 | |
| 189 | BMC FFDC Files |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 190 | [Documentation] Run the commands from FFDC_BMC_FILE and return a list of |
| 191 | ... generated files. |
| 192 | |
| 193 | @{entries}= Get FFDC File Index |
| 194 | # Example of entries: |
| 195 | # entries: |
| 196 | # entries[0]: BMC FILES |
| 197 | |
Steven Sombar | a31f4c8 | 2019-08-01 16:00:23 -0500 | [diff] [blame] | 198 | scp.Open Connection |
vinaybs6 | b811094 | 2020-01-29 23:15:29 -0600 | [diff] [blame] | 199 | ... ${OPENBMC_HOST} username=${OPENBMC_USERNAME} password=${OPENBMC_PASSWORD} port=${SSH_PORT} |
Steven Sombar | a31f4c8 | 2019-08-01 16:00:23 -0500 | [diff] [blame] | 200 | |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 201 | @{ffdc_file_list}= Create List |
Sushil Singh | 1988855 | 2020-06-08 02:14:52 -0500 | [diff] [blame] | 202 | |
| 203 | FOR ${index} IN @{entries} |
| 204 | ${ffdc_file_sub_list}= Create File and Write Data ${index} |
| 205 | ${ffdc_file_list}= Smart Combine Lists ${ffdc_file_list} ${ffdc_file_sub_list} |
| 206 | END |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 207 | |
Michael Walsh | 17eaafe | 2019-08-22 11:05:20 -0500 | [diff] [blame] | 208 | BMC Execute Command rm -rf /tmp/BMC_* |
Steven Sombar | a31f4c8 | 2019-08-01 16:00:23 -0500 | [diff] [blame] | 209 | scp.Close Connection |
| 210 | |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 211 | [Return] ${ffdc_file_list} |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 212 | |
| 213 | |
| 214 | Create File and Write Data |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 215 | [Documentation] Run commands from FFDC_BMC_FILE to create FFDC files and |
| 216 | ... return a list of generated files. |
| 217 | [Arguments] ${key_index} |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 218 | |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 219 | # Description of argument(s): |
| 220 | # key_index The index into the FFDC_BMC_FILE dictionary. |
| 221 | |
| 222 | @{ffdc_file_list}= Create List |
| 223 | @{cmd_list}= Get FFDC BMC File ${key_index} |
Sushil Singh | 1988855 | 2020-06-08 02:14:52 -0500 | [diff] [blame] | 224 | |
| 225 | FOR ${cmd} IN @{cmd_list} |
| 226 | ${logpath}= Catenate SEPARATOR= ${LOG_PREFIX} ${cmd[0]} |
| 227 | ${ffdc_file_sub_list}= Execute Command and Write FFDC ${cmd[0]} ${cmd[1]} ${logpath} |
George Keishing | 89974c9 | 2022-02-14 10:43:03 -0600 | [diff] [blame] | 228 | Run Key U scp.Get File \ /tmp/${cmd[0]} \ ${LOG_PREFIX}${cmd[0]} ignore=1 |
Sushil Singh | 1988855 | 2020-06-08 02:14:52 -0500 | [diff] [blame] | 229 | ${ffdc_file_list}= Smart Combine Lists ${ffdc_file_list} ${ffdc_file_sub_list} |
| 230 | END |
Sivas SRR | 0d657e8 | 2017-03-13 01:00:34 -0500 | [diff] [blame] | 231 | |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 232 | [Return] ${ffdc_file_list} |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 233 | |
| 234 | |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 235 | # Method : Log Test Case Status # |
| 236 | # Creates test result history footprint for reference # |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 237 | |
| 238 | Log Test Case Status |
Jeff Whitlock | 7d805b2 | 2017-01-20 14:04:33 -0600 | [diff] [blame] | 239 | [Documentation] Test case execution result history. |
| 240 | ... Create once and append to this file |
| 241 | ... logs/test_history.txt |
| 242 | ... Format Date:Test suite:Test case:Status |
| 243 | ... 20160909214053719992:Test Warmreset:Test WarmReset via REST:FAIL |
Michael Walsh | fa9f70f | 2017-04-21 16:00:18 -0500 | [diff] [blame] | 244 | |
| 245 | ${FFDC_DIR_PATH_STYLE}= Get Variable Value ${FFDC_DIR_PATH_STYLE} |
| 246 | ... ${EMPTY} |
| 247 | ${FFDC_DIR_PATH}= Get Variable Value ${FFDC_DIR_PATH} ${EMPTY} |
| 248 | |
| 249 | Run Keyword If '${FFDC_DIR_PATH}' == '${EMPTY}' Set FFDC Defaults |
| 250 | |
| 251 | Run Keyword If '${FFDC_DIR_PATH_STYLE}' == '${1}' Run Keywords |
| 252 | ... Set Global Variable ${FFDC_LOG_PATH} ${FFDC_DIR_PATH} AND |
| 253 | ... Set Global Variable ${TEST_HISTORY} ${FFDC_DIR_PATH}test_history.txt |
| 254 | |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 255 | Create Directory ${FFDC_LOG_PATH} |
| 256 | |
| 257 | ${exist}= Run Keyword and Return Status |
| 258 | ... OperatingSystem.File Should Exist ${TEST_HISTORY} |
| 259 | |
| 260 | Run Keyword If '${exist}' == '${False}' |
| 261 | ... Create File ${TEST_HISTORY} |
| 262 | |
Michael Walsh | fa9f70f | 2017-04-21 16:00:18 -0500 | [diff] [blame] | 263 | Rpvars TEST_HISTORY |
| 264 | |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 265 | ${cur_time}= Get Current Time Stamp |
| 266 | |
| 267 | Append To File ${TEST_HISTORY} |
| 268 | ... ${cur_time}:${SUITE_NAME}:${TEST_NAME}:${TEST_STATUS}${\n} |
| 269 | |
Gunnar Mills | a812e0f | 2016-09-29 20:30:03 -0500 | [diff] [blame] | 270 | |
| 271 | Log FFDC Get Requests |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 272 | [Documentation] Run the get requests associated with the key and return a |
| 273 | ... list of generated files. |
| 274 | [Arguments] ${key_index} |
Gunnar Mills | a812e0f | 2016-09-29 20:30:03 -0500 | [diff] [blame] | 275 | |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 276 | # Note: Output will be in JSON pretty_print format. |
| 277 | |
| 278 | # Description of argument(s): |
| 279 | # key_index The key to the FFDC_GET_REQUEST dictionary that contains the |
| 280 | # get requests that are to be run. |
| 281 | |
| 282 | @{ffdc_file_list}= Create List |
| 283 | @{cmd_list}= Get FFDC Get Request ${key_index} |
Sushil Singh | 1988855 | 2020-06-08 02:14:52 -0500 | [diff] [blame] | 284 | |
| 285 | FOR ${cmd} IN @{cmd_list} |
| 286 | ${logpath}= Catenate SEPARATOR= ${LOG_PREFIX} ${cmd[0]} |
George Keishing | ccd20e1 | 2020-07-29 11:14:26 -0500 | [diff] [blame] | 287 | ${resp}= OpenBMC Get Request ${cmd[1]} quiet=${1} timeout=${30} |
Sushil Singh | 1988855 | 2020-06-08 02:14:52 -0500 | [diff] [blame] | 288 | ${status}= Run Keyword and Return Status Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} |
| 289 | Run Keyword If '${status}' == '${False}' Continue For Loop |
| 290 | ${jsondata}= to json ${resp.content} pretty_print=True |
| 291 | Write Data To File ${\n}${jsondata}${\n} ${logpath} |
| 292 | Append To List ${ffdc_file_list} ${logpath} |
| 293 | END |
Gunnar Mills | a812e0f | 2016-09-29 20:30:03 -0500 | [diff] [blame] | 294 | |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 295 | [Return] ${ffdc_file_list} |
Gunnar Mills | a812e0f | 2016-09-29 20:30:03 -0500 | [diff] [blame] | 296 | |
George Keishing | 8c42bbc | 2021-09-28 14:52:54 -0500 | [diff] [blame] | 297 | |
| 298 | Log FFDC Get Redfish Requests |
| 299 | [Documentation] Run the get requests associated with the key and return a |
| 300 | ... list of generated files. |
| 301 | [Arguments] ${key_index} |
| 302 | |
| 303 | # Note: Output will be in JSON pretty_print format. |
| 304 | |
| 305 | # Description of argument(s): |
| 306 | # key_index The key to the FFDC_GET_REDFISH_REQUEST dictionary that contains the |
| 307 | # get requests that are to be run. |
| 308 | |
| 309 | @{ffdc_file_list}= Create List |
| 310 | @{cmd_list}= Get FFDC Get Redfish Request ${key_index} |
| 311 | |
| 312 | FOR ${cmd} IN @{cmd_list} |
| 313 | ${logpath}= Catenate SEPARATOR= ${LOG_PREFIX} ${cmd[0]} |
| 314 | ${resp}= Redfish.Get ${cmd[1]} |
| 315 | Write Data To File ${\n}${resp}${\n} ${logpath} |
| 316 | Append To List ${ffdc_file_list} ${logpath} |
| 317 | END |
| 318 | |
| 319 | [Return] ${ffdc_file_list} |
| 320 | |
| 321 | |
Gunnar Mills | a812e0f | 2016-09-29 20:30:03 -0500 | [diff] [blame] | 322 | BMC FFDC Get Requests |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 323 | [Documentation] Iterate over get request list and return a list of |
| 324 | ... generated files. |
| 325 | |
| 326 | @{ffdc_file_list}= Create List |
| 327 | |
Gunnar Mills | a812e0f | 2016-09-29 20:30:03 -0500 | [diff] [blame] | 328 | @{entries}= Get ffdc get request index |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 329 | # Example of entries: |
| 330 | # entries: |
| 331 | # entries[0]: GET REQUESTS |
Sushil Singh | 1988855 | 2020-06-08 02:14:52 -0500 | [diff] [blame] | 332 | |
| 333 | FOR ${index} IN @{entries} |
| 334 | ${ffdc_file_sub_list}= Log FFDC Get Requests ${index} |
| 335 | ${ffdc_file_list}= Smart Combine Lists ${ffdc_file_list} ${ffdc_file_sub_list} |
| 336 | END |
Gunnar Mills | 7e2cda2 | 2016-10-11 15:37:34 -0500 | [diff] [blame] | 337 | |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 338 | [Return] ${ffdc_file_list} |
Gunnar Mills | 7e2cda2 | 2016-10-11 15:37:34 -0500 | [diff] [blame] | 339 | |
George Keishing | 8c42bbc | 2021-09-28 14:52:54 -0500 | [diff] [blame] | 340 | |
| 341 | BMC FFDC Get Redfish Requests |
| 342 | [Documentation] Iterate over get request list and return a list of |
| 343 | ... generated files. |
| 344 | |
| 345 | @{ffdc_file_list}= Create List |
| 346 | |
| 347 | @{entries}= Get ffdc get redfish request index |
| 348 | # Example of entries: |
| 349 | # entries: |
| 350 | # entries[0]: GET REQUESTS |
| 351 | |
| 352 | FOR ${index} IN @{entries} |
| 353 | ${ffdc_file_sub_list}= Log FFDC Get Redfish Requests ${index} |
| 354 | ${ffdc_file_list}= Smart Combine Lists ${ffdc_file_list} ${ffdc_file_sub_list} |
| 355 | END |
| 356 | |
| 357 | [Return] ${ffdc_file_list} |
| 358 | |
| 359 | |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 360 | Log OS All distros FFDC |
| 361 | [Documentation] Run commands from FFDC_OS_ALL_DISTROS_FILE to create FFDC |
| 362 | ... files and return a list of generated files. |
| 363 | [Arguments] ${key_index} |
Gunnar Mills | 7e2cda2 | 2016-10-11 15:37:34 -0500 | [diff] [blame] | 364 | |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 365 | # Description of argument(s): |
| 366 | # key_index The index into the FFDC_OS_ALL_DISTROS_FILE dictionary. |
| 367 | |
| 368 | @{ffdc_file_list}= Create List |
| 369 | |
| 370 | @{cmd_list}= Get FFDC OS All Distros Call ${key_index} |
Sushil Singh | 1988855 | 2020-06-08 02:14:52 -0500 | [diff] [blame] | 371 | |
| 372 | FOR ${cmd} IN @{cmd_list} |
| 373 | ${logpath}= Catenate SEPARATOR= ${LOG_PREFIX} ${cmd[0]} |
| 374 | ${ffdc_file_sub_list}= Execute Command and Write FFDC ${cmd[0]} ${cmd[1]} ${logpath} target=OS |
| 375 | # scp it to the LOG_PREFIX ffdc directory. |
George Keishing | 89974c9 | 2022-02-14 10:43:03 -0600 | [diff] [blame] | 376 | Run Key U scp.Get File \ /tmp/${cmd[0]} \ ${LOG_PREFIX}${cmd[0]} ignore=1 |
Sushil Singh | 1988855 | 2020-06-08 02:14:52 -0500 | [diff] [blame] | 377 | ${ffdc_file_list}= Smart Combine Lists ${ffdc_file_list} ${ffdc_file_sub_list} |
| 378 | END |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 379 | |
| 380 | [Return] ${ffdc_file_list} |
Gunnar Mills | 7e2cda2 | 2016-10-11 15:37:34 -0500 | [diff] [blame] | 381 | |
| 382 | |
Gunnar Mills | cce185d | 2016-10-17 17:04:15 -0500 | [diff] [blame] | 383 | Log OS SPECIFIC DISTRO FFDC |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 384 | [Documentation] Run commands from the FFDC_OS_<distro>_FILE to create FFDC |
| 385 | ... files and return a list of generated files. |
| 386 | [Arguments] ${key_index} ${linux_distro} |
Gunnar Mills | cce185d | 2016-10-17 17:04:15 -0500 | [diff] [blame] | 387 | |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 388 | # Description of argument(s): |
| 389 | # key_index The index into the FFDC_OS_<distro>_FILE dictionary. |
| 390 | # linux_distro Your OS's linux distro (e.g. "UBUNTU", "RHEL", etc). |
| 391 | |
George Keishing | 671dd66 | 2021-05-28 03:26:30 -0500 | [diff] [blame] | 392 | Log To Console Collecting log for ${linux_distro} |
| 393 | |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 394 | @{ffdc_file_list}= Create List |
| 395 | |
| 396 | @{cmd_list}= Get FFDC OS Distro Call ${key_index} ${linux_distro} |
Sushil Singh | 1988855 | 2020-06-08 02:14:52 -0500 | [diff] [blame] | 397 | |
| 398 | FOR ${cmd} IN @{cmd_list} |
| 399 | ${logpath}= Catenate SEPARATOR= ${LOG_PREFIX} ${cmd[0]} |
| 400 | ${ffdc_file_sub_list}= Execute Command and Write FFDC ${cmd[0]} ${cmd[1]} ${logpath} target=OS |
George Keishing | 89974c9 | 2022-02-14 10:43:03 -0600 | [diff] [blame] | 401 | Run Key U scp.Get File \ /tmp/${cmd[0]} \ ${LOG_PREFIX}${cmd[0]} ignore=1 |
Sushil Singh | 1988855 | 2020-06-08 02:14:52 -0500 | [diff] [blame] | 402 | ${ffdc_file_list}= Smart Combine Lists ${ffdc_file_list} ${ffdc_file_sub_list} |
George Keishing | 4609d2f | 2021-05-28 04:40:58 -0500 | [diff] [blame] | 403 | END |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 404 | |
Steven Sombar | e70acbe | 2019-08-20 14:37:47 -0500 | [diff] [blame] | 405 | # Get the name of the sosreport file. |
| 406 | ${sosreport_file_path} ${stderr} ${rc}= OS Execute Command |
| 407 | ... ls /tmp/sosreport*FFDC*tar.xz ignore_err=${True} |
| 408 | # Example: sosreport_file_path="/tmp/sosreport-myhost-FFDC-2019-08-20-pbuaqtk.tar.xz". |
| 409 | |
| 410 | # Return if there is no sosreport file. |
| 411 | Return From Keyword If ${rc} != ${0} ${ffdc_file_list} |
| 412 | |
| 413 | ${sosreport_dir_path} ${sosreport_file_name}= Split Path ${sosreport_file_path} |
| 414 | # Example: sosreport_dir_path="/tmp", |
| 415 | # sosreport_file_name="sosreport-myhost-FFDC-2019-08-20-pbuaqtk.tar.xz". |
| 416 | |
| 417 | # Location where the sosreport file will be copied to. |
| 418 | ${local_sosreport_file_path}= Set Variable ${LOG_PREFIX}OS_${sosreport_file_name} |
| 419 | |
| 420 | # Change file permissions otherwise scp will not see the file. |
| 421 | OS Execute Command chmod 644 ${sosreport_file_path} |
| 422 | |
| 423 | # SCP the sosreport file from the OS. |
George Keishing | 89974c9 | 2022-02-14 10:43:03 -0600 | [diff] [blame] | 424 | Run Key U scp.Get File \ ${sosreport_file_path} \ ${local_sosreport_file_path} ignore=1 |
Steven Sombar | e70acbe | 2019-08-20 14:37:47 -0500 | [diff] [blame] | 425 | |
| 426 | # Add the file location to the ffdc_file_list. |
| 427 | Append To List ${ffdc_file_list} ${local_sosreport_file_path} |
| 428 | |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 429 | [Return] ${ffdc_file_list} |
Gunnar Mills | cce185d | 2016-10-17 17:04:15 -0500 | [diff] [blame] | 430 | |
| 431 | |
George Keishing | ca8c4c6 | 2016-10-14 10:08:40 -0500 | [diff] [blame] | 432 | OS FFDC Files |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 433 | [Documentation] Run the commands from FFDC_OS_ALL_DISTROS_FILE to create |
| 434 | ... FFDC files and return a list of generated files. |
Gunnar Mills | aca140d | 2016-10-26 13:05:10 -0500 | [diff] [blame] | 435 | [Arguments] ${OS_HOST}=${OS_HOST} ${OS_USERNAME}=${OS_USERNAME} |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 436 | ... ${OS_PASSWORD}=${OS_PASSWORD} |
Gunnar Mills | 7e2cda2 | 2016-10-11 15:37:34 -0500 | [diff] [blame] | 437 | |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 438 | @{ffdc_file_list}= Create List |
Gunnar Mills | aca140d | 2016-10-26 13:05:10 -0500 | [diff] [blame] | 439 | |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 440 | Run Keyword If '${OS_HOST}' == '${EMPTY}' Run Keywords |
| 441 | ... Print Timen No OS Host provided so no OS FFDC will be done. AND |
| 442 | ... Return From Keyword ${ffdc_file_list} |
Gunnar Mills | aca140d | 2016-10-26 13:05:10 -0500 | [diff] [blame] | 443 | |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 444 | ${match_state}= Create Dictionary os_ping=^1$ os_login=^1$ |
| 445 | ... os_run_cmd=^1$ |
| 446 | ${status} ${ret_values}= Run Keyword and Ignore Error Check State |
| 447 | ... ${match_state} quiet=0 |
| 448 | |
| 449 | Run Keyword If '${status}' == 'FAIL' Run Keywords |
Michael Walsh | c3b28d7 | 2017-11-16 10:43:14 -0600 | [diff] [blame] | 450 | ... Print Timen The OS is not communicating so no OS FFDC will be done.\n |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 451 | ... AND |
| 452 | ... Return From Keyword ${ffdc_file_list} |
Gunnar Mills | cce185d | 2016-10-17 17:04:15 -0500 | [diff] [blame] | 453 | |
George Keishing | 671dd66 | 2021-05-28 03:26:30 -0500 | [diff] [blame] | 454 | ${stdout}= OS Distro Type |
| 455 | |
Michael Walsh | e53e47a | 2017-06-30 17:03:24 -0500 | [diff] [blame] | 456 | Set Global Variable ${linux_distro} ${stdout} |
Gunnar Mills | aca140d | 2016-10-26 13:05:10 -0500 | [diff] [blame] | 457 | |
Michael Walsh | e53e47a | 2017-06-30 17:03:24 -0500 | [diff] [blame] | 458 | Rpvars linux_distro |
Gunnar Mills | aca140d | 2016-10-26 13:05:10 -0500 | [diff] [blame] | 459 | |
Steven Sombar | fc024cb | 2019-04-22 11:16:16 -0500 | [diff] [blame] | 460 | scp.Open Connection |
| 461 | ... ${OS_HOST} username=${OS_USERNAME} password=${OS_PASSWORD} |
| 462 | |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 463 | @{entries}= Get FFDC OS All Distros Index |
Sushil Singh | 1988855 | 2020-06-08 02:14:52 -0500 | [diff] [blame] | 464 | |
| 465 | FOR ${index} IN @{entries} |
| 466 | ${ffdc_file_sub_list}= Log OS All distros FFDC ${index} |
| 467 | ${ffdc_file_list}= Smart Combine Lists ${ffdc_file_list} ${ffdc_file_sub_list} |
| 468 | END |
Gunnar Mills | cce185d | 2016-10-17 17:04:15 -0500 | [diff] [blame] | 469 | |
Jeff Whitlock | 7d805b2 | 2017-01-20 14:04:33 -0600 | [diff] [blame] | 470 | Return From Keyword If |
| 471 | ... '${linux_distro}' == '${EMPTY}' or '${linux_distro}' == 'None' |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 472 | ... ${ffdc_file_list} |
Gunnar Mills | cce185d | 2016-10-17 17:04:15 -0500 | [diff] [blame] | 473 | |
| 474 | @{entries}= Get ffdc os distro index ${linux_distro} |
Sushil Singh | 1988855 | 2020-06-08 02:14:52 -0500 | [diff] [blame] | 475 | |
| 476 | FOR ${index} IN @{entries} |
| 477 | ${ffdc_file_sub_list}= Log OS SPECIFIC DISTRO FFDC ${index} ${linux_distro} |
| 478 | ${ffdc_file_list}= Smart Combine Lists ${ffdc_file_list} ${ffdc_file_sub_list} |
| 479 | END |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 480 | |
Steven Sombar | fc024cb | 2019-04-22 11:16:16 -0500 | [diff] [blame] | 481 | # Delete ffdc files still on OS and close scp. |
Steven Sombar | e70acbe | 2019-08-20 14:37:47 -0500 | [diff] [blame] | 482 | OS Execute Command rm -rf /tmp/OS_* /tmp/sosreport*FFDC* ignore_err=${True} |
Steven Sombar | fc024cb | 2019-04-22 11:16:16 -0500 | [diff] [blame] | 483 | scp.Close Connection |
| 484 | |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 485 | [Return] ${ffdc_file_list} |
George Keishing | 7a52022 | 2017-02-27 09:44:30 -0600 | [diff] [blame] | 486 | |
| 487 | |
Steven Sombar | 96de573 | 2017-08-17 09:04:52 -0500 | [diff] [blame] | 488 | System Inventory Files |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 489 | [Documentation] Copy systest os_inventory files and return a list of |
| 490 | ... generated files.. |
Steven Sombar | 96de573 | 2017-08-17 09:04:52 -0500 | [diff] [blame] | 491 | # The os_inventory files are the result of running |
| 492 | # systest/htx_hardbootme_test. If these files exist |
| 493 | # they are copied to the FFDC directory. |
| 494 | # Global variable ffdc_dir_path is the path name of the |
| 495 | # directory they are copied to. |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 496 | |
| 497 | @{ffdc_file_list}= Create List |
| 498 | |
| 499 | ${globex}= Set Variable os_inventory_*.json |
| 500 | |
| 501 | @{file_list}= OperatingSystem.List Files In Directory . ${globex} |
| 502 | |
| 503 | Copy Files ${globex} ${ffdc_dir_path} |
| 504 | |
Sushil Singh | 1988855 | 2020-06-08 02:14:52 -0500 | [diff] [blame] | 505 | FOR ${file_name} IN @{file_list} |
| 506 | Append To List ${ffdc_file_list} ${ffdc_dir_path}${file_name} |
| 507 | END |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 508 | |
| 509 | Run Keyword and Ignore Error Remove Files ${globex} |
| 510 | |
| 511 | [Return] ${ffdc_file_list} |
Steven Sombar | 96de573 | 2017-08-17 09:04:52 -0500 | [diff] [blame] | 512 | |
| 513 | |
George Keishing | 7a52022 | 2017-02-27 09:44:30 -0600 | [diff] [blame] | 514 | SCP Coredump Files |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 515 | [Documentation] Copy core dump files from BMC to local system and return a |
| 516 | ... list of generated file names. |
| 517 | |
| 518 | @{ffdc_file_list}= Create List |
Michael Walsh | e53e47a | 2017-06-30 17:03:24 -0500 | [diff] [blame] | 519 | |
George Keishing | 7a52022 | 2017-02-27 09:44:30 -0600 | [diff] [blame] | 520 | # Check if core dump exist in the /tmp |
Michael Walsh | e53e47a | 2017-06-30 17:03:24 -0500 | [diff] [blame] | 521 | ${core_files} ${stderr} ${rc}= BMC Execute Command ls /tmp/core_* |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 522 | ... ignore_err=${1} |
| 523 | Run Keyword If '${rc}' != '${0}' Return From Keyword ${ffdc_file_list} |
| 524 | |
| 525 | @{core_list}= Split String ${core_files} |
George Keishing | 7a52022 | 2017-02-27 09:44:30 -0600 | [diff] [blame] | 526 | # Copy the core files |
Michael Walsh | 6bad841 | 2017-06-27 14:09:36 -0500 | [diff] [blame] | 527 | Run Key U Open Connection for SCP |
Sushil Singh | 1988855 | 2020-06-08 02:14:52 -0500 | [diff] [blame] | 528 | |
| 529 | FOR ${index} IN @{core_list} |
| 530 | ${ffdc_file_path}= Catenate ${LOG_PREFIX}${index.lstrip("/tmp/")} |
| 531 | ${status}= Run Keyword and Return Status scp.Get File ${index} ${ffdc_file_path} |
| 532 | Run Keyword If '${status}' == '${False}' Continue For Loop |
| 533 | Append To List ${ffdc_file_list} ${ffdc_file_path} |
| 534 | |
| 535 | # Remove the file from remote to avoid re-copying on next FFDC call |
| 536 | |
| 537 | BMC Execute Command rm ${index} ignore_err=${1} |
| 538 | # I can't find a way to do this: scp.Close Connection |
| 539 | |
| 540 | END |
George Keishing | 7a52022 | 2017-02-27 09:44:30 -0600 | [diff] [blame] | 541 | |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 542 | [Return] ${ffdc_file_list} |
| 543 | |
Steven Sombar | 2da175f | 2019-02-04 10:32:58 -0600 | [diff] [blame] | 544 | |
Sweta Potthuri | a82efd6 | 2017-10-18 05:34:59 -0500 | [diff] [blame] | 545 | SCP Dump Files |
| 546 | [Documentation] Copy all dump files from BMC to local system. |
| 547 | |
| 548 | # Check if dumps exist |
| 549 | ${ffdc_file_list}= Scp Dumps ${FFDC_DIR_PATH} ${FFDC_PREFIX} |
| 550 | |
| 551 | [Return] ${ffdc_file_list} |
| 552 | |
Steven Sombar | 2da175f | 2019-02-04 10:32:58 -0600 | [diff] [blame] | 553 | |
George Keishing | 1165a02 | 2021-05-19 06:23:13 -0500 | [diff] [blame] | 554 | SCP Dump HB Files |
| 555 | [Documentation] Copy all HB dump files from BMC to local system. |
| 556 | |
| 557 | # Check if dumps exist |
| 558 | ${ffdc_file_list}= Scp Dumps HB ${FFDC_DIR_PATH} ${FFDC_PREFIX} |
| 559 | |
| 560 | [Return] ${ffdc_file_list} |
| 561 | |
| 562 | |
Sweta Potthuri | a82efd6 | 2017-10-18 05:34:59 -0500 | [diff] [blame] | 563 | Collect Dump Log |
| 564 | [Documentation] Collect dumps from dump entry. |
| 565 | [Arguments] ${log_prefix_path}=${LOG_PREFIX} |
| 566 | |
Rahul Maheshwari | a89ff9e | 2020-09-25 05:04:33 -0500 | [diff] [blame] | 567 | ${resp}= OpenBMC Get Request ${DUMP_URI} |
| 568 | Run Keyword If '${resp.status_code}' == '${HTTP_NOT_FOUND}' |
| 569 | ... Set Test Variable ${DUMP_ENTRY_URI} /xyz/openbmc_project/dump/entry/ |
| 570 | |
George Keishing | ccd20e1 | 2020-07-29 11:14:26 -0500 | [diff] [blame] | 571 | ${data}= Read Properties ${DUMP_ENTRY_URI}enumerate quiet=${1} timeout=${30} |
Sweta Potthuri | a82efd6 | 2017-10-18 05:34:59 -0500 | [diff] [blame] | 572 | |
| 573 | # Grab the list of entries from dump/entry/ |
| 574 | # The data shown below is the result of the "Get Dictionary Keys". |
| 575 | # Example: |
| 576 | # /xyz/openbmc_project/dump/entry/1 |
| 577 | # /xyz/openbmc_project/dump/entry/2 |
| 578 | |
| 579 | ${dump_list}= Get Dictionary Keys ${data} |
George Keishing | eb7b4bc | 2017-03-13 12:04:28 -0500 | [diff] [blame] | 580 | |
Michael Walsh | 02c7060 | 2018-10-04 15:24:30 -0500 | [diff] [blame] | 581 | |
George Keishing | be396b8 | 2020-03-23 10:23:58 -0500 | [diff] [blame] | 582 | Collect PEL Log |
| 583 | [Documentation] Collect PEL files from from BMC. |
| 584 | |
| 585 | Create Directory ${FFDC_DIR_PATH}${/}pel_files/ |
| 586 | scp.Get File /var/lib/phosphor-logging/extensions/pels/logs/ |
| 587 | ... ${FFDC_DIR_PATH}${/}pel_files recursive=True |
| 588 | |
| 589 | |
Steven Sombar | 2da175f | 2019-02-04 10:32:58 -0600 | [diff] [blame] | 590 | Enumerate Redfish Resources |
| 591 | [Documentation] Enumerate /redfish/v1 resources and properties to |
| 592 | ... a file. Return a list which contains the file name. |
George Keishing | 5942d20 | 2021-10-04 13:09:24 -0500 | [diff] [blame] | 593 | [Arguments] ${log_prefix_path}=${LOG_PREFIX} ${enum_uri}=/redfish/v1 |
| 594 | ... ${file_enum_name}=redfish_resource_properties.txt |
Steven Sombar | 2da175f | 2019-02-04 10:32:58 -0600 | [diff] [blame] | 595 | |
| 596 | # Description of argument(s): |
| 597 | # log_prefix_path The location specifying where to create FFDC file(s). |
| 598 | |
| 599 | # Login is needed to fetch Redfish information. |
| 600 | # If login fails, return from keyword. |
George Keishing | 97c9394 | 2019-03-04 12:45:07 -0600 | [diff] [blame] | 601 | ${status}= Run Keyword And Return Status Redfish.Login |
Steven Sombar | 2da175f | 2019-02-04 10:32:58 -0600 | [diff] [blame] | 602 | Return From Keyword If ${status} == ${False} |
| 603 | |
| 604 | # Get the Redfish resources and properties. |
George Keishing | 5942d20 | 2021-10-04 13:09:24 -0500 | [diff] [blame] | 605 | ${json_data}= redfish_utils.Enumerate Request ${enum_uri} |
Steven Sombar | 2da175f | 2019-02-04 10:32:58 -0600 | [diff] [blame] | 606 | # Typical output: |
| 607 | # { |
| 608 | # "@odata.id": "/redfish/v1", |
| 609 | # "@odata.type": "#ServiceRoot.v1_1_1.ServiceRoot", |
| 610 | # "AccountService": { |
| 611 | # "@odata.id": "/redfish/v1/AccountService" |
| 612 | # }, |
| 613 | # "Chassis": { |
| 614 | # "@odata.id": "/redfish/v1/Chassis" |
| 615 | # }, |
| 616 | # "Id": "RootService", |
| 617 | # "JsonSchemas": { |
| 618 | # "@odata.id": "/redfish/v1/JsonSchemas" |
| 619 | # }, |
| 620 | # ..etc... |
| 621 | # } |
| 622 | |
| 623 | @{ffdc_file_list}= Create List |
George Keishing | 5942d20 | 2021-10-04 13:09:24 -0500 | [diff] [blame] | 624 | ${logpath}= Catenate SEPARATOR= ${log_prefix_path} ${file_enum_name} |
Steven Sombar | 2da175f | 2019-02-04 10:32:58 -0600 | [diff] [blame] | 625 | Create File ${logpath} |
| 626 | Write Data To File "${\n}${json_data}${\n}" ${logpath} |
| 627 | |
| 628 | Append To List ${ffdc_file_list} ${logpath} |
| 629 | |
| 630 | [Return] ${ffdc_file_list} |
| 631 | |
| 632 | |
George Keishing | 985659a | 2021-06-23 02:52:13 -0500 | [diff] [blame] | 633 | Enumerate Redfish OEM Resources |
| 634 | [Documentation] Enumerate /<oem>/v1 resources and properties to |
| 635 | ... a file. Return a list which contains the file name. |
| 636 | [Arguments] ${log_prefix_path}=${LOG_PREFIX} |
| 637 | |
| 638 | # Description of argument(s): |
| 639 | # log_prefix_path The location specifying where to create FFDC file(s). |
| 640 | |
| 641 | # No-op by default if input is not supplied from command line. |
| 642 | Return From Keyword If "${OEM_REDFISH_PATH}" == "${EMPTY}" |
| 643 | |
| 644 | # Login is needed to fetch Redfish information. |
| 645 | # If login fails, return from keyword. |
| 646 | ${status}= Run Keyword And Return Status Redfish.Login |
| 647 | Return From Keyword If ${status} == ${False} |
| 648 | |
| 649 | # Get the Redfish resources and properties. |
| 650 | ${json_data}= redfish_utils.Enumerate Request ${OEM_REDFISH_PATH} |
| 651 | |
| 652 | @{ffdc_file_list}= Create List |
| 653 | ${logpath}= Catenate SEPARATOR= ${log_prefix_path} |
| 654 | ... redfish_oem_resource_properties.txt |
| 655 | Create File ${logpath} |
| 656 | Write Data To File "${\n}${json_data}${\n}" ${logpath} |
| 657 | |
| 658 | Append To List ${ffdc_file_list} ${logpath} |
| 659 | |
| 660 | [Return] ${ffdc_file_list} |
| 661 | |
| 662 | |
George Keishing | eb7b4bc | 2017-03-13 12:04:28 -0500 | [diff] [blame] | 663 | Collect eSEL Log |
Michael Walsh | 02c7060 | 2018-10-04 15:24:30 -0500 | [diff] [blame] | 664 | [Documentation] Create raw and formatted eSEL files. |
Sridevi Ramesh | b180c9f | 2017-08-06 10:27:41 -0500 | [diff] [blame] | 665 | [Arguments] ${log_prefix_path}=${LOG_PREFIX} |
| 666 | |
Michael Walsh | 02c7060 | 2018-10-04 15:24:30 -0500 | [diff] [blame] | 667 | # NOTE: If no eSEL.pl program can be located, then no formatted eSEL file |
| 668 | # will be generated. |
| 669 | |
| 670 | # Description of argument(s): |
| 671 | # log_prefix_path The path prefix to be used in creating |
| 672 | # eSEL file path names. For example, if |
| 673 | # log_prefix_path is |
| 674 | # "/tmp/user1/dummy.181001.120000.", then |
| 675 | # this keyword will create |
| 676 | # /tmp/user1/dummy.181001.120000.esel (raw) |
| 677 | # and |
| 678 | # /tmp/user1/dummy.181001.120000.esel.txt |
| 679 | # (formatted). |
| 680 | |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 681 | @{ffdc_file_list}= Create List |
| 682 | |
Michael Walsh | 02c7060 | 2018-10-04 15:24:30 -0500 | [diff] [blame] | 683 | ${esels}= Get Esels |
| 684 | ${num_esels}= Evaluate len(${esels}) |
| 685 | Rprint Vars num_esels |
| 686 | Return From Keyword If ${num_esels} == ${0} ${ffdc_file_list} |
George Keishing | eb7b4bc | 2017-03-13 12:04:28 -0500 | [diff] [blame] | 687 | |
Sridevi Ramesh | b180c9f | 2017-08-06 10:27:41 -0500 | [diff] [blame] | 688 | ${logpath}= Catenate SEPARATOR= ${log_prefix_path} esel |
George Keishing | eb7b4bc | 2017-03-13 12:04:28 -0500 | [diff] [blame] | 689 | Create File ${logpath} |
George Keishing | eb7b4bc | 2017-03-13 12:04:28 -0500 | [diff] [blame] | 690 | |
Sushil Singh | 1988855 | 2020-06-08 02:14:52 -0500 | [diff] [blame] | 691 | FOR ${esel} IN @{esels} |
| 692 | Write Data To File "${esel}"${\n} ${logpath} |
| 693 | END |
George Keishing | b1ca69b | 2017-03-31 14:36:42 -0500 | [diff] [blame] | 694 | |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 695 | Append To List ${ffdc_file_list} ${logpath} |
Michael Walsh | 02c7060 | 2018-10-04 15:24:30 -0500 | [diff] [blame] | 696 | |
| 697 | ${rc} ${output}= Shell Cmd which eSEL.pl show_err=0 |
| 698 | Return From Keyword If ${rc} != ${0} ${ffdc_file_list} |
| 699 | |
| 700 | Convert eSEL To Elog Format ${logpath} |
Michael Walsh | 0192e9b | 2017-11-14 15:14:15 -0600 | [diff] [blame] | 701 | Append To List ${ffdc_file_list} ${logpath}.txt |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 702 | |
| 703 | [Return] ${ffdc_file_list} |
| 704 | |
George Keishing | b1ca69b | 2017-03-31 14:36:42 -0500 | [diff] [blame] | 705 | |
George Keishing | b1ca69b | 2017-03-31 14:36:42 -0500 | [diff] [blame] | 706 | Convert eSEL To Elog Format |
| 707 | [Documentation] Execute parser tool on the eSEL data file to generate |
Michael Walsh | a30dac7 | 2017-04-04 17:56:23 -0500 | [diff] [blame] | 708 | ... formatted error log. |
George Keishing | b1ca69b | 2017-03-31 14:36:42 -0500 | [diff] [blame] | 709 | [Arguments] ${esel_file_path} |
Michael Walsh | 02c7060 | 2018-10-04 15:24:30 -0500 | [diff] [blame] | 710 | # Description of argument(s): |
George Keishing | 7c6342b | 2018-11-02 14:27:13 -0500 | [diff] [blame] | 711 | # esel_file_path The path to the file containing raw eSEL |
Michael Walsh | 02c7060 | 2018-10-04 15:24:30 -0500 | [diff] [blame] | 712 | # data (e.g. |
| 713 | # "/tmp/user1/dummy.181001.120000.esel"). |
George Keishing | b1ca69b | 2017-03-31 14:36:42 -0500 | [diff] [blame] | 714 | |
Michael Walsh | a30dac7 | 2017-04-04 17:56:23 -0500 | [diff] [blame] | 715 | # Note: The only way to get eSEL.pl to put the output in a particular |
| 716 | # directory is to cd to that directory. |
| 717 | ${cmd_buf}= Catenate cd $(dirname ${esel_file_path}) ; eSEL.pl -l |
| 718 | ... ${esel_file_path} -p decode_obmc_data |
Michael Walsh | 02c7060 | 2018-10-04 15:24:30 -0500 | [diff] [blame] | 719 | Qprint Issuing ${cmd_buf} |
Michael Walsh | a30dac7 | 2017-04-04 17:56:23 -0500 | [diff] [blame] | 720 | Run ${cmd_buf} |
Michael Walsh | 02c7060 | 2018-10-04 15:24:30 -0500 | [diff] [blame] | 721 | # The .binary file, which is generated by eSEL.pl, is of no use to us. |
| 722 | Remove File ${esel_file_path}.binary |
George Keishing | 671dd66 | 2021-05-28 03:26:30 -0500 | [diff] [blame] | 723 | |
| 724 | |
| 725 | OS Distro Type |
| 726 | [Documentation] Determine the host partition distro type |
| 727 | |
| 728 | ${stdout} ${stderr} ${rc}= OS Execute Command |
| 729 | ... . /etc/os-release; echo $ID ignore_err=${1} |
| 730 | |
| 731 | Return From Keyword If ${rc} == ${0} ${stdout} |
| 732 | |
George Keishing | 33d1503 | 2021-06-07 00:49:56 -0500 | [diff] [blame] | 733 | # If linux distro doesn't have os-release, check for uname. |
George Keishing | 671dd66 | 2021-05-28 03:26:30 -0500 | [diff] [blame] | 734 | ${stdout} ${stderr} ${rc}= OS Execute Command uname ignore_err=${0} |
| 735 | |
| 736 | [Return] ${stdout} |