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 | |
| 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 | |
| 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 | |
| 133 | : FOR ${id} IN @{software_ids} |
| 134 | \ Length Should Be ${id} ${8} |
| 135 | \ Should Match Regexp ${id} [0-9a-f]* |
| 136 | |
| 137 | |
| 138 | Verify 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 | |
| 150 | Verify 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 Keishing | fe4ebd2 | 2017-09-12 06:05:22 -0500 | [diff] [blame] | 162 | Verify 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 | |
| 198 | Verify 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 Keishing | 90d70e2 | 2020-03-04 10:44:08 +0000 | [diff] [blame] | 214 | ${sw_attr_data}= Read Attribute ${software_path} Associations |
George Keishing | fe4ebd2 | 2017-09-12 06:05:22 -0500 | [diff] [blame] | 215 | 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 Keishing | 0a1044c | 2017-08-09 09:50:51 -0500 | [diff] [blame] | 228 | Verify Software Version |
| 229 | [Documentation] Verify version and activation status. |
| 230 | [Arguments] ${software_purpose} |
George Keishing | ab5157b | 2017-02-09 12:24:25 -0600 | [diff] [blame] | 231 | |
George Keishing | 0a1044c | 2017-08-09 09:50:51 -0500 | [diff] [blame] | 232 | # 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 Keishing | 81ae45b | 2017-09-28 14:05:04 -0500 | [diff] [blame] | 245 | \ Run Keyword If '${software_purpose}' == '${VERSION_PURPOSE_BMC}' |
| 246 | ... Check BMC Version ${index} ${resp["Version"]} |
George Keishing | ab5157b | 2017-02-09 12:24:25 -0600 | [diff] [blame] | 247 | |
| 248 | |
| 249 | Verify Software Properties |
George Keishing | 0a1044c | 2017-08-09 09:50:51 -0500 | [diff] [blame] | 250 | [Documentation] Verify the software object properties. |
| 251 | [Arguments] ${software_property} ${software_purpose} |
George Keishing | ab5157b | 2017-02-09 12:24:25 -0600 | [diff] [blame] | 252 | |
George Keishing | 0a1044c | 2017-08-09 09:50:51 -0500 | [diff] [blame] | 253 | # 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 Keishing | ab5157b | 2017-02-09 12:24:25 -0600 | [diff] [blame] | 260 | |
| 261 | |
| 262 | Check BMC Version |
| 263 | [Documentation] Get BMC version from /etc/os-release and compare. |
George Keishing | 81ae45b | 2017-09-28 14:05:04 -0500 | [diff] [blame] | 264 | [Arguments] ${software_object} ${version} |
George Keishing | 0a1044c | 2017-08-09 09:50:51 -0500 | [diff] [blame] | 265 | |
| 266 | # Description of argument(s): |
George Keishing | 81ae45b | 2017-09-28 14:05:04 -0500 | [diff] [blame] | 267 | # 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 Keishing | 0a1044c | 2017-08-09 09:50:51 -0500 | [diff] [blame] | 274 | |
George Keishing | ab5157b | 2017-02-09 12:24:25 -0600 | [diff] [blame] | 275 | Open Connection And Log In |
| 276 | ${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] | 277 | ${output} ${stderr} ${rc}= BMC Execute Command ${cmd} |
George Keishing | ab5157b | 2017-02-09 12:24:25 -0600 | [diff] [blame] | 278 | Should Be Equal As Strings ${version} ${output[1:-1]} |
| 279 | |
| 280 | |
| 281 | Check Activation Status |
| 282 | [Documentation] Check if software state is "Active". |
| 283 | [Arguments] ${status} |
George Keishing | 0a1044c | 2017-08-09 09:50:51 -0500 | [diff] [blame] | 284 | |
| 285 | # Description of argument(s): |
George Keishing | ab5157b | 2017-02-09 12:24:25 -0600 | [diff] [blame] | 286 | # status Activation status |
| 287 | # (e.g. "xyz.openbmc_project.Software.Activation.Activations.Active") |
| 288 | Should Be Equal As Strings ${ACTIVE} ${status} |