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