blob: c44749d3e069ddcb9807138170b3ea974b0b23a8 [file] [log] [blame]
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -05001*** Settings ***
2Documentation Update the PNOR code on a target BMC.
3... Execution Method:
4... python -m robot -v OPENBMC_HOST:<hostname>
5... -v DELETE_OLD_PNOR_IMAGES:<"true" or "false">
Charles Paul Hofera5673162017-08-30 09:49:16 -05006... -v IMAGE_FILE_PATH:<path/*.tar>
7... -v ALTERNATE_IMAGE_FILE_PATH:<path/*.tar>
8... host_code_update.robot
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -05009...
10... Code update method BMC
11... Update work flow sequence:
12... - Upload image via REST
13... - Verify that the file exists on the BMC
14... - Check that software "Activation" is set to "Ready"
15... - Set "Requested Activation" to "Active"
16... - Wait for code update to complete
17... - Verify the new version
18
19Library ../../lib/bmc_ssh_utils.py
20Library ../../lib/code_update_utils.py
21Variables ../../data/variables.py
22Resource ../../lib/boot_utils.robot
23Resource code_update_utils.robot
24Resource ../../lib/code_update_utils.robot
George Keishing1eb85f52017-08-30 22:55:13 -050025Resource ../../lib/openbmc_ffdc.robot
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050026Resource ../../lib/state_manager.robot
George Keishing1eb85f52017-08-30 22:55:13 -050027Resource ../../lib/dump_utils.robot
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050028
George Keishing00715492017-08-18 11:46:37 -050029Test Teardown Code Update Test Teardown
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050030
George Keishing09712a12017-10-16 12:52:42 -050031Force Tags Host_Code_Update
32
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050033*** Variables ***
34
35${QUIET} ${1}
36${IMAGE_FILE_PATH} ${EMPTY}
37${DELETE_OLD_PNOR_IMAGES} false
Charles Paul Hofer51b54c02017-09-13 22:13:49 -050038${DELETE_OLD_GUARD_FILE} false
Charles Paul Hoferc1fa2bc2017-08-18 16:44:03 -050039${ALTERNATE_IMAGE_FILE_PATH} ${EMPTY}
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050040
41*** Test Cases ***
42
43REST Host Code Update
44 [Documentation] Do a PNOR code update by uploading image on BMC via REST.
George Keishing00715492017-08-18 11:46:37 -050045 # 1. Delete error logs if there is any.
46 # 1. Do code update.
47 # 2. Do post update the following:
48 # - Collect FFDC if error log exist and delete error logs.
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050049 [Tags] REST_Host_Code_Update
50 [Setup] Code Update Setup
51
52 Upload And Activate Image ${IMAGE_FILE_PATH}
53 OBMC Reboot (off)
54
55
56Post Update Boot To OS
57 [Documentation] Boot the host OS
58 [Tags] Post_Update_Boot_To_OS
Charles Paul Hofer0c4a87d2017-10-11 17:27:40 -050059 [Setup] Start SOL Console Logging
George Keishingda6bace2017-09-14 07:42:27 -050060 [Teardown] Run Keywords Stop SOL Console Logging
61 ... AND Code Update Test Teardown
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050062
63 Run Keyword If '${PREV_TEST_STATUS}' == 'FAIL'
64 ... Fail Code update failed. No need to boot to OS.
George Keishing00715492017-08-18 11:46:37 -050065 Delete Error Logs
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050066 REST Power On
Charles Paul Hofere43fb2f2017-09-26 15:36:18 -050067 Verify Running Host Image ${IMAGE_FILE_PATH}
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050068
69
Charles Paul Hofer7c6e7522017-10-18 17:09:27 -050070REST Host Code Update While OS Is Running
71 [Documentation] Do a PNOR code update while the host is running.
72 [Tags] REST_Host_Code_Update_While_OS_Is_Running
Charles Paul Hofer4e8c09b2017-11-03 14:59:05 -050073 [Teardown] Run Keywords REST Power Off stack_mode=skip
74 ... AND Code Update Test Teardown
Charles Paul Hofer7c6e7522017-10-18 17:09:27 -050075
76 Run Keyword If '${PREV_TEST_STATUS}' == 'FAIL'
77 ... Fail Cannot boot the OS.
78
79 REST Power On stack_mode=skip
George Keishing72373f82017-11-20 09:18:41 -060080 Upload And Activate Image
81 ... ${ALTERNATE_IMAGE_FILE_PATH} skip_if_active=true
Charles Paul Hofer7c6e7522017-10-18 17:09:27 -050082 REST Power On stack_mode=normal
83 Verify Running Host Image ${ALTERNATE_IMAGE_FILE_PATH}
84
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050085Host Image Priority Attribute Test
86 [Documentation] Set "Priority" attribute.
87 [Tags] Host_Image_Priority_Attribute_Test
88 [Template] Temporarily Set PNOR Attribute
89
90 # Property Value
91 Priority ${0}
92 Priority ${1}
93 Priority ${127}
George Keishing97ecb272017-09-12 04:30:20 -050094 Priority ${255}
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050095
96
Charles Paul Hofer42f17462017-09-12 14:09:32 -050097Host Set Priority To Invalid Values
98 [Documentation] Attempt to set the priority of an image to an invalid
99 ... value and expect an error.
100 [Tags] Host_Set_Priority_To_Invalid_Values
101 [Template] Set Priority To Invalid Value And Expect Error
102
103 # Version Type Priority
104 ${VERSION_PURPOSE_HOST} ${-1}
105 ${VERSION_PURPOSE_HOST} ${256}
106
107
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -0500108Set RequestedActivation To None
109 [Documentation] Set the RequestedActivation of the image to None and
110 ... verify that it is in fact set to None.
111 [Tags] Set_RequestedActivation_To_None
112
113 ${software_objects}= Get Software Objects
114 Set Host Software Property @{software_objects}[0] RequestedActivation
115 ... ${REQUESTED_NONE}
116 ${software_properties}= Get Host Software Property @{software_objects}[0]
117 Should Be Equal As Strings &{software_properties}[RequestedActivation]
118 ... ${REQUESTED_NONE}
119
120
121Set RequestedActivation And Activation To Invalid Value
122 [Documentation] Set the RequestedActivation and Activation propreties of
123 ... the image to an invalid value and verify that it was not
124 ... changed.
125 [Template] Set Property To Invalid Value And Verify No Change
126 [Tags] Set_RequestedActivation_And_Activation_To_Invalid_Value
127
128 # Property Version Type
129 RequestedActivation ${VERSION_PURPOSE_HOST}
130 Activation ${VERSION_PURPOSE_HOST}
131
132
Charles Paul Hoferc1fa2bc2017-08-18 16:44:03 -0500133Upload And Activate Multiple Host Images
134 [Documentation] Upload another PNOR image and verify that its state is
135 ... different from all others.
136 [Tags] Upload_And_Activate_Multiple_Host_Images
137 [Template] Activate Image And Verify No Duplicate Priorities
138 [Setup] Upload And Activate Multiple BMC Images Setup
139
140 # Image File Path Image Purpose
141 ${ALTERNATE_IMAGE_FILE_PATH} ${VERSION_PURPOSE_HOST}
142
143
Charles Paul Hofera5673162017-08-30 09:49:16 -0500144Set Same Priority For Multiple Host Images
145 [Documentation] Attempt to set the priority to be the same for two PNOR
146 ... images and verify that the priorities are not the same.
147 [Tags] Set_Same_Priority_For_Multiple_Host_Images
148
149 Run Keyword If '${PREV_TEST_STATUS}' == 'FAIL'
150 ... Fail Activation of alternate image failed. Cannot set priority.
151 Set Same Priority For Multiple Images ${VERSION_PURPOSE_HOST}
152
153
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -0500154Delete Host Image
155 [Documentation] Delete a PNOR image from the BMC and PNOR flash chip.
156 [Tags] Delete_Host_Image
157 [Setup] Initiate Host PowerOff
158
159 ${software_objects}= Get Software Objects
160 ... version_type=${VERSION_PURPOSE_HOST}
161 ${num_images}= Get Length ${software_objects}
162 Should Be True 0 < ${num_images}
163 ... msg=There are no PNOR images on the BMC to delete.
164 Delete Image And Verify @{software_objects}[0] ${VERSION_PURPOSE_HOST}
165
166
167*** Keywords ***
168
169Temporarily Set PNOR Attribute
170 [Documentation] Update the PNOR attribute value.
171 [Arguments] ${attribute_name} ${attribute_value}
172
173 # Description of argument(s):
174 # attribute_name Host software attribute name (e.g. "Priority").
175 # attribute_value Value to be written.
176
177 ${image_ids}= Get Software Objects
178 ${init_host_properties}= Get Host Software Property ${image_ids[0]}
179 ${initial_priority}= Set Variable ${init_host_properties["Priority"]}
180
181 Set Host Software Property ${image_ids[0]} ${attribute_name}
182 ... ${attribute_value}
183
184 ${cur_host_properties}= Get Host Software Property ${image_ids[0]}
185 Should Be Equal As Integers ${cur_host_properties["Priority"]}
186 ... ${attribute_value}
187
188 # Revert to to initial value.
189 Set Host Software Property
190 ... ${image_ids[0]} ${attribute_name} ${initial_priority}
191
192
193Code Update Setup
194 [Documentation] Do code update test case setup.
George Keishing1eb85f52017-08-30 22:55:13 -0500195 # - Clean up all existing BMC dumps.
196 # - Clean up all currently install PNOR images.
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -0500197
Charles Paul Hoferb9264082017-09-29 15:00:19 -0500198 Run Keyword And Ignore Error Smart Power Off
George Keishing1eb85f52017-08-30 22:55:13 -0500199 Delete All Dumps
George Keishing00715492017-08-18 11:46:37 -0500200 Delete Error Logs
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -0500201 Run Keyword If 'true' == '${DELETE_OLD_PNOR_IMAGES}'
202 ... Delete All PNOR Images
Charles Paul Hofer51b54c02017-09-13 22:13:49 -0500203 Run Keyword If 'true' == '${DELETE_OLD_GUARD_FILE}' BMC Execute Command
204 ... rm -f /var/lib/phosphor-software-manager/pnor/prsv/GUARD
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -0500205
206
Charles Paul Hoferc1fa2bc2017-08-18 16:44:03 -0500207Upload And Activate Multiple BMC Images Setup
208 [Documentation] Check that the ALTERNATE_FILE_PATH variable is set.
209
210 Should Not Be Empty ${ALTERNATE_IMAGE_FILE_PATH}
Charles Paul Hofer4e8c09b2017-11-03 14:59:05 -0500211 Delete All PNOR Images
George Keishing72373f82017-11-20 09:18:41 -0600212 Upload And Activate Image ${IMAGE_FILE_PATH} skip_if_active=true
Charles Paul Hoferc1fa2bc2017-08-18 16:44:03 -0500213
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -0500214Get PNOR Extended Version
215 [Documentation] Return the PNOR extended version.
216 [Arguments] ${manifest_path}
217
218 # Description of argument(s):
219 # manifest_path Path of the MANIFEST file
220 # (e.g. "/tmp/images/abc123/MANIFEST").
221
222 ${version}= BMC Execute Command
223 ... grep extended_version= ${manifest_path}
224 [return] ${version.split(",")}
George Keishing00715492017-08-18 11:46:37 -0500225
226
227Code Update Test Teardown
228 [Documentation] Do code update test case teardown.
229 # 1. Collect FFDC if test case failed.
230 # 2. Collect FFDC if test PASS but error log exists.
231
232 FFDC On Test Case Fail
233 Run Keyword If '${TEST_STATUS}' == 'PASS' Check Error And Collect FFDC