blob: 98e93763aeb78387de181f42dfd6cb83d00e2fd6 [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
4... to exist in the BAD_IMAGES_DIR_PATH:
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
18Resource ../../lib/connection_client.robot
19Resource ../../lib/rest_client.robot
20Resource ../../lib/openbmc_ffdc.robot
21Resource ../../lib/bmc_redfish_resource.robot
22Resource ../../lib/code_update_utils.robot
23Library OperatingSystem
24Library ../../lib/code_update_utils.py
25Library ../../lib/gen_robot_valid.py
26
27Suite Setup Suite Setup Execution
28Suite Teardown Redfish.Logout
29Test Setup Printn
30
31Force Tags Upload_Test
32
33*** Variables ***
34${timeout} 20
35${QUIET} ${1}
36${image_id} ${EMPTY}
37
38*** Test Cases ***
39
40Redfish Failure to Upload BMC Image With Bad Manifest
41 [Documentation] Upload a BMC firmware with a bad MANFIEST file.
42 [Tags] Redfish_Failure_To_Upload_BMC_Image_With_Bad_Manifest
43 [Template] Redfish Bad Firmware Update
44
45 # Image File Name
46 bmc_bad_manifest.ubi.mtd.tar
47
48
49Redfish Failure to Upload Empty BMC Image
50 [Documentation] Upload a BMC firmware with no kernel image.
51 [Tags] Redfish_Failure_To_Upload_Empty_BMC_Image
52 [Template] Redfish Bad Firmware Update
53
54 # Image File Name
55 bmc_nokernel_image.ubi.mtd.tar
56
57
58Redfish Failure to Upload Host Image With Bad Manifest
59 [Documentation] Upload a PNOR firmware with a bad MANIFEST file.
60 [Tags] Redfish_Failure_To_Upload_Host_Image_With_Bad_Manifest
61 [Template] Redfish Bad Firmware Update
62
63 # Image File Name
64 pnor_bad_manifest.pnor.squashfs.tar
65
66
67Redfish Failure to Upload Empty Host Image
68 [Documentation] Upload a PNOR firmware with no kernel Image.
69 [Tags] Redfish_Failure_To_Upload_Empty_Host_Image
70 [Template] Redfish Bad Firmware Update
71
72 # Image File Name
73 pnor_nokernel_image.pnor.squashfs.tar
74
75
76*** Keywords ***
77
78Suite Setup Execution
79 [Documentation] Do the suite setup.
80
81 Redfish.Login
82 Valid Dir Path BAD_IMAGES_DIR_PATH
83 Delete All BMC Dump
84 Redfish Purge Event Log
85
86
87Redfish Bad Firmware Update
88 [Documentation] Redfish firmware update.
89 [Arguments] ${image_file_name}
90 [Teardown] Test Teardown Execution
91
92 # Description of argument(s):
93 # image_file_name The file name of the image.
94
95 ${image_file_path}= OperatingSystem.Join Path ${BAD_IMAGES_DIR_PATH}
96 ... ${image_file_name}
97 Valid File Path image_file_path
98 Set ApplyTime policy=OnReset
99 ${image_data}= OperatingSystem.Get Binary File ${image_file_path}
100 ${status_code}= Upload Image To BMC
101 ... ${REDFISH_BASE_URI}UpdateService
102 ... ${timeout}
103 ... valid_status_codes=[${HTTP_OK}, ${HTTP_INTERNAL_SERVER_ERROR}]
104 ... data=${image_data}
105
106 Return From Keyword If ${status_code} == ${HTTP_INTERNAL_SERVER_ERROR}
107
108 ${image_id}= Get Latest Image ID
109 Rprint Vars image_id
110 Check Image Update Progress State
111 ... match_state='Updating', 'Disabled' image_id=${image_id}
112
113Test Teardown Execution
114 [Documentation] Do the post test teardown.
115
116 FFDC On Test Case Fail
117 Run Keyword If '${image_id}' Delete Software Object
118 ... /xyz/openbmc_project/software/${image_id}