blob: 3a0105476b5b240bd8866adb6c2b3872ce373dc7 [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 Maheshwarifaa5d202020-02-24 23:32:57 -06007Resource ../../lib/openbmc_ffdc.robot
8
Rahul Maheshwarif575c902020-02-26 04:38:40 -06009Test Setup Redfish.Login
10Test Teardown Run Keywords Redfish.Logout AND FFDC On Test Case Fail
Rahul Maheshwarifaa5d202020-02-24 23:32:57 -060011
12
13*** Variables ***
14
15${CMD_INTERNAL_FAILURE} busctl call xyz.openbmc_project.Logging /xyz/openbmc_project/logging
16... xyz.openbmc_project.Logging.Create Create ssa{ss} xyz.openbmc_project.Common.Error.InternalFailure
17... xyz.openbmc_project.Logging.Entry.Level.Error 0
18
19
20*** 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 Maheshwarif575c902020-02-26 04:38:40 -060081Verify PEL Log Persistence After BMC Reboot
82 [Documentation] Verify PEL log persistence after BMC reboot.
83 [Tags] Verify_PEL_Log_Persistence_After_BMC_Reboot
84
85 Create Test PEL Log
86 ${pel_before_reboot}= Get PEL Log Via BMC CLI
87
88 Redfish OBMC Reboot (off)
89 ${pel_after_reboot}= Get PEL Log Via BMC CLI
90
91 List Should Contain Sub List ${pel_after_reboot} ${pel_before_reboot}
Rahul Maheshwarifaa5d202020-02-24 23:32:57 -060092
93
Rahul Maheshwari58b99fc2020-03-03 00:05:55 -060094Verify PEL ID Numbering
95 [Documentation] Verify PEL ID numbering.
96 [Tags] Verify_PEL_ID_Numbering
97
98 Redfish Purge Event Log
99 Create Test PEL Log
100 Create Test PEL Log
101
102 ${pel_ids}= Get PEL Log Via BMC CLI
103
104 # Example of PEL IDs from PEL logs.
105 # [0x50000012]: <--- First PEL ID
106 # [CreatorID]: BMC
107 # [CompID]: 0x1000
108 # [PLID]: 0x50000012
109 # [Subsystem]: BMC Firmware
110 # [Message]: An application had an internal failure
111 # [SRC]: BD8D1002
112 # [Commit Time]: 03/02/2020 09:35:15
113 # [Sev]: Unrecoverable Error
114 #
115 # [0x50000013]: <--- Second PEL ID
116 # [CreatorID]: BMC
117 # [CompID]: 0x1000
118 # [PLID]: 0x50000013
119 # [Subsystem]: BMC Firmware
120 # [Message]: An application had an internal failure
121 # [SRC]: BD8D1002
122 # [Commit Time]: 03/02/2020 09:35:15
123 # [Sev]: Unrecoverable Error
124
125 Should Be True ${pel_ids[1]} == ${pel_ids[0]}+1
126
127
Rahul Maheshwari1bea6cc2020-03-31 00:53:14 -0500128Verify Host Off State From PEL
129 [Documentation] Verify Host off state from PEL.
130 [Tags] Verify_Host_Off_State_From_PEL
131
132 Redfish Power Off stack_mode=skip
133 Create Test PEL Log
134
135 ${pel_ids}= Get PEL Log Via BMC CLI
136 ${id}= Get From List ${pel_ids} -1
137 ${pel_host_state}= Get PEL Field Value ${id} User Data HostState
138
139 Valid Value pel_host_state ['Off']
140
141
142Verify BMC Version From PEL
143 [Documentation] Verify BMC Version from PEL.
144 [Tags] Verify_BMC_Version_From_PEL
145
146 Create Test PEL Log
147
148 ${pel_ids}= Get PEL Log Via BMC CLI
149 ${id}= Get From List ${pel_ids} -1
150 ${pel_bmc_version}= Get PEL Field Value ${id} User Data BMC Version ID
151
152 ${bmc_version}= Get BMC Version
153 Valid Value bmc_version ['${bmc_version}']
154
155
Rahul Maheshwari8f5256f2020-02-26 23:53:55 -0600156Verify PEL Log After Host Poweron
157 [Documentation] Verify PEL log generation while booting host.
158 [Tags] Verify_PEL_Log_After_Host_Poweron
159
160 Redfish Power Off stack_mode=skip
161 Redfish Purge Event Log
162 Redfish Power On stack_mode=skip
163
164 ${pel_informational_error}= Get PEL Log IDs User Header Event Severity Informational Event
165 ${pel_bmc_created_error}= Get PEL Log IDs Private Header Creator Subsystem BMC
166
167 # Get BMC created non-infomational error.
168 ${pel_bmc_error}= Subtract Lists ${pel_bmc_created_error} ${pel_informational_error}
169
170 Should Be Empty ${pel_bmc_error} msg=Unexpected error log generated during Host poweron.
171
172
Rahul Maheshwarifaa5d202020-02-24 23:32:57 -0600173*** Keywords ***
174
175Create Test PEL Log
176 [Documentation] Generate test PEL log.
177
178 # Test PEL log entry example:
179 # {
180 # "0x5000002D": {
181 # "SRC": "BD8D1002",
182 # "Message": "An application had an internal failure",
183 # "PLID": "0x5000002D",
184 # "CreatorID": "BMC",
185 # "Subsystem": "BMC Firmware",
186 # "Commit Time": "02/25/2020 04:47:09",
187 # "Sev": "Unrecoverable Error",
188 # "CompID": "0x1000"
189 # }
190 # }
191
192 BMC Execute Command ${CMD_INTERNAL_FAILURE}
193
194
Rahul Maheshwari8f5256f2020-02-26 23:53:55 -0600195Get PEL Log IDs
196 [Documentation] Returns the list of PEL log IDs which contains given field's value.
197 [Arguments] ${pel_section} ${pel_field} @{pel_field_value}
198
199 # Description of argument(s):
200 # pel_section The section of PEL (e.g. Private Header, User Header).
201 # pel_field The PEL field (e.g. Event Severity, Event Type).
202 # pel_field_value The list of PEL's field value (e.g. Unrecoverable Error).
203
204 ${pel_ids}= Get PEL Log Via BMC CLI
205 @{pel_id_list}= Create List
206
207 FOR ${id} IN @{pel_ids}
208 ${pel_output}= Peltool -i ${id}
209 # Example of PEL output from "peltool -i <id>" command.
210 # [Private Header]:
211 # [Created at]: 08/24/1928 12:04:06
212 # [Created by]: 0x584D
213 # [Sub-section type]: 0
214 # [Entry Id]: 0x50000BB7
215 # [Platform Log Id]: 0x8200061D
216 # [CSSVER]:
217 # [Section Version]: 1
218 # [Creator Subsystem]: PHYP
219 # [BMC Event Log Id]: 341
220 # [Committed at]: 03/25/1920 12:06:22
221 # [User Header]:
222 # [Log Committed by]: 0x4552
223 # [Action Flags]:
224 # [0]: Report Externally
225 # [Subsystem]: I/O Subsystem
226 # [Event Type]: Miscellaneous, Informational Only
227 # [Sub-section type]: 0
228 # [Event Scope]: Entire Platform
229 # [Event Severity]: Informational Event
230 # [Host Transmission]: Not Sent
231 # [Section Version]: 1
232
233 ${pel_section_output}= Get From Dictionary ${pel_output} ${pel_section}
234 ${pel_field_output}= Get From Dictionary ${pel_section_output} ${pel_field}
235 Run Keyword If '${pel_field_output}' in @{pel_field_value} Append To List ${pel_id_list} ${id}
236 END
237 Sort List ${pel_id_list}
238
239 [Return] ${pel_id_list}
240
241
Rahul Maheshwarif575c902020-02-26 04:38:40 -0600242Get PEL Log Via BMC CLI
243 [Documentation] Returns the list of PEL IDs using BMC CLI.
Rahul Maheshwarifaa5d202020-02-24 23:32:57 -0600244
245 ${pel_records}= Peltool -l
Rahul Maheshwarif575c902020-02-26 04:38:40 -0600246 ${ids}= Get Dictionary Keys ${pel_records}
Rahul Maheshwari1cffc4b2020-04-02 02:58:16 -0500247 Sort List ${ids}
Rahul Maheshwarifaa5d202020-02-24 23:32:57 -0600248
Rahul Maheshwarif575c902020-02-26 04:38:40 -0600249 [Return] ${ids}
Rahul Maheshwari60b58a82020-04-02 02:40:19 -0500250
251
252Get PEL Field Value
253 [Documentation] Returns the value of given PEL's field.
254 [Arguments] ${pel_id} ${pel_section} ${pel_field}
255
256 # Description of argument(s):
257 # pel_id The ID of PEL (e.g. 0x5000002D, 0x5000002E).
258 # pel_section The section of PEL (e.g. Private Header, User Header)
259 # pel_field The PEL field (e.g. Event Severity, Event Type).
260
261 ${pel_output}= Peltool -i ${pel_id}
262
263 # Example of PEL output from "peltool -i <id>" command.
264 # [Private Header]:
265 # [Created at]: 08/24/1928 12:04:06
266 # [Created by]: 0x584D
267 # [Sub-section type]: 0
268 # [Entry Id]: 0x50000BB7
269 # [Platform Log Id]: 0x8200061D
270 # [CSSVER]:
271 # [Section Version]: 1
272 # [Creator Subsystem]: PHYP
273 # [BMC Event Log Id]: 341
274 # [Committed at]: 03/25/1920 12:06:22
275 # [User Header]:
276 # [Log Committed by]: 0x4552
277 # [Action Flags]:
278 # [0]: Report Externally
279 # [Subsystem]: I/O Subsystem
280 # [Event Type]: Miscellaneous, Informational Only
281 # [Sub-section type]: 0
282 # [Event Scope]: Entire Platform
283 # [Event Severity]: Informational Event
284 # [Host Transmission]: Not Sent
285 # [Section Version]: 1
286
287 ${pel_section_output}= Get From Dictionary ${pel_output} ${pel_section}
288 ${pel_field_output}= Get From Dictionary ${pel_section_output} ${pel_field}
289
290 [Return] ${pel_field_output}
291