blob: fbff11774325a1e6d4fc7d5b7c7a4b1bdf5cfd42 [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
Tim Leede2d1302021-06-18 01:24:11 +080015*** Variables ***
16
17# Total size of the dump in kilo bytes
18${BMC_DUMP_TOTAL_SIZE} ${1024}
19
20# Minimum space required for one bmc dump in kilo bytes
21${BMC_DUMP_MIN_SPACE_REQD} ${20}
manashsarmabd346b32022-07-20 06:22:58 -050022${MAX_DUMP_COUNT} ${20}
manashsarma395f8802022-11-17 03:09:02 -060023${BMC_DUMP_COLLECTOR_PATH} /var/lib/phosphor-debug-collector/dumps
Rahul Maheshwari2568f872020-09-23 01:03:39 -050024
25*** Test Cases ***
26
manashsarma4b5b1fa2022-11-16 02:36:58 -060027Verify Error Response For Already Deleted Dump Id
28 [Documentation] Delete non existing BMC dump and expect an error.
29 [Tags] Verify_Error_Response_For_Already_Deleted_Dump_Id
30
manashsarma9dcabad2023-02-02 03:55:17 -060031 Redfish Power Off stack_mode=skip
manashsarma4b5b1fa2022-11-16 02:36:58 -060032 ${dump_id}= Create User Initiated BMC Dump Via Redfish
manashsarma6cc5bcf2023-08-22 02:22:48 -050033 Wait Until Keyword Succeeds 15 sec 5 sec Redfish Delete BMC Dump ${dump_id}
manashsarma4b5b1fa2022-11-16 02:36:58 -060034 Run Keyword And Expect Error ValueError: * Redfish Delete BMC Dump ${dump_id}
35
36
Rahul Maheshwari2568f872020-09-23 01:03:39 -050037Verify User Initiated BMC Dump When Host Powered Off
38 [Documentation] Create user initiated BMC dump at host off state and
39 ... verify dump entry for it.
40 [Tags] Verify_User_Initiated_BMC_Dump_When_Host_Powered_Off
41
42 Redfish Power Off stack_mode=skip
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -050043 ${dump_id}= Create User Initiated BMC Dump Via Redfish
Rahul Maheshwaribcefdf22020-10-16 07:51:34 -050044 ${dump_entries}= Get BMC Dump Entries
Rahul Maheshwari2568f872020-09-23 01:03:39 -050045 Length Should Be ${dump_entries} 1
46 List Should Contain Value ${dump_entries} ${dump_id}
47
Rahul Maheshwari2568f872020-09-23 01:03:39 -050048
Rahul Maheshwarie8e9d0c2020-10-30 02:39:01 -050049Verify User Initiated BMC Dump Size
manashsarma7831dc22022-03-08 01:49:36 -060050 [Documentation] Verify user initiated BMC dump size is under 20 MB.
Rahul Maheshwarie8e9d0c2020-10-30 02:39:01 -050051 [Tags] Verify_User_Initiated_BMC_Dump_Size
52
manashsarmae52174b2023-04-03 01:26:56 -050053 Redfish Power Off stack_mode=skip
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -050054 ${dump_id}= Create User Initiated BMC Dump Via Redfish
ganesanb4d430282023-04-27 14:33:23 +000055 ${resp}= Redfish.Get Properties /redfish/v1/Managers/${MANAGER_ID}/LogServices/Dump/Entries/${dump_id}
Rahul Maheshwarie8e9d0c2020-10-30 02:39:01 -050056
57 # Example of response from above Redfish GET request.
58 # "@odata.type": "#LogEntry.v1_7_0.LogEntry",
59 # "AdditionalDataSizeBytes": 31644,
ganesanb4d430282023-04-27 14:33:23 +000060 # "AdditionalDataURI": "/redfish/v1/Managers/${MANAGER_ID}/LogServices/Dump/attachment/9",
Rahul Maheshwarie8e9d0c2020-10-30 02:39:01 -050061 # "Created": "2020-10-23T06:32:53+00:00",
62 # "DiagnosticDataType": "Manager",
63 # "EntryType": "Event",
64 # "Id": "9",
65 # "Name": "BMC Dump Entry"
66
manashsarma7831dc22022-03-08 01:49:36 -060067 # Max size for dump is 20 MB = 20x1024x1024 Byte.
68 Should Be True 0 < ${resp["AdditionalDataSizeBytes"]} < 20971520
Rahul Maheshwarie8e9d0c2020-10-30 02:39:01 -050069
70
manashsarma7e1f2c52023-02-03 03:18:40 -060071Verify Internal Failure Initiated BMC Dump Size
72 [Documentation] Verify that the internal failure initiated BMC dump size is under 20 MB.
73 [Tags] Verify_Internal_Failure_Initiated_BMC_Dump_Size
74
75 Redfish Delete All BMC Dumps
76
77 # Create an internal failure error log.
78 BMC Execute Command ${CMD_INTERNAL_FAILURE}
79
80 # Wait for BMC dump to get generated after injecting internal failure.
81 Wait Until Keyword Succeeds 2 min 10 sec Is BMC Dump Available
82
83 # Verify that only one BMC dump is generated after injecting error.
84 ${dump_entries}= Get BMC Dump Entries
85 ${length}= Get length ${dump_entries}
86 Should Be Equal As Integers ${length} ${1}
87
88 # Max size for dump is 20 MB = 20x1024x1024 Byte.
89 ${resp}= Redfish.Get Properties
ganesanb4d430282023-04-27 14:33:23 +000090 ... /redfish/v1/Managers/${MANAGER_ID}/LogServices/Dump/Entries/${dump_entries[0]}
manashsarma7e1f2c52023-02-03 03:18:40 -060091 Should Be True 0 < ${resp["AdditionalDataSizeBytes"]} < 20971520
92
93
manashsarmabbc68bc2022-12-05 09:55:17 -060094Verify Multiple BMC Dump Creation
95 [Documentation] Verify that multiple BMC dumps can be created one after
96 ... another successfully.
97 [Tags] Verify_Multiple_BMC_Dump_Creation
98
manashsarmae52174b2023-04-03 01:26:56 -050099 Redfish Power Off stack_mode=skip
manashsarmabbc68bc2022-12-05 09:55:17 -0600100 ${dump_count}= Evaluate random.randint(5, 10) modules=random
101 FOR ${INDEX} IN 1 ${dump_count}
102 Create User Initiated BMC Dump Via Redfish
103 END
104
105
manashsarma395f8802022-11-17 03:09:02 -0600106Verify BMC Dump Default Location In BMC
107 [Documentation] Verify that BMC dump is created in its default location of BMC.
George Keishing224e4c72022-12-14 05:07:58 -0600108 [Tags] Verify_BMC_Dump_Default_Location_In_BMC
manashsarma395f8802022-11-17 03:09:02 -0600109
manashsarmae52174b2023-04-03 01:26:56 -0500110 Redfish Power Off stack_mode=skip
manashsarma395f8802022-11-17 03:09:02 -0600111 Redfish Delete All BMC Dumps
112 ${dump_id}= Create User Initiated BMC Dump Via Redfish
113 ${dump_file} ${stderr} ${rc}= BMC Execute Command
114 ... ls ${BMC_DUMP_COLLECTOR_PATH}/${dump_id}
115 Should Be True ${rc} == 0
manashsarmac30e02a2023-02-20 06:46:15 -0600116 Should Contain Any ${dump_file} BMCDUMP obmcdump
manashsarma395f8802022-11-17 03:09:02 -0600117
118
George Keishing3d850982022-07-19 11:03:03 -0500119Verify User Initiated BMC Dump When Host Booted
120 [Documentation] Create user initiated BMC dump at host booted state and
121 ... verify dump entry for it.
122 [Tags] Verify_User_Initiated_BMC_Dump_When_Host_Booted
123
124 Redfish Power On stack_mode=skip
125 ${dump_id}= Create User Initiated BMC Dump Via Redfish
126 ${dump_entries}= Get BMC Dump Entries
127 Length Should Be ${dump_entries} 1
128 List Should Contain Value ${dump_entries} ${dump_id}
129
130
manashsarma4b5d6ac2023-02-08 00:04:03 -0600131Verify User Initiated BMC Dump At Host Booting
132 [Documentation] Create and verify user initiated BMC dump during Host is powwering on
133 ... or when host booting is in progress.
134 [Tags] Verify_User_Initiated_BMC_Dump_At_Host_Booting
135
manashsarma9712ac52023-03-09 04:54:41 -0600136 Redfish Power Off stack_mode=skip
manashsarma4b5d6ac2023-02-08 00:04:03 -0600137 Redfish Delete All BMC Dumps
138
139 # Initiate power on.
140 Redfish Power Operation On
141 Wait Until Keyword Succeeds 2 min 5 sec Is Boot Progress Changed
142
143 # Create user initiated BMC dump and verify only one dump is available.
144 Create User Initiated BMC Dump Via Redfish
145 ${dump_entries}= Get BMC Dump Entries
146 Length Should Be ${dump_entries} 1
147
148
Rahul Maheshwari2568f872020-09-23 01:03:39 -0500149Verify Dump Persistency On Dump Service Restart
150 [Documentation] Create user dump, restart dump manager service and verify dump
151 ... persistency.
152 [Tags] Verify_Dump_Persistency_On_Dump_Service_Restart
153
manashsarmae52174b2023-04-03 01:26:56 -0500154 Redfish Power Off stack_mode=skip
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500155 Create User Initiated BMC Dump Via Redfish
ganesanb4d430282023-04-27 14:33:23 +0000156 ${dump_entries_before}= redfish_utils.get_member_list /redfish/v1/Managers/${MANAGER_ID}/LogServices/Dump/Entries
Rahul Maheshwari2568f872020-09-23 01:03:39 -0500157
158 # Restart dump service.
159 BMC Execute Command systemctl restart xyz.openbmc_project.Dump.Manager.service
160 Sleep 10s reason=Wait for BMC dump service to restart properly
161
ganesanb4d430282023-04-27 14:33:23 +0000162 ${dump_entries_after}= redfish_utils.get_member_list /redfish/v1/Managers/${MANAGER_ID}/LogServices/Dump/Entries
Rahul Maheshwari2568f872020-09-23 01:03:39 -0500163 Lists Should Be Equal ${dump_entries_before} ${dump_entries_after}
164
165
166Verify Dump Persistency On BMC Reset
167 [Documentation] Create user dump, reset BMC and verify dump persistency.
168 [Tags] Verify_Dump_Persistency_On_BMC_Reset
169
manashsarma8fa9c892022-10-03 06:20:58 -0500170 # Power off host so that dump is not offloaded to host OS.
171 Redfish Power Off stack_mode=skip
172
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500173 Create User Initiated BMC Dump Via Redfish
ganesanb4d430282023-04-27 14:33:23 +0000174 ${dump_entries_before}= redfish_utils.get_member_list /redfish/v1/Managers/${MANAGER_ID}/LogServices/Dump/Entries
Rahul Maheshwari2568f872020-09-23 01:03:39 -0500175
176 # Reset BMC.
George Keishing88ec2802021-08-04 03:04:22 -0500177 OBMC Reboot (off) stack_mode=skip
Rahul Maheshwari2568f872020-09-23 01:03:39 -0500178
ganesanb4d430282023-04-27 14:33:23 +0000179 ${dump_entries_after}= redfish_utils.get_member_list /redfish/v1/Managers/${MANAGER_ID}/LogServices/Dump/Entries
Rahul Maheshwari2568f872020-09-23 01:03:39 -0500180 Lists Should Be Equal ${dump_entries_before} ${dump_entries_after}
181
182
Rahul Maheshwari95cbceb2020-10-21 23:25:08 -0500183Delete User Initiated BMC Dump And Verify
184 [Documentation] Delete user initiated BMC dump and verify.
185 [Tags] Delete_User_Initiated_BMC_Dump_And_Verify
186
manashsarmae52174b2023-04-03 01:26:56 -0500187 Redfish Power Off stack_mode=skip
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500188 ${dump_id}= Create User Initiated BMC Dump Via Redfish
manashsarma6cc5bcf2023-08-22 02:22:48 -0500189 Wait Until Keyword Succeeds 15 sec 5 sec Redfish Delete BMC Dump ${dump_id}
Rahul Maheshwari95cbceb2020-10-21 23:25:08 -0500190
191 ${dump_entries}= Get BMC Dump Entries
192 Should Be Empty ${dump_entries}
193
194
195Delete All User Initiated BMC Dumps And Verify
196 [Documentation] Delete all user initiated BMC dumps and verify.
197 [Tags] Delete_All_User_Initiated_BMC_Dumps_And_Verify
198
manashsarma70d840e2022-10-18 02:34:45 -0500199 # Power off host so that dump is not offloaded to host OS.
200 Redfish Power Off stack_mode=skip
201
Rahul Maheshwari95cbceb2020-10-21 23:25:08 -0500202 # Create some BMC dump.
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500203 Create User Initiated BMC Dump Via Redfish
204 Create User Initiated BMC Dump Via Redfish
Rahul Maheshwari95cbceb2020-10-21 23:25:08 -0500205
206 Redfish Delete All BMC Dumps
207 ${dump_entries}= Get BMC Dump Entries
208 Should Be Empty ${dump_entries}
209
210
Rahul Maheshwari4f338ab2020-10-21 23:28:40 -0500211Create Two User Initiated BMC Dumps
212 [Documentation] Create two user initiated BMC dumps.
213 [Tags] Create_Two_User_Initiated_BMC_Dumps
214
manashsarmae52174b2023-04-03 01:26:56 -0500215 Redfish Power Off stack_mode=skip
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500216 ${dump_id1}= Create User Initiated BMC Dump Via Redfish
217 ${dump_id2}= Create User Initiated BMC Dump Via Redfish
Rahul Maheshwari4f338ab2020-10-21 23:28:40 -0500218
219 ${dump_entries}= Get BMC Dump Entries
220 Length Should Be ${dump_entries} 2
221 Should Contain ${dump_entries} ${dump_id1}
222 Should Contain ${dump_entries} ${dump_id2}
223
224
225Create Two User Initiated BMC Dumps And Delete One
226 [Documentation] Create two dumps and delete the first.
227 [Tags] Create_Two_User_Initiated_BMC_Dumps_And_Delete_One
228
manashsarmae52174b2023-04-03 01:26:56 -0500229 Redfish Power Off stack_mode=skip
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500230 ${dump_id1}= Create User Initiated BMC Dump Via Redfish
231 ${dump_id2}= Create User Initiated BMC Dump Via Redfish
Rahul Maheshwari4f338ab2020-10-21 23:28:40 -0500232
manashsarma6cc5bcf2023-08-22 02:22:48 -0500233 Wait Until Keyword Succeeds 15 sec 5 sec Redfish Delete BMC Dump ${dump_id1}
Rahul Maheshwari4f338ab2020-10-21 23:28:40 -0500234
235 ${dump_entries}= Get BMC Dump Entries
236 Length Should Be ${dump_entries} 1
237 List Should Contain Value ${dump_entries} ${dump_id2}
238
239
240Create And Delete User Initiated BMC Dump Multiple Times
241 [Documentation] Create and delete user initiated BMC dump multiple times.
242 [Tags] Create_And_Delete_User_Initiated_BMC_Dump_Multiple_Times
243
manashsarmae52174b2023-04-03 01:26:56 -0500244 Redfish Power Off stack_mode=skip
Rahul Maheshwari4f338ab2020-10-21 23:28:40 -0500245 FOR ${INDEX} IN 1 10
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500246 ${dump_id}= Create User Initiated BMC Dump Via Redfish
manashsarma6cc5bcf2023-08-22 02:22:48 -0500247 Wait Until Keyword Succeeds 15 sec 5 sec Redfish Delete BMC Dump ${dump_id}
Rahul Maheshwari4f338ab2020-10-21 23:28:40 -0500248 END
249
250
Rahul Maheshwarid709c8d2020-11-01 23:03:51 -0600251Verify Maximum BMC Dump Creation
252 [Documentation] Create maximum BMC dump and verify error when dump runs out of space.
253 [Tags] Verify_Maximum_BMC_Dump_Creation
254 [Teardown] Redfish Delete All BMC Dumps
255
256 # Maximum allowed space for dump is 1024 KB. BMC typically hold 8-14 dumps
257 # before running out of this dump space. So trying to create dumps in 20
258 # iterations to run out of space.
manashsarmabd346b32022-07-20 06:22:58 -0500259 # User can key in the Maximum allowed space for bmc dump and how many iteration.
260 FOR ${n} IN RANGE 0 ${MAX_DUMP_COUNT}
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500261 Create User Initiated BMC Dump Via Redfish
Rahul Maheshwarid709c8d2020-11-01 23:03:51 -0600262 ${dump_space}= Get Disk Usage For Dumps
Tim Leede2d1302021-06-18 01:24:11 +0800263 Exit For Loop If ${dump_space} >= (${BMC_DUMP_TOTAL_SIZE} - ${BMC_DUMP_MIN_SPACE_REQD})
Rahul Maheshwarid709c8d2020-11-01 23:03:51 -0600264 END
265
266 # Check error while creating dump when dump size is full.
267 ${payload}= Create Dictionary DiagnosticDataType=Manager
ganesanb4d430282023-04-27 14:33:23 +0000268 Redfish.Post /redfish/v1/Managers/${MANAGER_ID}/LogServices/Dump/Actions/LogService.CollectDiagnosticData
Rahul Maheshwarid709c8d2020-11-01 23:03:51 -0600269 ... body=${payload} valid_status_codes=[${HTTP_INTERNAL_SERVER_ERROR}]
270
271
manashsarma633cac92022-11-25 03:27:03 -0600272Verify BMC Core Dump When Host Powered Off
273 [Documentation] Verify BMC core dump after application crash at host powered off state.
274 [Tags] Verify_BMC_Core_Dump_When_Host_Powered_Off
275
276 Redfish Power Off stack_mode=skip
277
278 # Ensure all dumps are cleaned out.
279 Redfish Delete All BMC Dumps
280 Trigger Core Dump
281
282 # Verify that BMC dump is available.
283 Wait Until Keyword Succeeds 2 min 10 sec Is BMC Dump Available
284
285
manashsarma849189c2022-11-28 04:16:51 -0600286Verify Core Dump Size
287 [Documentation] Verify BMC core dump size is under 20 MB.
288 [Tags] Verify_Core_Dump_Size
289
290 Redfish Power Off stack_mode=skip
291
292 # Ensure all dumps are cleaned out.
293 Redfish Delete All BMC Dumps
294 Trigger Core Dump
295
296 # Verify that BMC dump is available.
297 Wait Until Keyword Succeeds 2 min 10 sec Is BMC Dump Available
298 ${dump_entries}= Get BMC Dump Entries
299 ${resp}= Redfish.Get Properties
ganesanb4d430282023-04-27 14:33:23 +0000300 ... /redfish/v1/Managers/${MANAGER_ID}/LogServices/Dump/Entries/${dump_entries[0]}
manashsarma849189c2022-11-28 04:16:51 -0600301
302 # Max size for dump is 20 MB = 20x1024x1024 Byte.
303 Should Be True 0 < ${resp["AdditionalDataSizeBytes"]} < 20971520
304
305
manashsarmafcbfdf62022-12-07 06:36:28 -0600306Verify Error While Initiating BMC Dump During Dumping State
307 [Documentation] Verify error while initiating BMC dump during dumping state.
308 [Tags] Verify_Error_While_Initiating_BMC_Dump_During_Dumping_State
309
manashsarmae52174b2023-04-03 01:26:56 -0500310 Redfish Power Off stack_mode=skip
Nandish-Mattiaf5bc152023-01-30 00:49:59 -0600311 ${task_id}= Create User Initiated BMC Dump Via Redfish ${1}
manashsarmafcbfdf62022-12-07 06:36:28 -0600312
313 # Check error while initiating BMC dump while dump in progress.
314 ${payload}= Create Dictionary DiagnosticDataType=Manager
315 Redfish.Post
ganesanb4d430282023-04-27 14:33:23 +0000316 ... /redfish/v1/Managers/${MANAGER_ID}/LogServices/Dump/Actions/LogService.CollectDiagnosticData
manashsarmafcbfdf62022-12-07 06:36:28 -0600317 ... body=${payload} valid_status_codes=[${HTTP_SERVICE_UNAVAILABLE}]
318
Nandish-Mattiaf5bc152023-01-30 00:49:59 -0600319 # Wait for above initiated dump to complete. Otherwise, on going dump would impact next test.
320 Wait Until Keyword Succeeds 5 min 15 sec Check Task Completion ${task_id}
321
manashsarmafcbfdf62022-12-07 06:36:28 -0600322
manashsarmaaa845b72022-12-12 05:41:32 -0600323Verify BMC Dump Create Errors While Another BMC Dump In Progress
324 [Documentation] Verify BMC dump creation error until older BMC dump completion.
325 [Tags] Verify_BMC_Dump_Create_Errors_While_Another_BMC_Dump_In_Progress
326
manashsarmae52174b2023-04-03 01:26:56 -0500327 Redfish Power Off stack_mode=skip
328
manashsarmaaa845b72022-12-12 05:41:32 -0600329 # Initiate a BMC dump that returns without completion.
330 ${task_id}= Create User Initiated BMC Dump Via Redfish ${1}
manashsarmacf757da2023-10-12 01:12:23 -0500331 ${task_dict}= Redfish.Get Properties /redfish/v1/TaskService/Tasks/${task_id}
manashsarmaaa845b72022-12-12 05:41:32 -0600332 ${payload}= Create Dictionary DiagnosticDataType=Manager
manashsarmacf757da2023-10-12 01:12:23 -0500333 IF '${task_dict['TaskState']}' != 'Completed'
manashsarma785244c2023-03-15 05:56:18 -0500334 ${resp}= Redfish.Post
ganesanb4d430282023-04-27 14:33:23 +0000335 ... /redfish/v1/Managers/${MANAGER_ID}/LogServices/Dump/Actions/LogService.CollectDiagnosticData
manashsarmacf757da2023-10-12 01:12:23 -0500336 ... body=${payload} valid_status_codes=[${HTTP_SERVICE_UNAVAILABLE}]
manashsarmaaa845b72022-12-12 05:41:32 -0600337 END
338
manashsarmaaa845b72022-12-12 05:41:32 -0600339 # Wait for above initiated dump to complete. Otherwise, on going dump would impact next test.
manashsarmacf757da2023-10-12 01:12:23 -0500340 Wait Until Keyword Succeeds 5 min 15 sec Check Task Completion ${task_id}
manashsarmaaa845b72022-12-12 05:41:32 -0600341
342
manashsarmaadabd3b2023-02-08 04:51:32 -0600343Verify Core Dump After Terminating Dump Manager Service
344 [Documentation] Verify initiate core dumps and kill Phosphor-dump-manager.
345 [Tags] Verify_Core_Dump_After_Terminating_Dump_Manager_Service
346
347 Redfish Power Off stack_mode=skip
348
349 # Remove all available dumps in BMC.
350 Redfish Delete All BMC Dumps
351
352 # Find the pid of the phosphor-dump-manage process and kill it.
353 ${cmd_buf}= Catenate kill -s SEGV $(pgrep phosphor-dump-manager)
354 ${cmd_output} ${stderr} ${rc}= BMC Execute Command ${cmd_buf}
355 Should Be Equal As Integers ${rc} ${0}
356
357 # Verify that BMC dump is available.
358 Wait Until Keyword Succeeds 2 min 10 sec Is BMC Dump Available
359
George Keishing4611b812023-02-16 09:44:33 -0600360 # Verifying that there is only one dump.
manashsarmaadabd3b2023-02-08 04:51:32 -0600361 ${dump_entries}= Get BMC Dump Entries
362 ${length}= Get length ${dump_entries}
363 Should Be Equal As Integers ${length} ${1}
364
365
manashsarma7bf47d22023-02-08 01:10:18 -0600366Verify Error Log And Dump For Internal Failure
367 [Documentation] Verify error log and dump for internal failure.
368 [Tags] Verify_Error_Log_And_Dump_For_Internal_Failure
369
370 Redfish Purge Event Log
371 Redfish Delete All BMC Dumps
372
373 # Create an internal failure error log.
374 BMC Execute Command ${CMD_INTERNAL_FAILURE}
375
376 # With internal failure, an error log file is generated. Check if
377 # BMC has only one error log for this internal failure.
378 ${resp}= Redfish.Get /redfish/v1/Systems/system/LogServices/CELog/Entries
379 Should Be True ${resp.dict["Members@odata.count"]} == ${1}
380
381 # Wait for the BMC dump to become available and verify its presence.
382 Wait Until Keyword Succeeds 2 min 10 sec Is BMC Dump Available
383 ${dump_entries}= Get BMC Dump Entries
384 ${length}= Get length ${dump_entries}
385 Should Be Equal As Integers ${length} ${1}
386
387
manashsarma35247412023-02-06 02:14:04 -0600388Verify Core Watchdog Initiated BMC Dump
389 [Documentation] Verify core watchdog timeout initiated BMC dump.
390 [Tags] Verify_Core_Watchdog_Initiated_BMC_Dump
391
392 Redfish Delete All BMC Dumps
393 Redfish Power Off stack_mode=skip
394
395 # Trigger watchdog timeout.
396 Redfish Initiate Auto Reboot 2000
397
398 # Wait for BMC dump to get generated after injecting watchdog timeout.
399 Wait Until Keyword Succeeds 4 min 20 sec Is BMC Dump Available
400
401 # Verify that only one BMC dump is available.
402 ${dump_entry_list}= Get BMC Dump Entries
403 ${length}= Get length ${dump_entry_list}
404 Should Be Equal As Integers ${length} ${1}
405
406
manashsarma1202ffe2023-09-22 09:01:18 -0500407Verify User Initiated BMC Dump Type
408 [Documentation] Download user initiate BMC dump and validates its type.
409 [Tags] Verify_User_Initiated_BMC_Dump_Type
410
manashsarmada7fd922023-10-05 08:26:13 -0500411 Redfish Power Off stack_mode=skip
manashsarma1202ffe2023-09-22 09:01:18 -0500412 ${dump_id}= Create User Initiated BMC Dump Via Redfish
413
414 # Download BMC dump and verify its size.
415 ${resp}= Redfish.Get /redfish/v1/Managers/bmc/LogServices/Dump/Entries/${dump_id}
manashsarma1202ffe2023-09-22 09:01:18 -0500416 ${redfish_dump_creation_timestamp}= Set Variable ${resp.dict["Created"]}
manashsarmada7fd922023-10-05 08:26:13 -0500417 # Download BMC dump and verify its size.
418 ${tarfile}= Download BMC Dump ${dump_id}
manashsarma1202ffe2023-09-22 09:01:18 -0500419
420 # Extract dump and verify type of dump from summary.log content:
421 # Wed Aug 30 17:23:29 UTC 2023 Name: BMCDUMP.XXXXXXX.0001005.20230830172329
422 # Wed Aug 30 17:23:29 UTC 2023 Epochtime: 1693416209
423 # Wed Aug 30 17:23:29 UTC 2023 ID: 0001005
424 # Wed Aug 30 17:23:29 UTC 2023 Type: user
425 ${extracted_dump_folder}= Extract BMC Dump BMC_dump.tar.gz ${redfish_dump_creation_timestamp}
426 ${contents}= OperatingSystem.Get File ${extracted_dump_folder}/summary.log
427 Should Match Regexp ${contents} Type:[ ]*user
428
429 # Clean extracted dump files.
430 Remove Files output output.zst
431 Remove Directory ${extracted_dump_folder} True
432
433
manashsarma7223e6dd2023-09-21 01:10:24 -0500434Verify Retrieve Core Initiated BMC Dump
435 [Documentation] Verify retrieval of core initiated BMC dump.
436 [Tags] Verify_Retrieve_Core_Initiated_BMC_Dump
437
438 Redfish Power Off stack_mode=skip
439
440 # Ensure all dumps are cleaned out.
441 Redfish Delete All BMC Dumps
442 Trigger Core Dump
443
444 # Verify that BMC dump is available.
445 Wait Until Keyword Succeeds 2 min 10 sec Is BMC Dump Available
446
447 ${dump_entries}= Get BMC Dump Entries
448 # Download BMC dump and verify its size.
449 Download BMC Dump ${dump_entries[0]}
450
451
manashsarmafcc14df2023-09-20 11:37:50 -0500452Verify Retrieve User Initiated BMC Dump
453 [Documentation] Verify retrieval of user initiated BMC dump.
454 [Tags] Verify_Retrieve_User_Initiated_BMC_Dump
455
manashsarmada7fd922023-10-05 08:26:13 -0500456 Redfish Power Off stack_mode=skip
manashsarmafcc14df2023-09-20 11:37:50 -0500457 ${dump_id}= Create User Initiated BMC Dump Via Redfish
458
459 # Download BMC dump.
460 Download BMC Dump ${dump_id}
461
462
manashsarmada7fd922023-10-05 08:26:13 -0500463Verify Core Initiated BMC Dump Type
464 [Documentation] Download core initiate BMC dump and validates its type.
465 [Tags] Verify_Core_Initiated_BMC_Dump_Type
466
467 Redfish Power Off stack_mode=skip
468
469 # Ensure all dumps are cleaned out.
470 Redfish Delete All BMC Dumps
471 Trigger Core Dump
472
473 # Verify that BMC dump is available.
474 Wait Until Keyword Succeeds 2 min 10 sec Is BMC Dump Available
475
476 ${dump_entries}= Get BMC Dump Entries
477
478 # Find the timestamp of BMC dump.
479 ${resp}= Redfish.Get /redfish/v1/Managers/bmc/LogServices/Dump/Entries/${dump_entries[0]}
480 ${redfish_dump_creation_timestamp}= Set Variable ${resp.dict["Created"]}
481
482 # Download BMC dump and verify its size.
483 ${tarfile}= Download BMC Dump ${dump_entries[0]}
484
485 # Extract dump and verify type of dump from summary.log content:
486 # Wed Aug 30 17:23:29 UTC 2023 Name: BMCDUMP.XXXXXXX.0001005.20230830172329
487 # Wed Aug 30 17:23:29 UTC 2023 Epochtime: 1693416209
488 # Wed Aug 30 17:23:29 UTC 2023 ID: 0001005
489 # Wed Aug 30 17:23:29 UTC 2023 Type: core
490
491 ${extracted_dump_folder}= Extract BMC Dump ${tarfile} ${redfish_dump_creation_timestamp}
492 ${contents}= OperatingSystem.Get File ${extracted_dump_folder}/summary.log
493 Should Match Regexp ${contents} Type:[ ]*core
494
495 # Clean extracted dump files.
496 Remove Files output output.zst
497 Remove Directory ${extracted_dump_folder} True
498
499
Rahul Maheshwari2568f872020-09-23 01:03:39 -0500500*** Keywords ***
501
manashsarmada7fd922023-10-05 08:26:13 -0500502Download BMC Dump
503 [Documentation] Download BMC dump and verify its size.
504 [Arguments] ${dump_id}
505
506 # Description of argument(s):
507 # dump_id An integer value that identifies a particular dump (e.g. 1, 3).
508
509 ${resp}= Redfish.Get /redfish/v1/Managers/bmc/LogServices/Dump/Entries/${dump_id}
510 ${redfish_bmc_dump_size}= Set Variable ${resp.dict["AdditionalDataSizeBytes"]}
511
512 Initialize OpenBMC
513 ${headers}= Create Dictionary Content-Type=application/octet-stream X-Auth-Token=${XAUTH_TOKEN}
514
515 ${ret}= Get Request openbmc /redfish/v1/Managers/bmc/LogServices/Dump/Entries/${dump_id}/attachment headers=${headers}
516
517 Should Be Equal As Numbers ${ret.status_code} 200
518
519 Create Binary File BMC_dump.tar.gz ${ret.content}
520 ${downloaded_dump_size}= Get File Size BMC_dump.tar.gz
521 Should Be Equal ${downloaded_dump_size} ${redfish_bmc_dump_size}
522 [Return] BMC_dump.tar.gz
523
524
manashsarma1202ffe2023-09-22 09:01:18 -0500525Extract BMC Dump
526 [Documentation] Extract BMC dump from the tar file and returns the name of
527 ... extracted folder like BMCDUMP.XXXXXXX.0000070.20230706063841.
528 [Arguments] ${filename} ${bmc_dump_timestamp}
529
530 # Description of argument(s):
531 # filename name of BMC dump tar file.
532 # bmc_dump_timestamp timestamp of generated BMC dump.
533
manashsarmafcc14df2023-09-20 11:37:50 -0500534 OperatingSystem.File Should Exist ${filename}
manashsarma1202ffe2023-09-22 09:01:18 -0500535 ${rc}= Run And Return RC dd if=${filename} of=output.zst bs=1 skip=628
536 Should Be True 0 == ${rc}
537
538 ${rc}= Run And Return RC zstd -d output.zst
539 Should Be True 0 == ${rc}
540
541 ${rc}= Run And Return RC tar -xvf output
542 Should Be True 0 == ${rc}
543
544 # Find the extracted dump folder identified with BMCDUMP as prefix and
545 # timestamp of dump generation where timestamp format is : 2023-09-27T08:30:17.000000+00:00.
546 ${var}= Fetch From Left ${bmc_dump_timestamp} .
547 ${var}= Remove String ${var} - T :
548 ${bmc_extraction_folders}= OperatingSystem.List Directories In Directory . BMCDUMP*${var}
549 ${cnt}= Get length ${bmc_extraction_folders}
550 should be equal as numbers ${cnt} 1
551
552 [Return] ${bmc_extraction_folders}[0]
553
554
Rahul Maheshwaribcefdf22020-10-16 07:51:34 -0500555Get BMC Dump Entries
556 [Documentation] Return BMC dump ids list.
557
ganesanb4d430282023-04-27 14:33:23 +0000558 ${dump_uris}= redfish_utils.get_member_list /redfish/v1/Managers/${MANAGER_ID}/LogServices/Dump/Entries
Rahul Maheshwaribcefdf22020-10-16 07:51:34 -0500559 ${dump_ids}= Create List
560
561 FOR ${dump_uri} IN @{dump_uris}
562 ${dump_id}= Fetch From Right ${dump_uri} /
563 Append To List ${dump_ids} ${dump_id}
564 END
565
566 [Return] ${dump_ids}
567
568
manashsarma633cac92022-11-25 03:27:03 -0600569Is BMC Dump Available
570 [Documentation] Verify if BMC dump is available.
571
572 ${dump_entries}= Get BMC Dump Entries
573
574 # Verifying that BMC dump is available.
575 ${length}= Get length ${dump_entries}
576 Should Be True 0 < ${length}
577
578
Rahul Maheshwarid709c8d2020-11-01 23:03:51 -0600579Get Disk Usage For Dumps
580 [Documentation] Return disk usage in kilobyte for BMC dumps.
581
George Keishing952bb0f2022-12-12 03:13:35 -0600582 ${usage_output} ${stderr} ${rc}= BMC Execute Command du -s ${BMC_DUMP_COLLECTOR_PATH}
Rahul Maheshwarid709c8d2020-11-01 23:03:51 -0600583
584 # Example of output from above BMC cli command.
585 # $ du -s /var/lib/phosphor-debug-collector/dumps
586 # 516 /var/lib/phosphor-debug-collector/dumps
587
588 ${usage_output}= Fetch From Left ${usage_output} /
589 ${usage_output}= Convert To Integer ${usage_output}
590
591 [return] ${usage_output}
592
593
Rahul Maheshwari2568f872020-09-23 01:03:39 -0500594Test Teardown Execution
595 [Documentation] Do test teardown operation.
596
597 FFDC On Test Case Fail
598 Close All Connections