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