Rahul Maheshwari | faa5d20 | 2020-02-24 23:32:57 -0600 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation This suite tests Platform Event Log (PEL) functionality of OpenBMC. |
| 3 | |
| 4 | Library ../../lib/pel_utils.py |
Rahul Maheshwari | a17a339 | 2020-03-02 04:51:52 -0600 | [diff] [blame] | 5 | Variables ../../data/pel_variables.py |
Rahul Maheshwari | faa5d20 | 2020-02-24 23:32:57 -0600 | [diff] [blame] | 6 | Resource ../../lib/openbmc_ffdc.robot |
| 7 | |
Rahul Maheshwari | f575c90 | 2020-02-26 04:38:40 -0600 | [diff] [blame] | 8 | Test Setup Redfish.Login |
| 9 | Test Teardown Run Keywords Redfish.Logout AND FFDC On Test Case Fail |
Rahul Maheshwari | faa5d20 | 2020-02-24 23:32:57 -0600 | [diff] [blame] | 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 | |
| 21 | Create 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 | |
Rahul Maheshwari | f575c90 | 2020-02-26 04:38:40 -0600 | [diff] [blame] | 25 | Redfish Purge Event Log |
Rahul Maheshwari | faa5d20 | 2020-02-24 23:32:57 -0600 | [diff] [blame] | 26 | Create Test PEL Log |
Rahul Maheshwari | f575c90 | 2020-02-26 04:38:40 -0600 | [diff] [blame] | 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 | |
Rahul Maheshwari | a17a339 | 2020-03-02 04:51:52 -0600 | [diff] [blame] | 31 | Verify 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 | |
Rahul Maheshwari | f575c90 | 2020-02-26 04:38:40 -0600 | [diff] [blame] | 80 | Verify 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} |
Rahul Maheshwari | faa5d20 | 2020-02-24 23:32:57 -0600 | [diff] [blame] | 91 | |
| 92 | |
Rahul Maheshwari | 58b99fc | 2020-03-03 00:05:55 -0600 | [diff] [blame] | 93 | Verify 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 | |
Rahul Maheshwari | 1bea6cc | 2020-03-31 00:53:14 -0500 | [diff] [blame] | 127 | Verify Host Off State From PEL |
| 128 | [Documentation] Verify Host off state from PEL. |
| 129 | [Tags] Verify_Host_Off_State_From_PEL |
| 130 | |
| 131 | Redfish Power Off stack_mode=skip |
| 132 | Create Test PEL Log |
| 133 | |
| 134 | ${pel_ids}= Get PEL Log Via BMC CLI |
| 135 | ${id}= Get From List ${pel_ids} -1 |
| 136 | ${pel_host_state}= Get PEL Field Value ${id} User Data HostState |
| 137 | |
| 138 | Valid Value pel_host_state ['Off'] |
| 139 | |
| 140 | |
| 141 | Verify BMC Version From PEL |
| 142 | [Documentation] Verify BMC Version from PEL. |
| 143 | [Tags] Verify_BMC_Version_From_PEL |
| 144 | |
| 145 | Create Test PEL Log |
| 146 | |
| 147 | ${pel_ids}= Get PEL Log Via BMC CLI |
| 148 | ${id}= Get From List ${pel_ids} -1 |
| 149 | ${pel_bmc_version}= Get PEL Field Value ${id} User Data BMC Version ID |
| 150 | |
| 151 | ${bmc_version}= Get BMC Version |
| 152 | Valid Value bmc_version ['${bmc_version}'] |
| 153 | |
| 154 | |
Rahul Maheshwari | faa5d20 | 2020-02-24 23:32:57 -0600 | [diff] [blame] | 155 | *** Keywords *** |
| 156 | |
| 157 | Create Test PEL Log |
| 158 | [Documentation] Generate test PEL log. |
| 159 | |
| 160 | # Test PEL log entry example: |
| 161 | # { |
| 162 | # "0x5000002D": { |
| 163 | # "SRC": "BD8D1002", |
| 164 | # "Message": "An application had an internal failure", |
| 165 | # "PLID": "0x5000002D", |
| 166 | # "CreatorID": "BMC", |
| 167 | # "Subsystem": "BMC Firmware", |
| 168 | # "Commit Time": "02/25/2020 04:47:09", |
| 169 | # "Sev": "Unrecoverable Error", |
| 170 | # "CompID": "0x1000" |
| 171 | # } |
| 172 | # } |
| 173 | |
| 174 | BMC Execute Command ${CMD_INTERNAL_FAILURE} |
| 175 | |
| 176 | |
Rahul Maheshwari | f575c90 | 2020-02-26 04:38:40 -0600 | [diff] [blame] | 177 | Get PEL Log Via BMC CLI |
| 178 | [Documentation] Returns the list of PEL IDs using BMC CLI. |
Rahul Maheshwari | faa5d20 | 2020-02-24 23:32:57 -0600 | [diff] [blame] | 179 | |
| 180 | ${pel_records}= Peltool -l |
Rahul Maheshwari | f575c90 | 2020-02-26 04:38:40 -0600 | [diff] [blame] | 181 | ${ids}= Get Dictionary Keys ${pel_records} |
Rahul Maheshwari | 1cffc4b | 2020-04-02 02:58:16 -0500 | [diff] [blame] | 182 | Sort List ${ids} |
Rahul Maheshwari | faa5d20 | 2020-02-24 23:32:57 -0600 | [diff] [blame] | 183 | |
Rahul Maheshwari | f575c90 | 2020-02-26 04:38:40 -0600 | [diff] [blame] | 184 | [Return] ${ids} |
Rahul Maheshwari | 60b58a8 | 2020-04-02 02:40:19 -0500 | [diff] [blame] | 185 | |
| 186 | |
| 187 | Get PEL Field Value |
| 188 | [Documentation] Returns the value of given PEL's field. |
| 189 | [Arguments] ${pel_id} ${pel_section} ${pel_field} |
| 190 | |
| 191 | # Description of argument(s): |
| 192 | # pel_id The ID of PEL (e.g. 0x5000002D, 0x5000002E). |
| 193 | # pel_section The section of PEL (e.g. Private Header, User Header) |
| 194 | # pel_field The PEL field (e.g. Event Severity, Event Type). |
| 195 | |
| 196 | ${pel_output}= Peltool -i ${pel_id} |
| 197 | |
| 198 | # Example of PEL output from "peltool -i <id>" command. |
| 199 | # [Private Header]: |
| 200 | # [Created at]: 08/24/1928 12:04:06 |
| 201 | # [Created by]: 0x584D |
| 202 | # [Sub-section type]: 0 |
| 203 | # [Entry Id]: 0x50000BB7 |
| 204 | # [Platform Log Id]: 0x8200061D |
| 205 | # [CSSVER]: |
| 206 | # [Section Version]: 1 |
| 207 | # [Creator Subsystem]: PHYP |
| 208 | # [BMC Event Log Id]: 341 |
| 209 | # [Committed at]: 03/25/1920 12:06:22 |
| 210 | # [User Header]: |
| 211 | # [Log Committed by]: 0x4552 |
| 212 | # [Action Flags]: |
| 213 | # [0]: Report Externally |
| 214 | # [Subsystem]: I/O Subsystem |
| 215 | # [Event Type]: Miscellaneous, Informational Only |
| 216 | # [Sub-section type]: 0 |
| 217 | # [Event Scope]: Entire Platform |
| 218 | # [Event Severity]: Informational Event |
| 219 | # [Host Transmission]: Not Sent |
| 220 | # [Section Version]: 1 |
| 221 | |
| 222 | ${pel_section_output}= Get From Dictionary ${pel_output} ${pel_section} |
| 223 | ${pel_field_output}= Get From Dictionary ${pel_section_output} ${pel_field} |
| 224 | |
| 225 | [Return] ${pel_field_output} |
| 226 | |