blob: 141b694c56b28002bc874dd4b0fe0b156f57cb2e [file] [log] [blame]
Rahul Maheshwari2568f872020-09-23 01:03:39 -05001*** Settings ***
2
3Documentation Test BMC dump functionality of OpenBMC.
4
5Resource ../../lib/openbmc_ffdc.robot
6Resource ../../lib/dump_utils.robot
7
George Keishingf514ccb2021-02-02 23:55:56 -06008Suite Setup Redfish.Login
Rahul Maheshwari2568f872020-09-23 01:03:39 -05009Test Setup Redfish Delete All BMC Dumps
10Test Teardown Test Teardown Execution
11
12
13*** Test Cases ***
14
15Verify User Initiated BMC Dump When Host Powered Off
16 [Documentation] Create user initiated BMC dump at host off state and
17 ... verify dump entry for it.
18 [Tags] Verify_User_Initiated_BMC_Dump_When_Host_Powered_Off
19
20 Redfish Power Off stack_mode=skip
21 ${dump_id}= Create User Initiated BMC Dump
Rahul Maheshwaribcefdf22020-10-16 07:51:34 -050022 ${dump_entries}= Get BMC Dump Entries
Rahul Maheshwari2568f872020-09-23 01:03:39 -050023 Length Should Be ${dump_entries} 1
24 List Should Contain Value ${dump_entries} ${dump_id}
25
Rahul Maheshwari2568f872020-09-23 01:03:39 -050026Verify User Initiated BMC Dump When Host Booted
27 [Documentation] Create user initiated BMC dump at host booted state and
28 ... verify dump entry for it.
29 [Tags] Verify_User_Initiated_BMC_Dump_When_Host_Booted
30
31 Redfish Power On stack_mode=skip
32 ${dump_id}= Create User Initiated BMC Dump
Rahul Maheshwaribcefdf22020-10-16 07:51:34 -050033 ${dump_entries}= Get BMC Dump Entries
Rahul Maheshwari2568f872020-09-23 01:03:39 -050034 Length Should Be ${dump_entries} 1
35 List Should Contain Value ${dump_entries} ${dump_id}
36
37
Rahul Maheshwarie8e9d0c2020-10-30 02:39:01 -050038Verify User Initiated BMC Dump Size
39 [Documentation] Verify user initiated BMC dump size is under 200 KB.
40 [Tags] Verify_User_Initiated_BMC_Dump_Size
41
42 ${dump_id}= Create User Initiated BMC Dump
43 ${resp}= Redfish.Get Properties /redfish/v1/Managers/bmc/LogServices/Dump/Entries/${dump_id}
44
45 # Example of response from above Redfish GET request.
46 # "@odata.type": "#LogEntry.v1_7_0.LogEntry",
47 # "AdditionalDataSizeBytes": 31644,
48 # "AdditionalDataURI": "/redfish/v1/Managers/bmc/LogServices/Dump/attachment/9",
49 # "Created": "2020-10-23T06:32:53+00:00",
50 # "DiagnosticDataType": "Manager",
51 # "EntryType": "Event",
52 # "Id": "9",
53 # "Name": "BMC Dump Entry"
54
55 # Max size for dump is 200 KB = 200x1024 Byte.
56 Should Be True 0 < ${resp["AdditionalDataSizeBytes"]} < 204800
57
58
Rahul Maheshwari2568f872020-09-23 01:03:39 -050059Verify Dump Persistency On Dump Service Restart
60 [Documentation] Create user dump, restart dump manager service and verify dump
61 ... persistency.
62 [Tags] Verify_Dump_Persistency_On_Dump_Service_Restart
63
64 Create User Initiated BMC Dump
65 ${dump_entries_before}= redfish_utils.get_member_list /redfish/v1/Managers/bmc/LogServices/Dump/Entries
66
67 # Restart dump service.
68 BMC Execute Command systemctl restart xyz.openbmc_project.Dump.Manager.service
69 Sleep 10s reason=Wait for BMC dump service to restart properly
70
71 ${dump_entries_after}= redfish_utils.get_member_list /redfish/v1/Managers/bmc/LogServices/Dump/Entries
72 Lists Should Be Equal ${dump_entries_before} ${dump_entries_after}
73
74
75Verify Dump Persistency On BMC Reset
76 [Documentation] Create user dump, reset BMC and verify dump persistency.
77 [Tags] Verify_Dump_Persistency_On_BMC_Reset
78
79 Create User Initiated BMC Dump
80 ${dump_entries_before}= redfish_utils.get_member_list /redfish/v1/Managers/bmc/LogServices/Dump/Entries
81
82 # Reset BMC.
83 OBMC Reboot (off)
84
85 ${dump_entries_after}= redfish_utils.get_member_list /redfish/v1/Managers/bmc/LogServices/Dump/Entries
86 Lists Should Be Equal ${dump_entries_before} ${dump_entries_after}
87
88
Rahul Maheshwari95cbceb2020-10-21 23:25:08 -050089Delete User Initiated BMC Dump And Verify
90 [Documentation] Delete user initiated BMC dump and verify.
91 [Tags] Delete_User_Initiated_BMC_Dump_And_Verify
92
93 ${dump_id}= Create User Initiated BMC Dump
94 Redfish Delete BMC Dump ${dump_id}
95
96 ${dump_entries}= Get BMC Dump Entries
97 Should Be Empty ${dump_entries}
98
99
100Delete All User Initiated BMC Dumps And Verify
101 [Documentation] Delete all user initiated BMC dumps and verify.
102 [Tags] Delete_All_User_Initiated_BMC_Dumps_And_Verify
103
104 # Create some BMC dump.
105 Create User Initiated BMC Dump
106 Create User Initiated BMC Dump
107
108 Redfish Delete All BMC Dumps
109 ${dump_entries}= Get BMC Dump Entries
110 Should Be Empty ${dump_entries}
111
112
Rahul Maheshwari4f338ab2020-10-21 23:28:40 -0500113Create Two User Initiated BMC Dumps
114 [Documentation] Create two user initiated BMC dumps.
115 [Tags] Create_Two_User_Initiated_BMC_Dumps
116
117 ${dump_id1}= Create User Initiated BMC Dump
118 ${dump_id2}= Create User Initiated BMC Dump
119
120 ${dump_entries}= Get BMC Dump Entries
121 Length Should Be ${dump_entries} 2
122 Should Contain ${dump_entries} ${dump_id1}
123 Should Contain ${dump_entries} ${dump_id2}
124
125
126Create Two User Initiated BMC Dumps And Delete One
127 [Documentation] Create two dumps and delete the first.
128 [Tags] Create_Two_User_Initiated_BMC_Dumps_And_Delete_One
129
130 ${dump_id1}= Create User Initiated BMC Dump
131 ${dump_id2}= Create User Initiated BMC Dump
132
133 Redfish Delete BMC Dump ${dump_id1}
134
135 ${dump_entries}= Get BMC Dump Entries
136 Length Should Be ${dump_entries} 1
137 List Should Contain Value ${dump_entries} ${dump_id2}
138
139
140Create And Delete User Initiated BMC Dump Multiple Times
141 [Documentation] Create and delete user initiated BMC dump multiple times.
142 [Tags] Create_And_Delete_User_Initiated_BMC_Dump_Multiple_Times
143
144 FOR ${INDEX} IN 1 10
145 ${dump_id}= Create User Initiated BMC Dump
146 Redfish Delete BMC Dump ${dump_id}
147 END
148
149
Rahul Maheshwarid709c8d2020-11-01 23:03:51 -0600150Verify Maximum BMC Dump Creation
151 [Documentation] Create maximum BMC dump and verify error when dump runs out of space.
152 [Tags] Verify_Maximum_BMC_Dump_Creation
153 [Teardown] Redfish Delete All BMC Dumps
154
155 # Maximum allowed space for dump is 1024 KB. BMC typically hold 8-14 dumps
156 # before running out of this dump space. So trying to create dumps in 20
157 # iterations to run out of space.
158
159 FOR ${n} IN RANGE 0 20
160 Create User Initiated BMC Dump
161 ${dump_space}= Get Disk Usage For Dumps
162 Exit For Loop If ${dump_space} >= 1024
163 END
164
165 # Check error while creating dump when dump size is full.
166 ${payload}= Create Dictionary DiagnosticDataType=Manager
167 Redfish.Post /redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.CollectDiagnosticData
168 ... body=${payload} valid_status_codes=[${HTTP_INTERNAL_SERVER_ERROR}]
169
170
Rahul Maheshwari2568f872020-09-23 01:03:39 -0500171*** Keywords ***
172
173Create User Initiated BMC Dump
174 [Documentation] Generate user initiated BMC dump and return the dump id number (e.g., "5").
175
176 ${payload}= Create Dictionary DiagnosticDataType=Manager
177 ${resp}= Redfish.Post /redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.CollectDiagnosticData
178 ... body=${payload} valid_status_codes=[${HTTP_ACCEPTED}]
179
180 # Example of response from above Redfish POST request.
181 # "@odata.id": "/redfish/v1/TaskService/Tasks/0",
182 # "@odata.type": "#Task.v1_4_3.Task",
183 # "Id": "0",
184 # "TaskState": "Running",
185 # "TaskStatus": "OK"
186
187 Wait Until Keyword Succeeds 5 min 15 sec Is Task Completed ${resp.dict['Id']}
188 ${task_id}= Set Variable ${resp.dict['Id']}
189
190 ${task_dict}= Redfish.Get Properties /redfish/v1/TaskService/Tasks/${task_id}
191
192 # Example of HttpHeaders field of task details.
193 # "Payload": {
194 # "HttpHeaders": [
195 # "Host: <BMC_IP>",
196 # "Accept-Encoding: identity",
197 # "Connection: Keep-Alive",
198 # "Accept: */*",
199 # "Content-Length: 33",
Rahul Maheshwaric7946c62021-05-19 07:07:32 -0500200 # "Location: /redfish/v1/Managers/bmc/LogServices/Dump/Entries/2/"]
Rahul Maheshwari2568f872020-09-23 01:03:39 -0500201 # ],
202 # "HttpOperation": "POST",
203 # "JsonBody": "{\"DiagnosticDataType\":\"Manager\"}",
204 # "TargetUri": "/redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.CollectDiagnosticData"
205 # }
206
Rahul Maheshwaric7946c62021-05-19 07:07:32 -0500207 [Return] ${task_dict["Payload"]["HttpHeaders"][-1].split("/")[-2]}
Rahul Maheshwari2568f872020-09-23 01:03:39 -0500208
209
Rahul Maheshwaribcefdf22020-10-16 07:51:34 -0500210Get BMC Dump Entries
211 [Documentation] Return BMC dump ids list.
212
213 ${dump_uris}= redfish_utils.get_member_list /redfish/v1/Managers/bmc/LogServices/Dump/Entries
214 ${dump_ids}= Create List
215
216 FOR ${dump_uri} IN @{dump_uris}
217 ${dump_id}= Fetch From Right ${dump_uri} /
218 Append To List ${dump_ids} ${dump_id}
219 END
220
221 [Return] ${dump_ids}
222
223
Rahul Maheshwarid709c8d2020-11-01 23:03:51 -0600224Get Disk Usage For Dumps
225 [Documentation] Return disk usage in kilobyte for BMC dumps.
226
227 ${usage_output} ${stderr} ${rc}= BMC Execute Command du -s /var/lib/phosphor-debug-collector/dumps
228
229 # Example of output from above BMC cli command.
230 # $ du -s /var/lib/phosphor-debug-collector/dumps
231 # 516 /var/lib/phosphor-debug-collector/dumps
232
233 ${usage_output}= Fetch From Left ${usage_output} /
234 ${usage_output}= Convert To Integer ${usage_output}
235
236 [return] ${usage_output}
237
238
Rahul Maheshwari2568f872020-09-23 01:03:39 -0500239Is Task Completed
240 [Documentation] Verify if the given task is completed.
241 [Arguments] ${task_id}
242
243 # Description of argument(s):
244 # task_id Id of task which needs to be checked.
245
246 ${task_dict}= Redfish.Get Properties /redfish/v1/TaskService/Tasks/${task_id}
247 Should Be Equal As Strings ${task_dict['TaskState']} Completed
248
249
250Test Teardown Execution
251 [Documentation] Do test teardown operation.
252
253 FFDC On Test Case Fail
254 Close All Connections