Fix bgp_app_peer test 38/77538/5
authortomas.markovic <tomas.markovic@pantheon.tech>
Tue, 6 Nov 2018 13:34:24 +0000 (14:34 +0100)
committerJamo Luhrsen <jluhrsen@redhat.com>
Fri, 9 Nov 2018 23:50:34 +0000 (23:50 +0000)
Refactor test

In result we also fix bgp_app_peer.py
script, which should increase health
of most of the performance tests.

Change-Id: I831540c6e09287ec7642de7adfc98d74e8f2b087
Signed-off-by: tomas.markovic <tomas.markovic@pantheon.tech>
csit/suites/bgpcep/bgpuser/bgp_app_peer_basic.robot
tools/fastbgp/bgp_app_peer.py
tools/fastbgp/ipv4-routes-template.xml
tools/fastbgp/ipv4-routes-template.xml.oxygen [moved from tools/fastbgp/ipv4-routes-template.xml.fluorine with 94% similarity]

index d3edd19284107b6697ad2d935cb52e2b72ed571a..4339e8450e64f8e63db228960b688b343094683f 100644 (file)
@@ -11,7 +11,7 @@ Documentation     Basic tests for BGP application peer.
 ...               BGP application peer operations and checks for IP4 topology updates
 ...               and updates towards BGP peer as follows:
 ...
-...               Test case 1: Initial BGP peer connection with pre-filled topology (Bug 4714),
+...               Test case 1: Initial BGP peer connection with pre-filled topology,
 ...               POST and simple DELETE requests used.
 ...               BGP_Application_Peer_Post_3_Initial_Routes,
 ...               Check_Example-IPv4-Topology_Is_Filled_With_3_Routes,
@@ -45,8 +45,6 @@ Documentation     Basic tests for BGP application peer.
 ...               how to use restconf application peer interface:
 ...               https://wiki.opendaylight.org/view/BGP_LS_PCEP:User_Guide#BGP_Application_Peer
 ...               https://wiki.opendaylight.org/view/BGP_LS_PCEP:Programmer_Guide#BGP
-...               Covered bugs:
-...               Bug 4714 - No routes from loc-rib are advertised to newly connected peer
 Suite Setup       Setup_Everything
 Suite Teardown    Teardown_Everything
 Test Setup        SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
@@ -69,8 +67,6 @@ ${TOOLS_SYSTEM_PROMPT}    ${DEFAULT_LINUX_PROMPT}
 ${HOLDTIME}       180
 ${BGP_PEER_LOG_LEVEL}    debug
 ${BGP_APP_PEER_LOG_LEVEL}    debug
-${ODL_LOG_LEVEL}    INFO
-${ODL_BGP_LOG_LEVEL}    DEFAULT
 ${BGP_PEER_COMMAND}    python play.py --amount 0 --myip=${TOOLS_SYSTEM_IP} --myport=${BGP_TOOL_PORT} --peerip=${ODL_SYSTEM_IP} --peerport=${ODL_BGP_PORT} --${BGP_PEER_LOG_LEVEL}
 ${BGP_PEER_OPTIONS}    ${EMPTY}
 ${BGP_APP_PEER_ID}    ${ODL_SYSTEM_IP}
@@ -133,12 +129,11 @@ TC1_BGP_Peer_Check_Incomming_Updates_For_3_Introduced_Prefixes
     [Documentation]    Check incomming updates for new routes
     [Tags]    critical
     Switch_To_BGP_Peer_Console
-    BuiltIn.Wait_Until_Keyword_Succeeds    60s    1s    Check_File_For_Word_Count    bgp_peer.log    nlri_prefix_received:    3
+    BuiltIn.Wait_Until_Keyword_Succeeds    10s    1s    Check_File_For_Word_Count    bgp_peer.log    nlri_prefix_received:    3
     Check_File_For_Word_Count    bgp_peer.log    nlri_prefix_received: 8.0.1.0/28    1
     Check_File_For_Word_Count    bgp_peer.log    nlri_prefix_received: 8.0.1.16/28    1
     Check_File_For_Word_Count    bgp_peer.log    nlri_prefix_received: 8.0.1.32/28    1
     Check_File_For_Word_Count    bgp_peer.log    withdrawn_prefix_received:    0
-    [Teardown]    Report_Failure_Due_To_Bug    4714
 
 TC1_BGP_Application_Peer_Delete_3_Initial_Routes
     [Documentation]    Start BGP application peer tool and give him ${BGP_APP_PEER_TIMEOUT}
@@ -157,12 +152,11 @@ TC1_Peer_Check_Incomming_Updates_For_3_Withdrawn_Prefixes
     [Documentation]    Check incomming updates for new routes
     [Tags]    critical
     Switch_To_BGP_Peer_Console
