blob: f1765c64e0249588acd55ebdbbf65772aca9c580 [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 Maheshwarif4a01aa2020-08-24 23:22:59 -05007Resource ../../lib/logging_utils.robot
Rahul Maheshwarifaa5d202020-02-24 23:32:57 -06008Resource ../../lib/openbmc_ffdc.robot
9
Rahul Maheshwarif575c902020-02-26 04:38:40 -060010Test Setup Redfish.Login
11Test Teardown Run Keywords Redfish.Logout AND FFDC On Test Case Fail
Rahul Maheshwarifaa5d202020-02-24 23:32:57 -060012
13
14*** Variables ***
15
16${CMD_INTERNAL_FAILURE} busctl call xyz.openbmc_project.Logging /xyz/openbmc_project/logging
17... xyz.openbmc_project.Logging.Create Create ssa{ss} xyz.openbmc_project.Common.Error.InternalFailure
18... xyz.openbmc_project.Logging.Entry.Level.Error 0
Rahul Maheshwari97d7ab82020-08-04 00:01:42 -050019
20${CMD_FRU_CALLOUT} busctl call xyz.openbmc_project.Logging /xyz/openbmc_project/logging
21... xyz.openbmc_project.Logging.Create Create ssa{ss} xyz.openbmc_project.Common.Error.Timeout
22... xyz.openbmc_project.Logging.Entry.Level.Error 2 "TIMEOUT_IN_MSEC" "5"
23... "CALLOUT_INVENTORY_PATH" "/xyz/openbmc_project/inventory/system/chassis/motherboard"
24
25${CMD_PROCEDURAL_SYMBOLIC_FRU_CALLOUT} busctl call xyz.openbmc_project.Logging /xyz/openbmc_project/logging
26... xyz.openbmc_project.Logging.Create Create ssa{ss} org.open_power.Logging.Error.TestError1
27... xyz.openbmc_project.Logging.Entry.Level.Error 0
28
manashsarma4e935382020-10-16 12:00:53 -050029${CMD_INFORMATIONAL_ERROR} busctl call xyz.openbmc_project.Logging /xyz/openbmc_project/logging
30... xyz.openbmc_project.Logging.Create Create ssa{ss} xyz.openbmc_project.Common.Error.TestError2
31... xyz.openbmc_project.Logging.Entry.Level.Informational 0
32
Rahul Maheshwari97d7ab82020-08-04 00:01:42 -050033${CMD_INVENTORY_PREFIX} busctl get-property xyz.openbmc_project.Inventory.Manager
34... /xyz/openbmc_project/inventory/system/chassis/motherboard
35
manashsarma15fe5632020-10-18 03:42:58 -050036${CMD_UNRECOVERABLE_ERROR} busctl call xyz.openbmc_project.Logging /xyz/openbmc_project/logging
37... xyz.openbmc_project.Logging.Create Create ssa{ss} xyz.openbmc_project.Common.Error.InternalFailure
38... xyz.openbmc_project.Logging.Entry.Level.Error 0
39
40${CMD_PREDICTIVE_ERROR} busctl call xyz.openbmc_project.Logging /xyz/openbmc_project/logging
41... xyz.openbmc_project.Logging.Create Create ssa{ss} xyz.openbmc_project.Common.Error.InternalFailure
42... xyz.openbmc_project.Logging.Entry.Level.Warning 0
43
Rahul Maheshwari39918682020-07-07 06:42:20 -050044@{mandatory_pel_fileds} Private Header User Header Primary SRC Extended User Header Failing MTMS
Rahul Maheshwarifaa5d202020-02-24 23:32:57 -060045
manashsarmad073a0a2020-10-20 12:54:59 -050046${info_log_max_usage_percentage} 15
47
Rahul Maheshwarifaa5d202020-02-24 23:32:57 -060048
49*** Test Cases ***
50
51Create Test PEL Log And Verify
52 [Documentation] Create PEL log using busctl command and verify via peltool.
53 [Tags] Create_Test_PEL_Log_And_Verify
54
Rahul Maheshwarif575c902020-02-26 04:38:40 -060055 Redfish Purge Event Log
Rahul Maheshwarifaa5d202020-02-24 23:32:57 -060056 Create Test PEL Log
Rahul Maheshwarif575c902020-02-26 04:38:40 -060057 ${pel_id}= Get PEL Log Via BMC CLI
58 Should Not Be Empty ${pel_id} msg=System PEL log entry is empty.
59
60
Rahul Maheshwaria17a3392020-03-02 04:51:52 -060061Verify PEL Log Details
62 [Documentation] Verify PEL log details via peltool.
63 [Tags] Verify_PEL_Log_Details
64
65 Redfish Purge Event Log
66
67 ${bmc_time1}= CLI Get BMC DateTime
68 Create Test PEL Log
69 ${bmc_time2}= CLI Get BMC DateTime
70
71 ${pel_records}= Peltool -l
72
73 # Example output from 'Peltool -l':
74 # pel_records:
75 # [0x50000012]:
76 # [CreatorID]: BMC
77 # [CompID]: 0x1000
78 # [PLID]: 0x50000012
79 # [Subsystem]: BMC Firmware
80 # [Message]: An application had an internal failure
81 # [SRC]: BD8D1002
82 # [Commit Time]: 03/02/2020 09:35:15
83 # [Sev]: Unrecoverable Error
84
85 ${ids}= Get Dictionary Keys ${pel_records}
86 ${id}= Get From List ${ids} 0
87
88 @{pel_fields}= Create List CreatorID Subsystem Message Sev
89 FOR ${field} IN @{pel_fields}
90 Valid Value pel_records['${id}']['${field}'] ['${PEL_DETAILS['${field}']}']
91 END
92
93 Valid Value pel_records['${id}']['PLID'] ['${id}']
94
95 # Verify if "CompID" and "SRC" fields of PEL has alphanumeric value.
96 Should Match Regexp ${pel_records['${id}']['CompID']} [a-zA-Z0-9]
97 Should Match Regexp ${pel_records['${id}']['SRC']} [a-zA-Z0-9]
98
99 ${pel_date_time}= Convert Date ${pel_records['${id}']['Commit Time']}
100 ... date_format=%m/%d/%Y %H:%M:%S exclude_millis=yes
101
102 # Convert BMC and PEL time to epoch time before comparing.
103 ${bmc_time1_epoch}= Convert Date ${bmc_time1} epoch
104 ${pel_time_epoch}= Convert Date ${pel_date_time} epoch
105 ${bmc_time2_epoch}= Convert Date ${bmc_time2} epoch
106
107 Should Be True ${bmc_time1_epoch} <= ${pel_time_epoch} <= ${bmc_time2_epoch}
108
109
Rahul Maheshwari39918682020-07-07 06:42:20 -0500110Verify Mandatory Sections Of Error Log PEL
111 [Documentation] Verify mandatory sections of error log PEL.
112 [Tags] Verify_Mandatory_Sections_Of_Error_Log_PEL
113
114 Create Test PEL Log
115
116 ${pel_ids}= Get PEL Log Via BMC CLI
117 ${pel_id}= Get From List ${pel_ids} -1
118 ${pel_output}= Peltool -i ${pel_id}
119 ${pel_sections}= Get Dictionary Keys ${pel_output}
120
121 List Should Contain Sub List ${pel_sections} ${mandatory_pel_fileds}
122
123
Rahul Maheshwarif575c902020-02-26 04:38:40 -0600124Verify PEL Log Persistence After BMC Reboot
125 [Documentation] Verify PEL log persistence after BMC reboot.
126 [Tags] Verify_PEL_Log_Persistence_After_BMC_Reboot
127
128 Create Test PEL Log
129 ${pel_before_reboot}= Get PEL Log Via BMC CLI
130
131 Redfish OBMC Reboot (off)
132 ${pel_after_reboot}= Get PEL Log Via BMC CLI
133
134 List Should Contain Sub List ${pel_after_reboot} ${pel_before_reboot}
Rahul Maheshwarifaa5d202020-02-24 23:32:57 -0600135
136
Rahul Maheshwari58b99fc2020-03-03 00:05:55 -0600137Verify PEL ID Numbering
138 [Documentation] Verify PEL ID numbering.
139 [Tags] Verify_PEL_ID_Numbering
140
141 Redfish Purge Event Log
142 Create Test PEL Log
143 Create Test PEL Log
144
145 ${pel_ids}= Get PEL Log Via BMC CLI
146
147 # Example of PEL IDs from PEL logs.
148 # [0x50000012]: <--- First PEL ID
149 # [CreatorID]: BMC
150 # [CompID]: 0x1000
151 # [PLID]: 0x50000012
152 # [Subsystem]: BMC Firmware
153 # [Message]: An application had an internal failure
154 # [SRC]: BD8D1002
155 # [Commit Time]: 03/02/2020 09:35:15
156 # [Sev]: Unrecoverable Error
157 #
158 # [0x50000013]: <--- Second PEL ID
159 # [CreatorID]: BMC
160 # [CompID]: 0x1000
161 # [PLID]: 0x50000013
162 # [Subsystem]: BMC Firmware
163 # [Message]: An application had an internal failure
164 # [SRC]: BD8D1002
165 # [Commit Time]: 03/02/2020 09:35:15
166 # [Sev]: Unrecoverable Error
167
168 Should Be True ${pel_ids[1]} == ${pel_ids[0]}+1
169
Rahul Maheshwari371e4f82020-04-06 22:53:52 -0500170Verify Machine Type Model And Serial Number
171 [Documentation] Verify machine type model and serial number from PEL.
172 [Tags] Verify_Machine_Type_Model_And_Serial_Number
173
174 Create Test PEL Log
175
176 ${pel_ids}= Get PEL Log Via BMC CLI
177 ${id}= Get From List ${pel_ids} -1
Rahul Maheshwari56dba362020-05-12 00:59:48 -0500178
Rahul Maheshwari371e4f82020-04-06 22:53:52 -0500179 ${pel_serial_number}= Get PEL Field Value ${id} Failing MTMS Serial Number
Rahul Maheshwari56dba362020-05-12 00:59:48 -0500180 ${pel_serial_number}= Replace String Using Regexp ${pel_serial_number} ^0+ ${EMPTY}
Rahul Maheshwari371e4f82020-04-06 22:53:52 -0500181 ${pel_machine_type_model}= Get PEL Field Value ${id} Failing MTMS Machine Type Model
Rahul Maheshwari56dba362020-05-12 00:59:48 -0500182 ${pel_machine_type_model}= Replace String Using Regexp ${pel_machine_type_model} ^0+ ${EMPTY}
Rahul Maheshwari371e4f82020-04-06 22:53:52 -0500183
184 # Example of "Machine Type Model" and "Serial Number" fields value from "Failing MTMS" section of PEL.
185 # [Failing MTMS]:
186 # [Created by]: 0x2000
187 # [Machine Type Model]: 1234-ABC <---- Machine type
188 # [Section Version]: 1
189 # [Serial Number]: ABCDEFG <---- Serial number
190 # [Sub-section type]: 0
191
192 ${redfish_machine_model}= Redfish.Get Attribute /redfish/v1/Systems/system/ Model
Rahul Maheshwari56dba362020-05-12 00:59:48 -0500193 ${redfish_machine_model}= Replace String Using Regexp ${redfish_machine_model} ^0+ ${EMPTY}
Rahul Maheshwari371e4f82020-04-06 22:53:52 -0500194 ${redfish_serial_number}= Redfish.Get Attribute /redfish/v1/Systems/system/ SerialNumber
Rahul Maheshwari56dba362020-05-12 00:59:48 -0500195 ${redfish_serial_number}= Replace String Using Regexp ${redfish_serial_number} ^0+ ${EMPTY}
Rahul Maheshwari371e4f82020-04-06 22:53:52 -0500196
197 Valid Value pel_machine_type_model ['${redfish_machine_model}']
198 Valid Value pel_serial_number ['${redfish_serial_number}']
199
200 # Check "Machine Type Model" and "Serial Number" fields value from "Extended User Header" section of PEL.
201 ${pel_machine_type_model}= Get PEL Field Value ${id} Extended User Header Reporting Machine Type
Rahul Maheshwari56dba362020-05-12 00:59:48 -0500202 ${pel_machine_type_model}= Replace String Using Regexp ${pel_machine_type_model} ^0+ ${EMPTY}
Rahul Maheshwari371e4f82020-04-06 22:53:52 -0500203 ${pel_serial_number}= Get PEL Field Value ${id} Extended User Header Reporting Serial Number
Rahul Maheshwari56dba362020-05-12 00:59:48 -0500204 ${pel_serial_number}= Replace String Using Regexp ${pel_serial_number} ^0+ ${EMPTY}
Rahul Maheshwari371e4f82020-04-06 22:53:52 -0500205
206 Valid Value pel_machine_type_model ['${redfish_machine_model}']
207 Valid Value pel_serial_number ['${redfish_serial_number}']
208
Rahul Maheshwari58b99fc2020-03-03 00:05:55 -0600209
Rahul Maheshwari1bea6cc2020-03-31 00:53:14 -0500210Verify Host Off State From PEL
211 [Documentation] Verify Host off state from PEL.
212 [Tags] Verify_Host_Off_State_From_PEL
213
214 Redfish Power Off stack_mode=skip
215 Create Test PEL Log
216
217 ${pel_ids}= Get PEL Log Via BMC CLI
218 ${id}= Get From List ${pel_ids} -1
219 ${pel_host_state}= Get PEL Field Value ${id} User Data HostState
220
221 Valid Value pel_host_state ['Off']
222
223
224Verify BMC Version From PEL
225 [Documentation] Verify BMC Version from PEL.
226 [Tags] Verify_BMC_Version_From_PEL
227
228 Create Test PEL Log
229
230 ${pel_ids}= Get PEL Log Via BMC CLI
231 ${id}= Get From List ${pel_ids} -1
232 ${pel_bmc_version}= Get PEL Field Value ${id} User Data BMC Version ID
233
234 ${bmc_version}= Get BMC Version
235 Valid Value bmc_version ['${bmc_version}']
236
237
Rahul Maheshwari8f5256f2020-02-26 23:53:55 -0600238Verify PEL Log After Host Poweron
239 [Documentation] Verify PEL log generation while booting host.
240 [Tags] Verify_PEL_Log_After_Host_Poweron
241
242 Redfish Power Off stack_mode=skip
243 Redfish Purge Event Log
244 Redfish Power On stack_mode=skip
245
246 ${pel_informational_error}= Get PEL Log IDs User Header Event Severity Informational Event
247 ${pel_bmc_created_error}= Get PEL Log IDs Private Header Creator Subsystem BMC
248
249 # Get BMC created non-infomational error.
250 ${pel_bmc_error}= Subtract Lists ${pel_bmc_created_error} ${pel_informational_error}
251
252 Should Be Empty ${pel_bmc_error} msg=Unexpected error log generated during Host poweron.
253
254
Rahul Maheshwari089615b2020-04-02 01:01:38 -0500255Verify BMC Event Log ID
256 [Documentation] Verify BMC Event Log ID from PEL.
257 [Tags] Verify_BMC_Event_Log_ID
258
259 Redfish Purge Event Log
260 Create Test PEL Log
261
262 ${pel_ids}= Get PEL Log Via BMC CLI
263 ${pel_bmc_event_log_id}= Get PEL Field Value ${pel_ids[0]} Private Header BMC Event Log Id
264
265 # Example "BMC Event Log Id" field value from "Private Header" section of PEL.
266 # [Private Header]:
267 # [Created at]: 08/24/1928 12:04:06
268 # [Created by]: 0x584D
269 # [Sub-section type]: 0
270 # [Entry Id]: 0x50000BB7
271 # [Platform Log Id]: 0x8200061D
272 # [CSSVER]:
273 # [Section Version]: 1
274 # [Creator Subsystem]: PHYP
275 # [BMC Event Log Id]: 341 <---- BMC event log id value
276 # [Committed at]: 03/25/1920 12:06:22
277
278 ${redfish_event_logs}= Redfish.Get Properties /redfish/v1/Systems/system/LogServices/EventLog/Entries
279
280 # Example of redfish_event_logs output:
281 # redfish_event_logs:
282 # [@odata.id]: /redfish/v1/Systems/system/LogServices/EventLog/Entries
283 # [Name]: System Event Log Entries
284 # [Members@odata.count]: 1
285 # [@odata.type]: #LogEntryCollection.LogEntryCollection
286 # [Description]: Collection of System Event Log Entries
287 # [Members]:
288 # [0]:
289 # [@odata.id]: /redfish/v1/Systems/system/LogServices/EventLog/Entries/235
290 # [Name]: System Event Log Entry
291 # [Severity]: Critical
292 # [EntryType]: Event
293 # [Created]: 2020-04-02T07:25:13+00:00
294 # [@odata.type]: #LogEntry.v1_5_1.LogEntry
295 # [Id]: 235 <----- Event log ID
296 # [Message]: xyz.openbmc_project.Common.Error.InternalFailure
297
298 Valid Value pel_bmc_event_log_id ['${redfish_event_logs['Members'][0]['Id']}']
299
300
Rahul Maheshwari97d7ab82020-08-04 00:01:42 -0500301Verify FRU Callout
302 [Documentation] Verify FRU callout entries from PEL log.
303 [Tags] Verify_FRU_Callout
304
305 Create Test PEL Log FRU Callout
306
307 ${pel_ids}= Get PEL Log Via BMC CLI
308 ${id}= Get From List ${pel_ids} -1
309 ${pel_callout_section}= Get PEL Field Value ${id} Primary SRC Callout Section
310
311 # Example of PEL Callout Section from "peltool -i <id>" command.
312 # [Callouts]:
313 # [0]:
314 # [FRU Type]: Normal Hardware FRU
315 # [Priority]: Mandatory, replace all with this type as a unit
316 # [Location Code]: U78DA.ND1.1234567-P0
317 # [Part Number]: F191014
318 # [CCIN]: 2E2D
319 # [Serial Number]: YL2E2D010000
320 # [Callout Count]: 1
321
322 Valid Value pel_callout_section['Callout Count'] ['1']
323 Valid Value pel_callout_section['Callouts'][0]['FRU Type'] ['Normal Hardware FRU']
324 Should Contain ${pel_callout_section['Callouts'][0]['Priority']} Mandatory
325
326 # Verify Location Code field of PEL callout with motherboard's Location Code.
327 ${busctl_output}= BMC Execute Command ${CMD_INVENTORY_PREFIX} com.ibm.ipzvpd.Location LocationCode
328 Should Be Equal ${pel_callout_section['Callouts'][0]['Location Code']}
329 ... ${busctl_output[0].split('"')[1].strip('"')}
330
331 # TODO: Compare CCIN and part number fields of PEL callout with Redfish or busctl output.
332 Should Match Regexp ${pel_callout_section['Callouts'][0]['CCIN']} [a-zA-Z0-9]
333 Should Match Regexp ${pel_callout_section['Callouts'][0]['Part Number']} [a-zA-Z0-9]
334
335 # Verify Serial Number field of PEL callout with motherboard's Serial Number.
336 ${busctl_output}= BMC Execute Command
337 ... ${CMD_INVENTORY_PREFIX} xyz.openbmc_project.Inventory.Decorator.Asset SerialNumber
338 Should Be Equal ${pel_callout_section['Callouts'][0]['Serial Number']}
339 ... ${busctl_output[0].split('"')[1].strip('"')}
340
341
342Verify Procedure And Symbolic FRU Callout
343 [Documentation] Verify procedure and symbolic FRU callout from PEL log.
344 [Tags] Verify_Procedure_And_Symbolic_FRU_Callout
345
346 Create Test PEL Log Procedure And Symbolic FRU Callout
347
348 ${pel_ids}= Get PEL Log Via BMC CLI
349 ${id}= Get From List ${pel_ids} -1
350 ${pel_callout_section}= Get PEL Field Value ${id} Primary SRC Callout Section
351
352 # Example of PEL Callout Section from "peltool -i <id>" command.
353 # [Callouts]:
354 # [0]:
355 # [Priority]: Mandatory, replace all with this type as a unit
356 # [Procedure Number]: BMCSP02
357 # [FRU Type]: Maintenance Procedure Required
358 # [1]:
359 # [Priority]: Medium Priority
360 # [Part Number]: SVCDOCS
361 # [FRU Type]: Symbolic FRU
362 # [Callout Count]: 2
363
364 Valid Value pel_callout_section['Callout Count'] ['2']
365
366 # Verify procedural callout info.
367
368 Valid Value pel_callout_section['Callouts'][0]['FRU Type'] ['Maintenance Procedure Required']
369 Should Contain ${pel_callout_section['Callouts'][0]['Priority']} Mandatory
370 # Verify if "Procedure Number" field of PEL has an alphanumeric value.
Rahul Maheshwari6acf0ee2020-10-28 05:37:01 -0500371 Should Match Regexp ${pel_callout_section['Callouts'][0]['Procedure']} [a-zA-Z0-9]
Rahul Maheshwari97d7ab82020-08-04 00:01:42 -0500372
373 # Verify procedural callout info.
374
375 Valid Value pel_callout_section['Callouts'][1]['FRU Type'] ['Symbolic FRU']
376 Should Contain ${pel_callout_section['Callouts'][1]['Priority']} Medium Priority
377 # Verify if "Part Number" field of Symbolic FRU has an alphanumeric value.
378 Should Match Regexp ${pel_callout_section['Callouts'][1]['Part Number']} [a-zA-Z0-9]
379
380
Rahul Maheshwarif4a01aa2020-08-24 23:22:59 -0500381Verify PEL Log Entry For Event Log
382 [Documentation] Create an event log and verify PEL log entry in BMC for the same.
383 [Tags] Verify_PEL_Log_Entry_For_Event_Log
384
385 Redfish Purge Event Log
386 # Create an internal failure error log.
387 BMC Execute Command ${CMD_INTERNAL_FAILURE}
388
389 ${elog_entry}= Get Event Logs
390 # Example of Redfish event logs:
391 # elog_entry:
392 # [0]:
393 # [Message]: xyz.openbmc_project.Common.Error.InternalFailure
394 # [Created]: 2020-04-20T01:55:22+00:00
395 # [Id]: 1
396 # [@odata.id]: /redfish/v1/Systems/system/LogServices/EventLog/Entries/1
397 # [@odata.type]: #LogEntry.v1_4_0.LogEntry
398 # [EntryType]: Event
399 # [Severity]: Critical
400 # [Name]: System Event Log Entry
401
402 ${redfish_log_time}= Convert Date ${elog_entry[0]["Created"]} epoch
403
404 ${pel_records}= Peltool -l
405 # Example output from 'Peltool -l':
406 # pel_records:
407 # [0x50000023]:
408 # [SRC]: BD8D1002
409 # [CreatorID]: BMC
410 # [Message]: An application had an internal failure
411 # [CompID]: 0x1000
412 # [PLID]: 0x50000023
413 # [Commit Time]: 04/20/2020 01:55:22
414 # [Subsystem]: BMC Firmware
415 # [Sev]: Unrecoverable Error
416
417 ${ids}= Get Dictionary Keys ${pel_records}
418 ${id}= Get From List ${ids} 0
419 ${pel_log_time}= Convert Date ${pel_records['${id}']['Commit Time']} epoch
420 ... date_format=%m/%d/%Y %H:%M:%S
421
422 # Verify that both Redfish event and PEL has log entry for internal error with same time stamp.
423 Should Contain Any ${pel_records['${id}']['Message']} internal failure ignore_case=True
424 Should Contain Any ${elog_entry[0]['Message']} InternalFailure ignore_case=True
425
426 Should Be Equal ${redfish_log_time} ${pel_log_time}
427
428
Rahul Maheshwari326d0642020-04-07 06:13:38 -0500429Verify Delete All PEL
430 [Documentation] Verify deleting all PEL logs.
431 [Tags] Verify_Delete_All_PEL
432
433 Create Test PEL Log
434 Create Test PEL Log
435 Peltool --delete-all False
436
437 ${pel_ids}= Get PEL Log Via BMC CLI
438 Should Be Empty ${pel_ids}
439
440
manashsarma4e935382020-10-16 12:00:53 -0500441Verify Informational Error Log
442 [Documentation] Create an informational error log and verify.
443 [Tags] Verify_Informational_Error_Log
444
445 Redfish Purge Event Log
446 # Create an informational error log.
447 BMC Execute Command ${CMD_INFORMATIONAL_ERROR}
448 ${pel_records}= Peltool -lfh
449
450 # An example of information error log data:
451 # {
452 # "0x500006A0": {
453 # "SRC": "BD8D1002",
454 # "Message": "An application had an internal failure",
455 # "PLID": "0x500006A0",
456 # "CreatorID": "BMC",
457 # "Subsystem": "BMC Firmware",
458 # "Commit Time": "10/14/2020 11:41:38",
459 # "Sev": "Informational Event",
460 # "CompID": "0x1000"
461 # }
462 # }
463
464 ${ids}= Get Dictionary Keys ${pel_records}
465 ${id}= Get From List ${ids} 0
466 Should Contain ${pel_records['${id}']['Sev']} Informational
467
468
manashsarma15fe5632020-10-18 03:42:58 -0500469Verify Predictable Error Log
470 [Documentation] Create a predictive error and verify.
471 [Tags] Verify_Predictable_Error_Log
472
473 # Create a predictable error log.
474 BMC Execute Command ${CMD_PREDICTIVE_ERROR}
475 ${pel_records}= Peltool -l
476
477 # An example of predictive error log data:
478 # {
479 # "0x5000069E": {
480 # "SRC": "BD8D1002",
481 # "Message": "An application had an internal failure",
482 # "PLID": "0x5000069E",
483 # "CreatorID": "BMC",
484 # "Subsystem": "BMC Firmware",
485 # "Commit Time": "10/14/2020 11:40:07",
486 # "Sev": "Predictive Error",
487 # "CompID": "0x1000"
488 # }
489 # }
490
491 ${pel_ids}= Get PEL Log Via BMC CLI
492 ${id}= Get From List ${pel_ids} -1
493 Should Contain ${pel_records['${id}']['Sev']} Predictive
494
495
496Verify Unrecoverable Error Log
497 [Documentation] Create an unrecoverable error and verify.
498 [Tags] Verify_Unrecoverable_Error_Log
499
500 # Create an internal failure error log.
501 BMC Execute Command ${CMD_UNRECOVERABLE_ERROR}
502 ${pel_records}= Peltool -l
503
504 # An example of unrecoverable error log data:
505 # {
506 # "0x50000CC5": {
507 # "SRC": "BD8D1002",
508 # "Message": "An application had an internal failure",
509 # "PLID": "0x50000CC5",
510 # "CreatorID": "BMC",
511 # "Subsystem": "BMC Firmware",
512 # "Commit Time": "04/01/2020 16:44:55",
513 # "Sev": "Unrecoverable Error",
514 # "CompID": "0x1000"
515 # }
516 # }
517
518 ${pel_ids}= Get PEL Log Via BMC CLI
519 ${id}= Get From List ${pel_ids} -1
520 Should Contain ${pel_records['${id}']['Sev']} Unrecoverable
521
522
manashsarmad073a0a2020-10-20 12:54:59 -0500523Verify Informational Error Log Size When Error Log Exceeds Limit
524 [Documentation] Verify informational error log size when informational log size exceeds limit.
525 [Tags] Verify_Informational_Error_Log_Error_Log_When_Size_Exceeds_Limit
526
527 # Initially remove all logs.
528 Redfish Purge Event Log
529
530 # Create 3001 information logs.
531 FOR ${LOG_COUNT} IN RANGE 0 3001
532 BMC Execute Command ${CMD_INFORMATIONAL_ERROR}
533 END
534
535 # Delay for BMC to perform log compression when log size exceeds.
536 Sleep 10s
537
538 # Check logsize and verify that disk usage is around 15%.
539 ${usage_percent}= Get Disk Usage For Error Logs
540 ${percent_diff}= Evaluate ${usage_percent} - ${info_log_max_usage_percentage}
541 ${percent_diff}= Evaluate abs(${percent_diff})
542 Should Be True ${percent_diff} <= 0.5
543
544
Rahul Maheshwarifaa5d202020-02-24 23:32:57 -0600545*** Keywords ***
546
manashsarmad073a0a2020-10-20 12:54:59 -0500547Get Disk Usage For Error Logs
548 [Documentation] Get disk usage percentage for error logs.
549
550 ${usage_output} ${stderr} ${rc}= BMC Execute Command du /var/lib/phosphor-logging/errors
551
552 ${usage_output}= Fetch From Left ${usage_output} \/
553
554 # Covert disk usage unit from KB to MB.
555 ${usage_output}= Evaluate ${usage_output} / 1024
556
557 # Logging disk capacity limit is set to 20MB. So calculating the log usage percentage.
558 ${usage_percent}= Evaluate ${usage_output} / 20 * 100
559
560 [return] ${usage_percent}
561
562
Rahul Maheshwarifaa5d202020-02-24 23:32:57 -0600563Create Test PEL Log
564 [Documentation] Generate test PEL log.
Rahul Maheshwari97d7ab82020-08-04 00:01:42 -0500565 [Arguments] ${pel_type}=Internal Failure
566
567 # Description of argument(s):
568 # pel_type The PEL type (e.g. Internal Failure, FRU Callout, Procedural Callout).
Rahul Maheshwarifaa5d202020-02-24 23:32:57 -0600569
570 # Test PEL log entry example:
571 # {
572 # "0x5000002D": {
573 # "SRC": "BD8D1002",
574 # "Message": "An application had an internal failure",
575 # "PLID": "0x5000002D",
576 # "CreatorID": "BMC",
577 # "Subsystem": "BMC Firmware",
578 # "Commit Time": "02/25/2020 04:47:09",
579 # "Sev": "Unrecoverable Error",
580 # "CompID": "0x1000"
581 # }
582 # }
583
Rahul Maheshwari97d7ab82020-08-04 00:01:42 -0500584 Run Keyword If '${pel_type}' == 'Internal Failure'
585 ... BMC Execute Command ${CMD_INTERNAL_FAILURE}
586 ... ELSE IF '${pel_type}' == 'FRU Callout'
587 ... BMC Execute Command ${CMD_FRU_CALLOUT}
588 ... ELSE IF '${pel_type}' == 'Procedure And Symbolic FRU Callout'
589 ... BMC Execute Command ${CMD_PROCEDURAL_SYMBOLIC_FRU_CALLOUT}
Rahul Maheshwarifaa5d202020-02-24 23:32:57 -0600590
591
Rahul Maheshwari8f5256f2020-02-26 23:53:55 -0600592Get PEL Log IDs
593 [Documentation] Returns the list of PEL log IDs which contains given field's value.
594 [Arguments] ${pel_section} ${pel_field} @{pel_field_value}
595
596 # Description of argument(s):
597 # pel_section The section of PEL (e.g. Private Header, User Header).
598 # pel_field The PEL field (e.g. Event Severity, Event Type).
599 # pel_field_value The list of PEL's field value (e.g. Unrecoverable Error).
600
601 ${pel_ids}= Get PEL Log Via BMC CLI
602 @{pel_id_list}= Create List
603
604 FOR ${id} IN @{pel_ids}
605 ${pel_output}= Peltool -i ${id}
606 # Example of PEL output from "peltool -i <id>" command.
607 # [Private Header]:
608 # [Created at]: 08/24/1928 12:04:06
609 # [Created by]: 0x584D
610 # [Sub-section type]: 0
611 # [Entry Id]: 0x50000BB7
612 # [Platform Log Id]: 0x8200061D
613 # [CSSVER]:
614 # [Section Version]: 1
615 # [Creator Subsystem]: PHYP
616 # [BMC Event Log Id]: 341
617 # [Committed at]: 03/25/1920 12:06:22
618 # [User Header]:
619 # [Log Committed by]: 0x4552
620 # [Action Flags]:
621 # [0]: Report Externally
622 # [Subsystem]: I/O Subsystem
623 # [Event Type]: Miscellaneous, Informational Only
624 # [Sub-section type]: 0
625 # [Event Scope]: Entire Platform
626 # [Event Severity]: Informational Event
627 # [Host Transmission]: Not Sent
628 # [Section Version]: 1
629
630 ${pel_section_output}= Get From Dictionary ${pel_output} ${pel_section}
631 ${pel_field_output}= Get From Dictionary ${pel_section_output} ${pel_field}
632 Run Keyword If '${pel_field_output}' in @{pel_field_value} Append To List ${pel_id_list} ${id}
633 END
634 Sort List ${pel_id_list}
635
636 [Return] ${pel_id_list}
637
638
Rahul Maheshwarif575c902020-02-26 04:38:40 -0600639Get PEL Log Via BMC CLI
640 [Documentation] Returns the list of PEL IDs using BMC CLI.
Rahul Maheshwarifaa5d202020-02-24 23:32:57 -0600641
642 ${pel_records}= Peltool -l
Rahul Maheshwarif575c902020-02-26 04:38:40 -0600643 ${ids}= Get Dictionary Keys ${pel_records}
Rahul Maheshwari1cffc4b2020-04-02 02:58:16 -0500644 Sort List ${ids}
Rahul Maheshwarifaa5d202020-02-24 23:32:57 -0600645
Rahul Maheshwarif575c902020-02-26 04:38:40 -0600646 [Return] ${ids}
Rahul Maheshwari60b58a82020-04-02 02:40:19 -0500647
648
649Get PEL Field Value
650 [Documentation] Returns the value of given PEL's field.
651 [Arguments] ${pel_id} ${pel_section} ${pel_field}
652
653 # Description of argument(s):
654 # pel_id The ID of PEL (e.g. 0x5000002D, 0x5000002E).
655 # pel_section The section of PEL (e.g. Private Header, User Header)
656 # pel_field The PEL field (e.g. Event Severity, Event Type).
657
658 ${pel_output}= Peltool -i ${pel_id}
659
660 # Example of PEL output from "peltool -i <id>" command.
661 # [Private Header]:
662 # [Created at]: 08/24/1928 12:04:06
663 # [Created by]: 0x584D
664 # [Sub-section type]: 0
665 # [Entry Id]: 0x50000BB7
666 # [Platform Log Id]: 0x8200061D
667 # [CSSVER]:
668 # [Section Version]: 1
669 # [Creator Subsystem]: PHYP
670 # [BMC Event Log Id]: 341
671 # [Committed at]: 03/25/1920 12:06:22
672 # [User Header]:
673 # [Log Committed by]: 0x4552
674 # [Action Flags]:
675 # [0]: Report Externally
676 # [Subsystem]: I/O Subsystem
677 # [Event Type]: Miscellaneous, Informational Only
678 # [Sub-section type]: 0
679 # [Event Scope]: Entire Platform
680 # [Event Severity]: Informational Event
681 # [Host Transmission]: Not Sent
682 # [Section Version]: 1
683
684 ${pel_section_output}= Get From Dictionary ${pel_output} ${pel_section}
685 ${pel_field_output}= Get From Dictionary ${pel_section_output} ${pel_field}
686
687 [Return] ${pel_field_output}