1*** Settings *** 2 3Documentation VMI static/dynamic IP config tests. 4 5Resource ../../lib/external_intf/vmi_utils.robot 6 7Suite Setup Suite Setup Execution 8Test Teardown FFDC On Test Case Fail 9Suite Teardown Run Keyword And Ignore Error Suite Teardown Execution 10 11Test Tags Vmi 12 13*** Variables *** 14 15# users User Name password 16@{ADMIN} admin_user TestPwd123 17@{OPERATOR} operator_user TestPwd123 18@{ReadOnly} readonly_user TestPwd123 19&{USERS} Administrator=${ADMIN} ReadOnly=${ReadOnly} 20 21${test_ipv4} 10.6.6.6 22${test_gateway} 10.6.6.1 23${test_netmask} 255.255.252.0 24 25&{DHCP_ENABLED} DHCPEnabled=${${True}} 26&{DHCP_DISABLED} DHCPEnabled=${${False}} 27 28&{ENABLE_DHCP} DHCPv4=&{DHCP_ENABLED} 29&{DISABLE_DHCP} DHCPv4=&{DHCP_DISABLED} 30 31${default} 0.0.0.0 32${default_ipv6addr} :: 33${prefix_length} ${64} 34${test_vmi_ipv6addr} 2001:db8:1111:2222:10:5:5:6 35${test_vmi_ipv6gateway} 2001:db8:1111:2222::1 36${ipv4_hexword_addr} 10.5.5.6:1A:1B:1C:1D:1E:1F 37${multicast_ipv6addr} FF00 38${loopback_ipv6addr} ::1 39 40 41*** Test Cases *** 42 43Verify All VMI EthernetInterfaces 44 [Documentation] Verify all VMI ethernet interfaces. 45 [Tags] Verify_All_VMI_EthernetInterfaces 46 47 Verify VMI EthernetInterfaces 48 49 50Verify Existing VMI Network Interface Details 51 [Documentation] Verify existing VMI network interface details. 52 [Tags] Verify_Existing_VMI_Network_Interface_Details 53 54 ${vmi_ip}= Get VMI Network Interface Details 55 ${origin}= Set Variable If ${vmi_ip["DHCPv4"]} == ${False} Static DHCP 56 Should Not Be Equal ${vmi_ip["DHCPv4"]} ${vmi_ip["IPv4StaticAddresses"]} 57 Should Be Equal As Strings ${vmi_ip["Id"]} ${ethernet_interface} 58 Should Be Equal As Strings ${vmi_ip["Description"]} 59 ... Hypervisor's Virtual Management Ethernet Interface 60 Should Be Equal As Strings ${vmi_ip["Name"]} Hypervisor Ethernet Interface 61 Run Keyword If ${vmi_ip["IPv4StaticAddresses"]} != @{empty} 62 ... Verify VMI Network Interface Details ${vmi_ip["IPv4_Address"]} 63 ... ${origin} ${vmi_ip["IPv4_Gateway"]} ${vmi_ip["IPv4_SubnetMask"]} 64 65 66Delete Existing Static VMI IP Address 67 [Documentation] Delete existing static VMI IP address. 68 [Tags] Delete_Existing_Static_VMI_IP_Address 69 70 ${curr_origin}= Get Immediate Child Parameter From VMI Network Interface DHCPEnabled 71 Run Keyword If ${curr_origin} == ${True} Set VMI IPv4 Origin ${False} ${HTTP_ACCEPTED} 72 73 Delete VMI IPv4 Address 74 75 76Verify User Cannot Delete ReadOnly Property IPv4Addresses 77 [Documentation] Verify user cannot delete readonly property IPv4Addresses. 78 [Tags] Verify_User_Cannot_Delete_ReadOnly_Property_IPv4Addresses 79 80 ${curr_origin}= Get Immediate Child Parameter From VMI Network Interface DHCPEnabled 81 Run Keyword If ${curr_origin} == ${True} Set VMI IPv4 Origin ${False} ${HTTP_ACCEPTED} 82 Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask} 83 Delete VMI IPv4 Address IPv4Addresses valid_status_code=${HTTP_FORBIDDEN} 84 85 86Assign Valid And Invalid Static IPv4 Address To VMI 87 [Documentation] Assign static IPv4 address to VMI. 88 [Tags] Assign_Valid_And_Invalid_Static_IPv4_Address_To_VMI 89 [Template] Set Static IPv4 Address To VMI And Verify 90 [Teardown] Run keywords Delete VMI IPv4 Address AND Test Teardown Execution 91 92 # ip gateway netmask valid_status_code 93 10.5.20.30 10.5.20.1 255.255.252.0 ${HTTP_ACCEPTED} 94 a.3.118.94 10.5.20.1 255.255.252.0 ${HTTP_BAD_REQUEST} 95 10.5.20 10.5.20.1 255.255.252.0 ${HTTP_BAD_REQUEST} 96 10.5.20.-5 10.5.20.1 255.255.252.0 ${HTTP_BAD_REQUEST} 97 98 99Add Multiple IP Addresses On VMI Interface And Verify 100 [Documentation] Add multiple IP addresses on VMI interface and verify. 101 [Tags] Add_Multiple_IP_Addresses_On_VMI_Interface_And_Verify 102 [Teardown] Run keywords Delete VMI IPv4 Address AND Test Teardown Execution 103 104 ${ip1}= Create dictionary Address=10.5.5.10 SubnetMask=255.255.252.0 Gateway=10.5.5.1 105 ${ip2}= Create dictionary Address=10.5.5.11 SubnetMask=255.255.252.0 Gateway=10.5.5.1 106 ${ip3}= Create dictionary Address=10.5.5.12 SubnetMask=255.255.252.0 Gateway=10.5.5.1 107 ${ips}= Create List ${ip1} ${ip2} ${ip3} 108 109 Redfish.Patch /redfish/v1/Systems/hypervisor/EthernetInterfaces/${ethernet_interface} 110 ... body={'IPv4StaticAddresses':${ips}} valid_status_codes=[${HTTP_BAD_REQUEST}] 111 112 113Modify IP Addresses On VMI Interface And Verify 114 [Documentation] Modify IP addresses on VMI interface and verify. 115 [Tags] Modify_IP_Addresses_On_VMI_Interface_And_Verify 116 [Template] Set Static IPv4 Address To VMI And Verify 117 [Teardown] Run keywords Delete VMI IPv4 Address AND Test Teardown Execution 118 119 # ip gateway netmask valid_status_code 120 10.5.5.10 10.5.5.1 255.255.252.0 ${HTTP_ACCEPTED} 121 10.5.5.11 10.5.5.1 255.255.252.0 ${HTTP_ACCEPTED} 122 123 124Switch Between IP Origins On VMI And Verify Details 125 [Documentation] Switch between IP origins on VMI and verify details. 126 [Tags] Switch_Between_IP_Origins_On_VMI_And_Verify_Details 127 128 Switch VMI IPv4 Origin And Verify Details 129 Switch VMI IPv4 Origin And Verify Details 130 131 132Verify Persistency Of VMI IPv4 Details After Host Reboot 133 [Documentation] Verify persistency of VMI IPv4 details after host reboot. 134 [Tags] Verify_Persistency_Of_VMI_IPv4_Details_After_Host_Reboot 135 136 # Verifying persistency of dynamic address. 137 Set VMI IPv4 Origin ${True} ${HTTP_ACCEPTED} 138 Redfish Power Off stack_mode=skip 139 Redfish Power On 140 Verify VMI Network Interface Details ${default} DHCP ${default} ${default} 141 142 # Verifying persistency of static address. 143 Switch VMI IPv4 Origin And Verify Details 144 Redfish Power Off stack_mode=skip 145 Redfish Power On 146 Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask} 147 148 149Delete VMI Static IP Address And Verify 150 [Documentation] Delete VMI static IP address and verify. 151 [Tags] Delete_VMI_Static_IP_Address_And_Verify 152 [Teardown] Test Teardown Execution 153 154 Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask} 155 Delete VMI IPv4 Address 156 157 158Verify Successful VMI IP Static Configuration On HOST Boot After Session Delete 159 [Documentation] Verify VMI IP static Configuration On HOST Boot After session deleted. 160 [Tags] Verify_Successful_VMI_IP_Static_Configuration_On_HOST_Boot_After_Session_Delete 161 [Teardown] Run keywords Delete VMI IPv4 Address AND Test Teardown Execution 162 163 Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask} 164 165 ${session_info}= Get Redfish Session Info 166 Redfish.Delete ${session_info["location"]} 167 168 # Create a new Redfish session 169 Redfish.Login 170 Redfish Power Off 171 Redfish Power On 172 173 Verify VMI Network Interface Details ${test_ipv4} Static ${test_gateway} ${test_netmask} 174 175 176Verify Persistency Of VMI DHCP IP Configuration After Multiple HOST Reboots 177 [Documentation] Verify Persistency Of VMI DHCP IP configuration After Multiple HOST Reboots 178 [Tags] Verify_Persistency_Of_VMI_DHCP_IP_Configuration_After_Multiple_HOST_Reboots 179 [Teardown] Test Teardown Execution 180 181 Set VMI IPv4 Origin ${True} ${HTTP_ACCEPTED} 182 ${vmi_ip_config}= Get VMI Network Interface Details 183 # Verifying persistency of dynamic address after multiple reboots. 184 FOR ${i} IN RANGE ${2} 185 Redfish Power Off 186 Redfish Power On 187 Verify VMI Network Interface Details ${vmi_ip_config["IPv4_Address"]} 188 ... DHCP ${vmi_ip_config["IPv4_Gateway"]} ${vmi_ip_config["IPv4_SubnetMask"]} 189 END 190 191 192Enable DHCP When Static IP Configured And Verify Static IP 193 [Documentation] Enable DHCP when static ip configured and verify static ip 194 [Tags] Enable_DHCP_When_Static_IP_Configured_And_Verify_Static_IP 195 [Setup] Redfish Power On 196 [Teardown] Test Teardown Execution 197 198 Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask} 199 Set VMI IPv4 Origin ${True} 200 ${vmi_network_conf}= Get VMI Network Interface Details 201 Should Not Be Equal As Strings ${test_ipv4} ${vmi_network_conf["IPv4_Address"]} 202 203 204Verify VMI Static IP Configuration Persist On BMC Reset Before Host Boot 205 [Documentation] Verify VMI static IP configuration persist on BMC reset. 206 [Tags] Verify_VMI_Static_IP_Configuration_Persist_On_BMC_Reset_Before_Host_Boot 207 [Teardown] Run keywords Delete VMI IPv4 Address AND FFDC On Test Case Fail 208 209 Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask} 210 Redfish OBMC Reboot (off) stack_mode=skip 211 Redfish Power On 212 # Verifying the VMI static configuration 213 Verify VMI Network Interface Details ${test_ipv4} Static ${test_gateway} ${test_netmask} 214 215 216Add Static IP When Host Poweroff And Verify On Poweron 217 [Documentation] Add Static IP When Host Poweroff And Verify on power on 218 [Tags] Add_Static_IP_When_Host_Poweroff_And_Verify_On_Poweron 219 [Setup] Redfish Power Off 220 [Teardown] Run keywords Delete VMI IPv4 Address AND FFDC On Test Case Fail 221 222 Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask} 223 Redfish Power On 224 Verify VMI Network Interface Details ${test_ipv4} Static ${test_gateway} ${test_netmask} 225 226 227Add VMI Static IP When Host Poweroff And Verify Static IP On BMC Reset 228 [Documentation] Add Static IP When Host Poweroff And Verify Static IP On BMC Reset. 229 [Tags] Add_VMI_Static_IP_When_Host_Poweroff_And_Verify_Static_IP_On_BMC_Reset 230 [Setup] Redfish Power Off 231 [Teardown] Run keywords Delete VMI IPv4 Address AND FFDC On Test Case Fail 232 233 Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask} 234 Redfish OBMC Reboot (off) stack_mode=skip 235 Redfish Power On 236 Verify VMI Network Interface Details ${test_ipv4} Static ${test_gateway} ${test_netmask} 237 238 239Enable DHCP When No Static IP Configured And Verify DHCP IP 240 [Documentation] Enable DHCP when no static ip configured and verify dhcp ip 241 [Tags] Enable_DHCP_When_No_Static_IP_Configured_And_Verify_DHCP_IP 242 [Setup] Run Keyword And Ignore Error Delete VMI IPv4 Address 243 [Teardown] Test Teardown Execution 244 245 ${curr_origin}= Get Immediate Child Parameter From VMI Network Interface DHCPEnabled 246 Run Keyword If ${curr_origin} == ${False} Set VMI IPv4 Origin ${True} ${HTTP_ACCEPTED} 247 ${vmi_ip_config}= Get VMI Network Interface Details 248 Verify VMI Network Interface Details ${vmi_ip_config["IPv4_Address"]} 249 ... DHCP ${vmi_ip_config["IPv4_Gateway"]} ${vmi_ip_config["IPv4_SubnetMask"]} 250 251 252Verify User Cannot Delete VMI DHCP IP Address 253 [Documentation] Verify user cannot delete VMI DHCP IP Address 254 [Tags] Verify_User_Cannot_Delete_VMI_DHCP_IP_Address 255 [Setup] Set VMI IPv4 Origin ${True} 256 [Teardown] Test Teardown Execution 257 258 Delete VMI IPv4 Address IPv4Addresses valid_status_code=${HTTP_FORBIDDEN} 259 ${resp}= Redfish.Get 260 ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${ethernet_interface} 261 Should Not Be Empty ${resp.dict["IPv4Addresses"]} 262 263 264Enable DHCP When Static IP Configured DHCP Server Unavailable And Verify IP 265 [Documentation] Enable DHCP When Static IP Configured And DHCP Server Unavailable And Verify No IP. 266 [Tags] Enable_DHCP_When_Static_IP_Configured_DHCP_Server_Unavailable_And_Verify_IP 267 [Teardown] Test Teardown Execution 268 269 Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask} 270 Set VMI IPv4 Origin ${True} 271 Verify VMI Network Interface Details ${default} DHCP ${default} ${default} 272 273 274Verify To Configure VMI Static IP Address With Different User Roles 275 [Documentation] Verify to configure vmi static ip address with different user roles. 276 [Tags] Verify_To_Configure_VMI_Static_IP_Address_With_Different_User_Roles 277 [Setup] Run Keywords Delete BMC Users Using Redfish 278 ... AND Create Users With Different Roles users=${USERS} force=${True} 279 [Template] Config VMI Static IP Address Using Different Users 280 [Teardown] Delete BMC Users Using Redfish 281 282 # username password ip_address gateway nemask valid_status_code 283 admin_user TestPwd123 ${test_ipv4} ${test_gateway} ${test_netmask} ${HTTP_ACCEPTED} 284 readonly_user TestPwd123 ${test_ipv4} ${test_gateway} ${test_netmask} ${HTTP_FORBIDDEN} 285 286 287Verify To Configure VMI Static IP Address With Operator User Role 288 [Documentation] Verify to configure vmi static ip address with operator user role. 289 [Tags] Verify_To_Configure_VMI_Static_IP_Address_With_Operator_User_Role 290 [Setup] Create Users With Different Roles users=${USERS} force=${True} 291 [Template] Config VMI Static IP Address Using Different Users 292 [Teardown] Delete BMC Users Using Redfish 293 294 # username password ip_address gateway nemask valid_status_code 295 operator_user TestPwd123 ${test_ipv4} ${test_gateway} ${test_netmask} ${HTTP_FORBIDDEN} 296 297 298Verify To Delete VMI Static IP Address With Different User Roles 299 [Documentation] Verify to delete vmi static IP address with different user roles. 300 [Tags] Verify_To_Delete_VMI_Static_IP_Address_With_Different_User_Roles 301 [Setup] Create Users With Different Roles users=${USERS} force=${True} 302 [Template] Delete VMI Static IP Address Using Different Users 303 [Teardown] Delete BMC Users Using Redfish 304 305 # username password valid_status_code 306 admin_user TestPwd123 ${HTTP_ACCEPTED} 307 readonly_user TestPwd123 ${HTTP_FORBIDDEN} 308 309 310Verify To Delete VMI Static IP Address With Operator User Role 311 [Documentation] Verify to delete vmi static IP address with operator user role. 312 [Tags] Verify_To_Delete_VMI_Static_IP_Address_With_Operator_User_Role 313 [Setup] Create Users With Different Roles users=${USERS} force=${True} 314 [Template] Delete VMI Static IP Address Using Different Users 315 [Teardown] Delete BMC Users Using Redfish 316 317 # username password valid_status_code 318 operator_user TestPwd123 ${HTTP_FORBIDDEN} 319 320 321Verify To Update VMI Static IP Address With Different User Roles 322 [Documentation] Verify to update vmi static IP address with different user roles. 323 [Tags] Verify_To_Update_VMI_Static_IP_Address_With_Different_User_Roles 324 [Setup] Create Users With Different Roles users=${USERS} force=${True} 325 [Template] Config VMI Static IP Address Using Different Users 326 [Teardown] Delete BMC Users Using Redfish 327 328 # username password ip_address gateway netmask valid_status_code 329 admin_user TestPwd123 10.5.10.20 10.5.10.1 255.255.0.0 ${HTTP_ACCEPTED} 330 readonly_user TestPwd123 10.5.20.40 10.5.20.1 255.255.0.0 ${HTTP_FORBIDDEN} 331 332 333Verify To Update VMI Static IP Address With Operator User Role 334 [Documentation] Verify to update vmi static IP address with operator user role. 335 [Tags] Verify_To_Update_VMI_Static_IP_Address_With_Operator_User_Role 336 [Setup] Create Users With Different Roles users=${USERS} force=${True} 337 [Template] Config VMI Static IP Address Using Different Users 338 [Teardown] Delete BMC Users Using Redfish 339 340 # username password ip_address gateway netmask valid_status_code 341 operator_user TestPwd123 10.5.10.30 10.5.10.1 255.255.0.0 ${HTTP_FORBIDDEN} 342 343 344Verify To Read VMI Network Configuration With Different User Roles 345 [Documentation] Verify to read vmi network configuration with different user roles. 346 [Tags] Verify_To_Read_VMI_Network_Configuration_With_Different_User_Roles 347 [Setup] Create Users With Different Roles users=${USERS} force=${True} 348 [Template] Read VMI Static IP Address Using Different Users 349 [Teardown] Delete BMC Users Using Redfish 350 351 # username password valid_status_code 352 admin_user TestPwd123 ${HTTP_OK} 353 readonly_user TestPwd123 ${HTTP_OK} 354 355 356Verify To Read VMI Network Configuration With Operator User Role 357 [Documentation] Verify to read vmi network configuration with operator user role. 358 [Tags] Verify_To_Read_VMI_Network_Configuration_With_Operator_User_Role 359 [Setup] Create Users With Different Roles users=${USERS} force=${True} 360 [Template] Read VMI Static IP Address Using Different Users 361 [Teardown] Delete BMC Users Using Redfish 362 363 # username password valid_status_code 364 operator_user TestPwd123 ${HTTP_FORBIDDEN} 365 366 367Enable DHCP On VMI Network Via Different Users Roles And Verify 368 [Documentation] Enable DHCP On VMI Network Via Different Users Roles And Verify. 369 [Tags] Enable_DHCP_On_VMI_Network_Via_Different_Users_Roles_And_Verify 370 [Setup] Create Users With Different Roles users=${USERS} force=${True} 371 [Template] Update User Role And Set VMI IPv4 Origin 372 [Teardown] Delete BMC Users Using Redfish 373 374 # username password dhcp_enabled valid_status_code 375 admin_user TestPwd123 ${True} ${HTTP_ACCEPTED} 376 readonly_user TestPwd123 ${True} ${HTTP_FORBIDDEN} 377 378 379Enable DHCP On VMI Network Via Operator User Role And Verify 380 [Documentation] Enable DHCP On VMI Network Via Operator User Role And Verify. 381 [Tags] Enable_DHCP_On_VMI_Network_Via_Operator_User_Role_And_Verify 382 [Setup] Create Users With Different Roles users=${USERS} force=${True} 383 [Template] Update User Role And Set VMI IPv4 Origin 384 [Teardown] Delete BMC Users Using Redfish 385 386 # username password dhcp_enabled valid_status_code 387 operator_user TestPwd123 ${True} ${HTTP_FORBIDDEN} 388 389 390Disable DHCP On VMI Network Via Different Users Roles And Verify 391 [Documentation] Disable DHCP On VMI Network Via Different Users Roles And Verify. 392 [Tags] Disable_DHCP_On_VMI_Network_Via_Different_Users_Roles_And_Verify 393 [Setup] Create Users With Different Roles users=${USERS} force=${True} 394 [Template] Update User Role And Set VMI IPv4 Origin 395 [Teardown] Delete BMC Users Using Redfish 396 397 # username password dhcp_enabled valid_status_code 398 admin_user TestPwd123 ${False} ${HTTP_ACCEPTED} 399 readonly_user TestPwd123 ${False} ${HTTP_FORBIDDEN} 400 401 402Disable DHCP On VMI Network Via Operator User Role And Verify 403 [Documentation] Disable DHCP On VMI Network Via Operator User Role And Verify. 404 [Tags] Disable_DHCP_On_VMI_Network_Via_Operator_User_Role_And_Verify 405 [Setup] Create Users With Different Roles users=${USERS} force=${True} 406 [Template] Update User Role And Set VMI IPv4 Origin 407 [Teardown] Delete BMC Users Using Redfish 408 409 # username password dhcp_enabled valid_status_code 410 operator_user TestPwd123 ${False} ${HTTP_FORBIDDEN} 411 412 413Enable And Disable DHCP And Verify 414 [Documentation] verify enable DHCP and disable DHCP. 415 [Tags] Enable_And_Disable_DHCP_And_Verify 416 417 Set VMI IPv4 Origin ${True} 418 Verify VMI Network Interface Details ${default} DHCP ${default} ${default} 419 Set VMI IPv4 Origin ${False} 420 Verify VMI Network Interface Details ${default} Static ${default} ${default} 421 422 423Multiple Times Enable And Disable DHCP And Verify 424 [Documentation] Enable and Disable DHCP in a loop and verify VMI gets an IP address from DHCP 425 ... each time when DHCP is enabled 426 [Tags] Multiple_Times_Enable_And_Disable_DHCP_And_Verify 427 428 FOR ${i} IN RANGE ${2} 429 Set VMI IPv4 Origin ${True} 430 Verify VMI Network Interface Details ${default} DHCP ${default} ${default} 431 Set VMI IPv4 Origin ${False} 432 Verify VMI Network Interface Details ${default} Static ${default} ${default} 433 END 434 435 436Assign Static IPv4 Address With Invalid Netmask To VMI 437 [Documentation] Assign static IPv4 address with invalid netmask and expect error. 438 [Tags] Assign_Static_IPv4_Address_With_Invalid_Netmask_To_VMI 439 [Template] Set Static IPv4 Address To VMI And Verify 440 441 # ip gateway netmask valid_status_code 442 ${test_ipv4} ${test_gateway} 255.256.255.0 ${HTTP_BAD_REQUEST} 443 ${test_ipv4} ${test_gateway} ff.ff.ff.ff ${HTTP_BAD_REQUEST} 444 ${test_ipv4} ${test_gateway} 255.255.253.0 ${HTTP_BAD_REQUEST} 445 446 447Assign Static IPv4 Address With Invalid Gateway To VMI 448 [Documentation] Add static IPv4 address with invalid gateway and expect error. 449 [Tags] Assign_Static_IPv4_Address_With_Invalid_Gateway_To_VMI 450 [Template] Set Static IPv4 Address To VMI And Verify 451 452 # ip gateway netmask valid_status_code 453 ${test_ipv4} @@@.%%.44.11 ${test_netmask} ${HTTP_BAD_REQUEST} 454 ${test_ipv4} 0xa.0xb.0xc.0xd ${test_netmask} ${HTTP_BAD_REQUEST} 455 ${test_ipv4} 10.3.36 ${test_netmask} ${HTTP_BAD_REQUEST} 456 ${test_ipv4} 10.3.36.-10 ${test_netmask} ${HTTP_BAD_REQUEST} 457 458 459Enable DHCP When Host Is Off And Verify After Poweron 460 [Documentation] Enable DHCP when host is off and 461 ... check whether it is enabled after poweron. 462 [Tags] Enable_DHCP_When_Host_Is_Off_And_Verify_After_Poweron 463 [Setup] Redfish Power Off stack_mode=skip 464 465 Set VMI IPv4 Origin ${True} 466 Redfish Power On stack_mode=skip 467 Verify VMI Network Interface Details ${default} DHCP ${default} ${default} 468 469 470Disable DHCP When Host Is Off And Verify New State Reflects After Power On 471 [Documentation] Disable DHCP when host is off and 472 ... get network info and verify that VMI origin is static. 473 [Tags] Disable_DHCP_When_Host_Is_Off_And_Verify_New_State_Reflects_After_Power_On 474 [Setup] Redfish Power Off stack_mode=skip 475 476 Set VMI IPv4 Origin ${False} 477 Redfish Power On stack_mode=skip 478 Verify VMI Network Interface Details ${default} Static ${default} ${default} 479 480 481Enable VMI Stateless Address AutoConfig And Verify 482 [Documentation] Enable VMI SLAACv6 and verify an origin. 483 [Tags] Enable_VMI_Stateless_Address_AutoConfig_And_Verify 484 485 Set VMI SLAACv6 Origin ${True} 486 487 # Check origin is set to slaac and address are getting displayed. 488 Verify VMI IPv6 Address SLAAC 489 490 491Disable VMI Stateless Address AutoConfig And Verify 492 [Documentation] Disable VMI SLAACv6 and verify an origin. 493 [Tags] Disable_VMI_Stateless_Address_AutoConfig_And_Verify 494 [Setup] Set VMI SLAACv6 Origin ${True} 495 496 Set VMI SLAACv6 Origin ${False} 497 498 # Check origin is set to static and slaacv6 address are getting erased. 499 Verify VMI IPv6 Address Static 500 501 502Enable VMI SLAAC And Check Persistency On BMC Reboot 503 [Documentation] Enable VMI SLAACv6 and verify its persistency 504 ... on BMC reboot and this works on the setup where router 505 ... advertises network prefix. 506 [Tags] Enable_VMI_SLAAC_And_Check_Persistency_On_BMC_Reboot 507 508 Set VMI SLAACv6 Origin ${True} 509 510 # Reboot BMC and verify persistency. 511 OBMC Reboot (off) 512 Redfish Power On 513 Wait For Host Boot Progress To Reach Required State 514 Sleep 5s 515 516 # Check origin is set to slaac and address are getting displayed. 517 ${vmi_ipv6addr}= Verify VMI IPv6 Address SLAAC 518 Should Not Be Equal ${vmi_ipv6addr["Address"]} ${default_ipv6addr} 519 520 521Disable VMI SLAAC And Check Persistency On BMC Reboot 522 [Documentation] Disable VMI SLAACv6 and verify its persistency 523 ... on BMC reboot. 524 [Tags] Disable_VMI_SLAAC_And_Check_Persistency_On_BMC_Reboot 525 526 Set VMI SLAACv6 Origin ${False} 527 528 # Reboot BMC and verify persistency. 529 OBMC Reboot (off) 530 Redfish Power On 531 Wait For Host Boot Progress To Reach Required State 532 533 # Check if origin is set to static and SLAAC address are getting erased. 534 ${vmi_ipv6addr}= Verify VMI IPv6 Address Static 535 Should Be Equal ${vmi_ipv6addr["Address"]} ${default_ipv6addr} 536 537 538Disable VMI DHCPv4 When SLAAC Is Enabled And Verify 539 [Documentation] Disable VMI DHCPv4 parameter when SLAACv6 is enabled 540 ... and check whether the IPv4 address origin is set to static and 541 ... DHCPv4 address is getting erased. 542 [Tags] Disable_VMI_DHCPv4_When_SLAAC_Is_Enabled_And_Verify 543 [Setup] Set VMI IPv4 Origin ${True} 544 545 # Set IPv6 origin to SLAAC. 546 Set VMI SLAACv6 Origin ${True} 547 Verify VMI IPv6 Address SLAAC 548 549 # Disable VMI DHCPv4 and check IPv4 address origin is set to static. 550 Set VMI IPv4 Origin ${False} 551 Verify VMI Network Interface Details ${default} Static ${default} ${default} 552 553 554Enable VMI SLAAC When DHCPv6 Is Enabled And Verify 555 [Documentation] Enable VMI SLAACv6 when VMI DHCPv6 is enabled and 556 ... check IPv6 gets Slaac address and this works on the setup 557 ... where router advertise network prefix. 558 [Tags] Enable_VMI_SLAAC_When_DHCPv6_Is_Enabled_And_Verify 559 560 Set VMI DHCPv6 Property Enabled 561 562 # Enable SLAAC and check whether IPv6 origin is set to SLAAC. 563 Set VMI SLAACv6 Origin ${True} 564 565 # Check if origin is set to slaac and address are getting displayed. 566 ${vmi_ipv6addr}= Verify VMI IPv6 Address SLAAC 567 Should Not Be Equal ${vmi_ipv6addr["Address"]} ${default_ipv6addr} 568 Should Be Equal ${vmi_ipv6addr["PrefixLength"]} ${prefix_length} 569 570 571Disable VMI DHCPv6 Property And Verify 572 [Documentation] Disable VMI DHCPv6 property and verify IPv6 address 573 ... origin is set to static and DHCPv6 address is erased. 574 [Tags] Disable_VMI_DHCPv6_Property_And_Verify 575 [Setup] Set VMI DHCPv6 Property Enabled 576 577 Set VMI DHCPv6 Property Disabled 578 579 # Verify IPv6 address origin is set to static and DHCPv6 address is erased. 580 ${vmi_ipv6addr}= Verify VMI IPv6 Address Static 581 Should Be Equal ${vmi_ipv6addr["Address"]} ${default_ipv6addr} 582 583 584Enable VMI SLAAC When DHCPv4 Is Enabled And Verify 585 [Documentation] On VMI enable SLAAC when DHCPv4 is enabled and verify DHCPv4 settings are intact 586 ... and IPv6 origin is set to SLAAC & it gets assigned with SLAAC IPv6 address and this 587 ... works on the setup where router advertise network prefix. 588 [Tags] Enable_VMI_SLAAC_When_DHCPv4_Is_Enabled_And_Verify 589 [Setup] Set VMI IPv4 Origin ${True} 590 591 # Enable Autoconfig address and check whether IPv6 address origin is set to SLAAC. 592 Set VMI SLAACv6 Origin ${True} 593 Verify VMI IPv6 Address SLAAC 594 595 # Check there is no impact on IPv4 settings, IPv4 address origin should be DHCP. 596 Verify VMI Network Interface Details ${default} DHCP ${default} ${default} 597 598 599Disable VMI DHCPv6 Property And Check Persistency On BMC Reboot 600 [Documentation] Disable VMI DHCPv6 property and verify its persistency on 601 ... BMC reboot. 602 [Tags] Disable_VMI_DHCPv6_Property_And_Check_Persistency_On_BMC_Reboot 603 [Setup] Set VMI DHCPv6 Property Enabled 604 605 Set VMI DHCPv6 Property Disabled 606 607 # Reboot BMC and verify persistency. 608 OBMC Reboot (off) 609 610 # Verify IPv6 address origin is set to Static and DHCPv6 address is erased. 611 ${vmi_ipv6addr}= Verify VMI IPv6 Address Static 612 Should Be Equal ${vmi_ipv6addr["Address"]} ${default_ipv6addr} 613 614 615Enable VMI SLAAC When IPv4 Origin Is Static And Verify 616 [Documentation] On VMI enable SLAAC when IPv4 origin is static and verify IPv4 settings are intact 617 ... and IPv6 origin is set to SLAAC & it gets assigned with SLAAC IPv6 address and this works 618 ... on the setup where router advertise network prefix. 619 [Tags] Enable_VMI_SLAAC_When_IPv4_Origin_Is_Static_And_Verify 620 [Setup] Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} ${test_netmask} 621 [Teardown] Run keywords Delete VMI IPv4 Address AND Test Teardown Execution 622 623 # Enable Autoconfig address and check whether IPv6 address origin is set to SLAAC. 624 Set VMI SLAACv6 Origin ${True} 625 Verify VMI IPv6 Address SLAAC 626 627 # Check there is no impact on IPv4 settings, IPv4 address origin should be Static. 628 Verify VMI Network Interface Details ${test_ipv4} Static ${test_gateway} ${test_netmask} 629 630 631Configure Static VMI IPv6 Address And Verify 632 [Documentation] Add static VMI IPv6 address and check whether IPv6 origin is set to static 633 ... and Static IPv6 address is assigned. 634 [Tags] Configure_Static_VMI_IPv6_Address_And_Verify 635 636 Set Static VMI IPv6 Address ${test_vmi_ipv6addr} ${prefix_length} 637 638 # Verify IPv6 address origin is set to static and static IPv6 address is assigned. 639 ${vmi_ipv6addr}= Verify VMI IPv6 Address Static 640 Should Not Be Equal ${vmi_ipv6addr["Address"]} ${default_ipv6addr} 641 Should Be Equal ${vmi_ipv6addr["PrefixLength"]} ${prefix_length} 642 643 644Configure IPv6 Static Default Gateway On VMI And Verify 645 [Documentation] Configure IPv6 static default gateway on VMI and verify. 646 [Tags] Configure_IPv6_Static_Default_Gateway_On_VMI_And_Verify 647 [Setup] Set Static VMI IPv6 Address ${test_vmi_ipv6addr} ${prefix_length} 648 649 Set VMI IPv6 Static Default Gateway ${test_vmi_ipv6gateway} 650 651 ${resp}= Redfish.Get 652 ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${ethernet_interface} 653 ${vmi_ipv6_gateways}= Get From Dictionary ${resp.dict} IPv6StaticDefaultGateways 654 ${vmi_ipv6_gateway} = Get From List ${vmi_ipv6_gateways} 0 655 Should Be Equal ${vmi_ipv6_gateway["Address"]} ${test_vmi_ipv6gateway} 656 657 658Delete VMI Static IPv6 Address And Verify 659 [Documentation] Delete VMI static IPv6 address and verify address is erased. 660 [Tags] Delete_VMI_Static_IPv6_Address_And_Verify 661 [Setup] Set Static VMI IPv6 Address ${test_vmi_ipv6addr} ${prefix_length} 662 663 # Delete VMI static IPv6 address. 664 Delete VMI IPv6 Static Address 665 666 # Verify VMI static IPv6 address is erased. 667 ${vmi_ipv6addr}= Verify VMI IPv6 Address Static 668 Should Not Be Equal ${vmi_ipv6addr["Address"]} ${test_vmi_ipv6addr} 669 Should Be Equal ${vmi_ipv6addr["Address"]} ${default_ipv6addr} 670 671 672Enable VMI DHCPv6 When IPv6 Origin Is Static And Verify 673 [Documentation] Enable VMI DHCPv6 when IPv6 origin is in static and verify 674 ... origin is set to DHCP and check if static IPv6 address is erased. 675 [Tags] Enable_VMI_DHCPv6_When_IPv6_Origin_Is_Static_And_Verify 676 677 Set Static VMI IPv6 Address ${test_vmi_ipv6addr} ${prefix_length} 678 ${vmi_ipv6addr_static}= Verify VMI IPv6 Address Static 679 680 Sleep 5s 681 682 # Enable DHCPv6 property. 683 Set VMI DHCPv6 Property Enabled 684 685 # Check origin is set to DHCP and static IPv6 address is erased. 686 ${vmi_dhcpv6addr}= Verify VMI IPv6 Address DHCPv6 687 Should Not Be Equal ${vmi_dhcpv6addr["Address"]} ${vmi_ipv6addr_static["Address"]} 688 689 690Configure Invalid Static IPv6 To VMI And Verify 691 [Documentation] Configure invalid static IPv6 address to VMI and verify that address 692 ... does not get assigned and it throws an error. 693 [Tags] Configure_Invalid_Static_IPv6_To_VMI_And_Verify 694 [Setup] Set Static VMI IPv6 Address ${test_vmi_ipv6addr} ${prefix_length} 695 [Template] Set VMI Invalid Static IPv6 Address And Verify 696 697 # invalid_vmi_ipv6addr invalid_prefix_length valid_status_codes 698 ${default_ipv6addr} 128 ${HTTP_BAD_REQUEST} 699 ${multicast_ipv6addr} 8 ${HTTP_BAD_REQUEST} 700 ${loopback_ipv6addr} 64 ${HTTP_BAD_REQUEST} 701 ${ipv4_hexword_addr} 64 ${HTTP_BAD_REQUEST} 702 703 704Delete IPv6 Static Default Gateway On VMI And Verify 705 [Documentation] Delete IPv6 static default gateway and verify address is erased. 706 [Tags] Delete_IPv6_Static_Default_Gateway_On_VMI_And_Verify 707 [Setup] Run Keywords Set Static VMI IPv6 Address ${test_vmi_ipv6addr} ${prefix_length} 708 ... AND Set VMI IPv6 Static Default Gateway ${test_vmi_ipv6gateway} 709 710 # Delete IPv6 static default gateway address. 711 Delete VMI IPv6 Static Default Gateway Address 712 713 Sleep 5s 714 715 # Verify static IPv6 default gateway address is deleted. 716 ${resp}= Redfish.Get 717 ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${ethernet_interface} 718 Should Be Empty ${resp.dict["IPv6StaticDefaultGateways"]} 719 720 721*** Keywords *** 722 723Suite Setup Execution 724 [Documentation] Do test setup execution task. 725 726 Redfish.Login 727 728 Redfish Power Off 729 Set BIOS Attribute pvm_hmc_managed Enabled 730 Set BIOS Attribute pvm_stop_at_standby Disabled 731 732 Redfish Power On 733 Wait For Host Boot Progress To Reach Required State 734 735 ${active_channel_config}= Get Active Channel Config 736 Set Suite Variable ${active_channel_config} 737 Set Suite Variable ${ethernet_interface} ${active_channel_config['${CHANNEL_NUMBER}']['name']} 738 ${resp}= Redfish.Get 739 ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${ethernet_interface} 740 ${ip_resp}= Evaluate json.loads(r'''${resp.text}''') json 741 ${length}= Get Length ${ip_resp["IPv4StaticAddresses"]} 742 ${vmi_network_conf}= Run Keyword If ${length} != ${0} Get VMI Network Interface Details 743 Set Suite Variable ${vmi_network_conf} 744 745 746Test Teardown Execution 747 [Documentation] Do test teardown execution task. 748 749 FFDC On Test Case Fail 750 ${curr_mode}= Get Immediate Child Parameter From VMI Network Interface DHCPEnabled 751 Run Keyword If ${curr_mode} == ${True} Set VMI IPv4 Origin ${False} 752 Run Keyword If '${vmi_network_conf["IPv4_Address"]}' != '${default}' 753 ... Set Static IPv4 Address To VMI And Verify ${vmi_network_conf["IPv4_Address"]} 754 ... ${vmi_network_conf["IPv4_Gateway"]} ${vmi_network_conf["IPv4_SubnetMask"]} 755 756 757Get Immediate Child Parameter From VMI Network Interface 758 [Documentation] Get immediate child parameter from VMI network interface. 759 [Arguments] ${parameter} ${valid_status_code}=${HTTP_OK} 760 761 # Description of argument(s): 762 # parameter parameter for which value is required. Ex: DHCPEnabled, MACAddress etc. 763 # valid_status_code Expected valid status code from GET request. 764 765 ${resp}= Redfish.Get 766 ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${ethernet_interface} 767 ... valid_status_codes=[${valid_status_code}] 768 769 ${ip_resp}= Evaluate json.loads(r'''${resp.text}''') json 770 ${value}= Set Variable If '${parameter}' != 'DHCPEnabled' ${ip_resp["${parameter}"]} 771 ... ${ip_resp["DHCPv4"]["${parameter}"]} 772 773 RETURN ${value} 774 775 776Switch VMI IPv4 Origin And Verify Details 777 [Documentation] Switch VMI IPv4 origin and verify details. 778 779 ${dhcp_mode_before}= Get Immediate Child Parameter From VMI Network Interface DHCPEnabled 780 ${dhcp_enabled}= Set Variable If ${dhcp_mode_before} == ${False} ${True} ${False} 781 782 ${origin}= Set Variable If ${dhcp_mode_before} == ${False} DHCP Static 783 Set VMI IPv4 Origin ${dhcp_enabled} ${HTTP_ACCEPTED} 784 785 ${dhcp_mode_after}= Get Immediate Child Parameter From VMI Network Interface DHCPEnabled 786 Should Not Be Equal ${dhcp_mode_before} ${dhcp_mode_after} 787 788 Run Keyword If ${dhcp_mode_after} == ${True} 789 ... Verify VMI Network Interface Details ${default} ${origin} ${default} ${default} 790 791 792Delete VMI Static IP Address Using Different Users 793 [Documentation] Update user role and delete vmi static IP address. 794 [Arguments] ${username} ${password} ${valid_status_code} 795 [Teardown] Run Keywords Redfish.Login AND 796 ... Set Static IPv4 Address To VMI And Verify ${test_ipv4} ${test_gateway} 797 ... ${test_netmask} ${HTTP_ACCEPTED} AND Redfish.Logout 798 799 # Description of argument(s): 800 # username The host username. 801 # password The host password. 802 # valid_status_code The expected valid status code. 803 804 # TODO: operator_user role is not yet supported. 805 Skip If '${username}' == 'operator_user' 806 Redfish.Login ${username} ${password} 807 Delete VMI IPv4 Address delete_param=IPv4StaticAddresses valid_status_code=${valid_status_code} 808 809 810Config VMI Static IP Address Using Different Users 811 [Documentation] Update user role and update vmi static ip address. 812 [Arguments] ${username} ${password} ${ip} ${gateway} ${netmask} 813 ... ${valid_status_code} 814 815 # Description of argument(s): 816 # username The host username. 817 # password The host password. 818 # ip IP address to be added (e.g. "10.7.7.7"). 819 # subnet_mask Subnet mask for the IP to be added 820 # (e.g. "255.255.0.0"). 821 # gateway Gateway for the IP to be added (e.g. "10.7.7.1"). 822 # valid_status_code The expected valid status code. 823 824 # TODO: operator_user role is not yet supported. 825 Skip If '${username}' == 'operator_user' 826 Redfish.Login ${username} ${password} 827 Set Static IPv4 Address To VMI And Verify ${ip} ${gateway} ${netmask} ${valid_status_code} 828 829 830Read VMI Static IP Address Using Different Users 831 [Documentation] Update user role and read vmi static ip address. 832 [Arguments] ${username} ${password} ${valid_status_code} 833 834 # Description of argument(s): 835 # username The host username. 836 # password The host password. 837 # valid_status_code The expected valid status code. 838 839 # TODO: operator_user role is not yet supported. 840 Skip If '${username}' == 'operator_user' 841 Redfish.Login ${username} ${password} 842 Redfish.Get 843 ... /redfish/v1/Systems/hypervisor/EthernetInterfaces/${ethernet_interface} 844 ... valid_status_codes=[${valid_status_code}] 845 846 847Delete BMC Users Using Redfish 848 [Documentation] Delete BMC users via redfish. 849 850 Redfish.Login 851 Delete BMC Users Via Redfish users=${USERS} 852 853 854Update User Role And Set VMI IPv4 Origin 855 [Documentation] Update User Role And Set VMI IPv4 Origin. 856 [Arguments] ${username} ${password} ${dhcp_enabled} ${valid_status_code} 857 858 # Description of argument(s): 859 # username The host username. 860 # password The host password. 861 # dhcp_enabled Indicates whether dhcp should be enabled 862 # (${True}, ${False}). 863 # valid_status_code The expected valid status code. 864 865 # TODO: operator_user role is not yet supported. 866 Skip If '${username}' == 'operator_user' 867 Redfish.Login ${username} ${password} 868 Set VMI IPv4 Origin ${dhcp_enabled} ${valid_status_code} 869 870 871Suite Teardown Execution 872 [Documentation] Do suite teardown execution task. 873 874 Run Keyword If ${vmi_network_conf} != ${None} 875 ... Set Static IPv4 Address To VMI And Verify ${vmi_network_conf["IPv4_Address"]} 876 ... ${vmi_network_conf["IPv4_Gateway"]} ${vmi_network_conf["IPv4_SubnetMask"]} 877 Delete All Redfish Sessions 878 Redfish.Logout 879 880 881Set VMI Invalid Static IPv6 Address And Verify 882 [Documentation] Set VMI invalid static IPv6 address and verify it throws an error. 883 [Arguments] ${invalid_vmi_ipv6addr} ${invalid_prefix_length} ${valid_status_codes} 884 ... ${interface}=${ethernet_interface} 885 886 # Description of argument(s): 887 # invalid_vmi_ipv6addr VMI IPv6 address to be added. 888 # invalid_prefix_length Prefix length for the VMI IPv6 to be added. 889 # valid_status_codes Expected status code for PATCH request. 890 # interface VMI interface (eg. eth0 or eth1). 891 892 Set Static VMI IPv6 Address ${invalid_vmi_ipv6addr} ${invalid_prefix_length} 893 ... ${valid_status_codes} 894 895 ${resp}= Redfish.Get /redfish/v1/Systems/hypervisor/EthernetInterfaces/${interface} 896 897 @{vmi_ipv6_address}= Get From Dictionary ${resp.dict} IPv6Addresses 898 ${vmi_ipv6_addr}= Get From List ${vmi_ipv6_address} 0 899 Should Not Be Equal ${vmi_ipv6_addr["Address"]} ${invalid_vmi_ipv6addr} 900 901 902Delete VMI IPv6 Static Default Gateway Address 903 [Documentation] Delete VMI IPv6 static default gateway address. 904 [Arguments] ${valid_status_codes}=${HTTP_ACCEPTED} 905 ... ${interface}=${ethernet_interface} 906 907 # Description of argument(s): 908 # valid_status_codes Expected valid status code from PATCH request. 909 # interface VMI interface (eg. eth0 or eth1). 910 911 ${data}= Set Variable {"IPv6StaticDefaultGateways": [${Null}]} 912 Redfish.Patch /redfish/v1/Systems/hypervisor/EthernetInterfaces/${interface} 913 ... body=${data} valid_status_codes=[${valid_status_codes}] 914