| 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} | 
| Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 21 |  | 
|  | 22 | *** Test Cases *** | 
|  | 23 |  | 
|  | 24 | Verify 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 Maheshwari | bd38aa4 | 2021-08-04 01:24:39 -0500 | [diff] [blame] | 30 | ${dump_id}=  Create User Initiated BMC Dump Via Redfish | 
| Rahul Maheshwari | bcefdf2 | 2020-10-16 07:51:34 -0500 | [diff] [blame] | 31 | ${dump_entries}=  Get BMC Dump Entries | 
| Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 32 | Length Should Be  ${dump_entries}  1 | 
|  | 33 | List Should Contain Value  ${dump_entries}  ${dump_id} | 
|  | 34 |  | 
| Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 35 | Verify User Initiated BMC Dump When Host Booted | 
|  | 36 | [Documentation]  Create user initiated BMC dump at host booted state and | 
|  | 37 | ...  verify dump entry for it. | 
|  | 38 | [Tags]  Verify_User_Initiated_BMC_Dump_When_Host_Booted | 
|  | 39 |  | 
|  | 40 | Redfish Power On  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 |  | 
|  | 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 |  | 
| Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 68 | Verify Dump Persistency On Dump Service Restart | 
|  | 69 | [Documentation]  Create user dump, restart dump manager service and verify dump | 
|  | 70 | ...  persistency. | 
|  | 71 | [Tags]  Verify_Dump_Persistency_On_Dump_Service_Restart | 
|  | 72 |  | 
| Rahul Maheshwari | bd38aa4 | 2021-08-04 01:24:39 -0500 | [diff] [blame] | 73 | Create User Initiated BMC Dump Via Redfish | 
| Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 74 | ${dump_entries_before}=  redfish_utils.get_member_list  /redfish/v1/Managers/bmc/LogServices/Dump/Entries | 
|  | 75 |  | 
|  | 76 | # Restart dump service. | 
|  | 77 | BMC Execute Command  systemctl restart xyz.openbmc_project.Dump.Manager.service | 
|  | 78 | Sleep  10s  reason=Wait for BMC dump service to restart properly | 
|  | 79 |  | 
|  | 80 | ${dump_entries_after}=  redfish_utils.get_member_list  /redfish/v1/Managers/bmc/LogServices/Dump/Entries | 
|  | 81 | Lists Should Be Equal  ${dump_entries_before}  ${dump_entries_after} | 
|  | 82 |  | 
|  | 83 |  | 
|  | 84 | Verify Dump Persistency On BMC Reset | 
|  | 85 | [Documentation]  Create user dump, reset BMC and verify dump persistency. | 
|  | 86 | [Tags]  Verify_Dump_Persistency_On_BMC_Reset | 
|  | 87 |  | 
| Rahul Maheshwari | bd38aa4 | 2021-08-04 01:24:39 -0500 | [diff] [blame] | 88 | Create User Initiated BMC Dump Via Redfish | 
| Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 89 | ${dump_entries_before}=  redfish_utils.get_member_list  /redfish/v1/Managers/bmc/LogServices/Dump/Entries | 
|  | 90 |  | 
|  | 91 | # Reset BMC. | 
| George Keishing | 88ec280 | 2021-08-04 03:04:22 -0500 | [diff] [blame] | 92 | OBMC Reboot (off)  stack_mode=skip | 
| Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 93 |  | 
|  | 94 | ${dump_entries_after}=  redfish_utils.get_member_list  /redfish/v1/Managers/bmc/LogServices/Dump/Entries | 
|  | 95 | Lists Should Be Equal  ${dump_entries_before}  ${dump_entries_after} | 
|  | 96 |  | 
|  | 97 |  | 
| Rahul Maheshwari | 95cbceb | 2020-10-21 23:25:08 -0500 | [diff] [blame] | 98 | Delete User Initiated BMC Dump And Verify | 
|  | 99 | [Documentation]  Delete user initiated BMC dump and verify. | 
|  | 100 | [Tags]  Delete_User_Initiated_BMC_Dump_And_Verify | 
|  | 101 |  | 
| Rahul Maheshwari | bd38aa4 | 2021-08-04 01:24:39 -0500 | [diff] [blame] | 102 | ${dump_id}=  Create User Initiated BMC Dump Via Redfish | 
| Rahul Maheshwari | 95cbceb | 2020-10-21 23:25:08 -0500 | [diff] [blame] | 103 | Redfish Delete BMC Dump  ${dump_id} | 
|  | 104 |  | 
|  | 105 | ${dump_entries}=  Get BMC Dump Entries | 
|  | 106 | Should Be Empty  ${dump_entries} | 
|  | 107 |  | 
|  | 108 |  | 
|  | 109 | Delete All User Initiated BMC Dumps And Verify | 
|  | 110 | [Documentation]  Delete all user initiated BMC dumps and verify. | 
|  | 111 | [Tags]  Delete_All_User_Initiated_BMC_Dumps_And_Verify | 
|  | 112 |  | 
|  | 113 | # Create some BMC dump. | 
| Rahul Maheshwari | bd38aa4 | 2021-08-04 01:24:39 -0500 | [diff] [blame] | 114 | Create User Initiated BMC Dump Via Redfish | 
|  | 115 | Create User Initiated BMC Dump Via Redfish | 
| Rahul Maheshwari | 95cbceb | 2020-10-21 23:25:08 -0500 | [diff] [blame] | 116 |  | 
|  | 117 | Redfish Delete All BMC Dumps | 
|  | 118 | ${dump_entries}=  Get BMC Dump Entries | 
|  | 119 | Should Be Empty  ${dump_entries} | 
|  | 120 |  | 
|  | 121 |  | 
| Rahul Maheshwari | 4f338ab | 2020-10-21 23:28:40 -0500 | [diff] [blame] | 122 | Create Two User Initiated BMC Dumps | 
|  | 123 | [Documentation]  Create two user initiated BMC dumps. | 
|  | 124 | [Tags]  Create_Two_User_Initiated_BMC_Dumps | 
|  | 125 |  | 
| Rahul Maheshwari | bd38aa4 | 2021-08-04 01:24:39 -0500 | [diff] [blame] | 126 | ${dump_id1}=  Create User Initiated BMC Dump Via Redfish | 
|  | 127 | ${dump_id2}=  Create User Initiated BMC Dump Via Redfish | 
| Rahul Maheshwari | 4f338ab | 2020-10-21 23:28:40 -0500 | [diff] [blame] | 128 |  | 
|  | 129 | ${dump_entries}=  Get BMC Dump Entries | 
|  | 130 | Length Should Be  ${dump_entries}  2 | 
|  | 131 | Should Contain  ${dump_entries}  ${dump_id1} | 
|  | 132 | Should Contain  ${dump_entries}  ${dump_id2} | 
|  | 133 |  | 
|  | 134 |  | 
|  | 135 | Create Two User Initiated BMC Dumps And Delete One | 
|  | 136 | [Documentation]  Create two dumps and delete the first. | 
|  | 137 | [Tags]  Create_Two_User_Initiated_BMC_Dumps_And_Delete_One | 
|  | 138 |  | 
| Rahul Maheshwari | bd38aa4 | 2021-08-04 01:24:39 -0500 | [diff] [blame] | 139 | ${dump_id1}=  Create User Initiated BMC Dump Via Redfish | 
|  | 140 | ${dump_id2}=  Create User Initiated BMC Dump Via Redfish | 
| Rahul Maheshwari | 4f338ab | 2020-10-21 23:28:40 -0500 | [diff] [blame] | 141 |  | 
|  | 142 | Redfish Delete BMC Dump  ${dump_id1} | 
|  | 143 |  | 
|  | 144 | ${dump_entries}=  Get BMC Dump Entries | 
|  | 145 | Length Should Be  ${dump_entries}  1 | 
|  | 146 | List Should Contain Value  ${dump_entries}  ${dump_id2} | 
|  | 147 |  | 
|  | 148 |  | 
|  | 149 | Create And Delete User Initiated BMC Dump Multiple Times | 
|  | 150 | [Documentation]  Create and delete user initiated BMC dump multiple times. | 
|  | 151 | [Tags]  Create_And_Delete_User_Initiated_BMC_Dump_Multiple_Times | 
|  | 152 |  | 
|  | 153 | FOR  ${INDEX}  IN  1  10 | 
| Rahul Maheshwari | bd38aa4 | 2021-08-04 01:24:39 -0500 | [diff] [blame] | 154 | ${dump_id}=  Create User Initiated BMC Dump Via Redfish | 
| Rahul Maheshwari | 4f338ab | 2020-10-21 23:28:40 -0500 | [diff] [blame] | 155 | Redfish Delete BMC Dump  ${dump_id} | 
|  | 156 | END | 
|  | 157 |  | 
|  | 158 |  | 
| Rahul Maheshwari | d709c8d | 2020-11-01 23:03:51 -0600 | [diff] [blame] | 159 | Verify Maximum BMC Dump Creation | 
|  | 160 | [Documentation]  Create maximum BMC dump and verify error when dump runs out of space. | 
|  | 161 | [Tags]  Verify_Maximum_BMC_Dump_Creation | 
|  | 162 | [Teardown]  Redfish Delete All BMC Dumps | 
|  | 163 |  | 
|  | 164 | # Maximum allowed space for dump is 1024 KB. BMC typically hold 8-14 dumps | 
|  | 165 | # before running out of this dump space. So trying to create dumps in 20 | 
|  | 166 | # iterations to run out of space. | 
|  | 167 |  | 
|  | 168 | FOR  ${n}  IN RANGE  0  20 | 
| Rahul Maheshwari | bd38aa4 | 2021-08-04 01:24:39 -0500 | [diff] [blame] | 169 | Create User Initiated BMC Dump Via Redfish | 
| Rahul Maheshwari | d709c8d | 2020-11-01 23:03:51 -0600 | [diff] [blame] | 170 | ${dump_space}=  Get Disk Usage For Dumps | 
| Tim Lee | de2d130 | 2021-06-18 01:24:11 +0800 | [diff] [blame] | 171 | 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] | 172 | END | 
|  | 173 |  | 
|  | 174 | # Check error while creating dump when dump size is full. | 
|  | 175 | ${payload}=  Create Dictionary  DiagnosticDataType=Manager | 
|  | 176 | Redfish.Post  /redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.CollectDiagnosticData | 
|  | 177 | ...  body=${payload}  valid_status_codes=[${HTTP_INTERNAL_SERVER_ERROR}] | 
|  | 178 |  | 
|  | 179 |  | 
| Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 180 | *** Keywords *** | 
|  | 181 |  | 
| Rahul Maheshwari | bcefdf2 | 2020-10-16 07:51:34 -0500 | [diff] [blame] | 182 | Get BMC Dump Entries | 
|  | 183 | [Documentation]  Return BMC dump ids list. | 
|  | 184 |  | 
|  | 185 | ${dump_uris}=  redfish_utils.get_member_list  /redfish/v1/Managers/bmc/LogServices/Dump/Entries | 
|  | 186 | ${dump_ids}=  Create List | 
|  | 187 |  | 
|  | 188 | FOR  ${dump_uri}  IN  @{dump_uris} | 
|  | 189 | ${dump_id}=  Fetch From Right  ${dump_uri}  / | 
|  | 190 | Append To List  ${dump_ids}  ${dump_id} | 
|  | 191 | END | 
|  | 192 |  | 
|  | 193 | [Return]  ${dump_ids} | 
|  | 194 |  | 
|  | 195 |  | 
| Rahul Maheshwari | d709c8d | 2020-11-01 23:03:51 -0600 | [diff] [blame] | 196 | Get Disk Usage For Dumps | 
|  | 197 | [Documentation]  Return disk usage in kilobyte for BMC dumps. | 
|  | 198 |  | 
|  | 199 | ${usage_output}  ${stderr}  ${rc}=  BMC Execute Command  du -s /var/lib/phosphor-debug-collector/dumps | 
|  | 200 |  | 
|  | 201 | # Example of output from above BMC cli command. | 
|  | 202 | # $ du -s /var/lib/phosphor-debug-collector/dumps | 
|  | 203 | # 516    /var/lib/phosphor-debug-collector/dumps | 
|  | 204 |  | 
|  | 205 | ${usage_output}=  Fetch From Left  ${usage_output}  / | 
|  | 206 | ${usage_output}=  Convert To Integer  ${usage_output} | 
|  | 207 |  | 
|  | 208 | [return]  ${usage_output} | 
|  | 209 |  | 
|  | 210 |  | 
| Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 211 | Test Teardown Execution | 
|  | 212 | [Documentation]  Do test teardown operation. | 
|  | 213 |  | 
|  | 214 | FFDC On Test Case Fail | 
|  | 215 | Close All Connections |