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 continuous 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@{static_name_servers} 10.5.5.5 51@{null_value} null 52@{empty_dictionary} {} 53@{string_value} aa.bb.cc.dd 54 55*** Test Cases *** 56 57Get IP Address And Verify 58 [Documentation] Get IP Address And Verify. 59 [Tags] Get_IP_Address_And_Verify 60 61 FOR ${network_configuration} IN @{network_configurations} 62 Verify IP On BMC ${network_configuration['Address']} 63 END 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 END 72 73Get Gateway And Verify 74 [Documentation] Get gateway and verify it's existence on the BMC. 75 [Tags] Get_Gateway_And_Verify 76 77 FOR ${network_configuration} IN @{network_configurations} 78 Verify Gateway On BMC ${network_configuration['Gateway']} 79 END 80 81Get MAC Address And Verify 82 [Documentation] Get MAC address and verify it's existence on the BMC. 83 [Tags] Get_MAC_Address_And_Verify 84 85 ${active_channel_config}= Get Active Channel Config 86 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} 87 88 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 89 ${macaddr}= Get From Dictionary ${resp.dict} MACAddress 90 Validate MAC On BMC ${macaddr} 91 92Verify All Configured IP And Netmask 93 [Documentation] Verify all configured IP and netmask on BMC. 94 [Tags] Verify_All_Configured_IP_And_Netmask 95 96 FOR ${network_configuration} IN @{network_configurations} 97 Verify IP And Netmask On BMC ${network_configuration['Address']} 98 ... ${network_configuration['SubnetMask']} 99 END 100 101Get Hostname And Verify 102 [Documentation] Get hostname via Redfish and verify. 103 [Tags] Get_Hostname_And_Verify 104 105 ${hostname}= Redfish_Utils.Get Attribute ${REDFISH_NW_PROTOCOL_URI} HostName 106 107 Validate Hostname On BMC ${hostname} 108 109Configure Hostname And Verify 110 [Documentation] Configure hostname via Redfish and verify. 111 [Tags] Configure_Hostname_And_Verify 112 [Teardown] Run Keywords 113 ... Configure Hostname ${hostname} AND Validate Hostname On BMC ${hostname} 114 115 ${hostname}= Redfish_Utils.Get Attribute ${REDFISH_NW_PROTOCOL_URI} HostName 116 117 Configure Hostname ${test_hostname} 118 Validate Hostname On BMC ${test_hostname} 119 120 # Verify configured hostname via redfish. 121 ${new_hostname}= Redfish_Utils.Get Attribute ${REDFISH_NW_PROTOCOL_URI} HostName 122 Should Be Equal ${new_hostname} ${test_hostname} 123 124 125Add Valid IPv4 Address And Verify 126 [Documentation] Add IPv4 Address via Redfish and verify. 127 [Tags] Add_Valid_IPv4_Address_And_Verify 128 [Teardown] Run Keywords 129 ... Delete IP Address ${test_ipv4_addr} AND Test Teardown Execution 130 131 Add IP Address ${test_ipv4_addr} ${test_subnet_mask} ${test_gateway} 132 133Add Invalid IPv4 Address And Verify 134 [Documentation] Add Invalid IPv4 Address via Redfish and verify. 135 [Tags] Add_Invalid_IPv4_Address_And_Verify 136 137 Add IP Address ${test_ipv4_invalid_addr} ${test_subnet_mask} 138 ... ${test_gateway} valid_status_codes=${HTTP_BAD_REQUEST} 139 140Configure Out Of Range IP 141 [Documentation] Configure out-of-range IP address. 142 [Tags] Configure_Out_Of_Range_IP 143 [Template] Add IP Address 144 145 # ip subnet_mask gateway valid_status_codes 146 ${out_of_range_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} 147 148Configure Broadcast IP 149 [Documentation] Configure broadcast IP address. 150 [Tags] Configure_Broadcast_IP 151 [Template] Add IP Address 152 [Teardown] Clear IP Settings On Fail ${broadcast_ip} 153 154 # ip subnet_mask gateway valid_status_codes 155 ${broadcast_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} 156 157Configure Multicast IP 158 [Documentation] Configure multicast IP address. 159 [Tags] Configure_Multicast_IP 160 [Template] Add IP Address 161 [Teardown] Clear IP Settings On Fail ${multicast_ip} 162 163 # ip subnet_mask gateway valid_status_codes 164 ${multicast_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} 165 166Configure Loopback IP 167 [Documentation] Configure loopback IP address. 168 [Tags] Configure_Loopback_IP 169 [Template] Add IP Address 170 [Teardown] Clear IP Settings On Fail ${loopback_ip} 171 172 # ip subnet_mask gateway valid_status_codes 173 ${loopback_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} 174 175Add Valid IPv4 Address And Check Persistency 176 [Documentation] Add IPv4 address and check persistency. 177 [Tags] Add_Valid_IPv4_Address_And_Check_Persistency 178 [Teardown] Run Keywords 179 ... Delete IP Address ${test_ipv4_addr} AND Test Teardown Execution 180 181 Add IP Address ${test_ipv4_addr} ${test_subnet_mask} ${test_gateway} 182 183 # Reboot BMC and verify persistency. 184 OBMC Reboot (off) 185 Redfish.Login 186 Verify IP On BMC ${test_ipv4_addr} 187 Verify IP On Redfish URI ${test_ipv4_addr} 188 189 190Add Fourth Octet Threshold IP And Verify 191 [Documentation] Add fourth octet threshold IP and verify. 192 [Tags] Add_Fourth_Octet_Threshold_IP_And_Verify 193 [Teardown] Run Keywords 194 ... Delete IP Address 10.7.7.254 AND Test Teardown Execution 195 196 Add IP Address 10.7.7.254 ${test_subnet_mask} ${test_gateway} 197 198Add Fourth Octet Lowest IP And Verify 199 [Documentation] Add fourth octet lowest IP and verify. 200 [Tags] Add_Fourth_Octet_Lowest_IP_And_Verify 201 [Teardown] Run Keywords 202 ... Delete IP Address 10.7.7.1 AND Test Teardown Execution 203 204 Add IP Address 10.7.7.1 ${test_subnet_mask} ${test_gateway} 205 206Add Third Octet Threshold IP And Verify 207 [Documentation] Add third octet threshold IP and verify. 208 [Tags] Add_Third_Octet_Threshold_IP_And_Verify 209 [Teardown] Run Keywords 210 ... Delete IP Address 10.7.255.7 AND Test Teardown Execution 211 212 Add IP Address 10.7.255.7 ${test_subnet_mask} ${test_gateway} 213 214Add Third Octet Lowest IP And Verify 215 [Documentation] Add third octet lowest IP and verify. 216 [Tags] Add_Third_Octet_Lowest_IP_And_Verify 217 [Teardown] Run Keywords 218 ... Delete IP Address 10.7.0.7 AND Test Teardown Execution 219 220 Add IP Address 10.7.0.7 ${test_subnet_mask} ${test_gateway} 221 222Add Second Octet Threshold IP And Verify 223 [Documentation] Add second octet threshold IP and verify. 224 [Tags] Add_Second_Octet_Threshold_IP_And_Verify 225 [Teardown] Run Keywords 226 ... Delete IP Address 10.255.7.7 AND Test Teardown Execution 227 228 Add IP Address 10.255.7.7 ${test_subnet_mask} ${test_gateway} 229 230Add Second Octet Lowest IP And Verify 231 [Documentation] Add second octet lowest IP and verify. 232 [Tags] Add_Second_Octet_Lowest_IP_And_Verify 233 [Teardown] Run Keywords 234 ... Delete IP Address 10.0.7.7 AND Test Teardown Execution 235 236 Add IP Address 10.0.7.7 ${test_subnet_mask} ${test_gateway} 237 238Add First Octet Threshold IP And Verify 239 [Documentation] Add first octet threshold IP and verify. 240 [Tags] Add_First_Octet_Threshold_IP_And_Verify 241 [Teardown] Run Keywords 242 ... Delete IP Address 223.7.7.7 AND Test Teardown Execution 243 244 Add IP Address 223.7.7.7 ${test_subnet_mask} ${test_gateway} 245 246Add First Octet Lowest IP And Verify 247 [Documentation] Add first octet lowest IP and verify. 248 [Tags] Add_First_Octet_Lowest_IP_And_Verify 249 [Teardown] Run Keywords 250 ... Delete IP Address 1.7.7.7 AND Test Teardown Execution 251 252 Add IP Address 1.7.7.7 ${test_subnet_mask} ${test_gateway} 253 254Configure Invalid Netmask 255 [Documentation] Verify error while setting invalid netmask. 256 [Tags] Configure_Invalid_Netmask 257 [Template] Add IP Address 258 259 # ip subnet_mask gateway valid_status_codes 260 ${test_ipv4_addr} ${invalid_netmask} ${test_gateway} ${HTTP_BAD_REQUEST} 261 262Configure Out Of Range Netmask 263 [Documentation] Verify error while setting out of range netmask. 264 [Tags] Configure_Out_Of_Range_Netmask 265 [Template] Add IP Address 266 267 # ip subnet_mask gateway valid_status_codes 268 ${test_ipv4_addr} ${out_of_range_netmask} ${test_gateway} ${HTTP_BAD_REQUEST} 269 270Configure Alpha Netmask 271 [Documentation] Verify error while setting alpha netmask. 272 [Tags] Configure_Alpha_Netmask 273 [Template] Add IP Address 274 275 # ip subnet_mask gateway valid_status_codes 276 ${test_ipv4_addr} ${alpha_netmask} ${test_gateway} ${HTTP_BAD_REQUEST} 277 278Configure More Byte Netmask 279 [Documentation] Verify error while setting more byte netmask. 280 [Tags] Configure_More_Byte_Netmask 281 [Template] Add IP Address 282 283 # ip subnet_mask gateway valid_status_codes 284 ${test_ipv4_addr} ${more_byte_netmask} ${test_gateway} ${HTTP_BAD_REQUEST} 285 286Configure Less Byte Netmask 287 [Documentation] Verify error while setting less byte netmask. 288 [Tags] Configure_Less_Byte_Netmask 289 [Template] Add IP Address 290 291 # ip subnet_mask gateway valid_status_codes 292 ${test_ipv4_addr} ${less_byte_netmask} ${test_gateway} ${HTTP_BAD_REQUEST} 293 294Configure Threshold Netmask And Verify 295 [Documentation] Configure threshold netmask and verify. 296 [Tags] Configure_Threshold_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} ${threshold_netmask} ${test_gateway} 301 302Configure Lowest Netmask And Verify 303 [Documentation] Configure lowest netmask and verify. 304 [Tags] Configure_Lowest_Netmask_And_Verify 305 [Teardown] Run Keywords 306 ... Delete IP Address ${test_ipv4_addr} AND Test Teardown Execution 307 308 Add IP Address ${test_ipv4_addr} ${lowest_netmask} ${test_gateway} 309 310Configure Network ID 311 [Documentation] Verify error while configuring network ID. 312 [Tags] Configure_Network_ID 313 [Template] Add IP Address 314 [Teardown] Clear IP Settings On Fail ${network_id} 315 316 # ip subnet_mask gateway valid_status_codes 317 ${network_id} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} 318 319Configure Less Octet IP 320 [Documentation] Verify error while Configuring less octet IP address. 321 [Tags] Configure_Less_Octet_IP 322 [Template] Add IP Address 323 324 # ip subnet_mask gateway valid_status_codes 325 ${less_octet_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} 326 327Configure Empty IP 328 [Documentation] Verify error while Configuring empty IP address. 329 [Tags] Configure_Empty_IP 330 [Template] Add IP Address 331 332 # ip subnet_mask gateway valid_status_codes 333 ${EMPTY} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} 334 335Configure Special Char IP 336 [Documentation] Configure invalid IP address containing special chars. 337 [Tags] Configure_Special_Char_IP 338 [Template] Add IP Address 339 340 # ip subnet_mask gateway valid_status_codes 341 @@@.%%.44.11 ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} 342 343Configure Hexadecimal IP 344 [Documentation] Configure invalid IP address containing hex value. 345 [Tags] Configure_Hexadecimal_IP 346 [Template] Add IP Address 347 348 # ip subnet_mask gateway valid_status_codes 349 ${hex_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} 350 351Configure Negative Octet IP 352 [Documentation] Configure invalid IP address containing negative octet. 353 [Tags] Configure_Negative_Octet_IP 354 [Template] Add IP Address 355 356 # ip subnet_mask gateway valid_status_codes 357 ${negative_ip} ${test_subnet_mask} ${test_gateway} ${HTTP_BAD_REQUEST} 358 359Configure Incomplete IP For Gateway 360 [Documentation] Configure incomplete IP for gateway and expect an error. 361 [Tags] Configure_Incomplete_IP_For_Gateway 362 [Template] Add IP Address 363 364 # ip subnet_mask gateway valid_status_codes 365 ${test_ipv4_addr} ${test_subnet_mask} ${less_octet_ip} ${HTTP_BAD_REQUEST} 366 367Configure Special Char IP For Gateway 368 [Documentation] Configure special char IP for gateway and expect an error. 369 [Tags] Configure_Special_Char_IP_For_Gateway 370 [Template] Add IP Address 371 372 # ip subnet_mask gateway valid_status_codes 373 ${test_ipv4_addr} ${test_subnet_mask} @@@.%%.44.11 ${HTTP_BAD_REQUEST} 374 375Configure Hexadecimal IP For Gateway 376 [Documentation] Configure hexadecimal IP for gateway and expect an error. 377 [Tags] Configure_Hexadecimal_IP_For_Gateway 378 [Template] Add IP Address 379 380 # ip subnet_mask gateway valid_status_codes 381 ${test_ipv4_addr} ${test_subnet_mask} ${hex_ip} ${HTTP_BAD_REQUEST} 382 383Get DNS Server And Verify 384 [Documentation] Get DNS server via Redfish and verify. 385 [Tags] Get_DNS_Server_And_Verify 386 387 Verify CLI and Redfish Nameservers 388 389Configure DNS Server And Verify 390 [Documentation] Configure DNS server and verify. 391 [Tags] Configure_DNS_Server_And_Verify 392 [Setup] DNS Test Setup Execution 393 [Teardown] Run Keywords 394 ... Configure Static Name Servers AND Test Teardown Execution 395 396 Configure Static Name Servers ${static_name_servers} 397 Verify CLI and Redfish Nameservers 398 399Delete DNS Server And Verify 400 [Documentation] Delete DNS server and verify. 401 [Tags] Delete_DNS_Server_And_Verify 402 [Setup] DNS Test Setup Execution 403 [Teardown] Run Keywords 404 ... Configure Static Name Servers AND Test Teardown Execution 405 406 Delete Static Name Servers 407 Verify CLI and Redfish Nameservers 408 409Configure DNS Server And Check Persistency 410 [Documentation] Configure DNS server and check persistency on reboot. 411 [Tags] Configure_DNS_Server_And_Check_Persistency 412 [Setup] DNS Test Setup Execution 413 [Teardown] Run Keywords 414 ... Configure Static Name Servers AND Test Teardown Execution 415 416 Configure Static Name Servers ${static_name_servers} 417 # Reboot BMC and verify persistency. 418 OBMC Reboot (off) 419 Redfish.Login 420 Verify CLI and Redfish Nameservers 421 422Configure Loopback IP For Gateway 423 [Documentation] Configure loopback IP for gateway and expect an error. 424 [Tags] Configure_Loopback_IP_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} ${loopback_ip} ${HTTP_BAD_REQUEST} 430 431Configure Network ID For Gateway 432 [Documentation] Configure network ID for gateway and expect an error. 433 [Tags] Configure_Network_ID_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} ${network_id} ${HTTP_BAD_REQUEST} 439 440Configure Multicast IP For Gateway 441 [Documentation] Configure multicast IP for gateway and expect an error. 442 [Tags] Configure_Multicast_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} ${multicast_ip} ${HTTP_BAD_REQUEST} 448 449Configure Broadcast IP For Gateway 450 [Documentation] Configure broadcast IP for gateway and expect an error. 451 [Tags] Configure_Broadcast_IP_For_Gateway 452 [Template] Add IP Address 453 [Teardown] Clear IP Settings On Fail ${test_ipv4_addr} 454 455 # ip subnet_mask gateway valid_status_codes 456 ${test_ipv4_addr} ${test_subnet_mask} ${broadcast_ip} ${HTTP_BAD_REQUEST} 457 458Configure Null Value For DNS Server 459 [Documentation] Configure null value for DNS server and expect an error. 460 [Tags] Configure_Null_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 ${null_value} ${HTTP_BAD_REQUEST} 466 467Configure Empty Value For DNS Server 468 [Documentation] Configure empty value for DNS server and expect an error. 469 [Tags] Configure_Empty_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 ${empty_dictionary} ${HTTP_BAD_REQUEST} 475 476Configure String Value For DNS Server 477 [Documentation] Configure string value for DNS server and expect an error. 478 [Tags] Configure_String_Value_For_DNS_Server 479 [Setup] DNS Test Setup Execution 480 [Teardown] Run Keywords 481 ... Configure Static Name Servers AND Test Teardown Execution 482 483 Configure Static Name Servers ${string_value} ${HTTP_BAD_REQUEST} 484 485Modify IPv4 Address And Verify 486 [Documentation] Modify IP address via Redfish and verify. 487 [Tags] Modify_IPv4_Address_And_Verify 488 [Teardown] Run Keywords 489 ... Delete IP Address ${test_ipv4_addr2} AND Test Teardown Execution 490 491 Add IP Address ${test_ipv4_addr} ${test_subnet_mask} ${test_gateway} 492 493 Update IP Address ${test_ipv4_addr} ${test_ipv4_addr2} ${test_subnet_mask} ${test_gateway} 494 495 496Configure Invalid Values For DNS Server 497 [Documentation] Configure invalid values for DNS server and expect an error. 498 [Tags] Configure_Invalid_Values_For_DNS_Server 499 [Setup] DNS Test Setup Execution 500 [Template] Configure Static Name Servers 501 [Teardown] Run Keywords 502 ... Configure Static Name Servers AND Test Teardown Execution 503 504 # static_name_servers valid_status_codes 505 0xa.0xb.0xc.0xd ${HTTP_BAD_REQUEST} 506 10.-7.-7.-7 ${HTTP_BAD_REQUEST} 507 10.3.36 ${HTTP_BAD_REQUEST} 508 @@@.%%.44.11 ${HTTP_BAD_REQUEST} 509 510 511Config Multiple DNS Servers And Verify 512 [Documentation] Config multiple DNS servers and verify. 513 [Tags] Config_Multiple_DNS_Servers_And_Verify 514 [Setup] DNS Test Setup Execution 515 [Teardown] Run Keywords 516 ... Configure Static Name Servers AND Test Teardown Execution 517 518 @{list_name_servers}= Create List 10.5.5.10 10.20.5.10 10.5.6.7 519 Configure Static Name Servers ${list_name_servers} 520 Verify CLI and Redfish Nameservers 521 522 523Configure And Verify Multiple Static IPv4 Addresses 524 [Documentation] Configure multiple static ipv4 address via Redfish and verify. 525 [Tags] Configure_And_Verify_Multiple_Static_IPv4_Addresses 526 [Teardown] Run Keywords Delete Multiple Static IPv4 Addresses ${test_ipv4_addresses} 527 ... AND Test Teardown Execution 528 529 ${test_ipv4_addresses}= Create List ${test_ipv4_addr} ${test_ipv4_addr2} 530 Configure Multiple Static IPv4 Addresses ${test_ipv4_addresses} ${test_subnet_mask} ${test_gateway} 531 532 533Configure Multiple Static IPv4 Addresses And Check Persistency 534 [Documentation] Configure multiple static ipv4 address via Redfish and check persistency. 535 [Tags] Configure_Multiple_Static_IPv4_Addresses_And_Check_Persistency 536 [Teardown] Run Keywords Delete Multiple Static IPv4 Addresses ${test_ipv4_addresses} 537 ... AND Test Teardown Execution 538 539 ${test_ipv4_addresses}= Create List ${test_ipv4_addr} ${test_ipv4_addr2} 540 Configure Multiple Static IPv4 Addresses ${test_ipv4_addresses} ${test_subnet_mask} ${test_gateway} 541 542 # Reboot BMC and verify persistency. 543 OBMC Reboot (off) 544 Redfish.Login 545 FOR ${ip} IN @{test_ipv4_addresses} 546 Verify IP And Netmask On BMC ${ip} ${test_subnet_mask} 547 Verify IP On Redfish URI ${ip} 548 END 549 550 551Configure And Verify Multiple IPv4 Addresses 552 [Documentation] Configure multiple IPv4 addresses and verify. 553 [Tags] Configure_And_Verify_Multiple_IPv4_Addresses 554 [Teardown] Run Keywords 555 ... Delete IP Address ${test_ipv4_addr} AND Delete IP Address ${test_ipv4_addr2} 556 ... AND Test Teardown Execution 557 558 ${ip1}= Create dictionary Address=${test_ipv4_addr} 559 ... SubnetMask=255.255.0.0 Gateway=${test_gateway} 560 ${ip2}= Create dictionary Address=${test_ipv4_addr2} 561 ... SubnetMask=255.255.252.0 Gateway=${test_gateway} 562 563 ${empty_dict}= Create Dictionary 564 ${patch_list}= Create List 565 ${network_configurations}= Get Network Configuration 566 ${num_entries}= Get Length ${network_configurations} 567 568 FOR ${INDEX} IN RANGE 0 ${num_entries} 569 Append To List ${patch_list} ${empty_dict} 570 END 571 572 # We need not check for existence of IP on BMC while adding. 573 Append To List ${patch_list} ${ip1} ${ip2} 574 ${payload}= Create Dictionary IPv4StaticAddresses=${patch_list} 575 ${active_channel_config}= Get Active Channel Config 576 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} 577 Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body=&{payload} 578 ... valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}] 579 580 # Note: Network restart takes around 15-18s after patch request processing. 581 Sleep ${NETWORK_TIMEOUT}s 582 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT} 583 Verify IP On BMC ${test_ipv4_addr} 584 Verify IP On BMC ${test_ipv4_addr2} 585 586 587Config Multiple DNS Servers And Check Persistency 588 [Documentation] Config multiple DNS and check persistency. 589 [Tags] Config_Multiple_DNS_Servers_And_Check_Persistency 590 [Setup] DNS Test Setup Execution 591 [Teardown] Run Keywords 592 ... Configure Static Name Servers AND Test Teardown Execution 593 594 @{list_name_servers}= Create List 10.5.5.10 10.20.5.10 10.5.6.7 595 Configure Static Name Servers ${list_name_servers} 596 597 # Reboot BMC and verify persistency. 598 OBMC Reboot (off) 599 Redfish.Login 600 Verify CLI and Redfish Nameservers 601 602 603Configure Static IP Without Using Gateway And Verify 604 [Documentation] Configure static IP without using gateway and verify error. 605 [Tags] Configure_Static_IP_Without_Using_Gateway_And_Verify 606 607 ${ip}= Create dictionary Address=${test_ipv4_addr} 608 ... SubnetMask=${test_subnet_mask} 609 ${empty_dict}= Create Dictionary 610 ${patch_list}= Create List 611 ${network_configurations}= Get Network Configuration 612 613 ${num_entries}= Get Length ${network_configurations} 614 FOR ${INDEX} IN RANGE 0 ${num_entries} 615 Append To List ${patch_list} ${empty_dict} 616 END 617 618 # We need not check for existence of IP on BMC while adding. 619 Append To List ${patch_list} ${ip} 620 ${payload}= Create Dictionary IPv4StaticAddresses=${patch_list} 621 ${active_channel_config}= Get Active Channel Config 622 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} 623 Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 624 ... body=&{payload} valid_status_codes=[${HTTP_BAD_REQUEST}] 625 626 627Test Network Response On Specified Host State 628 [Documentation] Verifying the BMC network response when host is on and off. 629 [Tags] Test_Network_Response_On_Specified_Host_State 630 [Template] Verify Network Response On Specified Host State 631 632 # host_state 633 on 634 off 635 636 637*** Keywords *** 638 639Test Setup Execution 640 [Documentation] Test setup execution. 641 642 Redfish.Login 643 644 @{network_configurations}= Get Network Configuration 645 Set Test Variable @{network_configurations} 646 647 # Get BMC IP address and prefix length. 648 ${ip_data}= Get BMC IP Info 649 Set Test Variable ${ip_data} 650 651 652Verify Netmask On BMC 653 [Documentation] Verify netmask on BMC. 654 [Arguments] ${netmask} 655 656 # Description of the argument(s): 657 # netmask netmask value to be verified. 658 659 ${prefix_length}= Netmask Prefix Length ${netmask} 660 661 Should Contain Match ${ip_data} */${prefix_length} 662 ... msg=Prefix length does not exist. 663 664Verify IP And Netmask On BMC 665 [Documentation] Verify IP and netmask on BMC. 666 [Arguments] ${ip} ${netmask} 667 668 # Description of the argument(s): 669 # ip IP address to be verified. 670 # netmask netmask value to be verified. 671 672 ${prefix_length}= Netmask Prefix Length ${netmask} 673 @{ip_data}= Get BMC IP Info 674 675 ${ip_with_netmask}= Catenate ${ip}/${prefix_length} 676 Should Contain ${ip_data} ${ip_with_netmask} 677 ... msg=IP and netmask pair does not exist. 678 679Test Teardown Execution 680 [Documentation] Test teardown execution. 681 682 FFDC On Test Case Fail 683 Redfish.Logout 684 685Clear IP Settings On Fail 686 [Documentation] Clear IP settings on fail. 687 [Arguments] ${ip} 688 689 # Description of argument(s): 690 # ip IP address to be deleted. 691 692 Run Keyword If '${TEST STATUS}' == 'FAIL' 693 ... Delete IP Address ${ip} 694 695 Test Teardown Execution 696 697Verify CLI and Redfish Nameservers 698 [Documentation] Verify that nameservers obtained via Redfish do not 699 ... match those found in /etc/resolv.conf. 700 701 ${active_channel_config}= Get Active Channel Config 702 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} 703 704 ${redfish_nameservers}= Redfish.Get Attribute 705 ... ${REDFISH_NW_ETH_IFACE}${ethernet_interface} StaticNameServers 706 ${resolve_conf_nameservers}= CLI Get Nameservers 707 Rqprint Vars redfish_nameservers resolve_conf_nameservers 708 709 List Should Contain Sub List ${resolve_conf_nameservers} ${redfish_nameservers} 710 ... msg=The nameservers obtained via Redfish do not match those found in /etc/resolv.conf. 711 712Configure Static Name Servers 713 [Documentation] Configure DNS server on BMC. 714 [Arguments] ${static_name_servers}=${original_nameservers} 715 ... ${valid_status_codes}=${HTTP_OK} 716 717 # Description of the argument(s): 718 # static_name_servers A list of static name server IPs to be 719 # configured on the BMC. 720 721 ${active_channel_config}= Get Active Channel Config 722 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} 723 724 ${type} = Evaluate type($static_name_servers).__name__ 725 ${static_name_servers}= Set Variable If '${type}'=='str' 726 ... '${static_name_servers}' ${static_name_servers} 727 728 # Currently BMC is sending 500 response code instead of 400 for invalid scenarios. 729 Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 730 ... body={'StaticNameServers': ${static_name_servers}} 731 ... valid_status_codes=[${valid_status_codes}, ${HTTP_INTERNAL_SERVER_ERROR}] 732 733 # Patch operation takes 1 to 3 seconds to set new value. 734 Sleep 3s 735 736 # Check if newly added DNS server is configured on BMC. 737 ${cli_nameservers}= CLI Get Nameservers 738 ${cmd_status}= Run Keyword And Return Status 739 ... List Should Contain Sub List ${cli_nameservers} ${static_name_servers} 740 741 Run Keyword If '${valid_status_codes}' == '${HTTP_OK}' 742 ... Should Be True ${cmd_status} == ${True} 743 ... ELSE Should Be True ${cmd_status} == ${False} 744 745Delete Static Name Servers 746 [Documentation] Delete static name servers. 747 748 Configure Static Name Servers static_name_servers=@{EMPTY} 749 750 # Check if all name servers deleted on BMC. 751 ${nameservers}= CLI Get Nameservers 752 Should Be Empty ${nameservers} 753 754DNS Test Setup Execution 755 [Documentation] Do DNS test setup execution. 756 757 Redfish.Login 758 759 ${active_channel_config}= Get Active Channel Config 760 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} 761 762 ${original_nameservers}= Redfish.Get Attribute 763 ... ${REDFISH_NW_ETH_IFACE}${ethernet_interface} StaticNameServers 764 765 Rprint Vars original_nameservers 766 # Set suite variables to trigger restoration during teardown. 767 Set Suite Variable ${original_nameservers} 768 769Suite Setup Execution 770 [Documentation] Do suite setup execution. 771 772 ${test_gateway}= Get BMC Default Gateway 773 Set Suite Variable ${test_gateway} 774 775Update IP Address 776 [Documentation] Update IP address of BMC. 777 [Arguments] ${ip} ${new_ip} ${netmask} ${gw_ip} 778 ... ${valid_status_codes}=[${HTTP_OK}, ${HTTP_NO_CONTENT}] 779 780 # Description of argument(s): 781 # ip IP address to be replaced (e.g. "10.7.7.7"). 782 # new_ip New IP address to be configured. 783 # netmask Netmask value. 784 # gw_ip Gateway IP address. 785 # valid_status_codes Expected return code from patch operation 786 # (e.g. "200"). See prolog of rest_request 787 # method in redfish_plus.py for details. 788 789 ${empty_dict}= Create Dictionary 790 ${patch_list}= Create List 791 ${ip_data}= Create Dictionary Address=${new_ip} SubnetMask=${netmask} Gateway=${gw_ip} 792 793 # Find the position of IP address to be modified. 794 @{network_configurations}= Get Network Configuration 795 FOR ${network_configuration} IN @{network_configurations} 796 Run Keyword If '${network_configuration['Address']}' == '${ip}' 797 ... Append To List ${patch_list} ${ip_data} 798 ... ELSE Append To List ${patch_list} ${empty_dict} 799 END 800 801 ${ip_found}= Run Keyword And Return Status List Should Contain Value 802 ... ${patch_list} ${ip_data} msg=${ip} does not exist on BMC 803 Pass Execution If ${ip_found} == ${False} ${ip} does not exist on BMC 804 805 # Run patch command only if given IP is found on BMC 806 ${data}= Create Dictionary IPv4StaticAddresses=${patch_list} 807 808 ${active_channel_config}= Get Active Channel Config 809 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} 810 811 Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 812 ... body=&{data} valid_status_codes=${valid_status_codes} 813 814 # Note: Network restart takes around 15-18s after patch request processing. 815 Sleep ${NETWORK_TIMEOUT}s 816 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT} 817 818 Verify IP On BMC ${new_ip} 819 Validate Network Config On BMC 820 821Configure Multiple Static IPv4 Addresses 822 [Documentation] Configure multiple static ipv4 address via Redfish and verify. 823 [Arguments] ${ip_addreses} ${subnet_mask} ${gateway} 824 825 # Description of argument(s): 826 # ip_addreses A list of IP addresses to be added (e.g.["10.7.7.7"]). 827 # subnet_mask Subnet mask for the IP to be added (e.g. "255.255.0.0"). 828 # gateway Gateway for the IP to be added (e.g. "10.7.7.1"). 829 830 FOR ${ip} IN @{ip_addreses} 831 Add IP Address ${ip} ${subnet_mask} ${gateway} 832 END 833 Validate Network Config On BMC 834 835 836Delete Multiple Static IPv4 Addresses 837 [Documentation] Delete multiple static ipv4 address via Redfish. 838 [Arguments] ${ip_addreses} 839 840 # Description of argument(s): 841 # ip_addreses A list of IP addresses to be deleted (e.g.["10.7.7.7"]). 842 843 FOR ${ip} IN @{ip_addreses} 844 Delete IP Address ${ip} 845 END 846 Validate Network Config On BMC 847 848Verify Network Response On Specified Host State 849 [Documentation] Verifying the BMC network response when host is on and off. 850 [Arguments] ${host_state} 851 852 # Description of argument(s): 853 # host_state if host_state is on then host is booted to operating system. 854 # if host_state is off then host is power off. 855 # (eg. on, off). 856 857 ${active_channel_config}= Get Active Channel Config 858 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} 859 860 Run Keyword If '${host_state}' == 'on' 861 ... Redfish Power On stack_mode=skip 862 ... ELSE 863 ... Redfish Power off stack_mode=skip 864 865 Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 866 Ping Host ${OPENBMC_HOST} 867 868 869Verify IP On Redfish URI 870 [Documentation] Verify given IP on redfish URI. 871 [Arguments] ${ip_address} 872 873 # Description of argument(s): 874 # ip_address Configured IP address which need to verified. 875 876 ${network_configurations}= Get Network Configuration 877 878 FOR ${network_configuration} IN @{network_configurations} 879 ${ip_found}= Set Variable If '${network_configuration['Address']}' == '${ip_address}' ${True} 880 ... ${False} 881 Exit For Loop If ${ip_found} 882 END 883 Run Keyword If '${ip_found}' == '${False}' 884 ... Fail msg=Configured IP address not found on EthernetInterface URI. 885