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 |
Sweta Potthuri | af741cb | 2017-07-04 09:41:17 -0500 | [diff] [blame] | 9 | Resource ../lib/boot_utils.robot |
George Keishing | efa9735 | 2017-03-13 07:13:03 -0500 | [diff] [blame] | 10 | Library ../lib/utilities.py |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 11 | |
| 12 | Variables ../data/variables.py |
George Keishing | c8166ed | 2017-02-24 03:53:38 -0600 | [diff] [blame] | 13 | Variables ../data/inventory.py |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 14 | |
George Keishing | c8166ed | 2017-02-24 03:53:38 -0600 | [diff] [blame] | 15 | Suite setup Test Suite Setup |
Rahul Maheshwari | 908df57 | 2017-02-16 04:41:54 -0600 | [diff] [blame] | 16 | Test Teardown FFDC On Test Case Fail |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 17 | |
Rahul Maheshwari | 3e9b0de | 2017-03-20 06:25:44 -0500 | [diff] [blame] | 18 | Force Tags Inventory |
| 19 | |
Sweta Potthuri | 654cbc0 | 2017-06-15 10:10:55 -0500 | [diff] [blame] | 20 | ***Variables*** |
| 21 | |
| 22 | ${LOOP_COUNT} ${1} |
| 23 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 24 | *** Test Cases *** |
| 25 | |
George Keishing | c8166ed | 2017-02-24 03:53:38 -0600 | [diff] [blame] | 26 | Verify System Inventory Path |
| 27 | [Documentation] Check if system inventory path exist. |
| 28 | [Tags] Verify_System_Inventory_Path |
| 29 | # When the host is booted, system inventory path should exist. |
| 30 | # Example: /xyz/openbmc_project/inventory/system |
| 31 | Get Inventory system |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 32 | |
Rahul Maheshwari | bb20f73 | 2016-10-24 06:27:14 -0500 | [diff] [blame] | 33 | |
George Keishing | 3d73431 | 2017-07-24 04:10:25 -0500 | [diff] [blame] | 34 | Verify Boxelder Present Property |
| 35 | [Documentation] Boxelder should be present by default. |
| 36 | [Tags] Verify that boxelder 'Present' property is present by default. |
| 37 | # Example: |
| 38 | # "/xyz/openbmc_project/inventory/system/chassis/motherboard/boxelder/bmc": |
| 39 | # { |
| 40 | # "BuildDate": "", |
| 41 | # "FieldReplaceable": 0, |
| 42 | # "Manufacturer": "IBM", |
| 43 | # "Model": "", |
| 44 | # "PartNumber": "01DH051", |
| 45 | # "Present": 1, |
| 46 | # "PrettyName": "BMC PLANAR ", |
| 47 | # "SerialNumber": "000000000000" |
| 48 | # }, |
| 49 | ${json_data}= Get Inventory system/chassis/motherboard/boxelder/bmc |
| 50 | Should Be True ${json_data["data"]["Present"]} |
| 51 | |
| 52 | |
| 53 | Verify Boxelder MAC Address Property Is Populated |
| 54 | [Documentation] Boxelder should be present by default. |
| 55 | [Tags] Verify_Boxelder_MAC_Address_Property_Is_Populated |
| 56 | # Example: |
| 57 | # /xyz/openbmc_project/inventory/system/chassis/motherboard/boxelder/bmc/ethernet |
| 58 | # { |
| 59 | # "FieldReplaceable": 0, |
| 60 | # "MACAddress": "00:00:00:00:00:00", |
| 61 | # "Present": 1, |
| 62 | # "PrettyName": "" |
| 63 | # } |
| 64 | |
| 65 | ${json_data}= Get Inventory |
| 66 | ... system/chassis/motherboard/boxelder/bmc/ethernet |
| 67 | Should Be True ${json_data["data"]["Present"]} |
| 68 | Should Not Be Equal As Strings |
| 69 | ... ${json_data["data"]["MACAddress"]} 00:00:00:00:00:00 |
| 70 | |
| 71 | # eth0 Link encap:Ethernet HWaddr 70:E2:84:14:23:F9 |
| 72 | ${mac_addr} ${stderr} ${rc}= BMC Execute Command |
| 73 | ... /sbin/ifconfig -a | grep HWaddr | awk -F'HWaddr ' '{print $2}' |
| 74 | ... return_stderr=True |
| 75 | Should Be Empty ${stderr} |
Rahul Maheshwari | 844dbe7 | 2017-09-18 00:24:23 -0500 | [diff] [blame] | 76 | Should Be Equal As Strings ${json_data["data"]["MACAddress"]} |
| 77 | ... ${mac_addr.strip()} msg=MAC address configured incorrectly. |
| 78 | ... ignore_case=True |
George Keishing | 3d73431 | 2017-07-24 04:10:25 -0500 | [diff] [blame] | 79 | |
| 80 | |
George Keishing | c8166ed | 2017-02-24 03:53:38 -0600 | [diff] [blame] | 81 | Verify Chassis Motherboard Properties |
| 82 | [Documentation] Check if chassis motherboard properties are |
| 83 | ... populated valid. |
| 84 | [Tags] Verify_Chassis_Motherboard_Properties |
| 85 | # When the host is booted, the following properties should |
| 86 | # be populated Manufacturer, PartNumber, SerialNumber and |
| 87 | # it should not be zero's. |
| 88 | # Example: |
| 89 | # "data": { |
| 90 | # "/xyz/openbmc_project/inventory/system/chassis/motherboard": { |
| 91 | # "BuildDate": "", |
| 92 | # "Manufacturer": "0000000000000000", |
| 93 | # "Model": "", |
| 94 | # "PartNumber": "0000000", |
| 95 | # "Present": 0, |
| 96 | # "PrettyName": "SYSTEM PLANAR ", |
| 97 | # "SerialNumber": "000000000000" |
| 98 | # } |
| 99 | ${properties}= Get Inventory system/chassis/motherboard |
| 100 | Should Not Be Equal As Strings |
George Keishing | c8166ed | 2017-02-24 03:53:38 -0600 | [diff] [blame] | 101 | ... ${properties["data"]["PartNumber"]} 0000000 |
| 102 | ... msg=motherboard part number invalid. |
| 103 | Should Not Be Equal As Strings |
| 104 | ... ${properties["data"]["SerialNumber"]} 000000000000 |
| 105 | ... msg=motherboard serial number invalid. |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 106 | |
George Keishing | ae35530 | 2017-03-13 04:34:58 -0500 | [diff] [blame] | 107 | Verify CPU Present |
| 108 | [Documentation] Check if the FRU "Present" is set for CPU's. |
| 109 | [Tags] Verify_CPU_Present |
| 110 | # System inventory cpu list: |
| 111 | # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0 |
| 112 | # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu1 |
| 113 | # Example: |
| 114 | # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0": { |
| 115 | # "FieldReplaceable": 1, |
| 116 | # "BuildDate": "", |
| 117 | # "Cached": 0, |
| 118 | # "SerialNumber": "YA3933741574", |
| 119 | # "Version": "10", |
| 120 | # "Model": "", |
| 121 | # "PrettyName": "PROCESSOR MODULE", |
| 122 | # "PartNumber": "01HL322", |
| 123 | # "Present": 1, |
| 124 | # "Manufacturer": "IBM" |
| 125 | # }, |
| 126 | # The CPU properties "Present" should be boolean 1. |
| 127 | |
| 128 | ${cpu_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system cpu |
| 129 | :FOR ${cpu_uri} IN @{cpu_list} |
| 130 | \ ${present}= Read Attribute ${cpu_uri} Present |
| 131 | \ Should Be True ${present} |
| 132 | |
| 133 | |
| 134 | Verify DIMM Present |
| 135 | [Documentation] Check if the FRU "Present" is set for DIMM's. |
| 136 | [Tags] Verify_DIMM_Present |
| 137 | # Example: |
| 138 | # "/xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0": { |
| 139 | # "FieldReplaceable": 1, |
| 140 | # "BuildDate": "", |
| 141 | # "Cached": 0, |
| 142 | # "SerialNumber": "0x0300cf4f", |
| 143 | # "Version": "0x00", |
| 144 | # "Model": "M393A1G40EB1-CRC ", |
| 145 | # "PrettyName": "0x0c", |
| 146 | # "PartNumber": "", |
| 147 | # "Present": 1, |
| 148 | # "Manufacturer": "0xce80" |
| 149 | # }, |
| 150 | |
| 151 | # The DIMM properties "Present" should be boolean 1. |
| 152 | |
| 153 | ${dimm_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system dimm |
| 154 | :FOR ${dimm_uri} IN @{dimm_list} |
| 155 | \ ${present}= Read Attribute ${dimm_uri} Present |
| 156 | \ Should Be True ${present} |
| 157 | |
| 158 | |
George Keishing | efa9735 | 2017-03-13 07:13:03 -0500 | [diff] [blame] | 159 | Verify FRU Properties |
| 160 | [Documentation] Verify the FRU properties fields. |
| 161 | [Tags] Verify_FRU_Properties |
| 162 | # Example: |
| 163 | # A FRU would have "FieldReplaceable" set to boolean 1 and should have |
| 164 | # the following entries |
| 165 | # "fru": [ |
| 166 | # "FieldReplaceable" |
| 167 | # "BuildDate", |
| 168 | # "Cached" |
| 169 | # "SerialNumber", |
| 170 | # "Version", |
| 171 | # "Model", |
| 172 | # "PrettyName", |
| 173 | # "PartNumber", |
| 174 | # "Present", |
| 175 | # "Manufacturer", |
| 176 | # ] |
| 177 | # and FRU which doesn't have one of this fields is an error. |
| 178 | # "/xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0": { |
| 179 | # "FieldReplaceable": 1, |
| 180 | # "BuildDate": "", |
| 181 | # "Cached": 0, |
| 182 | # "SerialNumber": "0x0300cf4f", |
| 183 | # "Version": "0x00", |
| 184 | # "Model": "M393A1G40EB1-CRC ", |
| 185 | # "PrettyName": "0x0c", |
| 186 | # "PartNumber": "", |
| 187 | # "Present": 1, |
| 188 | # "Manufacturer": "0xce80" |
| 189 | # }, |
| 190 | |
| 191 | ${system_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system * |
| 192 | ${fru_list}= Qualified FRU List @{system_list} |
| 193 | Validate FRU Properties Fields @{fru_list} |
| 194 | |
George Keishing | 071d8da | 2017-03-24 09:13:16 -0500 | [diff] [blame] | 195 | |
| 196 | Verify Core Functional State |
| 197 | [Documentation] Verify that "Present" core property is set if "Functional" |
| 198 | ... core property is set. |
| 199 | [Tags] Verify_Core_Functional_State |
| 200 | # Example: |
| 201 | # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0/core5":{ |
| 202 | # "Functional": 1, |
| 203 | # "Present": 1, |
| 204 | # "PrettyName": "" |
| 205 | # }, |
| 206 | ${core_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system core |
| 207 | :FOR ${core_uri} IN @{core_list} |
| 208 | \ ${status}= Run Keyword And Return Status |
| 209 | ... Check URL Property If Functional ${core_uri} |
George Keishing | c565839 | 2017-04-27 23:05:18 -0500 | [diff] [blame] | 210 | \ Continue For Loop If '${status}' == '${False}' |
George Keishing | 071d8da | 2017-03-24 09:13:16 -0500 | [diff] [blame] | 211 | \ ${present}= Read Attribute ${core_uri} Present |
| 212 | \ Should Be True ${present} |
| 213 | ... msg=${core_uri} is functional but not present. |
| 214 | |
| 215 | |
| 216 | Verify DIMM Functional State |
| 217 | [Documentation] Verify that "Present" DIMM property is set if "Functional" |
| 218 | ... DIMM property is set. |
| 219 | [Tags] Verify_DIMM_Functional_State |
| 220 | # Example: |
| 221 | # "/xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0": { |
| 222 | # "BuildDate": "", |
| 223 | # "Cached": 0, |
| 224 | # "FieldReplaceable": 1, |
| 225 | # "Functional": 1, |
| 226 | # "Manufacturer": "0xce80", |
| 227 | # "Model": "M393A1G40EB1-CRC ", |
| 228 | # "PartNumber": "", |
| 229 | # "Present": 1, |
| 230 | # "PrettyName": "0x0c", |
| 231 | # "SerialNumber": "0x0300cf4f", |
| 232 | # "Version": "0x00" |
| 233 | # }, |
| 234 | |
| 235 | ${dimm_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system dimm |
| 236 | :FOR ${dimm_uri} IN @{dimm_list} |
| 237 | \ ${status}= Run Keyword And Return Status |
| 238 | ... Check URL Property If Functional ${dimm_uri} |
George Keishing | c565839 | 2017-04-27 23:05:18 -0500 | [diff] [blame] | 239 | \ Continue For Loop If '${status}' == '${False}' |
George Keishing | 071d8da | 2017-03-24 09:13:16 -0500 | [diff] [blame] | 240 | \ ${present}= Read Attribute ${dimm_uri} Present |
| 241 | \ Should Be True ${present} |
| 242 | ... msg=${dimm_uri} is functional but not present. |
| 243 | |
George Keishing | 3c205b1 | 2017-05-13 04:09:33 -0500 | [diff] [blame] | 244 | |
| 245 | Verify Fan Functional State |
| 246 | [Documentation] Verify that "Present" fan property is set if "Functional" |
| 247 | ... fan property is set. |
| 248 | [Tags] Verify_Fan_Functional_State |
| 249 | # Example: |
| 250 | # "/xyz/openbmc_project/inventory/system/chassis/motherboard/fan0": { |
| 251 | # "Functional": 1, |
| 252 | # "Present": 1, |
| 253 | # "PrettyName": "fan0" |
| 254 | # }, |
| 255 | |
| 256 | ${fan_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system fan* |
| 257 | Should Not Be Empty ${fan_list} |
| 258 | :FOR ${fan_uri} IN @{fan_list} |
| 259 | \ ${status}= Run Keyword And Return Status |
| 260 | ... Check URL Property If Functional ${fan_uri} |
| 261 | \ Continue For Loop If '${status}' == '${False}' |
| 262 | \ ${present}= Read Attribute ${fan_uri} Present |
| 263 | \ Should Be True ${present} |
| 264 | ... msg=${fan_uri} is functional but "Present" is not set. |
| 265 | |
| 266 | |
George Keishing | 04c6b2c | 2017-06-15 12:33:59 -0500 | [diff] [blame] | 267 | Check Air Or Water Cooled |
| 268 | [Documentation] Check if this system is Air or water cooled. |
| 269 | [Tags] Check_Air_Or_Water_Cooled |
| 270 | # Example: |
| 271 | # "/xyz/openbmc_project/inventory/system/chassis": { |
| 272 | # "AirCooled": 1, |
| 273 | # "WaterCooled": 0 |
| 274 | # }, |
| 275 | |
| 276 | ${air_cooled}= Read Attribute |
| 277 | ... /xyz/openbmc_project/inventory/system/chassis AirCooled |
| 278 | Log AirCooled:${air_cooled} |
| 279 | |
| 280 | ${water_cooled}= Read Attribute |
| 281 | ... /xyz/openbmc_project/inventory/system/chassis WaterCooled |
| 282 | Log WaterCooled:${water_cooled} |
| 283 | |
| 284 | Run Keyword If ${air_cooled}==${0} and ${water_cooled}==${0} |
| 285 | ... Fail Neither AirCooled or WaterCooled. |
| 286 | |
Sweta Potthuri | 1a640de | 2017-07-18 11:09:59 -0500 | [diff] [blame] | 287 | Verify Minimal CPU Inventory |
| 288 | [Documentation] Verify minimal CPU inventory. |
| 289 | [Tags] Verify_Minimal_CPU_Inventory |
| 290 | |
| 291 | # item minimum_count |
| 292 | cpu 1 |
| 293 | [Template] Minimum Inventory |
| 294 | |
| 295 | Verify Minimal DIMM Inventory |
| 296 | [Documentation] Verify minimal DIMM inventory. |
| 297 | [Tags] Verify_Minimal_DIMM_Inventory |
| 298 | |
| 299 | # item minimum_count |
| 300 | dimm 2 |
| 301 | [Template] Minimum Inventory |
| 302 | |
| 303 | Verify Minimal Core Inventory |
| 304 | [Documentation] Verify minimal core inventory. |
| 305 | [Tags] Verify_Minimal_Core_Inventory |
| 306 | |
| 307 | # item minimum_count |
| 308 | core 1 |
| 309 | [Template] Minimum Inventory |
| 310 | |
| 311 | Verify Minimal Memory Buffer Inventory |
| 312 | [Documentation] Verify minimal memory buffer inventory. |
| 313 | [Tags] Verify_Minimal_Memory_Buffer_Inventory |
| 314 | |
| 315 | # item minimum_count |
| 316 | memory_buffer 1 |
| 317 | [Template] Minimum Inventory |
| 318 | |
| 319 | Verify Minimal Fan Inventory |
| 320 | [Documentation] Verify minimal fan inventory. |
| 321 | [Tags] Verify_Minimal_Fan_Inventory |
| 322 | |
| 323 | # item minimum_count |
| 324 | fan 2 |
| 325 | [Template] Minimum Inventory |
| 326 | |
| 327 | Verify Minimal Main Planar Inventory |
| 328 | [Documentation] Verify minimal main planar inventory. |
| 329 | [Tags] Verify_Minimal_Main_Planar_Inventory |
| 330 | |
| 331 | # item minimum_count |
| 332 | main_planar 1 |
| 333 | [Template] Minimum Inventory |
| 334 | |
| 335 | Verify Minimal System Inventory |
| 336 | [Documentation] Verify minimal system inventory. |
| 337 | [Tags] Verify_Minimal_System_Inventory |
| 338 | |
| 339 | # item minimum_count |
| 340 | system 1 |
| 341 | [Template] Minimum Inventory |
George Keishing | 04c6b2c | 2017-06-15 12:33:59 -0500 | [diff] [blame] | 342 | |
George Keishing | 03ebc29 | 2017-08-02 01:22:02 -0500 | [diff] [blame] | 343 | Verify Minimal Power Supply Inventory |
| 344 | [Documentation] Verify minimal power supply inventory. |
| 345 | [Tags] Verify_Minimal_Power_Supply_Inventory |
| 346 | # Example: |
| 347 | # "/xyz/openbmc_project/inventory/system/chassis/power_supply0", |
| 348 | # "/xyz/openbmc_project/inventory/system/chassis/power_supply1", |
| 349 | |
| 350 | # item minimum_count |
| 351 | power_supply 1 |
| 352 | [Template] Minimum Inventory |
| 353 | |
George Keishing | fafbfdb | 2017-08-30 23:51:23 -0500 | [diff] [blame] | 354 | |
| 355 | Verify Inventory List After Reboot |
| 356 | [Documentation] Verify inventory list after reboot. |
| 357 | [Tags] Verify_Inventory_List_After_Reboot |
| 358 | |
| 359 | Repeat Keyword ${LOOP_COUNT} times Choose Boot Option reboot |
| 360 | |
| 361 | |
| 362 | Verify Inventory List After Reset |
| 363 | [Documentation] Verify inventory list after reset. |
| 364 | [Tags] Verify_Inventory_List_After_Reset |
| 365 | |
| 366 | Repeat Keyword ${LOOP_COUNT} times Choose Boot Option reset |
| 367 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 368 | *** Keywords *** |
| 369 | |
George Keishing | c8166ed | 2017-02-24 03:53:38 -0600 | [diff] [blame] | 370 | Test Suite Setup |
| 371 | [Documentation] Do the initial suite setup. |
George Keishing | 25577a2 | 2017-07-12 05:18:46 -0500 | [diff] [blame] | 372 | |
Sweta Potthuri | af741cb | 2017-07-04 09:41:17 -0500 | [diff] [blame] | 373 | # Boot Host. |
| 374 | REST Power On |
George Keishing | caac9f3 | 2017-03-09 02:14:27 -0600 | [diff] [blame] | 375 | |
George Keishing | c8166ed | 2017-02-24 03:53:38 -0600 | [diff] [blame] | 376 | Get Inventory |
| 377 | [Documentation] Get the properties of an endpoint. |
| 378 | [Arguments] ${endpoint} |
| 379 | # Description of arguments: |
| 380 | # endpoint string for which url path ending. |
| 381 | # Example: "system" is the endpoint for url |
| 382 | # /xyz/openbmc_project/inventory/system |
| 383 | ${resp}= OpenBMC Get Request ${HOST_INVENTORY_URI}${endpoint} |
| 384 | Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} |
| 385 | ${jsondata}= To JSON ${resp.content} |
| 386 | [Return] ${jsondata} |
George Keishing | efa9735 | 2017-03-13 07:13:03 -0500 | [diff] [blame] | 387 | |
| 388 | |
| 389 | Qualified FRU List |
| 390 | [Documentation] Build the list of valid FRUs. |
| 391 | [Arguments] @{system_list} |
| 392 | # Description of arguments: |
| 393 | # system_list List of system inventory URLs. |
| 394 | # Example: |
| 395 | # /xyz/openbmc_project/inventory/system/chassis/motherboard |
| 396 | # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0 |
| 397 | # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu1 |
| 398 | # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0 |
| 399 | # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm1 |
| 400 | # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm2 |
| 401 | # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm3 |
| 402 | # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm4 |
| 403 | # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm5 |
| 404 | # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm6 |
| 405 | # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm7 |
| 406 | |
| 407 | ${fru_list}= Create List |
| 408 | :FOR ${fru_uri} IN @{system_list} |
George Keishing | df5ab12 | 2017-04-17 04:01:11 -0500 | [diff] [blame] | 409 | \ ${resp}= OpenBMC Get Request ${fru_uri}/attr/FieldReplaceable |
| 410 | \ ${jsondata}= To JSON ${resp.content} |
| 411 | \ ${status}= Run Keyword And Return Status |
| 412 | ... Should Be True ${jsondata['data']} == ${1} |
George Keishing | efa9735 | 2017-03-13 07:13:03 -0500 | [diff] [blame] | 413 | \ Run Keyword If '${status}' == '${True}' |
| 414 | ... Append To List ${fru_list} ${fru_uri} |
| 415 | |
| 416 | [Return] ${fru_list} |
| 417 | |
| 418 | |
| 419 | Validate FRU Properties Fields |
| 420 | [Documentation] Compare valid FRUs from system vs expected FRU set. |
| 421 | [Arguments] @{fru_list} |
| 422 | # Description of arguments: |
| 423 | # fru_list List of qualified FRU URLs. |
| 424 | |
| 425 | # Build the pre-defined set list from data/inventory.py derived from |
| 426 | # a group of YAML files. |
| 427 | # Example: |
| 428 | # set(['Version', 'PartNumber', 'SerialNumber', 'FieldReplaceable', |
| 429 | # 'BuildDate', 'Present', 'Manufacturer', 'PrettyName', 'Cached', 'Model']) |
| 430 | ${fru_set}= List To Set ${inventory_dict['fru']} |
| 431 | |
| 432 | # Iterate through the FRU's url and compare the set dictionary keys |
| 433 | # with the pre-define inventory data. |
| 434 | :FOR ${fru_url_path} IN @{fru_list} |
| 435 | \ ${fru_field}= Read Properties ${fru_url_path} |
| 436 | # ------------------------------------------------------------ |
| 437 | # ${fru_field.viewkeys()} extracts the list of keys from the |
| 438 | # JSON dictionary as a set. |
| 439 | # ------------------------------------------------------------ |
| 440 | \ Should Be Equal ${fru_field.viewkeys()} ${fru_set} |
| 441 | |
George Keishing | 071d8da | 2017-03-24 09:13:16 -0500 | [diff] [blame] | 442 | |
| 443 | Check URL Property If Functional |
| 444 | [Arguments] ${url_path} |
| 445 | # Description of arguments: |
| 446 | # url_path Full url path of the inventory object. |
| 447 | # Example: DIMM / core property url's |
| 448 | # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0 |
| 449 | # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0/core0 |
| 450 | ${state}= Read Attribute ${url_path} Functional |
| 451 | Should Be True ${state} |
Sweta Potthuri | 654cbc0 | 2017-06-15 10:10:55 -0500 | [diff] [blame] | 452 | |
George Keishing | fafbfdb | 2017-08-30 23:51:23 -0500 | [diff] [blame] | 453 | Choose Boot Option |
| 454 | [Documentation] Choose BMC reset or host reboot. |
| 455 | [Arguments] ${option} |
Sweta Potthuri | 654cbc0 | 2017-06-15 10:10:55 -0500 | [diff] [blame] | 456 | |
George Keishing | fafbfdb | 2017-08-30 23:51:23 -0500 | [diff] [blame] | 457 | Run Keyword If '${option}' == 'reboot' |
| 458 | ... Verify Inventory List Before And After Reboot |
| 459 | ... ELSE |
| 460 | ... Verify Inventory List Before And After Reset |
| 461 | |
| 462 | |
| 463 | Verify Inventory List Before And After Reboot |
| 464 | [Documentation] Verify inventory list before and after reboot. |
| 465 | |
| 466 | REST Power On |
| 467 | Delete Error Logs |
| 468 | ${inventory_before}= Get URL List ${HOST_INVENTORY_URI} |
Sweta Potthuri | 654cbc0 | 2017-06-15 10:10:55 -0500 | [diff] [blame] | 469 | Initiate Host Reboot |
George Keishing | f0680ee | 2017-08-19 15:22:53 -0500 | [diff] [blame] | 470 | Wait Until Keyword Succeeds 10 min 10 sec Is OS Booted |
George Keishing | fafbfdb | 2017-08-30 23:51:23 -0500 | [diff] [blame] | 471 | Delete Error Logs |
| 472 | ${inventory_after}= Get URL List ${HOST_INVENTORY_URI} |
| 473 | Lists Should Be Equal ${inventory_before} ${inventory_after} |
| 474 | |
| 475 | |
| 476 | Verify Inventory List Before And After Reset |
| 477 | [Documentation] Verify inventory list before and after BMC reset. |
| 478 | |
| 479 | REST Power On |
| 480 | Delete Error Logs |
| 481 | ${inventory_before}= Get URL List ${HOST_INVENTORY_URI} |
| 482 | OBMC Reboot (run) |
| 483 | Delete Error Logs |
| 484 | ${inventory_after}= Get URL List ${HOST_INVENTORY_URI} |
| 485 | Lists Should Be Equal ${inventory_before} ${inventory_after} |
| 486 | |
Sweta Potthuri | 1a640de | 2017-07-18 11:09:59 -0500 | [diff] [blame] | 487 | |
| 488 | Minimum Inventory |
| 489 | [Documentation] Check for minimum inventory. |
| 490 | [Arguments] ${item} ${minimum_count} |
| 491 | |
| 492 | # Description of argument(s): |
| 493 | # item Inventory name (example: "fan/cpu/dimm/etc"). |
| 494 | # minimum_count The minimum number of the given item. |
| 495 | |
| 496 | ${count}= Get Number Hardware Items ${item} |
| 497 | Should Be True ${count}>=${minimum_count} |
| 498 | |
| 499 | Get Number Hardware Items |
| 500 | [Documentation] Get the count of the total present currently on inventory. |
| 501 | [Arguments] ${item} |
| 502 | |
| 503 | # Description of argument(s): |
| 504 | # item Inventory name (example: "fan/cpu/dimm/etc"). |
| 505 | |
| 506 | ${count_inventory} Set Variable ${0} |
| 507 | ${list}= Get Endpoint Paths ${HOST_INVENTORY_URI}/system/ |
| 508 | ... ${item} |
| 509 | |
| 510 | : FOR ${element} IN @{list} |
| 511 | \ ${present}= Read Properties ${element} |
| 512 | \ ${count_inventory}= Set Variable if ${present['Present']} == 1 |
| 513 | \ ... ${count_inventory+1} ${count_inventory} |
| 514 | [return] ${count_inventory} |