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 22*** Test Cases *** 23 24Verify 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 30 ${dump_id}= Create User Initiated BMC Dump Via Redfish 31 ${dump_entries}= Get BMC Dump Entries 32 Length Should Be ${dump_entries} 1 33 List Should Contain Value ${dump_entries} ${dump_id} 34 35Verify 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 41 ${dump_id}= Create User Initiated BMC Dump Via Redfish 42 ${dump_entries}= Get BMC Dump Entries 43 Length Should Be ${dump_entries} 1 44 List Should Contain Value ${dump_entries} ${dump_id} 45 46 47Verify User Initiated BMC Dump Size 48 [Documentation] Verify user initiated BMC dump size is under 200 KB. 49 [Tags] Verify_User_Initiated_BMC_Dump_Size 50 51 ${dump_id}= Create User Initiated BMC Dump Via Redfish 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 64 # Max size for dump is 200 KB = 200x1024 Byte. 65 Should Be True 0 < ${resp["AdditionalDataSizeBytes"]} < 204800 66 67 68Verify 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 73 Create User Initiated BMC Dump Via Redfish 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 84Verify 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 88 Create User Initiated BMC Dump Via Redfish 89 ${dump_entries_before}= redfish_utils.get_member_list /redfish/v1/Managers/bmc/LogServices/Dump/Entries 90 91 # Reset BMC. 92 OBMC Reboot (off) stack_mode=skip 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 98Delete 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 102 ${dump_id}= Create User Initiated BMC Dump Via Redfish 103 Redfish Delete BMC Dump ${dump_id} 104 105 ${dump_entries}= Get BMC Dump Entries 106 Should Be Empty ${dump_entries} 107 108 109Delete 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. 114 Create User Initiated BMC Dump Via Redfish 115 Create User Initiated BMC Dump Via Redfish 116 117 Redfish Delete All BMC Dumps 118 ${dump_entries}= Get BMC Dump Entries 119 Should Be Empty ${dump_entries} 120 121 122Create Two User Initiated BMC Dumps 123 [Documentation] Create two user initiated BMC dumps. 124 [Tags] Create_Two_User_Initiated_BMC_Dumps 125 126 ${dump_id1}= Create User Initiated BMC Dump Via Redfish 127 ${dump_id2}= Create User Initiated BMC Dump Via Redfish 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 135Create 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 139 ${dump_id1}= Create User Initiated BMC Dump Via Redfish 140 ${dump_id2}= Create User Initiated BMC Dump Via Redfish 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 149Create 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 154 ${dump_id}= Create User Initiated BMC Dump Via Redfish 155 Redfish Delete BMC Dump ${dump_id} 156 END 157 158 159Verify 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 169 Create User Initiated BMC Dump Via Redfish 170 ${dump_space}= Get Disk Usage For Dumps 171 Exit For Loop If ${dump_space} >= (${BMC_DUMP_TOTAL_SIZE} - ${BMC_DUMP_MIN_SPACE_REQD}) 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 180*** Keywords *** 181 182Get 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 196Get 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 211Test Teardown Execution 212 [Documentation] Do test teardown operation. 213 214 FFDC On Test Case Fail 215 Close All Connections 216