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/openbmc_ffdc.robot 7 8Test Setup Redfish.Login 9Test Teardown Run Keywords Redfish.Logout AND FFDC On Test Case Fail 10 11 12*** Variables *** 13 14${CMD_INTERNAL_FAILURE} busctl call xyz.openbmc_project.Logging /xyz/openbmc_project/logging 15... xyz.openbmc_project.Logging.Create Create ssa{ss} xyz.openbmc_project.Common.Error.InternalFailure 16... xyz.openbmc_project.Logging.Entry.Level.Error 0 17 18 19*** Test Cases *** 20 21Create Test PEL Log And Verify 22 [Documentation] Create PEL log using busctl command and verify via peltool. 23 [Tags] Create_Test_PEL_Log_And_Verify 24 25 Redfish Purge Event Log 26 Create Test PEL Log 27 ${pel_id}= Get PEL Log Via BMC CLI 28 Should Not Be Empty ${pel_id} msg=System PEL log entry is empty. 29 30 31Verify PEL Log Details 32 [Documentation] Verify PEL log details via peltool. 33 [Tags] Verify_PEL_Log_Details 34 35 Redfish Purge Event Log 36 37 ${bmc_time1}= CLI Get BMC DateTime 38 Create Test PEL Log 39 ${bmc_time2}= CLI Get BMC DateTime 40 41 ${pel_records}= Peltool -l 42 43 # Example output from 'Peltool -l': 44 # pel_records: 45 # [0x50000012]: 46 # [CreatorID]: BMC 47 # [CompID]: 0x1000 48 # [PLID]: 0x50000012 49 # [Subsystem]: BMC Firmware 50 # [Message]: An application had an internal failure 51 # [SRC]: BD8D1002 52 # [Commit Time]: 03/02/2020 09:35:15 53 # [Sev]: Unrecoverable Error 54 55 ${ids}= Get Dictionary Keys ${pel_records} 56 ${id}= Get From List ${ids} 0 57 58 @{pel_fields}= Create List CreatorID Subsystem Message Sev 59 FOR ${field} IN @{pel_fields} 60 Valid Value pel_records['${id}']['${field}'] ['${PEL_DETAILS['${field}']}'] 61 END 62 63 Valid Value pel_records['${id}']['PLID'] ['${id}'] 64 65 # Verify if "CompID" and "SRC" fields of PEL has alphanumeric value. 66 Should Match Regexp ${pel_records['${id}']['CompID']} [a-zA-Z0-9] 67 Should Match Regexp ${pel_records['${id}']['SRC']} [a-zA-Z0-9] 68 69 ${pel_date_time}= Convert Date ${pel_records['${id}']['Commit Time']} 70 ... date_format=%m/%d/%Y %H:%M:%S exclude_millis=yes 71 72 # Convert BMC and PEL time to epoch time before comparing. 73 ${bmc_time1_epoch}= Convert Date ${bmc_time1} epoch 74 ${pel_time_epoch}= Convert Date ${pel_date_time} epoch 75 ${bmc_time2_epoch}= Convert Date ${bmc_time2} epoch 76 77 Should Be True ${bmc_time1_epoch} <= ${pel_time_epoch} <= ${bmc_time2_epoch} 78 79 80Verify PEL Log Persistence After BMC Reboot 81 [Documentation] Verify PEL log persistence after BMC reboot. 82 [Tags] Verify_PEL_Log_Persistence_After_BMC_Reboot 83 84 Create Test PEL Log 85 ${pel_before_reboot}= Get PEL Log Via BMC CLI 86 87 Redfish OBMC Reboot (off) 88 ${pel_after_reboot}= Get PEL Log Via BMC CLI 89 90 List Should Contain Sub List ${pel_after_reboot} ${pel_before_reboot} 91 92 93Verify PEL ID Numbering 94 [Documentation] Verify PEL ID numbering. 95 [Tags] Verify_PEL_ID_Numbering 96 97 Redfish Purge Event Log 98 Create Test PEL Log 99 Create Test PEL Log 100 101 ${pel_ids}= Get PEL Log Via BMC CLI 102 103 # Example of PEL IDs from PEL logs. 104 # [0x50000012]: <--- First PEL ID 105 # [CreatorID]: BMC 106 # [CompID]: 0x1000 107 # [PLID]: 0x50000012 108 # [Subsystem]: BMC Firmware 109 # [Message]: An application had an internal failure 110 # [SRC]: BD8D1002 111 # [Commit Time]: 03/02/2020 09:35:15 112 # [Sev]: Unrecoverable Error 113 # 114 # [0x50000013]: <--- Second PEL ID 115 # [CreatorID]: BMC 116 # [CompID]: 0x1000 117 # [PLID]: 0x50000013 118 # [Subsystem]: BMC Firmware 119 # [Message]: An application had an internal failure 120 # [SRC]: BD8D1002 121 # [Commit Time]: 03/02/2020 09:35:15 122 # [Sev]: Unrecoverable Error 123 124 Should Be True ${pel_ids[1]} == ${pel_ids[0]}+1 125 126 127*** Keywords *** 128 129Create Test PEL Log 130 [Documentation] Generate test PEL log. 131 132 # Test PEL log entry example: 133 # { 134 # "0x5000002D": { 135 # "SRC": "BD8D1002", 136 # "Message": "An application had an internal failure", 137 # "PLID": "0x5000002D", 138 # "CreatorID": "BMC", 139 # "Subsystem": "BMC Firmware", 140 # "Commit Time": "02/25/2020 04:47:09", 141 # "Sev": "Unrecoverable Error", 142 # "CompID": "0x1000" 143 # } 144 # } 145 146 BMC Execute Command ${CMD_INTERNAL_FAILURE} 147 148 149Get PEL Log Via BMC CLI 150 [Documentation] Returns the list of PEL IDs using BMC CLI. 151 152 ${pel_records}= Peltool -l 153 ${ids}= Get Dictionary Keys ${pel_records} 154 155 [Return] ${ids} 156