Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 1 | *** Settings *** |
George Keishing | c8166ed | 2017-02-24 03:53:38 -0600 | [diff] [blame] | 2 | Documentation System inventory related test. |
| 3 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 4 | Resource ../lib/rest_client.robot |
| 5 | Resource ../lib/utils.robot |
Rahul Maheshwari | 908df57 | 2017-02-16 04:41:54 -0600 | [diff] [blame] | 6 | Resource ../lib/state_manager.robot |
George Keishing | d55a4be | 2016-08-26 03:28:17 -0500 | [diff] [blame] | 7 | Resource ../lib/openbmc_ffdc.robot |
George Keishing | efa9735 | 2017-03-13 07:13:03 -0500 | [diff] [blame] | 8 | Library ../lib/utilities.py |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 9 | |
| 10 | Variables ../data/variables.py |
George Keishing | c8166ed | 2017-02-24 03:53:38 -0600 | [diff] [blame] | 11 | Variables ../data/inventory.py |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 12 | |
George Keishing | c8166ed | 2017-02-24 03:53:38 -0600 | [diff] [blame] | 13 | Suite setup Test Suite Setup |
Rahul Maheshwari | 908df57 | 2017-02-16 04:41:54 -0600 | [diff] [blame] | 14 | Test Teardown FFDC On Test Case Fail |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 15 | |
Rahul Maheshwari | 3e9b0de | 2017-03-20 06:25:44 -0500 | [diff] [blame] | 16 | Force Tags Inventory |
| 17 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 18 | *** Test Cases *** |
| 19 | |
George Keishing | c8166ed | 2017-02-24 03:53:38 -0600 | [diff] [blame] | 20 | Verify System Inventory Path |
| 21 | [Documentation] Check if system inventory path exist. |
| 22 | [Tags] Verify_System_Inventory_Path |
| 23 | # When the host is booted, system inventory path should exist. |
| 24 | # Example: /xyz/openbmc_project/inventory/system |
| 25 | Get Inventory system |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 26 | |
Rahul Maheshwari | bb20f73 | 2016-10-24 06:27:14 -0500 | [diff] [blame] | 27 | |
George Keishing | c8166ed | 2017-02-24 03:53:38 -0600 | [diff] [blame] | 28 | Verify Chassis Motherboard Properties |
| 29 | [Documentation] Check if chassis motherboard properties are |
| 30 | ... populated valid. |
| 31 | [Tags] Verify_Chassis_Motherboard_Properties |
| 32 | # When the host is booted, the following properties should |
| 33 | # be populated Manufacturer, PartNumber, SerialNumber and |
| 34 | # it should not be zero's. |
| 35 | # Example: |
| 36 | # "data": { |
| 37 | # "/xyz/openbmc_project/inventory/system/chassis/motherboard": { |
| 38 | # "BuildDate": "", |
| 39 | # "Manufacturer": "0000000000000000", |
| 40 | # "Model": "", |
| 41 | # "PartNumber": "0000000", |
| 42 | # "Present": 0, |
| 43 | # "PrettyName": "SYSTEM PLANAR ", |
| 44 | # "SerialNumber": "000000000000" |
| 45 | # } |
| 46 | ${properties}= Get Inventory system/chassis/motherboard |
| 47 | Should Not Be Equal As Strings |
| 48 | ... ${properties["data"]["Manufacturer"]} 0000000000000000 |
| 49 | ... msg=motherboard field invalid. |
| 50 | Should Not Be Equal As Strings |
| 51 | ... ${properties["data"]["PartNumber"]} 0000000 |
| 52 | ... msg=motherboard part number invalid. |
| 53 | Should Not Be Equal As Strings |
| 54 | ... ${properties["data"]["SerialNumber"]} 000000000000 |
| 55 | ... msg=motherboard serial number invalid. |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 56 | |
George Keishing | ae35530 | 2017-03-13 04:34:58 -0500 | [diff] [blame] | 57 | Verify CPU Present |
| 58 | [Documentation] Check if the FRU "Present" is set for CPU's. |
| 59 | [Tags] Verify_CPU_Present |
| 60 | # System inventory cpu list: |
| 61 | # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0 |
| 62 | # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu1 |
| 63 | # Example: |
| 64 | # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0": { |
| 65 | # "FieldReplaceable": 1, |
| 66 | # "BuildDate": "", |
| 67 | # "Cached": 0, |
| 68 | # "SerialNumber": "YA3933741574", |
| 69 | # "Version": "10", |
| 70 | # "Model": "", |
| 71 | # "PrettyName": "PROCESSOR MODULE", |
| 72 | # "PartNumber": "01HL322", |
| 73 | # "Present": 1, |
| 74 | # "Manufacturer": "IBM" |
| 75 | # }, |
| 76 | # The CPU properties "Present" should be boolean 1. |
| 77 | |
| 78 | ${cpu_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system cpu |
| 79 | :FOR ${cpu_uri} IN @{cpu_list} |
| 80 | \ ${present}= Read Attribute ${cpu_uri} Present |
| 81 | \ Should Be True ${present} |
| 82 | |
| 83 | |
| 84 | Verify DIMM Present |
| 85 | [Documentation] Check if the FRU "Present" is set for DIMM's. |
| 86 | [Tags] Verify_DIMM_Present |
| 87 | # Example: |
| 88 | # "/xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0": { |
| 89 | # "FieldReplaceable": 1, |
| 90 | # "BuildDate": "", |
| 91 | # "Cached": 0, |
| 92 | # "SerialNumber": "0x0300cf4f", |
| 93 | # "Version": "0x00", |
| 94 | # "Model": "M393A1G40EB1-CRC ", |
| 95 | # "PrettyName": "0x0c", |
| 96 | # "PartNumber": "", |
| 97 | # "Present": 1, |
| 98 | # "Manufacturer": "0xce80" |
| 99 | # }, |
| 100 | |
| 101 | # The DIMM properties "Present" should be boolean 1. |
| 102 | |
| 103 | ${dimm_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system dimm |
| 104 | :FOR ${dimm_uri} IN @{dimm_list} |
| 105 | \ ${present}= Read Attribute ${dimm_uri} Present |
| 106 | \ Should Be True ${present} |
| 107 | |
| 108 | |
George Keishing | efa9735 | 2017-03-13 07:13:03 -0500 | [diff] [blame] | 109 | Verify FRU Properties |
| 110 | [Documentation] Verify the FRU properties fields. |
| 111 | [Tags] Verify_FRU_Properties |
| 112 | # Example: |
| 113 | # A FRU would have "FieldReplaceable" set to boolean 1 and should have |
| 114 | # the following entries |
| 115 | # "fru": [ |
| 116 | # "FieldReplaceable" |
| 117 | # "BuildDate", |
| 118 | # "Cached" |
| 119 | # "SerialNumber", |
| 120 | # "Version", |
| 121 | # "Model", |
| 122 | # "PrettyName", |
| 123 | # "PartNumber", |
| 124 | # "Present", |
| 125 | # "Manufacturer", |
| 126 | # ] |
| 127 | # and FRU which doesn't have one of this fields is an error. |
| 128 | # "/xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0": { |
| 129 | # "FieldReplaceable": 1, |
| 130 | # "BuildDate": "", |
| 131 | # "Cached": 0, |
| 132 | # "SerialNumber": "0x0300cf4f", |
| 133 | # "Version": "0x00", |
| 134 | # "Model": "M393A1G40EB1-CRC ", |
| 135 | # "PrettyName": "0x0c", |
| 136 | # "PartNumber": "", |
| 137 | # "Present": 1, |
| 138 | # "Manufacturer": "0xce80" |
| 139 | # }, |
| 140 | |
| 141 | ${system_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system * |
| 142 | ${fru_list}= Qualified FRU List @{system_list} |
| 143 | Validate FRU Properties Fields @{fru_list} |
| 144 | |
George Keishing | 071d8da | 2017-03-24 09:13:16 -0500 | [diff] [blame] | 145 | |
| 146 | Verify Core Functional State |
| 147 | [Documentation] Verify that "Present" core property is set if "Functional" |
| 148 | ... core property is set. |
| 149 | [Tags] Verify_Core_Functional_State |
| 150 | # Example: |
| 151 | # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0/core5":{ |
| 152 | # "Functional": 1, |
| 153 | # "Present": 1, |
| 154 | # "PrettyName": "" |
| 155 | # }, |
| 156 | ${core_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system core |
| 157 | :FOR ${core_uri} IN @{core_list} |
| 158 | \ ${status}= Run Keyword And Return Status |
| 159 | ... Check URL Property If Functional ${core_uri} |
George Keishing | c565839 | 2017-04-27 23:05:18 -0500 | [diff] [blame] | 160 | \ Continue For Loop If '${status}' == '${False}' |
George Keishing | 071d8da | 2017-03-24 09:13:16 -0500 | [diff] [blame] | 161 | \ ${present}= Read Attribute ${core_uri} Present |
| 162 | \ Should Be True ${present} |
| 163 | ... msg=${core_uri} is functional but not present. |
| 164 | |
| 165 | |
| 166 | Verify DIMM Functional State |
| 167 | [Documentation] Verify that "Present" DIMM property is set if "Functional" |
| 168 | ... DIMM property is set. |
| 169 | [Tags] Verify_DIMM_Functional_State |
| 170 | # Example: |
| 171 | # "/xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0": { |
| 172 | # "BuildDate": "", |
| 173 | # "Cached": 0, |
| 174 | # "FieldReplaceable": 1, |
| 175 | # "Functional": 1, |
| 176 | # "Manufacturer": "0xce80", |
| 177 | # "Model": "M393A1G40EB1-CRC ", |
| 178 | # "PartNumber": "", |
| 179 | # "Present": 1, |
| 180 | # "PrettyName": "0x0c", |
| 181 | # "SerialNumber": "0x0300cf4f", |
| 182 | # "Version": "0x00" |
| 183 | # }, |
| 184 | |
| 185 | ${dimm_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system dimm |
| 186 | :FOR ${dimm_uri} IN @{dimm_list} |
| 187 | \ ${status}= Run Keyword And Return Status |
| 188 | ... Check URL Property If Functional ${dimm_uri} |
George Keishing | c565839 | 2017-04-27 23:05:18 -0500 | [diff] [blame] | 189 | \ Continue For Loop If '${status}' == '${False}' |
George Keishing | 071d8da | 2017-03-24 09:13:16 -0500 | [diff] [blame] | 190 | \ ${present}= Read Attribute ${dimm_uri} Present |
| 191 | \ Should Be True ${present} |
| 192 | ... msg=${dimm_uri} is functional but not present. |
| 193 | |
George Keishing | 3c205b1 | 2017-05-13 04:09:33 -0500 | [diff] [blame] | 194 | |
| 195 | Verify Fan Functional State |
| 196 | [Documentation] Verify that "Present" fan property is set if "Functional" |
| 197 | ... fan property is set. |
| 198 | [Tags] Verify_Fan_Functional_State |
| 199 | # Example: |
| 200 | # "/xyz/openbmc_project/inventory/system/chassis/motherboard/fan0": { |
| 201 | # "Functional": 1, |
| 202 | # "Present": 1, |
| 203 | # "PrettyName": "fan0" |
| 204 | # }, |
| 205 | |
| 206 | ${fan_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system fan* |
| 207 | Should Not Be Empty ${fan_list} |
| 208 | :FOR ${fan_uri} IN @{fan_list} |
| 209 | \ ${status}= Run Keyword And Return Status |
| 210 | ... Check URL Property If Functional ${fan_uri} |
| 211 | \ Continue For Loop If '${status}' == '${False}' |
| 212 | \ ${present}= Read Attribute ${fan_uri} Present |
| 213 | \ Should Be True ${present} |
| 214 | ... msg=${fan_uri} is functional but "Present" is not set. |
| 215 | |
| 216 | |
George Keishing | 04c6b2c | 2017-06-15 12:33:59 -0500 | [diff] [blame^] | 217 | Check Air Or Water Cooled |
| 218 | [Documentation] Check if this system is Air or water cooled. |
| 219 | [Tags] Check_Air_Or_Water_Cooled |
| 220 | # Example: |
| 221 | # "/xyz/openbmc_project/inventory/system/chassis": { |
| 222 | # "AirCooled": 1, |
| 223 | # "WaterCooled": 0 |
| 224 | # }, |
| 225 | |
| 226 | ${air_cooled}= Read Attribute |
| 227 | ... /xyz/openbmc_project/inventory/system/chassis AirCooled |
| 228 | Log AirCooled:${air_cooled} |
| 229 | |
| 230 | ${water_cooled}= Read Attribute |
| 231 | ... /xyz/openbmc_project/inventory/system/chassis WaterCooled |
| 232 | Log WaterCooled:${water_cooled} |
| 233 | |
| 234 | Run Keyword If ${air_cooled}==${0} and ${water_cooled}==${0} |
| 235 | ... Fail Neither AirCooled or WaterCooled. |
| 236 | |
| 237 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 238 | *** Keywords *** |
| 239 | |
George Keishing | c8166ed | 2017-02-24 03:53:38 -0600 | [diff] [blame] | 240 | Test Suite Setup |
| 241 | [Documentation] Do the initial suite setup. |
| 242 | ${current_state}= Get Host State |
| 243 | Run Keyword If '${current_state}' == 'Off' |
| 244 | ... Initiate Host Boot |
Rahul Maheshwari | 4a4eb6e | 2016-09-24 01:06:36 -0500 | [diff] [blame] | 245 | |
George Keishing | caac9f3 | 2017-03-09 02:14:27 -0600 | [diff] [blame] | 246 | Wait Until Keyword Succeeds |
| 247 | ... 10 min 10 sec Is OS Starting |
| 248 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 249 | |
George Keishing | c8166ed | 2017-02-24 03:53:38 -0600 | [diff] [blame] | 250 | Get Inventory |
| 251 | [Documentation] Get the properties of an endpoint. |
| 252 | [Arguments] ${endpoint} |
| 253 | # Description of arguments: |
| 254 | # endpoint string for which url path ending. |
| 255 | # Example: "system" is the endpoint for url |
| 256 | # /xyz/openbmc_project/inventory/system |
| 257 | ${resp}= OpenBMC Get Request ${HOST_INVENTORY_URI}${endpoint} |
| 258 | Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} |
| 259 | ${jsondata}= To JSON ${resp.content} |
| 260 | [Return] ${jsondata} |
George Keishing | efa9735 | 2017-03-13 07:13:03 -0500 | [diff] [blame] | 261 | |
| 262 | |
| 263 | Qualified FRU List |
| 264 | [Documentation] Build the list of valid FRUs. |
| 265 | [Arguments] @{system_list} |
| 266 | # Description of arguments: |
| 267 | # system_list List of system inventory URLs. |
| 268 | # Example: |
| 269 | # /xyz/openbmc_project/inventory/system/chassis/motherboard |
| 270 | # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0 |
| 271 | # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu1 |
| 272 | # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0 |
| 273 | # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm1 |
| 274 | # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm2 |
| 275 | # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm3 |
| 276 | # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm4 |
| 277 | # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm5 |
| 278 | # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm6 |
| 279 | # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm7 |
| 280 | |
| 281 | ${fru_list}= Create List |
| 282 | :FOR ${fru_uri} IN @{system_list} |
George Keishing | df5ab12 | 2017-04-17 04:01:11 -0500 | [diff] [blame] | 283 | \ ${resp}= OpenBMC Get Request ${fru_uri}/attr/FieldReplaceable |
| 284 | \ ${jsondata}= To JSON ${resp.content} |
| 285 | \ ${status}= Run Keyword And Return Status |
| 286 | ... Should Be True ${jsondata['data']} == ${1} |
George Keishing | efa9735 | 2017-03-13 07:13:03 -0500 | [diff] [blame] | 287 | \ Run Keyword If '${status}' == '${True}' |
| 288 | ... Append To List ${fru_list} ${fru_uri} |
| 289 | |
| 290 | [Return] ${fru_list} |
| 291 | |
| 292 | |
| 293 | Validate FRU Properties Fields |
| 294 | [Documentation] Compare valid FRUs from system vs expected FRU set. |
| 295 | [Arguments] @{fru_list} |
| 296 | # Description of arguments: |
| 297 | # fru_list List of qualified FRU URLs. |
| 298 | |
| 299 | # Build the pre-defined set list from data/inventory.py derived from |
| 300 | # a group of YAML files. |
| 301 | # Example: |
| 302 | # set(['Version', 'PartNumber', 'SerialNumber', 'FieldReplaceable', |
| 303 | # 'BuildDate', 'Present', 'Manufacturer', 'PrettyName', 'Cached', 'Model']) |
| 304 | ${fru_set}= List To Set ${inventory_dict['fru']} |
| 305 | |
| 306 | # Iterate through the FRU's url and compare the set dictionary keys |
| 307 | # with the pre-define inventory data. |
| 308 | :FOR ${fru_url_path} IN @{fru_list} |
| 309 | \ ${fru_field}= Read Properties ${fru_url_path} |
| 310 | # ------------------------------------------------------------ |
| 311 | # ${fru_field.viewkeys()} extracts the list of keys from the |
| 312 | # JSON dictionary as a set. |
| 313 | # ------------------------------------------------------------ |
| 314 | \ Should Be Equal ${fru_field.viewkeys()} ${fru_set} |
| 315 | |
George Keishing | 071d8da | 2017-03-24 09:13:16 -0500 | [diff] [blame] | 316 | |
| 317 | Check URL Property If Functional |
| 318 | [Arguments] ${url_path} |
| 319 | # Description of arguments: |
| 320 | # url_path Full url path of the inventory object. |
| 321 | # Example: DIMM / core property url's |
| 322 | # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0 |
| 323 | # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0/core0 |
| 324 | ${state}= Read Attribute ${url_path} Functional |
| 325 | Should Be True ${state} |