| 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 | 
| George Keishing | a6c0089 | 2021-10-11 01:09:54 -0500 | [diff] [blame] | 5 | Resource        bmc_redfish_utils.robot | 
| George Keishing | c37fca6 | 2017-11-24 05:07:32 -0600 | [diff] [blame] | 6 | Variables       ../data/variables.py | 
| Rahul Maheshwari | b8580dd | 2021-05-10 00:57:33 -0500 | [diff] [blame] | 7 | Variables       ../data/pel_variables.py | 
| Michael Walsh | db1adf4 | 2020-03-20 15:05:46 -0500 | [diff] [blame] | 8 |  | 
|  | 9 | *** Variables *** | 
|  | 10 |  | 
|  | 11 |  | 
|  | 12 | # Define variables for use by callers of 'Get Error Logs'. | 
| George Keishing | a6c0089 | 2021-10-11 01:09:54 -0500 | [diff] [blame] | 13 | ${low_severity_errlog_regex}  \\.(Informational|Notice|Debug|OK)$ | 
| Michael Walsh | db1adf4 | 2020-03-20 15:05:46 -0500 | [diff] [blame] | 14 | &{low_severity_errlog_filter}  Severity=${low_severity_errlog_regex} | 
|  | 15 | &{low_severity_errlog_filter_args}  filter_dict=${low_severity_errlog_filter}  regex=${True}  invert=${True} | 
|  | 16 | # The following is equivalent to &{low_severity_errlog_filter_args} but the name may be more intuitive for | 
|  | 17 | # users. Example usage: | 
|  | 18 | # ${err_logs}=  Get Error Logs  &{filter_low_severity_errlogs} | 
|  | 19 | &{filter_low_severity_errlogs}  &{low_severity_errlog_filter_args} | 
|  | 20 |  | 
| George Keishing | c37fca6 | 2017-11-24 05:07:32 -0600 | [diff] [blame] | 21 | *** Keywords *** | 
|  | 22 |  | 
| George Keishing | ba74644 | 2023-03-07 11:51:39 +0530 | [diff] [blame] | 23 | Filter Expected Logging Events | 
|  | 24 | [Documentation]  Get redfish logging entry, remove the user input expected | 
|  | 25 | ...              log event and return the object list. | 
|  | 26 | [Arguments]  ${expected_event}=None | 
|  | 27 |  | 
|  | 28 | # Description of argument(s): | 
|  | 29 | # expected_eventd   Event log list. | 
|  | 30 |  | 
|  | 31 | ${all_event_list}=  Get Redfish Event Logs | 
|  | 32 | Remove Values From List  ${all_event_list}  ${expected_event} | 
|  | 33 |  | 
|  | 34 | [Return]  ${all_event_list} | 
|  | 35 |  | 
|  | 36 |  | 
| George Keishing | c37fca6 | 2017-11-24 05:07:32 -0600 | [diff] [blame] | 37 | Get Logging Entry List | 
|  | 38 | [Documentation]  Get logging entry and return the object list. | 
|  | 39 |  | 
|  | 40 | ${entry_list}=  Create List | 
|  | 41 | ${resp}=  OpenBMC Get Request  ${BMC_LOGGING_ENTRY}list  quiet=${1} | 
|  | 42 | Return From Keyword If  ${resp.status_code} == ${HTTP_NOT_FOUND} | 
| George Keishing | c37fca6 | 2017-11-24 05:07:32 -0600 | [diff] [blame] | 43 |  | 
| George Keishing | fbd6700 | 2022-08-01 11:24:03 -0500 | [diff] [blame] | 44 | FOR  ${entry}  IN  @{resp.json()["data"]} | 
| Marissa Garza | 20ccfc7 | 2020-06-19 12:51:10 -0500 | [diff] [blame] | 45 | Continue For Loop If  '${entry.rsplit('/', 1)[1]}' == 'callout' | 
|  | 46 | Append To List  ${entry_list}  ${entry} | 
|  | 47 | END | 
| George Keishing | c37fca6 | 2017-11-24 05:07:32 -0600 | [diff] [blame] | 48 |  | 
|  | 49 | # Logging entries list. | 
|  | 50 | # ['/xyz/openbmc_project/logging/entry/14', | 
|  | 51 | #  '/xyz/openbmc_project/logging/entry/15'] | 
|  | 52 | [Return]  ${entry_list} | 
|  | 53 |  | 
|  | 54 |  | 
|  | 55 | Logging Entry Should Exist | 
|  | 56 | [Documentation]  Find the matching message id and return the entry id. | 
|  | 57 | [Arguments]  ${message_id} | 
|  | 58 |  | 
|  | 59 | # Description of argument(s): | 
|  | 60 | # message_id    Logging message string. | 
|  | 61 | #               Example: "xyz.openbmc_project.Common.Error.InternalFailure" | 
|  | 62 |  | 
| George Keishing | 5ac6e17 | 2018-04-09 12:44:15 -0500 | [diff] [blame] | 63 | @{elog_entries}=  Get Logging Entry List | 
| George Keishing | c37fca6 | 2017-11-24 05:07:32 -0600 | [diff] [blame] | 64 |  | 
| Marissa Garza | 20ccfc7 | 2020-06-19 12:51:10 -0500 | [diff] [blame] | 65 | FOR  ${entry}  IN  @{elog_entries} | 
|  | 66 | ${resp}=  Read Properties  ${entry} | 
|  | 67 | ${status}=  Run Keyword And Return Status | 
|  | 68 | ...  Should Be Equal As Strings  ${message_id}  ${resp["Message"]} | 
|  | 69 | Return From Keyword If  ${status} == ${TRUE}  ${entry} | 
|  | 70 | END | 
| George Keishing | c37fca6 | 2017-11-24 05:07:32 -0600 | [diff] [blame] | 71 |  | 
|  | 72 | Fail  No ${message_id} logging entry found. | 
|  | 73 |  | 
| Steven Sombar | 9567294 | 2018-03-23 11:24:58 -0500 | [diff] [blame] | 74 |  | 
|  | 75 | Get Error Logs | 
| Michael Walsh | db1adf4 | 2020-03-20 15:05:46 -0500 | [diff] [blame] | 76 | [Documentation]  Return the BMC error logs as a dictionary. | 
|  | 77 | [Arguments]   ${quiet}=1  &{filter_struct_args} | 
|  | 78 |  | 
|  | 79 | # Example of call using pre-defined filter args (defined above). | 
|  | 80 |  | 
|  | 81 | # ${err_logs}=  Get Error Logs  &{filter_low_severity_errlogs} | 
|  | 82 |  | 
|  | 83 | # In this example, all error logs with "Severity" fields that are neither Informational, Debug nor | 
|  | 84 | # Notice will be returned. | 
| Steven Sombar | 9567294 | 2018-03-23 11:24:58 -0500 | [diff] [blame] | 85 |  | 
|  | 86 | # Description of argument(s): | 
| Michael Walsh | db1adf4 | 2020-03-20 15:05:46 -0500 | [diff] [blame] | 87 | # quiet                         Indicates whether this keyword should run without any output to the | 
|  | 88 | #                               console, 0 = verbose, 1 = quiet. | 
|  | 89 | # filter_struct_args            filter_struct args (e.g. filter_dict, regex, etc.) to be passed directly | 
|  | 90 | #                               to the Filter Struct keyword.  See its prolog for details. | 
| Steven Sombar | 9567294 | 2018-03-23 11:24:58 -0500 | [diff] [blame] | 91 |  | 
|  | 92 | #  The length of the returned dictionary indicates how many logs there are. | 
| Michael Walsh | db1adf4 | 2020-03-20 15:05:46 -0500 | [diff] [blame] | 93 |  | 
|  | 94 | # Use 'Print Error Logs' to print.  Example: | 
|  | 95 |  | 
|  | 96 | # Print Error Logs  ${error_logs}  Message. | 
| Steven Sombar | 9567294 | 2018-03-23 11:24:58 -0500 | [diff] [blame] | 97 |  | 
|  | 98 | ${status}  ${error_logs}=  Run Keyword And Ignore Error  Read Properties | 
| Michael Walsh | db1adf4 | 2020-03-20 15:05:46 -0500 | [diff] [blame] | 99 | ...  /xyz/openbmc_project/logging/entry/enumerate  timeout=30  quiet=${quiet} | 
|  | 100 | Return From Keyword If  '${status}' == 'FAIL'  &{EMPTY} | 
|  | 101 | ${num_filter_struct_args}=  Get Length  ${filter_struct_args} | 
|  | 102 | Return From Keyword If  '${num_filter_struct_args}' == '${0}'  ${error_logs} | 
|  | 103 | ${filtered_error_logs}=  Filter Struct  ${error_logs}  &{filter_struct_args} | 
|  | 104 | [Return]  ${filtered_error_logs} | 
| Sivas SRR | cf6714f | 2018-03-26 10:51:29 -0500 | [diff] [blame] | 105 |  | 
|  | 106 |  | 
|  | 107 | Get IPMI SEL Setting | 
|  | 108 | [Documentation]  Returns status for given IPMI SEL setting. | 
|  | 109 | [Arguments]  ${setting} | 
|  | 110 | # Description of argument(s): | 
|  | 111 | # setting  SEL setting which needs to be read(e.g. "Last Add Time"). | 
|  | 112 |  | 
|  | 113 | ${resp}=  Run IPMI Standard Command  sel info | 
|  | 114 |  | 
|  | 115 | ${setting_line}=  Get Lines Containing String  ${resp}  ${setting} | 
|  | 116 | ...  case-insensitive | 
|  | 117 | ${setting_status}=  Fetch From Right  ${setting_line}  :${SPACE} | 
|  | 118 |  | 
|  | 119 | [Return]  ${setting_status} | 
|  | 120 |  | 
|  | 121 |  | 
|  | 122 | Verify Watchdog Errorlog Content | 
|  | 123 | [Documentation]  Verify watchdog errorlog content. | 
|  | 124 | # Example: | 
|  | 125 | # "/xyz/openbmc_project/logging/entry/1": | 
|  | 126 | #  { | 
|  | 127 | #      "AdditionalData": [], | 
|  | 128 | #      "Id": 1, | 
|  | 129 | #      "Message": "org.open_power.Host.Boot.Error.WatchdogTimedOut", | 
|  | 130 | #      "Resolved": 0, | 
|  | 131 | #      "Severity": "xyz.openbmc_project.Logging.Entry.Level.Error", | 
|  | 132 | #      "Timestamp": 1492715244828, | 
| George Keishing | 58520d0 | 2020-02-24 10:55:32 -0600 | [diff] [blame] | 133 | #      "Associations": [] | 
| Sivas SRR | cf6714f | 2018-03-26 10:51:29 -0500 | [diff] [blame] | 134 | # }, | 
|  | 135 |  | 
|  | 136 | ${elog_entry}=  Get URL List  ${BMC_LOGGING_ENTRY} | 
|  | 137 | ${elog}=  Read Properties  ${elog_entry[0]} | 
|  | 138 | Should Be Equal As Strings | 
|  | 139 | ...  ${elog["Message"]}  org.open_power.Host.Boot.Error.WatchdogTimedOut | 
| Sivas SRR | 21c2ef2 | 2018-04-18 11:01:38 -0500 | [diff] [blame] | 140 | ...  msg=Watchdog timeout error log was not found. | 
| Sivas SRR | cf6714f | 2018-03-26 10:51:29 -0500 | [diff] [blame] | 141 | Should Be Equal As Strings | 
|  | 142 | ...  ${elog["Severity"]}  xyz.openbmc_project.Logging.Entry.Level.Error | 
| Sivas SRR | 21c2ef2 | 2018-04-18 11:01:38 -0500 | [diff] [blame] | 143 | ...  msg=Watchdog timeout severity unexpected value. | 
| Sivas SRR | cf6714f | 2018-03-26 10:51:29 -0500 | [diff] [blame] | 144 |  | 
|  | 145 |  | 
|  | 146 | Logging Test Binary Exist | 
|  | 147 | [Documentation]  Verify existence of prerequisite logging-test. | 
| George Keishing | 5f0c1fa | 2022-08-05 13:30:16 -0500 | [diff] [blame] | 148 | ${stdout}  ${stderr}  ${rc}= | 
|  | 149 | ...  BMC Execute Command  test -f /tmp/tarball/bin/logging-test  print_out=1 | 
| Sivas SRR | 21c2ef2 | 2018-04-18 11:01:38 -0500 | [diff] [blame] | 150 | Should Be Empty  ${stderr}  msg=Logging Test stderr is non-empty. | 
| George Keishing | 5f0c1fa | 2022-08-05 13:30:16 -0500 | [diff] [blame] | 151 |  | 
| Sivas SRR | cf6714f | 2018-03-26 10:51:29 -0500 | [diff] [blame] | 152 |  | 
|  | 153 | Clear Existing Error Logs | 
|  | 154 | [Documentation]  If error log isn't empty, reboot the BMC to clear the log. | 
|  | 155 | ${resp}=  OpenBMC Get Request  ${BMC_LOGGING_ENTRY}${1} | 
|  | 156 | Return From Keyword If  ${resp.status_code} == ${HTTP_NOT_FOUND} | 
|  | 157 | Initiate BMC Reboot | 
|  | 158 | Wait Until Keyword Succeeds  10 min  10 sec | 
|  | 159 | ...  Is BMC Ready | 
|  | 160 | ${resp}=  OpenBMC Get Request  ${BMC_LOGGING_ENTRY}${1} | 
|  | 161 | Should Be Equal As Strings  ${resp.status_code}  ${HTTP_NOT_FOUND} | 
| Sivas SRR | 21c2ef2 | 2018-04-18 11:01:38 -0500 | [diff] [blame] | 162 | ...  msg=Could not clear BMC error logs. | 
| Sivas SRR | cf6714f | 2018-03-26 10:51:29 -0500 | [diff] [blame] | 163 |  | 
| Rahul Maheshwari | b8580dd | 2021-05-10 00:57:33 -0500 | [diff] [blame] | 164 |  | 
|  | 165 | Create Test PEL Log | 
|  | 166 | [Documentation]  Generate test PEL log. | 
| Rahul Maheshwari | 55e2346 | 2022-02-16 23:19:35 -0600 | [diff] [blame] | 167 | [Arguments]  ${pel_type}=Unrecoverable Error | 
| Rahul Maheshwari | b8580dd | 2021-05-10 00:57:33 -0500 | [diff] [blame] | 168 |  | 
|  | 169 | # Description of argument(s): | 
|  | 170 | # pel_type      The PEL type (e.g. Internal Failure, FRU Callout, Procedural Callout). | 
|  | 171 |  | 
|  | 172 | # Test PEL log entry example: | 
|  | 173 | # { | 
|  | 174 | #    "0x5000002D": { | 
|  | 175 | #            "SRC": "BD8D1002", | 
|  | 176 | #            "Message": "An application had an internal failure", | 
|  | 177 | #            "PLID": "0x5000002D", | 
|  | 178 | #            "CreatorID": "BMC", | 
|  | 179 | #            "Subsystem": "BMC Firmware", | 
|  | 180 | #            "Commit Time": "02/25/2020  04:47:09", | 
|  | 181 | #            "Sev": "Unrecoverable Error", | 
|  | 182 | #            "CompID": "0x1000" | 
|  | 183 | #    } | 
|  | 184 | # } | 
|  | 185 |  | 
|  | 186 | Run Keyword If  '${pel_type}' == 'Internal Failure' | 
|  | 187 | ...   BMC Execute Command  ${CMD_INTERNAL_FAILURE} | 
|  | 188 | ...  ELSE IF  '${pel_type}' == 'FRU Callout' | 
|  | 189 | ...   BMC Execute Command  ${CMD_FRU_CALLOUT} | 
|  | 190 | ...  ELSE IF  '${pel_type}' == 'Procedure And Symbolic FRU Callout' | 
|  | 191 | ...   BMC Execute Command  ${CMD_PROCEDURAL_SYMBOLIC_FRU_CALLOUT} | 
| Rahul Maheshwari | 55e2346 | 2022-02-16 23:19:35 -0600 | [diff] [blame] | 192 | ...  ELSE IF  '${pel_type}' == 'Unrecoverable Error' | 
|  | 193 | ...   BMC Execute Command  ${CMD_UNRECOVERABLE_ERROR} | 
| Rahul Maheshwari | b8580dd | 2021-05-10 00:57:33 -0500 | [diff] [blame] | 194 |  | 
|  | 195 |  | 
| Sivas SRR | cf6714f | 2018-03-26 10:51:29 -0500 | [diff] [blame] | 196 | Create Test Error Log | 
|  | 197 | [Documentation]  Generate test error log. | 
|  | 198 | # Test error log entry example: | 
|  | 199 | # "/xyz/openbmc_project/logging/entry/1":  { | 
|  | 200 | #     "AdditionalData": [ | 
|  | 201 | #         "STRING=FOO" | 
|  | 202 | #     ], | 
|  | 203 | #     "Id": 1, | 
|  | 204 | #     "Message": "example.xyz.openbmc_project.Example.Elog.AutoTestSimple", | 
|  | 205 | #     "Severity": "xyz.openbmc_project.Logging.Entry.Level.Error", | 
|  | 206 | #     "Timestamp": 1487743963328, | 
| George Keishing | 58520d0 | 2020-02-24 10:55:32 -0600 | [diff] [blame] | 207 | #     "Associations": [] | 
| Sivas SRR | cf6714f | 2018-03-26 10:51:29 -0500 | [diff] [blame] | 208 | # } | 
| Joy Onyerikwu | 9b66897 | 2018-05-22 19:10:43 -0500 | [diff] [blame] | 209 | BMC Execute Command  /tmp/tarball/bin/logging-test -c AutoTestSimple | 
| Sivas SRR | cf6714f | 2018-03-26 10:51:29 -0500 | [diff] [blame] | 210 |  | 
|  | 211 | Count Error Entries | 
|  | 212 | [Documentation]  Count Error entries. | 
|  | 213 | ${resp}=  OpenBMC Get Request  ${BMC_LOGGING_ENTRY} | 
|  | 214 | Should Be Equal As Strings  ${resp.status_code}  ${HTTP_OK} | 
| Sivas SRR | 21c2ef2 | 2018-04-18 11:01:38 -0500 | [diff] [blame] | 215 | ...  msg=Failed to get error logs. | 
| George Keishing | fbd6700 | 2022-08-01 11:24:03 -0500 | [diff] [blame] | 216 | ${count}=  Get Length  ${resp.json()["data"]} | 
| Sivas SRR | cf6714f | 2018-03-26 10:51:29 -0500 | [diff] [blame] | 217 | [Return]  ${count} | 
|  | 218 |  | 
|  | 219 | Verify Test Error Log | 
|  | 220 | [Documentation]  Verify test error log entries. | 
|  | 221 | ${elog_entry}=  Get URL List  ${BMC_LOGGING_ENTRY} | 
|  | 222 | ${entry_id}=  Read Attribute  ${elog_entry[0]}  Message | 
|  | 223 | Should Be Equal  ${entry_id} | 
|  | 224 | ...  example.xyz.openbmc_project.Example.Elog.AutoTestSimple | 
| Sivas SRR | 21c2ef2 | 2018-04-18 11:01:38 -0500 | [diff] [blame] | 225 | ...  msg=Error log not from AutoTestSimple. | 
| Sivas SRR | cf6714f | 2018-03-26 10:51:29 -0500 | [diff] [blame] | 226 | ${entry_id}=  Read Attribute  ${elog_entry[0]}  Severity | 
|  | 227 | Should Be Equal  ${entry_id} | 
|  | 228 | ...  xyz.openbmc_project.Logging.Entry.Level.Error | 
| Sivas SRR | 21c2ef2 | 2018-04-18 11:01:38 -0500 | [diff] [blame] | 229 | ...  msg=Error log severity mismatch. | 
| Sivas SRR | cf6714f | 2018-03-26 10:51:29 -0500 | [diff] [blame] | 230 |  | 
|  | 231 | Delete Error Logs And Verify | 
|  | 232 | [Documentation]  Delete all error logs and verify. | 
|  | 233 | Delete All Error Logs | 
| Steven Sombar | a8800da | 2018-12-18 16:19:05 -0600 | [diff] [blame] | 234 | ${resp}=  OpenBMC Get Request  ${BMC_LOGGING_ENTRY}list  quiet=${1} | 
| Sivas SRR | cf6714f | 2018-03-26 10:51:29 -0500 | [diff] [blame] | 235 | Should Be Equal As Strings  ${resp.status_code}  ${HTTP_NOT_FOUND} | 
| Sivas SRR | 21c2ef2 | 2018-04-18 11:01:38 -0500 | [diff] [blame] | 236 | ...  msg=Error logs not deleted as expected. | 
| Sivas SRR | cf6714f | 2018-03-26 10:51:29 -0500 | [diff] [blame] | 237 |  | 
|  | 238 |  | 
|  | 239 | Install Tarball | 
|  | 240 | [Documentation]  Install tarball on BMC. | 
| Sivas SRR | f27afbe | 2018-05-26 06:45:23 -0500 | [diff] [blame] | 241 | Should Not Be Empty  ${DEBUG_TARBALL_PATH} | 
|  | 242 | ...  msg=Debug tarball path value is required. | 
| Sivas SRR | cf6714f | 2018-03-26 10:51:29 -0500 | [diff] [blame] | 243 | BMC Execute Command  rm -rf /tmp/tarball | 
|  | 244 | Install Debug Tarball On BMC  ${DEBUG_TARBALL_PATH} | 
| George Keishing | 87e2a85 | 2019-05-29 12:30:14 -0500 | [diff] [blame] | 245 |  | 
|  | 246 |  | 
|  | 247 | Get Event Logs | 
|  | 248 | [Documentation]  Get all available EventLog entries. | 
|  | 249 |  | 
|  | 250 | #{ | 
|  | 251 | #  "@odata.context": "/redfish/v1/$metadata#LogEntryCollection.LogEntryCollection", | 
|  | 252 | #  "@odata.id": "/redfish/v1/Systems/system/LogServices/EventLog/Entries", | 
|  | 253 | #  "@odata.type": "#LogEntryCollection.LogEntryCollection", | 
|  | 254 | #  "Description": "Collection of System Event Log Entries", | 
|  | 255 | #  "Members": [ | 
|  | 256 | #  { | 
|  | 257 | #    "@odata.context": "/redfish/v1/$metadata#LogEntry.LogEntry", | 
|  | 258 | #    "@odata.id": "/redfish/v1/Systems/system/LogServices/EventLog/Entries/1", | 
|  | 259 | #    "@odata.type": "#LogEntry.v1_4_0.LogEntry", | 
|  | 260 | #    "Created": "2019-05-29T13:19:27+00:00", | 
|  | 261 | #    "EntryType": "Event", | 
|  | 262 | #    "Id": "1", | 
|  | 263 | #    "Message": "org.open_power.Host.Error.Event", | 
|  | 264 | #    "Name": "System DBus Event Log Entry", | 
|  | 265 | #    "Severity": "Critical" | 
|  | 266 | #  } | 
|  | 267 | #  ], | 
|  | 268 | #  "Members@odata.count": 1, | 
|  | 269 | #  "Name": "System Event Log Entries" | 
|  | 270 | #} | 
|  | 271 |  | 
| George Keishing | 32f6df6 | 2019-05-29 13:58:12 -0500 | [diff] [blame] | 272 | ${members}=  Redfish.Get Attribute  ${EVENT_LOG_URI}Entries  Members | 
| George Keishing | 87e2a85 | 2019-05-29 12:30:14 -0500 | [diff] [blame] | 273 | [Return]  ${members} | 
| George Keishing | 32f6df6 | 2019-05-29 13:58:12 -0500 | [diff] [blame] | 274 |  | 
|  | 275 |  | 
| George Keishing | 438fd3b | 2021-10-08 02:15:18 -0500 | [diff] [blame] | 276 | Get Redfish Event Logs | 
|  | 277 | [Documentation]  Pack the list of all available EventLog entries in dictionary. | 
| George Keishing | a6c0089 | 2021-10-11 01:09:54 -0500 | [diff] [blame] | 278 | [Arguments]   ${quiet}=1  &{filter_struct_args} | 
|  | 279 |  | 
|  | 280 | # Description of argument(s): | 
|  | 281 | # quiet                  Indicates whether this keyword should run without any output to the | 
|  | 282 | #                        console, 0 = verbose, 1 = quiet. | 
|  | 283 | # filter_struct_args     filter_struct args (e.g. filter_dict, regex, etc.) to be passed | 
|  | 284 | #                        directly to the Filter Struct keyword.  See its prolog for details. | 
| George Keishing | 438fd3b | 2021-10-08 02:15:18 -0500 | [diff] [blame] | 285 |  | 
|  | 286 | ${packed_dict}=  Create Dictionary | 
|  | 287 | ${error_logs}=  Get Event Logs | 
|  | 288 |  | 
| George Keishing | 1769aa9 | 2021-10-19 10:44:47 -0500 | [diff] [blame] | 289 | FOR  ${idx}   IN  @{error_logs} | 
| George Keishing | 438fd3b | 2021-10-08 02:15:18 -0500 | [diff] [blame] | 290 | Set To Dictionary  ${packed_dict}    ${idx['@odata.id']}=${idx} | 
|  | 291 | END | 
|  | 292 |  | 
| George Keishing | a6c0089 | 2021-10-11 01:09:54 -0500 | [diff] [blame] | 293 | ${num_filter_struct_args}=  Get Length  ${filter_struct_args} | 
|  | 294 | Return From Keyword If  '${num_filter_struct_args}' == '${0}'  &{packed_dict} | 
|  | 295 | ${filtered_error_logs}=  Filter Struct  ${packed_dict}  &{filter_struct_args} | 
|  | 296 |  | 
|  | 297 | [Return]  ${filtered_error_logs} | 
| George Keishing | 438fd3b | 2021-10-08 02:15:18 -0500 | [diff] [blame] | 298 |  | 
|  | 299 |  | 
| Joy Onyerikwu | d806cc0 | 2019-10-01 07:46:18 -0500 | [diff] [blame] | 300 | Get Event Logs Not Ok | 
|  | 301 | [Documentation]  Get all event logs where the 'Severity' is not 'OK'. | 
|  | 302 |  | 
|  | 303 | ${members}=  Get Event Logs | 
|  | 304 | ${severe_logs}=  Evaluate  [elog for elog in $members if elog['Severity'] != 'OK'] | 
|  | 305 | [Return]  ${severe_logs} | 
|  | 306 |  | 
|  | 307 |  | 
| Steven Sombar | 3468df5 | 2019-06-29 11:01:47 -0500 | [diff] [blame] | 308 | Get Number Of Event Logs | 
|  | 309 | [Documentation]  Return the number of EventLog members. | 
|  | 310 |  | 
|  | 311 | ${members}=  Get Event Logs | 
|  | 312 | ${num_members}=  Get Length  ${members} | 
|  | 313 | [Return]  ${num_members} | 
|  | 314 |  | 
|  | 315 |  | 
| George Keishing | 32f6df6 | 2019-05-29 13:58:12 -0500 | [diff] [blame] | 316 | Redfish Purge Event Log | 
|  | 317 | [Documentation]  Do Redfish EventLog purge. | 
|  | 318 |  | 
| Sushil Singh | eda8bff | 2019-12-05 00:47:13 -0600 | [diff] [blame] | 319 | ${target_action}=  redfish_utils.Get Target Actions | 
|  | 320 | ...  /redfish/v1/Systems/system/LogServices/EventLog/  LogService.ClearLog | 
|  | 321 | Redfish.Post  ${target_action}  body={'target': '${target_action}'} | 
|  | 322 | ...  valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}] | 
|  | 323 |  | 
| Tim Lee | 26393aa | 2022-04-15 11:00:37 +0800 | [diff] [blame] | 324 |  | 
|  | 325 | Event Log Should Not Exist | 
|  | 326 | [Documentation]  Event log entries should not exist. | 
|  | 327 |  | 
|  | 328 | ${elogs}=  Get Event Logs | 
|  | 329 | Should Be Empty  ${elogs}  msg=System event log entry is not empty. | 
| George Keishing | cdfea1d | 2022-08-05 10:42:39 -0500 | [diff] [blame] | 330 |  | 
|  | 331 |  | 
|  | 332 | Redfish Clear PostCodes | 
|  | 333 | [Documentation]  Do Redfish PostCodes purge from system. | 
|  | 334 |  | 
|  | 335 | ${target_action}=  redfish_utils.Get Target Actions | 
|  | 336 | ...  /redfish/v1/Systems/system/LogServices/PostCodes/  LogService.ClearLog | 
|  | 337 | Redfish.Post  ${target_action}  body={'target': '${target_action}'} | 
|  | 338 | ...  valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}] | 
|  | 339 |  | 
|  | 340 |  | 
|  | 341 | Redfish Get PostCodes | 
|  | 342 | [Documentation]  Perform Redfish GET request and return the PostCodes entries as a list of dictionaries. | 
|  | 343 |  | 
|  | 344 | # Formatted example output from Rprint vars  members | 
|  | 345 | # members: | 
|  | 346 | #  [0]: | 
|  | 347 | #    [@odata.id]:               /redfish/v1/Systems/system/LogServices/PostCodes/Entries/B1-1 | 
|  | 348 | #    [@odata.type]:             #LogEntry.v1_8_0.LogEntry | 
|  | 349 | #    [AdditionalDataURI]:       /redfish/v1/Systems/system/LogServices/PostCodes/Entries/B1-1/attachment | 
|  | 350 | #    [Created]:                 2022-08-06T04:38:10+00:00 | 
|  | 351 | #    [EntryType]:               Event | 
|  | 352 | #    [Id]:                      B1-1 | 
|  | 353 | #    [Message]:                 Message": "Boot Count: 4: TS Offset: 0.0033; POST Code: 0x43 | 
|  | 354 | #    [MessageArgs]: | 
|  | 355 | #      [0]:                    4 | 
|  | 356 | #      [1]:                    0.0033 | 
|  | 357 | #      [2]:                    0x43 | 
|  | 358 | #    [MessageId]:              OpenBMC.0.2.BIOSPOSTCodeASCII | 
|  | 359 | #    [Name]:                   POST Code Log Entry | 
|  | 360 | #    [Severity]:               OK | 
|  | 361 |  | 
|  | 362 | ${members}=  Redfish.Get Attribute  /redfish/v1/Systems/system/LogServices/PostCodes/Entries  Members | 
|  | 363 | ...  valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}] | 
|  | 364 |  | 
|  | 365 | [Return]  ${members} |