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