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