blob: 12fe770ff82f9dacb7ba7d00ad3e7b6b9e73c5a5 [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">
6... -v IMAGE_FILE_PATH:<path/*.tar> host_code_update.robot
7...
8... Code update method BMC
9... Update work flow sequence:
10... - Upload image via REST
11... - Verify that the file exists on the BMC
12... - Check that software "Activation" is set to "Ready"
13... - Set "Requested Activation" to "Active"
14... - Wait for code update to complete
15... - Verify the new version
16
17Library ../../lib/bmc_ssh_utils.py
18Library ../../lib/code_update_utils.py
19Variables ../../data/variables.py
20Resource ../../lib/boot_utils.robot
21Resource code_update_utils.robot
22Resource ../../lib/code_update_utils.robot
23Resource ../lib/openbmc_ffdc.robot
24Resource ../../lib/state_manager.robot
25
26Test Teardown FFDC On Test Case Fail
27
28*** Variables ***
29
30${QUIET} ${1}
31${IMAGE_FILE_PATH} ${EMPTY}
32${DELETE_OLD_PNOR_IMAGES} false
Charles Paul Hoferc1fa2bc2017-08-18 16:44:03 -050033${ALTERNATE_IMAGE_FILE_PATH} ${EMPTY}
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -050034
35*** Test Cases ***
36
37REST Host Code Update
38 [Documentation] Do a PNOR code update by uploading image on BMC via REST.
39 [Tags] REST_Host_Code_Update
40 [Setup] Code Update Setup
41
42 Upload And Activate Image ${IMAGE_FILE_PATH}
43 OBMC Reboot (off)
44
45
46Post Update Boot To OS
47 [Documentation] Boot the host OS
48 [Tags] Post_Update_Boot_To_OS
49 [Teardown] Stop SOL Console Logging
50
51 Run Keyword If '${PREV_TEST_STATUS}' == 'FAIL'
52 ... Fail Code update failed. No need to boot to OS.
53 Start SOL Console Logging
54 REST Power On
55
56
57Host Image Priority Attribute Test
58 [Documentation] Set "Priority" attribute.
59 [Tags] Host_Image_Priority_Attribute_Test
60 [Template] Temporarily Set PNOR Attribute
61
62 # Property Value
63 Priority ${0}
64 Priority ${1}
65 Priority ${127}
66
67
68Set RequestedActivation To None
69 [Documentation] Set the RequestedActivation of the image to None and
70 ... verify that it is in fact set to None.
71 [Tags] Set_RequestedActivation_To_None
72
73 ${software_objects}= Get Software Objects
74 Set Host Software Property @{software_objects}[0] RequestedActivation
75 ... ${REQUESTED_NONE}
76 ${software_properties}= Get Host Software Property @{software_objects}[0]
77 Should Be Equal As Strings &{software_properties}[RequestedActivation]
78 ... ${REQUESTED_NONE}
79
80
81Set RequestedActivation And Activation To Invalid Value
82 [Documentation] Set the RequestedActivation and Activation propreties of
83 ... the image to an invalid value and verify that it was not
84 ... changed.
85 [Template] Set Property To Invalid Value And Verify No Change
86 [Tags] Set_RequestedActivation_And_Activation_To_Invalid_Value
87
88 # Property Version Type
89 RequestedActivation ${VERSION_PURPOSE_HOST}
90 Activation ${VERSION_PURPOSE_HOST}
91
92
Charles Paul Hoferc1fa2bc2017-08-18 16:44:03 -050093Upload And Activate Multiple Host Images
94 [Documentation] Upload another PNOR image and verify that its state is
95 ... different from all others.
96 [Tags] Upload_And_Activate_Multiple_Host_Images
97 [Template] Activate Image And Verify No Duplicate Priorities
98 [Setup] Upload And Activate Multiple BMC Images Setup
99
100 # Image File Path Image Purpose
101 ${ALTERNATE_IMAGE_FILE_PATH} ${VERSION_PURPOSE_HOST}
102
103
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -0500104Delete Host Image
105 [Documentation] Delete a PNOR image from the BMC and PNOR flash chip.
106 [Tags] Delete_Host_Image
107 [Setup] Initiate Host PowerOff
108
109 ${software_objects}= Get Software Objects
110 ... version_type=${VERSION_PURPOSE_HOST}
111 ${num_images}= Get Length ${software_objects}
112 Should Be True 0 < ${num_images}
113 ... msg=There are no PNOR images on the BMC to delete.
114 Delete Image And Verify @{software_objects}[0] ${VERSION_PURPOSE_HOST}
115
116
117*** Keywords ***
118
119Temporarily Set PNOR Attribute
120 [Documentation] Update the PNOR attribute value.
121 [Arguments] ${attribute_name} ${attribute_value}
122
123 # Description of argument(s):
124 # attribute_name Host software attribute name (e.g. "Priority").
125 # attribute_value Value to be written.
126
127 ${image_ids}= Get Software Objects
128 ${init_host_properties}= Get Host Software Property ${image_ids[0]}
129 ${initial_priority}= Set Variable ${init_host_properties["Priority"]}
130
131 Set Host Software Property ${image_ids[0]} ${attribute_name}
132 ... ${attribute_value}
133
134 ${cur_host_properties}= Get Host Software Property ${image_ids[0]}
135 Should Be Equal As Integers ${cur_host_properties["Priority"]}
136 ... ${attribute_value}
137
138 # Revert to to initial value.
139 Set Host Software Property
140 ... ${image_ids[0]} ${attribute_name} ${initial_priority}
141
142
143Code Update Setup
144 [Documentation] Do code update test case setup.
145
146 Run Keyword If 'true' == '${DELETE_OLD_PNOR_IMAGES}'
147 ... Delete All PNOR Images
148
149
Charles Paul Hoferc1fa2bc2017-08-18 16:44:03 -0500150Upload And Activate Multiple BMC Images Setup
151 [Documentation] Check that the ALTERNATE_FILE_PATH variable is set.
152
153 Should Not Be Empty ${ALTERNATE_IMAGE_FILE_PATH}
154
155
Charles Paul Hofer9f74d3a2017-08-18 09:54:28 -0500156Get PNOR Extended Version
157 [Documentation] Return the PNOR extended version.
158 [Arguments] ${manifest_path}
159
160 # Description of argument(s):
161 # manifest_path Path of the MANIFEST file
162 # (e.g. "/tmp/images/abc123/MANIFEST").
163
164 ${version}= BMC Execute Command
165 ... grep extended_version= ${manifest_path}
166 [return] ${version.split(",")}