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