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