blob: 3aad17a3aa158669d0242ffcdaee2dce810a45f3 [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
Charles Paul Hofer21845462017-09-27 12:40:33 -050073 Upload And Activate Image ${IMAGE_FILE_PATH}
74 ... skip_if_active=${SKIP_UPDATE_IF_ACTIVE}
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050075 OBMC Reboot (off)
Charles Paul Hofere43fb2f2017-09-26 15:36:18 -050076 Verify Running BMC Image ${IMAGE_FILE_PATH}
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050077
78
Charles Paul Hoferd66c5dc2017-09-29 14:25:52 -050079Verify Error Log Persistency
80 [Documentation] Check that the error log is still present after a
81 ... code update.
82 [Tags] Verify_Error_Log_Persistency
83
84 ${error_log_paths}= Read Properties ${BMC_LOGGING_URI}/list
85 Log To Console ${error_log_paths}
86 ${test_error_message}= Read Attribute @{error_log_paths}[-1] Message
87 Should Be Equal ${test_error_message}
88 ... example.xyz.openbmc_project.Example.Elog.${test_errlog_text}
89 Delete Error Log Entry @{error_log_paths}[-1]
90
91
92Verify BMC Dump Persistency
93 [Documentation] Check that the BMC dump present after a code update.
94 [Tags] Verify_BMC_Dump_Persistency
95 [Teardown] Set Suite Variable ${running_persistence_test} ${FALSE}
96
97 Check Dump Existence ${dump_id}
98 Delete BMC Dump ${dump_id}
99
100
101Verify Settings Persistency
102 [Documentation] Verify that the settings from 'Prepare Persistent Data'
103 ... are still set correctly after the code update.
104 [Tags] Verify_Settings_Persistency
105
106 ${autoreboot_enabled}= Read Attribute ${CONTROL_HOST_URI}auto_reboot
107 ... AutoReboot
108 Should Be Equal ${autoreboot_enabled} ${0}
109 ${onetime_enabled}= Read Attribute ${CONTROL_HOST_URI}boot/one_time
110 ... Enabled
111 Should Be Equal ${onetime_enabled} ${0}
112
113 # Set values back to their defaults
114 ${autoreboot_dict}= Create Dictionary data=${1}
115 Write Attribute ${CONTROL_HOST_URI}auto_reboot AutoReboot
116 ... data=${autoreboot_dict}
117 ${onetime_dict}= Create Dictionary data=${1}
118 Write Attribute ${CONTROL_HOST_URI}boot/one_time Enabled
119 ... data=${onetime_dict}
120
121
Charles Paul Hoferc1fa2bc2017-08-18 16:44:03 -0500122Upload And Activate Multiple BMC Images
123 [Documentation] Upload another BMC image and verify that its state is
124 ... different from all others.
125 [Tags] Upload_And_Activate_Multiple_BMC_Images
126 [Template] Activate Image And Verify No Duplicate Priorities
127 [Setup] Upload And Activate Multiple BMC Images Setup
128
129 # Image File Path Image Purpose
130 ${ALTERNATE_IMAGE_FILE_PATH} ${VERSION_PURPOSE_BMC}
131
132
Charles Paul Hofer42f17462017-09-12 14:09:32 -0500133BMC Set Priority To Invalid Values
134 [Documentation] Attempt to set the priority of an image to an invalid
135 ... value and expect an error.
136 [Tags] BMC_Set_Priority_To_Invalid_Values
137 [Template] Set Priority To Invalid Value And Expect Error
138
139 # Version Type Priority
140 ${VERSION_PURPOSE_BMC} ${-1}
141 ${VERSION_PURPOSE_BMC} ${256}
142
143
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -0500144Delete BMC Image
145 [Documentation] Delete a BMC image from the BMC flash chip.
146 [Tags] Delete_BMC_Image
147
148 ${software_object}= Get Non Running BMC Software Object
149 Delete Image And Verify ${software_object} ${VERSION_PURPOSE_BMC}
Charles Paul Hoferc1fa2bc2017-08-18 16:44:03 -0500150
151
George Keishing97ecb272017-09-12 04:30:20 -0500152BMC Image Priority Attribute Test
153 [Documentation] Set "Priority" attribute.
154 [Tags] BMC_Image_Priority_Attribute_Test
155 [Template] Temporarily Set BMC Attribute
156
157 # Property Value
158 Priority ${0}
159 Priority ${1}
160 Priority ${127}
161 Priority ${255}
162
163
Charles Paul Hofere8dc5252017-10-10 13:50:18 -0500164Delete All Non Running BMC Images
165 [Documentation] Delete all non running BMC images.
166 [Tags] Delete_All_Non_Running_BMC_Images
167
168 ${version_id}= Upload And Activate Image ${ALTERNATE_IMAGE_FILE_PATH}
169 Delete All Non Running BMC Images
170
171 ${software_ids}= Get Software Objects Id
172 ... version_type=${VERSION_PURPOSE_BMC}
173 Should Not Contain ${software_ids} ${version_id}
174
Sivas SRR77c69192017-11-02 23:56:39 -0500175Test Basic BMC Performance After Code Update
176 [Documentation] Check performance of memory, CPU & file system of BMC.
177 [Tags] Test_Basic_BMC_Performance_After_Code_Update
178
179 Open Connection And Log In
180 Check BMC Performance
181
Charles Paul Hofere8dc5252017-10-10 13:50:18 -0500182
Charles Paul Hoferc1fa2bc2017-08-18 16:44:03 -0500183*** Keywords ***
184
George Keishing97ecb272017-09-12 04:30:20 -0500185Temporarily Set BMC Attribute
186 [Documentation] Update the BMC attribute value.
187 [Arguments] ${attribute_name} ${attribute_value}
188
189 # Description of argument(s):
190 # attribute_name BMC software attribute name (e.g. "Priority").
191 # attribute_value Value to be written.
192
193 ${image_ids}= Get Software Objects ${VERSION_PURPOSE_BMC}
194 ${init_bmc_properties}= Get Host Software Property ${image_ids[0]}
195 ${initial_priority}= Set Variable ${init_bmc_properties["Priority"]}
196
197 Set Host Software Property ${image_ids[0]} ${attribute_name}
198 ... ${attribute_value}
199
200 ${cur_bmc_properties}= Get Host Software Property ${image_ids[0]}
201 Should Be Equal As Integers ${cur_bmc_properties["Priority"]}
202 ... ${attribute_value}
203
204 # Revert to to initial value.
205 Set Host Software Property
206 ... ${image_ids[0]} ${attribute_name} ${initial_priority}
207
208
Charles Paul Hoferc1fa2bc2017-08-18 16:44:03 -0500209Upload And Activate Multiple BMC Images Setup
210 [Documentation] Check that the ALTERNATE_FILE_PATH variable is set.
211
George Keishing1eb85f52017-08-30 22:55:13 -0500212 Should Not Be Empty ${ALTERNATE_IMAGE_FILE_PATH}
213
Charles Paul Hoferd66c5dc2017-09-29 14:25:52 -0500214
215REST BMC Code Update Teardown
216 [Documentation] Do code update test teardown.
217
218 FFDC On Test Case Fail
219 Run Keyword If Test Failed Fatal Error msg=Code update failed.
220
221
222Suite Setup Execution
George Keishing1eb85f52017-08-30 22:55:13 -0500223 [Documentation] Do code update test case setup.
224 # - Clean up all existing BMC dumps.
225
226 Delete All Dumps
Charles Paul Hoferb9264082017-09-29 15:00:19 -0500227 Run Keyword And Ignore Error Smart Power Off
George Keishing00715492017-08-18 11:46:37 -0500228
Charles Paul Hoferd66c5dc2017-09-29 14:25:52 -0500229Test Teardown Execution
George Keishing00715492017-08-18 11:46:37 -0500230 [Documentation] Do code update test case teardown.
231 # 1. Collect FFDC if test case failed.
232 # 2. Collect FFDC if test PASS but error log exists.
233
Charles Paul Hoferd66c5dc2017-09-29 14:25:52 -0500234 # Don't delete our logs if we want to persist them for tests.
235 Return From Keyword If ${running_persistence_test}
236
George Keishing00715492017-08-18 11:46:37 -0500237 FFDC On Test Case Fail
238 Run Keyword If '${TEST_STATUS}' == 'PASS' Check Error And Collect FFDC
Sivas SRR77c69192017-11-02 23:56:39 -0500239 Close All Connections