blob: b97b103262a061f055953c7e04c4a771f61096c1 [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
9Resource ../../lib/boot_utils.robot
10Resource code_update_utils.robot
11Resource ../../lib/code_update_utils.robot
George Keishing1eb85f52017-08-30 22:55:13 -050012Resource ../../lib/openbmc_ffdc.robot
13Resource ../../lib/dump_utils.robot
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050014
Charles Paul Hoferd66c5dc2017-09-29 14:25:52 -050015Suite Setup Suite Setup Execution
16
17Test Teardown Test Teardown Execution
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050018
George Keishing09712a12017-10-16 12:52:42 -050019Force Tags BMC_Code_Update
20
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050021*** Variables ***
22
23${QUIET} ${1}
24${IMAGE_FILE_PATH} ${EMPTY}
Charles Paul Hoferc1fa2bc2017-08-18 16:44:03 -050025${ALTERNATE_IMAGE_FILE_PATH} ${EMPTY}
Charles Paul Hoferb7842a52017-09-22 10:11:33 -050026${SKIP_UPDATE_IF_ACTIVE} false
Charles Paul Hoferd66c5dc2017-09-29 14:25:52 -050027${dump_id} ${EMPTY}
28${running_persistence_test} ${FALSE}
29${test_errlog_text} AutoTestSimple
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050030
31*** Test Cases ***
32
Charles Paul Hoferd66c5dc2017-09-29 14:25:52 -050033Prepare Persistent Data
34 [Documentation] Set data that should persist across the code update.
35 [Tags] Prepare_Persistent_Data
36
37 # Install the debug tarball.
38 BMC Execute Command rm -rf /tmp/tarball
39 Install Debug Tarball On BMC tarball_file_path=${DEBUG_TARBALL_PATH}
40
41 # Create a dummy error log and dump.
42 BMC Execute Command /tmp/tarball/bin/logging-test -c ${test_errlog_text}
43 ${dump_id}= Create User Initiated Dump
44 Check Dump Existence ${dump_id}
45 Set Suite Variable ${dump_id}
46
47 # Set persistent settings.
48 ${autoreboot_dict}= Create Dictionary data=${0}
49 Write Attribute ${CONTROL_HOST_URI}auto_reboot AutoReboot
50 ... data=${autoreboot_dict}
51 ${onetime_dict}= Create Dictionary data=${0}
52 Write Attribute ${CONTROL_HOST_URI}boot/one_time Enabled
53 ... data=${onetime_dict}
54
55 # Let the remaining test cases know we are doing a persistence test so we
56 # do not delete logs.
57 Set Suite Variable ${running_persistence_test} ${TRUE}
58
59
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050060REST BMC Code Update
61 [Documentation] Do a BMC code update by uploading image on BMC via REST.
62 [Tags] REST_BMC_Code_Update
Charles Paul Hoferd66c5dc2017-09-29 14:25:52 -050063 [Teardown] REST BMC Code Update Teardown
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050064
Charles Paul Hofer21845462017-09-27 12:40:33 -050065 Upload And Activate Image ${IMAGE_FILE_PATH}
66 ... skip_if_active=${SKIP_UPDATE_IF_ACTIVE}
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050067 OBMC Reboot (off)
Charles Paul Hofere43fb2f2017-09-26 15:36:18 -050068 Verify Running BMC Image ${IMAGE_FILE_PATH}
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050069
70
Charles Paul Hoferd66c5dc2017-09-29 14:25:52 -050071Verify Error Log Persistency
72 [Documentation] Check that the error log is still present after a
73 ... code update.
74 [Tags] Verify_Error_Log_Persistency
75
76 ${error_log_paths}= Read Properties ${BMC_LOGGING_URI}/list
77 Log To Console ${error_log_paths}
78 ${test_error_message}= Read Attribute @{error_log_paths}[-1] Message
79 Should Be Equal ${test_error_message}
80 ... example.xyz.openbmc_project.Example.Elog.${test_errlog_text}
81 Delete Error Log Entry @{error_log_paths}[-1]
82
83
84Verify BMC Dump Persistency
85 [Documentation] Check that the BMC dump present after a code update.
86 [Tags] Verify_BMC_Dump_Persistency
87 [Teardown] Set Suite Variable ${running_persistence_test} ${FALSE}
88
89 Check Dump Existence ${dump_id}
90 Delete BMC Dump ${dump_id}
91
92
93Verify Settings Persistency
94 [Documentation] Verify that the settings from 'Prepare Persistent Data'
95 ... are still set correctly after the code update.
96 [Tags] Verify_Settings_Persistency
97
98 ${autoreboot_enabled}= Read Attribute ${CONTROL_HOST_URI}auto_reboot
99 ... AutoReboot
100 Should Be Equal ${autoreboot_enabled} ${0}
101 ${onetime_enabled}= Read Attribute ${CONTROL_HOST_URI}boot/one_time
102 ... Enabled
103 Should Be Equal ${onetime_enabled} ${0}
104
105 # Set values back to their defaults
106 ${autoreboot_dict}= Create Dictionary data=${1}
107 Write Attribute ${CONTROL_HOST_URI}auto_reboot AutoReboot
108 ... data=${autoreboot_dict}
109 ${onetime_dict}= Create Dictionary data=${1}
110 Write Attribute ${CONTROL_HOST_URI}boot/one_time Enabled
111 ... data=${onetime_dict}
112
113
Charles Paul Hoferc1fa2bc2017-08-18 16:44:03 -0500114Upload And Activate Multiple BMC Images
115 [Documentation] Upload another BMC image and verify that its state is
116 ... different from all others.
117 [Tags] Upload_And_Activate_Multiple_BMC_Images
118 [Template] Activate Image And Verify No Duplicate Priorities
119 [Setup] Upload And Activate Multiple BMC Images Setup
120
121 # Image File Path Image Purpose
122 ${ALTERNATE_IMAGE_FILE_PATH} ${VERSION_PURPOSE_BMC}
123
124
Charles Paul Hofer42f17462017-09-12 14:09:32 -0500125BMC Set Priority To Invalid Values
126 [Documentation] Attempt to set the priority of an image to an invalid
127 ... value and expect an error.
128 [Tags] BMC_Set_Priority_To_Invalid_Values
129 [Template] Set Priority To Invalid Value And Expect Error
130
131 # Version Type Priority
132 ${VERSION_PURPOSE_BMC} ${-1}
133 ${VERSION_PURPOSE_BMC} ${256}
134
135
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -0500136Delete BMC Image
137 [Documentation] Delete a BMC image from the BMC flash chip.
138 [Tags] Delete_BMC_Image
139
140 ${software_object}= Get Non Running BMC Software Object
141 Delete Image And Verify ${software_object} ${VERSION_PURPOSE_BMC}
Charles Paul Hoferc1fa2bc2017-08-18 16:44:03 -0500142
143
George Keishing97ecb272017-09-12 04:30:20 -0500144BMC Image Priority Attribute Test
145 [Documentation] Set "Priority" attribute.
146 [Tags] BMC_Image_Priority_Attribute_Test
147 [Template] Temporarily Set BMC Attribute
148
149 # Property Value
150 Priority ${0}
151 Priority ${1}
152 Priority ${127}
153 Priority ${255}
154
155
Charles Paul Hofere8dc5252017-10-10 13:50:18 -0500156Delete All Non Running BMC Images
157 [Documentation] Delete all non running BMC images.
158 [Tags] Delete_All_Non_Running_BMC_Images
159
160 ${version_id}= Upload And Activate Image ${ALTERNATE_IMAGE_FILE_PATH}
161 Delete All Non Running BMC Images
162
163 ${software_ids}= Get Software Objects Id
164 ... version_type=${VERSION_PURPOSE_BMC}
165 Should Not Contain ${software_ids} ${version_id}
166
167
Charles Paul Hoferc1fa2bc2017-08-18 16:44:03 -0500168*** Keywords ***
169
George Keishing97ecb272017-09-12 04:30:20 -0500170Temporarily Set BMC Attribute
171 [Documentation] Update the BMC attribute value.
172 [Arguments] ${attribute_name} ${attribute_value}
173
174 # Description of argument(s):
175 # attribute_name BMC software attribute name (e.g. "Priority").
176 # attribute_value Value to be written.
177
178 ${image_ids}= Get Software Objects ${VERSION_PURPOSE_BMC}
179 ${init_bmc_properties}= Get Host Software Property ${image_ids[0]}
180 ${initial_priority}= Set Variable ${init_bmc_properties["Priority"]}
181
182 Set Host Software Property ${image_ids[0]} ${attribute_name}
183 ... ${attribute_value}
184
185 ${cur_bmc_properties}= Get Host Software Property ${image_ids[0]}
186 Should Be Equal As Integers ${cur_bmc_properties["Priority"]}
187 ... ${attribute_value}
188
189 # Revert to to initial value.
190 Set Host Software Property
191 ... ${image_ids[0]} ${attribute_name} ${initial_priority}
192
193
Charles Paul Hoferc1fa2bc2017-08-18 16:44:03 -0500194Upload And Activate Multiple BMC Images Setup
195 [Documentation] Check that the ALTERNATE_FILE_PATH variable is set.
196
George Keishing1eb85f52017-08-30 22:55:13 -0500197 Should Not Be Empty ${ALTERNATE_IMAGE_FILE_PATH}
198
Charles Paul Hoferd66c5dc2017-09-29 14:25:52 -0500199
200REST BMC Code Update Teardown
201 [Documentation] Do code update test teardown.
202
203 FFDC On Test Case Fail
204 Run Keyword If Test Failed Fatal Error msg=Code update failed.
205
206
207Suite Setup Execution
George Keishing1eb85f52017-08-30 22:55:13 -0500208 [Documentation] Do code update test case setup.
209 # - Clean up all existing BMC dumps.
210
211 Delete All Dumps
Charles Paul Hoferb9264082017-09-29 15:00:19 -0500212 Run Keyword And Ignore Error Smart Power Off
George Keishing00715492017-08-18 11:46:37 -0500213
Charles Paul Hoferd66c5dc2017-09-29 14:25:52 -0500214Test Teardown Execution
George Keishing00715492017-08-18 11:46:37 -0500215 [Documentation] Do code update test case teardown.
216 # 1. Collect FFDC if test case failed.
217 # 2. Collect FFDC if test PASS but error log exists.
218
Charles Paul Hoferd66c5dc2017-09-29 14:25:52 -0500219 # Don't delete our logs if we want to persist them for tests.
220 Return From Keyword If ${running_persistence_test}
221
George Keishing00715492017-08-18 11:46:37 -0500222 FFDC On Test Case Fail
223 Run Keyword If '${TEST_STATUS}' == 'PASS' Check Error And Collect FFDC