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