1*** Settings *** 2Documentation Update firmware on a target MCU via Redifsh. 3 4# Test Parameters: 5# IMAGE_MCU_FILE_PATH The path to the MCU 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/boot_utils.robot 15Resource ../lib/openbmc_ffdc.robot 16Resource ../lib/common_utils.robot 17Resource ../lib/code_update_utils.robot 18Resource ../lib/dump_utils.robot 19Resource ../lib/logging_utils.robot 20Resource ../lib/redfish_code_update_utils.robot 21Resource ../lib/utils.robot 22Library ../lib/gen_robot_valid.py 23Library ../lib/tftp_update_utils.py 24 25Suite Setup Suite Setup Execution 26Suite Teardown Redfish.Logout 27Test Setup Printn 28Test Teardown FFDC On Test Case Fail 29 30Force Tags Mcu_Code_Update 31 32*** Test Cases *** 33 34Redfish Mcu Code Update With ApplyTime OnReset 35 [Documentation] Update the firmaware image with ApplyTime of OnReset. 36 [Tags] Redfish_Mcu_Code_Update_With_ApplyTime_OnReset 37 [Template] Redfish Update Firmware 38 39 # policy 40 OnReset ${IMAGE_MCU_FILE_PATH_0} 41 42 43Redfish Mcu Code Update With ApplyTime Immediate 44 [Documentation] Update the firmaware image with ApplyTime of Immediate. 45 [Tags] Redfish_Mcu_Code_Update_With_ApplyTime_Immediate 46 [Template] Redfish Update Firmware 47 48 # policy 49 Immediate ${IMAGE_MCU_FILE_PATH_1} 50 51 52*** Keywords *** 53 54Suite Setup Execution 55 [Documentation] Do the suite setup. 56 57 # Checking for file existence. 58 Valid File Path IMAGE_MCU_FILE_PATH_0 59 Valid File Path IMAGE_MCU_FILE_PATH_1 60 61 Redfish.Login 62 Delete All BMC Dump 63 Redfish Purge Event Log 64 65 66Redfish Verify MCU Version 67 [Documentation] Verify that the version on the MCU is the same as the 68 ... version in the given image via Redfish. 69 [Arguments] ${image_file_path} 70 71 # Description of argument(s): 72 # image_file_path Path to the image tarball. 73 74 # Extract the version from the image tarball on our local system. 75 ${tar_version}= Get Version Tar ${image_file_path} 76 77 ${image_info}= Get Software Inventory State By Version ${tar_version} 78 ${image_id}= Get Image Id By Image Info ${image_info} 79 80 ${mcu_version}= Redfish.Get Attribute /redfish/v1/UpdateService/FirmwareInventory/${image_id} Version 81 82 Valid Value mcu_version valid_values=['${tar_version}'] 83 84 85Redfish Update Firmware 86 [Documentation] Update the BMC firmware via redfish interface. 87 [Arguments] ${apply_time} ${image_file_path} 88 89 # Description of argument(s): 90 # policy ApplyTime allowed values (e.g. "OnReset", "Immediate"). 91 92 Redfish.Login 93 94 Set ApplyTime policy=${apply_time} 95 96 Redfish Upload Image /redfish/v1/UpdateService ${image_file_path} 97 Sleep 30s 98 99 ${image_version}= Get Version Tar ${image_file_path} 100 ${image_info}= Get Software Inventory State By Version ${image_version} 101 ${image_id}= Get Image Id By Image Info ${image_info} 102 103 Redfish.Login 104 Redfish Verify MCU Version ${image_file_path} 105 106 107Get Image Id By Image Info 108 [Documentation] Get image ID from image_info. 109 [Arguments] ${image_info} 110 111 [Return] ${image_info["image_id"]} 112