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