1*** Settings *** 2Documentation Update firmware 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/dump_utils.robot 18Resource ../../lib/logging_utils.robot 19Resource ../../lib/redfish_code_update_utils.robot 20Library ../../lib/gen_robot_valid.py 21Library ../../lib/tftp_update_utils.py 22Library ../../lib/gen_robot_keyword.py 23 24Suite Setup Suite Setup Execution 25Suite Teardown Redfish.Logout 26Test Setup Printn 27Test Teardown FFDC On Test Case Fail 28 29Force Tags BMC_Code_Update 30 31*** Test Cases *** 32 33Redfish Code Update With ApplyTime OnReset 34 [Documentation] Update the firmaware image with ApplyTime of OnReset. 35 [Tags] Redfish_Code_Update_With_ApplyTime_OnReset 36 [Template] Redfish Update Firmware 37 38 # policy 39 OnReset 40 41 42Redfish Code Update With ApplyTime Immediate 43 [Documentation] Update the firmaware image with ApplyTime of Immediate. 44 [Tags] Redfish_Code_Update_With_ApplyTime_Immediate 45 [Template] Redfish Update Firmware 46 47 # policy 48 Immediate 49 50 51Redfish Code Update With Multiple Firmware 52 [Documentation] Update the firmaware image with ApplyTime of Immediate. 53 [Tags] Redfish_Code_Update_With_Multiple_Firmware 54 [Template] Redfish Multiple Upload Image And Check Progress State 55 56 # policy image_file_path alternate_image_file_path 57 Immediate ${IMAGE_FILE_PATH} ${ALTERNATE_IMAGE_FILE_PATH} 58 59 60*** Keywords *** 61 62Suite Setup Execution 63 [Documentation] Do the suite setup. 64 65 Valid File Path IMAGE_FILE_PATH 66 Redfish.Login 67 Delete All BMC Dump 68 Redfish Purge Event Log 69 70 71Redfish Update Firmware 72 [Documentation] Update the BMC firmware via redfish interface. 73 [Arguments] ${apply_time} 74 75 # Description of argument(s): 76 # policy ApplyTime allowed values (e.g. "OnReset", "Immediate"). 77 78 ${state}= Get Pre Reboot State 79 Rprint Vars state 80 Set ApplyTime policy=${apply_Time} 81 ${get_json_file}= OperatingSystem.Get File lib/applytime_table.json 82 ${post_code_update_actions}= Evaluate json.loads('''${get_json_file}''') json 83 Redfish Upload Image And Check Progress State 84 Run Key ${post_code_update_actions['bmc']['${apply_time}']} 85 Redfish.Login 86 Verify Get ApplyTime ${apply_time} 87 88 89Redfish Multiple Upload Image And Check Progress State 90 [Documentation] Update multiple BMC firmware via redfish interface and check status. 91 [Arguments] ${apply_time} ${IMAGE_FILE_PATH} ${ALTERNATE_IMAGE_FILE_PATH} 92 93 # Description of argument(s): 94 # apply_time ApplyTime allowed values (e.g. "OnReset", "Immediate"). 95 # IMAGE_FILE_PATH The path to BMC image file. 96 # ALTERNATE_IMAGE_FILE_PATH The path to alternate BMC image file. 97 98 Valid File Path ALTERNATE_IMAGE_FILE_PATH 99 ${state}= Get Pre Reboot State 100 Rprint Vars state 101 102 Set ApplyTime policy=${apply_time} 103 Redfish Upload Image ${REDFISH_BASE_URI}UpdateService ${IMAGE_FILE_PATH} 104 105 ${first_image_id}= Get Latest Image ID 106 Rprint Vars first_image_id 107 Sleep 5s 108 Redfish Upload Image ${REDFISH_BASE_URI}UpdateService ${ALTERNATE_IMAGE_FILE_PATH} 109 110 ${second_image_id}= Get Latest Image ID 111 Rprint Vars second_image_id 112 113 Check Image Update Progress State 114 ... match_state='Updating', 'Disabled' image_id=${second_image_id} 115 116 Check Image Update Progress State 117 ... match_state='Updating' image_id=${first_image_id} 118 119 Wait Until Keyword Succeeds 8 min 20 sec 120 ... Check Image Update Progress State 121 ... match_state='Enabled' image_id=${first_image_id} 122 Reboot BMC And Verify BMC Image ${apply_time} start_boot_seconds=${state['epoch_seconds']} 123 124