Sushil Singh | 227dcaa | 2021-09-17 09:16:44 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Update the BMC code 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 | |
| 12 | Resource ../../lib/resource.robot |
| 13 | Resource ../../lib/bmc_redfish_resource.robot |
| 14 | Resource ../../lib/openbmc_ffdc.robot |
| 15 | Resource ../../lib/common_utils.robot |
| 16 | Resource ../../lib/code_update_utils.robot |
| 17 | Resource ../../lib/redfish_code_update_utils.robot |
| 18 | Resource ../../lib/utils.robot |
| 19 | Library ../../lib/gen_robot_valid.py |
| 20 | Library ../../lib/var_funcs.py |
| 21 | Library ../../lib/gen_robot_keyword.py |
| 22 | Library ../../lib/code_update_utils.py |
| 23 | |
| 24 | Suite Setup Suite Setup Execution |
| 25 | Suite Teardown Redfish.Logout |
| 26 | Test Setup Printn |
| 27 | Test Teardown FFDC On Test Case Fail |
| 28 | |
| 29 | # Force the test to timedout to prevent test hanging. |
| 30 | Test Timeout 30 minutes |
| 31 | |
| 32 | *** Test Cases *** |
| 33 | |
| 34 | Redfish Host Code Update |
| 35 | [Documentation] Update the firmware image. |
| 36 | [Tags] Redfish_Host_Code_Update |
| 37 | |
| 38 | ${image_version}= Get Version Tar ${IMAGE_FILE_PATH} |
| 39 | Rprint Vars image_version |
| 40 | |
| 41 | ${sw_inv}= Get Functional Firmware Host image |
Sushil Singh | 39132a9 | 2022-02-09 01:20:57 -0600 | [diff] [blame] | 42 | ${functional_sw_inv}= Get Non Functional Firmware ${sw_inv} True |
Sushil Singh | 227dcaa | 2021-09-17 09:16:44 -0500 | [diff] [blame] | 43 | |
Sushil Singh | 39132a9 | 2022-02-09 01:20:57 -0600 | [diff] [blame] | 44 | ${num_records}= Get Length ${functional_sw_inv} |
| 45 | |
| 46 | Run Keyword If ${num_records} != 0 Pass Execution If '${functional_sw_inv['version']}' == '${image_version}' |
| 47 | ... The existing ${image_version} firmware is already functional. |
Sushil Singh | 227dcaa | 2021-09-17 09:16:44 -0500 | [diff] [blame] | 48 | |
| 49 | ${post_code_update_actions}= Get Post Boot Action |
| 50 | ${state}= Get Pre Reboot State |
| 51 | Rprint Vars state |
| 52 | |
Sushil Singh | 227dcaa | 2021-09-17 09:16:44 -0500 | [diff] [blame] | 53 | Print Timen Performing firmware update ${image_version}. |
| 54 | |
| 55 | Redfish Update Firmware |
| 56 | |
| 57 | |
| 58 | *** Keywords *** |
| 59 | |
| 60 | Suite Setup Execution |
| 61 | [Documentation] Do the suite setup. |
| 62 | |
| 63 | Redfish.Login |
| 64 | # Delete BMC dump and Error logs. |
| 65 | Run Keyword And Ignore Error Redfish Delete All BMC Dumps |
| 66 | Run Keyword And Ignore Error Redfish Purge Event Log |
| 67 | # Checking for file existence. |
| 68 | Valid File Path IMAGE_FILE_PATH |
| 69 | |
| 70 | |
| 71 | Redfish Update Firmware |
| 72 | [Documentation] Update the BMC firmware via redfish interface. |
| 73 | |
| 74 | Redfish.Login |
| 75 | ${post_code_update_actions}= Get Post Boot Action |
| 76 | Rprint Vars post_code_update_actions |
| 77 | Run Keyword And Ignore Error Set ApplyTime policy=OnReset |
| 78 | Redfish Upload Image And Check Progress State |
| 79 | ${tar_version}= Get Version Tar ${IMAGE_FILE_PATH} |
| 80 | ${image_info}= Get Software Inventory State By Version ${tar_version} |
| 81 | Run Key ${post_code_update_actions['${image_info["image_type"]}']['OnReset']} |
| 82 | Redfish.Login |
| 83 | Redfish Verify Host Version ${IMAGE_FILE_PATH} |
| 84 | |