George Keishing | c37fca6 | 2017-11-24 05:07:32 -0600 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Error logging utility keywords. |
| 3 | |
| 4 | Resource rest_client.robot |
| 5 | Variables ../data/variables.py |
| 6 | |
| 7 | *** Keywords *** |
| 8 | |
| 9 | Get Logging Entry List |
| 10 | [Documentation] Get logging entry and return the object list. |
| 11 | |
| 12 | ${entry_list}= Create List |
| 13 | ${resp}= OpenBMC Get Request ${BMC_LOGGING_ENTRY}list quiet=${1} |
| 14 | Return From Keyword If ${resp.status_code} == ${HTTP_NOT_FOUND} |
| 15 | ${jsondata}= To JSON ${resp.content} |
| 16 | |
| 17 | :FOR ${entry} IN @{jsondata["data"]} |
| 18 | \ Continue For Loop If '${entry.rsplit('/', 1)[1]}' == 'callout' |
| 19 | \ Append To List ${entry_list} ${entry} |
| 20 | |
| 21 | # Logging entries list. |
| 22 | # ['/xyz/openbmc_project/logging/entry/14', |
| 23 | # '/xyz/openbmc_project/logging/entry/15'] |
| 24 | [Return] ${entry_list} |
| 25 | |
| 26 | |
| 27 | Logging Entry Should Exist |
| 28 | [Documentation] Find the matching message id and return the entry id. |
| 29 | [Arguments] ${message_id} |
| 30 | |
| 31 | # Description of argument(s): |
| 32 | # message_id Logging message string. |
| 33 | # Example: "xyz.openbmc_project.Common.Error.InternalFailure" |
| 34 | |
George Keishing | 5ac6e17 | 2018-04-09 12:44:15 -0500 | [diff] [blame] | 35 | @{elog_entries}= Get Logging Entry List |
George Keishing | c37fca6 | 2017-11-24 05:07:32 -0600 | [diff] [blame] | 36 | |
| 37 | :FOR ${entry} IN @{elog_entries} |
| 38 | \ ${resp}= Read Properties ${entry} |
| 39 | \ ${status}= Run Keyword And Return Status |
| 40 | ... Should Be Equal As Strings ${message_id} ${resp["Message"]} |
| 41 | \ Return From Keyword If ${status} == ${TRUE} ${entry} |
| 42 | |
| 43 | Fail No ${message_id} logging entry found. |
| 44 | |
Steven Sombar | 9567294 | 2018-03-23 11:24:58 -0500 | [diff] [blame] | 45 | |
| 46 | Get Error Logs |
| 47 | [Documentation] Return a dictionary which contains the BMC error logs. |
| 48 | [Arguments] ${quiet}=1 |
| 49 | |
| 50 | # Description of argument(s): |
| 51 | # quiet Indicates whether this keyword should run without any output to |
| 52 | # the console, 0 = verbose, 1 = quiet. |
| 53 | |
| 54 | # The length of the returned dictionary indicates how many logs there are. |
| 55 | # Printing of error logs can be done with the keyword Print Error Logs, |
| 56 | # for example, Print Error Logs ${error_logs} Message. |
| 57 | |
| 58 | ${status} ${error_logs}= Run Keyword And Ignore Error Read Properties |
Steven Sombar | c7474cc | 2018-05-25 09:18:56 -0500 | [diff] [blame] | 59 | ... /xyz/openbmc_project/logging/entry/enumerate |
| 60 | ... timeout=30 quiet=${quiet} |
Steven Sombar | 9567294 | 2018-03-23 11:24:58 -0500 | [diff] [blame] | 61 | |
| 62 | ${empty_dict}= Create Dictionary |
| 63 | Return From Keyword If '${status}' == 'FAIL' ${empty_dict} |
| 64 | [Return] ${error_logs} |
Sivas SRR | cf6714f | 2018-03-26 10:51:29 -0500 | [diff] [blame] | 65 | |
| 66 | |
| 67 | Get IPMI SEL Setting |
| 68 | [Documentation] Returns status for given IPMI SEL setting. |
| 69 | [Arguments] ${setting} |
| 70 | # Description of argument(s): |
| 71 | # setting SEL setting which needs to be read(e.g. "Last Add Time"). |
| 72 | |
| 73 | ${resp}= Run IPMI Standard Command sel info |
| 74 | |
| 75 | ${setting_line}= Get Lines Containing String ${resp} ${setting} |
| 76 | ... case-insensitive |
| 77 | ${setting_status}= Fetch From Right ${setting_line} :${SPACE} |
| 78 | |
| 79 | [Return] ${setting_status} |
| 80 | |
| 81 | |
| 82 | Verify Watchdog Errorlog Content |
| 83 | [Documentation] Verify watchdog errorlog content. |
| 84 | # Example: |
| 85 | # "/xyz/openbmc_project/logging/entry/1": |
| 86 | # { |
| 87 | # "AdditionalData": [], |
| 88 | # "Id": 1, |
| 89 | # "Message": "org.open_power.Host.Boot.Error.WatchdogTimedOut", |
| 90 | # "Resolved": 0, |
| 91 | # "Severity": "xyz.openbmc_project.Logging.Entry.Level.Error", |
| 92 | # "Timestamp": 1492715244828, |
| 93 | # "associations": [] |
| 94 | # }, |
| 95 | |
| 96 | ${elog_entry}= Get URL List ${BMC_LOGGING_ENTRY} |
| 97 | ${elog}= Read Properties ${elog_entry[0]} |
| 98 | Should Be Equal As Strings |
| 99 | ... ${elog["Message"]} org.open_power.Host.Boot.Error.WatchdogTimedOut |
Sivas SRR | 21c2ef2 | 2018-04-18 11:01:38 -0500 | [diff] [blame] | 100 | ... msg=Watchdog timeout error log was not found. |
Sivas SRR | cf6714f | 2018-03-26 10:51:29 -0500 | [diff] [blame] | 101 | Should Be Equal As Strings |
| 102 | ... ${elog["Severity"]} xyz.openbmc_project.Logging.Entry.Level.Error |
Sivas SRR | 21c2ef2 | 2018-04-18 11:01:38 -0500 | [diff] [blame] | 103 | ... msg=Watchdog timeout severity unexpected value. |
Sivas SRR | cf6714f | 2018-03-26 10:51:29 -0500 | [diff] [blame] | 104 | |
| 105 | |
| 106 | Logging Test Binary Exist |
| 107 | [Documentation] Verify existence of prerequisite logging-test. |
| 108 | Open Connection And Log In |
| 109 | ${out} ${stderr}= Execute Command |
| 110 | ... which /tmp/tarball/bin/logging-test return_stderr=True |
Sivas SRR | 21c2ef2 | 2018-04-18 11:01:38 -0500 | [diff] [blame] | 111 | Should Be Empty ${stderr} msg=Logging Test stderr is non-empty. |
Sivas SRR | cf6714f | 2018-03-26 10:51:29 -0500 | [diff] [blame] | 112 | Should Contain ${out} logging-test |
Sivas SRR | 21c2ef2 | 2018-04-18 11:01:38 -0500 | [diff] [blame] | 113 | ... msg=Logging test returned unexpected result. |
Sivas SRR | cf6714f | 2018-03-26 10:51:29 -0500 | [diff] [blame] | 114 | |
| 115 | Clear Existing Error Logs |
| 116 | [Documentation] If error log isn't empty, reboot the BMC to clear the log. |
| 117 | ${resp}= OpenBMC Get Request ${BMC_LOGGING_ENTRY}${1} |
| 118 | Return From Keyword If ${resp.status_code} == ${HTTP_NOT_FOUND} |
| 119 | Initiate BMC Reboot |
| 120 | Wait Until Keyword Succeeds 10 min 10 sec |
| 121 | ... Is BMC Ready |
| 122 | ${resp}= OpenBMC Get Request ${BMC_LOGGING_ENTRY}${1} |
| 123 | Should Be Equal As Strings ${resp.status_code} ${HTTP_NOT_FOUND} |
Sivas SRR | 21c2ef2 | 2018-04-18 11:01:38 -0500 | [diff] [blame] | 124 | ... msg=Could not clear BMC error logs. |
Sivas SRR | cf6714f | 2018-03-26 10:51:29 -0500 | [diff] [blame] | 125 | |
| 126 | Create Test Error Log |
| 127 | [Documentation] Generate test error log. |
| 128 | # Test error log entry example: |
| 129 | # "/xyz/openbmc_project/logging/entry/1": { |
| 130 | # "AdditionalData": [ |
| 131 | # "STRING=FOO" |
| 132 | # ], |
| 133 | # "Id": 1, |
| 134 | # "Message": "example.xyz.openbmc_project.Example.Elog.AutoTestSimple", |
| 135 | # "Severity": "xyz.openbmc_project.Logging.Entry.Level.Error", |
| 136 | # "Timestamp": 1487743963328, |
| 137 | # "associations": [] |
| 138 | # } |
Joy Onyerikwu | 9b66897 | 2018-05-22 19:10:43 -0500 | [diff] [blame] | 139 | BMC Execute Command /tmp/tarball/bin/logging-test -c AutoTestSimple |
Sivas SRR | cf6714f | 2018-03-26 10:51:29 -0500 | [diff] [blame] | 140 | |
| 141 | Count Error Entries |
| 142 | [Documentation] Count Error entries. |
| 143 | ${resp}= OpenBMC Get Request ${BMC_LOGGING_ENTRY} |
| 144 | Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} |
Sivas SRR | 21c2ef2 | 2018-04-18 11:01:38 -0500 | [diff] [blame] | 145 | ... msg=Failed to get error logs. |
Sivas SRR | cf6714f | 2018-03-26 10:51:29 -0500 | [diff] [blame] | 146 | ${jsondata}= To JSON ${resp.content} |
| 147 | ${count}= Get Length ${jsondata["data"]} |
| 148 | [Return] ${count} |
| 149 | |
| 150 | Verify Test Error Log |
| 151 | [Documentation] Verify test error log entries. |
| 152 | ${elog_entry}= Get URL List ${BMC_LOGGING_ENTRY} |
| 153 | ${entry_id}= Read Attribute ${elog_entry[0]} Message |
| 154 | Should Be Equal ${entry_id} |
| 155 | ... example.xyz.openbmc_project.Example.Elog.AutoTestSimple |
Sivas SRR | 21c2ef2 | 2018-04-18 11:01:38 -0500 | [diff] [blame] | 156 | ... msg=Error log not from AutoTestSimple. |
Sivas SRR | cf6714f | 2018-03-26 10:51:29 -0500 | [diff] [blame] | 157 | ${entry_id}= Read Attribute ${elog_entry[0]} Severity |
| 158 | Should Be Equal ${entry_id} |
| 159 | ... xyz.openbmc_project.Logging.Entry.Level.Error |
Sivas SRR | 21c2ef2 | 2018-04-18 11:01:38 -0500 | [diff] [blame] | 160 | ... msg=Error log severity mismatch. |
Sivas SRR | cf6714f | 2018-03-26 10:51:29 -0500 | [diff] [blame] | 161 | |
| 162 | Delete Error Logs And Verify |
| 163 | [Documentation] Delete all error logs and verify. |
| 164 | Delete All Error Logs |
Steven Sombar | a8800da | 2018-12-18 16:19:05 -0600 | [diff] [blame] | 165 | ${resp}= OpenBMC Get Request ${BMC_LOGGING_ENTRY}list quiet=${1} |
Sivas SRR | cf6714f | 2018-03-26 10:51:29 -0500 | [diff] [blame] | 166 | Should Be Equal As Strings ${resp.status_code} ${HTTP_NOT_FOUND} |
Sivas SRR | 21c2ef2 | 2018-04-18 11:01:38 -0500 | [diff] [blame] | 167 | ... msg=Error logs not deleted as expected. |
Sivas SRR | cf6714f | 2018-03-26 10:51:29 -0500 | [diff] [blame] | 168 | |
| 169 | |
| 170 | Install Tarball |
| 171 | [Documentation] Install tarball on BMC. |
Sivas SRR | f27afbe | 2018-05-26 06:45:23 -0500 | [diff] [blame] | 172 | Should Not Be Empty ${DEBUG_TARBALL_PATH} |
| 173 | ... msg=Debug tarball path value is required. |
Sivas SRR | cf6714f | 2018-03-26 10:51:29 -0500 | [diff] [blame] | 174 | BMC Execute Command rm -rf /tmp/tarball |
| 175 | Install Debug Tarball On BMC ${DEBUG_TARBALL_PATH} |
George Keishing | 87e2a85 | 2019-05-29 12:30:14 -0500 | [diff] [blame] | 176 | |
| 177 | |
| 178 | Get Event Logs |
| 179 | [Documentation] Get all available EventLog entries. |
| 180 | |
| 181 | #{ |
| 182 | # "@odata.context": "/redfish/v1/$metadata#LogEntryCollection.LogEntryCollection", |
| 183 | # "@odata.id": "/redfish/v1/Systems/system/LogServices/EventLog/Entries", |
| 184 | # "@odata.type": "#LogEntryCollection.LogEntryCollection", |
| 185 | # "Description": "Collection of System Event Log Entries", |
| 186 | # "Members": [ |
| 187 | # { |
| 188 | # "@odata.context": "/redfish/v1/$metadata#LogEntry.LogEntry", |
| 189 | # "@odata.id": "/redfish/v1/Systems/system/LogServices/EventLog/Entries/1", |
| 190 | # "@odata.type": "#LogEntry.v1_4_0.LogEntry", |
| 191 | # "Created": "2019-05-29T13:19:27+00:00", |
| 192 | # "EntryType": "Event", |
| 193 | # "Id": "1", |
| 194 | # "Message": "org.open_power.Host.Error.Event", |
| 195 | # "Name": "System DBus Event Log Entry", |
| 196 | # "Severity": "Critical" |
| 197 | # } |
| 198 | # ], |
| 199 | # "Members@odata.count": 1, |
| 200 | # "Name": "System Event Log Entries" |
| 201 | #} |
| 202 | |
George Keishing | 32f6df6 | 2019-05-29 13:58:12 -0500 | [diff] [blame] | 203 | ${members}= Redfish.Get Attribute ${EVENT_LOG_URI}Entries Members |
George Keishing | 87e2a85 | 2019-05-29 12:30:14 -0500 | [diff] [blame] | 204 | [Return] ${members} |
George Keishing | 32f6df6 | 2019-05-29 13:58:12 -0500 | [diff] [blame] | 205 | |
| 206 | |
Joy Onyerikwu | d806cc0 | 2019-10-01 07:46:18 -0500 | [diff] [blame] | 207 | Get Event Logs Not Ok |
| 208 | [Documentation] Get all event logs where the 'Severity' is not 'OK'. |
| 209 | |
| 210 | ${members}= Get Event Logs |
| 211 | ${severe_logs}= Evaluate [elog for elog in $members if elog['Severity'] != 'OK'] |
| 212 | [Return] ${severe_logs} |
| 213 | |
| 214 | |
Steven Sombar | 3468df5 | 2019-06-29 11:01:47 -0500 | [diff] [blame] | 215 | Get Number Of Event Logs |
| 216 | [Documentation] Return the number of EventLog members. |
| 217 | |
| 218 | ${members}= Get Event Logs |
| 219 | ${num_members}= Get Length ${members} |
| 220 | [Return] ${num_members} |
| 221 | |
| 222 | |
George Keishing | 32f6df6 | 2019-05-29 13:58:12 -0500 | [diff] [blame] | 223 | Redfish Purge Event Log |
| 224 | [Documentation] Do Redfish EventLog purge. |
| 225 | |
| 226 | Redfish.Post ${EVENT_LOG_URI}Actions/LogService.Reset |
| 227 | ... valid_status_codes=[${HTTP_NO_CONTENT}] |