blob: 416c6900e79375ecb0bba7dffaaf256969a7092f [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}
manashsarmabd346b32022-07-20 06:22:58 -050021${MAX_DUMP_COUNT} ${20}
Rahul Maheshwari2568f872020-09-23 01:03:39 -050022
23*** Test Cases ***
24
25Verify User Initiated BMC Dump When Host Powered Off
26 [Documentation] Create user initiated BMC dump at host off state and
27 ... verify dump entry for it.
28 [Tags] Verify_User_Initiated_BMC_Dump_When_Host_Powered_Off
29
30 Redfish Power Off stack_mode=skip
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -050031 ${dump_id}= Create User Initiated BMC Dump Via Redfish
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
Rahul Maheshwari2568f872020-09-23 01:03:39 -050036
Rahul Maheshwarie8e9d0c2020-10-30 02:39:01 -050037Verify User Initiated BMC Dump Size
manashsarma7831dc22022-03-08 01:49:36 -060038 [Documentation] Verify user initiated BMC dump size is under 20 MB.
Rahul Maheshwarie8e9d0c2020-10-30 02:39:01 -050039 [Tags] Verify_User_Initiated_BMC_Dump_Size
40
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -050041 ${dump_id}= Create User Initiated BMC Dump Via Redfish
Rahul Maheshwarie8e9d0c2020-10-30 02:39:01 -050042 ${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
manashsarma7831dc22022-03-08 01:49:36 -060054 # Max size for dump is 20 MB = 20x1024x1024 Byte.
55 Should Be True 0 < ${resp["AdditionalDataSizeBytes"]} < 20971520
Rahul Maheshwarie8e9d0c2020-10-30 02:39:01 -050056
57
George Keishing3d850982022-07-19 11:03:03 -050058Verify User Initiated BMC Dump When Host Booted
59 [Documentation] Create user initiated BMC dump at host booted state and
60 ... verify dump entry for it.
61 [Tags] Verify_User_Initiated_BMC_Dump_When_Host_Booted
62
63 Redfish Power On stack_mode=skip
64 ${dump_id}= Create User Initiated BMC Dump Via Redfish
65 ${dump_entries}= Get BMC Dump Entries
66 Length Should Be ${dump_entries} 1
67 List Should Contain Value ${dump_entries} ${dump_id}
68
69
Rahul Maheshwari2568f872020-09-23 01:03:39 -050070Verify Dump Persistency On Dump Service Restart
71 [Documentation] Create user dump, restart dump manager service and verify dump
72 ... persistency.
73 [Tags] Verify_Dump_Persistency_On_Dump_Service_Restart
74
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -050075 Create User Initiated BMC Dump Via Redfish
Rahul Maheshwari2568f872020-09-23 01:03:39 -050076 ${dump_entries_before}= redfish_utils.get_member_list /redfish/v1/Managers/bmc/LogServices/Dump/Entries
77
78 # Restart dump service.
79 BMC Execute Command systemctl restart xyz.openbmc_project.Dump.Manager.service
80 Sleep 10s reason=Wait for BMC dump service to restart properly
81
82 ${dump_entries_after}= redfish_utils.get_member_list /redfish/v1/Managers/bmc/LogServices/Dump/Entries
83 Lists Should Be Equal ${dump_entries_before} ${dump_entries_after}
84
85
86Verify Dump Persistency On BMC Reset
87 [Documentation] Create user dump, reset BMC and verify dump persistency.
88 [Tags] Verify_Dump_Persistency_On_BMC_Reset
89
manashsarma8fa9c892022-10-03 06:20:58 -050090 # Power off host so that dump is not offloaded to host OS.
91 Redfish Power Off stack_mode=skip
92
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -050093 Create User Initiated BMC Dump Via Redfish
Rahul Maheshwari2568f872020-09-23 01:03:39 -050094 ${dump_entries_before}= redfish_utils.get_member_list /redfish/v1/Managers/bmc/LogServices/Dump/Entries
95
96 # Reset BMC.
George Keishing88ec2802021-08-04 03:04:22 -050097 OBMC Reboot (off) stack_mode=skip
Rahul Maheshwari2568f872020-09-23 01:03:39 -050098
99 ${dump_entries_after}= redfish_utils.get_member_list /redfish/v1/Managers/bmc/LogServices/Dump/Entries
100 Lists Should Be Equal ${dump_entries_before} ${dump_entries_after}
101
102
Rahul Maheshwari95cbceb2020-10-21 23:25:08 -0500103Delete User Initiated BMC Dump And Verify
104 [Documentation] Delete user initiated BMC dump and verify.
105 [Tags] Delete_User_Initiated_BMC_Dump_And_Verify
106
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500107 ${dump_id}= Create User Initiated BMC Dump Via Redfish
Rahul Maheshwari95cbceb2020-10-21 23:25:08 -0500108 Redfish Delete BMC Dump ${dump_id}
109
110 ${dump_entries}= Get BMC Dump Entries
111 Should Be Empty ${dump_entries}
112
113
114Delete All User Initiated BMC Dumps And Verify
115 [Documentation] Delete all user initiated BMC dumps and verify.
116 [Tags] Delete_All_User_Initiated_BMC_Dumps_And_Verify
117
118 # Create some BMC dump.
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500119 Create User Initiated BMC Dump Via Redfish
120 Create User Initiated BMC Dump Via Redfish
Rahul Maheshwari95cbceb2020-10-21 23:25:08 -0500121
122 Redfish Delete All BMC Dumps
123 ${dump_entries}= Get BMC Dump Entries
124 Should Be Empty ${dump_entries}
125
126
Rahul Maheshwari4f338ab2020-10-21 23:28:40 -0500127Create Two User Initiated BMC Dumps
128 [Documentation] Create two user initiated BMC dumps.
129 [Tags] Create_Two_User_Initiated_BMC_Dumps
130
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500131 ${dump_id1}= Create User Initiated BMC Dump Via Redfish
132 ${dump_id2}= Create User Initiated BMC Dump Via Redfish
Rahul Maheshwari4f338ab2020-10-21 23:28:40 -0500133
134 ${dump_entries}= Get BMC Dump Entries
135 Length Should Be ${dump_entries} 2
136 Should Contain ${dump_entries} ${dump_id1}
137 Should Contain ${dump_entries} ${dump_id2}
138
139
140Create Two User Initiated BMC Dumps And Delete One
141 [Documentation] Create two dumps and delete the first.
142 [Tags] Create_Two_User_Initiated_BMC_Dumps_And_Delete_One
143
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500144 ${dump_id1}= Create User Initiated BMC Dump Via Redfish
145 ${dump_id2}= Create User Initiated BMC Dump Via Redfish
Rahul Maheshwari4f338ab2020-10-21 23:28:40 -0500146
147 Redfish Delete BMC Dump ${dump_id1}
148
149 ${dump_entries}= Get BMC Dump Entries
150 Length Should Be ${dump_entries} 1
151 List Should Contain Value ${dump_entries} ${dump_id2}
152
153
154Create And Delete User Initiated BMC Dump Multiple Times
155 [Documentation] Create and delete user initiated BMC dump multiple times.
156 [Tags] Create_And_Delete_User_Initiated_BMC_Dump_Multiple_Times
157
158 FOR ${INDEX} IN 1 10
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500159 ${dump_id}= Create User Initiated BMC Dump Via Redfish
Rahul Maheshwari4f338ab2020-10-21 23:28:40 -0500160 Redfish Delete BMC Dump ${dump_id}
161 END
162
163
Rahul Maheshwarid709c8d2020-11-01 23:03:51 -0600164Verify Maximum BMC Dump Creation
165 [Documentation] Create maximum BMC dump and verify error when dump runs out of space.
166 [Tags] Verify_Maximum_BMC_Dump_Creation
167 [Teardown] Redfish Delete All BMC Dumps
168
169 # Maximum allowed space for dump is 1024 KB. BMC typically hold 8-14 dumps
170 # before running out of this dump space. So trying to create dumps in 20
171 # iterations to run out of space.
manashsarmabd346b32022-07-20 06:22:58 -0500172 # User can key in the Maximum allowed space for bmc dump and how many iteration.
173 FOR ${n} IN RANGE 0 ${MAX_DUMP_COUNT}
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500174 Create User Initiated BMC Dump Via Redfish
Rahul Maheshwarid709c8d2020-11-01 23:03:51 -0600175 ${dump_space}= Get Disk Usage For Dumps
Tim Leede2d1302021-06-18 01:24:11 +0800176 Exit For Loop If ${dump_space} >= (${BMC_DUMP_TOTAL_SIZE} - ${BMC_DUMP_MIN_SPACE_REQD})
Rahul Maheshwarid709c8d2020-11-01 23:03:51 -0600177 END
178
179 # Check error while creating dump when dump size is full.
180 ${payload}= Create Dictionary DiagnosticDataType=Manager
181 Redfish.Post /redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.CollectDiagnosticData
182 ... body=${payload} valid_status_codes=[${HTTP_INTERNAL_SERVER_ERROR}]
183
184
Rahul Maheshwari2568f872020-09-23 01:03:39 -0500185*** Keywords ***
186
Rahul Maheshwaribcefdf22020-10-16 07:51:34 -0500187Get BMC Dump Entries
188 [Documentation] Return BMC dump ids list.
189
190 ${dump_uris}= redfish_utils.get_member_list /redfish/v1/Managers/bmc/LogServices/Dump/Entries
191 ${dump_ids}= Create List
192
193 FOR ${dump_uri} IN @{dump_uris}
194 ${dump_id}= Fetch From Right ${dump_uri} /
195 Append To List ${dump_ids} ${dump_id}
196 END
197
198 [Return] ${dump_ids}
199
200
Rahul Maheshwarid709c8d2020-11-01 23:03:51 -0600201Get Disk Usage For Dumps
202 [Documentation] Return disk usage in kilobyte for BMC dumps.
203
204 ${usage_output} ${stderr} ${rc}= BMC Execute Command du -s /var/lib/phosphor-debug-collector/dumps
205
206 # Example of output from above BMC cli command.
207 # $ du -s /var/lib/phosphor-debug-collector/dumps
208 # 516 /var/lib/phosphor-debug-collector/dumps
209
210 ${usage_output}= Fetch From Left ${usage_output} /
211 ${usage_output}= Convert To Integer ${usage_output}
212
213 [return] ${usage_output}
214
215
Rahul Maheshwari2568f872020-09-23 01:03:39 -0500216Test Teardown Execution
217 [Documentation] Do test teardown operation.
218
219 FFDC On Test Case Fail
220 Close All Connections