blob: 35a0df6635517dc463cb4e26e31c37a936531ef7 [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
17Force Tags IPMI_Network_Verify
18
chithrag4ad123a2022-04-12 19:26:05 +000019
20*** Variables ***
21${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
74 ${channel_count}= Get Physical Network Interface Count
75
76 # To target invalid channel, increment count.
77 ${channel_number}= Evaluate ${channel_count} + 1
78
79 # Example of invalid channel:
80 # $ ipmitool -I lanplus -H xx.xx.xx.xx -P password lan print 3
81 # Get Channel Info command failed: Parameter out of range
82 # Invalid channel: 3
83
84 ${stdout}= Run External IPMI Standard Command
85 ... lan print ${channel_number} fail_on_err=${0}
86 Should Contain ${stdout} Invalid channel
87 ... msg=IPMI channel ${channel_number} is invalid but seen working.
88
89
90Get IP Address Source And Verify Using Redfish
91 [Documentation] Get IP address source and verify it using Redfish.
92 [Tags] Get_IP_Address_Source_And_Verify_Using_Redfish
93
94 ${active_channel_config}= Get Active Channel Config
95 ${lan_config}= Get LAN Print Dict ${CHANNEL_NUMBER}
96
97 ${ipv4_addresses}= Redfish.Get Attribute
ganesanb4d430282023-04-27 14:33:23 +000098 ... /redfish/v1/Managers/${MANAGER_ID}/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']}
George Keishing364e93d2020-03-05 04:31:49 -060099 ... IPv4Addresses
100
101 FOR ${ipv4_address} IN @{ipv4_addresses}
102 ${ip_address_source}=
103 ... Set Variable if '${ipv4_address['Address']}' == '${lan_config['IP Address']}'
104 ... ${ipv4_address['AddressOrigin']} Address
105 Exit For Loop IF "${ip_address_source}" != 'None'
106 END
107
108 Valid Value lan_config['IP Address Source'] ['${ip_address_source}']
109
110
Tony Leec03c8e22020-03-25 13:41:07 +0800111Verify Get Set In Progress
112 [Documentation] Verify Get Set In Progress which belongs to LAN Configuration Parameters
113 ... via IPMI raw Command.
Tony Lee5e735522020-05-13 20:23:38 +0800114 [Tags] Verify_Get_Set_In_Progress
Tony Leec03c8e22020-03-25 13:41:07 +0800115
116 ${ipmi_output}= Run IPMI Command
117 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Get'][0]} ${CHANNEL_NUMBER} 0x00 0x00 0x00
118
119 ${ipmi_output}= Split String ${ipmi_output}
120 ${set_in_progress_value}= Set Variable ${ipmi_output[1]}
121
122 # 00b = set complete.
123 # 01b = set in progress.
124 Should Contain Any ${set_in_progress_value} 00 01
125
126
127Verify Cipher Suite Entry Count
128 [Documentation] Verify cipher suite entry count which belongs to LAN Configuration Parameters
129 ... via IPMI raw Command.
Tony Lee5e735522020-05-13 20:23:38 +0800130 [Tags] Verify_Cipher_Suite_Entry_Count
Tony Leec03c8e22020-03-25 13:41:07 +0800131
132 ${ipmi_output}= Run IPMI Command
133 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Get'][0]} ${CHANNEL_NUMBER} 0x16 0x00 0x00
134 ${cipher_suite_entry_count}= Split String ${ipmi_output}
135
136 # Convert minor cipher suite entry count from BCD format to integer. i.e. 01 to 1.
137 ${cipher_suite_entry_count[1]}= Convert To Integer ${cipher_suite_entry_count[1]}
138 ${cnt}= Get length ${valid_ciphers}
139
140 Should be Equal ${cipher_suite_entry_count[1]} ${cnt}
141
142
143Verify Authentication Type Support
144 [Documentation] Verify authentication type support which belongs to LAN Configuration Parameters
145 ... via IPMI raw Command.
Tony Lee5e735522020-05-13 20:23:38 +0800146 [Tags] Verify_Authentication_Type_Support
Tony Leec03c8e22020-03-25 13:41:07 +0800147
148 ${ipmi_output}= Run IPMI Command
149 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Get'][0]} ${CHANNEL_NUMBER} 0x01 0x00 0x00
150
151 ${authentication_type_support}= Split String ${ipmi_output}
152 # All bits:
153 # 1b = supported
154 # 0b = authentication type not available for use
155 # [5] - OEM proprietary (per OEM identified by the IANA OEM ID in the RMCP Ping Response)
156 # [4] - straight password / key
157 # [3] - reserved
158 # [2] - MD5
159 # [1] - MD2
160 # [0] - none
161 Should Contain Any ${authentication_type_support[1]} 00 01 02 03 04 05
162
163
chithrag4ad123a2022-04-12 19:26:05 +0000164Verify Set In Progress
165 [Documentation] Verify Set In Progress which belongs to LAN Configuration Parameters
166 ... via IPMI raw Command.
167 [Tags] Verify_Set_In_Progress
168
169 # Set the Set In Progress
170 ${output_msg}= Run Inband IPMI Raw Command
171 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][0]} ${CHANNEL_NUMBER} 0x00 0x01
172
173 # Get the Set In Progress
174 ${ipmi_output}= Run Inband IPMI Raw Command
175 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Get'][0]} ${CHANNEL_NUMBER} 0x00 0x00 0x00
176
177 # Verify the response
178 ${ipmi_output}= Split String ${ipmi_output}
179 ${set_in_progress_value}= Set Variable ${ipmi_output[1]}
180
181 # 01b = set in progress.
182 Should be Equal ${set_in_progress_value} 01
183
184 # set back to default.
185 Run IPMI Command ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][0]} ${CHANNEL_NUMBER} 0x00 0x00
186
187 # Get the Set In Progress.
188 ${ipmi_output}= Run Inband IPMI Raw Command
189 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Get'][0]} ${CHANNEL_NUMBER} 0x00 0x00 0x00
190
191 # Verify the response.
192 ${ipmi_output}= Split String ${ipmi_output}
193 ${set_in_progress_value}= Set Variable ${ipmi_output[1]}
194
195 # 00b = set complete.
196 Should be Equal ${set_in_progress_value} 00
197
198
199Verify Invalid Set MAC Address Via IPMI
200 [Documentation] Verify Get and Set MAC address via IPMI.
201 [Tags] Verify_Invalid_Set_MAC_Address_Via_IPMI
202
203 # MAC to hexa string.
204 ${Invalid_mac_address_hex}= Mac Address To Hex String ${Invalid_mac_address}
205
206 # Set MAC Address with invalid data.
George Keishing6e641262022-05-05 10:46:22 -0500207 ${cmd}= Catenate ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][0]} ${CHANNEL_NUMBER}
208 ... 0x05 ${Invalid_mac_address_hex} fail_on_err=0
209 ${ipmi_set_output}= Run Inband IPMI Raw Command ${cmd}
chithrag4ad123a2022-04-12 19:26:05 +0000210
211 Should Contain ${ipmi_set_output} ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][3]}
212
213
George Keishinge45d2622022-05-05 07:27:30 -0500214Verify Get And Set MAC Address Via IPMI
chithrag4ad123a2022-04-12 19:26:05 +0000215 [Documentation] Verify Get and Set MAC address via IPMI.
George Keishinge45d2622022-05-05 07:27:30 -0500216 [Tags] Verify_Get_And_Set_MAC_Address_Via_IPMI
chithrag4ad123a2022-04-12 19:26:05 +0000217 [Setup] Fetch The Default Mac Address
218 [Teardown] Set Default Mac And Verify ${ipmi_default_mac_split}
219
220 # MAC to hexa string.
221 ${mac_address_hex}= Mac Address To Hex String ${set_mac_address}
222
223 # Set the MAC address.
George Keishing6e641262022-05-05 10:46:22 -0500224 ${cmd}= Catenate ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][0]} ${CHANNEL_NUMBER}
225 ... 0x05 ${mac_address_hex} fail_on_err=0
226 ${ipmi_set_output}= Run Inband IPMI Raw Command ${cmd}
chithrag4ad123a2022-04-12 19:26:05 +0000227
228 # Get the MAC address and verify.
229 ${ipmi_output}= Run Inband IPMI Raw Command
230 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Get'][0]} ${CHANNEL_NUMBER} 0x05 0x00 0x00
231 ${ipmi_output_split}= Split String ${ipmi_output}
232 ${get_mac}= Evaluate ":".join(${ipmi_output_split[1:]})
233
234 Should be Equal ${get_mac} ${set_mac_address}
235
236
237Verify Cipher Suite Privilege
238 [Documentation] Verify cipher suite privilege which belongs to LAN Configuration Parameters
239 ... via IPMI raw Command.
240 [Tags] Verify_Cipher_Suite_Privilege
241
242 # Get the Cipher Suite privilege and verify the response.
243 ${ipmi_output}= Run Inband IPMI Raw Command
244 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Get'][0]} ${CHANNEL_NUMBER} 0x18 0x00 0x00
245 ${cipher_suite_privilege}= Split String ${ipmi_output}
246
247 Should be Equal '${${cipher_suite_privilege}[0]}' '11'
248 # 00b = reserved.
249 Should Contain Any '${cipher_suite_privilege[1]}' '00' '0'
250
251 ${cipher_suite_privilege_length}= Get length ${cipher_suite_privilege}
252 Should be Equal '${cipher_suite_privilege_length}' '10'
253
254 #44b = Maximum privilege for cipher suite.
255 FOR ${channel_number} IN RANGE 2 ${cipher_suite_privilege_length}
256 Should be Equal '${cipher_suite_privilege[${channel_number}]}' '44'
257 END
258
259
260Verify Set On Authentication Type
261 [Documentation] Verify Set On Authentication Type which belongs to LAN Configuration Parameters
262 ... via IPMI raw Command.
263 [Tags] Verify_Set_On_Authentication_Type
264
265 # Set Authentication Type and expect error.
266 ${ipmi_output}= Run Inband IPMI Raw Command
267 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][0]} ${CHANNEL_NUMBER} 0x01 0x01 fail_on_err=0
268
269 Should Contain ${ipmi_output} ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][2]}
270
271
272Verify IP Address Source Set To Address Loaded By BIOS
273 [Documentation] Verify Set IP Address Source to address loaded by BIOS or system software via IPMI.
274 [Tags] Verify_IP_Address_Source_Set_To_Address_Loaded_By_BIOS
275
276 # Set IP address source to address loaded by BIOS or system software.
277 ${ipmi_output}= Run Keyword and Expect Error *${IPMI_RAW_CMD['LAN_Config_Params']['Set'][3]}*
George Keishing6e641262022-05-05 10:46:22 -0500278 ... Run Inband IPMI Raw Command
279 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][0]} 0x0${CHANNEL_NUMBER} 0x04 0x03
chithrag4ad123a2022-04-12 19:26:05 +0000280
281
282Verify IP Address Source Set To Address Obtained By BMC
283 [Documentation] Verify Set IP Address Source to address obtained by,
284 ... BMC running other address assignment protocol via IPMI.
285 [Tags] Verify_IP_Address_Source_Set_To_Address_Obtained_By_BMC
286
287 # Set IP address source to address obtained by BMC running other address assignment protocol
288 ${ipmi_output}= Run Keyword and Expect Error *${IPMI_RAW_CMD['LAN_Config_Params']['Set'][3]}*
George Keishing6e641262022-05-05 10:46:22 -0500289 ... Run Inband IPMI Raw Command
290 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][0]} 0x0${CHANNEL_NUMBER} 0x04 0x04
chithrag4ad123a2022-04-12 19:26:05 +0000291
292
293Verify IP Address Source Set To Unspecified Address Source
294 [Documentation] Verify Set IP Address source to unspecified address source via IPMI.
295 [Tags] Verify_IP_Address_Source_Set_To_Unspecified_Address_Source
296
297 # Set IP address source to unspecified address source.
298 ${ipmi_output}= Run Keyword and Expect Error *${IPMI_RAW_CMD['LAN_Config_Params']['Set'][3]}*
George Keishing6e641262022-05-05 10:46:22 -0500299 ... Run Inband IPMI Raw Command
300 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][0]} 0x0${CHANNEL_NUMBER} 0x04 0x00
chithrag4ad123a2022-04-12 19:26:05 +0000301
302
George Keishing364e93d2020-03-05 04:31:49 -0600303*** Keywords ***
304
305Get Physical Network Interface Count
306 [Documentation] Return valid physical network interfaces count.
307 # Example:
308 # link/ether 22:3a:7f:70:92:cb brd ff:ff:ff:ff:ff:ff
309 # link/ether 0e:8e:0d:6b:e9:e4 brd ff:ff:ff:ff:ff:ff
310
311 ${mac_entry_list}= Get BMC MAC Address List
312 ${mac_unique_list}= Remove Duplicates ${mac_entry_list}
313 ${physical_interface_count}= Get Length ${mac_unique_list}
314
315 [Return] ${physical_interface_count}
316
317
318Verify Channel Info
319 [Documentation] Verify the channel info.
320 [Arguments] ${channel_number} ${network_parameter} ${active_channel_config}
321
322 Run Keyword If '${network_parameter}' == 'IPv4StaticAddresses'
323 ... Verify IPv4 Static Address ${channel_number} ${active_channel_config}
324 ... ELSE IF '${network_parameter}' == 'MACAddress'
325 ... Verify MAC Address ${channel_number} ${active_channel_config}
326
327
328Verify IPv4 Static Address
329 [Documentation] Verify the IPv4 Static Address.
330 [Arguments] ${channel_number} ${active_channel_config}
331
332 ${lan_print_ipmi}= Get LAN Print Dict ${channel_number}
333 ${ipv4_static_addresses}= Redfish.Get Attribute
334 ... ${REDFISH_NW_ETH_IFACE}${active_channel_config['${channel_number}']['name']} IPv4StaticAddresses
335 ${redfish_ips}= Nested Get Address ${ipv4_static_addresses}
336 Rprint Vars lan_print_ipmi ipv4_static_addresses redfish_ips
337 Valid Value lan_print_ipmi['IP Address'] ${redfish_ips}
338
339
340Verify MAC Address
341 [Documentation] Verify the MAC Address.
342 [Arguments] ${channel_number} ${active_channel_config}
343
344 ${lan_print_ipmi}= Get LAN Print Dict ${channel_number}
345 ${redfish_mac_address}= Redfish.Get Attribute
346 ... ${REDFISH_NW_ETH_IFACE}${active_channel_config['${channel_number}']['name']} MACAddress
347 Rprint Vars lan_print_ipmi redfish_mac_address
348 Valid Value lan_print_ipmi['MAC Address'] ['${redfish_mac_address}']
chithrag4ad123a2022-04-12 19:26:05 +0000349
350
351Fetch The Default Mac Address
352 [Documentation] Fetch The Default MAC Address.
353
354 # Get Default MAC Address.
355 ${ipmi_get_default_mac}= Run Inband IPMI Raw Command
356 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Get'][0]} ${CHANNEL_NUMBER} 0x05 0x00 0x00
357 Set Test Variable ${ipmi_get_default_mac}
358
359 # After splitting, list will have each byte of MAC address.
360 ${ipmi_default_mac_split}= Split String ${ipmi_get_default_mac}
361 Set Test Variable ${ipmi_default_mac_split}
362
363
364Set Default Mac And Verify
365 [Documentation] Set Default Mac And Verify.
366 [Arguments] ${default_mac}=${ipmi_default_mac_split}
367
368 ${set_default_mac}= Evaluate ":".join(${default_mac[1:]})
369 ${default_mac_address_hex}= Mac Address To Hex String ${set_default_mac}
370
371 # Set the Default MAC address.
George Keishing6e641262022-05-05 10:46:22 -0500372 ${cmd}= Catenate ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][0]} ${CHANNEL_NUMBER}
373 ... 0x05 ${default_mac_address_hex} fail_on_err=0
374 ${ipmi_set_output}= Run Inband IPMI Raw Command ${cmd}
chithrag4ad123a2022-04-12 19:26:05 +0000375
376 # check whether the default MAC is set.
377 ${ipmi_get_mac}= Run Inband IPMI Raw Command
378 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Get'][0]} ${CHANNEL_NUMBER} 0x05 0x00 0x00
379
380 ${ipmi_out}= Split String ${ipmi_get_mac}
381 Should be Equal ${default_mac} ${ipmi_out}