1*** Settings *** 2Documentation Network interface IPv6 configuration and verification 3 ... tests. 4 5Resource ../../lib/bmc_redfish_resource.robot 6Resource ../../lib/openbmc_ffdc.robot 7Resource ../../lib/bmc_ipv6_utils.robot 8Resource ../../lib/external_intf/vmi_utils.robot 9Resource ../../lib/bmc_network_utils.robot 10Library ../../lib/bmc_network_utils.py 11Library Collections 12Library Process 13 14Test Setup Test Setup Execution 15Test Teardown Test Teardown Execution 16Suite Setup Suite Setup Execution 17Suite Teardown Redfish.Logout 18 19Test Tags BMC_IPv6 20 21*** Variables *** 22${test_ipv6_addr} 2001:db8:3333:4444:5555:6666:7777:8888 23${test_ipv6_invalid_addr} 2001:db8:3333:4444:5555:6666:7777:JJKK 24${test_ipv6_addr1} 2001:db8:3333:4444:5555:6666:7777:9999 25${invalid_hexadec_ipv6} x:x:x:x:x:x:10.5.5.6 26${ipv6_multi_short} 2001::33::111 27# Valid prefix length is a integer ranges from 1 to 128. 28${test_prefix_length} 64 29${ipv6_gw_addr} 2002:903:15F:32:9:3:32:1 30${prefix_length_def} None 31${invalid_staticv6_gateway} 9.41.164.1 32${new_mac_addr} AA:E2:84:14:28:79 33${linklocal_addr_format} fe80::[0-9a-f:]+$ 34${link_local_addr} fe80:: 35${link_local_prefix_len} 10 36${ipv6_leading_zero} 2001:0022:0033::0111 37${ipv6_eliminate_zero} 2001:22:33::111 38 39*** Test Cases *** 40 41Get IPv6 Address And Verify 42 [Documentation] Get IPv6 Address And Verify. 43 [Tags] Get_IPv6_Address_And_Verify 44 45 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations} 46 Verify IPv6 On BMC ${ipv6_network_configuration['Address']} 47 END 48 49 50Get PrefixLength And Verify 51 [Documentation] Get IPv6 prefix length and verify. 52 [Tags] Get_PrefixLength_And_Verify 53 54 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations} 55 Verify IPv6 On BMC ${ipv6_network_configuration['PrefixLength']} 56 END 57 58 59Get IPv6 Default Gateway And Verify 60 [Documentation] Get IPv6 default gateway and verify. 61 [Tags] Get_IPv6_Default_Gateway_And_Verify 62 63 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 64 ${ipv6_gateway}= Get From Dictionary ${resp.dict} IPv6DefaultGateway 65 Verify IPv6 Default Gateway On BMC ${ipv6_gateway} 66 67 68Verify All Configured IPv6 And PrefixLength On BMC 69 [Documentation] Verify IPv6 address and its prefix length on BMC. 70 [Tags] Verify_All_Configured_IPv6_And_PrefixLength_On_BMC 71 72 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations} 73 Verify IPv6 And PrefixLength ${ipv6_network_configuration['Address']} 74 ... ${ipv6_network_configuration['PrefixLength']} 75 END 76 77 78Configure IPv6 Address And Verify 79 [Documentation] Configure IPv6 address and verify. 80 [Tags] Configure_IPv6_Address_And_Verify 81 [Teardown] Run Keywords 82 ... Delete IPv6 Address ${test_ipv6_addr} AND Test Teardown Execution 83 [Template] Configure IPv6 Address On BMC 84 85 86 # IPv6 address Prefix length 87 ${test_ipv6_addr} ${test_prefix_length} 88 89 90Delete IPv6 Address And Verify 91 [Documentation] Delete IPv6 address and verify. 92 [Tags] Delete_IPv6_Address_And_Verify 93 94 Configure IPv6 Address On BMC ${test_ipv6_addr} ${test_prefix_length} 95 96 Delete IPv6 Address ${test_ipv6_addr} 97 98 99Modify IPv6 Address And Verify 100 [Documentation] Modify IPv6 address and verify. 101 [Tags] Modify_IPv6_Address_And_Verify 102 [Teardown] Run Keywords 103 ... Delete IPv6 Address ${test_ipv6_addr1} AND Test Teardown Execution 104 105 Configure IPv6 Address On BMC ${test_ipv6_addr} ${test_prefix_length} 106 107 Modify IPv6 Address ${test_ipv6_addr} ${test_ipv6_addr1} ${test_prefix_length} 108 109 110Verify Persistency Of IPv6 After BMC Reboot 111 [Documentation] Verify persistency of IPv6 after BMC reboot. 112 [Tags] Verify_Persistency_Of_IPv6_After_BMC_Reboot 113 [Teardown] Run Keywords 114 ... Delete IPv6 Address ${test_ipv6_addr} AND Test Teardown Execution 115 116 Configure IPv6 Address On BMC ${test_ipv6_addr} ${test_prefix_length} 117 118 Redfish OBMC Reboot (off) stack_mode=skip 119 120 # Verifying persistency of IPv6. 121 Verify IPv6 On BMC ${test_ipv6_addr} 122 123 124Enable SLAAC On BMC And Verify 125 [Documentation] Enable SLAAC on BMC and verify. 126 [Tags] Enable_SLAAC_On_BMC_And_Verify 127 128 Set SLAAC Configuration State And Verify ${True} 129 130 131Enable DHCPv6 Property On BMC And Verify 132 [Documentation] Enable DHCPv6 property on BMC and verify. 133 [Tags] Enable_DHCPv6_Property_On_BMC_And_Verify 134 135 Set And Verify DHCPv6 Property Enabled 136 137 138Disable DHCPv6 Property On BMC And Verify 139 [Documentation] Disable DHCPv6 property on BMC and verify. 140 [Tags] Disable_DHCPv6_Property_On_BMC_And_Verify 141 142 Set And Verify DHCPv6 Property Disabled 143 144 145Verify Persistency Of DHCPv6 On Reboot 146 [Documentation] Verify persistency of DHCPv6 property on reboot. 147 [Tags] Verify_Persistency_Of_DHCPv6_On_Reboot 148 149 Set And Verify DHCPv6 Property Enabled 150 Redfish OBMC Reboot (off) stack_mode=skip 151 Verify DHCPv6 Property Enabled 152 153 154Configure Invalid Static IPv6 And Verify 155 [Documentation] Configure invalid static IPv6 and verify. 156 [Tags] Configure_Invalid_Static_IPv6_And_Verify 157 [Template] Configure IPv6 Address On BMC 158 159 #invalid_ipv6 prefix length valid_status_code 160 ${ipv4_hexword_addr} ${test_prefix_length} ${HTTP_BAD_REQUEST} 161 ${invalid_hexadec_ipv6} ${test_prefix_length} ${HTTP_BAD_REQUEST} 162 ${ipv6_multi_short} ${test_prefix_length} ${HTTP_BAD_REQUEST} 163 164 165 166Configure IPv6 Static Default Gateway And Verify 167 [Documentation] Configure IPv6 static default gateway and verify. 168 [Tags] Configure_IPv6_Static_Default_Gateway_And_Verify 169 [Template] Configure IPv6 Static Default Gateway On BMC 170 171 # static_def_gw prefix length valid_status_code 172 ${ipv6_gw_addr} ${prefix_length_def} ${HTTP_OK} 173 ${invalid_staticv6_gateway} ${test_prefix_length} ${HTTP_BAD_REQUEST} 174 175 176Modify Static Default Gateway And Verify 177 [Documentation] Modify static default gateway and verify. 178 [Tags] Modify_Static_Default_Gateway_And_Verify 179 [Setup] Configure IPv6 Static Default Gateway On BMC ${ipv6_gw_addr} ${prefix_length_def} 180 181 Modify IPv6 Static Default Gateway On BMC ${test_ipv6_addr1} ${prefix_length_def} ${HTTP_OK} ${ipv6_gw_addr} 182 183 184Delete IPv6 Static Default Gateway And Verify 185 [Documentation] Delete IPv6 static default gateway and verify. 186 [Tags] Delete_IPv6_Static_Default_Gateway_And_Verify 187 [Setup] Configure IPv6 Static Default Gateway On BMC ${ipv6_gw_addr} ${prefix_length_def} 188 189 Delete IPv6 Static Default Gateway ${ipv6_gw_addr} 190 191 192Verify Coexistence Of Linklocalv6 And Static IPv6 On BMC 193 [Documentation] Verify linklocalv6 And static IPv6 both exist. 194 [Tags] Verify_Coexistence_Of_Linklocalv6_And_Static_IPv6_On_BMC 195 [Setup] Configure IPv6 Address On BMC ${test_ipv6_addr} ${test_prefix_length} 196 [Teardown] Delete IPv6 Address ${test_ipv6_addr} 197 198 Check Coexistence Of Linklocalv6 And Static IPv6 199 200 201Verify IPv6 Linklocal Address Is In Correct Format 202 [Documentation] Verify linklocal address has network part as fe80 and 203 ... host part as EUI64. 204 [Tags] Verify_IPv6_Linklocal_Address_Is_In_Correct_Format 205 206 Check If Linklocal Address Is In Correct Format 207 208 209Verify BMC Gets SLAAC Address On Enabling SLAAC 210 [Documentation] On enabling SLAAC verify SLAAC address comes up. 211 [Tags] Verify_BMC_Gets_SLAAC_Address_On_Enabling_SLAAC 212 [Setup] Set SLAAC Configuration State And Verify ${False} 213 214 Set SLAAC Configuration State And Verify ${True} 215 Sleep ${NETWORK_TIMEOUT} 216 Check BMC Gets SLAAC Address 217 218 219Verify Enable And Disable SLAAC On Both Interfaces 220 [Documentation] Verify enable and disable SLAAC on both the interfaces. 221 [Tags] Verify_Enable_And_Disable_SLAAC_On_Both_Interfaces 222 [Setup] Get The Initial SLAAC Settings 223 [Template] Set And Verify SLAAC Property On Both Interfaces 224 [Teardown] Run Keywords Set SLAAC Configuration State And Verify ${slaac_channel_1} [${HTTP_OK}] ${1} 225 ... AND Set SLAAC Configuration State And Verify ${slaac_channel_2} [${HTTP_OK}] ${2} 226 227 # slaac_eth0 slaac_eth1 228 ${True} ${True} 229 ${True} ${False} 230 ${False} ${True} 231 ${False} ${False} 232 233 234Configure And Validate DHCPv6 Settings On Both Network Interfaces 235 [Documentation] Configure and validate the DHCPv6 enable/disable settings 236 ... on both network interfaces. 237 [Tags] Configure_And_Validate_DHCPv6_Settings_On_Both_Network_Interfaces 238 [Setup] Get The Initial DHCPv6 Settings 239 [Template] Set And Verify DHCPv6 Property On Both Interfaces 240 [Teardown] Run Keywords Set And Verify DHCPv6 Property ${dhcpv6_channel_1} ${1} AND 241 ... Set And Verify DHCPv6 Property ${dhcpv6_channel_2} ${2} 242 243 # DHCPv6_eth0 DHCPv6_eth1 244 Enabled Enabled 245 Enabled Disabled 246 Disabled Enabled 247 Disabled Disabled 248 249 250Verify Autoconfig Is Present On Ethernet Interface 251 [Documentation] Verify autoconfig is present on ethernet interface. 252 [Tags] Verify_Autoconfig_Is_Present_On_Ethernet_Interface 253 254 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 255 Should Contain ${resp.dict} StatelessAddressAutoConfig 256 257 258Verify Interface ID Of SLAAC And LinkLocal Addresses Are Same 259 [Documentation] Validate interface id of SLAAC and link-local addresses are same. 260 [Tags] Verify_Interface_ID_Of_SLAAC_And_LinkLocal_Addresses_Are_Same 261 262 @{ipv6_addressorigin_list} ${ipv6_linklocal_addr}= Get Address Origin List And Address For Type LinkLocal 263 @{ipv6_addressorigin_list} ${ipv6_slaac_addr}= Get Address Origin List And Address For Type SLAAC 264 265 ${linklocal_interface_id}= Get Interface ID Of IPv6 ${ipv6_linklocal_addr} 266 ${slaac_interface_id}= Get Interface ID Of IPv6 ${ipv6_slaac_addr} 267 268 Should Be Equal ${linklocal_interface_id} ${slaac_interface_id} 269 270 271Verify Persistency Of Link Local IPv6 On BMC Reboot 272 [Documentation] Verify persistency of link local on BMC reboot. 273 [Tags] Verify_Persistency_Of_Link_Local_IPv6_On_BMC_Reboot 274 275 # Capturing the linklocal before reboot. 276 @{ipv6_address_origin_list} ${linklocal_addr_before_reboot}= 277 ... Get Address Origin List And Address For Type LinkLocal 278 279 # Rebooting BMC. 280 Redfish OBMC Reboot (off) stack_mode=skip 281 282 @{ipv6_address_origin_list} ${linklocal_addr_after_reboot}= 283 ... Get Address Origin List And Address For Type LinkLocal 284 285 # Verifying the linklocal must be the same before and after reboot. 286 Should Be Equal ${linklocal_addr_before_reboot} ${linklocal_addr_after_reboot} 287 ... msg=IPv6 Linklocal address has changed after reboot. 288 289 290Modify MAC and Verify BMC Reinitializing Linklocal 291 [Documentation] Modify MAC and verify BMC reinitializing linklocal. 292 [Tags] Modify_MAC_and_Verify_BMC_Reinitializing_Linklocal 293 [Teardown] Configure MAC Settings ${original_address} 294 295 ${original_address}= Get BMC MAC Address 296 @{ipv6_addressorigin_list} ${ipv6_before_linklocal_addr}= Get Address Origin List And Address For Type LinkLocal 297 298 # Modify MAC Address Of Ethernet Interface. 299 Configure MAC Settings ${new_mac_addr} 300 Sleep 30s 301 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT} 302 @{ipv6_addressorigin_list} ${ipv6_linklocal_after_addr}= Get Address Origin List And Address For Type LinkLocal 303 304 # Verify whether the linklocal has changed and is in the the correct format. 305 Check If Linklocal Address Is In Correct Format 306 Should Not Be Equal ${ipv6_before_linklocal_addr} ${ipv6_linklocal_after_addr} 307 308 309Add Multiple IPv6 Address And Verify 310 [Documentation] Add multiple IPv6 address and verify. 311 [Tags] Add_Multiple_IPv6_Address_And_Verify 312 [Teardown] Run Keywords 313 ... Delete IPv6 Address ${test_ipv6_addr} AND Delete IPv6 Address ${test_ipv6_addr1} 314 ... AND Test Teardown Execution 315 316 Configure Multiple IPv6 Address on BMC ${test_prefix_length} 317 318 319Verify Coexistence Of Static IPv6 And SLAAC On BMC 320 [Documentation] Verify static IPv6 And SLAAC both coexist. 321 [Tags] Verify_Coexistence_Of_Static_IPv6_And_SLAAC_On_BMC 322 [Setup] Configure IPv6 Address On BMC ${test_ipv6_addr} ${test_prefix_length} 323 Set SLAAC Configuration State And Verify ${True} 324 [Teardown] Delete IPv6 Address ${test_ipv6_addr} 325 326 Sleep ${NETWORK_TIMEOUT}s 327 328 Check Coexistence Of Static IPv6 And SLAAC 329 330 331Verify Coexistence Of Link Local And DHCPv6 On BMC 332 [Documentation] Verify link local And dhcpv6 both coexist. 333 [Tags] Verify_Coexistence_Of_Link_Local_And_DHCPv6_On_BMC 334 [Setup] Set DHCPv6 Property Enabled ${2} 335 336 Sleep ${NETWORK_TIMEOUT}s 337 338 Check Coexistence Of Link Local And DHCPv6 339 340 341Verify Coexistence Of Link Local And SLAAC On BMC 342 [Documentation] Verify link local And SLAAC both coexist. 343 [Tags] Verify_Coexistence_Of_Link_Local_And_SLAAC_On_BMC 344 [Setup] Set SLAAC Configuration State And Verify ${True} 345 346 Sleep ${NETWORK_TIMEOUT}s 347 348 Check Coexistence Of Link Local And SLAAC 349 350 351Verify Coexistence Of All IPv6 Type Addresses On BMC 352 [Documentation] Verify coexistence of link local, static, DHCPv6 and SLAAC ipv6 addresses. 353 [Tags] Verify_Coexistence_Of_All_IPv6_Type_Addresses_On_BMC 354 [Setup] Run Keywords Configure IPv6 Address On BMC ${test_ipv6_addr} ${test_prefix_length} 355 ... AND Get The Initial DHCPv6 Setting On Each Interface ${1} 356 ... AND Set And Verify DHCPv6 Property Enabled 357 ... AND Get The Initial SLAAC Setting On Each Interface ${1} 358 ... AND Set SLAAC Configuration State And Verify ${True} 359 [Teardown] Run Keywords Delete IPv6 Address ${test_ipv6_addr} 360 ... AND Set And Verify DHCPv6 Property ${dhcpv6_channel_1} ${1} 361 ... AND Set SLAAC Configuration State And Verify ${slaac_channel_1} [${HTTP_OK}] ${1} 362 363 Sleep ${NETWORK_TIMEOUT}s 364 365 # Verify link local, static, DHCPv6 and SLAAC ipv6 addresses coexist. 366 Verify The Coexistence Of The Address Type LinkLocal Static DHCPv6 SLAAC 367 368 369Configure Link Local IPv6 Address And Verify 370 [Documentation] Configure link local IPv6 address and verify. 371 [Tags] Configure_Link_Local_IPv6_Address_And_Verify 372 373 Configure IPv6 Address On BMC ${link_local_addr} ${link_local_prefix_len} 374 375 # Verify the address origin contains link local. 376 @{ipv6_address_origin_list} ${ipv6_link_local_addr}= 377 ... Get Address Origin List And Address For Type LinkLocal 378 379 ${count}= Evaluate ${ipv6_address_origin_list}.count("LinkLocal") 380 381 Should Be Equal As Integers ${count} 2 382 383 384Configure IPv6 With Leading Zeros And Verify 385 [Documentation] Configure IPv6 with leading zeros & verify address is configured by eliminating 0s in multiple hextets. 386 [Tags] Configure_IPv6_with_Leading_Zeros_And_Verify 387 [Teardown] Run Keywords 388 ... Delete IPv6 Address ${ipv6_eliminate_zero} AND Test Teardown Execution 389 390 #Verify 2001:0022:0033::0111 configured as 2001:22:33::111. 391 Configure IPv6 Address On BMC 392 ... ${ipv6_leading_zero} ${test_prefix_length} ${ipv6_eliminate_zero} 393 394 395Verify Coexistence Of IPv6 Addresses Type Combination On BMC 396 [Documentation] Verify coexistence of IPv6 addresses type combination on BMC. 397 [Tags] Verify_Coexistence_Of_IPv6_Addresses_Type_Combination_On_BMC 398 [Setup] Run Keywords 399 ... Get The Initial DHCPv6 Setting On Each Interface ${1} 400 ... AND Get The Initial SLAAC Setting On Each Interface ${1} 401 [Teardown] Run Keywords 402 ... Set And Verify DHCPv6 Property ${dhcpv6_channel_1} ${1} 403 ... AND Set SLAAC Configuration State And Verify ${slaac_channel_1} [${HTTP_OK}] ${1} 404 [Template] Verify IPv6 Addresses Coexist 405 406 # type1 type2. 407 Static DHCPv6 408 DHCPv6 SLAAC 409 SLAAC Static 410 Static Static 411 412 413*** Keywords *** 414 415Suite Setup Execution 416 [Documentation] Do suite setup execution. 417 418 Redfish.Login 419 ${active_channel_config}= Get Active Channel Config 420 Set Suite Variable ${active_channel_config} 421 422 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} 423 424 Set Suite variable ${ethernet_interface} 425 426 # Get initial IPv4 and IPv6 addresses and address origins for eth0. 427 ${initial_ipv4_addressorigin_list} ${initial_ipv4_addr_list}= Get Address Origin List And IPv4 or IPv6 Address IPv4Addresses 428 ${initial_ipv6_addressorigin_list} ${initial_ipv6_addr_list}= Get Address Origin List And IPv4 or IPv6 Address IPv6Addresses 429 430 Set Suite Variable ${initial_ipv4_addressorigin_list} 431 Set Suite Variable ${initial_ipv4_addr_list} 432 Set Suite Variable ${initial_ipv6_addressorigin_list} 433 Set Suite Variable ${initial_ipv6_addr_list} 434 435 # Get initial IPv4 and IPv6 addresses and address origins for eth1. 436 ${eth1_initial_ipv4_addressorigin_list} ${eth1_initial_ipv4_addr_list}= 437 ... Get Address Origin List And IPv4 or IPv6 Address IPv4Addresses ${2} 438 ${eth1_initial_ipv6_addressorigin_list} ${eth1_initial_ipv6_addr_list}= 439 ... Get Address Origin List And IPv4 or IPv6 Address IPv6Addresses ${2} 440 Set Suite Variable ${eth1_initial_ipv4_addressorigin_list} 441 Set Suite Variable ${eth1_initial_ipv4_addr_list} 442 Set Suite Variable ${eth1_initial_ipv6_addressorigin_list} 443 Set Suite Variable ${eth1_initial_ipv6_addr_list} 444 445 446Test Setup Execution 447 [Documentation] Test setup execution. 448 449 @{ipv6_network_configurations}= Get IPv6 Network Configuration 450 Set Test Variable @{ipv6_network_configurations} 451 452 # Get BMC IPv6 address and prefix length. 453 ${ipv6_data}= Get BMC IPv6 Info 454 Set Test Variable ${ipv6_data} 455 456 457Test Teardown Execution 458 [Documentation] Test teardown execution. 459 460 FFDC On Test Case Fail 461 462 463Get IPv6 Network Configuration 464 [Documentation] Get Ipv6 network configuration. 465 # Sample output: 466 # { 467 # "@odata.id": "/redfish/v1/Managers/${MANAGER_ID}/EthernetInterfaces/eth0", 468 # "@odata.type": "#EthernetInterface.v1_4_1.EthernetInterface", 469 # "DHCPv4": { 470 # "DHCPEnabled": false, 471 # "UseDNSServers": false, 472 # "UseDomainName": true, 473 # "UseNTPServers": false 474 # }, 475 # "DHCPv6": { 476 # "OperatingMode": "Disabled", 477 # "UseDNSServers": false, 478 # "UseDomainName": true, 479 # "UseNTPServers": false 480 # }, 481 # "Description": "Management Network Interface", 482 # "FQDN": "localhost", 483 # "HostName": "localhost", 484 # "IPv4Addresses": [ 485 # { 486 # "Address": "xx.xx.xx.xx", 487 # "AddressOrigin": "Static", 488 # "Gateway": "xx.xx.xx.1", 489 # "SubnetMask": "xx.xx.xx.0" 490 # }, 491 # { 492 # "Address": "169.254.xx.xx", 493 # "AddressOrigin": "IPv4LinkLocal", 494 # "Gateway": "0.0.0.0", 495 # "SubnetMask": "xx.xx.0.0" 496 # }, 497 # ], 498 # "IPv4StaticAddresses": [ 499 # { 500 # "Address": "xx.xx.xx.xx", 501 # "AddressOrigin": "Static", 502 # "Gateway": "xx.xx.xx.1", 503 # "SubnetMask": "xx.xx.0.0" 504 # } 505 # } 506 # ], 507 # "IPv6AddressPolicyTable": [], 508 # "IPv6Addresses": [ 509 # { 510 # "Address": "fe80::xxxx:xxxx:xxxx:xxxx", 511 # "AddressOrigin": "LinkLocal", 512 # "AddressState": null, 513 # "PrefixLength": xx 514 # } 515 # ], 516 # "IPv6DefaultGateway": "", 517 # "IPv6StaticAddresses": [ 518 # { "Address": "xxxx:xxxx:xxxx:xxxx::xxxx", 519 # "AddressOrigin": "Static", 520 # "AddressState": null, 521 # "PrefixLength": xxx 522 # } 523 # ], 524 # "Id": "eth0", 525 # "InterfaceEnabled": true, 526 # "LinkStatus": "LinkUp", 527 # "MACAddress": "xx:xx:xx:xx:xx:xx", 528 # "Name": "Manager Ethernet Interface", 529 # "NameServers": [], 530 # "SpeedMbps": 0, 531 # "StaticNameServers": [], 532 # "Status": { 533 # "Health": "OK", 534 # "HealthRollup": "OK", 535 # "State": "Enabled" 536 # }, 537 # "VLANs": { 538 # "@odata.id": "/redfish/v1/Managers/${MANAGER_ID}/EthernetInterfaces/eth0/VLANs" 539 540 541 ${active_channel_config}= Get Active Channel Config 542 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${active_channel_config['${CHANNEL_NUMBER}']['name']} 543 544 @{ipv6_network_configurations}= Get From Dictionary ${resp.dict} IPv6StaticAddresses 545 RETURN @{ipv6_network_configurations} 546 547 548Verify IPv6 And PrefixLength 549 [Documentation] Verify IPv6 address and prefix length on BMC. 550 [Arguments] ${ipv6_addr} ${prefix_len} 551 552 # Description of the argument(s): 553 # ipv6_addr IPv6 address to be verified. 554 # prefix_len PrefixLength value to be verified. 555 556 # Catenate IPv6 address and its prefix length. 557 ${ipv6_with_prefix}= Catenate ${ipv6_addr}/${prefix_len} 558 559 # Get IPv6 address details on BMC using IP command. 560 @{ip_data}= Get BMC IPv6 Info 561 562 # Verify if IPv6 and prefix length is configured on BMC. 563 564 Should Contain ${ip_data} ${ipv6_with_prefix} 565 ... msg=IPv6 and prefix length pair does not exist. 566 567 568Configure IPv6 Address On BMC 569 [Documentation] Add IPv6 Address on BMC. 570 [Arguments] ${ipv6_addr1} ${prefix_len} ${ipv6_addr2}=${None} 571 ... ${valid_status_codes}=[${HTTP_OK},${HTTP_NO_CONTENT}] 572 573 # Description of argument(s): 574 # ipv6_addr1 IPv6 address to be added (e.g. "2001:0022:0033::0111"). 575 # ipv6_addr2 IPv6 address to be Verified (e.g. "2001:22:33::111"). 576 # prefix_len Prefix length for the IPv6 to be added 577 # (e.g. "64"). 578 # valid_status_codes Expected return code from patch operation 579 # (e.g. "200"). 580 581 ${prefix_length}= Convert To Integer ${prefix_len} 582 ${empty_dict}= Create Dictionary 583 ${ipv6_data}= Create Dictionary Address=${ipv6_addr1} 584 ... PrefixLength=${prefix_length} 585 586 ${patch_list}= Create List 587 588 # Get existing static IPv6 configurations on BMC. 589 ${ipv6_network_configurations}= Get IPv6 Network Configuration 590 ${num_entries}= Get Length ${ipv6_network_configurations} 591 592 FOR ${INDEX} IN RANGE 0 ${num_entries} 593 Append To List ${patch_list} ${empty_dict} 594 END 595 596 # We need not check for existence of IPv6 on BMC while adding. 597 Append To List ${patch_list} ${ipv6_data} 598 ${data}= Create Dictionary IPv6StaticAddresses=${patch_list} 599 600 ${active_channel_config}= Get Active Channel Config 601 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} 602 603 Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body=&{data} 604 ... valid_status_codes=${valid_status_codes} 605 606 IF ${valid_status_codes} != [${HTTP_OK}, ${HTTP_NO_CONTENT}] 607 Fail msg=Static address not added correctly 608 END 609 610 # Note: Network restart takes around 15-18s after patch request processing. 611 Sleep ${NETWORK_TIMEOUT}s 612 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT} 613 614 #Verify ip address on CLI. 615 IF '${ipv6_addr2}' != '${None}' 616 Verify IPv6 And PrefixLength ${ipv6_addr2} ${prefix_len} 617 ELSE 618 Verify IPv6 And PrefixLength ${ipv6_addr1} ${prefix_len} 619 END 620 621 # Verify if existing static IPv6 addresses still exist. 622 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations} 623 Verify IPv6 On BMC ${ipv6_network_configuration['Address']} 624 END 625 626 #Verify redfish and CLI data matches. 627 Validate IPv6 Network Config On BMC 628 629 630Configure Multiple IPv6 Address on BMC 631 [Documentation] Add multiple IPv6 address on BMC. 632 [Arguments] ${prefix_len} 633 ... ${valid_status_codes}=[${HTTP_OK},${HTTP_NO_CONTENT}] 634 635 # Description of argument(s): 636 # prefix_len Prefix length for the IPv6 to be added 637 # (e.g. "64"). 638 # valid_status_codes Expected return code from patch operation 639 # (e.g. "200"). 640 641 ${ipv6_list}= Create List ${test_ipv6_addr} ${test_ipv6_addr1} 642 ${prefix_length}= Convert To Integer ${prefix_len} 643 ${empty_dict}= Create Dictionary 644 ${patch_list}= Create List 645 646 # Get existing static IPv6 configurations on BMC. 647 ${ipv6_network_configurations}= Get IPv6 Network Configuration 648 ${num_entries}= Get Length ${ipv6_network_configurations} 649 650 FOR ${INDEX} IN RANGE 0 ${num_entries} 651 Append To List ${patch_list} ${empty_dict} 652 END 653 654 # We need not check for existence of IPv6 on BMC while adding. 655 FOR ${ipv6_addr} IN @{ipv6_list} 656 ${ipv6_data}= Create Dictionary Address=${ipv6_addr} PrefixLength=${prefix_length} 657 Append To List ${patch_list} ${ipv6_data} 658 END 659 ${data}= Create Dictionary IPv6StaticAddresses=${patch_list} 660 661 ${active_channel_config}= Get Active Channel Config 662 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} 663 664 Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body=&{data} 665 ... valid_status_codes=${valid_status_codes} 666 667 IF ${valid_status_codes} != [${HTTP_OK}, ${HTTP_NO_CONTENT}] 668 Fail msg=Static address not added correctly 669 END 670 671 # Note: Network restart takes around 15-18s after patch request processing. 672 Sleep ${NETWORK_TIMEOUT}s 673 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT} 674 675 # Verify newly added ip address on CLI. 676 FOR ${ipv6_addr} IN @{ipv6_list} 677 Verify IPv6 And PrefixLength ${ipv6_addr} ${prefix_len} 678 END 679 680 # Verify if existing static IPv6 addresses still exist. 681 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations} 682 Verify IPv6 On BMC ${ipv6_network_configuration['Address']} 683 END 684 685 # Get the latest ipv6 network configurations. 686 @{ipv6_network_configurations}= Get IPv6 Network Configuration 687 688 # Verify newly added ip address on BMC. 689 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations} 690 Should Contain Match ${ipv6_list} ${ipv6_network_configuration['Address']} 691 END 692 693 Validate IPv6 Network Config On BMC 694 695 696Validate IPv6 Network Config On BMC 697 [Documentation] Check that IPv6 network info obtained via redfish matches info 698 ... obtained via CLI. 699 700 @{ipv6_network_configurations}= Get IPv6 Network Configuration 701 ${ipv6_data}= Get BMC IPv6 Info 702 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations} 703 Should Contain Match ${ipv6_data} ${ipv6_network_configuration['Address']}/* 704 ... msg=IPv6 address does not exist. 705 END 706 707 708Delete IPv6 Address 709 [Documentation] Delete IPv6 address of BMC. 710 [Arguments] ${ipv6_addr} 711 ... ${valid_status_codes}=[${HTTP_OK},${HTTP_ACCEPTED},${HTTP_NO_CONTENT}] 712 713 # Description of argument(s): 714 # ipv6_addr IPv6 address to be deleted (e.g. "2001:1234:1234:1234::1234"). 715 # valid_status_codes Expected return code from patch operation 716 # (e.g. "200"). See prolog of rest_request 717 # method in redfish_plus.py for details. 718 719 ${empty_dict}= Create Dictionary 720 ${patch_list}= Create List 721 722 @{ipv6_network_configurations}= Get IPv6 Network Configuration 723 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations} 724 IF '${ipv6_network_configuration['Address']}' == '${ipv6_addr}' 725 Append To List ${patch_list} ${null} 726 ELSE 727 Append To List ${patch_list} ${empty_dict} 728 END 729 END 730 731 ${ip_found}= Run Keyword And Return Status List Should Contain Value 732 ... ${patch_list} ${null} msg=${ipv6_addr} does not exist on BMC 733 Pass Execution If ${ip_found} == ${False} ${ipv6_addr} does not exist on BMC 734 735 # Run patch command only if given IP is found on BMC 736 ${data}= Create Dictionary IPv6StaticAddresses=${patch_list} 737 738 ${active_channel_config}= Get Active Channel Config 739 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} 740 741 Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body=&{data} 742 ... valid_status_codes=${valid_status_codes} 743 744 # Note: Network restart takes around 15-18s after patch request processing 745 Sleep ${NETWORK_TIMEOUT}s 746 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT} 747 748 # IPv6 address that is deleted should not be there on BMC. 749 ${delete_status}= Run Keyword And Return Status Verify IPv6 On BMC ${ipv6_addr} 750 IF '${valid_status_codes}' == '[${HTTP_OK},${HTTP_ACCEPTED},${HTTP_NO_CONTENT}]' 751 Should Be True '${delete_status}' == '${False}' 752 ELSE 753 Should Be True '${delete_status}' == '${True}' 754 END 755 756 Validate IPv6 Network Config On BMC 757 758 759Modify IPv6 Address 760 [Documentation] Modify and verify IPv6 address of BMC. 761 [Arguments] ${ipv6} ${new_ipv6} ${prefix_len} 762 ... ${valid_status_codes}=[${HTTP_OK}, ${HTTP_NO_CONTENT}] 763 764 # Description of argument(s): 765 # ipv6 IPv6 address to be replaced (e.g. "2001:AABB:CCDD::AAFF"). 766 # new_ipv6 New IPv6 address to be configured. 767 # prefix_len Prefix length value (Range 1 to 128). 768 # valid_status_codes Expected return code from patch operation 769 # (e.g. "200", "201"). 770 771 ${empty_dict}= Create Dictionary 772 ${patch_list}= Create List 773 ${prefix_length}= Convert To Integer ${prefix_len} 774 ${ipv6_data}= Create Dictionary 775 ... Address=${new_ipv6} PrefixLength=${prefix_length} 776 777 # Sample IPv6 network configurations: 778 # "IPv6AddressPolicyTable": [], 779 # "IPv6Addresses": [ 780 # { 781 # "Address": "X002:db8:0:2::XX0", 782 # "AddressOrigin": "DHCPv6", 783 # "PrefixLength": 128 784 # }, 785 # { 786 # "Address": “X002:db8:0:2:a94:XXff:fe82:XXXX", 787 # "AddressOrigin": "SLAAC", 788 # "PrefixLength": 64 789 # }, 790 # { 791 # "Address": “Y002:db8:0:2:a94:efff:fe82:5000", 792 # "AddressOrigin": "Static", 793 # "PrefixLength": 56 794 # }, 795 # { 796 # "Address": “Z002:db8:0:2:a94:efff:fe82:5000", 797 # "AddressOrigin": "Static", 798 # "PrefixLength": 56 799 # }, 800 # { 801 # "Address": “Xe80::a94:efff:YYYY:XXXX", 802 # "AddressOrigin": "LinkLocal", 803 # "PrefixLength": 64 804 # }, 805 # { 806 # "Address": “X002:db8:1:2:eff:233:fee:546", 807 # "AddressOrigin": "Static", 808 # "PrefixLength": 56 809 # } 810 # ], 811 # "IPv6DefaultGateway": “XXXX::ab2e:80fe:87df:XXXX”, 812 # "IPv6StaticAddresses": [ 813 # { 814 # "Address": “X002:db8:0:2:a94:efff:fe82:5000", 815 # "PrefixLength": 56 816 # }, 817 # { 818 # "Address": “Y002:db8:0:2:a94:efff:fe82:5000", 819 # "PrefixLength": 56 820 # }, 821 # { 822 # "Address": “Z002:db8:1:2:eff:233:fee:546", 823 # "PrefixLength": 56 824 # } 825 # ], 826 # "IPv6StaticDefaultGateways": [], 827 828 # Find the position of IPv6 address to be modified. 829 @{ipv6_network_configurations}= Get IPv6 Network Configuration 830 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations} 831 IF '${ipv6_network_configuration['Address']}' == '${ipv6}' 832 Append To List ${patch_list} ${ipv6_data} 833 ELSE 834 Append To List ${patch_list} ${empty_dict} 835 END 836 END 837 838 # Modify the IPv6 address only if given IPv6 is found 839 ${ip_found}= Run Keyword And Return Status List Should Contain Value 840 ... ${patch_list} ${ipv6_data} msg=${ipv6} does not exist on BMC 841 Pass Execution If ${ip_found} == ${False} ${ipv6} does not exist on BMC 842 843 ${data}= Create Dictionary IPv6StaticAddresses=${patch_list} 844 845 ${active_channel_config}= Get Active Channel Config 846 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} 847 848 Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 849 ... body=&{data} valid_status_codes=${valid_status_codes} 850 851 # Note: Network restart takes around 15-18s after patch request processing. 852 Sleep ${NETWORK_TIMEOUT}s 853 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT} 854 855 # Verify if new IPv6 address is configured on BMC. 856 Verify IPv6 On BMC ${new_ipv6} 857 858 # Verify if old IPv6 address is erased. 859 ${cmd_status}= Run Keyword And Return Status 860 ... Verify IPv6 On BMC ${ipv6} 861 Should Be Equal ${cmd_status} ${False} msg=Old IPv6 address is not deleted. 862 863 Validate IPv6 Network Config On BMC 864 865 866Set SLAAC Configuration State And Verify 867 [Documentation] Set SLAAC configuration state and verify. 868 [Arguments] ${slaac_state} ${valid_status_codes}=[${HTTP_OK},${HTTP_ACCEPTED},${HTTP_NO_CONTENT}] 869 ... ${channel_number}=${CHANNEL_NUMBER} 870 871 # Description of argument(s): 872 # slaac_state SLAAC state('True' or 'False'). 873 # valid_status_code Expected valid status codes. 874 # channel_number Channel number 1(eth0) or 2(eth1). 875 876 ${active_channel_config}= Get Active Channel Config 877 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} 878 879 ${data}= Set Variable If ${slaac_state} == ${False} ${DISABLE_SLAAC} ${ENABLE_SLAAC} 880 ${resp}= Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 881 ... body=${data} valid_status_codes=${valid_status_codes} 882 883 # Verify SLAAC is set correctly. 884 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 885 ${slaac_verify}= Get From Dictionary ${resp.dict} StatelessAddressAutoConfig 886 887 IF '${slaac_verify['IPv6AutoConfigEnabled']}' != '${slaac_state}' 888 Fail msg=SLAAC not set properly. 889 END 890 891Set And Verify DHCPv6 Property 892 [Documentation] Set DHCPv6 property and verify. 893 [Arguments] ${dhcpv6_operating_mode}=${Disabled} ${channel_number}=${CHANNEL_NUMBER} 894 895 # Description of argument(s): 896 # dhcpv6_operating_mode Enabled if user wants to enable DHCPv6('Enabled' or 'Disabled'). 897 # channel_number Channel number 1 or 2. 898 899 Set DHCPv6 Property ${dhcpv6_operating_mode} ${channel_number} 900 Verify DHCPv6 Property ${dhcpv6_operating_mode} ${channel_number} 901 902 903Set DHCPv6 Property 904 [Documentation] Set DHCPv6 attribute is enables or disabled. 905 [Arguments] ${dhcpv6_operating_mode}=${Disabled} ${channel_number}=${CHANNEL_NUMBER} 906 907 # Description of argument(s): 908 # dhcpv6_operating_mode Enabled if user wants to enable DHCPv6('Enabled' or 'Disabled'). 909 # channel_number Channel number 1 or 2. 910 911 ${data}= Set Variable If '${dhcpv6_operating_mode}' == 'Disabled' ${DISABLE_DHCPv6} ${ENABLE_DHCPv6} 912 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} 913 914 Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 915 ... body=${data} valid_status_codes=[${HTTP_OK},${HTTP_NO_CONTENT}] 916 917 918Verify DHCPv6 Property 919 [Documentation] Verify DHCPv6 settings is enabled or disabled. 920 [Arguments] ${dhcpv6_operating_mode} ${channel_number}=${CHANNEL_NUMBER} 921 922 # Description of Argument(s): 923 # dhcpv6_operating_mode Enable/ Disable DHCPv6. 924 # channel_number Channel number 1 or 2. 925 926 ${ethernet_interface}= Set Variable ${active_channel_config['${channel_number}']['name']} 927 928 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 929 ${dhcpv6_verify}= Get From Dictionary ${resp.dict} DHCPv6 930 931 Should Be Equal '${dhcpv6_verify['OperatingMode']}' '${dhcpv6_operating_mode}' 932 933 Sleep 30s 934 935 @{ipv6_addressorigin_list} ${ipv6_dhcpv6_addr}= 936 ... Get Address Origin List And IPv4 or IPv6 Address IPv6Addresses ${channel_number} 937 938 IF "${dhcpv6_operating_mode}" == "Enabled" 939 @{ipv6_addressorigin_list} ${ipv6_dhcpv6_addr}= 940 ... Get Address Origin List And Address For Type DHCPv6 ${channel_number} 941 Should Not Be Empty ${ipv6_dhcpv6_addr} msg=DHCPv6 must be present. 942 ELSE 943 Should Not Contain ${ipv6_addressorigin_list} DHCPv6 944 END 945 946 947 948Get IPv6 Static Default Gateway 949 [Documentation] Get IPv6 static default gateway. 950 951 ${active_channel_config}= Get Active Channel Config 952 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${active_channel_config['${CHANNEL_NUMBER}']['name']} 953 954 @{ipv6_static_defgw_configurations}= Get From Dictionary ${resp.dict} IPv6StaticDefaultGateways 955 RETURN @{ipv6_static_defgw_configurations} 956 957 958Configure IPv6 Static Default Gateway On BMC 959 [Documentation] Configure IPv6 static default gateway on BMC. 960 [Arguments] ${ipv6_gw_addr} ${prefix_length_def} 961 ... ${valid_status_codes}=${HTTP_OK} 962 963 # Description of argument(s): 964 # ipv6_gw_addr IPv6 Static Default Gateway address to be configured. 965 # prefix_len_def Prefix length value (Range 1 to 128). 966 # valid_status_codes Expected return code from patch operation 967 # (e.g. "200", "204".) 968 969 # Prefix Length is passed as None. 970 IF '${prefix_length_def}' == '${None}' 971 ${ipv6_gw}= Create Dictionary Address=${ipv6_gw_addr} 972 ELSE 973 ${ipv6_gw}= Create Dictionary Address=${ipv6_gw_addr} Prefix Length=${prefix_length_def} 974 END 975 976 ${ipv6_static_def_gw}= Get IPv6 Static Default Gateway 977 978 ${num_entries}= Get Length ${ipv6_static_def_gw} 979 980 ${patch_list}= Create List 981 ${empty_dict}= Create Dictionary 982 983 FOR ${INDEX} IN RANGE 0 ${num_entries} 984 Append To List ${patch_list} ${empty_dict} 985 END 986 987 ${valid_status_codes}= Set Variable If '${valid_status_codes}' == '${HTTP_OK}' 988 ... ${HTTP_OK},${HTTP_NO_CONTENT} 989 ... ${valid_status_codes} 990 991 Append To List ${patch_list} ${ipv6_gw} 992 ${data}= Create Dictionary IPv6StaticDefaultGateways=${patch_list} 993 994 Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 995 ... body=${data} valid_status_codes=[${valid_status_codes}] 996 997 # Verify the added static default gateway is present in Redfish Get Output. 998 ${ipv6_staticdef_gateway}= Get IPv6 Static Default Gateway 999 1000 ${ipv6_static_def_gw_list}= Create List 1001 FOR ${ipv6_staticdef_gateway} IN @{ipv6_staticdef_gateway} 1002 ${value}= Get From Dictionary ${ipv6_staticdef_gateway} Address 1003 Append To List ${ipv6_static_def_gw_list} ${value} 1004 END 1005 1006 IF '${valid_status_codes}' != '${HTTP_OK},${HTTP_NO_CONTENT}' 1007 Should Not Contain ${ipv6_static_def_gw_list} ${ipv6_gw_addr} 1008 ELSE 1009 Should Contain ${ipv6_static_def_gw_list} ${ipv6_gw_addr} 1010 END 1011 1012 1013Modify IPv6 Static Default Gateway On BMC 1014 [Documentation] Modify and verify IPv6 address of BMC. 1015 [Arguments] ${ipv6_gw_addr} ${new_static_def_gw} ${prefix_length} 1016 ... ${valid_status_codes}=[${HTTP_OK},${HTTP_ACCEPTED}] 1017 1018 # Description of argument(s): 1019 # ipv6_gw_addr IPv6 static default gateway address to be replaced (e.g. "2001:AABB:CCDD::AAFF"). 1020 # new_static_def_gw New static default gateway address to be configured. 1021 # prefix_length Prefix length value (Range 1 to 128). 1022 # valid_status_codes Expected return code from patch operation 1023 # (e.g. "200", "204"). 1024 1025 ${empty_dict}= Create Dictionary 1026 ${patch_list}= Create List 1027 # Prefix Length is passed as None. 1028 IF '${prefix_length_def}' == '${None}' 1029 ${modified_ipv6_gw_addripv6_data}= Create Dictionary Address=${new_static_def_gw} 1030 ELSE 1031 ${modified_ipv6_gw_addripv6_data}= Create Dictionary Address=${new_static_def_gw} Prefix Length=${prefix_length_def} 1032 END 1033 1034 @{ipv6_static_def_gw_list}= Get IPv6 Static Default Gateway 1035 1036 FOR ${ipv6_static_def_gw} IN @{ipv6_static_def_gw_list} 1037 IF '${ipv6_static_def_gw['Address']}' == '${ipv6_gw_addr}' 1038 Append To List ${patch_list} ${modified_ipv6_gw_addripv6_data} 1039 ELSE 1040 Append To List ${patch_list} ${empty_dict} 1041 END 1042 END 1043 1044 # Modify the IPv6 address only if given IPv6 static default gateway is found. 1045 ${ip_static_def_gw_found}= Run Keyword And Return Status List Should Contain Value 1046 ... ${patch_list} ${modified_ipv6_gw_addripv6_data} msg=${ipv6_gw_addr} does not exist on BMC 1047 Pass Execution If ${ip_static_def_gw_found} == ${False} ${ipv6_gw_addr} does not exist on BMC 1048 1049 ${data}= Create Dictionary IPv6StaticDefaultGateways=${patch_list} 1050 1051 Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 1052 ... body=&{data} valid_status_codes=${valid_status_codes} 1053 1054 ${ipv6_staticdef_gateway}= Get IPv6 Static Default Gateway 1055 1056 ${ipv6_static_def_gw_list}= Create List 1057 FOR ${ipv6_staticdef_gateway} IN @{ipv6_staticdef_gateway} 1058 ${value}= Get From Dictionary ${ipv6_staticdef_gateway} Address 1059 Append To List ${ipv6_static_def_gw_list} ${value} 1060 END 1061 1062 Should Contain ${ipv6_static_def_gw_list} ${new_static_def_gw} 1063 # Verify if old static default gateway address is erased. 1064 Should Not Contain ${ipv6_static_def_gw_list} ${ipv6_gw_addr} 1065 1066 1067Delete IPv6 Static Default Gateway 1068 [Documentation] Delete IPv6 static default gateway on BMC. 1069 [Arguments] ${ipv6_gw_addr} 1070 ... ${valid_status_codes}=[${HTTP_OK},${HTTP_ACCEPTED},${HTTP_NO_CONTENT}] 1071 1072 # Description of argument(s): 1073 # ipv6_gw_addr IPv6 Static Default Gateway address to be deleted. 1074 # valid_status_codes Expected return code from patch operation 1075 # (e.g. "200"). 1076 1077 ${patch_list}= Create List 1078 ${empty_dict}= Create Dictionary 1079 1080 ${ipv6_static_def_gw_list}= Create List 1081 @{ipv6_static_defgw_configurations}= Get IPv6 Static Default Gateway 1082 1083 FOR ${ipv6_staticdef_gateway} IN @{ipv6_static_defgw_configurations} 1084 ${value}= Get From Dictionary ${ipv6_staticdef_gateway} Address 1085 Append To List ${ipv6_static_def_gw_list} ${value} 1086 END 1087 1088 ${defgw_found}= Run Keyword And Return Status List Should Contain Value 1089 ... ${ipv6_static_def_gw_list} ${ipv6_gw_addr} msg=${ipv6_gw_addr} does not exist on BMC 1090 Skip If ${defgw_found} == ${False} ${ipv6_gw_addr} does not exist on BMC 1091 1092 FOR ${ipv6_static_def_gw} IN @{ipv6_static_defgw_configurations} 1093 IF '${ipv6_static_def_gw['Address']}' == '${ipv6_gw_addr}' 1094 Append To List ${patch_list} ${null} 1095 ELSE 1096 Append To List ${patch_list} ${empty_dict} 1097 END 1098 END 1099 1100 # Run patch command only if given IP is found on BMC. 1101 ${data}= Create Dictionary IPv6StaticDefaultGateways=${patch_list} 1102 1103 Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body=&{data} 1104 ... valid_status_codes=${valid_status_codes} 1105 1106 ${data}= Create Dictionary IPv6StaticDefaultGateways=${patch_list} 1107 1108 @{ipv6_static_defgw_configurations}= Get IPv6 Static Default Gateway 1109 Should Not Contain Match ${ipv6_static_defgw_configurations} ${ipv6_gw_addr} 1110 ... msg=IPv6 Static default gateway does not exist. 1111 1112 1113Check Coexistence Of Linklocalv6 And Static IPv6 1114 [Documentation] Verify both linklocalv6 and static IPv6 exist. 1115 1116 # Verify the address origin contains static and linklocal. 1117 @{ipv6_addressorigin_list} ${ipv6_linklocal_addr}= Get Address Origin List And Address For Type LinkLocal 1118 1119 Should Match Regexp ${ipv6_linklocal_addr} ${linklocal_addr_format} 1120 Should Contain ${ipv6_addressorigin_list} Static 1121 1122 1123Check Coexistence Of Static IPv6 And SLAAC 1124 [Documentation] Verify both static IPv6 and SLAAC coexist. 1125 1126 # Verify the address origin contains static and slaac. 1127 @{ipv6_addressorigin_list} ${ipv6_static_addr}= 1128 ... Get Address Origin List And Address For Type Static 1129 1130 @{ipv6_addressorigin_list} ${ipv6_slaac_addr}= 1131 ... Get Address Origin List And Address For Type SLAAC 1132 1133 1134Check Coexistence Of Link Local And SLAAC 1135 [Documentation] Verify both link local and SLAAC coexist. 1136 1137 # Verify the address origin contains SLAAC and link local. 1138 @{ipv6_addressorigin_list} ${ipv6_link_local_addr}= 1139 ... Get Address Origin List And Address For Type LinkLocal 1140 1141 @{ipv6_addressorigin_list} ${ipv6_slaac_addr}= 1142 ... Get Address Origin List And Address For Type SLAAC 1143 1144 Should Match Regexp ${ipv6_link_local_addr} ${linklocal_addr_format} 1145 1146 1147Check Coexistence Of Link Local And DHCPv6 1148 [Documentation] Verify both link local and dhcpv6 coexist. 1149 1150 # Verify the address origin contains dhcpv6 and link local. 1151 @{ipv6_address_origin_list} ${ipv6_link_local_addr}= 1152 ... Get Address Origin List And Address For Type LinkLocal 1153 1154 @{ipv6_address_origin_list} ${ipv6_dhcpv6_addr}= 1155 ... Get Address Origin List And Address For Type DHCPv6 1156 1157 Should Match Regexp ${ipv6_link_local_addr} ${linklocal_addr_format} 1158 1159 1160Check If Linklocal Address Is In Correct Format 1161 [Documentation] Linklocal address has network part fe80 and host part EUI64. 1162 1163 # Fetch the linklocal address. 1164 @{ipv6_addressorigin_list} ${ipv6_linklocal_addr}= Get Address Origin List And Address For Type LinkLocal 1165 1166 # Follow EUI64 from MAC. 1167 ${system_mac}= Get BMC MAC Address 1168 ${split_octets}= Split String ${system_mac} : 1169 ${first_octet}= Evaluate int('${split_octets[0]}', 16) 1170 ${flipped_hex}= Evaluate format(${first_octet} ^ 2, '02x') 1171 ${grp1}= Evaluate re.sub(r'^0+', '', '${flipped_hex}${split_octets[1]}') modules=re 1172 ${grp2}= Evaluate re.sub(r'^0+', '', '${split_octets[2]}ff') modules=re 1173 ${grp3}= Evaluate re.sub(r'^0+', '', '${split_octets[4]}${split_octets[5]}') modules=re 1174 ${linklocal}= Set Variable fe80::${grp1}:${grp2}:fe${split_octets[3]}:${grp3} 1175 1176 # Verify the linklocal obtained is the same as on the machine. 1177 Should Be Equal ${linklocal} ${ipv6_linklocal_addr} 1178 1179 1180Check BMC Gets SLAAC Address 1181 [Documentation] Check BMC gets slaac address. 1182 1183 @{ipv6_addressorigin_list} ${ipv6_slaac_addr}= Get Address Origin List And Address For Type SLAAC 1184 1185 1186Get The Initial DHCPv6 Setting On Each Interface 1187 [Documentation] Get the initial DHCPv6 setting of each interface. 1188 [Arguments] ${channel_number} 1189 1190 # Description of the argument(s): 1191 # channel_number Channel number 1 or 2. 1192 1193 ${ethernet_interface}= Set Variable ${active_channel_config['${channel_number}']['name']} 1194 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 1195 ${initial_dhcpv6_iface}= Get From Dictionary ${resp.dict} DHCPv6 1196 IF ${channel_number}==${1} 1197 Set Test Variable ${dhcpv6_channel_1} ${initial_dhcpv6_iface['OperatingMode']} 1198 ELSE 1199 Set Test Variable ${dhcpv6_channel_2} ${initial_dhcpv6_iface['OperatingMode']} 1200 END 1201 1202 1203Get The Initial DHCPv6 Settings 1204 [Documentation] Get the initial DHCPv6 settings of both the interfaces. 1205 1206 Get The Initial DHCPv6 Setting On Each Interface ${1} 1207 Get The Initial DHCPv6 Setting On Each Interface ${2} 1208 1209 1210Get The Initial SLAAC Settings 1211 [Documentation] Get the initial SLAAC settings of both the interfaces. 1212 1213 Get The Initial SLAAC Setting On Each Interface ${1} 1214 Get The Initial SLAAC Setting On Each Interface ${2} 1215 1216 1217Get The Initial SLAAC Setting On Each Interface 1218 [Documentation] Get the initial SLAAC setting of the interface. 1219 [Arguments] ${channel_number} 1220 1221 # Description of the argument(s): 1222 # channel_number Channel number 1 or 2. 1223 1224 ${ethernet_interface}= Set Variable ${active_channel_config['${channel_number}']['name']} 1225 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 1226 ${initial_slaac_iface}= Get From Dictionary ${resp.dict} StatelessAddressAutoConfig 1227 IF ${channel_number}==${1} 1228 Set Test Variable ${slaac_channel_1} ${initial_slaac_iface['IPv6AutoConfigEnabled']} 1229 ELSE 1230 Set Test Variable ${slaac_channel_2} ${initial_slaac_iface['IPv6AutoConfigEnabled']} 1231 END 1232 1233 1234Get Address Origin List And IPv4 or IPv6 Address 1235 [Documentation] Get address origin list and address for type. 1236 [Arguments] ${ip_address_type} ${channel_number}=${CHANNEL_NUMBER} 1237 1238 # Description of the argument(s): 1239 # ip_address_type Type of IPv4 or IPv6 address to be checked. 1240 # channel_number Channel number 1(eth0) or 2(eth1). 1241 1242 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${active_channel_config['${channel_number}']['name']} 1243 @{ip_addresses}= Get From Dictionary ${resp.dict} ${ip_address_type} 1244 1245 ${ip_addressorigin_list}= Create List 1246 ${ip_addr_list}= Create List 1247 FOR ${ip_address} IN @{ip_addresses} 1248 ${ip_addressorigin}= Get From Dictionary ${ip_address} AddressOrigin 1249 Append To List ${ip_addressorigin_list} ${ip_addressorigin} 1250 Append To List ${ip_addr_list} ${ip_address['Address']} 1251 END 1252 RETURN ${ip_addressorigin_list} ${ip_addr_list} 1253 1254 1255Verify All The Addresses Are Intact 1256 [Documentation] Verify all the addresses and address origins remain intact. 1257 [Arguments] ${channel_number}=${CHANNEL_NUMBER} 1258 ... ${initial_ipv4_addressorigin_list}=${initial_ipv4_addressorigin_list} 1259 ... ${initial_ipv4_addr_list}=${initial_ipv4_addr_list} 1260 1261 # Description of argument(s): 1262 # channel_number Channel number 1(eth0) or 2(eth1). 1263 # initial_ipv4_addressorigin_list Initial IPv4 address origin list. 1264 # initial_ipv4_addr_list Initial IPv4 address list. 1265 1266 # Verify that it will not impact the IPv4 configuration. 1267 Sleep ${NETWORK_TIMEOUT} 1268 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT} 1269 1270 # IPv6 Linklocal address must be present. 1271 @{ipv6_addressorigin_list} ${ipv6_linklocal_addr}= 1272 ... Get Address Origin List And Address For Type LinkLocal ${channel_number} 1273 1274 # IPv4 addresses must remain intact. 1275 ${ipv4_addressorigin_list} ${ipv4_addr_list}= 1276 ... Get Address Origin List And IPv4 or IPv6 Address IPv4Addresses ${channel_number} 1277 1278 Should be Equal ${initial_ipv4_addressorigin_list} ${ipv4_addressorigin_list} 1279 Should be Equal ${initial_ipv4_addr_list} ${ipv4_addr_list} 1280 1281 1282Get Interface ID Of IPv6 1283 [Documentation] Get interface id of IPv6 address. 1284 [Arguments] ${ipv6_address} 1285 1286 # Description of the argument(s): 1287 # ${ipv6_address} IPv6 Address to extract the last 4 hextets. 1288 1289 # Last 64 bits of SLAAC and Linklocal must be the same. 1290 # Sample IPv6 network configurations. 1291 #"IPv6AddressPolicyTable": [], 1292 # "IPv6Addresses": [ 1293 # { 1294 # "Address": "fe80::xxxx:xxxx:xxxx:xxxx", 1295 # "AddressOrigin": "LinkLocal", 1296 # "AddressState": null, 1297 # "PrefixLength": xx 1298 # } 1299 # ], 1300 # { 1301 # "Address": "2002:xxxx:xxxx:xxxx:xxxx", 1302 # "AddressOrigin": "SLAAC", 1303 # "PrefixLength": 64 1304 # } 1305 # ], 1306 1307 ${split_ip_address}= Split String ${ipv6_address} : 1308 ${missing_ip}= Evaluate 8 - len(${split_ip_address}) + 1 1309 ${expanded_ip}= Create List 1310 1311 FOR ${hextet} IN @{split_ip_address} 1312 IF '${hextet}' == '' 1313 FOR ${i} IN RANGE ${missing_ip} 1314 Append To List ${expanded_ip} 0000 1315 END 1316 ELSE 1317 Append To List ${expanded_ip} ${hextet} 1318 END 1319 END 1320 ${interface_id}= Evaluate ':'.join(${expanded_ip}[-4:]) 1321 RETURN ${interface_id} 1322 1323 1324Set And Verify SLAAC Property On Both Interfaces 1325 [Documentation] Set and verify SLAAC property on both interfaces. 1326 [Arguments] ${slaac_value_1} ${slaac_value_2} 1327 1328 # Description of the argument(s): 1329 # slaac_value_1 SLAAC value for channel 1. 1330 # slaac_value_2 SLAAC value for channel 2. 1331 1332 Set SLAAC Configuration State And Verify ${slaac_value_1} [${HTTP_OK}] ${1} 1333 Set SLAAC Configuration State And Verify ${slaac_value_2} [${HTTP_OK}] ${2} 1334 1335 Sleep 30s 1336 1337 # Check SLAAC Settings for eth0. 1338 @{ipv6_addressorigin_list} ${ipv6_slaac_addr}= 1339 ... Get Address Origin List And IPv4 or IPv6 Address IPv6Addresses ${1} 1340 IF "${slaac_value_1}" == "${True}" 1341 Should Not Be Empty ${ipv6_slaac_addr} SLAAC 1342 ELSE 1343 Should Not Contain ${ipv6_addressorigin_list} SLAAC 1344 END 1345 1346 # Check SLAAC Settings for eth1. 1347 @{ipv6_addressorigin_list} ${ipv6_slaac_addr}= 1348 ... Get Address Origin List And IPv4 or IPv6 Address IPv6Addresses ${2} 1349 IF "${slaac_value_2}" == "${True}" 1350 Should Not Be Empty ${ipv6_slaac_addr} SLAAC 1351 ELSE 1352 Should Not Contain ${ipv6_addressorigin_list} SLAAC 1353 END 1354 1355 Verify All The Addresses Are Intact ${1} 1356 Verify All The Addresses Are Intact ${2} 1357 ... ${eth1_initial_ipv4_addressorigin_list} ${eth1_initial_ipv4_addr_list} 1358 1359 1360Set And Verify DHCPv6 Property On Both Interfaces 1361 [Documentation] Set and verify DHCPv6 property on both interfaces. 1362 [Arguments] ${dhcpv6_value_1} ${dhcpv6_value_2} 1363 1364 # Description of the argument(s): 1365 # dhcpv6_value_1 DHCPv6 value for channel 1. 1366 # dhcpv6_value_2 DHCPv6 value for channel 2. 1367 1368 Set And Verify DHCPv6 Property ${dhcpv6_value_1} ${1} 1369 Set And Verify DHCPv6 Property ${dhcpv6_value_2} ${2} 1370 1371 Verify All The Addresses Are Intact ${1} 1372 Verify All The Addresses Are Intact ${2} 1373 ... ${eth1_initial_ipv4_addressorigin_list} ${eth1_initial_ipv4_addr_list} 1374 1375 1376Verify IPv6 Addresses Coexist 1377 [Documentation] Verify IPv6 address type coexist. 1378 [Arguments] ${ipv6_address_type1} ${ipv6_address_type2} 1379 1380 # Description of the argument(s): 1381 # ipv6_address_type1 IPv6 address type. 1382 # ipv6_address_type2 IPv6 address type. 1383 # Valid IPv6 address type (Static, DHCPv6, SLAAC). 1384 1385 IF '${ipv6_address_type1}' == 'Static' and '${ipv6_address_type2}' == 'DHCPv6' 1386 Configure IPv6 Address On BMC ${test_ipv6_addr} ${test_prefix_length} 1387 Set And Verify DHCPv6 Property Enabled 1388 ELSE IF '${ipv6_address_type1}' == 'DHCPv6' and '${ipv6_address_type2}' == 'SLAAC' 1389 Set And Verify DHCPv6 Property Enabled 1390 Set SLAAC Configuration State And Verify ${True} 1391 ELSE IF '${ipv6_address_type1}' == 'SLAAC' and '${ipv6_address_type2}' == 'Static' 1392 Configure IPv6 Address On BMC ${test_ipv6_addr} ${test_prefix_length} 1393 Set SLAAC Configuration State And Verify ${True} 1394 ELSE IF '${ipv6_address_type1}' == 'Static' and '${ipv6_address_type2}' == 'Static' 1395 Configure IPv6 Address On BMC ${test_ipv6_addr} ${test_prefix_length} 1396 Configure IPv6 Address On BMC ${test_ipv6_addr1} ${test_prefix_length} 1397 END 1398 1399 Sleep ${NETWORK_TIMEOUT}s 1400 1401 # Verify coexistence. 1402 Verify The Coexistence Of The Address Type ${ipv6_address_type1} ${ipv6_address_type2} 1403 1404 IF '${ipv6_address_type1}' == 'Static' or '${ipv6_address_type2}' == 'Static' 1405 Delete IPv6 Address ${test_ipv6_addr} 1406 END 1407 IF '${ipv6_address_type1}' == 'Static' and '${ipv6_address_type2}' == 'Static' 1408 Delete IPv6 Address ${test_ipv6_addr1} 1409 END 1410 1411 Set And Verify DHCPv6 Property Disabled 1412 Set SLAAC Configuration State And Verify ${False} 1413