bgp_functional_route test update 82/65782/65
authorTomas Markovic <tomas.markovic@pantheon.tech>
Tue, 21 Nov 2017 07:16:29 +0000 (08:16 +0100)
committerVratko Polák <vrpolak@cisco.com>
Mon, 4 Dec 2017 09:30:22 +0000 (09:30 +0000)
verify odl stats using restconf bgp operational-state
verify odl stats using odl-bgpcep-bgp-cli

Change-Id: I6d76b0cef0e832b7444b789906092ca6bc49e425
Signed-off-by: Tomas Markovic <tomas.markovic@pantheon.tech>
csit/suites/bgpcep/bgpfunct/040_bgp_functional_route_ref.robot
csit/variables/bgpfunctional/route_refresh/operational_cli/route_refresh.txt [new file with mode: 0644]
csit/variables/bgpfunctional/route_refresh/operational_cli/update.txt [new file with mode: 0644]
csit/variables/bgpfunctional/route_refresh/operational_route_refresh/data.json [new file with mode: 0644]
csit/variables/bgpfunctional/route_refresh/operational_route_refresh/location.uri [new file with mode: 0644]
csit/variables/bgpfunctional/route_refresh/operational_updates/data.json [new file with mode: 0644]
csit/variables/bgpfunctional/route_refresh/operational_updates/location.uri [new file with mode: 0644]

index d3711a831d8febd8d33a6a08d9595645ea166eca..ffc70f7dbae1f4dce2182d09e0814df808b57cdd 100644 (file)
@@ -7,24 +7,26 @@ Documentation     Functional test for bgp - route refresh
 ...               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 sending and receiveing route request message.
+...               This suite tests sending and receiveing route refresh message.
 ...               It uses odl and exabgp as bgp peers.
 ...               Sending route refresh message from odl is initiated via restconf.
 ...               If route refresh received by odl also correct advertising of routes
 ...               is verified. Receiving of route refresh by odl is verified by
-...               checking appropriate message counter via ${JOLOKURL}. Feature
-...               odl-jolokia is required by this test suite.
+...               checking appropriate message counter via odl-bgpcep-bgp-cli and
+...               restconf using BGP neighbor operational state
 Suite Setup       Start_Suite
 Suite Teardown    Stop_Suite
 Test Setup        SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
 Library           RequestsLibrary
 Library           SSHLibrary
-Variables         ${CURDIR}/../../../variables/Variables.py
-Resource          ${CURDIR}/../../../libraries/ExaBgpLib.robot
-Resource          ${CURDIR}/../../../libraries/SetupUtils.robot
-Resource          ${CURDIR}/../../../libraries/TemplatedRequests.robot
-Resource          ${CURDIR}/../../../libraries/SSHKeywords.robot
-Library           ${CURDIR}/../../../libraries/BgpRpcClient.py    ${TOOLS_SYSTEM_IP}
+Variables         ../../../variables/Variables.py
+Resource          ../../../libraries/ExaBgpLib.robot
+Resource          ../../../libraries/SetupUtils.robot
+Resource          ../../../libraries/TemplatedRequests.robot
+Resource          ../../../libraries/SSHKeywords.robot
+Resource          ../../../libraries/KarafKeywords.robot
+Resource          ../../../libraries/CompareStream.robot
+Library           ../../../libraries/BgpRpcClient.py    ${TOOLS_SYSTEM_IP}
 
 *** Variables ***
 ${HOLDTIME}       180
@@ -38,7 +40,6 @@ ${BGP_RR_VAR_FOLDER}    ${BGP_VAR_FOLDER}/route_refresh
 ${BGP_CFG_NAME}    exa.cfg
 ${CONFIG_SESSION}    config-session
 ${EXARPCSCRIPT}    ${CURDIR}/../../../../tools/exabgp_files/exarpc.py
-${JOLOKURL}       /jolokia/read/org.opendaylight.controller:instanceName=${BGP_PEER_NAME},type=RuntimeBean,moduleFactoryName=bgp-peer
 
 *** Test Cases ***
 Configure_App_Peer
@@ -53,21 +54,23 @@ Reconfigure_ODL_To_Accept_Connection
     ...    INITIATE=false    RIB_INSTANCE_NAME=${RIB_INSTANCE}    BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG}    PASSIVE_MODE=true
     TemplatedRequests.Put_As_Xml_Templated    ${BGP_VAR_FOLDER}/bgp_peer    mapping=${mapping}    session=${CONFIG_SESSION}
 
