Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | |
| 3 | Documentation Test BMC dump functionality of OpenBMC. |
| 4 | |
George Keishing | 88ec280 | 2021-08-04 03:04:22 -0500 | [diff] [blame] | 5 | Resource ../../lib/bmc_redfish_resource.robot |
| 6 | Resource ../../lib/boot_utils.robot |
Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 7 | Resource ../../lib/dump_utils.robot |
George Keishing | 88ec280 | 2021-08-04 03:04:22 -0500 | [diff] [blame] | 8 | Resource ../../lib/openbmc_ffdc.robot |
Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 9 | |
George Keishing | f514ccb | 2021-02-02 23:55:56 -0600 | [diff] [blame] | 10 | Suite Setup Redfish.Login |
Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 11 | Test Setup Redfish Delete All BMC Dumps |
| 12 | Test Teardown Test Teardown Execution |
| 13 | |
Tim Lee | de2d130 | 2021-06-18 01:24:11 +0800 | [diff] [blame] | 14 | *** 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} |
manashsarma | bd346b3 | 2022-07-20 06:22:58 -0500 | [diff] [blame] | 21 | ${MAX_DUMP_COUNT} ${20} |
manashsarma | 395f880 | 2022-11-17 03:09:02 -0600 | [diff] [blame] | 22 | ${BMC_DUMP_COLLECTOR_PATH} /var/lib/phosphor-debug-collector/dumps |
Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 23 | |
| 24 | *** Test Cases *** |
| 25 | |
manashsarma | 4b5b1fa | 2022-11-16 02:36:58 -0600 | [diff] [blame] | 26 | Verify Error Response For Already Deleted Dump Id |
| 27 | [Documentation] Delete non existing BMC dump and expect an error. |
| 28 | [Tags] Verify_Error_Response_For_Already_Deleted_Dump_Id |
| 29 | |
| 30 | ${dump_id}= Create User Initiated BMC Dump Via Redfish |
| 31 | Redfish Delete BMC Dump ${dump_id} |
| 32 | Run Keyword And Expect Error ValueError: * Redfish Delete BMC Dump ${dump_id} |
| 33 | |
| 34 | |
Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 35 | Verify User Initiated BMC Dump When Host Powered Off |
| 36 | [Documentation] Create user initiated BMC dump at host off state and |
| 37 | ... verify dump entry for it. |
| 38 | [Tags] Verify_User_Initiated_BMC_Dump_When_Host_Powered_Off |
| 39 | |
| 40 | Redfish Power Off stack_mode=skip |
Rahul Maheshwari | bd38aa4 | 2021-08-04 01:24:39 -0500 | [diff] [blame] | 41 | ${dump_id}= Create User Initiated BMC Dump Via Redfish |
Rahul Maheshwari | bcefdf2 | 2020-10-16 07:51:34 -0500 | [diff] [blame] | 42 | ${dump_entries}= Get BMC Dump Entries |
Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 43 | Length Should Be ${dump_entries} 1 |
| 44 | List Should Contain Value ${dump_entries} ${dump_id} |
| 45 | |
Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 46 | |
Rahul Maheshwari | e8e9d0c | 2020-10-30 02:39:01 -0500 | [diff] [blame] | 47 | Verify User Initiated BMC Dump Size |
manashsarma | 7831dc2 | 2022-03-08 01:49:36 -0600 | [diff] [blame] | 48 | [Documentation] Verify user initiated BMC dump size is under 20 MB. |
Rahul Maheshwari | e8e9d0c | 2020-10-30 02:39:01 -0500 | [diff] [blame] | 49 | [Tags] Verify_User_Initiated_BMC_Dump_Size |
| 50 | |
Rahul Maheshwari | bd38aa4 | 2021-08-04 01:24:39 -0500 | [diff] [blame] | 51 | ${dump_id}= Create User Initiated BMC Dump Via Redfish |
Rahul Maheshwari | e8e9d0c | 2020-10-30 02:39:01 -0500 | [diff] [blame] | 52 | ${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 | |
manashsarma | 7831dc2 | 2022-03-08 01:49:36 -0600 | [diff] [blame] | 64 | # Max size for dump is 20 MB = 20x1024x1024 Byte. |
| 65 | Should Be True 0 < ${resp["AdditionalDataSizeBytes"]} < 20971520 |
Rahul Maheshwari | e8e9d0c | 2020-10-30 02:39:01 -0500 | [diff] [blame] | 66 | |
| 67 | |
manashsarma | bbc68bc | 2022-12-05 09:55:17 -0600 | [diff] [blame] | 68 | Verify Multiple BMC Dump Creation |
| 69 | [Documentation] Verify that multiple BMC dumps can be created one after |
| 70 | ... another successfully. |
| 71 | [Tags] Verify_Multiple_BMC_Dump_Creation |
| 72 | |
| 73 | ${dump_count}= Evaluate random.randint(5, 10) modules=random |
| 74 | FOR ${INDEX} IN 1 ${dump_count} |
| 75 | Create User Initiated BMC Dump Via Redfish |
| 76 | END |
| 77 | |
| 78 | |
manashsarma | 395f880 | 2022-11-17 03:09:02 -0600 | [diff] [blame] | 79 | Verify BMC Dump Default Location In BMC |
| 80 | [Documentation] Verify that BMC dump is created in its default location of BMC. |
| 81 | [Tags] Verify_BMC_Dump_In_Default_Folder |
| 82 | |
| 83 | Redfish Delete All BMC Dumps |
| 84 | ${dump_id}= Create User Initiated BMC Dump Via Redfish |
| 85 | ${dump_file} ${stderr} ${rc}= BMC Execute Command |
| 86 | ... ls ${BMC_DUMP_COLLECTOR_PATH}/${dump_id} |
| 87 | Should Be True ${rc} == 0 |
George Keishing | 952bb0f | 2022-12-12 03:13:35 -0600 | [diff] [blame] | 88 | Should Start With ${dump_file} BMCDUMP |
manashsarma | 395f880 | 2022-11-17 03:09:02 -0600 | [diff] [blame] | 89 | |
| 90 | |
George Keishing | 3d85098 | 2022-07-19 11:03:03 -0500 | [diff] [blame] | 91 | Verify User Initiated BMC Dump When Host Booted |
| 92 | [Documentation] Create user initiated BMC dump at host booted state and |
| 93 | ... verify dump entry for it. |
| 94 | [Tags] Verify_User_Initiated_BMC_Dump_When_Host_Booted |
| 95 | |
| 96 | Redfish Power On stack_mode=skip |
| 97 | ${dump_id}= Create User Initiated BMC Dump Via Redfish |
| 98 | ${dump_entries}= Get BMC Dump Entries |
| 99 | Length Should Be ${dump_entries} 1 |
| 100 | List Should Contain Value ${dump_entries} ${dump_id} |
| 101 | |
| 102 | |
Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 103 | Verify Dump Persistency On Dump Service Restart |
| 104 | [Documentation] Create user dump, restart dump manager service and verify dump |
| 105 | ... persistency. |
| 106 | [Tags] Verify_Dump_Persistency_On_Dump_Service_Restart |
| 107 | |
Rahul Maheshwari | bd38aa4 | 2021-08-04 01:24:39 -0500 | [diff] [blame] | 108 | Create User Initiated BMC Dump Via Redfish |
Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 109 | ${dump_entries_before}= redfish_utils.get_member_list /redfish/v1/Managers/bmc/LogServices/Dump/Entries |
| 110 | |
| 111 | # Restart dump service. |
| 112 | BMC Execute Command systemctl restart xyz.openbmc_project.Dump.Manager.service |
| 113 | Sleep 10s reason=Wait for BMC dump service to restart properly |
| 114 | |
| 115 | ${dump_entries_after}= redfish_utils.get_member_list /redfish/v1/Managers/bmc/LogServices/Dump/Entries |
| 116 | Lists Should Be Equal ${dump_entries_before} ${dump_entries_after} |
| 117 | |
| 118 | |
| 119 | Verify Dump Persistency On BMC Reset |
| 120 | [Documentation] Create user dump, reset BMC and verify dump persistency. |
| 121 | [Tags] Verify_Dump_Persistency_On_BMC_Reset |
| 122 | |
manashsarma | 8fa9c89 | 2022-10-03 06:20:58 -0500 | [diff] [blame] | 123 | # Power off host so that dump is not offloaded to host OS. |
| 124 | Redfish Power Off stack_mode=skip |
| 125 | |
Rahul Maheshwari | bd38aa4 | 2021-08-04 01:24:39 -0500 | [diff] [blame] | 126 | Create User Initiated BMC Dump Via Redfish |
Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 127 | ${dump_entries_before}= redfish_utils.get_member_list /redfish/v1/Managers/bmc/LogServices/Dump/Entries |
| 128 | |
| 129 | # Reset BMC. |
George Keishing | 88ec280 | 2021-08-04 03:04:22 -0500 | [diff] [blame] | 130 | OBMC Reboot (off) stack_mode=skip |
Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 131 | |
| 132 | ${dump_entries_after}= redfish_utils.get_member_list /redfish/v1/Managers/bmc/LogServices/Dump/Entries |
| 133 | Lists Should Be Equal ${dump_entries_before} ${dump_entries_after} |
| 134 | |
| 135 | |
Rahul Maheshwari | 95cbceb | 2020-10-21 23:25:08 -0500 | [diff] [blame] | 136 | Delete User Initiated BMC Dump And Verify |
| 137 | [Documentation] Delete user initiated BMC dump and verify. |
| 138 | [Tags] Delete_User_Initiated_BMC_Dump_And_Verify |
| 139 | |
Rahul Maheshwari | bd38aa4 | 2021-08-04 01:24:39 -0500 | [diff] [blame] | 140 | ${dump_id}= Create User Initiated BMC Dump Via Redfish |
Rahul Maheshwari | 95cbceb | 2020-10-21 23:25:08 -0500 | [diff] [blame] | 141 | Redfish Delete BMC Dump ${dump_id} |
| 142 | |
| 143 | ${dump_entries}= Get BMC Dump Entries |
| 144 | Should Be Empty ${dump_entries} |
| 145 | |
| 146 | |
| 147 | Delete All User Initiated BMC Dumps And Verify |
| 148 | [Documentation] Delete all user initiated BMC dumps and verify. |
| 149 | [Tags] Delete_All_User_Initiated_BMC_Dumps_And_Verify |
| 150 | |
manashsarma | 70d840e | 2022-10-18 02:34:45 -0500 | [diff] [blame] | 151 | # Power off host so that dump is not offloaded to host OS. |
| 152 | Redfish Power Off stack_mode=skip |
| 153 | |
Rahul Maheshwari | 95cbceb | 2020-10-21 23:25:08 -0500 | [diff] [blame] | 154 | # Create some BMC dump. |
Rahul Maheshwari | bd38aa4 | 2021-08-04 01:24:39 -0500 | [diff] [blame] | 155 | Create User Initiated BMC Dump Via Redfish |
| 156 | Create User Initiated BMC Dump Via Redfish |
Rahul Maheshwari | 95cbceb | 2020-10-21 23:25:08 -0500 | [diff] [blame] | 157 | |
| 158 | Redfish Delete All BMC Dumps |
| 159 | ${dump_entries}= Get BMC Dump Entries |
| 160 | Should Be Empty ${dump_entries} |
| 161 | |
| 162 | |
Rahul Maheshwari | 4f338ab | 2020-10-21 23:28:40 -0500 | [diff] [blame] | 163 | Create Two User Initiated BMC Dumps |
| 164 | [Documentation] Create two user initiated BMC dumps. |
| 165 | [Tags] Create_Two_User_Initiated_BMC_Dumps |
| 166 | |
Rahul Maheshwari | bd38aa4 | 2021-08-04 01:24:39 -0500 | [diff] [blame] | 167 | ${dump_id1}= Create User Initiated BMC Dump Via Redfish |
| 168 | ${dump_id2}= Create User Initiated BMC Dump Via Redfish |
Rahul Maheshwari | 4f338ab | 2020-10-21 23:28:40 -0500 | [diff] [blame] | 169 | |
| 170 | ${dump_entries}= Get BMC Dump Entries |
| 171 | Length Should Be ${dump_entries} 2 |
| 172 | Should Contain ${dump_entries} ${dump_id1} |
| 173 | Should Contain ${dump_entries} ${dump_id2} |
| 174 | |
| 175 | |
| 176 | Create Two User Initiated BMC Dumps And Delete One |
| 177 | [Documentation] Create two dumps and delete the first. |
| 178 | [Tags] Create_Two_User_Initiated_BMC_Dumps_And_Delete_One |
| 179 | |
Rahul Maheshwari | bd38aa4 | 2021-08-04 01:24:39 -0500 | [diff] [blame] | 180 | ${dump_id1}= Create User Initiated BMC Dump Via Redfish |
| 181 | ${dump_id2}= Create User Initiated BMC Dump Via Redfish |
Rahul Maheshwari | 4f338ab | 2020-10-21 23:28:40 -0500 | [diff] [blame] | 182 | |
| 183 | Redfish Delete BMC Dump ${dump_id1} |
| 184 | |
| 185 | ${dump_entries}= Get BMC Dump Entries |
| 186 | Length Should Be ${dump_entries} 1 |
| 187 | List Should Contain Value ${dump_entries} ${dump_id2} |
| 188 | |
| 189 | |
| 190 | Create And Delete User Initiated BMC Dump Multiple Times |
| 191 | [Documentation] Create and delete user initiated BMC dump multiple times. |
| 192 | [Tags] Create_And_Delete_User_Initiated_BMC_Dump_Multiple_Times |
| 193 | |
| 194 | FOR ${INDEX} IN 1 10 |
Rahul Maheshwari | bd38aa4 | 2021-08-04 01:24:39 -0500 | [diff] [blame] | 195 | ${dump_id}= Create User Initiated BMC Dump Via Redfish |
Rahul Maheshwari | 4f338ab | 2020-10-21 23:28:40 -0500 | [diff] [blame] | 196 | Redfish Delete BMC Dump ${dump_id} |
| 197 | END |
| 198 | |
| 199 | |
Rahul Maheshwari | d709c8d | 2020-11-01 23:03:51 -0600 | [diff] [blame] | 200 | Verify Maximum BMC Dump Creation |
| 201 | [Documentation] Create maximum BMC dump and verify error when dump runs out of space. |
| 202 | [Tags] Verify_Maximum_BMC_Dump_Creation |
| 203 | [Teardown] Redfish Delete All BMC Dumps |
| 204 | |
| 205 | # Maximum allowed space for dump is 1024 KB. BMC typically hold 8-14 dumps |
| 206 | # before running out of this dump space. So trying to create dumps in 20 |
| 207 | # iterations to run out of space. |
manashsarma | bd346b3 | 2022-07-20 06:22:58 -0500 | [diff] [blame] | 208 | # User can key in the Maximum allowed space for bmc dump and how many iteration. |
| 209 | FOR ${n} IN RANGE 0 ${MAX_DUMP_COUNT} |
Rahul Maheshwari | bd38aa4 | 2021-08-04 01:24:39 -0500 | [diff] [blame] | 210 | Create User Initiated BMC Dump Via Redfish |
Rahul Maheshwari | d709c8d | 2020-11-01 23:03:51 -0600 | [diff] [blame] | 211 | ${dump_space}= Get Disk Usage For Dumps |
Tim Lee | de2d130 | 2021-06-18 01:24:11 +0800 | [diff] [blame] | 212 | Exit For Loop If ${dump_space} >= (${BMC_DUMP_TOTAL_SIZE} - ${BMC_DUMP_MIN_SPACE_REQD}) |
Rahul Maheshwari | d709c8d | 2020-11-01 23:03:51 -0600 | [diff] [blame] | 213 | END |
| 214 | |
| 215 | # Check error while creating dump when dump size is full. |
| 216 | ${payload}= Create Dictionary DiagnosticDataType=Manager |
| 217 | Redfish.Post /redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.CollectDiagnosticData |
| 218 | ... body=${payload} valid_status_codes=[${HTTP_INTERNAL_SERVER_ERROR}] |
| 219 | |
| 220 | |
manashsarma | 633cac9 | 2022-11-25 03:27:03 -0600 | [diff] [blame] | 221 | Verify BMC Core Dump When Host Powered Off |
| 222 | [Documentation] Verify BMC core dump after application crash at host powered off state. |
| 223 | [Tags] Verify_BMC_Core_Dump_When_Host_Powered_Off |
| 224 | |
| 225 | Redfish Power Off stack_mode=skip |
| 226 | |
| 227 | # Ensure all dumps are cleaned out. |
| 228 | Redfish Delete All BMC Dumps |
| 229 | Trigger Core Dump |
| 230 | |
| 231 | # Verify that BMC dump is available. |
| 232 | Wait Until Keyword Succeeds 2 min 10 sec Is BMC Dump Available |
| 233 | |
| 234 | |
manashsarma | 849189c | 2022-11-28 04:16:51 -0600 | [diff] [blame] | 235 | Verify Core Dump Size |
| 236 | [Documentation] Verify BMC core dump size is under 20 MB. |
| 237 | [Tags] Verify_Core_Dump_Size |
| 238 | |
| 239 | Redfish Power Off stack_mode=skip |
| 240 | |
| 241 | # Ensure all dumps are cleaned out. |
| 242 | Redfish Delete All BMC Dumps |
| 243 | Trigger Core Dump |
| 244 | |
| 245 | # Verify that BMC dump is available. |
| 246 | Wait Until Keyword Succeeds 2 min 10 sec Is BMC Dump Available |
| 247 | ${dump_entries}= Get BMC Dump Entries |
| 248 | ${resp}= Redfish.Get Properties |
| 249 | ... /redfish/v1/Managers/bmc/LogServices/Dump/Entries/${dump_entries[0]} |
| 250 | |
| 251 | # Max size for dump is 20 MB = 20x1024x1024 Byte. |
| 252 | Should Be True 0 < ${resp["AdditionalDataSizeBytes"]} < 20971520 |
| 253 | |
| 254 | |
manashsarma | fcbfdf6 | 2022-12-07 06:36:28 -0600 | [diff] [blame] | 255 | Verify Error While Initiating BMC Dump During Dumping State |
| 256 | [Documentation] Verify error while initiating BMC dump during dumping state. |
| 257 | [Tags] Verify_Error_While_Initiating_BMC_Dump_During_Dumping_State |
| 258 | |
George Keishing | 8a68d45 | 2022-12-09 07:25:35 -0600 | [diff] [blame] | 259 | Create User Initiated BMC Dump Via Redfish ${1} |
manashsarma | fcbfdf6 | 2022-12-07 06:36:28 -0600 | [diff] [blame] | 260 | |
| 261 | # Check error while initiating BMC dump while dump in progress. |
| 262 | ${payload}= Create Dictionary DiagnosticDataType=Manager |
| 263 | Redfish.Post |
| 264 | ... /redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.CollectDiagnosticData |
| 265 | ... body=${payload} valid_status_codes=[${HTTP_SERVICE_UNAVAILABLE}] |
| 266 | |
| 267 | |
Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 268 | *** Keywords *** |
| 269 | |
Rahul Maheshwari | bcefdf2 | 2020-10-16 07:51:34 -0500 | [diff] [blame] | 270 | Get BMC Dump Entries |
| 271 | [Documentation] Return BMC dump ids list. |
| 272 | |
| 273 | ${dump_uris}= redfish_utils.get_member_list /redfish/v1/Managers/bmc/LogServices/Dump/Entries |
| 274 | ${dump_ids}= Create List |
| 275 | |
| 276 | FOR ${dump_uri} IN @{dump_uris} |
| 277 | ${dump_id}= Fetch From Right ${dump_uri} / |
| 278 | Append To List ${dump_ids} ${dump_id} |
| 279 | END |
| 280 | |
| 281 | [Return] ${dump_ids} |
| 282 | |
| 283 | |
manashsarma | 633cac9 | 2022-11-25 03:27:03 -0600 | [diff] [blame] | 284 | Is BMC Dump Available |
| 285 | [Documentation] Verify if BMC dump is available. |
| 286 | |
| 287 | ${dump_entries}= Get BMC Dump Entries |
| 288 | |
| 289 | # Verifying that BMC dump is available. |
| 290 | ${length}= Get length ${dump_entries} |
| 291 | Should Be True 0 < ${length} |
| 292 | |
| 293 | |
Rahul Maheshwari | d709c8d | 2020-11-01 23:03:51 -0600 | [diff] [blame] | 294 | Get Disk Usage For Dumps |
| 295 | [Documentation] Return disk usage in kilobyte for BMC dumps. |
| 296 | |
George Keishing | 952bb0f | 2022-12-12 03:13:35 -0600 | [diff] [blame] | 297 | ${usage_output} ${stderr} ${rc}= BMC Execute Command du -s ${BMC_DUMP_COLLECTOR_PATH} |
Rahul Maheshwari | d709c8d | 2020-11-01 23:03:51 -0600 | [diff] [blame] | 298 | |
| 299 | # Example of output from above BMC cli command. |
| 300 | # $ du -s /var/lib/phosphor-debug-collector/dumps |
| 301 | # 516 /var/lib/phosphor-debug-collector/dumps |
| 302 | |
| 303 | ${usage_output}= Fetch From Left ${usage_output} / |
| 304 | ${usage_output}= Convert To Integer ${usage_output} |
| 305 | |
| 306 | [return] ${usage_output} |
| 307 | |
| 308 | |
Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 309 | Test Teardown Execution |
| 310 | [Documentation] Do test teardown operation. |
| 311 | |
| 312 | FFDC On Test Case Fail |
| 313 | Close All Connections |