xref: /openbmc/openbmc-test-automation/openpower/pel/test_bmc_pel.robot (revision 2ab8e054fa96a970e1b43b9b61bff53250451e26)
1*** Settings ***
2Documentation   This suite tests Platform Event Log (PEL) functionality of OpenBMC.
3
4Library         ../../lib/pel_utils.py
5Variables       ../../data/pel_variables.py
6Resource        ../../lib/list_utils.robot
7Resource        ../../lib/logging_utils.robot
8Resource        ../../lib/openbmc_ffdc.robot
9
10Test Setup      Redfish.Login
11Test Teardown   Run Keywords  Redfish.Logout  AND  FFDC On Test Case Fail
12
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
19
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
29${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
33${CMD_INVENTORY_PREFIX}  busctl get-property xyz.openbmc_project.Inventory.Manager
34...  /xyz/openbmc_project/inventory/system/chassis/motherboard
35
36@{mandatory_pel_fileds}   Private Header  User Header  Primary SRC  Extended User Header  Failing MTMS
37
38
39*** Test Cases ***
40
41Create Test PEL Log And Verify
42    [Documentation]  Create PEL log using busctl command and verify via peltool.
43    [Tags]  Create_Test_PEL_Log_And_Verify
44
45    Redfish Purge Event Log
46    Create Test PEL Log
47    ${pel_id}=  Get PEL Log Via BMC CLI
48    Should Not Be Empty  ${pel_id}  msg=System PEL log entry is empty.
49
50
51Verify PEL Log Details
52    [Documentation]  Verify PEL log details via peltool.
53    [Tags]  Verify_PEL_Log_Details
54
55    Redfish Purge Event Log
56
57    ${bmc_time1}=  CLI Get BMC DateTime
58    Create Test PEL Log
59    ${bmc_time2}=  CLI Get BMC DateTime
60
61    ${pel_records}=  Peltool  -l
62
63    # Example output from 'Peltool  -l':
64    # pel_records:
65    # [0x50000012]:
66    #   [CreatorID]:                  BMC
67    #   [CompID]:                     0x1000
68    #   [PLID]:                       0x50000012
69    #   [Subsystem]:                  BMC Firmware
70    #   [Message]:                    An application had an internal failure
71    #   [SRC]:                        BD8D1002
72    #   [Commit Time]:                03/02/2020  09:35:15
73    #   [Sev]:                        Unrecoverable Error
74
75    ${ids}=  Get Dictionary Keys  ${pel_records}
76    ${id}=  Get From List  ${ids}  0
77
78    @{pel_fields}=  Create List  CreatorID  Subsystem  Message  Sev
79    FOR  ${field}  IN  @{pel_fields}
80      Valid Value  pel_records['${id}']['${field}']  ['${PEL_DETAILS['${field}']}']
81    END
82
83    Valid Value  pel_records['${id}']['PLID']  ['${id}']
84
85    # Verify if "CompID" and "SRC" fields of PEL has alphanumeric value.
86    Should Match Regexp  ${pel_records['${id}']['CompID']}  [a-zA-Z0-9]
87    Should Match Regexp  ${pel_records['${id}']['SRC']}  [a-zA-Z0-9]
88
89    ${pel_date_time}=  Convert Date  ${pel_records['${id}']['Commit Time']}
90    ...  date_format=%m/%d/%Y %H:%M:%S  exclude_millis=yes
91
92    # Convert BMC and PEL time to epoch time before comparing.
93    ${bmc_time1_epoch}=  Convert Date  ${bmc_time1}  epoch
94    ${pel_time_epoch}=  Convert Date  ${pel_date_time}  epoch
95    ${bmc_time2_epoch}=  Convert Date  ${bmc_time2}  epoch
96
97    Should Be True  ${bmc_time1_epoch} <= ${pel_time_epoch} <= ${bmc_time2_epoch}
98
99
100Verify Mandatory Sections Of Error Log PEL
101    [Documentation]  Verify mandatory sections of error log PEL.
102    [Tags]  Verify_Mandatory_Sections_Of_Error_Log_PEL
103
104    Create Test PEL Log
105
106    ${pel_ids}=  Get PEL Log Via BMC CLI
107    ${pel_id}=  Get From List  ${pel_ids}  -1
108    ${pel_output}=  Peltool  -i ${pel_id}
109    ${pel_sections}=  Get Dictionary Keys  ${pel_output}
110
111    List Should Contain Sub List  ${pel_sections}  ${mandatory_pel_fileds}
112
113
114Verify PEL Log Persistence After BMC Reboot
115    [Documentation]  Verify PEL log persistence after BMC reboot.
116    [Tags]  Verify_PEL_Log_Persistence_After_BMC_Reboot
117
118    Create Test PEL Log
119    ${pel_before_reboot}=  Get PEL Log Via BMC CLI
120
121    Redfish OBMC Reboot (off)
122    ${pel_after_reboot}=  Get PEL Log Via BMC CLI
123
124    List Should Contain Sub List  ${pel_after_reboot}  ${pel_before_reboot}
125
126
127Verify PEL ID Numbering
128    [Documentation]  Verify PEL ID numbering.
129    [Tags]  Verify_PEL_ID_Numbering
130
131    Redfish Purge Event Log
132    Create Test PEL Log
133    Create Test PEL Log
134
135    ${pel_ids}=  Get PEL Log Via BMC CLI
136
137    # Example of PEL IDs from PEL logs.
138    #  [0x50000012]:             <--- First PEL ID
139    #    [CreatorID]:                  BMC
140    #    [CompID]:                     0x1000
141    #    [PLID]:                       0x50000012
142    #    [Subsystem]:                  BMC Firmware
143    #    [Message]:                    An application had an internal failure
144    #    [SRC]:                        BD8D1002
145    #    [Commit Time]:                03/02/2020  09:35:15
146    #    [Sev]:                        Unrecoverable Error
147    #
148    #  [0x50000013]:             <--- Second PEL ID
149    #    [CreatorID]:                  BMC
150    #    [CompID]:                     0x1000
151    #    [PLID]:                       0x50000013
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    Should Be True  ${pel_ids[1]} == ${pel_ids[0]}+1
159
160Verify Machine Type Model And Serial Number
161    [Documentation]  Verify machine type model and serial number from PEL.
162    [Tags]  Verify_Machine_Type_Model_And_Serial_Number
163
164    Create Test PEL Log
165
166    ${pel_ids}=  Get PEL Log Via BMC CLI
167    ${id}=  Get From List  ${pel_ids}  -1
168
169    ${pel_serial_number}=  Get PEL Field Value  ${id}  Failing MTMS  Serial Number
170    ${pel_serial_number}=  Replace String Using Regexp  ${pel_serial_number}  ^0+  ${EMPTY}
171    ${pel_machine_type_model}=  Get PEL Field Value  ${id}  Failing MTMS  Machine Type Model
172    ${pel_machine_type_model}=  Replace String Using Regexp  ${pel_machine_type_model}  ^0+  ${EMPTY}
173
174    # Example of "Machine Type Model" and "Serial Number" fields value from "Failing MTMS" section of PEL.
175    #  [Failing MTMS]:
176    #    [Created by]:                                 0x2000
177    #    [Machine Type Model]:                         1234-ABC   <---- Machine type
178    #    [Section Version]:                            1
179    #    [Serial Number]:                              ABCDEFG    <---- Serial number
180    #    [Sub-section type]:                           0
181
182    ${redfish_machine_model}=  Redfish.Get Attribute  /redfish/v1/Systems/system/  Model
183    ${redfish_machine_model}=  Replace String Using Regexp  ${redfish_machine_model}  ^0+  ${EMPTY}
184    ${redfish_serial_number}=  Redfish.Get Attribute  /redfish/v1/Systems/system/  SerialNumber
185    ${redfish_serial_number}=  Replace String Using Regexp  ${redfish_serial_number}  ^0+  ${EMPTY}
186
187    Valid Value  pel_machine_type_model  ['${redfish_machine_model}']
188    Valid Value  pel_serial_number  ['${redfish_serial_number}']
189
190    # Check "Machine Type Model" and "Serial Number" fields value from "Extended User Header" section of PEL.
191    ${pel_machine_type_model}=  Get PEL Field Value  ${id}  Extended User Header  Reporting Machine Type
192    ${pel_machine_type_model}=  Replace String Using Regexp  ${pel_machine_type_model}  ^0+  ${EMPTY}
193    ${pel_serial_number}=  Get PEL Field Value  ${id}  Extended User Header  Reporting Serial Number
194    ${pel_serial_number}=  Replace String Using Regexp  ${pel_serial_number}  ^0+  ${EMPTY}
195
196    Valid Value  pel_machine_type_model  ['${redfish_machine_model}']
197    Valid Value  pel_serial_number  ['${redfish_serial_number}']
198
199
200Verify Host Off State From PEL
201    [Documentation]  Verify Host off state from PEL.
202    [Tags]  Verify_Host_Off_State_From_PEL
203
204    Redfish Power Off  stack_mode=skip
205    Create Test PEL Log
206
207    ${pel_ids}=  Get PEL Log Via BMC CLI
208    ${id}=  Get From List  ${pel_ids}  -1
209    ${pel_host_state}=  Get PEL Field Value  ${id}  User Data  HostState
210
211    Valid Value  pel_host_state  ['Off']
212
213
214Verify BMC Version From PEL
215    [Documentation]  Verify BMC Version from PEL.
216    [Tags]  Verify_BMC_Version_From_PEL
217
218    Create Test PEL Log
219
220    ${pel_ids}=  Get PEL Log Via BMC CLI
221    ${id}=  Get From List  ${pel_ids}  -1
222    ${pel_bmc_version}=  Get PEL Field Value  ${id}  User Data  BMC Version ID
223
224    ${bmc_version}=  Get BMC Version
225    Valid Value  bmc_version  ['${bmc_version}']
226
227
228Verify PEL Log After Host Poweron
229    [Documentation]  Verify PEL log generation while booting host.
230    [Tags]  Verify_PEL_Log_After_Host_Poweron
231
232    Redfish Power Off  stack_mode=skip
233    Redfish Purge Event Log
234    Redfish Power On  stack_mode=skip
235
236    ${pel_informational_error}=  Get PEL Log IDs  User Header  Event Severity  Informational Event
237    ${pel_bmc_created_error}=  Get PEL Log IDs  Private Header  Creator Subsystem  BMC
238
239    # Get BMC created non-infomational error.
240    ${pel_bmc_error}=  Subtract Lists  ${pel_bmc_created_error}  ${pel_informational_error}
241
242    Should Be Empty  ${pel_bmc_error}  msg=Unexpected error log generated during Host poweron.
243
244
245Verify BMC Event Log ID
246    [Documentation]  Verify BMC Event Log ID from PEL.
247    [Tags]  Verify_BMC_Event_Log_ID
248
249    Redfish Purge Event Log
250    Create Test PEL Log
251
252    ${pel_ids}=  Get PEL Log Via BMC CLI
253    ${pel_bmc_event_log_id}=  Get PEL Field Value  ${pel_ids[0]}  Private Header  BMC Event Log Id
254
255    # Example "BMC Event Log Id" field value from "Private Header" section of PEL.
256    #  [Private Header]:
257    #    [Created at]:                 08/24/1928 12:04:06
258    #    [Created by]:                 0x584D
259    #    [Sub-section type]:           0
260    #    [Entry Id]:                   0x50000BB7
261    #    [Platform Log Id]:            0x8200061D
262    #    [CSSVER]:
263    #    [Section Version]:            1
264    #    [Creator Subsystem]:          PHYP
265    #    [BMC Event Log Id]:           341      <---- BMC event log id value
266    #    [Committed at]:               03/25/1920 12:06:22
267
268    ${redfish_event_logs}=  Redfish.Get Properties  /redfish/v1/Systems/system/LogServices/EventLog/Entries
269
270    # Example of redfish_event_logs output:
271    # redfish_event_logs:
272    #  [@odata.id]:                    /redfish/v1/Systems/system/LogServices/EventLog/Entries
273    #  [Name]:                         System Event Log Entries
274    #  [Members@odata.count]:          1
275    #  [@odata.type]:                  #LogEntryCollection.LogEntryCollection
276    #  [Description]:                  Collection of System Event Log Entries
277    #  [Members]:
278    #    [0]:
279    #      [@odata.id]:                /redfish/v1/Systems/system/LogServices/EventLog/Entries/235
280    #      [Name]:                     System Event Log Entry
281    #      [Severity]:                 Critical
282    #      [EntryType]:                Event
283    #      [Created]:                  2020-04-02T07:25:13+00:00
284    #      [@odata.type]:              #LogEntry.v1_5_1.LogEntry
285    #      [Id]:                       235          <----- Event log ID
286    #      [Message]:                  xyz.openbmc_project.Common.Error.InternalFailure
287
288    Valid Value  pel_bmc_event_log_id  ['${redfish_event_logs['Members'][0]['Id']}']
289
290
291Verify FRU Callout
292    [Documentation]  Verify FRU callout entries from PEL log.
293    [Tags]  Verify_FRU_Callout
294
295    Create Test PEL Log  FRU Callout
296
297    ${pel_ids}=  Get PEL Log Via BMC CLI
298    ${id}=  Get From List  ${pel_ids}  -1
299    ${pel_callout_section}=  Get PEL Field Value  ${id}  Primary SRC  Callout Section
300
301    # Example of PEL Callout Section from "peltool -i <id>" command.
302    #  [Callouts]:
303    #    [0]:
304    #      [FRU Type]:                 Normal Hardware FRU
305    #      [Priority]:                 Mandatory, replace all with this type as a unit
306    #      [Location Code]:            U78DA.ND1.1234567-P0
307    #      [Part Number]:              F191014
308    #      [CCIN]:                     2E2D
309    #      [Serial Number]:            YL2E2D010000
310    #  [Callout Count]:                1
311
312    Valid Value  pel_callout_section['Callout Count']  ['1']
313    Valid Value  pel_callout_section['Callouts'][0]['FRU Type']  ['Normal Hardware FRU']
314    Should Contain  ${pel_callout_section['Callouts'][0]['Priority']}  Mandatory
315
316    # Verify Location Code field of PEL callout with motherboard's Location Code.
317    ${busctl_output}=  BMC Execute Command  ${CMD_INVENTORY_PREFIX} com.ibm.ipzvpd.Location LocationCode
318    Should Be Equal  ${pel_callout_section['Callouts'][0]['Location Code']}
319    ...  ${busctl_output[0].split('"')[1].strip('"')}
320
321    # TODO: Compare CCIN and part number fields of PEL callout with Redfish or busctl output.
322    Should Match Regexp  ${pel_callout_section['Callouts'][0]['CCIN']}  [a-zA-Z0-9]
323    Should Match Regexp  ${pel_callout_section['Callouts'][0]['Part Number']}  [a-zA-Z0-9]
324
325    # Verify Serial Number field of PEL callout with motherboard's Serial Number.
326    ${busctl_output}=  BMC Execute Command
327    ...  ${CMD_INVENTORY_PREFIX} xyz.openbmc_project.Inventory.Decorator.Asset SerialNumber
328    Should Be Equal  ${pel_callout_section['Callouts'][0]['Serial Number']}
329    ...  ${busctl_output[0].split('"')[1].strip('"')}
330
331
332Verify Procedure And Symbolic FRU Callout
333    [Documentation]  Verify procedure and symbolic FRU callout from PEL log.
334    [Tags]  Verify_Procedure_And_Symbolic_FRU_Callout
335
336    Create Test PEL Log   Procedure And Symbolic FRU Callout
337
338    ${pel_ids}=  Get PEL Log Via BMC CLI
339    ${id}=  Get From List  ${pel_ids}  -1
340    ${pel_callout_section}=  Get PEL Field Value  ${id}  Primary SRC  Callout Section
341
342    # Example of PEL Callout Section from "peltool -i <id>" command.
343    #  [Callouts]:
344    #    [0]:
345    #      [Priority]:                                 Mandatory, replace all with this type as a unit
346    #      [Procedure Number]:                         BMCSP02
347    #      [FRU Type]:                                 Maintenance Procedure Required
348    #    [1]:
349    #      [Priority]:                                 Medium Priority
350    #      [Part Number]:                              SVCDOCS
351    #      [FRU Type]:                                 Symbolic FRU
352    #  [Callout Count]:                                2
353
354    Valid Value  pel_callout_section['Callout Count']  ['2']
355
356    # Verify procedural callout info.
357
358    Valid Value  pel_callout_section['Callouts'][0]['FRU Type']  ['Maintenance Procedure Required']
359    Should Contain  ${pel_callout_section['Callouts'][0]['Priority']}  Mandatory
360    # Verify if "Procedure Number" field of PEL has an alphanumeric value.
361    Should Match Regexp  ${pel_callout_section['Callouts'][0]['Procedure Number']}  [a-zA-Z0-9]
362
363    # Verify procedural callout info.
364
365    Valid Value  pel_callout_section['Callouts'][1]['FRU Type']  ['Symbolic FRU']
366    Should Contain  ${pel_callout_section['Callouts'][1]['Priority']}  Medium Priority
367    # Verify if "Part Number" field of Symbolic FRU has an alphanumeric value.
368    Should Match Regexp  ${pel_callout_section['Callouts'][1]['Part Number']}  [a-zA-Z0-9]
369
370
371Verify PEL Log Entry For Event Log
372    [Documentation]  Create an event log and verify PEL log entry in BMC for the same.
373    [Tags]  Verify_PEL_Log_Entry_For_Event_Log
374
375    Redfish Purge Event Log
376    # Create an internal failure error log.
377    BMC Execute Command  ${CMD_INTERNAL_FAILURE}
378
379    ${elog_entry}=  Get Event Logs
380    # Example of Redfish event logs:
381    # elog_entry:
382    #  [0]:
383    #    [Message]:                                    xyz.openbmc_project.Common.Error.InternalFailure
384    #    [Created]:                                    2020-04-20T01:55:22+00:00
385    #    [Id]:                                         1
386    #    [@odata.id]:                                  /redfish/v1/Systems/system/LogServices/EventLog/Entries/1
387    #    [@odata.type]:                                #LogEntry.v1_4_0.LogEntry
388    #    [EntryType]:                                  Event
389    #    [Severity]:                                   Critical
390    #    [Name]:                                       System Event Log Entry
391
392    ${redfish_log_time}=  Convert Date  ${elog_entry[0]["Created"]}  epoch
393
394    ${pel_records}=  Peltool  -l
395    # Example output from 'Peltool  -l':
396    # pel_records:
397    # [0x50000023]:
398    #   [SRC]:                                        BD8D1002
399    #   [CreatorID]:                                  BMC
400    #   [Message]:                                    An application had an internal failure
401    #   [CompID]:                                     0x1000
402    #   [PLID]:                                       0x50000023
403    #   [Commit Time]:                                04/20/2020 01:55:22
404    #   [Subsystem]:                                  BMC Firmware
405    #   [Sev]:                                        Unrecoverable Error
406
407    ${ids}=  Get Dictionary Keys  ${pel_records}
408    ${id}=  Get From List  ${ids}  0
409    ${pel_log_time}=  Convert Date  ${pel_records['${id}']['Commit Time']}  epoch
410    ...  date_format=%m/%d/%Y %H:%M:%S
411
412    # Verify that both Redfish event and PEL has log entry for internal error with same time stamp.
413    Should Contain Any  ${pel_records['${id}']['Message']}  internal failure  ignore_case=True
414    Should Contain Any  ${elog_entry[0]['Message']}  InternalFailure  ignore_case=True
415
416    Should Be Equal  ${redfish_log_time}  ${pel_log_time}
417
418
419Verify Delete All PEL
420    [Documentation]  Verify deleting all PEL logs.
421    [Tags]  Verify_Delete_All_PEL
422
423    Create Test PEL Log
424    Create Test PEL Log
425    Peltool  --delete-all  False
426
427    ${pel_ids}=  Get PEL Log Via BMC CLI
428    Should Be Empty  ${pel_ids}
429
430
431Verify Informational Error Log
432    [Documentation]  Create an informational error log and verify.
433    [Tags]  Verify_Informational_Error_Log
434
435    Redfish Purge Event Log
436    # Create an informational error log.
437    BMC Execute Command  ${CMD_INFORMATIONAL_ERROR}
438    ${pel_records}=  Peltool  -lfh
439
440    # An example of information error log data:
441    # {
442    #    "0x500006A0": {
443    #            "SRC": "BD8D1002",
444    #            "Message": "An application had an internal failure",
445    #            "PLID": "0x500006A0",
446    #            "CreatorID": "BMC",
447    #            "Subsystem": "BMC Firmware",
448    #            "Commit Time": "10/14/2020 11:41:38",
449    #            "Sev": "Informational Event",
450    #            "CompID": "0x1000"
451    #    }
452    # }
453
454    ${ids}=  Get Dictionary Keys  ${pel_records}
455    ${id}=  Get From List  ${ids}  0
456    Should Contain  ${pel_records['${id}']['Sev']}  Informational
457
458
459*** Keywords ***
460
461Create Test PEL Log
462    [Documentation]  Generate test PEL log.
463    [Arguments]  ${pel_type}=Internal Failure
464
465    # Description of argument(s):
466    # pel_type      The PEL type (e.g. Internal Failure, FRU Callout, Procedural Callout).
467
468    # Test PEL log entry example:
469    # {
470    #    "0x5000002D": {
471    #            "SRC": "BD8D1002",
472    #            "Message": "An application had an internal failure",
473    #            "PLID": "0x5000002D",
474    #            "CreatorID": "BMC",
475    #            "Subsystem": "BMC Firmware",
476    #            "Commit Time": "02/25/2020  04:47:09",
477    #            "Sev": "Unrecoverable Error",
478    #            "CompID": "0x1000"
479    #    }
480    # }
481
482    Run Keyword If  '${pel_type}' == 'Internal Failure'
483    ...   BMC Execute Command  ${CMD_INTERNAL_FAILURE}
484    ...  ELSE IF  '${pel_type}' == 'FRU Callout'
485    ...   BMC Execute Command  ${CMD_FRU_CALLOUT}
486    ...  ELSE IF  '${pel_type}' == 'Procedure And Symbolic FRU Callout'
487    ...   BMC Execute Command  ${CMD_PROCEDURAL_SYMBOLIC_FRU_CALLOUT}
488
489
490Get PEL Log IDs
491    [Documentation]  Returns the list of PEL log IDs which contains given field's value.
492    [Arguments]  ${pel_section}  ${pel_field}  @{pel_field_value}
493
494    # Description of argument(s):
495    # pel_section      The section of PEL (e.g. Private Header, User Header).
496    # pel_field        The PEL field (e.g. Event Severity, Event Type).
497    # pel_field_value  The list of PEL's field value (e.g. Unrecoverable Error).
498
499    ${pel_ids}=  Get PEL Log Via BMC CLI
500    @{pel_id_list}=  Create List
501
502    FOR  ${id}  IN  @{pel_ids}
503      ${pel_output}=  Peltool  -i ${id}
504      # Example of PEL output from "peltool -i <id>" command.
505      #  [Private Header]:
506      #    [Created at]:                                 08/24/1928 12:04:06
507      #    [Created by]:                                 0x584D
508      #    [Sub-section type]:                           0
509      #    [Entry Id]:                                   0x50000BB7
510      #    [Platform Log Id]:                            0x8200061D
511      #    [CSSVER]:
512      #    [Section Version]:                            1
513      #    [Creator Subsystem]:                          PHYP
514      #    [BMC Event Log Id]:                           341
515      #    [Committed at]:                               03/25/1920 12:06:22
516      #  [User Header]:
517      #    [Log Committed by]:                           0x4552
518      #    [Action Flags]:
519      #      [0]:                                        Report Externally
520      #    [Subsystem]:                                  I/O Subsystem
521      #    [Event Type]:                                 Miscellaneous, Informational Only
522      #    [Sub-section type]:                           0
523      #    [Event Scope]:                                Entire Platform
524      #    [Event Severity]:                             Informational Event
525      #    [Host Transmission]:                          Not Sent
526      #    [Section Version]:                            1
527
528      ${pel_section_output}=  Get From Dictionary  ${pel_output}  ${pel_section}
529      ${pel_field_output}=  Get From Dictionary  ${pel_section_output}  ${pel_field}
530      Run Keyword If  '${pel_field_output}' in @{pel_field_value}  Append To List  ${pel_id_list}  ${id}
531    END
532    Sort List  ${pel_id_list}
533
534    [Return]  ${pel_id_list}
535
536
537Get PEL Log Via BMC CLI
538    [Documentation]  Returns the list of PEL IDs using BMC CLI.
539
540    ${pel_records}=  Peltool  -l
541    ${ids}=  Get Dictionary Keys  ${pel_records}
542    Sort List  ${ids}
543
544    [Return]  ${ids}
545
546
547Get PEL Field Value
548    [Documentation]  Returns the value of given PEL's field.
549    [Arguments]  ${pel_id}  ${pel_section}  ${pel_field}
550
551    # Description of argument(s):
552    # pel_id           The ID of PEL (e.g. 0x5000002D, 0x5000002E).
553    # pel_section      The section of PEL (e.g. Private Header, User Header)
554    # pel_field        The PEL field (e.g. Event Severity, Event Type).
555
556    ${pel_output}=  Peltool  -i ${pel_id}
557
558    # Example of PEL output from "peltool -i <id>" command.
559    #  [Private Header]:
560    #    [Created at]:                                 08/24/1928 12:04:06
561    #    [Created by]:                                 0x584D
562    #    [Sub-section type]:                           0
563    #    [Entry Id]:                                   0x50000BB7
564    #    [Platform Log Id]:                            0x8200061D
565    #    [CSSVER]:
566    #    [Section Version]:                            1
567    #    [Creator Subsystem]:                          PHYP
568    #    [BMC Event Log Id]:                           341
569    #    [Committed at]:                               03/25/1920 12:06:22
570    #  [User Header]:
571    #    [Log Committed by]:                           0x4552
572    #    [Action Flags]:
573    #      [0]:                                        Report Externally
574    #    [Subsystem]:                                  I/O Subsystem
575    #    [Event Type]:                                 Miscellaneous, Informational Only
576    #    [Sub-section type]:                           0
577    #    [Event Scope]:                                Entire Platform
578    #    [Event Severity]:                             Informational Event
579    #    [Host Transmission]:                          Not Sent
580    #    [Section Version]:                            1
581
582    ${pel_section_output}=  Get From Dictionary  ${pel_output}  ${pel_section}
583    ${pel_field_output}=  Get From Dictionary  ${pel_section_output}  ${pel_field}
584
585    [Return]  ${pel_field_output}
586