blob: f747cd445b8a50a6c9995455b9effa7fbe1200e9 [file] [log] [blame]
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -05001*** Settings ***
2Documentation Update the BMC code on a target BMC.
3... Execution Method:
4... python -m robot -v OPENBMC_HOST:<hostname>
5... -v IMAGE_FILE_PATH:<path/*.tar> bmc_code_update.robot
6
7Library ../../lib/code_update_utils.py
Michael Walshe78a4432018-03-29 16:36:04 -05008Library ../../lib/gen_robot_keyword.py
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -05009Variables ../../data/variables.py
Sivas SRR77c69192017-11-02 23:56:39 -050010Resource ../../lib/utils.robot
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050011Resource ../../lib/boot_utils.robot
12Resource code_update_utils.robot
13Resource ../../lib/code_update_utils.robot
George Keishing1eb85f52017-08-30 22:55:13 -050014Resource ../../lib/openbmc_ffdc.robot
15Resource ../../lib/dump_utils.robot
George Keishing1659f592018-10-03 08:33:41 -050016Resource ../../lib/ipmi_client.robot
Rahul Maheshwari8b70ddd2018-10-08 06:50:26 -050017Resource ../../lib/certificate_utils.robot
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050018
Charles Paul Hoferd66c5dc2017-09-29 14:25:52 -050019Suite Setup Suite Setup Execution
20
21Test Teardown Test Teardown Execution
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050022
George Keishing09712a12017-10-16 12:52:42 -050023Force Tags BMC_Code_Update
24
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050025*** Variables ***
26
27${QUIET} ${1}
28${IMAGE_FILE_PATH} ${EMPTY}
Charles Paul Hoferc1fa2bc2017-08-18 16:44:03 -050029${ALTERNATE_IMAGE_FILE_PATH} ${EMPTY}
Charles Paul Hoferb7842a52017-09-22 10:11:33 -050030${SKIP_UPDATE_IF_ACTIVE} false
Charles Paul Hoferd66c5dc2017-09-29 14:25:52 -050031${dump_id} ${EMPTY}
32${running_persistence_test} ${FALSE}
33${test_errlog_text} AutoTestSimple
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050034
35*** Test Cases ***
36
Sivas SRR77c69192017-11-02 23:56:39 -050037Test Basic BMC Performance Before BMC Code Update
38 [Documentation] Check performance of memory, CPU & file system of BMC.
39 [Tags] Test_Basic_BMC_Performance_Before_BMC_Code_Update
40
41 Open Connection And Log In
42 Check BMC Performance
43
Charles Paul Hoferd66c5dc2017-09-29 14:25:52 -050044Prepare Persistent Data
45 [Documentation] Set data that should persist across the code update.
46 [Tags] Prepare_Persistent_Data
47
48 # Install the debug tarball.
49 BMC Execute Command rm -rf /tmp/tarball
50 Install Debug Tarball On BMC tarball_file_path=${DEBUG_TARBALL_PATH}
51
52 # Create a dummy error log and dump.
53 BMC Execute Command /tmp/tarball/bin/logging-test -c ${test_errlog_text}
54 ${dump_id}= Create User Initiated Dump
55 Check Dump Existence ${dump_id}
56 Set Suite Variable ${dump_id}
57
58 # Set persistent settings.
59 ${autoreboot_dict}= Create Dictionary data=${0}
60 Write Attribute ${CONTROL_HOST_URI}auto_reboot AutoReboot
61 ... data=${autoreboot_dict}
62 ${onetime_dict}= Create Dictionary data=${0}
63 Write Attribute ${CONTROL_HOST_URI}boot/one_time Enabled
64 ... data=${onetime_dict}
65
66 # Let the remaining test cases know we are doing a persistence test so we
67 # do not delete logs.
68 Set Suite Variable ${running_persistence_test} ${TRUE}
69
70
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050071REST BMC Code Update
72 [Documentation] Do a BMC code update by uploading image on BMC via REST.
73 [Tags] REST_BMC_Code_Update
Charles Paul Hoferd66c5dc2017-09-29 14:25:52 -050074 [Teardown] REST BMC Code Update Teardown
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050075
Sweta Potthuri8c7ada42018-01-15 05:05:59 -060076 Run Keyword And Ignore Error List Installed Images BMC
77
Charles Paul Hofer21845462017-09-27 12:40:33 -050078 Upload And Activate Image ${IMAGE_FILE_PATH}
79 ... skip_if_active=${SKIP_UPDATE_IF_ACTIVE}
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050080 OBMC Reboot (off)
Charles Paul Hofere43fb2f2017-09-26 15:36:18 -050081 Verify Running BMC Image ${IMAGE_FILE_PATH}
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050082
83
Charles Paul Hoferd66c5dc2017-09-29 14:25:52 -050084Verify Error Log Persistency
85 [Documentation] Check that the error log is still present after a
86 ... code update.
87 [Tags] Verify_Error_Log_Persistency
88
89 ${error_log_paths}= Read Properties ${BMC_LOGGING_URI}/list
90 Log To Console ${error_log_paths}
91 ${test_error_message}= Read Attribute @{error_log_paths}[-1] Message
92 Should Be Equal ${test_error_message}
93 ... example.xyz.openbmc_project.Example.Elog.${test_errlog_text}
94 Delete Error Log Entry @{error_log_paths}[-1]
95
96
97Verify BMC Dump Persistency
98 [Documentation] Check that the BMC dump present after a code update.
99 [Tags] Verify_BMC_Dump_Persistency
100 [Teardown] Set Suite Variable ${running_persistence_test} ${FALSE}
101
102 Check Dump Existence ${dump_id}
103 Delete BMC Dump ${dump_id}
104
105
106Verify Settings Persistency
107 [Documentation] Verify that the settings from 'Prepare Persistent Data'
108 ... are still set correctly after the code update.
109 [Tags] Verify_Settings_Persistency
110
111 ${autoreboot_enabled}= Read Attribute ${CONTROL_HOST_URI}auto_reboot
112 ... AutoReboot
113 Should Be Equal ${autoreboot_enabled} ${0}
114 ${onetime_enabled}= Read Attribute ${CONTROL_HOST_URI}boot/one_time
115 ... Enabled
116 Should Be Equal ${onetime_enabled} ${0}
117
118 # Set values back to their defaults
119 ${autoreboot_dict}= Create Dictionary data=${1}
120 Write Attribute ${CONTROL_HOST_URI}auto_reboot AutoReboot
121 ... data=${autoreboot_dict}
122 ${onetime_dict}= Create Dictionary data=${1}
123 Write Attribute ${CONTROL_HOST_URI}boot/one_time Enabled
124 ... data=${onetime_dict}
125
126
Charles Paul Hoferc1fa2bc2017-08-18 16:44:03 -0500127Upload And Activate Multiple BMC Images
128 [Documentation] Upload another BMC image and verify that its state is
129 ... different from all others.
130 [Tags] Upload_And_Activate_Multiple_BMC_Images
131 [Template] Activate Image And Verify No Duplicate Priorities
132 [Setup] Upload And Activate Multiple BMC Images Setup
133
134 # Image File Path Image Purpose
135 ${ALTERNATE_IMAGE_FILE_PATH} ${VERSION_PURPOSE_BMC}
136
137
Charles Paul Hofer42f17462017-09-12 14:09:32 -0500138BMC Set Priority To Invalid Values
139 [Documentation] Attempt to set the priority of an image to an invalid
140 ... value and expect an error.
141 [Tags] BMC_Set_Priority_To_Invalid_Values
142 [Template] Set Priority To Invalid Value And Expect Error
143
144 # Version Type Priority
145 ${VERSION_PURPOSE_BMC} ${-1}
146 ${VERSION_PURPOSE_BMC} ${256}
147
148
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -0500149Delete BMC Image
150 [Documentation] Delete a BMC image from the BMC flash chip.
151 [Tags] Delete_BMC_Image
152
153 ${software_object}= Get Non Running BMC Software Object
154 Delete Image And Verify ${software_object} ${VERSION_PURPOSE_BMC}
Charles Paul Hoferc1fa2bc2017-08-18 16:44:03 -0500155
156
George Keishing97ecb272017-09-12 04:30:20 -0500157BMC Image Priority Attribute Test
158 [Documentation] Set "Priority" attribute.
159 [Tags] BMC_Image_Priority_Attribute_Test
160 [Template] Temporarily Set BMC Attribute
161
162 # Property Value
163 Priority ${0}
164 Priority ${1}
165 Priority ${127}
166 Priority ${255}
167
168
Charles Paul Hofere8dc5252017-10-10 13:50:18 -0500169Delete All Non Running BMC Images
170 [Documentation] Delete all non running BMC images.
171 [Tags] Delete_All_Non_Running_BMC_Images
172
173 ${version_id}= Upload And Activate Image ${ALTERNATE_IMAGE_FILE_PATH}
George Keishing0889d432017-11-27 11:53:06 -0600174 ... skip_if_active=true
Charles Paul Hofere8dc5252017-10-10 13:50:18 -0500175 Delete All Non Running BMC Images
176
177 ${software_ids}= Get Software Objects Id
178 ... version_type=${VERSION_PURPOSE_BMC}
179 Should Not Contain ${software_ids} ${version_id}
180
George Keishing1659f592018-10-03 08:33:41 -0500181
182Verify IPMI Disable Policy Post BMC Code Update
183 [Documentation] Disable IPMI, update BMC and verify post-update.
184 [Tags] Verify_IPMI_Disable_Policy_Post_BMC_Code_Update
185
186 REST Power On
187
188 Run Inband IPMI Standard Command lan set 1 access off
189 Run Keyword and Expect Error *Unable to establish IPMI*
190 ... Run External IPMI Standard Command lan print
191
192 Upload And Activate Image ${IMAGE_FILE_PATH}
193 ... skip_if_active=${SKIP_UPDATE_IF_ACTIVE}
194 OBMC Reboot (off)
195 Verify Running BMC Image ${IMAGE_FILE_PATH}
196
197 Run Keyword and Expect Error *Unable to establish IPMI*
198 ... Run External IPMI Standard Command lan print
199
200
Rahul Maheshwari8b70ddd2018-10-08 06:50:26 -0500201Test Certificate Persistency After BMC Code Update
202 [Documentation] Test certificate persistency after BMC update.
203 [Tags] Test_Certificate_Persistency_After_BMC_Code_Update
204
Rahul Maheshwarifa146c42018-11-05 00:38:52 -0600205 # Create certificate sub-directory in current working directory.
206 Create Directory certificate_dir
207 OperatingSystem.Directory Should Exist ${EXECDIR}${/}certificate_dir
208
Rahul Maheshwari8b70ddd2018-10-08 06:50:26 -0500209 ${cert_file_path}= Generate Certificate File Via Openssl
210 ... Valid Certificate Valid Privatekey
211 ${file_data}= OperatingSystem.Get Binary File ${cert_file_path}
212 ${cert_file_content}= OperatingSystem.Get File ${cert_file_path}
213
214 Install Certificate File On BMC ${CLIENT_CERTIFICATE_URI}
215 ... data=${file_data}
216
217 ${bmc_cert_content}= Get Certificate File Content From BMC Client
218 Should Contain ${cert_file_content} ${bmc_cert_content}
219
220 Upload And Activate Image ${IMAGE_FILE_PATH}
221 ... skip_if_active=${SKIP_UPDATE_IF_ACTIVE}
222 OBMC Reboot (off)
223 Verify Running BMC Image ${IMAGE_FILE_PATH}
224
225 ${bmc_cert_content}= Get Certificate File Content From BMC Client
226 Should Contain ${cert_file_content} ${bmc_cert_content}
227
228
Sivas SRR77c69192017-11-02 23:56:39 -0500229Test Basic BMC Performance After Code Update
230 [Documentation] Check performance of memory, CPU & file system of BMC.
231 [Tags] Test_Basic_BMC_Performance_After_Code_Update
232
233 Open Connection And Log In
234 Check BMC Performance
235
Charles Paul Hofere8dc5252017-10-10 13:50:18 -0500236
Charles Paul Hoferc1fa2bc2017-08-18 16:44:03 -0500237*** Keywords ***
238
George Keishing97ecb272017-09-12 04:30:20 -0500239Temporarily Set BMC Attribute
240 [Documentation] Update the BMC attribute value.
241 [Arguments] ${attribute_name} ${attribute_value}
242
243 # Description of argument(s):
244 # attribute_name BMC software attribute name (e.g. "Priority").
245 # attribute_value Value to be written.
246
247 ${image_ids}= Get Software Objects ${VERSION_PURPOSE_BMC}
248 ${init_bmc_properties}= Get Host Software Property ${image_ids[0]}
249 ${initial_priority}= Set Variable ${init_bmc_properties["Priority"]}
250
251 Set Host Software Property ${image_ids[0]} ${attribute_name}
252 ... ${attribute_value}
253
254 ${cur_bmc_properties}= Get Host Software Property ${image_ids[0]}
255 Should Be Equal As Integers ${cur_bmc_properties["Priority"]}
256 ... ${attribute_value}
257
258 # Revert to to initial value.
259 Set Host Software Property
260 ... ${image_ids[0]} ${attribute_name} ${initial_priority}
261
262
Charles Paul Hoferc1fa2bc2017-08-18 16:44:03 -0500263Upload And Activate Multiple BMC Images Setup
264 [Documentation] Check that the ALTERNATE_FILE_PATH variable is set.
265
George Keishing1eb85f52017-08-30 22:55:13 -0500266 Should Not Be Empty ${ALTERNATE_IMAGE_FILE_PATH}
267
Charles Paul Hoferd66c5dc2017-09-29 14:25:52 -0500268
269REST BMC Code Update Teardown
270 [Documentation] Do code update test teardown.
271
272 FFDC On Test Case Fail
273 Run Keyword If Test Failed Fatal Error msg=Code update failed.
274
275
276Suite Setup Execution
George Keishing1eb85f52017-08-30 22:55:13 -0500277 [Documentation] Do code update test case setup.
278 # - Clean up all existing BMC dumps.
279
Michael Walshe78a4432018-03-29 16:36:04 -0500280 Run Key Delete All Dumps ignore=1
Charles Paul Hoferb9264082017-09-29 15:00:19 -0500281 Run Keyword And Ignore Error Smart Power Off
George Keishing00715492017-08-18 11:46:37 -0500282
Charles Paul Hoferd66c5dc2017-09-29 14:25:52 -0500283Test Teardown Execution
George Keishing00715492017-08-18 11:46:37 -0500284 [Documentation] Do code update test case teardown.
285 # 1. Collect FFDC if test case failed.
286 # 2. Collect FFDC if test PASS but error log exists.
287
Charles Paul Hoferd66c5dc2017-09-29 14:25:52 -0500288 # Don't delete our logs if we want to persist them for tests.
289 Return From Keyword If ${running_persistence_test}
290
George Keishing00715492017-08-18 11:46:37 -0500291 FFDC On Test Case Fail
292 Run Keyword If '${TEST_STATUS}' == 'PASS' Check Error And Collect FFDC
Sivas SRR77c69192017-11-02 23:56:39 -0500293 Close All Connections