blob: d9583ff410aec84dcad016fdbd3c41b0e7bc62af [file] [log] [blame]
Rahul Maheshwari35aa8d52018-03-11 23:56:51 -05001*** Settings ***
2Documentation Test IPMI FRU data.
3
4Resource ../../lib/rest_client.robot
5Resource ../../lib/ipmi_client.robot
6Resource ../../lib/openbmc_ffdc.robot
7Resource ../../lib/boot_utils.robot
8Library ../../lib/ipmi_utils.py
9
10Variables ../data/ipmi_rest_fru_field_map.py
11
12Test Teardown Test Teardown Execution
13Suite Setup Suite Setup Execution
14
15
16*** Test Cases ***
17
18Test FRU Info At Power On
19 [Documentation] Verify FRU info via IPMI and REST at power on.
20 [Tags] Test_FRU_Info_At_Power_On
21 [Template] Verify FRU Info
22
23 # component_name
24 cpu
25 dimm
26 fan
27 bmc
28 system
29 powersupply
30 gv100card
31
32
33*** Keywords ***
34
35Get Component Fru Info Via REST
36 [Documentation] Get FRU Information Via REST for the given component.
37 [Arguments] ${component_name}
38
39 # Description of argument(s):
40 # component_name The name of the component (e.g. "cpu", "dimm", etc.).
41
42 ${inventory_uris}= Read Properties ${HOST_INVENTORY_URI}list quiet=${1}
43 # From the inventory_uris, select just the ones for the component of
44 # interest.
45 ${component_uris}= Get Matches ${inventory_uris}
Michael Walshd917c6e2018-12-11 10:09:09 -060046 ... regexp=^.*[0-9a-z_].${component_name}\[0-9]*$
Rahul Maheshwari35aa8d52018-03-11 23:56:51 -050047
48 # Get the component information for each record.
49 ${component_frus}= Create List
50 : FOR ${component_uri} IN @{component_uris}
51 \ ${result}= Read Properties ${component_uri} quiet=${1}
52 \ ${component}= Fetch From Right ${component_uri} /
53 \ Set To Dictionary ${result} fru_device_description ${component}
54 \ Append To List ${component_frus} ${result}
55 [Return] ${component_frus}
56
57
58Verify FRU Info
59 [Documentation] Verify FRU information of given component.
60 [Arguments] ${component_name}
61
62 # Description of argument(s):
63 # component_name The name of the component (e.g. "cpu", "dimm", etc.).
64
65 ${ipmi_fru_component_info}= Get Component FRU Info ${component_name}
66 ... ${fru_objs}
67 # Example of output from "Get Component FRU Info" keyword for CPU component.
68 #
69 # ipmi_fru_info:
70 # ipmi_fru_info[0]:
71 # [fru_device_description]: cpu0 (ID 1)
72 # [board_mfg_date]: Sun Dec 31 18:00:00 1995
73 # [board_mfg]: <Manufacturer Name>
74 # [board_product]: PROCESSOR MODULE
75 # [board_serial]: YA1934301835
76 # [board_part_number]: 02CY211
77 # ipmi_fru_info[1]:
78 # [fru_device_description]: cpu1 (ID 2)
79 # [board_mfg_date]: Sun Dec 31 18:00:00 1995
80 # [board_mfg]: <Manufacturer Name>
81 # [board_product]: PROCESSOR MODULE
82 # [board_serial]: YA1934301834
83 # [board_part_number]: 02CY211
84
85 ${rest_fru_component_info}= Get Component FRU Info Via REST
86 ... ${component_name}
87 # Example of output from "Get Component FRU Info Via REST" keyword for
88 # CPU component.
89 #
90 # rest_fru_info:
91 # rest_fru_info[0]:
92 # [FieldReplaceable]: 1
93 # [BuildDate]: 1996-01-01 - 00:00:00
94 # [fru_device_description]: cpu0
95 # [Cached]: 0
96 # [SerialNumber]: YA1934301835
97 # [Functional]: 1
98 # [Version]: 22
99 # [Model]: <blank>
100 # [PrettyName]: PROCESSOR MODULE
101 # [PartNumber]: 02CY211
102 # [Present]: 1
103 # [Manufacturer]: <Manufacturer Name>
104 # rest_fru_info[1]:
105 # [FieldReplaceable]: 1
106 # [BuildDate]: 1996-01-01 - 00:00:00
107 # [fru_device_description]: cpu1
108 # [Cached]: 0
109 # [SerialNumber]: YA1934301834
110 # [Functional]: 1
111 # [Version]: 22
112 # [Model]: <blank>
113 # [PrettyName]: PROCESSOR MODULE
114 # [PartNumber]: 02CY211
115 # [Present]: 1
116 # [Manufacturer]: <Manufacturer Name>
117
118 ${inventory_uris}= Read Properties
119 ... ${HOST_INVENTORY_URI}list quiet=${1}
120
121 # From the inventory_uris, select just the ones for the component of
122 # interest. Example for cpu:
123 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0
124 # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu1
125 ${component_uris}= Get Matches ${inventory_uris}
Michael Walshd917c6e2018-12-11 10:09:09 -0600126 ... regexp=^.*[0-9a-z_].${component_name}\[0-9]*$
Rahul Maheshwari35aa8d52018-03-11 23:56:51 -0500127
128 : FOR ${uri} IN @{component_uris}
129 \ ${sub_component}= Fetch From Right ${uri} /
130 \ ${ipmi_index}= Get Index Of FRU Sub Component Info
131 \ ... ${ipmi_fru_component_info} ${sub_component}
132 \ ${rest_index}= Get Index Of FRU Sub Component Info
133 \ ... ${rest_fru_component_info} ${sub_component}
134 \ ${ipmi_fru_sub_component}=
135 \ ... Get From List ${ipmi_fru_component_info} ${ipmi_index}
136 \ ${rest_fru_sub_component}=
137 \ ... Get From List ${rest_fru_component_info} ${rest_index}
138 \ Compare IPMI And REST FRU Component Info ${ipmi_fru_sub_component}
139 \ ... ${rest_fru_sub_component} ${component_name}
140
141
142Get Index Of FRU Sub Component Info
143 [Documentation] Get index of FRU sub component info from FRU component
144 ... data.
145 [Arguments] ${fru_component_info} ${sub_component}
146 # fru_component_info FRU component data as a list of dictionaries.
147 # ipmi_cpu_fru_info[0]:
148 # fru_device_description: cpu0 (ID 1)
149 # board_mfg_date: Sun Dec 31 18:00:00 1995
150 # board_mfg: <Manufacturer Name>
151 # board_product: PROCESSOR MODULE
152 # board_serial: YA1934302970
153 # board_part_number: 02CY211
154 # ipmi_cpu_fru_info[1]:
155 # fru_device_description: cpu1 (ID 2)
156 # board_mfg_date: Sun Dec 31 18:00:00 1995
157 # board_mfg: <Manufacturer Name>
158 # board_product: PROCESSOR MODULE
159 # board_serial: YA1934302965
160 # board_part_number: 02CY211
161 # sub_component Sub component name (e.g. "cpu0", "cpu1", etc.).
162
163 ${sub_component_count}= Get Length ${fru_component_info}
164 ${index}= Set Variable ${0}
165
166 : FOR ${rest_fru_sub_component} IN @{fru_component_info}
167 \ ${fru_component_section}=
168 \ ... Get From List ${fru_component_info} ${index}
169 \ ${status}= Run Keyword And Return Status Should Contain
170 \ ... ${fru_component_section['fru_device_description']}
171 \ ... ${sub_component}
172 \ Exit For Loop If '${status}' == '${True}'
173 \ ${index}= Evaluate ${index} + 1
174 \ Exit For Loop If ${index} >= ${sub_component_count}
175
176 [Return] ${index}
177
178
179Compare IPMI And REST FRU Component Info
180 [Documentation] Compare IPMI And REST FRU Component data objects.
181 [Arguments] ${ipmi_fru_component_obj} ${rest_fru_component_obj}
182 ... ${component_name}
183
184 # Description of argument(s):
185 # ipmi_fru_component_obj IPMI FRU component data in dictionary.
186 # Example:
187 # fru_device_description: cpu0 (ID 1)
188 # board_mfg_date: Sun Dec 31 18:00:00 1995
189 # board_mfg: <Manufacturer Name>
190 # board_product: PROCESSOR MODULE
191 # board_serial: YA1934302970
192 # board_part_number: 02CY211
193 # rest_fru_component_obj REST FRU component data in dictionary.
194 # Example:
195 # FieldReplaceable: 1
196 # BuildDate: 1996-01-01 - 00:00:00
197 # Cached: 0
198 # SerialNumber: YA1934302970
199 # Functional: 1
200 # Version: 22
201 # Model: <blank>
202 # PrettyName: PROCESSOR MODULE
203 # PartNumber: 02CY211
204 # Present: 1
205 # Manufacturer: <Manufacturer Name>
206 # component_name The name of the component (e.g. "cpu", "dimm", etc.).
207
208 # Get key_map from ipmi_rest_fru_field_map.
209 ${key_map}= Set Variable ${ipmi_rest_fru_field_map['${component_name}']}
210 : FOR ${ipmi_key} IN @{ipmi_rest_fru_field_map['${component_name}'].keys()}
211 \ ${rest_key}= Set Variable ${key_map['${ipmi_key}']}
212 \ Should Contain ${rest_fru_component_obj['${rest_key}']}
213 ... ${ipmi_fru_component_obj['${ipmi_key}']}
214 ... msg=Comparison failed.
215
216
217Test Teardown Execution
218 [Documentation] Do the post test teardown.
219
220 FFDC On Test Case Fail
221
222
223Suite Setup Execution
224 [Documentation] Do test setup initialization.
225
226 REST Power On stack_mode=skip quiet=1
227 ${fru_objs}= Get Fru Info
228 Set Suite Variable ${fru_objs}
229