Bgp-cli debug 66/71066/15
authorTomas Markovic <tomas.markovic@pantheon.tech>
Wed, 18 Apr 2018 05:51:24 +0000 (07:51 +0200)
committerJamo Luhrsen <jluhrsen@redhat.com>
Mon, 23 Apr 2018 20:38:11 +0000 (20:38 +0000)
Output of cli has changed in fluorine.
Also reworked some of the test cases
to be clearer and more universal.

Change-Id: Ic6c8bb34ff1b81d147485fc11374454778607d29
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.oxygen/update.txt [new file with mode: 0644]
csit/variables/bgpfunctional/route_refresh/operational_cli/route_refresh.txt [deleted file]
csit/variables/bgpfunctional/route_refresh/operational_cli/update.txt
csit/variables/bgpfunctional/route_refresh/operational_cli/update_ipv4.txt [deleted file]
csit/variables/bgpfunctional/route_refresh/operational_route_refresh/data.json [deleted file]
csit/variables/bgpfunctional/route_refresh/operational_route_refresh/location.uri [deleted file]
csit/variables/bgpfunctional/route_refresh/operational_state/data.json [moved from csit/variables/bgpfunctional/route_refresh/operational_updates/data.json with 84% similarity]
csit/variables/bgpfunctional/route_refresh/operational_state/location.uri [moved from csit/variables/bgpfunctional/route_refresh/operational_updates/location.uri with 100% similarity]

index b4c5014d82e15034bcd7ff3a4ce9a7145ef9711a..3f1bcfad954cc0cd610f02a83540c3fb2628ba93 100644 (file)
@@ -19,27 +19,27 @@ Suite Teardown    Stop_Suite
 Test Setup        SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
 Library           RequestsLibrary
 Library           SSHLibrary
-Variables         ../../../variables/Variables.py
+Library           ../../../libraries/BgpRpcClient.py    ${TOOLS_SYSTEM_IP}
+Resource          ../../../libraries/CompareStream.robot
 Resource          ../../../libraries/ExaBgpLib.robot
+Resource          ../../../libraries/KarafKeywords.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}
+Resource          ../../../libraries/TemplatedRequests.robot
+Resource          ../../../variables/Variables.robot
 
 *** Variables ***
-${HOLDTIME}       180
-${DEVICE_NAME}    controller-config
-${BGP_PEER_NAME}    example-bgp-peer
-${RIB_INSTANCE}    example-bgp-rib
-${PROTOCOL_OPENCONFIG}    ${RIB_INSTANCE}
 ${APP_PEER_NAME}    example-bgp-peer-app
-${BGP_VAR_FOLDER}    ${CURDIR}/../../../variables/bgpfunctional
-${BGP_RR_VAR_FOLDER}    ${BGP_VAR_FOLDER}/route_refresh
 ${BGP_CFG_NAME}    exa.cfg
+${BGP_PEER_NAME}    example-bgp-peer
+${BGP_RR_VAR_FOLDER}    ${BGP_VAR_FOLDER}/route_refresh
+${BGP_VAR_FOLDER}    ${CURDIR}/../../../variables/bgpfunctional
 ${CONFIG_SESSION}    config-session
+${DEVICE_NAME}    controller-config
 ${EXARPCSCRIPT}    ${CURDIR}/../../../../tools/exabgp_files/exarpc.py
+${HOLDTIME}       180
+${PROTOCOL_OPENCONFIG}    ${RIB_INSTANCE}
+${RIB_INSTANCE}    example-bgp-rib
 
 *** Test Cases ***
 Configure_App_Peer
@@ -56,21 +56,23 @@ Reconfigure_ODL_To_Accept_Connection
 
 Exa_To_Send_Route_Refresh
     [Documentation]    Exabgp sends route refresh and count received updates
+    [Tags]    critical
     [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}
+    BuiltIn.Wait_Until_Keyword_Succeeds    3x    5s    Verify_Odl_Operational_State_Count    notification_count=0    update_count=${nr_configured_routes}
     [Teardown]    Deconfigure_Routes_And_Stop_ExaBgp
 
 Odl_To_Send_Route_Refresh
     [Documentation]    Sends route refresh request and checks if exabgp receives it
+    [Tags]    critical
     [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_ExaBgp_Received_Route_Refresh    1
-    BuiltIn.Wait_Until_Keyword_Succeeds    3x    5s    Verify_Odl_Received_Route_Refresh    1
+    BuiltIn.Wait_Until_Keyword_Succeeds    3x    5s    Verify_Odl_Operational_State_Count    notification_count=1    update_count=4
     [Teardown]    ExaBgpLib.Stop_ExaBgp
 
 Delete_Bgp_Peer_Configuration
@@ -135,51 +137,33 @@ Deconfigure_Routes_And_Stop_ExaBgp
 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}
-    ${expstate_ipv4}    TemplatedRequests.Resolve_Text_From_Template_File    folder=${BGP_RR_VAR_FOLDER}/operational_cli/    file_name=update_ipv4.txt    mapping=${mapping}
-    BuiltIn.Should_Contain    ${output}    ${expstate}
-    BuiltIn.Should_Contain    ${output}    ${expstate_ipv4}
-
 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_Refresh
