| George Keishing | 6ecc04b | 2021-06-04 04:15:06 -0500 | [diff] [blame] | 1 | *** Settings *** | 
|  | 2 | Documentation            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 |  | 
| Stanley Chu | bc28435 | 2021-06-08 10:48:48 +0800 | [diff] [blame] | 12 | Resource                 ../../lib/resource.robot | 
|  | 13 | Resource                 ../../lib/bmc_redfish_resource.robot | 
|  | 14 | Resource                 ../../lib/boot_utils.robot | 
|  | 15 | Resource                 ../../lib/openbmc_ffdc.robot | 
|  | 16 | Resource                 ../../lib/common_utils.robot | 
|  | 17 | Resource                 ../../lib/code_update_utils.robot | 
|  | 18 | Resource                 ../../lib/dump_utils.robot | 
|  | 19 | Resource                 ../../lib/logging_utils.robot | 
|  | 20 | Resource                 ../../lib/redfish_code_update_utils.robot | 
|  | 21 | Resource                 ../../lib/utils.robot | 
|  | 22 | Library                  ../../lib/gen_robot_valid.py | 
|  | 23 | Library                  ../../lib/tftp_update_utils.py | 
| George Keishing | 6ecc04b | 2021-06-04 04:15:06 -0500 | [diff] [blame] | 24 |  | 
|  | 25 | Suite Setup              Suite Setup Execution | 
|  | 26 | Suite Teardown           Redfish.Logout | 
|  | 27 | Test Setup               Printn | 
|  | 28 | Test Teardown            FFDC On Test Case Fail | 
|  | 29 |  | 
| Matt Fischer | 6fb70d9 | 2023-10-24 19:06:33 -0600 | [diff] [blame] | 30 | Test Tags               Mcu_Code_Update | 
| George Keishing | 6ecc04b | 2021-06-04 04:15:06 -0500 | [diff] [blame] | 31 |  | 
|  | 32 | *** Test Cases *** | 
|  | 33 |  | 
|  | 34 | Redfish Mcu Code Update With ApplyTime OnReset | 
|  | 35 | [Documentation]  Update the firmware 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 |  | 
|  | 43 | Redfish Mcu Code Update With ApplyTime Immediate | 
|  | 44 | [Documentation]  Update the firmware 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 |  | 
|  | 54 | Suite 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 | 
| Tim Lee | 4aff2d0 | 2021-06-08 13:26:25 +0800 | [diff] [blame] | 62 | Redfish Delete All BMC Dumps | 
| George Keishing | 6ecc04b | 2021-06-04 04:15:06 -0500 | [diff] [blame] | 63 | Redfish Purge Event Log | 
|  | 64 |  | 
|  | 65 |  | 
|  | 66 | Redfish 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 |  | 
|  | 85 | Redfish Update Firmware | 
|  | 86 | [Documentation]  Update the BMC firmware via redfish interface. | 
|  | 87 | [Arguments]  ${apply_time}  ${image_file_path} | 
|  | 88 |  | 
|  | 89 | # Description of argument(s): | 
| Sridevi Ramesh | 34f0bf0 | 2025-07-24 09:31:26 -0500 | [diff] [blame] | 90 | # policy            ApplyTime allowed values (e.g. "OnReset", "Immediate"). | 
|  | 91 | # image_file_path   Path to the image tarball. | 
| George Keishing | 6ecc04b | 2021-06-04 04:15:06 -0500 | [diff] [blame] | 92 |  | 
|  | 93 | Redfish.Login | 
|  | 94 |  | 
|  | 95 | Set ApplyTime  policy=${apply_time} | 
|  | 96 |  | 
| Sushil Singh | 5eb37da | 2023-05-18 01:50:32 -0500 | [diff] [blame] | 97 | # URI : /redfish/v1/UpdateService | 
|  | 98 | # "HttpPushUri": "/redfish/v1/UpdateService/update", | 
|  | 99 |  | 
|  | 100 | ${redfish_update_uri}=  Get Redfish Update Service URI | 
|  | 101 | Redfish Upload Image  ${redfish_update_uri}  ${image_file_path} | 
| George Keishing | 6ecc04b | 2021-06-04 04:15:06 -0500 | [diff] [blame] | 102 | Sleep  30s | 
|  | 103 |  | 
|  | 104 | ${image_version}=  Get Version Tar  ${image_file_path} | 
|  | 105 | ${image_info}=  Get Software Inventory State By Version  ${image_version} | 
|  | 106 | ${image_id}=  Get Image Id By Image Info  ${image_info} | 
|  | 107 |  | 
|  | 108 | Redfish.Login | 
|  | 109 | Redfish Verify MCU Version  ${image_file_path} | 
|  | 110 |  | 
|  | 111 |  | 
|  | 112 | Get Image Id By Image Info | 
|  | 113 | [Documentation]  Get image ID from image_info. | 
|  | 114 | [Arguments]  ${image_info} | 
|  | 115 |  | 
| Sridevi Ramesh | 34f0bf0 | 2025-07-24 09:31:26 -0500 | [diff] [blame] | 116 | # Description of argument(s): | 
|  | 117 | # image_info  Image info. | 
|  | 118 |  | 
| George Keishing | 409df05 | 2024-01-17 22:36:14 +0530 | [diff] [blame] | 119 | RETURN  ${image_info["image_id"]} |