1*** Settings *** 2Documentation Network interface configuration and verification 3 ... tests. 4 5Resource ../../lib/bmc_redfish_resource.robot 6Resource ../../lib/bmc_network_utils.robot 7Resource ../../lib/openbmc_ffdc.robot 8Library ../../lib/bmc_network_utils.py 9Library Collections 10 11Test Setup Test Setup Execution 12Test Teardown Test Teardown Execution 13Suite Setup Suite Setup Execution 14 15Force Tags Network_Conf_Test 16 17*** Variables *** 18${test_hostname} openbmc 19${test_ipv4_addr} 10.7.7.7 20${test_ipv4_invalid_addr} 0.0.1.a 21${test_subnet_mask} 255.255.0.0 22${broadcast_ip} 10.7.7.255 23${loopback_ip} 127.0.0.2 24${multicast_ip} 224.6.6.6 25${out_of_range_ip} 10.7.7.256 26${test_ipv4_addr2} 10.7.7.8 27 28# Valid netmask is 4 bytes long and has continuos block of 1s. 29# Maximum valid value in each octet is 255 and least value is 0. 30# 253 is not valid, as binary value is 11111101. 31${invalid_netmask} 255.255.253.0 32${alpha_netmask} ff.ff.ff.ff 33# Maximum value of octet in netmask is 255. 34${out_of_range_netmask} 255.256.255.0 35${more_byte_netmask} 255.255.255.0.0 36${less_byte_netmask} 255.255.255 37${threshold_netmask} 255.255.255.255 38${lowest_netmask} 128.0.0.0 39 40# There will be 4 octets in IP address (e.g. xx.xx.xx.xx) 41# but trying to configure xx.xx.xx 42${less_octet_ip} 10.3.36 43 44# For the address 10.6.6.6, the 10.6.6.0 portion describes the 45# network ID and the 6 describe the host. 46 47${network_id} 10.7.7.0 48${hex_ip} 0xa.0xb.0xc.0xd 49${negative_ip} 10.-7.-7.7 50${hex_ip} 0xa.0xb.0xc.0xd 51@{static_name_servers} 10.5.5.5 52@{null_value} null 53@{empty_dictionary} {} 54@{string_value} aa.bb.cc.dd 55 56*** Test Cases *** 57 58Get IP Address And Verify 59 [Documentation] Get IP Address And Verify. 60 [Tags] Get_IP_Address_And_Verify 61 62 : FOR ${network_configuration} IN @{network_configurations} 63 \ Verify IP On BMC ${network_configuration['Address']} 64 65Get Netmask And Verify 66 [Documentation] Get Netmask And Verify. 67 [Tags] Get_Netmask_And_Verify 68 69 : FOR ${network_configuration} IN @{network_configurations} 70 \ Verify Netmask On BMC ${network_configuration['SubnetMask']} 71 72Get Gateway And Verify 73 [Documentation] Get gateway and verify it's existence on the BMC. 74 [Tags] Get_Gateway_And_Verify 75 76 : FOR ${network_configuration} IN @{network_configurations} 77 \ Verify Gateway On BMC ${network_configuration['Gateway']} 78 79Get MAC Address And Verify 80 [Documentation] Get MAC address and verify it's existence on the BMC. 81 [Tags] Get_MAC_Address_And_Verify 82 83 ${resp}= Redfish.Get ${REDFISH_NW_ETH0_URI} 84 ${macaddr}= Get From Dictionary ${resp.dict} MACAddress 85 Validate MAC On BMC ${macaddr} 86 87Verify All Configured IP And Netmask 88 [Documentation] Verify all configured IP and netmask on BMC. 89 [Tags] Verify_All_Configured_IP_And_Netmask 90 91 : FOR ${network_configuration} IN @{network_configurations} 92 \ Verify IP And Netmask On BMC ${network_configuration['Address']} 93 ... ${network_configuration['SubnetMask']} 94 95Get Hostname And Verify 96 [Documentation] Get hostname via Redfish and verify. 97 [Tags] Get_Hostname_And_Verify 98 99 ${hostname}= Redfish_Utils.Get Attribute ${REDFISH_NW_PROTOCOL_URI} HostName 100 101 Validate Hostname On BMC ${hostname} 102 103Configure Hostname And Verify 104 [Documentation] Configure hostname via Redfish and verify. 105 [Tags] Configure_Hostname_And_Verify 106 107 ${hostname}= Redfish_Utils.Get Attribute ${REDFISH_NW_PROTOCOL_URI} HostName 108 109 Configure Hostname ${test_hostname} 110 Validate Hostname On BMC ${test_hostname} 111 112 # Revert back to initial hostname. 113 Configure Hostname ${hostname} 114 Validate Hostname On BMC ${hostname} 115 116Add Valid IPv4 Address And Verify 117 [Documentation] Add IPv4 Address via Redfish and verify. 118 [Tags] Add_Valid_IPv4_Addres_And_Verify 119 [Teardown] Run Keywords 120 ... Delete IP Address ${test_ipv4_addr} AND Test Teardown Execution 121 122 Add IP Address ${test_ipv4_addr} ${test_subnet_mask} ${test_gateway} 123 124Add Invalid IPv4 Address And Verify 125 [Documentation] Add Invalid IPv4 Address via Redfish and verify. 126 [Tags] Add_Invalid_IPv4_Addres_And_Verify 127 128 Add IP Address ${test_ipv4_invalid_addr} ${test_subnet_mask} 129 ... ${test_gateway} valid_status_codes=${HTTP_BAD_REQUEST} 130 131Configure Out Of Range IP 132 [Documentation] Configure out-of-range IP address. 133 [Tags] Configure_Out_Of_Range_IP 134 [Template] Add IP Address 135 136 # ip subnet_mask gateway valid_status_codes 137 ${out_of_range_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} 138 139Configure Broadcast IP 140 [Documentation] Configure broadcast IP address. 141 [Tags] Configure_Broadcast_IP 142 [Template] Add IP Address 143 [Teardown] Clear IP Settings On Fail ${broadcast_ip} 144 145 # ip subnet_mask gateway valid_status_codes 146 ${broadcast_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} 147 148Configure Multicast IP 149 [Documentation] Configure multicast IP address. 150 [Tags] Configure_Multicast_IP 151 [Template] Add IP Address 152 [Teardown] Clear IP Settings On Fail ${multicast_ip} 153 154 # ip subnet_mask gateway valid_status_codes 155 ${multicast_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} 156 157Configure Loopback IP 158 [Documentation] Configure loopback IP address. 159 [Tags] Configure_Loopback_IP 160 [Template] Add IP Address 161 [Teardown] Clear IP Settings On Fail ${loopback_ip} 162 163 # ip subnet_mask gateway valid_status_codes 164 ${loopback_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} 165 166Add Valid IPv4 Address And Check Persistency 167 [Documentation] Add IPv4 address and check peristency. 168 [Tags] Add_Valid_IPv4_Addres_And_Check_Persistency 169 [Teardown] Run Keywords 170 ... Delete IP Address ${test_ipv4_addr} AND Test Teardown Execution 171 172 Add IP Address ${test_ipv4_addr} ${test_subnet_mask} ${test_gateway} 173 174 # Reboot BMC and verify persistency. 175 OBMC Reboot (off) 176 Redfish.Login 177 Verify IP On BMC ${test_ipv4_addr} 178 179Add Fourth Octet Threshold IP And Verify 180 [Documentation] Add fourth octet threshold IP and verify. 181 [Tags] Add_Fourth_Octet_Threshold_IP_And_Verify 182 [Teardown] Run Keywords 183 ... Delete IP Address 10.7.7.254 AND Test Teardown Execution 184 185 Add IP Address 10.7.7.254 ${test_subnet_mask} ${test_gateway} 186 187Add Fourth Octet Lowest IP And Verify 188 [Documentation] Add fourth octet lowest IP and verify. 189 [Tags] Add_Fourth_Octet_Lowest_IP_And_Verify 190 [Teardown] Run Keywords 191 ... Delete IP Address 10.7.7.1 AND Test Teardown Execution 192 193 Add IP Address 10.7.7.1 ${test_subnet_mask} ${test_gateway} 194 195Add Third Octet Threshold IP And Verify 196 [Documentation] Add third octet threshold IP and verify. 197 [Tags] Add_Third_Octet_Threshold_IP_And_Verify 198 [Teardown] Run Keywords 199 ... Delete IP Address 10.7.255.7 AND Test Teardown Execution 200 201 Add IP Address 10.7.255.7 ${test_subnet_mask} ${test_gateway} 202 203Add Third Octet Lowest IP And Verify 204 [Documentation] Add third octet lowest IP and verify. 205 [Tags] Add_Third_Octet_Lowest_IP_And_Verify 206 [Teardown] Run Keywords 207 ... Delete IP Address 10.7.0.7 AND Test Teardown Execution 208 209 Add IP Address 10.7.0.7 ${test_subnet_mask} ${test_gateway} 210 211Add Second Octet Threshold IP And Verify 212 [Documentation] Add second octet threshold IP and verify. 213 [Tags] Add_Second_Octet_Threshold_IP_And_Verify 214 [Teardown] Run Keywords 215 ... Delete IP Address 10.255.7.7 AND Test Teardown Execution 216 217 Add IP Address 10.255.7.7 ${test_subnet_mask} ${test_gateway} 218 219Add Second Octet Lowest IP And Verify 220 [Documentation] Add second octet lowest IP and verify. 221 [Tags] Add_Second_Octet_Lowest_IP_And_Verify 222 [Teardown] Run Keywords 223 ... Delete IP Address 10.0.7.7 AND Test Teardown Execution 224 225 Add IP Address 10.0.7.7 ${test_subnet_mask} ${test_gateway} 226 227Add First Octet Threshold IP And Verify 228 [Documentation] Add first octet threshold IP and verify. 229 [Tags] Add_First_Octet_Threshold_IP_And_Verify 230 [Teardown] Run Keywords 231 ... Delete IP Address 233.7.7.7 AND Test Teardown Execution 232 233 Add IP Address 223.7.7.7 ${test_subnet_mask} ${test_gateway} 234 235Add First Octet Lowest IP And Verify 236 [Documentation] Add first octet lowest IP and verify. 237 [Tags] Add_First_Octet_Lowest_IP_And_Verify 238 [Teardown] Run Keywords 239 ... Delete IP Address 1.7.7.7 AND Test Teardown Execution 240 241 Add IP Address 1.7.7.7 ${test_subnet_mask} ${test_gateway} 242 243Configure Invalid Netmask 244 [Documentation] Verify error while setting invalid netmask. 245 [Tags] Configure_Invalid_Netmask 246 [Template] Add IP Address 247 248 # ip subnet_mask gateway valid_status_codes 249 ${test_ipv4_addr} ${invalid_netmask} ${test_gateway} ${HTTP_BAD_REQUEST} 250 251Configure Out Of Range Netmask 252 [Documentation] Verify error while setting out of range netmask. 253 [Tags] Configure_Out_Of_Range_Netmask 254 [Template] Add IP Address 255 256 # ip subnet_mask gateway valid_status_codes 257 ${test_ipv4_addr} ${out_of_range_netmask} ${test_gateway} ${HTTP_BAD_REQUEST} 258 259Configure Alpha Netmask 260 [Documentation] Verify error while setting alpha netmask. 261 [Tags] Configure_Alpha_Netmask 262 [Template] Add IP Address 263 264 # ip subnet_mask gateway valid_status_codes 265 ${test_ipv4_addr} ${alpha_netmask} ${test_gateway} ${HTTP_BAD_REQUEST} 266 267Configure More Byte Netmask 268 [Documentation] Verify error while setting more byte netmask. 269 [Tags] Configure_More_Byte_Netmask 270 [Template] Add IP Address 271 272 # ip subnet_mask gateway valid_status_codes 273 ${test_ipv4_addr} ${more_byte_netmask} ${test_gateway} ${HTTP_BAD_REQUEST} 274 275Configure Less Byte Netmask 276 [Documentation] Verify error while setting less byte netmask. 277 [Tags] Configure_Less_Byte_Netmask 278 [Template] Add IP Address 279 280 # ip subnet_mask gateway valid_status_codes 281 ${test_ipv4_addr} ${less_byte_netmask} ${test_gateway} ${HTTP_BAD_REQUEST} 282 283Configure Threshold Netmask And Verify 284 [Documentation] Configure threshold netmask and verify. 285 [Tags] Configure_Threshold_Netmask_And_verify 286 [Teardown] Run Keywords 287 ... Delete IP Address ${test_ipv4_addr} AND Test Teardown Execution 288 289 Add IP Address ${test_ipv4_addr} ${threshold_netmask} ${test_gateway} 290 291Configure Lowest Netmask And Verify 292 [Documentation] Configure lowest netmask and verify. 293 [Tags] Configure_Lowest_Netmask_And_verify 294 [Teardown] Run Keywords 295 ... Delete IP Address ${test_ipv4_addr} AND Test Teardown Execution 296 297 Add IP Address ${test_ipv4_addr} ${lowest_netmask} ${test_gateway} 298 299Configure Network ID 300 [Documentation] Verify error while configuring network ID. 301 [Tags] Configure_Network_ID 302 [Template] Add IP Address 303 [Teardown] Clear IP Settings On Fail ${network_id} 304 305 # ip subnet_mask gateway valid_status_codes 306 ${network_id} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} 307 308Configure Less Octet IP 309 [Documentation] Verify error while Configuring less octet IP address. 310 [Tags] Configure_Less_Octet_IP 311 [Template] Add IP Address 312 313 # ip subnet_mask gateway valid_status_codes 314 ${less_octet_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} 315 316Configure Empty IP 317 [Documentation] Verify error while Configuring empty IP address. 318 [Tags] Configure_Empty_IP 319 [Template] Add IP Address 320 321 # ip subnet_mask gateway valid_status_codes 322 ${EMPTY} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} 323 324Configure Special Char IP 325 [Documentation] Configure invalid IP address containing special chars. 326 [Tags] Configure_Special_Char_IP 327 [Template] Add IP Address 328 329 # ip subnet_mask gateway valid_status_codes 330 @@@.%%.44.11 ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} 331 332Configure Hexadecimal IP 333 [Documentation] Configure invalid IP address containing hex value. 334 [Tags] Configure_Hexadecimal_IP 335 [Template] Add IP Address 336 337 # ip subnet_mask gateway valid_status_codes 338 ${hex_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} 339 340Configure Negative Octet IP 341 [Documentation] Configure invalid IP address containing negative octet. 342 [Tags] Configure_Negative_Octet_IP 343 [Template] Add IP Address 344 345 # ip subnet_mask gateway valid_status_codes 346 ${negative_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} 347 348Configure Incomplete IP For Gateway 349 [Documentation] Configure incomplete IP for gateway and expect an error. 350 [Tags] Configure_Incomplete_IP_For_Gateway 351 [Template] Add IP Address 352 353 # ip subnet_mask gateway valid_status_codes 354 ${test_ipv4_addr} ${test_subnet_mask} ${less_octet_ip} ${HTTP_BAD_REQUEST} 355 356Configure Special Char IP For Gateway 357 [Documentation] Configure special char IP for gateway and expect an error. 358 [Tags] Configure_Special_Char_IP_For_Gateway 359 [Template] Add IP Address 360 361 # ip subnet_mask gateway valid_status_codes 362 ${test_ipv4_addr} ${test_subnet_mask} @@@.%%.44.11 ${HTTP_BAD_REQUEST} 363 364Configure Hexadecimal IP For Gateway 365 [Documentation] Configure hexadecimal IP for gateway and expect an error. 366 [Tags] Configure_Hexadecimal_IP_For_Gateway 367 [Template] Add IP Address 368 369 # ip subnet_mask gateway valid_status_codes 370 ${test_ipv4_addr} ${test_subnet_mask} ${hex_ip} ${HTTP_BAD_REQUEST} 371 372Get DNS Server And Verify 373 [Documentation] Get DNS server via Redfish and verify. 374 [Tags] Get_DNS_Server_And_Verify 375 376 Verify CLI and Redfish Nameservers 377 378Configure DNS Server And Verify 379 [Documentation] Configure DNS server and verify. 380 [Tags] Configure_DNS_Server_And_Verify 381 [Setup] DNS Test Setup Execution 382 [Teardown] Run Keywords 383 ... Configure Static Name Servers AND Test Teardown Execution 384 385 Configure Static Name Servers ${static_name_servers} 386 Verify CLI and Redfish Nameservers 387 388Delete DNS Server And Verify 389 [Documentation] Delete DNS server and verify. 390 [Tags] Delete_DNS_Server_And_Verify 391 [Setup] DNS Test Setup Execution 392 [Teardown] Run Keywords 393 ... Configure Static Name Servers AND Test Teardown Execution 394 395 Delete Static Name Servers 396 Verify CLI and Redfish Nameservers 397 398Configure DNS Server And Check Persistency 399 [Documentation] Configure DNS server and check persistency on reboot. 400 [Tags] Configure_DNS_Server_And_Check_Persistency 401 [Setup] DNS Test Setup Execution 402 [Teardown] Run Keywords 403 ... Configure Static Name Servers AND Test Teardown Execution 404 405 Configure Static Name Servers ${static_name_servers} 406 # Reboot BMC and verify persistency. 407 OBMC Reboot (off) 408 Verify CLI and Redfish Nameservers 409 410Configure Loopback IP For Gateway 411 [Documentation] Configure loopback IP for gateway and expect an error. 412 [Tags] Configure_Loopback_IP_For_Gateway 413 [Template] Add IP Address 414 [Teardown] Clear IP Settings On Fail ${test_ipv4_addr} 415 416 # ip subnet_mask gateway valid_status_codes 417 ${test_ipv4_addr} ${test_subnet_mask} ${loopback_ip} ${HTTP_BAD_REQUEST} 418 419Configure Network ID For Gateway 420 [Documentation] Configure network ID for gateway and expect an error. 421 [Tags] Configure_Network_ID_For_Gateway 422 [Template] Add IP Address 423 [Teardown] Clear IP Settings On Fail ${test_ipv4_addr} 424 425 # ip subnet_mask gateway valid_status_codes 426 ${test_ipv4_addr} ${test_subnet_mask} ${network_id} ${HTTP_BAD_REQUEST} 427 428Configure Multicast IP For Gateway 429 [Documentation] Configure multicast IP for gateway and expect an error. 430 [Tags] Configure_Multicast_IP_For_Gateway 431 [Template] Add IP Address 432 [Teardown] Clear IP Settings On Fail ${test_ipv4_addr} 433 434 # ip subnet_mask gateway valid_status_codes 435 ${test_ipv4_addr} ${test_subnet_mask} ${multicaste_ip} ${HTTP_BAD_REQUEST} 436 437Configure Broadcast IP For Gateway 438 [Documentation] Configure broadcast IP for gateway and expect an error. 439 [Tags] Configure_Broadcast_IP_For_Gateway 440 [Template] Add IP Address 441 [Teardown] Clear IP Settings On Fail ${test_ipv4_addr} 442 443 # ip subnet_mask gateway valid_status_codes 444 ${test_ipv4_addr} ${test_subnet_mask} ${broadcast_ip} ${HTTP_BAD_REQUEST} 445 446Configure Null Value For DNS Server 447 [Documentation] Configure null value for DNS server and expect an error. 448 [Tags] Configure_Null_Value_For_DNS_Server 449 [Setup] DNS Test Setup Execution 450 [Teardown] Run Keywords 451 ... Configure Static Name Servers AND Test Teardown Execution 452 453 Configure Static Name Servers ${null_value} ${HTTP_BAD_REQUEST} 454 455Configure Empty Value For DNS Server 456 [Documentation] Configure empty value for DNS server and expect an error. 457 [Tags] Configure_Empty_Value_For_DNS_Server 458 [Setup] DNS Test Setup Execution 459 [Teardown] Run Keywords 460 ... Configure Static Name Servers AND Test Teardown Execution 461 462 Configure Static Name Servers ${empty_dictionary} ${HTTP_BAD_REQUEST} 463 464Configure String Value For DNS Server 465 [Documentation] Configure string value for DNS server and expect an error. 466 [Tags] Configure_String_Value_For_DNS_Server 467 [Setup] DNS Test Setup Execution 468 [Teardown] Run Keywords 469 ... Configure Static Name Servers AND Test Teardown Execution 470 471 Configure Static Name Servers ${string_value} ${HTTP_BAD_REQUEST} 472 473Modify IPv4 Address And Verify 474 [Documentation] Modify IP address via Redfish and verify. 475 [Tags] Modify_IPv4_Addres_And_Verify 476 [Teardown] Run Keywords 477 ... Delete IP Address ${test_ipv4_addr2} AND Delete IP Address ${test_ipv4_addr} 478 ... AND Test Teardown Execution 479 480 Add IP Address ${test_ipv4_addr} ${test_subnet_mask} ${test_gateway} 481 482 Update IP Address ${test_ipv4_addr} ${test_ipv4_addr2} ${test_subnet_mask} ${test_gateway} 483 484 485*** Keywords *** 486 487Test Setup Execution 488 [Documentation] Test setup execution. 489 490 Redfish.Login 491 492 @{network_configurations}= Get Network Configuration 493 Set Test Variable @{network_configurations} 494 495 # Get BMC IP address and prefix length. 496 ${ip_data}= Get BMC IP Info 497 Set Test Variable ${ip_data} 498 499 500Verify Netmask On BMC 501 [Documentation] Verify netmask on BMC. 502 [Arguments] ${netmask} 503 504 # Description of the argument(s): 505 # netmask netmask value to be verified. 506 507 ${prefix_length}= Netmask Prefix Length ${netmask} 508 509 Should Contain Match ${ip_data} */${prefix_length} 510 ... msg=Prefix length does not exist. 511 512Verify IP And Netmask On BMC 513 [Documentation] Verify IP and netmask on BMC. 514 [Arguments] ${ip} ${netmask} 515 516 # Description of the argument(s): 517 # ip IP address to be verified. 518 # netmask netmask value to be verified. 519 520 ${prefix_length}= Netmask Prefix Length ${netmask} 521 @{ip_data}= Get BMC IP Info 522 523 ${ip_with_netmask}= Catenate ${ip}/${prefix_length} 524 Should Contain ${ip_data} ${ip_with_netmask} 525 ... msg=IP and netmask pair does not exist. 526 527Validate Hostname On BMC 528 [Documentation] Verify that the hostname read via Redfish is the same as the 529 ... hostname configured on system. 530 [Arguments] ${hostname} 531 532 # Description of argument(s): 533 # hostname A hostname value which is to be compared to the hostname 534 # configured on system. 535 536 ${sys_hostname}= Get BMC Hostname 537 Should Be Equal ${sys_hostname} ${hostname} 538 ... ignore_case=True msg=Hostname does not exist. 539 540Test Teardown Execution 541 [Documentation] Test teardown execution. 542 543 FFDC On Test Case Fail 544 Redfish.Logout 545 546Clear IP Settings On Fail 547 [Documentation] Clear IP settings on fail. 548 [Arguments] ${ip} 549 550 # Description of argument(s): 551 # ip IP address to be deleted. 552 553 Run Keyword If '${TEST STATUS}' == 'FAIL' 554 ... Delete IP Address ${ip} 555 556 Test Teardown Execution 557 558Verify CLI and Redfish Nameservers 559 [Documentation] Verify that nameservers obtained via Redfish do not 560 ... match those found in /etc/resolv.conf. 561 562 ${redfish_nameservers}= Redfish.Get Attribute ${REDFISH_NW_ETH0_URI} StaticNameServers 563 ${resolve_conf_nameservers}= CLI Get Nameservers 564 Rqprint Vars redfish_nameservers resolve_conf_nameservers 565 566 # Check that the 2 lists are equivalent. 567 ${match}= Evaluate set($redfish_nameservers) == set($resolve_conf_nameservers) 568 Should Be True ${match} 569 ... The nameservers obtained via Redfish do not match those found in /etc/resolv.conf. 570 571 572Configure Static Name Servers 573 [Documentation] Configure DNS server on BMC. 574 [Arguments] ${static_name_servers}=${original_nameservers} 575 ... ${valid_status_codes}=${HTTP_OK} 576 577 # Description of the argument(s): 578 # static_name_servers A list of static name server IPs to be 579 # configured on the BMC. 580 581 # Currently BMC is sending 500 response code instead of 400 for invalid scenarios. 582 Redfish.Patch ${REDFISH_NW_ETH0_URI} body={'StaticNameServers': ${static_name_servers}} 583 ... valid_status_codes=[${valid_status_codes}, ${HTTP_INTERNAL_SERVER_ERROR}] 584 585 # Patch operation takes 1 to 3 seconds to set new value. 586 Sleep 3s 587 588 # Check if newly added DNS server is configured on BMC. 589 ${cli_nameservers}= CLI Get Nameservers 590 ${cmd_status}= Run Keyword And Return Status 591 ... List Should Contain Sub List ${cli_nameservers} ${static_name_servers} 592 593 Run Keyword If '${valid_status_codes}' == '${HTTP_OK}' 594 ... Should Be True ${cmd_status} == ${True} 595 ... ELSE Should Be True ${cmd_status} == ${False} 596 597Delete Static Name Servers 598 [Documentation] Delete static name servers. 599 600 Configure Static Name Servers @{EMPTY} 601 602 # Check if all name servers deleted on BMC. 603 ${nameservers}= CLI Get Nameservers 604 Should Be Empty ${nameservers} 605 606DNS Test Setup Execution 607 [Documentation] Do DNS test setup execution. 608 609 Redfish.Login 610 611 ${original_nameservers}= Redfish.Get Attribute ${REDFISH_NW_ETH0_URI} StaticNameServers 612 Rprint Vars original_nameservers 613 # Set suite variables to trigger restoration during teardown. 614 Set Suite Variable ${original_nameservers} 615 616Suite Setup Execution 617 [Documentation] Do suite setup execution. 618 619 ${test_gateway}= Get BMC Default Gateway 620 Set Suite Variable ${test_gateway} 621 622Update IP Address 623 [Documentation] Update IP address of BMC. 624 [Arguments] ${ip} ${new_ip} ${netmask} ${gw_ip} ${valid_status_codes}=${HTTP_OK} 625 626 # Description of argument(s): 627 # ip IP address to be replaced (e.g. "10.7.7.7"). 628 # new_ip New IP address to be configured. 629 # netmask Netmask value. 630 # gw_ip Gateway IP address. 631 # valid_status_codes Expected return code from patch operation 632 # (e.g. "200"). See prolog of rest_request 633 # method in redfish_plus.py for details. 634 635 ${empty_dict}= Create Dictionary 636 ${patch_list}= Create List 637 ${ip_data}= Create Dictionary Address=${new_ip} SubnetMask=${netmask} Gateway=${gw_ip} 638 639 # Find the position of IP address to be modified. 640 @{network_configurations}= Get Network Configuration 641 FOR ${network_configuration} IN @{network_configurations} 642 Run Keyword If '${network_configuration['Address']}' == '${ip}' 643 ... Append To List ${patch_list} ${ip_data} 644 ... ELSE Append To List ${patch_list} ${empty_dict} 645 END 646 647 ${ip_found}= Run Keyword And Return Status List Should Contain Value 648 ... ${patch_list} ${ip_data} msg=${ip} does not exist on BMC 649 Pass Execution If ${ip_found} == ${False} ${ip} does not exist on BMC 650 651 # Run patch command only if given IP is found on BMC 652 ${data}= Create Dictionary IPv4StaticAddresses=${patch_list} 653 654 Redfish.patch ${REDFISH_NW_ETH0_URI} body=&{data} valid_status_codes=[${valid_status_codes}] 655 656 # Note: Network restart takes around 15-18s after patch request processing. 657 Sleep ${NETWORK_TIMEOUT}s 658 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT} 659 660 Verify IP On BMC ${new_ip} 661 Validate Network Config On BMC 662