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