blob: 6b6f0582336e6ef9db7d3bc2b55af33ff15a0577 [file] [log] [blame]
Saqib Khanbb8b63f2017-05-24 10:58:01 -05001*** Settings ***
2Documentation Code update to a target BMC.
3... Execution Method:
4... python -m robot -v OPENBMC_HOST:<hostname>
Charles Paul Hofer2c731642017-08-03 18:13:27 -05005... -v DELETE_OLD_PNOR_IMAGES:<"true" or "false">
Saqib Khanbb8b63f2017-05-24 10:58:01 -05006... -v IMAGE_FILE_PATH:<path/*.tar> 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 software "Activation" status to be "Ready"
13... - Set "Requested Activation" to "Active"
14... - Wait for code update to complete
15... - Verify the new version
16
Charles Paul Hoferde7d4082017-08-08 14:41:01 -050017Library ../../lib/code_update_utils.py
Saqib Khanbb8b63f2017-05-24 10:58:01 -050018Variables ../../data/variables.py
Saqib Khanbb8b63f2017-05-24 10:58:01 -050019Resource ../lib/openbmc_ffdc.robot
George Keishingd3fb5922017-08-08 07:32:25 -050020Resource ../../lib/code_update_utils.robot
Charles Paul Hofere5100822017-08-01 10:02:23 -050021Resource ../../lib/boot_utils.robot
Charles Paul Hoferd68d0fa2017-08-17 13:51:24 -050022Resource ../../lib/utils.robot
23Resource code_update_utils.robot
Charles Paul Hoferda24d0a2017-08-09 15:03:40 -050024Resource ../../lib/state_manager.robot
Saqib Khanbb8b63f2017-05-24 10:58:01 -050025
Charles Paul Hofercef61992017-08-18 10:14:18 -050026Test Teardown FFDC On Test Case Fail
Saqib Khanbb8b63f2017-05-24 10:58:01 -050027
28*** Variables ***
29
30${QUIET} ${1}
Saqib Khanbb8b63f2017-05-24 10:58:01 -050031${upload_dir_path} /tmp/images/
Saqib Khanbb8b63f2017-05-24 10:58:01 -050032${IMAGE_FILE_PATH} ${EMPTY}
Charles Paul Hofer2c731642017-08-03 18:13:27 -050033${DELETE_OLD_PNOR_IMAGES} false
Saqib Khanbb8b63f2017-05-24 10:58:01 -050034
35*** Test Cases ***
36
Charles Paul Hofer9a5c7222017-08-03 18:21:08 -050037REST Host Code Update
Saqib Khanbb8b63f2017-05-24 10:58:01 -050038 [Documentation] Do a PNOR code update by uploading image on BMC via REST.
Charles Paul Hofer9a5c7222017-08-03 18:21:08 -050039 [Tags] REST_Host_Code_Update
Charles Paul Hofer2c731642017-08-03 18:13:27 -050040 [Setup] Code Update Setup
Saqib Khanbb8b63f2017-05-24 10:58:01 -050041
Charles Paul Hofercef61992017-08-18 10:14:18 -050042 Upload And Activate Image ${IMAGE_FILE_PATH}
Saqib Khanbb8b63f2017-05-24 10:58:01 -050043
Charles Paul Hoferbdbabf12017-08-18 12:30:14 -050044 OBMC Reboot (off)
Charles Paul Hofere5100822017-08-01 10:02:23 -050045
46
47Post Update Boot To OS
48 [Documentation] Boot the host OS
49 [Tags] Post_Update_Boot_To_OS
Charles Paul Hofer99108412017-08-21 09:22:36 -050050 [Teardown] Stop SOL Console Logging
Charles Paul Hofere5100822017-08-01 10:02:23 -050051
52 Run Keyword Unless '${PREV_TEST_STATUS}' == 'PASS'
53 ... Fail Code update failed. No need to boot to OS.
Charles Paul Hofer99108412017-08-21 09:22:36 -050054 Start SOL Console Logging
Charles Paul Hofere5100822017-08-01 10:02:23 -050055 REST Power On
56
George Keishingd3fb5922017-08-08 07:32:25 -050057
58Host Image Priority Attribute Test
59 [Documentation] Set "Priority" attribute.
60 [Tags] Host_Image_Priority_Attribute_Test
61 [Template] Set PNOR Attribute
62
63 # Property Value
64 Priority ${0}
65 Priority ${1}
66 Priority ${127}
67
Charles Paul Hofere5100822017-08-01 10:02:23 -050068
Charles Paul Hofer12a7c1d2017-08-01 13:44:02 -050069Set RequestedActivation To None
70 [Documentation] Set the RequestedActivation of the image to None and
71 ... verify that it is in fact set to None.
72 [Tags] Set_RequestedActivation_To_None
73
74 ${sw_objs}= Get Software Objects
75 Set Host Software Property @{sw_objs}[0] RequestedActivation
76 ... ${REQUESTED_NONE}
77 ${sw_props}= Get Host Software Property @{sw_objs}[0]
78 Should Be Equal As Strings &{sw_props}[RequestedActivation]
79 ... ${REQUESTED_NONE}
80
81
82Set RequestedActivation To Invalid Value
83 [Documentation] Set the RequestedActivation proprety of the image to an
84 ... invalid value and verify that it was not changed.
85 [Template] Set Property To Invalid Value And Verify No Change
86 [Tags] Set_RequestedActivation_To_Invalid_Value
87
88 # Property
89 RequestedActivation
90
91
92Set Activation To Invalid Value
93 [Documentation] Set the Activation proprety of the image to an invalid
94 ... value and verify that it was not changed.
95 [Template] Set Property To Invalid Value And Verify No Change
96 [Tags] Set_Activation_To_Invalid_Value
97
98 # Property
99 Activation
100
101
Charles Paul Hoferda24d0a2017-08-09 15:03:40 -0500102Delete Host Image
103 [Documentation] Delete a PNOR image from the BMC and PNOR flash chip.
104 [Tags] Delete_Host_Image
105 [Setup] Initiate Host PowerOff
106
107 ${software_objects}= Get Software Objects
108 ... version_type=${VERSION_PURPOSE_HOST}
109 ${num_images}= Get Length ${software_objects}
110 Should Be True 0 < ${num_images}
111 ... msg=There are no PNOR images on the BMC to delete.
112 Delete Image And Verify @{software_objects}[0] ${VERSION_PURPOSE_HOST}
113
114
115Delete BMC Image
116 [Documentation] Delete a BMC image from the BMC flash chip.
117 [Tags] Delete_BMC_Image
118
119 ${software_object}= Get Non Running BMC Software Object
120 Delete Image And Verify ${software_object} ${VERSION_PURPOSE_BMC}
121
122
Saqib Khanbb8b63f2017-05-24 10:58:01 -0500123*** Keywords ***
124
George Keishingd3fb5922017-08-08 07:32:25 -0500125Set PNOR Attribute
126 [Documentation] Update the attribute value.
127 [Arguments] ${attribute_name} ${value}
128
129 # Description of argument(s):
130 # attribute_name Host software attribute name (e.g. "Priority").
131 # value Value to be written.
132
133 ${image_ids}= Get Software Objects
134 ${resp}= Get Host Software Property ${image_ids[0]}
135 ${initial_value}= Set Variable ${resp["Priority"]}
136
137 Set Host Software Property ${image_ids[0]} ${attribute_name} ${value}
138
139 ${resp}= Get Host Software Property ${image_ids[0]}
140 Should Be Equal As Integers ${resp["Priority"]} ${value}
141
142 # Revert to to initial value.
143 Set Host Software Property
144 ... ${image_ids[0]} ${attribute_name} ${initial_value}
145
146
Charles Paul Hofer2c731642017-08-03 18:13:27 -0500147Code Update Setup
148 [Documentation] Do code update test case setup.
149
150 Run Keyword If 'true' == '${DELETE_OLD_PNOR_IMAGES}'
151 ... Delete All PNOR Images
152
Charles Paul Hofer12a7c1d2017-08-01 13:44:02 -0500153
Saqib Khanbb8b63f2017-05-24 10:58:01 -0500154Get PNOR Extended Version
155 [Documentation] Return the PNOR extended version.
Charles Paul Hofer12a7c1d2017-08-01 13:44:02 -0500156 [Arguments] ${path}
157
158 # Description of argument(s):
159 # path Path of the MANIFEST file.
Saqib Khanbb8b63f2017-05-24 10:58:01 -0500160
161 Open Connection And Log In
162 ${version}= Execute Command On BMC
163 ... "grep \"extended_version=\" " + ${path}
164 [return] ${version.split(",")}