blob: a62acf30262de2ef7c51cbec746c67f257fe093a [file] [log] [blame]
George Keishingcba6d422019-07-09 15:01:59 -05001*** Settings ***
2Documentation Firmware image (BMC and Host) upload test using TFTP protocol.
3
4# Test Parameters:
5# TFTP_SERVER The TFTP server host name or IP address.
6# IMAGE_FILE_NAME The BMC or Host image file name.
7#
8# Firmware update states:
9# Enabled -> Image is installed and either functional or active.
10# Disabled -> Image installation failed or ready for activation.
11# Updating -> Image installation currently in progress.
12
13Resource ../../lib/resource.robot
14Resource ../../lib/boot_utils.robot
15Resource ../../lib/bmc_redfish_resource.robot
16Resource ../../lib/openbmc_ffdc.robot
17Resource ../../lib/code_update_utils.robot
18Library ../../lib/code_update_utils.py
19Library ../../lib/gen_robot_valid.py
George Keishingcfa950c2019-07-18 12:46:46 -050020Library ../../lib/tftp_update_utils.py
George Keishingcba6d422019-07-09 15:01:59 -050021
22Suite Setup Suite Setup Execution
23Suite Teardown Redfish.Logout
George Keishingcfa950c2019-07-18 12:46:46 -050024Test Setup Run Keywords Redfish Power Off stack_mode=skip quiet=1 AND Redfish.Login
George Keishingcba6d422019-07-09 15:01:59 -050025Test Teardown FFDC On Test Case Fail
26
27Force Tags tftp_update
28
29*** Test Cases ***
30
31TFTP Download Install With ApplyTime OnReset Policy
32 [Documentation] Download image to BMC using TFTP with OnReset policy and verify installation.
33 [Tags] TFTP_Download_Install_With_ApplyTime_OnReset_Policy
George Keishingcfa950c2019-07-18 12:46:46 -050034 [Template] TFTP Download Install
George Keishingcba6d422019-07-09 15:01:59 -050035
George Keishingcfa950c2019-07-18 12:46:46 -050036 # policy
37 OnReset
38
39
40TFTP Download Install With ApplyTime Immediate Policy
41 [Documentation] Download image to BMC using TFTP with Immediate policy and verify installation.
42 [Tags] TFTP_Download_Install_With_ApplyTime_Immediate_Policy
43 [Template] TFTP Download Install
44
45 # policy
46 Immediate
47
48
49ImageURI Download Install With ApplyTime OnReset Policy
50 [Documentation] Download image to BMC using ImageURI with OnReset policy and verify installation.
51 [Tags] ImageURI_Download_Install_With_ApplyTime_OnReset_Policy
52 [Template] ImageURI Download Install
53
54 # policy
55 OnReset
56
57
58ImageURI Download Install With ApplyTime Immediate Policy
59 [Documentation] Download image to BMC using ImageURI with Immediate policy and verify installation.
60 [Tags] ImageURI_Download_Install_With_ApplyTime_Immediate_Policy
61 [Template] ImageURI Download Install
62
63 # policy
64 Immediate
65
66*** Keywords ***
67
68Suite Setup Execution
69 [Documentation] Do the suite setup.
70
71 Redfish.Login
Michael Walshe7edb222019-08-19 17:39:38 -050072 Valid Value TFTP_SERVER
73 Valid Value IMAGE_FILE_NAME
George Keishingcfa950c2019-07-18 12:46:46 -050074
75
76TFTP Download Install
77 [Documentation] Download image to BMC using TFTP with ApplyTime policy and verify installation.
78 [Arguments] ${policy}
79
80 # Description of argument(s):
81 # policy ApplyTime allowed values (e.g. "OnReset", "Immediate").
82
83 ${state}= Get Pre Reboot State
84 Rprint Vars state
85
86 Set ApplyTime policy=${policy}
George Keishingcba6d422019-07-09 15:01:59 -050087
88 # Download image from TFTP server to BMC.
89 Redfish.Post /redfish/v1/UpdateService/Actions/UpdateService.SimpleUpdate
90 ... body={"TransferProtocol" : "TFTP", "ImageURI" : "${TFTP_SERVER}/${IMAGE_FILE_NAME}"}
91
92 # Wait for image tar file to download complete.
93 ${image_id}= Wait Until Keyword Succeeds 60 sec 10 sec Get Latest Image ID
94 Rprint Vars image_id
95
96 # Let the image get extracted and it should not fail.
97 Sleep 5s
98 Check Image Update Progress State match_state='Disabled', 'Updating' image_id=${image_id}
99
100 # Get image version currently installation in progress.
101 ${install_version}= Get Firmware Image Version image_id=${image_id}
102 Rprint Vars install_version
103
104 Check Image Update Progress State match_state='Updating' image_id=${image_id}
105
106 # Wait for the image to install complete.
George Keishingcfa950c2019-07-18 12:46:46 -0500107 Wait Until Keyword Succeeds 8 min 15 sec
George Keishingcba6d422019-07-09 15:01:59 -0500108 ... Check Image Update Progress State match_state='Enabled' image_id=${image_id}
109
George Keishingcfa950c2019-07-18 12:46:46 -0500110 Reboot And Wait For BMC Standby policy=${policy} start_boot_seconds=${state['epoch_seconds']}
George Keishingcba6d422019-07-09 15:01:59 -0500111
112 # Verify the image is installed and functional.
113 ${cmd}= Set Variable grep ^VERSION_ID= /etc/os-release | cut -f 2 -d '=' | sed 's/"//g'
114 ${functional_version} ${stderr} ${rc}= BMC Execute Command ${cmd}
Michael Walshe7edb222019-08-19 17:39:38 -0500115 Valid Value functional_version valid_values=['${install_version}']
George Keishingcba6d422019-07-09 15:01:59 -0500116 Rprint Vars functional_version
117
118
George Keishingcfa950c2019-07-18 12:46:46 -0500119ImageURI Download Install
120 [Documentation] Download image to BMC using ImageURI with ApplyTime policy and verify installation.
121 [Arguments] ${policy}
George Keishingcba6d422019-07-09 15:01:59 -0500122
George Keishingcfa950c2019-07-18 12:46:46 -0500123 # Description of argument(s):
124 # policy ApplyTime allowed values (e.g. "OnReset", "Immediate").
George Keishingcba6d422019-07-09 15:01:59 -0500125
George Keishingcfa950c2019-07-18 12:46:46 -0500126 ${state}= Get Pre Reboot State
127 Rprint Vars state
128
129 Set ApplyTime policy=${policy}
130
131 # Download image from TFTP server via ImageURI to BMC.
132 Redfish.Post /redfish/v1/UpdateService/Actions/UpdateService.SimpleUpdate
133 ... body={"ImageURI": "tftp://${TFTP_SERVER}/${IMAGE_FILE_NAME}"}
134
135 # Wait for image tar file download to complete.
136 ${image_id}= Wait Until Keyword Succeeds 60 sec 10 sec Get Latest Image ID
137 Rprint Vars image_id
138
139 # Let the image get extracted and it should not fail.
140 Sleep 5s
141 Check Image Update Progress State match_state='Disabled', 'Updating' image_id=${image_id}
142
143 ${install_version}= Get Firmware Image Version image_id=${image_id}
144 Rprint Vars install_version
145
146 Check Image Update Progress State match_state='Updating' image_id=${image_id}
147
148 # Wait for the image to install complete.
149 Wait Until Keyword Succeeds 8 min 15 sec
150 ... Check Image Update Progress State match_state='Enabled' image_id=${image_id}
151
152 Reboot And Wait For BMC Standby policy=${policy} start_boot_seconds=${state['epoch_seconds']}
153
154 # Verify the image is installed and functional.
155 ${cmd}= Set Variable grep ^VERSION_ID= /etc/os-release | cut -f 2 -d '=' | sed 's/"//g'
156 ${functional_version} ${stderr} ${rc}= BMC Execute Command ${cmd}
Michael Walshe7edb222019-08-19 17:39:38 -0500157 Valid Value functional_version valid_values=['${install_version}']
George Keishingcfa950c2019-07-18 12:46:46 -0500158 Rprint Vars functional_version
159
160
161Reboot And Wait For BMC Standby
162 [Documentation] Reboot or wait for BMC standby post reboot.
163 [Arguments] ${policy} ${start_boot_seconds}
164
165 # Description of argument(s):
166 # policy ApplyTime allowed values (e.g. "OnReset", "Immediate").
167 # start_boot_seconds See 'Wait For Reboot' for details.
168
169 Run Keyword If '${policy}' == 'OnReset'
170 ... Redfish OBMC Reboot (off)
171 ... ELSE
172 ... Wait For Reboot start_boot_seconds=${start_boot_seconds}