blob: 8e23347ce5491d4e6ad77f7631c0146ace933aff [file] [log] [blame]
George Keishing364e93d2020-03-05 04:31:49 -06001*** Settings ***
2
3Documentation Module to test IPMI network functionality.
4Resource ../lib/ipmi_client.robot
5Resource ../lib/openbmc_ffdc.robot
6Resource ../lib/bmc_network_utils.robot
7Library ../lib/ipmi_utils.py
8Library ../lib/gen_robot_valid.py
9Library ../lib/var_funcs.py
10Library ../lib/bmc_network_utils.py
Tony Leec03c8e22020-03-25 13:41:07 +080011Variables ../data/ipmi_raw_cmd_table.py
George Keishing364e93d2020-03-05 04:31:49 -060012
13Suite Setup Redfish.Login
14Test Setup Printn
15Test Teardown FFDC On Test Case Fail
16
George Keishing87dc4422023-10-20 12:56:30 +053017Force Tags IPMI_Network_Verification
chithrag4ad123a2022-04-12 19:26:05 +000018
19*** Variables ***
George Keishing87dc4422023-10-20 12:56:30 +053020
chithrag4ad123a2022-04-12 19:26:05 +000021${set_mac_address} 02:f4:43:24:e7:1a
22${Invalid_mac_address} 11:f4:43:24:e7:1a
23
24
George Keishing364e93d2020-03-05 04:31:49 -060025*** Test Cases ***
26
27Retrieve IP Address Via IPMI And Verify Using Redfish
28 [Documentation] Retrieve IP address using IPMI and verify using Redfish.
George Keishingb98036a2022-01-31 12:39:47 -060029 [Tags] Retrieve_IP_Address_Via_IPMI_And_Verify_Using_Redfish
George Keishing364e93d2020-03-05 04:31:49 -060030
31 ${active_channel_config}= Get Active Channel Config
32 FOR ${channel_number} IN @{active_channel_config.keys()}
33 Verify Channel Info ${channel_number} IPv4StaticAddresses ${active_channel_config}
34 END
35
36Retrieve Default Gateway Via IPMI And Verify
37 [Documentation] Retrieve default gateway via IPMI and verify it's existence on the BMC.
38 [Tags] Retrieve_Default_Gateway_Via_IPMI_And_Verify
39
40 ${lan_print_ipmi}= Get LAN Print Dict
41
42 Verify Gateway On BMC ${lan_print_ipmi['Default Gateway IP']}
43
44
45Retrieve MAC Address Via IPMI And Verify Using Redfish
46 [Documentation] Retrieve MAC address via IPMI and verify using Redfish.
47 [Tags] Retrieve_MAC_Address_Via_IPMI_And_Verify_Using_Redfish
48
49 ${active_channel_config}= Get Active Channel Config
50 FOR ${channel_number} IN @{active_channel_config.keys()}
51 Verify Channel Info ${channel_number} MACAddress ${active_channel_config}
52 END
53
54
55Test Valid IPMI Channels Supported
56 [Documentation] Verify IPMI channels supported on a given system.
57 [Tags] Test_Valid_IPMI_Channels_Supported
58
59 ${channel_count}= Get Physical Network Interface Count
George Keishing24da2652021-12-21 22:33:01 -060060 Should Be True ${channel_count} > 0
61 ... msg=IPMI Lan channel support expected > 0 but found ${channel_count}
62 ${channel_count}= Evaluate ${channel_count} + 1
George Keishing364e93d2020-03-05 04:31:49 -060063
64 # Note: IPMI network channel logically starts from 1.
65 FOR ${channel_number} IN RANGE 1 ${channel_count}
66 Run IPMI Standard Command lan print ${channel_number}
67 END
68
69
70Test Invalid IPMI Channel Response
71 [Documentation] Verify invalid IPMI channels supported response.
72 [Tags] Test_Invalid_IPMI_Channel_Response
73
George Keishing364e93d2020-03-05 04:31:49 -060074 # Example of invalid channel:
75 # $ ipmitool -I lanplus -H xx.xx.xx.xx -P password lan print 3
76 # Get Channel Info command failed: Parameter out of range
77 # Invalid channel: 3
78
ishwaryamathim27d779d2023-11-10 05:42:47 +000079 @{inactive_channel_list}= Get Invalid Channel Number List
80 FOR ${channel_number} IN @{inactive_channel_list}
81 ${stdout}= Run IPMI Standard Command
82 ... lan print ${channel_number} fail_on_err=${0}
83 Should Contain ${stdout} Invalid channel
84 ... msg=IPMI channel ${channel_number} is invalid but seen working.
85 END
George Keishing364e93d2020-03-05 04:31:49 -060086
87
88Get IP Address Source And Verify Using Redfish
89 [Documentation] Get IP address source and verify it using Redfish.
90 [Tags] Get_IP_Address_Source_And_Verify_Using_Redfish
91
92 ${active_channel_config}= Get Active Channel Config
93 ${lan_config}= Get LAN Print Dict ${CHANNEL_NUMBER}
94
95 ${ipv4_addresses}= Redfish.Get Attribute
ganesanb4d430282023-04-27 14:33:23 +000096 ... /redfish/v1/Managers/${MANAGER_ID}/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']}
George Keishing364e93d2020-03-05 04:31:49 -060097 ... IPv4Addresses
98
99 FOR ${ipv4_address} IN @{ipv4_addresses}
100 ${ip_address_source}=
101 ... Set Variable if '${ipv4_address['Address']}' == '${lan_config['IP Address']}'
102 ... ${ipv4_address['AddressOrigin']} Address
103 Exit For Loop IF "${ip_address_source}" != 'None'
104 END
105
106 Valid Value lan_config['IP Address Source'] ['${ip_address_source}']
107
108
Tony Leec03c8e22020-03-25 13:41:07 +0800109Verify Get Set In Progress
110 [Documentation] Verify Get Set In Progress which belongs to LAN Configuration Parameters
111 ... via IPMI raw Command.
Tony Lee5e735522020-05-13 20:23:38 +0800112 [Tags] Verify_Get_Set_In_Progress
Tony Leec03c8e22020-03-25 13:41:07 +0800113
114 ${ipmi_output}= Run IPMI Command
115 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Get'][0]} ${CHANNEL_NUMBER} 0x00 0x00 0x00
116
117 ${ipmi_output}= Split String ${ipmi_output}
118 ${set_in_progress_value}= Set Variable ${ipmi_output[1]}
119
120 # 00b = set complete.
121 # 01b = set in progress.
122 Should Contain Any ${set_in_progress_value} 00 01
123
124
125Verify Cipher Suite Entry Count
126 [Documentation] Verify cipher suite entry count which belongs to LAN Configuration Parameters
127 ... via IPMI raw Command.
Tony Lee5e735522020-05-13 20:23:38 +0800128 [Tags] Verify_Cipher_Suite_Entry_Count
Tony Leec03c8e22020-03-25 13:41:07 +0800129
130 ${ipmi_output}= Run IPMI Command
131 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Get'][0]} ${CHANNEL_NUMBER} 0x16 0x00 0x00
132 ${cipher_suite_entry_count}= Split String ${ipmi_output}
133
134 # Convert minor cipher suite entry count from BCD format to integer. i.e. 01 to 1.
135 ${cipher_suite_entry_count[1]}= Convert To Integer ${cipher_suite_entry_count[1]}
136 ${cnt}= Get length ${valid_ciphers}
137
138 Should be Equal ${cipher_suite_entry_count[1]} ${cnt}
139
140
141Verify Authentication Type Support
142 [Documentation] Verify authentication type support which belongs to LAN Configuration Parameters
143 ... via IPMI raw Command.
Tony Lee5e735522020-05-13 20:23:38 +0800144 [Tags] Verify_Authentication_Type_Support
Tony Leec03c8e22020-03-25 13:41:07 +0800145
146 ${ipmi_output}= Run IPMI Command
147 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Get'][0]} ${CHANNEL_NUMBER} 0x01 0x00 0x00
148
149 ${authentication_type_support}= Split String ${ipmi_output}
150 # All bits:
151 # 1b = supported
152 # 0b = authentication type not available for use
153 # [5] - OEM proprietary (per OEM identified by the IANA OEM ID in the RMCP Ping Response)
154 # [4] - straight password / key
155 # [3] - reserved
156 # [2] - MD5
157 # [1] - MD2
158 # [0] - none
159 Should Contain Any ${authentication_type_support[1]} 00 01 02 03 04 05
160
161
chithrag4ad123a2022-04-12 19:26:05 +0000162Verify Set In Progress
163 [Documentation] Verify Set In Progress which belongs to LAN Configuration Parameters
164 ... via IPMI raw Command.
165 [Tags] Verify_Set_In_Progress
166
167 # Set the Set In Progress
168 ${output_msg}= Run Inband IPMI Raw Command
169 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][0]} ${CHANNEL_NUMBER} 0x00 0x01
170
171 # Get the Set In Progress
172 ${ipmi_output}= Run Inband IPMI Raw Command
173 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Get'][0]} ${CHANNEL_NUMBER} 0x00 0x00 0x00
174
175 # Verify the response
176 ${ipmi_output}= Split String ${ipmi_output}
177 ${set_in_progress_value}= Set Variable ${ipmi_output[1]}
178
179 # 01b = set in progress.
180 Should be Equal ${set_in_progress_value} 01
181
182 # set back to default.
183 Run IPMI Command ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][0]} ${CHANNEL_NUMBER} 0x00 0x00
184
185 # Get the Set In Progress.
186 ${ipmi_output}= Run Inband IPMI Raw Command
187 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Get'][0]} ${CHANNEL_NUMBER} 0x00 0x00 0x00
188
189 # Verify the response.
190 ${ipmi_output}= Split String ${ipmi_output}
191 ${set_in_progress_value}= Set Variable ${ipmi_output[1]}
192
193 # 00b = set complete.
194 Should be Equal ${set_in_progress_value} 00
195
196
197Verify Invalid Set MAC Address Via IPMI
198 [Documentation] Verify Get and Set MAC address via IPMI.
199 [Tags] Verify_Invalid_Set_MAC_Address_Via_IPMI
200
201 # MAC to hexa string.
202 ${Invalid_mac_address_hex}= Mac Address To Hex String ${Invalid_mac_address}
203
204 # Set MAC Address with invalid data.
George Keishing6e641262022-05-05 10:46:22 -0500205 ${cmd}= Catenate ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][0]} ${CHANNEL_NUMBER}
ishwaryamathim27d779d2023-11-10 05:42:47 +0000206 ... 0x05 ${Invalid_mac_address_hex}
207 ${ipmi_set_output}= Run Inband IPMI Raw Command ${cmd} fail_on_err=0
chithrag4ad123a2022-04-12 19:26:05 +0000208
209 Should Contain ${ipmi_set_output} ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][3]}
210
211
George Keishinge45d2622022-05-05 07:27:30 -0500212Verify Get And Set MAC Address Via IPMI
chithrag4ad123a2022-04-12 19:26:05 +0000213 [Documentation] Verify Get and Set MAC address via IPMI.
George Keishinge45d2622022-05-05 07:27:30 -0500214 [Tags] Verify_Get_And_Set_MAC_Address_Via_IPMI
chithrag4ad123a2022-04-12 19:26:05 +0000215 [Setup] Fetch The Default Mac Address
216 [Teardown] Set Default Mac And Verify ${ipmi_default_mac_split}
217
218 # MAC to hexa string.
219 ${mac_address_hex}= Mac Address To Hex String ${set_mac_address}
220
221 # Set the MAC address.
George Keishing6e641262022-05-05 10:46:22 -0500222 ${cmd}= Catenate ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][0]} ${CHANNEL_NUMBER}
ishwaryamathim27d779d2023-11-10 05:42:47 +0000223 ... 0x05 ${mac_address_hex}
224 ${ipmi_set_output}= Run Inband IPMI Raw Command ${cmd} fail_on_err=0
chithrag4ad123a2022-04-12 19:26:05 +0000225
226 # Get the MAC address and verify.
227 ${ipmi_output}= Run Inband IPMI Raw Command
228 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Get'][0]} ${CHANNEL_NUMBER} 0x05 0x00 0x00
229 ${ipmi_output_split}= Split String ${ipmi_output}
230 ${get_mac}= Evaluate ":".join(${ipmi_output_split[1:]})
231
232 Should be Equal ${get_mac} ${set_mac_address}
233
234
235Verify Cipher Suite Privilege
236 [Documentation] Verify cipher suite privilege which belongs to LAN Configuration Parameters
237 ... via IPMI raw Command.
238 [Tags] Verify_Cipher_Suite_Privilege
239
240 # Get the Cipher Suite privilege and verify the response.
241 ${ipmi_output}= Run Inband IPMI Raw Command
242 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Get'][0]} ${CHANNEL_NUMBER} 0x18 0x00 0x00
243 ${cipher_suite_privilege}= Split String ${ipmi_output}
244
245 Should be Equal '${${cipher_suite_privilege}[0]}' '11'
246 # 00b = reserved.
247 Should Contain Any '${cipher_suite_privilege[1]}' '00' '0'
248
249 ${cipher_suite_privilege_length}= Get length ${cipher_suite_privilege}
250 Should be Equal '${cipher_suite_privilege_length}' '10'
251
252 #44b = Maximum privilege for cipher suite.
253 FOR ${channel_number} IN RANGE 2 ${cipher_suite_privilege_length}
254 Should be Equal '${cipher_suite_privilege[${channel_number}]}' '44'
255 END
256
257
258Verify Set On Authentication Type
259 [Documentation] Verify Set On Authentication Type which belongs to LAN Configuration Parameters
260 ... via IPMI raw Command.
261 [Tags] Verify_Set_On_Authentication_Type
262
263 # Set Authentication Type and expect error.
264 ${ipmi_output}= Run Inband IPMI Raw Command
265 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][0]} ${CHANNEL_NUMBER} 0x01 0x01 fail_on_err=0
266
267 Should Contain ${ipmi_output} ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][2]}
268
269
270Verify IP Address Source Set To Address Loaded By BIOS
271 [Documentation] Verify Set IP Address Source to address loaded by BIOS or system software via IPMI.
272 [Tags] Verify_IP_Address_Source_Set_To_Address_Loaded_By_BIOS
273
274 # Set IP address source to address loaded by BIOS or system software.
275 ${ipmi_output}= Run Keyword and Expect Error *${IPMI_RAW_CMD['LAN_Config_Params']['Set'][3]}*
George Keishing6e641262022-05-05 10:46:22 -0500276 ... Run Inband IPMI Raw Command
277 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][0]} 0x0${CHANNEL_NUMBER} 0x04 0x03
chithrag4ad123a2022-04-12 19:26:05 +0000278
279
280Verify IP Address Source Set To Address Obtained By BMC
281 [Documentation] Verify Set IP Address Source to address obtained by,
282 ... BMC running other address assignment protocol via IPMI.
283 [Tags] Verify_IP_Address_Source_Set_To_Address_Obtained_By_BMC
284
285 # Set IP address source to address obtained by BMC running other address assignment protocol
286 ${ipmi_output}= Run Keyword and Expect Error *${IPMI_RAW_CMD['LAN_Config_Params']['Set'][3]}*
George Keishing6e641262022-05-05 10:46:22 -0500287 ... Run Inband IPMI Raw Command
288 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][0]} 0x0${CHANNEL_NUMBER} 0x04 0x04
chithrag4ad123a2022-04-12 19:26:05 +0000289
290
291Verify IP Address Source Set To Unspecified Address Source
292 [Documentation] Verify Set IP Address source to unspecified address source via IPMI.
293 [Tags] Verify_IP_Address_Source_Set_To_Unspecified_Address_Source
294
295 # Set IP address source to unspecified address source.
296 ${ipmi_output}= Run Keyword and Expect Error *${IPMI_RAW_CMD['LAN_Config_Params']['Set'][3]}*
George Keishing6e641262022-05-05 10:46:22 -0500297 ... Run Inband IPMI Raw Command
298 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][0]} 0x0${CHANNEL_NUMBER} 0x04 0x00
chithrag4ad123a2022-04-12 19:26:05 +0000299
300
George Keishing364e93d2020-03-05 04:31:49 -0600301*** Keywords ***
302
303Get Physical Network Interface Count
304 [Documentation] Return valid physical network interfaces count.
305 # Example:
306 # link/ether 22:3a:7f:70:92:cb brd ff:ff:ff:ff:ff:ff
307 # link/ether 0e:8e:0d:6b:e9:e4 brd ff:ff:ff:ff:ff:ff
308
309 ${mac_entry_list}= Get BMC MAC Address List
310 ${mac_unique_list}= Remove Duplicates ${mac_entry_list}
311 ${physical_interface_count}= Get Length ${mac_unique_list}
312
313 [Return] ${physical_interface_count}
314
315
316Verify Channel Info
317 [Documentation] Verify the channel info.
318 [Arguments] ${channel_number} ${network_parameter} ${active_channel_config}
319
320 Run Keyword If '${network_parameter}' == 'IPv4StaticAddresses'
321 ... Verify IPv4 Static Address ${channel_number} ${active_channel_config}
322 ... ELSE IF '${network_parameter}' == 'MACAddress'
323 ... Verify MAC Address ${channel_number} ${active_channel_config}
324
325
326Verify IPv4 Static Address
327 [Documentation] Verify the IPv4 Static Address.
328 [Arguments] ${channel_number} ${active_channel_config}
329
330 ${lan_print_ipmi}= Get LAN Print Dict ${channel_number}
331 ${ipv4_static_addresses}= Redfish.Get Attribute
332 ... ${REDFISH_NW_ETH_IFACE}${active_channel_config['${channel_number}']['name']} IPv4StaticAddresses
333 ${redfish_ips}= Nested Get Address ${ipv4_static_addresses}
334 Rprint Vars lan_print_ipmi ipv4_static_addresses redfish_ips
335 Valid Value lan_print_ipmi['IP Address'] ${redfish_ips}
336
337
338Verify MAC Address
339 [Documentation] Verify the MAC Address.
340 [Arguments] ${channel_number} ${active_channel_config}
341
342 ${lan_print_ipmi}= Get LAN Print Dict ${channel_number}
343 ${redfish_mac_address}= Redfish.Get Attribute
344 ... ${REDFISH_NW_ETH_IFACE}${active_channel_config['${channel_number}']['name']} MACAddress
345 Rprint Vars lan_print_ipmi redfish_mac_address
346 Valid Value lan_print_ipmi['MAC Address'] ['${redfish_mac_address}']
chithrag4ad123a2022-04-12 19:26:05 +0000347
348
349Fetch The Default Mac Address
350 [Documentation] Fetch The Default MAC Address.
351
352 # Get Default MAC Address.
353 ${ipmi_get_default_mac}= Run Inband IPMI Raw Command
354 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Get'][0]} ${CHANNEL_NUMBER} 0x05 0x00 0x00
355 Set Test Variable ${ipmi_get_default_mac}
356
357 # After splitting, list will have each byte of MAC address.
358 ${ipmi_default_mac_split}= Split String ${ipmi_get_default_mac}
359 Set Test Variable ${ipmi_default_mac_split}
360
361
362Set Default Mac And Verify
363 [Documentation] Set Default Mac And Verify.
364 [Arguments] ${default_mac}=${ipmi_default_mac_split}
365
366 ${set_default_mac}= Evaluate ":".join(${default_mac[1:]})
367 ${default_mac_address_hex}= Mac Address To Hex String ${set_default_mac}
368
369 # Set the Default MAC address.
George Keishing6e641262022-05-05 10:46:22 -0500370 ${cmd}= Catenate ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][0]} ${CHANNEL_NUMBER}
ishwaryamathim27d779d2023-11-10 05:42:47 +0000371 ... 0x05 ${default_mac_address_hex}
372 ${ipmi_set_output}= Run Inband IPMI Raw Command ${cmd} fail_on_err=0
chithrag4ad123a2022-04-12 19:26:05 +0000373
374 # check whether the default MAC is set.
375 ${ipmi_get_mac}= Run Inband IPMI Raw Command
376 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Get'][0]} ${CHANNEL_NUMBER} 0x05 0x00 0x00
377
378 ${ipmi_out}= Split String ${ipmi_get_mac}
379 Should be Equal ${default_mac} ${ipmi_out}