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 |
| 21 | |
| 22 | Suite Setup Suite Setup Execution |
| 23 | Suite Teardown Redfish.Logout |
| 24 | Test Setup Printn |
| 25 | Test Teardown FFDC On Test Case Fail |
| 26 | |
| 27 | *** Test Cases *** |
| 28 | |
| 29 | Redfish Signed Code Update |
| 30 | [Documentation] BMC/Host signed code update over functional signed |
| 31 | ... image, when FieldMode is set to true value. |
| 32 | [Tags] Redfish_Signed_Code_Update |
| 33 | [Template] Redfish Signed Firmware Update |
| 34 | |
| 35 | # image_file_path |
| 36 | ${IMAGE_FILE_PATH} |
| 37 | |
| 38 | |
| 39 | Redfish Fail Unsigned Code Update |
| 40 | [Documentation] BMC/Host unsigned code update over functional signed |
| 41 | ... image, when Field Mode is set to true to value. |
| 42 | [Tags] Redfish_Fail_Unsigned_Code_Update |
| 43 | [Template] Redfish Unsigned Firmware Update |
| 44 | |
| 45 | # image_file_path |
| 46 | ${IMAGE_FILE_PATH} |
| 47 | |
| 48 | |
Sushil Singh | 2a520ee | 2019-09-16 14:19:17 -0500 | [diff] [blame] | 49 | REST Failure When Field Mode Set To Disable |
| 50 | [Documentation] Verify error while disabling field mode from enabled mode. |
| 51 | [Tags] REST_Failure_When_Field_Mode_Set_To_Disable |
| 52 | |
| 53 | ${args}= Create Dictionary data=${0} |
| 54 | ${resp}= OpenBMC Post Request ${SOFTWARE_VERSION_URI}attr/FieldModeEnabled data=${args} |
| 55 | Should Be Equal As Strings ${resp.status_code} ${HTTP_METHOD_NOT_ALLOWED} |
| 56 | |
| 57 | |
Sushil Singh | c08932e | 2019-09-10 15:23:10 -0500 | [diff] [blame] | 58 | *** Keywords *** |
| 59 | |
| 60 | Suite Setup Execution |
| 61 | [Documentation] Do the suite setup. |
| 62 | |
| 63 | Valid File Path IMAGE_FILE_PATH |
Sushil Singh | 2334948 | 2019-09-18 07:35:01 -0500 | [diff] [blame] | 64 | Enable Field Mode And Verify Unmount |
Sushil Singh | c08932e | 2019-09-10 15:23:10 -0500 | [diff] [blame] | 65 | Redfish.Login |
Tim Lee | 4aff2d0 | 2021-06-08 13:26:25 +0800 | [diff] [blame] | 66 | Redfish Delete All BMC Dumps |
Sushil Singh | c08932e | 2019-09-10 15:23:10 -0500 | [diff] [blame] | 67 | Redfish Purge Event Log |
| 68 | |
| 69 | |
| 70 | Redfish Signed Firmware Update |
| 71 | [Documentation] Update the BMC/Host firmware via redfish interface. |
| 72 | [Arguments] ${image_file_path} |
| 73 | |
| 74 | # Description of argument(s): |
| 75 | # IMAGE_FILE_PATH The path to the image file. |
| 76 | |
| 77 | Field Mode Should Be Enabled |
| 78 | ${image_version}= Get Version Tar ${image_file_path} |
| 79 | ${state}= Get Pre Reboot State |
| 80 | Rprint Vars state |
Sushil Singh | 6f86f17 | 2019-10-30 11:36:25 -0500 | [diff] [blame] | 81 | Set ApplyTime policy=Immediate |
| 82 | Redfish Upload Image And Check Progress State |
Sushil Singh | c08932e | 2019-09-10 15:23:10 -0500 | [diff] [blame] | 83 | ${image_info}= Get Software Inventory State By Version ${image_version} |
| 84 | Run Keyword If 'BMC update' == '${image_info["image_type"]}' |
| 85 | ... Reboot BMC And Verify BMC Image Immediate start_boot_seconds=${state['epoch_seconds']} |
| 86 | ... ELSE |
| 87 | ... Poweron Host And Verify Host Image |
| 88 | |
| 89 | |
| 90 | Redfish Unsigned Firmware Update |
| 91 | [Documentation] Update the BMC/Host firmware via redfish interface. |
| 92 | [Arguments] ${image_file_path} |
| 93 | |
| 94 | # Description of argument(s): |
| 95 | # IMAGE_FILE_PATH The path to the image file. |
| 96 | |
| 97 | Field Mode Should Be Enabled |
| 98 | Set ApplyTime policy=Immediate |
| 99 | Redfish Upload Image ${REDFISH_BASE_URI}UpdateService ${image_file_path} |
| 100 | ${image_id}= Get Latest Image ID |
| 101 | Rprint Vars image_id |
| 102 | Sleep 5s |
| 103 | Wait Until Keyword Succeeds 8 min 20 sec |
| 104 | ... Check Image Update Progress State |
| 105 | ... match_state='Disabled', 'Updating', 'Disabled' image_id=${image_id} |
| 106 | Delete Software Object |
| 107 | ... /xyz/openbmc_project/software/${image_id} |
| 108 | |