Add new suite to test bgp md5 using exabgp 81/50181/16
authorPeter Gubka <pgubka@cisco.com>
Tue, 10 Jan 2017 13:25:12 +0000 (14:25 +0100)
committerJamo Luhrsen <jluhrsen@redhat.com>
Fri, 13 Jan 2017 18:53:30 +0000 (18:53 +0000)
Change-Id: Ib2b67354adbe67427c2d88a781e4290f540505ee
Signed-off-by: Peter Gubka <pgubka@cisco.com>
csit/suites/bgpcep/bgpfunct/bgp_functional_md5.robot [new file with mode: 0644]
csit/testplans/bgpcep-userfeatures.txt
csit/variables/bgpfunctional/bgp_md5/bgp_peer/data.xml [new file with mode: 0644]
csit/variables/bgpfunctional/bgp_md5/bgp_peer/location.uri [new file with mode: 0644]
csit/variables/bgpfunctional/bgp_md5/exa-md5.cfg [new file with mode: 0644]

diff --git a/csit/suites/bgpcep/bgpfunct/bgp_functional_md5.robot b/csit/suites/bgpcep/bgpfunct/bgp_functional_md5.robot
new file mode 100644 (file)
index 0000000..5e4cfc1
--- /dev/null
@@ -0,0 +1,97 @@
+*** Settings ***
+Documentation     Functional test suite for bgp - n-path and all-path selection
+...
+...               Copyright (c) 2017 Cisco Systems, Inc. and others. 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 tcpmd5 connection of bgp peers. It uses odl and exabgp as bgp
+...               peer. No routes are advertized, simple peer presence in the datastore is tested.
+...               are configured via application peer.
+Suite Setup       Start_Suite
+Suite Teardown    Stop_Suite
+Test Setup        SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
+Test Teardown     Delete_Bgp_Peer_Configuration
+Library           RequestsLibrary
+Library           SSHLibrary
+Resource          ${CURDIR}/../../../variables/Variables.robot
+Resource          ${CURDIR}/../../../libraries/BGPcliKeywords.robot
+Resource          ${CURDIR}/../../../libraries/CompareStream.robot
+Resource          ${CURDIR}/../../../libraries/ExaBgpLib.robot
+Resource          ${CURDIR}/../../../libraries/SetupUtils.robot
+Resource          ${CURDIR}/../../../libraries/SSHKeywords.robot
+Resource          ${CURDIR}/../../../libraries/TemplatedRequests.robot
+Resource          ${CURDIR}/../../../libraries/Utils.robot
+Resource          ${CURDIR}/../../../libraries/WaitForFailure.robot
+
+*** Variables ***
+${HOLDTIME}       180
+${BGP_VAR_FOLDER}    ${CURDIR}/../../../variables/bgpfunctional/bgp_md5
+${BGP_PEER_FOLDER}    ${BGP_VAR_FOLDER}${/}bgp_peer
+${BGP_EXAMD5_CFG}    exa-md5.cfg
+${MD5_SAME_PASSWD}    topsecret
+${MD5_DIFF_PASSWD}    different
+${PROTOCOL_OPENCONFIG}    example-bgp-rib
+${CONFIG_SESSION}    session
+
+*** Test Cases ***
+Verify Exabgp Connected
+    [Documentation]    Verifies exabgp connected with md5 settings
+    [Tags]    critical
+    [Setup]    Reconfigure_ODL_To_Accept_Connection    ${MD5_SAME_PASSWD}
+    ExaBgpLib.Start_ExaBgp_And_Verify_Connected    ${BGP_EXAMD5_CFG}    ${CONFIG_SESSION}    ${TOOLS_SYSTEM_IP}    connection_retries=${3}
+    ExaBgpLib.Stop_ExaBgp
+
+Verify Exabgp Not Connected
+    [Documentation]    Verifies exabgp connected with md5 settings
+    [Tags]    critical
+    [Setup]    Reconfigure_ODL_To_Accept_Connection    ${MD5_DIFF_PASSWD}
+    ExaBgpLib.Start_ExaBgp    ${BGP_EXAMD5_CFG}
+    WaitForFailure.Verify_Keyword_Never_Passes_Within_Timeout    15s    2s    ExaBgpLib.Verify_ExaBgps_Connection    ${CONFIG_SESSION}    ${TOOLS_SYSTEM_IP}
+    ExaBgpLib.Stop_ExaBgp
+
+*** Keywords ***
+Start_Suite
+    [Documentation]    Suite setup keyword.
+    SetupUtils.Setup_Utils_For_Setup_And_Teardown
+    ${tools_system_conn_id}=    SSHLibrary.Open_Connection    ${TOOLS_SYSTEM_IP}    prompt=${DEFAULT_LINUX_PROMPT}    timeout=6s
+    Builtin.Set_Suite_Variable    ${tools_system_conn_id}
+    Utils.Flexible_Mininet_Login    ${TOOLS_SYSTEM_USER}
+    SSHKeywords.Virtual_Env_Create
+    SSHKeywords.Virtual_Env_Install_Package    exabgp==3.4.17
+    RequestsLibrary.Create_Session    ${CONFIG_SESSION}    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}
+    Upload_Config_Files
+
+Stop_Suite
+    [Documentation]    Suite teardown keyword with old rib restoration
+    SSHKeywords.Virtual_Env_Delete
+    SSHLibrary.Close_All_Connections
+    RequestsLibrary.Delete_All_Sessions
+
+Reconfigure_ODL_To_Accept_Connection
+    [Arguments]    ${password}
+    [Documentation]    Configures BGP peer module with initiate-connection set to false.
+    &{mapping}    BuiltIn.Create_Dictionary    BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG}    IP=${TOOLS_SYSTEM_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}    PASSWORD=${password}
+    ...    PASSIVE_MODE=true
+    TemplatedRequests.Put_As_Xml_Templated    ${BGP_PEER_FOLDER}    mapping=${mapping}    session=${CONFIG_SESSION}
+
+Delete_Bgp_Peer_Configuration
+    [Documentation]    Revert the BGP configuration to the original state: without any configured peers.
+    &{mapping}    BuiltIn.Create_Dictionary    BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG}    IP=${TOOLS_SYSTEM_IP}
+    TemplatedRequests.Delete_Templated    ${BGP_PEER_FOLDER}    mapping=${mapping}    session=${CONFIG_SESSION}
+
+Upload_Config_Files
+    [Arguments]    ${addpath}=disable
+    [Documentation]    Uploads exabgp config files
+    SSHLibrary.Put_File    ${BGP_VAR_FOLDER}${/}exa-md5.cfg    .
+    @{cfgfiles}=    SSHLibrary.List_Files_In_Directory    .    *.cfg
+    : FOR    ${cfgfile}    IN    @{cfgfiles}
+    \    SSHLibrary.Execute_Command    sed -i -e 's/EXABGPIP/${TOOLS_SYSTEM_IP}/g' ${cfgfile}
+    \    SSHLibrary.Execute_Command    sed -i -e 's/ODLIP/${ODL_SYSTEM_IP}/g' ${cfgfile}
+    \    SSHLibrary.Execute_Command    sed -i -e 's/ROUTEREFRESH/enable/g' ${cfgfile}
+    \    SSHLibrary.Execute_Command    sed -i -e 's/ADDPATH/disable/g' ${cfgfile}
+    \    SSHLibrary.Execute_Command    sed -i -e 's/PASSWORD/${MD5_SAME_PASSWD}/g' ${cfgfile}
+    \    ${stdout}=    SSHLibrary.Execute_Command    cat ${cfgfile}
+    \    Log    ${stdout}
index fcc05d4c3cd34510b08fdfe92b8706871ba94b35..175497e94e03500da676bf77e9e1f38864056f65 100644 (file)
@@ -8,7 +8,7 @@
 integration/test/csit/suites/netconf/ready/netconfready.robot
 integration/test/csit/suites/bgpcep/bgpfunct/050_bmp_basic.robot
 integration/test/csit/suites/bgpcep/pcepuser/pcepuser.robot
