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 |
George Keishing | 1659f59 | 2018-10-03 08:33:41 -0500 | [diff] [blame] | 16 | Resource ../../lib/ipmi_client.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 | 09712a1 | 2017-10-16 12:52:42 -0500 | [diff] [blame] | 22 | Force Tags BMC_Code_Update |
| 23 | |
Charles Paul Hofer | 9f74d3a | 2017-08-18 09:54:28 -0500 | [diff] [blame] | 24 | *** Variables *** |
| 25 | |
| 26 | ${QUIET} ${1} |
| 27 | ${IMAGE_FILE_PATH} ${EMPTY} |
Charles Paul Hofer | c1fa2bc | 2017-08-18 16:44:03 -0500 | [diff] [blame] | 28 | ${ALTERNATE_IMAGE_FILE_PATH} ${EMPTY} |
Charles Paul Hofer | b7842a5 | 2017-09-22 10:11:33 -0500 | [diff] [blame] | 29 | ${SKIP_UPDATE_IF_ACTIVE} false |
Charles Paul Hofer | d66c5dc | 2017-09-29 14:25:52 -0500 | [diff] [blame] | 30 | ${dump_id} ${EMPTY} |
| 31 | ${running_persistence_test} ${FALSE} |
| 32 | ${test_errlog_text} AutoTestSimple |
Charles Paul Hofer | 9f74d3a | 2017-08-18 09:54:28 -0500 | [diff] [blame] | 33 | |
| 34 | *** Test Cases *** |
| 35 | |
Sivas SRR | 77c6919 | 2017-11-02 23:56:39 -0500 | [diff] [blame] | 36 | Test Basic BMC Performance Before BMC Code Update |
| 37 | [Documentation] Check performance of memory, CPU & file system of BMC. |
| 38 | [Tags] Test_Basic_BMC_Performance_Before_BMC_Code_Update |
| 39 | |
| 40 | Open Connection And Log In |
| 41 | Check BMC Performance |
| 42 | |
Charles Paul Hofer | d66c5dc | 2017-09-29 14:25:52 -0500 | [diff] [blame] | 43 | Prepare Persistent Data |
| 44 | [Documentation] Set data that should persist across the code update. |
| 45 | [Tags] Prepare_Persistent_Data |
| 46 | |
| 47 | # Install the debug tarball. |
| 48 | BMC Execute Command rm -rf /tmp/tarball |
| 49 | Install Debug Tarball On BMC tarball_file_path=${DEBUG_TARBALL_PATH} |
| 50 | |
| 51 | # Create a dummy error log and dump. |
| 52 | BMC Execute Command /tmp/tarball/bin/logging-test -c ${test_errlog_text} |
| 53 | ${dump_id}= Create User Initiated Dump |
| 54 | Check Dump Existence ${dump_id} |
| 55 | Set Suite Variable ${dump_id} |
| 56 | |
| 57 | # Set persistent settings. |
| 58 | ${autoreboot_dict}= Create Dictionary data=${0} |
| 59 | Write Attribute ${CONTROL_HOST_URI}auto_reboot AutoReboot |
| 60 | ... data=${autoreboot_dict} |
| 61 | ${onetime_dict}= Create Dictionary data=${0} |
| 62 | Write Attribute ${CONTROL_HOST_URI}boot/one_time Enabled |
| 63 | ... data=${onetime_dict} |
| 64 | |
| 65 | # Let the remaining test cases know we are doing a persistence test so we |
| 66 | # do not delete logs. |
| 67 | Set Suite Variable ${running_persistence_test} ${TRUE} |
| 68 | |
| 69 | |
Charles Paul Hofer | 9f74d3a | 2017-08-18 09:54:28 -0500 | [diff] [blame] | 70 | REST BMC Code Update |
| 71 | [Documentation] Do a BMC code update by uploading image on BMC via REST. |
| 72 | [Tags] REST_BMC_Code_Update |
Charles Paul Hofer | d66c5dc | 2017-09-29 14:25:52 -0500 | [diff] [blame] | 73 | [Teardown] REST BMC Code Update Teardown |
Charles Paul Hofer | 9f74d3a | 2017-08-18 09:54:28 -0500 | [diff] [blame] | 74 | |
Sweta Potthuri | 8c7ada4 | 2018-01-15 05:05:59 -0600 | [diff] [blame] | 75 | Run Keyword And Ignore Error List Installed Images BMC |
| 76 | |
Charles Paul Hofer | 2184546 | 2017-09-27 12:40:33 -0500 | [diff] [blame] | 77 | Upload And Activate Image ${IMAGE_FILE_PATH} |
| 78 | ... skip_if_active=${SKIP_UPDATE_IF_ACTIVE} |
Charles Paul Hofer | 9f74d3a | 2017-08-18 09:54:28 -0500 | [diff] [blame] | 79 | OBMC Reboot (off) |
Charles Paul Hofer | e43fb2f | 2017-09-26 15:36:18 -0500 | [diff] [blame] | 80 | Verify Running BMC Image ${IMAGE_FILE_PATH} |
Charles Paul Hofer | 9f74d3a | 2017-08-18 09:54:28 -0500 | [diff] [blame] | 81 | |
| 82 | |
Charles Paul Hofer | d66c5dc | 2017-09-29 14:25:52 -0500 | [diff] [blame] | 83 | Verify Error Log Persistency |
| 84 | [Documentation] Check that the error log is still present after a |
| 85 | ... code update. |
| 86 | [Tags] Verify_Error_Log_Persistency |
| 87 | |
| 88 | ${error_log_paths}= Read Properties ${BMC_LOGGING_URI}/list |
| 89 | Log To Console ${error_log_paths} |
| 90 | ${test_error_message}= Read Attribute @{error_log_paths}[-1] Message |
| 91 | Should Be Equal ${test_error_message} |
| 92 | ... example.xyz.openbmc_project.Example.Elog.${test_errlog_text} |
| 93 | Delete Error Log Entry @{error_log_paths}[-1] |
| 94 | |
| 95 | |
| 96 | Verify BMC Dump Persistency |
| 97 | [Documentation] Check that the BMC dump present after a code update. |
| 98 | [Tags] Verify_BMC_Dump_Persistency |
| 99 | [Teardown] Set Suite Variable ${running_persistence_test} ${FALSE} |
| 100 | |
| 101 | Check Dump Existence ${dump_id} |
| 102 | Delete BMC Dump ${dump_id} |
| 103 | |
| 104 | |
| 105 | Verify Settings Persistency |
| 106 | [Documentation] Verify that the settings from 'Prepare Persistent Data' |
| 107 | ... are still set correctly after the code update. |
| 108 | [Tags] Verify_Settings_Persistency |
| 109 | |
| 110 | ${autoreboot_enabled}= Read Attribute ${CONTROL_HOST_URI}auto_reboot |
| 111 | ... AutoReboot |
| 112 | Should Be Equal ${autoreboot_enabled} ${0} |
| 113 | ${onetime_enabled}= Read Attribute ${CONTROL_HOST_URI}boot/one_time |
| 114 | ... Enabled |
| 115 | Should Be Equal ${onetime_enabled} ${0} |
| 116 | |
| 117 | # Set values back to their defaults |
| 118 | ${autoreboot_dict}= Create Dictionary data=${1} |
| 119 | Write Attribute ${CONTROL_HOST_URI}auto_reboot AutoReboot |
| 120 | ... data=${autoreboot_dict} |
| 121 | ${onetime_dict}= Create Dictionary data=${1} |
| 122 | Write Attribute ${CONTROL_HOST_URI}boot/one_time Enabled |
| 123 | ... data=${onetime_dict} |
| 124 | |
| 125 | |
Charles Paul Hofer | c1fa2bc | 2017-08-18 16:44:03 -0500 | [diff] [blame] | 126 | Upload And Activate Multiple BMC Images |
| 127 | [Documentation] Upload another BMC image and verify that its state is |
| 128 | ... different from all others. |
| 129 | [Tags] Upload_And_Activate_Multiple_BMC_Images |
| 130 | [Template] Activate Image And Verify No Duplicate Priorities |
| 131 | [Setup] Upload And Activate Multiple BMC Images Setup |
| 132 | |
| 133 | # Image File Path Image Purpose |
| 134 | ${ALTERNATE_IMAGE_FILE_PATH} ${VERSION_PURPOSE_BMC} |
| 135 | |
| 136 | |
Charles Paul Hofer | 42f1746 | 2017-09-12 14:09:32 -0500 | [diff] [blame] | 137 | BMC Set Priority To Invalid Values |
| 138 | [Documentation] Attempt to set the priority of an image to an invalid |
| 139 | ... value and expect an error. |
| 140 | [Tags] BMC_Set_Priority_To_Invalid_Values |
| 141 | [Template] Set Priority To Invalid Value And Expect Error |
| 142 | |
| 143 | # Version Type Priority |
| 144 | ${VERSION_PURPOSE_BMC} ${-1} |
| 145 | ${VERSION_PURPOSE_BMC} ${256} |
| 146 | |
| 147 | |
Charles Paul Hofer | 9f74d3a | 2017-08-18 09:54:28 -0500 | [diff] [blame] | 148 | Delete BMC Image |
| 149 | [Documentation] Delete a BMC image from the BMC flash chip. |
| 150 | [Tags] Delete_BMC_Image |
| 151 | |
| 152 | ${software_object}= Get Non Running BMC Software Object |
| 153 | Delete Image And Verify ${software_object} ${VERSION_PURPOSE_BMC} |
Charles Paul Hofer | c1fa2bc | 2017-08-18 16:44:03 -0500 | [diff] [blame] | 154 | |
| 155 | |
George Keishing | 97ecb27 | 2017-09-12 04:30:20 -0500 | [diff] [blame] | 156 | BMC Image Priority Attribute Test |
| 157 | [Documentation] Set "Priority" attribute. |
| 158 | [Tags] BMC_Image_Priority_Attribute_Test |
| 159 | [Template] Temporarily Set BMC Attribute |
| 160 | |
| 161 | # Property Value |
| 162 | Priority ${0} |
| 163 | Priority ${1} |
| 164 | Priority ${127} |
| 165 | Priority ${255} |
| 166 | |
| 167 | |
Charles Paul Hofer | e8dc525 | 2017-10-10 13:50:18 -0500 | [diff] [blame] | 168 | Delete All Non Running BMC Images |
| 169 | [Documentation] Delete all non running BMC images. |
| 170 | [Tags] Delete_All_Non_Running_BMC_Images |
| 171 | |
| 172 | ${version_id}= Upload And Activate Image ${ALTERNATE_IMAGE_FILE_PATH} |
George Keishing | 0889d43 | 2017-11-27 11:53:06 -0600 | [diff] [blame] | 173 | ... skip_if_active=true |
Charles Paul Hofer | e8dc525 | 2017-10-10 13:50:18 -0500 | [diff] [blame] | 174 | Delete All Non Running BMC Images |
| 175 | |
| 176 | ${software_ids}= Get Software Objects Id |
| 177 | ... version_type=${VERSION_PURPOSE_BMC} |
| 178 | Should Not Contain ${software_ids} ${version_id} |
| 179 | |
George Keishing | 1659f59 | 2018-10-03 08:33:41 -0500 | [diff] [blame] | 180 | |
| 181 | Verify IPMI Disable Policy Post BMC Code Update |
| 182 | [Documentation] Disable IPMI, update BMC and verify post-update. |
| 183 | [Tags] Verify_IPMI_Disable_Policy_Post_BMC_Code_Update |
| 184 | |
| 185 | REST Power On |
| 186 | |
| 187 | Run Inband IPMI Standard Command lan set 1 access off |
| 188 | Run Keyword and Expect Error *Unable to establish IPMI* |
| 189 | ... Run External IPMI Standard Command lan print |
| 190 | |
| 191 | Upload And Activate Image ${IMAGE_FILE_PATH} |
| 192 | ... skip_if_active=${SKIP_UPDATE_IF_ACTIVE} |
| 193 | OBMC Reboot (off) |
| 194 | Verify Running BMC Image ${IMAGE_FILE_PATH} |
| 195 | |
| 196 | Run Keyword and Expect Error *Unable to establish IPMI* |
| 197 | ... Run External IPMI Standard Command lan print |
| 198 | |
| 199 | |
Sivas SRR | 77c6919 | 2017-11-02 23:56:39 -0500 | [diff] [blame] | 200 | Test Basic BMC Performance After Code Update |
| 201 | [Documentation] Check performance of memory, CPU & file system of BMC. |
| 202 | [Tags] Test_Basic_BMC_Performance_After_Code_Update |
| 203 | |
| 204 | Open Connection And Log In |
| 205 | Check BMC Performance |
| 206 | |
Charles Paul Hofer | e8dc525 | 2017-10-10 13:50:18 -0500 | [diff] [blame] | 207 | |
Charles Paul Hofer | c1fa2bc | 2017-08-18 16:44:03 -0500 | [diff] [blame] | 208 | *** Keywords *** |
| 209 | |
George Keishing | 97ecb27 | 2017-09-12 04:30:20 -0500 | [diff] [blame] | 210 | Temporarily Set BMC Attribute |
| 211 | [Documentation] Update the BMC attribute value. |
| 212 | [Arguments] ${attribute_name} ${attribute_value} |
| 213 | |
| 214 | # Description of argument(s): |
| 215 | # attribute_name BMC software attribute name (e.g. "Priority"). |
| 216 | # attribute_value Value to be written. |
| 217 | |
| 218 | ${image_ids}= Get Software Objects ${VERSION_PURPOSE_BMC} |
| 219 | ${init_bmc_properties}= Get Host Software Property ${image_ids[0]} |
| 220 | ${initial_priority}= Set Variable ${init_bmc_properties["Priority"]} |
| 221 | |
| 222 | Set Host Software Property ${image_ids[0]} ${attribute_name} |
| 223 | ... ${attribute_value} |
| 224 | |
| 225 | ${cur_bmc_properties}= Get Host Software Property ${image_ids[0]} |
| 226 | Should Be Equal As Integers ${cur_bmc_properties["Priority"]} |
| 227 | ... ${attribute_value} |
| 228 | |
| 229 | # Revert to to initial value. |
| 230 | Set Host Software Property |
| 231 | ... ${image_ids[0]} ${attribute_name} ${initial_priority} |
| 232 | |
| 233 | |
Charles Paul Hofer | c1fa2bc | 2017-08-18 16:44:03 -0500 | [diff] [blame] | 234 | Upload And Activate Multiple BMC Images Setup |
| 235 | [Documentation] Check that the ALTERNATE_FILE_PATH variable is set. |
| 236 | |
George Keishing | 1eb85f5 | 2017-08-30 22:55:13 -0500 | [diff] [blame] | 237 | Should Not Be Empty ${ALTERNATE_IMAGE_FILE_PATH} |
| 238 | |
Charles Paul Hofer | d66c5dc | 2017-09-29 14:25:52 -0500 | [diff] [blame] | 239 | |
| 240 | REST BMC Code Update Teardown |
| 241 | [Documentation] Do code update test teardown. |
| 242 | |
| 243 | FFDC On Test Case Fail |
| 244 | Run Keyword If Test Failed Fatal Error msg=Code update failed. |
| 245 | |
| 246 | |
| 247 | Suite Setup Execution |
George Keishing | 1eb85f5 | 2017-08-30 22:55:13 -0500 | [diff] [blame] | 248 | [Documentation] Do code update test case setup. |
| 249 | # - Clean up all existing BMC dumps. |
| 250 | |
Michael Walsh | e78a443 | 2018-03-29 16:36:04 -0500 | [diff] [blame] | 251 | Run Key Delete All Dumps ignore=1 |
Charles Paul Hofer | b926408 | 2017-09-29 15:00:19 -0500 | [diff] [blame] | 252 | Run Keyword And Ignore Error Smart Power Off |
George Keishing | 0071549 | 2017-08-18 11:46:37 -0500 | [diff] [blame] | 253 | |
Charles Paul Hofer | d66c5dc | 2017-09-29 14:25:52 -0500 | [diff] [blame] | 254 | Test Teardown Execution |
George Keishing | 0071549 | 2017-08-18 11:46:37 -0500 | [diff] [blame] | 255 | [Documentation] Do code update test case teardown. |
| 256 | # 1. Collect FFDC if test case failed. |
| 257 | # 2. Collect FFDC if test PASS but error log exists. |
| 258 | |
Charles Paul Hofer | d66c5dc | 2017-09-29 14:25:52 -0500 | [diff] [blame] | 259 | # Don't delete our logs if we want to persist them for tests. |
| 260 | Return From Keyword If ${running_persistence_test} |
| 261 | |
George Keishing | 0071549 | 2017-08-18 11:46:37 -0500 | [diff] [blame] | 262 | FFDC On Test Case Fail |
| 263 | Run Keyword If '${TEST_STATUS}' == 'PASS' Check Error And Collect FFDC |
Sivas SRR | 77c6919 | 2017-11-02 23:56:39 -0500 | [diff] [blame] | 264 | Close All Connections |