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 9Library ../../lib/bmc_network_utils.py 10Library Collections 11Library Process 12 13Test Setup Test Setup Execution 14Test Teardown Test Teardown Execution 15Suite Setup Suite Setup Execution 16Suite Teardown Redfish.Logout 17 18Test Tags BMC_IPv6 19 20*** Variables *** 21${test_ipv6_addr} 2001:db8:3333:4444:5555:6666:7777:8888 22${test_ipv6_invalid_addr} 2001:db8:3333:4444:5555:6666:7777:JJKK 23${test_ipv6_addr1} 2001:db8:3333:4444:5555:6666:7777:9999 24 25# Valid prefix length is a integer ranges from 1 to 128. 26${test_prefix_length} 64 27${ipv6_gw_addr} 2002:903:15F:32:9:3:32:1 28${prefix_length_def} None 29${invalid_staticv6_gateway} 9.41.164.1 30${linklocal_addr_format} fe80::[0-9a-f:]+$ 31 32*** Test Cases *** 33 34Get IPv6 Address And Verify 35 [Documentation] Get IPv6 Address And Verify. 36 [Tags] Get_IPv6_Address_And_Verify 37 38 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations} 39 Verify IPv6 On BMC ${ipv6_network_configuration['Address']} 40 END 41 42 43Get PrefixLength And Verify 44 [Documentation] Get IPv6 prefix length and verify. 45 [Tags] Get_PrefixLength_And_Verify 46 47 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations} 48 Verify IPv6 On BMC ${ipv6_network_configuration['PrefixLength']} 49 END 50 51 52Get IPv6 Default Gateway And Verify 53 [Documentation] Get IPv6 default gateway and verify. 54 [Tags] Get_IPv6_Default_Gateway_And_Verify 55 56 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 57 ${ipv6_gateway}= Get From Dictionary ${resp.dict} IPv6DefaultGateway 58 Verify IPv6 Default Gateway On BMC ${ipv6_gateway} 59 60 61Verify All Configured IPv6 And PrefixLength On BMC 62 [Documentation] Verify IPv6 address and its prefix length on BMC. 63 [Tags] Verify_All_Configured_IPv6_And_PrefixLength_On_BMC 64 65 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations} 66 Verify IPv6 And PrefixLength ${ipv6_network_configuration['Address']} 67 ... ${ipv6_network_configuration['PrefixLength']} 68 END 69 70 71Configure IPv6 Address And Verify 72 [Documentation] Configure IPv6 address and verify. 73 [Tags] Configure_IPv6_Address_And_Verify 74 [Teardown] Run Keywords 75 ... Delete IPv6 Address ${test_ipv6_addr} AND Test Teardown Execution 76 [Template] Configure IPv6 Address On BMC 77 78 79 # IPv6 address Prefix length 80 ${test_ipv6_addr} ${test_prefix_length} 81 82 83Delete IPv6 Address And Verify 84 [Documentation] Delete IPv6 address and verify. 85 [Tags] Delete_IPv6_Address_And_Verify 86 87 Configure IPv6 Address On BMC ${test_ipv6_addr} ${test_prefix_length} 88 89 Delete IPv6 Address ${test_ipv6_addr} 90 91 92Modify IPv6 Address And Verify 93 [Documentation] Modify IPv6 address and verify. 94 [Tags] Modify_IPv6_Address_And_Verify 95 [Teardown] Run Keywords 96 ... Delete IPv6 Address ${test_ipv6_addr1} AND Test Teardown Execution 97 98 Configure IPv6 Address On BMC ${test_ipv6_addr} ${test_prefix_length} 99 100 Modify IPv6 Address ${test_ipv6_addr} ${test_ipv6_addr1} ${test_prefix_length} 101 102 103Verify Persistency Of IPv6 After BMC Reboot 104 [Documentation] Verify persistency of IPv6 after BMC reboot. 105 [Tags] Verify_Persistency_Of_IPv6_After_BMC_Reboot 106 [Teardown] Run Keywords 107 ... Delete IPv6 Address ${test_ipv6_addr} AND Test Teardown Execution 108 109 Configure IPv6 Address On BMC ${test_ipv6_addr} ${test_prefix_length} 110 111 Redfish OBMC Reboot (off) stack_mode=skip 112 113 # Verifying persistency of IPv6. 114 Verify IPv6 On BMC ${test_ipv6_addr} 115 116 117Enable SLAACv6 On BMC And Verify 118 [Documentation] Enable SLAACv6 on BMC and verify. 119 [Tags] Enable_SLAACv6_On_BMC_And_Verify 120 121 Set SLAACv6 Configuration State And Verify ${True} 122 123 124Enable DHCPv6 Property On BMC And Verify 125 [Documentation] Enable DHCPv6 property on BMC and verify. 126 [Tags] Enable_DHCPv6_Property_On_BMC_And_Verify 127 128 Set And Verify DHCPv6 Property Enabled 129 130 131Disable DHCPv6 Property On BMC And Verify 132 [Documentation] Disable DHCPv6 property on BMC and verify. 133 [Tags] Disable_DHCPv6_Property_On_BMC_And_Verify 134 135 Set And Verify DHCPv6 Property Disabled 136 137 138Verify Persistency Of DHCPv6 On Reboot 139 [Documentation] Verify persistency of DHCPv6 property on reboot. 140 [Tags] Verify_Persistency_Of_DHCPv6_On_Reboot 141 142 Set And Verify DHCPv6 Property Enabled 143 Redfish OBMC Reboot (off) stack_mode=skip 144 Verify DHCPv6 Property Enabled 145 146 147Configure Invalid Static IPv6 And Verify 148 [Documentation] Configure invalid static IPv6 and verify. 149 [Tags] Configure_Invalid_Static_IPv6_And_Verify 150 [Template] Configure IPv6 Address On BMC 151 152 #invalid_ipv6 prefix length valid_status_code 153 ${ipv4_hexword_addr} ${test_prefix_length} ${HTTP_BAD_REQUEST} 154 155 156Configure IPv6 Static Default Gateway And Verify 157 [Documentation] Configure IPv6 static default gateway and verify. 158 [Tags] Configure_IPv6_Static_Default_Gateway_And_Verify 159 [Template] Configure IPv6 Static Default Gateway On BMC 160 161 # static_def_gw prefix length valid_status_code 162 ${ipv6_gw_addr} ${prefix_length_def} ${HTTP_OK} 163 ${invalid_staticv6_gateway} ${test_prefix_length} ${HTTP_BAD_REQUEST} 164 165 166Modify Static Default Gateway And Verify 167 [Documentation] Modify static default gateway and verify. 168 [Tags] Modify_Static_Default_Gateway_And_Verify 169 [Setup] Configure IPv6 Static Default Gateway On BMC ${ipv6_gw_addr} ${prefix_length_def} 170 171 Modify IPv6 Static Default Gateway On BMC ${test_ipv6_addr1} ${prefix_length_def} ${HTTP_OK} ${ipv6_gw_addr} 172 173 174Delete IPv6 Static Default Gateway And Verify 175 [Documentation] Delete IPv6 static default gateway and verify. 176 [Tags] Delete_IPv6_Static_Default_Gateway_And_Verify 177 [Setup] Configure IPv6 Static Default Gateway On BMC ${ipv6_gw_addr} ${prefix_length_def} 178 179 Delete IPv6 Static Default Gateway ${ipv6_gw_addr} 180 181 182Verify Coexistence Of Linklocalv6 And Static IPv6 On BMC 183 [Documentation] Verify linklocalv6 And static IPv6 both exist. 184 [Tags] Verify_Coexistence_Of_Linklocalv6_And_Static_IPv6_On_BMC 185 [Setup] Configure IPv6 Address On BMC ${test_ipv6_addr} ${test_prefix_length} 186 [Teardown] Delete IPv6 Address ${test_ipv6_addr} 187 188 Check Coexistence Of Linklocalv6 And Static IPv6 189 190 191Verify IPv6 Linklocal Address Is In Corrrect Format 192 [Documentation] Verify linklocal address has network part as fe80 and host part as EUI64. 193 [Tags] Verify_IPv6_Linklocal_Address_Is_In_Correct_Format 194 195 Check If Linklocal Address Is In Correct Format 196 197 198Verify BMC Gets SLAAC Address On Enabling SLAAC 199 [Documentation] On enabling SLAAC verify SLAAC address comes up. 200 [Tags] Verify_BMC_Gets_SLAAC_Address_On_Enabling_SLAAC 201 [Setup] Set SLAACv6 Configuration State And Verify ${False} 202 203 Set SLAACv6 Configuration State And Verify ${True} 204 Sleep ${NETWORK_TIMEOUT} 205 Check BMC Gets SLAACv6 Address 206 207 208Enable And Verify DHCPv6 Property On Eth1 When DHCPv6 Property Enabled On Eth0 209 [Documentation] Verify DHCPv6 on eth1 when DHCPv6 property is enabled on eth0. 210 [Tags] Enable_And_Verify_DHCPv6_Property_On_Eth1_When_DHCPv6_Property_Enabled_On_Eth0 211 [Setup] Run Keywords Get The Initial DHCPv6 Setting ${1} dhcpv6_channel_1 212 ... AND Get The Initial DHCPv6 Setting ${2} dhcpv6_channel_2 213 [Teardown] Run Keywords Set And Verify DHCPv6 Property ${dhcpv6_channel_1} ${1} 214 ... AND Set And Verify DHCPv6 Property ${dhcpv6_channel_2} ${2} 215 216 Set And Verify DHCPv6 Property Enabled ${1} 217 Set And Verify DHCPv6 Property Enabled ${2} 218 219 220*** Keywords *** 221 222Suite Setup Execution 223 [Documentation] Do suite setup execution. 224 225 Redfish.Login 226 ${active_channel_config}= Get Active Channel Config 227 Set Suite Variable ${active_channel_config} 228 229 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} 230 231 Set Suite variable ${ethernet_interface} 232 233 234Test Setup Execution 235 [Documentation] Test setup execution. 236 237 @{ipv6_network_configurations}= Get IPv6 Network Configuration 238 Set Test Variable @{ipv6_network_configurations} 239 240 # Get BMC IPv6 address and prefix length. 241 ${ipv6_data}= Get BMC IPv6 Info 242 Set Test Variable ${ipv6_data} 243 244 245Test Teardown Execution 246 [Documentation] Test teardown execution. 247 248 FFDC On Test Case Fail 249 250 251Get IPv6 Network Configuration 252 [Documentation] Get Ipv6 network configuration. 253 # Sample output: 254 # { 255 # "@odata.id": "/redfish/v1/Managers/${MANAGER_ID}/EthernetInterfaces/eth0", 256 # "@odata.type": "#EthernetInterface.v1_4_1.EthernetInterface", 257 # "DHCPv4": { 258 # "DHCPEnabled": false, 259 # "UseDNSServers": false, 260 # "UseDomainName": true, 261 # "UseNTPServers": false 262 # }, 263 # "DHCPv6": { 264 # "OperatingMode": "Disabled", 265 # "UseDNSServers": false, 266 # "UseDomainName": true, 267 # "UseNTPServers": false 268 # }, 269 # "Description": "Management Network Interface", 270 # "FQDN": "localhost", 271 # "HostName": "localhost", 272 # "IPv4Addresses": [ 273 # { 274 # "Address": "xx.xx.xx.xx", 275 # "AddressOrigin": "Static", 276 # "Gateway": "xx.xx.xx.1", 277 # "SubnetMask": "xx.xx.xx.0" 278 # }, 279 # { 280 # "Address": "169.254.xx.xx", 281 # "AddressOrigin": "IPv4LinkLocal", 282 # "Gateway": "0.0.0.0", 283 # "SubnetMask": "xx.xx.0.0" 284 # }, 285 # ], 286 # "IPv4StaticAddresses": [ 287 # { 288 # "Address": "xx.xx.xx.xx", 289 # "AddressOrigin": "Static", 290 # "Gateway": "xx.xx.xx.1", 291 # "SubnetMask": "xx.xx.0.0" 292 # } 293 # } 294 # ], 295 # "IPv6AddressPolicyTable": [], 296 # "IPv6Addresses": [ 297 # { 298 # "Address": "fe80::xxxx:xxxx:xxxx:xxxx", 299 # "AddressOrigin": "LinkLocal", 300 # "AddressState": null, 301 # "PrefixLength": xx 302 # } 303 # ], 304 # "IPv6DefaultGateway": "", 305 # "IPv6StaticAddresses": [ 306 # { "Address": "xxxx:xxxx:xxxx:xxxx::xxxx", 307 # "AddressOrigin": "Static", 308 # "AddressState": null, 309 # "PrefixLength": xxx 310 # } 311 # ], 312 # "Id": "eth0", 313 # "InterfaceEnabled": true, 314 # "LinkStatus": "LinkUp", 315 # "MACAddress": "xx:xx:xx:xx:xx:xx", 316 # "Name": "Manager Ethernet Interface", 317 # "NameServers": [], 318 # "SpeedMbps": 0, 319 # "StaticNameServers": [], 320 # "Status": { 321 # "Health": "OK", 322 # "HealthRollup": "OK", 323 # "State": "Enabled" 324 # }, 325 # "VLANs": { 326 # "@odata.id": "/redfish/v1/Managers/${MANAGER_ID}/EthernetInterfaces/eth0/VLANs" 327 328 329 ${active_channel_config}= Get Active Channel Config 330 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${active_channel_config['${CHANNEL_NUMBER}']['name']} 331 332 @{ipv6_network_configurations}= Get From Dictionary ${resp.dict} IPv6StaticAddresses 333 RETURN @{ipv6_network_configurations} 334 335 336Verify IPv6 And PrefixLength 337 [Documentation] Verify IPv6 address and prefix length on BMC. 338 [Arguments] ${ipv6_addr} ${prefix_len} 339 340 # Description of the argument(s): 341 # ipv6_addr IPv6 address to be verified. 342 # prefix_len PrefixLength value to be verified. 343 344 # Catenate IPv6 address and its prefix length. 345 ${ipv6_with_prefix}= Catenate ${ipv6_addr}/${prefix_len} 346 347 # Get IPv6 address details on BMC using IP command. 348 @{ip_data}= Get BMC IPv6 Info 349 350 # Verify if IPv6 and prefix length is configured on BMC. 351 352 Should Contain ${ip_data} ${ipv6_with_prefix} 353 ... msg=IPv6 and prefix length pair does not exist. 354 355 356Configure IPv6 Address On BMC 357 [Documentation] Add IPv6 Address on BMC. 358 [Arguments] ${ipv6_addr} ${prefix_len} ${valid_status_codes}=${HTTP_OK} 359 360 # Description of argument(s): 361 # ipv6_addr IPv6 address to be added (e.g. "2001:EEEE:2222::2022"). 362 # prefix_len Prefix length for the IPv6 to be added 363 # (e.g. "64"). 364 # valid_status_codes Expected return code from patch operation 365 # (e.g. "200"). 366 367 ${prefix_length}= Convert To Integer ${prefix_len} 368 ${empty_dict}= Create Dictionary 369 ${ipv6_data}= Create Dictionary Address=${ipv6_addr} 370 ... PrefixLength=${prefix_length} 371 372 ${patch_list}= Create List 373 374 # Get existing static IPv6 configurations on BMC. 375 ${ipv6_network_configurations}= Get IPv6 Network Configuration 376 ${num_entries}= Get Length ${ipv6_network_configurations} 377 378 FOR ${INDEX} IN RANGE 0 ${num_entries} 379 Append To List ${patch_list} ${empty_dict} 380 END 381 382 ${valid_status_codes}= Set Variable If '${valid_status_codes}' == '${HTTP_OK}' 383 ... ${HTTP_OK},${HTTP_NO_CONTENT} 384 ... ${valid_status_codes} 385 386 # We need not check for existence of IPv6 on BMC while adding. 387 Append To List ${patch_list} ${ipv6_data} 388 ${data}= Create Dictionary IPv6StaticAddresses=${patch_list} 389 390 ${active_channel_config}= Get Active Channel Config 391 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} 392 393 Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body=&{data} 394 ... valid_status_codes=[${valid_status_codes}] 395 396 Return From Keyword If '${valid_status_codes}' != '${HTTP_OK},${HTTP_NO_CONTENT}' 397 398 # Note: Network restart takes around 15-18s after patch request processing. 399 Sleep ${NETWORK_TIMEOUT}s 400 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT} 401 402 Verify IPv6 And PrefixLength ${ipv6_addr} ${prefix_len} 403 404 # Verify if existing static IPv6 addresses still exist. 405 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations} 406 Verify IPv6 On BMC ${ipv6_network_configuration['Address']} 407 END 408 409 Validate IPv6 Network Config On BMC 410 411 412Validate IPv6 Network Config On BMC 413 [Documentation] Check that IPv6 network info obtained via redfish matches info 414 ... obtained via CLI. 415 @{ipv6_network_configurations}= Get IPv6 Network Configuration 416 ${ipv6_data}= Get BMC IPv6 Info 417 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations} 418 Should Contain Match ${ipv6_data} ${ipv6_network_configuration['Address']}/* 419 ... msg=IPv6 address does not exist. 420 END 421 422 423Delete IPv6 Address 424 [Documentation] Delete IPv6 address of BMC. 425 [Arguments] ${ipv6_addr} 426 ... ${valid_status_codes}=[${HTTP_OK},${HTTP_ACCEPTED},${HTTP_NO_CONTENT}] 427 428 # Description of argument(s): 429 # ipv6_addr IPv6 address to be deleted (e.g. "2001:1234:1234:1234::1234"). 430 # valid_status_codes Expected return code from patch operation 431 # (e.g. "200"). See prolog of rest_request 432 # method in redfish_plus.py for details. 433 434 ${empty_dict}= Create Dictionary 435 ${patch_list}= Create List 436 437 @{ipv6_network_configurations}= Get IPv6 Network Configuration 438 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations} 439 IF '${ipv6_network_configuration['Address']}' == '${ipv6_addr}' 440 Append To List ${patch_list} ${null} 441 ELSE 442 Append To List ${patch_list} ${empty_dict} 443 END 444 END 445 446 ${ip_found}= Run Keyword And Return Status List Should Contain Value 447 ... ${patch_list} ${null} msg=${ipv6_addr} does not exist on BMC 448 Pass Execution If ${ip_found} == ${False} ${ipv6_addr} does not exist on BMC 449 450 # Run patch command only if given IP is found on BMC 451 ${data}= Create Dictionary IPv6StaticAddresses=${patch_list} 452 453 ${active_channel_config}= Get Active Channel Config 454 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} 455 456 Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body=&{data} 457 ... valid_status_codes=${valid_status_codes} 458 459 # Note: Network restart takes around 15-18s after patch request processing 460 Sleep ${NETWORK_TIMEOUT}s 461 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT} 462 463 # IPv6 address that is deleted should not be there on BMC. 464 ${delete_status}= Run Keyword And Return Status Verify IPv6 On BMC ${ipv6_addr} 465 IF '${valid_status_codes}' == '[${HTTP_OK},${HTTP_ACCEPTED},${HTTP_NO_CONTENT}]' 466 Should Be True '${delete_status}' == '${False}' 467 ELSE 468 Should Be True '${delete_status}' == '${True}' 469 END 470 471 Validate IPv6 Network Config On BMC 472 473 474Modify IPv6 Address 475 [Documentation] Modify and verify IPv6 address of BMC. 476 [Arguments] ${ipv6} ${new_ipv6} ${prefix_len} 477 ... ${valid_status_codes}=[${HTTP_OK}, ${HTTP_NO_CONTENT}] 478 479 # Description of argument(s): 480 # ipv6 IPv6 address to be replaced (e.g. "2001:AABB:CCDD::AAFF"). 481 # new_ipv6 New IPv6 address to be configured. 482 # prefix_len Prefix length value (Range 1 to 128). 483 # valid_status_codes Expected return code from patch operation 484 # (e.g. "200", "201"). 485 486 ${empty_dict}= Create Dictionary 487 ${patch_list}= Create List 488 ${prefix_length}= Convert To Integer ${prefix_len} 489 ${ipv6_data}= Create Dictionary 490 ... Address=${new_ipv6} PrefixLength=${prefix_length} 491 492 # Sample IPv6 network configurations: 493 # "IPv6AddressPolicyTable": [], 494 # "IPv6Addresses": [ 495 # { 496 # "Address": "X002:db8:0:2::XX0", 497 # "AddressOrigin": "DHCPv6", 498 # "PrefixLength": 128 499 # }, 500 # { 501 # "Address": “X002:db8:0:2:a94:XXff:fe82:XXXX", 502 # "AddressOrigin": "SLAAC", 503 # "PrefixLength": 64 504 # }, 505 # { 506 # "Address": “Y002:db8:0:2:a94:efff:fe82:5000", 507 # "AddressOrigin": "Static", 508 # "PrefixLength": 56 509 # }, 510 # { 511 # "Address": “Z002:db8:0:2:a94:efff:fe82:5000", 512 # "AddressOrigin": "Static", 513 # "PrefixLength": 56 514 # }, 515 # { 516 # "Address": “Xe80::a94:efff:YYYY:XXXX", 517 # "AddressOrigin": "LinkLocal", 518 # "PrefixLength": 64 519 # }, 520 # { 521 # "Address": “X002:db8:1:2:eff:233:fee:546", 522 # "AddressOrigin": "Static", 523 # "PrefixLength": 56 524 # } 525 # ], 526 # "IPv6DefaultGateway": “XXXX::ab2e:80fe:87df:XXXX”, 527 # "IPv6StaticAddresses": [ 528 # { 529 # "Address": “X002:db8:0:2:a94:efff:fe82:5000", 530 # "PrefixLength": 56 531 # }, 532 # { 533 # "Address": “Y002:db8:0:2:a94:efff:fe82:5000", 534 # "PrefixLength": 56 535 # }, 536 # { 537 # "Address": “Z002:db8:1:2:eff:233:fee:546", 538 # "PrefixLength": 56 539 # } 540 # ], 541 # "IPv6StaticDefaultGateways": [], 542 543 # Find the position of IPv6 address to be modified. 544 @{ipv6_network_configurations}= Get IPv6 Network Configuration 545 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations} 546 IF '${ipv6_network_configuration['Address']}' == '${ipv6}' 547 Append To List ${patch_list} ${ipv6_data} 548 ELSE 549 Append To List ${patch_list} ${empty_dict} 550 END 551 END 552 553 # Modify the IPv6 address only if given IPv6 is found 554 ${ip_found}= Run Keyword And Return Status List Should Contain Value 555 ... ${patch_list} ${ipv6_data} msg=${ipv6} does not exist on BMC 556 Pass Execution If ${ip_found} == ${False} ${ipv6} does not exist on BMC 557 558 ${data}= Create Dictionary IPv6StaticAddresses=${patch_list} 559 560 ${active_channel_config}= Get Active Channel Config 561 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} 562 563 Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 564 ... body=&{data} valid_status_codes=${valid_status_codes} 565 566 # Note: Network restart takes around 15-18s after patch request processing. 567 Sleep ${NETWORK_TIMEOUT}s 568 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT} 569 570 # Verify if new IPv6 address is configured on BMC. 571 Verify IPv6 On BMC ${new_ipv6} 572 573 # Verify if old IPv6 address is erased. 574 ${cmd_status}= Run Keyword And Return Status 575 ... Verify IPv6 On BMC ${ipv6} 576 Should Be Equal ${cmd_status} ${False} msg=Old IPv6 address is not deleted. 577 578 Validate IPv6 Network Config On BMC 579 580 581Set SLAACv6 Configuration State And Verify 582 [Documentation] Set SLAACv6 configuration state and verify. 583 [Arguments] ${slaac_state} ${valid_status_codes}=[${HTTP_OK},${HTTP_ACCEPTED},${HTTP_NO_CONTENT}] 584 585 # Description of argument(s): 586 # slaac_state SLAACv6 state('True' or 'False'). 587 # valid_status_code Expected valid status codes. 588 589 ${active_channel_config}= Get Active Channel Config 590 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} 591 592 ${data}= Set Variable If ${slaac_state} == ${False} ${DISABLE_SLAAC} ${ENABLE_SLAAC} 593 ${resp}= Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 594 ... body=${data} valid_status_codes=${valid_status_codes} 595 596 # Verify SLAACv6 is set correctly. 597 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 598 ${slaac_verify}= Get From Dictionary ${resp.dict} StatelessAddressAutoConfig 599 600 IF '${slaac_verify['IPv6AutoConfigEnabled']}' != '${slaac_state}' 601 Fail msg=SLAACv6 not set properly. 602 END 603 604Set And Verify DHCPv6 Property 605 [Documentation] Set DHCPv6 property and verify. 606 [Arguments] ${dhcpv6_operating_mode}=${Disabled} ${channel_number}=${CHANNEL_NUMBER} 607 608 # Description of argument(s): 609 # dhcpv6_operating_mode Enabled if user wants to enable DHCPv6('Enabled' or 'Disabled'). 610 # channel_number Channel number 1 or 2. 611 612 Set DHCPv6 Property ${dhcpv6_operating_mode} ${channel_number} 613 Verify DHCPv6 Property ${dhcpv6_operating_mode} ${channel_number} 614 615 616Set DHCPv6 Property 617 [Documentation] Set DHCPv6 attribute is enables or disabled. 618 [Arguments] ${dhcpv6_operating_mode}=${Disabled} ${channel_number}=${CHANNEL_NUMBER} 619 620 # Description of argument(s): 621 # dhcpv6_operating_mode Enabled if user wants to enable DHCPv6('Enabled' or 'Disabled'). 622 # channel_number Channel number 1 or 2. 623 624 ${data}= Set Variable If '${dhcpv6_operating_mode}' == 'Disabled' ${DISABLE_DHCPv6} ${ENABLE_DHCPv6} 625 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} 626 627 Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 628 ... body=${data} valid_status_codes=[${HTTP_OK},${HTTP_NO_CONTENT}] 629 630 631Verify DHCPv6 Property 632 [Documentation] Verify DHCPv6 settings is enabled or disabled. 633 [Arguments] ${dhcpv6_operating_mode} ${channel_number}=${CHANNEL_NUMBER} 634 635 # Description of Argument(s): 636 # dhcpv6_operating_mode Enable/ Disable DHCPv6. 637 # channel_number Channel number 1 or 2. 638 639 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} 640 641 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 642 ${dhcpv6_verify}= Get From Dictionary ${resp.dict} DHCPv6 643 644 Should Be Equal '${dhcpv6_verify['OperatingMode']}' '${dhcpv6_operating_mode}' 645 646 647Get IPv6 Static Default Gateway 648 [Documentation] Get IPv6 static default gateway. 649 650 ${active_channel_config}= Get Active Channel Config 651 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${active_channel_config['${CHANNEL_NUMBER}']['name']} 652 653 @{ipv6_static_defgw_configurations}= Get From Dictionary ${resp.dict} IPv6StaticDefaultGateways 654 RETURN @{ipv6_static_defgw_configurations} 655 656 657Configure IPv6 Static Default Gateway On BMC 658 [Documentation] Configure IPv6 static default gateway on BMC. 659 [Arguments] ${ipv6_gw_addr} ${prefix_length_def} 660 ... ${valid_status_codes}=${HTTP_OK} 661 # Description of argument(s): 662 # ipv6_gw_addr IPv6 Static Default Gateway address to be configured. 663 # prefix_len_def Prefix length value (Range 1 to 128). 664 # valid_status_codes Expected return code from patch operation 665 # (e.g. "200", "204".) 666 667 # Prefix Length is passed as None. 668 IF '${prefix_length_def}' == '${None}' 669 ${ipv6_gw}= Create Dictionary Address=${ipv6_gw_addr} 670 ELSE 671 ${ipv6_gw}= Create Dictionary Address=${ipv6_gw_addr} Prefix Length=${prefix_length_def} 672 END 673 674 ${ipv6_static_def_gw}= Get IPv6 Static Default Gateway 675 676 ${num_entries}= Get Length ${ipv6_static_def_gw} 677 678 ${patch_list}= Create List 679 ${empty_dict}= Create Dictionary 680 681 FOR ${INDEX} IN RANGE 0 ${num_entries} 682 Append To List ${patch_list} ${empty_dict} 683 END 684 685 ${valid_status_codes}= Set Variable If '${valid_status_codes}' == '${HTTP_OK}' 686 ... ${HTTP_OK},${HTTP_NO_CONTENT} 687 ... ${valid_status_codes} 688 689 Append To List ${patch_list} ${ipv6_gw} 690 ${data}= Create Dictionary IPv6StaticDefaultGateways=${patch_list} 691 692 Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 693 ... body=${data} valid_status_codes=[${valid_status_codes}] 694 695 # Verify the added static default gateway is present in Redfish Get Output. 696 ${ipv6_staticdef_gateway}= Get IPv6 Static Default Gateway 697 698 ${ipv6_static_def_gw_list}= Create List 699 FOR ${ipv6_staticdef_gateway} IN @{ipv6_staticdef_gateway} 700 ${value}= Get From Dictionary ${ipv6_staticdef_gateway} Address 701 Append To List ${ipv6_static_def_gw_list} ${value} 702 END 703 704 IF '${valid_status_codes}' != '${HTTP_OK},${HTTP_NO_CONTENT}' 705 Should Not Contain ${ipv6_static_def_gw_list} ${ipv6_gw_addr} 706 ELSE 707 Should Contain ${ipv6_static_def_gw_list} ${ipv6_gw_addr} 708 END 709 710 711Modify IPv6 Static Default Gateway On BMC 712 [Documentation] Modify and verify IPv6 address of BMC. 713 [Arguments] ${ipv6_gw_addr} ${new_static_def_gw} ${prefix_length} 714 ... ${valid_status_codes}=[${HTTP_OK},${HTTP_ACCEPTED}] 715 716 # Description of argument(s): 717 # ipv6_gw_addr IPv6 static default gateway address to be replaced (e.g. "2001:AABB:CCDD::AAFF"). 718 # new_static_def_gw New static default gateway address to be configured. 719 # prefix length Prefix length value (Range 1 to 128). 720 # valid_status_codes Expected return code from patch operation 721 # (e.g. "200", "204"). 722 723 ${empty_dict}= Create Dictionary 724 ${patch_list}= Create List 725 # Prefix Length is passed as None. 726 IF '${prefix_length_def}' == '${None}' 727 ${modified_ipv6_gw_addripv6_data}= Create Dictionary Address=${new_static_def_gw} 728 ELSE 729 ${modified_ipv6_gw_addripv6_data}= Create Dictionary Address=${new_static_def_gw} Prefix Length=${prefix_length_def} 730 END 731 732 @{ipv6_static_def_gw_list}= Get IPv6 Static Default Gateway 733 734 FOR ${ipv6_static_def_gw} IN @{ipv6_static_def_gw_list} 735 IF '${ipv6_static_def_gw['Address']}' == '${ipv6_gw_addr}' 736 Append To List ${patch_list} ${modified_ipv6_gw_addripv6_data} 737 ELSE 738 Append To List ${patch_list} ${empty_dict} 739 END 740 END 741 742 # Modify the IPv6 address only if given IPv6 static default gateway is found. 743 ${ip_static_def_gw_found}= Run Keyword And Return Status List Should Contain Value 744 ... ${patch_list} ${modified_ipv6_gw_addripv6_data} msg=${ipv6_gw_addr} does not exist on BMC 745 Pass Execution If ${ip_static_def_gw_found} == ${False} ${ipv6_gw_addr} does not exist on BMC 746 747 ${data}= Create Dictionary IPv6StaticDefaultGateways=${patch_list} 748 749 Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 750 ... body=&{data} valid_status_codes=${valid_status_codes} 751 752 ${ipv6_staticdef_gateway}= Get IPv6 Static Default Gateway 753 754 ${ipv6_static_def_gw_list}= Create List 755 FOR ${ipv6_staticdef_gateway} IN @{ipv6_staticdef_gateway} 756 ${value}= Get From Dictionary ${ipv6_staticdef_gateway} Address 757 Append To List ${ipv6_static_def_gw_list} ${value} 758 END 759 760 Should Contain ${ipv6_static_def_gw_list} ${new_static_def_gw} 761 # Verify if old static default gateway address is erased. 762 Should Not Contain ${ipv6_static_def_gw_list} ${ipv6_gw_addr} 763 764 765Delete IPv6 Static Default Gateway 766 [Documentation] Delete IPv6 static default gateway on BMC. 767 [Arguments] ${ipv6_gw_addr} 768 ... ${valid_status_codes}=[${HTTP_OK},${HTTP_ACCEPTED},${HTTP_NO_CONTENT}] 769 770 # Description of argument(s): 771 # ipv6_gw_addr IPv6 Static Default Gateway address to be deleted. 772 # valid_status_codes Expected return code from patch operation 773 # (e.g. "200"). 774 775 ${patch_list}= Create List 776 ${empty_dict}= Create Dictionary 777 778 ${ipv6_static_def_gw_list}= Create List 779 @{ipv6_static_defgw_configurations}= Get IPv6 Static Default Gateway 780 781 FOR ${ipv6_staticdef_gateway} IN @{ipv6_static_defgw_configurations} 782 ${value}= Get From Dictionary ${ipv6_staticdef_gateway} Address 783 Append To List ${ipv6_static_def_gw_list} ${value} 784 END 785 786 ${defgw_found}= Run Keyword And Return Status List Should Contain Value 787 ... ${ipv6_static_def_gw_list} ${ipv6_gw_addr} msg=${ipv6_gw_addr} does not exist on BMC 788 Skip If ${defgw_found} == ${False} ${ipv6_gw_addr} does not exist on BMC 789 790 FOR ${ipv6_static_def_gw} IN @{ipv6_static_defgw_configurations} 791 IF '${ipv6_static_def_gw['Address']}' == '${ipv6_gw_addr}' 792 Append To List ${patch_list} ${null} 793 ELSE 794 Append To List ${patch_list} ${empty_dict} 795 END 796 END 797 798 # Run patch command only if given IP is found on BMC. 799 ${data}= Create Dictionary IPv6StaticDefaultGateways=${patch_list} 800 801 Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body=&{data} 802 ... valid_status_codes=${valid_status_codes} 803 804 ${data}= Create Dictionary IPv6StaticDefaultGateways=${patch_list} 805 806 @{ipv6_static_defgw_configurations}= Get IPv6 Static Default Gateway 807 Should Not Contain Match ${ipv6_static_defgw_configurations} ${ipv6_gw_addr} 808 ... msg=IPv6 Static default gateway does not exist. 809 810 811Check Coexistence Of Linklocalv6 And Static IPv6 812 [Documentation] Verify both linklocalv6 and static IPv6 exist. 813 814 # Verify the address origin contains static and linklocal. 815 @{ipv6_addressorigin_list} ${ipv6_linklocal_addr}= Get Address Origin List And Address For Type LinkLocal 816 817 Should Not Be Empty ${ipv6_linklocal_addr} msg=LinkLocal address is not present. 818 Should Match Regexp ${ipv6_linklocal_addr} ${linklocal_addr_format} 819 Should Contain ${ipv6_addressorigin_list} LinkLocal 820 Should Contain ${ipv6_addressorigin_list} Static 821 822 823Check If Linklocal Address Is In Correct Format 824 [Documentation] Linklocal address has network part fe80 and host part EUI64. 825 826 # Fetch the linklocal address. 827 @{ipv6_addressorigin_list} ${ipv6_linklocal_addr}= Get Address Origin List And Address For Type LinkLocal 828 Should Contain ${ipv6_addressorigin_list} LinkLocal 829 Should Not Be Empty ${ipv6_linklocal_addr} msg=LinkLocal address is not present. 830 831 # Follow EUI64 from MAC. 832 ${system_mac}= Get BMC MAC Address 833 ${split_octets}= Split String ${system_mac} : 834 ${first_octet}= Evaluate int('${split_octets[0]}', 16) 835 ${flipped_hex}= Evaluate format(${first_octet} ^ 2, '02x') 836 ${grp1}= Evaluate re.sub(r'^0+', '', '${flipped_hex}${split_octets[1]}') modules=re 837 ${grp2}= Evaluate re.sub(r'^0+', '', '${split_octets[2]}ff') modules=re 838 ${grp3}= Evaluate re.sub(r'^0+', '', '${split_octets[4]}${split_octets[5]}') modules=re 839 ${linklocal}= Set Variable fe80::${grp1}:${grp2}:fe${split_octets[3]}:${grp3} 840 841 # Verify the linklocal obtained is the same as on the machine. 842 Should Be Equal ${linklocal} ${ipv6_linklocal_addr} 843 844 845Check BMC Gets SLAACv6 Address 846 [Documentation] Check BMC gets slaacv6 address. 847 848 @{ipv6_addressorigin_list} ${ipv6_slaac_addr}= Get Address Origin List And Address For Type SLAAC 849 850 Should Contain ${ipv6_addressorigin_list} SLAAC 851 Should Not Be Empty ${ipv6_slaac_addr} msg=SLAACv6 address is not present. 852 853 854Get The Initial DHCPv6 Setting 855 [Documentation] Get the initial DHCPv6 setting and store in a variable. 856 [Arguments] ${channel_number} ${initial_dhcpv6_before} 857 858 # Description of the argument(s): 859 # channel_number Channel number 1 or 2. 860 # initial_dhcpv6_before Variable to store initial DHCPv6 setting. 861 862 ${ethernet_interface}= Set Variable ${active_channel_config['${channel_number}']['name']} 863 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 864 ${initial_dhcpv6_iface}= Get From Dictionary ${resp.dict} DHCPv6 865 Set Test Variable ${${initial_dhcpv6_before}} ${initial_dhcpv6_iface['OperatingMode']} 866 867 868Get Address Origin List And Address For Type 869 [Documentation] Get address origin list and address for type. 870 [Arguments] ${ipv6_address_type} 871 872 # Description of the argument(s): 873 # ipv6_address_type Type of IPv6 address to be checked. 874 875 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${active_channel_config['${CHANNEL_NUMBER}']['name']} 876 @{ipv6_addresses}= Get From Dictionary ${resp.dict} IPv6Addresses 877 878 ${ipv6_addressorigin_list}= Create List 879 ${ipv6_slaac_addr}= Set Variable ${None} 880 FOR ${ipv6_address} IN @{ipv6_addresses} 881 ${ipv6_addressorigin}= Get From Dictionary ${ipv6_address} AddressOrigin 882 Append To List ${ipv6_addressorigin_list} ${ipv6_addressorigin} 883 IF '${ipv6_addressorigin}' == '${ipv6_address_type}' 884 Set Test Variable ${ipv6_type_addr} ${ipv6_address['Address']} 885 END 886 END 887 RETURN @{ipv6_addressorigin_list} ${ipv6_type_addr} 888