1*** 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 11Variables ../data/ipmi_raw_cmd_table.py 12 13Suite Setup Redfish.Login 14Test Setup Printn 15Test Teardown FFDC On Test Case Fail 16 17Force Tags IPMI_Network_Verification 18 19*** Variables *** 20 21${set_mac_address} 02:f4:43:24:e7:1a 22${Invalid_mac_address} 11:f4:43:24:e7:1a 23 24 25*** Test Cases *** 26 27Retrieve IP Address Via IPMI And Verify Using Redfish 28 [Documentation] Retrieve IP address using IPMI and verify using Redfish. 29 [Tags] Retrieve_IP_Address_Via_IPMI_And_Verify_Using_Redfish 30 31 ${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} 38 END 39 40 41Retrieve 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 54 ${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} 61 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 68 @{active_channel_list}= Get Active Ethernet Channel List 69 Set Suite Variable @{active_channel_list} 70 71 FOR ${channel_number} IN @{active_channel_list} 72 ${stdout}= Run IPMI Standard Command 73 ... lan print ${channel_number} 74 END 75 76 77Test Invalid IPMI Channel Response 78 [Documentation] Verify invalid IPMI channels supported response. 79 [Tags] Test_Invalid_IPMI_Channel_Response 80 81 # 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 86 @{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 93 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 103 ... /redfish/v1/Managers/${MANAGER_ID}/EthernetInterfaces/${active_channel_config['${CHANNEL_NUMBER}']['name']} 104 ... 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 116Verify Get Set In Progress 117 [Documentation] Verify Get Set In Progress which belongs to LAN Configuration Parameters 118 ... via IPMI raw Command. 119 [Tags] Verify_Get_Set_In_Progress 120 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. 135 [Tags] Verify_Cipher_Suite_Entry_Count 136 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. 151 [Tags] Verify_Authentication_Type_Support 152 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 169Verify 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. 212 ${cmd}= Catenate ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][0]} ${CHANNEL_NUMBER} 213 ... 0x05 ${Invalid_mac_address_hex} 214 ${ipmi_set_output}= Run Inband IPMI Raw Command ${cmd} fail_on_err=0 215 216 Should Contain ${ipmi_set_output} ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][3]} 217 218 219Verify Get And Set MAC Address Via IPMI 220 [Documentation] Verify Get and Set MAC address via IPMI. 221 [Tags] Verify_Get_And_Set_MAC_Address_Via_IPMI 222 [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. 229 ${cmd}= Catenate ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][0]} ${CHANNEL_NUMBER} 230 ... 0x05 ${mac_address_hex} 231 ${ipmi_set_output}= Run Inband IPMI Raw Command ${cmd} fail_on_err=0 232 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]}* 283 ... Run Inband IPMI Raw Command 284 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][0]} 0x0${CHANNEL_NUMBER} 0x04 0x03 285 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]}* 294 ... Run Inband IPMI Raw Command 295 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][0]} 0x0${CHANNEL_NUMBER} 0x04 0x04 296 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]}* 304 ... Run Inband IPMI Raw Command 305 ... ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][0]} 0x0${CHANNEL_NUMBER} 0x04 0x00 306 307 308*** 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 320 [Return] ${physical_interface_count} 321 322 323Verify Channel Info 324 [Documentation] Verify the channel info. 325 [Arguments] ${channel_number} ${network_parameter} ${valid_channels_list} 326 327 Run Keyword If '${network_parameter}' == 'IPv4StaticAddresses' 328 ... Verify IPv4 Static Address ${channel_number} ${valid_channels_list} 329 ... ELSE IF '${network_parameter}' == 'MACAddress' 330 ... Verify MAC Address ${channel_number} ${valid_channels_list} 331 332 333Verify IPv4 Static Address 334 [Documentation] Verify the IPv4 Static Address. 335 [Arguments] ${channel_number} ${valid_channels_list} 336 337 ${lan_print_ipmi}= Get LAN Print Dict ${channel_number} 338 ${ipv4_static_addresses}= Redfish.Get Attribute 339 ... ${REDFISH_NW_ETH_IFACE}${valid_channels_list['${channel_number}']['name']} IPv4StaticAddresses 340 ${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. 347 [Arguments] ${channel_number} ${valid_channels_list} 348 349 ${lan_print_ipmi}= Get LAN Print Dict ${channel_number} 350 ${redfish_mac_address}= Redfish.Get Attribute 351 ... ${REDFISH_NW_ETH_IFACE}${valid_channels_list['${channel_number}']['name']} MACAddress 352 Rprint Vars lan_print_ipmi redfish_mac_address 353 Valid Value lan_print_ipmi['MAC Address'] ['${redfish_mac_address}'] 354 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. 377 ${cmd}= Catenate ${IPMI_RAW_CMD['LAN_Config_Params']['Set'][0]} ${CHANNEL_NUMBER} 378 ... 0x05 ${default_mac_address_hex} 379 ${ipmi_set_output}= Run Inband IPMI Raw Command ${cmd} fail_on_err=0 380 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} 387