Exabgp ipv6 connect test 87/68887/41
authorTomas Markovic <tomas.markovic@pantheon.tech>
Wed, 28 Feb 2018 15:48:30 +0000 (16:48 +0100)
committerLuis Gomez <ecelgp@gmail.com>
Sun, 8 Apr 2018 19:33:34 +0000 (19:33 +0000)
Tests simple ipv6 functionality.

Configures neighbor as ibgp peer with ipv6
address. Starts exabgp with various ipv6
configurations, and verifies all of them report
expected data.

Change-Id: I0107a5adfe9b07526e742d07f619da48c1e4434d
Signed-off-by: Tomas Markovic <tomas.markovic@pantheon.tech>
12 files changed:
csit/suites/bgpcep/bgpfunct/bgp_ipv6_basic.robot [new file with mode: 0644]
csit/testplans/bgpcep-userfeatures-fluorine.txt
csit/testplans/bgpcep-userfeatures-oxygen.txt
csit/testplans/bgpcep-userfeatures.txt
csit/variables/bgpfunctional/ipv6/bgp_peer/data.xml [new file with mode: 0644]
csit/variables/bgpfunctional/ipv6/bgp_peer/location.uri [new file with mode: 0644]
csit/variables/bgpfunctional/ipv6/exaipv6.cfg [new file with mode: 0644]
csit/variables/bgpfunctional/ipv6/ipv6_topology_empty/data.json [new file with mode: 0644]
csit/variables/bgpfunctional/ipv6/ipv6_topology_empty/location.uri [new file with mode: 0644]
csit/variables/bgpfunctional/ipv6/ipv6_topology_filled/data.json [new file with mode: 0644]
csit/variables/bgpfunctional/ipv6/ipv6_topology_filled/location.uri [new file with mode: 0644]
csit/variables/bgpfunctional/ipv6/rib_state/location.uri [new file with mode: 0644]

