Peer group reconfig test case 97/69797/21
authorTomas Markovic <tomas.markovic@pantheon.tech>
Thu, 22 Mar 2018 09:33:55 +0000 (10:33 +0100)
committerLuis Gomez <ecelgp@gmail.com>
Mon, 2 Apr 2018 03:30:10 +0000 (03:30 +0000)
Add test cases for peer-group
configuration and reconfiguration.

Configures peer-group assigns peer to it.
Checks working peer with filled topology.
Reconfigures peer-group without appropriate
afi-safi, and checks empty topology.

Change-Id: I87588b24847c61eb4ad6532ed653ad9989c4fd92
Signed-off-by: Tomas Markovic <tomas.markovic@pantheon.tech>
csit/suites/bgpcep/bgpuser/basic.robot
csit/variables/bgpuser/bgp_peer_group/data.xml [new file with mode: 0644]
csit/variables/bgpuser/bgp_peer_group/location.uri [new file with mode: 0644]
csit/variables/bgpuser/peer_group/data.xml [new file with mode: 0644]
csit/variables/bgpuser/peer_group/location.uri [new file with mode: 0644]
csit/variables/bgpuser/peer_group_without_ipv4/data.xml [new file with mode: 0644]
csit/variables/bgpuser/peer_group_without_ipv4/location.uri [new file with mode: 0644]
csit/variables/bgpuser/verify_peer_group/data.json [new file with mode: 0644]
csit/variables/bgpuser/verify_peer_group/location.uri [new file with mode: 0644]
csit/variables/bgpuser/verify_peer_group_without_ipv4/data.json [new file with mode: 0644]
csit/variables/bgpuser/verify_peer_group_without_ipv4/location.uri [new file with mode: 0644]

index acf4e71f0d9b30ec14a23745684a0aea0f73e581..b8542a89ee594fc1b4fa2668de8a328bd7e3e5df 100644 (file)
@@ -8,15 +8,27 @@ Documentation     Basic tests for odl-bgpcep-bgp-all feature.
 ...               and is available at http://www.eclipse.org/legal/epl-v10.html
 ...
 ...               Test suite performs basic BGP functional test cases:
-...               BGP peer initiated coonection
+...               BGP peer initiated connection
 ...               - introduce and check 3 prefixes in one update message
-...               ODL controller initiated coonection:
+...               ODL controller initiated connection:
 ...               - introduce and check 3 prefixes in one update message
 ...               - introduce 2 prefixes in first update message and then additional 2 prefixes
 ...               in another update while the very first prefix is withdrawn
 ...               - introduce 3 prefixes and try to withdraw the first one
 ...               (to be ignored by controller) in a single update message
 ...
+...               For versions Oxygen and further, there are TC_R (test case reset) which
+...               test session-reset functionality.
+...               Resets the session, and than verifies that example-ipv4-topology is empty again.
+...
+...               For versions Fluorine and further, there are TC_PG (test case peer group) which
+...               test configuration and reconfiguration of peer-groups and neighbors configured by them.
+...               - configure peer-group, and assign neighbor to this peer-group
+...               - check filled topology
+...               - reconfigure peer-group without ipv4 unicast afi-safi
+...               - check empty topology
+...               - reconfigre neighbor without peer-group, delete peer-group
+...
 ...               Brief description how to perform BGP functional test:
 ...               https://wiki.opendaylight.org/view/BGP_LS_PCEP:Lithium_Feature_Tests#How_to_test_2
 ...
@@ -30,19 +42,19 @@ Test Teardown     FailFast.Start_Failing_Fast_If_This_Failed
 Library           OperatingSystem
 Library           SSHLibrary    timeout=10s
 Library           RequestsLibrary
