18abbb4d9SPrashanth Katti*** Settings *** 28abbb4d9SPrashanth KattiDocumentation Network interface IPv6 configuration and verification 38abbb4d9SPrashanth Katti ... tests. 48abbb4d9SPrashanth Katti 58abbb4d9SPrashanth KattiResource ../../lib/bmc_redfish_resource.robot 68abbb4d9SPrashanth KattiResource ../../lib/openbmc_ffdc.robot 78abbb4d9SPrashanth KattiResource ../../lib/bmc_ipv6_utils.robot 88ba74328SSweta PotthuriResource ../../lib/external_intf/vmi_utils.robot 98abbb4d9SPrashanth KattiLibrary ../../lib/bmc_network_utils.py 108abbb4d9SPrashanth KattiLibrary Collections 118abbb4d9SPrashanth Katti 128abbb4d9SPrashanth KattiTest Setup Test Setup Execution 138abbb4d9SPrashanth KattiTest Teardown Test Teardown Execution 143270fd09SPrashanth KattiSuite Setup Suite Setup Execution 158abbb4d9SPrashanth Katti 166fb70d98SMatt FischerTest Tags BMC_IPv6 178abbb4d9SPrashanth Katti 188abbb4d9SPrashanth Katti*** Variables *** 198abbb4d9SPrashanth Katti${test_ipv6_addr} 2001:db8:3333:4444:5555:6666:7777:8888 20c1d2daa6SPrashanth Katti${test_ipv6_invalid_addr} 2001:db8:3333:4444:5555:6666:7777:JJKK 215f7d2e4cSPrashanth Katti${test_ipv6_addr1} 2001:db8:3333:4444:5555:6666:7777:9999 228abbb4d9SPrashanth Katti 23e16f158fSGeorge Keishing# Valid prefix length is a integer ranges from 1 to 128. 2412ed4b74SPrashanth Katti${test_prefix_length} 64 258abbb4d9SPrashanth Katti 268abbb4d9SPrashanth Katti*** Test Cases *** 278abbb4d9SPrashanth Katti 288abbb4d9SPrashanth KattiGet IPv6 Address And Verify 298abbb4d9SPrashanth Katti [Documentation] Get IPv6 Address And Verify. 308abbb4d9SPrashanth Katti [Tags] Get_IPv6_Address_And_Verify 318abbb4d9SPrashanth Katti 328abbb4d9SPrashanth Katti FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations} 338abbb4d9SPrashanth Katti Verify IPv6 On BMC ${ipv6_network_configuration['Address']} 348abbb4d9SPrashanth Katti END 358abbb4d9SPrashanth Katti 368abbb4d9SPrashanth Katti 372c73abc6SPrashanth KattiGet PrefixLength And Verify 382c73abc6SPrashanth Katti [Documentation] Get IPv6 prefix length and verify. 392c73abc6SPrashanth Katti [Tags] Get_PrefixLength_And_Verify 402c73abc6SPrashanth Katti 412c73abc6SPrashanth Katti FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations} 422c73abc6SPrashanth Katti Verify IPv6 On BMC ${ipv6_network_configuration['PrefixLength']} 432c73abc6SPrashanth Katti END 442c73abc6SPrashanth Katti 452c73abc6SPrashanth Katti 462c73abc6SPrashanth KattiGet IPv6 Default Gateway And Verify 479614383dSGeorge Keishing [Documentation] Get IPv6 default gateway and verify. 48ade6ab42SGeorge Keishing [Tags] Get_IPv6_Default_Gateway_And_Verify 492c73abc6SPrashanth Katti 502c73abc6SPrashanth Katti ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 512c73abc6SPrashanth Katti ${ipv6_gateway}= Get From Dictionary ${resp.dict} IPv6DefaultGateway 522c73abc6SPrashanth Katti Verify IPv6 Default Gateway On BMC ${ipv6_gateway} 532c73abc6SPrashanth Katti 542c73abc6SPrashanth Katti 55c1d2daa6SPrashanth KattiVerify All Configured IPv6 And PrefixLength On BMC 56c1d2daa6SPrashanth Katti [Documentation] Verify IPv6 address and its prefix length on BMC. 57c1d2daa6SPrashanth Katti [Tags] Verify_All_Configured_IPv6_And_PrefixLength_On_BMC 58c1d2daa6SPrashanth Katti 59c1d2daa6SPrashanth Katti FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations} 60f02ca2b6SGeorge Keishing Verify IPv6 And PrefixLength ${ipv6_network_configuration['Address']} 61c1d2daa6SPrashanth Katti ... ${ipv6_network_configuration['PrefixLength']} 62c1d2daa6SPrashanth Katti END 63c1d2daa6SPrashanth Katti 64c1d2daa6SPrashanth Katti 65c1d2daa6SPrashanth KattiConfigure IPv6 Address And Verify 66c1d2daa6SPrashanth Katti [Documentation] Configure IPv6 address and verify. 67c1d2daa6SPrashanth Katti [Tags] Configure_IPv6_Address_And_Verify 68*3a26c66cSAnvesh-Kumar_Rayankula [Teardown] Run Keywords 69*3a26c66cSAnvesh-Kumar_Rayankula ... Delete IPv6 Address ${test_ipv6_addr} AND Test Teardown Execution 70c1d2daa6SPrashanth Katti [Template] Configure IPv6 Address On BMC 71c1d2daa6SPrashanth Katti 72c1d2daa6SPrashanth Katti 73c1d2daa6SPrashanth Katti # IPv6 address Prefix length 74c1d2daa6SPrashanth Katti ${test_ipv6_addr} ${test_prefix_length} 75c1d2daa6SPrashanth Katti 76c1d2daa6SPrashanth Katti 7712ed4b74SPrashanth KattiDelete IPv6 Address And Verify 7812ed4b74SPrashanth Katti [Documentation] Delete IPv6 address and verify. 7912ed4b74SPrashanth Katti [Tags] Delete_IPv6_Address_And_Verify 8012ed4b74SPrashanth Katti 8112ed4b74SPrashanth Katti Configure IPv6 Address On BMC ${test_ipv6_addr} ${test_prefix_length} 8212ed4b74SPrashanth Katti 8312ed4b74SPrashanth Katti Delete IPv6 Address ${test_ipv6_addr} 8412ed4b74SPrashanth Katti 8512ed4b74SPrashanth Katti 865f7d2e4cSPrashanth Katti 87cc288315SGeorge KeishingModify IPv6 Address And Verify 885f7d2e4cSPrashanth Katti [Documentation] Modify IPv6 address and verify. 895f7d2e4cSPrashanth Katti [Tags] Modify_IPv6_Address_And_Verify 9088de8c44Skvishal [Teardown] Run Keywords 9188de8c44Skvishal ... Delete IPv6 Address ${test_ipv6_addr1} AND Test Teardown Execution 925f7d2e4cSPrashanth Katti 935f7d2e4cSPrashanth Katti Configure IPv6 Address On BMC ${test_ipv6_addr} ${test_prefix_length} 945f7d2e4cSPrashanth Katti 955f7d2e4cSPrashanth Katti Modify IPv6 Address ${test_ipv6_addr} ${test_ipv6_addr1} ${test_prefix_length} 965f7d2e4cSPrashanth Katti 975f7d2e4cSPrashanth Katti 98afe858e3SSweta PotthuriVerify Persistency Of IPv6 After BMC Reboot 99afe858e3SSweta Potthuri [Documentation] Verify persistency of IPv6 after BMC reboot. 100afe858e3SSweta Potthuri [Tags] Verify_Persistency_Of_IPv6_After_BMC_Reboot 101afe858e3SSweta Potthuri [Teardown] Run Keywords 102afe858e3SSweta Potthuri ... Delete IPv6 Address ${test_ipv6_addr} AND Test Teardown Execution 103afe858e3SSweta Potthuri 104afe858e3SSweta Potthuri Configure IPv6 Address On BMC ${test_ipv6_addr} ${test_prefix_length} 105afe858e3SSweta Potthuri 106afe858e3SSweta Potthuri Redfish OBMC Reboot (off) stack_mode=skip 107afe858e3SSweta Potthuri 108afe858e3SSweta Potthuri # Verifying persistency of IPv6. 109afe858e3SSweta Potthuri Verify IPv6 On BMC ${test_ipv6_addr} 110afe858e3SSweta Potthuri 111afe858e3SSweta Potthuri 1128ba74328SSweta PotthuriEnable SLAACv6 On BMC And Verify 1138ba74328SSweta Potthuri [Documentation] Enable SLAACv6 on BMC and verify. 1148ba74328SSweta Potthuri [Tags] Enable_SLAACv6_On_BMC_And_Verify 1158ba74328SSweta Potthuri 1168ba74328SSweta Potthuri Set SLAACv6 Configuration State And Verify ${True} 1178ba74328SSweta Potthuri 1188ba74328SSweta Potthuri 1190df4a868SSweta PotthuriEnable DHCPv6 Property On BMC And Verify 1200df4a868SSweta Potthuri [Documentation] Enable DHCPv6 property on BMC and verify. 1210df4a868SSweta Potthuri [Tags] Enable_DHCPv6_Property_On_BMC_And_Verify 1220df4a868SSweta Potthuri 1230df4a868SSweta Potthuri Set And Verify DHCPv6 Property Enabled 1240df4a868SSweta Potthuri 1250df4a868SSweta Potthuri 126cb61ff0fSSweta PotthuriConfigure Invalid Static IPv6 And Verify 127cb61ff0fSSweta Potthuri [Documentation] Configure invalid static IPv6 and verify. 128cb61ff0fSSweta Potthuri [Tags] Configure_Invalid_Static_IPv6_And_Verify 129cb61ff0fSSweta Potthuri [Template] Configure IPv6 Address On BMC 130cb61ff0fSSweta Potthuri 131cb61ff0fSSweta Potthuri #invalid_ipv6 prefix length valid_status_code 132cb61ff0fSSweta Potthuri ${ipv4_hexword_addr} ${test_prefix_length} ${HTTP_BAD_REQUEST} 133cb61ff0fSSweta Potthuri 134cb61ff0fSSweta Potthuri 1358abbb4d9SPrashanth Katti*** Keywords *** 1368abbb4d9SPrashanth Katti 1373270fd09SPrashanth KattiSuite Setup Execution 1383270fd09SPrashanth Katti [Documentation] Do suite setup execution. 1393270fd09SPrashanth Katti 1403270fd09SPrashanth Katti ${active_channel_config}= Get Active Channel Config 1413270fd09SPrashanth Katti ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} 1423270fd09SPrashanth Katti 1433270fd09SPrashanth Katti Set Suite variable ${ethernet_interface} 1443270fd09SPrashanth Katti 1453270fd09SPrashanth Katti 1468abbb4d9SPrashanth KattiTest Setup Execution 1478abbb4d9SPrashanth Katti [Documentation] Test setup execution. 1488abbb4d9SPrashanth Katti 1498abbb4d9SPrashanth Katti Redfish.Login 1508abbb4d9SPrashanth Katti 1518abbb4d9SPrashanth Katti @{ipv6_network_configurations}= Get IPv6 Network Configuration 1528abbb4d9SPrashanth Katti Set Test Variable @{ipv6_network_configurations} 1538abbb4d9SPrashanth Katti 1548abbb4d9SPrashanth Katti # Get BMC IPv6 address and prefix length. 1558abbb4d9SPrashanth Katti ${ipv6_data}= Get BMC IPv6 Info 1568abbb4d9SPrashanth Katti Set Test Variable ${ipv6_data} 1578abbb4d9SPrashanth Katti 1588abbb4d9SPrashanth Katti 1598abbb4d9SPrashanth KattiTest Teardown Execution 1608abbb4d9SPrashanth Katti [Documentation] Test teardown execution. 1618abbb4d9SPrashanth Katti 1628abbb4d9SPrashanth Katti FFDC On Test Case Fail 1638abbb4d9SPrashanth Katti Redfish.Logout 1648abbb4d9SPrashanth Katti 1658abbb4d9SPrashanth Katti 1668abbb4d9SPrashanth KattiGet IPv6 Network Configuration 1678abbb4d9SPrashanth Katti [Documentation] Get Ipv6 network configuration. 1688abbb4d9SPrashanth Katti # Sample output: 1698abbb4d9SPrashanth Katti # { 1704d430283Sganesanb # "@odata.id": "/redfish/v1/Managers/${MANAGER_ID}/EthernetInterfaces/eth0", 1718abbb4d9SPrashanth Katti # "@odata.type": "#EthernetInterface.v1_4_1.EthernetInterface", 1728abbb4d9SPrashanth Katti # "DHCPv4": { 1738abbb4d9SPrashanth Katti # "DHCPEnabled": false, 1748abbb4d9SPrashanth Katti # "UseDNSServers": false, 1758abbb4d9SPrashanth Katti # "UseDomainName": true, 1768abbb4d9SPrashanth Katti # "UseNTPServers": false 1778abbb4d9SPrashanth Katti # }, 1788abbb4d9SPrashanth Katti # "DHCPv6": { 1798abbb4d9SPrashanth Katti # "OperatingMode": "Disabled", 1808abbb4d9SPrashanth Katti # "UseDNSServers": false, 1818abbb4d9SPrashanth Katti # "UseDomainName": true, 1828abbb4d9SPrashanth Katti # "UseNTPServers": false 1838abbb4d9SPrashanth Katti # }, 1848abbb4d9SPrashanth Katti # "Description": "Management Network Interface", 1858abbb4d9SPrashanth Katti # "FQDN": "localhost", 1868abbb4d9SPrashanth Katti # "HostName": "localhost", 1878abbb4d9SPrashanth Katti # "IPv4Addresses": [ 1888abbb4d9SPrashanth Katti # { 1898abbb4d9SPrashanth Katti # "Address": "xx.xx.xx.xx", 1908abbb4d9SPrashanth Katti # "AddressOrigin": "Static", 1918abbb4d9SPrashanth Katti # "Gateway": "xx.xx.xx.1", 1928abbb4d9SPrashanth Katti # "SubnetMask": "xx.xx.xx.0" 1938abbb4d9SPrashanth Katti # }, 1948abbb4d9SPrashanth Katti # { 1958abbb4d9SPrashanth Katti # "Address": "169.254.xx.xx", 1968abbb4d9SPrashanth Katti # "AddressOrigin": "IPv4LinkLocal", 1978abbb4d9SPrashanth Katti # "Gateway": "0.0.0.0", 1988abbb4d9SPrashanth Katti # "SubnetMask": "xx.xx.0.0" 1998abbb4d9SPrashanth Katti # }, 2008abbb4d9SPrashanth Katti # ], 2018abbb4d9SPrashanth Katti # "IPv4StaticAddresses": [ 2028abbb4d9SPrashanth Katti # { 2038abbb4d9SPrashanth Katti # "Address": "xx.xx.xx.xx", 2048abbb4d9SPrashanth Katti # "AddressOrigin": "Static", 2058abbb4d9SPrashanth Katti # "Gateway": "xx.xx.xx.1", 2068abbb4d9SPrashanth Katti # "SubnetMask": "xx.xx.0.0" 2078abbb4d9SPrashanth Katti # } 2088abbb4d9SPrashanth Katti # } 2098abbb4d9SPrashanth Katti # ], 2108abbb4d9SPrashanth Katti # "IPv6AddressPolicyTable": [], 2118abbb4d9SPrashanth Katti # "IPv6Addresses": [ 2128abbb4d9SPrashanth Katti # { 2138abbb4d9SPrashanth Katti # "Address": "fe80::xxxx:xxxx:xxxx:xxxx", 2148abbb4d9SPrashanth Katti # "AddressOrigin": "LinkLocal", 2158abbb4d9SPrashanth Katti # "AddressState": null, 2168abbb4d9SPrashanth Katti # "PrefixLength": xx 2178abbb4d9SPrashanth Katti # } 2188abbb4d9SPrashanth Katti # ], 2198abbb4d9SPrashanth Katti # "IPv6DefaultGateway": "", 2208abbb4d9SPrashanth Katti # "IPv6StaticAddresses": [ 2218abbb4d9SPrashanth Katti # { "Address": "xxxx:xxxx:xxxx:xxxx::xxxx", 2228abbb4d9SPrashanth Katti # "AddressOrigin": "Static", 2238abbb4d9SPrashanth Katti # "AddressState": null, 2248abbb4d9SPrashanth Katti # "PrefixLength": xxx 2258abbb4d9SPrashanth Katti # } 2268abbb4d9SPrashanth Katti # ], 2278abbb4d9SPrashanth Katti # "Id": "eth0", 2288abbb4d9SPrashanth Katti # "InterfaceEnabled": true, 2298abbb4d9SPrashanth Katti # "LinkStatus": "LinkUp", 2308abbb4d9SPrashanth Katti # "MACAddress": "xx:xx:xx:xx:xx:xx", 2318abbb4d9SPrashanth Katti # "Name": "Manager Ethernet Interface", 2328abbb4d9SPrashanth Katti # "NameServers": [], 2338abbb4d9SPrashanth Katti # "SpeedMbps": 0, 2348abbb4d9SPrashanth Katti # "StaticNameServers": [], 2358abbb4d9SPrashanth Katti # "Status": { 2368abbb4d9SPrashanth Katti # "Health": "OK", 2378abbb4d9SPrashanth Katti # "HealthRollup": "OK", 2388abbb4d9SPrashanth Katti # "State": "Enabled" 2398abbb4d9SPrashanth Katti # }, 2408abbb4d9SPrashanth Katti # "VLANs": { 2414d430283Sganesanb # "@odata.id": "/redfish/v1/Managers/${MANAGER_ID}/EthernetInterfaces/eth0/VLANs" 2428abbb4d9SPrashanth Katti 2438abbb4d9SPrashanth Katti 2448abbb4d9SPrashanth Katti ${active_channel_config}= Get Active Channel Config 2458abbb4d9SPrashanth Katti ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${active_channel_config['${CHANNEL_NUMBER}']['name']} 2468abbb4d9SPrashanth Katti 2478abbb4d9SPrashanth Katti @{ipv6_network_configurations}= Get From Dictionary ${resp.dict} IPv6StaticAddresses 248409df05dSGeorge Keishing RETURN @{ipv6_network_configurations} 249c1d2daa6SPrashanth Katti 250c1d2daa6SPrashanth Katti 251c1d2daa6SPrashanth KattiVerify IPv6 And PrefixLength 252c1d2daa6SPrashanth Katti [Documentation] Verify IPv6 address and prefix length on BMC. 253c1d2daa6SPrashanth Katti [Arguments] ${ipv6_addr} ${prefix_len} 254c1d2daa6SPrashanth Katti 255c1d2daa6SPrashanth Katti # Description of the argument(s): 256c1d2daa6SPrashanth Katti # ipv6_addr IPv6 address to be verified. 257c1d2daa6SPrashanth Katti # prefix_len PrefixLength value to be verified. 258c1d2daa6SPrashanth Katti 259c1d2daa6SPrashanth Katti # Catenate IPv6 address and its prefix length. 260c1d2daa6SPrashanth Katti ${ipv6_with_prefix}= Catenate ${ipv6_addr}/${prefix_len} 261c1d2daa6SPrashanth Katti 262c1d2daa6SPrashanth Katti # Get IPv6 address details on BMC using IP command. 263c1d2daa6SPrashanth Katti @{ip_data}= Get BMC IPv6 Info 264c1d2daa6SPrashanth Katti 265c1d2daa6SPrashanth Katti # Verify if IPv6 and prefix length is configured on BMC. 266c1d2daa6SPrashanth Katti 267c1d2daa6SPrashanth Katti Should Contain ${ip_data} ${ipv6_with_prefix} 268c1d2daa6SPrashanth Katti ... msg=IPv6 and prefix length pair does not exist. 269c1d2daa6SPrashanth Katti 270c1d2daa6SPrashanth Katti 271c1d2daa6SPrashanth KattiConfigure IPv6 Address On BMC 272c1d2daa6SPrashanth Katti [Documentation] Add IPv6 Address on BMC. 273c1d2daa6SPrashanth Katti [Arguments] ${ipv6_addr} ${prefix_len} ${valid_status_codes}=${HTTP_OK} 274c1d2daa6SPrashanth Katti 275c1d2daa6SPrashanth Katti # Description of argument(s): 276c1d2daa6SPrashanth Katti # ipv6_addr IPv6 address to be added (e.g. "2001:EEEE:2222::2022"). 277c1d2daa6SPrashanth Katti # prefix_len Prefix length for the IPv6 to be added 278c1d2daa6SPrashanth Katti # (e.g. "64"). 279c1d2daa6SPrashanth Katti # valid_status_codes Expected return code from patch operation 280c1d2daa6SPrashanth Katti # (e.g. "200"). 281c1d2daa6SPrashanth Katti 28212ed4b74SPrashanth Katti ${prefix_length}= Convert To Integer ${prefix_len} 283c1d2daa6SPrashanth Katti ${empty_dict}= Create Dictionary 284c1d2daa6SPrashanth Katti ${ipv6_data}= Create Dictionary Address=${ipv6_addr} 28512ed4b74SPrashanth Katti ... PrefixLength=${prefix_length} 286c1d2daa6SPrashanth Katti 287c1d2daa6SPrashanth Katti ${patch_list}= Create List 288c1d2daa6SPrashanth Katti 289c1d2daa6SPrashanth Katti # Get existing static IPv6 configurations on BMC. 290c1d2daa6SPrashanth Katti ${ipv6_network_configurations}= Get IPv6 Network Configuration 291c1d2daa6SPrashanth Katti ${num_entries}= Get Length ${ipv6_network_configurations} 292c1d2daa6SPrashanth Katti 293c1d2daa6SPrashanth Katti FOR ${INDEX} IN RANGE 0 ${num_entries} 294c1d2daa6SPrashanth Katti Append To List ${patch_list} ${empty_dict} 295c1d2daa6SPrashanth Katti END 296c1d2daa6SPrashanth Katti 297c1d2daa6SPrashanth Katti ${valid_status_codes}= Run Keyword If '${valid_status_codes}' == '${HTTP_OK}' 298c1d2daa6SPrashanth Katti ... Set Variable ${HTTP_OK},${HTTP_NO_CONTENT} 299c1d2daa6SPrashanth Katti ... ELSE Set Variable ${valid_status_codes} 300c1d2daa6SPrashanth Katti 301c1d2daa6SPrashanth Katti # We need not check for existence of IPv6 on BMC while adding. 302c1d2daa6SPrashanth Katti Append To List ${patch_list} ${ipv6_data} 303c1d2daa6SPrashanth Katti ${data}= Create Dictionary IPv6StaticAddresses=${patch_list} 304c1d2daa6SPrashanth Katti 305c1d2daa6SPrashanth Katti ${active_channel_config}= Get Active Channel Config 306c1d2daa6SPrashanth Katti ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} 307c1d2daa6SPrashanth Katti 308c1d2daa6SPrashanth Katti Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body=&{data} 309c1d2daa6SPrashanth Katti ... valid_status_codes=[${valid_status_codes}] 310c1d2daa6SPrashanth Katti 311c1d2daa6SPrashanth Katti Return From Keyword If '${valid_status_codes}' != '${HTTP_OK},${HTTP_NO_CONTENT}' 312c1d2daa6SPrashanth Katti 313c1d2daa6SPrashanth Katti # Note: Network restart takes around 15-18s after patch request processing. 314c1d2daa6SPrashanth Katti Sleep ${NETWORK_TIMEOUT}s 315c1d2daa6SPrashanth Katti Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT} 316c1d2daa6SPrashanth Katti 317c1d2daa6SPrashanth Katti Verify IPv6 And PrefixLength ${ipv6_addr} ${prefix_len} 318c1d2daa6SPrashanth Katti 319c1d2daa6SPrashanth Katti # Verify if existing static IPv6 addresses still exist. 320c1d2daa6SPrashanth Katti FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations} 321c1d2daa6SPrashanth Katti Verify IPv6 On BMC ${ipv6_network_configuration['Address']} 322c1d2daa6SPrashanth Katti END 323c1d2daa6SPrashanth Katti 324c1d2daa6SPrashanth Katti Validate IPv6 Network Config On BMC 325c1d2daa6SPrashanth Katti 326c1d2daa6SPrashanth Katti 327c1d2daa6SPrashanth KattiValidate IPv6 Network Config On BMC 328c1d2daa6SPrashanth Katti [Documentation] Check that IPv6 network info obtained via redfish matches info 329c1d2daa6SPrashanth Katti ... obtained via CLI. 3305f7d2e4cSPrashanth Katti @{ipv6_network_configurations}= Get IPv6 Network Configuration 331c1d2daa6SPrashanth Katti ${ipv6_data}= Get BMC IPv6 Info 332c1d2daa6SPrashanth Katti FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations} 333c1d2daa6SPrashanth Katti Should Contain Match ${ipv6_data} ${ipv6_network_configuration['Address']}/* 334c1d2daa6SPrashanth Katti ... msg=IPv6 address does not exist. 335c1d2daa6SPrashanth Katti END 336c1d2daa6SPrashanth Katti 33712ed4b74SPrashanth Katti 33812ed4b74SPrashanth KattiDelete IPv6 Address 33912ed4b74SPrashanth Katti [Documentation] Delete IPv6 address of BMC. 340bcb9dabbSPrashanth Katti [Arguments] ${ipv6_addr} 341bcb9dabbSPrashanth Katti ... ${valid_status_codes}=[${HTTP_OK},${HTTP_ACCEPTED},${HTTP_NO_CONTENT}] 34212ed4b74SPrashanth Katti 34312ed4b74SPrashanth Katti # Description of argument(s): 34412ed4b74SPrashanth Katti # ipv6_addr IPv6 address to be deleted (e.g. "2001:1234:1234:1234::1234"). 34512ed4b74SPrashanth Katti # valid_status_codes Expected return code from patch operation 34612ed4b74SPrashanth Katti # (e.g. "200"). See prolog of rest_request 34712ed4b74SPrashanth Katti # method in redfish_plus.py for details. 34812ed4b74SPrashanth Katti 34912ed4b74SPrashanth Katti ${empty_dict}= Create Dictionary 35012ed4b74SPrashanth Katti ${patch_list}= Create List 35112ed4b74SPrashanth Katti 35212ed4b74SPrashanth Katti @{ipv6_network_configurations}= Get IPv6 Network Configuration 35312ed4b74SPrashanth Katti FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations} 35412ed4b74SPrashanth Katti IF '${ipv6_network_configuration['Address']}' == '${ipv6_addr}' 35512ed4b74SPrashanth Katti Append To List ${patch_list} ${null} 35612ed4b74SPrashanth Katti ELSE 35712ed4b74SPrashanth Katti Append To List ${patch_list} ${empty_dict} 35812ed4b74SPrashanth Katti END 35912ed4b74SPrashanth Katti END 36012ed4b74SPrashanth Katti 36112ed4b74SPrashanth Katti ${ip_found}= Run Keyword And Return Status List Should Contain Value 36212ed4b74SPrashanth Katti ... ${patch_list} ${null} msg=${ipv6_addr} does not exist on BMC 36312ed4b74SPrashanth Katti Pass Execution If ${ip_found} == ${False} ${ipv6_addr} does not exist on BMC 36412ed4b74SPrashanth Katti 36512ed4b74SPrashanth Katti # Run patch command only if given IP is found on BMC 36612ed4b74SPrashanth Katti ${data}= Create Dictionary IPv6StaticAddresses=${patch_list} 36712ed4b74SPrashanth Katti 36812ed4b74SPrashanth Katti ${active_channel_config}= Get Active Channel Config 36912ed4b74SPrashanth Katti ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} 37012ed4b74SPrashanth Katti 37112ed4b74SPrashanth Katti Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} body=&{data} 372bcb9dabbSPrashanth Katti ... valid_status_codes=[${HTTP_OK},${HTTP_ACCEPTED},${HTTP_NO_CONTENT}] 37312ed4b74SPrashanth Katti 37412ed4b74SPrashanth Katti # Note: Network restart takes around 15-18s after patch request processing 37512ed4b74SPrashanth Katti Sleep ${NETWORK_TIMEOUT}s 37612ed4b74SPrashanth Katti Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT} 37712ed4b74SPrashanth Katti 37812ed4b74SPrashanth Katti # IPv6 address that is deleted should not be there on BMC. 37912ed4b74SPrashanth Katti ${delete_status}= Run Keyword And Return Status Verify IPv6 On BMC ${ipv6_addr} 380*3a26c66cSAnvesh-Kumar_Rayankula IF '${valid_status_codes}' == '[${HTTP_OK},${HTTP_ACCEPTED},${HTTP_NO_CONTENT}]' 38112ed4b74SPrashanth Katti Should Be True '${delete_status}' == '${False}' 38212ed4b74SPrashanth Katti ELSE 38312ed4b74SPrashanth Katti Should Be True '${delete_status}' == '${True}' 38412ed4b74SPrashanth Katti END 38512ed4b74SPrashanth Katti 38612ed4b74SPrashanth Katti Validate IPv6 Network Config On BMC 3875f7d2e4cSPrashanth Katti 3885f7d2e4cSPrashanth Katti 3895f7d2e4cSPrashanth KattiModify IPv6 Address 3905f7d2e4cSPrashanth Katti [Documentation] Modify and verify IPv6 address of BMC. 3915f7d2e4cSPrashanth Katti [Arguments] ${ipv6} ${new_ipv6} ${prefix_len} 3925f7d2e4cSPrashanth Katti ... ${valid_status_codes}=[${HTTP_OK}, ${HTTP_NO_CONTENT}] 3935f7d2e4cSPrashanth Katti 3945f7d2e4cSPrashanth Katti # Description of argument(s): 3955f7d2e4cSPrashanth Katti # ipv6 IPv6 address to be replaced (e.g. "2001:AABB:CCDD::AAFF"). 3965f7d2e4cSPrashanth Katti # new_ipv6 New IPv6 address to be configured. 3975f7d2e4cSPrashanth Katti # prefix_len Prefix length value (Range 1 to 128). 3985f7d2e4cSPrashanth Katti # valid_status_codes Expected return code from patch operation 3995f7d2e4cSPrashanth Katti # (e.g. "200", "201"). 4005f7d2e4cSPrashanth Katti 4015f7d2e4cSPrashanth Katti ${empty_dict}= Create Dictionary 4025f7d2e4cSPrashanth Katti ${patch_list}= Create List 4035f7d2e4cSPrashanth Katti ${prefix_length}= Convert To Integer ${prefix_len} 4045f7d2e4cSPrashanth Katti ${ipv6_data}= Create Dictionary 4055f7d2e4cSPrashanth Katti ... Address=${new_ipv6} PrefixLength=${prefix_length} 4065f7d2e4cSPrashanth Katti 4075f7d2e4cSPrashanth Katti # Sample IPv6 network configurations: 4085f7d2e4cSPrashanth Katti # "IPv6AddressPolicyTable": [], 4095f7d2e4cSPrashanth Katti # "IPv6Addresses": [ 4105f7d2e4cSPrashanth Katti # { 4115f7d2e4cSPrashanth Katti # "Address": "X002:db8:0:2::XX0", 4125f7d2e4cSPrashanth Katti # "AddressOrigin": "DHCPv6", 4135f7d2e4cSPrashanth Katti # "PrefixLength": 128 4145f7d2e4cSPrashanth Katti # }, 4155f7d2e4cSPrashanth Katti # { 4165f7d2e4cSPrashanth Katti # "Address": “X002:db8:0:2:a94:XXff:fe82:XXXX", 4175f7d2e4cSPrashanth Katti # "AddressOrigin": "SLAAC", 4185f7d2e4cSPrashanth Katti # "PrefixLength": 64 4195f7d2e4cSPrashanth Katti # }, 4205f7d2e4cSPrashanth Katti # { 4215f7d2e4cSPrashanth Katti # "Address": “Y002:db8:0:2:a94:efff:fe82:5000", 4225f7d2e4cSPrashanth Katti # "AddressOrigin": "Static", 4235f7d2e4cSPrashanth Katti # "PrefixLength": 56 4245f7d2e4cSPrashanth Katti # }, 4255f7d2e4cSPrashanth Katti # { 4265f7d2e4cSPrashanth Katti # "Address": “Z002:db8:0:2:a94:efff:fe82:5000", 4275f7d2e4cSPrashanth Katti # "AddressOrigin": "Static", 4285f7d2e4cSPrashanth Katti # "PrefixLength": 56 4295f7d2e4cSPrashanth Katti # }, 4305f7d2e4cSPrashanth Katti # { 4315f7d2e4cSPrashanth Katti # "Address": “Xe80::a94:efff:YYYY:XXXX", 4325f7d2e4cSPrashanth Katti # "AddressOrigin": "LinkLocal", 4335f7d2e4cSPrashanth Katti # "PrefixLength": 64 4345f7d2e4cSPrashanth Katti # }, 4355f7d2e4cSPrashanth Katti # { 4365f7d2e4cSPrashanth Katti # "Address": “X002:db8:1:2:eff:233:fee:546", 4375f7d2e4cSPrashanth Katti # "AddressOrigin": "Static", 4385f7d2e4cSPrashanth Katti # "PrefixLength": 56 4395f7d2e4cSPrashanth Katti # } 4405f7d2e4cSPrashanth Katti # ], 4415f7d2e4cSPrashanth Katti # "IPv6DefaultGateway": “XXXX::ab2e:80fe:87df:XXXX”, 4425f7d2e4cSPrashanth Katti # "IPv6StaticAddresses": [ 4435f7d2e4cSPrashanth Katti # { 4445f7d2e4cSPrashanth Katti # "Address": “X002:db8:0:2:a94:efff:fe82:5000", 4455f7d2e4cSPrashanth Katti # "PrefixLength": 56 4465f7d2e4cSPrashanth Katti # }, 4475f7d2e4cSPrashanth Katti # { 4485f7d2e4cSPrashanth Katti # "Address": “Y002:db8:0:2:a94:efff:fe82:5000", 4495f7d2e4cSPrashanth Katti # "PrefixLength": 56 4505f7d2e4cSPrashanth Katti # }, 4515f7d2e4cSPrashanth Katti # { 4525f7d2e4cSPrashanth Katti # "Address": “Z002:db8:1:2:eff:233:fee:546", 4535f7d2e4cSPrashanth Katti # "PrefixLength": 56 4545f7d2e4cSPrashanth Katti # } 4555f7d2e4cSPrashanth Katti # ], 4565f7d2e4cSPrashanth Katti # "IPv6StaticDefaultGateways": [], 4575f7d2e4cSPrashanth Katti 4585f7d2e4cSPrashanth Katti # Find the position of IPv6 address to be modified. 4595f7d2e4cSPrashanth Katti @{ipv6_network_configurations}= Get IPv6 Network Configuration 4605f7d2e4cSPrashanth Katti FOR ${ipv6_network_configuration} IN @{ipv6_network_configurations} 4615f7d2e4cSPrashanth Katti Run Keyword If '${ipv6_network_configuration['Address']}' == '${ipv6}' 4625f7d2e4cSPrashanth Katti ... Append To List ${patch_list} ${ipv6_data} 4635f7d2e4cSPrashanth Katti ... ELSE Append To List ${patch_list} ${empty_dict} 4645f7d2e4cSPrashanth Katti END 4655f7d2e4cSPrashanth Katti 4665f7d2e4cSPrashanth Katti # Modify the IPv6 address only if given IPv6 is found 4675f7d2e4cSPrashanth Katti ${ip_found}= Run Keyword And Return Status List Should Contain Value 4685f7d2e4cSPrashanth Katti ... ${patch_list} ${ipv6_data} msg=${ipv6} does not exist on BMC 4695f7d2e4cSPrashanth Katti Pass Execution If ${ip_found} == ${False} ${ipv6} does not exist on BMC 4705f7d2e4cSPrashanth Katti 4715f7d2e4cSPrashanth Katti ${data}= Create Dictionary IPv6StaticAddresses=${patch_list} 4725f7d2e4cSPrashanth Katti 4735f7d2e4cSPrashanth Katti ${active_channel_config}= Get Active Channel Config 4745f7d2e4cSPrashanth Katti ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} 4755f7d2e4cSPrashanth Katti 4765f7d2e4cSPrashanth Katti Redfish.patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 4775f7d2e4cSPrashanth Katti ... body=&{data} valid_status_codes=${valid_status_codes} 4785f7d2e4cSPrashanth Katti 4795f7d2e4cSPrashanth Katti # Note: Network restart takes around 15-18s after patch request processing. 4805f7d2e4cSPrashanth Katti Sleep ${NETWORK_TIMEOUT}s 4815f7d2e4cSPrashanth Katti Wait For Host To Ping ${OPENBMC_HOST} ${NETWORK_TIMEOUT} 4825f7d2e4cSPrashanth Katti 4835f7d2e4cSPrashanth Katti # Verify if new IPv6 address is configured on BMC. 4845f7d2e4cSPrashanth Katti Verify IPv6 On BMC ${new_ipv6} 4855f7d2e4cSPrashanth Katti 4865f7d2e4cSPrashanth Katti # Verify if old IPv6 address is erased. 4875f7d2e4cSPrashanth Katti ${cmd_status}= Run Keyword And Return Status 4885f7d2e4cSPrashanth Katti ... Verify IPv6 On BMC ${ipv6} 4895f7d2e4cSPrashanth Katti Should Be Equal ${cmd_status} ${False} msg=Old IPv6 address is not deleted. 4905f7d2e4cSPrashanth Katti 4915f7d2e4cSPrashanth Katti Validate IPv6 Network Config On BMC 4928ba74328SSweta Potthuri 4938ba74328SSweta Potthuri 4948ba74328SSweta PotthuriSet SLAACv6 Configuration State And Verify 4958ba74328SSweta Potthuri [Documentation] Set SLAACv6 configuration state and verify. 4968ba74328SSweta Potthuri [Arguments] ${slaac_state} ${valid_status_codes}=${HTTP_OK} 4978ba74328SSweta Potthuri 4988ba74328SSweta Potthuri # Description of argument(s): 4998ba74328SSweta Potthuri # slaac_state SLAACv6 state('True' or 'False'). 5008ba74328SSweta Potthuri # valid_status_code Expected valid status codes. 5018ba74328SSweta Potthuri 5028ba74328SSweta Potthuri ${active_channel_config}= Get Active Channel Config 5038ba74328SSweta Potthuri ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} 5048ba74328SSweta Potthuri 5058ba74328SSweta Potthuri ${data}= Set Variable If ${slaac_state} == ${False} ${DISABLE_SLAAC} ${ENABLE_SLAAC} 5068ba74328SSweta Potthuri ${resp}= Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 5078ba74328SSweta Potthuri ... body=${data} valid_status_codes=[${valid_status_codes}] 5088ba74328SSweta Potthuri 5098ba74328SSweta Potthuri # Verify SLAACv6 is set correctly. 5108ba74328SSweta Potthuri ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 5118ba74328SSweta Potthuri ${slaac_verify}= Get From Dictionary ${resp.dict} StatelessAddressAutoConfig 5128ba74328SSweta Potthuri 5138ba74328SSweta Potthuri Run Keyword If '${slaac_verify['IPv6AutoConfigEnabled']}' != '${slaac_state}' 5148ba74328SSweta Potthuri ... Fail msg=SLAACv6 not set properly. 5150df4a868SSweta Potthuri 516cb61ff0fSSweta Potthuri 5170df4a868SSweta PotthuriSet And Verify DHCPv6 Property 5180df4a868SSweta Potthuri [Documentation] Set DHCPv6 attribute and verify. 5190df4a868SSweta Potthuri [Arguments] ${dhcpv6_operating_mode}=${Disabled} 5200df4a868SSweta Potthuri 5210df4a868SSweta Potthuri # Description of argument(s): 5220df4a868SSweta Potthuri # dhcpv6_operating_mode Enabled if user wants to enable DHCPv6('Enabled' or 'Disabled'). 5230df4a868SSweta Potthuri 5240df4a868SSweta Potthuri ${data}= Set Variable If '${dhcpv6_operating_mode}' == 'Disabled' ${DISABLE_DHCPv6} ${ENABLE_DHCPv6} 5250df4a868SSweta Potthuri ${active_channel_config}= Get Active Channel Config 5260df4a868SSweta Potthuri ${ethernet_interface}= Set Variable ${active_channel_config['${CHANNEL_NUMBER}']['name']} 5270df4a868SSweta Potthuri 5280df4a868SSweta Potthuri Redfish.Patch ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 5290df4a868SSweta Potthuri ... body=${data} valid_status_codes=[${HTTP_OK},${HTTP_NO_CONTENT}] 5300df4a868SSweta Potthuri 5310df4a868SSweta Potthuri ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface} 5320df4a868SSweta Potthuri ${dhcpv6_verify}= Get From Dictionary ${resp.dict} DHCPv6 5330df4a868SSweta Potthuri 5340df4a868SSweta Potthuri Should Be Equal '${dhcpv6_verify['OperatingMode']}' '${dhcpv6_operating_mode}' 535cb61ff0fSSweta Potthuri 536