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 SLAAC On BMC And Verify 118 [Documentation] Enable SLAAC on BMC and verify. 119 [Tags] Enable_SLAAC_On_BMC_And_Verify 120 121 Set SLAAC 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 SLAAC Configuration State And Verify ${False} 202 203 Set SLAAC Configuration State And Verify ${True} 204 Sleep ${NETWORK_TIMEOUT} 205 Check BMC Gets SLAAC 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] Get The Initial DHCPv6 Settings 212 [Teardown] Run Keywords Set And Verify DHCPv6 Property ${dhcpv6_channel_1} ${1} 213 ... AND Set And Verify DHCPv6 Property ${dhcpv6_channel_2} ${2} 214 215 Set And Verify DHCPv6 Property Enabled ${1} 216 Set And Verify DHCPv6 Property Enabled ${2} 217 218 219Enable And Verify SLAAC Property On Eth1 When SLAAC Property Enabled On Eth0 220 [Documentation] Enable and verify SLAAC property on Eth1 when SLAAC property enabled on Eth0. 221 [Tags] Enable_And_Verify_SLAAC_Property_On_Eth1_When_SLAAC_Property_Enabled_On_Eth0 222 [Setup] Get The Initial SLAAC Settings 223 [Teardown] Run Keywords Set SLAAC Configuration State And Verify ${slaac_channel_1} [${HTTP_OK}] ${1} 224 ... AND Set SLAAC Configuration State And Verify ${slaac_channel_2} [${HTTP_OK}] ${2} 225 226 Set SLAAC Configuration State And Verify ${True} [${HTTP_OK}] ${1} 227 Set SLAAC Configuration State And Verify ${True} [${HTTP_OK}] ${2} 228 229 # Check all the addresses and address origins remain intact. 230 Verify All The Addresses Are Intact 231 232 233*** Keywords *** 234 235Suite Setup Execution 236 [Documentation] Do suite setup execution. 237 238 Redfish.Login 239 ${active_channel_config}= Get Active Channel Config 240 Set Suite Variable ${active_channel_config} 241 242 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} 243 244 Set Suite variable ${ethernet_interface} 245 246 ${initial_ipv4_addressorigin_list} ${initial_ipv4_addr_list}= Get Address Origin List And IPv4 or IPv6 Address IPv4Addresses 247 ${initial_ipv6_addressorigin_list} ${initial_ipv6_addr_list}= Get Address Origin List And IPv4 or IPv6 Address IPv6Addresses 248 249 Set Suite Variable ${initial_ipv4_addressorigin_list} 250 Set Suite Variable ${initial_ipv4_addr_list} 251 Set Suite Variable ${initial_ipv6_addressorigin_list} 252 Set Suite Variable ${initial_ipv6_addr_list} 253 254 255Test Setup Execution 256 [Documentation] Test setup execution. 257 258 @{ipv6_network_configurations}= Get IPv6 Network Configuration 259 Set Test Variable @{ipv6_network_configurations} 260 261 # Get BMC IPv6 address and prefix length. 262 ${ipv6_data}= Get BMC IPv6 Info 263 Set Test Variable ${ipv6_data} 264 265 266Test Teardown Execution 267 [Documentation] Test teardown execution. 268 269 FFDC On Test Case Fail 270 271 272Get IPv6 Network Configuration 273 [Documentation] Get Ipv6 network configuration. 274 # Sample output: 275 # { 276 # "@odata.id": "/redfish/v1/Managers/${MANAGER_ID}/EthernetInterfaces/eth0", 277 # "@odata.type": "#EthernetInterface.v1_4_1.EthernetInterface", 278 # "DHCPv4": { 279 # "DHCPEnabled": false, 280 # "UseDNSServers": false, 281 # "UseDomainName": true, 282 # "UseNTPServers": false 283 # }, 284 # "DHCPv6": { 285 # "OperatingMode": "Disabled", 286 # "UseDNSServers": false, 287 # "UseDomainName": true, 288 # "UseNTPServers": false 289 # }, 290 # "Description": "Management Network Interface", 291 # "FQDN": "localhost", 292 # "HostName": "localhost", 293 # "IPv4Addresses": [ 294 # { 295 # "Address": "xx.xx.xx.xx", 296 # "AddressOrigin": "Static", 297 # "Gateway": "xx.xx.xx.1", 298 # "SubnetMask": "xx.xx.xx.0" 299 # }, 300 # { 301 # "Address": "169.254.xx.xx", 302 # "AddressOrigin": "IPv4LinkLocal", 303 # "Gateway": "0.0.0.0", 304 # "SubnetMask": "xx.xx.0.0" 305 # }, 306 # ], 307 # "IPv4StaticAddresses": [ 308 # { 309 # "Address": "xx.xx.xx.xx", 310 # "AddressOrigin": "Static", 311 # "Gateway": "xx.xx.xx.1", 312 # "SubnetMask": "xx.xx.0.0" 313 # } 314 # } 315 # ], 316 # "IPv6AddressPolicyTable": [], 317 # "IPv6Addresses": [ 318 # { 319 # "Address": "fe80::xxxx:xxxx:xxxx:xxxx", 320 # "AddressOrigin": "LinkLocal", 321 # "AddressState": null, 322 # "PrefixLength": xx 323 # } 324 # ], 325 # "IPv6DefaultGateway": "", 326 # "IPv6StaticAddresses": [ 327 # { "Address": "xxxx:xxxx:xxxx:xxxx::xxxx", 328 # "AddressOrigin": "Static", 329 # "AddressState": null, 330 # "PrefixLength": xxx 331 # } 332 # ], 333 # "Id": "eth0", 334 # "InterfaceEnabled": true, 335 # "LinkStatus": "LinkUp", 336 # "MACAddress": "xx:xx:xx:xx:xx:xx", 337 # "Name": "Manager Ethernet Interface", 338 # "NameServers": [], 339 # "SpeedMbps": 0, 340 # "StaticNameServers": [], 341 # "Status": { 342 # "Health": "OK", 343 # "HealthRollup": "OK", 344 # "State": "Enabled" 345 # }, 346 # "VLANs": { 347 # "@odata.id": "/redfish/v1/Managers/${MANAGER_ID}/EthernetInterfaces/eth0/VLANs" 348 349 350 ${active_channel_config}= Get Active Channel Config 351 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${active_channel_config['${CHANNEL_NUMBER}']['name']} 352 353 @{ipv6_network_configurations}= Get From Dictionary ${resp.dict} IPv6StaticAddresses 354 RETURN @{ipv6_network_configurations} 355 356 357Verify IPv6 And PrefixLength 358 [Documentation] Verify IPv6 address and prefix length on BMC. 359 [Arguments] ${ipv6_addr} ${prefix_len} 360 361 # Description of the argument(s): 362 # ipv6_addr IPv6 address to be verified. 363 # prefix_len PrefixLength value to be verified. 364 365 # Catenate IPv6 address and its prefix length. 366 ${ipv6_with_prefix}= Catenate ${ipv6_addr}/${prefix_len} 367 368 # Get IPv6 address details on BMC using IP command. 369 @{ip_data}= Get BMC IPv6 Info 370 371 # Verify if IPv6 and prefix length is configured on BMC. 372 373 Should Contain ${ip_data} ${ipv6_with_prefix} 374 ... msg=IPv6 and prefix length pair does not exist. 375 376 377Configure IPv6 Address On BMC 378 [Documentation] Add IPv6 Address on BMC. 379 [Arguments] ${ipv6_addr} ${prefix_len} ${valid_status_codes}=${HTTP_OK} 380 381 # Description of argument(s): 382 # ipv6_addr IPv6 address to be added (e.g. "2001:EEEE:2222::2022"). 383 # prefix_len Prefix length for the IPv6 to be added 384 # (e.g. "64"). 385 # valid_status_codes Expected return code from patch operation 386 # (e.g. "200"). 387 388 ${prefix_length}= Convert To Integer ${prefix_len} 389 ${empty_dict}= Create Dictionary 390 ${ipv6_data}= Create Dictionary Address=${ipv6_addr} 391 ... PrefixLength=${prefix_length} 392 393 ${patch_list}= Create List 394 395 # Get existing static IPv6 configurations on BMC. 396 ${ipv6_network_configurations}= Get IPv6 Network Configuration 397 ${num_entries}= Get Length ${ipv6_network_configurations} 398 399 FOR ${INDEX} IN RANGE 0 ${num_entries} 400 Append To List ${patch_list} ${empty_dict} 401 END 402 403 ${valid_status_codes}= Set Variable If '${valid_status_codes}' == '${HTTP_OK}' 404 ... ${HTTP_OK},${HTTP_NO_CONTENT} 405 ... ${valid_status_codes} 406 407 # We need not check for existence of IPv6 on BMC while adding. 408 Append To List ${patch_list} ${ipv6_data} 409 ${data}= Create Dictionary IPv6StaticAddresses=${patch_list} 410 411 ${active_channel_config}= Get Active Channel Config 412 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} 413 414 Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body=&{data} 415 ... valid_status_codes=[${valid_status_codes}] 416 417 Return From Keyword If '${valid_status_codes}' != '${HTTP_OK},${HTTP_NO_CONTENT}' 418 419 # Note: Network restart takes around 15-18s after patch request processing. 420 Sleep ${NETWORK_TIMEOUT}s 421 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT} 422 423 Verify IPv6 And PrefixLength ${ipv6_addr} ${prefix_len} 424 425 # Verify if existing static IPv6 addresses still exist. 426 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations} 427 Verify IPv6 On BMC ${ipv6_network_configuration['Address']} 428 END 429 430 Validate IPv6 Network Config On BMC 431 432 433Validate IPv6 Network Config On BMC 434 [Documentation] Check that IPv6 network info obtained via redfish matches info 435 ... obtained via CLI. 436 @{ipv6_network_configurations}= Get IPv6 Network Configuration 437 ${ipv6_data}= Get BMC IPv6 Info 438 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations} 439 Should Contain Match ${ipv6_data} ${ipv6_network_configuration['Address']}/* 440 ... msg=IPv6 address does not exist. 441 END 442 443 444Delete IPv6 Address 445 [Documentation] Delete IPv6 address of BMC. 446 [Arguments] ${ipv6_addr} 447 ... ${valid_status_codes}=[${HTTP_OK},${HTTP_ACCEPTED},${HTTP_NO_CONTENT}] 448 449 # Description of argument(s): 450 # ipv6_addr IPv6 address to be deleted (e.g. "2001:1234:1234:1234::1234"). 451 # valid_status_codes Expected return code from patch operation 452 # (e.g. "200"). See prolog of rest_request 453 # method in redfish_plus.py for details. 454 455 ${empty_dict}= Create Dictionary 456 ${patch_list}= Create List 457 458 @{ipv6_network_configurations}= Get IPv6 Network Configuration 459 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations} 460 IF '${ipv6_network_configuration['Address']}' == '${ipv6_addr}' 461 Append To List ${patch_list} ${null} 462 ELSE 463 Append To List ${patch_list} ${empty_dict} 464 END 465 END 466 467 ${ip_found}= Run Keyword And Return Status List Should Contain Value 468 ... ${patch_list} ${null} msg=${ipv6_addr} does not exist on BMC 469 Pass Execution If ${ip_found} == ${False} ${ipv6_addr} does not exist on BMC 470 471 # Run patch command only if given IP is found on BMC 472 ${data}= Create Dictionary IPv6StaticAddresses=${patch_list} 473 474 ${active_channel_config}= Get Active Channel Config 475 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} 476 477 Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body=&{data} 478 ... valid_status_codes=${valid_status_codes} 479 480 # Note: Network restart takes around 15-18s after patch request processing 481 Sleep ${NETWORK_TIMEOUT}s 482 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT} 483 484 # IPv6 address that is deleted should not be there on BMC. 485 ${delete_status}= Run Keyword And Return Status Verify IPv6 On BMC ${ipv6_addr} 486 IF '${valid_status_codes}' == '[${HTTP_OK},${HTTP_ACCEPTED},${HTTP_NO_CONTENT}]' 487 Should Be True '${delete_status}' == '${False}' 488 ELSE 489 Should Be True '${delete_status}' == '${True}' 490 END 491 492 Validate IPv6 Network Config On BMC 493 494 495Modify IPv6 Address 496 [Documentation] Modify and verify IPv6 address of BMC. 497 [Arguments] ${ipv6} ${new_ipv6} ${prefix_len} 498 ... ${valid_status_codes}=[${HTTP_OK}, ${HTTP_NO_CONTENT}] 499 500 # Description of argument(s): 501 # ipv6 IPv6 address to be replaced (e.g. "2001:AABB:CCDD::AAFF"). 502 # new_ipv6 New IPv6 address to be configured. 503 # prefix_len Prefix length value (Range 1 to 128). 504 # valid_status_codes Expected return code from patch operation 505 # (e.g. "200", "201"). 506 507 ${empty_dict}= Create Dictionary 508 ${patch_list}= Create List 509 ${prefix_length}= Convert To Integer ${prefix_len} 510 ${ipv6_data}= Create Dictionary 511 ... Address=${new_ipv6} PrefixLength=${prefix_length} 512 513 # Sample IPv6 network configurations: 514 # "IPv6AddressPolicyTable": [], 515 # "IPv6Addresses": [ 516 # { 517 # "Address": "X002:db8:0:2::XX0", 518 # "AddressOrigin": "DHCPv6", 519 # "PrefixLength": 128 520 # }, 521 # { 522 # "Address": “X002:db8:0:2:a94:XXff:fe82:XXXX", 523 # "AddressOrigin": "SLAAC", 524 # "PrefixLength": 64 525 # }, 526 # { 527 # "Address": “Y002:db8:0:2:a94:efff:fe82:5000", 528 # "AddressOrigin": "Static", 529 # "PrefixLength": 56 530 # }, 531 # { 532 # "Address": “Z002:db8:0:2:a94:efff:fe82:5000", 533 # "AddressOrigin": "Static", 534 # "PrefixLength": 56 535 # }, 536 # { 537 # "Address": “Xe80::a94:efff:YYYY:XXXX", 538 # "AddressOrigin": "LinkLocal", 539 # "PrefixLength": 64 540 # }, 541 # { 542 # "Address": “X002:db8:1:2:eff:233:fee:546", 543 # "AddressOrigin": "Static", 544 # "PrefixLength": 56 545 # } 546 # ], 547 # "IPv6DefaultGateway": “XXXX::ab2e:80fe:87df:XXXX”, 548 # "IPv6StaticAddresses": [ 549 # { 550 # "Address": “X002:db8:0:2:a94:efff:fe82:5000", 551 # "PrefixLength": 56 552 # }, 553 # { 554 # "Address": “Y002:db8:0:2:a94:efff:fe82:5000", 555 # "PrefixLength": 56 556 # }, 557 # { 558 # "Address": “Z002:db8:1:2:eff:233:fee:546", 559 # "PrefixLength": 56 560 # } 561 # ], 562 # "IPv6StaticDefaultGateways": [], 563 564 # Find the position of IPv6 address to be modified. 565 @{ipv6_network_configurations}= Get IPv6 Network Configuration 566 FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations} 567 IF '${ipv6_network_configuration['Address']}' == '${ipv6}' 568 Append To List ${patch_list} ${ipv6_data} 569 ELSE 570 Append To List ${patch_list} ${empty_dict} 571 END 572 END 573 574 # Modify the IPv6 address only if given IPv6 is found 575 ${ip_found}= Run Keyword And Return Status List Should Contain Value 576 ... ${patch_list} ${ipv6_data} msg=${ipv6} does not exist on BMC 577 Pass Execution If ${ip_found} == ${False} ${ipv6} does not exist on BMC 578 579 ${data}= Create Dictionary IPv6StaticAddresses=${patch_list} 580 581 ${active_channel_config}= Get Active Channel Config 582 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} 583 584 Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 585 ... body=&{data} valid_status_codes=${valid_status_codes} 586 587 # Note: Network restart takes around 15-18s after patch request processing. 588 Sleep ${NETWORK_TIMEOUT}s 589 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT} 590 591 # Verify if new IPv6 address is configured on BMC. 592 Verify IPv6 On BMC ${new_ipv6} 593 594 # Verify if old IPv6 address is erased. 595 ${cmd_status}= Run Keyword And Return Status 596 ... Verify IPv6 On BMC ${ipv6} 597 Should Be Equal ${cmd_status} ${False} msg=Old IPv6 address is not deleted. 598 599 Validate IPv6 Network Config On BMC 600 601 602Set SLAAC Configuration State And Verify 603 [Documentation] Set SLAAC configuration state and verify. 604 [Arguments] ${slaac_state} ${valid_status_codes}=[${HTTP_OK},${HTTP_ACCEPTED},${HTTP_NO_CONTENT}] ${channel_number}=${CHANNEL_NUMBER} 605 606 # Description of argument(s): 607 # slaac_state SLAAC state('True' or 'False'). 608 # valid_status_code Expected valid status codes. 609 # channel_number Channel number 1(eth0) or 2(eth1). 610 611 ${active_channel_config}= Get Active Channel Config 612 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} 613 614 ${data}= Set Variable If ${slaac_state} == ${False} ${DISABLE_SLAAC} ${ENABLE_SLAAC} 615 ${resp}= Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 616 ... body=${data} valid_status_codes=${valid_status_codes} 617 618 # Verify SLAAC is set correctly. 619 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 620 ${slaac_verify}= Get From Dictionary ${resp.dict} StatelessAddressAutoConfig 621 622 IF '${slaac_verify['IPv6AutoConfigEnabled']}' != '${slaac_state}' 623 Fail msg=SLAAC not set properly. 624 END 625 626Set And Verify DHCPv6 Property 627 [Documentation] Set DHCPv6 property and verify. 628 [Arguments] ${dhcpv6_operating_mode}=${Disabled} ${channel_number}=${CHANNEL_NUMBER} 629 630 # Description of argument(s): 631 # dhcpv6_operating_mode Enabled if user wants to enable DHCPv6('Enabled' or 'Disabled'). 632 # channel_number Channel number 1 or 2. 633 634 Set DHCPv6 Property ${dhcpv6_operating_mode} ${channel_number} 635 Verify DHCPv6 Property ${dhcpv6_operating_mode} ${channel_number} 636 637 638Set DHCPv6 Property 639 [Documentation] Set DHCPv6 attribute is enables or disabled. 640 [Arguments] ${dhcpv6_operating_mode}=${Disabled} ${channel_number}=${CHANNEL_NUMBER} 641 642 # Description of argument(s): 643 # dhcpv6_operating_mode Enabled if user wants to enable DHCPv6('Enabled' or 'Disabled'). 644 # channel_number Channel number 1 or 2. 645 646 ${data}= Set Variable If '${dhcpv6_operating_mode}' == 'Disabled' ${DISABLE_DHCPv6} ${ENABLE_DHCPv6} 647 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} 648 649 Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 650 ... body=${data} valid_status_codes=[${HTTP_OK},${HTTP_NO_CONTENT}] 651 652 653Verify DHCPv6 Property 654 [Documentation] Verify DHCPv6 settings is enabled or disabled. 655 [Arguments] ${dhcpv6_operating_mode} ${channel_number}=${CHANNEL_NUMBER} 656 657 # Description of Argument(s): 658 # dhcpv6_operating_mode Enable/ Disable DHCPv6. 659 # channel_number Channel number 1 or 2. 660 661 ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} 662 663 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 664 ${dhcpv6_verify}= Get From Dictionary ${resp.dict} DHCPv6 665 666 Should Be Equal '${dhcpv6_verify['OperatingMode']}' '${dhcpv6_operating_mode}' 667 668 669Get IPv6 Static Default Gateway 670 [Documentation] Get IPv6 static default gateway. 671 672 ${active_channel_config}= Get Active Channel Config 673 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${active_channel_config['${CHANNEL_NUMBER}']['name']} 674 675 @{ipv6_static_defgw_configurations}= Get From Dictionary ${resp.dict} IPv6StaticDefaultGateways 676 RETURN @{ipv6_static_defgw_configurations} 677 678 679Configure IPv6 Static Default Gateway On BMC 680 [Documentation] Configure IPv6 static default gateway on BMC. 681 [Arguments] ${ipv6_gw_addr} ${prefix_length_def} 682 ... ${valid_status_codes}=${HTTP_OK} 683 # Description of argument(s): 684 # ipv6_gw_addr IPv6 Static Default Gateway address to be configured. 685 # prefix_len_def Prefix length value (Range 1 to 128). 686 # valid_status_codes Expected return code from patch operation 687 # (e.g. "200", "204".) 688 689 # Prefix Length is passed as None. 690 IF '${prefix_length_def}' == '${None}' 691 ${ipv6_gw}= Create Dictionary Address=${ipv6_gw_addr} 692 ELSE 693 ${ipv6_gw}= Create Dictionary Address=${ipv6_gw_addr} Prefix Length=${prefix_length_def} 694 END 695 696 ${ipv6_static_def_gw}= Get IPv6 Static Default Gateway 697 698 ${num_entries}= Get Length ${ipv6_static_def_gw} 699 700 ${patch_list}= Create List 701 ${empty_dict}= Create Dictionary 702 703 FOR ${INDEX} IN RANGE 0 ${num_entries} 704 Append To List ${patch_list} ${empty_dict} 705 END 706 707 ${valid_status_codes}= Set Variable If '${valid_status_codes}' == '${HTTP_OK}' 708 ... ${HTTP_OK},${HTTP_NO_CONTENT} 709 ... ${valid_status_codes} 710 711 Append To List ${patch_list} ${ipv6_gw} 712 ${data}= Create Dictionary IPv6StaticDefaultGateways=${patch_list} 713 714 Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 715 ... body=${data} valid_status_codes=[${valid_status_codes}] 716 717 # Verify the added static default gateway is present in Redfish Get Output. 718 ${ipv6_staticdef_gateway}= Get IPv6 Static Default Gateway 719 720 ${ipv6_static_def_gw_list}= Create List 721 FOR ${ipv6_staticdef_gateway} IN @{ipv6_staticdef_gateway} 722 ${value}= Get From Dictionary ${ipv6_staticdef_gateway} Address 723 Append To List ${ipv6_static_def_gw_list} ${value} 724 END 725 726 IF '${valid_status_codes}' != '${HTTP_OK},${HTTP_NO_CONTENT}' 727 Should Not Contain ${ipv6_static_def_gw_list} ${ipv6_gw_addr} 728 ELSE 729 Should Contain ${ipv6_static_def_gw_list} ${ipv6_gw_addr} 730 END 731 732 733Modify IPv6 Static Default Gateway On BMC 734 [Documentation] Modify and verify IPv6 address of BMC. 735 [Arguments] ${ipv6_gw_addr} ${new_static_def_gw} ${prefix_length} 736 ... ${valid_status_codes}=[${HTTP_OK},${HTTP_ACCEPTED}] 737 738 # Description of argument(s): 739 # ipv6_gw_addr IPv6 static default gateway address to be replaced (e.g. "2001:AABB:CCDD::AAFF"). 740 # new_static_def_gw New static default gateway address to be configured. 741 # prefix length Prefix length value (Range 1 to 128). 742 # valid_status_codes Expected return code from patch operation 743 # (e.g. "200", "204"). 744 745 ${empty_dict}= Create Dictionary 746 ${patch_list}= Create List 747 # Prefix Length is passed as None. 748 IF '${prefix_length_def}' == '${None}' 749 ${modified_ipv6_gw_addripv6_data}= Create Dictionary Address=${new_static_def_gw} 750 ELSE 751 ${modified_ipv6_gw_addripv6_data}= Create Dictionary Address=${new_static_def_gw} Prefix Length=${prefix_length_def} 752 END 753 754 @{ipv6_static_def_gw_list}= Get IPv6 Static Default Gateway 755 756 FOR ${ipv6_static_def_gw} IN @{ipv6_static_def_gw_list} 757 IF '${ipv6_static_def_gw['Address']}' == '${ipv6_gw_addr}' 758 Append To List ${patch_list} ${modified_ipv6_gw_addripv6_data} 759 ELSE 760 Append To List ${patch_list} ${empty_dict} 761 END 762 END 763 764 # Modify the IPv6 address only if given IPv6 static default gateway is found. 765 ${ip_static_def_gw_found}= Run Keyword And Return Status List Should Contain Value 766 ... ${patch_list} ${modified_ipv6_gw_addripv6_data} msg=${ipv6_gw_addr} does not exist on BMC 767 Pass Execution If ${ip_static_def_gw_found} == ${False} ${ipv6_gw_addr} does not exist on BMC 768 769 ${data}= Create Dictionary IPv6StaticDefaultGateways=${patch_list} 770 771 Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 772 ... body=&{data} valid_status_codes=${valid_status_codes} 773 774 ${ipv6_staticdef_gateway}= Get IPv6 Static Default Gateway 775 776 ${ipv6_static_def_gw_list}= Create List 777 FOR ${ipv6_staticdef_gateway} IN @{ipv6_staticdef_gateway} 778 ${value}= Get From Dictionary ${ipv6_staticdef_gateway} Address 779 Append To List ${ipv6_static_def_gw_list} ${value} 780 END 781 782 Should Contain ${ipv6_static_def_gw_list} ${new_static_def_gw} 783 # Verify if old static default gateway address is erased. 784 Should Not Contain ${ipv6_static_def_gw_list} ${ipv6_gw_addr} 785 786 787Delete IPv6 Static Default Gateway 788 [Documentation] Delete IPv6 static default gateway on BMC. 789 [Arguments] ${ipv6_gw_addr} 790 ... ${valid_status_codes}=[${HTTP_OK},${HTTP_ACCEPTED},${HTTP_NO_CONTENT}] 791 792 # Description of argument(s): 793 # ipv6_gw_addr IPv6 Static Default Gateway address to be deleted. 794 # valid_status_codes Expected return code from patch operation 795 # (e.g. "200"). 796 797 ${patch_list}= Create List 798 ${empty_dict}= Create Dictionary 799 800 ${ipv6_static_def_gw_list}= Create List 801 @{ipv6_static_defgw_configurations}= Get IPv6 Static Default Gateway 802 803 FOR ${ipv6_staticdef_gateway} IN @{ipv6_static_defgw_configurations} 804 ${value}= Get From Dictionary ${ipv6_staticdef_gateway} Address 805 Append To List ${ipv6_static_def_gw_list} ${value} 806 END 807 808 ${defgw_found}= Run Keyword And Return Status List Should Contain Value 809 ... ${ipv6_static_def_gw_list} ${ipv6_gw_addr} msg=${ipv6_gw_addr} does not exist on BMC 810 Skip If ${defgw_found} == ${False} ${ipv6_gw_addr} does not exist on BMC 811 812 FOR ${ipv6_static_def_gw} IN @{ipv6_static_defgw_configurations} 813 IF '${ipv6_static_def_gw['Address']}' == '${ipv6_gw_addr}' 814 Append To List ${patch_list} ${null} 815 ELSE 816 Append To List ${patch_list} ${empty_dict} 817 END 818 END 819 820 # Run patch command only if given IP is found on BMC. 821 ${data}= Create Dictionary IPv6StaticDefaultGateways=${patch_list} 822 823 Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body=&{data} 824 ... valid_status_codes=${valid_status_codes} 825 826 ${data}= Create Dictionary IPv6StaticDefaultGateways=${patch_list} 827 828 @{ipv6_static_defgw_configurations}= Get IPv6 Static Default Gateway 829 Should Not Contain Match ${ipv6_static_defgw_configurations} ${ipv6_gw_addr} 830 ... msg=IPv6 Static default gateway does not exist. 831 832 833Check Coexistence Of Linklocalv6 And Static IPv6 834 [Documentation] Verify both linklocalv6 and static IPv6 exist. 835 836 # Verify the address origin contains static and linklocal. 837 @{ipv6_addressorigin_list} ${ipv6_linklocal_addr}= Get Address Origin List And Address For Type LinkLocal 838 839 Should Match Regexp ${ipv6_linklocal_addr} ${linklocal_addr_format} 840 Should Contain ${ipv6_addressorigin_list} Static 841 842 843Check If Linklocal Address Is In Correct Format 844 [Documentation] Linklocal address has network part fe80 and host part EUI64. 845 846 # Fetch the linklocal address. 847 @{ipv6_addressorigin_list} ${ipv6_linklocal_addr}= Get Address Origin List And Address For Type LinkLocal 848 849 # Follow EUI64 from MAC. 850 ${system_mac}= Get BMC MAC Address 851 ${split_octets}= Split String ${system_mac} : 852 ${first_octet}= Evaluate int('${split_octets[0]}', 16) 853 ${flipped_hex}= Evaluate format(${first_octet} ^ 2, '02x') 854 ${grp1}= Evaluate re.sub(r'^0+', '', '${flipped_hex}${split_octets[1]}') modules=re 855 ${grp2}= Evaluate re.sub(r'^0+', '', '${split_octets[2]}ff') modules=re 856 ${grp3}= Evaluate re.sub(r'^0+', '', '${split_octets[4]}${split_octets[5]}') modules=re 857 ${linklocal}= Set Variable fe80::${grp1}:${grp2}:fe${split_octets[3]}:${grp3} 858 859 # Verify the linklocal obtained is the same as on the machine. 860 Should Be Equal ${linklocal} ${ipv6_linklocal_addr} 861 862 863Check BMC Gets SLAAC Address 864 [Documentation] Check BMC gets slaac address. 865 866 @{ipv6_addressorigin_list} ${ipv6_slaac_addr}= Get Address Origin List And Address For Type SLAAC 867 868 869Get The Initial DHCPv6 Setting On Each Interface 870 [Documentation] Get the initial DHCPv6 setting of each interface. 871 [Arguments] ${channel_number} 872 873 # Description of the argument(s): 874 # channel_number Channel number 1 or 2. 875 876 ${ethernet_interface}= Set Variable ${active_channel_config['${channel_number}']['name']} 877 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 878 ${initial_dhcpv6_iface}= Get From Dictionary ${resp.dict} DHCPv6 879 IF ${channel_number}==${1} 880 Set Test Variable ${dhcpv6_channel_1} ${initial_dhcpv6_iface['OperatingMode']} 881 ELSE 882 Set Test Variable ${dhcpv6_channel_2} ${initial_dhcpv6_iface['OperatingMode']} 883 END 884 885 886Get The Initial DHCPv6 Settings 887 [Documentation] Get the initial DHCPv6 settings of both the interfaces. 888 889 Get The Initial DHCPv6 Setting On Each Interface ${1} 890 Get The Initial DHCPv6 Setting On Each Interface ${2} 891 892 893Get The Initial SLAAC Settings 894 [Documentation] Get the initial SLAAC settings of both the interfaces. 895 896 Get The Initial SLAAC Setting On Each Interface ${1} 897 Get The Initial SLAAC Setting On Each Interface ${2} 898 899 900Get The Initial SLAAC Setting On Each Interface 901 [Documentation] Get the initial SLAAC setting of the interface. 902 [Arguments] ${channel_number} 903 904 # Description of the argument(s): 905 # channel_number Channel number 1 or 2. 906 907 ${ethernet_interface}= Set Variable ${active_channel_config['${channel_number}']['name']} 908 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 909 ${initial_slaac_iface}= Get From Dictionary ${resp.dict} StatelessAddressAutoConfig 910 IF ${channel_number}==${1} 911 Set Test Variable ${slaac_channel_1} ${initial_slaac_iface['IPv6AutoConfigEnabled']} 912 ELSE 913 Set Test Variable ${slaac_channel_2} ${initial_slaac_iface['IPv6AutoConfigEnabled']} 914 END 915 916 917Get Address Origin List And Address For Type 918 [Documentation] Get address origin list and address for type. 919 [Arguments] ${ipv6_address_type} 920 921 # Description of the argument(s): 922 # ipv6_address_type Type of IPv6 address to be checked. 923 924 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${active_channel_config['${CHANNEL_NUMBER}']['name']} 925 @{ipv6_addresses}= Get From Dictionary ${resp.dict} IPv6Addresses 926 927 ${ipv6_addressorigin_list}= Create List 928 ${ipv6_slaac_addr}= Set Variable ${None} 929 FOR ${ipv6_address} IN @{ipv6_addresses} 930 ${ipv6_addressorigin}= Get From Dictionary ${ipv6_address} AddressOrigin 931 Append To List ${ipv6_addressorigin_list} ${ipv6_addressorigin} 932 IF '${ipv6_addressorigin}' == '${ipv6_address_type}' 933 Set Test Variable ${ipv6_type_addr} ${ipv6_address['Address']} 934 END 935 END 936 Should Contain ${ipv6_addressorigin_list} ${ipv6_address_type} 937 Should Not Be Empty ${ipv6_type_addr} msg=${ipv6_address_type} address is not present 938 RETURN @{ipv6_addressorigin_list} ${ipv6_type_addr} 939 940 941Get Address Origin List And IPv4 or IPv6 Address 942 [Documentation] Get address origin list and address for type. 943 [Arguments] ${ip_address_type} 944 945 # Description of the argument(s): 946 # ipv4_address_type Type of IPv4 or IPv6 address to be checked. 947 948 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${active_channel_config['${CHANNEL_NUMBER}']['name']} 949 @{ip_addresses}= Get From Dictionary ${resp.dict} ${ip_address_type} 950 951 ${ip_addressorigin_list}= Create List 952 ${ip_addr_list}= Create List 953 FOR ${ip_address} IN @{ip_addresses} 954 ${ip_addressorigin}= Get From Dictionary ${ip_address} AddressOrigin 955 Append To List ${ip_addressorigin_list} ${ip_addressorigin} 956 Append To List ${ip_addr_list} ${ip_address['Address']} 957 END 958 RETURN ${ip_addressorigin_list} ${ip_addr_list} 959 960 961Verify All The Addresses Are Intact 962 [Documentation] Verify all the addresses and address origins remain intact. 963 964 # Verify that it will not impact the IPv4 configuration. 965 Sleep ${NETWORK_TIMEOUT} 966 Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT} 967 968 # IPv6 address must be present. 969 @{ipv6_addressorigin_list} ${ipv6_slaac_addr}= Get Address Origin List And Address For Type SLAAC 970 @{ipv6_addressorigin_list} ${ipv6_linklocal_addr}= Get Address Origin List And Address For Type LinkLocal 971 972 # IPv4 and IPv6 addresses must remain intact. 973 ${ipv4_addressorigin_list} ${ipv4_addr_list}= Get Address Origin List And IPv4 or IPv6 Address IPv4Addresses 974 ${ipv6_addressorigin_list} ${ipv6_addr_list}= Get Address Origin List And IPv4 or IPv6 Address IPv6Addresses 975 976 ${ipv6_is_subset}= Evaluate set(${initial_ipv6_addr_list}).issubset(set(${ipv6_addr_list})) 977 Should Be True ${ipv6_is_subset} 978 979 Should be Equal ${initial_ipv4_addressorigin_list} ${ipv4_addressorigin_list} 980 Should be Equal ${initial_ipv4_addr_list} ${ipv4_addr_list} 981