blob: fd3e6145a28bf54472eabfd1d09f7f43dad93c16 [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
98 ... /redfish/v1/Managers/bmc/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']}
99 ... 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.
207 ${ipmi_set_output}= Run Inband IPMI Raw Command
208 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][0]} ${CHANNEL_NUMBER} 0x05 ${Invalid_mac_address_hex} fail_on_err=0
209
210 Should Contain ${ipmi_set_output} ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][3]}
211
212
George Keishinge45d2622022-05-05 07:27:30 -0500213Verify Get And Set MAC Address Via IPMI
chithrag4ad123a2022-04-12 19:26:05 +0000214 [Documentation] Verify Get and Set MAC address via IPMI.
George Keishinge45d2622022-05-05 07:27:30 -0500215 [Tags] Verify_Get_And_Set_MAC_Address_Via_IPMI
chithrag4ad123a2022-04-12 19:26:05 +0000216 [Setup] Fetch The Default Mac Address
217 [Teardown] Set Default Mac And Verify ${ipmi_default_mac_split}
218
219 # MAC to hexa string.
220 ${mac_address_hex}= Mac Address To Hex String ${set_mac_address}
221
222 # Set the MAC address.
223 ${ipmi_set_output}= Run Inband IPMI Raw Command
224 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][0]} ${CHANNEL_NUMBER} 0x05 ${mac_address_hex} fail_on_err=0
225
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]}*
276 ... Run Inband IPMI Raw Command ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][0]} 0x0${CHANNEL_NUMBER} 0x04 0x03
277
278
279Verify IP Address Source Set To Address Obtained By BMC
280 [Documentation] Verify Set IP Address Source to address obtained by,
281 ... BMC running other address assignment protocol via IPMI.
282 [Tags] Verify_IP_Address_Source_Set_To_Address_Obtained_By_BMC
283
284 # Set IP address source to address obtained by BMC running other address assignment protocol
285 ${ipmi_output}= Run Keyword and Expect Error *${IPMI_RAW_CMD['LAN_Config_Params']['Set'][3]}*
286 ... Run Inband IPMI Raw Command ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][0]} 0x0${CHANNEL_NUMBER} 0x04 0x04
287
288
289Verify IP Address Source Set To Unspecified Address Source
290 [Documentation] Verify Set IP Address source to unspecified address source via IPMI.
291 [Tags] Verify_IP_Address_Source_Set_To_Unspecified_Address_Source
292
293 # Set IP address source to unspecified address source.
294 ${ipmi_output}= Run Keyword and Expect Error *${IPMI_RAW_CMD['LAN_Config_Params']['Set'][3]}*
295 ... Run Inband IPMI Raw Command ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][0]} 0x0${CHANNEL_NUMBER} 0x04 0x00
296
297
George Keishing364e93d2020-03-05 04:31:49 -0600298*** Keywords ***
299
300Get Physical Network Interface Count
301 [Documentation] Return valid physical network interfaces count.
302 # Example:
303 # link/ether 22:3a:7f:70:92:cb brd ff:ff:ff:ff:ff:ff
304 # link/ether 0e:8e:0d:6b:e9:e4 brd ff:ff:ff:ff:ff:ff
305
306 ${mac_entry_list}= Get BMC MAC Address List
307 ${mac_unique_list}= Remove Duplicates ${mac_entry_list}
308 ${physical_interface_count}= Get Length ${mac_unique_list}
309
310 [Return] ${physical_interface_count}
311
312
313Verify Channel Info
314 [Documentation] Verify the channel info.
315 [Arguments] ${channel_number} ${network_parameter} ${active_channel_config}
316
317 Run Keyword If '${network_parameter}' == 'IPv4StaticAddresses'
318 ... Verify IPv4 Static Address ${channel_number} ${active_channel_config}
319 ... ELSE IF '${network_parameter}' == 'MACAddress'
320 ... Verify MAC Address ${channel_number} ${active_channel_config}
321
322
323Verify IPv4 Static Address
324 [Documentation] Verify the IPv4 Static Address.
325 [Arguments] ${channel_number} ${active_channel_config}
326
327 ${lan_print_ipmi}= Get LAN Print Dict ${channel_number}
328 ${ipv4_static_addresses}= Redfish.Get Attribute
329 ... ${REDFISH_NW_ETH_IFACE}${active_channel_config['${channel_number}']['name']} IPv4StaticAddresses
330 ${redfish_ips}= Nested Get Address ${ipv4_static_addresses}
331 Rprint Vars lan_print_ipmi ipv4_static_addresses redfish_ips
332 Valid Value lan_print_ipmi['IP Address'] ${redfish_ips}
333
334
335Verify MAC Address
336 [Documentation] Verify the MAC Address.
337 [Arguments] ${channel_number} ${active_channel_config}
338
339 ${lan_print_ipmi}= Get LAN Print Dict ${channel_number}
340 ${redfish_mac_address}= Redfish.Get Attribute
341 ... ${REDFISH_NW_ETH_IFACE}${active_channel_config['${channel_number}']['name']} MACAddress
342 Rprint Vars lan_print_ipmi redfish_mac_address
343 Valid Value lan_print_ipmi['MAC Address'] ['${redfish_mac_address}']
chithrag4ad123a2022-04-12 19:26:05 +0000344
345
346Fetch The Default Mac Address
347 [Documentation] Fetch The Default MAC Address.
348
349 # Get Default MAC Address.
350 ${ipmi_get_default_mac}= Run Inband IPMI Raw Command
351 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Get'][0]} ${CHANNEL_NUMBER} 0x05 0x00 0x00
352 Set Test Variable ${ipmi_get_default_mac}
353
354 # After splitting, list will have each byte of MAC address.
355 ${ipmi_default_mac_split}= Split String ${ipmi_get_default_mac}
356 Set Test Variable ${ipmi_default_mac_split}
357
358
359Set Default Mac And Verify
360 [Documentation] Set Default Mac And Verify.
361 [Arguments] ${default_mac}=${ipmi_default_mac_split}
362
363 ${set_default_mac}= Evaluate ":".join(${default_mac[1:]})
364 ${default_mac_address_hex}= Mac Address To Hex String ${set_default_mac}
365
366 # Set the Default MAC address.
367 ${ipmi_set_output}= Run Inband IPMI Raw Command
368 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][0]} ${CHANNEL_NUMBER} 0x05 ${default_mac_address_hex} fail_on_err=0
369
370 # check whether the default MAC is set.
371 ${ipmi_get_mac}= Run Inband IPMI Raw Command
372 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Get'][0]} ${CHANNEL_NUMBER} 0x05 0x00 0x00
373
374 ${ipmi_out}= Split String ${ipmi_get_mac}
375 Should be Equal ${default_mac} ${ipmi_out}