diff --git a/csit/suites/bgpcep/bgpfunct/bgp_ipv6_basic.robot b/csit/suites/bgpcep/bgpfunct/bgp_ipv6_basic.robot
new file mode 100644 (file)
index 0000000..c772d75
--- /dev/null
@@ -0,0 +1,165 @@
+*** Settings ***
+Documentation     Functional test for ipv6 connection with bgp.
+...
+...               Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
+...
+...               This program and the accompanying materials are made available under the
+...               terms of the Eclipse Public License v1.0 which accompanies this distribution,
+...               and is available at http://www.eclipse.org/legal/epl-v10.html
+...
+...               This suite tests simple connection between one ibgp peer (exabgp) and Odl.
+...               Peer is configured with ipv6, and exabgp connectes to odl via ipv6.
+...               Exabgp sends one ipv6 unicast route, which presence is verified in
+...               example-ipv6-topology. Tests this connection multiple times, with
+...               different ipv6 accepted formats, e.g. (::1, 0:0:0:0:0:0:0:1, full text)
+Suite Setup       Start_Suite
+Suite Teardown    Stop_Suite
+Test Setup        SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
+Library           RequestsLibrary
+Library           SSHLibrary
+Resource          ../../../variables/Variables.robot
+Resource          ../../../libraries/BGPcliKeywords.robot
+Resource          ../../../libraries/ExaBgpLib.robot
+Resource          ../../../libraries/SetupUtils.robot
+Resource          ../../../libraries/SSHKeywords.robot
+Resource          ../../../libraries/TemplatedRequests.robot
+
+*** Variables ***
+${BGP_VAR_FOLDER}    ${CURDIR}/../../../variables/bgpfunctional/ipv6
+${CONFIG_SESSION}    config-session
+${CONTROLLER_IPV6}    ::1
+${EXABGP_ID}      1.2.3.4
+${EXABGP_CFG}     exaipv6.cfg
+${EXABGP_LOG}     exaipv6.log
+${IPV6_IP}        2607:f0d0:1002:0011:0000:0000:0000:0002
+${IPV6_IP_2}      2607:f0d0:1002:11:0:0:0:2
+${IPV6_IP_3}      2607:f0d0:1002:11::2
+${IPV6_IP_GW}     2607:f0d0:1002:0011:0000:0000:0000:0001
+${HOLDTIME}       180
+${RIB_INSTANCE}    example-bgp-rib
+
+*** Test Cases ***
+Reconfigure_ODL_To_Accept_Connections
+    [Documentation]    Configure BGP peer modules with initiate-connection set to false with short ipv6 address.
+    &{mapping}    Create Dictionary    IP=${IPV6_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}    INITIATE=false    BGP_RIB=${RIB_INSTANCE}
+    ...    PASSIVE_MODE=true    BGP_RIB_OPENCONFIG=${RIB_INSTANCE}    RIB_INSTANCE_NAME=${RIB_INSTANCE}
+    TemplatedRequests.Put_As_Xml_Templated    ${BGP_VAR_FOLDER}/bgp_peer    mapping=${mapping}    session=${CONFIG_SESSION}
+
+Start_Exabgp
+    [Documentation]    Start exabgp with
+    [Tags]    critical
+    ${cmd}    BuiltIn.Set_Variable    ${EXABGP_CFG} > ${EXABGP_LOG}
+    ExaBgpLib.Start_ExaBgp_And_Verify_Connected    ${cmd}    ${CONFIG_SESSION}    ${EXABGP_ID}
+
+Verify_Ipv6_Topology_Filled
+    [Documentation]    Verifies that example-ipv6-topology is filled after starting exabgp.
+    [Tags]    critical
+    Verify_Rib_Status_Filled
+
+Delete_Bgp_Peer_Configuration
+    [Documentation]    Revert the BGP configuration to the original state: without any configured peers.
+    &{mapping}    Create Dictionary    IP=${IPV6_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}    INITIATE=false    BGP_RIB=${RIB_INSTANCE}
+    ...    PASSIVE_MODE=true    BGP_RIB_OPENCONFIG=${RIB_INSTANCE}    RIB_INSTANCE_NAME=${RIB_INSTANCE}
+    TemplatedRequests.Delete_Templated    ${BGP_VAR_FOLDER}/bgp_peer    mapping=${mapping}    session=${CONFIG_SESSION}
+
+Verify_Ipv6_Topology_Empty
+    [Documentation]    Verifies that example-ipv6-topology is empty after deconfiguring peer for the first time.
+    [Tags]    critical
+    Verify_Rib_Status_Empty
+
+Reconfigure_ODL_To_Accept_Connections_2
+    [Documentation]    Configure BGP peer modules with initiate-connection set to false with ipv6 address without "::" shortened version.
+    &{mapping}    Create Dictionary    IP=${IPV6_IP_2}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}    INITIATE=false    BGP_RIB=${RIB_INSTANCE}
+    ...    PASSIVE_MODE=true    BGP_RIB_OPENCONFIG=${RIB_INSTANCE}    RIB_INSTANCE_NAME=${RIB_INSTANCE}
+    TemplatedRequests.Put_As_Xml_Templated    ${BGP_VAR_FOLDER}/bgp_peer    mapping=${mapping}    session=${CONFIG_SESSION}
+
+Verify_Ipv6_Topology_Filled_2
+    [Documentation]    Verifies that example-ipv6-topology is filled after configuring the peer for the second time.
+    [Tags]    critical
+    Verify_Rib_Status_Filled
+
+Delete_Bgp_Peer_Configuration_2
+    [Documentation]    Revert the BGP configuration to the original state: without any configured peers.
+    &{mapping}    Create Dictionary    IP=${IPV6_IP_2}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}    INITIATE=false    BGP_RIB=${RIB_INSTANCE}
+    ...    PASSIVE_MODE=true    BGP_RIB_OPENCONFIG=${RIB_INSTANCE}    RIB_INSTANCE_NAME=${RIB_INSTANCE}
+    TemplatedRequests.Delete_Templated    ${BGP_VAR_FOLDER}/bgp_peer    mapping=${mapping}    session=${CONFIG_SESSION}
+
+Verify_Ipv6_Topology_Empty_2
+    [Documentation]    Verifies that example-ipv6-topology is empty after deconfiguring peer for the second time.
+    [Tags]    critical
+    Verify_Rib_Status_Empty
+
+Reconfigure_ODL_To_Accept_Connections_3
+    [Documentation]    Configure BGP peer modules with initiate-connection set to false with full text ipv6 address.
+    &{mapping}    Create Dictionary    IP=${IPV6_IP_3}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}    INITIATE=false    BGP_RIB=${RIB_INSTANCE}
+    ...    PASSIVE_MODE=true    BGP_RIB_OPENCONFIG=${RIB_INSTANCE}    RIB_INSTANCE_NAME=${RIB_INSTANCE}
+    TemplatedRequests.Put_As_Xml_Templated    ${BGP_VAR_FOLDER}/bgp_peer    mapping=${mapping}    session=${CONFIG_SESSION}
+
+Verify_Ipv6_Topology_Filled_3
+    [Documentation]    Verifies that example-ipv6-topology is filled after configuring the peer for the third time.
+    [Tags]    critical
+    Verify_Rib_Status_Filled
+
+Delete_Bgp_Peer_Configuration_3
+    [Documentation]    Revert the BGP configuration to the original state: without any configured peers.
+    &{mapping}    Create Dictionary    IP=${IPV6_IP_3}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}    INITIATE=false    BGP_RIB=${RIB_INSTANCE}
+    ...    PASSIVE_MODE=true    BGP_RIB_OPENCONFIG=${RIB_INSTANCE}    RIB_INSTANCE_NAME=${RIB_INSTANCE}
+    TemplatedRequests.Delete_Templated    ${BGP_VAR_FOLDER}/bgp_peer    mapping=${mapping}    session=${CONFIG_SESSION}
+
+Verify_Ipv6_Topology_Empty_3
+    [Documentation]    Verifies that example-ipv6-topology is empty after final deconfiguration.
+    [Tags]    critical
+    Verify_Rib_Status_Empty
+
+Stop_All_Exabgps
+    [Documentation]    Save exabgp logs as exaipv6.log, and stop exabgp with ctrl-c bash signal
+    BGPcliKeywords.Store_File_To_Workspace    ${EXABGP_LOG}    ${EXABGP_LOG}
+    ExaBgpLib.Stop_ExaBgp
+
+*** Keywords ***
+Start_Suite
+    [Documentation]    Suite setup keyword.
+    SetupUtils.Setup_Utils_For_Setup_And_Teardown
+    ${conn_id}=    SSHLibrary.Open Connection    ${ODL_SYSTEM_IP}    prompt=${DEFAULT_LINUX_PROMPT}    timeout=10s
+    Builtin.Set_Suite_Variable    ${conn_id}
+    SSHKeywords.Flexible_Controller_Login
+    Configure_Ipv6_Network
+    SSHKeywords.Virtual_Env_Create
+    SSHKeywords.Virtual_Env_Install_Package    exabgp==4.0.5
+    RequestsLibrary.Create_Session    ${CONFIG_SESSION}    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}
+    Upload_Config_Files
+
+Stop_Suite
+    [Documentation]    Suite teardown keyword
+    SSHKeywords.Virtual_Env_Delete
+    SSHLibrary.Close_All_Connections
+    RequestsLibrary.Delete_All_Sessions
+
+Configure_Ipv6_Network
+    [Documentation]    Reconfigures basic network settings on controller
+    SSHLibrary.Execute_Command    sudo sh -c 'echo "NETWORKING_IPV6=yes" >> /etc/sysconfig/network'
+    SSHLibrary.Execute_Command    sudo sh -c 'echo "IPV6INIT=yes" >> /etc/sysconfig/network-scripts/ifcfg-eth0'
+    SSHLibrary.Execute_Command    sudo sh -c 'echo "IPV6ADDR=${IPV6_IP}" >> /etc/sysconfig/network-scripts/ifcfg-eth0'
+    SSHLibrary.Execute_Command    sudo sh -c 'echo "IPV6_DEFAULTGW=${IPV6_IP_GW}" >> /etc/sysconfig/network-scripts/ifcfg-eth0'
+    SSHLibrary.Execute_Command    sudo /etc/init.d/network restart
+
+Verify_Rib_Status_Empty
+    [Documentation]    Verifies that example-ipv6-topology is empty
+    BuiltIn.Wait_Until_Keyword_Succeeds    5x    2s    TemplatedRequests.Get_As_Json_Templated    ${BGP_VAR_FOLDER}/ipv6_topology_empty    session=${CONFIG_SESSION}    verify=True
+
+Verify_Rib_Status_Filled
+    [Documentation]    Verifies that example-ipv6-topology is filled with ipv6 route
+    BuiltIn.Wait_Until_Keyword_Succeeds    5x    2s    TemplatedRequests.Get_As_Json_Templated    ${BGP_VAR_FOLDER}/ipv6_topology_filled    session=${CONFIG_SESSION}    verify=True
+
+Upload_Config_Files
+    [Documentation]    Uploads exabgp config files
+    SSHLibrary.Put_File    ${BGP_VAR_FOLDER}/${EXABGP_CFG}    .
+    @{cfgfiles}=    SSHLibrary.List_Files_In_Directory    .    *.cfg
+    : FOR    ${cfgfile}    IN    @{cfgfiles}
+    \    SSHLibrary.Execute_Command    sed -i -e 's/EXABGPIP/${IPV6_IP}/g' ${cfgfile}
+    \    SSHLibrary.Execute_Command    sed -i -e 's/ODLIP/${CONTROLLER_IPV6}/g' ${cfgfile}
+    \    SSHLibrary.Execute_Command    sed -i -e 's/ROUTERID/${EXABGP_ID}/g' ${cfgfile}
+    \    SSHLibrary.Execute_Command    sed -i -e 's/ROUTEREFRESH/disable/g' ${cfgfile}
+    \    SSHLibrary.Execute_Command    sed -i -e 's/ADDPATH/disable/g' ${cfgfile}
+    \    ${stdout}=    SSHLibrary.Execute_Command    cat ${cfgfile}
+    \    Log    ${stdout}
index 4e794a7f97bd4b866520107cbda484e5799c6522..1e2ecd08d90fb98eca6f5a5884421d9b6748b9c2 100644 (file)
@@ -9,6 +9,7 @@ integration/test/csit/suites/bgpcep/bgpfunct/050_bmp_basic.robot
 integration/test/csit/suites/bgpcep/pcepuser/pcepuser.robot
 integration/test/csit/suites/bgpcep/bgpfunct/bgp_functional_md5.robot
 integration/test/csit/suites/bgpcep/bgpuser/basic.robot
