blob: 682e96b5a3e26ff66f2a9f29f950caa311776f7a [file] [log] [blame]
George Keishing69e6f712016-09-12 06:30:09 -05001*** Settings ***
2Documentation Methods to execute commands on BMC and collect
3... data to a list of FFDC files
4
5Resource openbmc_ffdc_utils.robot
George Keishing8e47f532016-10-05 08:41:45 -05006Resource rest_client.robot
Gunnar Millsaca140d2016-10-26 13:05:10 -05007Resource utils.robot
Michael Walsh63b70c02017-10-30 15:02:09 -05008Resource list_utils.robot
George Keishingab7a9072017-02-24 13:03:24 -06009Library SSHLibrary
Sivas SRR0d657e82017-03-13 01:00:34 -050010Library OperatingSystem
George Keishing16333ec2017-03-21 06:18:29 -050011Library Collections
Michael Walshe844e9a2017-04-20 16:51:10 -050012Library String
Michael Walshe53e47a2017-06-30 17:03:24 -050013Library gen_print.py
Michael Walshe844e9a2017-04-20 16:51:10 -050014Library gen_robot_keyword.py
Gunnar Mills7e2cda22016-10-11 15:37:34 -050015
George Keishing69e6f712016-09-12 06:30:09 -050016*** Keywords ***
17
George Keishing69e6f712016-09-12 06:30:09 -050018# Method : Call FFDC Methods #
19# Execute the user define keywords from the FFDC List #
20# Unlike any other keywords this will call into the #
21# list of keywords defined in the FFDC list at one go #
George Keishing69e6f712016-09-12 06:30:09 -050022
23Call FFDC Methods
Michael Walshe844e9a2017-04-20 16:51:10 -050024 [Documentation] Call into FFDC Keyword index list.
25 [Arguments] ${ffdc_function_list}=${EMPTY}
George Keishing69e6f712016-09-12 06:30:09 -050026
Michael Walshe844e9a2017-04-20 16:51:10 -050027 # Description of argument(s):
28 # ffdc_function_list A colon-delimited list naming the kinds of FFDC that
Michael Walsh63b70c02017-10-30 15:02:09 -050029 # are to be collected
Michael Walshe844e9a2017-04-20 16:51:10 -050030 # (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
37 @{entries}= Get FFDC Method Index
Michael Walsh63b70c02017-10-30 15:02:09 -050038 # Example entries:
39 # entries:
40 # entries[0]: BMC LOGS
41
42 @{ffdc_file_list}= Create List
Michael Walshe844e9a2017-04-20 16:51:10 -050043 :FOR ${index} IN @{entries}
Michael Walsh63b70c02017-10-30 15:02:09 -050044 \ ${ffdc_file_sub_list}= Method Call Keyword List ${index}
45 ... ${ffdc_function_list}
46 \ ${ffdc_file_list}= Smart Combine Lists ${ffdc_file_list}
47 ... ${ffdc_file_sub_list}
48
Michael Walsh6bad8412017-06-27 14:09:36 -050049 Run Key U SSHLibrary.Close All Connections
George Keishing69e6f712016-09-12 06:30:09 -050050
Michael Walsh63b70c02017-10-30 15:02:09 -050051 [Return] ${ffdc_file_list}
52
George Keishing69e6f712016-09-12 06:30:09 -050053Method Call Keyword List
Michael Walsh63b70c02017-10-30 15:02:09 -050054 [Documentation] Process FFDC request and return a list of generated files.
Michael Walshe844e9a2017-04-20 16:51:10 -050055 [Arguments] ${index} ${ffdc_function_list}=${EMPTY}
George Keishing69e6f712016-09-12 06:30:09 -050056
Michael Walshe844e9a2017-04-20 16:51:10 -050057 # Description of argument(s):
58 # index The index into the FFDC_METHOD_CALL dictionary (e.g.
59 # 'BMC LOGS').
60 # ffdc_function_list See ffdc_function_list description in
61 # "Call FFDC Methods" (above).
62
Michael Walsh63b70c02017-10-30 15:02:09 -050063 @{method_list}= Get FFDC Method Call ${index}
64 # Example method_list:
65 # method_list:
66 # method_list[0]:
67 # method_list[0][0]: FFDC Generic Report
68 # method_list[0][1]: BMC FFDC Manifest
69 # method_list[1]:
70 # method_list[1][0]: Get Request FFDC
71 # method_list[1][1]: BMC FFDC Get Requests
72 # (etc.)
Michael Walshe844e9a2017-04-20 16:51:10 -050073
74 # If function list is empty assign default (i.e. a list of all allowable
75 # values). In either case, convert ffdc_function_list from a string to
76 # a list.
77 @{ffdc_function_list}=
78 ... Run Keyword If '${ffdc_function_list}' == '${EMPTY}'
79 ... Get FFDC Method Desc ${index}
80 ... ELSE
81 ... Split String ${ffdc_function_list} separator=:
82
Michael Walsh63b70c02017-10-30 15:02:09 -050083 @{ffdc_file_list}= Create List
George Keishing69e6f712016-09-12 06:30:09 -050084 :FOR ${method} IN @{method_list}
Michael Walsh63b70c02017-10-30 15:02:09 -050085 \ ${ffdc_file_sub_list}= Execute Keyword Method ${method[0]}
86 ... ${method[1]} @{ffdc_function_list}
87 \ ${ffdc_file_list}= Smart Combine Lists ${ffdc_file_list}
88 ... ${ffdc_file_sub_list}
89
90 [Return] ${ffdc_file_list}
91
George Keishing69e6f712016-09-12 06:30:09 -050092
93Execute Keyword Method
Michael Walshe844e9a2017-04-20 16:51:10 -050094 [Documentation] Call into BMC method keywords. Don't let one
95 ... failure skip the remaining. Get whatever data
96 ... it could gather at worse case scenario.
97 [Arguments] ${description} ${keyword_name} @{ffdc_function_list}
George Keishing69e6f712016-09-12 06:30:09 -050098
Michael Walshe844e9a2017-04-20 16:51:10 -050099 # Description of argument(s):
100 # description The description of the FFDC to be collected. This
101 # would be any value returned by
102 # 'Get FFDC Method Desc' (e.g. "FFDC Generic Report").
103 # keyword_name The name of the keyword to call to collect the FFDC
104 # data (again, see FFDC_METHOD_CALL).
105 # ffdc_function_list See ffdc_function_list description in
106 # "Call FFDC Methods" (above). The only difference is
107 # in this case, it should be a list rather than a
108 # colon-delimited value.
George Keishing69e6f712016-09-12 06:30:09 -0500109
Michael Walsh63b70c02017-10-30 15:02:09 -0500110 @{ffdc_file_list}= Create List
Michael Walshe844e9a2017-04-20 16:51:10 -0500111
Michael Walsh63b70c02017-10-30 15:02:09 -0500112 ${index}= Get Index From List ${ffdc_function_list} ${description}
113 Run Keyword If '${index}' == '${-1}' Return from Keyword
114 ... ${ffdc_file_list}
115
116 ${status} ${ffdc_file_list}= Run Key ${keyword_name} ignore=1
117 [Return] ${ffdc_file_list}
George Keishing69e6f712016-09-12 06:30:09 -0500118
George Keishing69e6f712016-09-12 06:30:09 -0500119# Method : BMC FFDC Manifest #
120# Execute command on BMC and write to ffdc_report.txt #
George Keishing69e6f712016-09-12 06:30:09 -0500121
122BMC FFDC Manifest
Michael Walsh63b70c02017-10-30 15:02:09 -0500123 [Documentation] Run the ssh commands from FFDC_BMC_CMD and return a list
124 ... of generated files.
George Keishing69e6f712016-09-12 06:30:09 -0500125
Michael Walsh63b70c02017-10-30 15:02:09 -0500126 @{ffdc_file_list}= Create List ${FFDC_FILE_PATH}
127 @{entries}= Get FFDC Cmd Index
128 :FOR ${index} IN @{entries}
129 \ Iterate BMC Command List Pairs ${index}
130
131 [Return] ${ffdc_file_list}
George Keishing69e6f712016-09-12 06:30:09 -0500132
133
134Iterate BMC Command List Pairs
135 [Documentation] Feed in key pair list from dictionary to execute
136 [Arguments] ${key_index}
137
138 @{cmd_list}= Get ffdc bmc cmd ${key_index}
139 Set Suite Variable ${ENTRY_INDEX} ${key_index}
140 :FOR ${cmd} IN @{cmd_list}
141 \ Execute Command and Write FFDC ${cmd[0]} ${cmd[1]}
142
143
144Execute Command and Write FFDC
Michael Walsh63b70c02017-10-30 15:02:09 -0500145 [Documentation] Run a command on the BMC or OS, write the output to the
146 ... specified file and return a list of generated files.
147 [Arguments] ${key_index} ${cmd} ${logpath}=${FFDC_FILE_PATH}
148 ... ${target}=BMC
George Keishing69e6f712016-09-12 06:30:09 -0500149
Michael Walsh63b70c02017-10-30 15:02:09 -0500150 Run Keyword If '${logpath}' == '${FFDC_FILE_PATH}'
151 ... Write Cmd Output to FFDC File ${key_index} ${cmd}
152
153 @{ffdc_file_list}= Create List ${log_path}
George Keishing69e6f712016-09-12 06:30:09 -0500154
Michael Walshe53e47a2017-06-30 17:03:24 -0500155 ${cmd_buf}= Catenate ${target} Execute Command \ ${cmd} \ ignore_err=${1}
156 ${status} ${ret_values}= Run Key ${cmd_buf} ignore=${1}
157
158 ${stdout}= Set Variable @{ret_values}[0]
159 ${stderr}= Set Variable @{ret_values}[1]
George Keishing69e6f712016-09-12 06:30:09 -0500160
Jeff Whitlock7d805b22017-01-20 14:04:33 -0600161 # Write stdout on success and stderr/stdout to the file on failure.
162 Run Keyword If $stderr == '${EMPTY}'
Sweta Potthuri15e6d2f2017-02-28 03:10:02 -0600163 ... Write Data To File ${stdout}${\n} ${logpath}
164 ... ELSE Write Data To File
Jeff Whitlock7d805b22017-01-20 14:04:33 -0600165 ... ERROR output:${\n}${stderr}${\n}Output:${\n}${stdout}${\n}
166 ... ${logpath}
George Keishing69e6f712016-09-12 06:30:09 -0500167
Michael Walsh63b70c02017-10-30 15:02:09 -0500168 [Return] ${ffdc_file_list}
169
George Keishing69e6f712016-09-12 06:30:09 -0500170
George Keishing69e6f712016-09-12 06:30:09 -0500171# Method : BMC FFDC Files #
172# Execute command on BMC and write to individual file #
173# based on the file name pre-defined in the list #
George Keishing69e6f712016-09-12 06:30:09 -0500174
175BMC FFDC Files
Michael Walsh63b70c02017-10-30 15:02:09 -0500176 [Documentation] Run the commands from FFDC_BMC_FILE and return a list of
177 ... generated files.
178
179 @{entries}= Get FFDC File Index
180 # Example of entries:
181 # entries:
182 # entries[0]: BMC FILES
183
184 @{ffdc_file_list}= Create List
185 :FOR ${index} IN @{entries}
186 \ ${ffdc_file_sub_list}= Create File and Write Data ${index}
187 \ ${ffdc_file_list}= Smart Combine Lists ${ffdc_file_list}
188 ... ${ffdc_file_sub_list}
189
190 [Return] ${ffdc_file_list}
George Keishing69e6f712016-09-12 06:30:09 -0500191
192
193Create File and Write Data
Michael Walsh63b70c02017-10-30 15:02:09 -0500194 [Documentation] Run commands from FFDC_BMC_FILE to create FFDC files and
195 ... return a list of generated files.
196 [Arguments] ${key_index}
George Keishing69e6f712016-09-12 06:30:09 -0500197
Michael Walsh63b70c02017-10-30 15:02:09 -0500198 # Description of argument(s):
199 # key_index The index into the FFDC_BMC_FILE dictionary.
200
201 @{ffdc_file_list}= Create List
202 @{cmd_list}= Get FFDC BMC File ${key_index}
George Keishing69e6f712016-09-12 06:30:09 -0500203 :FOR ${cmd} IN @{cmd_list}
Michael Walsh63b70c02017-10-30 15:02:09 -0500204 \ ${logpath}= Catenate SEPARATOR= ${LOG_PREFIX} ${cmd[0]}.txt
205 \ ${ffdc_file_sub_list}= Execute Command and Write FFDC ${cmd[0]}
206 ... ${cmd[1]} ${logpath}
207 \ ${ffdc_file_list}= Smart Combine Lists ${ffdc_file_list}
208 ... ${ffdc_file_sub_list}
Sivas SRR0d657e82017-03-13 01:00:34 -0500209
Michael Walsh63b70c02017-10-30 15:02:09 -0500210 [Return] ${ffdc_file_list}
George Keishing69e6f712016-09-12 06:30:09 -0500211
212
George Keishing69e6f712016-09-12 06:30:09 -0500213# Method : Log Test Case Status #
214# Creates test result history footprint for reference #
George Keishing69e6f712016-09-12 06:30:09 -0500215
216Log Test Case Status
Jeff Whitlock7d805b22017-01-20 14:04:33 -0600217 [Documentation] Test case execution result history.
218 ... Create once and append to this file
219 ... logs/test_history.txt
220 ... Format Date:Test suite:Test case:Status
221 ... 20160909214053719992:Test Warmreset:Test WarmReset via REST:FAIL
Michael Walshfa9f70f2017-04-21 16:00:18 -0500222
223 ${FFDC_DIR_PATH_STYLE}= Get Variable Value ${FFDC_DIR_PATH_STYLE}
224 ... ${EMPTY}
225 ${FFDC_DIR_PATH}= Get Variable Value ${FFDC_DIR_PATH} ${EMPTY}
226
227 Run Keyword If '${FFDC_DIR_PATH}' == '${EMPTY}' Set FFDC Defaults
228
229 Run Keyword If '${FFDC_DIR_PATH_STYLE}' == '${1}' Run Keywords
230 ... Set Global Variable ${FFDC_LOG_PATH} ${FFDC_DIR_PATH} AND
231 ... Set Global Variable ${TEST_HISTORY} ${FFDC_DIR_PATH}test_history.txt
232
George Keishing69e6f712016-09-12 06:30:09 -0500233 Create Directory ${FFDC_LOG_PATH}
234
235 ${exist}= Run Keyword and Return Status
236 ... OperatingSystem.File Should Exist ${TEST_HISTORY}
237
238 Run Keyword If '${exist}' == '${False}'
239 ... Create File ${TEST_HISTORY}
240
Michael Walshfa9f70f2017-04-21 16:00:18 -0500241 Rpvars TEST_HISTORY
242
George Keishing69e6f712016-09-12 06:30:09 -0500243 ${cur_time}= Get Current Time Stamp
244
245 Append To File ${TEST_HISTORY}
246 ... ${cur_time}:${SUITE_NAME}:${TEST_NAME}:${TEST_STATUS}${\n}
247
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500248
249Log FFDC Get Requests
Michael Walsh63b70c02017-10-30 15:02:09 -0500250 [Documentation] Run the get requests associated with the key and return a
251 ... list of generated files.
252 [Arguments] ${key_index}
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500253
Michael Walsh63b70c02017-10-30 15:02:09 -0500254 # Note: Output will be in JSON pretty_print format.
255
256 # Description of argument(s):
257 # key_index The key to the FFDC_GET_REQUEST dictionary that contains the
258 # get requests that are to be run.
259
260 @{ffdc_file_list}= Create List
261 @{cmd_list}= Get FFDC Get Request ${key_index}
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500262 :FOR ${cmd} IN @{cmd_list}
Michael Walsh63b70c02017-10-30 15:02:09 -0500263 \ ${logpath}= Catenate SEPARATOR= ${LOG_PREFIX} ${cmd[0]}.txt
264 \ ${resp}= OpenBMC Get Request ${cmd[1]} quiet=${1}
265 \ ${status}= Run Keyword and Return Status
266 ... Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
267 \ Run Keyword If '${status}' == '${False}' Continue For Loop
268 \ ${jsondata}= to json ${resp.content} pretty_print=True
269 \ Write Data To File ${\n}${jsondata}${\n} ${logpath}
270 \ Append To List ${ffdc_file_list} ${logpath}
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500271
Michael Walsh63b70c02017-10-30 15:02:09 -0500272 [Return] ${ffdc_file_list}
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500273
274BMC FFDC Get Requests
Michael Walsh63b70c02017-10-30 15:02:09 -0500275 [Documentation] Iterate over get request list and return a list of
276 ... generated files.
277
278 @{ffdc_file_list}= Create List
279
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500280 @{entries}= Get ffdc get request index
Michael Walsh63b70c02017-10-30 15:02:09 -0500281 # Example of entries:
282 # entries:
283 # entries[0]: GET REQUESTS
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500284 :FOR ${index} IN @{entries}
Michael Walsh63b70c02017-10-30 15:02:09 -0500285 \ ${ffdc_file_sub_list}= Log FFDC Get Requests ${index}
286 \ ${ffdc_file_list}= Smart Combine Lists ${ffdc_file_list}
287 ... ${ffdc_file_sub_list}
Gunnar Mills7e2cda22016-10-11 15:37:34 -0500288
Michael Walsh63b70c02017-10-30 15:02:09 -0500289 [Return] ${ffdc_file_list}
Gunnar Mills7e2cda22016-10-11 15:37:34 -0500290
Michael Walsh63b70c02017-10-30 15:02:09 -0500291Log OS All distros FFDC
292 [Documentation] Run commands from FFDC_OS_ALL_DISTROS_FILE to create FFDC
293 ... files and return a list of generated files.
294 [Arguments] ${key_index}
Gunnar Mills7e2cda22016-10-11 15:37:34 -0500295
Michael Walsh63b70c02017-10-30 15:02:09 -0500296 # Description of argument(s):
297 # key_index The index into the FFDC_OS_ALL_DISTROS_FILE dictionary.
298
299 @{ffdc_file_list}= Create List
300
301 @{cmd_list}= Get FFDC OS All Distros Call ${key_index}
Gunnar Mills7e2cda22016-10-11 15:37:34 -0500302 :FOR ${cmd} IN @{cmd_list}
Michael Walsh63b70c02017-10-30 15:02:09 -0500303 \ ${logpath}= Catenate SEPARATOR= ${LOG_PREFIX} ${cmd[0]}.txt
304 \ ${ffdc_file_sub_list}= Execute Command and Write FFDC ${cmd[0]}
305 ... ${cmd[1]} ${logpath} target=OS
306 \ ${ffdc_file_list}= Smart Combine Lists ${ffdc_file_list}
307 ... ${ffdc_file_sub_list}
308
309 [Return] ${ffdc_file_list}
Gunnar Mills7e2cda22016-10-11 15:37:34 -0500310
311
Gunnar Millscce185d2016-10-17 17:04:15 -0500312Log OS SPECIFIC DISTRO FFDC
Michael Walsh63b70c02017-10-30 15:02:09 -0500313 [Documentation] Run commands from the FFDC_OS_<distro>_FILE to create FFDC
314 ... files and return a list of generated files.
315 [Arguments] ${key_index} ${linux_distro}
Gunnar Millscce185d2016-10-17 17:04:15 -0500316
Michael Walsh63b70c02017-10-30 15:02:09 -0500317 # Description of argument(s):
318 # key_index The index into the FFDC_OS_<distro>_FILE dictionary.
319 # linux_distro Your OS's linux distro (e.g. "UBUNTU", "RHEL", etc).
320
321 @{ffdc_file_list}= Create List
322
323 @{cmd_list}= Get FFDC OS Distro Call ${key_index} ${linux_distro}
Gunnar Millscce185d2016-10-17 17:04:15 -0500324 :FOR ${cmd} IN @{cmd_list}
Michael Walsh63b70c02017-10-30 15:02:09 -0500325 \ ${logpath}= Catenate SEPARATOR= ${LOG_PREFIX} ${cmd[0]}.txt
326 \ ${ffdc_file_sub_list}= Execute Command and Write FFDC ${cmd[0]}
327 ... ${cmd[1]} ${logpath} target=OS
328 \ ${ffdc_file_list}= Smart Combine Lists ${ffdc_file_list}
329 ... ${ffdc_file_sub_list}
330
331 [Return] ${ffdc_file_list}
Gunnar Millscce185d2016-10-17 17:04:15 -0500332
333
George Keishingca8c4c62016-10-14 10:08:40 -0500334OS FFDC Files
Michael Walsh63b70c02017-10-30 15:02:09 -0500335 [Documentation] Run the commands from FFDC_OS_ALL_DISTROS_FILE to create
336 ... FFDC files and return a list of generated files.
Gunnar Millsaca140d2016-10-26 13:05:10 -0500337 [Arguments] ${OS_HOST}=${OS_HOST} ${OS_USERNAME}=${OS_USERNAME}
Michael Walsh63b70c02017-10-30 15:02:09 -0500338 ... ${OS_PASSWORD}=${OS_PASSWORD}
Gunnar Mills7e2cda22016-10-11 15:37:34 -0500339
Michael Walsh63b70c02017-10-30 15:02:09 -0500340 @{ffdc_file_list}= Create List
Gunnar Millsaca140d2016-10-26 13:05:10 -0500341
Michael Walsh63b70c02017-10-30 15:02:09 -0500342 Run Keyword If '${OS_HOST}' == '${EMPTY}' Run Keywords
343 ... Print Timen No OS Host provided so no OS FFDC will be done. AND
344 ... Return From Keyword ${ffdc_file_list}
Gunnar Millsaca140d2016-10-26 13:05:10 -0500345
Michael Walsh63b70c02017-10-30 15:02:09 -0500346 ${match_state}= Create Dictionary os_ping=^1$ os_login=^1$
347 ... os_run_cmd=^1$
348 ${status} ${ret_values}= Run Keyword and Ignore Error Check State
349 ... ${match_state} quiet=0
350
351 Run Keyword If '${status}' == 'FAIL' Run Keywords
352 ... Print Error The OS is not communicating so no OS FFDC will be done.\n
353 ... AND
354 ... Return From Keyword ${ffdc_file_list}
Gunnar Millscce185d2016-10-17 17:04:15 -0500355
Michael Walshe53e47a2017-06-30 17:03:24 -0500356 ${stdout} ${stderr} ${rc}= OS Execute Command
357 ... . /etc/os-release; echo $ID ignore_err=${0}
358 Set Global Variable ${linux_distro} ${stdout}
Gunnar Millsaca140d2016-10-26 13:05:10 -0500359
Michael Walshe53e47a2017-06-30 17:03:24 -0500360 Rpvars linux_distro
Gunnar Millsaca140d2016-10-26 13:05:10 -0500361
Michael Walsh63b70c02017-10-30 15:02:09 -0500362 @{entries}= Get FFDC OS All Distros Index
Gunnar Mills7e2cda22016-10-11 15:37:34 -0500363 :FOR ${index} IN @{entries}
Michael Walsh63b70c02017-10-30 15:02:09 -0500364 \ ${ffdc_file_sub_list}= Log OS All distros FFDC ${index}
365 \ ${ffdc_file_list}= Smart Combine Lists ${ffdc_file_list}
366 ... ${ffdc_file_sub_list}
Gunnar Millscce185d2016-10-17 17:04:15 -0500367
Jeff Whitlock7d805b22017-01-20 14:04:33 -0600368 Return From Keyword If
369 ... '${linux_distro}' == '${EMPTY}' or '${linux_distro}' == 'None'
Michael Walsh63b70c02017-10-30 15:02:09 -0500370 ... ${ffdc_file_list}
Gunnar Millscce185d2016-10-17 17:04:15 -0500371
372 @{entries}= Get ffdc os distro index ${linux_distro}
373 :FOR ${index} IN @{entries}
Michael Walsh63b70c02017-10-30 15:02:09 -0500374 \ ${ffdc_file_sub_list}= Log OS SPECIFIC DISTRO FFDC ${index}
375 ... ${linux_distro}
376 \ ${ffdc_file_list}= Smart Combine Lists ${ffdc_file_list}
377 ... ${ffdc_file_sub_list}
378
379 [Return] ${ffdc_file_list}
George Keishing7a520222017-02-27 09:44:30 -0600380
381
Steven Sombar96de5732017-08-17 09:04:52 -0500382System Inventory Files
Michael Walsh63b70c02017-10-30 15:02:09 -0500383 [Documentation] Copy systest os_inventory files and return a list of
384 ... generated files..
Steven Sombar96de5732017-08-17 09:04:52 -0500385 # The os_inventory files are the result of running
386 # systest/htx_hardbootme_test. If these files exist
387 # they are copied to the FFDC directory.
388 # Global variable ffdc_dir_path is the path name of the
389 # directory they are copied to.
Michael Walsh63b70c02017-10-30 15:02:09 -0500390
391 @{ffdc_file_list}= Create List
392
393 ${globex}= Set Variable os_inventory_*.json
394
395 @{file_list}= OperatingSystem.List Files In Directory . ${globex}
396
397 Copy Files ${globex} ${ffdc_dir_path}
398
399 : FOR ${file_name} IN @{file_list}
400 \ Append To List ${ffdc_file_list} ${ffdc_dir_path}${file_name}
401
402 Run Keyword and Ignore Error Remove Files ${globex}
403
404 [Return] ${ffdc_file_list}
Steven Sombar96de5732017-08-17 09:04:52 -0500405
406
George Keishing7a520222017-02-27 09:44:30 -0600407SCP Coredump Files
Michael Walsh63b70c02017-10-30 15:02:09 -0500408 [Documentation] Copy core dump files from BMC to local system and return a
409 ... list of generated file names.
410
411 @{ffdc_file_list}= Create List
Michael Walshe53e47a2017-06-30 17:03:24 -0500412
George Keishing7a520222017-02-27 09:44:30 -0600413 # Check if core dump exist in the /tmp
Michael Walshe53e47a2017-06-30 17:03:24 -0500414 ${core_files} ${stderr} ${rc}= BMC Execute Command ls /tmp/core_*
Michael Walsh63b70c02017-10-30 15:02:09 -0500415 ... ignore_err=${1}
416 Run Keyword If '${rc}' != '${0}' Return From Keyword ${ffdc_file_list}
417
418 @{core_list}= Split String ${core_files}
George Keishing7a520222017-02-27 09:44:30 -0600419 # Copy the core files
Michael Walsh6bad8412017-06-27 14:09:36 -0500420 Run Key U Open Connection for SCP
George Keishing7a520222017-02-27 09:44:30 -0600421 :FOR ${index} IN @{core_list}
Michael Walsh63b70c02017-10-30 15:02:09 -0500422 \ ${ffdc_file_path}= Catenate ${LOG_PREFIX}${index.lstrip("/tmp/")}
423 \ ${status}= Run Keyword and Return Status
424 ... scp.Get File ${index} ${ffdc_file_path}
425 \ Run Keyword If '${status}' == '${False}' Continue For Loop
426 \ Append To List ${ffdc_file_list} ${ffdc_file_path}
George Keishing7a520222017-02-27 09:44:30 -0600427 # Remove the file from remote to avoid re-copying on next FFDC call
Michael Walsh63b70c02017-10-30 15:02:09 -0500428 \ BMC Execute Command rm ${index} ignore_err=${1}
Michael Walshe53e47a2017-06-30 17:03:24 -0500429 # I can't find a way to do this: scp.Close Connection
George Keishing7a520222017-02-27 09:44:30 -0600430
Michael Walsh63b70c02017-10-30 15:02:09 -0500431 [Return] ${ffdc_file_list}
432
George Keishingeb7b4bc2017-03-13 12:04:28 -0500433
George Keishingeb7b4bc2017-03-13 12:04:28 -0500434Collect eSEL Log
George Keishingb1ca69b2017-03-31 14:36:42 -0500435 [Documentation] Collect eSEL log from logging entry and convert eSEL data
Gunnar Mills28e403b2017-10-25 16:16:38 -0500436 ... to elog formatted string text file.
Sridevi Rameshb180c9f2017-08-06 10:27:41 -0500437 [Arguments] ${log_prefix_path}=${LOG_PREFIX}
438
Michael Walsh63b70c02017-10-30 15:02:09 -0500439 @{ffdc_file_list}= Create List
440
George Keishingeb7b4bc2017-03-13 12:04:28 -0500441 ${resp}= OpenBMC Get Request ${BMC_LOGGING_ENTRY}/enumerate quiet=${1}
442 ${status}= Run Keyword And Return Status
443 ... Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
Michael Walsh63b70c02017-10-30 15:02:09 -0500444 Return From Keyword If '${status}' == '${False}' ${ffdc_file_list}
George Keishingeb7b4bc2017-03-13 12:04:28 -0500445
446 ${content}= To Json ${resp.content}
447 # Grab the list of entries from logging/entry/
448 # The data shown below is the result of the "Get Dictionary Keys".
449 # Example:
450 # /xyz/openbmc_project/logging/entry/1
451 # /xyz/openbmc_project/logging/entry/2
452 ${esel_list}= Get Dictionary Keys ${content['data']}
453
Sridevi Rameshb180c9f2017-08-06 10:27:41 -0500454 ${logpath}= Catenate SEPARATOR= ${log_prefix_path} esel
George Keishingeb7b4bc2017-03-13 12:04:28 -0500455 Create File ${logpath}
456 # Fetch data from /xyz/openbmc_project/logging/entry/1/attr/AdditionalData
457 # "ESEL=00 00 df 00 00 00 00 20 00 04 12 35 6f aa 00 00 "
458 # Sample eSEL entry:
459 # "/xyz/openbmc_project/logging/entry/1": {
460 # "Timestamp": 1487744317025,
461 # "AdditionalData": [
462 # "ESEL=00 00 df 00 00 00 00 20 00 04 12 35 6f aa 00 00 "
463 # ],
464 # "Message": "org.open_power.Error.Host.Event.Event",
465 # "Id": 1,
466 # "Severity": "xyz.openbmc_project.Logging.Entry.Level.Emergency"
467 # }
468
469 :FOR ${entry_path} IN @{esel_list}
George Keishing28da9482017-07-27 13:38:54 -0500470 # Skip reading attribute if entry URI is a callout.
471 # Example: /xyz/openbmc_project/logging/entry/1/callout
472 \ Continue For Loop If '${entry_path.rsplit('/', 1)[1]}' == 'callout'
George Keishingeb7b4bc2017-03-13 12:04:28 -0500473 \ ${esel_data}= Read Attribute ${entry_path} AdditionalData quiet=${1}
George Keishing6db1d362017-09-22 12:36:56 -0500474 \ ${status}= Run Keyword And Return Status
475 ... Should Contain Match ${esel_data} ESEL*
476 \ Continue For Loop If ${status} == ${False}
George Keishing28da9482017-07-27 13:38:54 -0500477 \ ${index}= Get Esel Index ${esel_data}
478 \ Write Data To File "${esel_data[${index}]}" ${logpath}
George Keishingeb7b4bc2017-03-13 12:04:28 -0500479 \ Write Data To File ${\n} ${logpath}
480
George Keishingb1ca69b2017-03-31 14:36:42 -0500481 ${out}= Run which eSEL.pl
482 ${status}= Run Keyword And Return Status
483 ... Should Contain ${out} eSEL.pl
Michael Walsh63b70c02017-10-30 15:02:09 -0500484 Return From Keyword If '${status}' == '${False}' ${ffdc_file_list}
George Keishingb1ca69b2017-03-31 14:36:42 -0500485
486 Convert eSEL To Elog Format ${logpath}
487
Michael Walsh63b70c02017-10-30 15:02:09 -0500488 Append To List ${ffdc_file_list} ${logpath}
489
490 [Return] ${ffdc_file_list}
491
George Keishingb1ca69b2017-03-31 14:36:42 -0500492
George Keishingb1ca69b2017-03-31 14:36:42 -0500493Convert eSEL To Elog Format
494 [Documentation] Execute parser tool on the eSEL data file to generate
Michael Walsha30dac72017-04-04 17:56:23 -0500495 ... formatted error log.
George Keishingb1ca69b2017-03-31 14:36:42 -0500496 [Arguments] ${esel_file_path}
Gunnar Mills28e403b2017-10-25 16:16:38 -0500497 # Description of arguments:
Michael Walsha30dac72017-04-04 17:56:23 -0500498 # esel_file_path Absolute path of the eSEL data (e.g.
499 # /tmp/w55.170404.154820.esel).
George Keishingb1ca69b2017-03-31 14:36:42 -0500500
Michael Walsha30dac72017-04-04 17:56:23 -0500501 # Note: The only way to get eSEL.pl to put the output in a particular
502 # directory is to cd to that directory.
503 ${cmd_buf}= Catenate cd $(dirname ${esel_file_path}) ; eSEL.pl -l
504 ... ${esel_file_path} -p decode_obmc_data
505 Run ${cmd_buf}
George Keishingb1ca69b2017-03-31 14:36:42 -0500506