Sushil Singh | c08932e | 2019-09-10 15:23:10 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Redfish BMC/Host signed and unsigned code update |
| 3 | ... over BMC functional signed image. |
| 4 | |
| 5 | # Test Parameters: |
| 6 | # IMAGE_FILE_PATH The path to the BMC/Host image file. |
| 7 | # |
| 8 | # Firmware update states: |
| 9 | # Enabled Image is installed and either functional or active. |
| 10 | # Disabled Image installation failed or ready for activation. |
| 11 | # Updating Image installation currently in progress. |
| 12 | |
| 13 | Resource ../../lib/resource.robot |
| 14 | Resource ../../lib/bmc_redfish_resource.robot |
| 15 | Resource ../../lib/openbmc_ffdc.robot |
| 16 | Resource ../../lib/common_utils.robot |
| 17 | Resource ../../lib/code_update_utils.robot |
| 18 | Resource ../../lib/redfish_code_update_utils.robot |
Sushil Singh | c08932e | 2019-09-10 15:23:10 -0500 | [diff] [blame] | 19 | Library ../../lib/gen_robot_valid.py |
| 20 | Library ../../lib/var_funcs.py |
Sushil Singh | d7fb62f | 2022-05-13 05:57:13 -0500 | [diff] [blame] | 21 | Library ../../lib/gen_robot_keyword.py |
Sushil Singh | c08932e | 2019-09-10 15:23:10 -0500 | [diff] [blame] | 22 | |
| 23 | Suite Setup Suite Setup Execution |
| 24 | Suite Teardown Redfish.Logout |
| 25 | Test Setup Printn |
| 26 | Test Teardown FFDC On Test Case Fail |
| 27 | |
George Keishing | 504a371 | 2022-07-22 09:41:28 -0500 | [diff] [blame] | 28 | Force Tags Signed_Upload_Test |
Sushil Singh | d7fb62f | 2022-05-13 05:57:13 -0500 | [diff] [blame] | 29 | |
| 30 | *** Variables *** |
| 31 | |
| 32 | ${ACTIVATION_WAIT_TIMEOUT} 8 min |
| 33 | |
Sushil Singh | c08932e | 2019-09-10 15:23:10 -0500 | [diff] [blame] | 34 | *** Test Cases *** |
| 35 | |
| 36 | Redfish Signed Code Update |
| 37 | [Documentation] BMC/Host signed code update over functional signed |
| 38 | ... image, when FieldMode is set to true value. |
| 39 | [Tags] Redfish_Signed_Code_Update |
| 40 | [Template] Redfish Signed Firmware Update |
| 41 | |
| 42 | # image_file_path |
| 43 | ${IMAGE_FILE_PATH} |
| 44 | |
| 45 | |
| 46 | Redfish Fail Unsigned Code Update |
| 47 | [Documentation] BMC/Host unsigned code update over functional signed |
| 48 | ... image, when Field Mode is set to true to value. |
| 49 | [Tags] Redfish_Fail_Unsigned_Code_Update |
| 50 | [Template] Redfish Unsigned Firmware Update |
| 51 | |
| 52 | # image_file_path |
| 53 | ${IMAGE_FILE_PATH} |
| 54 | |
| 55 | |
Sushil Singh | 2a520ee | 2019-09-16 14:19:17 -0500 | [diff] [blame] | 56 | REST Failure When Field Mode Set To Disable |
| 57 | [Documentation] Verify error while disabling field mode from enabled mode. |
| 58 | [Tags] REST_Failure_When_Field_Mode_Set_To_Disable |
| 59 | |
| 60 | ${args}= Create Dictionary data=${0} |
| 61 | ${resp}= OpenBMC Post Request ${SOFTWARE_VERSION_URI}attr/FieldModeEnabled data=${args} |
| 62 | Should Be Equal As Strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED} |
| 63 | |
| 64 | |
Sushil Singh | c08932e | 2019-09-10 15:23:10 -0500 | [diff] [blame] | 65 | *** Keywords *** |
| 66 | |
| 67 | Suite Setup Execution |
| 68 | [Documentation] Do the suite setup. |
| 69 | |
| 70 | Valid File Path IMAGE_FILE_PATH |
Sushil Singh | 2334948 | 2019-09-18 07:35:01 -0500 | [diff] [blame] | 71 | Enable Field Mode And Verify Unmount |
Sushil Singh | c08932e | 2019-09-10 15:23:10 -0500 | [diff] [blame] | 72 | Redfish.Login |
Tim Lee | 4aff2d0 | 2021-06-08 13:26:25 +0800 | [diff] [blame] | 73 | Redfish Delete All BMC Dumps |
Sushil Singh | c08932e | 2019-09-10 15:23:10 -0500 | [diff] [blame] | 74 | Redfish Purge Event Log |
| 75 | |
| 76 | |
| 77 | Redfish Signed Firmware Update |
| 78 | [Documentation] Update the BMC/Host firmware via redfish interface. |
| 79 | [Arguments] ${image_file_path} |
| 80 | |
| 81 | # Description of argument(s): |
| 82 | # IMAGE_FILE_PATH The path to the image file. |
| 83 | |
| 84 | Field Mode Should Be Enabled |
| 85 | ${image_version}= Get Version Tar ${image_file_path} |
Sushil Singh | d7fb62f | 2022-05-13 05:57:13 -0500 | [diff] [blame] | 86 | |
| 87 | ${post_code_update_actions}= Get Post Boot Action |
Sushil Singh | c08932e | 2019-09-10 15:23:10 -0500 | [diff] [blame] | 88 | ${state}= Get Pre Reboot State |
| 89 | Rprint Vars state |
Sushil Singh | d7fb62f | 2022-05-13 05:57:13 -0500 | [diff] [blame] | 90 | |
| 91 | Run Keyword And Ignore Error Set ApplyTime policy=OnReset |
| 92 | |
| 93 | # Python module: get_member_list(resource_path) |
| 94 | ${before_inv_list}= redfish_utils.Get Member List /redfish/v1/UpdateService/FirmwareInventory |
| 95 | Log To Console Current images on the BMC before upload: ${before_inv_list} |
| 96 | |
| 97 | Redfish Upload Image /redfish/v1/UpdateService ${IMAGE_FILE_PATH} |
| 98 | |
| 99 | # Python module: get_member_list(resource_path) |
| 100 | ${after_inv_list}= redfish_utils.Get Member List /redfish/v1/UpdateService/FirmwareInventory |
| 101 | Log To Console Current images on the BMC after upload: ${after_inv_list} |
| 102 | |
| 103 | ${image_id}= Evaluate set(${after_inv_list}) - set(${before_inv_list}) |
| 104 | Should Not Be Empty ${image_id} |
| 105 | ${image_id}= Evaluate list(${image_id})[0].split('/')[-1] |
| 106 | Log To Console Firmware installation in progress with image id:: ${image_id} |
| 107 | |
| 108 | Wait Until Keyword Succeeds ${ACTIVATION_WAIT_TIMEOUT} 10 sec |
| 109 | ... Check Image Update Progress State match_state='Enabled' image_id=${image_id} |
| 110 | |
| 111 | # Python module: get_version_tar(tar_file_path) |
| 112 | ${tar_version}= code_update_utils.Get Version Tar ${IMAGE_FILE_PATH} |
| 113 | ${image_info}= Get Software Inventory State By Version ${tar_version} |
| 114 | |
| 115 | Run Key ${post_code_update_actions['${image_info["image_type"]}']['OnReset']} |
| 116 | Redfish.Login |
| 117 | Redfish Verify BMC Version ${IMAGE_FILE_PATH} |
Sushil Singh | c08932e | 2019-09-10 15:23:10 -0500 | [diff] [blame] | 118 | |
| 119 | |
| 120 | Redfish Unsigned Firmware Update |
| 121 | [Documentation] Update the BMC/Host firmware via redfish interface. |
| 122 | [Arguments] ${image_file_path} |
| 123 | |
| 124 | # Description of argument(s): |
| 125 | # IMAGE_FILE_PATH The path to the image file. |
| 126 | |
| 127 | Field Mode Should Be Enabled |
| 128 | Set ApplyTime policy=Immediate |
| 129 | Redfish Upload Image ${REDFISH_BASE_URI}UpdateService ${image_file_path} |
| 130 | ${image_id}= Get Latest Image ID |
| 131 | Rprint Vars image_id |
| 132 | Sleep 5s |
| 133 | Wait Until Keyword Succeeds 8 min 20 sec |
| 134 | ... Check Image Update Progress State |
| 135 | ... match_state='Disabled', 'Updating', 'Disabled' image_id=${image_id} |
| 136 | Delete Software Object |
| 137 | ... /xyz/openbmc_project/software/${image_id} |
| 138 | |