-Exa_To_Send_Route_Request
+Exa_To_Send_Route_Refresh
     [Documentation]    Exabgp sends route refresh and count received updates
     [Setup]    Configure_Routes_And_Start_ExaBgp    ${BGP_CFG_NAME}
     BgpRpcClient.exa_clean_received_update_count
     BgpRpcClient.exa_announce    announce route-refresh ipv4 unicast
     BuiltIn.Wait_Until_Keyword_Succeeds    5x    2s    Verify_ExaBgp_Received_Updates    ${nr_configured_routes}
+    BuiltIn.Wait_Until_Keyword_Succeeds    3x    5s    Verify_Odl_Received_Updates    ${nr_configured_routes}
     [Teardown]    Deconfigure_Routes_And_Stop_ExaBgp
 
-Odl_To_Send_Route_Request
-    [Documentation]    Sends route requests and checks if exabgp receives it
+Odl_To_Send_Route_Refresh
+    [Documentation]    Sends route refresh request and checks if exabgp receives it
     [Setup]    ExaBgpLib.Start_ExaBgp_And_Verify_Connected    ${BGP_CFG_NAME}    ${CONFIG_SESSION}    ${TOOLS_SYSTEM_IP}
     BgpRpcClient.exa_clean_received_route_refresh_count
     &{mapping}    BuiltIn.Create_Dictionary    BGP_PEER_IP=${TOOLS_SYSTEM_IP}
     TemplatedRequests.Post_As_Xml_Templated    ${BGP_VAR_FOLDER}/route_refresh    mapping=${mapping}    session=${CONFIG_SESSION}
-    BuiltIn.Wait_Until_Keyword_Succeeds    5x    2s    Verify_Odl_Sent_Route_Request    1
+    BuiltIn.Wait_Until_Keyword_Succeeds    5x    2s    Verify_ExaBgp_Received_Route_Refresh    1
+    BuiltIn.Wait_Until_Keyword_Succeeds    3x    5s    Verify_Odl_Received_Route_Refresh    1
     [Teardown]    ExaBgpLib.Stop_ExaBgp
 
 Delete_Bgp_Peer_Configuration
@@ -129,23 +132,52 @@ Deconfigure_Routes_And_Stop_ExaBgp
     &{mapping}    BuiltIn.Create_Dictionary    PREFIX=${prefix}    APP_RIB=${app_rib}
     TemplatedRequests.Delete_Templated    ${BGP_RR_VAR_FOLDER}/route    mapping=${mapping}    session=${CONFIG_SESSION}
 
-Verify_Odl_Sent_Route_Request
+Verify_ExaBgp_Received_Updates
+    [Arguments]    ${expcount}
+    [Documentation]    Gets number of received update requests and compares with given expected count
+    [Tags]    critical
+    ${count_recv}=    BgpRpcClient.exa_get_received_update_count
+    BuiltIn.Should Be Equal As Numbers    ${count_recv}    ${expcount}
+
+Verify_Odl_Received_Updates
+    [Arguments]    ${expcount}
+    [Documentation]    Compares sent information with given expected count using restconf
+    [Tags]    critical
+    &{mapping}    BuiltIn.Create_Dictionary    IP=${TOOLS_SYSTEM_IP}    RIB_INSTANCE_NAME=${RIB_INSTANCE}    COUNT=${expcount}
+    ${ret}=    BuiltIn.Wait_Until_Keyword_Succeeds    3x    5s    TemplatedRequests.Get_As_Json_Templated    folder=${BGP_RR_VAR_FOLDER}/operational_updates    mapping=${mapping}
+    ...    session=${CONFIG_SESSION}    verify=True
+    CompareStream.Run_Keyword_If_At_Least_Oxygen    BuiltIn.Wait_Until_Keyword_Succeeds    3x    5s    Verify_Odl_Received_Updates_Cli    ${expcount}
+
+Verify_Odl_Received_Updates_Cli
+    [Arguments]    ${expcount}
+    [Documentation]    Compares sent information with given expected count using odl-bgpcep-bgp-cli
+    [Tags]    critical
+    ${output}=    KarafKeywords.Safe_Issue_Command_On_Karaf_Console    bgp:operational-state -rib example-bgp-rib -neighbor ${TOOLS_SYSTEM_IP}
+    &{mapping}    BuiltIn.Create_Dictionary    IP=${TOOLS_SYSTEM_IP}    COUNT=${expcount}
+    ${expstate}    TemplatedRequests.Resolve_Text_From_Template_File    folder=${BGP_RR_VAR_FOLDER}/operational_cli/    file_name=update.txt    mapping=${mapping}
+    BuiltIn.Should_Contain    ${output}    ${expstate}
+
+Verify_ExaBgp_Received_Route_Refresh
     [Arguments]    ${expcount}
     [Documentation]    Compares expected count of route request messages on exabgp side
