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