1227dcaa7SSushil Singh*** Settings *** 2227dcaa7SSushil SinghDocumentation Update the BMC code on a target BMC via Redifsh. 3227dcaa7SSushil Singh 4227dcaa7SSushil Singh# Test Parameters: 5227dcaa7SSushil Singh# IMAGE_FILE_PATH The path to the BMC image file. 6227dcaa7SSushil Singh# 7227dcaa7SSushil Singh# Firmware update states: 8227dcaa7SSushil Singh# Enabled Image is installed and either functional or active. 9227dcaa7SSushil Singh# Disabled Image installation failed or ready for activation. 10227dcaa7SSushil Singh# Updating Image installation currently in progress. 11227dcaa7SSushil Singh 12227dcaa7SSushil SinghResource ../../lib/resource.robot 13227dcaa7SSushil SinghResource ../../lib/bmc_redfish_resource.robot 14227dcaa7SSushil SinghResource ../../lib/openbmc_ffdc.robot 15227dcaa7SSushil SinghResource ../../lib/common_utils.robot 16227dcaa7SSushil SinghResource ../../lib/code_update_utils.robot 17227dcaa7SSushil SinghResource ../../lib/redfish_code_update_utils.robot 18227dcaa7SSushil SinghResource ../../lib/utils.robot 19227dcaa7SSushil SinghLibrary ../../lib/gen_robot_valid.py 20227dcaa7SSushil SinghLibrary ../../lib/var_funcs.py 21227dcaa7SSushil SinghLibrary ../../lib/gen_robot_keyword.py 22227dcaa7SSushil SinghLibrary ../../lib/code_update_utils.py 23227dcaa7SSushil Singh 24227dcaa7SSushil SinghSuite Setup Suite Setup Execution 25227dcaa7SSushil SinghSuite Teardown Redfish.Logout 26227dcaa7SSushil SinghTest Setup Printn 27227dcaa7SSushil SinghTest Teardown FFDC On Test Case Fail 28227dcaa7SSushil Singh 29227dcaa7SSushil Singh# Force the test to timedout to prevent test hanging. 30227dcaa7SSushil SinghTest Timeout 30 minutes 31227dcaa7SSushil Singh 32227dcaa7SSushil Singh*** Test Cases *** 33227dcaa7SSushil Singh 34227dcaa7SSushil SinghRedfish Host Code Update 35227dcaa7SSushil Singh [Documentation] Update the firmware image. 36227dcaa7SSushil Singh [Tags] Redfish_Host_Code_Update 37227dcaa7SSushil Singh 38227dcaa7SSushil Singh ${image_version}= Get Version Tar ${IMAGE_FILE_PATH} 39227dcaa7SSushil Singh Rprint Vars image_version 40227dcaa7SSushil Singh 41227dcaa7SSushil Singh ${sw_inv}= Get Functional Firmware Host image 4239132a9eSSushil Singh ${functional_sw_inv}= Get Non Functional Firmware ${sw_inv} True 43227dcaa7SSushil Singh 4439132a9eSSushil Singh ${num_records}= Get Length ${functional_sw_inv} 4539132a9eSSushil Singh 46*538f1743SGeorge Keishing Run Keyword If ${num_records} != 0 47*538f1743SGeorge Keishing ... Pass Execution If '${functional_sw_inv['version']}' == '${image_version}' 4839132a9eSSushil Singh ... The existing ${image_version} firmware is already functional. 49227dcaa7SSushil Singh 50227dcaa7SSushil Singh ${post_code_update_actions}= Get Post Boot Action 51227dcaa7SSushil Singh ${state}= Get Pre Reboot State 52227dcaa7SSushil Singh Rprint Vars state 53227dcaa7SSushil Singh 54227dcaa7SSushil Singh Print Timen Performing firmware update ${image_version}. 55227dcaa7SSushil Singh 56227dcaa7SSushil Singh Redfish Update Firmware 57227dcaa7SSushil Singh 58227dcaa7SSushil Singh 59227dcaa7SSushil Singh*** Keywords *** 60227dcaa7SSushil Singh 61227dcaa7SSushil SinghSuite Setup Execution 62227dcaa7SSushil Singh [Documentation] Do the suite setup. 63227dcaa7SSushil Singh 64227dcaa7SSushil Singh Redfish.Login 65227dcaa7SSushil Singh # Delete BMC dump and Error logs. 66227dcaa7SSushil Singh Run Keyword And Ignore Error Redfish Delete All BMC Dumps 67227dcaa7SSushil Singh Run Keyword And Ignore Error Redfish Purge Event Log 68227dcaa7SSushil Singh # Checking for file existence. 69227dcaa7SSushil Singh Valid File Path IMAGE_FILE_PATH 70227dcaa7SSushil Singh 71227dcaa7SSushil Singh 72227dcaa7SSushil SinghRedfish Update Firmware 73227dcaa7SSushil Singh [Documentation] Update the BMC firmware via redfish interface. 74227dcaa7SSushil Singh 75227dcaa7SSushil Singh Redfish.Login 76227dcaa7SSushil Singh ${post_code_update_actions}= Get Post Boot Action 77227dcaa7SSushil Singh Rprint Vars post_code_update_actions 78227dcaa7SSushil Singh Run Keyword And Ignore Error Set ApplyTime policy=OnReset 79227dcaa7SSushil Singh Redfish Upload Image And Check Progress State 80227dcaa7SSushil Singh ${tar_version}= Get Version Tar ${IMAGE_FILE_PATH} 81227dcaa7SSushil Singh ${image_info}= Get Software Inventory State By Version ${tar_version} 82227dcaa7SSushil Singh Run Key ${post_code_update_actions['${image_info["image_type"]}']['OnReset']} 83227dcaa7SSushil Singh Redfish.Login 84227dcaa7SSushil Singh Redfish Verify Host Version ${IMAGE_FILE_PATH} 85227dcaa7SSushil Singh 86