blob: a77f96ec3f4a541f93ca26762c0ee4f5069fb888 [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 Maheshwarifaa5d202020-02-24 23:32:57 -06006Resource ../../lib/openbmc_ffdc.robot
7
Rahul Maheshwarif575c902020-02-26 04:38:40 -06008Test Setup Redfish.Login
9Test Teardown Run Keywords Redfish.Logout AND FFDC On Test Case Fail
Rahul Maheshwarifaa5d202020-02-24 23:32:57 -060010
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
Rahul Maheshwarif575c902020-02-26 04:38:40 -060025 Redfish Purge Event Log
Rahul Maheshwarifaa5d202020-02-24 23:32:57 -060026 Create Test PEL Log
Rahul Maheshwarif575c902020-02-26 04:38:40 -060027 ${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 Maheshwaria17a3392020-03-02 04:51:52 -060031Verify 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 Maheshwarif575c902020-02-26 04:38:40 -060080Verify 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 Maheshwarifaa5d202020-02-24 23:32:57 -060091
92
Rahul Maheshwari58b99fc2020-03-03 00:05:55 -060093Verify 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 Maheshwari1bea6cc2020-03-31 00:53:14 -0500127Verify 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
141Verify 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 Maheshwarifaa5d202020-02-24 23:32:57 -0600155*** Keywords ***
156
157Create 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 Maheshwarif575c902020-02-26 04:38:40 -0600177Get PEL Log Via BMC CLI
178 [Documentation] Returns the list of PEL IDs using BMC CLI.
Rahul Maheshwarifaa5d202020-02-24 23:32:57 -0600179
180 ${pel_records}= Peltool -l
Rahul Maheshwarif575c902020-02-26 04:38:40 -0600181 ${ids}= Get Dictionary Keys ${pel_records}
Rahul Maheshwari1cffc4b2020-04-02 02:58:16 -0500182 Sort List ${ids}
Rahul Maheshwarifaa5d202020-02-24 23:32:57 -0600183
Rahul Maheshwarif575c902020-02-26 04:38:40 -0600184 [Return] ${ids}
Rahul Maheshwari60b58a82020-04-02 02:40:19 -0500185
186
187Get 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