blob: eb665a4adb9e6914d1a3546ab3d8badea05b0862 [file] [log] [blame]
Rahul Maheshwari71525ad2019-08-01 05:54:06 -05001*** Settings ***
2
3Documentation Module to test IPMI asset tag functionality.
4Resource ../lib/ipmi_client.robot
5Resource ../lib/openbmc_ffdc.robot
nagarjunb2298450742022-04-19 12:00:02 +05306Resource ../lib/bmc_network_utils.robot
Tony Lee3fdd31e2020-02-15 11:21:40 +08007Variables ../data/ipmi_raw_cmd_table.py
Tony Lee18c6f9a2020-02-18 17:00:20 +08008Variables ../data/ipmi_variable.py
9Library ../lib/bmc_network_utils.py
10Library ../lib/ipmi_utils.py
Rahul Maheshwari71525ad2019-08-01 05:54:06 -050011
nagarjunb2298450742022-04-19 12:00:02 +053012Suite Setup IPMI General Test Suite Setup
Rahul Maheshwari71525ad2019-08-01 05:54:06 -050013Test Teardown FFDC On Test Case Fail
14
George Keishing87dc4422023-10-20 12:56:30 +053015Force Tags IPMI_General
16
Rahul Maheshwari71525ad2019-08-01 05:54:06 -050017*** Test Cases ***
18
Tony Lee3fdd31e2020-02-15 11:21:40 +080019Test Get Self Test Results via IPMI Raw Command
20 [Documentation] Get self test results via IPMI raw command and verify the output.
George Keishingb98036a2022-01-31 12:39:47 -060021 [Tags] Test_Get_Self_Test_Results_via_IPMI_Raw_Command
Tony Lee3fdd31e2020-02-15 11:21:40 +080022
23 ${resp}= Run IPMI Standard Command raw ${IPMI_RAW_CMD['Self_Test_Results']['Get'][0]}
24
25 # 55h = No error. All Self Tests Passed.
26 # 56h = Self Test function not implemented in this controller.
27 Should Contain Any ${resp} 55 00 56 00
28
29
30Test Get Device GUID Via IPMI Raw Command
31 [Documentation] Get device GUID via IPMI raw command and verify it using Redfish.
George Keishingb98036a2022-01-31 12:39:47 -060032 [Tags] Test_Get_Device_GUID_Via_IPMI_Raw_Command
Tony Lee3fdd31e2020-02-15 11:21:40 +080033 [Teardown] Run Keywords Redfish.Logout AND FFDC On Test Case Fail
34 # Get GUIDS via IPMI.
ganesanb4d430282023-04-27 14:33:23 +000035 # This should match the /redfish/v1/Managers/${MANAGER_ID}'s UUID data.
Tony Lee3fdd31e2020-02-15 11:21:40 +080036 ${guids}= Run IPMI Standard Command raw ${IPMI_RAW_CMD['Device GUID']['Get'][0]}
37 # Reverse the order and remove space delims.
38 ${guids}= Split String ${guids}
39 Reverse List ${guids}
40 ${guids}= Evaluate "".join(${guids})
41
42 Redfish.Login
ganesanb4d430282023-04-27 14:33:23 +000043 ${uuid}= Redfish.Get Attribute /redfish/v1/Managers/${MANAGER_ID} UUID
Tony Lee3fdd31e2020-02-15 11:21:40 +080044 ${uuid}= Remove String ${uuid} -
45
46 Rprint Vars guids uuid
47 Valid Value uuid ['${guids}']
Tony Lee18c6f9a2020-02-18 17:00:20 +080048
49
50Verify Get Channel Info via IPMI
51 [Documentation] Verify get channel info via IPMI.
52 [Tags] Verify_Get_Channel_Info_via_IPMI
53
54 # Get channel info via ipmi command "ipmitool channel info [channel number]".
Tony Lee87c9cb92020-03-04 14:47:09 +080055 # Verify channel info with files "channel_access_volatile.json", "channel_access_nv.json"
56 # and "channel_config.json" in BMC.
Tony Lee18c6f9a2020-02-18 17:00:20 +080057
58 # Example output from 'Get Channel Info':
59 # channel_info:
60 # [channel_0x2_info]:
61 # [channel_medium_type]: 802.3 LAN
62 # [channel_protocol_type]: IPMB-1.0
63 # [session_support]: multi-session
64 # [active_session_count]: 0
65 # [protocol_vendor_id]: 7154
Tony Lee87c9cb92020-03-04 14:47:09 +080066 # [volatile(active)_settings]:
67 # [alerting]: enabled
68 # [per-message_auth]: enabled
69 # [user_level_auth]: enabled
70 # [access_mode]: always available
71 # [Non-Volatile Settings]:
72 # [alerting]: enabled
73 # [per-message_auth]: enabled
74 # [user_level_auth]: enabled
75 # [access_mode]: always available
Tony Lee18c6f9a2020-02-18 17:00:20 +080076
77 ${channel_info_ipmi}= Get Channel Info ${CHANNEL_NUMBER}
78 ${active_channel_config}= Get Active Channel Config
Tony Lee87c9cb92020-03-04 14:47:09 +080079 ${channel_volatile_data_config}= Get Channel Access Config /run/ipmi/channel_access_volatile.json
80 ${channel_nv_data_config}= Get Channel Access Config /var/lib/ipmi/channel_access_nv.json
81
George Keishing33be3592022-03-08 08:52:25 -060082 Rprint Vars channel_info_ipmi
83 Rprint Vars active_channel_config
84 Rprint Vars channel_volatile_data_config
85 Rprint Vars channel_nv_data_config
Tony Lee18c6f9a2020-02-18 17:00:20 +080086
87 Valid Value medium_type_ipmi_conf_map['${channel_info_ipmi['channel_0x${CHANNEL_NUMBER}_info']['channel_medium_type']}']
88 ... ['${active_channel_config['${CHANNEL_NUMBER}']['channel_info']['medium_type']}']
89
90 Valid Value protocol_type_ipmi_conf_map['${channel_info_ipmi['channel_0x${CHANNEL_NUMBER}_info']['channel_protocol_type']}']
91 ... ['${active_channel_config['${CHANNEL_NUMBER}']['channel_info']['protocol_type']}']
92
93 Valid Value channel_info_ipmi['channel_0x${CHANNEL_NUMBER}_info']['session_support']
94 ... ['${active_channel_config['${CHANNEL_NUMBER}']['channel_info']['session_supported']}']
95
96 Valid Value channel_info_ipmi['channel_0x${CHANNEL_NUMBER}_info']['active_session_count']
97 ... ['${active_channel_config['${CHANNEL_NUMBER}']['active_sessions']}']
98 # IPMI Spec: The IPMI Enterprise Number is: 7154 (decimal)
99 Valid Value channel_info_ipmi['channel_0x${CHANNEL_NUMBER}_info']['protocol_vendor_id'] ['7154']
100
Tony Lee87c9cb92020-03-04 14:47:09 +0800101 # Verify volatile(active)_settings
102 Valid Value disabled_ipmi_conf_map['${channel_info_ipmi['volatile(active)_settings']['alerting']}']
103 ... ['${channel_volatile_data_config['${CHANNEL_NUMBER}']['alerting_disabled']}']
Tony Lee18c6f9a2020-02-18 17:00:20 +0800104
Tony Lee87c9cb92020-03-04 14:47:09 +0800105 Valid Value disabled_ipmi_conf_map['${channel_info_ipmi['volatile(active)_settings']['per-message_auth']}']
106 ... ['${channel_volatile_data_config['${CHANNEL_NUMBER}']['per_msg_auth_disabled']}']
Tony Lee18c6f9a2020-02-18 17:00:20 +0800107
Tony Lee87c9cb92020-03-04 14:47:09 +0800108 Valid Value disabled_ipmi_conf_map['${channel_info_ipmi['volatile(active)_settings']['user_level_auth']}']
109 ... ['${channel_volatile_data_config['${CHANNEL_NUMBER}']['user_auth_disabled']}']
Tony Lee18c6f9a2020-02-18 17:00:20 +0800110
Tony Lee87c9cb92020-03-04 14:47:09 +0800111 Valid Value access_mode_ipmi_conf_map['${channel_info_ipmi['volatile(active)_settings']['access_mode']}']
112 ... ['${channel_volatile_data_config['${CHANNEL_NUMBER}']['access_mode']}']
113
114 # Verify Non-Volatile Settings
115 Valid Value disabled_ipmi_conf_map['${channel_info_ipmi['non-volatile_settings']['alerting']}']
116 ... ['${channel_nv_data_config['${CHANNEL_NUMBER}']['alerting_disabled']}']
117
118 Valid Value disabled_ipmi_conf_map['${channel_info_ipmi['non-volatile_settings']['per-message_auth']}']
119 ... ['${channel_nv_data_config['${CHANNEL_NUMBER}']['per_msg_auth_disabled']}']
120
121 Valid Value disabled_ipmi_conf_map['${channel_info_ipmi['non-volatile_settings']['user_level_auth']}']
122 ... ['${channel_nv_data_config['${CHANNEL_NUMBER}']['user_auth_disabled']}']
123
124 Valid Value access_mode_ipmi_conf_map['${channel_info_ipmi['non-volatile_settings']['access_mode']}']
125 ... ['${channel_nv_data_config['${CHANNEL_NUMBER}']['access_mode']}']
Tony Lee0754c5f2020-03-13 19:38:24 +0800126
127
128Test Get Channel Authentication Capabilities via IPMI
nagarjunb2298450742022-04-19 12:00:02 +0530129 [Documentation] Verify channel authentication capabilities via IPMI.
Tony Lee0754c5f2020-03-13 19:38:24 +0800130 [Tags] Test_Get_Channel_Authentication_Capabilities_via_IPMI
nagarjunb2298450742022-04-19 12:00:02 +0530131 [Template] Verify Channel Auth Capabilities
Tony Lee0754c5f2020-03-13 19:38:24 +0800132
nagarjunb2298450742022-04-19 12:00:02 +0530133 FOR ${channel} IN @{active_channel_list}
134 FOR ${privilege} IN 4 3 2
135 # Input Channel Privilege Level
136 ${channel} ${privilege}
137 END
138 END
Tony Lee0754c5f2020-03-13 19:38:24 +0800139
nagarjunb2298450742022-04-19 12:00:02 +0530140
141Test Get Channel Authentication Capabilities IPMI Command For Invalid Channel
142 [Documentation] Verify get channel authentication capabilities for invalid channel.
143 [Tags] Test_Get_Channel_Authentication_Capabilities_IPMI_Command_For_Invalid_Channel
George Keishing13b7afd2022-05-23 07:36:16 -0500144 [Template] Verify Channel Auth Capabilities For Invalid Channel
nagarjunb2298450742022-04-19 12:00:02 +0530145
146 FOR ${channel} IN @{inactive_channel_list}
147 # Input Channel
148 ${channel}
149 END
150
151
George Keishing13b7afd2022-05-23 07:36:16 -0500152Verify Get Channel Authentication Capabilities IPMI Raw Command With Invalid Data Length
153 [Documentation] Verify get channel authentication capabilities IPMI raw command with invalid data length.
154 [Tags] Verify_Get_Channel_Authentication_Capabilities_IPMI_Raw_Command_With_Invalid_Data_Length
nagarjunb2298450742022-04-19 12:00:02 +0530155 [Template] Verify Channel Auth Command For Invalid Data Length
156
157 # Bytes
158 low
159 high
Tony Lee2d071822020-02-19 16:37:58 +0800160
161
162Verify Set Session Privilege Level via IPMI Raw Command
163 [Documentation] Set session privilege with given privilege level and verify the response with
164 ... expected level.
165 [Tags] Verify_Set_Session_Privilege_Level_via_IPMI_Raw_Command
166 [Template] Set Session Privilege Level And Verify
167
168 # privilege_level expected_level
169 0x00 04
170 0x02 02
171 0x03 03
172 0x04 04
173
174
George Keishingb98036a2022-01-31 12:39:47 -0600175Verify Set Invalid Session Privilege Level Via IPMI Raw Command
Tony Lee94f1a6c2020-03-25 10:37:46 +0800176 [Documentation] Verify set invalid session privilege level via IPMI raw command.
177 [Tags] Verify_Set_Invalid_Session_Privilege_Level_Via_IPMI_Raw_Command
178 [Template] Set Invalid Session Privilege Level And Verify
179
180 # invalid_privilege_level
Nagarjun Bbb3365c2023-05-25 14:40:57 +0530181 0x01
Tony Lee94f1a6c2020-03-25 10:37:46 +0800182 0x05
183 0x06
184 0x07
185 0x0F
186
187
George Keishingb98036a2022-01-31 12:39:47 -0600188Verify Close Session Via IPMI
Tony Leed12b40d2020-03-19 10:45:21 +0800189 [Documentation] Verify close session via IPMI.
190 [Tags] Verify_Close_Session_Via_IPMI
191
192 # The "close session command" can be tested with any out-of-band IPMI command.
193 # When the session is about to close, it will execute the close session command at the end.
194
195 ${cmd}= Catenate mc info -vvv 2>&1 | grep "Closed Session"
196 ${cmd_output}= Run External IPMI Standard Command ${cmd}
197
198 Should Contain ${cmd_output} Closed Session
199
200
Ashwini Chandrappa4ec70852021-09-07 09:10:36 -0500201Verify Chassis Identify via IPMI
202 [Documentation] Set chassis identify using IPMI and verify.
203 [Tags] Verify_Chassis_Identify_via_IPMI
204 [Setup] Redfish.Login
205 [Teardown] Redfish.logout
206
207 # Set to default "chassis identify" and verify that LED blinks for 15s.
208 Run IPMI Standard Command chassis identify
209 Verify Identify LED State Via Redfish Lit
210
211 Sleep 18s
212 Verify Identify LED State Via Redfish Off
213
214 # Set "chassis identify" to 10s and verify that the LED blinks for 10s.
215 Run IPMI Standard Command chassis identify 10
216 Verify Identify LED State Via Redfish Lit
217
218 Sleep 12s
219 Verify Identify LED State Via Redfish Off
220
221
222Verify Chassis Identify Off And Force Identify On via IPMI
223 [Documentation] Set chassis identify to "off" and "force" using IPMI and verify.
224 [Tags] Verify_Chassis_Identify_Off_And_Force_Identify_On_via_IPMI
225 [Setup] Redfish.Login
226 [Teardown] Redfish.logout
227
228 # Set the LED to "Force Identify On".
229 Run IPMI Standard Command chassis identify force
230 Verify Identify LED State Via Redfish Lit
231
232 # Set "chassis identify" to 0 and verify that the LED turns off.
233 Run IPMI Standard Command chassis identify 0
234 Verify Identify LED State Via Redfish Off
235
236
Tony Lee2d071822020-02-19 16:37:58 +0800237*** Keywords ***
238
nagarjunb2298450742022-04-19 12:00:02 +0530239IPMI General Test Suite Setup
240 [Documentation] Get active and inactive/invalid channels from channel_config.json file
241 ... in list type and set it as suite variable.
242
243 # Get active channel list and set as suite variable.
244 @{active_channel_list}= Get Active Ethernet Channel List
245 Set Suite Variable @{active_channel_list}
246
247 # Get Inactive/Invalid channel list and set as suite variable.
248 @{inactive_channel_list}= Get Invalid Channel Number List
249 Set Suite Variable @{inactive_channel_list}
250
251
Tony Lee2d071822020-02-19 16:37:58 +0800252Set Session Privilege Level And Verify
253 [Documentation] Set session privilege with given privilege level and verify the response with
254 ... expected level.
255 [Arguments] ${privilege_level} ${expected_level}
256 # Description of argument(s):
257 # privilege_level Requested Privilege Level.
George Keishing33be3592022-03-08 08:52:25 -0600258 # expected_level New Privilege Level (or present level if ‘return present privilege level’
259 # was selected).
Tony Lee2d071822020-02-19 16:37:58 +0800260
Tony Leeb49853c2020-06-03 15:27:56 +0800261 ${resp}= Run External IPMI Raw Command
Tony Lee94f1a6c2020-03-25 10:37:46 +0800262 ... 0x06 0x3b ${privilege_level}
Tony Lee2d071822020-02-19 16:37:58 +0800263 Should Contain ${resp} ${expected_level}
Tony Lee94f1a6c2020-03-25 10:37:46 +0800264
265
266Set Invalid Session Privilege Level And Verify
267 [Documentation] Set invalid session privilege level and verify the response.
268 [Arguments] ${privilege_level}
269 # Description of argument(s):
270 # privilege_level Requested Privilege Level.
271
272 # Verify requested level exceeds Channel and/or User Privilege Limit.
Tony Leeb49853c2020-06-03 15:27:56 +0800273 ${msg}= Run Keyword And Expect Error * Run External IPMI Raw Command
Tony Lee94f1a6c2020-03-25 10:37:46 +0800274 ... 0x06 0x3b ${privilege_level}
Nagarjun Bbb3365c2023-05-25 14:40:57 +0530275
276 # 0x05 is OEM proprietary level.
277 IF ${privilege_level} == 0x05
278 Should Contain ${msg} Unknown rsp=0x81
279 ELSE
George Keishingc2b95042023-06-27 12:25:33 +0530280 # According to IPMI spec privilege level except 0x00-0x05, others are
281 # reserved. So if we try to set those privilege we will get rsp as
282 # 0xcc(Invalid data filed in request)
Nagarjun Bbb3365c2023-05-25 14:40:57 +0530283 Should Contain ${msg} Invalid data field in request rsp=0xcc
284 END
Ashwini Chandrappa4ec70852021-09-07 09:10:36 -0500285
286
287Verify Identify LED State Via Redfish
288 [Documentation] Verify that Redfish identify LED system with given state.
289 [Arguments] ${expected_state}
290 # Description of argument(s):
291 # expected_led_status Expected value of Identify LED.
292
George Keishingb0614552022-07-08 02:52:57 -0500293 # Get the following URI(s) and iterate to find the attribute IndicatorLED.
294 # Example:
295 # /redfish/v1/Systems/system
296 # /redfish/v1/Systems/hypervisor
297
George Keishing52eb7c22022-03-11 10:58:53 -0600298 # Python module: get_member_list(resource_path)
299 ${systems}= Redfish_Utils.Get Member List /redfish/v1/Systems
300 FOR ${system} IN @{systems}
301 ${led_value}= Redfish.Get Attribute ${system} IndicatorLED
George Keishingf6b4d532022-07-08 07:07:54 -0500302 # Get attribute return None if IndicatorLED does not exist in the URI.
George Keishingb0614552022-07-08 02:52:57 -0500303 Continue For Loop If '${led_value}' == 'None'
George Keishing52eb7c22022-03-11 10:58:53 -0600304 Should Be True '${led_value}' == '${expected_state}'
305 END
nagarjunb2298450742022-04-19 12:00:02 +0530306
307
308Verify Channel Auth Capabilities
309 [Documentation] Verify authentication capabilities for given channel and privilege.
310 [Arguments] ${channel} ${privilege_level}
311
312 # Description of argument(s):
313 # channel Interface channel number.
George Keishing13b7afd2022-05-23 07:36:16 -0500314 # privilege_level User Privilege level (e.g. 4-Administator, 3-Operator, 2-Readonly).
nagarjunb2298450742022-04-19 12:00:02 +0530315
316 # Python module: get_channel_auth_capabilities(channel_number, privilege_level)
317 ${channel_auth_cap}= Get Channel Auth Capabilities ${channel} ${privilege_level}
318 Rprint Vars channel_auth_cap
319
320 Valid Value channel_auth_cap['channel_number'] ['${channel}']
321 Valid Value channel_auth_cap['kg_status'] ['default (all zeroes)']
322 Valid Value channel_auth_cap['per_message_authentication'] ['enabled']
323 Valid Value channel_auth_cap['user_level_authentication'] ['enabled']
324 Valid Value channel_auth_cap['non-null_user_names_exist'] ['yes']
325 Valid Value channel_auth_cap['null_user_names_exist'] ['no']
326 Valid Value channel_auth_cap['anonymous_login_enabled'] ['no']
327 Valid Value channel_auth_cap['channel_supports_ipmi_v1.5'] ['no']
328 Valid Value channel_auth_cap['channel_supports_ipmi_v2.0'] ['yes']
329
330
George Keishing13b7afd2022-05-23 07:36:16 -0500331Verify Channel Auth Capabilities For Invalid Channel
nagarjunb2298450742022-04-19 12:00:02 +0530332 [Documentation] Verify authentication capabilities of invalid channels.
333 [Arguments] ${channel}
334
335 # Description of argument(s):
336 # channel Interface channel number.
337
338 ${channel_in_hex}= Convert To Hex ${channel} prefix=0x
339 ${cmd}= Catenate ${IPMI_RAW_CMD['Get Channel Auth Cap']['get'][0]} ${channel_in_hex} 0x04
340
341 Verify Invalid IPMI Command ${cmd} 0xcc
342
343
344Verify Channel Auth Command For Invalid Data Length
345 [Documentation] Verify channel authentication command for invalid data length.
346 [Arguments] ${byte_length}
347
348 # Description of argument(s):
349 # byte_length high or low.
350 # e.g. high - add extra byte to request data like "0x06 0x38 0x01 0x04 0x01".
351 # low - reduce bytes in actual request data like "0x06 0x38".
352
353 ${req_cmd}= Run Keyword If '${byte_length}' == 'low'
354 ... Catenate ${IPMI_RAW_CMD['Get Channel Auth Cap']['get'][0]} ${CHANNEL_NUMBER}
355 ... ELSE
356 ... Catenate ${IPMI_RAW_CMD['Get Channel Auth Cap']['get'][0]} ${CHANNEL_NUMBER} 0x04 0x01
357
358 Verify Invalid IPMI Command ${req_cmd} 0xc7