-Library           ${CURDIR}/../../../libraries/norm_json.py
-Variables         ${CURDIR}/../../../variables/Variables.py
-Variables         ${CURDIR}/../../../variables/bgpuser/variables.py    ${TOOLS_SYSTEM_IP}    ${ODL_STREAM}
-Resource          ${CURDIR}/../../../libraries/BGPcliKeywords.robot
-Resource          ${CURDIR}/../../../libraries/BGPSpeaker.robot
-Resource          ${CURDIR}/../../../libraries/FailFast.robot
-Resource          ${CURDIR}/../../../libraries/KillPythonTool.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
-Resource          ${CURDIR}/../../../libraries/CompareStream.robot
+Library           ../../../libraries/norm_json.py
+Variables         ../../../variables/bgpuser/variables.py    ${TOOLS_SYSTEM_IP}    ${ODL_STREAM}
+Resource          ../../../variables/Variables.robot
+Resource          ../../../libraries/BGPcliKeywords.robot
+Resource          ../../../libraries/BGPSpeaker.robot
+Resource          ../../../libraries/FailFast.robot
+Resource          ../../../libraries/KillPythonTool.robot
+Resource          ../../../libraries/SetupUtils.robot
+Resource          ../../../libraries/SSHKeywords.robot
+Resource          ../../../libraries/TemplatedRequests.robot
+Resource          ../../../libraries/Utils.robot
+Resource          ../../../libraries/WaitForFailure.robot
+Resource          ../../../libraries/CompareStream.robot
 
 *** Variables ***
 ${ACTUAL_RESPONSES_FOLDER}    ${TEMPDIR}/actual
@@ -54,6 +66,7 @@ ${BGP_TOOL_LOG_LEVEL}    info
 ${ODL_LOG_LEVEL}    INFO
 ${ODL_BGP_LOG_LEVEL}    DEFAULT
 ${CONFIG_SESSION}    session
+${PEER_GROUP}     internal-neighbors
 ${PROTOCOL_OPENCONFIG}    ${RIB_INSTANCE}
 ${DEVICE_NAME}    controller-config
 ${BGP_PEER_NAME}    example-bgp-peer
@@ -89,17 +102,58 @@ Check_Talking_Topology_Is_Filled
     [Tags]    critical
     Wait_For_Topology_To_Change_To    ${filled_json}    020_Filled.json
 
-Reset_Bgp_Peer_Session
-    [Documentation]    Reset Peer Session (Oxygen only)
+TC_R_Reset_Bgp_Peer_Session
+    [Documentation]    Reset Peer Session
     [Tags]    Critical
     &{mapping}    Create Dictionary    IP=${TOOLS_SYSTEM_IP}    RIB_INSTANCE_NAME=${RIB_INSTANCE}
     CompareStream.Run_Keyword_If_At_Least_Oxygen    TemplatedRequests.Post_As_Xml_Templated    folder=${BGP_VARIABLES_FOLDER}${/}peer_session/restart    mapping=${mapping}    session=${CONFIG_SESSION}
 
-Check_For_Empty_Topology_After_Resetting
-    [Documentation]    See example-ipv4-topology empty after resetting session (Oxygen only)
+TC_R_Check_For_Empty_Topology_After_Resetting
+    [Documentation]    See example-ipv4-topology empty after resetting session
     [Tags]    critical
     CompareStream.Run_Keyword_If_At_Least_Oxygen    Wait_For_Topology_To_Change_To    ${empty_json}    030_Empty.json
 
