George Keishing | cba6d42 | 2019-07-09 15:01:59 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Firmware image (BMC and Host) upload test using TFTP protocol. |
| 3 | |
| 4 | # Test Parameters: |
| 5 | # TFTP_SERVER The TFTP server host name or IP address. |
| 6 | # IMAGE_FILE_NAME The BMC or Host image file name. |
| 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/boot_utils.robot |
| 15 | Resource ../../lib/bmc_redfish_resource.robot |
| 16 | Resource ../../lib/openbmc_ffdc.robot |
| 17 | Resource ../../lib/code_update_utils.robot |
| 18 | Library ../../lib/code_update_utils.py |
| 19 | Library ../../lib/gen_robot_valid.py |
George Keishing | cfa950c | 2019-07-18 12:46:46 -0500 | [diff] [blame] | 20 | Library ../../lib/tftp_update_utils.py |
George Keishing | cba6d42 | 2019-07-09 15:01:59 -0500 | [diff] [blame] | 21 | |
| 22 | Suite Setup Suite Setup Execution |
| 23 | Suite Teardown Redfish.Logout |
George Keishing | cfa950c | 2019-07-18 12:46:46 -0500 | [diff] [blame] | 24 | Test Setup Run Keywords Redfish Power Off stack_mode=skip quiet=1 AND Redfish.Login |
George Keishing | cba6d42 | 2019-07-09 15:01:59 -0500 | [diff] [blame] | 25 | Test Teardown FFDC On Test Case Fail |
| 26 | |
| 27 | Force Tags tftp_update |
| 28 | |
| 29 | *** Test Cases *** |
| 30 | |
| 31 | TFTP Download Install With ApplyTime OnReset Policy |
| 32 | [Documentation] Download image to BMC using TFTP with OnReset policy and verify installation. |
| 33 | [Tags] TFTP_Download_Install_With_ApplyTime_OnReset_Policy |
George Keishing | cfa950c | 2019-07-18 12:46:46 -0500 | [diff] [blame] | 34 | [Template] TFTP Download Install |
George Keishing | cba6d42 | 2019-07-09 15:01:59 -0500 | [diff] [blame] | 35 | |
George Keishing | cfa950c | 2019-07-18 12:46:46 -0500 | [diff] [blame] | 36 | # policy |
| 37 | OnReset |
| 38 | |
| 39 | |
| 40 | TFTP Download Install With ApplyTime Immediate Policy |
| 41 | [Documentation] Download image to BMC using TFTP with Immediate policy and verify installation. |
| 42 | [Tags] TFTP_Download_Install_With_ApplyTime_Immediate_Policy |
| 43 | [Template] TFTP Download Install |
| 44 | |
| 45 | # policy |
| 46 | Immediate |
| 47 | |
| 48 | |
| 49 | ImageURI Download Install With ApplyTime OnReset Policy |
| 50 | [Documentation] Download image to BMC using ImageURI with OnReset policy and verify installation. |
| 51 | [Tags] ImageURI_Download_Install_With_ApplyTime_OnReset_Policy |
| 52 | [Template] ImageURI Download Install |
| 53 | |
| 54 | # policy |
| 55 | OnReset |
| 56 | |
| 57 | |
| 58 | ImageURI Download Install With ApplyTime Immediate Policy |
| 59 | [Documentation] Download image to BMC using ImageURI with Immediate policy and verify installation. |
| 60 | [Tags] ImageURI_Download_Install_With_ApplyTime_Immediate_Policy |
| 61 | [Template] ImageURI Download Install |
| 62 | |
| 63 | # policy |
| 64 | Immediate |
| 65 | |
| 66 | *** Keywords *** |
| 67 | |
| 68 | Suite Setup Execution |
| 69 | [Documentation] Do the suite setup. |
| 70 | |
| 71 | Redfish.Login |
| 72 | Rvalid Value TFTP_SERVER |
| 73 | Rvalid Value IMAGE_FILE_NAME |
| 74 | |
| 75 | |
| 76 | TFTP Download Install |
| 77 | [Documentation] Download image to BMC using TFTP with ApplyTime policy and verify installation. |
| 78 | [Arguments] ${policy} |
| 79 | |
| 80 | # Description of argument(s): |
| 81 | # policy ApplyTime allowed values (e.g. "OnReset", "Immediate"). |
| 82 | |
| 83 | ${state}= Get Pre Reboot State |
| 84 | Rprint Vars state |
| 85 | |
| 86 | Set ApplyTime policy=${policy} |
George Keishing | cba6d42 | 2019-07-09 15:01:59 -0500 | [diff] [blame] | 87 | |
| 88 | # Download image from TFTP server to BMC. |
| 89 | Redfish.Post /redfish/v1/UpdateService/Actions/UpdateService.SimpleUpdate |
| 90 | ... body={"TransferProtocol" : "TFTP", "ImageURI" : "${TFTP_SERVER}/${IMAGE_FILE_NAME}"} |
| 91 | |
| 92 | # Wait for image tar file to download complete. |
| 93 | ${image_id}= Wait Until Keyword Succeeds 60 sec 10 sec Get Latest Image ID |
| 94 | Rprint Vars image_id |
| 95 | |
| 96 | # Let the image get extracted and it should not fail. |
| 97 | Sleep 5s |
| 98 | Check Image Update Progress State match_state='Disabled', 'Updating' image_id=${image_id} |
| 99 | |
| 100 | # Get image version currently installation in progress. |
| 101 | ${install_version}= Get Firmware Image Version image_id=${image_id} |
| 102 | Rprint Vars install_version |
| 103 | |
| 104 | Check Image Update Progress State match_state='Updating' image_id=${image_id} |
| 105 | |
| 106 | # Wait for the image to install complete. |
George Keishing | cfa950c | 2019-07-18 12:46:46 -0500 | [diff] [blame] | 107 | Wait Until Keyword Succeeds 8 min 15 sec |
George Keishing | cba6d42 | 2019-07-09 15:01:59 -0500 | [diff] [blame] | 108 | ... Check Image Update Progress State match_state='Enabled' image_id=${image_id} |
| 109 | |
George Keishing | cfa950c | 2019-07-18 12:46:46 -0500 | [diff] [blame] | 110 | Reboot And Wait For BMC Standby policy=${policy} start_boot_seconds=${state['epoch_seconds']} |
George Keishing | cba6d42 | 2019-07-09 15:01:59 -0500 | [diff] [blame] | 111 | |
| 112 | # Verify the image is installed and functional. |
| 113 | ${cmd}= Set Variable grep ^VERSION_ID= /etc/os-release | cut -f 2 -d '=' | sed 's/"//g' |
| 114 | ${functional_version} ${stderr} ${rc}= BMC Execute Command ${cmd} |
| 115 | Rvalid Value functional_version valid_values=['${install_version}'] |
| 116 | Rprint Vars functional_version |
| 117 | |
| 118 | |
George Keishing | cfa950c | 2019-07-18 12:46:46 -0500 | [diff] [blame] | 119 | ImageURI Download Install |
| 120 | [Documentation] Download image to BMC using ImageURI with ApplyTime policy and verify installation. |
| 121 | [Arguments] ${policy} |
George Keishing | cba6d42 | 2019-07-09 15:01:59 -0500 | [diff] [blame] | 122 | |
George Keishing | cfa950c | 2019-07-18 12:46:46 -0500 | [diff] [blame] | 123 | # Description of argument(s): |
| 124 | # policy ApplyTime allowed values (e.g. "OnReset", "Immediate"). |
George Keishing | cba6d42 | 2019-07-09 15:01:59 -0500 | [diff] [blame] | 125 | |
George Keishing | cfa950c | 2019-07-18 12:46:46 -0500 | [diff] [blame] | 126 | ${state}= Get Pre Reboot State |
| 127 | Rprint Vars state |
| 128 | |
| 129 | Set ApplyTime policy=${policy} |
| 130 | |
| 131 | # Download image from TFTP server via ImageURI to BMC. |
| 132 | Redfish.Post /redfish/v1/UpdateService/Actions/UpdateService.SimpleUpdate |
| 133 | ... body={"ImageURI": "tftp://${TFTP_SERVER}/${IMAGE_FILE_NAME}"} |
| 134 | |
| 135 | # Wait for image tar file download to complete. |
| 136 | ${image_id}= Wait Until Keyword Succeeds 60 sec 10 sec Get Latest Image ID |
| 137 | Rprint Vars image_id |
| 138 | |
| 139 | # Let the image get extracted and it should not fail. |
| 140 | Sleep 5s |
| 141 | Check Image Update Progress State match_state='Disabled', 'Updating' image_id=${image_id} |
| 142 | |
| 143 | ${install_version}= Get Firmware Image Version image_id=${image_id} |
| 144 | Rprint Vars install_version |
| 145 | |
| 146 | Check Image Update Progress State match_state='Updating' image_id=${image_id} |
| 147 | |
| 148 | # Wait for the image to install complete. |
| 149 | Wait Until Keyword Succeeds 8 min 15 sec |
| 150 | ... Check Image Update Progress State match_state='Enabled' image_id=${image_id} |
| 151 | |
| 152 | Reboot And Wait For BMC Standby policy=${policy} start_boot_seconds=${state['epoch_seconds']} |
| 153 | |
| 154 | # Verify the image is installed and functional. |
| 155 | ${cmd}= Set Variable grep ^VERSION_ID= /etc/os-release | cut -f 2 -d '=' | sed 's/"//g' |
| 156 | ${functional_version} ${stderr} ${rc}= BMC Execute Command ${cmd} |
| 157 | Rvalid Value functional_version valid_values=['${install_version}'] |
| 158 | Rprint Vars functional_version |
| 159 | |
| 160 | |
| 161 | Reboot And Wait For BMC Standby |
| 162 | [Documentation] Reboot or wait for BMC standby post reboot. |
| 163 | [Arguments] ${policy} ${start_boot_seconds} |
| 164 | |
| 165 | # Description of argument(s): |
| 166 | # policy ApplyTime allowed values (e.g. "OnReset", "Immediate"). |
| 167 | # start_boot_seconds See 'Wait For Reboot' for details. |
| 168 | |
| 169 | Run Keyword If '${policy}' == 'OnReset' |
| 170 | ... Redfish OBMC Reboot (off) |
| 171 | ... ELSE |
| 172 | ... Wait For Reboot start_boot_seconds=${start_boot_seconds} |