| George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 1 | *** Settings *** | 
|  | 2 | Documentation      Utility keywords for FFDC | 
|  | 3 |  | 
|  | 4 | Library            String | 
|  | 5 | Library            DateTime | 
|  | 6 | Library            openbmc_ffdc_list.py | 
| Sandhya Somashekar | 839a0c2 | 2019-01-31 05:05:43 -0600 | [diff] [blame] | 7 | Resource           resource.robot | 
| George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 8 | Resource           connection_client.robot | 
| Sweta Potthuri | 15e6d2f | 2017-02-28 03:10:02 -0600 | [diff] [blame] | 9 | Resource           utils.robot | 
| George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 10 |  | 
|  | 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 |  | 
|  | 27 | Get Test Dir and Name | 
|  | 28 | [Documentation]    SUITE_NAME and TEST_NAME are automatic variables | 
|  | 29 | ...                and is populated dynamically by the robot framework | 
| Gunnar Mills | bb398ac | 2016-11-14 11:50:22 -0600 | [diff] [blame] | 30 | ...                during execution | 
| George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 31 | ${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} | 
| George Keishing | 409df05 | 2024-01-17 22:36:14 +0530 | [diff] [blame] | 35 | RETURN  ${suite_name}   ${test_name} | 
| George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 36 |  | 
|  | 37 |  | 
|  | 38 | Create FFDC Directory | 
|  | 39 | [Documentation]    Creates directory and report file | 
|  | 40 | Create Directory   ${FFDC_DIR_PATH} | 
|  | 41 | Create FFDC Report File | 
|  | 42 |  | 
|  | 43 |  | 
|  | 44 | Create FFDC Report File | 
|  | 45 | [Documentation]     Create a generic file name for ffdc | 
|  | 46 | Set Suite Variable | 
| Gunnar Mills | aca140d | 2016-10-26 13:05:10 -0500 | [diff] [blame] | 47 | ...  ${FFDC_FILE_PATH}   ${FFDC_DIR_PATH}${/}${FFDC_TIME}_BMC_general.txt | 
| George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 48 | Create File         ${FFDC_FILE_PATH} | 
|  | 49 |  | 
|  | 50 |  | 
| Sweta Potthuri | 15e6d2f | 2017-02-28 03:10:02 -0600 | [diff] [blame] | 51 | Write Data To File | 
| George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 52 | [Documentation]     Write data to the ffdc report document | 
|  | 53 | [Arguments]         ${data}=      ${filepath}=${FFDC_FILE_PATH} | 
|  | 54 | Append To File      ${filepath}   ${data} | 
|  | 55 |  | 
|  | 56 |  | 
|  | 57 | Get 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} | 
| George Keishing | 409df05 | 2024-01-17 22:36:14 +0530 | [diff] [blame] | 61 | RETURN  ${cur_time} | 
| George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 62 |  | 
|  | 63 |  | 
|  | 64 | Header Message | 
| Michael Walsh | 7745854 | 2017-10-30 15:01:01 -0500 | [diff] [blame] | 65 | [Documentation]     Write header message to the report document manifest | 
|  | 66 | ...                 and return a list of generated files. | 
| Michael Walsh | 259c540 | 2018-11-01 13:22:51 -0500 | [diff] [blame] | 67 | ...                 TEST_NAME, TEST_MESSAGE,SUITE_SOURCE, TEST_DOCUMENTATION | 
| George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 68 | ...                 are auto variables and are populated dynamically by the | 
| Michael Walsh | 259c540 | 2018-11-01 13:22:51 -0500 | [diff] [blame] | 69 | ...                 robot framework during execution. | 
|  | 70 | ...                 1. Write opening statement headers message. | 
|  | 71 | ...                 2. Add test setup and config information. | 
|  | 72 | ...                 3. Print types of data collection. | 
| George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 73 |  | 
| Michael Walsh | fdde258 | 2019-04-18 11:05:11 -0500 | [diff] [blame] | 74 |  | 
|  | 75 | ${ffdc_file_list}=  Create List  ${FFDC_FILE_PATH} | 
|  | 76 | Return From Keyword If  '${TEST_MODE}'  ${ffdc_file_list} | 
|  | 77 |  | 
| Michael Walsh | 259c540 | 2018-11-01 13:22:51 -0500 | [diff] [blame] | 78 | ${TEST_NAME}=  Get Variable Value  ${TEST_NAME} | 
|  | 79 | ${TEST_MESSAGE}=  Get Variable Value  ${TEST_MESSAGE} | 
|  | 80 | ${TEST_DOCUMENTATION}=  Get Variable Value  ${TEST_DOCUMENTATION} | 
|  | 81 | Write Data To File  ${HEADER_MSG} | 
|  | 82 | Write Data To File  ${FOOTER_MSG} | 
|  | 83 | Write Data To File  Test Suite File\t\t: ${SUITE_NAME} ${\n} | 
|  | 84 | Write Data To File  Test Case Name\t\t: ${TEST_NAME}${\n} | 
|  | 85 | Write Data To File  Test Source File\t: ${SUITE_SOURCE}${\n} | 
|  | 86 | Write Data To File  Failure Time Stamp\t: ${FFDC_TIME}${\n} | 
|  | 87 | Write Data To File  Test Error Message\t: ${TEST_MESSAGE}${\n} | 
|  | 88 | Write Data To File  Test Documentation\t:${\n}${TEST_DOCUMENTATION}${\n} | 
|  | 89 | Write Data To File  ${FOOTER_MSG} | 
| George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 90 |  | 
|  | 91 | Test Setup Info | 
|  | 92 |  | 
| Michael Walsh | 259c540 | 2018-11-01 13:22:51 -0500 | [diff] [blame] | 93 | Write Data To File  ${\n}${MSG_INTRO}${\n} | 
| George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 94 |  | 
|  | 95 | # --- FFDC header notes --- | 
| Michael Walsh | 259c540 | 2018-11-01 13:22:51 -0500 | [diff] [blame] | 96 | @{entries}=  Get ffdc cmd index | 
| Marissa Garza | 20ccfc7 | 2020-06-19 12:51:10 -0500 | [diff] [blame] | 97 | FOR  ${index}  IN  @{entries} | 
|  | 98 | Write Data To File  * ${index.upper()} | 
|  | 99 | Write Data To File  ${\n} | 
|  | 100 | END | 
| George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 101 |  | 
| Michael Walsh | 259c540 | 2018-11-01 13:22:51 -0500 | [diff] [blame] | 102 | Write Data To File  ${MSG_DETAIL} | 
| George Keishing | 409df05 | 2024-01-17 22:36:14 +0530 | [diff] [blame] | 103 | RETURN  ${ffdc_file_list} | 
| George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 104 |  | 
|  | 105 |  | 
|  | 106 | Write Cmd Output to FFDC File | 
|  | 107 | [Documentation]      Write cmd output data to the report document | 
|  | 108 | [Arguments]          ${name_str}   ${cmd} | 
|  | 109 |  | 
| Sweta Potthuri | 15e6d2f | 2017-02-28 03:10:02 -0600 | [diff] [blame] | 110 | Write Data To File   ${FOOTER_MSG} | 
|  | 111 | Write Data To File   ${ENTRY_INDEX.upper()} : ${name_str}\t | 
|  | 112 | Write Data To File   Executed : ${cmd} | 
|  | 113 | Write Data To File   ${FOOTER_MSG} | 
| George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 114 |  | 
|  | 115 |  | 
|  | 116 | Test Setup Info | 
| Gunnar Mills | bb398ac | 2016-11-14 11:50:22 -0600 | [diff] [blame] | 117 | [Documentation]      BMC IP, Model and other information | 
| George Keishing | 69e6f71 | 2016-09-12 06:30:09 -0500 | [diff] [blame] | 118 |  | 
| Sweta Potthuri | 15e6d2f | 2017-02-28 03:10:02 -0600 | [diff] [blame] | 119 | Write Data To File  ${\n}-----------------------${\n} | 
|  | 120 | Write Data To File  Test Setup Information: | 
|  | 121 | Write Data To File  ${\n}-----------------------${\n} | 
|  | 122 | Write Data To File  OPENBMC HOST \t: ${OPENBMC_HOST}${\n} | 
|  | 123 | ${model_name}=  Get BMC System Model | 
|  | 124 | Write Data To File  SYSTEM TYPE \t: ${model_name} | 
| George Keishing | 3e840a5 | 2017-07-21 08:31:44 -0500 | [diff] [blame] | 125 |  | 
|  | 126 |  | 
|  | 127 | Error Logs Should Not Exist | 
|  | 128 | [Documentation]  Verify that error logs do not exist. | 
|  | 129 |  | 
| Steven Sombar | a8800da | 2018-12-18 16:19:05 -0600 | [diff] [blame] | 130 | ${resp}=  OpenBMC Get Request  ${BMC_LOGGING_ENTRY}list  quiet=${1} | 
| George Keishing | 3e840a5 | 2017-07-21 08:31:44 -0500 | [diff] [blame] | 131 | Should Be Equal As Strings  ${resp.status_code}  ${HTTP_NOT_FOUND} | 
| Steven Sombar | 9567294 | 2018-03-23 11:24:58 -0500 | [diff] [blame] | 132 | ...  msg=Unexpected BMC error log(s) present. | 
| Steven Sombar | 43d6ba3 | 2018-02-16 11:25:09 -0600 | [diff] [blame] | 133 |  | 
|  | 134 |  | 
|  | 135 | Error Logs Should Exist | 
|  | 136 | [Documentation]  Verify that error logs exist. | 
|  | 137 |  | 
| Steven Sombar | a8800da | 2018-12-18 16:19:05 -0600 | [diff] [blame] | 138 | ${resp}=  OpenBMC Get Request  ${BMC_LOGGING_ENTRY}list  quiet=${1} | 
| Steven Sombar | 43d6ba3 | 2018-02-16 11:25:09 -0600 | [diff] [blame] | 139 | Run Keyword If  ${resp.status_code} != ${HTTP_OK}  Fail | 
|  | 140 | ...  msg=Expected BMC error log(s) are not present. |