blob: 35f160e4b32973ea32420bd20e2767d86d8285f1 [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}
manashsarma395f8802022-11-17 03:09:02 -060022${BMC_DUMP_COLLECTOR_PATH} /var/lib/phosphor-debug-collector/dumps
Rahul Maheshwari2568f872020-09-23 01:03:39 -050023
24*** Test Cases ***
25
manashsarma4b5b1fa2022-11-16 02:36:58 -060026Verify Error Response For Already Deleted Dump Id
27 [Documentation] Delete non existing BMC dump and expect an error.
28 [Tags] Verify_Error_Response_For_Already_Deleted_Dump_Id
29
manashsarma9dcabad2023-02-02 03:55:17 -060030 Redfish Power Off stack_mode=skip
manashsarma4b5b1fa2022-11-16 02:36:58 -060031 ${dump_id}= Create User Initiated BMC Dump Via Redfish
32 Redfish Delete BMC Dump ${dump_id}
33 Run Keyword And Expect Error ValueError: * Redfish Delete BMC Dump ${dump_id}
34
35
Rahul Maheshwari2568f872020-09-23 01:03:39 -050036Verify User Initiated BMC Dump When Host Powered Off
37 [Documentation] Create user initiated BMC dump at host off state and
38 ... verify dump entry for it.
39 [Tags] Verify_User_Initiated_BMC_Dump_When_Host_Powered_Off
40
41 Redfish Power Off stack_mode=skip
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -050042 ${dump_id}= Create User Initiated BMC Dump Via Redfish
Rahul Maheshwaribcefdf22020-10-16 07:51:34 -050043 ${dump_entries}= Get BMC Dump Entries
Rahul Maheshwari2568f872020-09-23 01:03:39 -050044 Length Should Be ${dump_entries} 1
45 List Should Contain Value ${dump_entries} ${dump_id}
46
Rahul Maheshwari2568f872020-09-23 01:03:39 -050047
Rahul Maheshwarie8e9d0c2020-10-30 02:39:01 -050048Verify User Initiated BMC Dump Size
manashsarma7831dc22022-03-08 01:49:36 -060049 [Documentation] Verify user initiated BMC dump size is under 20 MB.
Rahul Maheshwarie8e9d0c2020-10-30 02:39:01 -050050 [Tags] Verify_User_Initiated_BMC_Dump_Size
51
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -050052 ${dump_id}= Create User Initiated BMC Dump Via Redfish
Rahul Maheshwarie8e9d0c2020-10-30 02:39:01 -050053 ${resp}= Redfish.Get Properties /redfish/v1/Managers/bmc/LogServices/Dump/Entries/${dump_id}
54
55 # Example of response from above Redfish GET request.
56 # "@odata.type": "#LogEntry.v1_7_0.LogEntry",
57 # "AdditionalDataSizeBytes": 31644,
58 # "AdditionalDataURI": "/redfish/v1/Managers/bmc/LogServices/Dump/attachment/9",
59 # "Created": "2020-10-23T06:32:53+00:00",
60 # "DiagnosticDataType": "Manager",
61 # "EntryType": "Event",
62 # "Id": "9",
63 # "Name": "BMC Dump Entry"
64
manashsarma7831dc22022-03-08 01:49:36 -060065 # Max size for dump is 20 MB = 20x1024x1024 Byte.
66 Should Be True 0 < ${resp["AdditionalDataSizeBytes"]} < 20971520
Rahul Maheshwarie8e9d0c2020-10-30 02:39:01 -050067
68
manashsarmabbc68bc2022-12-05 09:55:17 -060069Verify Multiple BMC Dump Creation
70 [Documentation] Verify that multiple BMC dumps can be created one after
71 ... another successfully.
72 [Tags] Verify_Multiple_BMC_Dump_Creation
73
74 ${dump_count}= Evaluate random.randint(5, 10) modules=random
75 FOR ${INDEX} IN 1 ${dump_count}
76 Create User Initiated BMC Dump Via Redfish
77 END
78
79
manashsarma395f8802022-11-17 03:09:02 -060080Verify BMC Dump Default Location In BMC
81 [Documentation] Verify that BMC dump is created in its default location of BMC.
George Keishing224e4c72022-12-14 05:07:58 -060082 [Tags] Verify_BMC_Dump_Default_Location_In_BMC
manashsarma395f8802022-11-17 03:09:02 -060083
84 Redfish Delete All BMC Dumps
85 ${dump_id}= Create User Initiated BMC Dump Via Redfish
86 ${dump_file} ${stderr} ${rc}= BMC Execute Command
87 ... ls ${BMC_DUMP_COLLECTOR_PATH}/${dump_id}
88 Should Be True ${rc} == 0
George Keishing952bb0f2022-12-12 03:13:35 -060089 Should Start With ${dump_file} BMCDUMP
manashsarma395f8802022-11-17 03:09:02 -060090
91
George Keishing3d850982022-07-19 11:03:03 -050092Verify User Initiated BMC Dump When Host Booted
93 [Documentation] Create user initiated BMC dump at host booted state and
94 ... verify dump entry for it.
95 [Tags] Verify_User_Initiated_BMC_Dump_When_Host_Booted
96
97 Redfish Power On stack_mode=skip
98 ${dump_id}= Create User Initiated BMC Dump Via Redfish
99 ${dump_entries}= Get BMC Dump Entries
100 Length Should Be ${dump_entries} 1
101 List Should Contain Value ${dump_entries} ${dump_id}
102
103
Rahul Maheshwari2568f872020-09-23 01:03:39 -0500104Verify Dump Persistency On Dump Service Restart
105 [Documentation] Create user dump, restart dump manager service and verify dump
106 ... persistency.
107 [Tags] Verify_Dump_Persistency_On_Dump_Service_Restart
108
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500109 Create User Initiated BMC Dump Via Redfish
Rahul Maheshwari2568f872020-09-23 01:03:39 -0500110 ${dump_entries_before}= redfish_utils.get_member_list /redfish/v1/Managers/bmc/LogServices/Dump/Entries
111
112 # Restart dump service.
113 BMC Execute Command systemctl restart xyz.openbmc_project.Dump.Manager.service
114 Sleep 10s reason=Wait for BMC dump service to restart properly
115
116 ${dump_entries_after}= redfish_utils.get_member_list /redfish/v1/Managers/bmc/LogServices/Dump/Entries
117 Lists Should Be Equal ${dump_entries_before} ${dump_entries_after}
118
119
120Verify Dump Persistency On BMC Reset
121 [Documentation] Create user dump, reset BMC and verify dump persistency.
122 [Tags] Verify_Dump_Persistency_On_BMC_Reset
123
manashsarma8fa9c892022-10-03 06:20:58 -0500124 # Power off host so that dump is not offloaded to host OS.
125 Redfish Power Off stack_mode=skip
126
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500127 Create User Initiated BMC Dump Via Redfish
Rahul Maheshwari2568f872020-09-23 01:03:39 -0500128 ${dump_entries_before}= redfish_utils.get_member_list /redfish/v1/Managers/bmc/LogServices/Dump/Entries
129
130 # Reset BMC.
George Keishing88ec2802021-08-04 03:04:22 -0500131 OBMC Reboot (off) stack_mode=skip
Rahul Maheshwari2568f872020-09-23 01:03:39 -0500132
133 ${dump_entries_after}= redfish_utils.get_member_list /redfish/v1/Managers/bmc/LogServices/Dump/Entries
134 Lists Should Be Equal ${dump_entries_before} ${dump_entries_after}
135
136
Rahul Maheshwari95cbceb2020-10-21 23:25:08 -0500137Delete User Initiated BMC Dump And Verify
138 [Documentation] Delete user initiated BMC dump and verify.
139 [Tags] Delete_User_Initiated_BMC_Dump_And_Verify
140
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500141 ${dump_id}= Create User Initiated BMC Dump Via Redfish
Rahul Maheshwari95cbceb2020-10-21 23:25:08 -0500142 Redfish Delete BMC Dump ${dump_id}
143
144 ${dump_entries}= Get BMC Dump Entries
145 Should Be Empty ${dump_entries}
146
147
148Delete All User Initiated BMC Dumps And Verify
149 [Documentation] Delete all user initiated BMC dumps and verify.
150 [Tags] Delete_All_User_Initiated_BMC_Dumps_And_Verify
151
manashsarma70d840e2022-10-18 02:34:45 -0500152 # Power off host so that dump is not offloaded to host OS.
153 Redfish Power Off stack_mode=skip
154
Rahul Maheshwari95cbceb2020-10-21 23:25:08 -0500155 # Create some BMC dump.
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500156 Create User Initiated BMC Dump Via Redfish
157 Create User Initiated BMC Dump Via Redfish
Rahul Maheshwari95cbceb2020-10-21 23:25:08 -0500158
159 Redfish Delete All BMC Dumps
160 ${dump_entries}= Get BMC Dump Entries
161 Should Be Empty ${dump_entries}
162
163
Rahul Maheshwari4f338ab2020-10-21 23:28:40 -0500164Create Two User Initiated BMC Dumps
165 [Documentation] Create two user initiated BMC dumps.
166 [Tags] Create_Two_User_Initiated_BMC_Dumps
167
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500168 ${dump_id1}= Create User Initiated BMC Dump Via Redfish
169 ${dump_id2}= Create User Initiated BMC Dump Via Redfish
Rahul Maheshwari4f338ab2020-10-21 23:28:40 -0500170
171 ${dump_entries}= Get BMC Dump Entries
172 Length Should Be ${dump_entries} 2
173 Should Contain ${dump_entries} ${dump_id1}
174 Should Contain ${dump_entries} ${dump_id2}
175
176
177Create Two User Initiated BMC Dumps And Delete One
178 [Documentation] Create two dumps and delete the first.
179 [Tags] Create_Two_User_Initiated_BMC_Dumps_And_Delete_One
180
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500181 ${dump_id1}= Create User Initiated BMC Dump Via Redfish
182 ${dump_id2}= Create User Initiated BMC Dump Via Redfish
Rahul Maheshwari4f338ab2020-10-21 23:28:40 -0500183
184 Redfish Delete BMC Dump ${dump_id1}
185
186 ${dump_entries}= Get BMC Dump Entries
187 Length Should Be ${dump_entries} 1
188 List Should Contain Value ${dump_entries} ${dump_id2}
189
190
191Create And Delete User Initiated BMC Dump Multiple Times
192 [Documentation] Create and delete user initiated BMC dump multiple times.
193 [Tags] Create_And_Delete_User_Initiated_BMC_Dump_Multiple_Times
194
195 FOR ${INDEX} IN 1 10
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500196 ${dump_id}= Create User Initiated BMC Dump Via Redfish
Rahul Maheshwari4f338ab2020-10-21 23:28:40 -0500197 Redfish Delete BMC Dump ${dump_id}
198 END
199
200
Rahul Maheshwarid709c8d2020-11-01 23:03:51 -0600201Verify Maximum BMC Dump Creation
202 [Documentation] Create maximum BMC dump and verify error when dump runs out of space.
203 [Tags] Verify_Maximum_BMC_Dump_Creation
204 [Teardown] Redfish Delete All BMC Dumps
205
206 # Maximum allowed space for dump is 1024 KB. BMC typically hold 8-14 dumps
207 # before running out of this dump space. So trying to create dumps in 20
208 # iterations to run out of space.
manashsarmabd346b32022-07-20 06:22:58 -0500209 # User can key in the Maximum allowed space for bmc dump and how many iteration.
210 FOR ${n} IN RANGE 0 ${MAX_DUMP_COUNT}
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500211 Create User Initiated BMC Dump Via Redfish
Rahul Maheshwarid709c8d2020-11-01 23:03:51 -0600212 ${dump_space}= Get Disk Usage For Dumps
Tim Leede2d1302021-06-18 01:24:11 +0800213 Exit For Loop If ${dump_space} >= (${BMC_DUMP_TOTAL_SIZE} - ${BMC_DUMP_MIN_SPACE_REQD})
Rahul Maheshwarid709c8d2020-11-01 23:03:51 -0600214 END
215
216 # Check error while creating dump when dump size is full.
217 ${payload}= Create Dictionary DiagnosticDataType=Manager
218 Redfish.Post /redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.CollectDiagnosticData
219 ... body=${payload} valid_status_codes=[${HTTP_INTERNAL_SERVER_ERROR}]
220
221
manashsarma633cac92022-11-25 03:27:03 -0600222Verify BMC Core Dump When Host Powered Off
223 [Documentation] Verify BMC core dump after application crash at host powered off state.
224 [Tags] Verify_BMC_Core_Dump_When_Host_Powered_Off
225
226 Redfish Power Off stack_mode=skip
227
228 # Ensure all dumps are cleaned out.
229 Redfish Delete All BMC Dumps
230 Trigger Core Dump
231
232 # Verify that BMC dump is available.
233 Wait Until Keyword Succeeds 2 min 10 sec Is BMC Dump Available
234
235
manashsarma849189c2022-11-28 04:16:51 -0600236Verify Core Dump Size
237 [Documentation] Verify BMC core dump size is under 20 MB.
238 [Tags] Verify_Core_Dump_Size
239
240 Redfish Power Off stack_mode=skip
241
242 # Ensure all dumps are cleaned out.
243 Redfish Delete All BMC Dumps
244 Trigger Core Dump
245
246 # Verify that BMC dump is available.
247 Wait Until Keyword Succeeds 2 min 10 sec Is BMC Dump Available
248 ${dump_entries}= Get BMC Dump Entries
249 ${resp}= Redfish.Get Properties
250 ... /redfish/v1/Managers/bmc/LogServices/Dump/Entries/${dump_entries[0]}
251
252 # Max size for dump is 20 MB = 20x1024x1024 Byte.
253 Should Be True 0 < ${resp["AdditionalDataSizeBytes"]} < 20971520
254
255
manashsarmafcbfdf62022-12-07 06:36:28 -0600256Verify Error While Initiating BMC Dump During Dumping State
257 [Documentation] Verify error while initiating BMC dump during dumping state.
258 [Tags] Verify_Error_While_Initiating_BMC_Dump_During_Dumping_State
259
Nandish-Mattiaf5bc152023-01-30 00:49:59 -0600260 ${task_id}= Create User Initiated BMC Dump Via Redfish ${1}
manashsarmafcbfdf62022-12-07 06:36:28 -0600261
262 # Check error while initiating BMC dump while dump in progress.
263 ${payload}= Create Dictionary DiagnosticDataType=Manager
264 Redfish.Post
265 ... /redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.CollectDiagnosticData
266 ... body=${payload} valid_status_codes=[${HTTP_SERVICE_UNAVAILABLE}]
267
Nandish-Mattiaf5bc152023-01-30 00:49:59 -0600268 # Wait for above initiated dump to complete. Otherwise, on going dump would impact next test.
269 Wait Until Keyword Succeeds 5 min 15 sec Check Task Completion ${task_id}
270
manashsarmafcbfdf62022-12-07 06:36:28 -0600271
manashsarmaaa845b72022-12-12 05:41:32 -0600272Verify BMC Dump Create Errors While Another BMC Dump In Progress
273 [Documentation] Verify BMC dump creation error until older BMC dump completion.
274 [Tags] Verify_BMC_Dump_Create_Errors_While_Another_BMC_Dump_In_Progress
275
276 # Initiate a BMC dump that returns without completion.
277 ${task_id}= Create User Initiated BMC Dump Via Redfish ${1}
278
279 # Now continue to initiate multiple dump request which is not expected to be accepted
280 # till earlier BMC dump task is completed. A limit is set to avoid risk of infinite loop.
281 ${payload}= Create Dictionary DiagnosticDataType=Manager
282 WHILE True limit=1000
283 ${task_dict}= Redfish.Get Properties /redfish/v1/TaskService/Tasks/${task_id}
284 IF '${task_dict['TaskState']}' == 'Completed' BREAK
285 Redfish.Post
286 ... /redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.CollectDiagnosticData
287 ... body=${payload} valid_status_codes=[${HTTP_SERVICE_UNAVAILABLE}]
288 END
289
290 # The next BMC dump initiation request should be accepted as earlier dump is completed.
291 ${resp}= Redfish.Post
292 ... /redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.CollectDiagnosticData
293 ... body=${payload} valid_status_codes=[${HTTP_ACCEPTED}]
294
295 # Wait for above initiated dump to complete. Otherwise, on going dump would impact next test.
296 Wait Until Keyword Succeeds 5 min 15 sec Check Task Completion ${resp.dict['Id']}
297
298
manashsarmaadabd3b2023-02-08 04:51:32 -0600299Verify Core Dump After Terminating Dump Manager Service
300 [Documentation] Verify initiate core dumps and kill Phosphor-dump-manager.
301 [Tags] Verify_Core_Dump_After_Terminating_Dump_Manager_Service
302
303 Redfish Power Off stack_mode=skip
304
305 # Remove all available dumps in BMC.
306 Redfish Delete All BMC Dumps
307
308 # Find the pid of the phosphor-dump-manage process and kill it.
309 ${cmd_buf}= Catenate kill -s SEGV $(pgrep phosphor-dump-manager)
310 ${cmd_output} ${stderr} ${rc}= BMC Execute Command ${cmd_buf}
311 Should Be Equal As Integers ${rc} ${0}
312
313 # Verify that BMC dump is available.
314 Wait Until Keyword Succeeds 2 min 10 sec Is BMC Dump Available
315
316 # Verifing that there is only one dump.
317 ${dump_entries}= Get BMC Dump Entries
318 ${length}= Get length ${dump_entries}
319 Should Be Equal As Integers ${length} ${1}
320
321
Rahul Maheshwari2568f872020-09-23 01:03:39 -0500322*** Keywords ***
323
Rahul Maheshwaribcefdf22020-10-16 07:51:34 -0500324Get BMC Dump Entries
325 [Documentation] Return BMC dump ids list.
326
327 ${dump_uris}= redfish_utils.get_member_list /redfish/v1/Managers/bmc/LogServices/Dump/Entries
328 ${dump_ids}= Create List
329
330 FOR ${dump_uri} IN @{dump_uris}
331 ${dump_id}= Fetch From Right ${dump_uri} /
332 Append To List ${dump_ids} ${dump_id}
333 END
334
335 [Return] ${dump_ids}
336
337
manashsarma633cac92022-11-25 03:27:03 -0600338Is BMC Dump Available
339 [Documentation] Verify if BMC dump is available.
340
341 ${dump_entries}= Get BMC Dump Entries
342
343 # Verifying that BMC dump is available.
344 ${length}= Get length ${dump_entries}
345 Should Be True 0 < ${length}
346
347
Rahul Maheshwarid709c8d2020-11-01 23:03:51 -0600348Get Disk Usage For Dumps
349 [Documentation] Return disk usage in kilobyte for BMC dumps.
350
George Keishing952bb0f2022-12-12 03:13:35 -0600351 ${usage_output} ${stderr} ${rc}= BMC Execute Command du -s ${BMC_DUMP_COLLECTOR_PATH}
Rahul Maheshwarid709c8d2020-11-01 23:03:51 -0600352
353 # Example of output from above BMC cli command.
354 # $ du -s /var/lib/phosphor-debug-collector/dumps
355 # 516 /var/lib/phosphor-debug-collector/dumps
356
357 ${usage_output}= Fetch From Left ${usage_output} /
358 ${usage_output}= Convert To Integer ${usage_output}
359
360 [return] ${usage_output}
361
362
Rahul Maheshwari2568f872020-09-23 01:03:39 -0500363Test Teardown Execution
364 [Documentation] Do test teardown operation.
365
366 FFDC On Test Case Fail
367 Close All Connections