+integration/test/csit/suites/bgpcep/bgpfunct/bgp_ipv6_basic.robot
 integration/test/csit/suites/bgpcep/bgpuser/bgp_app_peer_basic.robot
 integration/test/csit/suites/bgpcep/bgpuser/ibgp_peers_basic.robot
 integration/test/csit/suites/bgpcep/bgpuser/ebgp_peers_basic.robot
index 4e794a7f97bd4b866520107cbda484e5799c6522..1e2ecd08d90fb98eca6f5a5884421d9b6748b9c2 100644 (file)
@@ -9,6 +9,7 @@ integration/test/csit/suites/bgpcep/bgpfunct/050_bmp_basic.robot
 integration/test/csit/suites/bgpcep/pcepuser/pcepuser.robot
 integration/test/csit/suites/bgpcep/bgpfunct/bgp_functional_md5.robot
 integration/test/csit/suites/bgpcep/bgpuser/basic.robot
+integration/test/csit/suites/bgpcep/bgpfunct/bgp_ipv6_basic.robot
 integration/test/csit/suites/bgpcep/bgpuser/bgp_app_peer_basic.robot
 integration/test/csit/suites/bgpcep/bgpuser/ibgp_peers_basic.robot
 integration/test/csit/suites/bgpcep/bgpuser/ebgp_peers_basic.robot
