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