blob: 6c841eacea189d147df2178d61671da0bcf6d1d7 [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
Rahul Maheshwari371e4f82020-04-06 22:53:52 -0500127Verify Machine Type Model And Serial Number
128 [Documentation] Verify machine type model and serial number from PEL.
129 [Tags] Verify_Machine_Type_Model_And_Serial_Number
130
131 Create Test PEL Log
132
133 ${pel_ids}= Get PEL Log Via BMC CLI
134 ${id}= Get From List ${pel_ids} -1
135 ${pel_serial_number}= Get PEL Field Value ${id} Failing MTMS Serial Number
136 ${pel_machine_type_model}= Get PEL Field Value ${id} Failing MTMS Machine Type Model
137
138 # Example of "Machine Type Model" and "Serial Number" fields value from "Failing MTMS" section of PEL.
139 # [Failing MTMS]:
140 # [Created by]: 0x2000
141 # [Machine Type Model]: 1234-ABC <---- Machine type
142 # [Section Version]: 1
143 # [Serial Number]: ABCDEFG <---- Serial number
144 # [Sub-section type]: 0
145
146 ${redfish_machine_model}= Redfish.Get Attribute /redfish/v1/Systems/system/ Model
147 ${redfish_serial_number}= Redfish.Get Attribute /redfish/v1/Systems/system/ SerialNumber
148
149 Valid Value pel_machine_type_model ['${redfish_machine_model}']
150 Valid Value pel_serial_number ['${redfish_serial_number}']
151
152 # Check "Machine Type Model" and "Serial Number" fields value from "Extended User Header" section of PEL.
153 ${pel_machine_type_model}= Get PEL Field Value ${id} Extended User Header Reporting Machine Type
154 ${pel_serial_number}= Get PEL Field Value ${id} Extended User Header Reporting Serial Number
155
156 Valid Value pel_machine_type_model ['${redfish_machine_model}']
157 Valid Value pel_serial_number ['${redfish_serial_number}']
158
Rahul Maheshwari58b99fc2020-03-03 00:05:55 -0600159
Rahul Maheshwari1bea6cc2020-03-31 00:53:14 -0500160Verify Host Off State From PEL
161 [Documentation] Verify Host off state from PEL.
162 [Tags] Verify_Host_Off_State_From_PEL
163
164 Redfish Power Off stack_mode=skip
165 Create Test PEL Log
166
167 ${pel_ids}= Get PEL Log Via BMC CLI
168 ${id}= Get From List ${pel_ids} -1
169 ${pel_host_state}= Get PEL Field Value ${id} User Data HostState
170
171 Valid Value pel_host_state ['Off']
172
173
174Verify BMC Version From PEL
175 [Documentation] Verify BMC Version from PEL.
176 [Tags] Verify_BMC_Version_From_PEL
177
178 Create Test PEL Log
179
180 ${pel_ids}= Get PEL Log Via BMC CLI
181 ${id}= Get From List ${pel_ids} -1
182 ${pel_bmc_version}= Get PEL Field Value ${id} User Data BMC Version ID
183
184 ${bmc_version}= Get BMC Version
185 Valid Value bmc_version ['${bmc_version}']
186
187
Rahul Maheshwari8f5256f2020-02-26 23:53:55 -0600188Verify PEL Log After Host Poweron
189 [Documentation] Verify PEL log generation while booting host.
190 [Tags] Verify_PEL_Log_After_Host_Poweron
191
192 Redfish Power Off stack_mode=skip
193 Redfish Purge Event Log
194 Redfish Power On stack_mode=skip
195
196 ${pel_informational_error}= Get PEL Log IDs User Header Event Severity Informational Event
197 ${pel_bmc_created_error}= Get PEL Log IDs Private Header Creator Subsystem BMC
198
199 # Get BMC created non-infomational error.
200 ${pel_bmc_error}= Subtract Lists ${pel_bmc_created_error} ${pel_informational_error}
201
202 Should Be Empty ${pel_bmc_error} msg=Unexpected error log generated during Host poweron.
203
204
Rahul Maheshwari089615b2020-04-02 01:01:38 -0500205Verify BMC Event Log ID
206 [Documentation] Verify BMC Event Log ID from PEL.
207 [Tags] Verify_BMC_Event_Log_ID
208
209 Redfish Purge Event Log
210 Create Test PEL Log
211
212 ${pel_ids}= Get PEL Log Via BMC CLI
213 ${pel_bmc_event_log_id}= Get PEL Field Value ${pel_ids[0]} Private Header BMC Event Log Id
214
215 # Example "BMC Event Log Id" field value from "Private Header" section of PEL.
216 # [Private Header]:
217 # [Created at]: 08/24/1928 12:04:06
218 # [Created by]: 0x584D
219 # [Sub-section type]: 0
220 # [Entry Id]: 0x50000BB7
221 # [Platform Log Id]: 0x8200061D
222 # [CSSVER]:
223 # [Section Version]: 1
224 # [Creator Subsystem]: PHYP
225 # [BMC Event Log Id]: 341 <---- BMC event log id value
226 # [Committed at]: 03/25/1920 12:06:22
227
228 ${redfish_event_logs}= Redfish.Get Properties /redfish/v1/Systems/system/LogServices/EventLog/Entries
229
230 # Example of redfish_event_logs output:
231 # redfish_event_logs:
232 # [@odata.id]: /redfish/v1/Systems/system/LogServices/EventLog/Entries
233 # [Name]: System Event Log Entries
234 # [Members@odata.count]: 1
235 # [@odata.type]: #LogEntryCollection.LogEntryCollection
236 # [Description]: Collection of System Event Log Entries
237 # [Members]:
238 # [0]:
239 # [@odata.id]: /redfish/v1/Systems/system/LogServices/EventLog/Entries/235
240 # [Name]: System Event Log Entry
241 # [Severity]: Critical
242 # [EntryType]: Event
243 # [Created]: 2020-04-02T07:25:13+00:00
244 # [@odata.type]: #LogEntry.v1_5_1.LogEntry
245 # [Id]: 235 <----- Event log ID
246 # [Message]: xyz.openbmc_project.Common.Error.InternalFailure
247
248 Valid Value pel_bmc_event_log_id ['${redfish_event_logs['Members'][0]['Id']}']
249
250
Rahul Maheshwarifaa5d202020-02-24 23:32:57 -0600251*** Keywords ***
252
253Create Test PEL Log
254 [Documentation] Generate test PEL log.
255
256 # Test PEL log entry example:
257 # {
258 # "0x5000002D": {
259 # "SRC": "BD8D1002",
260 # "Message": "An application had an internal failure",
261 # "PLID": "0x5000002D",
262 # "CreatorID": "BMC",
263 # "Subsystem": "BMC Firmware",
264 # "Commit Time": "02/25/2020 04:47:09",
265 # "Sev": "Unrecoverable Error",
266 # "CompID": "0x1000"
267 # }
268 # }
269
270 BMC Execute Command ${CMD_INTERNAL_FAILURE}
271
272
Rahul Maheshwari8f5256f2020-02-26 23:53:55 -0600273Get PEL Log IDs
274 [Documentation] Returns the list of PEL log IDs which contains given field's value.
275 [Arguments] ${pel_section} ${pel_field} @{pel_field_value}
276
277 # Description of argument(s):
278 # pel_section The section of PEL (e.g. Private Header, User Header).
279 # pel_field The PEL field (e.g. Event Severity, Event Type).
280 # pel_field_value The list of PEL's field value (e.g. Unrecoverable Error).
281
282 ${pel_ids}= Get PEL Log Via BMC CLI
283 @{pel_id_list}= Create List
284
285 FOR ${id} IN @{pel_ids}
286 ${pel_output}= Peltool -i ${id}
287 # Example of PEL output from "peltool -i <id>" command.
288 # [Private Header]:
289 # [Created at]: 08/24/1928 12:04:06
290 # [Created by]: 0x584D
291 # [Sub-section type]: 0
292 # [Entry Id]: 0x50000BB7
293 # [Platform Log Id]: 0x8200061D
294 # [CSSVER]:
295 # [Section Version]: 1
296 # [Creator Subsystem]: PHYP
297 # [BMC Event Log Id]: 341
298 # [Committed at]: 03/25/1920 12:06:22
299 # [User Header]:
300 # [Log Committed by]: 0x4552
301 # [Action Flags]:
302 # [0]: Report Externally
303 # [Subsystem]: I/O Subsystem
304 # [Event Type]: Miscellaneous, Informational Only
305 # [Sub-section type]: 0
306 # [Event Scope]: Entire Platform
307 # [Event Severity]: Informational Event
308 # [Host Transmission]: Not Sent
309 # [Section Version]: 1
310
311 ${pel_section_output}= Get From Dictionary ${pel_output} ${pel_section}
312 ${pel_field_output}= Get From Dictionary ${pel_section_output} ${pel_field}
313 Run Keyword If '${pel_field_output}' in @{pel_field_value} Append To List ${pel_id_list} ${id}
314 END
315 Sort List ${pel_id_list}
316
317 [Return] ${pel_id_list}
318
319
Rahul Maheshwarif575c902020-02-26 04:38:40 -0600320Get PEL Log Via BMC CLI
321 [Documentation] Returns the list of PEL IDs using BMC CLI.
Rahul Maheshwarifaa5d202020-02-24 23:32:57 -0600322
323 ${pel_records}= Peltool -l
Rahul Maheshwarif575c902020-02-26 04:38:40 -0600324 ${ids}= Get Dictionary Keys ${pel_records}
Rahul Maheshwari1cffc4b2020-04-02 02:58:16 -0500325 Sort List ${ids}
Rahul Maheshwarifaa5d202020-02-24 23:32:57 -0600326
Rahul Maheshwarif575c902020-02-26 04:38:40 -0600327 [Return] ${ids}
Rahul Maheshwari60b58a82020-04-02 02:40:19 -0500328
329
330Get PEL Field Value
331 [Documentation] Returns the value of given PEL's field.
332 [Arguments] ${pel_id} ${pel_section} ${pel_field}
333
334 # Description of argument(s):
335 # pel_id The ID of PEL (e.g. 0x5000002D, 0x5000002E).
336 # pel_section The section of PEL (e.g. Private Header, User Header)
337 # pel_field The PEL field (e.g. Event Severity, Event Type).
338
339 ${pel_output}= Peltool -i ${pel_id}
340
341 # Example of PEL output from "peltool -i <id>" command.
342 # [Private Header]:
343 # [Created at]: 08/24/1928 12:04:06
344 # [Created by]: 0x584D
345 # [Sub-section type]: 0
346 # [Entry Id]: 0x50000BB7
347 # [Platform Log Id]: 0x8200061D
348 # [CSSVER]:
349 # [Section Version]: 1
350 # [Creator Subsystem]: PHYP
351 # [BMC Event Log Id]: 341
352 # [Committed at]: 03/25/1920 12:06:22
353 # [User Header]:
354 # [Log Committed by]: 0x4552
355 # [Action Flags]:
356 # [0]: Report Externally
357 # [Subsystem]: I/O Subsystem
358 # [Event Type]: Miscellaneous, Informational Only
359 # [Sub-section type]: 0
360 # [Event Scope]: Entire Platform
361 # [Event Severity]: Informational Event
362 # [Host Transmission]: Not Sent
363 # [Section Version]: 1
364
365 ${pel_section_output}= Get From Dictionary ${pel_output} ${pel_section}
366 ${pel_field_output}= Get From Dictionary ${pel_section_output} ${pel_field}
367
368 [Return] ${pel_field_output}