+TC_PG_Reconfigure_ODL_With_Peer_Group_To_Accept_Connection
+    [Documentation]    Configure BGP peer module with initiate-connection set to false.
+    &{mapping}    BuiltIn.Create_Dictionary    DEVICE_NAME=${DEVICE_NAME}    BGP_NAME=${BGP_PEER_NAME}    IP=${TOOLS_SYSTEM_IP}    BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG}
+    CompareStream.Run_Keyword_If_At_Least_Fluorine    TemplatedRequests.Delete_Templated    ${BGP_VARIABLES_FOLDER}${/}bgp_peer    mapping=${mapping}    session=${CONFIG_SESSION}
+    CompareStream.Run_Keyword_If_At_Least_Fluorine    Configure_Peer_Group
+    &{mapping}    Create Dictionary    DEVICE_NAME=${DEVICE_NAME}    BGP_NAME=${BGP_PEER_NAME}    IP=${TOOLS_SYSTEM_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}
+    ...    PEER_GROUP_NAME=${PEER_GROUP}    INITIATE=false    BGP_RIB=${RIB_INSTANCE}    PASSIVE_MODE=true    BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG}    RIB_INSTANCE_NAME=${RIB_INSTANCE}
+    CompareStream.Run_Keyword_If_At_Least_Fluorine    TemplatedRequests.Put_As_Xml_Templated    ${BGP_VARIABLES_FOLDER}${/}bgp_peer_group    mapping=${mapping}    session=${CONFIG_SESSION}
+    [Teardown]    SetupUtils.Teardown_Test_Show_Bugs_If_Test_Failed
+
+TC_PG_Restart_Talking_BGP_Speaker
+    [Documentation]    Abort the Python speaker. Also, attempt to stop failing fast.
+    [Tags]    critical
+    [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
+    CompareStream.Run_Keyword_If_At_Least_Fluorine    Restart_Talking_BGP_Speaker
+    [Teardown]    FailFast.Do_Not_Start_Failing_If_This_Failed
+
+TC_PG_Check_Talking_Topology_Is_Filled
+    [Documentation]    See new routes in example-ipv4-topology as a proof that synchronization was correct.
+    [Tags]    critical
+    CompareStream.Run_Keyword_If_At_Least_Fluorine    Wait_For_Topology_To_Change_To    ${filled_json}    021_Filled.json
+
+TC_PG_Reconfigure_ODL_With_Peer_Group_Without_Ipv4_Unicast
+    [Documentation]    Configure BGP peer module with initiate-connection set to false. (Fluorine only)
+    CompareStream.Run_Keyword_If_At_Least_Fluorine    Configure_Peer_Group    peer_group_folder=peer_group_without_ipv4
+    [Teardown]    SetupUtils.Teardown_Test_Show_Bugs_If_Test_Failed
+
+TC_PG_Check_For_Empty_Topology_After_Deconfiguration
+    [Documentation]    See example-ipv4-topology empty after resetting session (Fluorine only)
+    [Tags]    critical
+    CompareStream.Run_Keyword_If_At_Least_Fluorine    Wait_For_Topology_To_Change_To    ${empty_json}    031_Empty.json
+
+TC_PG_Reconfigure_ODL_To_Accept_Connection
+    [Documentation]    Configure BGP peer module with initiate-connection set to false. (Fluorine only)
+    &{mapping}    Create Dictionary    DEVICE_NAME=${DEVICE_NAME}    BGP_NAME=${BGP_PEER_NAME}    IP=${TOOLS_SYSTEM_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}
+    ...    PEER_GROUP_NAME=${PEER_GROUP}    INITIATE=false    BGP_RIB=${RIB_INSTANCE}    PASSIVE_MODE=true    BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG}    RIB_INSTANCE_NAME=${RIB_INSTANCE}
+    CompareStream.Run_Keyword_If_At_Least_Fluorine    TemplatedRequests.Delete_Templated    ${BGP_VARIABLES_FOLDER}${/}bgp_peer_group    mapping=${mapping}    session=${CONFIG_SESSION}
+    CompareStream.Run_Keyword_If_At_Least_Fluorine    TemplatedRequests.Put_As_Xml_Templated    ${BGP_VARIABLES_FOLDER}${/}bgp_peer    mapping=${mapping}    session=${CONFIG_SESSION}
+    CompareStream.Run_Keyword_If_At_Least_Fluorine    Deconfigure_Peer_Group
+    [Teardown]    SetupUtils.Teardown_Test_Show_Bugs_If_Test_Failed
+
 Kill_Talking_BGP_Speaker
     [Documentation]    Abort the Python speaker. Also, attempt to stop failing fast.
     [Tags]    critical
@@ -302,3 +356,28 @@ Check_Number_Of_Speaker_Connections
     [Documentation]    Run netstat in mininet machine and parse it for number of established connections. Check it is ${howmany}.
     ${output}=    SSHKeywords.Count_Port_Occurences    17900    ESTABLISHED    python
     BuiltIn.Should_Be_Equal_As_Strings    ${output}    ${howmany}
