Sushil Singh | 47f8013 | 2019-08-27 04:53:24 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation Test upload image with invalid images. |
| 3 | ... This test expects the following bad tarball image files |
Sushil Singh | c51eee7 | 2019-09-01 11:13:37 -0500 | [diff] [blame] | 4 | ... to exist in the BAD_IMAGES_DIR_PATH/TFTP_SERVER: |
Sushil Singh | 47f8013 | 2019-08-27 04:53:24 -0500 | [diff] [blame] | 5 | ... bmc_bad_manifest.ubi.mtd.tar |
| 6 | ... bmc_nokernel_image.ubi.mtd.tar |
| 7 | ... bmc_invalid_key.ubi.mtd.tar |
| 8 | ... pnor_bad_manifest.pnor.squashfs.tar |
| 9 | ... pnor_nokernel_image.pnor.squashfs.tar |
| 10 | ... pnor_invalid_key.pnor.squashfs.tar |
| 11 | |
| 12 | # Test Parameters: |
| 13 | # OPENBMC_HOST The BMC host name or IP address. |
| 14 | # OPENBMC_USERNAME The OS login userid. |
| 15 | # OPENBMC_PASSWORD The password for the OS login. |
| 16 | # BAD_IMAGES_DIR_PATH The path to the directory which contains the bad image files. |
Sushil Singh | c51eee7 | 2019-09-01 11:13:37 -0500 | [diff] [blame] | 17 | # TFTP_SERVER The host name or IP of the TFTP server. |
Sushil Singh | 47f8013 | 2019-08-27 04:53:24 -0500 | [diff] [blame] | 18 | |
| 19 | Resource ../../lib/connection_client.robot |
| 20 | Resource ../../lib/rest_client.robot |
| 21 | Resource ../../lib/openbmc_ffdc.robot |
| 22 | Resource ../../lib/bmc_redfish_resource.robot |
| 23 | Resource ../../lib/code_update_utils.robot |
| 24 | Library OperatingSystem |
| 25 | Library ../../lib/code_update_utils.py |
| 26 | Library ../../lib/gen_robot_valid.py |
| 27 | |
| 28 | Suite Setup Suite Setup Execution |
| 29 | Suite Teardown Redfish.Logout |
| 30 | Test Setup Printn |
Sushil Singh | 1926902 | 2022-04-01 02:50:50 -0500 | [diff] [blame] | 31 | Test Teardown Test Teardown Execution |
Sushil Singh | 47f8013 | 2019-08-27 04:53:24 -0500 | [diff] [blame] | 32 | |
| 33 | Force Tags Upload_Test |
| 34 | |
| 35 | *** Variables *** |
| 36 | ${timeout} 20 |
| 37 | ${QUIET} ${1} |
| 38 | ${image_id} ${EMPTY} |
| 39 | |
| 40 | *** Test Cases *** |
| 41 | |
George Keishing | 5236ec5 | 2022-01-31 12:07:58 -0600 | [diff] [blame] | 42 | Redfish Failure To Upload BMC Image With Bad Manifest |
Sushil Singh | 47f8013 | 2019-08-27 04:53:24 -0500 | [diff] [blame] | 43 | [Documentation] Upload a BMC firmware with a bad MANFIEST file. |
| 44 | [Tags] Redfish_Failure_To_Upload_BMC_Image_With_Bad_Manifest |
| 45 | [Template] Redfish Bad Firmware Update |
| 46 | |
| 47 | # Image File Name |
| 48 | bmc_bad_manifest.ubi.mtd.tar |
| 49 | |
| 50 | |
George Keishing | 5236ec5 | 2022-01-31 12:07:58 -0600 | [diff] [blame] | 51 | Redfish Failure To Upload Empty BMC Image |
Sushil Singh | 47f8013 | 2019-08-27 04:53:24 -0500 | [diff] [blame] | 52 | [Documentation] Upload a BMC firmware with no kernel image. |
| 53 | [Tags] Redfish_Failure_To_Upload_Empty_BMC_Image |
| 54 | [Template] Redfish Bad Firmware Update |
| 55 | |
| 56 | # Image File Name |
| 57 | bmc_nokernel_image.ubi.mtd.tar |
| 58 | |
| 59 | |
George Keishing | 5236ec5 | 2022-01-31 12:07:58 -0600 | [diff] [blame] | 60 | Redfish Failure To Upload Host Image With Bad Manifest |
Sushil Singh | 47f8013 | 2019-08-27 04:53:24 -0500 | [diff] [blame] | 61 | [Documentation] Upload a PNOR firmware with a bad MANIFEST file. |
| 62 | [Tags] Redfish_Failure_To_Upload_Host_Image_With_Bad_Manifest |
| 63 | [Template] Redfish Bad Firmware Update |
| 64 | |
| 65 | # Image File Name |
| 66 | pnor_bad_manifest.pnor.squashfs.tar |
| 67 | |
| 68 | |
George Keishing | 5236ec5 | 2022-01-31 12:07:58 -0600 | [diff] [blame] | 69 | Redfish Failure To Upload Empty Host Image |
Sushil Singh | 47f8013 | 2019-08-27 04:53:24 -0500 | [diff] [blame] | 70 | [Documentation] Upload a PNOR firmware with no kernel Image. |
| 71 | [Tags] Redfish_Failure_To_Upload_Empty_Host_Image |
| 72 | [Template] Redfish Bad Firmware Update |
| 73 | |
| 74 | # Image File Name |
| 75 | pnor_nokernel_image.pnor.squashfs.tar |
| 76 | |
| 77 | |
George Keishing | 5236ec5 | 2022-01-31 12:07:58 -0600 | [diff] [blame] | 78 | Redfish TFTP Failure To Upload BMC Image With Bad Manifest |
Sushil Singh | c51eee7 | 2019-09-01 11:13:37 -0500 | [diff] [blame] | 79 | [Documentation] Upload a BMC firmware with a bad MANFIEST file via TFTP. |
| 80 | [Tags] Redfish_TFTP_Failure_To_Upload_BMC_Image_With_Bad_Manifest |
| 81 | [Template] Redfish TFTP Bad Firmware Update |
| 82 | |
| 83 | # Image File Name |
| 84 | bmc_bad_manifest.ubi.mtd.tar |
| 85 | |
| 86 | |
George Keishing | 5236ec5 | 2022-01-31 12:07:58 -0600 | [diff] [blame] | 87 | Redfish TFTP Failure To Upload Empty BMC Image |
Sushil Singh | c51eee7 | 2019-09-01 11:13:37 -0500 | [diff] [blame] | 88 | [Documentation] Upload a BMC firmware with no kernel image via TFTP. |
| 89 | [Tags] Redfish_TFTP_Failure_To_Upload_Empty_BMC_Image |
| 90 | [Template] Redfish TFTP Bad Firmware Update |
| 91 | |
| 92 | # Image File Name |
| 93 | bmc_nokernel_image.ubi.mtd.tar |
| 94 | |
| 95 | |
George Keishing | 5236ec5 | 2022-01-31 12:07:58 -0600 | [diff] [blame] | 96 | Redfish TFTP Failure To Upload Host Image With Bad Manifest |
Sushil Singh | c51eee7 | 2019-09-01 11:13:37 -0500 | [diff] [blame] | 97 | [Documentation] Upload a PNOR firmware with a bad MANIFEST file via TFTP. |
| 98 | [Tags] Redfish_TFTP_Failure_To_Upload_Host_Image_With_Bad_Manifest |
| 99 | [Template] Redfish TFTP Bad Firmware Update |
| 100 | |
| 101 | # Image File Name |
| 102 | pnor_bad_manifest.pnor.squashfs.tar |
| 103 | |
| 104 | |
George Keishing | 5236ec5 | 2022-01-31 12:07:58 -0600 | [diff] [blame] | 105 | Redfish TFTP Failure To Upload Empty Host Image |
Sushil Singh | c51eee7 | 2019-09-01 11:13:37 -0500 | [diff] [blame] | 106 | [Documentation] Upload a PNOR firmware with no kernel Image via TFTP. |
| 107 | [Tags] Redfish_TFTP_Failure_To_Upload_Empty_Host_Image |
| 108 | [Template] Redfish TFTP Bad Firmware Update |
| 109 | |
| 110 | # Image File Name |
| 111 | pnor_nokernel_image.pnor.squashfs.tar |
| 112 | |
| 113 | |
Sushil Singh | 47f8013 | 2019-08-27 04:53:24 -0500 | [diff] [blame] | 114 | *** Keywords *** |
| 115 | |
| 116 | Suite Setup Execution |
| 117 | [Documentation] Do the suite setup. |
| 118 | |
Sushil Singh | 1926902 | 2022-04-01 02:50:50 -0500 | [diff] [blame] | 119 | Valid Value OPENBMC_HOST |
| 120 | Valid Value OPENBMC_USERNAME |
| 121 | Valid Value OPENBMC_PASSWORD |
| 122 | Valid Value BAD_IMAGES_DIR_PATH |
| 123 | Valid Value TFTP_SERVER |
Sushil Singh | 47f8013 | 2019-08-27 04:53:24 -0500 | [diff] [blame] | 124 | Redfish.Login |
Tim Lee | 4aff2d0 | 2021-06-08 13:26:25 +0800 | [diff] [blame] | 125 | Redfish Delete All BMC Dumps |
Sushil Singh | 47f8013 | 2019-08-27 04:53:24 -0500 | [diff] [blame] | 126 | Redfish Purge Event Log |
| 127 | |
| 128 | |
| 129 | Redfish Bad Firmware Update |
| 130 | [Documentation] Redfish firmware update. |
| 131 | [Arguments] ${image_file_name} |
Sushil Singh | 47f8013 | 2019-08-27 04:53:24 -0500 | [diff] [blame] | 132 | |
| 133 | # Description of argument(s): |
| 134 | # image_file_name The file name of the image. |
| 135 | |
Sushil Singh | c51eee7 | 2019-09-01 11:13:37 -0500 | [diff] [blame] | 136 | Valid Dir Path BAD_IMAGES_DIR_PATH |
Sushil Singh | 47f8013 | 2019-08-27 04:53:24 -0500 | [diff] [blame] | 137 | ${image_file_path}= OperatingSystem.Join Path ${BAD_IMAGES_DIR_PATH} |
| 138 | ... ${image_file_name} |
| 139 | Valid File Path image_file_path |
| 140 | Set ApplyTime policy=OnReset |
| 141 | ${image_data}= OperatingSystem.Get Binary File ${image_file_path} |
| 142 | ${status_code}= Upload Image To BMC |
| 143 | ... ${REDFISH_BASE_URI}UpdateService |
| 144 | ... ${timeout} |
| 145 | ... valid_status_codes=[${HTTP_OK}, ${HTTP_INTERNAL_SERVER_ERROR}] |
| 146 | ... data=${image_data} |
| 147 | |
| 148 | Return From Keyword If ${status_code} == ${HTTP_INTERNAL_SERVER_ERROR} |
| 149 | |
| 150 | ${image_id}= Get Latest Image ID |
| 151 | Rprint Vars image_id |
| 152 | Check Image Update Progress State |
| 153 | ... match_state='Updating', 'Disabled' image_id=${image_id} |
| 154 | |
Sushil Singh | c51eee7 | 2019-09-01 11:13:37 -0500 | [diff] [blame] | 155 | |
| 156 | Redfish TFTP Bad Firmware Update |
| 157 | [Documentation] Redfish bad firmware update via TFTP. |
| 158 | [Arguments] ${image_file_name} |
Sushil Singh | c51eee7 | 2019-09-01 11:13:37 -0500 | [diff] [blame] | 159 | |
| 160 | # Description of argument(s): |
| 161 | # image_file_name The file name of the image. |
| 162 | |
| 163 | Set ApplyTime policy=OnReset |
| 164 | # Download image from TFTP server to BMC. |
| 165 | Redfish.Post /redfish/v1/UpdateService/Actions/UpdateService.SimpleUpdate |
| 166 | ... body={"TransferProtocol" : "TFTP", "ImageURI" : "${TFTP_SERVER}/${image_file_name}"} |
| 167 | Sleep 60s |
| 168 | ${image_version}= Get Image Version From TFTP Server ${TFTP_SERVER} ${image_file_name} |
| 169 | Return From Keyword If '${image_version}' == '${EMPTY}' |
| 170 | # Wait for image tar file to download complete. |
| 171 | ${image_id}= Wait Until Keyword Succeeds 60 sec 10 sec Get Latest Image ID |
| 172 | Rprint Vars image_id |
| 173 | |
| 174 | Check Image Update Progress State |
| 175 | ... match_state='Updating', 'Disabled' image_id=${image_id} |
| 176 | |
| 177 | |
Sushil Singh | 47f8013 | 2019-08-27 04:53:24 -0500 | [diff] [blame] | 178 | Test Teardown Execution |
| 179 | [Documentation] Do the post test teardown. |
| 180 | |
| 181 | FFDC On Test Case Fail |
| 182 | Run Keyword If '${image_id}' Delete Software Object |
| 183 | ... /xyz/openbmc_project/software/${image_id} |
Sushil Singh | c51eee7 | 2019-09-01 11:13:37 -0500 | [diff] [blame] | 184 | |