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 | |
| 5 | Resource openbmc_ffdc_utils.robot |
George Keishing | 8e47f53 | 2016-10-05 08:41:45 -0500 | [diff] [blame] | 6 | Resource rest_client.robot |
Gunnar Mills | aca140d | 2016-10-26 13:05:10 -0500 | [diff] [blame] | 7 | Resource utils.robot |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 8 | Resource list_utils.robot |
Michael Walsh | fef3f81 | 2018-10-09 10:45:36 -0500 | [diff] [blame] | 9 | Resource logging_utils.robot |
George Keishing | ab7a907 | 2017-02-24 13:03:24 -0600 | [diff] [blame] | 10 | Library SSHLibrary |
Sivas SRR | 0d657e8 | 2017-03-13 01:00:34 -0500 | [diff] [blame] | 11 | Library OperatingSystem |
George Keishing | 16333ec | 2017-03-21 06:18:29 -0500 | [diff] [blame] | 12 | Library Collections |
Michael Walsh | e844e9a | 2017-04-20 16:51:10 -0500 | [diff] [blame] | 13 | Library String |
Michael Walsh | e53e47a | 2017-06-30 17:03:24 -0500 | [diff] [blame] | 14 | Library gen_print.py |
Michael Walsh | 02c7060 | 2018-10-04 15:24:30 -0500 | [diff] [blame] | 15 | Library gen_cmd.py |
Michael Walsh | e844e9a | 2017-04-20 16:51:10 -0500 | [diff] [blame] | 16 | Library gen_robot_keyword.py |
Sweta Potthuri | a82efd6 | 2017-10-18 05:34:59 -0500 | [diff] [blame] | 17 | Library dump_utils.py |
Michael Walsh | 02c7060 | 2018-10-04 15:24:30 -0500 | [diff] [blame] | 18 | Library logging_utils.py |
Gunnar Mills | 7e2cda2 | 2016-10-11 15:37:34 -0500 | [diff] [blame] | 19 | |
Michael Walsh | de5e937 | 2018-11-15 11:28:23 -0600 | [diff] [blame] | 20 | *** Variables *** |
| 21 | |
| 22 | ${FFDC_TIMEOUT} 240 |
| 23 | |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 24 | *** Keywords *** |
| 25 | |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 26 | # Method : Call FFDC Methods # |
| 27 | # Execute the user define keywords from the FFDC List # |
| 28 | # Unlike any other keywords this will call into the # |
| 29 | # list of keywords defined in the FFDC list at one go # |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 30 | |
| 31 | Call FFDC Methods |
Michael Walsh | e844e9a | 2017-04-20 16:51:10 -0500 | [diff] [blame] | 32 | [Documentation] Call into FFDC Keyword index list. |
| 33 | [Arguments] ${ffdc_function_list}=${EMPTY} |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 34 | |
Michael Walsh | e844e9a | 2017-04-20 16:51:10 -0500 | [diff] [blame] | 35 | # Description of argument(s): |
| 36 | # 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] | 37 | # are to be collected |
Michael Walsh | e844e9a | 2017-04-20 16:51:10 -0500 | [diff] [blame] | 38 | # (e.g. "FFDC Generic Report:BMC Specific Files"). |
| 39 | # Acceptable values can be found in the description |
| 40 | # field of FFDC_METHOD_CALL in |
| 41 | # lib/openbmc_ffdc_list.py. Those values can be |
| 42 | # obtained via a call to 'Get FFDC Method Desc' (also |
| 43 | # from lib/openbmc_ffdc_list.py). |
| 44 | |
| 45 | @{entries}= Get FFDC Method Index |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 46 | # Example entries: |
| 47 | # entries: |
| 48 | # entries[0]: BMC LOGS |
| 49 | |
| 50 | @{ffdc_file_list}= Create List |
Michael Walsh | e844e9a | 2017-04-20 16:51:10 -0500 | [diff] [blame] | 51 | :FOR ${index} IN @{entries} |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 52 | \ ${ffdc_file_sub_list}= Method Call Keyword List ${index} |
| 53 | ... ${ffdc_function_list} |
| 54 | \ ${ffdc_file_list}= Smart Combine Lists ${ffdc_file_list} |
| 55 | ... ${ffdc_file_sub_list} |
| 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 | |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 61 | Method Call Keyword List |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 62 | [Documentation] Process FFDC request and return a list of generated files. |
Michael Walsh | e844e9a | 2017-04-20 16:51:10 -0500 | [diff] [blame] | 63 | [Arguments] ${index} ${ffdc_function_list}=${EMPTY} |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 64 | |
Michael Walsh | e844e9a | 2017-04-20 16:51:10 -0500 | [diff] [blame] | 65 | # Description of argument(s): |
| 66 | # index The index into the FFDC_METHOD_CALL dictionary (e.g. |
| 67 | # 'BMC LOGS'). |
| 68 | # ffdc_function_list See ffdc_function_list description in |
| 69 | # "Call FFDC Methods" (above). |
| 70 | |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 71 | @{method_list}= Get FFDC Method Call ${index} |
| 72 | # Example method_list: |
| 73 | # method_list: |
| 74 | # method_list[0]: |
| 75 | # method_list[0][0]: FFDC Generic Report |
| 76 | # method_list[0][1]: BMC FFDC Manifest |
| 77 | # method_list[1]: |
| 78 | # method_list[1][0]: Get Request FFDC |
| 79 | # method_list[1][1]: BMC FFDC Get Requests |
| 80 | # (etc.) |
Michael Walsh | e844e9a | 2017-04-20 16:51:10 -0500 | [diff] [blame] | 81 | |
| 82 | # If function list is empty assign default (i.e. a list of all allowable |
| 83 | # values). In either case, convert ffdc_function_list from a string to |
| 84 | # a list. |
| 85 | @{ffdc_function_list}= |
| 86 | ... Run Keyword If '${ffdc_function_list}' == '${EMPTY}' |
| 87 | ... Get FFDC Method Desc ${index} |
| 88 | ... ELSE |
| 89 | ... Split String ${ffdc_function_list} separator=: |
| 90 | |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 91 | @{ffdc_file_list}= Create List |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 92 | :FOR ${method} IN @{method_list} |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 93 | \ ${ffdc_file_sub_list}= Execute Keyword Method ${method[0]} |
| 94 | ... ${method[1]} @{ffdc_function_list} |
| 95 | \ ${ffdc_file_list}= Smart Combine Lists ${ffdc_file_list} |
| 96 | ... ${ffdc_file_sub_list} |
| 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 |
| 136 | :FOR ${index} IN @{entries} |
| 137 | \ Iterate BMC Command List Pairs ${index} |
| 138 | |
| 139 | [Return] ${ffdc_file_list} |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 140 | |
| 141 | |
| 142 | Iterate BMC Command List Pairs |
| 143 | [Documentation] Feed in key pair list from dictionary to execute |
| 144 | [Arguments] ${key_index} |
| 145 | |
| 146 | @{cmd_list}= Get ffdc bmc cmd ${key_index} |
| 147 | Set Suite Variable ${ENTRY_INDEX} ${key_index} |
| 148 | :FOR ${cmd} IN @{cmd_list} |
| 149 | \ Execute Command and Write FFDC ${cmd[0]} ${cmd[1]} |
| 150 | |
| 151 | |
| 152 | Execute Command and Write FFDC |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 153 | [Documentation] Run a command on the BMC or OS, write the output to the |
| 154 | ... specified file and return a list of generated files. |
| 155 | [Arguments] ${key_index} ${cmd} ${logpath}=${FFDC_FILE_PATH} |
| 156 | ... ${target}=BMC |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 157 | |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 158 | Run Keyword If '${logpath}' == '${FFDC_FILE_PATH}' |
| 159 | ... Write Cmd Output to FFDC File ${key_index} ${cmd} |
| 160 | |
| 161 | @{ffdc_file_list}= Create List ${log_path} |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 162 | |
Michael Walsh | e53e47a | 2017-06-30 17:03:24 -0500 | [diff] [blame] | 163 | ${cmd_buf}= Catenate ${target} Execute Command \ ${cmd} \ ignore_err=${1} |
Michael Walsh | de5e937 | 2018-11-15 11:28:23 -0600 | [diff] [blame] | 164 | ... \ time_out=${FFDC_TIMEOUT} |
Michael Walsh | e53e47a | 2017-06-30 17:03:24 -0500 | [diff] [blame] | 165 | ${status} ${ret_values}= Run Key ${cmd_buf} ignore=${1} |
Michael Walsh | de5e937 | 2018-11-15 11:28:23 -0600 | [diff] [blame] | 166 | # If the command times out, status will be 'FAIL'. |
| 167 | Return From Keyword If '${status}' == 'FAIL' ${ffdc_file_list} |
Michael Walsh | e53e47a | 2017-06-30 17:03:24 -0500 | [diff] [blame] | 168 | |
| 169 | ${stdout}= Set Variable @{ret_values}[0] |
| 170 | ${stderr}= Set Variable @{ret_values}[1] |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 171 | |
Jeff Whitlock | 7d805b2 | 2017-01-20 14:04:33 -0600 | [diff] [blame] | 172 | # Write stdout on success and stderr/stdout to the file on failure. |
| 173 | Run Keyword If $stderr == '${EMPTY}' |
Sweta Potthuri | 15e6d2f | 2017-02-28 03:10:02 -0600 | [diff] [blame] | 174 | ... Write Data To File ${stdout}${\n} ${logpath} |
| 175 | ... ELSE Write Data To File |
Jeff Whitlock | 7d805b2 | 2017-01-20 14:04:33 -0600 | [diff] [blame] | 176 | ... ERROR output:${\n}${stderr}${\n}Output:${\n}${stdout}${\n} |
| 177 | ... ${logpath} |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 178 | |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 179 | [Return] ${ffdc_file_list} |
| 180 | |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 181 | |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 182 | # Method : BMC FFDC Files # |
| 183 | # Execute command on BMC and write to individual file # |
| 184 | # based on the file name pre-defined in the list # |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 185 | |
| 186 | BMC FFDC Files |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 187 | [Documentation] Run the commands from FFDC_BMC_FILE and return a list of |
| 188 | ... generated files. |
| 189 | |
| 190 | @{entries}= Get FFDC File Index |
| 191 | # Example of entries: |
| 192 | # entries: |
| 193 | # entries[0]: BMC FILES |
| 194 | |
| 195 | @{ffdc_file_list}= Create List |
| 196 | :FOR ${index} IN @{entries} |
| 197 | \ ${ffdc_file_sub_list}= Create File and Write Data ${index} |
| 198 | \ ${ffdc_file_list}= Smart Combine Lists ${ffdc_file_list} |
| 199 | ... ${ffdc_file_sub_list} |
| 200 | |
| 201 | [Return] ${ffdc_file_list} |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 202 | |
| 203 | |
| 204 | Create File and Write Data |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 205 | [Documentation] Run commands from FFDC_BMC_FILE to create FFDC files and |
| 206 | ... return a list of generated files. |
| 207 | [Arguments] ${key_index} |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 208 | |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 209 | # Description of argument(s): |
| 210 | # key_index The index into the FFDC_BMC_FILE dictionary. |
| 211 | |
| 212 | @{ffdc_file_list}= Create List |
| 213 | @{cmd_list}= Get FFDC BMC File ${key_index} |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 214 | :FOR ${cmd} IN @{cmd_list} |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 215 | \ ${logpath}= Catenate SEPARATOR= ${LOG_PREFIX} ${cmd[0]}.txt |
| 216 | \ ${ffdc_file_sub_list}= Execute Command and Write FFDC ${cmd[0]} |
| 217 | ... ${cmd[1]} ${logpath} |
| 218 | \ ${ffdc_file_list}= Smart Combine Lists ${ffdc_file_list} |
| 219 | ... ${ffdc_file_sub_list} |
Sivas SRR | 0d657e8 | 2017-03-13 01:00:34 -0500 | [diff] [blame] | 220 | |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 221 | [Return] ${ffdc_file_list} |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 222 | |
| 223 | |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 224 | # Method : Log Test Case Status # |
| 225 | # Creates test result history footprint for reference # |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 226 | |
| 227 | Log Test Case Status |
Jeff Whitlock | 7d805b2 | 2017-01-20 14:04:33 -0600 | [diff] [blame] | 228 | [Documentation] Test case execution result history. |
| 229 | ... Create once and append to this file |
| 230 | ... logs/test_history.txt |
| 231 | ... Format Date:Test suite:Test case:Status |
| 232 | ... 20160909214053719992:Test Warmreset:Test WarmReset via REST:FAIL |
Michael Walsh | fa9f70f | 2017-04-21 16:00:18 -0500 | [diff] [blame] | 233 | |
| 234 | ${FFDC_DIR_PATH_STYLE}= Get Variable Value ${FFDC_DIR_PATH_STYLE} |
| 235 | ... ${EMPTY} |
| 236 | ${FFDC_DIR_PATH}= Get Variable Value ${FFDC_DIR_PATH} ${EMPTY} |
| 237 | |
| 238 | Run Keyword If '${FFDC_DIR_PATH}' == '${EMPTY}' Set FFDC Defaults |
| 239 | |
| 240 | Run Keyword If '${FFDC_DIR_PATH_STYLE}' == '${1}' Run Keywords |
| 241 | ... Set Global Variable ${FFDC_LOG_PATH} ${FFDC_DIR_PATH} AND |
| 242 | ... Set Global Variable ${TEST_HISTORY} ${FFDC_DIR_PATH}test_history.txt |
| 243 | |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 244 | Create Directory ${FFDC_LOG_PATH} |
| 245 | |
| 246 | ${exist}= Run Keyword and Return Status |
| 247 | ... OperatingSystem.File Should Exist ${TEST_HISTORY} |
| 248 | |
| 249 | Run Keyword If '${exist}' == '${False}' |
| 250 | ... Create File ${TEST_HISTORY} |
| 251 | |
Michael Walsh | fa9f70f | 2017-04-21 16:00:18 -0500 | [diff] [blame] | 252 | Rpvars TEST_HISTORY |
| 253 | |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 254 | ${cur_time}= Get Current Time Stamp |
| 255 | |
| 256 | Append To File ${TEST_HISTORY} |
| 257 | ... ${cur_time}:${SUITE_NAME}:${TEST_NAME}:${TEST_STATUS}${\n} |
| 258 | |
Gunnar Mills | a812e0f | 2016-09-29 20:30:03 -0500 | [diff] [blame] | 259 | |
| 260 | Log FFDC Get Requests |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 261 | [Documentation] Run the get requests associated with the key and return a |
| 262 | ... list of generated files. |
| 263 | [Arguments] ${key_index} |
Gunnar Mills | a812e0f | 2016-09-29 20:30:03 -0500 | [diff] [blame] | 264 | |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 265 | # Note: Output will be in JSON pretty_print format. |
| 266 | |
| 267 | # Description of argument(s): |
| 268 | # key_index The key to the FFDC_GET_REQUEST dictionary that contains the |
| 269 | # get requests that are to be run. |
| 270 | |
| 271 | @{ffdc_file_list}= Create List |
| 272 | @{cmd_list}= Get FFDC Get Request ${key_index} |
Gunnar Mills | a812e0f | 2016-09-29 20:30:03 -0500 | [diff] [blame] | 273 | :FOR ${cmd} IN @{cmd_list} |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 274 | \ ${logpath}= Catenate SEPARATOR= ${LOG_PREFIX} ${cmd[0]}.txt |
| 275 | \ ${resp}= OpenBMC Get Request ${cmd[1]} quiet=${1} |
| 276 | \ ${status}= Run Keyword and Return Status |
| 277 | ... Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} |
| 278 | \ Run Keyword If '${status}' == '${False}' Continue For Loop |
| 279 | \ ${jsondata}= to json ${resp.content} pretty_print=True |
| 280 | \ Write Data To File ${\n}${jsondata}${\n} ${logpath} |
| 281 | \ Append To List ${ffdc_file_list} ${logpath} |
Gunnar Mills | a812e0f | 2016-09-29 20:30:03 -0500 | [diff] [blame] | 282 | |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 283 | [Return] ${ffdc_file_list} |
Gunnar Mills | a812e0f | 2016-09-29 20:30:03 -0500 | [diff] [blame] | 284 | |
| 285 | BMC FFDC Get Requests |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 286 | [Documentation] Iterate over get request list and return a list of |
| 287 | ... generated files. |
| 288 | |
| 289 | @{ffdc_file_list}= Create List |
| 290 | |
Gunnar Mills | a812e0f | 2016-09-29 20:30:03 -0500 | [diff] [blame] | 291 | @{entries}= Get ffdc get request index |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 292 | # Example of entries: |
| 293 | # entries: |
| 294 | # entries[0]: GET REQUESTS |
Gunnar Mills | a812e0f | 2016-09-29 20:30:03 -0500 | [diff] [blame] | 295 | :FOR ${index} IN @{entries} |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 296 | \ ${ffdc_file_sub_list}= Log FFDC Get Requests ${index} |
| 297 | \ ${ffdc_file_list}= Smart Combine Lists ${ffdc_file_list} |
| 298 | ... ${ffdc_file_sub_list} |
Gunnar Mills | 7e2cda2 | 2016-10-11 15:37:34 -0500 | [diff] [blame] | 299 | |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 300 | [Return] ${ffdc_file_list} |
Gunnar Mills | 7e2cda2 | 2016-10-11 15:37:34 -0500 | [diff] [blame] | 301 | |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 302 | Log OS All distros FFDC |
| 303 | [Documentation] Run commands from FFDC_OS_ALL_DISTROS_FILE to create FFDC |
| 304 | ... files and return a list of generated files. |
| 305 | [Arguments] ${key_index} |
Gunnar Mills | 7e2cda2 | 2016-10-11 15:37:34 -0500 | [diff] [blame] | 306 | |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 307 | # Description of argument(s): |
| 308 | # key_index The index into the FFDC_OS_ALL_DISTROS_FILE dictionary. |
| 309 | |
| 310 | @{ffdc_file_list}= Create List |
| 311 | |
| 312 | @{cmd_list}= Get FFDC OS All Distros Call ${key_index} |
Gunnar Mills | 7e2cda2 | 2016-10-11 15:37:34 -0500 | [diff] [blame] | 313 | :FOR ${cmd} IN @{cmd_list} |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 314 | \ ${logpath}= Catenate SEPARATOR= ${LOG_PREFIX} ${cmd[0]}.txt |
| 315 | \ ${ffdc_file_sub_list}= Execute Command and Write FFDC ${cmd[0]} |
| 316 | ... ${cmd[1]} ${logpath} target=OS |
| 317 | \ ${ffdc_file_list}= Smart Combine Lists ${ffdc_file_list} |
| 318 | ... ${ffdc_file_sub_list} |
| 319 | |
| 320 | [Return] ${ffdc_file_list} |
Gunnar Mills | 7e2cda2 | 2016-10-11 15:37:34 -0500 | [diff] [blame] | 321 | |
| 322 | |
Gunnar Mills | cce185d | 2016-10-17 17:04:15 -0500 | [diff] [blame] | 323 | Log OS SPECIFIC DISTRO FFDC |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 324 | [Documentation] Run commands from the FFDC_OS_<distro>_FILE to create FFDC |
| 325 | ... files and return a list of generated files. |
| 326 | [Arguments] ${key_index} ${linux_distro} |
Gunnar Mills | cce185d | 2016-10-17 17:04:15 -0500 | [diff] [blame] | 327 | |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 328 | # Description of argument(s): |
| 329 | # key_index The index into the FFDC_OS_<distro>_FILE dictionary. |
| 330 | # linux_distro Your OS's linux distro (e.g. "UBUNTU", "RHEL", etc). |
| 331 | |
| 332 | @{ffdc_file_list}= Create List |
| 333 | |
| 334 | @{cmd_list}= Get FFDC OS Distro Call ${key_index} ${linux_distro} |
Gunnar Mills | cce185d | 2016-10-17 17:04:15 -0500 | [diff] [blame] | 335 | :FOR ${cmd} IN @{cmd_list} |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 336 | \ ${logpath}= Catenate SEPARATOR= ${LOG_PREFIX} ${cmd[0]}.txt |
| 337 | \ ${ffdc_file_sub_list}= Execute Command and Write FFDC ${cmd[0]} |
| 338 | ... ${cmd[1]} ${logpath} target=OS |
| 339 | \ ${ffdc_file_list}= Smart Combine Lists ${ffdc_file_list} |
| 340 | ... ${ffdc_file_sub_list} |
| 341 | |
| 342 | [Return] ${ffdc_file_list} |
Gunnar Mills | cce185d | 2016-10-17 17:04:15 -0500 | [diff] [blame] | 343 | |
| 344 | |
George Keishing | ca8c4c6 | 2016-10-14 10:08:40 -0500 | [diff] [blame] | 345 | OS FFDC Files |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 346 | [Documentation] Run the commands from FFDC_OS_ALL_DISTROS_FILE to create |
| 347 | ... FFDC files and return a list of generated files. |
Gunnar Mills | aca140d | 2016-10-26 13:05:10 -0500 | [diff] [blame] | 348 | [Arguments] ${OS_HOST}=${OS_HOST} ${OS_USERNAME}=${OS_USERNAME} |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 349 | ... ${OS_PASSWORD}=${OS_PASSWORD} |
Gunnar Mills | 7e2cda2 | 2016-10-11 15:37:34 -0500 | [diff] [blame] | 350 | |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 351 | @{ffdc_file_list}= Create List |
Gunnar Mills | aca140d | 2016-10-26 13:05:10 -0500 | [diff] [blame] | 352 | |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 353 | Run Keyword If '${OS_HOST}' == '${EMPTY}' Run Keywords |
| 354 | ... Print Timen No OS Host provided so no OS FFDC will be done. AND |
| 355 | ... Return From Keyword ${ffdc_file_list} |
Gunnar Mills | aca140d | 2016-10-26 13:05:10 -0500 | [diff] [blame] | 356 | |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 357 | ${match_state}= Create Dictionary os_ping=^1$ os_login=^1$ |
| 358 | ... os_run_cmd=^1$ |
| 359 | ${status} ${ret_values}= Run Keyword and Ignore Error Check State |
| 360 | ... ${match_state} quiet=0 |
| 361 | |
| 362 | Run Keyword If '${status}' == 'FAIL' Run Keywords |
Michael Walsh | c3b28d7 | 2017-11-16 10:43:14 -0600 | [diff] [blame] | 363 | ... 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] | 364 | ... AND |
| 365 | ... Return From Keyword ${ffdc_file_list} |
Gunnar Mills | cce185d | 2016-10-17 17:04:15 -0500 | [diff] [blame] | 366 | |
Michael Walsh | e53e47a | 2017-06-30 17:03:24 -0500 | [diff] [blame] | 367 | ${stdout} ${stderr} ${rc}= OS Execute Command |
| 368 | ... . /etc/os-release; echo $ID ignore_err=${0} |
| 369 | Set Global Variable ${linux_distro} ${stdout} |
Gunnar Mills | aca140d | 2016-10-26 13:05:10 -0500 | [diff] [blame] | 370 | |
Michael Walsh | e53e47a | 2017-06-30 17:03:24 -0500 | [diff] [blame] | 371 | Rpvars linux_distro |
Gunnar Mills | aca140d | 2016-10-26 13:05:10 -0500 | [diff] [blame] | 372 | |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 373 | @{entries}= Get FFDC OS All Distros Index |
Gunnar Mills | 7e2cda2 | 2016-10-11 15:37:34 -0500 | [diff] [blame] | 374 | :FOR ${index} IN @{entries} |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 375 | \ ${ffdc_file_sub_list}= Log OS All distros FFDC ${index} |
| 376 | \ ${ffdc_file_list}= Smart Combine Lists ${ffdc_file_list} |
| 377 | ... ${ffdc_file_sub_list} |
Gunnar Mills | cce185d | 2016-10-17 17:04:15 -0500 | [diff] [blame] | 378 | |
Jeff Whitlock | 7d805b2 | 2017-01-20 14:04:33 -0600 | [diff] [blame] | 379 | Return From Keyword If |
| 380 | ... '${linux_distro}' == '${EMPTY}' or '${linux_distro}' == 'None' |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 381 | ... ${ffdc_file_list} |
Gunnar Mills | cce185d | 2016-10-17 17:04:15 -0500 | [diff] [blame] | 382 | |
| 383 | @{entries}= Get ffdc os distro index ${linux_distro} |
| 384 | :FOR ${index} IN @{entries} |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 385 | \ ${ffdc_file_sub_list}= Log OS SPECIFIC DISTRO FFDC ${index} |
| 386 | ... ${linux_distro} |
| 387 | \ ${ffdc_file_list}= Smart Combine Lists ${ffdc_file_list} |
| 388 | ... ${ffdc_file_sub_list} |
| 389 | |
| 390 | [Return] ${ffdc_file_list} |
George Keishing | 7a52022 | 2017-02-27 09:44:30 -0600 | [diff] [blame] | 391 | |
| 392 | |
Steven Sombar | 96de573 | 2017-08-17 09:04:52 -0500 | [diff] [blame] | 393 | System Inventory Files |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 394 | [Documentation] Copy systest os_inventory files and return a list of |
| 395 | ... generated files.. |
Steven Sombar | 96de573 | 2017-08-17 09:04:52 -0500 | [diff] [blame] | 396 | # The os_inventory files are the result of running |
| 397 | # systest/htx_hardbootme_test. If these files exist |
| 398 | # they are copied to the FFDC directory. |
| 399 | # Global variable ffdc_dir_path is the path name of the |
| 400 | # directory they are copied to. |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 401 | |
| 402 | @{ffdc_file_list}= Create List |
| 403 | |
| 404 | ${globex}= Set Variable os_inventory_*.json |
| 405 | |
| 406 | @{file_list}= OperatingSystem.List Files In Directory . ${globex} |
| 407 | |
| 408 | Copy Files ${globex} ${ffdc_dir_path} |
| 409 | |
| 410 | : FOR ${file_name} IN @{file_list} |
| 411 | \ Append To List ${ffdc_file_list} ${ffdc_dir_path}${file_name} |
| 412 | |
| 413 | Run Keyword and Ignore Error Remove Files ${globex} |
| 414 | |
| 415 | [Return] ${ffdc_file_list} |
Steven Sombar | 96de573 | 2017-08-17 09:04:52 -0500 | [diff] [blame] | 416 | |
| 417 | |
George Keishing | 7a52022 | 2017-02-27 09:44:30 -0600 | [diff] [blame] | 418 | SCP Coredump Files |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 419 | [Documentation] Copy core dump files from BMC to local system and return a |
| 420 | ... list of generated file names. |
| 421 | |
| 422 | @{ffdc_file_list}= Create List |
Michael Walsh | e53e47a | 2017-06-30 17:03:24 -0500 | [diff] [blame] | 423 | |
George Keishing | 7a52022 | 2017-02-27 09:44:30 -0600 | [diff] [blame] | 424 | # Check if core dump exist in the /tmp |
Michael Walsh | e53e47a | 2017-06-30 17:03:24 -0500 | [diff] [blame] | 425 | ${core_files} ${stderr} ${rc}= BMC Execute Command ls /tmp/core_* |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 426 | ... ignore_err=${1} |
| 427 | Run Keyword If '${rc}' != '${0}' Return From Keyword ${ffdc_file_list} |
| 428 | |
| 429 | @{core_list}= Split String ${core_files} |
George Keishing | 7a52022 | 2017-02-27 09:44:30 -0600 | [diff] [blame] | 430 | # Copy the core files |
Michael Walsh | 6bad841 | 2017-06-27 14:09:36 -0500 | [diff] [blame] | 431 | Run Key U Open Connection for SCP |
George Keishing | 7a52022 | 2017-02-27 09:44:30 -0600 | [diff] [blame] | 432 | :FOR ${index} IN @{core_list} |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 433 | \ ${ffdc_file_path}= Catenate ${LOG_PREFIX}${index.lstrip("/tmp/")} |
| 434 | \ ${status}= Run Keyword and Return Status |
| 435 | ... scp.Get File ${index} ${ffdc_file_path} |
| 436 | \ Run Keyword If '${status}' == '${False}' Continue For Loop |
| 437 | \ Append To List ${ffdc_file_list} ${ffdc_file_path} |
George Keishing | 7a52022 | 2017-02-27 09:44:30 -0600 | [diff] [blame] | 438 | # Remove the file from remote to avoid re-copying on next FFDC call |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 439 | \ BMC Execute Command rm ${index} ignore_err=${1} |
Michael Walsh | e53e47a | 2017-06-30 17:03:24 -0500 | [diff] [blame] | 440 | # I can't find a way to do this: scp.Close Connection |
George Keishing | 7a52022 | 2017-02-27 09:44:30 -0600 | [diff] [blame] | 441 | |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 442 | [Return] ${ffdc_file_list} |
| 443 | |
Sweta Potthuri | a82efd6 | 2017-10-18 05:34:59 -0500 | [diff] [blame] | 444 | SCP Dump Files |
| 445 | [Documentation] Copy all dump files from BMC to local system. |
| 446 | |
| 447 | # Check if dumps exist |
| 448 | ${ffdc_file_list}= Scp Dumps ${FFDC_DIR_PATH} ${FFDC_PREFIX} |
| 449 | |
| 450 | [Return] ${ffdc_file_list} |
| 451 | |
| 452 | Collect Dump Log |
| 453 | [Documentation] Collect dumps from dump entry. |
| 454 | [Arguments] ${log_prefix_path}=${LOG_PREFIX} |
| 455 | |
| 456 | ${data}= Read Properties ${DUMP_ENTRY_URI}/enumerate quiet=${1} |
| 457 | |
| 458 | # Grab the list of entries from dump/entry/ |
| 459 | # The data shown below is the result of the "Get Dictionary Keys". |
| 460 | # Example: |
| 461 | # /xyz/openbmc_project/dump/entry/1 |
| 462 | # /xyz/openbmc_project/dump/entry/2 |
| 463 | |
| 464 | ${dump_list}= Get Dictionary Keys ${data} |
George Keishing | eb7b4bc | 2017-03-13 12:04:28 -0500 | [diff] [blame] | 465 | |
Michael Walsh | 02c7060 | 2018-10-04 15:24:30 -0500 | [diff] [blame] | 466 | |
George Keishing | eb7b4bc | 2017-03-13 12:04:28 -0500 | [diff] [blame] | 467 | Collect eSEL Log |
Michael Walsh | 02c7060 | 2018-10-04 15:24:30 -0500 | [diff] [blame] | 468 | [Documentation] Create raw and formatted eSEL files. |
Sridevi Ramesh | b180c9f | 2017-08-06 10:27:41 -0500 | [diff] [blame] | 469 | [Arguments] ${log_prefix_path}=${LOG_PREFIX} |
| 470 | |
Michael Walsh | 02c7060 | 2018-10-04 15:24:30 -0500 | [diff] [blame] | 471 | # NOTE: If no eSEL.pl program can be located, then no formatted eSEL file |
| 472 | # will be generated. |
| 473 | |
| 474 | # Description of argument(s): |
| 475 | # log_prefix_path The path prefix to be used in creating |
| 476 | # eSEL file path names. For example, if |
| 477 | # log_prefix_path is |
| 478 | # "/tmp/user1/dummy.181001.120000.", then |
| 479 | # this keyword will create |
| 480 | # /tmp/user1/dummy.181001.120000.esel (raw) |
| 481 | # and |
| 482 | # /tmp/user1/dummy.181001.120000.esel.txt |
| 483 | # (formatted). |
| 484 | |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 485 | @{ffdc_file_list}= Create List |
| 486 | |
Michael Walsh | 02c7060 | 2018-10-04 15:24:30 -0500 | [diff] [blame] | 487 | ${esels}= Get Esels |
| 488 | ${num_esels}= Evaluate len(${esels}) |
| 489 | Rprint Vars num_esels |
| 490 | Return From Keyword If ${num_esels} == ${0} ${ffdc_file_list} |
George Keishing | eb7b4bc | 2017-03-13 12:04:28 -0500 | [diff] [blame] | 491 | |
Sridevi Ramesh | b180c9f | 2017-08-06 10:27:41 -0500 | [diff] [blame] | 492 | ${logpath}= Catenate SEPARATOR= ${log_prefix_path} esel |
George Keishing | eb7b4bc | 2017-03-13 12:04:28 -0500 | [diff] [blame] | 493 | Create File ${logpath} |
George Keishing | eb7b4bc | 2017-03-13 12:04:28 -0500 | [diff] [blame] | 494 | |
Michael Walsh | 02c7060 | 2018-10-04 15:24:30 -0500 | [diff] [blame] | 495 | :FOR ${esel} IN @{esels} |
| 496 | \ Write Data To File "${esel}"${\n} ${logpath} |
George Keishing | b1ca69b | 2017-03-31 14:36:42 -0500 | [diff] [blame] | 497 | |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 498 | Append To List ${ffdc_file_list} ${logpath} |
Michael Walsh | 02c7060 | 2018-10-04 15:24:30 -0500 | [diff] [blame] | 499 | |
| 500 | ${rc} ${output}= Shell Cmd which eSEL.pl show_err=0 |
| 501 | Return From Keyword If ${rc} != ${0} ${ffdc_file_list} |
| 502 | |
| 503 | Convert eSEL To Elog Format ${logpath} |
Michael Walsh | 0192e9b | 2017-11-14 15:14:15 -0600 | [diff] [blame] | 504 | Append To List ${ffdc_file_list} ${logpath}.txt |
Michael Walsh | 63b70c0 | 2017-10-30 15:02:09 -0500 | [diff] [blame] | 505 | |
| 506 | [Return] ${ffdc_file_list} |
| 507 | |
George Keishing | b1ca69b | 2017-03-31 14:36:42 -0500 | [diff] [blame] | 508 | |
George Keishing | b1ca69b | 2017-03-31 14:36:42 -0500 | [diff] [blame] | 509 | Convert eSEL To Elog Format |
| 510 | [Documentation] Execute parser tool on the eSEL data file to generate |
Michael Walsh | a30dac7 | 2017-04-04 17:56:23 -0500 | [diff] [blame] | 511 | ... formatted error log. |
George Keishing | b1ca69b | 2017-03-31 14:36:42 -0500 | [diff] [blame] | 512 | [Arguments] ${esel_file_path} |
Michael Walsh | 02c7060 | 2018-10-04 15:24:30 -0500 | [diff] [blame] | 513 | # Description of argument(s): |
George Keishing | 7c6342b | 2018-11-02 14:27:13 -0500 | [diff] [blame] | 514 | # esel_file_path The path to the file containing raw eSEL |
Michael Walsh | 02c7060 | 2018-10-04 15:24:30 -0500 | [diff] [blame] | 515 | # data (e.g. |
| 516 | # "/tmp/user1/dummy.181001.120000.esel"). |
George Keishing | b1ca69b | 2017-03-31 14:36:42 -0500 | [diff] [blame] | 517 | |
Michael Walsh | a30dac7 | 2017-04-04 17:56:23 -0500 | [diff] [blame] | 518 | # Note: The only way to get eSEL.pl to put the output in a particular |
| 519 | # directory is to cd to that directory. |
| 520 | ${cmd_buf}= Catenate cd $(dirname ${esel_file_path}) ; eSEL.pl -l |
| 521 | ... ${esel_file_path} -p decode_obmc_data |
Michael Walsh | 02c7060 | 2018-10-04 15:24:30 -0500 | [diff] [blame] | 522 | Qprint Issuing ${cmd_buf} |
Michael Walsh | a30dac7 | 2017-04-04 17:56:23 -0500 | [diff] [blame] | 523 | Run ${cmd_buf} |
Michael Walsh | 02c7060 | 2018-10-04 15:24:30 -0500 | [diff] [blame] | 524 | # The .binary file, which is generated by eSEL.pl, is of no use to us. |
| 525 | Remove File ${esel_file_path}.binary |