blob: 288a1f3b0333dff6fb53036cb0d80d4353fdcfd2 [file] [log] [blame]
Rahul Maheshwarifaa5d202020-02-24 23:32:57 -06001*** Settings ***
2Documentation This suite tests Platform Event Log (PEL) functionality of OpenBMC.
3
4Library ../../lib/pel_utils.py
Rahul Maheshwaria17a3392020-03-02 04:51:52 -06005Variables ../../data/pel_variables.py
Rahul Maheshwari8f5256f2020-02-26 23:53:55 -06006Resource ../../lib/list_utils.robot
Rahul Maheshwarifaa5d202020-02-24 23:32:57 -06007Resource ../../lib/openbmc_ffdc.robot
8
Rahul Maheshwarif575c902020-02-26 04:38:40 -06009Test Setup Redfish.Login
10Test Teardown Run Keywords Redfish.Logout AND FFDC On Test Case Fail
Rahul Maheshwarifaa5d202020-02-24 23:32:57 -060011
12
13*** Variables ***
14
15${CMD_INTERNAL_FAILURE} busctl call xyz.openbmc_project.Logging /xyz/openbmc_project/logging
16... xyz.openbmc_project.Logging.Create Create ssa{ss} xyz.openbmc_project.Common.Error.InternalFailure
17... xyz.openbmc_project.Logging.Entry.Level.Error 0
18
19
20*** Test Cases ***
21
22Create Test PEL Log And Verify
23 [Documentation] Create PEL log using busctl command and verify via peltool.
24 [Tags] Create_Test_PEL_Log_And_Verify
25
Rahul Maheshwarif575c902020-02-26 04:38:40 -060026 Redfish Purge Event Log
Rahul Maheshwarifaa5d202020-02-24 23:32:57 -060027 Create Test PEL Log
Rahul Maheshwarif575c902020-02-26 04:38:40 -060028 ${pel_id}= Get PEL Log Via BMC CLI
29 Should Not Be Empty ${pel_id} msg=System PEL log entry is empty.
30
31
Rahul Maheshwaria17a3392020-03-02 04:51:52 -060032Verify PEL Log Details
33 [Documentation] Verify PEL log details via peltool.
34 [Tags] Verify_PEL_Log_Details
35
36 Redfish Purge Event Log
37
38 ${bmc_time1}= CLI Get BMC DateTime
39 Create Test PEL Log
40 ${bmc_time2}= CLI Get BMC DateTime
41
42 ${pel_records}= Peltool -l
43
44 # Example output from 'Peltool -l':
45 # pel_records:
46 # [0x50000012]:
47 # [CreatorID]: BMC
48 # [CompID]: 0x1000
49 # [PLID]: 0x50000012
50 # [Subsystem]: BMC Firmware
51 # [Message]: An application had an internal failure
52 # [SRC]: BD8D1002
53 # [Commit Time]: 03/02/2020 09:35:15
54 # [Sev]: Unrecoverable Error
55
56 ${ids}= Get Dictionary Keys ${pel_records}
57 ${id}= Get From List ${ids} 0
58
59 @{pel_fields}= Create List CreatorID Subsystem Message Sev
60 FOR ${field} IN @{pel_fields}
61 Valid Value pel_records['${id}']['${field}'] ['${PEL_DETAILS['${field}']}']
62 END
63
64 Valid Value pel_records['${id}']['PLID'] ['${id}']
65
66 # Verify if "CompID" and "SRC" fields of PEL has alphanumeric value.
67 Should Match Regexp ${pel_records['${id}']['CompID']} [a-zA-Z0-9]
68 Should Match Regexp ${pel_records['${id}']['SRC']} [a-zA-Z0-9]
69
70 ${pel_date_time}= Convert Date ${pel_records['${id}']['Commit Time']}
71 ... date_format=%m/%d/%Y %H:%M:%S exclude_millis=yes
72
73 # Convert BMC and PEL time to epoch time before comparing.
74 ${bmc_time1_epoch}= Convert Date ${bmc_time1} epoch
75 ${pel_time_epoch}= Convert Date ${pel_date_time} epoch
76 ${bmc_time2_epoch}= Convert Date ${bmc_time2} epoch
77
78 Should Be True ${bmc_time1_epoch} <= ${pel_time_epoch} <= ${bmc_time2_epoch}
79
80
Rahul Maheshwarif575c902020-02-26 04:38:40 -060081Verify PEL Log Persistence After BMC Reboot
82 [Documentation] Verify PEL log persistence after BMC reboot.
83 [Tags] Verify_PEL_Log_Persistence_After_BMC_Reboot
84
85 Create Test PEL Log
86 ${pel_before_reboot}= Get PEL Log Via BMC CLI
87
88 Redfish OBMC Reboot (off)
89 ${pel_after_reboot}= Get PEL Log Via BMC CLI
90
91 List Should Contain Sub List ${pel_after_reboot} ${pel_before_reboot}
Rahul Maheshwarifaa5d202020-02-24 23:32:57 -060092
93
Rahul Maheshwari58b99fc2020-03-03 00:05:55 -060094Verify PEL ID Numbering
95 [Documentation] Verify PEL ID numbering.
96 [Tags] Verify_PEL_ID_Numbering
97
98 Redfish Purge Event Log
99 Create Test PEL Log
100 Create Test PEL Log
101
102 ${pel_ids}= Get PEL Log Via BMC CLI
103
104 # Example of PEL IDs from PEL logs.
105 # [0x50000012]: <--- First PEL ID
106 # [CreatorID]: BMC
107 # [CompID]: 0x1000
108 # [PLID]: 0x50000012
109 # [Subsystem]: BMC Firmware
110 # [Message]: An application had an internal failure
111 # [SRC]: BD8D1002
112 # [Commit Time]: 03/02/2020 09:35:15
113 # [Sev]: Unrecoverable Error
114 #
115 # [0x50000013]: <--- Second PEL ID
116 # [CreatorID]: BMC
117 # [CompID]: 0x1000
118 # [PLID]: 0x50000013
119 # [Subsystem]: BMC Firmware
120 # [Message]: An application had an internal failure
121 # [SRC]: BD8D1002
122 # [Commit Time]: 03/02/2020 09:35:15
123 # [Sev]: Unrecoverable Error
124
125 Should Be True ${pel_ids[1]} == ${pel_ids[0]}+1
126
127
Rahul Maheshwari1bea6cc2020-03-31 00:53:14 -0500128Verify Host Off State From PEL
129 [Documentation] Verify Host off state from PEL.
130 [Tags] Verify_Host_Off_State_From_PEL
131
132 Redfish Power Off stack_mode=skip
133 Create Test PEL Log
134
135 ${pel_ids}= Get PEL Log Via BMC CLI
136 ${id}= Get From List ${pel_ids} -1
137 ${pel_host_state}= Get PEL Field Value ${id} User Data HostState
138
139 Valid Value pel_host_state ['Off']
140
141
142Verify BMC Version From PEL
143 [Documentation] Verify BMC Version from PEL.
144 [Tags] Verify_BMC_Version_From_PEL
145
146 Create Test PEL Log
147
148 ${pel_ids}= Get PEL Log Via BMC CLI
149 ${id}= Get From List ${pel_ids} -1
150 ${pel_bmc_version}= Get PEL Field Value ${id} User Data BMC Version ID
151
152 ${bmc_version}= Get BMC Version
153 Valid Value bmc_version ['${bmc_version}']
154
155
Rahul Maheshwari8f5256f2020-02-26 23:53:55 -0600156Verify PEL Log After Host Poweron
157 [Documentation] Verify PEL log generation while booting host.
158 [Tags] Verify_PEL_Log_After_Host_Poweron
159
160 Redfish Power Off stack_mode=skip
161 Redfish Purge Event Log
162 Redfish Power On stack_mode=skip
163
164 ${pel_informational_error}= Get PEL Log IDs User Header Event Severity Informational Event
165 ${pel_bmc_created_error}= Get PEL Log IDs Private Header Creator Subsystem BMC
166
167 # Get BMC created non-infomational error.
168 ${pel_bmc_error}= Subtract Lists ${pel_bmc_created_error} ${pel_informational_error}
169
170 Should Be Empty ${pel_bmc_error} msg=Unexpected error log generated during Host poweron.
171
172
Rahul Maheshwari089615b2020-04-02 01:01:38 -0500173Verify BMC Event Log ID
174 [Documentation] Verify BMC Event Log ID from PEL.
175 [Tags] Verify_BMC_Event_Log_ID
176
177 Redfish Purge Event Log
178 Create Test PEL Log
179
180 ${pel_ids}= Get PEL Log Via BMC CLI
181 ${pel_bmc_event_log_id}= Get PEL Field Value ${pel_ids[0]} Private Header BMC Event Log Id
182
183 # Example "BMC Event Log Id" field value from "Private Header" section of PEL.
184 # [Private Header]:
185 # [Created at]: 08/24/1928 12:04:06
186 # [Created by]: 0x584D
187 # [Sub-section type]: 0
188 # [Entry Id]: 0x50000BB7
189 # [Platform Log Id]: 0x8200061D
190 # [CSSVER]:
191 # [Section Version]: 1
192 # [Creator Subsystem]: PHYP
193 # [BMC Event Log Id]: 341 <---- BMC event log id value
194 # [Committed at]: 03/25/1920 12:06:22
195
196 ${redfish_event_logs}= Redfish.Get Properties /redfish/v1/Systems/system/LogServices/EventLog/Entries
197
198 # Example of redfish_event_logs output:
199 # redfish_event_logs:
200 # [@odata.id]: /redfish/v1/Systems/system/LogServices/EventLog/Entries
201 # [Name]: System Event Log Entries
202 # [Members@odata.count]: 1
203 # [@odata.type]: #LogEntryCollection.LogEntryCollection
204 # [Description]: Collection of System Event Log Entries
205 # [Members]:
206 # [0]:
207 # [@odata.id]: /redfish/v1/Systems/system/LogServices/EventLog/Entries/235
208 # [Name]: System Event Log Entry
209 # [Severity]: Critical
210 # [EntryType]: Event
211 # [Created]: 2020-04-02T07:25:13+00:00
212 # [@odata.type]: #LogEntry.v1_5_1.LogEntry
213 # [Id]: 235 <----- Event log ID
214 # [Message]: xyz.openbmc_project.Common.Error.InternalFailure
215
216 Valid Value pel_bmc_event_log_id ['${redfish_event_logs['Members'][0]['Id']}']
217
218
Rahul Maheshwarifaa5d202020-02-24 23:32:57 -0600219*** Keywords ***
220
221Create Test PEL Log
222 [Documentation] Generate test PEL log.
223
224 # Test PEL log entry example:
225 # {
226 # "0x5000002D": {
227 # "SRC": "BD8D1002",
228 # "Message": "An application had an internal failure",
229 # "PLID": "0x5000002D",
230 # "CreatorID": "BMC",
231 # "Subsystem": "BMC Firmware",
232 # "Commit Time": "02/25/2020 04:47:09",
233 # "Sev": "Unrecoverable Error",
234 # "CompID": "0x1000"
235 # }
236 # }
237
238 BMC Execute Command ${CMD_INTERNAL_FAILURE}
239
240
Rahul Maheshwari8f5256f2020-02-26 23:53:55 -0600241Get PEL Log IDs
242 [Documentation] Returns the list of PEL log IDs which contains given field's value.
243 [Arguments] ${pel_section} ${pel_field} @{pel_field_value}
244
245 # Description of argument(s):
246 # pel_section The section of PEL (e.g. Private Header, User Header).
247 # pel_field The PEL field (e.g. Event Severity, Event Type).
248 # pel_field_value The list of PEL's field value (e.g. Unrecoverable Error).
249
250 ${pel_ids}= Get PEL Log Via BMC CLI
251 @{pel_id_list}= Create List
252
253 FOR ${id} IN @{pel_ids}
254 ${pel_output}= Peltool -i ${id}
255 # Example of PEL output from "peltool -i <id>" command.
256 # [Private Header]:
257 # [Created at]: 08/24/1928 12:04:06
258 # [Created by]: 0x584D
259 # [Sub-section type]: 0
260 # [Entry Id]: 0x50000BB7
261 # [Platform Log Id]: 0x8200061D
262 # [CSSVER]:
263 # [Section Version]: 1
264 # [Creator Subsystem]: PHYP
265 # [BMC Event Log Id]: 341
266 # [Committed at]: 03/25/1920 12:06:22
267 # [User Header]:
268 # [Log Committed by]: 0x4552
269 # [Action Flags]:
270 # [0]: Report Externally
271 # [Subsystem]: I/O Subsystem
272 # [Event Type]: Miscellaneous, Informational Only
273 # [Sub-section type]: 0
274 # [Event Scope]: Entire Platform
275 # [Event Severity]: Informational Event
276 # [Host Transmission]: Not Sent
277 # [Section Version]: 1
278
279 ${pel_section_output}= Get From Dictionary ${pel_output} ${pel_section}
280 ${pel_field_output}= Get From Dictionary ${pel_section_output} ${pel_field}
281 Run Keyword If '${pel_field_output}' in @{pel_field_value} Append To List ${pel_id_list} ${id}
282 END
283 Sort List ${pel_id_list}
284
285 [Return] ${pel_id_list}
286
287
Rahul Maheshwarif575c902020-02-26 04:38:40 -0600288Get PEL Log Via BMC CLI
289 [Documentation] Returns the list of PEL IDs using BMC CLI.
Rahul Maheshwarifaa5d202020-02-24 23:32:57 -0600290
291 ${pel_records}= Peltool -l
Rahul Maheshwarif575c902020-02-26 04:38:40 -0600292 ${ids}= Get Dictionary Keys ${pel_records}
Rahul Maheshwari1cffc4b2020-04-02 02:58:16 -0500293 Sort List ${ids}
Rahul Maheshwarifaa5d202020-02-24 23:32:57 -0600294
Rahul Maheshwarif575c902020-02-26 04:38:40 -0600295 [Return] ${ids}
Rahul Maheshwari60b58a82020-04-02 02:40:19 -0500296
297
298Get PEL Field Value
299 [Documentation] Returns the value of given PEL's field.
300 [Arguments] ${pel_id} ${pel_section} ${pel_field}
301
302 # Description of argument(s):
303 # pel_id The ID of PEL (e.g. 0x5000002D, 0x5000002E).
304 # pel_section The section of PEL (e.g. Private Header, User Header)
305 # pel_field The PEL field (e.g. Event Severity, Event Type).
306
307 ${pel_output}= Peltool -i ${pel_id}
308
309 # Example of PEL output from "peltool -i <id>" command.
310 # [Private Header]:
311 # [Created at]: 08/24/1928 12:04:06
312 # [Created by]: 0x584D
313 # [Sub-section type]: 0
314 # [Entry Id]: 0x50000BB7
315 # [Platform Log Id]: 0x8200061D
316 # [CSSVER]:
317 # [Section Version]: 1
318 # [Creator Subsystem]: PHYP
319 # [BMC Event Log Id]: 341
320 # [Committed at]: 03/25/1920 12:06:22
321 # [User Header]:
322 # [Log Committed by]: 0x4552
323 # [Action Flags]:
324 # [0]: Report Externally
325 # [Subsystem]: I/O Subsystem
326 # [Event Type]: Miscellaneous, Informational Only
327 # [Sub-section type]: 0
328 # [Event Scope]: Entire Platform
329 # [Event Severity]: Informational Event
330 # [Host Transmission]: Not Sent
331 # [Section Version]: 1
332
333 ${pel_section_output}= Get From Dictionary ${pel_output} ${pel_section}
334 ${pel_field_output}= Get From Dictionary ${pel_section_output} ${pel_field}
335
336 [Return] ${pel_field_output}
337