| 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 |  | 
|  | 25 | Verify 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 Maheshwari | bd38aa4 | 2021-08-04 01:24:39 -0500 | [diff] [blame] | 31 | ${dump_id}=  Create User Initiated BMC Dump Via Redfish | 
| Rahul Maheshwari | bcefdf2 | 2020-10-16 07:51:34 -0500 | [diff] [blame] | 32 | ${dump_entries}=  Get BMC Dump Entries | 
| Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 33 | Length Should Be  ${dump_entries}  1 | 
|  | 34 | List Should Contain Value  ${dump_entries}  ${dump_id} | 
|  | 35 |  | 
| Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 36 |  | 
| Rahul Maheshwari | e8e9d0c | 2020-10-30 02:39:01 -0500 | [diff] [blame] | 37 | Verify User Initiated BMC Dump Size | 
| manashsarma | 7831dc2 | 2022-03-08 01:49:36 -0600 | [diff] [blame] | 38 | [Documentation]  Verify user initiated BMC dump size is under 20 MB. | 
| Rahul Maheshwari | e8e9d0c | 2020-10-30 02:39:01 -0500 | [diff] [blame] | 39 | [Tags]  Verify_User_Initiated_BMC_Dump_Size | 
|  | 40 |  | 
| Rahul Maheshwari | bd38aa4 | 2021-08-04 01:24:39 -0500 | [diff] [blame] | 41 | ${dump_id}=  Create User Initiated BMC Dump Via Redfish | 
| Rahul Maheshwari | e8e9d0c | 2020-10-30 02:39:01 -0500 | [diff] [blame] | 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 |  | 
| manashsarma | 7831dc2 | 2022-03-08 01:49:36 -0600 | [diff] [blame] | 54 | # Max size for dump is 20 MB = 20x1024x1024 Byte. | 
|  | 55 | Should Be True  0 < ${resp["AdditionalDataSizeBytes"]} < 20971520 | 
| Rahul Maheshwari | e8e9d0c | 2020-10-30 02:39:01 -0500 | [diff] [blame] | 56 |  | 
|  | 57 |  | 
| George Keishing | 3d85098 | 2022-07-19 11:03:03 -0500 | [diff] [blame] | 58 | Verify 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 Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 70 | Verify 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 Maheshwari | bd38aa4 | 2021-08-04 01:24:39 -0500 | [diff] [blame] | 75 | Create User Initiated BMC Dump Via Redfish | 
| Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 76 | ${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 |  | 
|  | 86 | Verify 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 |  | 
| manashsarma | 8fa9c89 | 2022-10-03 06:20:58 -0500 | [diff] [blame] | 90 | # Power off host so that dump is not offloaded to host OS. | 
|  | 91 | Redfish Power Off  stack_mode=skip | 
|  | 92 |  | 
| Rahul Maheshwari | bd38aa4 | 2021-08-04 01:24:39 -0500 | [diff] [blame] | 93 | Create User Initiated BMC Dump Via Redfish | 
| Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 94 | ${dump_entries_before}=  redfish_utils.get_member_list  /redfish/v1/Managers/bmc/LogServices/Dump/Entries | 
|  | 95 |  | 
|  | 96 | # Reset BMC. | 
| George Keishing | 88ec280 | 2021-08-04 03:04:22 -0500 | [diff] [blame] | 97 | OBMC Reboot (off)  stack_mode=skip | 
| Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 98 |  | 
|  | 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 Maheshwari | 95cbceb | 2020-10-21 23:25:08 -0500 | [diff] [blame] | 103 | Delete 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 Maheshwari | bd38aa4 | 2021-08-04 01:24:39 -0500 | [diff] [blame] | 107 | ${dump_id}=  Create User Initiated BMC Dump Via Redfish | 
| Rahul Maheshwari | 95cbceb | 2020-10-21 23:25:08 -0500 | [diff] [blame] | 108 | Redfish Delete BMC Dump  ${dump_id} | 
|  | 109 |  | 
|  | 110 | ${dump_entries}=  Get BMC Dump Entries | 
|  | 111 | Should Be Empty  ${dump_entries} | 
|  | 112 |  | 
|  | 113 |  | 
|  | 114 | Delete 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 |  | 
| manashsarma | 70d840e | 2022-10-18 02:34:45 -0500 | [diff] [blame] | 118 | # Power off host so that dump is not offloaded to host OS. | 
|  | 119 | Redfish Power Off  stack_mode=skip | 
|  | 120 |  | 
| Rahul Maheshwari | 95cbceb | 2020-10-21 23:25:08 -0500 | [diff] [blame] | 121 | # Create some BMC dump. | 
| Rahul Maheshwari | bd38aa4 | 2021-08-04 01:24:39 -0500 | [diff] [blame] | 122 | Create User Initiated BMC Dump Via Redfish | 
|  | 123 | Create User Initiated BMC Dump Via Redfish | 
| Rahul Maheshwari | 95cbceb | 2020-10-21 23:25:08 -0500 | [diff] [blame] | 124 |  | 
|  | 125 | Redfish Delete All BMC Dumps | 
|  | 126 | ${dump_entries}=  Get BMC Dump Entries | 
|  | 127 | Should Be Empty  ${dump_entries} | 
|  | 128 |  | 
|  | 129 |  | 
| Rahul Maheshwari | 4f338ab | 2020-10-21 23:28:40 -0500 | [diff] [blame] | 130 | Create Two User Initiated BMC Dumps | 
|  | 131 | [Documentation]  Create two user initiated BMC dumps. | 
|  | 132 | [Tags]  Create_Two_User_Initiated_BMC_Dumps | 
|  | 133 |  | 
| Rahul Maheshwari | bd38aa4 | 2021-08-04 01:24:39 -0500 | [diff] [blame] | 134 | ${dump_id1}=  Create User Initiated BMC Dump Via Redfish | 
|  | 135 | ${dump_id2}=  Create User Initiated BMC Dump Via Redfish | 
| Rahul Maheshwari | 4f338ab | 2020-10-21 23:28:40 -0500 | [diff] [blame] | 136 |  | 
|  | 137 | ${dump_entries}=  Get BMC Dump Entries | 
|  | 138 | Length Should Be  ${dump_entries}  2 | 
|  | 139 | Should Contain  ${dump_entries}  ${dump_id1} | 
|  | 140 | Should Contain  ${dump_entries}  ${dump_id2} | 
|  | 141 |  | 
|  | 142 |  | 
|  | 143 | Create Two User Initiated BMC Dumps And Delete One | 
|  | 144 | [Documentation]  Create two dumps and delete the first. | 
|  | 145 | [Tags]  Create_Two_User_Initiated_BMC_Dumps_And_Delete_One | 
|  | 146 |  | 
| Rahul Maheshwari | bd38aa4 | 2021-08-04 01:24:39 -0500 | [diff] [blame] | 147 | ${dump_id1}=  Create User Initiated BMC Dump Via Redfish | 
|  | 148 | ${dump_id2}=  Create User Initiated BMC Dump Via Redfish | 
| Rahul Maheshwari | 4f338ab | 2020-10-21 23:28:40 -0500 | [diff] [blame] | 149 |  | 
|  | 150 | Redfish Delete BMC Dump  ${dump_id1} | 
|  | 151 |  | 
|  | 152 | ${dump_entries}=  Get BMC Dump Entries | 
|  | 153 | Length Should Be  ${dump_entries}  1 | 
|  | 154 | List Should Contain Value  ${dump_entries}  ${dump_id2} | 
|  | 155 |  | 
|  | 156 |  | 
|  | 157 | Create And Delete User Initiated BMC Dump Multiple Times | 
|  | 158 | [Documentation]  Create and delete user initiated BMC dump multiple times. | 
|  | 159 | [Tags]  Create_And_Delete_User_Initiated_BMC_Dump_Multiple_Times | 
|  | 160 |  | 
|  | 161 | FOR  ${INDEX}  IN  1  10 | 
| Rahul Maheshwari | bd38aa4 | 2021-08-04 01:24:39 -0500 | [diff] [blame] | 162 | ${dump_id}=  Create User Initiated BMC Dump Via Redfish | 
| Rahul Maheshwari | 4f338ab | 2020-10-21 23:28:40 -0500 | [diff] [blame] | 163 | Redfish Delete BMC Dump  ${dump_id} | 
|  | 164 | END | 
|  | 165 |  | 
|  | 166 |  | 
| Rahul Maheshwari | d709c8d | 2020-11-01 23:03:51 -0600 | [diff] [blame] | 167 | Verify Maximum BMC Dump Creation | 
|  | 168 | [Documentation]  Create maximum BMC dump and verify error when dump runs out of space. | 
|  | 169 | [Tags]  Verify_Maximum_BMC_Dump_Creation | 
|  | 170 | [Teardown]  Redfish Delete All BMC Dumps | 
|  | 171 |  | 
|  | 172 | # Maximum allowed space for dump is 1024 KB. BMC typically hold 8-14 dumps | 
|  | 173 | # before running out of this dump space. So trying to create dumps in 20 | 
|  | 174 | # iterations to run out of space. | 
| manashsarma | bd346b3 | 2022-07-20 06:22:58 -0500 | [diff] [blame] | 175 | # User can key in the Maximum allowed space for bmc dump and how many iteration. | 
|  | 176 | FOR  ${n}  IN RANGE  0  ${MAX_DUMP_COUNT} | 
| Rahul Maheshwari | bd38aa4 | 2021-08-04 01:24:39 -0500 | [diff] [blame] | 177 | Create User Initiated BMC Dump Via Redfish | 
| Rahul Maheshwari | d709c8d | 2020-11-01 23:03:51 -0600 | [diff] [blame] | 178 | ${dump_space}=  Get Disk Usage For Dumps | 
| Tim Lee | de2d130 | 2021-06-18 01:24:11 +0800 | [diff] [blame] | 179 | 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] | 180 | END | 
|  | 181 |  | 
|  | 182 | # Check error while creating dump when dump size is full. | 
|  | 183 | ${payload}=  Create Dictionary  DiagnosticDataType=Manager | 
|  | 184 | Redfish.Post  /redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.CollectDiagnosticData | 
|  | 185 | ...  body=${payload}  valid_status_codes=[${HTTP_INTERNAL_SERVER_ERROR}] | 
|  | 186 |  | 
|  | 187 |  | 
| Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 188 | *** Keywords *** | 
|  | 189 |  | 
| Rahul Maheshwari | bcefdf2 | 2020-10-16 07:51:34 -0500 | [diff] [blame] | 190 | Get BMC Dump Entries | 
|  | 191 | [Documentation]  Return BMC dump ids list. | 
|  | 192 |  | 
|  | 193 | ${dump_uris}=  redfish_utils.get_member_list  /redfish/v1/Managers/bmc/LogServices/Dump/Entries | 
|  | 194 | ${dump_ids}=  Create List | 
|  | 195 |  | 
|  | 196 | FOR  ${dump_uri}  IN  @{dump_uris} | 
|  | 197 | ${dump_id}=  Fetch From Right  ${dump_uri}  / | 
|  | 198 | Append To List  ${dump_ids}  ${dump_id} | 
|  | 199 | END | 
|  | 200 |  | 
|  | 201 | [Return]  ${dump_ids} | 
|  | 202 |  | 
|  | 203 |  | 
| Rahul Maheshwari | d709c8d | 2020-11-01 23:03:51 -0600 | [diff] [blame] | 204 | Get Disk Usage For Dumps | 
|  | 205 | [Documentation]  Return disk usage in kilobyte for BMC dumps. | 
|  | 206 |  | 
|  | 207 | ${usage_output}  ${stderr}  ${rc}=  BMC Execute Command  du -s /var/lib/phosphor-debug-collector/dumps | 
|  | 208 |  | 
|  | 209 | # Example of output from above BMC cli command. | 
|  | 210 | # $ du -s /var/lib/phosphor-debug-collector/dumps | 
|  | 211 | # 516    /var/lib/phosphor-debug-collector/dumps | 
|  | 212 |  | 
|  | 213 | ${usage_output}=  Fetch From Left  ${usage_output}  / | 
|  | 214 | ${usage_output}=  Convert To Integer  ${usage_output} | 
|  | 215 |  | 
|  | 216 | [return]  ${usage_output} | 
|  | 217 |  | 
|  | 218 |  | 
| Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 219 | Test Teardown Execution | 
|  | 220 | [Documentation]  Do test teardown operation. | 
|  | 221 |  | 
|  | 222 | FFDC On Test Case Fail | 
|  | 223 | Close All Connections |