blob: 6c40b76e6e7b8cfbbc5c632538b485ed7a4cf375 [file] [log] [blame]
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -05001*** Settings ***
2Documentation This suite is for testing general IPMI functions.
3
4Resource ../../lib/ipmi_client.robot
5Resource ../../lib/openbmc_ffdc.robot
Rahul Maheshwari615da152018-02-13 23:53:36 -06006Resource ../lib/boot_utils.robot
7Library ../../lib/ipmi_utils.py
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -05008
9Test Teardown FFDC On Test Case Fail
10
11*** Variables ***
12
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -060013${new_mc_id}= HOST
Rahul Maheshwari901dcde2018-02-06 03:14:31 -060014${allowed_temp_diff}= ${1}
Rahul Maheshwari615da152018-02-13 23:53:36 -060015${allowed_power_diff}= ${10}
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -060016
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -050017*** Test Cases ***
18
19Set Asset Tag With Valid String Length
20 [Documentation] Set asset tag with valid string length and verify.
21 [Tags] Set_Asset_Tag_With_Valid_String_Length
22
23 # Allowed MAX characters length for asset tag name is 63.
24 ${random_string}= Generate Random String 63
25 Run Keyword Run IPMI Standard Command dcmi set_asset_tag ${random_string}
26
27 ${asset_tag}= Run Keyword Run IPMI Standard Command dcmi asset_tag
28 Should Contain ${asset_tag} ${random_string}
29
30
31Set Asset Tag With Invalid String Length
32 [Documentation] Verify error while setting invalid asset tag via IPMI.
33 [Tags] Set_Asset_Tag_With_Invalid_String_Length
34
35 # Any string more than 63 character is invalid for asset tag.
36 ${random_string}= Generate Random String 64
37
38 ${resp}= Run Keyword And Expect Error * Run IPMI Standard Command
39 ... dcmi set_asset_tag ${random_string}
40 Should Contain ${resp} Parameter out of range ignore_case=True
41
42
43Set Asset Tag With Valid String Length Via REST
44 [Documentation] Set valid asset tag via REST and verify.
45 [Tags] Set_Asset_Tag_With_Valid_String_Length_Via_REST
46
47 ${random_string}= Generate Random String 63
48 ${args}= Create Dictionary data=${random_string}
49 Write Attribute /xyz/openbmc_project/inventory/system AssetTag
50 ... data=${args}
51
52 ${asset_tag}= Read Attribute /xyz/openbmc_project/inventory/system
53 ... AssetTag
54 Should Be Equal As Strings ${asset_tag} ${random_string}
55
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -060056Verify Get And Set Management Controller ID String
57 [Documentation] Verify get and set management controller ID string.
58 [Tags] Verify_Get_And_Set_Management_Controller_ID_String
59
60 # Get the value of the managemment controller ID string.
61 # Example:
62 # Get Management Controller Identifier String: witherspoon
63
64 ${cmd_output}= Run IPMI Standard Command dcmi get_mc_id_string
65
66 # Extract management controller ID from cmd_output.
67 ${initial_mc_id}= Fetch From Right ${cmd_output} :${SPACE}
68
69 # Set the management controller ID string to other value.
70 # Example:
71 # Set Management Controller Identifier String Command: HOST
72
73 Set Management Controller ID String ${new_mc_id}
74
75 # Get the management controller ID and verify.
76 Get Management Controller ID String And Verify ${new_mc_id}
77
78 # Set the value back to the initial value and verify.
79 Set Management Controller ID String ${initial_mc_id}
80
81 # Get the management controller ID and verify.
82 Get Management Controller ID String And Verify ${initial_mc_id}
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -050083
Sweta Potthuri0cc60502018-01-24 00:36:17 -060084Verify Chassis Identify via IPMI
85 [Documentation] Verify "chassis identify" using IPMI command.
86 [Tags] Verify_Chassis_Identify_via_IPMI
87
88 # Set to default "chassis identify" and verify that LED blinks for 15s.
89 Run IPMI Standard Command chassis identify
90 Verify Identify LED State Blink
91
92 Sleep 15s
93 Verify Identify LED State Off
94
95 # Set "chassis identify" to 10s and verify that the LED blinks for 10s.
96 Run IPMI Standard Command chassis identify 10
97 Verify Identify LED State Blink
98
99 Sleep 10s
100 Verify Identify LED State Off
101
102Verify Chassis Identify Off And Force Identify On via IPMI
103 [Documentation] Verify "chassis identify" off
104 ... and "force identify on" via IPMI.
105 [Tags] Verify_Chassis_Identify_Off_And_Force_Identify_On_via_IPMI
106
107 # Set the LED to "Force Identify On".
108 Run IPMI Standard Command chassis identify force
109 Verify Identify LED State Blink
110
111 # Set "chassis identify" to 0 and verify that the LED turns off.
112 Run IPMI Standard Command chassis identify 0
113 Verify Identify LED State Off
114
Sweta Potthuri7d3af3c2018-01-29 03:07:07 -0600115Test Watchdog Reset Via IPMI And Verify Using REST
116 [Documentation] Test watchdog reset via IPMI and verify using REST.
117 [Tags] Test_Watchdog_Reset_Via_IPMI_And_Verify_Using_REST
118
119 Initiate Host Boot
120
121 Set Watchdog Enabled Using REST ${1}
122
123 Watchdog Object Should Exist
124
125 # Resetting the watchdog via IPMI.
126 Run IPMI Standard Command mc watchdog reset
127
128 # Verify the watchdog is reset using REST after an interval of 1000ms.
129 Sleep 1000ms
130 ${watchdog_time_left}=
131 ... Read Attribute ${HOST_WATCHDOG_URI} TimeRemaining
132 Should Be True
133 ... ${watchdog_time_left}<${1200000} and ${watchdog_time_left}>${2000}
134 ... msg=Watchdog timer didn't reset.
135
136Test Watchdog Off Via IPMI And Verify Using REST
137 [Documentation] Test watchdog off via IPMI and verify using REST.
138 [Tags] Test_Watchdog_Off_Via_IPMI_And_Verify_Using_REST
139
140 Initiate Host Boot
141
142 Set Watchdog Enabled Using REST ${1}
143
144 Watchdog Object Should Exist
145
146 # Turn off the watchdog via IPMI.
147 Run IPMI Standard Command mc watchdog off
148
149 # Verify the watchdog is off using REST
150 ${watchdog_state}= Read Attribute ${HOST_WATCHDOG_URI} Enabled
151 Should Be Equal ${watchdog_state} ${0}
152 ... msg=msg=Verification failed for watchdog off check.
Rahul Maheshwari901dcde2018-02-06 03:14:31 -0600153
154
155Test Ambient Temperature Via IPMI
156 [Documentation] Test ambient temperature via IPMI and verify using REST.
157 [Tags] Test_Ambient_Temperature_Via_IPMI
158
159 # Entity ID Entity Instance Temp. Readings
160 # Inlet air temperature(40h) 1 +19 C
161 # CPU temperature sensors(41h) 5 +51 C
162 # CPU temperature sensors(41h) 6 +50 C
163 # CPU temperature sensors(41h) 7 +50 C
164 # CPU temperature sensors(41h) 8 +50 C
165 # CPU temperature sensors(41h) 9 +50 C
166 # CPU temperature sensors(41h) 10 +48 C
167 # CPU temperature sensors(41h) 11 +49 C
168 # CPU temperature sensors(41h) 12 +47 C
169 # CPU temperature sensors(41h) 8 +50 C
170 # CPU temperature sensors(41h) 16 +51 C
171 # CPU temperature sensors(41h) 24 +50 C
172 # CPU temperature sensors(41h) 32 +43 C
173 # CPU temperature sensors(41h) 40 +43 C
174 # Baseboard temperature sensors(42h) 1 +35 C
175
176 ${temp_reading}= Run IPMI Standard Command dcmi get_temp_reading -N 10
177 ${ambient_temp_line}=
178 ... Get Lines Containing String ${temp_reading}
179 ... Inlet air temperature case-insensitive
180
181 ${ambient_temp_ipmi}= Fetch From Right ${ambient_temp_line} +
182 ${ambient_temp_ipmi}= Remove String ${ambient_temp_ipmi} ${SPACE}C
183
184 ${ambient_temp_rest}= Read Attribute
185 ... ${SENSORS_URI}temperature/ambient Value
186
187 # Example of ambient temperature via REST
188 # "CriticalAlarmHigh": 0,
189 # "CriticalAlarmLow": 0,
190 # "CriticalHigh": 35000,
191 # "CriticalLow": 0,
192 # "Scale": -3,
193 # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.DegreesC",
194 # "Value": 21775,
195 # "WarningAlarmHigh": 0,
196 # "WarningAlarmLow": 0,
197 # "WarningHigh": 25000,
198 # "WarningLow": 0
199
200 # Get temperature value based on scale i.e. Value * (10 power Scale Value)
201 # e.g. from above case 21775 * (10 power -3) = 21775/1000
202
203 ${ambient_temp_rest}= Evaluate ${ambient_temp_rest}/1000
204 ${ipmi_rest_temp_diff}=
205 ... Evaluate abs(${ambient_temp_rest} - ${ambient_temp_ipmi})
206
207 Should Be True ${ipmi_rest_temp_diff} <= ${allowed_temp_diff}
208 ... msg=Ambient temperature above allowed threshold ${allowed_temp_diff}.
209
210
Rahul Maheshwari43556632018-02-05 23:42:52 -0600211Verify Get DCMI Capabilities
212 [Documentation] Verify get DCMI capabilities command output.
213 [Tags] Verify_Get_DCMI_Capabilities
214
215 ${cmd_output}= Run IPMI Standard Command dcmi discover
216
217 @{supported_capabilities}= Create List
218 # Supported DCMI capabilities:
219 ... Mandatory platform capabilties
220 ... Optional platform capabilties
221 ... Power management available
222 ... Managebility access capabilties
223 ... In-band KCS channel available
224 # Mandatory platform attributes:
225 ... 200 SEL entries
226 ... SEL automatic rollover is enabled
227 # Optional Platform Attributes:
228 ... Slave address of device: 0h (8bits)(Satellite/External controller)
229 ... Channel number is 0h (Primary BMC)
230 ... Device revision is 0
231 # Manageability Access Attributes:
232 ... Primary LAN channel number: 1 is available
233 ... Secondary LAN channel is not available for OOB
234 ... No serial channel is available
235
236 :FOR ${capability} IN @{supported_capabilities}
237 \ Should Contain ${cmd_output} ${capability} ignore_case=True
238 ... msg=Supported DCMI capabilities not present.
239
240
Rahul Maheshwari615da152018-02-13 23:53:36 -0600241Test Power Reading Via IPMI With Host Booted
242 [Documentation] Test power reading via IPMI with host booted state and
243 ... verify using REST.
244 [Tags] Test_Power_Reading_Via_IPMI_With_Host_Booted
245
246 REST Power On stack_mode=skip quiet=1
247
248 # Example of power reading command output via IPMI.
249 # Instantaneous power reading: 235 Watts
250 # Minimum during sampling period: 235 Watts
251 # Maximum during sampling period: 235 Watts
252 # Average power reading over sample period: 235 Watts
253 # IPMI timestamp: Thu Jan 1 00:00:00 1970
254 # Sampling period: 00000000 Seconds.
255 # Power reading state is: deactivated
256
257 ${power_reading}= Get IPMI Power Reading
258 ${power_reading_ipmi}= Set Variable
259 ... ${power_reading['instantaneous_power_reading']}
260 ${power_reading_ipmi}= Remove String ${power_reading_ipmi} ${SPACE}Watts
261
262 ${power_reading_rest}= Read Attribute
263 ... ${SENSORS_URI}power/total_power Value
264
265 # Example of power reading via REST
266 # "CriticalAlarmHigh": 0,
267 # "CriticalAlarmLow": 0,
268 # "CriticalHigh": 3100000000,
269 # "CriticalLow": 0,
270 # "Scale": -6,
271 # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.Watts",
272 # "Value": 228000000,
273 # "WarningAlarmHigh": 0,
274 # "WarningAlarmLow": 0,
275 # "WarningHigh": 3050000000,
276 # "WarningLow": 0
277
278 # Get power value based on scale i.e. Value * (10 power Scale Value)
279 # e.g. from above case 228000000 * (10 power -6) = 228000000/1000000
280
281 ${power_reading_rest}= Evaluate ${power_reading_rest}/1000000
282 ${ipmi_rest_power_diff}=
283 ... Evaluate abs(${power_reading_rest} - ${power_reading_ipmi})
284
285 Should Be True ${ipmi_rest_power_diff} <= ${allowed_power_diff}
286 ... msg=Power reading above allowed threshold ${allowed_power_diff}.
287
288
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -0500289*** Keywords ***
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600290
291Set Management Controller ID String
292 [Documentation] Set the management controller ID string.
293 [Arguments] ${string}
294
295 # Description of argument(s):
296 # string Management Controller ID String to be set
297
298 ${set_mc_id_string}= Run IPMI Standard Command
299 ... dcmi set_mc_id_string ${string}
300
301Get Management Controller ID String And Verify
302 [Documentation] Get the management controller ID sting.
303 [Arguments] ${string}
304
305 # Description of argument(s):
306 # string Management Controller ID string
307
308 ${get_mc_id}= Run IPMI Standard Command dcmi get_mc_id_string
309 Should Contain ${get_mc_id} ${string}
310 ... msg=Command failed: get_mc_id.
Sweta Potthuri0cc60502018-01-24 00:36:17 -0600311
312Verify Identify LED State
313 [Documentation] Verify the identify LED state
314 ... matches caller's expectations.
315 [Arguments] ${expected_state}
316
317 # Description of argument(s):
318 # expected_state The LED state expected by the caller ("Blink" or "Off").
319
320 ${resp}= Read Attribute ${LED_PHYSICAL_URI}/front_id State
321 Should Be Equal ${resp} xyz.openbmc_project.Led.Physical.Action.${expected_state}
322 ... msg=Unexpected LED state.
323
324 ${resp}= Read Attribute ${LED_PHYSICAL_URI}/rear_id State
325 Should Be Equal ${resp} xyz.openbmc_project.Led.Physical.Action.${expected_state}
326 ... msg=Unexpected LED state.
327
Sweta Potthuri7d3af3c2018-01-29 03:07:07 -0600328Set Watchdog Enabled Using REST
329 [Documentation] Set watchdog Enabled field using REST.
330 [Arguments] ${value}
331
332 # Description of argument(s):
333 # value Integer value (eg. "0-Disabled", "1-Enabled").
334
335 ${value_dict}= Create Dictionary data=${value}
336 ${resp}= OpenBMC Put Request ${HOST_WATCHDOG_URI}/attr/Enabled
337 ... data=${value_dict}