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 |
George Keishing | ab7a907 | 2017-02-24 13:03:24 -0600 | [diff] [blame] | 8 | Library SSHLibrary |
Sivas SRR | 0d657e8 | 2017-03-13 01:00:34 -0500 | [diff] [blame] | 9 | Library OperatingSystem |
George Keishing | 16333ec | 2017-03-21 06:18:29 -0500 | [diff] [blame] | 10 | Library Collections |
Michael Walsh | e844e9a | 2017-04-20 16:51:10 -0500 | [diff] [blame] | 11 | Library String |
| 12 | Library gen_robot_keyword.py |
Gunnar Mills | 7e2cda2 | 2016-10-11 15:37:34 -0500 | [diff] [blame] | 13 | |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 14 | *** Keywords *** |
| 15 | |
| 16 | ################################################################ |
| 17 | # Method : Call FFDC Methods # |
| 18 | # Execute the user define keywords from the FFDC List # |
| 19 | # Unlike any other keywords this will call into the # |
| 20 | # list of keywords defined in the FFDC list at one go # |
| 21 | ################################################################ |
| 22 | |
| 23 | Call FFDC Methods |
Michael Walsh | e844e9a | 2017-04-20 16:51:10 -0500 | [diff] [blame] | 24 | [Documentation] Call into FFDC Keyword index list. |
| 25 | [Arguments] ${ffdc_function_list}=${EMPTY} |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 26 | |
Michael Walsh | e844e9a | 2017-04-20 16:51:10 -0500 | [diff] [blame] | 27 | # Description of argument(s): |
| 28 | # ffdc_function_list A colon-delimited list naming the kinds of FFDC that |
| 29 | # is to be collected |
| 30 | # (e.g. "FFDC Generic Report:BMC Specific Files"). |
| 31 | # Acceptable values can be found in the description |
| 32 | # field of FFDC_METHOD_CALL in |
| 33 | # lib/openbmc_ffdc_list.py. Those values can be |
| 34 | # obtained via a call to 'Get FFDC Method Desc' (also |
| 35 | # from lib/openbmc_ffdc_list.py). |
| 36 | |
Michael Walsh | 6bad841 | 2017-06-27 14:09:36 -0500 | [diff] [blame] | 37 | Run Key U Open Connection And Log In |
Michael Walsh | e844e9a | 2017-04-20 16:51:10 -0500 | [diff] [blame] | 38 | @{entries}= Get FFDC Method Index |
| 39 | :FOR ${index} IN @{entries} |
| 40 | \ Method Call Keyword List ${index} ${ffdc_function_list} |
Michael Walsh | 6bad841 | 2017-06-27 14:09:36 -0500 | [diff] [blame] | 41 | Run Key U SSHLibrary.Close All Connections |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 42 | |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 43 | Method Call Keyword List |
Michael Walsh | e844e9a | 2017-04-20 16:51:10 -0500 | [diff] [blame] | 44 | [Documentation] Iterate the list through keyword index. |
| 45 | [Arguments] ${index} ${ffdc_function_list}=${EMPTY} |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 46 | |
Michael Walsh | e844e9a | 2017-04-20 16:51:10 -0500 | [diff] [blame] | 47 | # Description of argument(s): |
| 48 | # index The index into the FFDC_METHOD_CALL dictionary (e.g. |
| 49 | # 'BMC LOGS'). |
| 50 | # ffdc_function_list See ffdc_function_list description in |
| 51 | # "Call FFDC Methods" (above). |
| 52 | |
| 53 | @{method_list}= Get ffdc method call ${index} |
| 54 | |
| 55 | # If function list is empty assign default (i.e. a list of all allowable |
| 56 | # values). In either case, convert ffdc_function_list from a string to |
| 57 | # a list. |
| 58 | @{ffdc_function_list}= |
| 59 | ... Run Keyword If '${ffdc_function_list}' == '${EMPTY}' |
| 60 | ... Get FFDC Method Desc ${index} |
| 61 | ... ELSE |
| 62 | ... Split String ${ffdc_function_list} separator=: |
| 63 | |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 64 | :FOR ${method} IN @{method_list} |
Michael Walsh | e844e9a | 2017-04-20 16:51:10 -0500 | [diff] [blame] | 65 | \ Execute Keyword Method ${method[0]} ${method[1]} |
| 66 | ... @{ffdc_function_list} |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 67 | |
| 68 | Execute Keyword Method |
Michael Walsh | e844e9a | 2017-04-20 16:51:10 -0500 | [diff] [blame] | 69 | [Documentation] Call into BMC method keywords. Don't let one |
| 70 | ... failure skip the remaining. Get whatever data |
| 71 | ... it could gather at worse case scenario. |
| 72 | [Arguments] ${description} ${keyword_name} @{ffdc_function_list} |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 73 | |
Michael Walsh | e844e9a | 2017-04-20 16:51:10 -0500 | [diff] [blame] | 74 | # Description of argument(s): |
| 75 | # description The description of the FFDC to be collected. This |
| 76 | # would be any value returned by |
| 77 | # 'Get FFDC Method Desc' (e.g. "FFDC Generic Report"). |
| 78 | # keyword_name The name of the keyword to call to collect the FFDC |
| 79 | # data (again, see FFDC_METHOD_CALL). |
| 80 | # ffdc_function_list See ffdc_function_list description in |
| 81 | # "Call FFDC Methods" (above). The only difference is |
| 82 | # in this case, it should be a list rather than a |
| 83 | # colon-delimited value. |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 84 | |
Michael Walsh | e844e9a | 2017-04-20 16:51:10 -0500 | [diff] [blame] | 85 | ${status} ${ret_values}= Run Keyword And Ignore Error |
| 86 | ... List Should Contain Value ${ffdc_function_list} ${description} |
| 87 | Run Keyword If '${status}' != 'PASS' Return from Keyword |
| 88 | |
| 89 | Run Key ${keyword_name} ignore=1 |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 90 | |
| 91 | ################################################################ |
| 92 | # Method : BMC FFDC Manifest # |
| 93 | # Execute command on BMC and write to ffdc_report.txt # |
| 94 | ################################################################ |
| 95 | |
| 96 | BMC FFDC Manifest |
| 97 | [Documentation] Get the commands index for the FFDC_BMC_CMD, |
| 98 | ... login to BMC and execute commands. |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 99 | |
| 100 | @{entries}= Get ffdc cmd index |
| 101 | :FOR ${index} IN @{entries} |
| 102 | \ Iterate BMC Command List Pairs ${index} |
| 103 | |
| 104 | |
| 105 | Iterate BMC Command List Pairs |
| 106 | [Documentation] Feed in key pair list from dictionary to execute |
| 107 | [Arguments] ${key_index} |
| 108 | |
| 109 | @{cmd_list}= Get ffdc bmc cmd ${key_index} |
| 110 | Set Suite Variable ${ENTRY_INDEX} ${key_index} |
| 111 | :FOR ${cmd} IN @{cmd_list} |
| 112 | \ Execute Command and Write FFDC ${cmd[0]} ${cmd[1]} |
| 113 | |
| 114 | |
| 115 | Execute Command and Write FFDC |
Gunnar Mills | cce185d | 2016-10-17 17:04:15 -0500 | [diff] [blame] | 116 | [Documentation] Execute command on BMC or OS and write to ffdc |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 117 | ... By default to ffdc_report.txt file else to |
| 118 | ... specified file path. |
| 119 | [Arguments] ${key_index} |
| 120 | ... ${cmd} |
| 121 | ... ${logpath}=${FFDC_FILE_PATH} |
| 122 | |
| 123 | Run Keyword If '${logpath}' == '${FFDC_FILE_PATH}' |
| 124 | ... Write Cmd Output to FFDC File ${key_index} ${cmd} |
| 125 | |
| 126 | ${stdout} ${stderr}= |
| 127 | ... Execute Command ${cmd} return_stderr=True |
| 128 | |
Jeff Whitlock | 7d805b2 | 2017-01-20 14:04:33 -0600 | [diff] [blame] | 129 | # Write stdout on success and stderr/stdout to the file on failure. |
| 130 | Run Keyword If $stderr == '${EMPTY}' |
Sweta Potthuri | 15e6d2f | 2017-02-28 03:10:02 -0600 | [diff] [blame] | 131 | ... Write Data To File ${stdout}${\n} ${logpath} |
| 132 | ... ELSE Write Data To File |
Jeff Whitlock | 7d805b2 | 2017-01-20 14:04:33 -0600 | [diff] [blame] | 133 | ... ERROR output:${\n}${stderr}${\n}Output:${\n}${stdout}${\n} |
| 134 | ... ${logpath} |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 135 | |
| 136 | |
| 137 | ################################################################ |
| 138 | # Method : BMC FFDC Files # |
| 139 | # Execute command on BMC and write to individual file # |
| 140 | # based on the file name pre-defined in the list # |
| 141 | ################################################################ |
| 142 | |
| 143 | BMC FFDC Files |
| 144 | [Documentation] Get the command list and iterate |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 145 | @{entries}= Get ffdc file index |
| 146 | :FOR ${index} IN @{entries} |
| 147 | \ Create File and Write Data ${index} |
| 148 | |
| 149 | |
| 150 | Create File and Write Data |
| 151 | [Documentation] Create files to current FFDC log directory, |
| 152 | ... executes command and write to corresponding |
| 153 | ... file name in the current FFDC directory. |
| 154 | [Arguments] ${key_index} |
| 155 | |
| 156 | @{cmd_list}= Get ffdc bmc file ${key_index} |
| 157 | :FOR ${cmd} IN @{cmd_list} |
Gunnar Mills | 50070fa | 2016-11-14 11:17:30 -0600 | [diff] [blame] | 158 | \ ${logpath}= Catenate SEPARATOR= ${LOG_PREFIX} ${cmd[0]}.txt |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 159 | \ Execute Command and Write FFDC ${cmd[0]} ${cmd[1]} ${logpath} |
Sivas SRR | 0d657e8 | 2017-03-13 01:00:34 -0500 | [diff] [blame] | 160 | |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 161 | |
| 162 | |
| 163 | ################################################################ |
| 164 | # Method : Log Test Case Status # |
| 165 | # Creates test result history footprint for reference # |
| 166 | ################################################################ |
| 167 | |
| 168 | Log Test Case Status |
Jeff Whitlock | 7d805b2 | 2017-01-20 14:04:33 -0600 | [diff] [blame] | 169 | [Documentation] Test case execution result history. |
| 170 | ... Create once and append to this file |
| 171 | ... logs/test_history.txt |
| 172 | ... Format Date:Test suite:Test case:Status |
| 173 | ... 20160909214053719992:Test Warmreset:Test WarmReset via REST:FAIL |
Michael Walsh | fa9f70f | 2017-04-21 16:00:18 -0500 | [diff] [blame] | 174 | |
| 175 | ${FFDC_DIR_PATH_STYLE}= Get Variable Value ${FFDC_DIR_PATH_STYLE} |
| 176 | ... ${EMPTY} |
| 177 | ${FFDC_DIR_PATH}= Get Variable Value ${FFDC_DIR_PATH} ${EMPTY} |
| 178 | |
| 179 | Run Keyword If '${FFDC_DIR_PATH}' == '${EMPTY}' Set FFDC Defaults |
| 180 | |
| 181 | Run Keyword If '${FFDC_DIR_PATH_STYLE}' == '${1}' Run Keywords |
| 182 | ... Set Global Variable ${FFDC_LOG_PATH} ${FFDC_DIR_PATH} AND |
| 183 | ... Set Global Variable ${TEST_HISTORY} ${FFDC_DIR_PATH}test_history.txt |
| 184 | |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 185 | Create Directory ${FFDC_LOG_PATH} |
| 186 | |
| 187 | ${exist}= Run Keyword and Return Status |
| 188 | ... OperatingSystem.File Should Exist ${TEST_HISTORY} |
| 189 | |
| 190 | Run Keyword If '${exist}' == '${False}' |
| 191 | ... Create File ${TEST_HISTORY} |
| 192 | |
Michael Walsh | fa9f70f | 2017-04-21 16:00:18 -0500 | [diff] [blame] | 193 | Rpvars TEST_HISTORY |
| 194 | |
George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 195 | ${cur_time}= Get Current Time Stamp |
| 196 | |
| 197 | Append To File ${TEST_HISTORY} |
| 198 | ... ${cur_time}:${SUITE_NAME}:${TEST_NAME}:${TEST_STATUS}${\n} |
| 199 | |
Gunnar Mills | a812e0f | 2016-09-29 20:30:03 -0500 | [diff] [blame] | 200 | |
| 201 | Log FFDC Get Requests |
| 202 | [Documentation] Create file in current FFDC log directory. |
| 203 | ... Do openbmc get request and write to |
| 204 | ... corresponding file name. |
George Keishing | 8e47f53 | 2016-10-05 08:41:45 -0500 | [diff] [blame] | 205 | ... JSON pretty print for logging to file. |
Gunnar Mills | a812e0f | 2016-09-29 20:30:03 -0500 | [diff] [blame] | 206 | [Arguments] ${key_index} |
| 207 | |
| 208 | @{cmd_list}= Get ffdc get request ${key_index} |
| 209 | :FOR ${cmd} IN @{cmd_list} |
Gunnar Mills | 50070fa | 2016-11-14 11:17:30 -0600 | [diff] [blame] | 210 | \ ${logpath}= Catenate SEPARATOR= ${LOG_PREFIX} ${cmd[0]}.txt |
George Keishing | d71e912 | 2016-11-30 11:15:21 -0600 | [diff] [blame] | 211 | \ ${resp}= OpenBMC Get Request ${cmd[1]} quiet=${1} |
George Keishing | 8e47f53 | 2016-10-05 08:41:45 -0500 | [diff] [blame] | 212 | \ ${status}= Run Keyword and Return Status |
| 213 | ... Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} |
| 214 | \ Run Keyword If '${status}' == '${False}' Continue For Loop |
| 215 | \ ${jsondata}= to json ${resp.content} pretty_print=True |
Sweta Potthuri | 15e6d2f | 2017-02-28 03:10:02 -0600 | [diff] [blame] | 216 | \ Write Data To File ${\n}${jsondata}${\n} ${logpath} |
Gunnar Mills | a812e0f | 2016-09-29 20:30:03 -0500 | [diff] [blame] | 217 | |
| 218 | |
| 219 | BMC FFDC Get Requests |
| 220 | [Documentation] Get the command list and iterate |
Gunnar Mills | a812e0f | 2016-09-29 20:30:03 -0500 | [diff] [blame] | 221 | @{entries}= Get ffdc get request index |
| 222 | :FOR ${index} IN @{entries} |
| 223 | \ Log FFDC Get Requests ${index} |
Gunnar Mills | 7e2cda2 | 2016-10-11 15:37:34 -0500 | [diff] [blame] | 224 | |
| 225 | |
Gunnar Mills | cce185d | 2016-10-17 17:04:15 -0500 | [diff] [blame] | 226 | Log OS ALL DISTROS FFDC |
Gunnar Mills | 7e2cda2 | 2016-10-11 15:37:34 -0500 | [diff] [blame] | 227 | [Documentation] Create file in current FFDC log directory. |
| 228 | ... Executes OS command and write to |
| 229 | ... corresponding file name. |
| 230 | [Arguments] ${key_index} |
| 231 | |
Gunnar Mills | 7e2cda2 | 2016-10-11 15:37:34 -0500 | [diff] [blame] | 232 | @{cmd_list}= get ffdc os all distros call ${key_index} |
| 233 | :FOR ${cmd} IN @{cmd_list} |
Gunnar Mills | 50070fa | 2016-11-14 11:17:30 -0600 | [diff] [blame] | 234 | \ ${logpath}= Catenate SEPARATOR= ${LOG_PREFIX} ${cmd[0]}.txt |
Gunnar Mills | 7e2cda2 | 2016-10-11 15:37:34 -0500 | [diff] [blame] | 235 | \ Execute Command and Write FFDC ${cmd[0]} ${cmd[1]} ${logpath} |
| 236 | |
| 237 | |
Gunnar Mills | cce185d | 2016-10-17 17:04:15 -0500 | [diff] [blame] | 238 | Log OS SPECIFIC DISTRO FFDC |
| 239 | [Documentation] Create file in current FFDC log directory. |
| 240 | ... Executes OS command and write to |
| 241 | ... corresponding file name. |
| 242 | [Arguments] ${key_index} ${linux_distro} |
| 243 | |
| 244 | @{cmd_list}= get ffdc os distro call ${key_index} ${linux_distro} |
| 245 | :FOR ${cmd} IN @{cmd_list} |
Gunnar Mills | 50070fa | 2016-11-14 11:17:30 -0600 | [diff] [blame] | 246 | \ ${logpath}= Catenate SEPARATOR= ${LOG_PREFIX} ${cmd[0]}.txt |
Gunnar Mills | cce185d | 2016-10-17 17:04:15 -0500 | [diff] [blame] | 247 | \ Execute Command and Write FFDC ${cmd[0]} ${cmd[1]} ${logpath} |
| 248 | |
| 249 | |
| 250 | |
George Keishing | ca8c4c6 | 2016-10-14 10:08:40 -0500 | [diff] [blame] | 251 | OS FFDC Files |
Gunnar Mills | 7e2cda2 | 2016-10-11 15:37:34 -0500 | [diff] [blame] | 252 | [Documentation] Get the command list and iterate |
Gunnar Mills | aca140d | 2016-10-26 13:05:10 -0500 | [diff] [blame] | 253 | [Arguments] ${OS_HOST}=${OS_HOST} ${OS_USERNAME}=${OS_USERNAME} |
| 254 | ... ${OS_PASSWORD}=${OS_PASSWORD} |
Gunnar Mills | 7e2cda2 | 2016-10-11 15:37:34 -0500 | [diff] [blame] | 255 | |
| 256 | Return From Keyword If '${OS_HOST}' == '${EMPTY}' |
| 257 | ... No OS Host Provided |
Gunnar Mills | aca140d | 2016-10-26 13:05:10 -0500 | [diff] [blame] | 258 | |
| 259 | # If can't ping, return |
| 260 | ${rc}= Run Keyword and Return Status Ping Host ${OS_HOST} |
| 261 | Return From Keyword If '${rc}' == '${False}' |
| 262 | ... Could not ping OS |
| 263 | |
Gunnar Mills | cce185d | 2016-10-17 17:04:15 -0500 | [diff] [blame] | 264 | Open Connection And Log In host=${OS_HOST} username=${OS_USERNAME} |
| 265 | ... password=${OS_PASSWORD} |
| 266 | |
Gunnar Mills | aca140d | 2016-10-26 13:05:10 -0500 | [diff] [blame] | 267 | ${output} ${stderr} ${rc}= Execute Command uptime return_stderr=True |
| 268 | ... return_rc=True |
| 269 | |
| 270 | # If the return code returned by "Execute Command" is non-zero, return |
| 271 | Return From Keyword If '${rc}' != '${0}' |
| 272 | ... Could not connect to OS |
| 273 | |
Gunnar Mills | 7e2cda2 | 2016-10-11 15:37:34 -0500 | [diff] [blame] | 274 | @{entries}= Get ffdc os all distros index |
| 275 | :FOR ${index} IN @{entries} |
Gunnar Mills | cce185d | 2016-10-17 17:04:15 -0500 | [diff] [blame] | 276 | \ Log OS ALL DISTROS FFDC ${index} |
| 277 | |
| 278 | ${linux_distro}= Execute Command |
| 279 | ... . /etc/os-release; echo $ID |
| 280 | ... return_stdout=True return_stderr=False return_rc=False |
| 281 | |
Jeff Whitlock | 7d805b2 | 2017-01-20 14:04:33 -0600 | [diff] [blame] | 282 | Return From Keyword If |
| 283 | ... '${linux_distro}' == '${EMPTY}' or '${linux_distro}' == 'None' |
| 284 | ... Could not determine Linux Distribution |
Gunnar Mills | cce185d | 2016-10-17 17:04:15 -0500 | [diff] [blame] | 285 | |
| 286 | @{entries}= Get ffdc os distro index ${linux_distro} |
| 287 | :FOR ${index} IN @{entries} |
| 288 | \ Log OS SPECIFIC DISTRO FFDC ${index} ${linux_distro} |
George Keishing | 7a52022 | 2017-02-27 09:44:30 -0600 | [diff] [blame] | 289 | |
| 290 | |
| 291 | ############################################################################## |
| 292 | SCP Coredump Files |
| 293 | [Documentation] Copy core dump file from BMC to local system. |
| 294 | # Check if core dump exist in the /tmp |
Michael Walsh | 87b1ce3 | 2017-03-03 15:21:42 -0600 | [diff] [blame] | 295 | ${core_files}= Execute Command ls /tmp/core_* |
George Keishing | 7a52022 | 2017-02-27 09:44:30 -0600 | [diff] [blame] | 296 | @{core_list} = Split String ${core_files} |
| 297 | # Copy the core files |
Michael Walsh | 6bad841 | 2017-06-27 14:09:36 -0500 | [diff] [blame] | 298 | Run Key U Open Connection for SCP |
George Keishing | 7a52022 | 2017-02-27 09:44:30 -0600 | [diff] [blame] | 299 | :FOR ${index} IN @{core_list} |
| 300 | \ scp.Get File ${index} ${LOG_PREFIX}${index.lstrip("/tmp/")} |
| 301 | # Remove the file from remote to avoid re-copying on next FFDC call |
| 302 | \ Execute Command On BMC rm ${index} |
Michael Walsh | 6bad841 | 2017-06-27 14:09:36 -0500 | [diff] [blame] | 303 | Run Key U scp.Close Connection |
George Keishing | 7a52022 | 2017-02-27 09:44:30 -0600 | [diff] [blame] | 304 | |
George Keishing | eb7b4bc | 2017-03-13 12:04:28 -0500 | [diff] [blame] | 305 | |
| 306 | ############################################################################## |
| 307 | Collect eSEL Log |
George Keishing | b1ca69b | 2017-03-31 14:36:42 -0500 | [diff] [blame] | 308 | [Documentation] Collect eSEL log from logging entry and convert eSEL data |
| 309 | ... to elog formated string text file. |
George Keishing | eb7b4bc | 2017-03-13 12:04:28 -0500 | [diff] [blame] | 310 | ${resp}= OpenBMC Get Request ${BMC_LOGGING_ENTRY}/enumerate quiet=${1} |
| 311 | ${status}= Run Keyword And Return Status |
| 312 | ... Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} |
| 313 | Return From Keyword If '${status}' == '${False}' |
| 314 | |
| 315 | ${content}= To Json ${resp.content} |
| 316 | # Grab the list of entries from logging/entry/ |
| 317 | # The data shown below is the result of the "Get Dictionary Keys". |
| 318 | # Example: |
| 319 | # /xyz/openbmc_project/logging/entry/1 |
| 320 | # /xyz/openbmc_project/logging/entry/2 |
| 321 | ${esel_list}= Get Dictionary Keys ${content['data']} |
| 322 | |
Sweta Potthuri | 92e7b13 | 2017-03-17 06:02:32 -0500 | [diff] [blame] | 323 | ${logpath}= Catenate SEPARATOR= ${LOG_PREFIX} esel |
George Keishing | eb7b4bc | 2017-03-13 12:04:28 -0500 | [diff] [blame] | 324 | Create File ${logpath} |
| 325 | # Fetch data from /xyz/openbmc_project/logging/entry/1/attr/AdditionalData |
| 326 | # "ESEL=00 00 df 00 00 00 00 20 00 04 12 35 6f aa 00 00 " |
| 327 | # Sample eSEL entry: |
| 328 | # "/xyz/openbmc_project/logging/entry/1": { |
| 329 | # "Timestamp": 1487744317025, |
| 330 | # "AdditionalData": [ |
| 331 | # "ESEL=00 00 df 00 00 00 00 20 00 04 12 35 6f aa 00 00 " |
| 332 | # ], |
| 333 | # "Message": "org.open_power.Error.Host.Event.Event", |
| 334 | # "Id": 1, |
| 335 | # "Severity": "xyz.openbmc_project.Logging.Entry.Level.Emergency" |
| 336 | # } |
| 337 | |
| 338 | :FOR ${entry_path} IN @{esel_list} |
| 339 | \ ${esel_data}= Read Attribute ${entry_path} AdditionalData quiet=${1} |
George Keishing | 16333ec | 2017-03-21 06:18:29 -0500 | [diff] [blame] | 340 | \ ${length}= Get Length ${esel_data} |
| 341 | # Skip writting to file if eSEL AdditionalData is empty |
| 342 | \ Continue For Loop If ${length} == ${0} |
George Keishing | eb7b4bc | 2017-03-13 12:04:28 -0500 | [diff] [blame] | 343 | \ Write Data To File "${esel_data[0]}" ${logpath} |
| 344 | \ Write Data To File ${\n} ${logpath} |
| 345 | |
George Keishing | b1ca69b | 2017-03-31 14:36:42 -0500 | [diff] [blame] | 346 | ${out}= Run which eSEL.pl |
| 347 | ${status}= Run Keyword And Return Status |
| 348 | ... Should Contain ${out} eSEL.pl |
| 349 | Return From Keyword If '${status}' == '${False}' |
| 350 | |
| 351 | Convert eSEL To Elog Format ${logpath} |
| 352 | |
| 353 | |
| 354 | ############################################################################## |
| 355 | Convert eSEL To Elog Format |
| 356 | [Documentation] Execute parser tool on the eSEL data file to generate |
Michael Walsh | a30dac7 | 2017-04-04 17:56:23 -0500 | [diff] [blame] | 357 | ... formatted error log. |
George Keishing | b1ca69b | 2017-03-31 14:36:42 -0500 | [diff] [blame] | 358 | [Arguments] ${esel_file_path} |
| 359 | # Desription of arguments: |
Michael Walsh | a30dac7 | 2017-04-04 17:56:23 -0500 | [diff] [blame] | 360 | # esel_file_path Absolute path of the eSEL data (e.g. |
| 361 | # /tmp/w55.170404.154820.esel). |
George Keishing | b1ca69b | 2017-03-31 14:36:42 -0500 | [diff] [blame] | 362 | |
Michael Walsh | a30dac7 | 2017-04-04 17:56:23 -0500 | [diff] [blame] | 363 | # Note: The only way to get eSEL.pl to put the output in a particular |
| 364 | # directory is to cd to that directory. |
| 365 | ${cmd_buf}= Catenate cd $(dirname ${esel_file_path}) ; eSEL.pl -l |
| 366 | ... ${esel_file_path} -p decode_obmc_data |
| 367 | Run ${cmd_buf} |
George Keishing | b1ca69b | 2017-03-31 14:36:42 -0500 | [diff] [blame] | 368 | |
George Keishing | eb7b4bc | 2017-03-13 12:04:28 -0500 | [diff] [blame] | 369 | ############################################################################## |