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