blob: b2112d930f7ca99a418b10554d0fb2d276cb2800 [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}
Rahul Maheshwari2568f872020-09-23 01:03:39 -050021
22*** Test Cases ***
23
24Verify User Initiated BMC Dump When Host Powered Off
25 [Documentation] Create user initiated BMC dump at host off state and
26 ... verify dump entry for it.
27 [Tags] Verify_User_Initiated_BMC_Dump_When_Host_Powered_Off
28
29 Redfish Power Off stack_mode=skip
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -050030 ${dump_id}= Create User Initiated BMC Dump Via Redfish
Rahul Maheshwaribcefdf22020-10-16 07:51:34 -050031 ${dump_entries}= Get BMC Dump Entries
Rahul Maheshwari2568f872020-09-23 01:03:39 -050032 Length Should Be ${dump_entries} 1
33 List Should Contain Value ${dump_entries} ${dump_id}
34
Rahul Maheshwari2568f872020-09-23 01:03:39 -050035Verify User Initiated BMC Dump When Host Booted
36 [Documentation] Create user initiated BMC dump at host booted state and
37 ... verify dump entry for it.
38 [Tags] Verify_User_Initiated_BMC_Dump_When_Host_Booted
39
40 Redfish Power On 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
46
Rahul Maheshwarie8e9d0c2020-10-30 02:39:01 -050047Verify User Initiated BMC Dump Size
48 [Documentation] Verify user initiated BMC dump size is under 200 KB.
49 [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
64 # Max size for dump is 200 KB = 200x1024 Byte.
65 Should Be True 0 < ${resp["AdditionalDataSizeBytes"]} < 204800
66
67
Rahul Maheshwari2568f872020-09-23 01:03:39 -050068Verify Dump Persistency On Dump Service Restart
69 [Documentation] Create user dump, restart dump manager service and verify dump
70 ... persistency.
71 [Tags] Verify_Dump_Persistency_On_Dump_Service_Restart
72
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -050073 Create User Initiated BMC Dump Via Redfish
Rahul Maheshwari2568f872020-09-23 01:03:39 -050074 ${dump_entries_before}= redfish_utils.get_member_list /redfish/v1/Managers/bmc/LogServices/Dump/Entries
75
76 # Restart dump service.
77 BMC Execute Command systemctl restart xyz.openbmc_project.Dump.Manager.service
78 Sleep 10s reason=Wait for BMC dump service to restart properly
79
80 ${dump_entries_after}= redfish_utils.get_member_list /redfish/v1/Managers/bmc/LogServices/Dump/Entries
81 Lists Should Be Equal ${dump_entries_before} ${dump_entries_after}
82
83
84Verify Dump Persistency On BMC Reset
85 [Documentation] Create user dump, reset BMC and verify dump persistency.
86 [Tags] Verify_Dump_Persistency_On_BMC_Reset
87
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -050088 Create User Initiated BMC Dump Via Redfish
Rahul Maheshwari2568f872020-09-23 01:03:39 -050089 ${dump_entries_before}= redfish_utils.get_member_list /redfish/v1/Managers/bmc/LogServices/Dump/Entries
90
91 # Reset BMC.
George Keishing88ec2802021-08-04 03:04:22 -050092 OBMC Reboot (off) stack_mode=skip
Rahul Maheshwari2568f872020-09-23 01:03:39 -050093
94 ${dump_entries_after}= redfish_utils.get_member_list /redfish/v1/Managers/bmc/LogServices/Dump/Entries
95 Lists Should Be Equal ${dump_entries_before} ${dump_entries_after}
96
97
Rahul Maheshwari95cbceb2020-10-21 23:25:08 -050098Delete User Initiated BMC Dump And Verify
99 [Documentation] Delete user initiated BMC dump and verify.
100 [Tags] Delete_User_Initiated_BMC_Dump_And_Verify
101
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500102 ${dump_id}= Create User Initiated BMC Dump Via Redfish
Rahul Maheshwari95cbceb2020-10-21 23:25:08 -0500103 Redfish Delete BMC Dump ${dump_id}
104
105 ${dump_entries}= Get BMC Dump Entries
106 Should Be Empty ${dump_entries}
107
108
109Delete All User Initiated BMC Dumps And Verify
110 [Documentation] Delete all user initiated BMC dumps and verify.
111 [Tags] Delete_All_User_Initiated_BMC_Dumps_And_Verify
112
113 # Create some BMC dump.
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500114 Create User Initiated BMC Dump Via Redfish
115 Create User Initiated BMC Dump Via Redfish
Rahul Maheshwari95cbceb2020-10-21 23:25:08 -0500116
117 Redfish Delete All BMC Dumps
118 ${dump_entries}= Get BMC Dump Entries
119 Should Be Empty ${dump_entries}
120
121
Rahul Maheshwari4f338ab2020-10-21 23:28:40 -0500122Create Two User Initiated BMC Dumps
123 [Documentation] Create two user initiated BMC dumps.
124 [Tags] Create_Two_User_Initiated_BMC_Dumps
125
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500126 ${dump_id1}= Create User Initiated BMC Dump Via Redfish
127 ${dump_id2}= Create User Initiated BMC Dump Via Redfish
Rahul Maheshwari4f338ab2020-10-21 23:28:40 -0500128
129 ${dump_entries}= Get BMC Dump Entries
130 Length Should Be ${dump_entries} 2
131 Should Contain ${dump_entries} ${dump_id1}
132 Should Contain ${dump_entries} ${dump_id2}
133
134
135Create Two User Initiated BMC Dumps And Delete One
136 [Documentation] Create two dumps and delete the first.
137 [Tags] Create_Two_User_Initiated_BMC_Dumps_And_Delete_One
138
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500139 ${dump_id1}= Create User Initiated BMC Dump Via Redfish
140 ${dump_id2}= Create User Initiated BMC Dump Via Redfish
Rahul Maheshwari4f338ab2020-10-21 23:28:40 -0500141
142 Redfish Delete BMC Dump ${dump_id1}
143
144 ${dump_entries}= Get BMC Dump Entries
145 Length Should Be ${dump_entries} 1
146 List Should Contain Value ${dump_entries} ${dump_id2}
147
148
149Create And Delete User Initiated BMC Dump Multiple Times
150 [Documentation] Create and delete user initiated BMC dump multiple times.
151 [Tags] Create_And_Delete_User_Initiated_BMC_Dump_Multiple_Times
152
153 FOR ${INDEX} IN 1 10
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500154 ${dump_id}= Create User Initiated BMC Dump Via Redfish
Rahul Maheshwari4f338ab2020-10-21 23:28:40 -0500155 Redfish Delete BMC Dump ${dump_id}
156 END
157
158
Rahul Maheshwarid709c8d2020-11-01 23:03:51 -0600159Verify Maximum BMC Dump Creation
160 [Documentation] Create maximum BMC dump and verify error when dump runs out of space.
161 [Tags] Verify_Maximum_BMC_Dump_Creation
162 [Teardown] Redfish Delete All BMC Dumps
163
164 # Maximum allowed space for dump is 1024 KB. BMC typically hold 8-14 dumps
165 # before running out of this dump space. So trying to create dumps in 20
166 # iterations to run out of space.
167
168 FOR ${n} IN RANGE 0 20
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500169 Create User Initiated BMC Dump Via Redfish
Rahul Maheshwarid709c8d2020-11-01 23:03:51 -0600170 ${dump_space}= Get Disk Usage For Dumps
Tim Leede2d1302021-06-18 01:24:11 +0800171 Exit For Loop If ${dump_space} >= (${BMC_DUMP_TOTAL_SIZE} - ${BMC_DUMP_MIN_SPACE_REQD})
Rahul Maheshwarid709c8d2020-11-01 23:03:51 -0600172 END
173
174 # Check error while creating dump when dump size is full.
175 ${payload}= Create Dictionary DiagnosticDataType=Manager
176 Redfish.Post /redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.CollectDiagnosticData
177 ... body=${payload} valid_status_codes=[${HTTP_INTERNAL_SERVER_ERROR}]
178
179
Rahul Maheshwari2568f872020-09-23 01:03:39 -0500180*** Keywords ***
181
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500182Create User Initiated BMC Dump Via Redfish
183 [Documentation] Generate user initiated BMC dump via Redfish and return the dump id number (e.g., "5").
Rahul Maheshwari2568f872020-09-23 01:03:39 -0500184
185 ${payload}= Create Dictionary DiagnosticDataType=Manager
186 ${resp}= Redfish.Post /redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.CollectDiagnosticData
187 ... body=${payload} valid_status_codes=[${HTTP_ACCEPTED}]
188
189 # Example of response from above Redfish POST request.
190 # "@odata.id": "/redfish/v1/TaskService/Tasks/0",
191 # "@odata.type": "#Task.v1_4_3.Task",
192 # "Id": "0",
193 # "TaskState": "Running",
194 # "TaskStatus": "OK"
195
196 Wait Until Keyword Succeeds 5 min 15 sec Is Task Completed ${resp.dict['Id']}
197 ${task_id}= Set Variable ${resp.dict['Id']}
198
199 ${task_dict}= Redfish.Get Properties /redfish/v1/TaskService/Tasks/${task_id}
200
201 # Example of HttpHeaders field of task details.
202 # "Payload": {
203 # "HttpHeaders": [
204 # "Host: <BMC_IP>",
205 # "Accept-Encoding: identity",
206 # "Connection: Keep-Alive",
207 # "Accept: */*",
208 # "Content-Length: 33",
Tim Leecdaf03f2021-06-17 09:53:02 +0800209 # "Location: /redfish/v1/Managers/bmc/LogServices/Dump/Entries/2"]
Rahul Maheshwari2568f872020-09-23 01:03:39 -0500210 # ],
211 # "HttpOperation": "POST",
212 # "JsonBody": "{\"DiagnosticDataType\":\"Manager\"}",
213 # "TargetUri": "/redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.CollectDiagnosticData"
214 # }
215
Tim Leecdaf03f2021-06-17 09:53:02 +0800216 [Return] ${task_dict["Payload"]["HttpHeaders"][-1].split("/")[-1]}
Rahul Maheshwari2568f872020-09-23 01:03:39 -0500217
218
Rahul Maheshwaribcefdf22020-10-16 07:51:34 -0500219Get BMC Dump Entries
220 [Documentation] Return BMC dump ids list.
221
222 ${dump_uris}= redfish_utils.get_member_list /redfish/v1/Managers/bmc/LogServices/Dump/Entries
223 ${dump_ids}= Create List
224
225 FOR ${dump_uri} IN @{dump_uris}
226 ${dump_id}= Fetch From Right ${dump_uri} /
227 Append To List ${dump_ids} ${dump_id}
228 END
229
230 [Return] ${dump_ids}
231
232
Rahul Maheshwarid709c8d2020-11-01 23:03:51 -0600233Get Disk Usage For Dumps
234 [Documentation] Return disk usage in kilobyte for BMC dumps.
235
236 ${usage_output} ${stderr} ${rc}= BMC Execute Command du -s /var/lib/phosphor-debug-collector/dumps
237
238 # Example of output from above BMC cli command.
239 # $ du -s /var/lib/phosphor-debug-collector/dumps
240 # 516 /var/lib/phosphor-debug-collector/dumps
241
242 ${usage_output}= Fetch From Left ${usage_output} /
243 ${usage_output}= Convert To Integer ${usage_output}
244
245 [return] ${usage_output}
246
247
Rahul Maheshwari2568f872020-09-23 01:03:39 -0500248Is Task Completed
249 [Documentation] Verify if the given task is completed.
250 [Arguments] ${task_id}
251
252 # Description of argument(s):
253 # task_id Id of task which needs to be checked.
254
255 ${task_dict}= Redfish.Get Properties /redfish/v1/TaskService/Tasks/${task_id}
256 Should Be Equal As Strings ${task_dict['TaskState']} Completed
257
258
259Test Teardown Execution
260 [Documentation] Do test teardown operation.
261
262 FFDC On Test Case Fail
263 Close All Connections