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