blob: 96fdc7db288e7abc55704a813aa7fe8d8f23811c [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
Steven Sombar0d0d1112018-10-09 16:09:59 -050010Resource ../lib/fan_utils.robot
George Keishingefa97352017-03-13 07:13:03 -050011Library ../lib/utilities.py
George Keishing8c9efed2018-02-28 10:45:26 -060012Library Collections
Chris Austenb29d2e82016-06-07 12:25:35 -050013
14Variables ../data/variables.py
George Keishingc8166ed2017-02-24 03:53:38 -060015Variables ../data/inventory.py
Chris Austenb29d2e82016-06-07 12:25:35 -050016
George Keishingda0aa882017-12-05 06:44:03 -060017Suite Setup Suite Setup Execution
Rahul Maheshwari908df572017-02-16 04:41:54 -060018Test Teardown FFDC On Test Case Fail
Chris Austenb29d2e82016-06-07 12:25:35 -050019
Rahul Maheshwari3e9b0de2017-03-20 06:25:44 -050020Force Tags Inventory
21
Sweta Potthuri654cbc02017-06-15 10:10:55 -050022***Variables***
23
24${LOOP_COUNT} ${1}
25
Chris Austenb29d2e82016-06-07 12:25:35 -050026*** Test Cases ***
27
George Keishingc8166ed2017-02-24 03:53:38 -060028Verify System Inventory Path
29 [Documentation] Check if system inventory path exist.
30 [Tags] Verify_System_Inventory_Path
31 # When the host is booted, system inventory path should exist.
32 # Example: /xyz/openbmc_project/inventory/system
33 Get Inventory system
Chris Austenb29d2e82016-06-07 12:25:35 -050034
Rahul Maheshwaribb20f732016-10-24 06:27:14 -050035
George Keishing3d734312017-07-24 04:10:25 -050036Verify Boxelder Present Property
37 [Documentation] Boxelder should be present by default.
George Keishing01b59ac2017-11-24 10:43:58 -060038 [Tags] Verify_Boxelder_Present_Property
George Keishing3d734312017-07-24 04:10:25 -050039 # Example:
40 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/boxelder/bmc":
41 # {
42 # "BuildDate": "",
43 # "FieldReplaceable": 0,
George Keishinge0a81282018-06-08 10:02:30 -050044 # "Manufacturer": "<Manufacturer Name>",
George Keishing3d734312017-07-24 04:10:25 -050045 # "Model": "",
46 # "PartNumber": "01DH051",
47 # "Present": 1,
48 # "PrettyName": "BMC PLANAR ",
49 # "SerialNumber": "000000000000"
50 # },
51 ${json_data}= Get Inventory system/chassis/motherboard/boxelder/bmc
52 Should Be True ${json_data["data"]["Present"]}
George Keishing33dd4432017-09-13 01:48:26 -050053 Should Not Be Equal As Strings
54 ... ${json_data["data"]["SerialNumber"]} 000000000000
55 ... msg=BMC planar serial number invalid.
George Keishing3d734312017-07-24 04:10:25 -050056
57
George Keishinge4e1d272017-11-24 06:05:21 -060058Verify UUID Entry
59 [Documentation] UUID entry should exist in BMC planar property.
60 [Tags] Verify_UUID_Entry
61 # Example:
62 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/boxelder/bmc":
63 # {
64 # "BuildDate": "",
65 # "FieldReplaceable": 0,
George Keishinge0a81282018-06-08 10:02:30 -050066 # "Manufacturer": "<Manufacturer Name>",
George Keishinge4e1d272017-11-24 06:05:21 -060067 # "Model": "",
68 # "PartNumber": "01DH051",
69 # "Present": 1,
70 # "PrettyName": "BMC PLANAR ",
71 # "SerialNumber": "000000000000"
72 # "UUID": ""
73 # },
George Keishingfa239972017-12-11 06:45:05 -060074 ${resp}= OpenBMC Get Request
75 ... ${HOST_INVENTORY_URI}system/chassis/motherboard/boxelder/bmc/attr/UUID
76 Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
George Keishinge4e1d272017-11-24 06:05:21 -060077
78
George Keishing3d734312017-07-24 04:10:25 -050079Verify Boxelder MAC Address Property Is Populated
80 [Documentation] Boxelder should be present by default.
81 [Tags] Verify_Boxelder_MAC_Address_Property_Is_Populated
82 # Example:
83 # /xyz/openbmc_project/inventory/system/chassis/motherboard/boxelder/bmc/ethernet
84 # {
85 # "FieldReplaceable": 0,
86 # "MACAddress": "00:00:00:00:00:00",
87 # "Present": 1,
88 # "PrettyName": ""
89 # }
90
91 ${json_data}= Get Inventory
92 ... system/chassis/motherboard/boxelder/bmc/ethernet
93 Should Be True ${json_data["data"]["Present"]}
94 Should Not Be Equal As Strings
95 ... ${json_data["data"]["MACAddress"]} 00:00:00:00:00:00
96
97 # eth0 Link encap:Ethernet HWaddr 70:E2:84:14:23:F9
98 ${mac_addr} ${stderr} ${rc}= BMC Execute Command
George Keishingb9f2bd22019-04-17 08:20:11 -050099 ... /sbin/ifconfig -a | grep eth0 | grep HWaddr | awk -F'HWaddr ' '{print $2}'
George Keishing3d734312017-07-24 04:10:25 -0500100 ... return_stderr=True
101 Should Be Empty ${stderr}
Rahul Maheshwari844dbe72017-09-18 00:24:23 -0500102 Should Be Equal As Strings ${json_data["data"]["MACAddress"]}
103 ... ${mac_addr.strip()} msg=MAC address configured incorrectly.
104 ... ignore_case=True
George Keishing3d734312017-07-24 04:10:25 -0500105
106
George Keishingc8166ed2017-02-24 03:53:38 -0600107Verify Chassis Motherboard Properties
108 [Documentation] Check if chassis motherboard properties are
109 ... populated valid.
110 [Tags] Verify_Chassis_Motherboard_Properties
111 # When the host is booted, the following properties should
112 # be populated Manufacturer, PartNumber, SerialNumber and
113 # it should not be zero's.
114 # Example:
115 # "data": {
116 # "/xyz/openbmc_project/inventory/system/chassis/motherboard": {
117 # "BuildDate": "",
118 # "Manufacturer": "0000000000000000",
119 # "Model": "",
120 # "PartNumber": "0000000",
121 # "Present": 0,
122 # "PrettyName": "SYSTEM PLANAR ",
123 # "SerialNumber": "000000000000"
124 # }
125 ${properties}= Get Inventory system/chassis/motherboard
126 Should Not Be Equal As Strings
George Keishingc8166ed2017-02-24 03:53:38 -0600127 ... ${properties["data"]["PartNumber"]} 0000000
128 ... msg=motherboard part number invalid.
129 Should Not Be Equal As Strings
130 ... ${properties["data"]["SerialNumber"]} 000000000000
131 ... msg=motherboard serial number invalid.
Chris Austenb29d2e82016-06-07 12:25:35 -0500132
George Keishingae355302017-03-13 04:34:58 -0500133Verify CPU Present
134 [Documentation] Check if the FRU "Present" is set for CPU's.
135 [Tags] Verify_CPU_Present
136 # System inventory cpu list:
137 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0
138 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu1
139 # Example:
140 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0": {
141 # "FieldReplaceable": 1,
142 # "BuildDate": "",
143 # "Cached": 0,
144 # "SerialNumber": "YA3933741574",
145 # "Version": "10",
146 # "Model": "",
147 # "PrettyName": "PROCESSOR MODULE",
148 # "PartNumber": "01HL322",
149 # "Present": 1,
George Keishinge0a81282018-06-08 10:02:30 -0500150 # "Manufacturer": "<Manufacturer Name>"
George Keishingae355302017-03-13 04:34:58 -0500151 # },
152 # The CPU properties "Present" should be boolean 1.
153
154 ${cpu_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system cpu
Sushil Singhbe97ffc2019-06-04 06:34:24 -0500155 FOR ${cpu_uri} IN @{cpu_list}
156 ${present}= Read Attribute ${cpu_uri} Present
157 Should Be True ${present}
158 END
George Keishingae355302017-03-13 04:34:58 -0500159
160Verify DIMM Present
161 [Documentation] Check if the FRU "Present" is set for DIMM's.
162 [Tags] Verify_DIMM_Present
163 # Example:
164 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0": {
165 # "FieldReplaceable": 1,
166 # "BuildDate": "",
167 # "Cached": 0,
168 # "SerialNumber": "0x0300cf4f",
169 # "Version": "0x00",
170 # "Model": "M393A1G40EB1-CRC ",
171 # "PrettyName": "0x0c",
172 # "PartNumber": "",
173 # "Present": 1,
174 # "Manufacturer": "0xce80"
175 # },
176
177 # The DIMM properties "Present" should be boolean 1.
178
179 ${dimm_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system dimm
Sushil Singhbe97ffc2019-06-04 06:34:24 -0500180 FOR ${dimm_uri} IN @{dimm_list}
181 ${present}= Read Attribute ${dimm_uri} Present
182 Should Be True ${present}
183 END
George Keishingae355302017-03-13 04:34:58 -0500184
George Keishingefa97352017-03-13 07:13:03 -0500185Verify FRU Properties
186 [Documentation] Verify the FRU properties fields.
187 [Tags] Verify_FRU_Properties
188 # Example:
189 # A FRU would have "FieldReplaceable" set to boolean 1 and should have
190 # the following entries
191 # "fru": [
192 # "FieldReplaceable"
193 # "BuildDate",
194 # "Cached"
195 # "SerialNumber",
196 # "Version",
197 # "Model",
198 # "PrettyName",
199 # "PartNumber",
200 # "Present",
201 # "Manufacturer",
202 # ]
203 # and FRU which doesn't have one of this fields is an error.
204 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0": {
205 # "FieldReplaceable": 1,
206 # "BuildDate": "",
207 # "Cached": 0,
208 # "SerialNumber": "0x0300cf4f",
209 # "Version": "0x00",
210 # "Model": "M393A1G40EB1-CRC ",
211 # "PrettyName": "0x0c",
212 # "PartNumber": "",
213 # "Present": 1,
214 # "Manufacturer": "0xce80"
215 # },
216
217 ${system_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system *
218 ${fru_list}= Qualified FRU List @{system_list}
Steven Sombar0d0d1112018-10-09 16:09:59 -0500219 Validate FRU Properties Fields fru EQU @{fru_list}
George Keishingda0aa882017-12-05 06:44:03 -0600220
221
222Verify GPU Properties
223 [Documentation] Verify the GPU properties fields.
224 [Tags] Verify_GPU_Properties
225 # Example:
226 # A GPU property should have the following entries:
227 # "gpu":[
George Keishing0219da62018-03-26 03:24:40 -0500228 # "FieldReplaceable",
George Keishingda0aa882017-12-05 06:44:03 -0600229 # "PrettyName",
230 # "Present",
231 # "Functional"
232 # ]
233 # GPU inventory:
234 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/gv100card2": {
George Keishing0219da62018-03-26 03:24:40 -0500235 # "FieldReplaceable": 1,
George Keishingda0aa882017-12-05 06:44:03 -0600236 # "Functional": 1,
237 # "Present": 1,
238 # "PrettyName": ""
239 # },
240
241
242 ${system_list}= Get Endpoint Paths
243 ... ${HOST_INVENTORY_URI}system/chassis/motherboard gv*
Steven Sombar0d0d1112018-10-09 16:09:59 -0500244 Validate FRU Properties Fields gpu EQU @{system_list}
George Keishingda0aa882017-12-05 06:44:03 -0600245
246
247Verify Core Properties
248 [Documentation] Verify the core property fields.
249 [Tags] Verify_Core_Properties
250 # Example:
251 # A core property should have the following entries:
252 # "core":[
253 # "PrettyName",
254 # "Present",
255 # "Functional"
256 # ]
257 # core inventory:
258 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu1/core0": {
259 # "Functional": 1,
260 # "Present": 1,
261 # "PrettyName": ""
262 # },
263
264 ${system_list}= Get Endpoint Paths
265 ... ${HOST_INVENTORY_URI}system/chassis/motherboard core*
Steven Sombar0d0d1112018-10-09 16:09:59 -0500266 Validate FRU Properties Fields core EQU @{system_list}
George Keishingda0aa882017-12-05 06:44:03 -0600267
George Keishingefa97352017-03-13 07:13:03 -0500268
George Keishingca8c61b2017-12-11 11:48:00 -0600269Verify Fan Properties
270 [Documentation] Verify the fan property fields.
271 [Tags] Verify_Fan_Properties
272 # Example:
273 # A fan property should have the following entries:
274 # "core":[
275 # "PrettyName",
276 # "Present",
277 # "MeetsMinimumShipLevel",
278 # "Functional"
279 # ]
280 # fan inventory:
281 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/fan0": {
282 # "Functional": 1,
283 # "MeetsMinimumShipLevel": 1,
284 # "Present": 1,
285 # "PrettyName": "fan0"
286 # },
287
Steven Sombar0d0d1112018-10-09 16:09:59 -0500288 ${water_cooled}= Is Water Cooled
289
George Keishingca8c61b2017-12-11 11:48:00 -0600290 ${system_list}= Get Endpoint Paths
291 ... ${HOST_INVENTORY_URI}system/chassis/motherboard fan*
Steven Sombar0d0d1112018-10-09 16:09:59 -0500292
Michael Walshc108e422019-03-28 12:27:18 -0500293 Printn
Steven Sombar0d0d1112018-10-09 16:09:59 -0500294 Rprint Vars water_cooled system_list
295
296 Run Keyword If ${water_cooled}
297 ... Validate FRU Properties Fields fan_wc SUBSET @{system_list}
298 ... ELSE
299 ... Validate FRU Properties Fields fan EQU @{system_list}
George Keishingca8c61b2017-12-11 11:48:00 -0600300
George Keishing071d8da2017-03-24 09:13:16 -0500301
302Verify Core Functional State
303 [Documentation] Verify that "Present" core property is set if "Functional"
304 ... core property is set.
305 [Tags] Verify_Core_Functional_State
306 # Example:
307 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0/core5":{
308 # "Functional": 1,
309 # "Present": 1,
310 # "PrettyName": ""
311 # },
312 ${core_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system core
Sushil Singhbe97ffc2019-06-04 06:34:24 -0500313 FOR ${core_uri} IN @{core_list}
314 ${status}= Run Keyword And Return Status
315 ... Check URL Property Is Functional ${core_uri}
316 Continue For Loop If '${status}' == '${False}'
317 ${present}= Read Attribute ${core_uri} Present
318 Should Be True ${present}
319 ... msg=${core_uri} is functional but not present.
320 END
George Keishing071d8da2017-03-24 09:13:16 -0500321
322
323Verify DIMM Functional State
324 [Documentation] Verify that "Present" DIMM property is set if "Functional"
325 ... DIMM property is set.
326 [Tags] Verify_DIMM_Functional_State
327 # Example:
328 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0": {
329 # "BuildDate": "",
330 # "Cached": 0,
331 # "FieldReplaceable": 1,
332 # "Functional": 1,
333 # "Manufacturer": "0xce80",
334 # "Model": "M393A1G40EB1-CRC ",
335 # "PartNumber": "",
336 # "Present": 1,
337 # "PrettyName": "0x0c",
338 # "SerialNumber": "0x0300cf4f",
339 # "Version": "0x00"
340 # },
341
342 ${dimm_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system dimm
Sushil Singhbe97ffc2019-06-04 06:34:24 -0500343 FOR ${dimm_uri} IN @{dimm_list}
344 ${status}= Run Keyword And Return Status
345 ... Check URL Property Is Functional ${dimm_uri}
346 Continue For Loop If '${status}' == '${False}'
347 ${present}= Read Attribute ${dimm_uri} Present
348 Should Be True ${present}
349 ... msg=${dimm_uri} is functional but not present.
350 END
George Keishing071d8da2017-03-24 09:13:16 -0500351
George Keishing3c205b12017-05-13 04:09:33 -0500352
353Verify Fan Functional State
354 [Documentation] Verify that "Present" fan property is set if "Functional"
355 ... fan property is set.
356 [Tags] Verify_Fan_Functional_State
357 # Example:
358 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/fan0": {
359 # "Functional": 1,
360 # "Present": 1,
361 # "PrettyName": "fan0"
362 # },
363
364 ${fan_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system fan*
365 Should Not Be Empty ${fan_list}
Sushil Singhbe97ffc2019-06-04 06:34:24 -0500366 FOR ${fan_uri} IN @{fan_list}
367 ${status}= Run Keyword And Return Status
368 ... Check URL Property Is Functional ${fan_uri}
369 Continue For Loop If '${status}' == '${False}'
370 ${present}= Read Attribute ${fan_uri} Present
371 Should Be True ${present}
372 ... msg=${fan_uri} is functional but "Present" is not set.
373 END
374
George Keishing3c205b12017-05-13 04:09:33 -0500375
Sweta Potthuri56631f52017-11-10 02:19:38 -0600376Verify CPU Functional State
377 [Documentation] Verify that "Present" CPU property is set if "Functional"
378 ... CPU property is set.
379 [Tags] Verify_CPU_Functional_State
380
381 # Example of cpu* endpoint data:
382 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0": {
383 # "Functional": 1,
384 # "Present": 1,
385 # "PrettyName": "cpu0"
386 # },
387
388 ${cpu_list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system cpu*
389 Should Not Be Empty ${cpu_list}
Sushil Singhbe97ffc2019-06-04 06:34:24 -0500390 FOR ${cpu_uri} IN @{cpu_list}
391 ${status}= Run Keyword And Return Status
392 ... Check URL Property Is Functional ${cpu_uri}
393 Continue For Loop If '${status}' == '${False}'
394 ${present}= Read Attribute ${cpu_uri} Present
395 Should Be True ${present}
396 ... msg=${cpu_uri} is functional but "Present" is not set.
397 END
George Keishing3c205b12017-05-13 04:09:33 -0500398
George Keishing53a75f72017-11-17 12:50:30 -0600399
400Verify GPU Functional State
401 [Documentation] Verify that "Functional" GPU property is set if "Present"
402 ... GPU property is set
403 [Tags] Verify_GPU_Functional_State
404
405 # Example of gv* endpoint data:
406 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/gv100card4": {
407 # "Functional": 1,
408 # "Present": 1,
409 # "PrettyName": ""
410 # },
411
412
George Keishingc7b161b2017-12-01 09:58:12 -0600413 ${gpu_list}= Get Endpoint Paths
414 ... ${HOST_INVENTORY_URI}system/chassis/motherboard gv*
George Keishing53a75f72017-11-17 12:50:30 -0600415 Should Not Be Empty ${gpu_list}
Sushil Singhbe97ffc2019-06-04 06:34:24 -0500416 FOR ${gpu_uri} IN @{gpu_list}
417 ${status}= Run Keyword And Return Status
418 ... Check URL Property Is Functional ${gpu_uri}
419 Continue For Loop If '${status}' == '${False}'
420 ${present}= Read Attribute ${gpu_uri} Present
421 Should Be True ${present}
422 ... msg=${gpu_uri} is functional but "Present" is not set.
423 END
George Keishing53a75f72017-11-17 12:50:30 -0600424
George Keishing04c6b2c2017-06-15 12:33:59 -0500425Check Air Or Water Cooled
426 [Documentation] Check if this system is Air or water cooled.
427 [Tags] Check_Air_Or_Water_Cooled
428 # Example:
429 # "/xyz/openbmc_project/inventory/system/chassis": {
430 # "AirCooled": 1,
431 # "WaterCooled": 0
432 # },
433
434 ${air_cooled}= Read Attribute
435 ... /xyz/openbmc_project/inventory/system/chassis AirCooled
436 Log AirCooled:${air_cooled}
437
438 ${water_cooled}= Read Attribute
439 ... /xyz/openbmc_project/inventory/system/chassis WaterCooled
440 Log WaterCooled:${water_cooled}
441
442 Run Keyword If ${air_cooled}==${0} and ${water_cooled}==${0}
443 ... Fail Neither AirCooled or WaterCooled.
444
Sweta Potthuri1a640de2017-07-18 11:09:59 -0500445Verify Minimal CPU Inventory
446 [Documentation] Verify minimal CPU inventory.
447 [Tags] Verify_Minimal_CPU_Inventory
George Keishing5abfe602018-07-05 11:54:37 -0500448 [Template] Minimum Inventory
Sweta Potthuri1a640de2017-07-18 11:09:59 -0500449
450 # item minimum_count
451 cpu 1
Sweta Potthuri1a640de2017-07-18 11:09:59 -0500452
453Verify Minimal DIMM Inventory
454 [Documentation] Verify minimal DIMM inventory.
455 [Tags] Verify_Minimal_DIMM_Inventory
George Keishing5abfe602018-07-05 11:54:37 -0500456 [Template] Minimum Inventory
Sweta Potthuri1a640de2017-07-18 11:09:59 -0500457
458 # item minimum_count
459 dimm 2
Sweta Potthuri1a640de2017-07-18 11:09:59 -0500460
461Verify Minimal Core Inventory
462 [Documentation] Verify minimal core inventory.
463 [Tags] Verify_Minimal_Core_Inventory
George Keishing5abfe602018-07-05 11:54:37 -0500464 [Template] Minimum Inventory
Sweta Potthuri1a640de2017-07-18 11:09:59 -0500465
466 # item minimum_count
467 core 1
Sweta Potthuri1a640de2017-07-18 11:09:59 -0500468
469Verify Minimal Memory Buffer Inventory
470 [Documentation] Verify minimal memory buffer inventory.
471 [Tags] Verify_Minimal_Memory_Buffer_Inventory
George Keishing5abfe602018-07-05 11:54:37 -0500472 [Template] Minimum Inventory
Sweta Potthuri1a640de2017-07-18 11:09:59 -0500473
474 # item minimum_count
475 memory_buffer 1
Sweta Potthuri1a640de2017-07-18 11:09:59 -0500476
477Verify Minimal Fan Inventory
478 [Documentation] Verify minimal fan inventory.
479 [Tags] Verify_Minimal_Fan_Inventory
George Keishing5abfe602018-07-05 11:54:37 -0500480 [Template] Minimum Inventory
Sweta Potthuri1a640de2017-07-18 11:09:59 -0500481
482 # item minimum_count
483 fan 2
Sweta Potthuri1a640de2017-07-18 11:09:59 -0500484
485Verify Minimal Main Planar Inventory
486 [Documentation] Verify minimal main planar inventory.
487 [Tags] Verify_Minimal_Main_Planar_Inventory
George Keishing5abfe602018-07-05 11:54:37 -0500488 [Template] Minimum Inventory
Sweta Potthuri1a640de2017-07-18 11:09:59 -0500489
490 # item minimum_count
491 main_planar 1
Sweta Potthuri1a640de2017-07-18 11:09:59 -0500492
493Verify Minimal System Inventory
494 [Documentation] Verify minimal system inventory.
495 [Tags] Verify_Minimal_System_Inventory
George Keishing5abfe602018-07-05 11:54:37 -0500496 [Template] Minimum Inventory
Sweta Potthuri1a640de2017-07-18 11:09:59 -0500497
498 # item minimum_count
499 system 1
George Keishing04c6b2c2017-06-15 12:33:59 -0500500
George Keishing03ebc292017-08-02 01:22:02 -0500501Verify Minimal Power Supply Inventory
502 [Documentation] Verify minimal power supply inventory.
503 [Tags] Verify_Minimal_Power_Supply_Inventory
George Keishing5abfe602018-07-05 11:54:37 -0500504 [Template] Minimum Inventory
George Keishing03ebc292017-08-02 01:22:02 -0500505 # Example:
Matt Spinler6a1e5ed2018-02-14 09:05:07 -0600506 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply0",
507 # "/xyz/openbmc_project/inventory/system/chassis/motherboard/powersupply1",
George Keishing03ebc292017-08-02 01:22:02 -0500508
509 # item minimum_count
George Keishing1b71f222017-11-23 14:02:49 -0600510 powersupply 1
George Keishing03ebc292017-08-02 01:22:02 -0500511
George Keishingfafbfdb2017-08-30 23:51:23 -0500512
513Verify Inventory List After Reboot
514 [Documentation] Verify inventory list after reboot.
515 [Tags] Verify_Inventory_List_After_Reboot
516
517 Repeat Keyword ${LOOP_COUNT} times Choose Boot Option reboot
518
519
520Verify Inventory List After Reset
521 [Documentation] Verify inventory list after reset.
522 [Tags] Verify_Inventory_List_After_Reset
523
524 Repeat Keyword ${LOOP_COUNT} times Choose Boot Option reset
525
Chris Austenb29d2e82016-06-07 12:25:35 -0500526*** Keywords ***
527
George Keishingda0aa882017-12-05 06:44:03 -0600528Suite Setup Execution
George Keishingc8166ed2017-02-24 03:53:38 -0600529 [Documentation] Do the initial suite setup.
George Keishing25577a22017-07-12 05:18:46 -0500530
George Keishing4f5260b2017-12-14 12:28:31 -0600531 Smart Power Off
532 REST Power On
George Keishing8b13fd22018-07-20 12:28:52 -0500533 Delete All Error Logs
George Keishingcaac9f32017-03-09 02:14:27 -0600534
George Keishingc8166ed2017-02-24 03:53:38 -0600535Get Inventory
536 [Documentation] Get the properties of an endpoint.
537 [Arguments] ${endpoint}
538 # Description of arguments:
539 # endpoint string for which url path ending.
540 # Example: "system" is the endpoint for url
541 # /xyz/openbmc_project/inventory/system
542 ${resp}= OpenBMC Get Request ${HOST_INVENTORY_URI}${endpoint}
543 Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
544 ${jsondata}= To JSON ${resp.content}
545 [Return] ${jsondata}
George Keishingefa97352017-03-13 07:13:03 -0500546
547
548Qualified FRU List
549 [Documentation] Build the list of valid FRUs.
550 [Arguments] @{system_list}
551 # Description of arguments:
552 # system_list List of system inventory URLs.
553 # Example:
554 # /xyz/openbmc_project/inventory/system/chassis/motherboard
555 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0
556 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu1
557 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0
558 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm1
559 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm2
560 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm3
561 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm4
562 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm5
563 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm6
564 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm7
565
566 ${fru_list}= Create List
Sushil Singhbe97ffc2019-06-04 06:34:24 -0500567 FOR ${fru_uri} IN @{system_list}
568 ${resp}= OpenBMC Get Request ${fru_uri}/attr/FieldReplaceable
569 ... quiet=${1}
570 ${jsondata}= To JSON ${resp.content}
571 ${status}= Run Keyword And Return Status
572 ... Should Be True ${jsondata['data']} == ${1}
573 Run Keyword If '${status}' == '${True}'
574 ... Append To List ${fru_list} ${fru_uri}
575 END
George Keishingefa97352017-03-13 07:13:03 -0500576
George Keishing8c9efed2018-02-28 10:45:26 -0600577 ${fru_valid_list}= Filter GPU FRU Entries ${fru_list}
578
579 [Return] ${fru_valid_list}
580
581
582Filter GPU FRU Entries
583 [Documentation] Remove GPU entries from FRU list and return the result.
584 [Arguments] ${fru_list}
585
586 # Description of arguments:
587 # fru_list List of FRU system inventory URIs.
588 # Example FRUs list:
589 # [u'/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0',
590 # u'/xyz/openbmc_project/inventory/system/chassis/motherboard/cpu1',
591 # u'/xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0',
592 # u'/xyz/openbmc_project/inventory/system/chassis/motherboard/dimm1',
593 # u'/xyz/openbmc_project/inventory/system/chassis/motherboard/gv100card0',
594 # u'/xyz/openbmc_project/inventory/system/chassis/motherboard/gv100card1',
595 # u'/xyz/openbmc_project/inventory/system/chassis/motherboard/gv100card3',
596 # u'/xyz/openbmc_project/inventory/system/chassis/motherboard/gv100card4']
597
598 # Example of the matched GPU FRUs entries:
599 # [u'/xyz/openbmc_project/inventory/system/chassis/motherboard/gv100card0',
600 # u'/xyz/openbmc_project/inventory/system/chassis/motherboard/gv100card1',
601 # u'/xyz/openbmc_project/inventory/system/chassis/motherboard/gv100card3',
602 # u'/xyz/openbmc_project/inventory/system/chassis/motherboard/gv100card4']
603
604 ${gpu_matches}= Get Matches ${fru_list} *gv*
605
606 Remove Values From List ${fru_list} @{gpu_matches}
George Keishingefa97352017-03-13 07:13:03 -0500607 [Return] ${fru_list}
608
609
610Validate FRU Properties Fields
Steven Sombar0d0d1112018-10-09 16:09:59 -0500611 [Documentation] Compare valid FRUs from system to expected FRU set.
612 [Arguments] ${fru_type} ${comparison_type} @{fru_list}
George Keishingda0aa882017-12-05 06:44:03 -0600613
Steven Sombar0d0d1112018-10-09 16:09:59 -0500614 # Description of argument(s):
615 # fru_type FRU type name (e.g. "gpu", "fru", "fan", etc.).
616 # comparison_type A string indicating the comparison method.
617 # "EQU" for equality, "SUBSET" for subset comparison.
618 # fru_list List of FRU URLs.
George Keishingefa97352017-03-13 07:13:03 -0500619
Steven Sombar0d0d1112018-10-09 16:09:59 -0500620 # Get the pre-defined fru_type attributes from the inventory dictionary
621 # for the fru_type. Example:
George Keishingefa97352017-03-13 07:13:03 -0500622 # set(['Version', 'PartNumber', 'SerialNumber', 'FieldReplaceable',
623 # 'BuildDate', 'Present', 'Manufacturer', 'PrettyName', 'Cached', 'Model'])
George Keishingda0aa882017-12-05 06:44:03 -0600624 ${fru_set}= List To Set ${inventory_dict['${fru_type}']}
George Keishingefa97352017-03-13 07:13:03 -0500625
Steven Sombar0d0d1112018-10-09 16:09:59 -0500626 Rprint Vars fru_set
627
628 # Iterate through the url of the FRU and compare its attributes with
629 # the pre-defined fru_type attributes.
Sushil Singhbe97ffc2019-06-04 06:34:24 -0500630 FOR ${fru_url_path} IN @{fru_list}
631 ${fru_field}= Read Properties ${fru_url_path}
632 ${fru_keys}= List To Set ${fru_field.viewkeys()}
633 Rprint Vars fru_keys
634 Run Keyword If '${comparison_type}' == 'EQU'
635 ... Should Be Equal ${fru_keys} ${fru_set}
636 ... ELSE
637 ... Should Be True $fru_set.issubset($fru_keys)
638 END
George Keishingefa97352017-03-13 07:13:03 -0500639
George Keishing071d8da2017-03-24 09:13:16 -0500640
Joy Onyerikwuf4a807b2018-06-20 08:43:54 -0500641Check URL Property Is Functional
642 [Documentation] Verify that the given url property is functional.
George Keishing071d8da2017-03-24 09:13:16 -0500643 [Arguments] ${url_path}
644 # Description of arguments:
645 # url_path Full url path of the inventory object.
646 # Example: DIMM / core property url's
647 # /xyz/openbmc_project/inventory/system/chassis/motherboard/dimm0
648 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0/core0
649 ${state}= Read Attribute ${url_path} Functional
650 Should Be True ${state}
Sweta Potthuri654cbc02017-06-15 10:10:55 -0500651
George Keishingfafbfdb2017-08-30 23:51:23 -0500652Choose Boot Option
653 [Documentation] Choose BMC reset or host reboot.
654 [Arguments] ${option}
Sweta Potthuri654cbc02017-06-15 10:10:55 -0500655
George Keishingfafbfdb2017-08-30 23:51:23 -0500656 Run Keyword If '${option}' == 'reboot'
657 ... Verify Inventory List Before And After Reboot
658 ... ELSE
659 ... Verify Inventory List Before And After Reset
660
661
662Verify Inventory List Before And After Reboot
663 [Documentation] Verify inventory list before and after reboot.
664
George Keishingda0aa882017-12-05 06:44:03 -0600665 REST Power On stack_mode=skip quiet=1
George Keishing32fe4e12018-07-13 05:06:47 -0500666 Delete All Error Logs
George Keishingfafbfdb2017-08-30 23:51:23 -0500667 ${inventory_before}= Get URL List ${HOST_INVENTORY_URI}
George Keishinga58775d2018-09-06 10:01:27 -0500668 Host Reboot
George Keishing32fe4e12018-07-13 05:06:47 -0500669 Delete All Error Logs
George Keishingfafbfdb2017-08-30 23:51:23 -0500670 ${inventory_after}= Get URL List ${HOST_INVENTORY_URI}
671 Lists Should Be Equal ${inventory_before} ${inventory_after}
672
673
674Verify Inventory List Before And After Reset
675 [Documentation] Verify inventory list before and after BMC reset.
676
George Keishingda0aa882017-12-05 06:44:03 -0600677 REST Power On stack_mode=skip quiet=1
George Keishing32fe4e12018-07-13 05:06:47 -0500678 Delete All Error Logs
George Keishingfafbfdb2017-08-30 23:51:23 -0500679 ${inventory_before}= Get URL List ${HOST_INVENTORY_URI}
680 OBMC Reboot (run)
George Keishing32fe4e12018-07-13 05:06:47 -0500681 Delete All Error Logs
George Keishingfafbfdb2017-08-30 23:51:23 -0500682 ${inventory_after}= Get URL List ${HOST_INVENTORY_URI}
683 Lists Should Be Equal ${inventory_before} ${inventory_after}
684
Sweta Potthuri1a640de2017-07-18 11:09:59 -0500685
686Minimum Inventory
687 [Documentation] Check for minimum inventory.
688 [Arguments] ${item} ${minimum_count}
689
690 # Description of argument(s):
691 # item Inventory name (example: "fan/cpu/dimm/etc").
692 # minimum_count The minimum number of the given item.
693
694 ${count}= Get Number Hardware Items ${item}
695 Should Be True ${count}>=${minimum_count}
696
697Get Number Hardware Items
698 [Documentation] Get the count of the total present currently on inventory.
699 [Arguments] ${item}
700
701 # Description of argument(s):
702 # item Inventory name (example: "fan/cpu/dimm/etc").
703
704 ${count_inventory} Set Variable ${0}
Steven Sombaraaaab222018-12-19 13:16:23 -0600705 ${list}= Get Endpoint Paths ${HOST_INVENTORY_URI}system/
Sweta Potthuri1a640de2017-07-18 11:09:59 -0500706 ... ${item}
707
Sushil Singhbe97ffc2019-06-04 06:34:24 -0500708 FOR ${element} IN @{list}
709 ${present}= Read Properties ${element}
710 ${count_inventory}= Set Variable if ${present['Present']} == 1
711 ... ${count_inventory+1} ${count_inventory}
712 END
Sweta Potthuri1a640de2017-07-18 11:09:59 -0500713 [return] ${count_inventory}