1*** Settings *** 2 3Documentation Test BMC dump functionality of OpenBMC. 4 5Resource ../../lib/bmc_redfish_resource.robot 6Resource ../../lib/boot_utils.robot 7Resource ../../lib/dump_utils.robot 8Resource ../../lib/openbmc_ffdc.robot 9 10Suite Setup Redfish.Login 11Test Setup Redfish Delete All BMC Dumps 12Test Teardown Test Teardown Execution 13 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} 21${MAX_DUMP_COUNT} ${20} 22 23*** Test Cases *** 24 25Verify 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 31 ${dump_id}= Create User Initiated BMC Dump Via Redfish 32 ${dump_entries}= Get BMC Dump Entries 33 Length Should Be ${dump_entries} 1 34 List Should Contain Value ${dump_entries} ${dump_id} 35 36 37Verify User Initiated BMC Dump Size 38 [Documentation] Verify user initiated BMC dump size is under 20 MB. 39 [Tags] Verify_User_Initiated_BMC_Dump_Size 40 41 ${dump_id}= Create User Initiated BMC Dump Via Redfish 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 54 # Max size for dump is 20 MB = 20x1024x1024 Byte. 55 Should Be True 0 < ${resp["AdditionalDataSizeBytes"]} < 20971520 56 57 58Verify 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 70Verify 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 75 Create User Initiated BMC Dump Via Redfish 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 86Verify 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 90 Create User Initiated BMC Dump Via Redfish 91 ${dump_entries_before}= redfish_utils.get_member_list /redfish/v1/Managers/bmc/LogServices/Dump/Entries 92 93 # Reset BMC. 94 OBMC Reboot (off) stack_mode=skip 95 96 ${dump_entries_after}= redfish_utils.get_member_list /redfish/v1/Managers/bmc/LogServices/Dump/Entries 97 Lists Should Be Equal ${dump_entries_before} ${dump_entries_after} 98 99 100Delete User Initiated BMC Dump And Verify 101 [Documentation] Delete user initiated BMC dump and verify. 102 [Tags] Delete_User_Initiated_BMC_Dump_And_Verify 103 104 ${dump_id}= Create User Initiated BMC Dump Via Redfish 105 Redfish Delete BMC Dump ${dump_id} 106 107 ${dump_entries}= Get BMC Dump Entries 108 Should Be Empty ${dump_entries} 109 110 111Delete All User Initiated BMC Dumps And Verify 112 [Documentation] Delete all user initiated BMC dumps and verify. 113 [Tags] Delete_All_User_Initiated_BMC_Dumps_And_Verify 114 115 # Create some BMC dump. 116 Create User Initiated BMC Dump Via Redfish 117 Create User Initiated BMC Dump Via Redfish 118 119 Redfish Delete All BMC Dumps 120 ${dump_entries}= Get BMC Dump Entries 121 Should Be Empty ${dump_entries} 122 123 124Create Two User Initiated BMC Dumps 125 [Documentation] Create two user initiated BMC dumps. 126 [Tags] Create_Two_User_Initiated_BMC_Dumps 127 128 ${dump_id1}= Create User Initiated BMC Dump Via Redfish 129 ${dump_id2}= Create User Initiated BMC Dump Via Redfish 130 131 ${dump_entries}= Get BMC Dump Entries 132 Length Should Be ${dump_entries} 2 133 Should Contain ${dump_entries} ${dump_id1} 134 Should Contain ${dump_entries} ${dump_id2} 135 136 137Create Two User Initiated BMC Dumps And Delete One 138 [Documentation] Create two dumps and delete the first. 139 [Tags] Create_Two_User_Initiated_BMC_Dumps_And_Delete_One 140 141 ${dump_id1}= Create User Initiated BMC Dump Via Redfish 142 ${dump_id2}= Create User Initiated BMC Dump Via Redfish 143 144 Redfish Delete BMC Dump ${dump_id1} 145 146 ${dump_entries}= Get BMC Dump Entries 147 Length Should Be ${dump_entries} 1 148 List Should Contain Value ${dump_entries} ${dump_id2} 149 150 151Create And Delete User Initiated BMC Dump Multiple Times 152 [Documentation] Create and delete user initiated BMC dump multiple times. 153 [Tags] Create_And_Delete_User_Initiated_BMC_Dump_Multiple_Times 154 155 FOR ${INDEX} IN 1 10 156 ${dump_id}= Create User Initiated BMC Dump Via Redfish 157 Redfish Delete BMC Dump ${dump_id} 158 END 159 160 161Verify Maximum BMC Dump Creation 162 [Documentation] Create maximum BMC dump and verify error when dump runs out of space. 163 [Tags] Verify_Maximum_BMC_Dump_Creation 164 [Teardown] Redfish Delete All BMC Dumps 165 166 # Maximum allowed space for dump is 1024 KB. BMC typically hold 8-14 dumps 167 # before running out of this dump space. So trying to create dumps in 20 168 # iterations to run out of space. 169 # User can key in the Maximum allowed space for bmc dump and how many iteration. 170 FOR ${n} IN RANGE 0 ${MAX_DUMP_COUNT} 171 Create User Initiated BMC Dump Via Redfish 172 ${dump_space}= Get Disk Usage For Dumps 173 Exit For Loop If ${dump_space} >= (${BMC_DUMP_TOTAL_SIZE} - ${BMC_DUMP_MIN_SPACE_REQD}) 174 END 175 176 # Check error while creating dump when dump size is full. 177 ${payload}= Create Dictionary DiagnosticDataType=Manager 178 Redfish.Post /redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.CollectDiagnosticData 179 ... body=${payload} valid_status_codes=[${HTTP_INTERNAL_SERVER_ERROR}] 180 181 182*** Keywords *** 183 184Get BMC Dump Entries 185 [Documentation] Return BMC dump ids list. 186 187 ${dump_uris}= redfish_utils.get_member_list /redfish/v1/Managers/bmc/LogServices/Dump/Entries 188 ${dump_ids}= Create List 189 190 FOR ${dump_uri} IN @{dump_uris} 191 ${dump_id}= Fetch From Right ${dump_uri} / 192 Append To List ${dump_ids} ${dump_id} 193 END 194 195 [Return] ${dump_ids} 196 197 198Get Disk Usage For Dumps 199 [Documentation] Return disk usage in kilobyte for BMC dumps. 200 201 ${usage_output} ${stderr} ${rc}= BMC Execute Command du -s /var/lib/phosphor-debug-collector/dumps 202 203 # Example of output from above BMC cli command. 204 # $ du -s /var/lib/phosphor-debug-collector/dumps 205 # 516 /var/lib/phosphor-debug-collector/dumps 206 207 ${usage_output}= Fetch From Left ${usage_output} / 208 ${usage_output}= Convert To Integer ${usage_output} 209 210 [return] ${usage_output} 211 212 213Test Teardown Execution 214 [Documentation] Do test teardown operation. 215 216 FFDC On Test Case Fail 217 Close All Connections 218