blob: 1160262bcdaee95e64ff550ac8d3ef9385e3d389 [file] [log] [blame]
Rahul Maheshwari2568f872020-09-23 01:03:39 -05001*** Settings ***
2
3Documentation Test BMC dump functionality of OpenBMC.
4
George Keishing88ec2802021-08-04 03:04:22 -05005Resource ../../lib/bmc_redfish_resource.robot
6Resource ../../lib/boot_utils.robot
Rahul Maheshwari2568f872020-09-23 01:03:39 -05007Resource ../../lib/dump_utils.robot
George Keishing88ec2802021-08-04 03:04:22 -05008Resource ../../lib/openbmc_ffdc.robot
Rahul Maheshwari2568f872020-09-23 01:03:39 -05009
George Keishingf514ccb2021-02-02 23:55:56 -060010Suite Setup Redfish.Login
Rahul Maheshwari2568f872020-09-23 01:03:39 -050011Test Setup Redfish Delete All BMC Dumps
12Test Teardown Test Teardown Execution
13
Tim Leede2d1302021-06-18 01:24:11 +080014*** Variables ***
15
16# Total size of the dump in kilo bytes
17${BMC_DUMP_TOTAL_SIZE} ${1024}
18
19# Minimum space required for one bmc dump in kilo bytes
20${BMC_DUMP_MIN_SPACE_REQD} ${20}
manashsarmabd346b32022-07-20 06:22:58 -050021${MAX_DUMP_COUNT} ${20}
Rahul Maheshwari2568f872020-09-23 01:03:39 -050022
23*** Test Cases ***
24
manashsarma4b5b1fa2022-11-16 02:36:58 -060025Verify Error Response For Already Deleted Dump Id
26 [Documentation] Delete non existing BMC dump and expect an error.
27 [Tags] Verify_Error_Response_For_Already_Deleted_Dump_Id
28
29 ${dump_id}= Create User Initiated BMC Dump Via Redfish
30 Redfish Delete BMC Dump ${dump_id}
31 Run Keyword And Expect Error ValueError: * Redfish Delete BMC Dump ${dump_id}
32
33
Rahul Maheshwari2568f872020-09-23 01:03:39 -050034Verify User Initiated BMC Dump When Host Powered Off
35 [Documentation] Create user initiated BMC dump at host off state and
36 ... verify dump entry for it.
37 [Tags] Verify_User_Initiated_BMC_Dump_When_Host_Powered_Off
38
39 Redfish Power Off stack_mode=skip
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -050040 ${dump_id}= Create User Initiated BMC Dump Via Redfish
Rahul Maheshwaribcefdf22020-10-16 07:51:34 -050041 ${dump_entries}= Get BMC Dump Entries
Rahul Maheshwari2568f872020-09-23 01:03:39 -050042 Length Should Be ${dump_entries} 1
43 List Should Contain Value ${dump_entries} ${dump_id}
44
Rahul Maheshwari2568f872020-09-23 01:03:39 -050045
Rahul Maheshwarie8e9d0c2020-10-30 02:39:01 -050046Verify User Initiated BMC Dump Size
manashsarma7831dc22022-03-08 01:49:36 -060047 [Documentation] Verify user initiated BMC dump size is under 20 MB.
Rahul Maheshwarie8e9d0c2020-10-30 02:39:01 -050048 [Tags] Verify_User_Initiated_BMC_Dump_Size
49
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -050050 ${dump_id}= Create User Initiated BMC Dump Via Redfish
Rahul Maheshwarie8e9d0c2020-10-30 02:39:01 -050051 ${resp}= Redfish.Get Properties /redfish/v1/Managers/bmc/LogServices/Dump/Entries/${dump_id}
52
53 # Example of response from above Redfish GET request.
54 # "@odata.type": "#LogEntry.v1_7_0.LogEntry",
55 # "AdditionalDataSizeBytes": 31644,
56 # "AdditionalDataURI": "/redfish/v1/Managers/bmc/LogServices/Dump/attachment/9",
57 # "Created": "2020-10-23T06:32:53+00:00",
58 # "DiagnosticDataType": "Manager",
59 # "EntryType": "Event",
60 # "Id": "9",
61 # "Name": "BMC Dump Entry"
62
manashsarma7831dc22022-03-08 01:49:36 -060063 # Max size for dump is 20 MB = 20x1024x1024 Byte.
64 Should Be True 0 < ${resp["AdditionalDataSizeBytes"]} < 20971520
Rahul Maheshwarie8e9d0c2020-10-30 02:39:01 -050065
66
George Keishing3d850982022-07-19 11:03:03 -050067Verify User Initiated BMC Dump When Host Booted
68 [Documentation] Create user initiated BMC dump at host booted state and
69 ... verify dump entry for it.
70 [Tags] Verify_User_Initiated_BMC_Dump_When_Host_Booted
71
72 Redfish Power On stack_mode=skip
73 ${dump_id}= Create User Initiated BMC Dump Via Redfish
74 ${dump_entries}= Get BMC Dump Entries
75 Length Should Be ${dump_entries} 1
76 List Should Contain Value ${dump_entries} ${dump_id}
77
78
Rahul Maheshwari2568f872020-09-23 01:03:39 -050079Verify Dump Persistency On Dump Service Restart
80 [Documentation] Create user dump, restart dump manager service and verify dump
81 ... persistency.
82 [Tags] Verify_Dump_Persistency_On_Dump_Service_Restart
83
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -050084 Create User Initiated BMC Dump Via Redfish
Rahul Maheshwari2568f872020-09-23 01:03:39 -050085 ${dump_entries_before}= redfish_utils.get_member_list /redfish/v1/Managers/bmc/LogServices/Dump/Entries
86
87 # Restart dump service.
88 BMC Execute Command systemctl restart xyz.openbmc_project.Dump.Manager.service
89 Sleep 10s reason=Wait for BMC dump service to restart properly
90
91 ${dump_entries_after}= redfish_utils.get_member_list /redfish/v1/Managers/bmc/LogServices/Dump/Entries
92 Lists Should Be Equal ${dump_entries_before} ${dump_entries_after}
93
94
95Verify Dump Persistency On BMC Reset
96 [Documentation] Create user dump, reset BMC and verify dump persistency.
97 [Tags] Verify_Dump_Persistency_On_BMC_Reset
98
manashsarma8fa9c892022-10-03 06:20:58 -050099 # Power off host so that dump is not offloaded to host OS.
100 Redfish Power Off stack_mode=skip
101
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500102 Create User Initiated BMC Dump Via Redfish
Rahul Maheshwari2568f872020-09-23 01:03:39 -0500103 ${dump_entries_before}= redfish_utils.get_member_list /redfish/v1/Managers/bmc/LogServices/Dump/Entries
104
105 # Reset BMC.
George Keishing88ec2802021-08-04 03:04:22 -0500106 OBMC Reboot (off) stack_mode=skip
Rahul Maheshwari2568f872020-09-23 01:03:39 -0500107
108 ${dump_entries_after}= redfish_utils.get_member_list /redfish/v1/Managers/bmc/LogServices/Dump/Entries
109 Lists Should Be Equal ${dump_entries_before} ${dump_entries_after}
110
111
Rahul Maheshwari95cbceb2020-10-21 23:25:08 -0500112Delete User Initiated BMC Dump And Verify
113 [Documentation] Delete user initiated BMC dump and verify.
114 [Tags] Delete_User_Initiated_BMC_Dump_And_Verify
115
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500116 ${dump_id}= Create User Initiated BMC Dump Via Redfish
Rahul Maheshwari95cbceb2020-10-21 23:25:08 -0500117 Redfish Delete BMC Dump ${dump_id}
118
119 ${dump_entries}= Get BMC Dump Entries
120 Should Be Empty ${dump_entries}
121
122
123Delete All User Initiated BMC Dumps And Verify
124 [Documentation] Delete all user initiated BMC dumps and verify.
125 [Tags] Delete_All_User_Initiated_BMC_Dumps_And_Verify
126
manashsarma70d840e2022-10-18 02:34:45 -0500127 # Power off host so that dump is not offloaded to host OS.
128 Redfish Power Off stack_mode=skip
129
Rahul Maheshwari95cbceb2020-10-21 23:25:08 -0500130 # Create some BMC dump.
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500131 Create User Initiated BMC Dump Via Redfish
132 Create User Initiated BMC Dump Via Redfish
Rahul Maheshwari95cbceb2020-10-21 23:25:08 -0500133
134 Redfish Delete All BMC Dumps
135 ${dump_entries}= Get BMC Dump Entries
136 Should Be Empty ${dump_entries}
137
138
Rahul Maheshwari4f338ab2020-10-21 23:28:40 -0500139Create Two User Initiated BMC Dumps
140 [Documentation] Create two user initiated BMC dumps.
141 [Tags] Create_Two_User_Initiated_BMC_Dumps
142
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500143 ${dump_id1}= Create User Initiated BMC Dump Via Redfish
144 ${dump_id2}= Create User Initiated BMC Dump Via Redfish
Rahul Maheshwari4f338ab2020-10-21 23:28:40 -0500145
146 ${dump_entries}= Get BMC Dump Entries
147 Length Should Be ${dump_entries} 2
148 Should Contain ${dump_entries} ${dump_id1}
149 Should Contain ${dump_entries} ${dump_id2}
150
151
152Create Two User Initiated BMC Dumps And Delete One
153 [Documentation] Create two dumps and delete the first.
154 [Tags] Create_Two_User_Initiated_BMC_Dumps_And_Delete_One
155
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500156 ${dump_id1}= Create User Initiated BMC Dump Via Redfish
157 ${dump_id2}= Create User Initiated BMC Dump Via Redfish
Rahul Maheshwari4f338ab2020-10-21 23:28:40 -0500158
159 Redfish Delete BMC Dump ${dump_id1}
160
161 ${dump_entries}= Get BMC Dump Entries
162 Length Should Be ${dump_entries} 1
163 List Should Contain Value ${dump_entries} ${dump_id2}
164
165
166Create And Delete User Initiated BMC Dump Multiple Times
167 [Documentation] Create and delete user initiated BMC dump multiple times.
168 [Tags] Create_And_Delete_User_Initiated_BMC_Dump_Multiple_Times
169
170 FOR ${INDEX} IN 1 10
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500171 ${dump_id}= Create User Initiated BMC Dump Via Redfish
Rahul Maheshwari4f338ab2020-10-21 23:28:40 -0500172 Redfish Delete BMC Dump ${dump_id}
173 END
174
175
Rahul Maheshwarid709c8d2020-11-01 23:03:51 -0600176Verify Maximum BMC Dump Creation
177 [Documentation] Create maximum BMC dump and verify error when dump runs out of space.
178 [Tags] Verify_Maximum_BMC_Dump_Creation
179 [Teardown] Redfish Delete All BMC Dumps
180
181 # Maximum allowed space for dump is 1024 KB. BMC typically hold 8-14 dumps
182 # before running out of this dump space. So trying to create dumps in 20
183 # iterations to run out of space.
manashsarmabd346b32022-07-20 06:22:58 -0500184 # User can key in the Maximum allowed space for bmc dump and how many iteration.
185 FOR ${n} IN RANGE 0 ${MAX_DUMP_COUNT}
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500186 Create User Initiated BMC Dump Via Redfish
Rahul Maheshwarid709c8d2020-11-01 23:03:51 -0600187 ${dump_space}= Get Disk Usage For Dumps
Tim Leede2d1302021-06-18 01:24:11 +0800188 Exit For Loop If ${dump_space} >= (${BMC_DUMP_TOTAL_SIZE} - ${BMC_DUMP_MIN_SPACE_REQD})
Rahul Maheshwarid709c8d2020-11-01 23:03:51 -0600189 END
190
191 # Check error while creating dump when dump size is full.
192 ${payload}= Create Dictionary DiagnosticDataType=Manager
193 Redfish.Post /redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.CollectDiagnosticData
194 ... body=${payload} valid_status_codes=[${HTTP_INTERNAL_SERVER_ERROR}]
195
196
manashsarma633cac92022-11-25 03:27:03 -0600197Verify BMC Core Dump When Host Powered Off
198 [Documentation] Verify BMC core dump after application crash at host powered off state.
199 [Tags] Verify_BMC_Core_Dump_When_Host_Powered_Off
200
201 Redfish Power Off stack_mode=skip
202
203 # Ensure all dumps are cleaned out.
204 Redfish Delete All BMC Dumps
205 Trigger Core Dump
206
207 # Verify that BMC dump is available.
208 Wait Until Keyword Succeeds 2 min 10 sec Is BMC Dump Available
209
210
manashsarma849189c2022-11-28 04:16:51 -0600211Verify Core Dump Size
212 [Documentation] Verify BMC core dump size is under 20 MB.
213 [Tags] Verify_Core_Dump_Size
214
215 Redfish Power Off stack_mode=skip
216
217 # Ensure all dumps are cleaned out.
218 Redfish Delete All BMC Dumps
219 Trigger Core Dump
220
221 # Verify that BMC dump is available.
222 Wait Until Keyword Succeeds 2 min 10 sec Is BMC Dump Available
223 ${dump_entries}= Get BMC Dump Entries
224 ${resp}= Redfish.Get Properties
225 ... /redfish/v1/Managers/bmc/LogServices/Dump/Entries/${dump_entries[0]}
226
227 # Max size for dump is 20 MB = 20x1024x1024 Byte.
228 Should Be True 0 < ${resp["AdditionalDataSizeBytes"]} < 20971520
229
230
Rahul Maheshwari2568f872020-09-23 01:03:39 -0500231*** Keywords ***
232
Rahul Maheshwaribcefdf22020-10-16 07:51:34 -0500233Get BMC Dump Entries
234 [Documentation] Return BMC dump ids list.
235
236 ${dump_uris}= redfish_utils.get_member_list /redfish/v1/Managers/bmc/LogServices/Dump/Entries
237 ${dump_ids}= Create List
238
239 FOR ${dump_uri} IN @{dump_uris}
240 ${dump_id}= Fetch From Right ${dump_uri} /
241 Append To List ${dump_ids} ${dump_id}
242 END
243
244 [Return] ${dump_ids}
245
246
manashsarma633cac92022-11-25 03:27:03 -0600247Is BMC Dump Available
248 [Documentation] Verify if BMC dump is available.
249
250 ${dump_entries}= Get BMC Dump Entries
251
252 # Verifying that BMC dump is available.
253 ${length}= Get length ${dump_entries}
254 Should Be True 0 < ${length}
255
256
Rahul Maheshwarid709c8d2020-11-01 23:03:51 -0600257Get Disk Usage For Dumps
258 [Documentation] Return disk usage in kilobyte for BMC dumps.
259
260 ${usage_output} ${stderr} ${rc}= BMC Execute Command du -s /var/lib/phosphor-debug-collector/dumps
261
262 # Example of output from above BMC cli command.
263 # $ du -s /var/lib/phosphor-debug-collector/dumps
264 # 516 /var/lib/phosphor-debug-collector/dumps
265
266 ${usage_output}= Fetch From Left ${usage_output} /
267 ${usage_output}= Convert To Integer ${usage_output}
268
269 [return] ${usage_output}
270
271
Rahul Maheshwari2568f872020-09-23 01:03:39 -0500272Test Teardown Execution
273 [Documentation] Do test teardown operation.
274
275 FFDC On Test Case Fail
276 Close All Connections