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 coexist. 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 321Verify Coexistence Of Link Local And DHCPv6 On BMC 322 [Documentation] Verify link local And dhcpv6 both coexist. 323 [Tags] Verify_Coexistence_Of_Link_Local_And_DHCPv6_On_BMC 324 [Setup] Set DHCPv6 Property Enabled ${2} 325 326 Sleep ${NETWORK_TIMEOUT}s 327 328 Check Coexistence Of Link Local And DHCPv6 329 330 331Verify Coexistence Of Link Local And SLAAC On BMC 332 [Documentation] Verify link local And SLAAC both coexist. 333 [Tags] Verify_Coexistence_Of_Link_Local_And_SLAAC_On_BMC 334 [Setup] Set SLAAC Configuration State And Verify ${True} 335 336 Sleep ${NETWORK_TIMEOUT}s 337 338 Check Coexistence Of Link Local And SLAAC 339 340 341*** Keywords *** 342 343Suite Setup Execution 344 [Documentation] Do suite setup execution. 345 346 Redfish.Login 347 ${active_channel_config}= Get Active Channel Config 348 Set Suite Variable ${active_channel_config} 349 350 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} 351 352 Set Suite variable ${ethernet_interface} 353 354 ${initial_ipv4_addressorigin_list} ${initial_ipv4_addr_list}= Get Address Origin List And IPv4 or IPv6 Address IPv4Addresses 355 ${initial_ipv6_addressorigin_list} ${initial_ipv6_addr_list}= Get Address Origin List And IPv4 or IPv6 Address IPv6Addresses 356 357 Set Suite Variable ${initial_ipv4_addressorigin_list} 358 Set Suite Variable ${initial_ipv4_addr_list} 359 Set Suite Variable ${initial_ipv6_addressorigin_list} 360 Set Suite Variable ${initial_ipv6_addr_list} 361 362 363Test Setup Execution 364 [Documentation] Test setup execution. 365 366 @{ipv6_network_configurations}= Get IPv6 Network Configuration 367 Set Test Variable @{ipv6_network_configurations} 368 369 # Get BMC IPv6 address and prefix length. 370 ${ipv6_data}= Get BMC IPv6 Info 371 Set Test Variable ${ipv6_data} 372 373 374Test Teardown Execution 375 [Documentation] Test teardown execution. 376 377 FFDC On Test Case Fail 378 379 380Get IPv6 Network Configuration 381 [Documentation] Get Ipv6 network configuration. 382 # Sample output: 383 # { 384 # "@odata.id": "/redfish/v1/Managers/${MANAGER_ID}/EthernetInterfaces/eth0", 385 # "@odata.type": "#EthernetInterface.v1_4_1.EthernetInterface", 386 # "DHCPv4": { 387 # "DHCPEnabled": false, 388 # "UseDNSServers": false, 389 # "UseDomainName": true, 390 # "UseNTPServers": false 391 # }, 392 # "DHCPv6": { 393 # "OperatingMode": "Disabled", 394 # "UseDNSServers": false, 395 # "UseDomainName": true, 396 # "UseNTPServers": false 397 # }, 398 # "Description": "Management Network Interface", 399 # "FQDN": "localhost", 400 # "HostName": "localhost", 401 # "IPv4Addresses": [ 402 # { 403 # "Address": "xx.xx.xx.xx", 404 # "AddressOrigin": "Static", 405 # "Gateway": "xx.xx.xx.1", 406 # "SubnetMask": "xx.xx.xx.0" 407 # }, 408 # { 409 # "Address": "169.254.xx.xx", 410 # "AddressOrigin": "IPv4LinkLocal", 411 # "Gateway": "0.0.0.0", 412 # "SubnetMask": "xx.xx.0.0" 413 # }, 414 # ], 415 # "IPv4StaticAddresses": [ 416 # { 417 # "Address": "xx.xx.xx.xx", 418 # "AddressOrigin": "Static", 419 # "Gateway": "xx.xx.xx.1", 420 # "SubnetMask": "xx.xx.0.0" 421 # } 422 # } 423 # ], 424 # "IPv6AddressPolicyTable": [], 425 # "IPv6Addresses": [ 426 # { 427 # "Address": "fe80::xxxx:xxxx:xxxx:xxxx", 428 # "AddressOrigin": "LinkLocal", 429 # "AddressState": null, 430 # "PrefixLength": xx 431 # } 432 # ], 433 # "IPv6DefaultGateway": "", 434 # "IPv6StaticAddresses": [ 435 # { "Address": "xxxx:xxxx:xxxx:xxxx::xxxx", 436 # "AddressOrigin": "Static", 437 # "AddressState": null, 438 # "PrefixLength": xxx 439 # } 440 # ], 441 # "Id": "eth0", 442 # "InterfaceEnabled": true, 443 # "LinkStatus": "LinkUp", 444 # "MACAddress": "xx:xx:xx:xx:xx:xx", 445 # "Name": "Manager Ethernet Interface", 446 # "NameServers": [], 447 # "SpeedMbps": 0, 448 # "StaticNameServers": [], 449 # "Status": { 450 # "Health": "OK", 451 # "HealthRollup": "OK", 452 # "State": "Enabled" 453 # }, 454 # "VLANs": { 455 # "@odata.id": "/redfish/v1/Managers/${MANAGER_ID}/EthernetInterfaces/eth0/VLANs" 456 457 458 ${active_channel_config}= Get Active Channel Config 459 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${active_channel_config['${CHANNEL_NUMBER}']['name']} 460 461 @{ipv6_network_configurations}= Get From Dictionary ${resp.dict} IPv6StaticAddresses 462 RETURN @{ipv6_network_configurations} 463 464 465Verify IPv6 And PrefixLength 466 [Documentation] Verify IPv6 address and prefix length on BMC. 467 [Arguments] ${ipv6_addr} ${prefix_len} 468 469 # Description of the argument(s): 470 # ipv6_addr IPv6 address to be verified. 471 # prefix_len PrefixLength value to be verified. 472 473 # Catenate IPv6 address and its prefix length. 474 ${ipv6_with_prefix}= Catenate ${ipv6_addr}/${prefix_len} 475 476 # Get IPv6 address details on BMC using IP command. 477 @{ip_data}= Get BMC IPv6 Info 478 479 # Verify if IPv6 and prefix length is configured on BMC. 480 481 Should Contain ${ip_data} ${ipv6_with_prefix} 482 ... msg=IPv6 and prefix length pair does not exist. 483 484 485Configure IPv6 Address On BMC 486 [Documentation] Add IPv6 Address on BMC. 487 [Arguments] ${ipv6_addr} ${prefix_len} ${valid_status_codes}=${HTTP_OK} 488 489 # Description of argument(s): 490 # ipv6_addr IPv6 address to be added (e.g. "2001:EEEE:2222::2022"). 491 # prefix_len Prefix length for the IPv6 to be added 492 # (e.g. "64"). 493 # valid_status_codes Expected return code from patch operation 494 # (e.g. "200"). 495 496 ${prefix_length}= Convert To Integer ${prefix_len} 497 ${empty_dict}= Create Dictionary 498 ${ipv6_data}= Create Dictionary Address=${ipv6_addr} 499 ... PrefixLength=${prefix_length} 500 501 ${patch_list}= Create List 502 503 # Get existing static IPv6 configurations on BMC. 504 ${ipv6_network_configurations}= Get IPv6 Network Configuration 505 ${num_entries}= Get Length ${ipv6_network_configurations} 506 507 FOR ${INDEX} IN RANGE 0 ${num_entries} 508 Append To List ${patch_list} ${empty_dict} 509 END 510 511 ${valid_status_codes}= Set Variable If '${valid_status_codes}' == '${HTTP_OK}' 512 ... ${HTTP_OK},${HTTP_NO_CONTENT} 513 ... ${valid_status_codes} 514 515 # We need not check for existence of IPv6 on BMC while adding. 516 Append To List ${patch_list} ${ipv6_data} 517 ${data}= Create Dictionary IPv6StaticAddresses=${patch_list} 518 519 ${active_channel_config}= Get Active Channel Config 520 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} 521 522 Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body=&{data} 523 ... valid_status_codes=[${valid_status_codes}] 524 525 Return From Keyword If '${valid_status_codes}' != '${HTTP_OK},${HTTP_NO_CONTENT}' 526 527 # Note: Network restart takes around 15-18s after patch request processing. 528 Sleep ${NETWORK_TIMEOUT}s 529 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT} 530 531 Verify IPv6 And PrefixLength ${ipv6_addr} ${prefix_len} 532 533 # Verify if existing static IPv6 addresses still exist. 534 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations} 535 Verify IPv6 On BMC ${ipv6_network_configuration['Address']} 536 END 537 538 Validate IPv6 Network Config On BMC 539 540 541Configure Multiple IPv6 Address on BMC 542 [Documentation] Add multiple IPv6 address on BMC. 543 [Arguments] ${prefix_len} 544 ... ${valid_status_codes}=[${HTTP_OK},${HTTP_NO_CONTENT}] 545 546 # Description of argument(s): 547 # prefix_len Prefix length for the IPv6 to be added 548 # (e.g. "64"). 549 # valid_status_codes Expected return code from patch operation 550 # (e.g. "200"). 551 552 ${ipv6_list}= Create List ${test_ipv6_addr} ${test_ipv6_addr1} 553 ${prefix_length}= Convert To Integer ${prefix_len} 554 ${empty_dict}= Create Dictionary 555 ${patch_list}= Create List 556 557 # Get existing static IPv6 configurations on BMC. 558 ${ipv6_network_configurations}= Get IPv6 Network Configuration 559 ${num_entries}= Get Length ${ipv6_network_configurations} 560 561 FOR ${INDEX} IN RANGE 0 ${num_entries} 562 Append To List ${patch_list} ${empty_dict} 563 END 564 565 # We need not check for existence of IPv6 on BMC while adding. 566 FOR ${ipv6_addr} IN @{ipv6_list} 567 ${ipv6_data}= Create Dictionary Address=${ipv6_addr} PrefixLength=${prefix_length} 568 Append To List ${patch_list} ${ipv6_data} 569 END 570 ${data}= Create Dictionary IPv6StaticAddresses=${patch_list} 571 572 ${active_channel_config}= Get Active Channel Config 573 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} 574 575 Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body=&{data} 576 ... valid_status_codes=${valid_status_codes} 577 578 IF ${valid_status_codes} != [${HTTP_OK}, ${HTTP_NO_CONTENT}] 579 Fail msg=Static address not added correctly 580 END 581 582 # Note: Network restart takes around 15-18s after patch request processing. 583 Sleep ${NETWORK_TIMEOUT}s 584 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT} 585 586 # Verify newly added ip address on CLI. 587 FOR ${ipv6_addr} IN @{ipv6_list} 588 Verify IPv6 And PrefixLength ${ipv6_addr} ${prefix_len} 589 END 590 591 # Verify if existing static IPv6 addresses still exist. 592 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations} 593 Verify IPv6 On BMC ${ipv6_network_configuration['Address']} 594 END 595 596 # Get the latest ipv6 network configurations. 597 @{ipv6_network_configurations}= Get IPv6 Network Configuration 598 599 # Verify newly added ip address on BMC. 600 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations} 601 Should Contain Match ${ipv6_list} ${ipv6_network_configuration['Address']} 602 END 603 604 Validate IPv6 Network Config On BMC 605 606 607Validate IPv6 Network Config On BMC 608 [Documentation] Check that IPv6 network info obtained via redfish matches info 609 ... obtained via CLI. 610 611 @{ipv6_network_configurations}= Get IPv6 Network Configuration 612 ${ipv6_data}= Get BMC IPv6 Info 613 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations} 614 Should Contain Match ${ipv6_data} ${ipv6_network_configuration['Address']}/* 615 ... msg=IPv6 address does not exist. 616 END 617 618 619Delete IPv6 Address 620 [Documentation] Delete IPv6 address of BMC. 621 [Arguments] ${ipv6_addr} 622 ... ${valid_status_codes}=[${HTTP_OK},${HTTP_ACCEPTED},${HTTP_NO_CONTENT}] 623 624 # Description of argument(s): 625 # ipv6_addr IPv6 address to be deleted (e.g. "2001:1234:1234:1234::1234"). 626 # valid_status_codes Expected return code from patch operation 627 # (e.g. "200"). See prolog of rest_request 628 # method in redfish_plus.py for details. 629 630 ${empty_dict}= Create Dictionary 631 ${patch_list}= Create List 632 633 @{ipv6_network_configurations}= Get IPv6 Network Configuration 634 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations} 635 IF '${ipv6_network_configuration['Address']}' == '${ipv6_addr}' 636 Append To List ${patch_list} ${null} 637 ELSE 638 Append To List ${patch_list} ${empty_dict} 639 END 640 END 641 642 ${ip_found}= Run Keyword And Return Status List Should Contain Value 643 ... ${patch_list} ${null} msg=${ipv6_addr} does not exist on BMC 644 Pass Execution If ${ip_found} == ${False} ${ipv6_addr} does not exist on BMC 645 646 # Run patch command only if given IP is found on BMC 647 ${data}= Create Dictionary IPv6StaticAddresses=${patch_list} 648 649 ${active_channel_config}= Get Active Channel Config 650 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} 651 652 Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body=&{data} 653 ... valid_status_codes=${valid_status_codes} 654 655 # Note: Network restart takes around 15-18s after patch request processing 656 Sleep ${NETWORK_TIMEOUT}s 657 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT} 658 659 # IPv6 address that is deleted should not be there on BMC. 660 ${delete_status}= Run Keyword And Return Status Verify IPv6 On BMC ${ipv6_addr} 661 IF '${valid_status_codes}' == '[${HTTP_OK},${HTTP_ACCEPTED},${HTTP_NO_CONTENT}]' 662 Should Be True '${delete_status}' == '${False}' 663 ELSE 664 Should Be True '${delete_status}' == '${True}' 665 END 666 667 Validate IPv6 Network Config On BMC 668 669 670Modify IPv6 Address 671 [Documentation] Modify and verify IPv6 address of BMC. 672 [Arguments] ${ipv6} ${new_ipv6} ${prefix_len} 673 ... ${valid_status_codes}=[${HTTP_OK}, ${HTTP_NO_CONTENT}] 674 675 # Description of argument(s): 676 # ipv6 IPv6 address to be replaced (e.g. "2001:AABB:CCDD::AAFF"). 677 # new_ipv6 New IPv6 address to be configured. 678 # prefix_len Prefix length value (Range 1 to 128). 679 # valid_status_codes Expected return code from patch operation 680 # (e.g. "200", "201"). 681 682 ${empty_dict}= Create Dictionary 683 ${patch_list}= Create List 684 ${prefix_length}= Convert To Integer ${prefix_len} 685 ${ipv6_data}= Create Dictionary 686 ... Address=${new_ipv6} PrefixLength=${prefix_length} 687 688 # Sample IPv6 network configurations: 689 # "IPv6AddressPolicyTable": [], 690 # "IPv6Addresses": [ 691 # { 692 # "Address": "X002:db8:0:2::XX0", 693 # "AddressOrigin": "DHCPv6", 694 # "PrefixLength": 128 695 # }, 696 # { 697 # "Address": “X002:db8:0:2:a94:XXff:fe82:XXXX", 698 # "AddressOrigin": "SLAAC", 699 # "PrefixLength": 64 700 # }, 701 # { 702 # "Address": “Y002:db8:0:2:a94:efff:fe82:5000", 703 # "AddressOrigin": "Static", 704 # "PrefixLength": 56 705 # }, 706 # { 707 # "Address": “Z002:db8:0:2:a94:efff:fe82:5000", 708 # "AddressOrigin": "Static", 709 # "PrefixLength": 56 710 # }, 711 # { 712 # "Address": “Xe80::a94:efff:YYYY:XXXX", 713 # "AddressOrigin": "LinkLocal", 714 # "PrefixLength": 64 715 # }, 716 # { 717 # "Address": “X002:db8:1:2:eff:233:fee:546", 718 # "AddressOrigin": "Static", 719 # "PrefixLength": 56 720 # } 721 # ], 722 # "IPv6DefaultGateway": “XXXX::ab2e:80fe:87df:XXXX”, 723 # "IPv6StaticAddresses": [ 724 # { 725 # "Address": “X002:db8:0:2:a94:efff:fe82:5000", 726 # "PrefixLength": 56 727 # }, 728 # { 729 # "Address": “Y002:db8:0:2:a94:efff:fe82:5000", 730 # "PrefixLength": 56 731 # }, 732 # { 733 # "Address": “Z002:db8:1:2:eff:233:fee:546", 734 # "PrefixLength": 56 735 # } 736 # ], 737 # "IPv6StaticDefaultGateways": [], 738 739 # Find the position of IPv6 address to be modified. 740 @{ipv6_network_configurations}= Get IPv6 Network Configuration 741 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations} 742 IF '${ipv6_network_configuration['Address']}' == '${ipv6}' 743 Append To List ${patch_list} ${ipv6_data} 744 ELSE 745 Append To List ${patch_list} ${empty_dict} 746 END 747 END 748 749 # Modify the IPv6 address only if given IPv6 is found 750 ${ip_found}= Run Keyword And Return Status List Should Contain Value 751 ... ${patch_list} ${ipv6_data} msg=${ipv6} does not exist on BMC 752 Pass Execution If ${ip_found} == ${False} ${ipv6} does not exist on BMC 753 754 ${data}= Create Dictionary IPv6StaticAddresses=${patch_list} 755 756 ${active_channel_config}= Get Active Channel Config 757 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} 758 759 Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 760 ... body=&{data} valid_status_codes=${valid_status_codes} 761 762 # Note: Network restart takes around 15-18s after patch request processing. 763 Sleep ${NETWORK_TIMEOUT}s 764 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT} 765 766 # Verify if new IPv6 address is configured on BMC. 767 Verify IPv6 On BMC ${new_ipv6} 768 769 # Verify if old IPv6 address is erased. 770 ${cmd_status}= Run Keyword And Return Status 771 ... Verify IPv6 On BMC ${ipv6} 772 Should Be Equal ${cmd_status} ${False} msg=Old IPv6 address is not deleted. 773 774 Validate IPv6 Network Config On BMC 775 776 777Set SLAAC Configuration State And Verify 778 [Documentation] Set SLAAC configuration state and verify. 779 [Arguments] ${slaac_state} ${valid_status_codes}=[${HTTP_OK},${HTTP_ACCEPTED},${HTTP_NO_CONTENT}] 780 ... ${channel_number}=${CHANNEL_NUMBER} 781 782 # Description of argument(s): 783 # slaac_state SLAAC state('True' or 'False'). 784 # valid_status_code Expected valid status codes. 785 # channel_number Channel number 1(eth0) or 2(eth1). 786 787 ${active_channel_config}= Get Active Channel Config 788 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} 789 790 ${data}= Set Variable If ${slaac_state} == ${False} ${DISABLE_SLAAC} ${ENABLE_SLAAC} 791 ${resp}= Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 792 ... body=${data} valid_status_codes=${valid_status_codes} 793 794 # Verify SLAAC is set correctly. 795 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 796 ${slaac_verify}= Get From Dictionary ${resp.dict} StatelessAddressAutoConfig 797 798 IF '${slaac_verify['IPv6AutoConfigEnabled']}' != '${slaac_state}' 799 Fail msg=SLAAC not set properly. 800 END 801 802Set And Verify DHCPv6 Property 803 [Documentation] Set DHCPv6 property and verify. 804 [Arguments] ${dhcpv6_operating_mode}=${Disabled} ${channel_number}=${CHANNEL_NUMBER} 805 806 # Description of argument(s): 807 # dhcpv6_operating_mode Enabled if user wants to enable DHCPv6('Enabled' or 'Disabled'). 808 # channel_number Channel number 1 or 2. 809 810 Set DHCPv6 Property ${dhcpv6_operating_mode} ${channel_number} 811 Verify DHCPv6 Property ${dhcpv6_operating_mode} ${channel_number} 812 813 814Set DHCPv6 Property 815 [Documentation] Set DHCPv6 attribute is enables or disabled. 816 [Arguments] ${dhcpv6_operating_mode}=${Disabled} ${channel_number}=${CHANNEL_NUMBER} 817 818 # Description of argument(s): 819 # dhcpv6_operating_mode Enabled if user wants to enable DHCPv6('Enabled' or 'Disabled'). 820 # channel_number Channel number 1 or 2. 821 822 ${data}= Set Variable If '${dhcpv6_operating_mode}' == 'Disabled' ${DISABLE_DHCPv6} ${ENABLE_DHCPv6} 823 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} 824 825 Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 826 ... body=${data} valid_status_codes=[${HTTP_OK},${HTTP_NO_CONTENT}] 827 828 829Verify DHCPv6 Property 830 [Documentation] Verify DHCPv6 settings is enabled or disabled. 831 [Arguments] ${dhcpv6_operating_mode} ${channel_number}=${CHANNEL_NUMBER} 832 833 # Description of Argument(s): 834 # dhcpv6_operating_mode Enable/ Disable DHCPv6. 835 # channel_number Channel number 1 or 2. 836 837 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} 838 839 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 840 ${dhcpv6_verify}= Get From Dictionary ${resp.dict} DHCPv6 841 842 Should Be Equal '${dhcpv6_verify['OperatingMode']}' '${dhcpv6_operating_mode}' 843 844 845Get IPv6 Static Default Gateway 846 [Documentation] Get IPv6 static default gateway. 847 848 ${active_channel_config}= Get Active Channel Config 849 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${active_channel_config['${CHANNEL_NUMBER}']['name']} 850 851 @{ipv6_static_defgw_configurations}= Get From Dictionary ${resp.dict} IPv6StaticDefaultGateways 852 RETURN @{ipv6_static_defgw_configurations} 853 854 855Configure IPv6 Static Default Gateway On BMC 856 [Documentation] Configure IPv6 static default gateway on BMC. 857 [Arguments] ${ipv6_gw_addr} ${prefix_length_def} 858 ... ${valid_status_codes}=${HTTP_OK} 859 860 # Description of argument(s): 861 # ipv6_gw_addr IPv6 Static Default Gateway address to be configured. 862 # prefix_len_def Prefix length value (Range 1 to 128). 863 # valid_status_codes Expected return code from patch operation 864 # (e.g. "200", "204".) 865 866 # Prefix Length is passed as None. 867 IF '${prefix_length_def}' == '${None}' 868 ${ipv6_gw}= Create Dictionary Address=${ipv6_gw_addr} 869 ELSE 870 ${ipv6_gw}= Create Dictionary Address=${ipv6_gw_addr} Prefix Length=${prefix_length_def} 871 END 872 873 ${ipv6_static_def_gw}= Get IPv6 Static Default Gateway 874 875 ${num_entries}= Get Length ${ipv6_static_def_gw} 876 877 ${patch_list}= Create List 878 ${empty_dict}= Create Dictionary 879 880 FOR ${INDEX} IN RANGE 0 ${num_entries} 881 Append To List ${patch_list} ${empty_dict} 882 END 883 884 ${valid_status_codes}= Set Variable If '${valid_status_codes}' == '${HTTP_OK}' 885 ... ${HTTP_OK},${HTTP_NO_CONTENT} 886 ... ${valid_status_codes} 887 888 Append To List ${patch_list} ${ipv6_gw} 889 ${data}= Create Dictionary IPv6StaticDefaultGateways=${patch_list} 890 891 Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 892 ... body=${data} valid_status_codes=[${valid_status_codes}] 893 894 # Verify the added static default gateway is present in Redfish Get Output. 895 ${ipv6_staticdef_gateway}= Get IPv6 Static Default Gateway 896 897 ${ipv6_static_def_gw_list}= Create List 898 FOR ${ipv6_staticdef_gateway} IN @{ipv6_staticdef_gateway} 899 ${value}= Get From Dictionary ${ipv6_staticdef_gateway} Address 900 Append To List ${ipv6_static_def_gw_list} ${value} 901 END 902 903 IF '${valid_status_codes}' != '${HTTP_OK},${HTTP_NO_CONTENT}' 904 Should Not Contain ${ipv6_static_def_gw_list} ${ipv6_gw_addr} 905 ELSE 906 Should Contain ${ipv6_static_def_gw_list} ${ipv6_gw_addr} 907 END 908 909 910Modify IPv6 Static Default Gateway On BMC 911 [Documentation] Modify and verify IPv6 address of BMC. 912 [Arguments] ${ipv6_gw_addr} ${new_static_def_gw} ${prefix_length} 913 ... ${valid_status_codes}=[${HTTP_OK},${HTTP_ACCEPTED}] 914 915 # Description of argument(s): 916 # ipv6_gw_addr IPv6 static default gateway address to be replaced (e.g. "2001:AABB:CCDD::AAFF"). 917 # new_static_def_gw New static default gateway address to be configured. 918 # prefix_length Prefix length value (Range 1 to 128). 919 # valid_status_codes Expected return code from patch operation 920 # (e.g. "200", "204"). 921 922 ${empty_dict}= Create Dictionary 923 ${patch_list}= Create List 924 # Prefix Length is passed as None. 925 IF '${prefix_length_def}' == '${None}' 926 ${modified_ipv6_gw_addripv6_data}= Create Dictionary Address=${new_static_def_gw} 927 ELSE 928 ${modified_ipv6_gw_addripv6_data}= Create Dictionary Address=${new_static_def_gw} Prefix Length=${prefix_length_def} 929 END 930 931 @{ipv6_static_def_gw_list}= Get IPv6 Static Default Gateway 932 933 FOR ${ipv6_static_def_gw} IN @{ipv6_static_def_gw_list} 934 IF '${ipv6_static_def_gw['Address']}' == '${ipv6_gw_addr}' 935 Append To List ${patch_list} ${modified_ipv6_gw_addripv6_data} 936 ELSE 937 Append To List ${patch_list} ${empty_dict} 938 END 939 END 940 941 # Modify the IPv6 address only if given IPv6 static default gateway is found. 942 ${ip_static_def_gw_found}= Run Keyword And Return Status List Should Contain Value 943 ... ${patch_list} ${modified_ipv6_gw_addripv6_data} msg=${ipv6_gw_addr} does not exist on BMC 944 Pass Execution If ${ip_static_def_gw_found} == ${False} ${ipv6_gw_addr} does not exist on BMC 945 946 ${data}= Create Dictionary IPv6StaticDefaultGateways=${patch_list} 947 948 Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 949 ... body=&{data} valid_status_codes=${valid_status_codes} 950 951 ${ipv6_staticdef_gateway}= Get IPv6 Static Default Gateway 952 953 ${ipv6_static_def_gw_list}= Create List 954 FOR ${ipv6_staticdef_gateway} IN @{ipv6_staticdef_gateway} 955 ${value}= Get From Dictionary ${ipv6_staticdef_gateway} Address 956 Append To List ${ipv6_static_def_gw_list} ${value} 957 END 958 959 Should Contain ${ipv6_static_def_gw_list} ${new_static_def_gw} 960 # Verify if old static default gateway address is erased. 961 Should Not Contain ${ipv6_static_def_gw_list} ${ipv6_gw_addr} 962 963 964Delete IPv6 Static Default Gateway 965 [Documentation] Delete IPv6 static default gateway on BMC. 966 [Arguments] ${ipv6_gw_addr} 967 ... ${valid_status_codes}=[${HTTP_OK},${HTTP_ACCEPTED},${HTTP_NO_CONTENT}] 968 969 # Description of argument(s): 970 # ipv6_gw_addr IPv6 Static Default Gateway address to be deleted. 971 # valid_status_codes Expected return code from patch operation 972 # (e.g. "200"). 973 974 ${patch_list}= Create List 975 ${empty_dict}= Create Dictionary 976 977 ${ipv6_static_def_gw_list}= Create List 978 @{ipv6_static_defgw_configurations}= Get IPv6 Static Default Gateway 979 980 FOR ${ipv6_staticdef_gateway} IN @{ipv6_static_defgw_configurations} 981 ${value}= Get From Dictionary ${ipv6_staticdef_gateway} Address 982 Append To List ${ipv6_static_def_gw_list} ${value} 983 END 984 985 ${defgw_found}= Run Keyword And Return Status List Should Contain Value 986 ... ${ipv6_static_def_gw_list} ${ipv6_gw_addr} msg=${ipv6_gw_addr} does not exist on BMC 987 Skip If ${defgw_found} == ${False} ${ipv6_gw_addr} does not exist on BMC 988 989 FOR ${ipv6_static_def_gw} IN @{ipv6_static_defgw_configurations} 990 IF '${ipv6_static_def_gw['Address']}' == '${ipv6_gw_addr}' 991 Append To List ${patch_list} ${null} 992 ELSE 993 Append To List ${patch_list} ${empty_dict} 994 END 995 END 996 997 # Run patch command only if given IP is found on BMC. 998 ${data}= Create Dictionary IPv6StaticDefaultGateways=${patch_list} 999 1000 Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body=&{data} 1001 ... valid_status_codes=${valid_status_codes} 1002 1003 ${data}= Create Dictionary IPv6StaticDefaultGateways=${patch_list} 1004 1005 @{ipv6_static_defgw_configurations}= Get IPv6 Static Default Gateway 1006 Should Not Contain Match ${ipv6_static_defgw_configurations} ${ipv6_gw_addr} 1007 ... msg=IPv6 Static default gateway does not exist. 1008 1009 1010Check Coexistence Of Linklocalv6 And Static IPv6 1011 [Documentation] Verify both linklocalv6 and static IPv6 exist. 1012 1013 # Verify the address origin contains static and linklocal. 1014 @{ipv6_addressorigin_list} ${ipv6_linklocal_addr}= Get Address Origin List And Address For Type LinkLocal 1015 1016 Should Match Regexp ${ipv6_linklocal_addr} ${linklocal_addr_format} 1017 Should Contain ${ipv6_addressorigin_list} Static 1018 1019 1020Check Coexistence Of Static IPv6 And SLAAC 1021 [Documentation] Verify both static IPv6 and SLAAC coexist. 1022 1023 # Verify the address origin contains static and slaac. 1024 @{ipv6_addressorigin_list} ${ipv6_static_addr}= 1025 ... Get Address Origin List And Address For Type Static 1026 1027 @{ipv6_addressorigin_list} ${ipv6_slaac_addr}= 1028 ... Get Address Origin List And Address For Type SLAAC 1029 1030 1031Check Coexistence Of Link Local And SLAAC 1032 [Documentation] Verify both link local and SLAAC coexist. 1033 1034 # Verify the address origin contains SLAAC and link local. 1035 @{ipv6_addressorigin_list} ${ipv6_link_local_addr}= 1036 ... Get Address Origin List And Address For Type LinkLocal 1037 1038 @{ipv6_addressorigin_list} ${ipv6_slaac_addr}= 1039 ... Get Address Origin List And Address For Type SLAAC 1040 1041 Should Match Regexp ${ipv6_link_local_addr} ${linklocal_addr_format} 1042 1043 1044Check Coexistence Of Link Local And DHCPv6 1045 [Documentation] Verify both link local and dhcpv6 coexist. 1046 1047 # Verify the address origin contains dhcpv6 and link local. 1048 @{ipv6_address_origin_list} ${ipv6_link_local_addr}= 1049 ... Get Address Origin List And Address For Type LinkLocal 1050 1051 @{ipv6_address_origin_list} ${ipv6_dhcpv6_addr}= 1052 ... Get Address Origin List And Address For Type DHCPv6 1053 1054 Should Match Regexp ${ipv6_link_local_addr} ${linklocal_addr_format} 1055 1056 1057Check If Linklocal Address Is In Correct Format 1058 [Documentation] Linklocal address has network part fe80 and host part EUI64. 1059 1060 # Fetch the linklocal address. 1061 @{ipv6_addressorigin_list} ${ipv6_linklocal_addr}= Get Address Origin List And Address For Type LinkLocal 1062 1063 # Follow EUI64 from MAC. 1064 ${system_mac}= Get BMC MAC Address 1065 ${split_octets}= Split String ${system_mac} : 1066 ${first_octet}= Evaluate int('${split_octets[0]}', 16) 1067 ${flipped_hex}= Evaluate format(${first_octet} ^ 2, '02x') 1068 ${grp1}= Evaluate re.sub(r'^0+', '', '${flipped_hex}${split_octets[1]}') modules=re 1069 ${grp2}= Evaluate re.sub(r'^0+', '', '${split_octets[2]}ff') modules=re 1070 ${grp3}= Evaluate re.sub(r'^0+', '', '${split_octets[4]}${split_octets[5]}') modules=re 1071 ${linklocal}= Set Variable fe80::${grp1}:${grp2}:fe${split_octets[3]}:${grp3} 1072 1073 # Verify the linklocal obtained is the same as on the machine. 1074 Should Be Equal ${linklocal} ${ipv6_linklocal_addr} 1075 1076 1077Check BMC Gets SLAAC Address 1078 [Documentation] Check BMC gets slaac address. 1079 1080 @{ipv6_addressorigin_list} ${ipv6_slaac_addr}= Get Address Origin List And Address For Type SLAAC 1081 1082 1083Get The Initial DHCPv6 Setting On Each Interface 1084 [Documentation] Get the initial DHCPv6 setting of each interface. 1085 [Arguments] ${channel_number} 1086 1087 # Description of the argument(s): 1088 # channel_number Channel number 1 or 2. 1089 1090 ${ethernet_interface}= Set Variable ${active_channel_config['${channel_number}']['name']} 1091 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 1092 ${initial_dhcpv6_iface}= Get From Dictionary ${resp.dict} DHCPv6 1093 IF ${channel_number}==${1} 1094 Set Test Variable ${dhcpv6_channel_1} ${initial_dhcpv6_iface['OperatingMode']} 1095 ELSE 1096 Set Test Variable ${dhcpv6_channel_2} ${initial_dhcpv6_iface['OperatingMode']} 1097 END 1098 1099 1100Get The Initial DHCPv6 Settings 1101 [Documentation] Get the initial DHCPv6 settings of both the interfaces. 1102 1103 Get The Initial DHCPv6 Setting On Each Interface ${1} 1104 Get The Initial DHCPv6 Setting On Each Interface ${2} 1105 1106 1107Get The Initial SLAAC Settings 1108 [Documentation] Get the initial SLAAC settings of both the interfaces. 1109 1110 Get The Initial SLAAC Setting On Each Interface ${1} 1111 Get The Initial SLAAC Setting On Each Interface ${2} 1112 1113 1114Get The Initial SLAAC Setting On Each Interface 1115 [Documentation] Get the initial SLAAC setting of the interface. 1116 [Arguments] ${channel_number} 1117 1118 # Description of the argument(s): 1119 # channel_number Channel number 1 or 2. 1120 1121 ${ethernet_interface}= Set Variable ${active_channel_config['${channel_number}']['name']} 1122 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 1123 ${initial_slaac_iface}= Get From Dictionary ${resp.dict} StatelessAddressAutoConfig 1124 IF ${channel_number}==${1} 1125 Set Test Variable ${slaac_channel_1} ${initial_slaac_iface['IPv6AutoConfigEnabled']} 1126 ELSE 1127 Set Test Variable ${slaac_channel_2} ${initial_slaac_iface['IPv6AutoConfigEnabled']} 1128 END 1129 1130 1131Get Address Origin List And IPv4 or IPv6 Address 1132 [Documentation] Get address origin list and address for type. 1133 [Arguments] ${ip_address_type} 1134 1135 # Description of the argument(s): 1136 # ip_address_type Type of IPv4 or IPv6 address to be checked. 1137 1138 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${active_channel_config['${CHANNEL_NUMBER}']['name']} 1139 @{ip_addresses}= Get From Dictionary ${resp.dict} ${ip_address_type} 1140 1141 ${ip_addressorigin_list}= Create List 1142 ${ip_addr_list}= Create List 1143 FOR ${ip_address} IN @{ip_addresses} 1144 ${ip_addressorigin}= Get From Dictionary ${ip_address} AddressOrigin 1145 Append To List ${ip_addressorigin_list} ${ip_addressorigin} 1146 Append To List ${ip_addr_list} ${ip_address['Address']} 1147 END 1148 RETURN ${ip_addressorigin_list} ${ip_addr_list} 1149 1150 1151Verify All The Addresses Are Intact 1152 [Documentation] Verify all the addresses and address origins remain intact. 1153 1154 # Verify that it will not impact the IPv4 configuration. 1155 Sleep ${NETWORK_TIMEOUT} 1156 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT} 1157 1158 # IPv6 address must be present. 1159 @{ipv6_addressorigin_list} ${ipv6_slaac_addr}= Get Address Origin List And Address For Type SLAAC 1160 @{ipv6_addressorigin_list} ${ipv6_linklocal_addr}= Get Address Origin List And Address For Type LinkLocal 1161 1162 # IPv4 and IPv6 addresses must remain intact. 1163 ${ipv4_addressorigin_list} ${ipv4_addr_list}= Get Address Origin List And IPv4 or IPv6 Address IPv4Addresses 1164 ${ipv6_addressorigin_list} ${ipv6_addr_list}= Get Address Origin List And IPv4 or IPv6 Address IPv6Addresses 1165 1166 ${ipv6_is_subset}= Evaluate set(${initial_ipv6_addr_list}).issubset(set(${ipv6_addr_list})) 1167 Should Be True ${ipv6_is_subset} 1168 1169 Should be Equal ${initial_ipv4_addressorigin_list} ${ipv4_addressorigin_list} 1170 Should be Equal ${initial_ipv4_addr_list} ${ipv4_addr_list} 1171 1172 1173Get Interface ID Of IPv6 1174 [Documentation] Get interface id of IPv6 address. 1175 [Arguments] ${ipv6_address} 1176 1177 # Description of the argument(s): 1178 # ${ipv6_address} IPv6 Address to extract the last 4 hextets. 1179 1180 # Last 64 bits of SLAAC and Linklocal must be the same. 1181 # Sample IPv6 network configurations. 1182 #"IPv6AddressPolicyTable": [], 1183 # "IPv6Addresses": [ 1184 # { 1185 # "Address": "fe80::xxxx:xxxx:xxxx:xxxx", 1186 # "AddressOrigin": "LinkLocal", 1187 # "AddressState": null, 1188 # "PrefixLength": xx 1189 # } 1190 # ], 1191 # { 1192 # "Address": "2002:xxxx:xxxx:xxxx:xxxx", 1193 # "AddressOrigin": "SLAAC", 1194 # "PrefixLength": 64 1195 # } 1196 # ], 1197 1198 ${split_ip_address}= Split String ${ipv6_address} : 1199 ${missing_ip}= Evaluate 8 - len(${split_ip_address}) + 1 1200 ${expanded_ip}= Create List 1201 1202 FOR ${hextet} IN @{split_ip_address} 1203 IF '${hextet}' == '' 1204 FOR ${i} IN RANGE ${missing_ip} 1205 Append To List ${expanded_ip} 0000 1206 END 1207 ELSE 1208 Append To List ${expanded_ip} ${hextet} 1209 END 1210 END 1211 ${interface_id}= Evaluate ':'.join(${expanded_ip}[-4:]) 1212 RETURN ${interface_id} 1213