blob: 3ba78a54e4ce0a68b9b8cc1fa7f6292daeaaa7fd [file] [log] [blame]
Chris Austenb29d2e82016-06-07 12:25:35 -05001*** Settings ***
Sridevi Ramesh206173d2016-08-16 05:41:40 -05002Documentation This suite is for Verifying BMC & BIOS version exposed part
3... of system inventory
Chris Austenb29d2e82016-06-07 12:25:35 -05004
George Keishingb9bb75d2019-07-18 23:45:06 -05005Resource ../../lib/rest_client.robot
6Resource ../../lib/openbmc_ffdc.robot
7Resource ../../lib/connection_client.robot
8Resource ../../lib/code_update_utils.robot
Chris Austenb29d2e82016-06-07 12:25:35 -05009
Charles Paul Hofer3d267d82017-10-06 15:36:44 -050010Test Teardown FFDC On Test Case Fail
Chris Austenb29d2e82016-06-07 12:25:35 -050011
George Keishingfe4ebd22017-09-12 06:05:22 -050012*** Variables ***
13
14${BMC_SW_PATH} ${HOST_INVENTORY_URI}system/chassis/motherboard/boxelder/bmc
15${HOST_SW_PATH} ${HOST_INVENTORY_URI}system/chassis
16
Chris Austenb29d2e82016-06-07 12:25:35 -050017*** Test Cases ***
George Keishingab5157b2017-02-09 12:24:25 -060018
Charles Paul Hofer3d267d82017-10-06 15:36:44 -050019Verify Software Purposes
20 [Documentation] Verify that all software objects have a valid 'Purpose'
21 ... field.
22 [Tags] Verify_Software_Purpose
23
Steven Sombaraaaab222018-12-19 13:16:23 -060024 ${object_uris}= Read Properties ${SOFTWARE_VERSION_URI}list
Charles Paul Hofer3d267d82017-10-06 15:36:44 -050025
26 :FOR ${uri} IN @{object_uris}
27 \ ${object}= Read Properties ${uri}
28 \ Continue For Loop If not 'Purpose' in ${object}
29 \ Should Contain Any &{object}[Purpose] ${VERSION_PURPOSE_HOST}
30 ... ${VERSION_PURPOSE_BMC}
31
32
33BMC Software Hex ID
34 [Documentation] Verify BMC images have valid 8-digit hex IDs.
35 [Tags] BMC_Software_Hex_ID
36 [Template] Verify Software Hex IDs
37
38 # Software Purpose
39 ${VERSION_PURPOSE_BMC}
40
41
George Keishing0a1044c2017-08-09 09:50:51 -050042BMC Software Version
43 [Documentation] Verify BMC version and activation status.
44 [Tags] BMC_Software_Version
45 [Template] Verify Software Version
46
George Keishingfe4ebd22017-09-12 06:05:22 -050047 # Software Purpose
George Keishing0a1044c2017-08-09 09:50:51 -050048 ${VERSION_PURPOSE_BMC}
49
George Keishingfe4ebd22017-09-12 06:05:22 -050050
Charles Paul Hofer3d267d82017-10-06 15:36:44 -050051BMC Software Path
52 [Documentation] Verify BMC images have valid 'Path' properties.
53 [Tags] BMC_Software_Path
54 [Template] Verify Software Path
55
56 # Software Version
57 ${VERSION_PURPOSE_BMC}
58
59
60BMC Software RequestedActivation
61 [Documentation] Veriify BMC images have valid 'RequestedActivation'
62 ... properties.
63 [Tags] BMC_Software_RequestedActivation
64 [Template] Verify Software RequestedActivation
65
66 # Software Purpose
67 ${VERSION_PURPOSE_BMC}
68
69
George Keishingfe4ebd22017-09-12 06:05:22 -050070BMC Software Activation Association
71 [Documentation] Verify BMC association.
72 [Tags] BMC_Software_Activation_Association
73 [Template] Verify Software Activation Association
74
75 # Software Purpose Association path
76 ${VERSION_PURPOSE_BMC} ${BMC_SW_PATH}
77
78
Charles Paul Hofer3d267d82017-10-06 15:36:44 -050079Host Software Hex ID
80 [Documentation] Verify host images have valid 8-digit hex IDs.
81 [Tags] Host_Software_Hex_ID
82 [Template] Verify Software Hex IDs
83
84 # Software Purpose
85 ${VERSION_PURPOSE_HOST}
86
87
George Keishing0a1044c2017-08-09 09:50:51 -050088Host Software Version
89 [Documentation] Verify host version and activation status.
90 [Tags] Host_Software_Version
91 [Template] Verify Software Version
92
George Keishingfe4ebd22017-09-12 06:05:22 -050093 # Software Purpose
George Keishing0a1044c2017-08-09 09:50:51 -050094 ${VERSION_PURPOSE_HOST}
George Keishingab5157b2017-02-09 12:24:25 -060095
96
Charles Paul Hofer3d267d82017-10-06 15:36:44 -050097Host Software Path
98 [Documentation] Verify host images have valid 'Path' properties.
99 [Tags] Host_Software_Path
100 [Template] Verify Software Path
101
102 # Software Version
103 ${VERSION_PURPOSE_HOST}
104
105
106Host Software RequestedActivation
107 [Documentation] Veriify host images have valid 'RequestedActivation'
108 ... properties.
109 [Tags] BMC_Software_RequestedActivation
110 [Template] Verify Software RequestedActivation
111
112 # Software Purpose
113 ${VERSION_PURPOSE_HOST}
114
115
George Keishingfe4ebd22017-09-12 06:05:22 -0500116Host Software Activation Association
117 [Documentation] Verify Host association.
118 [Tags] Host_Software_Activation_Association
119 [Template] Verify Software Activation Association
120
121 # Software Purpose Association path
122 ${VERSION_PURPOSE_HOST} ${HOST_SW_PATH}
123
124
George Keishingab5157b2017-02-09 12:24:25 -0600125*** Keywords ***
126
Charles Paul Hofer3d267d82017-10-06 15:36:44 -0500127Verify Software Hex IDs
128 [Documentation] Verify software has valid hex IDs.
129 [Arguments] ${software_purpose}
130
131 ${software_ids}= Get Software Objects Id ${software_purpose}
132
133 : FOR ${id} IN @{software_ids}
134 \ Length Should Be ${id} ${8}
135 \ Should Match Regexp ${id} [0-9a-f]*
136
137
138Verify Software Path
139 [Documentation] Verify software has valid 'Path' properties.
140 [Arguments] ${software_purpose}
141
142 ${software_uris}= Get Software Objects ${software_purpose}
143
144 : FOR ${uri} IN @{software_uris}
145 \ ${software_object}= Get Host Software Property ${uri}
146 \ Return From Keyword If len('&{software_object}[Path]') == ${0}
147 \ BMC Execute Command [ -d "${path}" ]
148
149
150Verify Software RequestedActivation
151 [Documentation] Verify that software has valid 'Purpose' properties.
152 [Arguments] ${software_purpose}
153
154 ${software_uris}= Get Software Objects ${software_purpose}
155
156 : FOR ${uri} IN @{software_uris}
157 \ ${software_object}= Get Host Software Property ${uri}
158 \ Should Contain Any &{software_object}[RequestedActivation]
159 ... ${REQUESTED_ACTIVE} ${REQUESTED_NONE}
160
161
George Keishingfe4ebd22017-09-12 06:05:22 -0500162Verify Software Activation Association
163 [Documentation] Verify software activation association.
164 [Arguments] ${software_purpose} ${assoiation_path}
165
166 # Description of argument(s):
167 # software_purpose BMC or host software purpose.
168 # assoiation_path BMC or host inventory path.
169
170 # Example:
171 # "/xyz/openbmc_project/software/a0d9ba0d": {
172 # "Activation": "xyz.openbmc_project.Software.Activation.Activations.Active",
173 # "Path": "",
174 # "Priority": 0,
175 # "Purpose": "xyz.openbmc_project.Software.Version.VersionPurpose.BMC",
176 # "RequestedActivation": "xyz.openbmc_project.Software.Activation.RequestedActivations.None",
177 # "Version": "v1.99.9-143-g69cab69",
178 # "associations": [
179 # [
180 # "inventory",
181 # "activation",
182 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/boxelder/bmc"
183 # ]
184 # ]
185 # },
186 # "/xyz/openbmc_project/software/a0d9ba0d/inventory": {
187 # "endpoints": [
188 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/boxelder/bmc"
189 # ]
190 # },
191
192 ${obj_path_list}= Get Software Objects ${software_purpose}
193
194 : FOR ${index} IN @{obj_path_list}
195 \ Verify Inventory Association ${index} ${assoiation_path}
196
197
198Verify Inventory Association
199 [Documentation] Verify software inventory association.
200 [Arguments] ${software_path} ${assoiation_path}
201
202 # Description of argument(s):
203 # software_path BMC or host software id.
204 # assoiation_path BMC or host inventory path.
205
206 # Example:
207 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/boxelder/bmc/activation": {
208 # "endpoints": [
209 # "/xyz/openbmc_project/software/e42627b5",
210 # "/xyz/openbmc_project/software/a0d9ba0d"
211 # ]
212 # },
213
George Keishing90d70e22020-03-04 10:44:08 +0000214 ${sw_attr_data}= Read Attribute ${software_path} Associations
George Keishingfe4ebd22017-09-12 06:05:22 -0500215 List Should Contain Value @{sw_attr_data} ${assoiation_path}
216
217 # Verify the inventory path in software manager entry.
218 ${sw_endpoint_data}= Read Attribute
219 ... ${software_path}${/}inventory endpoints
220 List Should Contain Value ${sw_endpoint_data} ${assoiation_path}
221
222 # Verify the inventory path.
223 ${inv_endpoint_data}= Read Attribute
224 ... ${assoiation_path}${/}activation endpoints
225 List Should Contain Value ${inv_endpoint_data} ${software_path}
226
227
George Keishing0a1044c2017-08-09 09:50:51 -0500228Verify Software Version
229 [Documentation] Verify version and activation status.
230 [Arguments] ${software_purpose}
George Keishingab5157b2017-02-09 12:24:25 -0600231
George Keishing0a1044c2017-08-09 09:50:51 -0500232 # Description of argument(s):
233 # software_purpose BMC or host software purpose.
234
235 # Example:
236 # /xyz/openbmc_project/software/list
237 # [
238 # "/xyz/openbmc_project/software/2f974579",
239 # "/xyz/openbmc_project/software/136cf504"
240 # ]
241 ${obj_list}= Get Software Objects ${software_purpose}
242 : FOR ${index} IN @{obj_list}
243 \ ${resp}= Get Host Software Property ${index}
244 \ Verify Software Properties ${resp} ${software_purpose}
George Keishing81ae45b2017-09-28 14:05:04 -0500245 \ Run Keyword If '${software_purpose}' == '${VERSION_PURPOSE_BMC}'
246 ... Check BMC Version ${index} ${resp["Version"]}
George Keishingab5157b2017-02-09 12:24:25 -0600247
248
249Verify Software Properties
George Keishing0a1044c2017-08-09 09:50:51 -0500250 [Documentation] Verify the software object properties.
251 [Arguments] ${software_property} ${software_purpose}
George Keishingab5157b2017-02-09 12:24:25 -0600252
George Keishing0a1044c2017-08-09 09:50:51 -0500253 # Description of argument(s):
254 # software_property JSON response data.
255 # software_purpose BMC or host software purpose
256 # (e.g. "xyz.openbmc_project.Software.Version.VersionPurpose.BMC"
257 # "xyz.openbmc_project.Software.Version.VersionPurpose.Host").
258
259 Check Activation Status ${software_property["Activation"]}
George Keishingab5157b2017-02-09 12:24:25 -0600260
261
262Check BMC Version
263 [Documentation] Get BMC version from /etc/os-release and compare.
George Keishing81ae45b2017-09-28 14:05:04 -0500264 [Arguments] ${software_object} ${version}
George Keishing0a1044c2017-08-09 09:50:51 -0500265
266 # Description of argument(s):
George Keishing81ae45b2017-09-28 14:05:04 -0500267 # software_object Software object path.
268 # version Software version (e.g. "v1.99.2-107-g2be34d2-dirty")
269
270 ${min_value}= Get Least Value Priority Image ${VERSION_PURPOSE_BMC}
271 ${priority_value}= Read Software Attribute ${software_object} Priority
272
273 Return From Keyword If ${priority_value} != ${min_value}
George Keishing0a1044c2017-08-09 09:50:51 -0500274
George Keishingab5157b2017-02-09 12:24:25 -0600275 Open Connection And Log In
276 ${cmd}= Set Variable grep ^VERSION_ID= /etc/os-release | cut -f 2 -d '='
Joy Onyerikwub9922612018-05-14 12:36:57 -0500277 ${output} ${stderr} ${rc}= BMC Execute Command ${cmd}
George Keishingab5157b2017-02-09 12:24:25 -0600278 Should Be Equal As Strings ${version} ${output[1:-1]}
279
280
281Check Activation Status
282 [Documentation] Check if software state is "Active".
283 [Arguments] ${status}
George Keishing0a1044c2017-08-09 09:50:51 -0500284
285 # Description of argument(s):
George Keishingab5157b2017-02-09 12:24:25 -0600286 # status Activation status
287 # (e.g. "xyz.openbmc_project.Software.Activation.Activations.Active")
288 Should Be Equal As Strings ${ACTIVE} ${status}