blob: 67c865dfc2d86c26cddcb0ef5760dfb20d1da53b [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 Walsh02c70602018-10-04 15:24:30 -050014Library gen_cmd.py
Michael Walshe844e9a2017-04-20 16:51:10 -050015Library gen_robot_keyword.py
Sweta Potthuria82efd62017-10-18 05:34:59 -050016Library dump_utils.py
Michael Walsh02c70602018-10-04 15:24:30 -050017Library logging_utils.py
Gunnar Mills7e2cda22016-10-11 15:37:34 -050018
George Keishing69e6f712016-09-12 06:30:09 -050019*** Keywords ***
20
George Keishing69e6f712016-09-12 06:30:09 -050021# Method : Call FFDC Methods #
22# Execute the user define keywords from the FFDC List #
23# Unlike any other keywords this will call into the #
24# list of keywords defined in the FFDC list at one go #
George Keishing69e6f712016-09-12 06:30:09 -050025
26Call FFDC Methods
Michael Walshe844e9a2017-04-20 16:51:10 -050027 [Documentation] Call into FFDC Keyword index list.
28 [Arguments] ${ffdc_function_list}=${EMPTY}
George Keishing69e6f712016-09-12 06:30:09 -050029
Michael Walshe844e9a2017-04-20 16:51:10 -050030 # Description of argument(s):
31 # ffdc_function_list A colon-delimited list naming the kinds of FFDC that
Michael Walsh63b70c02017-10-30 15:02:09 -050032 # are to be collected
Michael Walshe844e9a2017-04-20 16:51:10 -050033 # (e.g. "FFDC Generic Report:BMC Specific Files").
34 # Acceptable values can be found in the description
35 # field of FFDC_METHOD_CALL in
36 # lib/openbmc_ffdc_list.py. Those values can be
37 # obtained via a call to 'Get FFDC Method Desc' (also
38 # from lib/openbmc_ffdc_list.py).
39
40 @{entries}= Get FFDC Method Index
Michael Walsh63b70c02017-10-30 15:02:09 -050041 # Example entries:
42 # entries:
43 # entries[0]: BMC LOGS
44
45 @{ffdc_file_list}= Create List
Michael Walshe844e9a2017-04-20 16:51:10 -050046 :FOR ${index} IN @{entries}
Michael Walsh63b70c02017-10-30 15:02:09 -050047 \ ${ffdc_file_sub_list}= Method Call Keyword List ${index}
48 ... ${ffdc_function_list}
49 \ ${ffdc_file_list}= Smart Combine Lists ${ffdc_file_list}
50 ... ${ffdc_file_sub_list}
51
Michael Walsh6bad8412017-06-27 14:09:36 -050052 Run Key U SSHLibrary.Close All Connections
George Keishing69e6f712016-09-12 06:30:09 -050053
Michael Walsh63b70c02017-10-30 15:02:09 -050054 [Return] ${ffdc_file_list}
55
George Keishing69e6f712016-09-12 06:30:09 -050056Method Call Keyword List
Michael Walsh63b70c02017-10-30 15:02:09 -050057 [Documentation] Process FFDC request and return a list of generated files.
Michael Walshe844e9a2017-04-20 16:51:10 -050058 [Arguments] ${index} ${ffdc_function_list}=${EMPTY}
George Keishing69e6f712016-09-12 06:30:09 -050059
Michael Walshe844e9a2017-04-20 16:51:10 -050060 # Description of argument(s):
61 # index The index into the FFDC_METHOD_CALL dictionary (e.g.
62 # 'BMC LOGS').
63 # ffdc_function_list See ffdc_function_list description in
64 # "Call FFDC Methods" (above).
65
Michael Walsh63b70c02017-10-30 15:02:09 -050066 @{method_list}= Get FFDC Method Call ${index}
67 # Example method_list:
68 # method_list:
69 # method_list[0]:
70 # method_list[0][0]: FFDC Generic Report
71 # method_list[0][1]: BMC FFDC Manifest
72 # method_list[1]:
73 # method_list[1][0]: Get Request FFDC
74 # method_list[1][1]: BMC FFDC Get Requests
75 # (etc.)
Michael Walshe844e9a2017-04-20 16:51:10 -050076
77 # If function list is empty assign default (i.e. a list of all allowable
78 # values). In either case, convert ffdc_function_list from a string to
79 # a list.
80 @{ffdc_function_list}=
81 ... Run Keyword If '${ffdc_function_list}' == '${EMPTY}'
82 ... Get FFDC Method Desc ${index}
83 ... ELSE
84 ... Split String ${ffdc_function_list} separator=:
85
Michael Walsh63b70c02017-10-30 15:02:09 -050086 @{ffdc_file_list}= Create List
George Keishing69e6f712016-09-12 06:30:09 -050087 :FOR ${method} IN @{method_list}
Michael Walsh63b70c02017-10-30 15:02:09 -050088 \ ${ffdc_file_sub_list}= Execute Keyword Method ${method[0]}
89 ... ${method[1]} @{ffdc_function_list}
90 \ ${ffdc_file_list}= Smart Combine Lists ${ffdc_file_list}
91 ... ${ffdc_file_sub_list}
92
93 [Return] ${ffdc_file_list}
94
George Keishing69e6f712016-09-12 06:30:09 -050095
96Execute Keyword Method
Michael Walshe844e9a2017-04-20 16:51:10 -050097 [Documentation] Call into BMC method keywords. Don't let one
98 ... failure skip the remaining. Get whatever data
99 ... it could gather at worse case scenario.
100 [Arguments] ${description} ${keyword_name} @{ffdc_function_list}
George Keishing69e6f712016-09-12 06:30:09 -0500101
Michael Walshe844e9a2017-04-20 16:51:10 -0500102 # Description of argument(s):
103 # description The description of the FFDC to be collected. This
104 # would be any value returned by
105 # 'Get FFDC Method Desc' (e.g. "FFDC Generic Report").
106 # keyword_name The name of the keyword to call to collect the FFDC
107 # data (again, see FFDC_METHOD_CALL).
108 # ffdc_function_list See ffdc_function_list description in
109 # "Call FFDC Methods" (above). The only difference is
110 # in this case, it should be a list rather than a
111 # colon-delimited value.
George Keishing69e6f712016-09-12 06:30:09 -0500112
Michael Walsh63b70c02017-10-30 15:02:09 -0500113 @{ffdc_file_list}= Create List
Michael Walshe844e9a2017-04-20 16:51:10 -0500114
Michael Walsh63b70c02017-10-30 15:02:09 -0500115 ${index}= Get Index From List ${ffdc_function_list} ${description}
116 Run Keyword If '${index}' == '${-1}' Return from Keyword
117 ... ${ffdc_file_list}
118
119 ${status} ${ffdc_file_list}= Run Key ${keyword_name} ignore=1
120 [Return] ${ffdc_file_list}
George Keishing69e6f712016-09-12 06:30:09 -0500121
George Keishing69e6f712016-09-12 06:30:09 -0500122# Method : BMC FFDC Manifest #
123# Execute command on BMC and write to ffdc_report.txt #
George Keishing69e6f712016-09-12 06:30:09 -0500124
125BMC FFDC Manifest
Michael Walsh63b70c02017-10-30 15:02:09 -0500126 [Documentation] Run the ssh commands from FFDC_BMC_CMD and return a list
127 ... of generated files.
George Keishing69e6f712016-09-12 06:30:09 -0500128
Michael Walsh63b70c02017-10-30 15:02:09 -0500129 @{ffdc_file_list}= Create List ${FFDC_FILE_PATH}
130 @{entries}= Get FFDC Cmd Index
131 :FOR ${index} IN @{entries}
132 \ Iterate BMC Command List Pairs ${index}
133
134 [Return] ${ffdc_file_list}
George Keishing69e6f712016-09-12 06:30:09 -0500135
136
137Iterate BMC Command List Pairs
138 [Documentation] Feed in key pair list from dictionary to execute
139 [Arguments] ${key_index}
140
141 @{cmd_list}= Get ffdc bmc cmd ${key_index}
142 Set Suite Variable ${ENTRY_INDEX} ${key_index}
143 :FOR ${cmd} IN @{cmd_list}
144 \ Execute Command and Write FFDC ${cmd[0]} ${cmd[1]}
145
146
147Execute Command and Write FFDC
Michael Walsh63b70c02017-10-30 15:02:09 -0500148 [Documentation] Run a command on the BMC or OS, write the output to the
149 ... specified file and return a list of generated files.
150 [Arguments] ${key_index} ${cmd} ${logpath}=${FFDC_FILE_PATH}
151 ... ${target}=BMC
George Keishing69e6f712016-09-12 06:30:09 -0500152
Michael Walsh63b70c02017-10-30 15:02:09 -0500153 Run Keyword If '${logpath}' == '${FFDC_FILE_PATH}'
154 ... Write Cmd Output to FFDC File ${key_index} ${cmd}
155
156 @{ffdc_file_list}= Create List ${log_path}
George Keishing69e6f712016-09-12 06:30:09 -0500157
Michael Walshe53e47a2017-06-30 17:03:24 -0500158 ${cmd_buf}= Catenate ${target} Execute Command \ ${cmd} \ ignore_err=${1}
159 ${status} ${ret_values}= Run Key ${cmd_buf} ignore=${1}
160
161 ${stdout}= Set Variable @{ret_values}[0]
162 ${stderr}= Set Variable @{ret_values}[1]
George Keishing69e6f712016-09-12 06:30:09 -0500163
Jeff Whitlock7d805b22017-01-20 14:04:33 -0600164 # Write stdout on success and stderr/stdout to the file on failure.
165 Run Keyword If $stderr == '${EMPTY}'
Sweta Potthuri15e6d2f2017-02-28 03:10:02 -0600166 ... Write Data To File ${stdout}${\n} ${logpath}
167 ... ELSE Write Data To File
Jeff Whitlock7d805b22017-01-20 14:04:33 -0600168 ... ERROR output:${\n}${stderr}${\n}Output:${\n}${stdout}${\n}
169 ... ${logpath}
George Keishing69e6f712016-09-12 06:30:09 -0500170
Michael Walsh63b70c02017-10-30 15:02:09 -0500171 [Return] ${ffdc_file_list}
172
George Keishing69e6f712016-09-12 06:30:09 -0500173
George Keishing69e6f712016-09-12 06:30:09 -0500174# Method : BMC FFDC Files #
175# Execute command on BMC and write to individual file #
176# based on the file name pre-defined in the list #
George Keishing69e6f712016-09-12 06:30:09 -0500177
178BMC FFDC Files
Michael Walsh63b70c02017-10-30 15:02:09 -0500179 [Documentation] Run the commands from FFDC_BMC_FILE and return a list of
180 ... generated files.
181
182 @{entries}= Get FFDC File Index
183 # Example of entries:
184 # entries:
185 # entries[0]: BMC FILES
186
187 @{ffdc_file_list}= Create List
188 :FOR ${index} IN @{entries}
189 \ ${ffdc_file_sub_list}= Create File and Write Data ${index}
190 \ ${ffdc_file_list}= Smart Combine Lists ${ffdc_file_list}
191 ... ${ffdc_file_sub_list}
192
193 [Return] ${ffdc_file_list}
George Keishing69e6f712016-09-12 06:30:09 -0500194
195
196Create File and Write Data
Michael Walsh63b70c02017-10-30 15:02:09 -0500197 [Documentation] Run commands from FFDC_BMC_FILE to create FFDC files and
198 ... return a list of generated files.
199 [Arguments] ${key_index}
George Keishing69e6f712016-09-12 06:30:09 -0500200
Michael Walsh63b70c02017-10-30 15:02:09 -0500201 # Description of argument(s):
202 # key_index The index into the FFDC_BMC_FILE dictionary.
203
204 @{ffdc_file_list}= Create List
205 @{cmd_list}= Get FFDC BMC File ${key_index}
George Keishing69e6f712016-09-12 06:30:09 -0500206 :FOR ${cmd} IN @{cmd_list}
Michael Walsh63b70c02017-10-30 15:02:09 -0500207 \ ${logpath}= Catenate SEPARATOR= ${LOG_PREFIX} ${cmd[0]}.txt
208 \ ${ffdc_file_sub_list}= Execute Command and Write FFDC ${cmd[0]}
209 ... ${cmd[1]} ${logpath}
210 \ ${ffdc_file_list}= Smart Combine Lists ${ffdc_file_list}
211 ... ${ffdc_file_sub_list}
Sivas SRR0d657e82017-03-13 01:00:34 -0500212
Michael Walsh63b70c02017-10-30 15:02:09 -0500213 [Return] ${ffdc_file_list}
George Keishing69e6f712016-09-12 06:30:09 -0500214
215
George Keishing69e6f712016-09-12 06:30:09 -0500216# Method : Log Test Case Status #
217# Creates test result history footprint for reference #
George Keishing69e6f712016-09-12 06:30:09 -0500218
219Log Test Case Status
Jeff Whitlock7d805b22017-01-20 14:04:33 -0600220 [Documentation] Test case execution result history.
221 ... Create once and append to this file
222 ... logs/test_history.txt
223 ... Format Date:Test suite:Test case:Status
224 ... 20160909214053719992:Test Warmreset:Test WarmReset via REST:FAIL
Michael Walshfa9f70f2017-04-21 16:00:18 -0500225
226 ${FFDC_DIR_PATH_STYLE}= Get Variable Value ${FFDC_DIR_PATH_STYLE}
227 ... ${EMPTY}
228 ${FFDC_DIR_PATH}= Get Variable Value ${FFDC_DIR_PATH} ${EMPTY}
229
230 Run Keyword If '${FFDC_DIR_PATH}' == '${EMPTY}' Set FFDC Defaults
231
232 Run Keyword If '${FFDC_DIR_PATH_STYLE}' == '${1}' Run Keywords
233 ... Set Global Variable ${FFDC_LOG_PATH} ${FFDC_DIR_PATH} AND
234 ... Set Global Variable ${TEST_HISTORY} ${FFDC_DIR_PATH}test_history.txt
235
George Keishing69e6f712016-09-12 06:30:09 -0500236 Create Directory ${FFDC_LOG_PATH}
237
238 ${exist}= Run Keyword and Return Status
239 ... OperatingSystem.File Should Exist ${TEST_HISTORY}
240
241 Run Keyword If '${exist}' == '${False}'
242 ... Create File ${TEST_HISTORY}
243
Michael Walshfa9f70f2017-04-21 16:00:18 -0500244 Rpvars TEST_HISTORY
245
George Keishing69e6f712016-09-12 06:30:09 -0500246 ${cur_time}= Get Current Time Stamp
247
248 Append To File ${TEST_HISTORY}
249 ... ${cur_time}:${SUITE_NAME}:${TEST_NAME}:${TEST_STATUS}${\n}
250
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500251
252Log FFDC Get Requests
Michael Walsh63b70c02017-10-30 15:02:09 -0500253 [Documentation] Run the get requests associated with the key and return a
254 ... list of generated files.
255 [Arguments] ${key_index}
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500256
Michael Walsh63b70c02017-10-30 15:02:09 -0500257 # Note: Output will be in JSON pretty_print format.
258
259 # Description of argument(s):
260 # key_index The key to the FFDC_GET_REQUEST dictionary that contains the
261 # get requests that are to be run.
262
263 @{ffdc_file_list}= Create List
264 @{cmd_list}= Get FFDC Get Request ${key_index}
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500265 :FOR ${cmd} IN @{cmd_list}
Michael Walsh63b70c02017-10-30 15:02:09 -0500266 \ ${logpath}= Catenate SEPARATOR= ${LOG_PREFIX} ${cmd[0]}.txt
267 \ ${resp}= OpenBMC Get Request ${cmd[1]} quiet=${1}
268 \ ${status}= Run Keyword and Return Status
269 ... Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
270 \ Run Keyword If '${status}' == '${False}' Continue For Loop
271 \ ${jsondata}= to json ${resp.content} pretty_print=True
272 \ Write Data To File ${\n}${jsondata}${\n} ${logpath}
273 \ Append To List ${ffdc_file_list} ${logpath}
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500274
Michael Walsh63b70c02017-10-30 15:02:09 -0500275 [Return] ${ffdc_file_list}
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500276
277BMC FFDC Get Requests
Michael Walsh63b70c02017-10-30 15:02:09 -0500278 [Documentation] Iterate over get request list and return a list of
279 ... generated files.
280
281 @{ffdc_file_list}= Create List
282
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500283 @{entries}= Get ffdc get request index
Michael Walsh63b70c02017-10-30 15:02:09 -0500284 # Example of entries:
285 # entries:
286 # entries[0]: GET REQUESTS
Gunnar Millsa812e0f2016-09-29 20:30:03 -0500287 :FOR ${index} IN @{entries}
Michael Walsh63b70c02017-10-30 15:02:09 -0500288 \ ${ffdc_file_sub_list}= Log FFDC Get Requests ${index}
289 \ ${ffdc_file_list}= Smart Combine Lists ${ffdc_file_list}
290 ... ${ffdc_file_sub_list}
Gunnar Mills7e2cda22016-10-11 15:37:34 -0500291
Michael Walsh63b70c02017-10-30 15:02:09 -0500292 [Return] ${ffdc_file_list}
Gunnar Mills7e2cda22016-10-11 15:37:34 -0500293
Michael Walsh63b70c02017-10-30 15:02:09 -0500294Log OS All distros FFDC
295 [Documentation] Run commands from FFDC_OS_ALL_DISTROS_FILE to create FFDC
296 ... files and return a list of generated files.
297 [Arguments] ${key_index}
Gunnar Mills7e2cda22016-10-11 15:37:34 -0500298
Michael Walsh63b70c02017-10-30 15:02:09 -0500299 # Description of argument(s):
300 # key_index The index into the FFDC_OS_ALL_DISTROS_FILE dictionary.
301
302 @{ffdc_file_list}= Create List
303
304 @{cmd_list}= Get FFDC OS All Distros Call ${key_index}
Gunnar Mills7e2cda22016-10-11 15:37:34 -0500305 :FOR ${cmd} IN @{cmd_list}
Michael Walsh63b70c02017-10-30 15:02:09 -0500306 \ ${logpath}= Catenate SEPARATOR= ${LOG_PREFIX} ${cmd[0]}.txt
307 \ ${ffdc_file_sub_list}= Execute Command and Write FFDC ${cmd[0]}
308 ... ${cmd[1]} ${logpath} target=OS
309 \ ${ffdc_file_list}= Smart Combine Lists ${ffdc_file_list}
310 ... ${ffdc_file_sub_list}
311
312 [Return] ${ffdc_file_list}
Gunnar Mills7e2cda22016-10-11 15:37:34 -0500313
314
Gunnar Millscce185d2016-10-17 17:04:15 -0500315Log OS SPECIFIC DISTRO FFDC
Michael Walsh63b70c02017-10-30 15:02:09 -0500316 [Documentation] Run commands from the FFDC_OS_<distro>_FILE to create FFDC
317 ... files and return a list of generated files.
318 [Arguments] ${key_index} ${linux_distro}
Gunnar Millscce185d2016-10-17 17:04:15 -0500319
Michael Walsh63b70c02017-10-30 15:02:09 -0500320 # Description of argument(s):
321 # key_index The index into the FFDC_OS_<distro>_FILE dictionary.
322 # linux_distro Your OS's linux distro (e.g. "UBUNTU", "RHEL", etc).
323
324 @{ffdc_file_list}= Create List
325
326 @{cmd_list}= Get FFDC OS Distro Call ${key_index} ${linux_distro}
Gunnar Millscce185d2016-10-17 17:04:15 -0500327 :FOR ${cmd} IN @{cmd_list}
Michael Walsh63b70c02017-10-30 15:02:09 -0500328 \ ${logpath}= Catenate SEPARATOR= ${LOG_PREFIX} ${cmd[0]}.txt
329 \ ${ffdc_file_sub_list}= Execute Command and Write FFDC ${cmd[0]}
330 ... ${cmd[1]} ${logpath} target=OS
331 \ ${ffdc_file_list}= Smart Combine Lists ${ffdc_file_list}
332 ... ${ffdc_file_sub_list}
333
334 [Return] ${ffdc_file_list}
Gunnar Millscce185d2016-10-17 17:04:15 -0500335
336
George Keishingca8c4c62016-10-14 10:08:40 -0500337OS FFDC Files
Michael Walsh63b70c02017-10-30 15:02:09 -0500338 [Documentation] Run the commands from FFDC_OS_ALL_DISTROS_FILE to create
339 ... FFDC files and return a list of generated files.
Gunnar Millsaca140d2016-10-26 13:05:10 -0500340 [Arguments] ${OS_HOST}=${OS_HOST} ${OS_USERNAME}=${OS_USERNAME}
Michael Walsh63b70c02017-10-30 15:02:09 -0500341 ... ${OS_PASSWORD}=${OS_PASSWORD}
Gunnar Mills7e2cda22016-10-11 15:37:34 -0500342
Michael Walsh63b70c02017-10-30 15:02:09 -0500343 @{ffdc_file_list}= Create List
Gunnar Millsaca140d2016-10-26 13:05:10 -0500344
Michael Walsh63b70c02017-10-30 15:02:09 -0500345 Run Keyword If '${OS_HOST}' == '${EMPTY}' Run Keywords
346 ... Print Timen No OS Host provided so no OS FFDC will be done. AND
347 ... Return From Keyword ${ffdc_file_list}
Gunnar Millsaca140d2016-10-26 13:05:10 -0500348
Michael Walsh63b70c02017-10-30 15:02:09 -0500349 ${match_state}= Create Dictionary os_ping=^1$ os_login=^1$
350 ... os_run_cmd=^1$
351 ${status} ${ret_values}= Run Keyword and Ignore Error Check State
352 ... ${match_state} quiet=0
353
354 Run Keyword If '${status}' == 'FAIL' Run Keywords
Michael Walshc3b28d72017-11-16 10:43:14 -0600355 ... Print Timen The OS is not communicating so no OS FFDC will be done.\n
Michael Walsh63b70c02017-10-30 15:02:09 -0500356 ... AND
357 ... Return From Keyword ${ffdc_file_list}
Gunnar Millscce185d2016-10-17 17:04:15 -0500358
Michael Walshe53e47a2017-06-30 17:03:24 -0500359 ${stdout} ${stderr} ${rc}= OS Execute Command
360 ... . /etc/os-release; echo $ID ignore_err=${0}
361 Set Global Variable ${linux_distro} ${stdout}
Gunnar Millsaca140d2016-10-26 13:05:10 -0500362
Michael Walshe53e47a2017-06-30 17:03:24 -0500363 Rpvars linux_distro
Gunnar Millsaca140d2016-10-26 13:05:10 -0500364
Michael Walsh63b70c02017-10-30 15:02:09 -0500365 @{entries}= Get FFDC OS All Distros Index
Gunnar Mills7e2cda22016-10-11 15:37:34 -0500366 :FOR ${index} IN @{entries}
Michael Walsh63b70c02017-10-30 15:02:09 -0500367 \ ${ffdc_file_sub_list}= Log OS All distros FFDC ${index}
368 \ ${ffdc_file_list}= Smart Combine Lists ${ffdc_file_list}
369 ... ${ffdc_file_sub_list}
Gunnar Millscce185d2016-10-17 17:04:15 -0500370
Jeff Whitlock7d805b22017-01-20 14:04:33 -0600371 Return From Keyword If
372 ... '${linux_distro}' == '${EMPTY}' or '${linux_distro}' == 'None'
Michael Walsh63b70c02017-10-30 15:02:09 -0500373 ... ${ffdc_file_list}
Gunnar Millscce185d2016-10-17 17:04:15 -0500374
375 @{entries}= Get ffdc os distro index ${linux_distro}
376 :FOR ${index} IN @{entries}
Michael Walsh63b70c02017-10-30 15:02:09 -0500377 \ ${ffdc_file_sub_list}= Log OS SPECIFIC DISTRO FFDC ${index}
378 ... ${linux_distro}
379 \ ${ffdc_file_list}= Smart Combine Lists ${ffdc_file_list}
380 ... ${ffdc_file_sub_list}
381
382 [Return] ${ffdc_file_list}
George Keishing7a520222017-02-27 09:44:30 -0600383
384
Steven Sombar96de5732017-08-17 09:04:52 -0500385System Inventory Files
Michael Walsh63b70c02017-10-30 15:02:09 -0500386 [Documentation] Copy systest os_inventory files and return a list of
387 ... generated files..
Steven Sombar96de5732017-08-17 09:04:52 -0500388 # The os_inventory files are the result of running
389 # systest/htx_hardbootme_test. If these files exist
390 # they are copied to the FFDC directory.
391 # Global variable ffdc_dir_path is the path name of the
392 # directory they are copied to.
Michael Walsh63b70c02017-10-30 15:02:09 -0500393
394 @{ffdc_file_list}= Create List
395
396 ${globex}= Set Variable os_inventory_*.json
397
398 @{file_list}= OperatingSystem.List Files In Directory . ${globex}
399
400 Copy Files ${globex} ${ffdc_dir_path}
401
402 : FOR ${file_name} IN @{file_list}
403 \ Append To List ${ffdc_file_list} ${ffdc_dir_path}${file_name}
404
405 Run Keyword and Ignore Error Remove Files ${globex}
406
407 [Return] ${ffdc_file_list}
Steven Sombar96de5732017-08-17 09:04:52 -0500408
409
George Keishing7a520222017-02-27 09:44:30 -0600410SCP Coredump Files
Michael Walsh63b70c02017-10-30 15:02:09 -0500411 [Documentation] Copy core dump files from BMC to local system and return a
412 ... list of generated file names.
413
414 @{ffdc_file_list}= Create List
Michael Walshe53e47a2017-06-30 17:03:24 -0500415
George Keishing7a520222017-02-27 09:44:30 -0600416 # Check if core dump exist in the /tmp
Michael Walshe53e47a2017-06-30 17:03:24 -0500417 ${core_files} ${stderr} ${rc}= BMC Execute Command ls /tmp/core_*
Michael Walsh63b70c02017-10-30 15:02:09 -0500418 ... ignore_err=${1}
419 Run Keyword If '${rc}' != '${0}' Return From Keyword ${ffdc_file_list}
420
421 @{core_list}= Split String ${core_files}
George Keishing7a520222017-02-27 09:44:30 -0600422 # Copy the core files
Michael Walsh6bad8412017-06-27 14:09:36 -0500423 Run Key U Open Connection for SCP
George Keishing7a520222017-02-27 09:44:30 -0600424 :FOR ${index} IN @{core_list}
Michael Walsh63b70c02017-10-30 15:02:09 -0500425 \ ${ffdc_file_path}= Catenate ${LOG_PREFIX}${index.lstrip("/tmp/")}
426 \ ${status}= Run Keyword and Return Status
427 ... scp.Get File ${index} ${ffdc_file_path}
428 \ Run Keyword If '${status}' == '${False}' Continue For Loop
429 \ Append To List ${ffdc_file_list} ${ffdc_file_path}
George Keishing7a520222017-02-27 09:44:30 -0600430 # Remove the file from remote to avoid re-copying on next FFDC call
Michael Walsh63b70c02017-10-30 15:02:09 -0500431 \ BMC Execute Command rm ${index} ignore_err=${1}
Michael Walshe53e47a2017-06-30 17:03:24 -0500432 # I can't find a way to do this: scp.Close Connection
George Keishing7a520222017-02-27 09:44:30 -0600433
Michael Walsh63b70c02017-10-30 15:02:09 -0500434 [Return] ${ffdc_file_list}
435
Sweta Potthuria82efd62017-10-18 05:34:59 -0500436SCP Dump Files
437 [Documentation] Copy all dump files from BMC to local system.
438
439 # Check if dumps exist
440 ${ffdc_file_list}= Scp Dumps ${FFDC_DIR_PATH} ${FFDC_PREFIX}
441
442 [Return] ${ffdc_file_list}
443
444Collect Dump Log
445 [Documentation] Collect dumps from dump entry.
446 [Arguments] ${log_prefix_path}=${LOG_PREFIX}
447
448 ${data}= Read Properties ${DUMP_ENTRY_URI}/enumerate quiet=${1}
449
450 # Grab the list of entries from dump/entry/
451 # The data shown below is the result of the "Get Dictionary Keys".
452 # Example:
453 # /xyz/openbmc_project/dump/entry/1
454 # /xyz/openbmc_project/dump/entry/2
455
456 ${dump_list}= Get Dictionary Keys ${data}
George Keishingeb7b4bc2017-03-13 12:04:28 -0500457
Michael Walsh02c70602018-10-04 15:24:30 -0500458
George Keishingeb7b4bc2017-03-13 12:04:28 -0500459Collect eSEL Log
Michael Walsh02c70602018-10-04 15:24:30 -0500460 [Documentation] Create raw and formatted eSEL files.
Sridevi Rameshb180c9f2017-08-06 10:27:41 -0500461 [Arguments] ${log_prefix_path}=${LOG_PREFIX}
462
Michael Walsh02c70602018-10-04 15:24:30 -0500463 # NOTE: If no eSEL.pl program can be located, then no formatted eSEL file
464 # will be generated.
465
466 # Description of argument(s):
467 # log_prefix_path The path prefix to be used in creating
468 # eSEL file path names. For example, if
469 # log_prefix_path is
470 # "/tmp/user1/dummy.181001.120000.", then
471 # this keyword will create
472 # /tmp/user1/dummy.181001.120000.esel (raw)
473 # and
474 # /tmp/user1/dummy.181001.120000.esel.txt
475 # (formatted).
476
Michael Walsh63b70c02017-10-30 15:02:09 -0500477 @{ffdc_file_list}= Create List
478
Michael Walsh02c70602018-10-04 15:24:30 -0500479 ${esels}= Get Esels
480 ${num_esels}= Evaluate len(${esels})
481 Rprint Vars num_esels
482 Return From Keyword If ${num_esels} == ${0} ${ffdc_file_list}
George Keishingeb7b4bc2017-03-13 12:04:28 -0500483
Sridevi Rameshb180c9f2017-08-06 10:27:41 -0500484 ${logpath}= Catenate SEPARATOR= ${log_prefix_path} esel
George Keishingeb7b4bc2017-03-13 12:04:28 -0500485 Create File ${logpath}
George Keishingeb7b4bc2017-03-13 12:04:28 -0500486
Michael Walsh02c70602018-10-04 15:24:30 -0500487 :FOR ${esel} IN @{esels}
488 \ Write Data To File "${esel}"${\n} ${logpath}
George Keishingb1ca69b2017-03-31 14:36:42 -0500489
Michael Walsh63b70c02017-10-30 15:02:09 -0500490 Append To List ${ffdc_file_list} ${logpath}
Michael Walsh02c70602018-10-04 15:24:30 -0500491
492 ${rc} ${output}= Shell Cmd which eSEL.pl show_err=0
493 Return From Keyword If ${rc} != ${0} ${ffdc_file_list}
494
495 Convert eSEL To Elog Format ${logpath}
Michael Walsh0192e9b2017-11-14 15:14:15 -0600496 Append To List ${ffdc_file_list} ${logpath}.txt
Michael Walsh63b70c02017-10-30 15:02:09 -0500497
498 [Return] ${ffdc_file_list}
499
George Keishingb1ca69b2017-03-31 14:36:42 -0500500
George Keishingb1ca69b2017-03-31 14:36:42 -0500501Convert eSEL To Elog Format
502 [Documentation] Execute parser tool on the eSEL data file to generate
Michael Walsha30dac72017-04-04 17:56:23 -0500503 ... formatted error log.
George Keishingb1ca69b2017-03-31 14:36:42 -0500504 [Arguments] ${esel_file_path}
Michael Walsh02c70602018-10-04 15:24:30 -0500505 # Description of argument(s):
506 # esel_file_path The path to the file containg raw eSEL
507 # data (e.g.
508 # "/tmp/user1/dummy.181001.120000.esel").
George Keishingb1ca69b2017-03-31 14:36:42 -0500509
Michael Walsha30dac72017-04-04 17:56:23 -0500510 # Note: The only way to get eSEL.pl to put the output in a particular
511 # directory is to cd to that directory.
512 ${cmd_buf}= Catenate cd $(dirname ${esel_file_path}) ; eSEL.pl -l
513 ... ${esel_file_path} -p decode_obmc_data
Michael Walsh02c70602018-10-04 15:24:30 -0500514 Qprint Issuing ${cmd_buf}
Michael Walsha30dac72017-04-04 17:56:23 -0500515 Run ${cmd_buf}
Michael Walsh02c70602018-10-04 15:24:30 -0500516 # The .binary file, which is generated by eSEL.pl, is of no use to us.
517 Remove File ${esel_file_path}.binary