blob: 1eba96945afd70e3d8aed2c43d113a60925f358b [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
9
10*** Variables ***
11
12${PRINT_LINE} ------------------------------------------------------------------------
13
14${MSG_INTRO} This report contains the following information:
15${MSG_DETAIL} ${\n}\t\t[ Detailed Logs Captured Section ]
16${HEADER_MSG} ${\n}\t\t---------------------------
17... ${\n}\t\t FIRST FAILURE DATA CAPTURE
18... ${\n}\t\t---------------------------
19${FOOTER_MSG} ${\n}${PRINT_LINE} ${\n}
20
21${FFDC_LOG_PATH} ${EXECDIR}${/}logs${/}
22${TEST_HISTORY} ${FFDC_LOG_PATH}${/}test_history.txt
23
24*** Keywords ***
25
26Get Test Dir and Name
27 [Documentation] SUITE_NAME and TEST_NAME are automatic variables
28 ... and is populated dynamically by the robot framework
Gunnar Millsbb398ac2016-11-14 11:50:22 -060029 ... during execution
George Keishing69e6f712016-09-12 06:30:09 -050030 ${suite_name}= Get strip string ${SUITE_NAME}
31 ${suite_name}= Catenate SEPARATOR= ${FFDC_TIME}_ ${suite_name}
32 ${test_name}= Get strip string ${TEST_NAME}
33 ${test_name}= Catenate SEPARATOR= ${FFDC_TIME}_ ${test_name}
34 [return] ${suite_name} ${test_name}
35
36
37Create FFDC Directory
38 [Documentation] Creates directory and report file
39 Create Directory ${FFDC_DIR_PATH}
40 Create FFDC Report File
41
42
43Create FFDC Report File
44 [Documentation] Create a generic file name for ffdc
45 Set Suite Variable
Gunnar Millsaca140d2016-10-26 13:05:10 -050046 ... ${FFDC_FILE_PATH} ${FFDC_DIR_PATH}${/}${FFDC_TIME}_BMC_general.txt
George Keishing69e6f712016-09-12 06:30:09 -050047 Create File ${FFDC_FILE_PATH}
48
49
50Write Data to File
51 [Documentation] Write data to the ffdc report document
52 [Arguments] ${data}= ${filepath}=${FFDC_FILE_PATH}
53 Append To File ${filepath} ${data}
54
55
56Get Current Time Stamp
57 [Documentation] Get the current time stamp data
58 ${cur_time}= Get Current Date result_format=%Y-%m-%d %H:%M:%S:%f
59 ${cur_time}= Get strip string ${cur_time}
60 [return] ${cur_time}
61
62
63Header Message
64 [Documentation] Write header message to the report document manifest.
65 ... TEST_NAME, TEST_MESSAGE,SUITE_SOURCE,TEST_DOCUMENTATION
66 ... are auto variables and are populated dynamically by the
Gunnar Millsbb398ac2016-11-14 11:50:22 -060067 ... robot framework during execution
George Keishing69e6f712016-09-12 06:30:09 -050068 ... 1. Writes opening statement headers msg
69 ... 2. Add Test setup and config information
70 ... 3. Types of data collection
71
72 Write Data to File ${HEADER_MSG}
73 Write Data to File ${FOOTER_MSG}
74 Write Data to File Test Suite File\t\t: ${SUITE_NAME} ${\n}
75 Write Data to File Test Case Name\t\t: ${TEST_NAME}${\n}
76 Write Data to File Test Source File\t: ${SUITE_SOURCE}${\n}
77 Write Data to File Failure Time Stamp\t: ${FFDC_TIME}${\n}
78 Write Data to File Test Error Message\t: ${TEST_MESSAGE}${\n}
79 Write Data to File Test Documentation\t:${\n}${TEST_DOCUMENTATION}${\n}
80 Write Data to File ${FOOTER_MSG}
81
82 Test Setup Info
83
84 Write Data to File ${\n}${MSG_INTRO}${\n}
85
86 # --- FFDC header notes ---
87 @{entries}= Get ffdc cmd index
88 :FOR ${index} IN @{entries}
89 \ Write Data to File * ${index.upper()}
90 \ Write Data to File ${\n}
91
92 Write Data to File ${MSG_DETAIL}
93
94
95Write Cmd Output to FFDC File
96 [Documentation] Write cmd output data to the report document
97 [Arguments] ${name_str} ${cmd}
98
99 Write Data to File ${FOOTER_MSG}
100 Write Data to File ${ENTRY_INDEX.upper()} : ${name_str}\t
101 Write Data to File Executed : ${cmd}
102 Write Data to File ${FOOTER_MSG}
103
104
105Test Setup Info
Gunnar Millsbb398ac2016-11-14 11:50:22 -0600106 [Documentation] BMC IP, Model and other information
George Keishing69e6f712016-09-12 06:30:09 -0500107
Gunnar Millsbb398ac2016-11-14 11:50:22 -0600108 Write Data to File ${\n}-----------------------${\n}
George Keishing69e6f712016-09-12 06:30:09 -0500109 Write Data to File Test Setup Information:
Gunnar Millsbb398ac2016-11-14 11:50:22 -0600110 Write Data to File ${\n}-----------------------${\n}
George Keishing69e6f712016-09-12 06:30:09 -0500111 Write Data to File OPENBMC HOST \t: ${OPENBMC_HOST}${\n}
Gunnar Millsbb398ac2016-11-14 11:50:22 -0600112 Write Data to File
George Keishing69e6f712016-09-12 06:30:09 -0500113 ... SYSTEM TYPE \t: ${OPENBMC_MODEL.replace('./data/','').replace('.py','')}${\n}${\n}