blob: 94d8f7082286a8c859cc8809fca7601f8c761658 [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
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050016
Charles Paul Hoferd66c5dc2017-09-29 14:25:52 -050017Suite Setup Suite Setup Execution
18
19Test Teardown Test Teardown Execution
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050020
George Keishing09712a12017-10-16 12:52:42 -050021Force Tags BMC_Code_Update
22
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050023*** Variables ***
24
25${QUIET} ${1}
26${IMAGE_FILE_PATH} ${EMPTY}
Charles Paul Hoferc1fa2bc2017-08-18 16:44:03 -050027${ALTERNATE_IMAGE_FILE_PATH} ${EMPTY}
Charles Paul Hoferb7842a52017-09-22 10:11:33 -050028${SKIP_UPDATE_IF_ACTIVE} false
Charles Paul Hoferd66c5dc2017-09-29 14:25:52 -050029${dump_id} ${EMPTY}
30${running_persistence_test} ${FALSE}
31${test_errlog_text} AutoTestSimple
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050032
33*** Test Cases ***
34
Sivas SRR77c69192017-11-02 23:56:39 -050035Test Basic BMC Performance Before BMC Code Update
36 [Documentation] Check performance of memory, CPU & file system of BMC.
37 [Tags] Test_Basic_BMC_Performance_Before_BMC_Code_Update
38
39 Open Connection And Log In
40 Check BMC Performance
41
Charles Paul Hoferd66c5dc2017-09-29 14:25:52 -050042Prepare Persistent Data
43 [Documentation] Set data that should persist across the code update.
44 [Tags] Prepare_Persistent_Data
45
46 # Install the debug tarball.
47 BMC Execute Command rm -rf /tmp/tarball
48 Install Debug Tarball On BMC tarball_file_path=${DEBUG_TARBALL_PATH}
49
50 # Create a dummy error log and dump.
51 BMC Execute Command /tmp/tarball/bin/logging-test -c ${test_errlog_text}
52 ${dump_id}= Create User Initiated Dump
53 Check Dump Existence ${dump_id}
54 Set Suite Variable ${dump_id}
55
56 # Set persistent settings.
57 ${autoreboot_dict}= Create Dictionary data=${0}
58 Write Attribute ${CONTROL_HOST_URI}auto_reboot AutoReboot
59 ... data=${autoreboot_dict}
60 ${onetime_dict}= Create Dictionary data=${0}
61 Write Attribute ${CONTROL_HOST_URI}boot/one_time Enabled
62 ... data=${onetime_dict}
63
64 # Let the remaining test cases know we are doing a persistence test so we
65 # do not delete logs.
66 Set Suite Variable ${running_persistence_test} ${TRUE}
67
68
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050069REST BMC Code Update
70 [Documentation] Do a BMC code update by uploading image on BMC via REST.
71 [Tags] REST_BMC_Code_Update
Charles Paul Hoferd66c5dc2017-09-29 14:25:52 -050072 [Teardown] REST BMC Code Update Teardown
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050073
Sweta Potthuri8c7ada42018-01-15 05:05:59 -060074 Run Keyword And Ignore Error List Installed Images BMC
75
Charles Paul Hofer21845462017-09-27 12:40:33 -050076 Upload And Activate Image ${IMAGE_FILE_PATH}
77 ... skip_if_active=${SKIP_UPDATE_IF_ACTIVE}
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050078 OBMC Reboot (off)
Charles Paul Hofere43fb2f2017-09-26 15:36:18 -050079 Verify Running BMC Image ${IMAGE_FILE_PATH}
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050080
81
Charles Paul Hoferd66c5dc2017-09-29 14:25:52 -050082Verify Error Log Persistency
83 [Documentation] Check that the error log is still present after a
84 ... code update.
85 [Tags] Verify_Error_Log_Persistency
86
87 ${error_log_paths}= Read Properties ${BMC_LOGGING_URI}/list
88 Log To Console ${error_log_paths}
89 ${test_error_message}= Read Attribute @{error_log_paths}[-1] Message
90 Should Be Equal ${test_error_message}
91 ... example.xyz.openbmc_project.Example.Elog.${test_errlog_text}
92 Delete Error Log Entry @{error_log_paths}[-1]
93
94
95Verify BMC Dump Persistency
96 [Documentation] Check that the BMC dump present after a code update.
97 [Tags] Verify_BMC_Dump_Persistency
98 [Teardown] Set Suite Variable ${running_persistence_test} ${FALSE}
99
100 Check Dump Existence ${dump_id}
101 Delete BMC Dump ${dump_id}
102
103
104Verify Settings Persistency
105 [Documentation] Verify that the settings from 'Prepare Persistent Data'
106 ... are still set correctly after the code update.
107 [Tags] Verify_Settings_Persistency
108
109 ${autoreboot_enabled}= Read Attribute ${CONTROL_HOST_URI}auto_reboot
110 ... AutoReboot
111 Should Be Equal ${autoreboot_enabled} ${0}
112 ${onetime_enabled}= Read Attribute ${CONTROL_HOST_URI}boot/one_time
113 ... Enabled
114 Should Be Equal ${onetime_enabled} ${0}
115
116 # Set values back to their defaults
117 ${autoreboot_dict}= Create Dictionary data=${1}
118 Write Attribute ${CONTROL_HOST_URI}auto_reboot AutoReboot
119 ... data=${autoreboot_dict}
120 ${onetime_dict}= Create Dictionary data=${1}
121 Write Attribute ${CONTROL_HOST_URI}boot/one_time Enabled
122 ... data=${onetime_dict}
123
124
Charles Paul Hoferc1fa2bc2017-08-18 16:44:03 -0500125Upload And Activate Multiple BMC Images
126 [Documentation] Upload another BMC image and verify that its state is
127 ... different from all others.
128 [Tags] Upload_And_Activate_Multiple_BMC_Images
129 [Template] Activate Image And Verify No Duplicate Priorities
130 [Setup] Upload And Activate Multiple BMC Images Setup
131
132 # Image File Path Image Purpose
133 ${ALTERNATE_IMAGE_FILE_PATH} ${VERSION_PURPOSE_BMC}
134
135
Charles Paul Hofer42f17462017-09-12 14:09:32 -0500136BMC Set Priority To Invalid Values
137 [Documentation] Attempt to set the priority of an image to an invalid
138 ... value and expect an error.
139 [Tags] BMC_Set_Priority_To_Invalid_Values
140 [Template] Set Priority To Invalid Value And Expect Error
141
142 # Version Type Priority
143 ${VERSION_PURPOSE_BMC} ${-1}
144 ${VERSION_PURPOSE_BMC} ${256}
145
146
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -0500147Delete BMC Image
148 [Documentation] Delete a BMC image from the BMC flash chip.
149 [Tags] Delete_BMC_Image
150
151 ${software_object}= Get Non Running BMC Software Object
152 Delete Image And Verify ${software_object} ${VERSION_PURPOSE_BMC}
Charles Paul Hoferc1fa2bc2017-08-18 16:44:03 -0500153
154
George Keishing97ecb272017-09-12 04:30:20 -0500155BMC Image Priority Attribute Test
156 [Documentation] Set "Priority" attribute.
157 [Tags] BMC_Image_Priority_Attribute_Test
158 [Template] Temporarily Set BMC Attribute
159
160 # Property Value
161 Priority ${0}
162 Priority ${1}
163 Priority ${127}
164 Priority ${255}
165
166
Charles Paul Hofere8dc5252017-10-10 13:50:18 -0500167Delete All Non Running BMC Images
168 [Documentation] Delete all non running BMC images.
169 [Tags] Delete_All_Non_Running_BMC_Images
170
171 ${version_id}= Upload And Activate Image ${ALTERNATE_IMAGE_FILE_PATH}
George Keishing0889d432017-11-27 11:53:06 -0600172 ... skip_if_active=true
Charles Paul Hofere8dc5252017-10-10 13:50:18 -0500173 Delete All Non Running BMC Images
174
175 ${software_ids}= Get Software Objects Id
176 ... version_type=${VERSION_PURPOSE_BMC}
177 Should Not Contain ${software_ids} ${version_id}
178
Sivas SRR77c69192017-11-02 23:56:39 -0500179Test Basic BMC Performance After Code Update
180 [Documentation] Check performance of memory, CPU & file system of BMC.
181 [Tags] Test_Basic_BMC_Performance_After_Code_Update
182
183 Open Connection And Log In
184 Check BMC Performance
185
Charles Paul Hofere8dc5252017-10-10 13:50:18 -0500186
Charles Paul Hoferc1fa2bc2017-08-18 16:44:03 -0500187*** Keywords ***
188
George Keishing97ecb272017-09-12 04:30:20 -0500189Temporarily Set BMC Attribute
190 [Documentation] Update the BMC attribute value.
191 [Arguments] ${attribute_name} ${attribute_value}
192
193 # Description of argument(s):
194 # attribute_name BMC software attribute name (e.g. "Priority").
195 # attribute_value Value to be written.
196
197 ${image_ids}= Get Software Objects ${VERSION_PURPOSE_BMC}
198 ${init_bmc_properties}= Get Host Software Property ${image_ids[0]}
199 ${initial_priority}= Set Variable ${init_bmc_properties["Priority"]}
200
201 Set Host Software Property ${image_ids[0]} ${attribute_name}
202 ... ${attribute_value}
203
204 ${cur_bmc_properties}= Get Host Software Property ${image_ids[0]}
205 Should Be Equal As Integers ${cur_bmc_properties["Priority"]}
206 ... ${attribute_value}
207
208 # Revert to to initial value.
209 Set Host Software Property
210 ... ${image_ids[0]} ${attribute_name} ${initial_priority}
211
212
Charles Paul Hoferc1fa2bc2017-08-18 16:44:03 -0500213Upload And Activate Multiple BMC Images Setup
214 [Documentation] Check that the ALTERNATE_FILE_PATH variable is set.
215
George Keishing1eb85f52017-08-30 22:55:13 -0500216 Should Not Be Empty ${ALTERNATE_IMAGE_FILE_PATH}
217
Charles Paul Hoferd66c5dc2017-09-29 14:25:52 -0500218
219REST BMC Code Update Teardown
220 [Documentation] Do code update test teardown.
221
222 FFDC On Test Case Fail
223 Run Keyword If Test Failed Fatal Error msg=Code update failed.
224
225
226Suite Setup Execution
George Keishing1eb85f52017-08-30 22:55:13 -0500227 [Documentation] Do code update test case setup.
228 # - Clean up all existing BMC dumps.
229
Michael Walshe78a4432018-03-29 16:36:04 -0500230 Run Key Delete All Dumps ignore=1
Charles Paul Hoferb9264082017-09-29 15:00:19 -0500231 Run Keyword And Ignore Error Smart Power Off
George Keishing00715492017-08-18 11:46:37 -0500232
Charles Paul Hoferd66c5dc2017-09-29 14:25:52 -0500233Test Teardown Execution
George Keishing00715492017-08-18 11:46:37 -0500234 [Documentation] Do code update test case teardown.
235 # 1. Collect FFDC if test case failed.
236 # 2. Collect FFDC if test PASS but error log exists.
237
Charles Paul Hoferd66c5dc2017-09-29 14:25:52 -0500238 # Don't delete our logs if we want to persist them for tests.
239 Return From Keyword If ${running_persistence_test}
240
George Keishing00715492017-08-18 11:46:37 -0500241 FFDC On Test Case Fail
242 Run Keyword If '${TEST_STATUS}' == 'PASS' Check Error And Collect FFDC
Sivas SRR77c69192017-11-02 23:56:39 -0500243 Close All Connections