1*** Settings *** 2Documentation Test upload image with invalid images. 3... This test expects the following bad tarball image files 4... to exist in the BAD_IMAGES_DIR_PATH/TFTP_SERVER: 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. 17# TFTP_SERVER The host name or IP of the TFTP server. 18 19Resource ../../lib/connection_client.robot 20Resource ../../lib/rest_client.robot 21Resource ../../lib/openbmc_ffdc.robot 22Resource ../../lib/bmc_redfish_resource.robot 23Resource ../../lib/code_update_utils.robot 24Library OperatingSystem 25Library ../../lib/code_update_utils.py 26Library ../../lib/gen_robot_valid.py 27 28Suite Setup Suite Setup Execution 29Suite Teardown Redfish.Logout 30Test Setup Printn 31Test Teardown Test Teardown Execution 32 33Force Tags Upload_Test 34 35*** Variables *** 36${timeout} 20 37${QUIET} ${1} 38${image_id} ${EMPTY} 39 40*** Test Cases *** 41 42Redfish Failure To Upload BMC Image With Bad Manifest 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 51Redfish Failure To Upload Empty BMC Image 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 60Redfish Failure To Upload Host Image With Bad Manifest 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 69Redfish Failure To Upload Empty Host Image 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 78Redfish TFTP Failure To Upload BMC Image With Bad Manifest 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 87Redfish TFTP Failure To Upload Empty BMC Image 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 96Redfish TFTP Failure To Upload Host Image With Bad Manifest 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 105Redfish TFTP Failure To Upload Empty Host Image 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 114*** Keywords *** 115 116Suite Setup Execution 117 [Documentation] Do the suite setup. 118 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 124 Redfish.Login 125 Redfish Delete All BMC Dumps 126 Redfish Purge Event Log 127 128 129Redfish Bad Firmware Update 130 [Documentation] Redfish firmware update. 131 [Arguments] ${image_file_name} 132 133 # Description of argument(s): 134 # image_file_name The file name of the image. 135 136 Valid Dir Path BAD_IMAGES_DIR_PATH 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 155 156Redfish TFTP Bad Firmware Update 157 [Documentation] Redfish bad firmware update via TFTP. 158 [Arguments] ${image_file_name} 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 178Test 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} 184 185