blob: f31219e08eed3e7ead11f739908aea1f851f495e [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 Keishingda0aa882017-12-05 06:44:03 -060015Suite Setup Suite Setup Execution
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}
George Keishingda0aa882017-12-05 06:44:03 -0600216 Validate FRU Properties Fields fru @{fru_list}
217
218
219Verify GPU Properties
220 [Documentation] Verify the GPU properties fields.
221 [Tags] Verify_GPU_Properties
222 # Example:
223 # A GPU property should have the following entries:
224 # "gpu":[
225 # "PrettyName",
226 # "Present",
227 # "Functional"
228 # ]
229 # GPU inventory:
230 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/gv100card2": {
231 # "Functional": 1,
232 # "Present": 1,
233 # "PrettyName": ""
234 # },
235
236
237 ${system_list}= Get Endpoint Paths
238 ... ${HOST_INVENTORY_URI}system/chassis/motherboard gv*
239 Validate FRU Properties Fields gpu @{system_list}
240
241
242Verify Core Properties
243 [Documentation] Verify the core property fields.
244 [Tags] Verify_Core_Properties
245 # Example:
246 # A core property should have the following entries:
247 # "core":[
248 # "PrettyName",
249 # "Present",
250 # "Functional"
251 # ]
252 # core inventory:
253 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu1/core0": {
254 # "Functional": 1,
255 # "Present": 1,
256 # "PrettyName": ""
257 # },
258
259 ${system_list}= Get Endpoint Paths
260 ... ${HOST_INVENTORY_URI}system/chassis/motherboard core*
261 Validate FRU Properties Fields core @{system_list}
262
George Keishingefa97352017-03-13 07:13:03 -0500263
George Keishing071d8da2017-03-24 09:13:16 -0500264
265Verify Core Functional State
266 [Documentation] Verify that "Present" core property is set if "Functional"
267 ... core property is set.
268 [Tags] Verify_Core_Functional_State
269 # Example:
270 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0/core5":{
271 # "Functional": 1,
272 # "Present": 1,
273 # "PrettyName": ""
274 # },
275 ${core_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system core
276 :FOR ${core_uri} IN @{core_list}
277 \ ${status}= Run Keyword And Return Status
278 ... Check URL Property If Functional ${core_uri}
George Keishingc5658392017-04-27 23:05:18 -0500279 \ Continue For Loop If '${status}' == '${False}'
George Keishing071d8da2017-03-24 09:13:16 -0500280 \ ${present}= Read Attribute ${core_uri} Present
281 \ Should Be True ${present}
282 ... msg=${core_uri} is functional but not present.
283
284
285Verify DIMM Functional State
286 [Documentation] Verify that "Present" DIMM property is set if "Functional"
287 ... DIMM property is set.
288 [Tags] Verify_DIMM_Functional_State
289 # Example:
290 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0": {
291 # "BuildDate": "",
292 # "Cached": 0,
293 # "FieldReplaceable": 1,
294 # "Functional": 1,
295 # "Manufacturer": "0xce80",
296 # "Model": "M393A1G40EB1-CRC ",
297 # "PartNumber": "",
298 # "Present": 1,
299 # "PrettyName": "0x0c",
300 # "SerialNumber": "0x0300cf4f",
301 # "Version": "0x00"
302 # },
303
304 ${dimm_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system dimm
305 :FOR ${dimm_uri} IN @{dimm_list}
306 \ ${status}= Run Keyword And Return Status
307 ... Check URL Property If Functional ${dimm_uri}
George Keishingc5658392017-04-27 23:05:18 -0500308 \ Continue For Loop If '${status}' == '${False}'
George Keishing071d8da2017-03-24 09:13:16 -0500309 \ ${present}= Read Attribute ${dimm_uri} Present
310 \ Should Be True ${present}
311 ... msg=${dimm_uri} is functional but not present.
312
George Keishing3c205b12017-05-13 04:09:33 -0500313
314Verify Fan Functional State
315 [Documentation] Verify that "Present" fan property is set if "Functional"
316 ... fan property is set.
317 [Tags] Verify_Fan_Functional_State
318 # Example:
319 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/fan0": {
320 # "Functional": 1,
321 # "Present": 1,
322 # "PrettyName": "fan0"
323 # },
324
325 ${fan_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system fan*
326 Should Not Be Empty ${fan_list}
327 :FOR ${fan_uri} IN @{fan_list}
328 \ ${status}= Run Keyword And Return Status
329 ... Check URL Property If Functional ${fan_uri}
330 \ Continue For Loop If '${status}' == '${False}'
331 \ ${present}= Read Attribute ${fan_uri} Present
332 \ Should Be True ${present}
333 ... msg=${fan_uri} is functional but "Present" is not set.
334
Sweta Potthuri56631f52017-11-10 02:19:38 -0600335Verify CPU Functional State
336 [Documentation] Verify that "Present" CPU property is set if "Functional"
337 ... CPU property is set.
338 [Tags] Verify_CPU_Functional_State
339
340 # Example of cpu* endpoint data:
341 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0": {
342 # "Functional": 1,
343 # "Present": 1,
344 # "PrettyName": "cpu0"
345 # },
346
347 ${cpu_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system cpu*
348 Should Not Be Empty ${cpu_list}
349 :FOR ${cpu_uri} IN @{cpu_list}
350 \ ${status}= Run Keyword And Return Status
351 ... Check URL Property If Functional ${cpu_uri}
352 \ Continue For Loop If '${status}' == '${False}'
353 \ ${present}= Read Attribute ${cpu_uri} Present
354 \ Should Be True ${present}
355 ... msg=${cpu_uri} is functional but "Present" is not set.
George Keishing3c205b12017-05-13 04:09:33 -0500356
George Keishing53a75f72017-11-17 12:50:30 -0600357
358Verify GPU Functional State
359 [Documentation] Verify that "Functional" GPU property is set if "Present"
360 ... GPU property is set
361 [Tags] Verify_GPU_Functional_State
362
363 # Example of gv* endpoint data:
364 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/gv100card4": {
365 # "Functional": 1,
366 # "Present": 1,
367 # "PrettyName": ""
368 # },
369
370
George Keishingc7b161b2017-12-01 09:58:12 -0600371 ${gpu_list}= Get Endpoint Paths
372 ... ${HOST_INVENTORY_URI}system/chassis/motherboard gv*
George Keishing53a75f72017-11-17 12:50:30 -0600373 Should Not Be Empty ${gpu_list}
374 :FOR ${gpu_uri} IN @{gpu_list}
375 \ ${status}= Run Keyword And Return Status
376 ... Check URL Property If Functional ${gpu_uri}
377 \ Continue For Loop If '${status}' == '${False}'
378 \ ${present}= Read Attribute ${gpu_uri} Present
379 \ Should Be True ${present}
380 ... msg=${gpu_uri} is functional but "Present" is not set.
381
382
George Keishing04c6b2c2017-06-15 12:33:59 -0500383Check Air Or Water Cooled
384 [Documentation] Check if this system is Air or water cooled.
385 [Tags] Check_Air_Or_Water_Cooled
386 # Example:
387 # "/xyz/openbmc_project/inventory/system/chassis": {
388 # "AirCooled": 1,
389 # "WaterCooled": 0
390 # },
391
392 ${air_cooled}= Read Attribute
393 ... /xyz/openbmc_project/inventory/system/chassis AirCooled
394 Log AirCooled:${air_cooled}
395
396 ${water_cooled}= Read Attribute
397 ... /xyz/openbmc_project/inventory/system/chassis WaterCooled
398 Log WaterCooled:${water_cooled}
399
400 Run Keyword If ${air_cooled}==${0} and ${water_cooled}==${0}
401 ... Fail Neither AirCooled or WaterCooled.
402
Sweta Potthuri1a640de2017-07-18 11:09:59 -0500403Verify Minimal CPU Inventory
404 [Documentation] Verify minimal CPU inventory.
405 [Tags] Verify_Minimal_CPU_Inventory
406
407 # item minimum_count
408 cpu 1
409 [Template] Minimum Inventory
410
411Verify Minimal DIMM Inventory
412 [Documentation] Verify minimal DIMM inventory.
413 [Tags] Verify_Minimal_DIMM_Inventory
414
415 # item minimum_count
416 dimm 2
417 [Template] Minimum Inventory
418
419Verify Minimal Core Inventory
420 [Documentation] Verify minimal core inventory.
421 [Tags] Verify_Minimal_Core_Inventory
422
423 # item minimum_count
424 core 1
425 [Template] Minimum Inventory
426
427Verify Minimal Memory Buffer Inventory
428 [Documentation] Verify minimal memory buffer inventory.
429 [Tags] Verify_Minimal_Memory_Buffer_Inventory
430
431 # item minimum_count
432 memory_buffer 1
433 [Template] Minimum Inventory
434
435Verify Minimal Fan Inventory
436 [Documentation] Verify minimal fan inventory.
437 [Tags] Verify_Minimal_Fan_Inventory
438
439 # item minimum_count
440 fan 2
441 [Template] Minimum Inventory
442
443Verify Minimal Main Planar Inventory
444 [Documentation] Verify minimal main planar inventory.
445 [Tags] Verify_Minimal_Main_Planar_Inventory
446
447 # item minimum_count
448 main_planar 1
449 [Template] Minimum Inventory
450
451Verify Minimal System Inventory
452 [Documentation] Verify minimal system inventory.
453 [Tags] Verify_Minimal_System_Inventory
454
455 # item minimum_count
456 system 1
457 [Template] Minimum Inventory
George Keishing04c6b2c2017-06-15 12:33:59 -0500458
George Keishing03ebc292017-08-02 01:22:02 -0500459Verify Minimal Power Supply Inventory
460 [Documentation] Verify minimal power supply inventory.
461 [Tags] Verify_Minimal_Power_Supply_Inventory
462 # Example:
George Keishing1b71f222017-11-23 14:02:49 -0600463 # "/xyz/openbmc_project/inventory/system/chassis/powersupply0",
464 # "/xyz/openbmc_project/inventory/system/chassis/powersupply1",
George Keishing03ebc292017-08-02 01:22:02 -0500465
466 # item minimum_count
George Keishing1b71f222017-11-23 14:02:49 -0600467 powersupply 1
George Keishing03ebc292017-08-02 01:22:02 -0500468 [Template] Minimum Inventory
469
George Keishingfafbfdb2017-08-30 23:51:23 -0500470
471Verify Inventory List After Reboot
472 [Documentation] Verify inventory list after reboot.
473 [Tags] Verify_Inventory_List_After_Reboot
474
475 Repeat Keyword ${LOOP_COUNT} times Choose Boot Option reboot
476
477
478Verify Inventory List After Reset
479 [Documentation] Verify inventory list after reset.
480 [Tags] Verify_Inventory_List_After_Reset
481
482 Repeat Keyword ${LOOP_COUNT} times Choose Boot Option reset
483
Chris Austenb29d2e82016-06-07 12:25:35 -0500484*** Keywords ***
485
George Keishingda0aa882017-12-05 06:44:03 -0600486Suite Setup Execution
George Keishingc8166ed2017-02-24 03:53:38 -0600487 [Documentation] Do the initial suite setup.
George Keishing25577a22017-07-12 05:18:46 -0500488
Sweta Potthuriaf741cb2017-07-04 09:41:17 -0500489 # Boot Host.
George Keishingda0aa882017-12-05 06:44:03 -0600490 REST Power On stack_mode=skip quiet=1
George Keishingcaac9f32017-03-09 02:14:27 -0600491
George Keishingc8166ed2017-02-24 03:53:38 -0600492Get Inventory
493 [Documentation] Get the properties of an endpoint.
494 [Arguments] ${endpoint}
495 # Description of arguments:
496 # endpoint string for which url path ending.
497 # Example: "system" is the endpoint for url
498 # /xyz/openbmc_project/inventory/system
499 ${resp}= OpenBMC Get Request ${HOST_INVENTORY_URI}${endpoint}
500 Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
501 ${jsondata}= To JSON ${resp.content}
502 [Return] ${jsondata}
George Keishingefa97352017-03-13 07:13:03 -0500503
504
505Qualified FRU List
506 [Documentation] Build the list of valid FRUs.
507 [Arguments] @{system_list}
508 # Description of arguments:
509 # system_list List of system inventory URLs.
510 # Example:
511 # /xyz/openbmc_project/inventory/system/chassis/motherboard
512 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0
513 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu1
514 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0
515 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm1
516 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm2
517 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm3
518 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm4
519 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm5
520 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm6
521 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm7
522
523 ${fru_list}= Create List
524 :FOR ${fru_uri} IN @{system_list}
George Keishingdf5ab122017-04-17 04:01:11 -0500525 \ ${resp}= OpenBMC Get Request ${fru_uri}/attr/FieldReplaceable
George Keishingda0aa882017-12-05 06:44:03 -0600526 ... quiet=${1}
George Keishingdf5ab122017-04-17 04:01:11 -0500527 \ ${jsondata}= To JSON ${resp.content}
528 \ ${status}= Run Keyword And Return Status
529 ... Should Be True ${jsondata['data']} == ${1}
George Keishingefa97352017-03-13 07:13:03 -0500530 \ Run Keyword If '${status}' == '${True}'
531 ... Append To List ${fru_list} ${fru_uri}
532
533 [Return] ${fru_list}
534
535
536Validate FRU Properties Fields
537 [Documentation] Compare valid FRUs from system vs expected FRU set.
George Keishingda0aa882017-12-05 06:44:03 -0600538 [Arguments] ${fru_type} @{fru_list}
539
George Keishingefa97352017-03-13 07:13:03 -0500540 # Description of arguments:
George Keishingda0aa882017-12-05 06:44:03 -0600541 # fru_type FRU type name (e.g. "gpu", "fru", "fan", etc.).
George Keishingefa97352017-03-13 07:13:03 -0500542 # fru_list List of qualified FRU URLs.
543
544 # Build the pre-defined set list from data/inventory.py derived from
545 # a group of YAML files.
546 # Example:
547 # set(['Version', 'PartNumber', 'SerialNumber', 'FieldReplaceable',
548 # 'BuildDate', 'Present', 'Manufacturer', 'PrettyName', 'Cached', 'Model'])
George Keishingda0aa882017-12-05 06:44:03 -0600549 ${fru_set}= List To Set ${inventory_dict['${fru_type}']}
George Keishingefa97352017-03-13 07:13:03 -0500550
551 # Iterate through the FRU's url and compare the set dictionary keys
552 # with the pre-define inventory data.
553 :FOR ${fru_url_path} IN @{fru_list}
554 \ ${fru_field}= Read Properties ${fru_url_path}
555 # ------------------------------------------------------------
556 # ${fru_field.viewkeys()} extracts the list of keys from the
557 # JSON dictionary as a set.
558 # ------------------------------------------------------------
559 \ Should Be Equal ${fru_field.viewkeys()} ${fru_set}
560
George Keishing071d8da2017-03-24 09:13:16 -0500561
562Check URL Property If Functional
563 [Arguments] ${url_path}
564 # Description of arguments:
565 # url_path Full url path of the inventory object.
566 # Example: DIMM / core property url's
567 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0
568 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0/core0
569 ${state}= Read Attribute ${url_path} Functional
570 Should Be True ${state}
Sweta Potthuri654cbc02017-06-15 10:10:55 -0500571
George Keishingfafbfdb2017-08-30 23:51:23 -0500572Choose Boot Option
573 [Documentation] Choose BMC reset or host reboot.
574 [Arguments] ${option}
Sweta Potthuri654cbc02017-06-15 10:10:55 -0500575
George Keishingfafbfdb2017-08-30 23:51:23 -0500576 Run Keyword If '${option}' == 'reboot'
577 ... Verify Inventory List Before And After Reboot
578 ... ELSE
579 ... Verify Inventory List Before And After Reset
580
581
582Verify Inventory List Before And After Reboot
583 [Documentation] Verify inventory list before and after reboot.
584
George Keishingda0aa882017-12-05 06:44:03 -0600585 REST Power On stack_mode=skip quiet=1
George Keishingfafbfdb2017-08-30 23:51:23 -0500586 Delete Error Logs
587 ${inventory_before}= Get URL List ${HOST_INVENTORY_URI}
Sweta Potthuri654cbc02017-06-15 10:10:55 -0500588 Initiate Host Reboot
George Keishingf0680ee2017-08-19 15:22:53 -0500589 Wait Until Keyword Succeeds 10 min 10 sec Is OS Booted
George Keishingfafbfdb2017-08-30 23:51:23 -0500590 Delete Error Logs
591 ${inventory_after}= Get URL List ${HOST_INVENTORY_URI}
592 Lists Should Be Equal ${inventory_before} ${inventory_after}
593
594
595Verify Inventory List Before And After Reset
596 [Documentation] Verify inventory list before and after BMC reset.
597
George Keishingda0aa882017-12-05 06:44:03 -0600598 REST Power On stack_mode=skip quiet=1
George Keishingfafbfdb2017-08-30 23:51:23 -0500599 Delete Error Logs
600 ${inventory_before}= Get URL List ${HOST_INVENTORY_URI}
601 OBMC Reboot (run)
602 Delete Error Logs
603 ${inventory_after}= Get URL List ${HOST_INVENTORY_URI}
604 Lists Should Be Equal ${inventory_before} ${inventory_after}
605
Sweta Potthuri1a640de2017-07-18 11:09:59 -0500606
607Minimum Inventory
608 [Documentation] Check for minimum inventory.
609 [Arguments] ${item} ${minimum_count}
610
611 # Description of argument(s):
612 # item Inventory name (example: "fan/cpu/dimm/etc").
613 # minimum_count The minimum number of the given item.
614
615 ${count}= Get Number Hardware Items ${item}
616 Should Be True ${count}>=${minimum_count}
617
618Get Number Hardware Items
619 [Documentation] Get the count of the total present currently on inventory.
620 [Arguments] ${item}
621
622 # Description of argument(s):
623 # item Inventory name (example: "fan/cpu/dimm/etc").
624
625 ${count_inventory} Set Variable ${0}
626 ${list}= Get Endpoint Paths ${HOST_INVENTORY_URI}/system/
627 ... ${item}
628
629 : FOR ${element} IN @{list}
630 \ ${present}= Read Properties ${element}
631 \ ${count_inventory}= Set Variable if ${present['Present']} == 1
632 \ ... ${count_inventory+1} ${count_inventory}
633 [return] ${count_inventory}