-integration/test/csit/suites/bgpcep/tcpmd5user/tcpmd5user.robot
+integration/test/csit/suites/bgpcep/bgpfunct/bgp_functional_md5.robot
 integration/test/csit/suites/bgpcep/bgpuser/cases.robot
 integration/test/csit/suites/bgpcep/bgpuser/bgp_app_peer_basic.robot
 integration/test/csit/suites/bgpcep/bgpuser/ibgp_peers_basic.robot
@@ -19,3 +19,4 @@ integration/test/csit/suites/bgpcep/bgpfunct/010_bgp_functional_l3vpn.robot
 integration/test/csit/suites/bgpcep/bgpfunct/030_bgp_functional_evpn.robot
 integration/test/csit/suites/bgpcep/bgpfunct/040_bgp_functional_route_ref.robot
 integration/test/csit/suites/bgpcep/bgpfunct/020_bgp_functional_multipath.robot
+integration/test/csit/suites/bgpcep/tcpmd5user/tcpmd5user.robot
diff --git a/csit/variables/bgpfunctional/bgp_md5/bgp_peer/data.xml b/csit/variables/bgpfunctional/bgp_md5/bgp_peer/data.xml
new file mode 100644 (file)
index 0000000..17f22bc
--- /dev/null
@@ -0,0 +1,28 @@
+<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>
+        </config>
+    </timers>
+    <transport>
+        <config>
+            <remote-port>$PEER_PORT</remote-port>
+            <passive-mode>$PASSIVE_MODE</passive-mode>
+        </config>
+    </transport>
+    <config>
+        <peer-type>INTERNAL</peer-type>
+        <auth-password>$PASSWORD</auth-password>
+    </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-safis>
+</neighbor>
diff --git a/csit/variables/bgpfunctional/bgp_md5/bgp_peer/location.uri b/csit/variables/bgpfunctional/bgp_md5/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/bgp_md5/exa-md5.cfg b/csit/variables/bgpfunctional/bgp_md5/exa-md5.cfg
new file mode 100644 (file)
index 0000000..904f88f
--- /dev/null
@@ -0,0 +1,16 @@
+neighbor ODLIP {
+  router-id EXABGPIP;
+  local-address EXABGPIP;
+  local-as 64496;
+  peer-as 64496;
+  md5 PASSWORD;
+
+  capability {
+    route-refresh ROUTEREFRESH;
+    add-path ADDPATH;
+  }
+
+  family {
+    ipv4 unicast;
+  }
+}