blob: 556555b2c94a47675c6912046126cb17ec6c2a5e [file] [log] [blame]
George Keishing69e6f712016-09-12 06:30:09 -05001*** Settings ***
2Documentation Utility keywords for FFDC
3
4Library String
5Library DateTime
6Library openbmc_ffdc_list.py
7Resource resource.txt
8Resource connection_client.robot
Sweta Potthuri15e6d2f2017-02-28 03:10:02 -06009Resource utils.robot
George Keishing69e6f712016-09-12 06:30:09 -050010
11*** Variables ***
12
13${PRINT_LINE} ------------------------------------------------------------------------
14
15${MSG_INTRO} This report contains the following information:
16${MSG_DETAIL} ${\n}\t\t[ Detailed Logs Captured Section ]
17${HEADER_MSG} ${\n}\t\t---------------------------
18... ${\n}\t\t FIRST FAILURE DATA CAPTURE
19... ${\n}\t\t---------------------------
20${FOOTER_MSG} ${\n}${PRINT_LINE} ${\n}
21
22${FFDC_LOG_PATH} ${EXECDIR}${/}logs${/}
23${TEST_HISTORY} ${FFDC_LOG_PATH}${/}test_history.txt
24
25*** Keywords ***
26
27Get Test Dir and Name
28 [Documentation] SUITE_NAME and TEST_NAME are automatic variables
29 ... and is populated dynamically by the robot framework
Gunnar Millsbb398ac2016-11-14 11:50:22 -060030 ... during execution
George Keishing69e6f712016-09-12 06:30:09 -050031 ${suite_name}= Get strip string ${SUITE_NAME}
32 ${suite_name}= Catenate SEPARATOR= ${FFDC_TIME}_ ${suite_name}
33 ${test_name}= Get strip string ${TEST_NAME}
34 ${test_name}= Catenate SEPARATOR= ${FFDC_TIME}_ ${test_name}
Gunnar Millsc9ea9362016-12-13 16:21:13 -060035 [Return] ${suite_name} ${test_name}
George Keishing69e6f712016-09-12 06:30:09 -050036
37
38Create FFDC Directory
39 [Documentation] Creates directory and report file
40 Create Directory ${FFDC_DIR_PATH}
41 Create FFDC Report File
42
43
44Create FFDC Report File
45 [Documentation] Create a generic file name for ffdc
46 Set Suite Variable
Gunnar Millsaca140d2016-10-26 13:05:10 -050047 ... ${FFDC_FILE_PATH} ${FFDC_DIR_PATH}${/}${FFDC_TIME}_BMC_general.txt
George Keishing69e6f712016-09-12 06:30:09 -050048 Create File ${FFDC_FILE_PATH}
49
50
Sweta Potthuri15e6d2f2017-02-28 03:10:02 -060051Write Data To File
George Keishing69e6f712016-09-12 06:30:09 -050052 [Documentation] Write data to the ffdc report document
53 [Arguments] ${data}= ${filepath}=${FFDC_FILE_PATH}
54 Append To File ${filepath} ${data}
55
56
57Get Current Time Stamp
58 [Documentation] Get the current time stamp data
59 ${cur_time}= Get Current Date result_format=%Y-%m-%d %H:%M:%S:%f
60 ${cur_time}= Get strip string ${cur_time}
Gunnar Millsc9ea9362016-12-13 16:21:13 -060061 [Return] ${cur_time}
George Keishing69e6f712016-09-12 06:30:09 -050062
63
64Header Message
65 [Documentation] Write header message to the report document manifest.
66 ... TEST_NAME, TEST_MESSAGE,SUITE_SOURCE,TEST_DOCUMENTATION
67 ... are auto variables and are populated dynamically by the
Gunnar Millsbb398ac2016-11-14 11:50:22 -060068 ... robot framework during execution
George Keishing69e6f712016-09-12 06:30:09 -050069 ... 1. Writes opening statement headers msg
70 ... 2. Add Test setup and config information
71 ... 3. Types of data collection
72
Sweta Potthuri15e6d2f2017-02-28 03:10:02 -060073 Write Data To File ${HEADER_MSG}
74 Write Data To File ${FOOTER_MSG}
75 Write Data To File Test Suite File\t\t: ${SUITE_NAME} ${\n}
76 Write Data To File Test Case Name\t\t: ${TEST_NAME}${\n}
77 Write Data To File Test Source File\t: ${SUITE_SOURCE}${\n}
78 Write Data To File Failure Time Stamp\t: ${FFDC_TIME}${\n}
79 Write Data To File Test Error Message\t: ${TEST_MESSAGE}${\n}
80 Write Data To File Test Documentation\t:${\n}${TEST_DOCUMENTATION}${\n}
81 Write Data To File ${FOOTER_MSG}
George Keishing69e6f712016-09-12 06:30:09 -050082
83 Test Setup Info
84
Sweta Potthuri15e6d2f2017-02-28 03:10:02 -060085 Write Data To File ${\n}${MSG_INTRO}${\n}
George Keishing69e6f712016-09-12 06:30:09 -050086
87 # --- FFDC header notes ---
88 @{entries}= Get ffdc cmd index
89 :FOR ${index} IN @{entries}
Sweta Potthuri15e6d2f2017-02-28 03:10:02 -060090 \ Write Data To File * ${index.upper()}
91 \ Write Data To File ${\n}
George Keishing69e6f712016-09-12 06:30:09 -050092
Sweta Potthuri15e6d2f2017-02-28 03:10:02 -060093 Write Data To File ${MSG_DETAIL}
George Keishing69e6f712016-09-12 06:30:09 -050094
95
96Write Cmd Output to FFDC File
97 [Documentation] Write cmd output data to the report document
98 [Arguments] ${name_str} ${cmd}
99
Sweta Potthuri15e6d2f2017-02-28 03:10:02 -0600100 Write Data To File ${FOOTER_MSG}
101 Write Data To File ${ENTRY_INDEX.upper()} : ${name_str}\t
102 Write Data To File Executed : ${cmd}
103 Write Data To File ${FOOTER_MSG}
George Keishing69e6f712016-09-12 06:30:09 -0500104
105
106Test Setup Info
Gunnar Millsbb398ac2016-11-14 11:50:22 -0600107 [Documentation] BMC IP, Model and other information
George Keishing69e6f712016-09-12 06:30:09 -0500108
Sweta Potthuri15e6d2f2017-02-28 03:10:02 -0600109 Write Data To File ${\n}-----------------------${\n}
110 Write Data To File Test Setup Information:
111 Write Data To File ${\n}-----------------------${\n}
112 Write Data To File OPENBMC HOST \t: ${OPENBMC_HOST}${\n}
113 ${model_name}= Get BMC System Model
114 Write Data To File SYSTEM TYPE \t: ${model_name}