-    BuiltIn.Wait_Until_Keyword_Succeeds    60s    1s    Check_File_For_Word_Count    bgp_peer.log    withdrawn_prefix_received:    3
+    BuiltIn.Wait_Until_Keyword_Succeeds    10s    1s    Check_File_For_Word_Count    bgp_peer.log    withdrawn_prefix_received:    3
     Check_File_For_Word_Count    bgp_peer.log    withdrawn_prefix_received: 8.0.1.0/28    1
     Check_File_For_Word_Count    bgp_peer.log    withdrawn_prefix_received: 8.0.1.16/28    1
     Check_File_For_Word_Count    bgp_peer.log    withdrawn_prefix_received: 8.0.1.32/28    1
     Check_File_For_Word_Count    bgp_peer.log    nlri_prefix_received:    3
-    [Teardown]    Report_Failure_Due_To_Bug    4714
 
 TC1_Stop_BGP_Peer
     [Documentation]    Stop BGP peer tool
@@ -197,7 +191,7 @@ TC2_BGP_Peer_Check_Incomming_Updates_For_3_Introduced_Prefixes
     [Documentation]    Check incomming updates for new routes
     [Tags]    critical
     Switch_To_BGP_Peer_Console
-    BuiltIn.Wait_Until_Keyword_Succeeds    60s    1s    Check_File_For_Word_Count    bgp_peer.log    nlri_prefix_received:    3
+    BuiltIn.Wait_Until_Keyword_Succeeds    10s    1s    Check_File_For_Word_Count    bgp_peer.log    nlri_prefix_received:    3
     Check_File_For_Word_Count    bgp_peer.log    nlri_prefix_received: 8.0.1.0/28    1
     Check_File_For_Word_Count    bgp_peer.log    nlri_prefix_received: 8.0.1.16/28    1
     Check_File_For_Word_Count    bgp_peer.log    nlri_prefix_received: 8.0.1.32/28    1
@@ -220,7 +214,7 @@ TC2_BGP_Peer_Check_Incomming_Updates_For_3_Withdrawn_Prefixes
     [Documentation]    Check incomming updates for new routes
     [Tags]    critical
     Switch_To_BGP_Peer_Console
-    BuiltIn.Wait_Until_Keyword_Succeeds    60s    1s    Check_File_For_Word_Count    bgp_peer.log    withdrawn_prefix_received:    3
+    BuiltIn.Wait_Until_Keyword_Succeeds    10s    1s    Check_File_For_Word_Count    bgp_peer.log    withdrawn_prefix_received:    3
     Check_File_For_Word_Count    bgp_peer.log    withdrawn_prefix_received: 8.0.1.0/28    1
     Check_File_For_Word_Count    bgp_peer.log    withdrawn_prefix_received: 8.0.1.16/28    1
     Check_File_For_Word_Count    bgp_peer.log    withdrawn_prefix_received: 8.0.1.32/28    1
@@ -252,7 +246,7 @@ TC3_Reconnect_BGP_Peer_And_Check_Incomming_Updates_For_3_Introduced_Prefixes
     Switch_To_BGP_Peer_Console
     Start_Console_Tool    ${BGP_PEER_COMMAND}    ${BGP_PEER_OPTIONS}
     Read_And_Fail_If_Prompt_Is_Seen
-    BuiltIn.Wait_Until_Keyword_Succeeds    60s    1s    Check_File_For_Word_Count    bgp_peer.log    nlri_prefix_received:    3
+    BuiltIn.Wait_Until_Keyword_Succeeds    10s    1s    Check_File_For_Word_Count    bgp_peer.log    nlri_prefix_received:    3
     Check_File_For_Word_Count    bgp_peer.log    nlri_prefix_received:    3
     Check_File_For_Word_Count    bgp_peer.log    nlri_prefix_received: 8.0.1.0/28    1
     Check_File_For_Word_Count    bgp_peer.log    nlri_prefix_received: 8.0.1.16/28    1
@@ -276,7 +270,7 @@ TC3_BGP_Peer_Check_Incomming_Updates_For_3_Withdrawn_Prefixes
     [Documentation]    Check incomming updates for new routes
     [Tags]    critical
     Switch_To_BGP_Peer_Console
