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