blob: 2c6b4839b23183e24093d344d4b5673d0541b108 [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
manashsarma1810a5b2020-12-09 20:09:20 -06008Resource ../../lib/connection_client.robot
Rahul Maheshwarifaa5d202020-02-24 23:32:57 -06009Resource ../../lib/openbmc_ffdc.robot
10
Rahul Maheshwarif575c902020-02-26 04:38:40 -060011Test Setup Redfish.Login
12Test Teardown Run Keywords Redfish.Logout AND FFDC On Test Case Fail
Rahul Maheshwarifaa5d202020-02-24 23:32:57 -060013
14
15*** Variables ***
16
Rahul Maheshwari39918682020-07-07 06:42:20 -050017@{mandatory_pel_fileds} Private Header User Header Primary SRC Extended User Header Failing MTMS
Rahul Maheshwarifaa5d202020-02-24 23:32:57 -060018
Rahul Maheshwarib8580dd2021-05-10 00:57:33 -050019
Rahul Maheshwarifaa5d202020-02-24 23:32:57 -060020*** 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 Maheshwari39918682020-07-07 06:42:20 -050081Verify Mandatory Sections Of Error Log PEL
82 [Documentation] Verify mandatory sections of error log PEL.
83 [Tags] Verify_Mandatory_Sections_Of_Error_Log_PEL
84
85 Create Test PEL Log
86
87 ${pel_ids}= Get PEL Log Via BMC CLI
88 ${pel_id}= Get From List ${pel_ids} -1
89 ${pel_output}= Peltool -i ${pel_id}
90 ${pel_sections}= Get Dictionary Keys ${pel_output}
91
92 List Should Contain Sub List ${pel_sections} ${mandatory_pel_fileds}
93
94
Rahul Maheshwarif575c902020-02-26 04:38:40 -060095Verify PEL Log Persistence After BMC Reboot
96 [Documentation] Verify PEL log persistence after BMC reboot.
97 [Tags] Verify_PEL_Log_Persistence_After_BMC_Reboot
98
99 Create Test PEL Log
100 ${pel_before_reboot}= Get PEL Log Via BMC CLI
101
102 Redfish OBMC Reboot (off)
103 ${pel_after_reboot}= Get PEL Log Via BMC CLI
104
105 List Should Contain Sub List ${pel_after_reboot} ${pel_before_reboot}
Rahul Maheshwarifaa5d202020-02-24 23:32:57 -0600106
107
Rahul Maheshwari58b99fc2020-03-03 00:05:55 -0600108Verify PEL ID Numbering
109 [Documentation] Verify PEL ID numbering.
110 [Tags] Verify_PEL_ID_Numbering
111
112 Redfish Purge Event Log
113 Create Test PEL Log
114 Create Test PEL Log
115
116 ${pel_ids}= Get PEL Log Via BMC CLI
117
118 # Example of PEL IDs from PEL logs.
119 # [0x50000012]: <--- First PEL ID
120 # [CreatorID]: BMC
121 # [CompID]: 0x1000
122 # [PLID]: 0x50000012
123 # [Subsystem]: BMC Firmware
124 # [Message]: An application had an internal failure
125 # [SRC]: BD8D1002
126 # [Commit Time]: 03/02/2020 09:35:15
127 # [Sev]: Unrecoverable Error
128 #
129 # [0x50000013]: <--- Second PEL ID
130 # [CreatorID]: BMC
131 # [CompID]: 0x1000
132 # [PLID]: 0x50000013
133 # [Subsystem]: BMC Firmware
134 # [Message]: An application had an internal failure
135 # [SRC]: BD8D1002
136 # [Commit Time]: 03/02/2020 09:35:15
137 # [Sev]: Unrecoverable Error
138
139 Should Be True ${pel_ids[1]} == ${pel_ids[0]}+1
140
Rahul Maheshwari371e4f82020-04-06 22:53:52 -0500141Verify Machine Type Model And Serial Number
142 [Documentation] Verify machine type model and serial number from PEL.
143 [Tags] Verify_Machine_Type_Model_And_Serial_Number
144
145 Create Test PEL Log
146
147 ${pel_ids}= Get PEL Log Via BMC CLI
148 ${id}= Get From List ${pel_ids} -1
Rahul Maheshwari56dba362020-05-12 00:59:48 -0500149
Rahul Maheshwari371e4f82020-04-06 22:53:52 -0500150 ${pel_serial_number}= Get PEL Field Value ${id} Failing MTMS Serial Number
Rahul Maheshwari56dba362020-05-12 00:59:48 -0500151 ${pel_serial_number}= Replace String Using Regexp ${pel_serial_number} ^0+ ${EMPTY}
Rahul Maheshwari371e4f82020-04-06 22:53:52 -0500152 ${pel_machine_type_model}= Get PEL Field Value ${id} Failing MTMS Machine Type Model
Rahul Maheshwari56dba362020-05-12 00:59:48 -0500153 ${pel_machine_type_model}= Replace String Using Regexp ${pel_machine_type_model} ^0+ ${EMPTY}
Rahul Maheshwari371e4f82020-04-06 22:53:52 -0500154
155 # Example of "Machine Type Model" and "Serial Number" fields value from "Failing MTMS" section of PEL.
156 # [Failing MTMS]:
157 # [Created by]: 0x2000
158 # [Machine Type Model]: 1234-ABC <---- Machine type
159 # [Section Version]: 1
160 # [Serial Number]: ABCDEFG <---- Serial number
161 # [Sub-section type]: 0
162
163 ${redfish_machine_model}= Redfish.Get Attribute /redfish/v1/Systems/system/ Model
Rahul Maheshwari56dba362020-05-12 00:59:48 -0500164 ${redfish_machine_model}= Replace String Using Regexp ${redfish_machine_model} ^0+ ${EMPTY}
Rahul Maheshwari371e4f82020-04-06 22:53:52 -0500165 ${redfish_serial_number}= Redfish.Get Attribute /redfish/v1/Systems/system/ SerialNumber
Rahul Maheshwari56dba362020-05-12 00:59:48 -0500166 ${redfish_serial_number}= Replace String Using Regexp ${redfish_serial_number} ^0+ ${EMPTY}
Rahul Maheshwari371e4f82020-04-06 22:53:52 -0500167
168 Valid Value pel_machine_type_model ['${redfish_machine_model}']
169 Valid Value pel_serial_number ['${redfish_serial_number}']
170
171 # Check "Machine Type Model" and "Serial Number" fields value from "Extended User Header" section of PEL.
172 ${pel_machine_type_model}= Get PEL Field Value ${id} Extended User Header Reporting Machine Type
Rahul Maheshwari56dba362020-05-12 00:59:48 -0500173 ${pel_machine_type_model}= Replace String Using Regexp ${pel_machine_type_model} ^0+ ${EMPTY}
Rahul Maheshwari371e4f82020-04-06 22:53:52 -0500174 ${pel_serial_number}= Get PEL Field Value ${id} Extended User Header Reporting Serial Number
Rahul Maheshwari56dba362020-05-12 00:59:48 -0500175 ${pel_serial_number}= Replace String Using Regexp ${pel_serial_number} ^0+ ${EMPTY}
Rahul Maheshwari371e4f82020-04-06 22:53:52 -0500176
177 Valid Value pel_machine_type_model ['${redfish_machine_model}']
178 Valid Value pel_serial_number ['${redfish_serial_number}']
179
Rahul Maheshwari58b99fc2020-03-03 00:05:55 -0600180
Rahul Maheshwari1bea6cc2020-03-31 00:53:14 -0500181Verify Host Off State From PEL
182 [Documentation] Verify Host off state from PEL.
183 [Tags] Verify_Host_Off_State_From_PEL
184
185 Redfish Power Off stack_mode=skip
186 Create Test PEL Log
187
188 ${pel_ids}= Get PEL Log Via BMC CLI
189 ${id}= Get From List ${pel_ids} -1
190 ${pel_host_state}= Get PEL Field Value ${id} User Data HostState
191
192 Valid Value pel_host_state ['Off']
193
194
195Verify BMC Version From PEL
196 [Documentation] Verify BMC Version from PEL.
197 [Tags] Verify_BMC_Version_From_PEL
198
199 Create Test PEL Log
200
201 ${pel_ids}= Get PEL Log Via BMC CLI
202 ${id}= Get From List ${pel_ids} -1
203 ${pel_bmc_version}= Get PEL Field Value ${id} User Data BMC Version ID
204
205 ${bmc_version}= Get BMC Version
206 Valid Value bmc_version ['${bmc_version}']
207
208
Rahul Maheshwari8f5256f2020-02-26 23:53:55 -0600209Verify PEL Log After Host Poweron
210 [Documentation] Verify PEL log generation while booting host.
211 [Tags] Verify_PEL_Log_After_Host_Poweron
212
213 Redfish Power Off stack_mode=skip
214 Redfish Purge Event Log
215 Redfish Power On stack_mode=skip
216
217 ${pel_informational_error}= Get PEL Log IDs User Header Event Severity Informational Event
218 ${pel_bmc_created_error}= Get PEL Log IDs Private Header Creator Subsystem BMC
219
220 # Get BMC created non-infomational error.
221 ${pel_bmc_error}= Subtract Lists ${pel_bmc_created_error} ${pel_informational_error}
222
223 Should Be Empty ${pel_bmc_error} msg=Unexpected error log generated during Host poweron.
224
225
Rahul Maheshwari089615b2020-04-02 01:01:38 -0500226Verify BMC Event Log ID
227 [Documentation] Verify BMC Event Log ID from PEL.
228 [Tags] Verify_BMC_Event_Log_ID
229
230 Redfish Purge Event Log
231 Create Test PEL Log
232
233 ${pel_ids}= Get PEL Log Via BMC CLI
234 ${pel_bmc_event_log_id}= Get PEL Field Value ${pel_ids[0]} Private Header BMC Event Log Id
235
236 # Example "BMC Event Log Id" field value from "Private Header" section of PEL.
237 # [Private Header]:
238 # [Created at]: 08/24/1928 12:04:06
239 # [Created by]: 0x584D
240 # [Sub-section type]: 0
241 # [Entry Id]: 0x50000BB7
242 # [Platform Log Id]: 0x8200061D
243 # [CSSVER]:
244 # [Section Version]: 1
245 # [Creator Subsystem]: PHYP
246 # [BMC Event Log Id]: 341 <---- BMC event log id value
247 # [Committed at]: 03/25/1920 12:06:22
248
249 ${redfish_event_logs}= Redfish.Get Properties /redfish/v1/Systems/system/LogServices/EventLog/Entries
250
251 # Example of redfish_event_logs output:
252 # redfish_event_logs:
253 # [@odata.id]: /redfish/v1/Systems/system/LogServices/EventLog/Entries
254 # [Name]: System Event Log Entries
255 # [Members@odata.count]: 1
256 # [@odata.type]: #LogEntryCollection.LogEntryCollection
257 # [Description]: Collection of System Event Log Entries
258 # [Members]:
259 # [0]:
260 # [@odata.id]: /redfish/v1/Systems/system/LogServices/EventLog/Entries/235
261 # [Name]: System Event Log Entry
262 # [Severity]: Critical
263 # [EntryType]: Event
264 # [Created]: 2020-04-02T07:25:13+00:00
265 # [@odata.type]: #LogEntry.v1_5_1.LogEntry
266 # [Id]: 235 <----- Event log ID
267 # [Message]: xyz.openbmc_project.Common.Error.InternalFailure
268
269 Valid Value pel_bmc_event_log_id ['${redfish_event_logs['Members'][0]['Id']}']
270
271
Rahul Maheshwari97d7ab82020-08-04 00:01:42 -0500272Verify FRU Callout
273 [Documentation] Verify FRU callout entries from PEL log.
274 [Tags] Verify_FRU_Callout
275
276 Create Test PEL Log FRU Callout
277
278 ${pel_ids}= Get PEL Log Via BMC CLI
279 ${id}= Get From List ${pel_ids} -1
280 ${pel_callout_section}= Get PEL Field Value ${id} Primary SRC Callout Section
281
282 # Example of PEL Callout Section from "peltool -i <id>" command.
283 # [Callouts]:
284 # [0]:
285 # [FRU Type]: Normal Hardware FRU
286 # [Priority]: Mandatory, replace all with this type as a unit
287 # [Location Code]: U78DA.ND1.1234567-P0
288 # [Part Number]: F191014
289 # [CCIN]: 2E2D
290 # [Serial Number]: YL2E2D010000
291 # [Callout Count]: 1
292
293 Valid Value pel_callout_section['Callout Count'] ['1']
294 Valid Value pel_callout_section['Callouts'][0]['FRU Type'] ['Normal Hardware FRU']
295 Should Contain ${pel_callout_section['Callouts'][0]['Priority']} Mandatory
296
297 # Verify Location Code field of PEL callout with motherboard's Location Code.
298 ${busctl_output}= BMC Execute Command ${CMD_INVENTORY_PREFIX} com.ibm.ipzvpd.Location LocationCode
299 Should Be Equal ${pel_callout_section['Callouts'][0]['Location Code']}
300 ... ${busctl_output[0].split('"')[1].strip('"')}
301
302 # TODO: Compare CCIN and part number fields of PEL callout with Redfish or busctl output.
303 Should Match Regexp ${pel_callout_section['Callouts'][0]['CCIN']} [a-zA-Z0-9]
304 Should Match Regexp ${pel_callout_section['Callouts'][0]['Part Number']} [a-zA-Z0-9]
305
306 # Verify Serial Number field of PEL callout with motherboard's Serial Number.
307 ${busctl_output}= BMC Execute Command
308 ... ${CMD_INVENTORY_PREFIX} xyz.openbmc_project.Inventory.Decorator.Asset SerialNumber
309 Should Be Equal ${pel_callout_section['Callouts'][0]['Serial Number']}
310 ... ${busctl_output[0].split('"')[1].strip('"')}
311
312
313Verify Procedure And Symbolic FRU Callout
314 [Documentation] Verify procedure and symbolic FRU callout from PEL log.
315 [Tags] Verify_Procedure_And_Symbolic_FRU_Callout
316
317 Create Test PEL Log Procedure And Symbolic FRU Callout
318
319 ${pel_ids}= Get PEL Log Via BMC CLI
320 ${id}= Get From List ${pel_ids} -1
321 ${pel_callout_section}= Get PEL Field Value ${id} Primary SRC Callout Section
322
323 # Example of PEL Callout Section from "peltool -i <id>" command.
324 # [Callouts]:
325 # [0]:
326 # [Priority]: Mandatory, replace all with this type as a unit
327 # [Procedure Number]: BMCSP02
328 # [FRU Type]: Maintenance Procedure Required
329 # [1]:
330 # [Priority]: Medium Priority
331 # [Part Number]: SVCDOCS
332 # [FRU Type]: Symbolic FRU
333 # [Callout Count]: 2
334
335 Valid Value pel_callout_section['Callout Count'] ['2']
336
337 # Verify procedural callout info.
338
339 Valid Value pel_callout_section['Callouts'][0]['FRU Type'] ['Maintenance Procedure Required']
340 Should Contain ${pel_callout_section['Callouts'][0]['Priority']} Mandatory
341 # Verify if "Procedure Number" field of PEL has an alphanumeric value.
Rahul Maheshwari6acf0ee2020-10-28 05:37:01 -0500342 Should Match Regexp ${pel_callout_section['Callouts'][0]['Procedure']} [a-zA-Z0-9]
Rahul Maheshwari97d7ab82020-08-04 00:01:42 -0500343
344 # Verify procedural callout info.
345
346 Valid Value pel_callout_section['Callouts'][1]['FRU Type'] ['Symbolic FRU']
347 Should Contain ${pel_callout_section['Callouts'][1]['Priority']} Medium Priority
348 # Verify if "Part Number" field of Symbolic FRU has an alphanumeric value.
349 Should Match Regexp ${pel_callout_section['Callouts'][1]['Part Number']} [a-zA-Z0-9]
350
351
Rahul Maheshwarif4a01aa2020-08-24 23:22:59 -0500352Verify PEL Log Entry For Event Log
353 [Documentation] Create an event log and verify PEL log entry in BMC for the same.
354 [Tags] Verify_PEL_Log_Entry_For_Event_Log
355
356 Redfish Purge Event Log
357 # Create an internal failure error log.
358 BMC Execute Command ${CMD_INTERNAL_FAILURE}
359
360 ${elog_entry}= Get Event Logs
361 # Example of Redfish event logs:
362 # elog_entry:
363 # [0]:
364 # [Message]: xyz.openbmc_project.Common.Error.InternalFailure
365 # [Created]: 2020-04-20T01:55:22+00:00
366 # [Id]: 1
367 # [@odata.id]: /redfish/v1/Systems/system/LogServices/EventLog/Entries/1
368 # [@odata.type]: #LogEntry.v1_4_0.LogEntry
369 # [EntryType]: Event
370 # [Severity]: Critical
371 # [Name]: System Event Log Entry
372
373 ${redfish_log_time}= Convert Date ${elog_entry[0]["Created"]} epoch
374
375 ${pel_records}= Peltool -l
376 # Example output from 'Peltool -l':
377 # pel_records:
378 # [0x50000023]:
379 # [SRC]: BD8D1002
380 # [CreatorID]: BMC
381 # [Message]: An application had an internal failure
382 # [CompID]: 0x1000
383 # [PLID]: 0x50000023
384 # [Commit Time]: 04/20/2020 01:55:22
385 # [Subsystem]: BMC Firmware
386 # [Sev]: Unrecoverable Error
387
388 ${ids}= Get Dictionary Keys ${pel_records}
389 ${id}= Get From List ${ids} 0
390 ${pel_log_time}= Convert Date ${pel_records['${id}']['Commit Time']} epoch
391 ... date_format=%m/%d/%Y %H:%M:%S
392
393 # Verify that both Redfish event and PEL has log entry for internal error with same time stamp.
394 Should Contain Any ${pel_records['${id}']['Message']} internal failure ignore_case=True
395 Should Contain Any ${elog_entry[0]['Message']} InternalFailure ignore_case=True
396
397 Should Be Equal ${redfish_log_time} ${pel_log_time}
398
399
Rahul Maheshwari326d0642020-04-07 06:13:38 -0500400Verify Delete All PEL
401 [Documentation] Verify deleting all PEL logs.
402 [Tags] Verify_Delete_All_PEL
403
404 Create Test PEL Log
405 Create Test PEL Log
406 Peltool --delete-all False
407
408 ${pel_ids}= Get PEL Log Via BMC CLI
409 Should Be Empty ${pel_ids}
410
411
manashsarma4e935382020-10-16 12:00:53 -0500412Verify Informational Error Log
413 [Documentation] Create an informational error log and verify.
414 [Tags] Verify_Informational_Error_Log
415
416 Redfish Purge Event Log
417 # Create an informational error log.
418 BMC Execute Command ${CMD_INFORMATIONAL_ERROR}
419 ${pel_records}= Peltool -lfh
420
421 # An example of information error log data:
422 # {
423 # "0x500006A0": {
424 # "SRC": "BD8D1002",
425 # "Message": "An application had an internal failure",
426 # "PLID": "0x500006A0",
427 # "CreatorID": "BMC",
428 # "Subsystem": "BMC Firmware",
429 # "Commit Time": "10/14/2020 11:41:38",
430 # "Sev": "Informational Event",
431 # "CompID": "0x1000"
432 # }
433 # }
434
435 ${ids}= Get Dictionary Keys ${pel_records}
436 ${id}= Get From List ${ids} 0
437 Should Contain ${pel_records['${id}']['Sev']} Informational
438
439
manashsarma15fe5632020-10-18 03:42:58 -0500440Verify Predictable Error Log
441 [Documentation] Create a predictive error and verify.
442 [Tags] Verify_Predictable_Error_Log
443
444 # Create a predictable error log.
445 BMC Execute Command ${CMD_PREDICTIVE_ERROR}
446 ${pel_records}= Peltool -l
447
448 # An example of predictive error log data:
449 # {
450 # "0x5000069E": {
451 # "SRC": "BD8D1002",
452 # "Message": "An application had an internal failure",
453 # "PLID": "0x5000069E",
454 # "CreatorID": "BMC",
455 # "Subsystem": "BMC Firmware",
456 # "Commit Time": "10/14/2020 11:40:07",
457 # "Sev": "Predictive Error",
458 # "CompID": "0x1000"
459 # }
460 # }
461
462 ${pel_ids}= Get PEL Log Via BMC CLI
463 ${id}= Get From List ${pel_ids} -1
464 Should Contain ${pel_records['${id}']['Sev']} Predictive
465
466
467Verify Unrecoverable Error Log
468 [Documentation] Create an unrecoverable error and verify.
469 [Tags] Verify_Unrecoverable_Error_Log
470
471 # Create an internal failure error log.
472 BMC Execute Command ${CMD_UNRECOVERABLE_ERROR}
473 ${pel_records}= Peltool -l
474
475 # An example of unrecoverable error log data:
476 # {
477 # "0x50000CC5": {
478 # "SRC": "BD8D1002",
479 # "Message": "An application had an internal failure",
480 # "PLID": "0x50000CC5",
481 # "CreatorID": "BMC",
482 # "Subsystem": "BMC Firmware",
483 # "Commit Time": "04/01/2020 16:44:55",
484 # "Sev": "Unrecoverable Error",
485 # "CompID": "0x1000"
486 # }
487 # }
488
489 ${pel_ids}= Get PEL Log Via BMC CLI
490 ${id}= Get From List ${pel_ids} -1
491 Should Contain ${pel_records['${id}']['Sev']} Unrecoverable
492
493
manashsarma595282d2020-10-20 13:22:31 -0500494Verify Error Logging Rotation Policy
495 [Documentation] Verify error logging rotation policy.
496 [Tags] Verify_Error_Logging_Rotation_Policy
497 [Template] Error Logging Rotation Policy
manashsarmad073a0a2020-10-20 12:54:59 -0500498
manashsarma557b6322020-11-29 12:08:32 -0600499 # Error logs to be created % of total logging space when error
500 # log exceeds max limit.
501 Informational BMC 3000 15
502 Predictive BMC 3000 30
503 Unrecoverable BMC 3000 30
504 Informational BMC 1500, Predictive BMC 1500 45
505 Informational BMC 1500, Unrecoverable BMC 1500 45
506 Unrecoverable BMC 1500, Predictive BMC 1500 30
Rahul Maheshwarib4cacb52021-01-18 23:57:29 -0600507
508
509Verify Error Logging Rotation Policy With All Types Of Errors
510 [Documentation] Verify error logging rotation policy with all types of errors.
511 [Tags] Verify_Error_Logging_Rotation_Policy_With_All_Types_Errors
512 [Template] Error Logging Rotation Policy
513
514 # Error logs to be created % of total logging space when error
515 # log exceeds max limit.
manashsarma557b6322020-11-29 12:08:32 -0600516 Unrecoverable BMC 1000, Informational BMC 1000, Predictive BMC 1000 45
manashsarmac5131662020-11-12 12:25:59 -0600517
manashsarma1810a5b2020-12-09 20:09:20 -0600518
519Verify Error Logging Rotation Policy With HOST Error Logs
520 [Documentation] Verify error logging rotation policy for non bmc error logs.
521 [Tags] Verify_Error_Logging_Rotation_Policy_With_HOST_Error_Logs
522 [Setup] Run Keywords Open Connection for SCP AND scp.Put File ${UNRECOVERABLE_FILE_PATH}
Rahul Maheshwarie54d16f2021-02-04 05:20:46 -0600523 ... /tmp/FILE_NBMC_UNRECOVERABLE AND Redfish.Login
manashsarma1810a5b2020-12-09 20:09:20 -0600524 [Template] Error Logging Rotation Policy
525
526 # Error logs to be created % of total logging space when error
527 # log exceeds max limit.
528 Unrecoverable HOST 3000 30
529 Unrecoverable HOST 1500, Informational BMC 1500 45
530 Unrecoverable HOST 1500, Predictive BMC 1500 60
Rahul Maheshwarib4cacb52021-01-18 23:57:29 -0600531
532
533Verify Error Logging Rotation Policy With Unrecoverable HOST And BMC Error Logs
534 [Documentation] Verify error logging rotation policy with unrecoverable HOST and BMC error logs.
535 [Tags] Verify_Error_Logging_Rotation_Policy_With_Unrecoverable_HOST_And_BMC_Error_Logs
536 [Setup] Run Keywords Open Connection for SCP AND scp.Put File ${UNRECOVERABLE_FILE_PATH}
Rahul Maheshwarie54d16f2021-02-04 05:20:46 -0600537 ... /tmp/FILE_NBMC_UNRECOVERABLE AND Redfish.Login
Rahul Maheshwarib4cacb52021-01-18 23:57:29 -0600538 [Template] Error Logging Rotation Policy
539
540 # Error logs to be created % of total logging space when error
541 # log exceeds max limit.
manashsarma1810a5b2020-12-09 20:09:20 -0600542 Unrecoverable HOST 1500, Unrecoverable BMC 1500 60
543
544
manashsarma6f1f2a42020-12-15 07:29:41 -0600545Verify Old Logs Are Deleted When Count Crosses Max
546 [Documentation] Verify that when the count crosses max, older logs are deleted.
547 [Tags] Verify_Old_Logs_Are_Deleted_When_Count_Crosses_Max
548
549 Redfish Purge Event Log
manashsarma6f1f2a42020-12-15 07:29:41 -0600550 # Create 3000 error logs.
551 FOR ${count} IN RANGE ${3000}
552 BMC Execute Command ${CMD_PREDICTIVE_ERROR}
553 END
554
555 # Retrieve the IDs of the logs.
556 ${pel_ids}= Get PEL Log Via BMC CLI
manashsarmadd132682021-04-08 07:59:13 -0500557 ${1st_id}= Get From List ${pel_ids} 0
558 ${3000th_id}= Get From List ${pel_ids} 2999
manashsarma6f1f2a42020-12-15 07:29:41 -0600559
560 # Now create 3001st log to cross threshold limit and trigger error logs rotation.
561 BMC Execute Command ${CMD_PREDICTIVE_ERROR}
manashsarmadd132682021-04-08 07:59:13 -0500562
manashsarma6f1f2a42020-12-15 07:29:41 -0600563 # Wait few seconds for error logs rotation to complete.
564 Sleep 10s
565
566 # Now verify that first log is no more available but the 3000th is available.
manashsarmadd132682021-04-08 07:59:13 -0500567 ${status} ${output}= Run Keyword And Ignore Error Peltool -i ${1st_id}
568 Should Be True '${status}' == 'FAIL'
manashsarma6f1f2a42020-12-15 07:29:41 -0600569 Should Contain ${output} PEL not found
manashsarmadd132682021-04-08 07:59:13 -0500570
571 ${status} ${output}= Run Keyword And Ignore Error Peltool -i ${3000th_id}
572 Should Be True '${status}' == 'PASS'
manashsarma6f1f2a42020-12-15 07:29:41 -0600573 Should Not Contain ${output} PEL not found
574
575
manashsarma5f201202020-10-30 12:52:04 -0500576Verify Reverse Order Of PEL Logs
577 [Documentation] Verify PEL command to output PEL logs in reverse order.
578 [Tags] Verify_Reverse_PEL_Logs
579
580 Redfish Purge Event Log
manashsarmac5131662020-11-12 12:25:59 -0600581
582 # Below commands create unrecoverable error log at first and then the predictable error.
manashsarma5f201202020-10-30 12:52:04 -0500583 BMC Execute Command ${CMD_UNRECOVERABLE_ERROR}
584 BMC Execute Command ${CMD_PREDICTIVE_ERROR}
585
manashsarmac5131662020-11-12 12:25:59 -0600586 # Using peltool -lr, recent PELs appear first. Hence the ID of first PEL is greater than the next.
587 ${pel_records}= peltool -lr
manashsarma5f201202020-10-30 12:52:04 -0500588
manashsarmac5131662020-11-12 12:25:59 -0600589 # It is found that, variables like dictionary always keep items in sorted order that makes
590 # this verification not possible, hence json is used to keep the items original order.
591 ${pel_records}= Convert To String ${pel_records}
592 ${json_string}= Replace String ${pel_records} ' "
593 ${json_object}= Evaluate json.loads('''${json_string}''') json
594
595 ${list}= Convert To List ${json_object}
596
597 ${id1}= Get From List ${list} 0
598 ${id1}= Convert To Integer ${id1}
599 ${id2}= Get From List ${list} 1
600 ${id2}= Convert To Integer ${id2}
601
602 Should Be True ${id1} > ${id2}
manashsarma5f201202020-10-30 12:52:04 -0500603
604
manashsarma6d75bd82020-10-30 07:36:05 -0500605Verify Total PEL Count
606 [Documentation] Verify total PEL count returned by peltool command.
607 [Tags] Verify_Total_PEL_Count
608
609 # Initially remove all logs.
610 Redfish Purge Event Log
611
612 # Generate a random number between 1-20.
613 ${random}= Evaluate random.randint(1, 20) modules=random
614
615 # Generate predictive error log multiple times.
616 FOR ${count} IN RANGE 0 ${random}
617 BMC Execute Command ${CMD_PREDICTIVE_ERROR}
618 END
619
620 # Check PEL log count via peltool command and compare it with actual generated log count.
621 ${pel_records}= peltool -n
622
623 Should Be Equal ${pel_records['Number of PELs found']} ${random}
624
625
manashsarma407deda2020-10-30 10:36:26 -0500626Verify Listing Information Error
627 [Documentation] Verify that information error logs can only be listed using -lfh option of peltool.
628 [Tags] Verify_Listing_Information_Error
629
630 # Initially remove all logs.
631 Redfish Purge Event Log
632 BMC Execute Command ${CMD_INFORMATIONAL_ERROR}
633
634 # Generate informational logs and verify that it would not get listed by peltool's list command.
635 ${pel_records}= peltool -l
manashsarma31d807b2020-11-11 12:49:46 -0600636 ${ids}= Get Dictionary Keys ${pel_records}
637 Should Be Empty ${ids}
manashsarma407deda2020-10-30 10:36:26 -0500638
639 # Verify that information logs get listed using peltool's list command with -lfh option.
640 ${pel_records}= peltool -lfh
manashsarma31d807b2020-11-11 12:49:46 -0600641 ${ids}= Get Dictionary Keys ${pel_records}
642 Should Not Be Empty ${ids}
643 ${id}= Get From List ${ids} 0
manashsarma407deda2020-10-30 10:36:26 -0500644 Should Contain ${pel_records['${id}']['Sev']} Informational
645
646
manashsarma54539ff2020-11-23 02:32:36 -0600647Verify PEL Delete
648 [Documentation] Verify that peltool command can delete PEL log based on id.
649 [Tags] Verify_PEL_Delete
650
651 BMC Execute Command ${CMD_PREDICTIVE_ERROR}
652 ${pel_ids}= Get PEL Log Via BMC CLI
653 ${id}= Get From List ${pel_ids} -1
Rahul Maheshwari5eab56c2021-01-06 23:58:46 -0600654 Peltool -d ${id} False
655 Run Keyword and Expect Error *PEL not found* Peltool -i ${id}
manashsarma54539ff2020-11-23 02:32:36 -0600656
657
Rahul Maheshwarifaa5d202020-02-24 23:32:57 -0600658*** Keywords ***
659
manashsarma595282d2020-10-20 13:22:31 -0500660Error Logging Rotation Policy
661 [Documentation] Verify that when maximum log limit is reached, given error logging type
662 ... are deleted when reached their max allocated space.
663 [Arguments] ${error_log_type} ${max_allocated_space_percentage}
664
665 # Description of argument(s):
manashsarma557b6322020-11-29 12:08:32 -0600666 # error_log Error logs to be created (E.g. Informational BMC 3000
667 # stands for BMC created 3000 informational error logs).
manashsarma595282d2020-10-20 13:22:31 -0500668 # max_allocated_space_percentage The maximum percentage of disk usage for given error
669 # log type when maximum count/log size is reached.
670 # The maximum error log count is 3000.
671
672 # Initially remove all logs. Purging is done to ensure that, only specific logs are present
673 # in BMC during the test.
674 Redfish Purge Event Log
675
manashsarma557b6322020-11-29 12:08:32 -0600676 @{lists}= Split String ${error_log_type} ,${SPACE}
manashsarma595282d2020-10-20 13:22:31 -0500677
manashsarma557b6322020-11-29 12:08:32 -0600678 ${length}= Get Length ${lists}
manashsarma595282d2020-10-20 13:22:31 -0500679
manashsarma557b6322020-11-29 12:08:32 -0600680 FOR ${list} IN RANGE ${length}
681 @{words}= Split String ${lists}[${list}] ${SPACE}
682 Create Error Log ${words}[0] ${words}[1] ${words}[2]
manashsarma595282d2020-10-20 13:22:31 -0500683 END
684
manashsarma557b6322020-11-29 12:08:32 -0600685 # Create an additional error log to exceed max error logs limit.
686 BMC Execute Command ${CMD_UNRECOVERABLE_ERROR}
687
manashsarma595282d2020-10-20 13:22:31 -0500688 # Delay for BMC to perform delete older error logs when log limit exceeds.
689 Sleep 10s
690
691 # Verify disk usage is around max allocated space. Maximum usage is around 3MB not exactly 3MB
692 # (for informational log) and around 6 MB for unrecoverable / predictive error log. So, usage
693 # percentage is NOT exactly 15% and 30%. So, an error/accuracy factor 0.5 percent is added.
694
695 ${disk_usage_percentage}= Get Disk Usage For Error Logs
696 ${percent_diff}= Evaluate ${disk_usage_percentage} - ${max_allocated_space_percentage}
697 ${percent_diff}= Evaluate abs(${percent_diff})
698 Should Be True ${percent_diff} <= 0.5
699
700
manashsarma557b6322020-11-29 12:08:32 -0600701Create Error Log
702 [Arguments] ${error_severity} ${error_creator} ${count}
703
704 # Description of argument(s):
705 # error_severity Severity of the error (E.g. Informational, Unrecoberable or Predictive)
706 # error_creator Name of error log's creator(E.g BMC, Host Boot)
707 # count Number of error logs to be generated.
708
709 FOR ${i} IN RANGE 0 ${count}
710 ${cmd}= Set Variable If
Rahul Maheshwari5eab56c2021-01-06 23:58:46 -0600711 ... '${error_severity}' == 'Informational' and '${error_creator}' == 'BMC' ${CMD_INFORMATIONAL_ERROR}
712 ... '${error_severity}' == 'Predictive' and '${error_creator}' == 'BMC' ${CMD_PREDICTIVE_ERROR}
713 ... '${error_severity}' == 'Unrecoverable' and '${error_creator}' == 'BMC' ${CMD_UNRECOVERABLE_ERROR}
714 ... '${error_severity}' == 'Unrecoverable' and '${error_creator}' == 'HOST' ${CMD_UNRECOVERABLE_HOST_ERROR}
manashsarma557b6322020-11-29 12:08:32 -0600715 BMC Execute Command ${cmd}
716 END
717
718
manashsarmad073a0a2020-10-20 12:54:59 -0500719Get Disk Usage For Error Logs
720 [Documentation] Get disk usage percentage for error logs.
721
manashsarma407deda2020-10-30 10:36:26 -0500722 ${usage_output} ${stderr} ${rc}= BMC Execute Command du /var/lib/phosphor-logging/errors
manashsarmad073a0a2020-10-20 12:54:59 -0500723
724 ${usage_output}= Fetch From Left ${usage_output} \/
725
726 # Covert disk usage unit from KB to MB.
727 ${usage_output}= Evaluate ${usage_output} / 1024
728
729 # Logging disk capacity limit is set to 20MB. So calculating the log usage percentage.
730 ${usage_percent}= Evaluate ${usage_output} / 20 * 100
731
732 [return] ${usage_percent}
733
734
Rahul Maheshwari8f5256f2020-02-26 23:53:55 -0600735Get PEL Log IDs
736 [Documentation] Returns the list of PEL log IDs which contains given field's value.
737 [Arguments] ${pel_section} ${pel_field} @{pel_field_value}
738
739 # Description of argument(s):
740 # pel_section The section of PEL (e.g. Private Header, User Header).
741 # pel_field The PEL field (e.g. Event Severity, Event Type).
742 # pel_field_value The list of PEL's field value (e.g. Unrecoverable Error).
743
744 ${pel_ids}= Get PEL Log Via BMC CLI
745 @{pel_id_list}= Create List
746
747 FOR ${id} IN @{pel_ids}
748 ${pel_output}= Peltool -i ${id}
749 # Example of PEL output from "peltool -i <id>" command.
750 # [Private Header]:
751 # [Created at]: 08/24/1928 12:04:06
752 # [Created by]: 0x584D
753 # [Sub-section type]: 0
754 # [Entry Id]: 0x50000BB7
755 # [Platform Log Id]: 0x8200061D
756 # [CSSVER]:
757 # [Section Version]: 1
758 # [Creator Subsystem]: PHYP
759 # [BMC Event Log Id]: 341
760 # [Committed at]: 03/25/1920 12:06:22
761 # [User Header]:
762 # [Log Committed by]: 0x4552
763 # [Action Flags]:
764 # [0]: Report Externally
765 # [Subsystem]: I/O Subsystem
766 # [Event Type]: Miscellaneous, Informational Only
767 # [Sub-section type]: 0
768 # [Event Scope]: Entire Platform
769 # [Event Severity]: Informational Event
770 # [Host Transmission]: Not Sent
771 # [Section Version]: 1
772
773 ${pel_section_output}= Get From Dictionary ${pel_output} ${pel_section}
774 ${pel_field_output}= Get From Dictionary ${pel_section_output} ${pel_field}
775 Run Keyword If '${pel_field_output}' in @{pel_field_value} Append To List ${pel_id_list} ${id}
776 END
777 Sort List ${pel_id_list}
778
779 [Return] ${pel_id_list}
780
781
Rahul Maheshwarif575c902020-02-26 04:38:40 -0600782Get PEL Log Via BMC CLI
783 [Documentation] Returns the list of PEL IDs using BMC CLI.
Rahul Maheshwarifaa5d202020-02-24 23:32:57 -0600784
785 ${pel_records}= Peltool -l
Rahul Maheshwarif575c902020-02-26 04:38:40 -0600786 ${ids}= Get Dictionary Keys ${pel_records}
Rahul Maheshwari1cffc4b2020-04-02 02:58:16 -0500787 Sort List ${ids}
Rahul Maheshwarifaa5d202020-02-24 23:32:57 -0600788
Rahul Maheshwarif575c902020-02-26 04:38:40 -0600789 [Return] ${ids}
Rahul Maheshwari60b58a82020-04-02 02:40:19 -0500790
791
792Get PEL Field Value
793 [Documentation] Returns the value of given PEL's field.
794 [Arguments] ${pel_id} ${pel_section} ${pel_field}
795
796 # Description of argument(s):
797 # pel_id The ID of PEL (e.g. 0x5000002D, 0x5000002E).
798 # pel_section The section of PEL (e.g. Private Header, User Header)
799 # pel_field The PEL field (e.g. Event Severity, Event Type).
800
801 ${pel_output}= Peltool -i ${pel_id}
802
803 # Example of PEL output from "peltool -i <id>" command.
804 # [Private Header]:
805 # [Created at]: 08/24/1928 12:04:06
806 # [Created by]: 0x584D
807 # [Sub-section type]: 0
808 # [Entry Id]: 0x50000BB7
809 # [Platform Log Id]: 0x8200061D
810 # [CSSVER]:
811 # [Section Version]: 1
812 # [Creator Subsystem]: PHYP
813 # [BMC Event Log Id]: 341
814 # [Committed at]: 03/25/1920 12:06:22
815 # [User Header]:
816 # [Log Committed by]: 0x4552
817 # [Action Flags]:
818 # [0]: Report Externally
819 # [Subsystem]: I/O Subsystem
820 # [Event Type]: Miscellaneous, Informational Only
821 # [Sub-section type]: 0
822 # [Event Scope]: Entire Platform
823 # [Event Severity]: Informational Event
824 # [Host Transmission]: Not Sent
825 # [Section Version]: 1
826
827 ${pel_section_output}= Get From Dictionary ${pel_output} ${pel_section}
828 ${pel_field_output}= Get From Dictionary ${pel_section_output} ${pel_field}
829
830 [Return] ${pel_field_output}