blob: a2cbd60acadff33d7f38bf768b2af4aac1034374 [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
George Keishingefa97352017-03-13 07:13:03 -05009Library ../lib/utilities.py
Chris Austenb29d2e82016-06-07 12:25:35 -050010
11Variables ../data/variables.py
George Keishingc8166ed2017-02-24 03:53:38 -060012Variables ../data/inventory.py
Chris Austenb29d2e82016-06-07 12:25:35 -050013
George Keishingc8166ed2017-02-24 03:53:38 -060014Suite setup Test Suite Setup
Rahul Maheshwari908df572017-02-16 04:41:54 -060015Test Teardown FFDC On Test Case Fail
Chris Austenb29d2e82016-06-07 12:25:35 -050016
Rahul Maheshwari3e9b0de2017-03-20 06:25:44 -050017Force Tags Inventory
18
Sweta Potthuri654cbc02017-06-15 10:10:55 -050019***Variables***
20
21${LOOP_COUNT} ${1}
22
Chris Austenb29d2e82016-06-07 12:25:35 -050023*** Test Cases ***
24
George Keishingc8166ed2017-02-24 03:53:38 -060025Verify 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 Austenb29d2e82016-06-07 12:25:35 -050031
Rahul Maheshwaribb20f732016-10-24 06:27:14 -050032
George Keishingc8166ed2017-02-24 03:53:38 -060033Verify 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 Austenb29d2e82016-06-07 12:25:35 -050061
George Keishingae355302017-03-13 04:34:58 -050062Verify 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
89Verify 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 Keishingefa97352017-03-13 07:13:03 -0500114Verify 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 Keishing071d8da2017-03-24 09:13:16 -0500150
151Verify 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 Keishingc5658392017-04-27 23:05:18 -0500165 \ Continue For Loop If '${status}' == '${False}'
George Keishing071d8da2017-03-24 09:13:16 -0500166 \ ${present}= Read Attribute ${core_uri} Present
167 \ Should Be True ${present}
168 ... msg=${core_uri} is functional but not present.
169
170
171Verify 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 Keishingc5658392017-04-27 23:05:18 -0500194 \ Continue For Loop If '${status}' == '${False}'
George Keishing071d8da2017-03-24 09:13:16 -0500195 \ ${present}= Read Attribute ${dimm_uri} Present
196 \ Should Be True ${present}
197 ... msg=${dimm_uri} is functional but not present.
198
George Keishing3c205b12017-05-13 04:09:33 -0500199
200Verify 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 Potthuri654cbc02017-06-15 10:10:55 -0500221Verify 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 Keishing3c205b12017-05-13 04:09:33 -0500226
George Keishing04c6b2c2017-06-15 12:33:59 -0500227Check 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 Potthuri1a640de2017-07-18 11:09:59 -0500247Verify 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
255Verify 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
263Verify 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
271Verify 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
279Verify 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
287Verify 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
295Verify 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 Keishing04c6b2c2017-06-15 12:33:59 -0500302
Chris Austenb29d2e82016-06-07 12:25:35 -0500303*** Keywords ***
304
George Keishingc8166ed2017-02-24 03:53:38 -0600305Test Suite Setup
306 [Documentation] Do the initial suite setup.
George Keishing25577a22017-07-12 05:18:46 -0500307
308 # Reboot host to re-power on clean if host is not "off".
George Keishingc8166ed2017-02-24 03:53:38 -0600309 ${current_state}= Get Host State
310 Run Keyword If '${current_state}' == 'Off'
311 ... Initiate Host Boot
George Keishing25577a22017-07-12 05:18:46 -0500312 ... ELSE Initiate Host Reboot
Rahul Maheshwari4a4eb6e2016-09-24 01:06:36 -0500313
George Keishingcaac9f32017-03-09 02:14:27 -0600314 Wait Until Keyword Succeeds
315 ... 10 min 10 sec Is OS Starting
316
George Keishingc8166ed2017-02-24 03:53:38 -0600317Get 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 Keishingefa97352017-03-13 07:13:03 -0500328
329
330Qualified 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 Keishingdf5ab122017-04-17 04:01:11 -0500350 \ ${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 Keishingefa97352017-03-13 07:13:03 -0500354 \ Run Keyword If '${status}' == '${True}'
355 ... Append To List ${fru_list} ${fru_uri}
356
357 [Return] ${fru_list}
358
359
360Validate 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 Keishing071d8da2017-03-24 09:13:16 -0500383
384Check 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 Potthuri654cbc02017-06-15 10:10:55 -0500393
394Verify 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 Potthuri1a640de2017-07-18 11:09:59 -0500404
405Minimum 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
416Get 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}