blob: 5f03c337d258af31f56cab55193ca11c8be22dbd [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
Matt Fischer6fb70d92023-10-24 19:06:33 -060017Test 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
ishwaryamathime9cecb22023-11-10 06:14:21 +000031 ${all_channels_list}= Get Channel Number For All Interface
32 ${valid_channels_list}= Get Valid Channel Number ${all_channels_list}
33 ${ethernet_channels_list}= Get Channel Number For Valid Ethernet Interface
34 ... ${valid_channels_list}
35
36 FOR ${channel_number} IN @{ethernet_channels_list}
37 Verify Channel Info ${channel_number} IPv4StaticAddresses ${valid_channels_list}
George Keishing364e93d2020-03-05 04:31:49 -060038 END
39
ishwaryamathime9cecb22023-11-10 06:14:21 +000040
George Keishing364e93d2020-03-05 04:31:49 -060041Retrieve Default Gateway Via IPMI And Verify
42 [Documentation] Retrieve default gateway via IPMI and verify it's existence on the BMC.
43 [Tags] Retrieve_Default_Gateway_Via_IPMI_And_Verify
44
45 ${lan_print_ipmi}= Get LAN Print Dict
46
47 Verify Gateway On BMC ${lan_print_ipmi['Default Gateway IP']}
48
49
50Retrieve MAC Address Via IPMI And Verify Using Redfish
51 [Documentation] Retrieve MAC address via IPMI and verify using Redfish.
52 [Tags] Retrieve_MAC_Address_Via_IPMI_And_Verify_Using_Redfish
53
ishwaryamathime9cecb22023-11-10 06:14:21 +000054 ${all_channels_list}= Get Channel Number For All Interface
55 ${valid_channels_list}= Get Valid Channel Number ${all_channels_list}
56 ${ethernet_channels_list}= Get Channel Number For Valid Ethernet Interface
57 ... ${valid_channels_list}
58
59 FOR ${channel_number} IN @{ethernet_channels_list}
60 Verify Channel Info ${channel_number} MACAddress ${valid_channels_list}
George Keishing364e93d2020-03-05 04:31:49 -060061 END
62
63
64Test Valid IPMI Channels Supported
65 [Documentation] Verify IPMI channels supported on a given system.
66 [Tags] Test_Valid_IPMI_Channels_Supported
67
ishwaryamathime9cecb22023-11-10 06:14:21 +000068 @{active_channel_list}= Get Active Ethernet Channel List
69 Set Suite Variable @{active_channel_list}
George Keishing364e93d2020-03-05 04:31:49 -060070
ishwaryamathime9cecb22023-11-10 06:14:21 +000071 FOR ${channel_number} IN @{active_channel_list}
72 ${stdout}= Run IPMI Standard Command
73 ... lan print ${channel_number}
George Keishing364e93d2020-03-05 04:31:49 -060074 END
75
76
77Test Invalid IPMI Channel Response
78 [Documentation] Verify invalid IPMI channels supported response.
79 [Tags] Test_Invalid_IPMI_Channel_Response
80
George Keishing364e93d2020-03-05 04:31:49 -060081 # Example of invalid channel:
82 # $ ipmitool -I lanplus -H xx.xx.xx.xx -P password lan print 3
83 # Get Channel Info command failed: Parameter out of range
84 # Invalid channel: 3
85
ishwaryamathim27d779d2023-11-10 05:42:47 +000086 @{inactive_channel_list}= Get Invalid Channel Number List
87 FOR ${channel_number} IN @{inactive_channel_list}
88 ${stdout}= Run IPMI Standard Command
89 ... lan print ${channel_number} fail_on_err=${0}
90 Should Contain ${stdout} Invalid channel
91 ... msg=IPMI channel ${channel_number} is invalid but seen working.
92 END
George Keishing364e93d2020-03-05 04:31:49 -060093
94
95Get IP Address Source And Verify Using Redfish
96 [Documentation] Get IP address source and verify it using Redfish.
97 [Tags] Get_IP_Address_Source_And_Verify_Using_Redfish
98
99 ${active_channel_config}= Get Active Channel Config
100 ${lan_config}= Get LAN Print Dict ${CHANNEL_NUMBER}
101
102 ${ipv4_addresses}= Redfish.Get Attribute
ganesanb4d430282023-04-27 14:33:23 +0000103 ... /redfish/v1/Managers/${MANAGER_ID}/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']}
George Keishing364e93d2020-03-05 04:31:49 -0600104 ... IPv4Addresses
105
106 FOR ${ipv4_address} IN @{ipv4_addresses}
107 ${ip_address_source}=
108 ... Set Variable if '${ipv4_address['Address']}' == '${lan_config['IP Address']}'
109 ... ${ipv4_address['AddressOrigin']} Address
110 Exit For Loop IF "${ip_address_source}" != 'None'
111 END
112
113 Valid Value lan_config['IP Address Source'] ['${ip_address_source}']
114
115
Tony Leec03c8e22020-03-25 13:41:07 +0800116Verify Get Set In Progress
117 [Documentation] Verify Get Set In Progress which belongs to LAN Configuration Parameters
118 ... via IPMI raw Command.
Tony Lee5e735522020-05-13 20:23:38 +0800119 [Tags] Verify_Get_Set_In_Progress
Tony Leec03c8e22020-03-25 13:41:07 +0800120
121 ${ipmi_output}= Run IPMI Command
122 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Get'][0]} ${CHANNEL_NUMBER} 0x00 0x00 0x00
123
124 ${ipmi_output}= Split String ${ipmi_output}
125 ${set_in_progress_value}= Set Variable ${ipmi_output[1]}
126
127 # 00b = set complete.
128 # 01b = set in progress.
129 Should Contain Any ${set_in_progress_value} 00 01
130
131
132Verify Cipher Suite Entry Count
133 [Documentation] Verify cipher suite entry count which belongs to LAN Configuration Parameters
134 ... via IPMI raw Command.
Tony Lee5e735522020-05-13 20:23:38 +0800135 [Tags] Verify_Cipher_Suite_Entry_Count
Tony Leec03c8e22020-03-25 13:41:07 +0800136
137 ${ipmi_output}= Run IPMI Command
138 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Get'][0]} ${CHANNEL_NUMBER} 0x16 0x00 0x00
139 ${cipher_suite_entry_count}= Split String ${ipmi_output}
140
141 # Convert minor cipher suite entry count from BCD format to integer. i.e. 01 to 1.
142 ${cipher_suite_entry_count[1]}= Convert To Integer ${cipher_suite_entry_count[1]}
143 ${cnt}= Get length ${valid_ciphers}
144
145 Should be Equal ${cipher_suite_entry_count[1]} ${cnt}
146
147
148Verify Authentication Type Support
149 [Documentation] Verify authentication type support which belongs to LAN Configuration Parameters
150 ... via IPMI raw Command.
Tony Lee5e735522020-05-13 20:23:38 +0800151 [Tags] Verify_Authentication_Type_Support
Tony Leec03c8e22020-03-25 13:41:07 +0800152
153 ${ipmi_output}= Run IPMI Command
154 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Get'][0]} ${CHANNEL_NUMBER} 0x01 0x00 0x00
155
156 ${authentication_type_support}= Split String ${ipmi_output}
157 # All bits:
158 # 1b = supported
159 # 0b = authentication type not available for use
160 # [5] - OEM proprietary (per OEM identified by the IANA OEM ID in the RMCP Ping Response)
161 # [4] - straight password / key
162 # [3] - reserved
163 # [2] - MD5
164 # [1] - MD2
165 # [0] - none
166 Should Contain Any ${authentication_type_support[1]} 00 01 02 03 04 05
167
168
chithrag4ad123a2022-04-12 19:26:05 +0000169Verify Set In Progress
170 [Documentation] Verify Set In Progress which belongs to LAN Configuration Parameters
171 ... via IPMI raw Command.
172 [Tags] Verify_Set_In_Progress
173
174 # Set the Set In Progress
175 ${output_msg}= Run Inband IPMI Raw Command
176 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][0]} ${CHANNEL_NUMBER} 0x00 0x01
177
178 # Get the Set In Progress
179 ${ipmi_output}= Run Inband IPMI Raw Command
180 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Get'][0]} ${CHANNEL_NUMBER} 0x00 0x00 0x00
181
182 # Verify the response
183 ${ipmi_output}= Split String ${ipmi_output}
184 ${set_in_progress_value}= Set Variable ${ipmi_output[1]}
185
186 # 01b = set in progress.
187 Should be Equal ${set_in_progress_value} 01
188
189 # set back to default.
190 Run IPMI Command ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][0]} ${CHANNEL_NUMBER} 0x00 0x00
191
192 # Get the Set In Progress.
193 ${ipmi_output}= Run Inband IPMI Raw Command
194 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Get'][0]} ${CHANNEL_NUMBER} 0x00 0x00 0x00
195
196 # Verify the response.
197 ${ipmi_output}= Split String ${ipmi_output}
198 ${set_in_progress_value}= Set Variable ${ipmi_output[1]}
199
200 # 00b = set complete.
201 Should be Equal ${set_in_progress_value} 00
202
203
204Verify Invalid Set MAC Address Via IPMI
205 [Documentation] Verify Get and Set MAC address via IPMI.
206 [Tags] Verify_Invalid_Set_MAC_Address_Via_IPMI
207
208 # MAC to hexa string.
209 ${Invalid_mac_address_hex}= Mac Address To Hex String ${Invalid_mac_address}
210
211 # Set MAC Address with invalid data.
George Keishing6e641262022-05-05 10:46:22 -0500212 ${cmd}= Catenate ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][0]} ${CHANNEL_NUMBER}
ishwaryamathim27d779d2023-11-10 05:42:47 +0000213 ... 0x05 ${Invalid_mac_address_hex}
214 ${ipmi_set_output}= Run Inband IPMI Raw Command ${cmd} fail_on_err=0
chithrag4ad123a2022-04-12 19:26:05 +0000215
216 Should Contain ${ipmi_set_output} ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][3]}
217
218
George Keishinge45d2622022-05-05 07:27:30 -0500219Verify Get And Set MAC Address Via IPMI
chithrag4ad123a2022-04-12 19:26:05 +0000220 [Documentation] Verify Get and Set MAC address via IPMI.
George Keishinge45d2622022-05-05 07:27:30 -0500221 [Tags] Verify_Get_And_Set_MAC_Address_Via_IPMI
chithrag4ad123a2022-04-12 19:26:05 +0000222 [Setup] Fetch The Default Mac Address
223 [Teardown] Set Default Mac And Verify ${ipmi_default_mac_split}
224
225 # MAC to hexa string.
226 ${mac_address_hex}= Mac Address To Hex String ${set_mac_address}
227
228 # Set the MAC address.
George Keishing6e641262022-05-05 10:46:22 -0500229 ${cmd}= Catenate ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][0]} ${CHANNEL_NUMBER}
ishwaryamathim27d779d2023-11-10 05:42:47 +0000230 ... 0x05 ${mac_address_hex}
231 ${ipmi_set_output}= Run Inband IPMI Raw Command ${cmd} fail_on_err=0
chithrag4ad123a2022-04-12 19:26:05 +0000232
233 # Get the MAC address and verify.
234 ${ipmi_output}= Run Inband IPMI Raw Command
235 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Get'][0]} ${CHANNEL_NUMBER} 0x05 0x00 0x00
236 ${ipmi_output_split}= Split String ${ipmi_output}
237 ${get_mac}= Evaluate ":".join(${ipmi_output_split[1:]})
238
239 Should be Equal ${get_mac} ${set_mac_address}
240
241
242Verify Cipher Suite Privilege
243 [Documentation] Verify cipher suite privilege which belongs to LAN Configuration Parameters
244 ... via IPMI raw Command.
245 [Tags] Verify_Cipher_Suite_Privilege
246
247 # Get the Cipher Suite privilege and verify the response.
248 ${ipmi_output}= Run Inband IPMI Raw Command
249 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Get'][0]} ${CHANNEL_NUMBER} 0x18 0x00 0x00
250 ${cipher_suite_privilege}= Split String ${ipmi_output}
251
252 Should be Equal '${${cipher_suite_privilege}[0]}' '11'
253 # 00b = reserved.
254 Should Contain Any '${cipher_suite_privilege[1]}' '00' '0'
255
256 ${cipher_suite_privilege_length}= Get length ${cipher_suite_privilege}
257 Should be Equal '${cipher_suite_privilege_length}' '10'
258
259 #44b = Maximum privilege for cipher suite.
260 FOR ${channel_number} IN RANGE 2 ${cipher_suite_privilege_length}
261 Should be Equal '${cipher_suite_privilege[${channel_number}]}' '44'
262 END
263
264
265Verify Set On Authentication Type
266 [Documentation] Verify Set On Authentication Type which belongs to LAN Configuration Parameters
267 ... via IPMI raw Command.
268 [Tags] Verify_Set_On_Authentication_Type
269
270 # Set Authentication Type and expect error.
271 ${ipmi_output}= Run Inband IPMI Raw Command
272 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][0]} ${CHANNEL_NUMBER} 0x01 0x01 fail_on_err=0
273
274 Should Contain ${ipmi_output} ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][2]}
275
276
277Verify IP Address Source Set To Address Loaded By BIOS
278 [Documentation] Verify Set IP Address Source to address loaded by BIOS or system software via IPMI.
279 [Tags] Verify_IP_Address_Source_Set_To_Address_Loaded_By_BIOS
280
281 # Set IP address source to address loaded by BIOS or system software.
282 ${ipmi_output}= Run Keyword and Expect Error *${IPMI_RAW_CMD['LAN_Config_Params']['Set'][3]}*
George Keishing6e641262022-05-05 10:46:22 -0500283 ... Run Inband IPMI Raw Command
284 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][0]} 0x0${CHANNEL_NUMBER} 0x04 0x03
chithrag4ad123a2022-04-12 19:26:05 +0000285
286
287Verify IP Address Source Set To Address Obtained By BMC
288 [Documentation] Verify Set IP Address Source to address obtained by,
289 ... BMC running other address assignment protocol via IPMI.
290 [Tags] Verify_IP_Address_Source_Set_To_Address_Obtained_By_BMC
291
292 # Set IP address source to address obtained by BMC running other address assignment protocol
293 ${ipmi_output}= Run Keyword and Expect Error *${IPMI_RAW_CMD['LAN_Config_Params']['Set'][3]}*
George Keishing6e641262022-05-05 10:46:22 -0500294 ... Run Inband IPMI Raw Command
295 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][0]} 0x0${CHANNEL_NUMBER} 0x04 0x04
chithrag4ad123a2022-04-12 19:26:05 +0000296
297
298Verify IP Address Source Set To Unspecified Address Source
299 [Documentation] Verify Set IP Address source to unspecified address source via IPMI.
300 [Tags] Verify_IP_Address_Source_Set_To_Unspecified_Address_Source
301
302 # Set IP address source to unspecified address source.
303 ${ipmi_output}= Run Keyword and Expect Error *${IPMI_RAW_CMD['LAN_Config_Params']['Set'][3]}*
George Keishing6e641262022-05-05 10:46:22 -0500304 ... Run Inband IPMI Raw Command
305 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][0]} 0x0${CHANNEL_NUMBER} 0x04 0x00
chithrag4ad123a2022-04-12 19:26:05 +0000306
307
George Keishing364e93d2020-03-05 04:31:49 -0600308*** Keywords ***
309
310Get Physical Network Interface Count
311 [Documentation] Return valid physical network interfaces count.
312 # Example:
313 # link/ether 22:3a:7f:70:92:cb brd ff:ff:ff:ff:ff:ff
314 # link/ether 0e:8e:0d:6b:e9:e4 brd ff:ff:ff:ff:ff:ff
315
316 ${mac_entry_list}= Get BMC MAC Address List
317 ${mac_unique_list}= Remove Duplicates ${mac_entry_list}
318 ${physical_interface_count}= Get Length ${mac_unique_list}
319
George Keishing409df052024-01-17 22:36:14 +0530320 RETURN ${physical_interface_count}
George Keishing364e93d2020-03-05 04:31:49 -0600321
322
323Verify Channel Info
324 [Documentation] Verify the channel info.
ishwaryamathime9cecb22023-11-10 06:14:21 +0000325 [Arguments] ${channel_number} ${network_parameter} ${valid_channels_list}
George Keishing364e93d2020-03-05 04:31:49 -0600326
327 Run Keyword If '${network_parameter}' == 'IPv4StaticAddresses'
ishwaryamathime9cecb22023-11-10 06:14:21 +0000328 ... Verify IPv4 Static Address ${channel_number} ${valid_channels_list}
George Keishing364e93d2020-03-05 04:31:49 -0600329 ... ELSE IF '${network_parameter}' == 'MACAddress'
ishwaryamathime9cecb22023-11-10 06:14:21 +0000330 ... Verify MAC Address ${channel_number} ${valid_channels_list}
George Keishing364e93d2020-03-05 04:31:49 -0600331
332
333Verify IPv4 Static Address
334 [Documentation] Verify the IPv4 Static Address.
ishwaryamathime9cecb22023-11-10 06:14:21 +0000335 [Arguments] ${channel_number} ${valid_channels_list}
George Keishing364e93d2020-03-05 04:31:49 -0600336
337 ${lan_print_ipmi}= Get LAN Print Dict ${channel_number}
338 ${ipv4_static_addresses}= Redfish.Get Attribute
ishwaryamathime9cecb22023-11-10 06:14:21 +0000339 ... ${REDFISH_NW_ETH_IFACE}${valid_channels_list['${channel_number}']['name']} IPv4StaticAddresses
George Keishing364e93d2020-03-05 04:31:49 -0600340 ${redfish_ips}= Nested Get Address ${ipv4_static_addresses}
341 Rprint Vars lan_print_ipmi ipv4_static_addresses redfish_ips
342 Valid Value lan_print_ipmi['IP Address'] ${redfish_ips}
343
344
345Verify MAC Address
346 [Documentation] Verify the MAC Address.
ishwaryamathime9cecb22023-11-10 06:14:21 +0000347 [Arguments] ${channel_number} ${valid_channels_list}
George Keishing364e93d2020-03-05 04:31:49 -0600348
349 ${lan_print_ipmi}= Get LAN Print Dict ${channel_number}
350 ${redfish_mac_address}= Redfish.Get Attribute
ishwaryamathime9cecb22023-11-10 06:14:21 +0000351 ... ${REDFISH_NW_ETH_IFACE}${valid_channels_list['${channel_number}']['name']} MACAddress
George Keishing364e93d2020-03-05 04:31:49 -0600352 Rprint Vars lan_print_ipmi redfish_mac_address
353 Valid Value lan_print_ipmi['MAC Address'] ['${redfish_mac_address}']
chithrag4ad123a2022-04-12 19:26:05 +0000354
355
356Fetch The Default Mac Address
357 [Documentation] Fetch The Default MAC Address.
358
359 # Get Default MAC Address.
360 ${ipmi_get_default_mac}= Run Inband IPMI Raw Command
361 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Get'][0]} ${CHANNEL_NUMBER} 0x05 0x00 0x00
362 Set Test Variable ${ipmi_get_default_mac}
363
364 # After splitting, list will have each byte of MAC address.
365 ${ipmi_default_mac_split}= Split String ${ipmi_get_default_mac}
366 Set Test Variable ${ipmi_default_mac_split}
367
368
369Set Default Mac And Verify
370 [Documentation] Set Default Mac And Verify.
371 [Arguments] ${default_mac}=${ipmi_default_mac_split}
372
373 ${set_default_mac}= Evaluate ":".join(${default_mac[1:]})
374 ${default_mac_address_hex}= Mac Address To Hex String ${set_default_mac}
375
376 # Set the Default MAC address.
George Keishing6e641262022-05-05 10:46:22 -0500377 ${cmd}= Catenate ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][0]} ${CHANNEL_NUMBER}
ishwaryamathim27d779d2023-11-10 05:42:47 +0000378 ... 0x05 ${default_mac_address_hex}
379 ${ipmi_set_output}= Run Inband IPMI Raw Command ${cmd} fail_on_err=0
chithrag4ad123a2022-04-12 19:26:05 +0000380
381 # check whether the default MAC is set.
382 ${ipmi_get_mac}= Run Inband IPMI Raw Command
383 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Get'][0]} ${CHANNEL_NUMBER} 0x05 0x00 0x00
384
385 ${ipmi_out}= Split String ${ipmi_get_mac}
386 Should be Equal ${default_mac} ${ipmi_out}