1*** Settings ***
2Documentation   This suite tests Platform Event Log (PEL) functionality of OpenBMC.
3
4Library         ../../lib/pel_utils.py
5Resource        ../../lib/openbmc_ffdc.robot
6
7Test Setup      Redfish.Login
8Test Teardown   Run Keywords  Redfish.Logout  AND  FFDC On Test Case Fail
9
10
11*** Variables ***
12
13${CMD_INTERNAL_FAILURE}  busctl call xyz.openbmc_project.Logging /xyz/openbmc_project/logging
14...  xyz.openbmc_project.Logging.Create Create ssa{ss} xyz.openbmc_project.Common.Error.InternalFailure
15...  xyz.openbmc_project.Logging.Entry.Level.Error 0
16
17
18*** Test Cases ***
19
20Create Test PEL Log And Verify
21    [Documentation]  Create PEL log using busctl command and verify via peltool.
22    [Tags]  Create_Test_PEL_Log_And_Verify
23
24    Redfish Purge Event Log
25    Create Test PEL Log
26    ${pel_id}=  Get PEL Log Via BMC CLI
27    Should Not Be Empty  ${pel_id}  msg=System PEL log entry is empty.
28
29
30Verify PEL Log Persistence After BMC Reboot
31    [Documentation]  Verify PEL log persistence after BMC reboot.
32    [Tags]  Verify_PEL_Log_Persistence_After_BMC_Reboot
33
34    Create Test PEL Log
35    ${pel_before_reboot}=  Get PEL Log Via BMC CLI
36
37    Redfish OBMC Reboot (off)
38    ${pel_after_reboot}=  Get PEL Log Via BMC CLI
39
40    List Should Contain Sub List  ${pel_after_reboot}  ${pel_before_reboot}
41
42
43*** Keywords ***
44
45Create Test PEL Log
46    [Documentation]  Generate test PEL log.
47
48    # Test PEL log entry example:
49    # {
50    #    "0x5000002D": {
51    #            "SRC": "BD8D1002",
52    #            "Message": "An application had an internal failure",
53    #            "PLID": "0x5000002D",
54    #            "CreatorID": "BMC",
55    #            "Subsystem": "BMC Firmware",
56    #            "Commit Time": "02/25/2020  04:47:09",
57    #            "Sev": "Unrecoverable Error",
58    #            "CompID": "0x1000"
59    #    }
60    # }
61
62    BMC Execute Command  ${CMD_INTERNAL_FAILURE}
63
64
65Get PEL Log Via BMC CLI
66    [Documentation]  Returns the list of PEL IDs using BMC CLI.
67
68    ${pel_records}=  Peltool  -l
69    ${ids}=  Get Dictionary Keys  ${pel_records}
70
71    [Return]  ${ids}
72