Many iBGP routing reflector clients 81/33481/18
authorRadovan Sajben <rsajben@cisco.com>
Mon, 25 Jan 2016 14:08:57 +0000 (15:08 +0100)
committerGerrit Code Review <gerrit@opendaylight.org>
Fri, 5 Feb 2016 15:12:29 +0000 (15:12 +0000)
- 10 iBGP rrc peers send and receive updates

Change-Id: I839b6eefcde4588cfabec020fa837dd2a8813050
Signed-off-by: Radovan Sajben <rsajben@cisco.com>
csit/suites/bgpcep/bgpingest/manypeers_peercount.robot [new file with mode: 0644]
csit/testplans/bgpcep-bgp-ingest.txt
tools/fastbgp/play.py

diff --git a/csit/suites/bgpcep/bgpingest/manypeers_peercount.robot b/csit/suites/bgpcep/bgpingest/manypeers_peercount.robot
new file mode 100644 (file)
index 0000000..e6cc862
--- /dev/null
@@ -0,0 +1,189 @@
+*** Settings ***
+Documentation     BGP performance of ingesting from many iBGP rrc peers, iBGPs receive updates.
+...
+...               Copyright (c) 2016 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 uses play.py processes as iBGP rrc peers.
+...               This is analogue of single peer performance suite, which uses many peers.
+...               Each peer is of ibgp rrc type, and they contribute to the same example-bgp-rib,
+...               and thus to the same single example-ipv4-topology.
+...               The suite looks at example-ipv4-topology and checks BGP peers log for received updates.
+...
+...               ODL distinguishes peers by their IP addresses.
+...               Currently, this suite requires python utils to be started on ODL System,
+...               to guarantee IP address block is available for them to bind to.
+Suite Setup       Setup_Everything
+Suite Teardown    Teardown_Everything
+Test Setup        SetupUtils.Setup_Test_With_Logging_And_Fast_Failing
+Test Teardown     FailFast.Start_Failing_Fast_If_This_Failed
+Library           DateTime
+Library           RequestsLibrary
+Library           SSHLibrary    timeout=10s
+Variables         ${CURDIR}/../../../variables/Variables.py
+Resource          ${CURDIR}/../../../libraries/BGPSpeaker.robot
+Resource          ${CURDIR}/../../../libraries/ConfigViaRestconf.robot
+Resource          ${CURDIR}/../../../libraries/FailFast.robot
+Resource          ${CURDIR}/../../../libraries/KillPythonTool.robot
+Resource          ${CURDIR}/../../../libraries/PrefixCounting.robot
+Resource          ${CURDIR}/../../../libraries/SetupUtils.robot
+Resource          ${CURDIR}/../../../libraries/SSHKeywords.robot
+
+*** Variables ***
+${BGP_TOOL_LOG_LEVEL}    info
+${BGP_PEERS_LOG_FILE_NAME}    bgp_peer.log
+${BGP_VARIABLES_FOLDER}    ${CURDIR}/../../../variables/bgpuser/
+${CHECK_PERIOD}    10
+${CHECK_PERIOD_PREFIX_COUNT}    ${CHECK_PERIOD}
+${CHECK_PERIOD_PREFIX_COUNT_MANY}    ${CHECK_PERIOD_PREFIX_COUNT}
+${CHECK_PERIOD_PREFIX_COUNT_MANY_RRC}    ${CHECK_PERIOD_PREFIX_COUNT_MANY}
+${COUNT}          1000000
+${COUNT_PREFIX_COUNT}    ${COUNT}
+${COUNT_PREFIX_COUNT_MANY}    ${COUNT_PREFIX_COUNT}
+${COUNT_PREFIX_COUNT_MANY_RRC}    ${COUNT_PREFIX_COUNT_MANY}
+${FIRST_PEER_IP}    127.0.0.1
+${HOLDTIME}       180
+${HOLDTIME_PREFIX_COUNT}    ${HOLDTIME}
+${HOLDTIME_PREFIX_COUNT_MANY}    ${HOLDTIME_PREFIX_COUNT}
+${HOLDTIME_PREFIX_COUNT_MANY_RRC}    ${HOLDTIME_PREFIX_COUNT_MANY}
+${KARAF_LOG_LEVEL}    INFO
+${KARAF_BGPCEP_LOG_LEVEL}    ${KARAF_LOG_LEVEL}
+${KARAF_PROTOCOL_LOG_LEVEL}    ${KARAF_BGPCEP_LOG_LEVEL}
+${MULTIPLICITY}    10
+${MULTIPLICITY_PREFIX_COUNT}    ${MULTIPLICITY}
+${MULTIPLICITY_PREFIX_COUNT_MANY}    ${MULTIPLICITY_PREFIX_COUNT}
+${MULTIPLICITY_PREFIX_COUNT_MANY_RRC}    ${MULTIPLICITY_PREFIX_COUNT_MANY}
+${REPETITIONS}    1
+${REPETITIONS_PREFIX_COUNT}    ${REPETITIONS}
+${REPETITIONS_PREFIX_COUNT_MANY}    ${REPETITIONS_PREFIX_COUNT}
+${REPETITIONS_PREFIX_COUNT_MANY_RRC}    ${REPETITIONS_PREFIX_COUNT_MANY}
+${TEST_DURATION_MULTIPLIER}    1
+${TEST_DURATION_MULTIPLIER_PREFIX_COUNT}    ${TEST_DURATION_MULTIPLIER}
+${TEST_DURATION_MULTIPLIER_PREFIX_COUNT_MANY}    ${TEST_DURATION_MULTIPLIER_PREFIX_COUNT}
+${TEST_DURATION_MULTIPLIER_PREFIX_COUNT_MANY_RRC}    ${TEST_DURATION_MULTIPLIER_PREFIX_COUNT_MANY}
+# TODO: Option names can be better.
+# TODO: TODOs can be better.
+
+*** Test Cases ***
+Check_For_Empty_Ipv4_Topology_Before_Talking
+    [Documentation]    Wait for example-ipv4-topology to come up and empty. Give large timeout for case when BGP boots slower than restconf.
+    [Tags]    critical
+    [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
+    BuiltIn.Wait_Until_Keyword_Succeeds    120s    1s    PrefixCounting.Check_Ipv4_Topology_Is_Empty
+
+Reconfigure_ODL_To_Accept_Connections
+    [Documentation]    Configure BGP peer modules with initiate-connection set to false.
+    [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
+    : FOR    ${index}    IN RANGE    1    ${MULTIPLICITY_PREFIX_COUNT_MANY_RRC}+1
+    \    ${peer_name} =    BuiltIn.Set_Variable    example-bgp-peer-${index}
+    \    ${peer_ip} =    BuiltIn.Evaluate    str(ipaddr.IPAddress('${FIRST_PEER_IP}') + ${index} - 1)    modules=ipaddr
+    \    ${template_as_string} =    BuiltIn.Set_Variable    {'NAME': '${peer_name}', 'IP': '${peer_ip}', 'PEER_PORT': '${BGP_TOOL_PORT}', 'HOLDTIME': '${HOLDTIME_PREFIX_COUNT_MANY_RRC}', 'PEER_ROLE': 'rr-client', 'INITIATE': 'false'}
+    \    ConfigViaRestconf.Put_Xml_Template_Folder_Config_Via_Restconf    ${BGP_VARIABLES_FOLDER}${/}ibgp_peers    ${template_as_string}
+
+Start_Talking_BGP_Manager
+    [Documentation]    Start Python manager to connect speakers to ODL.
+    BGPSpeaker.Start_BGP_Manager    --amount=${COUNT_PREFIX_COUNT_MANY_RRC} --multiplicity=${MULTIPLICITY_PREFIX_COUNT_MANY_RRC} --myip=${FIRST_PEER_IP} --myport=${BGP_TOOL_PORT} --peerip=${ODL_SYSTEM_IP} --peerport=${ODL_BGP_PORT} --logfile=${BGP_PEERS_LOG_FILE_NAME} --${BGP_TOOL_LOG_LEVEL}
+
+Wait_For_Ipv4_Topology
+    [Documentation]    Wait until example-ipv4-topology reaches the target prefix count.
+    [Tags]    critical
+    [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
+    BuiltIn.Log    ${bgp_filling_timeout}s    console=yes
+    BuiltIn.Wait_Until_Keyword_Succeeds    ${bgp_filling_timeout}    ${CHECK_PERIOD_PREFIX_COUNT_MANY_RRC}    Check_Ipv4_Topology    ${COUNT_PREFIX_COUNT_MANY_RRC}
+    [Teardown]    Report_Failure_Due_To_Bug    5185
+
+Check_Logs_For_Updates
+    [Documentation]    Check BGP peer logs for received updates.
+    [Tags]    critical
+    ${timeout} =    BuiltIn.Set_Variable    ${bgp_filling_timeout}
+    : FOR    ${index}    IN RANGE    1    ${MULTIPLICITY_PREFIX_COUNT_MANY_RRC}+1
+    \    ${bgp_peer_label} =    BuiltIn.Set_Variable    BGP-Dummy-${index}
+    \    ${expected_prefixcount} =    BuiltIn.Evaluate    ${COUNT_PREFIX_COUNT_MANY_RRC} - ${COUNT_PREFIX_COUNT_MANY_RRC} / ${MULTIPLICITY_PREFIX_COUNT_MANY_RRC}
+    \    ${expected_string} =    BuiltIn.Set_Variable    total_received_nlri_prefix_counter: ${expected_prefixcount}
+    \    BuiltIn.Wait_Until_Keyword_Succeeds    ${timeout}    1s    Check_File_For_Occurence    ${BGP_PEERS_LOG_FILE_NAME}    ${bgp_peer_label}
+    \    ...    ${expected_string}    2
+    \    ${timeout} =    BuiltIn.Set_Variable    20s
+    # FIXME: Calculation of ${expected_prefixcount} correct just when the ${COUNT_PREFIX_COUNT_MANY_RRC} is a multiplication of ${MULTIPLICITY_PREFIX_COUNT_MANY_RRC}
+
+Kill_Talking_BGP_Speakers
+    [Documentation]    Abort the Python speakers. Also, attempt to stop failing fast.
+    [Tags]    critical
+    [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
+    BGPSpeaker.Kill_BGP_Speaker
+    FailFast.Do_Not_Fail_Fast_From_Now_On
+    # NOTE: It is still possible to remain failing fast, if both previous and this test have failed.
+    [Teardown]    FailFast.Do_Not_Start_Failing_If_This_Failed
+
+Wait_For_Stable_Ipv4_Topology_After_Talking
+    [Documentation]    Wait until example-ipv4-topology becomes stable again.
+    [Tags]    critical
+    [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
+    PrefixCounting.Wait_For_Ipv4_Topology_Prefixes_To_Become_Stable    timeout=${bgp_emptying_timeout}    period=${CHECK_PERIOD_PREFIX_COUNT_MANY_RRC}    repetitions=${REPETITIONS_PREFIX_COUNT_MANY_RRC}    excluded_count=${COUNT_PREFIX_COUNT_MANY_RRC}
+    [Teardown]    Report_Failure_Due_To_Bug    5097
+
+Check_For_Empty_Ipv4_Topology_After_Talking
+    [Documentation]    Example-ipv4-topology should be empty now.
+    [Tags]    critical
+    [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
+    PrefixCounting.Check_Ipv4_Topology_Is_Empty
+    [Teardown]    Report_Failure_Due_To_Bug    5097
+
+Delete_Bgp_Peer_Configuration
+    [Documentation]    Revert the BGP configuration to the original state: without any configured peers.
+    [Tags]    critical
+    [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
+    : FOR    ${index}    IN RANGE    1    ${MULTIPLICITY_PREFIX_COUNT_MANY_RRC}+1
+    \    ${template_as_string}=    BuiltIn.Set_Variable    {'NAME': 'example-bgp-peer-${index}'}
+    \    ConfigViaRestconf.Delete_Xml_Template_Folder_Config_Via_Restconf    ${BGP_VARIABLESFOLDER}${/}ibgp_peers    ${template_as_string}
+
+*** Keywords ***
+Setup_Everything
+    [Documentation]    Setup imported resources, SSH-login to ODL system,
+    ...    create HTTP session, put Python tool to ODL system.
+    SetupUtils.Setup_Utils_For_Setup_And_Teardown
+    ConfigViaRestconf.Setup_Config_Via_Restconf
+    PrefixCounting.PC_Setup
+    SSHLibrary.Set_Default_Configuration    prompt=${ODL_SYSTEM_PROMPT}
+    SSHLibrary.Open_Connection    ${ODL_SYSTEM_IP}
+    Utils.Flexible_Controller_Login
+    RequestsLibrary.Create_Session    operational    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}${OPERATIONAL_API}    auth=${AUTH}
+    # TODO: Do not include slash in ${OPERATIONAL_TOPO_API}, having it typed here is more readable.
+    # TODO: Alternatively, create variable in Variables which starts with http.
+    # Both TODOs would probably need to update every suite relying on current Variables.
+    SSHKeywords.Require_Python
+    SSHKeywords.Assure_Library_Ipaddr    target_dir=.
+    SSHLibrary.Put_File    ${CURDIR}/../../../../tools/fastbgp/play.py
+    # Calculate the timeout value based on how many routes are going to be pushed.
+    ${period} =    DateTime.Convert_Time    ${CHECK_PERIOD_PREFIX_COUNT_MANY_RRC}    result_format=number
+    ${timeout} =    BuiltIn.Evaluate    ${MULTIPLICITY_PREFIX_COUNT_MANY_RRC} * ${TEST_DURATION_MULTIPLIER_PREFIX_COUNT_MANY_RRC} * (${COUNT_PREFIX_COUNT_MANY_RRC} * 6.0 / 10000 + ${period} * (${REPETITIONS_PREFIX_COUNT_MANY_RRC} + 1)) + 20
+    Builtin.Set_Suite_Variable    ${bgp_filling_timeout}    ${timeout}
+    ${timeout} =    BuiltIn.Evaluate    ${TEST_DURATION_MULTIPLIER_PREFIX_COUNT_MANY_RRC} * (${COUNT_PREFIX_COUNT_MANY_RRC} * 2.0 / 10000 + ${period} * (${REPETITIONS_PREFIX_COUNT_MANY_RRC} + 1)) + 20
+    Builtin.Set_Suite_Variable    ${bgp_emptying_timeout}    ${timeout}
+    KarafKeywords.Execute_Controller_Karaf_Command_On_Background    log:set ${KARAF_LOG_LEVEL}
+
+Teardown_Everything
+    [Documentation]    Make sure Python tool was killed and tear down imported Resources.
+    # Environment issue may have dropped the SSH connection, but we do not want Teardown to fail.
+    BuiltIn.Run_Keyword_And_Ignore_Error    KillPythonTool.Search_And_Kill_Remote_Python    'play\.py'
+    ConfigViaRestconf.Teardown_Config_Via_Restconf
+    RequestsLibrary.Delete_All_Sessions
+    SSHLibrary.Close_All_Connections
+
+Check_Ipv4_Topology
+    [Arguments]    ${expected_count}=0
+    [Documentation]    Check and log the IPv4 topology count
+    ${current_time} =    DateTime.Get_Current_Date    exclude_millis=True
+    ${actual_count} =    PrefixCounting.Get_Ipv4_Topology_Count
+    BuiltIn.Log    ${current_time}: actual (expected) prefix count is ${actual_count} (${expected_count})    console=yes
+    BuiltIn.Should_Be_Equal_As_Strings    ${actual_count}    ${expected_count}
+
+Check_File_For_Occurence
+    [Arguments]    ${file_name}    ${keyword}    ${value}=''    ${threshold}=1
+    [Documentation]    Check file for ${keyword} or ${keyword} ${value} pair and returns number of occurences
+    ${output_log}=    SSHLibrary.Execute_Command    grep '${keyword}' '${file_name}' | grep -c '${value}'
+    ${count}=    Convert To Integer    ${output_log}
+    BuiltIn.Should_Be_True    ${count} >= ${threshold}
+    [Return]    ${count}
index 2a7fbcca41b9b8e34aeec04b68330b75200a02b2..26c79c79bfd08693830d713456a9fe72c53e385c 100644 (file)
@@ -10,4 +10,5 @@ integration/test/csit/suites/bgpcep/bgpingest/singlepeer_prefixcount.robot
 integration/test/csit/suites/bgpcep/bgpingest/singlepeer_changecount.robot
 integration/test/csit/suites/bgpcep/bgpingest/bgp_app_peer_prefixcount.robot
 integration/test/csit/suites/bgpcep/bgpingest/manypeers_prefixcount.robot
+integration/test/csit/suites/bgpcep/bgpingest/manypeers_peercount.robot
 integration/test/csit/suites/bgpcep/bgpingest/manypeers_changecount.robot
index 6ad79a60dee6a7241c143236b7a0b1605af120bb..5551bc8df1480839bdd63afdc4ccb388041dd913 100755 (executable)
@@ -1607,7 +1607,7 @@ def create_logger(loglevel, logfile):
         :return: logger object
     """
     logger = logging.getLogger("logger")
-    log_formatter = logging.Formatter("%(asctime)s %(levelname)s: %(message)s")
+    log_formatter = logging.Formatter("%(asctime)s %(levelname)s BGP-%(threadName)s: %(message)s")
     console_handler = logging.StreamHandler()
     file_handler = logging.FileHandler(logfile, mode="w")
     console_handler.setFormatter(log_formatter)
@@ -1709,7 +1709,4 @@ def threaded_job(arguments):
 if __name__ == "__main__":
     arguments = parse_arguments()
     logger = create_logger(arguments.loglevel, arguments.logfile)
-    if arguments.multiplicity > 1:
-        threaded_job(arguments)
-    else:
-        job(arguments)
+    threaded_job(arguments)