blob: 6ab0930d04f6bd6ada228487a20c835308549add [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 -050035
Rahul Maheshwarie8e9d0c2020-10-30 02:39:01 -050036Verify User Initiated BMC Dump Size
manashsarma7831dc22022-03-08 01:49:36 -060037 [Documentation] Verify user initiated BMC dump size is under 20 MB.
Rahul Maheshwarie8e9d0c2020-10-30 02:39:01 -050038 [Tags] Verify_User_Initiated_BMC_Dump_Size
39
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -050040 ${dump_id}= Create User Initiated BMC Dump Via Redfish
Rahul Maheshwarie8e9d0c2020-10-30 02:39:01 -050041 ${resp}= Redfish.Get Properties /redfish/v1/Managers/bmc/LogServices/Dump/Entries/${dump_id}
42
43 # Example of response from above Redfish GET request.
44 # "@odata.type": "#LogEntry.v1_7_0.LogEntry",
45 # "AdditionalDataSizeBytes": 31644,
46 # "AdditionalDataURI": "/redfish/v1/Managers/bmc/LogServices/Dump/attachment/9",
47 # "Created": "2020-10-23T06:32:53+00:00",
48 # "DiagnosticDataType": "Manager",
49 # "EntryType": "Event",
50 # "Id": "9",
51 # "Name": "BMC Dump Entry"
52
manashsarma7831dc22022-03-08 01:49:36 -060053 # Max size for dump is 20 MB = 20x1024x1024 Byte.
54 Should Be True 0 < ${resp["AdditionalDataSizeBytes"]} < 20971520
Rahul Maheshwarie8e9d0c2020-10-30 02:39:01 -050055
56
George Keishing3d850982022-07-19 11:03:03 -050057Verify User Initiated BMC Dump When Host Booted
58 [Documentation] Create user initiated BMC dump at host booted state and
59 ... verify dump entry for it.
60 [Tags] Verify_User_Initiated_BMC_Dump_When_Host_Booted
61
62 Redfish Power On stack_mode=skip
63 ${dump_id}= Create User Initiated BMC Dump Via Redfish
64 ${dump_entries}= Get BMC Dump Entries
65 Length Should Be ${dump_entries} 1
66 List Should Contain Value ${dump_entries} ${dump_id}
67
68
Rahul Maheshwari2568f872020-09-23 01:03:39 -050069Verify Dump Persistency On Dump Service Restart
70 [Documentation] Create user dump, restart dump manager service and verify dump
71 ... persistency.
72 [Tags] Verify_Dump_Persistency_On_Dump_Service_Restart
73
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -050074 Create User Initiated BMC Dump Via Redfish
Rahul Maheshwari2568f872020-09-23 01:03:39 -050075 ${dump_entries_before}= redfish_utils.get_member_list /redfish/v1/Managers/bmc/LogServices/Dump/Entries
76
77 # Restart dump service.
78 BMC Execute Command systemctl restart xyz.openbmc_project.Dump.Manager.service
79 Sleep 10s reason=Wait for BMC dump service to restart properly
80
81 ${dump_entries_after}= redfish_utils.get_member_list /redfish/v1/Managers/bmc/LogServices/Dump/Entries
82 Lists Should Be Equal ${dump_entries_before} ${dump_entries_after}
83
84
85Verify Dump Persistency On BMC Reset
86 [Documentation] Create user dump, reset BMC and verify dump persistency.
87 [Tags] Verify_Dump_Persistency_On_BMC_Reset
88
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -050089 Create User Initiated BMC Dump Via Redfish
Rahul Maheshwari2568f872020-09-23 01:03:39 -050090 ${dump_entries_before}= redfish_utils.get_member_list /redfish/v1/Managers/bmc/LogServices/Dump/Entries
91
92 # Reset BMC.
George Keishing88ec2802021-08-04 03:04:22 -050093 OBMC Reboot (off) stack_mode=skip
Rahul Maheshwari2568f872020-09-23 01:03:39 -050094
95 ${dump_entries_after}= redfish_utils.get_member_list /redfish/v1/Managers/bmc/LogServices/Dump/Entries
96 Lists Should Be Equal ${dump_entries_before} ${dump_entries_after}
97
98
Rahul Maheshwari95cbceb2020-10-21 23:25:08 -050099Delete User Initiated BMC Dump And Verify
100 [Documentation] Delete user initiated BMC dump and verify.
101 [Tags] Delete_User_Initiated_BMC_Dump_And_Verify
102
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500103 ${dump_id}= Create User Initiated BMC Dump Via Redfish
Rahul Maheshwari95cbceb2020-10-21 23:25:08 -0500104 Redfish Delete BMC Dump ${dump_id}
105
106 ${dump_entries}= Get BMC Dump Entries
107 Should Be Empty ${dump_entries}
108
109
110Delete All User Initiated BMC Dumps And Verify
111 [Documentation] Delete all user initiated BMC dumps and verify.
112 [Tags] Delete_All_User_Initiated_BMC_Dumps_And_Verify
113
114 # Create some BMC dump.
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500115 Create User Initiated BMC Dump Via Redfish
116 Create User Initiated BMC Dump Via Redfish
Rahul Maheshwari95cbceb2020-10-21 23:25:08 -0500117
118 Redfish Delete All BMC Dumps
119 ${dump_entries}= Get BMC Dump Entries
120 Should Be Empty ${dump_entries}
121
122
Rahul Maheshwari4f338ab2020-10-21 23:28:40 -0500123Create Two User Initiated BMC Dumps
124 [Documentation] Create two user initiated BMC dumps.
125 [Tags] Create_Two_User_Initiated_BMC_Dumps
126
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500127 ${dump_id1}= Create User Initiated BMC Dump Via Redfish
128 ${dump_id2}= Create User Initiated BMC Dump Via Redfish
Rahul Maheshwari4f338ab2020-10-21 23:28:40 -0500129
130 ${dump_entries}= Get BMC Dump Entries
131 Length Should Be ${dump_entries} 2
132 Should Contain ${dump_entries} ${dump_id1}
133 Should Contain ${dump_entries} ${dump_id2}
134
135
136Create Two User Initiated BMC Dumps And Delete One
137 [Documentation] Create two dumps and delete the first.
138 [Tags] Create_Two_User_Initiated_BMC_Dumps_And_Delete_One
139
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500140 ${dump_id1}= Create User Initiated BMC Dump Via Redfish
141 ${dump_id2}= Create User Initiated BMC Dump Via Redfish
Rahul Maheshwari4f338ab2020-10-21 23:28:40 -0500142
143 Redfish Delete BMC Dump ${dump_id1}
144
145 ${dump_entries}= Get BMC Dump Entries
146 Length Should Be ${dump_entries} 1
147 List Should Contain Value ${dump_entries} ${dump_id2}
148
149
150Create And Delete User Initiated BMC Dump Multiple Times
151 [Documentation] Create and delete user initiated BMC dump multiple times.
152 [Tags] Create_And_Delete_User_Initiated_BMC_Dump_Multiple_Times
153
154 FOR ${INDEX} IN 1 10
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500155 ${dump_id}= Create User Initiated BMC Dump Via Redfish
Rahul Maheshwari4f338ab2020-10-21 23:28:40 -0500156 Redfish Delete BMC Dump ${dump_id}
157 END
158
159
Rahul Maheshwarid709c8d2020-11-01 23:03:51 -0600160Verify Maximum BMC Dump Creation
161 [Documentation] Create maximum BMC dump and verify error when dump runs out of space.
162 [Tags] Verify_Maximum_BMC_Dump_Creation
163 [Teardown] Redfish Delete All BMC Dumps
164
165 # Maximum allowed space for dump is 1024 KB. BMC typically hold 8-14 dumps
166 # before running out of this dump space. So trying to create dumps in 20
167 # iterations to run out of space.
168
169 FOR ${n} IN RANGE 0 20
Rahul Maheshwaribd38aa42021-08-04 01:24:39 -0500170 Create User Initiated BMC Dump Via Redfish
Rahul Maheshwarid709c8d2020-11-01 23:03:51 -0600171 ${dump_space}= Get Disk Usage For Dumps
Tim Leede2d1302021-06-18 01:24:11 +0800172 Exit For Loop If ${dump_space} >= (${BMC_DUMP_TOTAL_SIZE} - ${BMC_DUMP_MIN_SPACE_REQD})
Rahul Maheshwarid709c8d2020-11-01 23:03:51 -0600173 END
174
175 # Check error while creating dump when dump size is full.
176 ${payload}= Create Dictionary DiagnosticDataType=Manager
177 Redfish.Post /redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.CollectDiagnosticData
178 ... body=${payload} valid_status_codes=[${HTTP_INTERNAL_SERVER_ERROR}]
179
180
Rahul Maheshwari2568f872020-09-23 01:03:39 -0500181*** Keywords ***
182
Rahul Maheshwaribcefdf22020-10-16 07:51:34 -0500183Get BMC Dump Entries
184 [Documentation] Return BMC dump ids list.
185
186 ${dump_uris}= redfish_utils.get_member_list /redfish/v1/Managers/bmc/LogServices/Dump/Entries
187 ${dump_ids}= Create List
188
189 FOR ${dump_uri} IN @{dump_uris}
190 ${dump_id}= Fetch From Right ${dump_uri} /
191 Append To List ${dump_ids} ${dump_id}
192 END
193
194 [Return] ${dump_ids}
195
196
Rahul Maheshwarid709c8d2020-11-01 23:03:51 -0600197Get Disk Usage For Dumps
198 [Documentation] Return disk usage in kilobyte for BMC dumps.
199
200 ${usage_output} ${stderr} ${rc}= BMC Execute Command du -s /var/lib/phosphor-debug-collector/dumps
201
202 # Example of output from above BMC cli command.
203 # $ du -s /var/lib/phosphor-debug-collector/dumps
204 # 516 /var/lib/phosphor-debug-collector/dumps
205
206 ${usage_output}= Fetch From Left ${usage_output} /
207 ${usage_output}= Convert To Integer ${usage_output}
208
209 [return] ${usage_output}
210
211
Rahul Maheshwari2568f872020-09-23 01:03:39 -0500212Test Teardown Execution
213 [Documentation] Do test teardown operation.
214
215 FFDC On Test Case Fail
216 Close All Connections