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 | |
Sweta Potthuri | 1a640de | 2017-07-18 11:09:59 -0500 | [diff] [blame] | 247 | Verify Minimal CPU Inventory |
| 248 | [Documentation] Verify minimal CPU inventory. |
| 249 | [Tags] Verify_Minimal_CPU_Inventory |
| 250 | |
| 251 | # item minimum_count |
| 252 | cpu 1 |
| 253 | [Template] Minimum Inventory |
| 254 | |
| 255 | Verify Minimal DIMM Inventory |
| 256 | [Documentation] Verify minimal DIMM inventory. |
| 257 | [Tags] Verify_Minimal_DIMM_Inventory |
| 258 | |
| 259 | # item minimum_count |
| 260 | dimm 2 |
| 261 | [Template] Minimum Inventory |
| 262 | |
| 263 | Verify Minimal Core Inventory |
| 264 | [Documentation] Verify minimal core inventory. |
| 265 | [Tags] Verify_Minimal_Core_Inventory |
| 266 | |
| 267 | # item minimum_count |
| 268 | core 1 |
| 269 | [Template] Minimum Inventory |
| 270 | |
| 271 | Verify Minimal Memory Buffer Inventory |
| 272 | [Documentation] Verify minimal memory buffer inventory. |
| 273 | [Tags] Verify_Minimal_Memory_Buffer_Inventory |
| 274 | |
| 275 | # item minimum_count |
| 276 | memory_buffer 1 |
| 277 | [Template] Minimum Inventory |
| 278 | |
| 279 | Verify Minimal Fan Inventory |
| 280 | [Documentation] Verify minimal fan inventory. |
| 281 | [Tags] Verify_Minimal_Fan_Inventory |
| 282 | |
| 283 | # item minimum_count |
| 284 | fan 2 |
| 285 | [Template] Minimum Inventory |
| 286 | |
| 287 | Verify Minimal Main Planar Inventory |
| 288 | [Documentation] Verify minimal main planar inventory. |
| 289 | [Tags] Verify_Minimal_Main_Planar_Inventory |
| 290 | |
| 291 | # item minimum_count |
| 292 | main_planar 1 |
| 293 | [Template] Minimum Inventory |
| 294 | |
| 295 | Verify Minimal System Inventory |
| 296 | [Documentation] Verify minimal system inventory. |
| 297 | [Tags] Verify_Minimal_System_Inventory |
| 298 | |
| 299 | # item minimum_count |
| 300 | system 1 |
| 301 | [Template] Minimum Inventory |
George Keishing | 04c6b2c | 2017-06-15 12:33:59 -0500 | [diff] [blame] | 302 | |
Chris Austen | b29d2e8 | 2016-06-07 12:25:35 -0500 | [diff] [blame] | 303 | *** Keywords *** |
| 304 | |
George Keishing | c8166ed | 2017-02-24 03:53:38 -0600 | [diff] [blame] | 305 | Test Suite Setup |
| 306 | [Documentation] Do the initial suite setup. |
George Keishing | 25577a2 | 2017-07-12 05:18:46 -0500 | [diff] [blame] | 307 | |
| 308 | # Reboot host to re-power on clean if host is not "off". |
George Keishing | c8166ed | 2017-02-24 03:53:38 -0600 | [diff] [blame] | 309 | ${current_state}= Get Host State |
| 310 | Run Keyword If '${current_state}' == 'Off' |
| 311 | ... Initiate Host Boot |
George Keishing | 25577a2 | 2017-07-12 05:18:46 -0500 | [diff] [blame] | 312 | ... ELSE Initiate Host Reboot |
Rahul Maheshwari | 4a4eb6e | 2016-09-24 01:06:36 -0500 | [diff] [blame] | 313 | |
George Keishing | caac9f3 | 2017-03-09 02:14:27 -0600 | [diff] [blame] | 314 | Wait Until Keyword Succeeds |
| 315 | ... 10 min 10 sec Is OS Starting |
| 316 | |
George Keishing | c8166ed | 2017-02-24 03:53:38 -0600 | [diff] [blame] | 317 | Get Inventory |
| 318 | [Documentation] Get the properties of an endpoint. |
| 319 | [Arguments] ${endpoint} |
| 320 | # Description of arguments: |
| 321 | # endpoint string for which url path ending. |
| 322 | # Example: "system" is the endpoint for url |
| 323 | # /xyz/openbmc_project/inventory/system |
| 324 | ${resp}= OpenBMC Get Request ${HOST_INVENTORY_URI}${endpoint} |
| 325 | Should Be Equal As Strings ${resp.status_code} ${HTTP_OK} |
| 326 | ${jsondata}= To JSON ${resp.content} |
| 327 | [Return] ${jsondata} |
George Keishing | efa9735 | 2017-03-13 07:13:03 -0500 | [diff] [blame] | 328 | |
| 329 | |
| 330 | Qualified FRU List |
| 331 | [Documentation] Build the list of valid FRUs. |
| 332 | [Arguments] @{system_list} |
| 333 | # Description of arguments: |
| 334 | # system_list List of system inventory URLs. |
| 335 | # Example: |
| 336 | # /xyz/openbmc_project/inventory/system/chassis/motherboard |
| 337 | # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0 |
| 338 | # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu1 |
| 339 | # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0 |
| 340 | # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm1 |
| 341 | # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm2 |
| 342 | # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm3 |
| 343 | # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm4 |
| 344 | # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm5 |
| 345 | # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm6 |
| 346 | # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm7 |
| 347 | |
| 348 | ${fru_list}= Create List |
| 349 | :FOR ${fru_uri} IN @{system_list} |
George Keishing | df5ab12 | 2017-04-17 04:01:11 -0500 | [diff] [blame] | 350 | \ ${resp}= OpenBMC Get Request ${fru_uri}/attr/FieldReplaceable |
| 351 | \ ${jsondata}= To JSON ${resp.content} |
| 352 | \ ${status}= Run Keyword And Return Status |
| 353 | ... Should Be True ${jsondata['data']} == ${1} |
George Keishing | efa9735 | 2017-03-13 07:13:03 -0500 | [diff] [blame] | 354 | \ Run Keyword If '${status}' == '${True}' |
| 355 | ... Append To List ${fru_list} ${fru_uri} |
| 356 | |
| 357 | [Return] ${fru_list} |
| 358 | |
| 359 | |
| 360 | Validate FRU Properties Fields |
| 361 | [Documentation] Compare valid FRUs from system vs expected FRU set. |
| 362 | [Arguments] @{fru_list} |
| 363 | # Description of arguments: |
| 364 | # fru_list List of qualified FRU URLs. |
| 365 | |
| 366 | # Build the pre-defined set list from data/inventory.py derived from |
| 367 | # a group of YAML files. |
| 368 | # Example: |
| 369 | # set(['Version', 'PartNumber', 'SerialNumber', 'FieldReplaceable', |
| 370 | # 'BuildDate', 'Present', 'Manufacturer', 'PrettyName', 'Cached', 'Model']) |
| 371 | ${fru_set}= List To Set ${inventory_dict['fru']} |
| 372 | |
| 373 | # Iterate through the FRU's url and compare the set dictionary keys |
| 374 | # with the pre-define inventory data. |
| 375 | :FOR ${fru_url_path} IN @{fru_list} |
| 376 | \ ${fru_field}= Read Properties ${fru_url_path} |
| 377 | # ------------------------------------------------------------ |
| 378 | # ${fru_field.viewkeys()} extracts the list of keys from the |
| 379 | # JSON dictionary as a set. |
| 380 | # ------------------------------------------------------------ |
| 381 | \ Should Be Equal ${fru_field.viewkeys()} ${fru_set} |
| 382 | |
George Keishing | 071d8da | 2017-03-24 09:13:16 -0500 | [diff] [blame] | 383 | |
| 384 | Check URL Property If Functional |
| 385 | [Arguments] ${url_path} |
| 386 | # Description of arguments: |
| 387 | # url_path Full url path of the inventory object. |
| 388 | # Example: DIMM / core property url's |
| 389 | # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0 |
| 390 | # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0/core0 |
| 391 | ${state}= Read Attribute ${url_path} Functional |
| 392 | Should Be True ${state} |
Sweta Potthuri | 654cbc0 | 2017-06-15 10:10:55 -0500 | [diff] [blame] | 393 | |
| 394 | Verify Inventory List Before And After Reboot |
| 395 | [Documentation] Verify Inventory list before and after reboot. |
| 396 | |
| 397 | Initiate Host Boot |
| 398 | Wait Until Keyword Succeeds 10 min 10 sec Is OS Starting |
| 399 | ${inv_before}= Get URL List ${HOST_INVENTORY_URI} |
| 400 | Initiate Host Reboot |
| 401 | Wait Until Keyword Succeeds 10 min 10 sec Is OS Starting |
| 402 | ${inv_after}= Get URL List ${HOST_INVENTORY_URI} |
| 403 | Lists Should Be Equal ${inv_before} ${inv_after} |
Sweta Potthuri | 1a640de | 2017-07-18 11:09:59 -0500 | [diff] [blame] | 404 | |
| 405 | Minimum Inventory |
| 406 | [Documentation] Check for minimum inventory. |
| 407 | [Arguments] ${item} ${minimum_count} |
| 408 | |
| 409 | # Description of argument(s): |
| 410 | # item Inventory name (example: "fan/cpu/dimm/etc"). |
| 411 | # minimum_count The minimum number of the given item. |
| 412 | |
| 413 | ${count}= Get Number Hardware Items ${item} |
| 414 | Should Be True ${count}>=${minimum_count} |
| 415 | |
| 416 | Get Number Hardware Items |
| 417 | [Documentation] Get the count of the total present currently on inventory. |
| 418 | [Arguments] ${item} |
| 419 | |
| 420 | # Description of argument(s): |
| 421 | # item Inventory name (example: "fan/cpu/dimm/etc"). |
| 422 | |
| 423 | ${count_inventory} Set Variable ${0} |
| 424 | ${list}= Get Endpoint Paths ${HOST_INVENTORY_URI}/system/ |
| 425 | ... ${item} |
| 426 | |
| 427 | : FOR ${element} IN @{list} |
| 428 | \ ${present}= Read Properties ${element} |
| 429 | \ ${count_inventory}= Set Variable if ${present['Present']} == 1 |
| 430 | \ ... ${count_inventory+1} ${count_inventory} |
| 431 | [return] ${count_inventory} |