index 5819f0456c01706db717a31766e9eb712190cf85..6d9d7af159ff53a7f9c77c53fee4172a4976c448 100644 (file)
@@ -9,6 +9,7 @@ integration/test/csit/suites/bgpcep/bgpfunct/050_bmp_basic.robot
 integration/test/csit/suites/bgpcep/pcepuser/pcepuser.robot
 integration/test/csit/suites/bgpcep/bgpfunct/bgp_functional_md5.robot
 integration/test/csit/suites/bgpcep/bgpuser/basic.robot
+integration/test/csit/suites/bgpcep/bgpfunct/bgp_ipv6_basic.robot
 integration/test/csit/suites/bgpcep/bgpuser/bgp_app_peer_basic.robot
 integration/test/csit/suites/bgpcep/bgpuser/ibgp_peers_basic.robot
 integration/test/csit/suites/bgpcep/bgpuser/ebgp_peers_basic.robot
diff --git a/csit/variables/bgpfunctional/ipv6/bgp_peer/data.xml b/csit/variables/bgpfunctional/ipv6/bgp_peer/data.xml
new file mode 100644 (file)
index 0000000..775ff6c
--- /dev/null
@@ -0,0 +1,31 @@
+<neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
+    <neighbor-address>$IP</neighbor-address>
+    <route-reflector>
+        <config>
+            <route-reflector-client>false</route-reflector-client>
+        </config>
+    </route-reflector>
+    <timers>
+        <config>
+            <hold-time>$HOLDTIME</hold-time>
+            <connect-retry>5</connect-retry>
+        </config>
+    </timers>
+    <transport>
+        <config>
+            <remote-port>$PEER_PORT</remote-port>
+            <passive-mode>$PASSIVE_MODE</passive-mode>
+        </config>
+    </transport>
+    <config>
+        <peer-type>INTERNAL</peer-type>
+    </config>
+    <afi-safis>
+        <afi-safi>
+            <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV4-UNICAST</afi-safi-name>
+        </afi-safi>
+        <afi-safi>
+            <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV6-UNICAST</afi-safi-name>
+        </afi-safi>
+    </afi-safis>
+</neighbor>
diff --git a/csit/variables/bgpfunctional/ipv6/bgp_peer/location.uri b/csit/variables/bgpfunctional/ipv6/bgp_peer/location.uri
new file mode 100644 (file)
index 0000000..d713ddf
--- /dev/null
@@ -0,0 +1 @@
+restconf/config/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols/protocol/openconfig-policy-types:BGP/$BGP_RIB_OPENCONFIG/bgp/neighbors/neighbor/$IP
diff --git a/csit/variables/bgpfunctional/ipv6/exaipv6.cfg b/csit/variables/bgpfunctional/ipv6/exaipv6.cfg
new file mode 100644 (file)
index 0000000..ada3cad
--- /dev/null
@@ -0,0 +1,19 @@
+neighbor ODLIP {
+    router-id ROUTERID;
+    local-address EXABGPIP;
+    local-as 64496;
+    peer-as 64496;
+
+    capability {
+        route-refresh ROUTEREFRESH;
+        add-path ADDPATH;
+    }
+
+    family {
+        ipv6 unicast;
+    }
+
+    static {
+        route 2a04:6d80::1/128 next-hop self;
+    }
+}
diff --git a/csit/variables/bgpfunctional/ipv6/ipv6_topology_empty/data.json b/csit/variables/bgpfunctional/ipv6/ipv6_topology_empty/data.json
new file mode 100644 (file)
index 0000000..5b63cca
--- /dev/null
@@ -0,0 +1,12 @@
+{
+    "topology": [
+        {
+            "server-provided": true,
+            "topology-id": "example-ipv6-topology",
+            "topology-types": {
+                "odl-bgp-topology-types:bgp-ipv6-reachability-topology": {}
+            }
+        }
+    ]
+}
+
diff --git a/csit/variables/bgpfunctional/ipv6/ipv6_topology_empty/location.uri b/csit/variables/bgpfunctional/ipv6/ipv6_topology_empty/location.uri
new file mode 100644 (file)
index 0000000..56a3cc0
--- /dev/null
@@ -0,0 +1 @@
+restconf/operational/network-topology:network-topology/topology/example-ipv6-topology
diff --git a/csit/variables/bgpfunctional/ipv6/ipv6_topology_filled/data.json b/csit/variables/bgpfunctional/ipv6/ipv6_topology_filled/data.json
new file mode 100644 (file)
index 0000000..05ec399
--- /dev/null
@@ -0,0 +1,23 @@
+{
+    "topology": [
+        {
+            "node": [
+                {
+                    "l3-unicast-igp-topology:igp-node-attributes": {
+                        "prefix": [
+                            {
+                                "prefix": "2a04:6d80::1/128"
+                            }
+                        ]
+                    },
+                    "node-id": "2607:f0d0:1002:11::2"
+                }
+            ],
+            "server-provided": true,
+            "topology-id": "example-ipv6-topology",
+            "topology-types": {
+                "odl-bgp-topology-types:bgp-ipv6-reachability-topology": {}
+            }
+        }
+    ]
+}
diff --git a/csit/variables/bgpfunctional/ipv6/ipv6_topology_filled/location.uri b/csit/variables/bgpfunctional/ipv6/ipv6_topology_filled/location.uri
new file mode 100644 (file)
index 0000000..56a3cc0
--- /dev/null
@@ -0,0 +1 @@
+restconf/operational/network-topology:network-topology/topology/example-ipv6-topology
diff --git a/csit/variables/bgpfunctional/ipv6/rib_state/location.uri b/csit/variables/bgpfunctional/ipv6/rib_state/location.uri
new file mode 100644 (file)
index 0000000..48fa884
--- /dev/null
@@ -0,0 +1 @@
+restconf/operational/bgp-rib:bgp-rib/rib/example-bgp-rib