| 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 | 
| manashsarma | 7e1f2c5 | 2023-02-03 03:18:40 -0600 | [diff] [blame] | 9 | Variables           ../../data/pel_variables.py | 
| Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 10 |  | 
| George Keishing | f514ccb | 2021-02-02 23:55:56 -0600 | [diff] [blame] | 11 | Suite Setup         Redfish.Login | 
| Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 12 | Test Setup          Redfish Delete All BMC Dumps | 
|  | 13 | Test Teardown       Test Teardown Execution | 
|  | 14 |  | 
| Tim Lee | de2d130 | 2021-06-18 01:24:11 +0800 | [diff] [blame] | 15 | *** Variables *** | 
|  | 16 |  | 
|  | 17 | # Total size of the dump in kilo bytes | 
|  | 18 | ${BMC_DUMP_TOTAL_SIZE}       ${1024} | 
|  | 19 |  | 
|  | 20 | # Minimum space required for one bmc dump in kilo bytes | 
|  | 21 | ${BMC_DUMP_MIN_SPACE_REQD}   ${20} | 
| manashsarma | bd346b3 | 2022-07-20 06:22:58 -0500 | [diff] [blame] | 22 | ${MAX_DUMP_COUNT}            ${20} | 
| manashsarma | 395f880 | 2022-11-17 03:09:02 -0600 | [diff] [blame] | 23 | ${BMC_DUMP_COLLECTOR_PATH}   /var/lib/phosphor-debug-collector/dumps | 
| Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 24 |  | 
|  | 25 | *** Test Cases *** | 
|  | 26 |  | 
| manashsarma | 4b5b1fa | 2022-11-16 02:36:58 -0600 | [diff] [blame] | 27 | Verify Error Response For Already Deleted Dump Id | 
|  | 28 | [Documentation]  Delete non existing BMC dump and expect an error. | 
|  | 29 | [Tags]  Verify_Error_Response_For_Already_Deleted_Dump_Id | 
|  | 30 |  | 
| manashsarma | 9dcabad | 2023-02-02 03:55:17 -0600 | [diff] [blame] | 31 | Redfish Power Off  stack_mode=skip | 
| manashsarma | 4b5b1fa | 2022-11-16 02:36:58 -0600 | [diff] [blame] | 32 | ${dump_id}=  Create User Initiated BMC Dump Via Redfish | 
|  | 33 | Redfish Delete BMC Dump  ${dump_id} | 
|  | 34 | Run Keyword And Expect Error  ValueError: *  Redfish Delete BMC Dump  ${dump_id} | 
|  | 35 |  | 
|  | 36 |  | 
| Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 37 | Verify User Initiated BMC Dump When Host Powered Off | 
|  | 38 | [Documentation]  Create user initiated BMC dump at host off state and | 
|  | 39 | ...  verify dump entry for it. | 
|  | 40 | [Tags]  Verify_User_Initiated_BMC_Dump_When_Host_Powered_Off | 
|  | 41 |  | 
|  | 42 | Redfish Power Off  stack_mode=skip | 
| Rahul Maheshwari | bd38aa4 | 2021-08-04 01:24:39 -0500 | [diff] [blame] | 43 | ${dump_id}=  Create User Initiated BMC Dump Via Redfish | 
| Rahul Maheshwari | bcefdf2 | 2020-10-16 07:51:34 -0500 | [diff] [blame] | 44 | ${dump_entries}=  Get BMC Dump Entries | 
| Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 45 | Length Should Be  ${dump_entries}  1 | 
|  | 46 | List Should Contain Value  ${dump_entries}  ${dump_id} | 
|  | 47 |  | 
| Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 48 |  | 
| Rahul Maheshwari | e8e9d0c | 2020-10-30 02:39:01 -0500 | [diff] [blame] | 49 | Verify User Initiated BMC Dump Size | 
| manashsarma | 7831dc2 | 2022-03-08 01:49:36 -0600 | [diff] [blame] | 50 | [Documentation]  Verify user initiated BMC dump size is under 20 MB. | 
| Rahul Maheshwari | e8e9d0c | 2020-10-30 02:39:01 -0500 | [diff] [blame] | 51 | [Tags]  Verify_User_Initiated_BMC_Dump_Size | 
|  | 52 |  | 
| Rahul Maheshwari | bd38aa4 | 2021-08-04 01:24:39 -0500 | [diff] [blame] | 53 | ${dump_id}=  Create User Initiated BMC Dump Via Redfish | 
| Rahul Maheshwari | e8e9d0c | 2020-10-30 02:39:01 -0500 | [diff] [blame] | 54 | ${resp}=  Redfish.Get Properties  /redfish/v1/Managers/bmc/LogServices/Dump/Entries/${dump_id} | 
|  | 55 |  | 
|  | 56 | # Example of response from above Redfish GET request. | 
|  | 57 | # "@odata.type": "#LogEntry.v1_7_0.LogEntry", | 
|  | 58 | # "AdditionalDataSizeBytes": 31644, | 
|  | 59 | # "AdditionalDataURI": "/redfish/v1/Managers/bmc/LogServices/Dump/attachment/9", | 
|  | 60 | # "Created": "2020-10-23T06:32:53+00:00", | 
|  | 61 | # "DiagnosticDataType": "Manager", | 
|  | 62 | # "EntryType": "Event", | 
|  | 63 | # "Id": "9", | 
|  | 64 | # "Name": "BMC Dump Entry" | 
|  | 65 |  | 
| manashsarma | 7831dc2 | 2022-03-08 01:49:36 -0600 | [diff] [blame] | 66 | # Max size for dump is 20 MB = 20x1024x1024 Byte. | 
|  | 67 | Should Be True  0 < ${resp["AdditionalDataSizeBytes"]} < 20971520 | 
| Rahul Maheshwari | e8e9d0c | 2020-10-30 02:39:01 -0500 | [diff] [blame] | 68 |  | 
|  | 69 |  | 
| manashsarma | 7e1f2c5 | 2023-02-03 03:18:40 -0600 | [diff] [blame] | 70 | Verify Internal Failure Initiated BMC Dump Size | 
|  | 71 | [Documentation]  Verify that the internal failure initiated BMC dump size is under 20 MB. | 
|  | 72 | [Tags]  Verify_Internal_Failure_Initiated_BMC_Dump_Size | 
|  | 73 |  | 
|  | 74 | Redfish Delete All BMC Dumps | 
|  | 75 |  | 
|  | 76 | # Create an internal failure error log. | 
|  | 77 | BMC Execute Command  ${CMD_INTERNAL_FAILURE} | 
|  | 78 |  | 
|  | 79 | # Wait for BMC dump to get generated after injecting internal failure. | 
|  | 80 | Wait Until Keyword Succeeds  2 min  10 sec  Is BMC Dump Available | 
|  | 81 |  | 
|  | 82 | # Verify that only one BMC dump is generated after injecting error. | 
|  | 83 | ${dump_entries}=  Get BMC Dump Entries | 
|  | 84 | ${length}=  Get length  ${dump_entries} | 
|  | 85 | Should Be Equal As Integers  ${length}  ${1} | 
|  | 86 |  | 
|  | 87 | # Max size for dump is 20 MB = 20x1024x1024 Byte. | 
|  | 88 | ${resp}=  Redfish.Get Properties | 
|  | 89 | ...  /redfish/v1/Managers/bmc/LogServices/Dump/Entries/${dump_entries[0]} | 
|  | 90 | Should Be True  0 < ${resp["AdditionalDataSizeBytes"]} < 20971520 | 
|  | 91 |  | 
|  | 92 |  | 
| manashsarma | bbc68bc | 2022-12-05 09:55:17 -0600 | [diff] [blame] | 93 | Verify Multiple BMC Dump Creation | 
|  | 94 | [Documentation]  Verify that multiple BMC dumps can be created one after | 
|  | 95 | ...  another successfully. | 
|  | 96 | [Tags]   Verify_Multiple_BMC_Dump_Creation | 
|  | 97 |  | 
|  | 98 | ${dump_count}=  Evaluate  random.randint(5, 10)  modules=random | 
|  | 99 | FOR  ${INDEX}  IN  1  ${dump_count} | 
|  | 100 | Create User Initiated BMC Dump Via Redfish | 
|  | 101 | END | 
|  | 102 |  | 
|  | 103 |  | 
| manashsarma | 395f880 | 2022-11-17 03:09:02 -0600 | [diff] [blame] | 104 | Verify BMC Dump Default Location In BMC | 
|  | 105 | [Documentation]  Verify that BMC dump is created in its default location of BMC. | 
| George Keishing | 224e4c7 | 2022-12-14 05:07:58 -0600 | [diff] [blame] | 106 | [Tags]  Verify_BMC_Dump_Default_Location_In_BMC | 
| manashsarma | 395f880 | 2022-11-17 03:09:02 -0600 | [diff] [blame] | 107 |  | 
|  | 108 | Redfish Delete All BMC Dumps | 
|  | 109 | ${dump_id}=  Create User Initiated BMC Dump Via Redfish | 
|  | 110 | ${dump_file}  ${stderr}  ${rc}=  BMC Execute Command | 
|  | 111 | ...  ls ${BMC_DUMP_COLLECTOR_PATH}/${dump_id} | 
|  | 112 | Should Be True  ${rc} == 0 | 
| George Keishing | 952bb0f | 2022-12-12 03:13:35 -0600 | [diff] [blame] | 113 | Should Start With  ${dump_file}  BMCDUMP | 
| manashsarma | 395f880 | 2022-11-17 03:09:02 -0600 | [diff] [blame] | 114 |  | 
|  | 115 |  | 
| George Keishing | 3d85098 | 2022-07-19 11:03:03 -0500 | [diff] [blame] | 116 | Verify User Initiated BMC Dump When Host Booted | 
|  | 117 | [Documentation]  Create user initiated BMC dump at host booted state and | 
|  | 118 | ...  verify dump entry for it. | 
|  | 119 | [Tags]  Verify_User_Initiated_BMC_Dump_When_Host_Booted | 
|  | 120 |  | 
|  | 121 | Redfish Power On  stack_mode=skip | 
|  | 122 | ${dump_id}=  Create User Initiated BMC Dump Via Redfish | 
|  | 123 | ${dump_entries}=  Get BMC Dump Entries | 
|  | 124 | Length Should Be  ${dump_entries}  1 | 
|  | 125 | List Should Contain Value  ${dump_entries}  ${dump_id} | 
|  | 126 |  | 
|  | 127 |  | 
| Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 128 | Verify Dump Persistency On Dump Service Restart | 
|  | 129 | [Documentation]  Create user dump, restart dump manager service and verify dump | 
|  | 130 | ...  persistency. | 
|  | 131 | [Tags]  Verify_Dump_Persistency_On_Dump_Service_Restart | 
|  | 132 |  | 
| Rahul Maheshwari | bd38aa4 | 2021-08-04 01:24:39 -0500 | [diff] [blame] | 133 | Create User Initiated BMC Dump Via Redfish | 
| Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 134 | ${dump_entries_before}=  redfish_utils.get_member_list  /redfish/v1/Managers/bmc/LogServices/Dump/Entries | 
|  | 135 |  | 
|  | 136 | # Restart dump service. | 
|  | 137 | BMC Execute Command  systemctl restart xyz.openbmc_project.Dump.Manager.service | 
|  | 138 | Sleep  10s  reason=Wait for BMC dump service to restart properly | 
|  | 139 |  | 
|  | 140 | ${dump_entries_after}=  redfish_utils.get_member_list  /redfish/v1/Managers/bmc/LogServices/Dump/Entries | 
|  | 141 | Lists Should Be Equal  ${dump_entries_before}  ${dump_entries_after} | 
|  | 142 |  | 
|  | 143 |  | 
|  | 144 | Verify Dump Persistency On BMC Reset | 
|  | 145 | [Documentation]  Create user dump, reset BMC and verify dump persistency. | 
|  | 146 | [Tags]  Verify_Dump_Persistency_On_BMC_Reset | 
|  | 147 |  | 
| manashsarma | 8fa9c89 | 2022-10-03 06:20:58 -0500 | [diff] [blame] | 148 | # Power off host so that dump is not offloaded to host OS. | 
|  | 149 | Redfish Power Off  stack_mode=skip | 
|  | 150 |  | 
| Rahul Maheshwari | bd38aa4 | 2021-08-04 01:24:39 -0500 | [diff] [blame] | 151 | Create User Initiated BMC Dump Via Redfish | 
| Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 152 | ${dump_entries_before}=  redfish_utils.get_member_list  /redfish/v1/Managers/bmc/LogServices/Dump/Entries | 
|  | 153 |  | 
|  | 154 | # Reset BMC. | 
| George Keishing | 88ec280 | 2021-08-04 03:04:22 -0500 | [diff] [blame] | 155 | OBMC Reboot (off)  stack_mode=skip | 
| Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 156 |  | 
|  | 157 | ${dump_entries_after}=  redfish_utils.get_member_list  /redfish/v1/Managers/bmc/LogServices/Dump/Entries | 
|  | 158 | Lists Should Be Equal  ${dump_entries_before}  ${dump_entries_after} | 
|  | 159 |  | 
|  | 160 |  | 
| Rahul Maheshwari | 95cbceb | 2020-10-21 23:25:08 -0500 | [diff] [blame] | 161 | Delete User Initiated BMC Dump And Verify | 
|  | 162 | [Documentation]  Delete user initiated BMC dump and verify. | 
|  | 163 | [Tags]  Delete_User_Initiated_BMC_Dump_And_Verify | 
|  | 164 |  | 
| Rahul Maheshwari | bd38aa4 | 2021-08-04 01:24:39 -0500 | [diff] [blame] | 165 | ${dump_id}=  Create User Initiated BMC Dump Via Redfish | 
| Rahul Maheshwari | 95cbceb | 2020-10-21 23:25:08 -0500 | [diff] [blame] | 166 | Redfish Delete BMC Dump  ${dump_id} | 
|  | 167 |  | 
|  | 168 | ${dump_entries}=  Get BMC Dump Entries | 
|  | 169 | Should Be Empty  ${dump_entries} | 
|  | 170 |  | 
|  | 171 |  | 
|  | 172 | Delete All User Initiated BMC Dumps And Verify | 
|  | 173 | [Documentation]  Delete all user initiated BMC dumps and verify. | 
|  | 174 | [Tags]  Delete_All_User_Initiated_BMC_Dumps_And_Verify | 
|  | 175 |  | 
| manashsarma | 70d840e | 2022-10-18 02:34:45 -0500 | [diff] [blame] | 176 | # Power off host so that dump is not offloaded to host OS. | 
|  | 177 | Redfish Power Off  stack_mode=skip | 
|  | 178 |  | 
| Rahul Maheshwari | 95cbceb | 2020-10-21 23:25:08 -0500 | [diff] [blame] | 179 | # Create some BMC dump. | 
| Rahul Maheshwari | bd38aa4 | 2021-08-04 01:24:39 -0500 | [diff] [blame] | 180 | Create User Initiated BMC Dump Via Redfish | 
|  | 181 | Create User Initiated BMC Dump Via Redfish | 
| Rahul Maheshwari | 95cbceb | 2020-10-21 23:25:08 -0500 | [diff] [blame] | 182 |  | 
|  | 183 | Redfish Delete All BMC Dumps | 
|  | 184 | ${dump_entries}=  Get BMC Dump Entries | 
|  | 185 | Should Be Empty  ${dump_entries} | 
|  | 186 |  | 
|  | 187 |  | 
| Rahul Maheshwari | 4f338ab | 2020-10-21 23:28:40 -0500 | [diff] [blame] | 188 | Create Two User Initiated BMC Dumps | 
|  | 189 | [Documentation]  Create two user initiated BMC dumps. | 
|  | 190 | [Tags]  Create_Two_User_Initiated_BMC_Dumps | 
|  | 191 |  | 
| Rahul Maheshwari | bd38aa4 | 2021-08-04 01:24:39 -0500 | [diff] [blame] | 192 | ${dump_id1}=  Create User Initiated BMC Dump Via Redfish | 
|  | 193 | ${dump_id2}=  Create User Initiated BMC Dump Via Redfish | 
| Rahul Maheshwari | 4f338ab | 2020-10-21 23:28:40 -0500 | [diff] [blame] | 194 |  | 
|  | 195 | ${dump_entries}=  Get BMC Dump Entries | 
|  | 196 | Length Should Be  ${dump_entries}  2 | 
|  | 197 | Should Contain  ${dump_entries}  ${dump_id1} | 
|  | 198 | Should Contain  ${dump_entries}  ${dump_id2} | 
|  | 199 |  | 
|  | 200 |  | 
|  | 201 | Create Two User Initiated BMC Dumps And Delete One | 
|  | 202 | [Documentation]  Create two dumps and delete the first. | 
|  | 203 | [Tags]  Create_Two_User_Initiated_BMC_Dumps_And_Delete_One | 
|  | 204 |  | 
| Rahul Maheshwari | bd38aa4 | 2021-08-04 01:24:39 -0500 | [diff] [blame] | 205 | ${dump_id1}=  Create User Initiated BMC Dump Via Redfish | 
|  | 206 | ${dump_id2}=  Create User Initiated BMC Dump Via Redfish | 
| Rahul Maheshwari | 4f338ab | 2020-10-21 23:28:40 -0500 | [diff] [blame] | 207 |  | 
|  | 208 | Redfish Delete BMC Dump  ${dump_id1} | 
|  | 209 |  | 
|  | 210 | ${dump_entries}=  Get BMC Dump Entries | 
|  | 211 | Length Should Be  ${dump_entries}  1 | 
|  | 212 | List Should Contain Value  ${dump_entries}  ${dump_id2} | 
|  | 213 |  | 
|  | 214 |  | 
|  | 215 | Create And Delete User Initiated BMC Dump Multiple Times | 
|  | 216 | [Documentation]  Create and delete user initiated BMC dump multiple times. | 
|  | 217 | [Tags]  Create_And_Delete_User_Initiated_BMC_Dump_Multiple_Times | 
|  | 218 |  | 
|  | 219 | FOR  ${INDEX}  IN  1  10 | 
| Rahul Maheshwari | bd38aa4 | 2021-08-04 01:24:39 -0500 | [diff] [blame] | 220 | ${dump_id}=  Create User Initiated BMC Dump Via Redfish | 
| Rahul Maheshwari | 4f338ab | 2020-10-21 23:28:40 -0500 | [diff] [blame] | 221 | Redfish Delete BMC Dump  ${dump_id} | 
|  | 222 | END | 
|  | 223 |  | 
|  | 224 |  | 
| Rahul Maheshwari | d709c8d | 2020-11-01 23:03:51 -0600 | [diff] [blame] | 225 | Verify Maximum BMC Dump Creation | 
|  | 226 | [Documentation]  Create maximum BMC dump and verify error when dump runs out of space. | 
|  | 227 | [Tags]  Verify_Maximum_BMC_Dump_Creation | 
|  | 228 | [Teardown]  Redfish Delete All BMC Dumps | 
|  | 229 |  | 
|  | 230 | # Maximum allowed space for dump is 1024 KB. BMC typically hold 8-14 dumps | 
|  | 231 | # before running out of this dump space. So trying to create dumps in 20 | 
|  | 232 | # iterations to run out of space. | 
| manashsarma | bd346b3 | 2022-07-20 06:22:58 -0500 | [diff] [blame] | 233 | # User can key in the Maximum allowed space for bmc dump and how many iteration. | 
|  | 234 | FOR  ${n}  IN RANGE  0  ${MAX_DUMP_COUNT} | 
| Rahul Maheshwari | bd38aa4 | 2021-08-04 01:24:39 -0500 | [diff] [blame] | 235 | Create User Initiated BMC Dump Via Redfish | 
| Rahul Maheshwari | d709c8d | 2020-11-01 23:03:51 -0600 | [diff] [blame] | 236 | ${dump_space}=  Get Disk Usage For Dumps | 
| Tim Lee | de2d130 | 2021-06-18 01:24:11 +0800 | [diff] [blame] | 237 | 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] | 238 | END | 
|  | 239 |  | 
|  | 240 | # Check error while creating dump when dump size is full. | 
|  | 241 | ${payload}=  Create Dictionary  DiagnosticDataType=Manager | 
|  | 242 | Redfish.Post  /redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.CollectDiagnosticData | 
|  | 243 | ...  body=${payload}  valid_status_codes=[${HTTP_INTERNAL_SERVER_ERROR}] | 
|  | 244 |  | 
|  | 245 |  | 
| manashsarma | 633cac9 | 2022-11-25 03:27:03 -0600 | [diff] [blame] | 246 | Verify BMC Core Dump When Host Powered Off | 
|  | 247 | [Documentation]  Verify BMC core dump after application crash at host powered off state. | 
|  | 248 | [Tags]  Verify_BMC_Core_Dump_When_Host_Powered_Off | 
|  | 249 |  | 
|  | 250 | Redfish Power Off  stack_mode=skip | 
|  | 251 |  | 
|  | 252 | # Ensure all dumps are cleaned out. | 
|  | 253 | Redfish Delete All BMC Dumps | 
|  | 254 | Trigger Core Dump | 
|  | 255 |  | 
|  | 256 | # Verify that BMC dump is available. | 
|  | 257 | Wait Until Keyword Succeeds  2 min  10 sec  Is BMC Dump Available | 
|  | 258 |  | 
|  | 259 |  | 
| manashsarma | 849189c | 2022-11-28 04:16:51 -0600 | [diff] [blame] | 260 | Verify Core Dump Size | 
|  | 261 | [Documentation]  Verify BMC core dump size is under 20 MB. | 
|  | 262 | [Tags]  Verify_Core_Dump_Size | 
|  | 263 |  | 
|  | 264 | Redfish Power Off  stack_mode=skip | 
|  | 265 |  | 
|  | 266 | # Ensure all dumps are cleaned out. | 
|  | 267 | Redfish Delete All BMC Dumps | 
|  | 268 | Trigger Core Dump | 
|  | 269 |  | 
|  | 270 | # Verify that BMC dump is available. | 
|  | 271 | Wait Until Keyword Succeeds  2 min  10 sec  Is BMC Dump Available | 
|  | 272 | ${dump_entries}=  Get BMC Dump Entries | 
|  | 273 | ${resp}=  Redfish.Get Properties | 
|  | 274 | ...  /redfish/v1/Managers/bmc/LogServices/Dump/Entries/${dump_entries[0]} | 
|  | 275 |  | 
|  | 276 | # Max size for dump is 20 MB = 20x1024x1024 Byte. | 
|  | 277 | Should Be True  0 < ${resp["AdditionalDataSizeBytes"]} < 20971520 | 
|  | 278 |  | 
|  | 279 |  | 
| manashsarma | fcbfdf6 | 2022-12-07 06:36:28 -0600 | [diff] [blame] | 280 | Verify Error While Initiating BMC Dump During Dumping State | 
|  | 281 | [Documentation]  Verify error while initiating BMC dump during dumping state. | 
|  | 282 | [Tags]  Verify_Error_While_Initiating_BMC_Dump_During_Dumping_State | 
|  | 283 |  | 
| Nandish-Matti | af5bc15 | 2023-01-30 00:49:59 -0600 | [diff] [blame] | 284 | ${task_id}=  Create User Initiated BMC Dump Via Redfish  ${1} | 
| manashsarma | fcbfdf6 | 2022-12-07 06:36:28 -0600 | [diff] [blame] | 285 |  | 
|  | 286 | # Check error while initiating BMC dump while dump in progress. | 
|  | 287 | ${payload}=  Create Dictionary  DiagnosticDataType=Manager | 
|  | 288 | Redfish.Post | 
|  | 289 | ...  /redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.CollectDiagnosticData | 
|  | 290 | ...  body=${payload}  valid_status_codes=[${HTTP_SERVICE_UNAVAILABLE}] | 
|  | 291 |  | 
| Nandish-Matti | af5bc15 | 2023-01-30 00:49:59 -0600 | [diff] [blame] | 292 | # Wait for above initiated dump to complete. Otherwise, on going dump would impact next test. | 
|  | 293 | Wait Until Keyword Succeeds  5 min  15 sec  Check Task Completion  ${task_id} | 
|  | 294 |  | 
| manashsarma | fcbfdf6 | 2022-12-07 06:36:28 -0600 | [diff] [blame] | 295 |  | 
| manashsarma | aa845b7 | 2022-12-12 05:41:32 -0600 | [diff] [blame] | 296 | Verify BMC Dump Create Errors While Another BMC Dump In Progress | 
|  | 297 | [Documentation]  Verify BMC dump creation error until older BMC dump completion. | 
|  | 298 | [Tags]  Verify_BMC_Dump_Create_Errors_While_Another_BMC_Dump_In_Progress | 
|  | 299 |  | 
|  | 300 | # Initiate a BMC dump that returns without completion. | 
|  | 301 | ${task_id}=  Create User Initiated BMC Dump Via Redfish  ${1} | 
|  | 302 |  | 
|  | 303 | # Now continue to initiate multiple dump request which is not expected to be accepted | 
|  | 304 | # till earlier BMC dump task is completed. A limit is set to avoid risk of infinite loop. | 
|  | 305 | ${payload}=  Create Dictionary  DiagnosticDataType=Manager | 
|  | 306 | WHILE  True  limit=1000 | 
|  | 307 | ${task_dict}=  Redfish.Get Properties  /redfish/v1/TaskService/Tasks/${task_id} | 
|  | 308 | IF  '${task_dict['TaskState']}' == 'Completed'  BREAK | 
|  | 309 | Redfish.Post | 
|  | 310 | ...  /redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.CollectDiagnosticData | 
|  | 311 | ...  body=${payload}  valid_status_codes=[${HTTP_SERVICE_UNAVAILABLE}] | 
|  | 312 | END | 
|  | 313 |  | 
|  | 314 | # The next BMC dump initiation request should be accepted as earlier dump is completed. | 
|  | 315 | ${resp}=  Redfish.Post | 
|  | 316 | ...  /redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.CollectDiagnosticData | 
|  | 317 | ...  body=${payload}  valid_status_codes=[${HTTP_ACCEPTED}] | 
|  | 318 |  | 
|  | 319 | # Wait for above initiated dump to complete. Otherwise, on going dump would impact next test. | 
|  | 320 | Wait Until Keyword Succeeds  5 min  15 sec  Check Task Completion  ${resp.dict['Id']} | 
|  | 321 |  | 
|  | 322 |  | 
| manashsarma | adabd3b | 2023-02-08 04:51:32 -0600 | [diff] [blame] | 323 | Verify Core Dump After Terminating Dump Manager Service | 
|  | 324 | [Documentation]  Verify initiate core dumps and kill Phosphor-dump-manager. | 
|  | 325 | [Tags]  Verify_Core_Dump_After_Terminating_Dump_Manager_Service | 
|  | 326 |  | 
|  | 327 | Redfish Power Off  stack_mode=skip | 
|  | 328 |  | 
|  | 329 | # Remove all available dumps in BMC. | 
|  | 330 | Redfish Delete All BMC Dumps | 
|  | 331 |  | 
|  | 332 | # Find the pid of the phosphor-dump-manage process and kill it. | 
|  | 333 | ${cmd_buf}=  Catenate  kill -s SEGV $(pgrep phosphor-dump-manager) | 
|  | 334 | ${cmd_output}  ${stderr}  ${rc}=  BMC Execute Command  ${cmd_buf} | 
|  | 335 | Should Be Equal As Integers  ${rc}  ${0} | 
|  | 336 |  | 
|  | 337 | # Verify that BMC dump is available. | 
|  | 338 | Wait Until Keyword Succeeds  2 min  10 sec  Is BMC Dump Available | 
|  | 339 |  | 
| George Keishing | 4611b81 | 2023-02-16 09:44:33 -0600 | [diff] [blame^] | 340 | # Verifying that there is only one dump. | 
| manashsarma | adabd3b | 2023-02-08 04:51:32 -0600 | [diff] [blame] | 341 | ${dump_entries}=  Get BMC Dump Entries | 
|  | 342 | ${length}=  Get length  ${dump_entries} | 
|  | 343 | Should Be Equal As Integers  ${length}  ${1} | 
|  | 344 |  | 
|  | 345 |  | 
| Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 346 | *** Keywords *** | 
|  | 347 |  | 
| Rahul Maheshwari | bcefdf2 | 2020-10-16 07:51:34 -0500 | [diff] [blame] | 348 | Get BMC Dump Entries | 
|  | 349 | [Documentation]  Return BMC dump ids list. | 
|  | 350 |  | 
|  | 351 | ${dump_uris}=  redfish_utils.get_member_list  /redfish/v1/Managers/bmc/LogServices/Dump/Entries | 
|  | 352 | ${dump_ids}=  Create List | 
|  | 353 |  | 
|  | 354 | FOR  ${dump_uri}  IN  @{dump_uris} | 
|  | 355 | ${dump_id}=  Fetch From Right  ${dump_uri}  / | 
|  | 356 | Append To List  ${dump_ids}  ${dump_id} | 
|  | 357 | END | 
|  | 358 |  | 
|  | 359 | [Return]  ${dump_ids} | 
|  | 360 |  | 
|  | 361 |  | 
| manashsarma | 633cac9 | 2022-11-25 03:27:03 -0600 | [diff] [blame] | 362 | Is BMC Dump Available | 
|  | 363 | [Documentation]  Verify if BMC dump is available. | 
|  | 364 |  | 
|  | 365 | ${dump_entries}=  Get BMC Dump Entries | 
|  | 366 |  | 
|  | 367 | # Verifying that BMC dump is available. | 
|  | 368 | ${length}=  Get length  ${dump_entries} | 
|  | 369 | Should Be True  0 < ${length} | 
|  | 370 |  | 
|  | 371 |  | 
| Rahul Maheshwari | d709c8d | 2020-11-01 23:03:51 -0600 | [diff] [blame] | 372 | Get Disk Usage For Dumps | 
|  | 373 | [Documentation]  Return disk usage in kilobyte for BMC dumps. | 
|  | 374 |  | 
| George Keishing | 952bb0f | 2022-12-12 03:13:35 -0600 | [diff] [blame] | 375 | ${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] | 376 |  | 
|  | 377 | # Example of output from above BMC cli command. | 
|  | 378 | # $ du -s /var/lib/phosphor-debug-collector/dumps | 
|  | 379 | # 516    /var/lib/phosphor-debug-collector/dumps | 
|  | 380 |  | 
|  | 381 | ${usage_output}=  Fetch From Left  ${usage_output}  / | 
|  | 382 | ${usage_output}=  Convert To Integer  ${usage_output} | 
|  | 383 |  | 
|  | 384 | [return]  ${usage_output} | 
|  | 385 |  | 
|  | 386 |  | 
| Rahul Maheshwari | 2568f87 | 2020-09-23 01:03:39 -0500 | [diff] [blame] | 387 | Test Teardown Execution | 
|  | 388 | [Documentation]  Do test teardown operation. | 
|  | 389 |  | 
|  | 390 | FFDC On Test Case Fail | 
|  | 391 | Close All Connections |