1*** Settings *** 2Documentation Update the BMC code on a target BMC via Redifsh. 3 4# Test Parameters: 5# IMAGE_FILE_PATH The path to the BMC image file. 6# 7# Firmware update states: 8# Enabled Image is installed and either functional or active. 9# Disabled Image installation failed or ready for activation. 10# Updating Image installation currently in progress. 11 12Resource ../../lib/resource.robot 13Resource ../../lib/bmc_redfish_resource.robot 14Resource ../../lib/openbmc_ffdc.robot 15Resource ../../lib/common_utils.robot 16Resource ../../lib/code_update_utils.robot 17Resource ../../lib/redfish_code_update_utils.robot 18Resource ../../lib/utils.robot 19Library ../../lib/gen_robot_valid.py 20Library ../../lib/var_funcs.py 21Library ../../lib/gen_robot_keyword.py 22Library ../../lib/code_update_utils.py 23 24Suite Setup Suite Setup Execution 25Suite Teardown Redfish.Logout 26Test Setup Printn 27Test Teardown FFDC On Test Case Fail 28 29# Force the test to timedout to prevent test hanging. 30Test Timeout 30 minutes 31 32*** Test Cases *** 33 34Redfish Host Code Update 35 [Documentation] Update the firmware image. 36 [Tags] Redfish_Host_Code_Update 37 38 ${image_version}= Get Version Tar ${IMAGE_FILE_PATH} 39 Rprint Vars image_version 40 41 ${sw_inv}= Get Functional Firmware Host image 42 ${functional_sw_inv}= Get Non Functional Firmware ${sw_inv} True 43 44 ${num_records}= Get Length ${functional_sw_inv} 45 46 Run Keyword If ${num_records} != 0 47 ... Pass Execution If '${functional_sw_inv['version']}' == '${image_version}' 48 ... The existing ${image_version} firmware is already functional. 49 50 ${post_code_update_actions}= Get Post Boot Action 51 ${state}= Get Pre Reboot State 52 Rprint Vars state 53 54 Print Timen Performing firmware update ${image_version}. 55 56 Redfish Update Firmware 57 58 59*** Keywords *** 60 61Suite Setup Execution 62 [Documentation] Do the suite setup. 63 64 Redfish.Login 65 # Delete BMC dump and Error logs. 66 Run Keyword And Ignore Error Redfish Delete All BMC Dumps 67 Run Keyword And Ignore Error Redfish Purge Event Log 68 # Checking for file existence. 69 Valid File Path IMAGE_FILE_PATH 70 71 72Redfish Update Firmware 73 [Documentation] Update the BMC firmware via redfish interface. 74 75 Redfish.Login 76 ${post_code_update_actions}= Get Post Boot Action 77 Rprint Vars post_code_update_actions 78 Run Keyword And Ignore Error Set ApplyTime policy=OnReset 79 Redfish Upload Image And Check Progress State 80 ${tar_version}= Get Version Tar ${IMAGE_FILE_PATH} 81 ${image_info}= Get Software Inventory State By Version ${tar_version} 82 Run Key ${post_code_update_actions['${image_info["image_type"]}']['OnReset']} 83 Redfish.Login 84 Redfish Verify Host Version ${IMAGE_FILE_PATH} 85 86