Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 1 | *** Settings *** |
Sridevi Ramesh | 206173d | 2016-08-16 05:41:40 -0500 | [diff] [blame] | 2 | Documentation This suite is for Verifying BMC & BIOS version exposed part |
| 3 | ... of system inventory |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 4 | |
George Keishing | b9bb75d | 2019-07-18 23:45:06 -0500 | [diff] [blame] | 5 | Resource ../../lib/rest_client.robot |
| 6 | Resource ../../lib/openbmc_ffdc.robot |
| 7 | Resource ../../lib/connection_client.robot |
| 8 | Resource ../../lib/code_update_utils.robot |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 9 | |
Charles Paul Hofer | 3d267d8 | 2017-10-06 15:36:44 -0500 | [diff] [blame] | 10 | Test Teardown FFDC On Test Case Fail |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 11 | |
George Keishing | fe4ebd2 | 2017-09-12 06:05:22 -0500 | [diff] [blame] | 12 | *** 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 Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 17 | *** Test Cases *** |
George Keishing | ab5157b | 2017-02-09 12:24:25 -0600 | [diff] [blame] | 18 | |
Charles Paul Hofer | 3d267d8 | 2017-10-06 15:36:44 -0500 | [diff] [blame] | 19 | Verify Software Purposes |
| 20 | [Documentation] Verify that all software objects have a valid 'Purpose' |
| 21 | ... field. |
| 22 | [Tags] Verify_Software_Purpose |
| 23 | |
Steven Sombar | aaaab22 | 2018-12-19 13:16:23 -0600 | [diff] [blame] | 24 | ${object_uris}= Read Properties ${SOFTWARE_VERSION_URI}list |
Charles Paul Hofer | 3d267d8 | 2017-10-06 15:36:44 -0500 | [diff] [blame] | 25 | |
Sushma M M | d27fc31 | 2020-06-19 08:26:50 -0500 | [diff] [blame] | 26 | FOR ${uri} IN @{object_uris} |
| 27 | ${object}= Read Properties ${uri} |
| 28 | Continue For Loop If not 'Purpose' in ${object} |
Sushil Singh | a125de8 | 2020-06-30 13:36:52 -0500 | [diff] [blame] | 29 | Should Contain Any ${object}[Purpose] ${VERSION_PURPOSE_HOST} ${VERSION_PURPOSE_BMC} |
Sushma M M | d27fc31 | 2020-06-19 08:26:50 -0500 | [diff] [blame] | 30 | END |
Charles Paul Hofer | 3d267d8 | 2017-10-06 15:36:44 -0500 | [diff] [blame] | 31 | |
| 32 | |
| 33 | BMC 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 Keishing | 0a1044c | 2017-08-09 09:50:51 -0500 | [diff] [blame] | 42 | BMC Software Version |
| 43 | [Documentation] Verify BMC version and activation status. |
| 44 | [Tags] BMC_Software_Version |
| 45 | [Template] Verify Software Version |
| 46 | |
George Keishing | fe4ebd2 | 2017-09-12 06:05:22 -0500 | [diff] [blame] | 47 | # Software Purpose |
George Keishing | 0a1044c | 2017-08-09 09:50:51 -0500 | [diff] [blame] | 48 | ${VERSION_PURPOSE_BMC} |
| 49 | |
George Keishing | fe4ebd2 | 2017-09-12 06:05:22 -0500 | [diff] [blame] | 50 | |
Charles Paul Hofer | 3d267d8 | 2017-10-06 15:36:44 -0500 | [diff] [blame] | 51 | BMC 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 | |
| 60 | BMC 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 Keishing | fe4ebd2 | 2017-09-12 06:05:22 -0500 | [diff] [blame] | 70 | BMC 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 Hofer | 3d267d8 | 2017-10-06 15:36:44 -0500 | [diff] [blame] | 79 | Host 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 Keishing | 0a1044c | 2017-08-09 09:50:51 -0500 | [diff] [blame] | 88 | Host Software Version |
| 89 | [Documentation] Verify host version and activation status. |
| 90 | [Tags] Host_Software_Version |
| 91 | [Template] Verify Software Version |
| 92 | |
George Keishing | fe4ebd2 | 2017-09-12 06:05:22 -0500 | [diff] [blame] | 93 | # Software Purpose |
George Keishing | 0a1044c | 2017-08-09 09:50:51 -0500 | [diff] [blame] | 94 | ${VERSION_PURPOSE_HOST} |
George Keishing | ab5157b | 2017-02-09 12:24:25 -0600 | [diff] [blame] | 95 | |
| 96 | |
Charles Paul Hofer | 3d267d8 | 2017-10-06 15:36:44 -0500 | [diff] [blame] | 97 | Host 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 | |
| 106 | Host 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 Keishing | fe4ebd2 | 2017-09-12 06:05:22 -0500 | [diff] [blame] | 116 | Host 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 Keishing | ab5157b | 2017-02-09 12:24:25 -0600 | [diff] [blame] | 125 | *** Keywords *** |
| 126 | |
Charles Paul Hofer | 3d267d8 | 2017-10-06 15:36:44 -0500 | [diff] [blame] | 127 | Verify 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 | |
Sushil Singh | a125de8 | 2020-06-30 13:36:52 -0500 | [diff] [blame] | 133 | FOR ${id} IN @{software_ids} |
| 134 | Length Should Be ${id} ${8} |
| 135 | Should Match Regexp ${id} [0-9a-f]* |
| 136 | END |
Charles Paul Hofer | 3d267d8 | 2017-10-06 15:36:44 -0500 | [diff] [blame] | 137 | |
| 138 | |
| 139 | Verify Software Path |
| 140 | [Documentation] Verify software has valid 'Path' properties. |
| 141 | [Arguments] ${software_purpose} |
| 142 | |
| 143 | ${software_uris}= Get Software Objects ${software_purpose} |
| 144 | |
Sushil Singh | a125de8 | 2020-06-30 13:36:52 -0500 | [diff] [blame] | 145 | FOR ${uri} IN @{software_uris} |
| 146 | ${software_object}= Get Host Software Property ${uri} |
| 147 | Return From Keyword If len('${software_object}[Path]') == ${0} |
| 148 | BMC Execute Command [ -d "${path}" ] |
| 149 | END |
Charles Paul Hofer | 3d267d8 | 2017-10-06 15:36:44 -0500 | [diff] [blame] | 150 | |
| 151 | |
| 152 | Verify Software RequestedActivation |
| 153 | [Documentation] Verify that software has valid 'Purpose' properties. |
| 154 | [Arguments] ${software_purpose} |
| 155 | |
| 156 | ${software_uris}= Get Software Objects ${software_purpose} |
| 157 | |
Sushil Singh | a125de8 | 2020-06-30 13:36:52 -0500 | [diff] [blame] | 158 | FOR ${uri} IN @{software_uris} |
| 159 | ${software_object}= Get Host Software Property ${uri} |
| 160 | Should Contain Any ${software_object}[RequestedActivation] ${REQUESTED_ACTIVE} ${REQUESTED_NONE} |
| 161 | END |
Charles Paul Hofer | 3d267d8 | 2017-10-06 15:36:44 -0500 | [diff] [blame] | 162 | |
| 163 | |
George Keishing | fe4ebd2 | 2017-09-12 06:05:22 -0500 | [diff] [blame] | 164 | Verify Software Activation Association |
| 165 | [Documentation] Verify software activation association. |
| 166 | [Arguments] ${software_purpose} ${assoiation_path} |
| 167 | |
| 168 | # Description of argument(s): |
| 169 | # software_purpose BMC or host software purpose. |
| 170 | # assoiation_path BMC or host inventory path. |
| 171 | |
| 172 | # Example: |
| 173 | # "/xyz/openbmc_project/software/a0d9ba0d": { |
| 174 | # "Activation": "xyz.openbmc_project.Software.Activation.Activations.Active", |
| 175 | # "Path": "", |
| 176 | # "Priority": 0, |
| 177 | # "Purpose": "xyz.openbmc_project.Software.Version.VersionPurpose.BMC", |
| 178 | # "RequestedActivation": "xyz.openbmc_project.Software.Activation.RequestedActivations.None", |
| 179 | # "Version": "v1.99.9-143-g69cab69", |
| 180 | # "associations": [ |
| 181 | # [ |
| 182 | # "inventory", |
| 183 | # "activation", |
| 184 | # "/xyz/openbmc_project/inventory/system/chassis/motherboard/boxelder/bmc" |
| 185 | # ] |
| 186 | # ] |
| 187 | # }, |
| 188 | # "/xyz/openbmc_project/software/a0d9ba0d/inventory": { |
| 189 | # "endpoints": [ |
| 190 | # "/xyz/openbmc_project/inventory/system/chassis/motherboard/boxelder/bmc" |
| 191 | # ] |
| 192 | # }, |
| 193 | |
| 194 | ${obj_path_list}= Get Software Objects ${software_purpose} |
| 195 | |
Sushil Singh | a125de8 | 2020-06-30 13:36:52 -0500 | [diff] [blame] | 196 | FOR ${index} IN @{obj_path_list} |
| 197 | Verify Inventory Association ${index} ${assoiation_path} |
| 198 | END |
George Keishing | fe4ebd2 | 2017-09-12 06:05:22 -0500 | [diff] [blame] | 199 | |
| 200 | |
| 201 | Verify Inventory Association |
| 202 | [Documentation] Verify software inventory association. |
| 203 | [Arguments] ${software_path} ${assoiation_path} |
| 204 | |
| 205 | # Description of argument(s): |
| 206 | # software_path BMC or host software id. |
| 207 | # assoiation_path BMC or host inventory path. |
| 208 | |
| 209 | # Example: |
| 210 | # "/xyz/openbmc_project/inventory/system/chassis/motherboard/boxelder/bmc/activation": { |
| 211 | # "endpoints": [ |
| 212 | # "/xyz/openbmc_project/software/e42627b5", |
| 213 | # "/xyz/openbmc_project/software/a0d9ba0d" |
| 214 | # ] |
| 215 | # }, |
| 216 | |
George Keishing | 90d70e2 | 2020-03-04 10:44:08 +0000 | [diff] [blame] | 217 | ${sw_attr_data}= Read Attribute ${software_path} Associations |
George Keishing | fe4ebd2 | 2017-09-12 06:05:22 -0500 | [diff] [blame] | 218 | List Should Contain Value @{sw_attr_data} ${assoiation_path} |
| 219 | |
| 220 | # Verify the inventory path in software manager entry. |
| 221 | ${sw_endpoint_data}= Read Attribute |
| 222 | ... ${software_path}${/}inventory endpoints |
| 223 | List Should Contain Value ${sw_endpoint_data} ${assoiation_path} |
| 224 | |
| 225 | # Verify the inventory path. |
| 226 | ${inv_endpoint_data}= Read Attribute |
| 227 | ... ${assoiation_path}${/}activation endpoints |
| 228 | List Should Contain Value ${inv_endpoint_data} ${software_path} |
| 229 | |
| 230 | |
George Keishing | 0a1044c | 2017-08-09 09:50:51 -0500 | [diff] [blame] | 231 | Verify Software Version |
| 232 | [Documentation] Verify version and activation status. |
| 233 | [Arguments] ${software_purpose} |
George Keishing | ab5157b | 2017-02-09 12:24:25 -0600 | [diff] [blame] | 234 | |
George Keishing | 0a1044c | 2017-08-09 09:50:51 -0500 | [diff] [blame] | 235 | # Description of argument(s): |
| 236 | # software_purpose BMC or host software purpose. |
| 237 | |
| 238 | # Example: |
| 239 | # /xyz/openbmc_project/software/list |
| 240 | # [ |
| 241 | # "/xyz/openbmc_project/software/2f974579", |
| 242 | # "/xyz/openbmc_project/software/136cf504" |
| 243 | # ] |
Sushil Singh | a125de8 | 2020-06-30 13:36:52 -0500 | [diff] [blame] | 244 | |
George Keishing | 0a1044c | 2017-08-09 09:50:51 -0500 | [diff] [blame] | 245 | ${obj_list}= Get Software Objects ${software_purpose} |
Sushil Singh | a125de8 | 2020-06-30 13:36:52 -0500 | [diff] [blame] | 246 | |
| 247 | FOR ${index} IN @{obj_list} |
| 248 | ${resp}= Get Host Software Property ${index} |
| 249 | Verify Software Properties ${resp} ${software_purpose} |
| 250 | Run Keyword If '${software_purpose}' == '${VERSION_PURPOSE_BMC}' |
| 251 | ... Check BMC Version ${index} ${resp["Version"]} |
| 252 | END |
George Keishing | ab5157b | 2017-02-09 12:24:25 -0600 | [diff] [blame] | 253 | |
| 254 | |
| 255 | Verify Software Properties |
George Keishing | 0a1044c | 2017-08-09 09:50:51 -0500 | [diff] [blame] | 256 | [Documentation] Verify the software object properties. |
| 257 | [Arguments] ${software_property} ${software_purpose} |
George Keishing | ab5157b | 2017-02-09 12:24:25 -0600 | [diff] [blame] | 258 | |
George Keishing | 0a1044c | 2017-08-09 09:50:51 -0500 | [diff] [blame] | 259 | # Description of argument(s): |
| 260 | # software_property JSON response data. |
| 261 | # software_purpose BMC or host software purpose |
| 262 | # (e.g. "xyz.openbmc_project.Software.Version.VersionPurpose.BMC" |
| 263 | # "xyz.openbmc_project.Software.Version.VersionPurpose.Host"). |
| 264 | |
| 265 | Check Activation Status ${software_property["Activation"]} |
George Keishing | ab5157b | 2017-02-09 12:24:25 -0600 | [diff] [blame] | 266 | |
| 267 | |
| 268 | Check BMC Version |
| 269 | [Documentation] Get BMC version from /etc/os-release and compare. |
George Keishing | 81ae45b | 2017-09-28 14:05:04 -0500 | [diff] [blame] | 270 | [Arguments] ${software_object} ${version} |
George Keishing | 0a1044c | 2017-08-09 09:50:51 -0500 | [diff] [blame] | 271 | |
| 272 | # Description of argument(s): |
George Keishing | 81ae45b | 2017-09-28 14:05:04 -0500 | [diff] [blame] | 273 | # software_object Software object path. |
Sushil Singh | 51362ba | 2020-06-19 07:41:50 -0500 | [diff] [blame] | 274 | # version Software version (e.g. "2.9.0-dev-257-gc97c74782") |
George Keishing | 81ae45b | 2017-09-28 14:05:04 -0500 | [diff] [blame] | 275 | |
| 276 | ${min_value}= Get Least Value Priority Image ${VERSION_PURPOSE_BMC} |
| 277 | ${priority_value}= Read Software Attribute ${software_object} Priority |
| 278 | |
| 279 | Return From Keyword If ${priority_value} != ${min_value} |
George Keishing | 0a1044c | 2017-08-09 09:50:51 -0500 | [diff] [blame] | 280 | |
George Keishing | ab5157b | 2017-02-09 12:24:25 -0600 | [diff] [blame] | 281 | Open Connection And Log In |
| 282 | ${cmd}= Set Variable grep ^VERSION_ID= /etc/os-release | cut -f 2 -d '=' |
Joy Onyerikwu | b992261 | 2018-05-14 12:36:57 -0500 | [diff] [blame] | 283 | ${output} ${stderr} ${rc}= BMC Execute Command ${cmd} |
George Keishing | b0743c5 | 2020-06-05 09:25:05 -0500 | [diff] [blame] | 284 | Should Be Equal As Strings ${version} ${output} |
George Keishing | ab5157b | 2017-02-09 12:24:25 -0600 | [diff] [blame] | 285 | |
| 286 | |
| 287 | Check Activation Status |
| 288 | [Documentation] Check if software state is "Active". |
| 289 | [Arguments] ${status} |
George Keishing | 0a1044c | 2017-08-09 09:50:51 -0500 | [diff] [blame] | 290 | |
| 291 | # Description of argument(s): |
George Keishing | ab5157b | 2017-02-09 12:24:25 -0600 | [diff] [blame] | 292 | # status Activation status |
| 293 | # (e.g. "xyz.openbmc_project.Software.Activation.Activations.Active") |
| 294 | Should Be Equal As Strings ${ACTIVE} ${status} |