blob: 756dadc7fc645c199801fa7bc0bcc838263f3853 [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
manashsarma7e1f2c52023-02-03 03:18:40 -06009Variables ../../data/pel_variables.py
Rahul Maheshwari2568f872020-09-23 01:03:39 -050010
George Keishingf514ccb2021-02-02 23:55:56 -060011Suite Setup Redfish.Login
Rahul Maheshwari2568f872020-09-23 01:03:39 -050012Test Setup Redfish Delete All BMC Dumps
13Test Teardown Test Teardown Execution
14
George Keishing6217ea32023-10-16 09:58:41 +053015Force Tags BMC_Dumps
16
Tim Leede2d1302021-06-18 01:24:11 +080017*** Variables ***
18
19# Total size of the dump in kilo bytes
20${BMC_DUMP_TOTAL_SIZE} ${1024}
21
22# Minimum space required for one bmc dump in kilo bytes
23${BMC_DUMP_MIN_SPACE_REQD} ${20}
manashsarmabd346b32022-07-20 06:22:58 -050024${MAX_DUMP_COUNT} ${20}
manashsarma395f8802022-11-17 03:09:02 -060025${BMC_DUMP_COLLECTOR_PATH} /var/lib/phosphor-debug-collector/dumps
Rahul Maheshwari2568f872020-09-23 01:03:39 -050026
27*** Test Cases ***
28
manashsarma4b5b1fa2022-11-16 02:36:58 -060029Verify Error Response For Already Deleted Dump Id
30 [Documentation] Delete non existing BMC dump and expect an error.
31 [Tags] Verify_Error_Response_For_Already_Deleted_Dump_Id
32
manashsarma9dcabad2023-02-02 03:55:17 -060033 Redfish Power Off stack_mode=skip
manashsarma4b5b1fa2022-11-16 02:36:58 -060034 ${dump_id}= Create User Initiated BMC Dump Via Redfish
manashsarma6cc5bcf2023-08-22 02:22:48 -050035 Wait Until Keyword Succeeds 15 sec 5 sec Redfish Delete BMC Dump ${dump_id}
manashsarma4b5b1fa2022-11-16 02:36:58 -060036 Run Keyword And Expect Error ValueError: * Redfish Delete BMC Dump ${dump_id}
37
38
Rahul Maheshwari2568f872020-09-23 01:03:39 -050039Verify User Initiated BMC Dump When Host Powered Off
40 [Documentation] Create user initiated BMC dump at host off state and
41 ... verify dump entry for it.
42 [Tags] Verify_User_Initiated_BMC_Dump_When_Host_Powered_Off
43
44 Redfish Power Off stack_mode=skip
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -050045 ${dump_id}= Create User Initiated BMC Dump Via Redfish
Rahul Maheshwaribcefdf22020-10-16 07:51:34 -050046 ${dump_entries}= Get BMC Dump Entries
Rahul Maheshwari2568f872020-09-23 01:03:39 -050047 Length Should Be ${dump_entries} 1
48 List Should Contain Value ${dump_entries} ${dump_id}
49
Rahul Maheshwari2568f872020-09-23 01:03:39 -050050
Rahul Maheshwarie8e9d0c2020-10-30 02:39:01 -050051Verify User Initiated BMC Dump Size
manashsarma7831dc22022-03-08 01:49:36 -060052 [Documentation] Verify user initiated BMC dump size is under 20 MB.
Rahul Maheshwarie8e9d0c2020-10-30 02:39:01 -050053 [Tags] Verify_User_Initiated_BMC_Dump_Size
54
manashsarmae52174b2023-04-03 01:26:56 -050055 Redfish Power Off stack_mode=skip
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -050056 ${dump_id}= Create User Initiated BMC Dump Via Redfish
ganesanb4d430282023-04-27 14:33:23 +000057 ${resp}= Redfish.Get Properties /redfish/v1/Managers/${MANAGER_ID}/LogServices/Dump/Entries/${dump_id}
Rahul Maheshwarie8e9d0c2020-10-30 02:39:01 -050058
59 # Example of response from above Redfish GET request.
60 # "@odata.type": "#LogEntry.v1_7_0.LogEntry",
61 # "AdditionalDataSizeBytes": 31644,
ganesanb4d430282023-04-27 14:33:23 +000062 # "AdditionalDataURI": "/redfish/v1/Managers/${MANAGER_ID}/LogServices/Dump/attachment/9",
Rahul Maheshwarie8e9d0c2020-10-30 02:39:01 -050063 # "Created": "2020-10-23T06:32:53+00:00",
64 # "DiagnosticDataType": "Manager",
65 # "EntryType": "Event",
66 # "Id": "9",
67 # "Name": "BMC Dump Entry"
68
manashsarma7831dc22022-03-08 01:49:36 -060069 # Max size for dump is 20 MB = 20x1024x1024 Byte.
70 Should Be True 0 < ${resp["AdditionalDataSizeBytes"]} < 20971520
Rahul Maheshwarie8e9d0c2020-10-30 02:39:01 -050071
72
manashsarma7e1f2c52023-02-03 03:18:40 -060073Verify Internal Failure Initiated BMC Dump Size
74 [Documentation] Verify that the internal failure initiated BMC dump size is under 20 MB.
75 [Tags] Verify_Internal_Failure_Initiated_BMC_Dump_Size
76
manashsarmaa8efe722024-02-26 03:24:55 -060077 Redfish Power Off stack_mode=skip
manashsarma7e1f2c52023-02-03 03:18:40 -060078 Redfish Delete All BMC Dumps
79
80 # Create an internal failure error log.
81 BMC Execute Command ${CMD_INTERNAL_FAILURE}
82
83 # Wait for BMC dump to get generated after injecting internal failure.
84 Wait Until Keyword Succeeds 2 min 10 sec Is BMC Dump Available
85
86 # Verify that only one BMC dump is generated after injecting error.
87 ${dump_entries}= Get BMC Dump Entries
88 ${length}= Get length ${dump_entries}
89 Should Be Equal As Integers ${length} ${1}
90
91 # Max size for dump is 20 MB = 20x1024x1024 Byte.
92 ${resp}= Redfish.Get Properties
ganesanb4d430282023-04-27 14:33:23 +000093 ... /redfish/v1/Managers/${MANAGER_ID}/LogServices/Dump/Entries/${dump_entries[0]}
manashsarma7e1f2c52023-02-03 03:18:40 -060094 Should Be True 0 < ${resp["AdditionalDataSizeBytes"]} < 20971520
95
96
manashsarmabbc68bc2022-12-05 09:55:17 -060097Verify Multiple BMC Dump Creation
98 [Documentation] Verify that multiple BMC dumps can be created one after
99 ... another successfully.
100 [Tags] Verify_Multiple_BMC_Dump_Creation
101
manashsarmae52174b2023-04-03 01:26:56 -0500102 Redfish Power Off stack_mode=skip
manashsarmabbc68bc2022-12-05 09:55:17 -0600103 ${dump_count}= Evaluate random.randint(5, 10) modules=random
104 FOR ${INDEX} IN 1 ${dump_count}
105 Create User Initiated BMC Dump Via Redfish
106 END
107
108
manashsarma395f8802022-11-17 03:09:02 -0600109Verify BMC Dump Default Location In BMC
110 [Documentation] Verify that BMC dump is created in its default location of BMC.
George Keishing224e4c72022-12-14 05:07:58 -0600111 [Tags] Verify_BMC_Dump_Default_Location_In_BMC
manashsarma395f8802022-11-17 03:09:02 -0600112
manashsarmae52174b2023-04-03 01:26:56 -0500113 Redfish Power Off stack_mode=skip
manashsarma395f8802022-11-17 03:09:02 -0600114 Redfish Delete All BMC Dumps
115 ${dump_id}= Create User Initiated BMC Dump Via Redfish
116 ${dump_file} ${stderr} ${rc}= BMC Execute Command
117 ... ls ${BMC_DUMP_COLLECTOR_PATH}/${dump_id}
118 Should Be True ${rc} == 0
manashsarmac30e02a2023-02-20 06:46:15 -0600119 Should Contain Any ${dump_file} BMCDUMP obmcdump
manashsarma395f8802022-11-17 03:09:02 -0600120
121
manashsarma4b5d6ac2023-02-08 00:04:03 -0600122Verify User Initiated BMC Dump At Host Booting
123 [Documentation] Create and verify user initiated BMC dump during Host is powwering on
124 ... or when host booting is in progress.
125 [Tags] Verify_User_Initiated_BMC_Dump_At_Host_Booting
126
manashsarma9712ac52023-03-09 04:54:41 -0600127 Redfish Power Off stack_mode=skip
manashsarma4b5d6ac2023-02-08 00:04:03 -0600128 Redfish Delete All BMC Dumps
129
130 # Initiate power on.
131 Redfish Power Operation On
132 Wait Until Keyword Succeeds 2 min 5 sec Is Boot Progress Changed
133
134 # Create user initiated BMC dump and verify only one dump is available.
135 Create User Initiated BMC Dump Via Redfish
136 ${dump_entries}= Get BMC Dump Entries
137 Length Should Be ${dump_entries} 1
138
139
Rahul Maheshwari2568f872020-09-23 01:03:39 -0500140Verify Dump Persistency On Dump Service Restart
141 [Documentation] Create user dump, restart dump manager service and verify dump
142 ... persistency.
143 [Tags] Verify_Dump_Persistency_On_Dump_Service_Restart
144
manashsarmae52174b2023-04-03 01:26:56 -0500145 Redfish Power Off stack_mode=skip
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500146 Create User Initiated BMC Dump Via Redfish
ganesanb4d430282023-04-27 14:33:23 +0000147 ${dump_entries_before}= redfish_utils.get_member_list /redfish/v1/Managers/${MANAGER_ID}/LogServices/Dump/Entries
Rahul Maheshwari2568f872020-09-23 01:03:39 -0500148
149 # Restart dump service.
150 BMC Execute Command systemctl restart xyz.openbmc_project.Dump.Manager.service
151 Sleep 10s reason=Wait for BMC dump service to restart properly
152
ganesanb4d430282023-04-27 14:33:23 +0000153 ${dump_entries_after}= redfish_utils.get_member_list /redfish/v1/Managers/${MANAGER_ID}/LogServices/Dump/Entries
Rahul Maheshwari2568f872020-09-23 01:03:39 -0500154 Lists Should Be Equal ${dump_entries_before} ${dump_entries_after}
155
156
157Verify Dump Persistency On BMC Reset
158 [Documentation] Create user dump, reset BMC and verify dump persistency.
159 [Tags] Verify_Dump_Persistency_On_BMC_Reset
160
manashsarma8fa9c892022-10-03 06:20:58 -0500161 # Power off host so that dump is not offloaded to host OS.
162 Redfish Power Off stack_mode=skip
163
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500164 Create User Initiated BMC Dump Via Redfish
ganesanb4d430282023-04-27 14:33:23 +0000165 ${dump_entries_before}= redfish_utils.get_member_list /redfish/v1/Managers/${MANAGER_ID}/LogServices/Dump/Entries
Rahul Maheshwari2568f872020-09-23 01:03:39 -0500166
167 # Reset BMC.
George Keishing88ec2802021-08-04 03:04:22 -0500168 OBMC Reboot (off) stack_mode=skip
Rahul Maheshwari2568f872020-09-23 01:03:39 -0500169
ganesanb4d430282023-04-27 14:33:23 +0000170 ${dump_entries_after}= redfish_utils.get_member_list /redfish/v1/Managers/${MANAGER_ID}/LogServices/Dump/Entries
Rahul Maheshwari2568f872020-09-23 01:03:39 -0500171 Lists Should Be Equal ${dump_entries_before} ${dump_entries_after}
172
173
Rahul Maheshwari95cbceb2020-10-21 23:25:08 -0500174Delete User Initiated BMC Dump And Verify
175 [Documentation] Delete user initiated BMC dump and verify.
176 [Tags] Delete_User_Initiated_BMC_Dump_And_Verify
177
manashsarmae52174b2023-04-03 01:26:56 -0500178 Redfish Power Off stack_mode=skip
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500179 ${dump_id}= Create User Initiated BMC Dump Via Redfish
manashsarma6cc5bcf2023-08-22 02:22:48 -0500180 Wait Until Keyword Succeeds 15 sec 5 sec Redfish Delete BMC Dump ${dump_id}
Rahul Maheshwari95cbceb2020-10-21 23:25:08 -0500181
182 ${dump_entries}= Get BMC Dump Entries
183 Should Be Empty ${dump_entries}
184
185
186Delete All User Initiated BMC Dumps And Verify
187 [Documentation] Delete all user initiated BMC dumps and verify.
188 [Tags] Delete_All_User_Initiated_BMC_Dumps_And_Verify
189
manashsarma70d840e2022-10-18 02:34:45 -0500190 # Power off host so that dump is not offloaded to host OS.
191 Redfish Power Off stack_mode=skip
192
Rahul Maheshwari95cbceb2020-10-21 23:25:08 -0500193 # Create some BMC dump.
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500194 Create User Initiated BMC Dump Via Redfish
195 Create User Initiated BMC Dump Via Redfish
Rahul Maheshwari95cbceb2020-10-21 23:25:08 -0500196
197 Redfish Delete All BMC Dumps
198 ${dump_entries}= Get BMC Dump Entries
199 Should Be Empty ${dump_entries}
200
201
Rahul Maheshwari4f338ab2020-10-21 23:28:40 -0500202Create Two User Initiated BMC Dumps
203 [Documentation] Create two user initiated BMC dumps.
204 [Tags] Create_Two_User_Initiated_BMC_Dumps
205
manashsarmae52174b2023-04-03 01:26:56 -0500206 Redfish Power Off stack_mode=skip
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500207 ${dump_id1}= Create User Initiated BMC Dump Via Redfish
208 ${dump_id2}= Create User Initiated BMC Dump Via Redfish
Rahul Maheshwari4f338ab2020-10-21 23:28:40 -0500209
210 ${dump_entries}= Get BMC Dump Entries
211 Length Should Be ${dump_entries} 2
212 Should Contain ${dump_entries} ${dump_id1}
213 Should Contain ${dump_entries} ${dump_id2}
214
215
216Create Two User Initiated BMC Dumps And Delete One
217 [Documentation] Create two dumps and delete the first.
218 [Tags] Create_Two_User_Initiated_BMC_Dumps_And_Delete_One
219
manashsarmae52174b2023-04-03 01:26:56 -0500220 Redfish Power Off stack_mode=skip
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500221 ${dump_id1}= Create User Initiated BMC Dump Via Redfish
222 ${dump_id2}= Create User Initiated BMC Dump Via Redfish
Rahul Maheshwari4f338ab2020-10-21 23:28:40 -0500223
manashsarma6cc5bcf2023-08-22 02:22:48 -0500224 Wait Until Keyword Succeeds 15 sec 5 sec Redfish Delete BMC Dump ${dump_id1}
Rahul Maheshwari4f338ab2020-10-21 23:28:40 -0500225
226 ${dump_entries}= Get BMC Dump Entries
227 Length Should Be ${dump_entries} 1
228 List Should Contain Value ${dump_entries} ${dump_id2}
229
230
231Create And Delete User Initiated BMC Dump Multiple Times
232 [Documentation] Create and delete user initiated BMC dump multiple times.
233 [Tags] Create_And_Delete_User_Initiated_BMC_Dump_Multiple_Times
234
manashsarmae52174b2023-04-03 01:26:56 -0500235 Redfish Power Off stack_mode=skip
Rahul Maheshwari4f338ab2020-10-21 23:28:40 -0500236 FOR ${INDEX} IN 1 10
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500237 ${dump_id}= Create User Initiated BMC Dump Via Redfish
manashsarma6cc5bcf2023-08-22 02:22:48 -0500238 Wait Until Keyword Succeeds 15 sec 5 sec Redfish Delete BMC Dump ${dump_id}
Rahul Maheshwari4f338ab2020-10-21 23:28:40 -0500239 END
240
241
Rahul Maheshwarid709c8d2020-11-01 23:03:51 -0600242Verify Maximum BMC Dump Creation
243 [Documentation] Create maximum BMC dump and verify error when dump runs out of space.
244 [Tags] Verify_Maximum_BMC_Dump_Creation
245 [Teardown] Redfish Delete All BMC Dumps
246
247 # Maximum allowed space for dump is 1024 KB. BMC typically hold 8-14 dumps
248 # before running out of this dump space. So trying to create dumps in 20
249 # iterations to run out of space.
manashsarmabd346b32022-07-20 06:22:58 -0500250 # User can key in the Maximum allowed space for bmc dump and how many iteration.
251 FOR ${n} IN RANGE 0 ${MAX_DUMP_COUNT}
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500252 Create User Initiated BMC Dump Via Redfish
Rahul Maheshwarid709c8d2020-11-01 23:03:51 -0600253 ${dump_space}= Get Disk Usage For Dumps
Tim Leede2d1302021-06-18 01:24:11 +0800254 Exit For Loop If ${dump_space} >= (${BMC_DUMP_TOTAL_SIZE} - ${BMC_DUMP_MIN_SPACE_REQD})
Rahul Maheshwarid709c8d2020-11-01 23:03:51 -0600255 END
256
257 # Check error while creating dump when dump size is full.
258 ${payload}= Create Dictionary DiagnosticDataType=Manager
ganesanb4d430282023-04-27 14:33:23 +0000259 Redfish.Post /redfish/v1/Managers/${MANAGER_ID}/LogServices/Dump/Actions/LogService.CollectDiagnosticData
Rahul Maheshwarid709c8d2020-11-01 23:03:51 -0600260 ... body=${payload} valid_status_codes=[${HTTP_INTERNAL_SERVER_ERROR}]
261
262
manashsarma633cac92022-11-25 03:27:03 -0600263Verify BMC Core Dump When Host Powered Off
264 [Documentation] Verify BMC core dump after application crash at host powered off state.
265 [Tags] Verify_BMC_Core_Dump_When_Host_Powered_Off
266
267 Redfish Power Off stack_mode=skip
268
269 # Ensure all dumps are cleaned out.
270 Redfish Delete All BMC Dumps
271 Trigger Core Dump
272
273 # Verify that BMC dump is available.
274 Wait Until Keyword Succeeds 2 min 10 sec Is BMC Dump Available
275
276
manashsarma849189c2022-11-28 04:16:51 -0600277Verify Core Dump Size
278 [Documentation] Verify BMC core dump size is under 20 MB.
279 [Tags] Verify_Core_Dump_Size
280
281 Redfish Power Off stack_mode=skip
282
283 # Ensure all dumps are cleaned out.
284 Redfish Delete All BMC Dumps
285 Trigger Core Dump
286
287 # Verify that BMC dump is available.
288 Wait Until Keyword Succeeds 2 min 10 sec Is BMC Dump Available
289 ${dump_entries}= Get BMC Dump Entries
290 ${resp}= Redfish.Get Properties
ganesanb4d430282023-04-27 14:33:23 +0000291 ... /redfish/v1/Managers/${MANAGER_ID}/LogServices/Dump/Entries/${dump_entries[0]}
manashsarma849189c2022-11-28 04:16:51 -0600292
293 # Max size for dump is 20 MB = 20x1024x1024 Byte.
294 Should Be True 0 < ${resp["AdditionalDataSizeBytes"]} < 20971520
295
296
manashsarmafcbfdf62022-12-07 06:36:28 -0600297Verify Error While Initiating BMC Dump During Dumping State
298 [Documentation] Verify error while initiating BMC dump during dumping state.
299 [Tags] Verify_Error_While_Initiating_BMC_Dump_During_Dumping_State
300
manashsarmae52174b2023-04-03 01:26:56 -0500301 Redfish Power Off stack_mode=skip
Nandish-Mattiaf5bc152023-01-30 00:49:59 -0600302 ${task_id}= Create User Initiated BMC Dump Via Redfish ${1}
manashsarmafcbfdf62022-12-07 06:36:28 -0600303
304 # Check error while initiating BMC dump while dump in progress.
305 ${payload}= Create Dictionary DiagnosticDataType=Manager
306 Redfish.Post
ganesanb4d430282023-04-27 14:33:23 +0000307 ... /redfish/v1/Managers/${MANAGER_ID}/LogServices/Dump/Actions/LogService.CollectDiagnosticData
manashsarmafcbfdf62022-12-07 06:36:28 -0600308 ... body=${payload} valid_status_codes=[${HTTP_SERVICE_UNAVAILABLE}]
309
Nandish-Mattiaf5bc152023-01-30 00:49:59 -0600310 # Wait for above initiated dump to complete. Otherwise, on going dump would impact next test.
311 Wait Until Keyword Succeeds 5 min 15 sec Check Task Completion ${task_id}
312
manashsarmafcbfdf62022-12-07 06:36:28 -0600313
manashsarmaaa845b72022-12-12 05:41:32 -0600314Verify BMC Dump Create Errors While Another BMC Dump In Progress
315 [Documentation] Verify BMC dump creation error until older BMC dump completion.
316 [Tags] Verify_BMC_Dump_Create_Errors_While_Another_BMC_Dump_In_Progress
317
manashsarmae52174b2023-04-03 01:26:56 -0500318 Redfish Power Off stack_mode=skip
319
manashsarmaaa845b72022-12-12 05:41:32 -0600320 # Initiate a BMC dump that returns without completion.
321 ${task_id}= Create User Initiated BMC Dump Via Redfish ${1}
manashsarmacf757da2023-10-12 01:12:23 -0500322 ${task_dict}= Redfish.Get Properties /redfish/v1/TaskService/Tasks/${task_id}
manashsarmaaa845b72022-12-12 05:41:32 -0600323 ${payload}= Create Dictionary DiagnosticDataType=Manager
manashsarmacf757da2023-10-12 01:12:23 -0500324 IF '${task_dict['TaskState']}' != 'Completed'
manashsarma785244c2023-03-15 05:56:18 -0500325 ${resp}= Redfish.Post
ganesanb4d430282023-04-27 14:33:23 +0000326 ... /redfish/v1/Managers/${MANAGER_ID}/LogServices/Dump/Actions/LogService.CollectDiagnosticData
manashsarmacf757da2023-10-12 01:12:23 -0500327 ... body=${payload} valid_status_codes=[${HTTP_SERVICE_UNAVAILABLE}]
manashsarmaaa845b72022-12-12 05:41:32 -0600328 END
329
manashsarmaaa845b72022-12-12 05:41:32 -0600330 # Wait for above initiated dump to complete. Otherwise, on going dump would impact next test.
manashsarmacf757da2023-10-12 01:12:23 -0500331 Wait Until Keyword Succeeds 5 min 15 sec Check Task Completion ${task_id}
manashsarmaaa845b72022-12-12 05:41:32 -0600332
333
manashsarmaadabd3b2023-02-08 04:51:32 -0600334Verify Core Dump After Terminating Dump Manager Service
335 [Documentation] Verify initiate core dumps and kill Phosphor-dump-manager.
336 [Tags] Verify_Core_Dump_After_Terminating_Dump_Manager_Service
337
338 Redfish Power Off stack_mode=skip
339
340 # Remove all available dumps in BMC.
341 Redfish Delete All BMC Dumps
342
343 # Find the pid of the phosphor-dump-manage process and kill it.
344 ${cmd_buf}= Catenate kill -s SEGV $(pgrep phosphor-dump-manager)
345 ${cmd_output} ${stderr} ${rc}= BMC Execute Command ${cmd_buf}
346 Should Be Equal As Integers ${rc} ${0}
347
348 # Verify that BMC dump is available.
349 Wait Until Keyword Succeeds 2 min 10 sec Is BMC Dump Available
350
George Keishing4611b812023-02-16 09:44:33 -0600351 # Verifying that there is only one dump.
manashsarmaadabd3b2023-02-08 04:51:32 -0600352 ${dump_entries}= Get BMC Dump Entries
353 ${length}= Get length ${dump_entries}
354 Should Be Equal As Integers ${length} ${1}
355
356
manashsarma1202ffe2023-09-22 09:01:18 -0500357Verify User Initiated BMC Dump Type
358 [Documentation] Download user initiate BMC dump and validates its type.
359 [Tags] Verify_User_Initiated_BMC_Dump_Type
360
manashsarmada7fd922023-10-05 08:26:13 -0500361 Redfish Power Off stack_mode=skip
manashsarma1202ffe2023-09-22 09:01:18 -0500362 ${dump_id}= Create User Initiated BMC Dump Via Redfish
363
364 # Download BMC dump and verify its size.
Yi Huc32434a2024-01-11 17:33:10 -0800365 ${resp}= Redfish.Get /redfish/v1/Managers/${MANAGER_ID}/LogServices/Dump/Entries/${dump_id}
manashsarma1202ffe2023-09-22 09:01:18 -0500366 ${redfish_dump_creation_timestamp}= Set Variable ${resp.dict["Created"]}
manashsarmada7fd922023-10-05 08:26:13 -0500367 # Download BMC dump and verify its size.
368 ${tarfile}= Download BMC Dump ${dump_id}
manashsarma1202ffe2023-09-22 09:01:18 -0500369
370 # Extract dump and verify type of dump from summary.log content:
371 # Wed Aug 30 17:23:29 UTC 2023 Name: BMCDUMP.XXXXXXX.0001005.20230830172329
372 # Wed Aug 30 17:23:29 UTC 2023 Epochtime: 1693416209
373 # Wed Aug 30 17:23:29 UTC 2023 ID: 0001005
374 # Wed Aug 30 17:23:29 UTC 2023 Type: user
375 ${extracted_dump_folder}= Extract BMC Dump BMC_dump.tar.gz ${redfish_dump_creation_timestamp}
376 ${contents}= OperatingSystem.Get File ${extracted_dump_folder}/summary.log
377 Should Match Regexp ${contents} Type:[ ]*user
378
379 # Clean extracted dump files.
380 Remove Files output output.zst
381 Remove Directory ${extracted_dump_folder} True
382
383
manashsarma7223e6dd2023-09-21 01:10:24 -0500384Verify Retrieve Core Initiated BMC Dump
385 [Documentation] Verify retrieval of core initiated BMC dump.
386 [Tags] Verify_Retrieve_Core_Initiated_BMC_Dump
387
388 Redfish Power Off stack_mode=skip
389
390 # Ensure all dumps are cleaned out.
391 Redfish Delete All BMC Dumps
392 Trigger Core Dump
393
394 # Verify that BMC dump is available.
395 Wait Until Keyword Succeeds 2 min 10 sec Is BMC Dump Available
396
397 ${dump_entries}= Get BMC Dump Entries
398 # Download BMC dump and verify its size.
399 Download BMC Dump ${dump_entries[0]}
400
401
manashsarmafcc14df2023-09-20 11:37:50 -0500402Verify Retrieve User Initiated BMC Dump
403 [Documentation] Verify retrieval of user initiated BMC dump.
404 [Tags] Verify_Retrieve_User_Initiated_BMC_Dump
405
manashsarmada7fd922023-10-05 08:26:13 -0500406 Redfish Power Off stack_mode=skip
manashsarmafcc14df2023-09-20 11:37:50 -0500407 ${dump_id}= Create User Initiated BMC Dump Via Redfish
408
409 # Download BMC dump.
410 Download BMC Dump ${dump_id}
411
412
manashsarmada7fd922023-10-05 08:26:13 -0500413Verify Core Initiated BMC Dump Type
414 [Documentation] Download core initiate BMC dump and validates its type.
415 [Tags] Verify_Core_Initiated_BMC_Dump_Type
416
417 Redfish Power Off stack_mode=skip
418
419 # Ensure all dumps are cleaned out.
420 Redfish Delete All BMC Dumps
421 Trigger Core Dump
422
423 # Verify that BMC dump is available.
424 Wait Until Keyword Succeeds 2 min 10 sec Is BMC Dump Available
425
426 ${dump_entries}= Get BMC Dump Entries
427
428 # Find the timestamp of BMC dump.
Yi Huc32434a2024-01-11 17:33:10 -0800429 ${resp}= Redfish.Get /redfish/v1/Managers/${MANAGER_ID}/LogServices/Dump/Entries/${dump_entries[0]}
manashsarmada7fd922023-10-05 08:26:13 -0500430 ${redfish_dump_creation_timestamp}= Set Variable ${resp.dict["Created"]}
431
432 # Download BMC dump and verify its size.
433 ${tarfile}= Download BMC Dump ${dump_entries[0]}
434
435 # Extract dump and verify type of dump from summary.log content:
436 # Wed Aug 30 17:23:29 UTC 2023 Name: BMCDUMP.XXXXXXX.0001005.20230830172329
437 # Wed Aug 30 17:23:29 UTC 2023 Epochtime: 1693416209
438 # Wed Aug 30 17:23:29 UTC 2023 ID: 0001005
439 # Wed Aug 30 17:23:29 UTC 2023 Type: core
440
441 ${extracted_dump_folder}= Extract BMC Dump ${tarfile} ${redfish_dump_creation_timestamp}
442 ${contents}= OperatingSystem.Get File ${extracted_dump_folder}/summary.log
443 Should Match Regexp ${contents} Type:[ ]*core
444
445 # Clean extracted dump files.
446 Remove Files output output.zst
447 Remove Directory ${extracted_dump_folder} True
448
449
manashsarmaf0f29952023-11-16 23:48:01 -0600450Verify Core Watchdog Initiated BMC Dump
451 [Documentation] Verify core watchdog timeout initiated BMC dump.
452 [Tags] Verify_Core_Watchdog_Initiated_BMC_Dump
453
454 Redfish Delete All BMC Dumps
455 Redfish Power Off stack_mode=skip
456
457 # Trigger watchdog timeout.
458 Redfish Initiate Auto Reboot 2000
459
460 # Wait for BMC dump to get generated after injecting watchdog timeout.
461 Wait Until Keyword Succeeds 4 min 20 sec Is BMC Dump Available
462
463 # Verify that only one BMC dump is available.
464 ${dump_entry_list}= Get BMC Dump Entries
465 ${length}= Get length ${dump_entry_list}
466 Should Be Equal As Integers ${length} ${1}
467
468
Rahul Maheshwari2568f872020-09-23 01:03:39 -0500469*** Keywords ***
470
manashsarmada7fd922023-10-05 08:26:13 -0500471Download BMC Dump
472 [Documentation] Download BMC dump and verify its size.
473 [Arguments] ${dump_id}
474
475 # Description of argument(s):
476 # dump_id An integer value that identifies a particular dump (e.g. 1, 3).
477
Yi Huc32434a2024-01-11 17:33:10 -0800478 ${resp}= Redfish.Get /redfish/v1/Managers/${MANAGER_ID}/LogServices/Dump/Entries/${dump_id}
manashsarmada7fd922023-10-05 08:26:13 -0500479 ${redfish_bmc_dump_size}= Set Variable ${resp.dict["AdditionalDataSizeBytes"]}
480
481 Initialize OpenBMC
482 ${headers}= Create Dictionary Content-Type=application/octet-stream X-Auth-Token=${XAUTH_TOKEN}
483
Yi Huc32434a2024-01-11 17:33:10 -0800484 ${ret}= GET On Session openbmc /redfish/v1/Managers/${MANAGER_ID}/LogServices/Dump/Entries/${dump_id}/attachment headers=${headers}
manashsarmada7fd922023-10-05 08:26:13 -0500485
486 Should Be Equal As Numbers ${ret.status_code} 200
487
488 Create Binary File BMC_dump.tar.gz ${ret.content}
489 ${downloaded_dump_size}= Get File Size BMC_dump.tar.gz
490 Should Be Equal ${downloaded_dump_size} ${redfish_bmc_dump_size}
491 [Return] BMC_dump.tar.gz
492
493
manashsarma1202ffe2023-09-22 09:01:18 -0500494Extract BMC Dump
495 [Documentation] Extract BMC dump from the tar file and returns the name of
496 ... extracted folder like BMCDUMP.XXXXXXX.0000070.20230706063841.
497 [Arguments] ${filename} ${bmc_dump_timestamp}
498
499 # Description of argument(s):
500 # filename name of BMC dump tar file.
501 # bmc_dump_timestamp timestamp of generated BMC dump.
502
manashsarmafcc14df2023-09-20 11:37:50 -0500503 OperatingSystem.File Should Exist ${filename}
manashsarma1202ffe2023-09-22 09:01:18 -0500504 ${rc}= Run And Return RC dd if=${filename} of=output.zst bs=1 skip=628
505 Should Be True 0 == ${rc}
506
507 ${rc}= Run And Return RC zstd -d output.zst
508 Should Be True 0 == ${rc}
509
510 ${rc}= Run And Return RC tar -xvf output
511 Should Be True 0 == ${rc}
512
513 # Find the extracted dump folder identified with BMCDUMP as prefix and
514 # timestamp of dump generation where timestamp format is : 2023-09-27T08:30:17.000000+00:00.
515 ${var}= Fetch From Left ${bmc_dump_timestamp} .
516 ${var}= Remove String ${var} - T :
517 ${bmc_extraction_folders}= OperatingSystem.List Directories In Directory . BMCDUMP*${var}
518 ${cnt}= Get length ${bmc_extraction_folders}
519 should be equal as numbers ${cnt} 1
520
521 [Return] ${bmc_extraction_folders}[0]
522
523
Rahul Maheshwaribcefdf22020-10-16 07:51:34 -0500524Get BMC Dump Entries
525 [Documentation] Return BMC dump ids list.
526
ganesanb4d430282023-04-27 14:33:23 +0000527 ${dump_uris}= redfish_utils.get_member_list /redfish/v1/Managers/${MANAGER_ID}/LogServices/Dump/Entries
Rahul Maheshwaribcefdf22020-10-16 07:51:34 -0500528 ${dump_ids}= Create List
529
530 FOR ${dump_uri} IN @{dump_uris}
531 ${dump_id}= Fetch From Right ${dump_uri} /
532 Append To List ${dump_ids} ${dump_id}
533 END
534
535 [Return] ${dump_ids}
536
537
manashsarma633cac92022-11-25 03:27:03 -0600538Is BMC Dump Available
539 [Documentation] Verify if BMC dump is available.
540
541 ${dump_entries}= Get BMC Dump Entries
542
543 # Verifying that BMC dump is available.
544 ${length}= Get length ${dump_entries}
545 Should Be True 0 < ${length}
546
547
Rahul Maheshwarid709c8d2020-11-01 23:03:51 -0600548Get Disk Usage For Dumps
549 [Documentation] Return disk usage in kilobyte for BMC dumps.
550
George Keishing952bb0f2022-12-12 03:13:35 -0600551 ${usage_output} ${stderr} ${rc}= BMC Execute Command du -s ${BMC_DUMP_COLLECTOR_PATH}
Rahul Maheshwarid709c8d2020-11-01 23:03:51 -0600552
553 # Example of output from above BMC cli command.
554 # $ du -s /var/lib/phosphor-debug-collector/dumps
555 # 516 /var/lib/phosphor-debug-collector/dumps
556
557 ${usage_output}= Fetch From Left ${usage_output} /
558 ${usage_output}= Convert To Integer ${usage_output}
559
560 [return] ${usage_output}
561
562
Rahul Maheshwari2568f872020-09-23 01:03:39 -0500563Test Teardown Execution
564 [Documentation] Do test teardown operation.
565
566 FFDC On Test Case Fail
567 Close All Connections