-    [Arguments]    ${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}
+Verify_Odl_Operational_State_Count
+    [Arguments]    ${notification_count}    ${update_count}
+    [Documentation]    Check notification and update count gained from operatial neighbor state
+    ...    On versions oxygen and above, it verifies these counts also against cli output.
+    &{mapping}    BuiltIn.Create_Dictionary    IP=${TOOLS_SYSTEM_IP}    RIB_INSTANCE_NAME=${RIB_INSTANCE}    NOT_COUNT=${notification_count}    UPD_COUNT=${update_count}
+    ${ret}=    BuiltIn.Wait_Until_Keyword_Succeeds    3x    5s    TemplatedRequests.Get_As_Json_Templated    folder=${BGP_RR_VAR_FOLDER}/operational_state    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_Odl_Received_Route_Refresh_Cli
-    [Arguments]    ${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.Log    ${ret}
+    CompareStream.Run_Keyword_If_At_Least_Oxygen    BuiltIn.Wait_Until_Keyword_Succeeds    3x    5s    Verify_Cli_Output_Count    ${notification_count}    ${update_count}
+
+Verify_Cli_Output_Count
+    [Arguments]    ${notification_count}    ${update_count}
+    [Documentation]    Checks notification and update count from odl-bgpcep-bgp-cli.
+    ...    odl-bgpcep-bgp-cli is only avaiable on versions oxygen and above.
+    ${output}    KarafKeywords.Safe_Issue_Command_On_Karaf_Console    bgp:operational-state -rib example-bgp-rib -neighbor ${TOOLS_SYSTEM_IP}
+    BuiltIn.Log    ${output}
+    # cli output in karaf has changed in fluorine with different divider between results.
+    ${divider}    CompareStream.Set_Variable_If_At_Least_Fluorine    │    |
+    &{mapping}    BuiltIn.Create_Dictionary    IP=${TOOLS_SYSTEM_IP}    NOT_COUNT=${notification_count}    UPD_COUNT=${update_count}    DIVIDER=${divider}
+    ${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}
diff --git a/csit/variables/bgpfunctional/route_refresh/operational_cli.oxygen/update.txt b/csit/variables/bgpfunctional/route_refresh/operational_cli.oxygen/update.txt
new file mode 100644 (file)
index 0000000..a39bf4b
--- /dev/null
@@ -0,0 +1,8 @@
+Messages state         $DIVIDER                 \r
+====================== $DIVIDER                 \r
+Messages Received      $DIVIDER                 \r
+NOTIFICATION           $DIVIDER $NOT_COUNT               \r
+UPDATE                 $DIVIDER $UPD_COUNT               \r
+Messages Sent          $DIVIDER                 \r
+NOTIFICATION           $DIVIDER 0               \r
+UPDATE                 $DIVIDER 4
diff --git a/csit/variables/bgpfunctional/route_refresh/operational_cli/route_refresh.txt b/csit/variables/bgpfunctional/route_refresh/operational_cli/route_refresh.txt
deleted file mode 100644 (file)
index 9d2a148..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-Messages state         |                 \r
-====================== |                 \r
-Messages Received      |                 \r
-NOTIFICATION           | $COUNT               \r
-UPDATE                 | 4               \r
-Messages Sent          |                 \r
-NOTIFICATION           | 0               \r
-UPDATE                 | 4
index 90ce5cfe12e99e25c923819943a1c2ed142a8389..94695ce58b8692b98eccaf841b21261e77dfa373 100644 (file)
@@ -1,8 +1,8 @@
-Messages state         |                 \r
-====================== |                 \r
-Messages Received      |                 \r
-NOTIFICATION           | 0               \r
-UPDATE                 | $COUNT               \r
-Messages Sent          |                 \r
-NOTIFICATION           | 0               \r
-UPDATE                 | 4
+Messages state         $DIVIDER\r
+====================== $DIVIDER\r
+Messages Received      $DIVIDER\r
+NOTIFICATION           $DIVIDER $NOT_COUNT\r
+UPDATE                 $DIVIDER $UPD_COUNT\r
+Messages Sent          $DIVIDER\r
+NOTIFICATION           $DIVIDER 0\r
+UPDATE                 $DIVIDER 4
diff --git a/csit/variables/bgpfunctional/route_refresh/operational_cli/update_ipv4.txt b/csit/variables/bgpfunctional/route_refresh/operational_cli/update_ipv4.txt
deleted file mode 100644 (file)
index d62bd5b..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-AFI state              |                 \r
-====================== |                 \r
-Family                 | IPV4UNICAST     \r
-Active                 | true            \r
-Prefixes               |                 \r
-Installed              | 0               \r
-Sent                   | $COUNT               \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
deleted file mode 100644 (file)
index b3ff451..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-{
-    "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
deleted file mode 100644 (file)
index 384c609..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-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
-
similarity index 84%
rename from csit/variables/bgpfunctional/route_refresh/operational_updates/data.json
rename to csit/variables/bgpfunctional/route_refresh/operational_state/data.json
index 9768c249ecccb5a91096540a78026418390de488..9367bcd0c33b7af4f139610fd3918a30e4971ec7 100644 (file)
@@ -2,8 +2,8 @@
     "bgp-openconfig-extensions:state": {
         "messages": {
             "received": {
-                "NOTIFICATION": 0,
-                "UPDATE": $COUNT
+                "NOTIFICATION": $NOT_COUNT,
+                "UPDATE": $UPD_COUNT
             },
             "sent": {
                 "NOTIFICATION": 0,