blob: 9fd0561fedbb70f3dba855dfccd3aeb87734005c [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
Rahul Maheshwari39918682020-07-07 06:42:20 -050018@{mandatory_pel_fileds} Private Header User Header Primary SRC Extended User Header Failing MTMS
Rahul Maheshwarifaa5d202020-02-24 23:32:57 -060019
20
21*** Test Cases ***
22
23Create Test PEL Log And Verify
24 [Documentation] Create PEL log using busctl command and verify via peltool.
25 [Tags] Create_Test_PEL_Log_And_Verify
26
Rahul Maheshwarif575c902020-02-26 04:38:40 -060027 Redfish Purge Event Log
Rahul Maheshwarifaa5d202020-02-24 23:32:57 -060028 Create Test PEL Log
Rahul Maheshwarif575c902020-02-26 04:38:40 -060029 ${pel_id}= Get PEL Log Via BMC CLI
30 Should Not Be Empty ${pel_id} msg=System PEL log entry is empty.
31
32
Rahul Maheshwaria17a3392020-03-02 04:51:52 -060033Verify PEL Log Details
34 [Documentation] Verify PEL log details via peltool.
35 [Tags] Verify_PEL_Log_Details
36
37 Redfish Purge Event Log
38
39 ${bmc_time1}= CLI Get BMC DateTime
40 Create Test PEL Log
41 ${bmc_time2}= CLI Get BMC DateTime
42
43 ${pel_records}= Peltool -l
44
45 # Example output from 'Peltool -l':
46 # pel_records:
47 # [0x50000012]:
48 # [CreatorID]: BMC
49 # [CompID]: 0x1000
50 # [PLID]: 0x50000012
51 # [Subsystem]: BMC Firmware
52 # [Message]: An application had an internal failure
53 # [SRC]: BD8D1002
54 # [Commit Time]: 03/02/2020 09:35:15
55 # [Sev]: Unrecoverable Error
56
57 ${ids}= Get Dictionary Keys ${pel_records}
58 ${id}= Get From List ${ids} 0
59
60 @{pel_fields}= Create List CreatorID Subsystem Message Sev
61 FOR ${field} IN @{pel_fields}
62 Valid Value pel_records['${id}']['${field}'] ['${PEL_DETAILS['${field}']}']
63 END
64
65 Valid Value pel_records['${id}']['PLID'] ['${id}']
66
67 # Verify if "CompID" and "SRC" fields of PEL has alphanumeric value.
68 Should Match Regexp ${pel_records['${id}']['CompID']} [a-zA-Z0-9]
69 Should Match Regexp ${pel_records['${id}']['SRC']} [a-zA-Z0-9]
70
71 ${pel_date_time}= Convert Date ${pel_records['${id}']['Commit Time']}
72 ... date_format=%m/%d/%Y %H:%M:%S exclude_millis=yes
73
74 # Convert BMC and PEL time to epoch time before comparing.
75 ${bmc_time1_epoch}= Convert Date ${bmc_time1} epoch
76 ${pel_time_epoch}= Convert Date ${pel_date_time} epoch
77 ${bmc_time2_epoch}= Convert Date ${bmc_time2} epoch
78
79 Should Be True ${bmc_time1_epoch} <= ${pel_time_epoch} <= ${bmc_time2_epoch}
80
81
Rahul Maheshwari39918682020-07-07 06:42:20 -050082Verify Mandatory Sections Of Error Log PEL
83 [Documentation] Verify mandatory sections of error log PEL.
84 [Tags] Verify_Mandatory_Sections_Of_Error_Log_PEL
85
86 Create Test PEL Log
87
88 ${pel_ids}= Get PEL Log Via BMC CLI
89 ${pel_id}= Get From List ${pel_ids} -1
90 ${pel_output}= Peltool -i ${pel_id}
91 ${pel_sections}= Get Dictionary Keys ${pel_output}
92
93 List Should Contain Sub List ${pel_sections} ${mandatory_pel_fileds}
94
95
Rahul Maheshwarif575c902020-02-26 04:38:40 -060096Verify PEL Log Persistence After BMC Reboot
97 [Documentation] Verify PEL log persistence after BMC reboot.
98 [Tags] Verify_PEL_Log_Persistence_After_BMC_Reboot
99
100 Create Test PEL Log
101 ${pel_before_reboot}= Get PEL Log Via BMC CLI
102
103 Redfish OBMC Reboot (off)
104 ${pel_after_reboot}= Get PEL Log Via BMC CLI
105
106 List Should Contain Sub List ${pel_after_reboot} ${pel_before_reboot}
Rahul Maheshwarifaa5d202020-02-24 23:32:57 -0600107
108
Rahul Maheshwari58b99fc2020-03-03 00:05:55 -0600109Verify PEL ID Numbering
110 [Documentation] Verify PEL ID numbering.
111 [Tags] Verify_PEL_ID_Numbering
112
113 Redfish Purge Event Log
114 Create Test PEL Log
115 Create Test PEL Log
116
117 ${pel_ids}= Get PEL Log Via BMC CLI
118
119 # Example of PEL IDs from PEL logs.
120 # [0x50000012]: <--- First PEL ID
121 # [CreatorID]: BMC
122 # [CompID]: 0x1000
123 # [PLID]: 0x50000012
124 # [Subsystem]: BMC Firmware
125 # [Message]: An application had an internal failure
126 # [SRC]: BD8D1002
127 # [Commit Time]: 03/02/2020 09:35:15
128 # [Sev]: Unrecoverable Error
129 #
130 # [0x50000013]: <--- Second PEL ID
131 # [CreatorID]: BMC
132 # [CompID]: 0x1000
133 # [PLID]: 0x50000013
134 # [Subsystem]: BMC Firmware
135 # [Message]: An application had an internal failure
136 # [SRC]: BD8D1002
137 # [Commit Time]: 03/02/2020 09:35:15
138 # [Sev]: Unrecoverable Error
139
140 Should Be True ${pel_ids[1]} == ${pel_ids[0]}+1
141
Rahul Maheshwari371e4f82020-04-06 22:53:52 -0500142Verify Machine Type Model And Serial Number
143 [Documentation] Verify machine type model and serial number from PEL.
144 [Tags] Verify_Machine_Type_Model_And_Serial_Number
145
146 Create Test PEL Log
147
148 ${pel_ids}= Get PEL Log Via BMC CLI
149 ${id}= Get From List ${pel_ids} -1
Rahul Maheshwari56dba362020-05-12 00:59:48 -0500150
Rahul Maheshwari371e4f82020-04-06 22:53:52 -0500151 ${pel_serial_number}= Get PEL Field Value ${id} Failing MTMS Serial Number
Rahul Maheshwari56dba362020-05-12 00:59:48 -0500152 ${pel_serial_number}= Replace String Using Regexp ${pel_serial_number} ^0+ ${EMPTY}
Rahul Maheshwari371e4f82020-04-06 22:53:52 -0500153 ${pel_machine_type_model}= Get PEL Field Value ${id} Failing MTMS Machine Type Model
Rahul Maheshwari56dba362020-05-12 00:59:48 -0500154 ${pel_machine_type_model}= Replace String Using Regexp ${pel_machine_type_model} ^0+ ${EMPTY}
Rahul Maheshwari371e4f82020-04-06 22:53:52 -0500155
156 # Example of "Machine Type Model" and "Serial Number" fields value from "Failing MTMS" section of PEL.
157 # [Failing MTMS]:
158 # [Created by]: 0x2000
159 # [Machine Type Model]: 1234-ABC <---- Machine type
160 # [Section Version]: 1
161 # [Serial Number]: ABCDEFG <---- Serial number
162 # [Sub-section type]: 0
163
164 ${redfish_machine_model}= Redfish.Get Attribute /redfish/v1/Systems/system/ Model
Rahul Maheshwari56dba362020-05-12 00:59:48 -0500165 ${redfish_machine_model}= Replace String Using Regexp ${redfish_machine_model} ^0+ ${EMPTY}
Rahul Maheshwari371e4f82020-04-06 22:53:52 -0500166 ${redfish_serial_number}= Redfish.Get Attribute /redfish/v1/Systems/system/ SerialNumber
Rahul Maheshwari56dba362020-05-12 00:59:48 -0500167 ${redfish_serial_number}= Replace String Using Regexp ${redfish_serial_number} ^0+ ${EMPTY}
Rahul Maheshwari371e4f82020-04-06 22:53:52 -0500168
169 Valid Value pel_machine_type_model ['${redfish_machine_model}']
170 Valid Value pel_serial_number ['${redfish_serial_number}']
171
172 # Check "Machine Type Model" and "Serial Number" fields value from "Extended User Header" section of PEL.
173 ${pel_machine_type_model}= Get PEL Field Value ${id} Extended User Header Reporting Machine Type
Rahul Maheshwari56dba362020-05-12 00:59:48 -0500174 ${pel_machine_type_model}= Replace String Using Regexp ${pel_machine_type_model} ^0+ ${EMPTY}
Rahul Maheshwari371e4f82020-04-06 22:53:52 -0500175 ${pel_serial_number}= Get PEL Field Value ${id} Extended User Header Reporting Serial Number
Rahul Maheshwari56dba362020-05-12 00:59:48 -0500176 ${pel_serial_number}= Replace String Using Regexp ${pel_serial_number} ^0+ ${EMPTY}
Rahul Maheshwari371e4f82020-04-06 22:53:52 -0500177
178 Valid Value pel_machine_type_model ['${redfish_machine_model}']
179 Valid Value pel_serial_number ['${redfish_serial_number}']
180
Rahul Maheshwari58b99fc2020-03-03 00:05:55 -0600181
Rahul Maheshwari1bea6cc2020-03-31 00:53:14 -0500182Verify Host Off State From PEL
183 [Documentation] Verify Host off state from PEL.
184 [Tags] Verify_Host_Off_State_From_PEL
185
186 Redfish Power Off stack_mode=skip
187 Create Test PEL Log
188
189 ${pel_ids}= Get PEL Log Via BMC CLI
190 ${id}= Get From List ${pel_ids} -1
191 ${pel_host_state}= Get PEL Field Value ${id} User Data HostState
192
193 Valid Value pel_host_state ['Off']
194
195
196Verify BMC Version From PEL
197 [Documentation] Verify BMC Version from PEL.
198 [Tags] Verify_BMC_Version_From_PEL
199
200 Create Test PEL Log
201
202 ${pel_ids}= Get PEL Log Via BMC CLI
203 ${id}= Get From List ${pel_ids} -1
204 ${pel_bmc_version}= Get PEL Field Value ${id} User Data BMC Version ID
205
206 ${bmc_version}= Get BMC Version
207 Valid Value bmc_version ['${bmc_version}']
208
209
Rahul Maheshwari8f5256f2020-02-26 23:53:55 -0600210Verify PEL Log After Host Poweron
211 [Documentation] Verify PEL log generation while booting host.
212 [Tags] Verify_PEL_Log_After_Host_Poweron
213
214 Redfish Power Off stack_mode=skip
215 Redfish Purge Event Log
216 Redfish Power On stack_mode=skip
217
218 ${pel_informational_error}= Get PEL Log IDs User Header Event Severity Informational Event
219 ${pel_bmc_created_error}= Get PEL Log IDs Private Header Creator Subsystem BMC
220
221 # Get BMC created non-infomational error.
222 ${pel_bmc_error}= Subtract Lists ${pel_bmc_created_error} ${pel_informational_error}
223
224 Should Be Empty ${pel_bmc_error} msg=Unexpected error log generated during Host poweron.
225
226
Rahul Maheshwari089615b2020-04-02 01:01:38 -0500227Verify BMC Event Log ID
228 [Documentation] Verify BMC Event Log ID from PEL.
229 [Tags] Verify_BMC_Event_Log_ID
230
231 Redfish Purge Event Log
232 Create Test PEL Log
233
234 ${pel_ids}= Get PEL Log Via BMC CLI
235 ${pel_bmc_event_log_id}= Get PEL Field Value ${pel_ids[0]} Private Header BMC Event Log Id
236
237 # Example "BMC Event Log Id" field value from "Private Header" section of PEL.
238 # [Private Header]:
239 # [Created at]: 08/24/1928 12:04:06
240 # [Created by]: 0x584D
241 # [Sub-section type]: 0
242 # [Entry Id]: 0x50000BB7
243 # [Platform Log Id]: 0x8200061D
244 # [CSSVER]:
245 # [Section Version]: 1
246 # [Creator Subsystem]: PHYP
247 # [BMC Event Log Id]: 341 <---- BMC event log id value
248 # [Committed at]: 03/25/1920 12:06:22
249
250 ${redfish_event_logs}= Redfish.Get Properties /redfish/v1/Systems/system/LogServices/EventLog/Entries
251
252 # Example of redfish_event_logs output:
253 # redfish_event_logs:
254 # [@odata.id]: /redfish/v1/Systems/system/LogServices/EventLog/Entries
255 # [Name]: System Event Log Entries
256 # [Members@odata.count]: 1
257 # [@odata.type]: #LogEntryCollection.LogEntryCollection
258 # [Description]: Collection of System Event Log Entries
259 # [Members]:
260 # [0]:
261 # [@odata.id]: /redfish/v1/Systems/system/LogServices/EventLog/Entries/235
262 # [Name]: System Event Log Entry
263 # [Severity]: Critical
264 # [EntryType]: Event
265 # [Created]: 2020-04-02T07:25:13+00:00
266 # [@odata.type]: #LogEntry.v1_5_1.LogEntry
267 # [Id]: 235 <----- Event log ID
268 # [Message]: xyz.openbmc_project.Common.Error.InternalFailure
269
270 Valid Value pel_bmc_event_log_id ['${redfish_event_logs['Members'][0]['Id']}']
271
272
Rahul Maheshwari326d0642020-04-07 06:13:38 -0500273Verify Delete All PEL
274 [Documentation] Verify deleting all PEL logs.
275 [Tags] Verify_Delete_All_PEL
276
277 Create Test PEL Log
278 Create Test PEL Log
279 Peltool --delete-all False
280
281 ${pel_ids}= Get PEL Log Via BMC CLI
282 Should Be Empty ${pel_ids}
283
284
Rahul Maheshwarifaa5d202020-02-24 23:32:57 -0600285*** Keywords ***
286
287Create Test PEL Log
288 [Documentation] Generate test PEL log.
289
290 # Test PEL log entry example:
291 # {
292 # "0x5000002D": {
293 # "SRC": "BD8D1002",
294 # "Message": "An application had an internal failure",
295 # "PLID": "0x5000002D",
296 # "CreatorID": "BMC",
297 # "Subsystem": "BMC Firmware",
298 # "Commit Time": "02/25/2020 04:47:09",
299 # "Sev": "Unrecoverable Error",
300 # "CompID": "0x1000"
301 # }
302 # }
303
304 BMC Execute Command ${CMD_INTERNAL_FAILURE}
305
306
Rahul Maheshwari8f5256f2020-02-26 23:53:55 -0600307Get PEL Log IDs
308 [Documentation] Returns the list of PEL log IDs which contains given field's value.
309 [Arguments] ${pel_section} ${pel_field} @{pel_field_value}
310
311 # Description of argument(s):
312 # pel_section The section of PEL (e.g. Private Header, User Header).
313 # pel_field The PEL field (e.g. Event Severity, Event Type).
314 # pel_field_value The list of PEL's field value (e.g. Unrecoverable Error).
315
316 ${pel_ids}= Get PEL Log Via BMC CLI
317 @{pel_id_list}= Create List
318
319 FOR ${id} IN @{pel_ids}
320 ${pel_output}= Peltool -i ${id}
321 # Example of PEL output from "peltool -i <id>" command.
322 # [Private Header]:
323 # [Created at]: 08/24/1928 12:04:06
324 # [Created by]: 0x584D
325 # [Sub-section type]: 0
326 # [Entry Id]: 0x50000BB7
327 # [Platform Log Id]: 0x8200061D
328 # [CSSVER]:
329 # [Section Version]: 1
330 # [Creator Subsystem]: PHYP
331 # [BMC Event Log Id]: 341
332 # [Committed at]: 03/25/1920 12:06:22
333 # [User Header]:
334 # [Log Committed by]: 0x4552
335 # [Action Flags]:
336 # [0]: Report Externally
337 # [Subsystem]: I/O Subsystem
338 # [Event Type]: Miscellaneous, Informational Only
339 # [Sub-section type]: 0
340 # [Event Scope]: Entire Platform
341 # [Event Severity]: Informational Event
342 # [Host Transmission]: Not Sent
343 # [Section Version]: 1
344
345 ${pel_section_output}= Get From Dictionary ${pel_output} ${pel_section}
346 ${pel_field_output}= Get From Dictionary ${pel_section_output} ${pel_field}
347 Run Keyword If '${pel_field_output}' in @{pel_field_value} Append To List ${pel_id_list} ${id}
348 END
349 Sort List ${pel_id_list}
350
351 [Return] ${pel_id_list}
352
353
Rahul Maheshwarif575c902020-02-26 04:38:40 -0600354Get PEL Log Via BMC CLI
355 [Documentation] Returns the list of PEL IDs using BMC CLI.
Rahul Maheshwarifaa5d202020-02-24 23:32:57 -0600356
357 ${pel_records}= Peltool -l
Rahul Maheshwarif575c902020-02-26 04:38:40 -0600358 ${ids}= Get Dictionary Keys ${pel_records}
Rahul Maheshwari1cffc4b2020-04-02 02:58:16 -0500359 Sort List ${ids}
Rahul Maheshwarifaa5d202020-02-24 23:32:57 -0600360
Rahul Maheshwarif575c902020-02-26 04:38:40 -0600361 [Return] ${ids}
Rahul Maheshwari60b58a82020-04-02 02:40:19 -0500362
363
364Get PEL Field Value
365 [Documentation] Returns the value of given PEL's field.
366 [Arguments] ${pel_id} ${pel_section} ${pel_field}
367
368 # Description of argument(s):
369 # pel_id The ID of PEL (e.g. 0x5000002D, 0x5000002E).
370 # pel_section The section of PEL (e.g. Private Header, User Header)
371 # pel_field The PEL field (e.g. Event Severity, Event Type).
372
373 ${pel_output}= Peltool -i ${pel_id}
374
375 # Example of PEL output from "peltool -i <id>" command.
376 # [Private Header]:
377 # [Created at]: 08/24/1928 12:04:06
378 # [Created by]: 0x584D
379 # [Sub-section type]: 0
380 # [Entry Id]: 0x50000BB7
381 # [Platform Log Id]: 0x8200061D
382 # [CSSVER]:
383 # [Section Version]: 1
384 # [Creator Subsystem]: PHYP
385 # [BMC Event Log Id]: 341
386 # [Committed at]: 03/25/1920 12:06:22
387 # [User Header]:
388 # [Log Committed by]: 0x4552
389 # [Action Flags]:
390 # [0]: Report Externally
391 # [Subsystem]: I/O Subsystem
392 # [Event Type]: Miscellaneous, Informational Only
393 # [Sub-section type]: 0
394 # [Event Scope]: Entire Platform
395 # [Event Severity]: Informational Event
396 # [Host Transmission]: Not Sent
397 # [Section Version]: 1
398
399 ${pel_section_output}= Get From Dictionary ${pel_output} ${pel_section}
400 ${pel_field_output}= Get From Dictionary ${pel_section_output} ${pel_field}
401
402 [Return] ${pel_field_output}