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