blob: c065495799fc32cace881b0418bd4662b1d47774 [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
6
7Test Teardown FFDC On Test Case Fail
8
9*** Variables ***
10
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -060011${new_mc_id}= HOST
Rahul Maheshwari901dcde2018-02-06 03:14:31 -060012${allowed_temp_diff}= ${1}
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -060013
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -050014*** Test Cases ***
15
16Set Asset Tag With Valid String Length
17 [Documentation] Set asset tag with valid string length and verify.
18 [Tags] Set_Asset_Tag_With_Valid_String_Length
19
20 # Allowed MAX characters length for asset tag name is 63.
21 ${random_string}= Generate Random String 63
22 Run Keyword Run IPMI Standard Command dcmi set_asset_tag ${random_string}
23
24 ${asset_tag}= Run Keyword Run IPMI Standard Command dcmi asset_tag
25 Should Contain ${asset_tag} ${random_string}
26
27
28Set Asset Tag With Invalid String Length
29 [Documentation] Verify error while setting invalid asset tag via IPMI.
30 [Tags] Set_Asset_Tag_With_Invalid_String_Length
31
32 # Any string more than 63 character is invalid for asset tag.
33 ${random_string}= Generate Random String 64
34
35 ${resp}= Run Keyword And Expect Error * Run IPMI Standard Command
36 ... dcmi set_asset_tag ${random_string}
37 Should Contain ${resp} Parameter out of range ignore_case=True
38
39
40Set Asset Tag With Valid String Length Via REST
41 [Documentation] Set valid asset tag via REST and verify.
42 [Tags] Set_Asset_Tag_With_Valid_String_Length_Via_REST
43
44 ${random_string}= Generate Random String 63
45 ${args}= Create Dictionary data=${random_string}
46 Write Attribute /xyz/openbmc_project/inventory/system AssetTag
47 ... data=${args}
48
49 ${asset_tag}= Read Attribute /xyz/openbmc_project/inventory/system
50 ... AssetTag
51 Should Be Equal As Strings ${asset_tag} ${random_string}
52
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -060053Verify Get And Set Management Controller ID String
54 [Documentation] Verify get and set management controller ID string.
55 [Tags] Verify_Get_And_Set_Management_Controller_ID_String
56
57 # Get the value of the managemment controller ID string.
58 # Example:
59 # Get Management Controller Identifier String: witherspoon
60
61 ${cmd_output}= Run IPMI Standard Command dcmi get_mc_id_string
62
63 # Extract management controller ID from cmd_output.
64 ${initial_mc_id}= Fetch From Right ${cmd_output} :${SPACE}
65
66 # Set the management controller ID string to other value.
67 # Example:
68 # Set Management Controller Identifier String Command: HOST
69
70 Set Management Controller ID String ${new_mc_id}
71
72 # Get the management controller ID and verify.
73 Get Management Controller ID String And Verify ${new_mc_id}
74
75 # Set the value back to the initial value and verify.
76 Set Management Controller ID String ${initial_mc_id}
77
78 # Get the management controller ID and verify.
79 Get Management Controller ID String And Verify ${initial_mc_id}
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -050080
Sweta Potthuri0cc60502018-01-24 00:36:17 -060081Verify Chassis Identify via IPMI
82 [Documentation] Verify "chassis identify" using IPMI command.
83 [Tags] Verify_Chassis_Identify_via_IPMI
84
85 # Set to default "chassis identify" and verify that LED blinks for 15s.
86 Run IPMI Standard Command chassis identify
87 Verify Identify LED State Blink
88
89 Sleep 15s
90 Verify Identify LED State Off
91
92 # Set "chassis identify" to 10s and verify that the LED blinks for 10s.
93 Run IPMI Standard Command chassis identify 10
94 Verify Identify LED State Blink
95
96 Sleep 10s
97 Verify Identify LED State Off
98
99Verify Chassis Identify Off And Force Identify On via IPMI
100 [Documentation] Verify "chassis identify" off
101 ... and "force identify on" via IPMI.
102 [Tags] Verify_Chassis_Identify_Off_And_Force_Identify_On_via_IPMI
103
104 # Set the LED to "Force Identify On".
105 Run IPMI Standard Command chassis identify force
106 Verify Identify LED State Blink
107
108 # Set "chassis identify" to 0 and verify that the LED turns off.
109 Run IPMI Standard Command chassis identify 0
110 Verify Identify LED State Off
111
Sweta Potthuri7d3af3c2018-01-29 03:07:07 -0600112Test Watchdog Reset Via IPMI And Verify Using REST
113 [Documentation] Test watchdog reset via IPMI and verify using REST.
114 [Tags] Test_Watchdog_Reset_Via_IPMI_And_Verify_Using_REST
115
116 Initiate Host Boot
117
118 Set Watchdog Enabled Using REST ${1}
119
120 Watchdog Object Should Exist
121
122 # Resetting the watchdog via IPMI.
123 Run IPMI Standard Command mc watchdog reset
124
125 # Verify the watchdog is reset using REST after an interval of 1000ms.
126 Sleep 1000ms
127 ${watchdog_time_left}=
128 ... Read Attribute ${HOST_WATCHDOG_URI} TimeRemaining
129 Should Be True
130 ... ${watchdog_time_left}<${1200000} and ${watchdog_time_left}>${2000}
131 ... msg=Watchdog timer didn't reset.
132
133Test Watchdog Off Via IPMI And Verify Using REST
134 [Documentation] Test watchdog off via IPMI and verify using REST.
135 [Tags] Test_Watchdog_Off_Via_IPMI_And_Verify_Using_REST
136
137 Initiate Host Boot
138
139 Set Watchdog Enabled Using REST ${1}
140
141 Watchdog Object Should Exist
142
143 # Turn off the watchdog via IPMI.
144 Run IPMI Standard Command mc watchdog off
145
146 # Verify the watchdog is off using REST
147 ${watchdog_state}= Read Attribute ${HOST_WATCHDOG_URI} Enabled
148 Should Be Equal ${watchdog_state} ${0}
149 ... msg=msg=Verification failed for watchdog off check.
Rahul Maheshwari901dcde2018-02-06 03:14:31 -0600150
151
152Test Ambient Temperature Via IPMI
153 [Documentation] Test ambient temperature via IPMI and verify using REST.
154 [Tags] Test_Ambient_Temperature_Via_IPMI
155
156 # Entity ID Entity Instance Temp. Readings
157 # Inlet air temperature(40h) 1 +19 C
158 # CPU temperature sensors(41h) 5 +51 C
159 # CPU temperature sensors(41h) 6 +50 C
160 # CPU temperature sensors(41h) 7 +50 C
161 # CPU temperature sensors(41h) 8 +50 C
162 # CPU temperature sensors(41h) 9 +50 C
163 # CPU temperature sensors(41h) 10 +48 C
164 # CPU temperature sensors(41h) 11 +49 C
165 # CPU temperature sensors(41h) 12 +47 C
166 # CPU temperature sensors(41h) 8 +50 C
167 # CPU temperature sensors(41h) 16 +51 C
168 # CPU temperature sensors(41h) 24 +50 C
169 # CPU temperature sensors(41h) 32 +43 C
170 # CPU temperature sensors(41h) 40 +43 C
171 # Baseboard temperature sensors(42h) 1 +35 C
172
173 ${temp_reading}= Run IPMI Standard Command dcmi get_temp_reading -N 10
174 ${ambient_temp_line}=
175 ... Get Lines Containing String ${temp_reading}
176 ... Inlet air temperature case-insensitive
177
178 ${ambient_temp_ipmi}= Fetch From Right ${ambient_temp_line} +
179 ${ambient_temp_ipmi}= Remove String ${ambient_temp_ipmi} ${SPACE}C
180
181 ${ambient_temp_rest}= Read Attribute
182 ... ${SENSORS_URI}temperature/ambient Value
183
184 # Example of ambient temperature via REST
185 # "CriticalAlarmHigh": 0,
186 # "CriticalAlarmLow": 0,
187 # "CriticalHigh": 35000,
188 # "CriticalLow": 0,
189 # "Scale": -3,
190 # "Unit": "xyz.openbmc_project.Sensor.Value.Unit.DegreesC",
191 # "Value": 21775,
192 # "WarningAlarmHigh": 0,
193 # "WarningAlarmLow": 0,
194 # "WarningHigh": 25000,
195 # "WarningLow": 0
196
197 # Get temperature value based on scale i.e. Value * (10 power Scale Value)
198 # e.g. from above case 21775 * (10 power -3) = 21775/1000
199
200 ${ambient_temp_rest}= Evaluate ${ambient_temp_rest}/1000
201 ${ipmi_rest_temp_diff}=
202 ... Evaluate abs(${ambient_temp_rest} - ${ambient_temp_ipmi})
203
204 Should Be True ${ipmi_rest_temp_diff} <= ${allowed_temp_diff}
205 ... msg=Ambient temperature above allowed threshold ${allowed_temp_diff}.
206
207
Rahul Maheshwarifdd5ff62017-08-01 04:15:03 -0500208*** Keywords ***
Sweta Potthuri5c6c72e2018-01-23 05:48:35 -0600209
210Set Management Controller ID String
211 [Documentation] Set the management controller ID string.
212 [Arguments] ${string}
213
214 # Description of argument(s):
215 # string Management Controller ID String to be set
216
217 ${set_mc_id_string}= Run IPMI Standard Command
218 ... dcmi set_mc_id_string ${string}
219
220Get Management Controller ID String And Verify
221 [Documentation] Get the management controller ID sting.
222 [Arguments] ${string}
223
224 # Description of argument(s):
225 # string Management Controller ID string
226
227 ${get_mc_id}= Run IPMI Standard Command dcmi get_mc_id_string
228 Should Contain ${get_mc_id} ${string}
229 ... msg=Command failed: get_mc_id.
Sweta Potthuri0cc60502018-01-24 00:36:17 -0600230
231Verify Identify LED State
232 [Documentation] Verify the identify LED state
233 ... matches caller's expectations.
234 [Arguments] ${expected_state}
235
236 # Description of argument(s):
237 # expected_state The LED state expected by the caller ("Blink" or "Off").
238
239 ${resp}= Read Attribute ${LED_PHYSICAL_URI}/front_id State
240 Should Be Equal ${resp} xyz.openbmc_project.Led.Physical.Action.${expected_state}
241 ... msg=Unexpected LED state.
242
243 ${resp}= Read Attribute ${LED_PHYSICAL_URI}/rear_id State
244 Should Be Equal ${resp} xyz.openbmc_project.Led.Physical.Action.${expected_state}
245 ... msg=Unexpected LED state.
246
Sweta Potthuri7d3af3c2018-01-29 03:07:07 -0600247Set Watchdog Enabled Using REST
248 [Documentation] Set watchdog Enabled field using REST.
249 [Arguments] ${value}
250
251 # Description of argument(s):
252 # value Integer value (eg. "0-Disabled", "1-Enabled").
253
254 ${value_dict}= Create Dictionary data=${value}
255 ${resp}= OpenBMC Put Request ${HOST_WATCHDOG_URI}/attr/Enabled
256 ... data=${value_dict}