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