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