-    BuiltIn.Wait_Until_Keyword_Succeeds    60s    1s    Check_File_For_Word_Count    bgp_peer.log    withdrawn_prefix_received:    3
+    BuiltIn.Wait_Until_Keyword_Succeeds    10s    1s    Check_File_For_Word_Count    bgp_peer.log    withdrawn_prefix_received:    3
     Check_File_For_Word_Count    bgp_peer.log    withdrawn_prefix_received: 8.0.1.0/28    1
     Check_File_For_Word_Count    bgp_peer.log    withdrawn_prefix_received: 8.0.1.16/28    1
     Check_File_For_Word_Count    bgp_peer.log    withdrawn_prefix_received: 8.0.1.32/28    1
@@ -315,9 +309,6 @@ Setup_Everything
     SSHLibrary.Put_File    ${CURDIR}/../../../../tools/fastbgp/bgp_app_peer.py
     SSHLibrary.Put_File    ${CURDIR}/../../../../tools/fastbgp/ipv4-routes-template.xml*
     RequestsLibrary.Create_Session    ${CONFIG_SESSION}    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}
-    KarafKeywords.Execute_Controller_Karaf_Command_On_Background    log:set ${ODL_LOG_LEVEL}
-    KarafKeywords.Execute_Controller_Karaf_Command_On_Background    log:set ${ODL_BGP_LOG_LEVEL} org.opendaylight.bgpcep
-    KarafKeywords.Execute_Controller_Karaf_Command_On_Background    log:set ${ODL_BGP_LOG_LEVEL} org.opendaylight.protocol
 
 Teardown_Everything
     [Documentation]    Make sure Python tool was killed.
index 1df7931e0f56c824d3a03c09234d1351401ec3f9..16f658f834a47fdd496cbfb5f5b2974704ff4859 100755 (executable)
@@ -12,6 +12,7 @@ import argparse
 import logging
 import time
 import xml.dom.minidom as md
+import os.path
 
 
 __author__ = "Radovan Sajben"
@@ -59,8 +60,12 @@ def _stream_data(xml_template, prefix_base, prefix_len, count, route_key=False,
         :yield xml_data: requested data by elements as xml data
     """
     global total_build_data_time_counter
-
-    routes = md.parse(xml_template)
+    if os.path.isfile(xml_template + "." + stream):
+        routes = md.parse(xml_template + "." + stream)
+    elif os.path.isfile(xml_template):
+        routes = md.parse(xml_template)
+    else:
+        logger.error("Template '{}' does not exist.".format(xml_template))
 
     routes_node = routes.getElementsByTagName("ipv4-routes")[0]
     route_node = routes.getElementsByTagName("ipv4-route")[0]
@@ -403,7 +408,7 @@ if __name__ == "__main__":
                         const=logging.DEBUG, default=logging.INFO,
                         help="Set log level to debug (default is info)")
     parser.add_argument("--logfile", default="bgp_app_peer.log", help="Log file name")
-    parser.add_argument("--stream", default="", help="Stream - oxygen, fluorine ...")
+    parser.add_argument("--stream", default="", help="ODL Stream - oxygen, fluorine ...")
 
     args = parser.parse_args()
 
@@ -425,12 +430,13 @@ if __name__ == "__main__":
     prefix_base = args.prefix
     prefix_len = args.prefixlen
     count = args.count
-    auth = (args.user, args.password)
     uri = args.uri
+    stream = args.stream
+    xml_template = args.xml
+
     # From Fluorine onward route-key argument is mandatory for identification.
-    route_key_stream = ["fluorine"]
-    [xml_template, route_key] = ["{}.{}".format(args.xml, args.stream), True] \
-        if args.stream in route_key_stream else [args.xml, False]
+    route_key_stream = ["oxygen"]
+    route_key = True if args.stream not in route_key_stream else False
 
     test_start_time = time.time()
     total_build_data_time_counter = 0
index ac44b3bbd706b0ee8919b37560e34bd7afcfabe9..0e120250a90277948ba15e9b812dd686ab68683a 100755 (executable)
@@ -2,6 +2,7 @@
  <ipv4-route>
   <prefix>0.0.0.0/32</prefix>
   <path-id>0</path-id>
+  <route-key>0.0.0.0/32</route-key>
   <attributes>
    <ipv4-next-hop>
     <global>192.0.2.1</global>
similarity index 94%
rename from tools/fastbgp/ipv4-routes-template.xml.fluorine
rename to tools/fastbgp/ipv4-routes-template.xml.oxygen
index 0e120250a90277948ba15e9b812dd686ab68683a..ac44b3bbd706b0ee8919b37560e34bd7afcfabe9 100755 (executable)
@@ -2,7 +2,6 @@
  <ipv4-route>
   <prefix>0.0.0.0/32</prefix>
   <path-id>0</path-id>
-  <route-key>0.0.0.0/32</route-key>
   <attributes>
    <ipv4-next-hop>
     <global>192.0.2.1</global>