blob: df728b5df68f5e7c605d56b2b3acc1c7338c3b05 [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
31*** Variables ***
32
33${QUIET} ${1}
34${IMAGE_FILE_PATH} ${EMPTY}
35${DELETE_OLD_PNOR_IMAGES} false
Charles Paul Hofer51b54c02017-09-13 22:13:49 -050036${DELETE_OLD_GUARD_FILE} false
Charles Paul Hoferc1fa2bc2017-08-18 16:44:03 -050037${ALTERNATE_IMAGE_FILE_PATH} ${EMPTY}
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050038
39*** Test Cases ***
40
41REST Host Code Update
42 [Documentation] Do a PNOR code update by uploading image on BMC via REST.
George Keishing00715492017-08-18 11:46:37 -050043 # 1. Delete error logs if there is any.
44 # 1. Do code update.
45 # 2. Do post update the following:
46 # - Collect FFDC if error log exist and delete error logs.
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050047 [Tags] REST_Host_Code_Update
48 [Setup] Code Update Setup
49
50 Upload And Activate Image ${IMAGE_FILE_PATH}
51 OBMC Reboot (off)
52
53
54Post Update Boot To OS
55 [Documentation] Boot the host OS
56 [Tags] Post_Update_Boot_To_OS
George Keishingda6bace2017-09-14 07:42:27 -050057 [Teardown] Run Keywords Stop SOL Console Logging
58 ... AND Code Update Test Teardown
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050059
60 Run Keyword If '${PREV_TEST_STATUS}' == 'FAIL'
61 ... Fail Code update failed. No need to boot to OS.
62 Start SOL Console Logging
George Keishing00715492017-08-18 11:46:37 -050063 Delete Error Logs
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050064 REST Power On
65
66
67Host Image Priority Attribute Test
68 [Documentation] Set "Priority" attribute.
69 [Tags] Host_Image_Priority_Attribute_Test
70 [Template] Temporarily Set PNOR Attribute
71
72 # Property Value
73 Priority ${0}
74 Priority ${1}
75 Priority ${127}
George Keishing97ecb272017-09-12 04:30:20 -050076 Priority ${255}
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050077
78
Charles Paul Hofer42f17462017-09-12 14:09:32 -050079Host Set Priority To Invalid Values
80 [Documentation] Attempt to set the priority of an image to an invalid
81 ... value and expect an error.
82 [Tags] Host_Set_Priority_To_Invalid_Values
83 [Template] Set Priority To Invalid Value And Expect Error
84
85 # Version Type Priority
86 ${VERSION_PURPOSE_HOST} ${-1}
87 ${VERSION_PURPOSE_HOST} ${256}
88
89
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050090Set RequestedActivation To None
91 [Documentation] Set the RequestedActivation of the image to None and
92 ... verify that it is in fact set to None.
93 [Tags] Set_RequestedActivation_To_None
94
95 ${software_objects}= Get Software Objects
96 Set Host Software Property @{software_objects}[0] RequestedActivation
97 ... ${REQUESTED_NONE}
98 ${software_properties}= Get Host Software Property @{software_objects}[0]
99 Should Be Equal As Strings &{software_properties}[RequestedActivation]
100 ... ${REQUESTED_NONE}
101
102
103Set RequestedActivation And Activation To Invalid Value
104 [Documentation] Set the RequestedActivation and Activation propreties of
105 ... the image to an invalid value and verify that it was not
106 ... changed.
107 [Template] Set Property To Invalid Value And Verify No Change
108 [Tags] Set_RequestedActivation_And_Activation_To_Invalid_Value
109
110 # Property Version Type
111 RequestedActivation ${VERSION_PURPOSE_HOST}
112 Activation ${VERSION_PURPOSE_HOST}
113
114
Charles Paul Hoferc1fa2bc2017-08-18 16:44:03 -0500115Upload And Activate Multiple Host Images
116 [Documentation] Upload another PNOR image and verify that its state is
117 ... different from all others.
118 [Tags] Upload_And_Activate_Multiple_Host_Images
119 [Template] Activate Image And Verify No Duplicate Priorities
120 [Setup] Upload And Activate Multiple BMC Images Setup
121
122 # Image File Path Image Purpose
123 ${ALTERNATE_IMAGE_FILE_PATH} ${VERSION_PURPOSE_HOST}
124
125
Charles Paul Hofera5673162017-08-30 09:49:16 -0500126Set Same Priority For Multiple Host Images
127 [Documentation] Attempt to set the priority to be the same for two PNOR
128 ... images and verify that the priorities are not the same.
129 [Tags] Set_Same_Priority_For_Multiple_Host_Images
130
131 Run Keyword If '${PREV_TEST_STATUS}' == 'FAIL'
132 ... Fail Activation of alternate image failed. Cannot set priority.
133 Set Same Priority For Multiple Images ${VERSION_PURPOSE_HOST}
134
135
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -0500136Delete Host Image
137 [Documentation] Delete a PNOR image from the BMC and PNOR flash chip.
138 [Tags] Delete_Host_Image
139 [Setup] Initiate Host PowerOff
140
141 ${software_objects}= Get Software Objects
142 ... version_type=${VERSION_PURPOSE_HOST}
143 ${num_images}= Get Length ${software_objects}
144 Should Be True 0 < ${num_images}
145 ... msg=There are no PNOR images on the BMC to delete.
146 Delete Image And Verify @{software_objects}[0] ${VERSION_PURPOSE_HOST}
147
148
149*** Keywords ***
150
151Temporarily Set PNOR Attribute
152 [Documentation] Update the PNOR attribute value.
153 [Arguments] ${attribute_name} ${attribute_value}
154
155 # Description of argument(s):
156 # attribute_name Host software attribute name (e.g. "Priority").
157 # attribute_value Value to be written.
158
159 ${image_ids}= Get Software Objects
160 ${init_host_properties}= Get Host Software Property ${image_ids[0]}
161 ${initial_priority}= Set Variable ${init_host_properties["Priority"]}
162
163 Set Host Software Property ${image_ids[0]} ${attribute_name}
164 ... ${attribute_value}
165
166 ${cur_host_properties}= Get Host Software Property ${image_ids[0]}
167 Should Be Equal As Integers ${cur_host_properties["Priority"]}
168 ... ${attribute_value}
169
170 # Revert to to initial value.
171 Set Host Software Property
172 ... ${image_ids[0]} ${attribute_name} ${initial_priority}
173
174
175Code Update Setup
176 [Documentation] Do code update test case setup.
George Keishing1eb85f52017-08-30 22:55:13 -0500177 # - Clean up all existing BMC dumps.
178 # - Clean up all currently install PNOR images.
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -0500179
Charles Paul Hofer51b54c02017-09-13 22:13:49 -0500180 Initiate Host PowerOff
George Keishing1eb85f52017-08-30 22:55:13 -0500181 Delete All Dumps
George Keishing00715492017-08-18 11:46:37 -0500182 Delete Error Logs
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -0500183 Run Keyword If 'true' == '${DELETE_OLD_PNOR_IMAGES}'
184 ... Delete All PNOR Images
Charles Paul Hofer51b54c02017-09-13 22:13:49 -0500185 Run Keyword If 'true' == '${DELETE_OLD_GUARD_FILE}' BMC Execute Command
186 ... rm -f /var/lib/phosphor-software-manager/pnor/prsv/GUARD
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -0500187
188
Charles Paul Hoferc1fa2bc2017-08-18 16:44:03 -0500189Upload And Activate Multiple BMC Images Setup
190 [Documentation] Check that the ALTERNATE_FILE_PATH variable is set.
191
192 Should Not Be Empty ${ALTERNATE_IMAGE_FILE_PATH}
193
194
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -0500195Get PNOR Extended Version
196 [Documentation] Return the PNOR extended version.
197 [Arguments] ${manifest_path}
198
199 # Description of argument(s):
200 # manifest_path Path of the MANIFEST file
201 # (e.g. "/tmp/images/abc123/MANIFEST").
202
203 ${version}= BMC Execute Command
204 ... grep extended_version= ${manifest_path}
205 [return] ${version.split(",")}
George Keishing00715492017-08-18 11:46:37 -0500206
207
208Code Update Test Teardown
209 [Documentation] Do code update test case teardown.
210 # 1. Collect FFDC if test case failed.
211 # 2. Collect FFDC if test PASS but error log exists.
212
213 FFDC On Test Case Fail
214 Run Keyword If '${TEST_STATUS}' == 'PASS' Check Error And Collect FFDC