blob: 7e60414cc0d7128b0d0733e5fdda27c790c5d9f6 [file] [log] [blame]
Chris Austenb29d2e82016-06-07 12:25:35 -05001*** Settings ***
George Keishingc8166ed2017-02-24 03:53:38 -06002Documentation System inventory related test.
3
Chris Austenb29d2e82016-06-07 12:25:35 -05004Resource ../lib/rest_client.robot
5Resource ../lib/utils.robot
Rahul Maheshwari908df572017-02-16 04:41:54 -06006Resource ../lib/state_manager.robot
George Keishingd55a4be2016-08-26 03:28:17 -05007Resource ../lib/openbmc_ffdc.robot
Sweta Potthuri654cbc02017-06-15 10:10:55 -05008Resource ../lib/list_utils.robot
Sweta Potthuriaf741cb2017-07-04 09:41:17 -05009Resource ../lib/boot_utils.robot
George Keishingefa97352017-03-13 07:13:03 -050010Library ../lib/utilities.py
Chris Austenb29d2e82016-06-07 12:25:35 -050011
12Variables ../data/variables.py
George Keishingc8166ed2017-02-24 03:53:38 -060013Variables ../data/inventory.py
Chris Austenb29d2e82016-06-07 12:25:35 -050014
George Keishingc8166ed2017-02-24 03:53:38 -060015Suite setup Test Suite Setup
Rahul Maheshwari908df572017-02-16 04:41:54 -060016Test Teardown FFDC On Test Case Fail
Chris Austenb29d2e82016-06-07 12:25:35 -050017
Rahul Maheshwari3e9b0de2017-03-20 06:25:44 -050018Force Tags Inventory
19
Sweta Potthuri654cbc02017-06-15 10:10:55 -050020***Variables***
21
22${LOOP_COUNT} ${1}
23
Chris Austenb29d2e82016-06-07 12:25:35 -050024*** Test Cases ***
25
George Keishingc8166ed2017-02-24 03:53:38 -060026Verify 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 Austenb29d2e82016-06-07 12:25:35 -050032
Rahul Maheshwaribb20f732016-10-24 06:27:14 -050033
George Keishing3d734312017-07-24 04:10:25 -050034Verify Boxelder Present Property
35 [Documentation] Boxelder should be present by default.
George Keishing01b59ac2017-11-24 10:43:58 -060036 [Tags] Verify_Boxelder_Present_Property
George Keishing3d734312017-07-24 04:10:25 -050037 # 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 Keishing33dd4432017-09-13 01:48:26 -050051 Should Not Be Equal As Strings
52 ... ${json_data["data"]["SerialNumber"]} 000000000000
53 ... msg=BMC planar serial number invalid.
George Keishing3d734312017-07-24 04:10:25 -050054
55
George Keishinge4e1d272017-11-24 06:05:21 -060056Verify UUID Entry
57 [Documentation] UUID entry should exist in BMC planar property.
58 [Tags] Verify_UUID_Entry
59 # Example:
60 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/boxelder/bmc":
61 # {
62 # "BuildDate": "",
63 # "FieldReplaceable": 0,
64 # "Manufacturer": "IBM",
65 # "Model": "",
66 # "PartNumber": "01DH051",
67 # "Present": 1,
68 # "PrettyName": "BMC PLANAR ",
69 # "SerialNumber": "000000000000"
70 # "UUID": ""
71 # },
72 ${json_data}= Get Inventory system/chassis/motherboard/boxelder/bmc
73 Should Not Be Empty ${json_data["data"]["UUID"]}
74
75
George Keishing3d734312017-07-24 04:10:25 -050076Verify Boxelder MAC Address Property Is Populated
77 [Documentation] Boxelder should be present by default.
78 [Tags] Verify_Boxelder_MAC_Address_Property_Is_Populated
79 # Example:
80 # /xyz/openbmc_project/inventory/system/chassis/motherboard/boxelder/bmc/ethernet
81 # {
82 # "FieldReplaceable": 0,
83 # "MACAddress": "00:00:00:00:00:00",
84 # "Present": 1,
85 # "PrettyName": ""
86 # }
87
88 ${json_data}= Get Inventory
89 ... system/chassis/motherboard/boxelder/bmc/ethernet
90 Should Be True ${json_data["data"]["Present"]}
91 Should Not Be Equal As Strings
92 ... ${json_data["data"]["MACAddress"]} 00:00:00:00:00:00
93
94 # eth0 Link encap:Ethernet HWaddr 70:E2:84:14:23:F9
95 ${mac_addr} ${stderr} ${rc}= BMC Execute Command
96 ... /sbin/ifconfig -a | grep HWaddr | awk -F'HWaddr ' '{print $2}'
97 ... return_stderr=True
98 Should Be Empty ${stderr}
Rahul Maheshwari844dbe72017-09-18 00:24:23 -050099 Should Be Equal As Strings ${json_data["data"]["MACAddress"]}
100 ... ${mac_addr.strip()} msg=MAC address configured incorrectly.
101 ... ignore_case=True
George Keishing3d734312017-07-24 04:10:25 -0500102
103
George Keishingc8166ed2017-02-24 03:53:38 -0600104Verify Chassis Motherboard Properties
105 [Documentation] Check if chassis motherboard properties are
106 ... populated valid.
107 [Tags] Verify_Chassis_Motherboard_Properties
108 # When the host is booted, the following properties should
109 # be populated Manufacturer, PartNumber, SerialNumber and
110 # it should not be zero's.
111 # Example:
112 # "data": {
113 # "/xyz/openbmc_project/inventory/system/chassis/motherboard": {
114 # "BuildDate": "",
115 # "Manufacturer": "0000000000000000",
116 # "Model": "",
117 # "PartNumber": "0000000",
118 # "Present": 0,
119 # "PrettyName": "SYSTEM PLANAR ",
120 # "SerialNumber": "000000000000"
121 # }
122 ${properties}= Get Inventory system/chassis/motherboard
123 Should Not Be Equal As Strings
George Keishingc8166ed2017-02-24 03:53:38 -0600124 ... ${properties["data"]["PartNumber"]} 0000000
125 ... msg=motherboard part number invalid.
126 Should Not Be Equal As Strings
127 ... ${properties["data"]["SerialNumber"]} 000000000000
128 ... msg=motherboard serial number invalid.
Chris Austenb29d2e82016-06-07 12:25:35 -0500129
George Keishingae355302017-03-13 04:34:58 -0500130Verify CPU Present
131 [Documentation] Check if the FRU "Present" is set for CPU's.
132 [Tags] Verify_CPU_Present
133 # System inventory cpu list:
134 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0
135 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu1
136 # Example:
137 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0": {
138 # "FieldReplaceable": 1,
139 # "BuildDate": "",
140 # "Cached": 0,
141 # "SerialNumber": "YA3933741574",
142 # "Version": "10",
143 # "Model": "",
144 # "PrettyName": "PROCESSOR MODULE",
145 # "PartNumber": "01HL322",
146 # "Present": 1,
147 # "Manufacturer": "IBM"
148 # },
149 # The CPU properties "Present" should be boolean 1.
150
151 ${cpu_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system cpu
152 :FOR ${cpu_uri} IN @{cpu_list}
153 \ ${present}= Read Attribute ${cpu_uri} Present
154 \ Should Be True ${present}
155
156
157Verify DIMM Present
158 [Documentation] Check if the FRU "Present" is set for DIMM's.
159 [Tags] Verify_DIMM_Present
160 # Example:
161 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0": {
162 # "FieldReplaceable": 1,
163 # "BuildDate": "",
164 # "Cached": 0,
165 # "SerialNumber": "0x0300cf4f",
166 # "Version": "0x00",
167 # "Model": "M393A1G40EB1-CRC ",
168 # "PrettyName": "0x0c",
169 # "PartNumber": "",
170 # "Present": 1,
171 # "Manufacturer": "0xce80"
172 # },
173
174 # The DIMM properties "Present" should be boolean 1.
175
176 ${dimm_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system dimm
177 :FOR ${dimm_uri} IN @{dimm_list}
178 \ ${present}= Read Attribute ${dimm_uri} Present
179 \ Should Be True ${present}
180
181
George Keishingefa97352017-03-13 07:13:03 -0500182Verify FRU Properties
183 [Documentation] Verify the FRU properties fields.
184 [Tags] Verify_FRU_Properties
185 # Example:
186 # A FRU would have "FieldReplaceable" set to boolean 1 and should have
187 # the following entries
188 # "fru": [
189 # "FieldReplaceable"
190 # "BuildDate",
191 # "Cached"
192 # "SerialNumber",
193 # "Version",
194 # "Model",
195 # "PrettyName",
196 # "PartNumber",
197 # "Present",
198 # "Manufacturer",
199 # ]
200 # and FRU which doesn't have one of this fields is an error.
201 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0": {
202 # "FieldReplaceable": 1,
203 # "BuildDate": "",
204 # "Cached": 0,
205 # "SerialNumber": "0x0300cf4f",
206 # "Version": "0x00",
207 # "Model": "M393A1G40EB1-CRC ",
208 # "PrettyName": "0x0c",
209 # "PartNumber": "",
210 # "Present": 1,
211 # "Manufacturer": "0xce80"
212 # },
213
214 ${system_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system *
215 ${fru_list}= Qualified FRU List @{system_list}
216 Validate FRU Properties Fields @{fru_list}
217
George Keishing071d8da2017-03-24 09:13:16 -0500218
219Verify Core Functional State
220 [Documentation] Verify that "Present" core property is set if "Functional"
221 ... core property is set.
222 [Tags] Verify_Core_Functional_State
223 # Example:
224 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0/core5":{
225 # "Functional": 1,
226 # "Present": 1,
227 # "PrettyName": ""
228 # },
229 ${core_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system core
230 :FOR ${core_uri} IN @{core_list}
231 \ ${status}= Run Keyword And Return Status
232 ... Check URL Property If Functional ${core_uri}
George Keishingc5658392017-04-27 23:05:18 -0500233 \ Continue For Loop If '${status}' == '${False}'
George Keishing071d8da2017-03-24 09:13:16 -0500234 \ ${present}= Read Attribute ${core_uri} Present
235 \ Should Be True ${present}
236 ... msg=${core_uri} is functional but not present.
237
238
239Verify DIMM Functional State
240 [Documentation] Verify that "Present" DIMM property is set if "Functional"
241 ... DIMM property is set.
242 [Tags] Verify_DIMM_Functional_State
243 # Example:
244 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0": {
245 # "BuildDate": "",
246 # "Cached": 0,
247 # "FieldReplaceable": 1,
248 # "Functional": 1,
249 # "Manufacturer": "0xce80",
250 # "Model": "M393A1G40EB1-CRC ",
251 # "PartNumber": "",
252 # "Present": 1,
253 # "PrettyName": "0x0c",
254 # "SerialNumber": "0x0300cf4f",
255 # "Version": "0x00"
256 # },
257
258 ${dimm_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system dimm
259 :FOR ${dimm_uri} IN @{dimm_list}
260 \ ${status}= Run Keyword And Return Status
261 ... Check URL Property If Functional ${dimm_uri}
George Keishingc5658392017-04-27 23:05:18 -0500262 \ Continue For Loop If '${status}' == '${False}'
George Keishing071d8da2017-03-24 09:13:16 -0500263 \ ${present}= Read Attribute ${dimm_uri} Present
264 \ Should Be True ${present}
265 ... msg=${dimm_uri} is functional but not present.
266
George Keishing3c205b12017-05-13 04:09:33 -0500267
268Verify Fan Functional State
269 [Documentation] Verify that "Present" fan property is set if "Functional"
270 ... fan property is set.
271 [Tags] Verify_Fan_Functional_State
272 # Example:
273 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/fan0": {
274 # "Functional": 1,
275 # "Present": 1,
276 # "PrettyName": "fan0"
277 # },
278
279 ${fan_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system fan*
280 Should Not Be Empty ${fan_list}
281 :FOR ${fan_uri} IN @{fan_list}
282 \ ${status}= Run Keyword And Return Status
283 ... Check URL Property If Functional ${fan_uri}
284 \ Continue For Loop If '${status}' == '${False}'
285 \ ${present}= Read Attribute ${fan_uri} Present
286 \ Should Be True ${present}
287 ... msg=${fan_uri} is functional but "Present" is not set.
288
Sweta Potthuri56631f52017-11-10 02:19:38 -0600289Verify CPU Functional State
290 [Documentation] Verify that "Present" CPU property is set if "Functional"
291 ... CPU property is set.
292 [Tags] Verify_CPU_Functional_State
293
294 # Example of cpu* endpoint data:
295 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0": {
296 # "Functional": 1,
297 # "Present": 1,
298 # "PrettyName": "cpu0"
299 # },
300
301 ${cpu_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system cpu*
302 Should Not Be Empty ${cpu_list}
303 :FOR ${cpu_uri} IN @{cpu_list}
304 \ ${status}= Run Keyword And Return Status
305 ... Check URL Property If Functional ${cpu_uri}
306 \ Continue For Loop If '${status}' == '${False}'
307 \ ${present}= Read Attribute ${cpu_uri} Present
308 \ Should Be True ${present}
309 ... msg=${cpu_uri} is functional but "Present" is not set.
George Keishing3c205b12017-05-13 04:09:33 -0500310
George Keishing53a75f72017-11-17 12:50:30 -0600311
312Verify GPU Functional State
313 [Documentation] Verify that "Functional" GPU property is set if "Present"
314 ... GPU property is set
315 [Tags] Verify_GPU_Functional_State
316
317 # Example of gv* endpoint data:
318 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/gv100card4": {
319 # "Functional": 1,
320 # "Present": 1,
321 # "PrettyName": ""
322 # },
323
324
George Keishingc7b161b2017-12-01 09:58:12 -0600325 ${gpu_list}= Get Endpoint Paths
326 ... ${HOST_INVENTORY_URI}system/chassis/motherboard gv*
George Keishing53a75f72017-11-17 12:50:30 -0600327 Should Not Be Empty ${gpu_list}
328 :FOR ${gpu_uri} IN @{gpu_list}
329 \ ${status}= Run Keyword And Return Status
330 ... Check URL Property If Functional ${gpu_uri}
331 \ Continue For Loop If '${status}' == '${False}'
332 \ ${present}= Read Attribute ${gpu_uri} Present
333 \ Should Be True ${present}
334 ... msg=${gpu_uri} is functional but "Present" is not set.
335
336
George Keishing04c6b2c2017-06-15 12:33:59 -0500337Check Air Or Water Cooled
338 [Documentation] Check if this system is Air or water cooled.
339 [Tags] Check_Air_Or_Water_Cooled
340 # Example:
341 # "/xyz/openbmc_project/inventory/system/chassis": {
342 # "AirCooled": 1,
343 # "WaterCooled": 0
344 # },
345
346 ${air_cooled}= Read Attribute
347 ... /xyz/openbmc_project/inventory/system/chassis AirCooled
348 Log AirCooled:${air_cooled}
349
350 ${water_cooled}= Read Attribute
351 ... /xyz/openbmc_project/inventory/system/chassis WaterCooled
352 Log WaterCooled:${water_cooled}
353
354 Run Keyword If ${air_cooled}==${0} and ${water_cooled}==${0}
355 ... Fail Neither AirCooled or WaterCooled.
356
Sweta Potthuri1a640de2017-07-18 11:09:59 -0500357Verify Minimal CPU Inventory
358 [Documentation] Verify minimal CPU inventory.
359 [Tags] Verify_Minimal_CPU_Inventory
360
361 # item minimum_count
362 cpu 1
363 [Template] Minimum Inventory
364
365Verify Minimal DIMM Inventory
366 [Documentation] Verify minimal DIMM inventory.
367 [Tags] Verify_Minimal_DIMM_Inventory
368
369 # item minimum_count
370 dimm 2
371 [Template] Minimum Inventory
372
373Verify Minimal Core Inventory
374 [Documentation] Verify minimal core inventory.
375 [Tags] Verify_Minimal_Core_Inventory
376
377 # item minimum_count
378 core 1
379 [Template] Minimum Inventory
380
381Verify Minimal Memory Buffer Inventory
382 [Documentation] Verify minimal memory buffer inventory.
383 [Tags] Verify_Minimal_Memory_Buffer_Inventory
384
385 # item minimum_count
386 memory_buffer 1
387 [Template] Minimum Inventory
388
389Verify Minimal Fan Inventory
390 [Documentation] Verify minimal fan inventory.
391 [Tags] Verify_Minimal_Fan_Inventory
392
393 # item minimum_count
394 fan 2
395 [Template] Minimum Inventory
396
397Verify Minimal Main Planar Inventory
398 [Documentation] Verify minimal main planar inventory.
399 [Tags] Verify_Minimal_Main_Planar_Inventory
400
401 # item minimum_count
402 main_planar 1
403 [Template] Minimum Inventory
404
405Verify Minimal System Inventory
406 [Documentation] Verify minimal system inventory.
407 [Tags] Verify_Minimal_System_Inventory
408
409 # item minimum_count
410 system 1
411 [Template] Minimum Inventory
George Keishing04c6b2c2017-06-15 12:33:59 -0500412
George Keishing03ebc292017-08-02 01:22:02 -0500413Verify Minimal Power Supply Inventory
414 [Documentation] Verify minimal power supply inventory.
415 [Tags] Verify_Minimal_Power_Supply_Inventory
416 # Example:
George Keishing1b71f222017-11-23 14:02:49 -0600417 # "/xyz/openbmc_project/inventory/system/chassis/powersupply0",
418 # "/xyz/openbmc_project/inventory/system/chassis/powersupply1",
George Keishing03ebc292017-08-02 01:22:02 -0500419
420 # item minimum_count
George Keishing1b71f222017-11-23 14:02:49 -0600421 powersupply 1
George Keishing03ebc292017-08-02 01:22:02 -0500422 [Template] Minimum Inventory
423
George Keishingfafbfdb2017-08-30 23:51:23 -0500424
425Verify Inventory List After Reboot
426 [Documentation] Verify inventory list after reboot.
427 [Tags] Verify_Inventory_List_After_Reboot
428
429 Repeat Keyword ${LOOP_COUNT} times Choose Boot Option reboot
430
431
432Verify Inventory List After Reset
433 [Documentation] Verify inventory list after reset.
434 [Tags] Verify_Inventory_List_After_Reset
435
436 Repeat Keyword ${LOOP_COUNT} times Choose Boot Option reset
437
Chris Austenb29d2e82016-06-07 12:25:35 -0500438*** Keywords ***
439
George Keishingc8166ed2017-02-24 03:53:38 -0600440Test Suite Setup
441 [Documentation] Do the initial suite setup.
George Keishing25577a22017-07-12 05:18:46 -0500442
Sweta Potthuriaf741cb2017-07-04 09:41:17 -0500443 # Boot Host.
444 REST Power On
George Keishingcaac9f32017-03-09 02:14:27 -0600445
George Keishingc8166ed2017-02-24 03:53:38 -0600446Get Inventory
447 [Documentation] Get the properties of an endpoint.
448 [Arguments] ${endpoint}
449 # Description of arguments:
450 # endpoint string for which url path ending.
451 # Example: "system" is the endpoint for url
452 # /xyz/openbmc_project/inventory/system
453 ${resp}= OpenBMC Get Request ${HOST_INVENTORY_URI}${endpoint}
454 Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
455 ${jsondata}= To JSON ${resp.content}
456 [Return] ${jsondata}
George Keishingefa97352017-03-13 07:13:03 -0500457
458
459Qualified FRU List
460 [Documentation] Build the list of valid FRUs.
461 [Arguments] @{system_list}
462 # Description of arguments:
463 # system_list List of system inventory URLs.
464 # Example:
465 # /xyz/openbmc_project/inventory/system/chassis/motherboard
466 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0
467 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu1
468 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0
469 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm1
470 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm2
471 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm3
472 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm4
473 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm5
474 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm6
475 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm7
476
477 ${fru_list}= Create List
478 :FOR ${fru_uri} IN @{system_list}
George Keishingdf5ab122017-04-17 04:01:11 -0500479 \ ${resp}= OpenBMC Get Request ${fru_uri}/attr/FieldReplaceable
480 \ ${jsondata}= To JSON ${resp.content}
481 \ ${status}= Run Keyword And Return Status
482 ... Should Be True ${jsondata['data']} == ${1}
George Keishingefa97352017-03-13 07:13:03 -0500483 \ Run Keyword If '${status}' == '${True}'
484 ... Append To List ${fru_list} ${fru_uri}
485
486 [Return] ${fru_list}
487
488
489Validate FRU Properties Fields
490 [Documentation] Compare valid FRUs from system vs expected FRU set.
491 [Arguments] @{fru_list}
492 # Description of arguments:
493 # fru_list List of qualified FRU URLs.
494
495 # Build the pre-defined set list from data/inventory.py derived from
496 # a group of YAML files.
497 # Example:
498 # set(['Version', 'PartNumber', 'SerialNumber', 'FieldReplaceable',
499 # 'BuildDate', 'Present', 'Manufacturer', 'PrettyName', 'Cached', 'Model'])
500 ${fru_set}= List To Set ${inventory_dict['fru']}
501
502 # Iterate through the FRU's url and compare the set dictionary keys
503 # with the pre-define inventory data.
504 :FOR ${fru_url_path} IN @{fru_list}
505 \ ${fru_field}= Read Properties ${fru_url_path}
506 # ------------------------------------------------------------
507 # ${fru_field.viewkeys()} extracts the list of keys from the
508 # JSON dictionary as a set.
509 # ------------------------------------------------------------
510 \ Should Be Equal ${fru_field.viewkeys()} ${fru_set}
511
George Keishing071d8da2017-03-24 09:13:16 -0500512
513Check URL Property If Functional
514 [Arguments] ${url_path}
515 # Description of arguments:
516 # url_path Full url path of the inventory object.
517 # Example: DIMM / core property url's
518 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0
519 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0/core0
520 ${state}= Read Attribute ${url_path} Functional
521 Should Be True ${state}
Sweta Potthuri654cbc02017-06-15 10:10:55 -0500522
George Keishingfafbfdb2017-08-30 23:51:23 -0500523Choose Boot Option
524 [Documentation] Choose BMC reset or host reboot.
525 [Arguments] ${option}
Sweta Potthuri654cbc02017-06-15 10:10:55 -0500526
George Keishingfafbfdb2017-08-30 23:51:23 -0500527 Run Keyword If '${option}' == 'reboot'
528 ... Verify Inventory List Before And After Reboot
529 ... ELSE
530 ... Verify Inventory List Before And After Reset
531
532
533Verify Inventory List Before And After Reboot
534 [Documentation] Verify inventory list before and after reboot.
535
536 REST Power On
537 Delete Error Logs
538 ${inventory_before}= Get URL List ${HOST_INVENTORY_URI}
Sweta Potthuri654cbc02017-06-15 10:10:55 -0500539 Initiate Host Reboot
George Keishingf0680ee2017-08-19 15:22:53 -0500540 Wait Until Keyword Succeeds 10 min 10 sec Is OS Booted
George Keishingfafbfdb2017-08-30 23:51:23 -0500541 Delete Error Logs
542 ${inventory_after}= Get URL List ${HOST_INVENTORY_URI}
543 Lists Should Be Equal ${inventory_before} ${inventory_after}
544
545
546Verify Inventory List Before And After Reset
547 [Documentation] Verify inventory list before and after BMC reset.
548
549 REST Power On
550 Delete Error Logs
551 ${inventory_before}= Get URL List ${HOST_INVENTORY_URI}
552 OBMC Reboot (run)
553 Delete Error Logs
554 ${inventory_after}= Get URL List ${HOST_INVENTORY_URI}
555 Lists Should Be Equal ${inventory_before} ${inventory_after}
556
Sweta Potthuri1a640de2017-07-18 11:09:59 -0500557
558Minimum Inventory
559 [Documentation] Check for minimum inventory.
560 [Arguments] ${item} ${minimum_count}
561
562 # Description of argument(s):
563 # item Inventory name (example: "fan/cpu/dimm/etc").
564 # minimum_count The minimum number of the given item.
565
566 ${count}= Get Number Hardware Items ${item}
567 Should Be True ${count}>=${minimum_count}
568
569Get Number Hardware Items
570 [Documentation] Get the count of the total present currently on inventory.
571 [Arguments] ${item}
572
573 # Description of argument(s):
574 # item Inventory name (example: "fan/cpu/dimm/etc").
575
576 ${count_inventory} Set Variable ${0}
577 ${list}= Get Endpoint Paths ${HOST_INVENTORY_URI}/system/
578 ... ${item}
579
580 : FOR ${element} IN @{list}
581 \ ${present}= Read Properties ${element}
582 \ ${count_inventory}= Set Variable if ${present['Present']} == 1
583 \ ... ${count_inventory+1} ${count_inventory}
584 [return] ${count_inventory}