+    [Tags]    critical
     ${count}=    BgpRpcClient.exa_get_received_route_refresh_count
     BuiltIn.Should Be Equal As Numbers    ${count}    ${expcount}
 
-Verify_Odl_Received_Route_Request
+Verify_Odl_Received_Route_Refresh
     [Arguments]    ${expcount}
-    [Documentation]    Gets numebr of received route requests and compares with given expected count
-    ${rsp}=    RequestsLibrary.Get_Request    ${CONFIG_SESSION}    ${JOLOKURL}
-    BuiltIn.Log    ${rsp.content}
-    BuiltIn.Should_Be_Equal_As_Numbers    ${rsp.status_code}    200
-    BuiltIn.Should_Be_Equal_As_Numbers    ${rsp.json()['status']}    200
-    BuiltIn.Should_Be_Equal_As_Numbers    ${rsp.json()['value']['BgpSessionState']['messagesStats']['routeRefreshMsgs']['received']['count']['value']}    ${expcount}
+    [Documentation]    Compares expected count of messages on odl using restconf
+    [Tags]    critical
+    &{mapping}    BuiltIn.Create_Dictionary    IP=${TOOLS_SYSTEM_IP}    RIB_INSTANCE_NAME=${RIB_INSTANCE}    COUNT=${expcount}
+    ${ret}=    BuiltIn.Wait_Until_Keyword_Succeeds    3x    5s    TemplatedRequests.Get_As_Json_Templated    folder=${BGP_RR_VAR_FOLDER}/operational_route_refresh    mapping=${mapping}
+    ...    session=${CONFIG_SESSION}    verify=True
+    CompareStream.Run_Keyword_If_At_Least_Oxygen    BuiltIn.Wait_Until_Keyword_Succeeds    3x    5s    Verify_Odl_Received_Route_Refresh_Cli    ${expcount}
 
-Verify_ExaBgp_Received_Updates
+Verify_Odl_Received_Route_Refresh_Cli
     [Arguments]    ${expcount}
