blob: d38c08505ce3a196f8d97adc727ccc4872256ac6 [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
30 ${dump_id}= Create User Initiated BMC Dump Via Redfish
31 Redfish Delete BMC Dump ${dump_id}
32 Run Keyword And Expect Error ValueError: * Redfish Delete BMC Dump ${dump_id}
33
34
Rahul Maheshwari2568f872020-09-23 01:03:39 -050035Verify User Initiated BMC Dump When Host Powered Off
36 [Documentation] Create user initiated BMC dump at host off state and
37 ... verify dump entry for it.
38 [Tags] Verify_User_Initiated_BMC_Dump_When_Host_Powered_Off
39
40 Redfish Power Off stack_mode=skip
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -050041 ${dump_id}= Create User Initiated BMC Dump Via Redfish
Rahul Maheshwaribcefdf22020-10-16 07:51:34 -050042 ${dump_entries}= Get BMC Dump Entries
Rahul Maheshwari2568f872020-09-23 01:03:39 -050043 Length Should Be ${dump_entries} 1
44 List Should Contain Value ${dump_entries} ${dump_id}
45
Rahul Maheshwari2568f872020-09-23 01:03:39 -050046
Rahul Maheshwarie8e9d0c2020-10-30 02:39:01 -050047Verify User Initiated BMC Dump Size
manashsarma7831dc22022-03-08 01:49:36 -060048 [Documentation] Verify user initiated BMC dump size is under 20 MB.
Rahul Maheshwarie8e9d0c2020-10-30 02:39:01 -050049 [Tags] Verify_User_Initiated_BMC_Dump_Size
50
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -050051 ${dump_id}= Create User Initiated BMC Dump Via Redfish
Rahul Maheshwarie8e9d0c2020-10-30 02:39:01 -050052 ${resp}= Redfish.Get Properties /redfish/v1/Managers/bmc/LogServices/Dump/Entries/${dump_id}
53
54 # Example of response from above Redfish GET request.
55 # "@odata.type": "#LogEntry.v1_7_0.LogEntry",
56 # "AdditionalDataSizeBytes": 31644,
57 # "AdditionalDataURI": "/redfish/v1/Managers/bmc/LogServices/Dump/attachment/9",
58 # "Created": "2020-10-23T06:32:53+00:00",
59 # "DiagnosticDataType": "Manager",
60 # "EntryType": "Event",
61 # "Id": "9",
62 # "Name": "BMC Dump Entry"
63
manashsarma7831dc22022-03-08 01:49:36 -060064 # Max size for dump is 20 MB = 20x1024x1024 Byte.
65 Should Be True 0 < ${resp["AdditionalDataSizeBytes"]} < 20971520
Rahul Maheshwarie8e9d0c2020-10-30 02:39:01 -050066
67
manashsarmabbc68bc2022-12-05 09:55:17 -060068Verify Multiple BMC Dump Creation
69 [Documentation] Verify that multiple BMC dumps can be created one after
70 ... another successfully.
71 [Tags] Verify_Multiple_BMC_Dump_Creation
72
73 ${dump_count}= Evaluate random.randint(5, 10) modules=random
74 FOR ${INDEX} IN 1 ${dump_count}
75 Create User Initiated BMC Dump Via Redfish
76 END
77
78
manashsarma395f8802022-11-17 03:09:02 -060079Verify BMC Dump Default Location In BMC
80 [Documentation] Verify that BMC dump is created in its default location of BMC.
George Keishing224e4c72022-12-14 05:07:58 -060081 [Tags] Verify_BMC_Dump_Default_Location_In_BMC
manashsarma395f8802022-11-17 03:09:02 -060082
83 Redfish Delete All BMC Dumps
84 ${dump_id}= Create User Initiated BMC Dump Via Redfish
85 ${dump_file} ${stderr} ${rc}= BMC Execute Command
86 ... ls ${BMC_DUMP_COLLECTOR_PATH}/${dump_id}
87 Should Be True ${rc} == 0
George Keishing952bb0f2022-12-12 03:13:35 -060088 Should Start With ${dump_file} BMCDUMP
manashsarma395f8802022-11-17 03:09:02 -060089
90
George Keishing3d850982022-07-19 11:03:03 -050091Verify User Initiated BMC Dump When Host Booted
92 [Documentation] Create user initiated BMC dump at host booted state and
93 ... verify dump entry for it.
94 [Tags] Verify_User_Initiated_BMC_Dump_When_Host_Booted
95
96 Redfish Power On stack_mode=skip
97 ${dump_id}= Create User Initiated BMC Dump Via Redfish
98 ${dump_entries}= Get BMC Dump Entries
99 Length Should Be ${dump_entries} 1
100 List Should Contain Value ${dump_entries} ${dump_id}
101
102
Rahul Maheshwari2568f872020-09-23 01:03:39 -0500103Verify Dump Persistency On Dump Service Restart
104 [Documentation] Create user dump, restart dump manager service and verify dump
105 ... persistency.
106 [Tags] Verify_Dump_Persistency_On_Dump_Service_Restart
107
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500108 Create User Initiated BMC Dump Via Redfish
Rahul Maheshwari2568f872020-09-23 01:03:39 -0500109 ${dump_entries_before}= redfish_utils.get_member_list /redfish/v1/Managers/bmc/LogServices/Dump/Entries
110
111 # Restart dump service.
112 BMC Execute Command systemctl restart xyz.openbmc_project.Dump.Manager.service
113 Sleep 10s reason=Wait for BMC dump service to restart properly
114
115 ${dump_entries_after}= redfish_utils.get_member_list /redfish/v1/Managers/bmc/LogServices/Dump/Entries
116 Lists Should Be Equal ${dump_entries_before} ${dump_entries_after}
117
118
119Verify Dump Persistency On BMC Reset
120 [Documentation] Create user dump, reset BMC and verify dump persistency.
121 [Tags] Verify_Dump_Persistency_On_BMC_Reset
122
manashsarma8fa9c892022-10-03 06:20:58 -0500123 # Power off host so that dump is not offloaded to host OS.
124 Redfish Power Off stack_mode=skip
125
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500126 Create User Initiated BMC Dump Via Redfish
Rahul Maheshwari2568f872020-09-23 01:03:39 -0500127 ${dump_entries_before}= redfish_utils.get_member_list /redfish/v1/Managers/bmc/LogServices/Dump/Entries
128
129 # Reset BMC.
George Keishing88ec2802021-08-04 03:04:22 -0500130 OBMC Reboot (off) stack_mode=skip
Rahul Maheshwari2568f872020-09-23 01:03:39 -0500131
132 ${dump_entries_after}= redfish_utils.get_member_list /redfish/v1/Managers/bmc/LogServices/Dump/Entries
133 Lists Should Be Equal ${dump_entries_before} ${dump_entries_after}
134
135
Rahul Maheshwari95cbceb2020-10-21 23:25:08 -0500136Delete User Initiated BMC Dump And Verify
137 [Documentation] Delete user initiated BMC dump and verify.
138 [Tags] Delete_User_Initiated_BMC_Dump_And_Verify
139
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500140 ${dump_id}= Create User Initiated BMC Dump Via Redfish
Rahul Maheshwari95cbceb2020-10-21 23:25:08 -0500141 Redfish Delete BMC Dump ${dump_id}
142
143 ${dump_entries}= Get BMC Dump Entries
144 Should Be Empty ${dump_entries}
145
146
147Delete All User Initiated BMC Dumps And Verify
148 [Documentation] Delete all user initiated BMC dumps and verify.
149 [Tags] Delete_All_User_Initiated_BMC_Dumps_And_Verify
150
manashsarma70d840e2022-10-18 02:34:45 -0500151 # Power off host so that dump is not offloaded to host OS.
152 Redfish Power Off stack_mode=skip
153
Rahul Maheshwari95cbceb2020-10-21 23:25:08 -0500154 # Create some BMC dump.
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500155 Create User Initiated BMC Dump Via Redfish
156 Create User Initiated BMC Dump Via Redfish
Rahul Maheshwari95cbceb2020-10-21 23:25:08 -0500157
158 Redfish Delete All BMC Dumps
159 ${dump_entries}= Get BMC Dump Entries
160 Should Be Empty ${dump_entries}
161
162
Rahul Maheshwari4f338ab2020-10-21 23:28:40 -0500163Create Two User Initiated BMC Dumps
164 [Documentation] Create two user initiated BMC dumps.
165 [Tags] Create_Two_User_Initiated_BMC_Dumps
166
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500167 ${dump_id1}= Create User Initiated BMC Dump Via Redfish
168 ${dump_id2}= Create User Initiated BMC Dump Via Redfish
Rahul Maheshwari4f338ab2020-10-21 23:28:40 -0500169
170 ${dump_entries}= Get BMC Dump Entries
171 Length Should Be ${dump_entries} 2
172 Should Contain ${dump_entries} ${dump_id1}
173 Should Contain ${dump_entries} ${dump_id2}
174
175
176Create Two User Initiated BMC Dumps And Delete One
177 [Documentation] Create two dumps and delete the first.
178 [Tags] Create_Two_User_Initiated_BMC_Dumps_And_Delete_One
179
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500180 ${dump_id1}= Create User Initiated BMC Dump Via Redfish
181 ${dump_id2}= Create User Initiated BMC Dump Via Redfish
Rahul Maheshwari4f338ab2020-10-21 23:28:40 -0500182
183 Redfish Delete BMC Dump ${dump_id1}
184
185 ${dump_entries}= Get BMC Dump Entries
186 Length Should Be ${dump_entries} 1
187 List Should Contain Value ${dump_entries} ${dump_id2}
188
189
190Create And Delete User Initiated BMC Dump Multiple Times
191 [Documentation] Create and delete user initiated BMC dump multiple times.
192 [Tags] Create_And_Delete_User_Initiated_BMC_Dump_Multiple_Times
193
194 FOR ${INDEX} IN 1 10
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500195 ${dump_id}= Create User Initiated BMC Dump Via Redfish
Rahul Maheshwari4f338ab2020-10-21 23:28:40 -0500196 Redfish Delete BMC Dump ${dump_id}
197 END
198
199
Rahul Maheshwarid709c8d2020-11-01 23:03:51 -0600200Verify Maximum BMC Dump Creation
201 [Documentation] Create maximum BMC dump and verify error when dump runs out of space.
202 [Tags] Verify_Maximum_BMC_Dump_Creation
203 [Teardown] Redfish Delete All BMC Dumps
204
205 # Maximum allowed space for dump is 1024 KB. BMC typically hold 8-14 dumps
206 # before running out of this dump space. So trying to create dumps in 20
207 # iterations to run out of space.
manashsarmabd346b32022-07-20 06:22:58 -0500208 # User can key in the Maximum allowed space for bmc dump and how many iteration.
209 FOR ${n} IN RANGE 0 ${MAX_DUMP_COUNT}
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500210 Create User Initiated BMC Dump Via Redfish
Rahul Maheshwarid709c8d2020-11-01 23:03:51 -0600211 ${dump_space}= Get Disk Usage For Dumps
Tim Leede2d1302021-06-18 01:24:11 +0800212 Exit For Loop If ${dump_space} >= (${BMC_DUMP_TOTAL_SIZE} - ${BMC_DUMP_MIN_SPACE_REQD})
Rahul Maheshwarid709c8d2020-11-01 23:03:51 -0600213 END
214
215 # Check error while creating dump when dump size is full.
216 ${payload}= Create Dictionary DiagnosticDataType=Manager
217 Redfish.Post /redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.CollectDiagnosticData
218 ... body=${payload} valid_status_codes=[${HTTP_INTERNAL_SERVER_ERROR}]
219
220
manashsarma633cac92022-11-25 03:27:03 -0600221Verify BMC Core Dump When Host Powered Off
222 [Documentation] Verify BMC core dump after application crash at host powered off state.
223 [Tags] Verify_BMC_Core_Dump_When_Host_Powered_Off
224
225 Redfish Power Off stack_mode=skip
226
227 # Ensure all dumps are cleaned out.
228 Redfish Delete All BMC Dumps
229 Trigger Core Dump
230
231 # Verify that BMC dump is available.
232 Wait Until Keyword Succeeds 2 min 10 sec Is BMC Dump Available
233
234
manashsarma849189c2022-11-28 04:16:51 -0600235Verify Core Dump Size
236 [Documentation] Verify BMC core dump size is under 20 MB.
237 [Tags] Verify_Core_Dump_Size
238
239 Redfish Power Off stack_mode=skip
240
241 # Ensure all dumps are cleaned out.
242 Redfish Delete All BMC Dumps
243 Trigger Core Dump
244
245 # Verify that BMC dump is available.
246 Wait Until Keyword Succeeds 2 min 10 sec Is BMC Dump Available
247 ${dump_entries}= Get BMC Dump Entries
248 ${resp}= Redfish.Get Properties
249 ... /redfish/v1/Managers/bmc/LogServices/Dump/Entries/${dump_entries[0]}
250
251 # Max size for dump is 20 MB = 20x1024x1024 Byte.
252 Should Be True 0 < ${resp["AdditionalDataSizeBytes"]} < 20971520
253
254
manashsarmafcbfdf62022-12-07 06:36:28 -0600255Verify Error While Initiating BMC Dump During Dumping State
256 [Documentation] Verify error while initiating BMC dump during dumping state.
257 [Tags] Verify_Error_While_Initiating_BMC_Dump_During_Dumping_State
258
George Keishing8a68d452022-12-09 07:25:35 -0600259 Create User Initiated BMC Dump Via Redfish ${1}
manashsarmafcbfdf62022-12-07 06:36:28 -0600260
261 # Check error while initiating BMC dump while dump in progress.
262 ${payload}= Create Dictionary DiagnosticDataType=Manager
263 Redfish.Post
264 ... /redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.CollectDiagnosticData
265 ... body=${payload} valid_status_codes=[${HTTP_SERVICE_UNAVAILABLE}]
266
267
manashsarmaaa845b72022-12-12 05:41:32 -0600268Verify BMC Dump Create Errors While Another BMC Dump In Progress
269 [Documentation] Verify BMC dump creation error until older BMC dump completion.
270 [Tags] Verify_BMC_Dump_Create_Errors_While_Another_BMC_Dump_In_Progress
271
272 # Initiate a BMC dump that returns without completion.
273 ${task_id}= Create User Initiated BMC Dump Via Redfish ${1}
274
275 # Now continue to initiate multiple dump request which is not expected to be accepted
276 # till earlier BMC dump task is completed. A limit is set to avoid risk of infinite loop.
277 ${payload}= Create Dictionary DiagnosticDataType=Manager
278 WHILE True limit=1000
279 ${task_dict}= Redfish.Get Properties /redfish/v1/TaskService/Tasks/${task_id}
280 IF '${task_dict['TaskState']}' == 'Completed' BREAK
281 Redfish.Post
282 ... /redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.CollectDiagnosticData
283 ... body=${payload} valid_status_codes=[${HTTP_SERVICE_UNAVAILABLE}]
284 END
285
286 # The next BMC dump initiation request should be accepted as earlier dump is completed.
287 ${resp}= Redfish.Post
288 ... /redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.CollectDiagnosticData
289 ... body=${payload} valid_status_codes=[${HTTP_ACCEPTED}]
290
291 # Wait for above initiated dump to complete. Otherwise, on going dump would impact next test.
292 Wait Until Keyword Succeeds 5 min 15 sec Check Task Completion ${resp.dict['Id']}
293
294
Rahul Maheshwari2568f872020-09-23 01:03:39 -0500295*** Keywords ***
296
Rahul Maheshwaribcefdf22020-10-16 07:51:34 -0500297Get BMC Dump Entries
298 [Documentation] Return BMC dump ids list.
299
300 ${dump_uris}= redfish_utils.get_member_list /redfish/v1/Managers/bmc/LogServices/Dump/Entries
301 ${dump_ids}= Create List
302
303 FOR ${dump_uri} IN @{dump_uris}
304 ${dump_id}= Fetch From Right ${dump_uri} /
305 Append To List ${dump_ids} ${dump_id}
306 END
307
308 [Return] ${dump_ids}
309
310
manashsarma633cac92022-11-25 03:27:03 -0600311Is BMC Dump Available
312 [Documentation] Verify if BMC dump is available.
313
314 ${dump_entries}= Get BMC Dump Entries
315
316 # Verifying that BMC dump is available.
317 ${length}= Get length ${dump_entries}
318 Should Be True 0 < ${length}
319
320
Rahul Maheshwarid709c8d2020-11-01 23:03:51 -0600321Get Disk Usage For Dumps
322 [Documentation] Return disk usage in kilobyte for BMC dumps.
323
George Keishing952bb0f2022-12-12 03:13:35 -0600324 ${usage_output} ${stderr} ${rc}= BMC Execute Command du -s ${BMC_DUMP_COLLECTOR_PATH}
Rahul Maheshwarid709c8d2020-11-01 23:03:51 -0600325
326 # Example of output from above BMC cli command.
327 # $ du -s /var/lib/phosphor-debug-collector/dumps
328 # 516 /var/lib/phosphor-debug-collector/dumps
329
330 ${usage_output}= Fetch From Left ${usage_output} /
331 ${usage_output}= Convert To Integer ${usage_output}
332
333 [return] ${usage_output}
334
335
Rahul Maheshwari2568f872020-09-23 01:03:39 -0500336Test Teardown Execution
337 [Documentation] Do test teardown operation.
338
339 FFDC On Test Case Fail
340 Close All Connections