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 8Library ../../lib/gen_robot_keyword.py 9Variables ../../data/variables.py 10Resource ../../lib/utils.robot 11Resource ../../lib/boot_utils.robot 12Resource code_update_utils.robot 13Resource ../../lib/code_update_utils.robot 14Resource ../../lib/openbmc_ffdc.robot 15Resource ../../lib/dump_utils.robot 16 17Suite Setup Suite Setup Execution 18 19Test Teardown Test Teardown Execution 20 21Force Tags BMC_Code_Update 22 23*** Variables *** 24 25${QUIET} ${1} 26${IMAGE_FILE_PATH} ${EMPTY} 27${ALTERNATE_IMAGE_FILE_PATH} ${EMPTY} 28${SKIP_UPDATE_IF_ACTIVE} false 29${dump_id} ${EMPTY} 30${running_persistence_test} ${FALSE} 31${test_errlog_text} AutoTestSimple 32 33*** Test Cases *** 34 35Test 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 42Prepare 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 69REST BMC Code Update 70 [Documentation] Do a BMC code update by uploading image on BMC via REST. 71 [Tags] REST_BMC_Code_Update 72 [Teardown] REST BMC Code Update Teardown 73 74 Run Keyword And Ignore Error List Installed Images BMC 75 76 Upload And Activate Image ${IMAGE_FILE_PATH} 77 ... skip_if_active=${SKIP_UPDATE_IF_ACTIVE} 78 OBMC Reboot (off) 79 Verify Running BMC Image ${IMAGE_FILE_PATH} 80 81 82Verify 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 95Verify 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 104Verify 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 125Upload 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 136BMC 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 147Delete 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} 153 154 155BMC 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 167Delete 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} 172 ... skip_if_active=true 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 179Test 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 186 187*** Keywords *** 188 189Temporarily 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 213Upload And Activate Multiple BMC Images Setup 214 [Documentation] Check that the ALTERNATE_FILE_PATH variable is set. 215 216 Should Not Be Empty ${ALTERNATE_IMAGE_FILE_PATH} 217 218 219REST 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 226Suite Setup Execution 227 [Documentation] Do code update test case setup. 228 # - Clean up all existing BMC dumps. 229 230 Run Key Delete All Dumps ignore=1 231 Run Keyword And Ignore Error Smart Power Off 232 233Test Teardown Execution 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 238 # Don't delete our logs if we want to persist them for tests. 239 Return From Keyword If ${running_persistence_test} 240 241 FFDC On Test Case Fail 242 Run Keyword If '${TEST_STATUS}' == 'PASS' Check Error And Collect FFDC 243 Close All Connections 244