blob: 6f1a18d7f24fde78a199ed1dcc79f0b99bc4898d [file] [log] [blame]
Sushil Singh47f80132019-08-27 04:53:24 -05001*** Settings ***
2Documentation Test upload image with invalid images.
3... This test expects the following bad tarball image files
Sushil Singhc51eee72019-09-01 11:13:37 -05004... to exist in the BAD_IMAGES_DIR_PATH/TFTP_SERVER:
Sushil Singh47f80132019-08-27 04:53:24 -05005... 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 Singhc51eee72019-09-01 11:13:37 -050017# TFTP_SERVER The host name or IP of the TFTP server.
Sushil Singh47f80132019-08-27 04:53:24 -050018
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
Sushil Singh19269022022-04-01 02:50:50 -050031Test Teardown Test Teardown Execution
Sushil Singh47f80132019-08-27 04:53:24 -050032
33Force Tags Upload_Test
34
35*** Variables ***
36${timeout} 20
37${QUIET} ${1}
38${image_id} ${EMPTY}
39
40*** Test Cases ***
41
George Keishing5236ec52022-01-31 12:07:58 -060042Redfish Failure To Upload BMC Image With Bad Manifest
Sushil Singh47f80132019-08-27 04:53:24 -050043 [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 Keishing5236ec52022-01-31 12:07:58 -060051Redfish Failure To Upload Empty BMC Image
Sushil Singh47f80132019-08-27 04:53:24 -050052 [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 Keishing5236ec52022-01-31 12:07:58 -060060Redfish Failure To Upload Host Image With Bad Manifest
Sushil Singh47f80132019-08-27 04:53:24 -050061 [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 Keishing5236ec52022-01-31 12:07:58 -060069Redfish Failure To Upload Empty Host Image
Sushil Singh47f80132019-08-27 04:53:24 -050070 [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 Keishing5236ec52022-01-31 12:07:58 -060078Redfish TFTP Failure To Upload BMC Image With Bad Manifest
Sushil Singhc51eee72019-09-01 11:13:37 -050079 [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 Keishing5236ec52022-01-31 12:07:58 -060087Redfish TFTP Failure To Upload Empty BMC Image
Sushil Singhc51eee72019-09-01 11:13:37 -050088 [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 Keishing5236ec52022-01-31 12:07:58 -060096Redfish TFTP Failure To Upload Host Image With Bad Manifest
Sushil Singhc51eee72019-09-01 11:13:37 -050097 [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 Keishing5236ec52022-01-31 12:07:58 -0600105Redfish TFTP Failure To Upload Empty Host Image
Sushil Singhc51eee72019-09-01 11:13:37 -0500106 [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 Singh47f80132019-08-27 04:53:24 -0500114*** Keywords ***
115
116Suite Setup Execution
117 [Documentation] Do the suite setup.
118
Sushil Singh19269022022-04-01 02:50:50 -0500119 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 Singh47f80132019-08-27 04:53:24 -0500124 Redfish.Login
Tim Lee4aff2d02021-06-08 13:26:25 +0800125 Redfish Delete All BMC Dumps
Sushil Singh47f80132019-08-27 04:53:24 -0500126 Redfish Purge Event Log
127
128
129Redfish Bad Firmware Update
130 [Documentation] Redfish firmware update.
131 [Arguments] ${image_file_name}
Sushil Singh47f80132019-08-27 04:53:24 -0500132
133 # Description of argument(s):
134 # image_file_name The file name of the image.
135
Sushil Singhc51eee72019-09-01 11:13:37 -0500136 Valid Dir Path BAD_IMAGES_DIR_PATH
Sushil Singh47f80132019-08-27 04:53:24 -0500137 ${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 Singhc51eee72019-09-01 11:13:37 -0500155
156Redfish TFTP Bad Firmware Update
157 [Documentation] Redfish bad firmware update via TFTP.
158 [Arguments] ${image_file_name}
Sushil Singhc51eee72019-09-01 11:13:37 -0500159
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 Singh47f80132019-08-27 04:53:24 -0500178Test 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 Singhc51eee72019-09-01 11:13:37 -0500184