+
+Configure_Peer_Group
+    [Arguments]    ${peer_group_folder}=peer_group
+    [Documentation]    Configures peer group which is template for all the neighbors which are going
+    ...    to be configured. Also after PUT, this case verifies presence of peer group within
+    ...    peer-groups. This case is specific to versions Fluorine and above.
+    &{mapping}    Create Dictionary    DEVICE_NAME=${DEVICE_NAME}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}    INITIATE=false    BGP_RIB=${RIB_INSTANCE}
+    ...    PASSIVE_MODE=true    BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG}    RIB_INSTANCE_NAME=${RIB_INSTANCE}    PEER_GROUP_NAME=${PEER_GROUP}    RR_CLIENT=false
+    TemplatedRequests.Put_As_Xml_Templated    ${BGP_VARIABLES_FOLDER}${/}${peer_group_folder}    mapping=${mapping}    session=${CONFIG_SESSION}
+    TemplatedRequests.Get_As_Json_Templated    ${BGP_VARIABLES_FOLDER}${/}verify_${peer_group_folder}    mapping=${mapping}    session=${CONFIG_SESSION}    verify=True
+
+Deconfigure_Peer_Group
+    [Documentation]    Deconfigures peer group which is template for all the neighbors
+    ...    This test case is specific to versions Fluorine and above.
+    &{mapping}    Create Dictionary    DEVICE_NAME=${DEVICE_NAME}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}    INITIATE=false    BGP_RIB=${RIB_INSTANCE}
+    ...    PASSIVE_MODE=true    BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG}    RIB_INSTANCE_NAME=${RIB_INSTANCE}    PEER_GROUP_NAME=${PEER_GROUP}    RR_CLIENT=false
+    TemplatedRequests.Delete_Templated    ${BGP_VARIABLES_FOLDER}${/}peer_group    mapping=${mapping}    session=${CONFIG_SESSION}
+
+Restart_Talking_BGP_Speaker
+    [Documentation]    Abort the Python speaker. Also, attempt to stop failing fast. And Start it again.
+    ...    We have to restart it this way because we reset session before
+    BGPSpeaker.Kill_BGP_Speaker
+    FailFast.Do_Not_Fail_Fast_From_Now_On
+    BGPSpeaker.Start_BGP_Speaker    --amount 3 --myip=${TOOLS_SYSTEM_IP} --myport=${BGP_TOOL_PORT} --peerip=${ODL_SYSTEM_IP} --peerport=${ODL_BGP_PORT} --${BGP_TOOL_LOG_LEVEL}
+    Read_And_Fail_If_Prompt_Is_Seen
diff --git a/csit/variables/bgpuser/bgp_peer_group/data.xml b/csit/variables/bgpuser/bgp_peer_group/data.xml
new file mode 100644 (file)
index 0000000..fe14b65
--- /dev/null
@@ -0,0 +1,6 @@
+<neighbor xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
+    <neighbor-address>$IP</neighbor-address>
+    <config>
+        <peer-group>/bgp/neighbors/neighbor/bgp/peer-groups/peer-group[peer-group-name="$PEER_GROUP_NAME"]</peer-group>
+    </config>
+</neighbor>
diff --git a/csit/variables/bgpuser/bgp_peer_group/location.uri b/csit/variables/bgpuser/bgp_peer_group/location.uri
new file mode 100644 (file)
index 0000000..a630024
--- /dev/null
@@ -0,0 +1,2 @@
+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/bgpuser/peer_group/data.xml b/csit/variables/bgpuser/peer_group/data.xml
new file mode 100644 (file)
index 0000000..39a186b
--- /dev/null
@@ -0,0 +1,33 @@
+<peer-group xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
+    <peer-group-name>$PEER_GROUP_NAME</peer-group-name>
+    <config>
+        <peer-type>INTERNAL</peer-type>
+    </config>
+    <transport>
+        <config>
+            <passive-mode>$PASSIVE_MODE</passive-mode>
+        </config>
+    </transport>
+    <timers>
+        <config>
+            <hold-time>$HOLDTIME</hold-time>
+            <connect-retry>5</connect-retry>
+        </config>
+    </timers>
+    <route-reflector>
+        <config>
+            <route-reflector-client>$RR_CLIENT</route-reflector-client>
+        </config>
+    </route-reflector>
+    <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-safi>
+            <afi-safi-name>LINKSTATE</afi-safi-name>
+        </afi-safi>
+    </afi-safis>
+</peer-group>
diff --git a/csit/variables/bgpuser/peer_group/location.uri b/csit/variables/bgpuser/peer_group/location.uri
new file mode 100644 (file)
index 0000000..97f2db7
--- /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/peer-groups/peer-group/$PEER_GROUP_NAME
diff --git a/csit/variables/bgpuser/peer_group_without_ipv4/data.xml b/csit/variables/bgpuser/peer_group_without_ipv4/data.xml
new file mode 100644 (file)
index 0000000..1d92cdd
--- /dev/null
@@ -0,0 +1,30 @@
+<peer-group xmlns="urn:opendaylight:params:xml:ns:yang:bgp:openconfig-extensions">
+    <peer-group-name>$PEER_GROUP_NAME</peer-group-name>
+    <config>
+        <peer-type>INTERNAL</peer-type>
+    </config>
+    <transport>
+        <config>
+            <passive-mode>$PASSIVE_MODE</passive-mode>
+        </config>
+    </transport>
+    <timers>
+        <config>
+            <hold-time>$HOLDTIME</hold-time>
+            <connect-retry>5</connect-retry>
+        </config>
+    </timers>
+    <route-reflector>
+        <config>
+            <route-reflector-client>$RR_CLIENT</route-reflector-client>
+        </config>
+    </route-reflector>
+    <afi-safis>
+        <afi-safi>
+            <afi-safi-name xmlns:x="http://openconfig.net/yang/bgp-types">x:IPV6-UNICAST</afi-safi-name>
+        </afi-safi>
+        <afi-safi>
+            <afi-safi-name>LINKSTATE</afi-safi-name>
+        </afi-safi>
+    </afi-safis>
+</peer-group>
diff --git a/csit/variables/bgpuser/peer_group_without_ipv4/location.uri b/csit/variables/bgpuser/peer_group_without_ipv4/location.uri
new file mode 100644 (file)
index 0000000..97f2db7
--- /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/peer-groups/peer-group/$PEER_GROUP_NAME
diff --git a/csit/variables/bgpuser/verify_peer_group/data.json b/csit/variables/bgpuser/verify_peer_group/data.json
new file mode 100644 (file)
index 0000000..17f23ae
--- /dev/null
@@ -0,0 +1,39 @@
+{
+    "bgp-openconfig-extensions:peer-group": [
+        {
+            "peer-group-name": "internal-neighbors",
+            "transport": {
+                "config": {
+                    "passive-mode": true
+                }
+            },
+            "config": {
+                "peer-type": "INTERNAL"
+            },
+            "afi-safis": {
+                "afi-safi": [
+                    {
+                        "afi-safi-name": "openconfig-bgp-types:IPV6-UNICAST"
+                    },
+                    {
+                        "afi-safi-name": "openconfig-bgp-types:IPV4-UNICAST"
+                    },
+                    {
+                        "afi-safi-name": "bgp-openconfig-extensions:LINKSTATE"
+                    }
+                ]
+            },
+            "timers": {
+                "config": {
+                    "hold-time": 180,
+                    "connect-retry": 5
+                }
+            },
+            "route-reflector": {
+                "config": {
+                    "route-reflector-client": false
+                }
+            }
+        }
+    ]
+}
diff --git a/csit/variables/bgpuser/verify_peer_group/location.uri b/csit/variables/bgpuser/verify_peer_group/location.uri
new file mode 100644 (file)
index 0000000..97f2db7
--- /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/peer-groups/peer-group/$PEER_GROUP_NAME
diff --git a/csit/variables/bgpuser/verify_peer_group_without_ipv4/data.json b/csit/variables/bgpuser/verify_peer_group_without_ipv4/data.json
new file mode 100644 (file)
index 0000000..7c53ede
--- /dev/null
@@ -0,0 +1,36 @@
+{
+    "bgp-openconfig-extensions:peer-group": [
+        {
+            "peer-group-name": "internal-neighbors",
+            "transport": {
+                "config": {
+                    "passive-mode": true
+                }
+            },
+            "config": {
+                "peer-type": "INTERNAL"
+            },
+            "afi-safis": {
+                "afi-safi": [
+                    {
+                        "afi-safi-name": "openconfig-bgp-types:IPV6-UNICAST"
+                    },
+                    {
+                        "afi-safi-name": "bgp-openconfig-extensions:LINKSTATE"
+                    }
+                ]
+            },
+            "timers": {
+                "config": {
+                    "hold-time": 180,
+                    "connect-retry": 5
+                }
+            },
+            "route-reflector": {
+                "config": {
+                    "route-reflector-client": false
+                }
+            }
+        }
+    ]
+}
diff --git a/csit/variables/bgpuser/verify_peer_group_without_ipv4/location.uri b/csit/variables/bgpuser/verify_peer_group_without_ipv4/location.uri
new file mode 100644 (file)
index 0000000..97f2db7
--- /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/peer-groups/peer-group/$PEER_GROUP_NAME