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