-    [Documentation]    Gets numebr of received update requests and compares with given expected count
-    ${count_recv}=    BgpRpcClient.exa_get_received_update_count
-    BuiltIn.Should Be Equal As Numbers    ${count_recv}    ${expcount}
+    [Documentation]    Compares expected count of messages on odl using odl-bgpcep-bgp-cli
+    [Tags]    critical
+    ${output}=    KarafKeywords.Safe_Issue_Command_On_Karaf_Console    bgp:operational-state -rib example-bgp-rib -neighbor ${TOOLS_SYSTEM_IP}
+    &{mapping}    BuiltIn.Create_Dictionary    IP=${TOOLS_SYSTEM_IP}    COUNT=${expcount}
+    ${expstate}    TemplatedRequests.Resolve_Text_From_Template_File    folder=${BGP_RR_VAR_FOLDER}/operational_cli/    file_name=route_refresh.txt    mapping=${mapping}
+    BuiltIn.Should_Contain    ${output}    ${expstate}
diff --git a/csit/variables/bgpfunctional/route_refresh/operational_cli/route_refresh.txt b/csit/variables/bgpfunctional/route_refresh/operational_cli/route_refresh.txt
new file mode 100644 (file)
index 0000000..227feb8
--- /dev/null
@@ -0,0 +1,31 @@
+Messages state         |                 \r
+====================== |                 \r
+Messages Received      |                 \r
+NOTIFICATION           | $COUNT               \r
+UPDATE                 | 4               \r
+Messages Sent          |                 \r
+NOTIFICATION           | 0               \r
+UPDATE                 | 4               \r
+                       |                 \r
+AFI state              |                 \r
+====================== |                 \r
+Family                 | IPV4UNICAST     \r
+Active                 | true            \r
+Prefixes               |                 \r
+Installed              | 0               \r
+Sent                   | 0               \r
+Received               | 0               \r
+                       |                 \r
+AFI state              |                 \r
+====================== |                 \r
+Family                 | L2VPNEVPN       \r
+Active                 | false           \r
+                       |                 \r
+AFI state              |                 \r
+====================== |                 \r
+Family                 | L3VPNIPV4UNICAST\r
+Active                 | true            \r
+Prefixes               |                 \r
+Installed              | 0               \r
+Sent                   | 0               \r
+Received               | 0
diff --git a/csit/variables/bgpfunctional/route_refresh/operational_cli/update.txt b/csit/variables/bgpfunctional/route_refresh/operational_cli/update.txt
new file mode 100644 (file)
index 0000000..5e2d71d
--- /dev/null
@@ -0,0 +1,31 @@
+Messages state         |                 \r
+====================== |                 \r
+Messages Received      |                 \r
+NOTIFICATION           | 0               \r
+UPDATE                 | $COUNT               \r
+Messages Sent          |                 \r
+NOTIFICATION           | 0               \r
+UPDATE                 | 4               \r
+                       |                 \r
+AFI state              |                 \r
+====================== |                 \r
+Family                 | IPV4UNICAST     \r
+Active                 | true            \r
+Prefixes               |                 \r
+Installed              | 0               \r
+Sent                   | $COUNT               \r
+Received               | 0               \r
+                       |                 \r
+AFI state              |                 \r
+====================== |                 \r
+Family                 | L2VPNEVPN       \r
+Active                 | false           \r
+                       |                 \r
+AFI state              |                 \r
+====================== |                 \r
+Family                 | L3VPNIPV4UNICAST\r
+Active                 | true            \r
+Prefixes               |                 \r
+Installed              | 0               \r
+Sent                   | 0               \r
+Received               | 0
diff --git a/csit/variables/bgpfunctional/route_refresh/operational_route_refresh/data.json b/csit/variables/bgpfunctional/route_refresh/operational_route_refresh/data.json
new file mode 100644 (file)
index 0000000..b3ff451
--- /dev/null
@@ -0,0 +1,20 @@
+{
+    "bgp-openconfig-extensions:state": {
+        "messages": {
+            "received": {
+                "NOTIFICATION": $COUNT,
+                "UPDATE": 4
+            },
+            "sent": {
+                "NOTIFICATION": 0,
+                "UPDATE": 4
+            }
+        },
+        "session-state": "ESTABLISHED",
+        "supported-capabilities": [
+            "openconfig-bgp-types:ASN32",
+            "openconfig-bgp-types:MPBGP",
+            "openconfig-bgp-types:ROUTE-REFRESH"
+        ]
+    }
+}
diff --git a/csit/variables/bgpfunctional/route_refresh/operational_route_refresh/location.uri b/csit/variables/bgpfunctional/route_refresh/operational_route_refresh/location.uri
new file mode 100644 (file)
index 0000000..384c609
--- /dev/null
@@ -0,0 +1,2 @@
+restconf/operational/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols/protocol/openconfig-policy-types:BGP/$RIB_INSTANCE_NAME/bgp/neighbors/neighbor/$IP/state
+
diff --git a/csit/variables/bgpfunctional/route_refresh/operational_updates/data.json b/csit/variables/bgpfunctional/route_refresh/operational_updates/data.json
new file mode 100644 (file)
index 0000000..9768c24
--- /dev/null
@@ -0,0 +1,20 @@
+{
+    "bgp-openconfig-extensions:state": {
+        "messages": {
+            "received": {
+                "NOTIFICATION": 0,
+                "UPDATE": $COUNT
+            },
+            "sent": {
+                "NOTIFICATION": 0,
+                "UPDATE": 4
+            }
+        },
+        "session-state": "ESTABLISHED",
+        "supported-capabilities": [
+            "openconfig-bgp-types:ASN32",
+            "openconfig-bgp-types:MPBGP",
+            "openconfig-bgp-types:ROUTE-REFRESH"
+        ]
+    }
+}
diff --git a/csit/variables/bgpfunctional/route_refresh/operational_updates/location.uri b/csit/variables/bgpfunctional/route_refresh/operational_updates/location.uri
new file mode 100644 (file)
index 0000000..f4c1c29
--- /dev/null
@@ -0,0 +1 @@
+restconf/operational/openconfig-network-instance:network-instances/network-instance/global-bgp/openconfig-network-instance:protocols/protocol/openconfig-policy-types:BGP/$RIB_INSTANCE_NAME/bgp/neighbors/neighbor/$IP/state