Charles Paul Hofer | 9f74d3a | 2017-08-18 09:54:28 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Update the BMC code on a target BMC. |
| 3 | ... Execution Method: |
| 4 | ... python -m robot -v OPENBMC_HOST:<hostname> |
| 5 | ... -v IMAGE_FILE_PATH:<path/*.tar> bmc_code_update.robot |
| 6 | |
| 7 | Library ../../lib/code_update_utils.py |
Michael Walsh | e78a443 | 2018-03-29 16:36:04 -0500 | [diff] [blame] | 8 | Library ../../lib/gen_robot_keyword.py |
Charles Paul Hofer | 9f74d3a | 2017-08-18 09:54:28 -0500 | [diff] [blame] | 9 | Variables ../../data/variables.py |
Sivas SRR | 77c6919 | 2017-11-02 23:56:39 -0500 | [diff] [blame] | 10 | Resource ../../lib/utils.robot |
Charles Paul Hofer | 9f74d3a | 2017-08-18 09:54:28 -0500 | [diff] [blame] | 11 | Resource ../../lib/boot_utils.robot |
| 12 | Resource code_update_utils.robot |
| 13 | Resource ../../lib/code_update_utils.robot |
George Keishing | 1eb85f5 | 2017-08-30 22:55:13 -0500 | [diff] [blame] | 14 | Resource ../../lib/openbmc_ffdc.robot |
| 15 | Resource ../../lib/dump_utils.robot |
Rahul Maheshwari | 8b70ddd | 2018-10-08 06:50:26 -0500 | [diff] [blame] | 16 | Resource ../../lib/certificate_utils.robot |
Charles Paul Hofer | 9f74d3a | 2017-08-18 09:54:28 -0500 | [diff] [blame] | 17 | |
Charles Paul Hofer | d66c5dc | 2017-09-29 14:25:52 -0500 | [diff] [blame] | 18 | Suite Setup Suite Setup Execution |
| 19 | |
| 20 | Test Teardown Test Teardown Execution |
Charles Paul Hofer | 9f74d3a | 2017-08-18 09:54:28 -0500 | [diff] [blame] | 21 | |
George Keishing | 7e85471 | 2021-03-17 13:18:10 -0500 | [diff] [blame] | 22 | # Force the test to timedout to prevent test hanging. |
| 23 | Test Timeout 30 minutes |
| 24 | |
George Keishing | 09712a1 | 2017-10-16 12:52:42 -0500 | [diff] [blame] | 25 | Force Tags BMC_Code_Update |
| 26 | |
Charles Paul Hofer | 9f74d3a | 2017-08-18 09:54:28 -0500 | [diff] [blame] | 27 | *** Variables *** |
| 28 | |
| 29 | ${QUIET} ${1} |
| 30 | ${IMAGE_FILE_PATH} ${EMPTY} |
Charles Paul Hofer | c1fa2bc | 2017-08-18 16:44:03 -0500 | [diff] [blame] | 31 | ${ALTERNATE_IMAGE_FILE_PATH} ${EMPTY} |
Charles Paul Hofer | b7842a5 | 2017-09-22 10:11:33 -0500 | [diff] [blame] | 32 | ${SKIP_UPDATE_IF_ACTIVE} false |
Charles Paul Hofer | d66c5dc | 2017-09-29 14:25:52 -0500 | [diff] [blame] | 33 | ${dump_id} ${EMPTY} |
| 34 | ${running_persistence_test} ${FALSE} |
| 35 | ${test_errlog_text} AutoTestSimple |
Charles Paul Hofer | 9f74d3a | 2017-08-18 09:54:28 -0500 | [diff] [blame] | 36 | |
| 37 | *** Test Cases *** |
| 38 | |
Sivas SRR | 77c6919 | 2017-11-02 23:56:39 -0500 | [diff] [blame] | 39 | Test Basic BMC Performance Before BMC Code Update |
| 40 | [Documentation] Check performance of memory, CPU & file system of BMC. |
| 41 | [Tags] Test_Basic_BMC_Performance_Before_BMC_Code_Update |
| 42 | |
| 43 | Open Connection And Log In |
| 44 | Check BMC Performance |
| 45 | |
Charles Paul Hofer | d66c5dc | 2017-09-29 14:25:52 -0500 | [diff] [blame] | 46 | Prepare Persistent Data |
| 47 | [Documentation] Set data that should persist across the code update. |
| 48 | [Tags] Prepare_Persistent_Data |
| 49 | |
| 50 | # Install the debug tarball. |
| 51 | BMC Execute Command rm -rf /tmp/tarball |
| 52 | Install Debug Tarball On BMC tarball_file_path=${DEBUG_TARBALL_PATH} |
| 53 | |
| 54 | # Create a dummy error log and dump. |
| 55 | BMC Execute Command /tmp/tarball/bin/logging-test -c ${test_errlog_text} |
| 56 | ${dump_id}= Create User Initiated Dump |
| 57 | Check Dump Existence ${dump_id} |
| 58 | Set Suite Variable ${dump_id} |
| 59 | |
| 60 | # Set persistent settings. |
| 61 | ${autoreboot_dict}= Create Dictionary data=${0} |
| 62 | Write Attribute ${CONTROL_HOST_URI}auto_reboot AutoReboot |
| 63 | ... data=${autoreboot_dict} |
| 64 | ${onetime_dict}= Create Dictionary data=${0} |
| 65 | Write Attribute ${CONTROL_HOST_URI}boot/one_time Enabled |
| 66 | ... data=${onetime_dict} |
| 67 | |
| 68 | # Let the remaining test cases know we are doing a persistence test so we |
| 69 | # do not delete logs. |
| 70 | Set Suite Variable ${running_persistence_test} ${TRUE} |
| 71 | |
| 72 | |
Charles Paul Hofer | 9f74d3a | 2017-08-18 09:54:28 -0500 | [diff] [blame] | 73 | REST BMC Code Update |
| 74 | [Documentation] Do a BMC code update by uploading image on BMC via REST. |
| 75 | [Tags] REST_BMC_Code_Update |
Charles Paul Hofer | d66c5dc | 2017-09-29 14:25:52 -0500 | [diff] [blame] | 76 | [Teardown] REST BMC Code Update Teardown |
Charles Paul Hofer | 9f74d3a | 2017-08-18 09:54:28 -0500 | [diff] [blame] | 77 | |
Sweta Potthuri | 8c7ada4 | 2018-01-15 05:05:59 -0600 | [diff] [blame] | 78 | Run Keyword And Ignore Error List Installed Images BMC |
George Keishing | fe96e64 | 2021-01-25 08:45:24 -0600 | [diff] [blame] | 79 | Run Keyword And Ignore Error Set ApplyTime policy=OnReset |
Sweta Potthuri | 8c7ada4 | 2018-01-15 05:05:59 -0600 | [diff] [blame] | 80 | |
George Keishing | 8010d86 | 2019-12-03 09:46:27 -0600 | [diff] [blame] | 81 | ${image_version}= Get Version Tar ${IMAGE_FILE_PATH} |
Michael Walsh | c81c6ae | 2020-05-08 10:19:36 -0500 | [diff] [blame] | 82 | ${bmc_release_info}= Get BMC Release Info |
| 83 | ${functional_version}= Set Variable ${bmc_release_info['version_id']} |
| 84 | Rprint Vars image_version functional_version |
George Keishing | 8010d86 | 2019-12-03 09:46:27 -0600 | [diff] [blame] | 85 | |
| 86 | # Check if the existing firmware is functional. |
Michael Walsh | c81c6ae | 2020-05-08 10:19:36 -0500 | [diff] [blame] | 87 | Pass Execution If '${functional_version}' == '${image_version}' |
| 88 | ... The existing ${image_version} firmware is already functional. |
George Keishing | 8010d86 | 2019-12-03 09:46:27 -0600 | [diff] [blame] | 89 | |
Charles Paul Hofer | 2184546 | 2017-09-27 12:40:33 -0500 | [diff] [blame] | 90 | Upload And Activate Image ${IMAGE_FILE_PATH} |
| 91 | ... skip_if_active=${SKIP_UPDATE_IF_ACTIVE} |
Charles Paul Hofer | 9f74d3a | 2017-08-18 09:54:28 -0500 | [diff] [blame] | 92 | OBMC Reboot (off) |
Charles Paul Hofer | e43fb2f | 2017-09-26 15:36:18 -0500 | [diff] [blame] | 93 | Verify Running BMC Image ${IMAGE_FILE_PATH} |
Sivas SRR | da339e6 | 2019-10-10 01:04:14 -0500 | [diff] [blame] | 94 | BMC Execute Command cd /etc ; cat host.conf hosts hostname print_out=1 |
Charles Paul Hofer | 9f74d3a | 2017-08-18 09:54:28 -0500 | [diff] [blame] | 95 | |
| 96 | |
Charles Paul Hofer | d66c5dc | 2017-09-29 14:25:52 -0500 | [diff] [blame] | 97 | Verify Error Log Persistency |
| 98 | [Documentation] Check that the error log is still present after a |
| 99 | ... code update. |
| 100 | [Tags] Verify_Error_Log_Persistency |
| 101 | |
Steven Sombar | a8800da | 2018-12-18 16:19:05 -0600 | [diff] [blame] | 102 | ${error_log_paths}= Read Properties ${BMC_LOGGING_ENTRY}list |
Charles Paul Hofer | d66c5dc | 2017-09-29 14:25:52 -0500 | [diff] [blame] | 103 | Log To Console ${error_log_paths} |
| 104 | ${test_error_message}= Read Attribute @{error_log_paths}[-1] Message |
| 105 | Should Be Equal ${test_error_message} |
| 106 | ... example.xyz.openbmc_project.Example.Elog.${test_errlog_text} |
| 107 | Delete Error Log Entry @{error_log_paths}[-1] |
| 108 | |
| 109 | |
| 110 | Verify BMC Dump Persistency |
| 111 | [Documentation] Check that the BMC dump present after a code update. |
| 112 | [Tags] Verify_BMC_Dump_Persistency |
| 113 | [Teardown] Set Suite Variable ${running_persistence_test} ${FALSE} |
| 114 | |
| 115 | Check Dump Existence ${dump_id} |
| 116 | Delete BMC Dump ${dump_id} |
| 117 | |
| 118 | |
| 119 | Verify Settings Persistency |
| 120 | [Documentation] Verify that the settings from 'Prepare Persistent Data' |
| 121 | ... are still set correctly after the code update. |
| 122 | [Tags] Verify_Settings_Persistency |
| 123 | |
| 124 | ${autoreboot_enabled}= Read Attribute ${CONTROL_HOST_URI}auto_reboot |
| 125 | ... AutoReboot |
| 126 | Should Be Equal ${autoreboot_enabled} ${0} |
| 127 | ${onetime_enabled}= Read Attribute ${CONTROL_HOST_URI}boot/one_time |
| 128 | ... Enabled |
| 129 | Should Be Equal ${onetime_enabled} ${0} |
| 130 | |
| 131 | # Set values back to their defaults |
| 132 | ${autoreboot_dict}= Create Dictionary data=${1} |
| 133 | Write Attribute ${CONTROL_HOST_URI}auto_reboot AutoReboot |
| 134 | ... data=${autoreboot_dict} |
| 135 | ${onetime_dict}= Create Dictionary data=${1} |
| 136 | Write Attribute ${CONTROL_HOST_URI}boot/one_time Enabled |
| 137 | ... data=${onetime_dict} |
| 138 | |
| 139 | |
Charles Paul Hofer | c1fa2bc | 2017-08-18 16:44:03 -0500 | [diff] [blame] | 140 | Upload And Activate Multiple BMC Images |
| 141 | [Documentation] Upload another BMC image and verify that its state is |
| 142 | ... different from all others. |
| 143 | [Tags] Upload_And_Activate_Multiple_BMC_Images |
| 144 | [Template] Activate Image And Verify No Duplicate Priorities |
| 145 | [Setup] Upload And Activate Multiple BMC Images Setup |
| 146 | |
| 147 | # Image File Path Image Purpose |
| 148 | ${ALTERNATE_IMAGE_FILE_PATH} ${VERSION_PURPOSE_BMC} |
| 149 | |
| 150 | |
Charles Paul Hofer | 42f1746 | 2017-09-12 14:09:32 -0500 | [diff] [blame] | 151 | BMC Set Priority To Invalid Values |
| 152 | [Documentation] Attempt to set the priority of an image to an invalid |
| 153 | ... value and expect an error. |
| 154 | [Tags] BMC_Set_Priority_To_Invalid_Values |
| 155 | [Template] Set Priority To Invalid Value And Expect Error |
| 156 | |
| 157 | # Version Type Priority |
| 158 | ${VERSION_PURPOSE_BMC} ${-1} |
| 159 | ${VERSION_PURPOSE_BMC} ${256} |
| 160 | |
| 161 | |
Charles Paul Hofer | 9f74d3a | 2017-08-18 09:54:28 -0500 | [diff] [blame] | 162 | Delete BMC Image |
| 163 | [Documentation] Delete a BMC image from the BMC flash chip. |
| 164 | [Tags] Delete_BMC_Image |
| 165 | |
| 166 | ${software_object}= Get Non Running BMC Software Object |
| 167 | Delete Image And Verify ${software_object} ${VERSION_PURPOSE_BMC} |
Charles Paul Hofer | c1fa2bc | 2017-08-18 16:44:03 -0500 | [diff] [blame] | 168 | |
| 169 | |
George Keishing | 97ecb27 | 2017-09-12 04:30:20 -0500 | [diff] [blame] | 170 | BMC Image Priority Attribute Test |
| 171 | [Documentation] Set "Priority" attribute. |
| 172 | [Tags] BMC_Image_Priority_Attribute_Test |
| 173 | [Template] Temporarily Set BMC Attribute |
| 174 | |
| 175 | # Property Value |
George Keishing | 872d69f | 2019-10-18 12:35:02 -0500 | [diff] [blame] | 176 | Priority ${False} |
| 177 | Priority ${True} |
George Keishing | 97ecb27 | 2017-09-12 04:30:20 -0500 | [diff] [blame] | 178 | Priority ${0} |
| 179 | Priority ${1} |
| 180 | Priority ${127} |
| 181 | Priority ${255} |
| 182 | |
| 183 | |
Charles Paul Hofer | e8dc525 | 2017-10-10 13:50:18 -0500 | [diff] [blame] | 184 | Delete All Non Running BMC Images |
| 185 | [Documentation] Delete all non running BMC images. |
| 186 | [Tags] Delete_All_Non_Running_BMC_Images |
| 187 | |
| 188 | ${version_id}= Upload And Activate Image ${ALTERNATE_IMAGE_FILE_PATH} |
George Keishing | 0889d43 | 2017-11-27 11:53:06 -0600 | [diff] [blame] | 189 | ... skip_if_active=true |
Charles Paul Hofer | e8dc525 | 2017-10-10 13:50:18 -0500 | [diff] [blame] | 190 | Delete All Non Running BMC Images |
| 191 | |
| 192 | ${software_ids}= Get Software Objects Id |
| 193 | ... version_type=${VERSION_PURPOSE_BMC} |
| 194 | Should Not Contain ${software_ids} ${version_id} |
| 195 | |
George Keishing | 1659f59 | 2018-10-03 08:33:41 -0500 | [diff] [blame] | 196 | |
Rahul Maheshwari | 8b70ddd | 2018-10-08 06:50:26 -0500 | [diff] [blame] | 197 | Test Certificate Persistency After BMC Code Update |
| 198 | [Documentation] Test certificate persistency after BMC update. |
| 199 | [Tags] Test_Certificate_Persistency_After_BMC_Code_Update |
| 200 | |
Rahul Maheshwari | fa146c4 | 2018-11-05 00:38:52 -0600 | [diff] [blame] | 201 | # Create certificate sub-directory in current working directory. |
| 202 | Create Directory certificate_dir |
| 203 | OperatingSystem.Directory Should Exist ${EXECDIR}${/}certificate_dir |
| 204 | |
Rahul Maheshwari | 8b70ddd | 2018-10-08 06:50:26 -0500 | [diff] [blame] | 205 | ${cert_file_path}= Generate Certificate File Via Openssl |
| 206 | ... Valid Certificate Valid Privatekey |
| 207 | ${file_data}= OperatingSystem.Get Binary File ${cert_file_path} |
| 208 | ${cert_file_content}= OperatingSystem.Get File ${cert_file_path} |
| 209 | |
Rahul Maheshwari | 6a849ad | 2020-02-26 03:31:19 -0600 | [diff] [blame] | 210 | Redfish.Login |
| 211 | ${cert_id}= Install Certificate File On BMC ${REDFISH_CA_CERTIFICATE_URI} ok data=${file_data} |
| 212 | Logging Installed certificate id: ${cert_id} |
Rahul Maheshwari | 8b70ddd | 2018-10-08 06:50:26 -0500 | [diff] [blame] | 213 | |
Rahul Maheshwari | 6a849ad | 2020-02-26 03:31:19 -0600 | [diff] [blame] | 214 | # Adding delay after certificate installation. |
| 215 | Sleep 30s |
| 216 | |
| 217 | ${bmc_cert_content}= redfish_utils.Get Attribute |
| 218 | ... /redfish/v1/Managers/bmc/Truststore/Certificates/${cert_id} CertificateString |
Rahul Maheshwari | 8b70ddd | 2018-10-08 06:50:26 -0500 | [diff] [blame] | 219 | Should Contain ${cert_file_content} ${bmc_cert_content} |
| 220 | |
| 221 | Upload And Activate Image ${IMAGE_FILE_PATH} |
| 222 | ... skip_if_active=${SKIP_UPDATE_IF_ACTIVE} |
| 223 | OBMC Reboot (off) |
| 224 | Verify Running BMC Image ${IMAGE_FILE_PATH} |
| 225 | |
Rahul Maheshwari | 6a849ad | 2020-02-26 03:31:19 -0600 | [diff] [blame] | 226 | Redfish.Login |
| 227 | ${bmc_cert_content}= redfish_utils.Get Attribute |
| 228 | ... ${REDFISH_CA_CERTIFICATE_URI}/${cert_id} CertificateString |
Rahul Maheshwari | 8b70ddd | 2018-10-08 06:50:26 -0500 | [diff] [blame] | 229 | Should Contain ${cert_file_content} ${bmc_cert_content} |
| 230 | |
Rahul Maheshwari | 6a849ad | 2020-02-26 03:31:19 -0600 | [diff] [blame] | 231 | Redfish.Logout |
| 232 | |
Rahul Maheshwari | 8b70ddd | 2018-10-08 06:50:26 -0500 | [diff] [blame] | 233 | |
Sivas SRR | 77c6919 | 2017-11-02 23:56:39 -0500 | [diff] [blame] | 234 | Test Basic BMC Performance After Code Update |
| 235 | [Documentation] Check performance of memory, CPU & file system of BMC. |
| 236 | [Tags] Test_Basic_BMC_Performance_After_Code_Update |
| 237 | |
| 238 | Open Connection And Log In |
| 239 | Check BMC Performance |
| 240 | |
Charles Paul Hofer | e8dc525 | 2017-10-10 13:50:18 -0500 | [diff] [blame] | 241 | |
Charles Paul Hofer | c1fa2bc | 2017-08-18 16:44:03 -0500 | [diff] [blame] | 242 | *** Keywords *** |
| 243 | |
George Keishing | 97ecb27 | 2017-09-12 04:30:20 -0500 | [diff] [blame] | 244 | Temporarily Set BMC Attribute |
| 245 | [Documentation] Update the BMC attribute value. |
| 246 | [Arguments] ${attribute_name} ${attribute_value} |
| 247 | |
| 248 | # Description of argument(s): |
| 249 | # attribute_name BMC software attribute name (e.g. "Priority"). |
| 250 | # attribute_value Value to be written. |
| 251 | |
| 252 | ${image_ids}= Get Software Objects ${VERSION_PURPOSE_BMC} |
| 253 | ${init_bmc_properties}= Get Host Software Property ${image_ids[0]} |
| 254 | ${initial_priority}= Set Variable ${init_bmc_properties["Priority"]} |
| 255 | |
| 256 | Set Host Software Property ${image_ids[0]} ${attribute_name} |
| 257 | ... ${attribute_value} |
| 258 | |
| 259 | ${cur_bmc_properties}= Get Host Software Property ${image_ids[0]} |
| 260 | Should Be Equal As Integers ${cur_bmc_properties["Priority"]} |
| 261 | ... ${attribute_value} |
| 262 | |
| 263 | # Revert to to initial value. |
| 264 | Set Host Software Property |
| 265 | ... ${image_ids[0]} ${attribute_name} ${initial_priority} |
| 266 | |
| 267 | |
Charles Paul Hofer | c1fa2bc | 2017-08-18 16:44:03 -0500 | [diff] [blame] | 268 | Upload And Activate Multiple BMC Images Setup |
| 269 | [Documentation] Check that the ALTERNATE_FILE_PATH variable is set. |
| 270 | |
George Keishing | 1eb85f5 | 2017-08-30 22:55:13 -0500 | [diff] [blame] | 271 | Should Not Be Empty ${ALTERNATE_IMAGE_FILE_PATH} |
| 272 | |
Charles Paul Hofer | d66c5dc | 2017-09-29 14:25:52 -0500 | [diff] [blame] | 273 | |
| 274 | REST BMC Code Update Teardown |
| 275 | [Documentation] Do code update test teardown. |
| 276 | |
| 277 | FFDC On Test Case Fail |
| 278 | Run Keyword If Test Failed Fatal Error msg=Code update failed. |
| 279 | |
| 280 | |
| 281 | Suite Setup Execution |
George Keishing | 1eb85f5 | 2017-08-30 22:55:13 -0500 | [diff] [blame] | 282 | [Documentation] Do code update test case setup. |
| 283 | # - Clean up all existing BMC dumps. |
| 284 | |
Michael Walsh | e78a443 | 2018-03-29 16:36:04 -0500 | [diff] [blame] | 285 | Run Key Delete All Dumps ignore=1 |
Charles Paul Hofer | b926408 | 2017-09-29 15:00:19 -0500 | [diff] [blame] | 286 | Run Keyword And Ignore Error Smart Power Off |
George Keishing | 0071549 | 2017-08-18 11:46:37 -0500 | [diff] [blame] | 287 | |
Charles Paul Hofer | d66c5dc | 2017-09-29 14:25:52 -0500 | [diff] [blame] | 288 | Test Teardown Execution |
George Keishing | 0071549 | 2017-08-18 11:46:37 -0500 | [diff] [blame] | 289 | [Documentation] Do code update test case teardown. |
| 290 | # 1. Collect FFDC if test case failed. |
| 291 | # 2. Collect FFDC if test PASS but error log exists. |
| 292 | |
Charles Paul Hofer | d66c5dc | 2017-09-29 14:25:52 -0500 | [diff] [blame] | 293 | # Don't delete our logs if we want to persist them for tests. |
| 294 | Return From Keyword If ${running_persistence_test} |
| 295 | |
George Keishing | 0071549 | 2017-08-18 11:46:37 -0500 | [diff] [blame] | 296 | FFDC On Test Case Fail |
| 297 | Run Keyword If '${TEST_STATUS}' == 'PASS' Check Error And Collect FFDC |
Sivas SRR | 77c6919 | 2017-11-02 23:56:39 -0500 | [diff] [blame] | 298 | Close All Connections |