blob: 309b72e1bac3e0a1b420848033241d26e4489340 [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
77 Redfish Delete All BMC Dumps
78
79 # Create an internal failure error log.
80 BMC Execute Command ${CMD_INTERNAL_FAILURE}
81
82 # Wait for BMC dump to get generated after injecting internal failure.
83 Wait Until Keyword Succeeds 2 min 10 sec Is BMC Dump Available
84
85 # Verify that only one BMC dump is generated after injecting error.
86 ${dump_entries}= Get BMC Dump Entries
87 ${length}= Get length ${dump_entries}
88 Should Be Equal As Integers ${length} ${1}
89
90 # Max size for dump is 20 MB = 20x1024x1024 Byte.
91 ${resp}= Redfish.Get Properties
ganesanb4d430282023-04-27 14:33:23 +000092 ... /redfish/v1/Managers/${MANAGER_ID}/LogServices/Dump/Entries/${dump_entries[0]}
manashsarma7e1f2c52023-02-03 03:18:40 -060093 Should Be True 0 < ${resp["AdditionalDataSizeBytes"]} < 20971520
94
95
manashsarmabbc68bc2022-12-05 09:55:17 -060096Verify Multiple BMC Dump Creation
97 [Documentation] Verify that multiple BMC dumps can be created one after
98 ... another successfully.
99 [Tags] Verify_Multiple_BMC_Dump_Creation
100
manashsarmae52174b2023-04-03 01:26:56 -0500101 Redfish Power Off stack_mode=skip
manashsarmabbc68bc2022-12-05 09:55:17 -0600102 ${dump_count}= Evaluate random.randint(5, 10) modules=random
103 FOR ${INDEX} IN 1 ${dump_count}
104 Create User Initiated BMC Dump Via Redfish
105 END
106
107
manashsarma395f8802022-11-17 03:09:02 -0600108Verify BMC Dump Default Location In BMC
109 [Documentation] Verify that BMC dump is created in its default location of BMC.
George Keishing224e4c72022-12-14 05:07:58 -0600110 [Tags] Verify_BMC_Dump_Default_Location_In_BMC
manashsarma395f8802022-11-17 03:09:02 -0600111
manashsarmae52174b2023-04-03 01:26:56 -0500112 Redfish Power Off stack_mode=skip
manashsarma395f8802022-11-17 03:09:02 -0600113 Redfish Delete All BMC Dumps
114 ${dump_id}= Create User Initiated BMC Dump Via Redfish
115 ${dump_file} ${stderr} ${rc}= BMC Execute Command
116 ... ls ${BMC_DUMP_COLLECTOR_PATH}/${dump_id}
117 Should Be True ${rc} == 0
manashsarmac30e02a2023-02-20 06:46:15 -0600118 Should Contain Any ${dump_file} BMCDUMP obmcdump
manashsarma395f8802022-11-17 03:09:02 -0600119
120
George Keishing3d850982022-07-19 11:03:03 -0500121Verify User Initiated BMC Dump When Host Booted
122 [Documentation] Create user initiated BMC dump at host booted state and
123 ... verify dump entry for it.
124 [Tags] Verify_User_Initiated_BMC_Dump_When_Host_Booted
125
126 Redfish Power On stack_mode=skip
127 ${dump_id}= Create User Initiated BMC Dump Via Redfish
128 ${dump_entries}= Get BMC Dump Entries
129 Length Should Be ${dump_entries} 1
130 List Should Contain Value ${dump_entries} ${dump_id}
131
132
manashsarma4b5d6ac2023-02-08 00:04:03 -0600133Verify User Initiated BMC Dump At Host Booting
134 [Documentation] Create and verify user initiated BMC dump during Host is powwering on
135 ... or when host booting is in progress.
136 [Tags] Verify_User_Initiated_BMC_Dump_At_Host_Booting
137
manashsarma9712ac52023-03-09 04:54:41 -0600138 Redfish Power Off stack_mode=skip
manashsarma4b5d6ac2023-02-08 00:04:03 -0600139 Redfish Delete All BMC Dumps
140
141 # Initiate power on.
142 Redfish Power Operation On
143 Wait Until Keyword Succeeds 2 min 5 sec Is Boot Progress Changed
144
145 # Create user initiated BMC dump and verify only one dump is available.
146 Create User Initiated BMC Dump Via Redfish
147 ${dump_entries}= Get BMC Dump Entries
148 Length Should Be ${dump_entries} 1
149
150
Rahul Maheshwari2568f872020-09-23 01:03:39 -0500151Verify Dump Persistency On Dump Service Restart
152 [Documentation] Create user dump, restart dump manager service and verify dump
153 ... persistency.
154 [Tags] Verify_Dump_Persistency_On_Dump_Service_Restart
155
manashsarmae52174b2023-04-03 01:26:56 -0500156 Redfish Power Off stack_mode=skip
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500157 Create User Initiated BMC Dump Via Redfish
ganesanb4d430282023-04-27 14:33:23 +0000158 ${dump_entries_before}= redfish_utils.get_member_list /redfish/v1/Managers/${MANAGER_ID}/LogServices/Dump/Entries
Rahul Maheshwari2568f872020-09-23 01:03:39 -0500159
160 # Restart dump service.
161 BMC Execute Command systemctl restart xyz.openbmc_project.Dump.Manager.service
162 Sleep 10s reason=Wait for BMC dump service to restart properly
163
ganesanb4d430282023-04-27 14:33:23 +0000164 ${dump_entries_after}= redfish_utils.get_member_list /redfish/v1/Managers/${MANAGER_ID}/LogServices/Dump/Entries
Rahul Maheshwari2568f872020-09-23 01:03:39 -0500165 Lists Should Be Equal ${dump_entries_before} ${dump_entries_after}
166
167
168Verify Dump Persistency On BMC Reset
169 [Documentation] Create user dump, reset BMC and verify dump persistency.
170 [Tags] Verify_Dump_Persistency_On_BMC_Reset
171
manashsarma8fa9c892022-10-03 06:20:58 -0500172 # Power off host so that dump is not offloaded to host OS.
173 Redfish Power Off stack_mode=skip
174
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500175 Create User Initiated BMC Dump Via Redfish
ganesanb4d430282023-04-27 14:33:23 +0000176 ${dump_entries_before}= redfish_utils.get_member_list /redfish/v1/Managers/${MANAGER_ID}/LogServices/Dump/Entries
Rahul Maheshwari2568f872020-09-23 01:03:39 -0500177
178 # Reset BMC.
George Keishing88ec2802021-08-04 03:04:22 -0500179 OBMC Reboot (off) stack_mode=skip
Rahul Maheshwari2568f872020-09-23 01:03:39 -0500180
ganesanb4d430282023-04-27 14:33:23 +0000181 ${dump_entries_after}= redfish_utils.get_member_list /redfish/v1/Managers/${MANAGER_ID}/LogServices/Dump/Entries
Rahul Maheshwari2568f872020-09-23 01:03:39 -0500182 Lists Should Be Equal ${dump_entries_before} ${dump_entries_after}
183
184
Rahul Maheshwari95cbceb2020-10-21 23:25:08 -0500185Delete User Initiated BMC Dump And Verify
186 [Documentation] Delete user initiated BMC dump and verify.
187 [Tags] Delete_User_Initiated_BMC_Dump_And_Verify
188
manashsarmae52174b2023-04-03 01:26:56 -0500189 Redfish Power Off stack_mode=skip
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500190 ${dump_id}= Create User Initiated BMC Dump Via Redfish
manashsarma6cc5bcf2023-08-22 02:22:48 -0500191 Wait Until Keyword Succeeds 15 sec 5 sec Redfish Delete BMC Dump ${dump_id}
Rahul Maheshwari95cbceb2020-10-21 23:25:08 -0500192
193 ${dump_entries}= Get BMC Dump Entries
194 Should Be Empty ${dump_entries}
195
196
197Delete All User Initiated BMC Dumps And Verify
198 [Documentation] Delete all user initiated BMC dumps and verify.
199 [Tags] Delete_All_User_Initiated_BMC_Dumps_And_Verify
200
manashsarma70d840e2022-10-18 02:34:45 -0500201 # Power off host so that dump is not offloaded to host OS.
202 Redfish Power Off stack_mode=skip
203
Rahul Maheshwari95cbceb2020-10-21 23:25:08 -0500204 # Create some BMC dump.
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500205 Create User Initiated BMC Dump Via Redfish
206 Create User Initiated BMC Dump Via Redfish
Rahul Maheshwari95cbceb2020-10-21 23:25:08 -0500207
208 Redfish Delete All BMC Dumps
209 ${dump_entries}= Get BMC Dump Entries
210 Should Be Empty ${dump_entries}
211
212
Rahul Maheshwari4f338ab2020-10-21 23:28:40 -0500213Create Two User Initiated BMC Dumps
214 [Documentation] Create two user initiated BMC dumps.
215 [Tags] Create_Two_User_Initiated_BMC_Dumps
216
manashsarmae52174b2023-04-03 01:26:56 -0500217 Redfish Power Off stack_mode=skip
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500218 ${dump_id1}= Create User Initiated BMC Dump Via Redfish
219 ${dump_id2}= Create User Initiated BMC Dump Via Redfish
Rahul Maheshwari4f338ab2020-10-21 23:28:40 -0500220
221 ${dump_entries}= Get BMC Dump Entries
222 Length Should Be ${dump_entries} 2
223 Should Contain ${dump_entries} ${dump_id1}
224 Should Contain ${dump_entries} ${dump_id2}
225
226
227Create Two User Initiated BMC Dumps And Delete One
228 [Documentation] Create two dumps and delete the first.
229 [Tags] Create_Two_User_Initiated_BMC_Dumps_And_Delete_One
230
manashsarmae52174b2023-04-03 01:26:56 -0500231 Redfish Power Off stack_mode=skip
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500232 ${dump_id1}= Create User Initiated BMC Dump Via Redfish
233 ${dump_id2}= Create User Initiated BMC Dump Via Redfish
Rahul Maheshwari4f338ab2020-10-21 23:28:40 -0500234
manashsarma6cc5bcf2023-08-22 02:22:48 -0500235 Wait Until Keyword Succeeds 15 sec 5 sec Redfish Delete BMC Dump ${dump_id1}
Rahul Maheshwari4f338ab2020-10-21 23:28:40 -0500236
237 ${dump_entries}= Get BMC Dump Entries
238 Length Should Be ${dump_entries} 1
239 List Should Contain Value ${dump_entries} ${dump_id2}
240
241
242Create And Delete User Initiated BMC Dump Multiple Times
243 [Documentation] Create and delete user initiated BMC dump multiple times.
244 [Tags] Create_And_Delete_User_Initiated_BMC_Dump_Multiple_Times
245
manashsarmae52174b2023-04-03 01:26:56 -0500246 Redfish Power Off stack_mode=skip
Rahul Maheshwari4f338ab2020-10-21 23:28:40 -0500247 FOR ${INDEX} IN 1 10
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500248 ${dump_id}= Create User Initiated BMC Dump Via Redfish
manashsarma6cc5bcf2023-08-22 02:22:48 -0500249 Wait Until Keyword Succeeds 15 sec 5 sec Redfish Delete BMC Dump ${dump_id}
Rahul Maheshwari4f338ab2020-10-21 23:28:40 -0500250 END
251
252
Rahul Maheshwarid709c8d2020-11-01 23:03:51 -0600253Verify Maximum BMC Dump Creation
254 [Documentation] Create maximum BMC dump and verify error when dump runs out of space.
255 [Tags] Verify_Maximum_BMC_Dump_Creation
256 [Teardown] Redfish Delete All BMC Dumps
257
258 # Maximum allowed space for dump is 1024 KB. BMC typically hold 8-14 dumps
259 # before running out of this dump space. So trying to create dumps in 20
260 # iterations to run out of space.
manashsarmabd346b32022-07-20 06:22:58 -0500261 # User can key in the Maximum allowed space for bmc dump and how many iteration.
262 FOR ${n} IN RANGE 0 ${MAX_DUMP_COUNT}
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500263 Create User Initiated BMC Dump Via Redfish
Rahul Maheshwarid709c8d2020-11-01 23:03:51 -0600264 ${dump_space}= Get Disk Usage For Dumps
Tim Leede2d1302021-06-18 01:24:11 +0800265 Exit For Loop If ${dump_space} >= (${BMC_DUMP_TOTAL_SIZE} - ${BMC_DUMP_MIN_SPACE_REQD})
Rahul Maheshwarid709c8d2020-11-01 23:03:51 -0600266 END
267
268 # Check error while creating dump when dump size is full.
269 ${payload}= Create Dictionary DiagnosticDataType=Manager
ganesanb4d430282023-04-27 14:33:23 +0000270 Redfish.Post /redfish/v1/Managers/${MANAGER_ID}/LogServices/Dump/Actions/LogService.CollectDiagnosticData
Rahul Maheshwarid709c8d2020-11-01 23:03:51 -0600271 ... body=${payload} valid_status_codes=[${HTTP_INTERNAL_SERVER_ERROR}]
272
273
manashsarma633cac92022-11-25 03:27:03 -0600274Verify BMC Core Dump When Host Powered Off
275 [Documentation] Verify BMC core dump after application crash at host powered off state.
276 [Tags] Verify_BMC_Core_Dump_When_Host_Powered_Off
277
278 Redfish Power Off stack_mode=skip
279
280 # Ensure all dumps are cleaned out.
281 Redfish Delete All BMC Dumps
282 Trigger Core Dump
283
284 # Verify that BMC dump is available.
285 Wait Until Keyword Succeeds 2 min 10 sec Is BMC Dump Available
286
287
manashsarma849189c2022-11-28 04:16:51 -0600288Verify Core Dump Size
289 [Documentation] Verify BMC core dump size is under 20 MB.
290 [Tags] Verify_Core_Dump_Size
291
292 Redfish Power Off stack_mode=skip
293
294 # Ensure all dumps are cleaned out.
295 Redfish Delete All BMC Dumps
296 Trigger Core Dump
297
298 # Verify that BMC dump is available.
299 Wait Until Keyword Succeeds 2 min 10 sec Is BMC Dump Available
300 ${dump_entries}= Get BMC Dump Entries
301 ${resp}= Redfish.Get Properties
ganesanb4d430282023-04-27 14:33:23 +0000302 ... /redfish/v1/Managers/${MANAGER_ID}/LogServices/Dump/Entries/${dump_entries[0]}
manashsarma849189c2022-11-28 04:16:51 -0600303
304 # Max size for dump is 20 MB = 20x1024x1024 Byte.
305 Should Be True 0 < ${resp["AdditionalDataSizeBytes"]} < 20971520
306
307
manashsarmafcbfdf62022-12-07 06:36:28 -0600308Verify Error While Initiating BMC Dump During Dumping State
309 [Documentation] Verify error while initiating BMC dump during dumping state.
310 [Tags] Verify_Error_While_Initiating_BMC_Dump_During_Dumping_State
311
manashsarmae52174b2023-04-03 01:26:56 -0500312 Redfish Power Off stack_mode=skip
Nandish-Mattiaf5bc152023-01-30 00:49:59 -0600313 ${task_id}= Create User Initiated BMC Dump Via Redfish ${1}
manashsarmafcbfdf62022-12-07 06:36:28 -0600314
315 # Check error while initiating BMC dump while dump in progress.
316 ${payload}= Create Dictionary DiagnosticDataType=Manager
317 Redfish.Post
ganesanb4d430282023-04-27 14:33:23 +0000318 ... /redfish/v1/Managers/${MANAGER_ID}/LogServices/Dump/Actions/LogService.CollectDiagnosticData
manashsarmafcbfdf62022-12-07 06:36:28 -0600319 ... body=${payload} valid_status_codes=[${HTTP_SERVICE_UNAVAILABLE}]
320
Nandish-Mattiaf5bc152023-01-30 00:49:59 -0600321 # Wait for above initiated dump to complete. Otherwise, on going dump would impact next test.
322 Wait Until Keyword Succeeds 5 min 15 sec Check Task Completion ${task_id}
323
manashsarmafcbfdf62022-12-07 06:36:28 -0600324
manashsarmaaa845b72022-12-12 05:41:32 -0600325Verify BMC Dump Create Errors While Another BMC Dump In Progress
326 [Documentation] Verify BMC dump creation error until older BMC dump completion.
327 [Tags] Verify_BMC_Dump_Create_Errors_While_Another_BMC_Dump_In_Progress
328
manashsarmae52174b2023-04-03 01:26:56 -0500329 Redfish Power Off stack_mode=skip
330
manashsarmaaa845b72022-12-12 05:41:32 -0600331 # Initiate a BMC dump that returns without completion.
332 ${task_id}= Create User Initiated BMC Dump Via Redfish ${1}
manashsarmacf757da2023-10-12 01:12:23 -0500333 ${task_dict}= Redfish.Get Properties /redfish/v1/TaskService/Tasks/${task_id}
manashsarmaaa845b72022-12-12 05:41:32 -0600334 ${payload}= Create Dictionary DiagnosticDataType=Manager
manashsarmacf757da2023-10-12 01:12:23 -0500335 IF '${task_dict['TaskState']}' != 'Completed'
manashsarma785244c2023-03-15 05:56:18 -0500336 ${resp}= Redfish.Post
ganesanb4d430282023-04-27 14:33:23 +0000337 ... /redfish/v1/Managers/${MANAGER_ID}/LogServices/Dump/Actions/LogService.CollectDiagnosticData
manashsarmacf757da2023-10-12 01:12:23 -0500338 ... body=${payload} valid_status_codes=[${HTTP_SERVICE_UNAVAILABLE}]
manashsarmaaa845b72022-12-12 05:41:32 -0600339 END
340
manashsarmaaa845b72022-12-12 05:41:32 -0600341 # Wait for above initiated dump to complete. Otherwise, on going dump would impact next test.
manashsarmacf757da2023-10-12 01:12:23 -0500342 Wait Until Keyword Succeeds 5 min 15 sec Check Task Completion ${task_id}
manashsarmaaa845b72022-12-12 05:41:32 -0600343
344
manashsarmaadabd3b2023-02-08 04:51:32 -0600345Verify Core Dump After Terminating Dump Manager Service
346 [Documentation] Verify initiate core dumps and kill Phosphor-dump-manager.
347 [Tags] Verify_Core_Dump_After_Terminating_Dump_Manager_Service
348
349 Redfish Power Off stack_mode=skip
350
351 # Remove all available dumps in BMC.
352 Redfish Delete All BMC Dumps
353
354 # Find the pid of the phosphor-dump-manage process and kill it.
355 ${cmd_buf}= Catenate kill -s SEGV $(pgrep phosphor-dump-manager)
356 ${cmd_output} ${stderr} ${rc}= BMC Execute Command ${cmd_buf}
357 Should Be Equal As Integers ${rc} ${0}
358
359 # Verify that BMC dump is available.
360 Wait Until Keyword Succeeds 2 min 10 sec Is BMC Dump Available
361
George Keishing4611b812023-02-16 09:44:33 -0600362 # Verifying that there is only one dump.
manashsarmaadabd3b2023-02-08 04:51:32 -0600363 ${dump_entries}= Get BMC Dump Entries
364 ${length}= Get length ${dump_entries}
365 Should Be Equal As Integers ${length} ${1}
366
367
manashsarma7bf47d22023-02-08 01:10:18 -0600368Verify Error Log And Dump For Internal Failure
369 [Documentation] Verify error log and dump for internal failure.
370 [Tags] Verify_Error_Log_And_Dump_For_Internal_Failure
371
372 Redfish Purge Event Log
373 Redfish Delete All BMC Dumps
374
375 # Create an internal failure error log.
376 BMC Execute Command ${CMD_INTERNAL_FAILURE}
377
378 # With internal failure, an error log file is generated. Check if
379 # BMC has only one error log for this internal failure.
380 ${resp}= Redfish.Get /redfish/v1/Systems/system/LogServices/CELog/Entries
381 Should Be True ${resp.dict["Members@odata.count"]} == ${1}
382
383 # Wait for the BMC dump to become available and verify its presence.
384 Wait Until Keyword Succeeds 2 min 10 sec Is BMC Dump Available
385 ${dump_entries}= Get BMC Dump Entries
386 ${length}= Get length ${dump_entries}
387 Should Be Equal As Integers ${length} ${1}
388
389
manashsarma35247412023-02-06 02:14:04 -0600390Verify Core Watchdog Initiated BMC Dump
391 [Documentation] Verify core watchdog timeout initiated BMC dump.
392 [Tags] Verify_Core_Watchdog_Initiated_BMC_Dump
393
394 Redfish Delete All BMC Dumps
395 Redfish Power Off stack_mode=skip
396
397 # Trigger watchdog timeout.
398 Redfish Initiate Auto Reboot 2000
399
400 # Wait for BMC dump to get generated after injecting watchdog timeout.
401 Wait Until Keyword Succeeds 4 min 20 sec Is BMC Dump Available
402
403 # Verify that only one BMC dump is available.
404 ${dump_entry_list}= Get BMC Dump Entries
405 ${length}= Get length ${dump_entry_list}
406 Should Be Equal As Integers ${length} ${1}
407
408
manashsarma1202ffe2023-09-22 09:01:18 -0500409Verify User Initiated BMC Dump Type
410 [Documentation] Download user initiate BMC dump and validates its type.
411 [Tags] Verify_User_Initiated_BMC_Dump_Type
412
manashsarmada7fd922023-10-05 08:26:13 -0500413 Redfish Power Off stack_mode=skip
manashsarma1202ffe2023-09-22 09:01:18 -0500414 ${dump_id}= Create User Initiated BMC Dump Via Redfish
415
416 # Download BMC dump and verify its size.
417 ${resp}= Redfish.Get /redfish/v1/Managers/bmc/LogServices/Dump/Entries/${dump_id}
manashsarma1202ffe2023-09-22 09:01:18 -0500418 ${redfish_dump_creation_timestamp}= Set Variable ${resp.dict["Created"]}
manashsarmada7fd922023-10-05 08:26:13 -0500419 # Download BMC dump and verify its size.
420 ${tarfile}= Download BMC Dump ${dump_id}
manashsarma1202ffe2023-09-22 09:01:18 -0500421
422 # Extract dump and verify type of dump from summary.log content:
423 # Wed Aug 30 17:23:29 UTC 2023 Name: BMCDUMP.XXXXXXX.0001005.20230830172329
424 # Wed Aug 30 17:23:29 UTC 2023 Epochtime: 1693416209
425 # Wed Aug 30 17:23:29 UTC 2023 ID: 0001005
426 # Wed Aug 30 17:23:29 UTC 2023 Type: user
427 ${extracted_dump_folder}= Extract BMC Dump BMC_dump.tar.gz ${redfish_dump_creation_timestamp}
428 ${contents}= OperatingSystem.Get File ${extracted_dump_folder}/summary.log
429 Should Match Regexp ${contents} Type:[ ]*user
430
431 # Clean extracted dump files.
432 Remove Files output output.zst
433 Remove Directory ${extracted_dump_folder} True
434
435
manashsarma7223e6dd2023-09-21 01:10:24 -0500436Verify Retrieve Core Initiated BMC Dump
437 [Documentation] Verify retrieval of core initiated BMC dump.
438 [Tags] Verify_Retrieve_Core_Initiated_BMC_Dump
439
440 Redfish Power Off stack_mode=skip
441
442 # Ensure all dumps are cleaned out.
443 Redfish Delete All BMC Dumps
444 Trigger Core Dump
445
446 # Verify that BMC dump is available.
447 Wait Until Keyword Succeeds 2 min 10 sec Is BMC Dump Available
448
449 ${dump_entries}= Get BMC Dump Entries
450 # Download BMC dump and verify its size.
451 Download BMC Dump ${dump_entries[0]}
452
453
manashsarmafcc14df2023-09-20 11:37:50 -0500454Verify Retrieve User Initiated BMC Dump
455 [Documentation] Verify retrieval of user initiated BMC dump.
456 [Tags] Verify_Retrieve_User_Initiated_BMC_Dump
457
manashsarmada7fd922023-10-05 08:26:13 -0500458 Redfish Power Off stack_mode=skip
manashsarmafcc14df2023-09-20 11:37:50 -0500459 ${dump_id}= Create User Initiated BMC Dump Via Redfish
460
461 # Download BMC dump.
462 Download BMC Dump ${dump_id}
463
464
manashsarmada7fd922023-10-05 08:26:13 -0500465Verify Core Initiated BMC Dump Type
466 [Documentation] Download core initiate BMC dump and validates its type.
467 [Tags] Verify_Core_Initiated_BMC_Dump_Type
468
469 Redfish Power Off stack_mode=skip
470
471 # Ensure all dumps are cleaned out.
472 Redfish Delete All BMC Dumps
473 Trigger Core Dump
474
475 # Verify that BMC dump is available.
476 Wait Until Keyword Succeeds 2 min 10 sec Is BMC Dump Available
477
478 ${dump_entries}= Get BMC Dump Entries
479
480 # Find the timestamp of BMC dump.
481 ${resp}= Redfish.Get /redfish/v1/Managers/bmc/LogServices/Dump/Entries/${dump_entries[0]}
482 ${redfish_dump_creation_timestamp}= Set Variable ${resp.dict["Created"]}
483
484 # Download BMC dump and verify its size.
485 ${tarfile}= Download BMC Dump ${dump_entries[0]}
486
487 # Extract dump and verify type of dump from summary.log content:
488 # Wed Aug 30 17:23:29 UTC 2023 Name: BMCDUMP.XXXXXXX.0001005.20230830172329
489 # Wed Aug 30 17:23:29 UTC 2023 Epochtime: 1693416209
490 # Wed Aug 30 17:23:29 UTC 2023 ID: 0001005
491 # Wed Aug 30 17:23:29 UTC 2023 Type: core
492
493 ${extracted_dump_folder}= Extract BMC Dump ${tarfile} ${redfish_dump_creation_timestamp}
494 ${contents}= OperatingSystem.Get File ${extracted_dump_folder}/summary.log
495 Should Match Regexp ${contents} Type:[ ]*core
496
497 # Clean extracted dump files.
498 Remove Files output output.zst
499 Remove Directory ${extracted_dump_folder} True
500
501
Rahul Maheshwari2568f872020-09-23 01:03:39 -0500502*** Keywords ***
503
manashsarmada7fd922023-10-05 08:26:13 -0500504Download BMC Dump
505 [Documentation] Download BMC dump and verify its size.
506 [Arguments] ${dump_id}
507
508 # Description of argument(s):
509 # dump_id An integer value that identifies a particular dump (e.g. 1, 3).
510
511 ${resp}= Redfish.Get /redfish/v1/Managers/bmc/LogServices/Dump/Entries/${dump_id}
512 ${redfish_bmc_dump_size}= Set Variable ${resp.dict["AdditionalDataSizeBytes"]}
513
514 Initialize OpenBMC
515 ${headers}= Create Dictionary Content-Type=application/octet-stream X-Auth-Token=${XAUTH_TOKEN}
516
517 ${ret}= Get Request openbmc /redfish/v1/Managers/bmc/LogServices/Dump/Entries/${dump_id}/attachment headers=${headers}
518
519 Should Be Equal As Numbers ${ret.status_code} 200
520
521 Create Binary File BMC_dump.tar.gz ${ret.content}
522 ${downloaded_dump_size}= Get File Size BMC_dump.tar.gz
523 Should Be Equal ${downloaded_dump_size} ${redfish_bmc_dump_size}
524 [Return] BMC_dump.tar.gz
525
526
manashsarma1202ffe2023-09-22 09:01:18 -0500527Extract BMC Dump
528 [Documentation] Extract BMC dump from the tar file and returns the name of
529 ... extracted folder like BMCDUMP.XXXXXXX.0000070.20230706063841.
530 [Arguments] ${filename} ${bmc_dump_timestamp}
531
532 # Description of argument(s):
533 # filename name of BMC dump tar file.
534 # bmc_dump_timestamp timestamp of generated BMC dump.
535
manashsarmafcc14df2023-09-20 11:37:50 -0500536 OperatingSystem.File Should Exist ${filename}
manashsarma1202ffe2023-09-22 09:01:18 -0500537 ${rc}= Run And Return RC dd if=${filename} of=output.zst bs=1 skip=628
538 Should Be True 0 == ${rc}
539
540 ${rc}= Run And Return RC zstd -d output.zst
541 Should Be True 0 == ${rc}
542
543 ${rc}= Run And Return RC tar -xvf output
544 Should Be True 0 == ${rc}
545
546 # Find the extracted dump folder identified with BMCDUMP as prefix and
547 # timestamp of dump generation where timestamp format is : 2023-09-27T08:30:17.000000+00:00.
548 ${var}= Fetch From Left ${bmc_dump_timestamp} .
549 ${var}= Remove String ${var} - T :
550 ${bmc_extraction_folders}= OperatingSystem.List Directories In Directory . BMCDUMP*${var}
551 ${cnt}= Get length ${bmc_extraction_folders}
552 should be equal as numbers ${cnt} 1
553
554 [Return] ${bmc_extraction_folders}[0]
555
556
Rahul Maheshwaribcefdf22020-10-16 07:51:34 -0500557Get BMC Dump Entries
558 [Documentation] Return BMC dump ids list.
559
ganesanb4d430282023-04-27 14:33:23 +0000560 ${dump_uris}= redfish_utils.get_member_list /redfish/v1/Managers/${MANAGER_ID}/LogServices/Dump/Entries
Rahul Maheshwaribcefdf22020-10-16 07:51:34 -0500561 ${dump_ids}= Create List
562
563 FOR ${dump_uri} IN @{dump_uris}
564 ${dump_id}= Fetch From Right ${dump_uri} /
565 Append To List ${dump_ids} ${dump_id}
566 END
567
568 [Return] ${dump_ids}
569
570
manashsarma633cac92022-11-25 03:27:03 -0600571Is BMC Dump Available
572 [Documentation] Verify if BMC dump is available.
573
574 ${dump_entries}= Get BMC Dump Entries
575
576 # Verifying that BMC dump is available.
577 ${length}= Get length ${dump_entries}
578 Should Be True 0 < ${length}
579
580
Rahul Maheshwarid709c8d2020-11-01 23:03:51 -0600581Get Disk Usage For Dumps
582 [Documentation] Return disk usage in kilobyte for BMC dumps.
583
George Keishing952bb0f2022-12-12 03:13:35 -0600584 ${usage_output} ${stderr} ${rc}= BMC Execute Command du -s ${BMC_DUMP_COLLECTOR_PATH}
Rahul Maheshwarid709c8d2020-11-01 23:03:51 -0600585
586 # Example of output from above BMC cli command.
587 # $ du -s /var/lib/phosphor-debug-collector/dumps
588 # 516 /var/lib/phosphor-debug-collector/dumps
589
590 ${usage_output}= Fetch From Left ${usage_output} /
591 ${usage_output}= Convert To Integer ${usage_output}
592
593 [return] ${usage_output}
594
595
Rahul Maheshwari2568f872020-09-23 01:03:39 -0500596Test Teardown Execution
597 [Documentation] Do test teardown operation.
598
599 FFDC On Test Case Fail
600 Close All Connections