1fc3096a5SGeorge Keishing*** Settings *** 2fc3096a5SGeorge KeishingDocumentation Redfish test to switch image sides and boot. 3fc3096a5SGeorge Keishing 4fc3096a5SGeorge KeishingResource ../../lib/resource.robot 5fc3096a5SGeorge KeishingResource ../../lib/bmc_redfish_resource.robot 6fc3096a5SGeorge KeishingResource ../../lib/openbmc_ffdc.robot 7fc3096a5SGeorge KeishingResource ../../lib/redfish_code_update_utils.robot 8fc3096a5SGeorge KeishingLibrary ../../lib/tftp_update_utils.py 9fc3096a5SGeorge Keishing 10fc3096a5SGeorge KeishingSuite Setup Suite Setup Execution 11dbd7afb8SGeorge KeishingSuite Teardown Run Keyword And Ignore Error Redfish.Logout 12fc3096a5SGeorge KeishingTest Teardown FFDC On Test Case Fail 13fc3096a5SGeorge Keishing 146fb70d98SMatt FischerTest Tags Bmc_Image_Switch 15504a371eSGeorge Keishing 16fc3096a5SGeorge Keishing*** Variables *** 17fc3096a5SGeorge Keishing 18fc3096a5SGeorge Keishing# Switch iteration count. By default it does only 2 switch. 19fc3096a5SGeorge Keishing# User can input -v LOOP_COUNT:n to drive the switch back and forth for 20fc3096a5SGeorge Keishing# nth iteration. 21fc3096a5SGeorge Keishing${LOOP_COUNT} ${2} 22fc3096a5SGeorge Keishing 23fc3096a5SGeorge Keishing*** Test Cases *** 24fc3096a5SGeorge Keishing 25fc3096a5SGeorge KeishingTest Firmware Image Switch Without Powering Host 26fc3096a5SGeorge Keishing [Documentation] Switch image at host powered off. 27fc3096a5SGeorge Keishing [Tags] Test_Firmware_Image_Switch_Without_Powering_Host 28fc3096a5SGeorge Keishing [Template] Firmware Switch Loop 29fc3096a5SGeorge Keishing 30fc3096a5SGeorge Keishing # iteration power_on 31fc3096a5SGeorge Keishing ${LOOP_COUNT} NO 32fc3096a5SGeorge Keishing 33fc3096a5SGeorge Keishing 34fc3096a5SGeorge KeishingTest Firmware Image Switch And Power On Host 35fc3096a5SGeorge Keishing [Documentation] Switch image and power on host and verify that it boots. 36fc3096a5SGeorge Keishing [Tags] Test_Firmware_Image_Switch_And_Power_On_Host 37fc3096a5SGeorge Keishing [Template] Firmware Switch Loop 38fc3096a5SGeorge Keishing 39fc3096a5SGeorge Keishing # iteration power_on 40fc3096a5SGeorge Keishing ${LOOP_COUNT} YES 41fc3096a5SGeorge Keishing 42fc3096a5SGeorge Keishing 43fc3096a5SGeorge Keishing*** Keywords *** 44fc3096a5SGeorge Keishing 45fc3096a5SGeorge KeishingFirmware Switch Loop 46fc3096a5SGeorge Keishing [Documentation] Wrapper keyword for iteration for firmware side switch. 47fc3096a5SGeorge Keishing [Arguments] ${iteration} ${power_on} 48fc3096a5SGeorge Keishing 49fc3096a5SGeorge Keishing # Description of argument(s): 50fc3096a5SGeorge Keishing # iteration Number of switch it needs to perform. 51fc3096a5SGeorge Keishing # power_on If YES, boot the system post firmware image switch, 52fc3096a5SGeorge Keishing # if NO, do not perform any poweron operation. 53fc3096a5SGeorge Keishing 54fc3096a5SGeorge Keishing FOR ${count} IN RANGE 0 ${iteration} 55fc3096a5SGeorge Keishing Log To Console LOOP_COUNT:${count} execution. 56fc3096a5SGeorge Keishing Redfish BMC Switch Firmware Side 57fc3096a5SGeorge Keishing 58*ac155720SSridevi Ramesh IF '${power_on}' == 'NO' CONTINUE 59fc3096a5SGeorge Keishing 60fc3096a5SGeorge Keishing Log To Console Power on requested, issuing power on. 61fc3096a5SGeorge Keishing Redfish Power On 62fc3096a5SGeorge Keishing 63fc3096a5SGeorge Keishing # Power Off for next iteration. Firmware image switch ideally needs to be 64fc3096a5SGeorge Keishing # to be executed when Host is powered off. 65fc3096a5SGeorge Keishing Log To Console Power off requested, issuing power off. 66fc3096a5SGeorge Keishing Redfish Power Off 67fc3096a5SGeorge Keishing END 68fc3096a5SGeorge Keishing 69fc3096a5SGeorge Keishing 70fc3096a5SGeorge KeishingSuite Setup Execution 71fc3096a5SGeorge Keishing [Documentation] Do the suite setup. 72fc3096a5SGeorge Keishing 73fc3096a5SGeorge Keishing Redfish.Login 74fc3096a5SGeorge Keishing Run Keyword And Ignore Error Redfish Purge Event Log 75fc3096a5SGeorge Keishing Redfish Power Off stack_mode=skip 76fc3096a5SGeorge Keishing 77fc3096a5SGeorge Keishing 78fc3096a5SGeorge KeishingRedfish BMC Switch Firmware Side 79fc3096a5SGeorge Keishing [Documentation] Switch back up image to running and verify. 80fc3096a5SGeorge Keishing [Tags] Redfish_BMC_Switch_Firmware_Side 81fc3096a5SGeorge Keishing 82fc3096a5SGeorge Keishing # fw_inv_dict: 83fc3096a5SGeorge Keishing # [19a3ef3e]: 84fc3096a5SGeorge Keishing # [image_type]: BMC image 85fc3096a5SGeorge Keishing # [image_id]: 19a3ef3e 86fc3096a5SGeorge Keishing # [functional]: True 87fc3096a5SGeorge Keishing # [version]: 2.12.0-dev-1440-g8dada0a1a 88fc3096a5SGeorge Keishing # [62d16947]: 89fc3096a5SGeorge Keishing # [image_type]: BMC image 90fc3096a5SGeorge Keishing # [image_id]: 62d16947 91fc3096a5SGeorge Keishing # [functional]: False 92fc3096a5SGeorge Keishing # [version]: 2.12.0-dev-1441-g8deadbeef 93fc3096a5SGeorge Keishing ${fw_inv_dict}= Get Software Inventory State 94fc3096a5SGeorge Keishing Rprint Vars fw_inv_dict 95fc3096a5SGeorge Keishing 96fc3096a5SGeorge Keishing # Get the backup firmware version for reference. 97fc3096a5SGeorge Keishing FOR ${id} IN @{fw_inv_dict.keys()} 98*ac155720SSridevi Ramesh IF '${fw_inv_dict['${id}']['functional']}' == 'True' CONTINUE 99fc3096a5SGeorge Keishing # Find the non functional id and fetch the version. 100fc3096a5SGeorge Keishing ${image_version}= Set Variable ${fw_inv_dict['${id}']['version']} 101fc3096a5SGeorge Keishing END 102fc3096a5SGeorge Keishing 103fc3096a5SGeorge Keishing Log To Console Backup firmware version: ${image_version} 104fc3096a5SGeorge Keishing 105fc3096a5SGeorge Keishing Switch Firmware Side ${image_version} 106fc3096a5SGeorge Keishing 107fc3096a5SGeorge Keishing Match BMC Release And Redifsh Firmware Version 108fc3096a5SGeorge Keishing Log To Console The backup firmware image ${image_version} is now functional. 109fc3096a5SGeorge Keishing 110fc3096a5SGeorge Keishing 111fc3096a5SGeorge KeishingMatch BMC Release And Redifsh Firmware Version 112fc3096a5SGeorge Keishing [Documentation] The /etc/os-release vs Redfish FirmwareVersion attribute value from 1134d430283Sganesanb ... /redfish/v1/Managers/${MANAGER_ID} should match. 114fc3096a5SGeorge Keishing 115fc3096a5SGeorge Keishing # Python module: get_bmc_release_info() 116fc3096a5SGeorge Keishing ${bmc_release_info}= utils.Get BMC Release Info 117fc3096a5SGeorge Keishing ${bmc_release}= Set Variable ${bmc_release_info['version_id']} 118fc3096a5SGeorge Keishing Rprint Vars bmc_release 119fc3096a5SGeorge Keishing 1204d430283Sganesanb ${firmware_version}= Redfish.Get Attribute /redfish/v1/Managers/${MANAGER_ID} FirmwareVersion 121fc3096a5SGeorge Keishing Rprint Vars firmware_version 122fc3096a5SGeorge Keishing 123fc3096a5SGeorge Keishing Should Be Equal As Strings ${bmc_release} ${firmware_version} 124fc3096a5SGeorge Keishing ... msg=${bmc_release} does not match redfish version ${firmware_version} 125fc3096a5SGeorge Keishing 126fc3096a5SGeorge Keishing 127fc3096a5SGeorge KeishingSwitch Firmware Side 128fc3096a5SGeorge Keishing [Documentation] Set the backup firmware to functional and verify after BMC rebooted. 129fc3096a5SGeorge Keishing [Arguments] ${image_version} 130fc3096a5SGeorge Keishing 131fc3096a5SGeorge Keishing # Description of argument(s): 132fc3096a5SGeorge Keishing # image_version Version of image. 133fc3096a5SGeorge Keishing 134fc3096a5SGeorge Keishing ${state}= Get Pre Reboot State 135fc3096a5SGeorge Keishing 136fc3096a5SGeorge Keishing Print Timen Switch to back up and rebooting. 137fc3096a5SGeorge Keishing Switch Backup Firmware Image To Functional 138fc3096a5SGeorge Keishing Wait For Reboot start_boot_seconds=${state['epoch_seconds']} 139fc3096a5SGeorge Keishing Print Timen Switch to back up completed. 140fc3096a5SGeorge Keishing 141fc3096a5SGeorge Keishing # Check if the BMC version after rebooted is the same version asked to switch. 1424d430283Sganesanb ${firmware_version}= Redfish.Get Attribute /redfish/v1/Managers/${MANAGER_ID} FirmwareVersion 143fc3096a5SGeorge Keishing Should Be Equal As Strings ${image_version} ${firmware_version} 144fc3096a5SGeorge Keishing ... msg=${image_version} does not match redfish version ${firmware_version} 145