bgp prefixcount suite with nonreplicated bgp_rib 61/46661/28
authorPeter Gubka <pgubka@cisco.com>
Fri, 7 Oct 2016 09:49:37 +0000 (11:49 +0200)
committerPeter Gubka <pgubka@cisco.com>
Fri, 4 Nov 2016 17:50:43 +0000 (18:50 +0100)
Change-Id: I28611ae8492c6e899be86e8f6309e777acf53d6f
Signed-off-by: Peter Gubka <pgubka@cisco.com>
14 files changed:
csit/libraries/ClusterManagement.robot
csit/scriptplans/bgpcep-bgpcluster-prefixcount-nonreplic.txt [new file with mode: 0644]
csit/suites/bgpcep/bgpclustering/005_Cluster_Reset_And_Set_Nonreplicated_Bgp_Rib.robot [new file with mode: 0644]
csit/suites/bgpcep/bgpclustering/010_singlepeer_prefixcount_1route.robot
csit/suites/bgpcep/bgpclustering/010_singlepeer_prefixcount_1route_Be.robot
csit/suites/bgpcep/bgpclustering/010_singlepeer_prefixcount_1route_nonreplicated_rib.robot [new file with mode: 0644]
csit/suites/bgpcep/bgpclustering/020_singlepeer_prefixcount_100kroutes.robot
csit/suites/bgpcep/bgpclustering/020_singlepeer_prefixcount_100kroutes_Be.robot
csit/suites/bgpcep/bgpclustering/020_singlepeer_prefixcount_100kroutes_nonreplicated_rib.robot [new file with mode: 0644]
csit/suites/bgpcep/bgpclustering/030_singlepeer_prefixcount_1Mroutes.robot
csit/suites/bgpcep/bgpclustering/030_singlepeer_prefixcount_1Mroutes_Be.robot
csit/suites/bgpcep/bgpclustering/030_singlepeer_prefixcount_1Mroutes_nonreplicated_rib.robot [new file with mode: 0644]
csit/suites/bgpcep/bgpclustering/PrefixcountKeywords.robot [new file with mode: 0644]
csit/testplans/bgpcep-bgpclustering.txt

index 85ebb124b678e8134b1b1fae9503516eeb84d51c..f094272bae43111ddf38e379eccb93f1cbb017cb 100644 (file)
@@ -492,6 +492,16 @@ Clean_Directories_On_List_Or_All
     ${path_list} =    Builtin.Set Variable If    "${directory_list}" == "${EMPTY}"    ${ODL_DEFAULT_DATA_PATHS}    ${directory_list}
     Safe_With_Ssh_To_List_Or_All_Run_Keyword    ${member_index_list}    ClusterManagement__Clean_Directories    ${path_list}    ${karaf_home}
 
+Store_Karaf_Log_On_List_Or_All
+    [Arguments]    ${member_index_list}=${EMPTY}    ${dst_dir}=/tmp    ${karaf_home}=${KARAF_HOME}
+    [Documentation]    Saves karaf.log to the ${dst_dir} for members in given list or all. Return None.
+    Safe_With_Ssh_To_List_Or_All_Run_Keyword    ${member_index_list}    SSHKeywords.Execute_Command_Should_Pass    cp ${karaf_home}/data/log/karaf.log ${dst_dir}
+
+Restore_Karaf_Log_On_List_Or_All
+    [Arguments]    ${member_index_list}=${EMPTY}    ${src_dir}=/tmp    ${karaf_home}=${KARAF_HOME}
+    [Documentation]    Places stored karaf.log to the ${karaf_home}/data/log for members in given list or all. Return None.
+    Safe_With_Ssh_To_List_Or_All_Run_Keyword    ${member_index_list}    SSHKeywords.Execute_Command_Should_Pass    cp ${src_dir}/karaf.log ${karaf_home}/data/log/
+
 ClusterManagement__Clean_Directories
     [Arguments]    ${relative_path_list}    ${karaf_home}
     [Documentation]    For each relative path, remove files with respect to ${karaf_home}. Return None.
diff --git a/csit/scriptplans/bgpcep-bgpcluster-prefixcount-nonreplic.txt b/csit/scriptplans/bgpcep-bgpcluster-prefixcount-nonreplic.txt
new file mode 100644 (file)
index 0000000..30e85ab
--- /dev/null
@@ -0,0 +1,8 @@
+# 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
+
+# Place the suites in run order:
+integration/test/csit/scripts/controllermem_6g.sh
diff --git a/csit/suites/bgpcep/bgpclustering/005_Cluster_Reset_And_Set_Nonreplicated_Bgp_Rib.robot b/csit/suites/bgpcep/bgpclustering/005_Cluster_Reset_And_Set_Nonreplicated_Bgp_Rib.robot
new file mode 100644 (file)
index 0000000..f570e08
--- /dev/null
@@ -0,0 +1,77 @@
+*** Settings ***
+Documentation     Kill nodes, delete all data created since boot, change cluster configs,
+...               start nodes, wait for sync.
+...
+...               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
+Suite Setup       ClusterManagement.ClusterManagement_Setup
+Default Tags      clustering    critical
+Library           DateTime
+Library           OperatingSystem
+Library           SSHLibrary
+Resource          ${CURDIR}/../../../libraries/ClusterManagement.robot
+Library           ${CURDIR}/../../../libraries/ConfGen.py
+Library           Collections
+
+*** Variables ***
+${MODULES_FILE}    modules.conf
+${MODULE_SHARDS_FILE}    module-shards.conf
+${RIB_SHARD_NAME}    bgp_rib
+${RIB_SHARD_NAMESPACE}    urn:opendaylight:params:xml:ns:yang:bgp-rib
+
+*** Test Cases ***
+Kill_All_Members
+    [Documentation]    Kill every node, download karaf logs.
+    ClusterManagement.Kill_Members_From_List_Or_All
+
+Store_Karaf_Log_And_Clean_All
+    [Documentation]    Remove various data folders, including ${KARAF_HOME}/data/ on every node.
+    ...    Start each memberand wait for sync.
+    ClusterManagement.Store_Karaf_Log_On_List_Or_All
+    ClusterManagement.Clean_Directories_On_List_Or_All
+    ClusterManagement.Run_Bash_Command_On_List_Or_All    mkdir -p ${KARAF_HOME}/data/log
+    ClusterManagement.Restore_Karaf_Log_On_List_Or_All
+
+Upload_Initial_Config_Files
+    [Documentation]    Upload config files for non-replicated bgp_rib
+    : FOR    ${idx}    IN    @{ClusterManagement__member_index_list}
+    \    ${idxl}=    BuiltIn.Create_List    ${idx}
+    \    ClusterManagement.Safe_With_Ssh_To_List_Or_All_Run_Keyword    member_index_list=${idxl}    keyword_name=Set_Config_Files_With_Nonreplicated_Rib    index_list=${idxl}
+
+Start_All_And_Sync
+    [Documentation]    Start each memberand wait for sync.
+    ClusterManagement.Start_Members_From_List_Or_All
+    BuiltIn.Comment    Basic synch performed, but waits for specific functionality may still be needed.
+    BuiltIn.Wait_Until_Keyword_Succeeds    2m    5s    Topology_Available
+    ClusterManagement.Run_Bash_Command_On_List_Or_All    ps -ef | grep java
+
+*** Keywords ***
+Download_Karaf_Log
+    ${timestamp} =    DateTime.Get_Current_Date    time_zone=UTC    result_format=%Y%m%d%H%M%S%f
+    SSHLibrary.Get_File    ${WORKSPACE}${/}${BUNDLEFOLDER}${/}data${/}log${/}karaf.log    karaf_${timestamp}.log
+
+Topology_Available
+    ${session}=    ClusterManagement.Resolve_Http_Session_For_Member    1
+    TemplatedRequests.Get_As_Json_From_Uri    /restconf/operational/network-topology:network-topology/topology/example-ipv4-topology    session=${session}
+
+Set_Config_Files_With_Nonreplicated_Rib
+    [Arguments]    ${index_list}
+    ${modules_file}=    SSHLibrary.Execute_Command    ls ${WORKSPACE}${/}${BUNDLEFOLDER}${/}system${/}org${/}opendaylight${/}controller${/}sal-clustering-config${/}*${/}*-moduleconf.xml
+    ${module_shards_file}=    SSHLibrary.Execute_Command    ls ${WORKSPACE}${/}${BUNDLEFOLDER}${/}system${/}org${/}opendaylight${/}controller${/}sal-clustering-config${/}*${/}*-moduleshardconf.xml
+    SSHLibrary.Get File    ${modules_file}    ${CURDIR}${/}${MODULES_FILE}.tmpl
+    SSHLibrary.Get File    ${module_shards_file}    ${CURDIR}${/}${MODULE_SHARDS_FILE}.tmpl
+    ${modules_content}=    ConfGen.Generate_Modules    ${CURDIR}${/}${MODULES_FILE}.tmpl    name=${RIB_SHARD_NAME}    namespace=${RIB_SHARD_NAMESPACE}
+    ${ms_content}=    ConfGen.Generate_Module_Shards    ${CURDIR}${/}${MODULE_SHARDS_FILE}.tmpl    nodes=${NUM_ODL_SYSTEM}    shard_name=${RIB_SHARD_NAME}    replicas=${index_list}
+    OperatingSystem.Create File    ${CURDIR}${/}${MODULES_FILE}    ${modules_content}
+    OperatingSystem.Create File    ${CURDIR}${/}${MODULE_SHARDS_FILE}    ${ms_content}
+    SSHLibrary.Put File    ${CURDIR}${/}${MODULES_FILE}    ${WORKSPACE}${/}${BUNDLEFOLDER}${/}configuration${/}initial${/}${MODULES_FILE}
+    SSHLibrary.Put File    ${CURDIR}${/}${MODULE_SHARDS_FILE}    ${WORKSPACE}${/}${BUNDLEFOLDER}${/}configuration${/}initial${/}${MODULE_SHARDS_FILE}
+    ${stdout}    ${stderr}=    SSHLibrary.Execute_Command    cat ${WORKSPACE}${/}${BUNDLEFOLDER}${/}configuration${/}initial${/}${MODULES_FILE}    return_stderr=True
+    BuiltIn.Log    ${stdout}
+    BuiltIn.Should_Be_Empty    ${stderr}
+    ${stdout}    ${stderr}=    SSHLibrary.Execute_Command    cat ${WORKSPACE}${/}${BUNDLEFOLDER}${/}configuration${/}initial${/}${MODULE_SHARDS_FILE}    return_stderr=True
+    BuiltIn.Log    ${stdout}
+    BuiltIn.Should_Be_Empty    ${stderr}
index 8de4925f3b45d4a33b21813be950901ad33a7462..6b4d2840d814e2191b3782b1f55eb9cb825b3fd0 100644 (file)
@@ -14,8 +14,8 @@ Documentation     BGP performance of ingesting from 1 iBGP peer, data change cou
 ...               <dst-id> is recognized during the suite run, should be the Leader of default
 ...               operational Shard, otherwise the scenario would fail due to
 ...               https://bugs.opendaylight.org/show_bug.cgi?id=5536
-Suite Setup       Setup_Everything
-Suite Teardown    Teardown_Everything
+Suite Setup       PrefixcountKeywords.Setup_Everything
+Suite Teardown    PrefixcountKeywords.Teardown_Everything
 Test Setup        SetupUtils.Setup_Test_With_Logging_And_Fast_Failing
 Test Teardown     SetupUtils.Teardown_Test_Show_Bugs_And_Start_Fast_Failing_If_Test_Failed
 Library           SSHLibrary    timeout=10s
@@ -30,46 +30,17 @@ Resource          ${CURDIR}/../../../libraries/SetupUtils.robot
 Resource          ${CURDIR}/../../../libraries/ClusterManagement.robot
 Resource          ${CURDIR}/../../../libraries/SSHKeywords.robot
 Resource          ${CURDIR}/../../../libraries/TemplatedRequests.robot
+Resource          ${CURDIR}/PrefixcountKeywords.robot
 
 *** Variables ***
-${BGP_TOOL_LOG_LEVEL}    info
-${BGP_VARIABLES_FOLDER}    ${CURDIR}/../../../variables/bgpclustering/bgp_peer
-${BGP_VARIABLES_FOLDER_OP}    ${CURDIR}/../../../variables/bgpclustering/bgp_peer_operational
-${NETCONF_DEV_FOLDER}    ${CURDIR}/../../../variables/netconf/device/full-uri-device
-${NETCONF_MOUNT_FOLDER}    ${CURDIR}/../../../variables/netconf/device/full-uri-mount
-${CHECK_PERIOD}    10
 ${COUNT}          1
-${HOLDTIME}       180
-${INSERT}         1
-${KARAF_LOG_LEVEL}    INFO
-${KARAF_BGPCEP_LOG_LEVEL}    ${KARAF_LOG_LEVEL}
-${KARAF_PROTOCOL_LOG_LEVEL}    ${KARAF_BGPCEP_LOG_LEVEL}
-${PREFILL}        0
-${REPETITIONS}    1
-${RESULTS_FILE_NAME}    bgp.csv
-${TEST_DURATION_MULTIPLIER}    1
-${UPDATE}         single
-${WITHDRAW}       0
-${INITIAL_RESTCONF_TIMEOUT}    30s
-${KARAF_HOME}     ${WORKSPACE}/${BUNDLEFOLDER}
-${SHARD_DEFAULT_CONFIG}    shard-default-config
-${SHARD_DEFAULT_OPERATIONAL}    shard-default-operational
-${CONFIG_SESSION}    config-session
-${CONFIGURATION_1}    operational-1
-${CONFIGURATION_2}    operational-2
-${CONFIGURATION_3}    operational-3
-${EXAMPLE_IPV4_TOPOLOGY}    example-ipv4-topology
-${DEVICE_NAME}    peer-controller-config
-${DEVICE_CHECK_TIMEOUT}    60s
-${RIB_INSTANCE}    example-bgp-rib
-${BGP_PEER_NAME}    example-bgp-peer
 
 *** Test Cases ***
 Get Example Bgp Rib Owner
     [Documentation]    Find an odl node which is able to accept incomming connection. To this node netconf connector should be configured.
     ${rib_owner}    ${rib_candidates}=    ClusterManagement.Get_Owner_And_Successors_For_device    example-bgp-rib    org.opendaylight.mdsal.ServiceEntityType    1
-    BuiltIn.Set Suite variable    ${rib_owner}    ${rib_owner}
-    BuiltIn.Set Suite variable    ${rib_owner_node_id}    ${ODL_SYSTEM_${rib_owner}_IP}
+    BuiltIn.Set_Suite_Variable    ${rib_owner}    ${rib_owner}
+    BuiltIn.Set_Suite_Variable    ${rib_owner_node_id}    ${ODL_SYSTEM_${rib_owner}_IP}
     RequestsLibrary.Create_Session    ${CONFIG_SESSION}    http://${ODL_SYSTEM_${rib_owner}_IP}:${RESTCONFPORT}    auth=${AUTH}
 
 Check_For_Empty_Ipv4_Topology_Before_Talking_1
@@ -92,10 +63,10 @@ Check_For_Empty_Ipv4_Topology_Before_Talking_3
 
 Configure_Netconf_Device
     [Documentation]    Configures and verifies netconf device configuration. If configuration is not successful, it de-configures the device before the next attempt.
-    &{mapping}    Create Dictionary    DEVICE_NAME=${DEVICE_NAME}    DEVICE_PORT=1830    DEVICE_IP=${rib_owner_node_id}    DEVICE_USER=admin    DEVICE_PASSWORD=admin
+    &{mapping}    BuiltIn.Create_Dictionary    DEVICE_NAME=${DEVICE_NAME}    DEVICE_PORT=1830    DEVICE_IP=${rib_owner_node_id}    DEVICE_USER=admin    DEVICE_PASSWORD=admin
     # After the netconf device is configured, odl starts downloading schemas. If the downloading will not finish within akka timeout, more tries are needed, 3 is based on a user experience.
     : FOR    ${index}    IN RANGE    0    3
-    \    ${status}    ${value}=    Run Keyword And Ignore Error    Configure Netconf Device And Check Mounted    ${mapping}
+    \    ${status}    ${value}=    Run Keyword And Ignore Error    PrefixcountKeywords.Configure_Netconf_Device_And_Check_Mounted    ${mapping}
     \    Exit For Loop If    '${status}' == 'PASS'
     \    Run Keyword Unless    '${status}' == 'PASS'    TemplatedRequests.Delete_Templated    ${NETCONF_DEV_FOLDER}    mapping=${mapping}    session=${CONFIG_SESSION}
     Run Keyword Unless    '${status}' == 'PASS'    Fail
@@ -103,14 +74,14 @@ Configure_Netconf_Device
 Reconfigure_ODL_To_Accept_Connection
     [Documentation]    Configure BGP peer module with initiate-connection set to false.
     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
-    &{mapping}    Create Dictionary    DEVICE_NAME=${DEVICE_NAME}    BGP_NAME=${BGP_PEER_NAME}    IP=${TOOLS_SYSTEM_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}
+    &{mapping}    BuiltIn.Create_Dictionary    DEVICE_NAME=${DEVICE_NAME}    BGP_NAME=${BGP_PEER_NAME}    IP=${TOOLS_SYSTEM_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}
     ...    INITIATE=false    BGP_RIB=${RIB_INSTANCE}
     TemplatedRequests.Put_As_Json_Templated    ${BGP_VARIABLES_FOLDER}    mapping=${mapping}    session=${CONFIG_SESSION}
     [Teardown]    SetupUtils.Teardown_Test_Show_Bugs_If_Test_Failed
 
 Start_Talking_BGP_Speaker
-    [Documentation]    Start Python speaker to connect to ODL. We need to do WUKS until odl really starts to accept incomming bgp connection. The failure happens if the incomming connection comes too quickly after configuring the peer in the previous test case.
-    BuiltIn.Wait_Until_Keyword_Succeeds    3x    1s    Start Bgp Peer
+    [Documentation]    Start Python speaker to connect to ODL.
+    PrefixcountKeywords.Start_Bgp_Peer_And_Verify_Connected    connection_retries=${3}
 
 Wait_For_Stable_Talking_Ipv4_Topology_1
     [Documentation]    Wait until ${EXAMPLE_IPV4_TOPOLOGY} becomes stable. This is done by checking stability of prefix count as seen from node 1.
@@ -185,63 +156,12 @@ Check_For_Empty_Ipv4_Topology_After_Listening_3
 Delete_Bgp_Peer_Configuration
     [Documentation]    Revert the BGP configuration to the original state: without any configured peers.
     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
-    &{mapping}    Create Dictionary    DEVICE_NAME=${DEVICE_NAME}    BGP_NAME=${BGP_PEER_NAME}    IP=${TOOLS_SYSTEM_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}
+    &{mapping}    BuiltIn.Create_Dictionary    DEVICE_NAME=${DEVICE_NAME}    BGP_NAME=${BGP_PEER_NAME}    IP=${TOOLS_SYSTEM_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}
     ...    INITIATE=false    BGP_RIB=${RIB_INSTANCE}
     TemplatedRequests.Delete_Templated    ${BGP_VARIABLES_FOLDER}    mapping=${mapping}    session=${CONFIG_SESSION}
 
 Delete_Netconf_Device_Configuration
     [Documentation]    Revert the netconf configuration to the original stat
     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
-    &{mapping}    Create Dictionary    DEVICE_NAME=${DEVICE_NAME}    DEVICE_PORT=1830    DEVICE_IP=${rib_owner_node_id}    DEVICE_USER=admin    DEVICE_PASSWORD=admin
+    &{mapping}    BuiltIn.Create_Dictionary    DEVICE_NAME=${DEVICE_NAME}    DEVICE_PORT=1830    DEVICE_IP=${rib_owner_node_id}    DEVICE_USER=admin    DEVICE_PASSWORD=admin
     TemplatedRequests.Delete_Templated    ${NETCONF_DEV_FOLDER}    mapping=${mapping}    session=${CONFIG_SESSION}
-
-*** Keywords ***
-Setup_Everything
-    [Documentation]    Setup imported resources, SSH-login to tools system,
-    ...    create HTTP session, put Python tool to tools system.
-    SetupUtils.Setup_Utils_For_Setup_And_Teardown
-    ClusterManagement.ClusterManagement_Setup
-    RequestsLibrary.Create_Session    ${CONFIGURATION_1}    http://${ODL_SYSTEM_1_IP}:${RESTCONFPORT}${OPERATIONAL_API}    auth=${AUTH}
-    RequestsLibrary.Create_Session    ${CONFIGURATION_2}    http://${ODL_SYSTEM_2_IP}:${RESTCONFPORT}${OPERATIONAL_API}    auth=${AUTH}
-    RequestsLibrary.Create_Session    ${CONFIGURATION_3}    http://${ODL_SYSTEM_3_IP}:${RESTCONFPORT}${OPERATIONAL_API}    auth=${AUTH}
-    PrefixCounting.PC_Setup
-    SSHLibrary.Set_Default_Configuration    prompt=${TOOLS_SYSTEM_PROMPT}
-    SSHLibrary.Open_Connection    ${TOOLS_SYSTEM_IP}
-    Utils.Flexible_Mininet_Login
-    # 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.
-    SSHLibrary.Put_File    ${CURDIR}/../../../../tools/fastbgp/play.py
-    SSHKeywords.Require_Python
-    SSHKeywords.Assure_Library_Ipaddr    target_dir=.
-    # Calculate the timeout value based on how many routes are going to be pushed
-    # TODO: Replace 35 with some formula from period and repetitions.
-    ${timeout} =    BuiltIn.Evaluate    ${TEST_DURATION_MULTIPLIER} * (${COUNT} * 6.0 / 10000 + 35)
-    Builtin.Set_Suite_Variable    ${bgp_filling_timeout}    ${timeout}
-    Builtin.Set_Suite_Variable    ${bgp_emptying_timeout}    ${bgp_filling_timeout*3.0/4}
-    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'
-    RequestsLibrary.Delete_All_Sessions
-    SSHLibrary.Close_All_Connections
-
-Store_File_To_Workspace
-    [Arguments]    ${src_file_name}    ${dst_file_name}
-    [Documentation]    Store the provided file from the SSH client to workspace.
-    ${files}=    SSHLibrary.List Files In Directory    .
-    ${output_log}=    SSHLibrary.Execute_Command    cat ${src_file_name}
-    BuiltIn.Log    ${output_log}
-    Create File    ${dst_file_name}    ${output_log}
-
-Configure Netconf Device And Check Mounted
-    [Arguments]    ${mapping}
-    TemplatedRequests.Put_As_Xml_Templated    ${NETCONF_DEV_FOLDER}    mapping=${mapping}    session=${CONFIG_SESSION}
-    BuiltIn.Wait Until Keyword Succeeds    10x    3s    TemplatedRequests.Get_As_Xml_Templated    ${NETCONF_MOUNT_FOLDER}    mapping=${mapping}    session=${CONFIG_SESSION}
-
-Start Bgp Peer
-    [Documentation]    Starts bgp peer and verifies that the peer runs.
-    BGPSpeaker.Start_BGP_Speaker    --amount ${COUNT} --myip=${TOOLS_SYSTEM_IP} --myport=${BGP_TOOL_PORT} --peerip=${rib_owner_node_id} --peerport=${ODL_BGP_PORT} --insert=${INSERT} --withdraw=${WITHDRAW} --prefill ${PREFILL} --update ${UPDATE} --${BGP_TOOL_LOG_LEVEL} --results ${RESULTS_FILE_NAME}
-    BGPcliKeywords.Read_And_Fail_If_Prompt_Is_Seen
index 19c950be6988e6fee7c554224f1726f8a9ddfaf6..0de9716ac2a61425dc26e851540e780b81723595 100644 (file)
@@ -14,8 +14,8 @@ Documentation     BGP performance of ingesting from 1 iBGP peer, data change cou
 ...               <dst-id> is recognized during the suite run, should be the Leader of default
 ...               operational Shard, otherwise the scenario would fail due to
 ...               https://bugs.opendaylight.org/show_bug.cgi?id=5536
-Suite Setup       Setup_Everything
-Suite Teardown    Teardown_Everything
+Suite Setup       PrefixcountKeywords.Setup_Everything
+Suite Teardown    PrefixcountKeywords.Teardown_Everything
 Test Setup        SetupUtils.Setup_Test_With_Logging_And_Fast_Failing
 Test Teardown     SetupUtils.Teardown_Test_Show_Bugs_And_Start_Fast_Failing_If_Test_Failed
 Library           SSHLibrary    timeout=10s
@@ -30,45 +30,17 @@ Resource          ${CURDIR}/../../../libraries/SetupUtils.robot
 Resource          ${CURDIR}/../../../libraries/ClusterManagement.robot
 Resource          ${CURDIR}/../../../libraries/SSHKeywords.robot
 Resource          ${CURDIR}/../../../libraries/TemplatedRequests.robot
+Resource          ${CURDIR}/PrefixcountKeywords.robot
 
 *** Variables ***
-${BGP_TOOL_LOG_LEVEL}    info
-${BGP_VARIABLES_FOLDER}    ${CURDIR}/../../../variables/bgpclustering/bgp_peer
-${BGP_VARIABLES_FOLDER_OP}    ${CURDIR}/../../../variables/bgpclustering/bgp_peer_operational
-${NETCONF_DEV_FOLDER}    ${CURDIR}/../../../variables/netconf/device/full-uri-device
-${NETCONF_MOUNT_FOLDER}    ${CURDIR}/../../../variables/netconf/device/full-uri-mount
-${CHECK_PERIOD}    10
 ${COUNT}          1
-${HOLDTIME}       180
-${INSERT}         1
-${KARAF_LOG_LEVEL}    INFO
-${KARAF_BGPCEP_LOG_LEVEL}    ${KARAF_LOG_LEVEL}
-${KARAF_PROTOCOL_LOG_LEVEL}    ${KARAF_BGPCEP_LOG_LEVEL}
-${PREFILL}        0
-${REPETITIONS}    1
-${RESULTS_FILE_NAME}    bgp.csv
-${TEST_DURATION_MULTIPLIER}    1
-${UPDATE}         single
-${WITHDRAW}       0
-${INITIAL_RESTCONF_TIMEOUT}    30s
-${KARAF_HOME}     ${WORKSPACE}/${BUNDLEFOLDER}
-${SHARD_DEFAULT_CONFIG}    shard-default-config
-${SHARD_DEFAULT_OPERATIONAL}    shard-default-operational
-${CONFIG_SESSION}    config-session
-${CONFIGURATION_1}    operational-1
-${CONFIGURATION_2}    operational-2
-${CONFIGURATION_3}    operational-3
 ${EXAMPLE_IPV4_TOPOLOGY_PREF}    example-ipv4-topology-
-${DEVICE_NAME}    peer-controller-config
-${DEVICE_CHECK_TIMEOUT}    60s
-${RIB_INSTANCE}    example-bgp-rib
-${BGP_PEER_NAME}    example-bgp-peer
 
 *** Test Cases ***
 Get Default Operational Shard Leader
     ${dos_leader}    ${dos_followers}=    ClusterManagement.Get_Leader_And_Followers_For_Shard
-    BuiltIn.Set Suite variable    ${dos_leader}    ${dos_leader}
-    BuiltIn.Set Suite variable    ${default_oper_shard_leader_node_ip}    ${ODL_SYSTEM_${dos_leader}_IP}
+    BuiltIn.Set_Suite_Variable    ${dos_leader}    ${dos_leader}
+    BuiltIn.Set_Suite_Variable    ${default_oper_shard_leader_node_ip}    ${ODL_SYSTEM_${dos_leader}_IP}
     RequestsLibrary.Create_Session    ${CONFIG_SESSION}    http://${ODL_SYSTEM_${dos_leader}_IP}:${RESTCONFPORT}    auth=${AUTH}
 
 Check_For_Empty_Ipv4_Topology_Before_Talking_1
@@ -91,10 +63,10 @@ Check_For_Empty_Ipv4_Topology_Before_Talking_3
 
 Configure_Netconf_Device
     [Documentation]    Configures and verifies netconf device configuration. If configuration is not successful, it de-configures the device before the next attempt.
-    &{mapping}    Create Dictionary    DEVICE_NAME=${DEVICE_NAME}    DEVICE_PORT=1830    DEVICE_IP=${default_oper_shard_leader_node_ip}    DEVICE_USER=admin    DEVICE_PASSWORD=admin
+    &{mapping}    BuiltIn.Create_Dictionary    DEVICE_NAME=${DEVICE_NAME}    DEVICE_PORT=1830    DEVICE_IP=${default_oper_shard_leader_node_ip}    DEVICE_USER=admin    DEVICE_PASSWORD=admin
     # After the netconf device is configured, odl starts downloading schemas. If the downloading will not finish within akka timeout, more tries are needed, 3 is based on a user experience.
     : FOR    ${index}    IN RANGE    0    3
-    \    ${status}    ${value}=    Run Keyword And Ignore Error    Configure Netconf Device And Check Mounted    ${mapping}
+    \    ${status}    ${value}=    Run Keyword And Ignore Error    PrefixcountKeywords.Configure_Netconf_Device_And_Check_Mounted    ${mapping}
     \    Exit For Loop If    '${status}' == 'PASS'
     \    Run Keyword Unless    '${status}' == 'PASS'    TemplatedRequests.Delete_Templated    ${NETCONF_DEV_FOLDER}    mapping=${mapping}    session=${CONFIG_SESSION}
     Run Keyword Unless    '${status}' == 'PASS'    Fail
@@ -102,14 +74,14 @@ Configure_Netconf_Device
 Reconfigure_ODL_To_Accept_Connection
     [Documentation]    Configure BGP peer module with initiate-connection set to false.
     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
-    &{mapping}    Create Dictionary    DEVICE_NAME=${DEVICE_NAME}    BGP_NAME=${BGP_PEER_NAME}    IP=${TOOLS_SYSTEM_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}
+    &{mapping}    BuiltIn.Create_Dictionary    DEVICE_NAME=${DEVICE_NAME}    BGP_NAME=${BGP_PEER_NAME}    IP=${TOOLS_SYSTEM_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}
     ...    INITIATE=false    BGP_RIB=${RIB_INSTANCE}
     TemplatedRequests.Put_As_Json_Templated    ${BGP_VARIABLES_FOLDER}    mapping=${mapping}    session=${CONFIG_SESSION}
     [Teardown]    SetupUtils.Teardown_Test_Show_Bugs_If_Test_Failed
 
 Start_Talking_BGP_Speaker
-    [Documentation]    Start Python speaker to connect to ODL. We need to do WUKS until odl really starts to accept incomming bgp connection. The failure happens if the incomming connection comes too quickly after configuring the peer in the previous test case.
-    BuiltIn.Wait_Until_Keyword_Succeeds    3x    1s    Start Bgp Peer
+    [Documentation]    Start Python speaker to connect to ODL.
+    PrefixcountKeywords.Start_Bgp_Peer_And_Verify_Connected    connection_retries=${3}    peerip=${default_oper_shard_leader_node_ip}
 
 Wait_For_Stable_Talking_Ipv4_Topology_1
     [Documentation]    Wait until ${EXAMPLE_IPV4_TOPOLOGY_PREF}${dos_leader} becomes stable. This is done by checking stability of prefix count as seen from node 1.
@@ -184,63 +156,12 @@ Check_For_Empty_Ipv4_Topology_After_Listening_3
 Delete_Bgp_Peer_Configuration
     [Documentation]    Revert the BGP configuration to the original state: without any configured peers.
     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
-    &{mapping}    Create Dictionary    DEVICE_NAME=${DEVICE_NAME}    BGP_NAME=${BGP_PEER_NAME}    IP=${TOOLS_SYSTEM_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}
+    &{mapping}    BuiltIn.Create_Dictionary    DEVICE_NAME=${DEVICE_NAME}    BGP_NAME=${BGP_PEER_NAME}    IP=${TOOLS_SYSTEM_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}
     ...    INITIATE=false    BGP_RIB=${RIB_INSTANCE}
     TemplatedRequests.Delete_Templated    ${BGP_VARIABLES_FOLDER}    mapping=${mapping}    session=${CONFIG_SESSION}
 
 Delete_Netconf_Device_Configuration
     [Documentation]    Revert the netconf configuration to the original stat
     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
-    &{mapping}    Create Dictionary    DEVICE_NAME=${DEVICE_NAME}    DEVICE_PORT=1830    DEVICE_IP=${default_oper_shard_leader_node_ip}    DEVICE_USER=admin    DEVICE_PASSWORD=admin
+    &{mapping}    BuiltIn.Create_Dictionary    DEVICE_NAME=${DEVICE_NAME}    DEVICE_PORT=1830    DEVICE_IP=${default_oper_shard_leader_node_ip}    DEVICE_USER=admin    DEVICE_PASSWORD=admin
     TemplatedRequests.Delete_Templated    ${NETCONF_DEV_FOLDER}    mapping=${mapping}    session=${CONFIG_SESSION}
-
-*** Keywords ***
-Setup_Everything
-    [Documentation]    Setup imported resources, SSH-login to tools system,
-    ...    create HTTP session, put Python tool to tools system.
-    SetupUtils.Setup_Utils_For_Setup_And_Teardown
-    ClusterManagement.ClusterManagement_Setup
-    RequestsLibrary.Create_Session    ${CONFIGURATION_1}    http://${ODL_SYSTEM_1_IP}:${RESTCONFPORT}${OPERATIONAL_API}    auth=${AUTH}
-    RequestsLibrary.Create_Session    ${CONFIGURATION_2}    http://${ODL_SYSTEM_2_IP}:${RESTCONFPORT}${OPERATIONAL_API}    auth=${AUTH}
-    RequestsLibrary.Create_Session    ${CONFIGURATION_3}    http://${ODL_SYSTEM_3_IP}:${RESTCONFPORT}${OPERATIONAL_API}    auth=${AUTH}
-    PrefixCounting.PC_Setup
-    SSHLibrary.Set_Default_Configuration    prompt=${TOOLS_SYSTEM_PROMPT}
-    SSHLibrary.Open_Connection    ${TOOLS_SYSTEM_IP}
-    Utils.Flexible_Mininet_Login
-    # 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.
-    SSHLibrary.Put_File    ${CURDIR}/../../../../tools/fastbgp/play.py
-    SSHKeywords.Require_Python
-    SSHKeywords.Assure_Library_Ipaddr    target_dir=.
-    # Calculate the timeout value based on how many routes are going to be pushed
-    # TODO: Replace 35 with some formula from period and repetitions.
-    ${timeout} =    BuiltIn.Evaluate    ${TEST_DURATION_MULTIPLIER} * (${COUNT} * 6.0 / 10000 + 35)
-    Builtin.Set_Suite_Variable    ${bgp_filling_timeout}    ${timeout}
-    Builtin.Set_Suite_Variable    ${bgp_emptying_timeout}    ${bgp_filling_timeout*3.0/4}
-    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'
-    RequestsLibrary.Delete_All_Sessions
-    SSHLibrary.Close_All_Connections
-
-Store_File_To_Workspace
-    [Arguments]    ${src_file_name}    ${dst_file_name}
-    [Documentation]    Store the provided file from the SSH client to workspace.
-    ${files}=    SSHLibrary.List Files In Directory    .
-    ${output_log}=    SSHLibrary.Execute_Command    cat ${src_file_name}
-    BuiltIn.Log    ${output_log}
-    Create File    ${dst_file_name}    ${output_log}
-
-Configure Netconf Device And Check Mounted
-    [Arguments]    ${mapping}
-    TemplatedRequests.Put_As_Xml_Templated    ${NETCONF_DEV_FOLDER}    mapping=${mapping}    session=${CONFIG_SESSION}
-    BuiltIn.Wait Until Keyword Succeeds    10x    3s    TemplatedRequests.Get_As_Xml_Templated    ${NETCONF_MOUNT_FOLDER}    mapping=${mapping}    session=${CONFIG_SESSION}
-
-Start Bgp Peer
-    [Documentation]    Starts bgp peer and verifies that the peer runs.
-    BGPSpeaker.Start_BGP_Speaker    --amount ${COUNT} --myip=${TOOLS_SYSTEM_IP} --myport=${BGP_TOOL_PORT} --peerip=${default_oper_shard_leader_node_ip} --peerport=${ODL_BGP_PORT} --insert=${INSERT} --withdraw=${WITHDRAW} --prefill ${PREFILL} --update ${UPDATE} --${BGP_TOOL_LOG_LEVEL} --results ${RESULTS_FILE_NAME}
-    BGPcliKeywords.Read_And_Fail_If_Prompt_Is_Seen
diff --git a/csit/suites/bgpcep/bgpclustering/010_singlepeer_prefixcount_1route_nonreplicated_rib.robot b/csit/suites/bgpcep/bgpclustering/010_singlepeer_prefixcount_1route_nonreplicated_rib.robot
new file mode 100644 (file)
index 0000000..10d7335
--- /dev/null
@@ -0,0 +1,97 @@
+*** Settings ***
+Documentation     BGP performance of ingesting from 1 iBGP peer, data change counter is NOT used.
+...
+...               Copyright (c) 2015-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 as single iBGP peer which talks to
+...               single controller in three node cluster configuration.
+...               Test suite checks changes of the the example-ipv4-topology default operational
+...               shard leader only. Less stress for cluster is expected as if followers were
+...               triggered for that.
+Suite Setup       PrefixcountKeywords.Setup_Everything
+Suite Teardown    PrefixcountKeywords.Teardown_Everything
+Test Setup        SetupUtils.Setup_Test_With_Logging_And_Fast_Failing
+Test Teardown     SetupUtils.Teardown_Test_Show_Bugs_And_Start_Fast_Failing_If_Test_Failed
+Library           SSHLibrary    timeout=10s
+Library           RequestsLibrary
+Variables         ${CURDIR}/../../../variables/Variables.py
+Resource          ${CURDIR}/../../../libraries/BGPSpeaker.robot
+Resource          ${CURDIR}/../../../libraries/BGPcliKeywords.robot
+Resource          ${CURDIR}/../../../libraries/FailFast.robot
+Resource          ${CURDIR}/../../../libraries/KillPythonTool.robot
+Resource          ${CURDIR}/../../../libraries/PrefixCounting.robot
+Resource          ${CURDIR}/../../../libraries/SetupUtils.robot
+Resource          ${CURDIR}/../../../libraries/ClusterManagement.robot
+Resource          ${CURDIR}/../../../libraries/SSHKeywords.robot
+Resource          ${CURDIR}/../../../libraries/TemplatedRequests.robot
+Resource          ${CURDIR}/PrefixcountKeywords.robot
+
+*** Variables ***
+${COUNT}          1
+
+*** Test Cases ***
+Get Example Bgp Rib Owner
+    [Documentation]    Find an odl node which is able to accept incomming connection. To this node netconf connector should be configured.
+    ${rib_owner}    ${rib_candidates}=    ClusterManagement.Get_Owner_And_Successors_For_device    example-bgp-rib    org.opendaylight.mdsal.ServiceEntityType    1
+    BuiltIn.Set_Suite_Variable    ${rib_owner}    ${rib_owner}
+    BuiltIn.Set_Suite_Variable    ${rib_owner_node_id}    ${ODL_SYSTEM_${rib_owner}_IP}
+    RequestsLibrary.Create_Session    ${CONFIG_SESSION}    http://${ODL_SYSTEM_${rib_owner}_IP}:${RESTCONFPORT}    auth=${AUTH}
+
+Get Topology Operational Leader
+    [Documentation]    Gets the operational topology shard leader
+    ${leader}    ${followers}=    ClusterManagement.Get_Leader_And_Followers_For_Shard    shard_name=topology    shard_type=operational
+    BuiltIn.Set_Suite_Variable    ${topo_lead_ses}    operational-${leader}
+
+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    ${INITIAL_RESTCONF_TIMEOUT}    1s    PrefixCounting.Check_Ipv4_Topology_Is_Empty    session=${topo_lead_ses}    topology=${EXAMPLE_IPV4_TOPOLOGY}
+
+Reconfigure_ODL_To_Accept_Connection
+    [Documentation]    Configure BGP peer module in passive mode (not initiating connection)
+    [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
+    &{mapping}    Create Dictionary    IP=${TOOLS_SYSTEM_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}    PASSIVE_MODE=true    BGP_RIB=${RIB_INSTANCE}
+    TemplatedRequests.Post_As_Xml_Templated    ${BGP_PEER_FOLDER}    mapping=${mapping}    session=${CONFIG_SESSION}
+    [Teardown]    SetupUtils.Teardown_Test_Show_Bugs_If_Test_Failed
+
+Start_Talking_BGP_Speaker
+    [Documentation]    Start Python speaker to connect to ODL.
+    PrefixcountKeywords.Start_Bgp_Peer_And_Verify_Connected    connection_retries=${3}
+
+Wait_For_Stable_Talking_Ipv4_Topology
+    [Documentation]    Wait until ${EXAMPLE_IPV4_TOPOLOGY} becomes stable. This is done by checking stability of prefix count as seen from node 1.
+    PrefixCounting.Wait_For_Ipv4_Topology_Prefixes_To_Become_Stable    timeout=${bgp_filling_timeout}    period=${CHECK_PERIOD}    repetitions=${REPETITIONS}    excluded_count=0    session=${topo_lead_ses}    topology=${EXAMPLE_IPV4_TOPOLOGY}
+
+Check_Talking_Ipv4_Topology_Count
+    [Documentation]    Count the routes in ${EXAMPLE_IPV4_TOPOLOGY} and fail if the count is not correct as seen from node 1.
+    [Tags]    critical
+    [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
+    PrefixCounting.Check_Ipv4_Topology_Count    ${COUNT}    session=${topo_lead_ses}    topology=${EXAMPLE_IPV4_TOPOLOGY}
+
+Kill_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
+    BGPSpeaker.Kill_BGP_Speaker
+    FailFast.Do_Not_Fail_Fast_From_Now_On
+
+Wait_For_Stable_Ipv4_Topology_After_Listening
+    [Documentation]    Wait until ${EXAMPLE_IPV4_TOPOLOGY} becomes stable again as seen from node 1.
+    [Tags]    critical
+    PrefixCounting.Wait_For_Ipv4_Topology_Prefixes_To_Become_Stable    timeout=${bgp_filling_timeout}    period=${CHECK_PERIOD}    repetitions=${REPETITIONS}    excluded_count=${COUNT}    session=${topo_lead_ses}    topology=${EXAMPLE_IPV4_TOPOLOGY}
+
+Check_For_Empty_Ipv4_Topology_After_Listening
+    [Documentation]    Example-ipv4-topology should be empty now as seen from node 1.
+    [Tags]    critical
+    [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
+    PrefixCounting.Check_Ipv4_Topology_Is_Empty    session=${topo_lead_ses}    topology=${EXAMPLE_IPV4_TOPOLOGY}
+
+Delete_Bgp_Peer_Configuration
+    [Documentation]    Revert the BGP configuration to the original state: without any configured peers
+    &{mapping}    Create Dictionary    BGP_RIB=${RIB_INSTANCE}
+    TemplatedRequests.Delete_Templated    ${BGP_PEER_FOLDER}    mapping=${mapping}    session=${CONFIG_SESSION}
index 30ab2fb8f3e477c0af3f39bd90601829bfa921bb..1e77f8bf1366fc914e32d1f9e460688f878b9255 100644 (file)
@@ -14,8 +14,8 @@ Documentation     BGP performance of ingesting from 1 iBGP peer, data change cou
 ...               <dst-id> is recognized during the suite run, should be the Leader of default
 ...               operational Shard, otherwise the scenario would fail due to
 ...               https://bugs.opendaylight.org/show_bug.cgi?id=5536
-Suite Setup       Setup_Everything
-Suite Teardown    Teardown_Everything
+Suite Setup       PrefixcountKeywords.Setup_Everything
+Suite Teardown    PrefixcountKeywords.Teardown_Everything
 Test Setup        SetupUtils.Setup_Test_With_Logging_And_Fast_Failing
 Test Teardown     SetupUtils.Teardown_Test_Show_Bugs_And_Start_Fast_Failing_If_Test_Failed
 Library           SSHLibrary    timeout=10s
@@ -30,46 +30,17 @@ Resource          ${CURDIR}/../../../libraries/SetupUtils.robot
 Resource          ${CURDIR}/../../../libraries/ClusterManagement.robot
 Resource          ${CURDIR}/../../../libraries/SSHKeywords.robot
 Resource          ${CURDIR}/../../../libraries/TemplatedRequests.robot
+Resource          ${CURDIR}/PrefixcountKeywords.robot
 
 *** Variables ***
-${BGP_TOOL_LOG_LEVEL}    info
-${BGP_VARIABLES_FOLDER}    ${CURDIR}/../../../variables/bgpclustering/bgp_peer
-${BGP_VARIABLES_FOLDER_OP}    ${CURDIR}/../../../variables/bgpclustering/bgp_peer_operational
-${NETCONF_DEV_FOLDER}    ${CURDIR}/../../../variables/netconf/device/full-uri-device
-${NETCONF_MOUNT_FOLDER}    ${CURDIR}/../../../variables/netconf/device/full-uri-mount
-${CHECK_PERIOD}    10
 ${COUNT}          100000
-${HOLDTIME}       180
-${INSERT}         1
-${KARAF_LOG_LEVEL}    INFO
-${KARAF_BGPCEP_LOG_LEVEL}    ${KARAF_LOG_LEVEL}
-${KARAF_PROTOCOL_LOG_LEVEL}    ${KARAF_BGPCEP_LOG_LEVEL}
-${PREFILL}        0
-${REPETITIONS}    1
-${RESULTS_FILE_NAME}    bgp.csv
-${TEST_DURATION_MULTIPLIER}    1
-${UPDATE}         single
-${WITHDRAW}       0
-${INITIAL_RESTCONF_TIMEOUT}    30s
-${KARAF_HOME}     ${WORKSPACE}/${BUNDLEFOLDER}
-${SHARD_DEFAULT_CONFIG}    shard-default-config
-${SHARD_DEFAULT_OPERATIONAL}    shard-default-operational
-${CONFIG_SESSION}    config-session
-${CONFIGURATION_1}    operational-1
-${CONFIGURATION_2}    operational-2
-${CONFIGURATION_3}    operational-3
-${EXAMPLE_IPV4_TOPOLOGY}    example-ipv4-topology
-${DEVICE_NAME}    peer-controller-config
-${DEVICE_CHECK_TIMEOUT}    60s
-${RIB_INSTANCE}    example-bgp-rib
-${BGP_PEER_NAME}    example-bgp-peer
 
 *** Test Cases ***
 Get Example Bgp Rib Owner
     [Documentation]    Find an odl node which is able to accept incomming connection. To this node netconf connector should be configured.
     ${rib_owner}    ${rib_candidates}=    ClusterManagement.Get_Owner_And_Successors_For_device    example-bgp-rib    org.opendaylight.mdsal.ServiceEntityType    1
-    BuiltIn.Set Suite variable    ${rib_owner}    ${rib_owner}
-    BuiltIn.Set Suite variable    ${rib_owner_node_id}    ${ODL_SYSTEM_${rib_owner}_IP}
+    BuiltIn.Set_Suite_Variable    ${rib_owner}    ${rib_owner}
+    BuiltIn.Set_Suite_Variable    ${rib_owner_node_id}    ${ODL_SYSTEM_${rib_owner}_IP}
     RequestsLibrary.Create_Session    ${CONFIG_SESSION}    http://${ODL_SYSTEM_${rib_owner}_IP}:${RESTCONFPORT}    auth=${AUTH}
 
 Check_For_Empty_Ipv4_Topology_Before_Talking_1
@@ -92,10 +63,10 @@ Check_For_Empty_Ipv4_Topology_Before_Talking_3
 
 Configure_Netconf_Device
     [Documentation]    Configures and verifies netconf device configuration. If configuration is not successful, it de-configures the device before the next attempt.
-    &{mapping}    Create Dictionary    DEVICE_NAME=${DEVICE_NAME}    DEVICE_PORT=1830    DEVICE_IP=${rib_owner_node_id}    DEVICE_USER=admin    DEVICE_PASSWORD=admin
+    &{mapping}    BuiltIn.Create_Dictionary    DEVICE_NAME=${DEVICE_NAME}    DEVICE_PORT=1830    DEVICE_IP=${rib_owner_node_id}    DEVICE_USER=admin    DEVICE_PASSWORD=admin
     # After the netconf device is configured, odl starts downloading schemas. If the downloading will not finish within akka timeout, more tries are needed, 3 is based on a user experience.
     : FOR    ${index}    IN RANGE    0    3
-    \    ${status}    ${value}=    Run Keyword And Ignore Error    Configure Netconf Device And Check Mounted    ${mapping}
+    \    ${status}    ${value}=    Run Keyword And Ignore Error    PrefixcountKeywords.Configure_Netconf_Device_And_Check_Mounted    ${mapping}
     \    Exit For Loop If    '${status}' == 'PASS'
     \    Run Keyword Unless    '${status}' == 'PASS'    TemplatedRequests.Delete_Templated    ${NETCONF_DEV_FOLDER}    mapping=${mapping}    session=${CONFIG_SESSION}
     Run Keyword Unless    '${status}' == 'PASS'    Fail
@@ -103,14 +74,14 @@ Configure_Netconf_Device
 Reconfigure_ODL_To_Accept_Connection
     [Documentation]    Configure BGP peer module with initiate-connection set to false.
     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
-    &{mapping}    Create Dictionary    DEVICE_NAME=${DEVICE_NAME}    BGP_NAME=${BGP_PEER_NAME}    IP=${TOOLS_SYSTEM_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}
+    &{mapping}    BuiltIn.Create_Dictionary    DEVICE_NAME=${DEVICE_NAME}    BGP_NAME=${BGP_PEER_NAME}    IP=${TOOLS_SYSTEM_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}
     ...    INITIATE=false    BGP_RIB=${RIB_INSTANCE}
     TemplatedRequests.Put_As_Json_Templated    ${BGP_VARIABLES_FOLDER}    mapping=${mapping}    session=${CONFIG_SESSION}
     [Teardown]    SetupUtils.Teardown_Test_Show_Bugs_If_Test_Failed
 
 Start_Talking_BGP_Speaker
-    [Documentation]    Start Python speaker to connect to ODL. We need to do WUKS until odl really starts to accept incomming bgp connection. The failure happens if the incomming connection comes too quickly after configuring the peer in the previous test case.
-    BuiltIn.Wait_Until_Keyword_Succeeds    3x    1s    Start Bgp Peer
+    [Documentation]    Start Python speaker to connect to ODL.
+    PrefixcountKeywords.Start_Bgp_Peer_And_Verify_Connected    connection_retries=${3}
 
 Wait_For_Stable_Talking_Ipv4_Topology_1
     [Documentation]    Wait until ${EXAMPLE_IPV4_TOPOLOGY} becomes stable. This is done by checking stability of prefix count as seen from node 1.
@@ -185,63 +156,12 @@ Check_For_Empty_Ipv4_Topology_After_Listening_3
 Delete_Bgp_Peer_Configuration
     [Documentation]    Revert the BGP configuration to the original state: without any configured peers.
     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
-    &{mapping}    Create Dictionary    DEVICE_NAME=${DEVICE_NAME}    BGP_NAME=${BGP_PEER_NAME}    IP=${TOOLS_SYSTEM_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}
+    &{mapping}    BuiltIn.Create_Dictionary    DEVICE_NAME=${DEVICE_NAME}    BGP_NAME=${BGP_PEER_NAME}    IP=${TOOLS_SYSTEM_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}
     ...    INITIATE=false    BGP_RIB=${RIB_INSTANCE}
     TemplatedRequests.Delete_Templated    ${BGP_VARIABLES_FOLDER}    mapping=${mapping}    session=${CONFIG_SESSION}
 
 Delete_Netconf_Device_Configuration
     [Documentation]    Revert the netconf configuration to the original stat
     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
-    &{mapping}    Create Dictionary    DEVICE_NAME=${DEVICE_NAME}    DEVICE_PORT=1830    DEVICE_IP=${rib_owner_node_id}    DEVICE_USER=admin    DEVICE_PASSWORD=admin
+    &{mapping}    BuiltIn.Create_Dictionary    DEVICE_NAME=${DEVICE_NAME}    DEVICE_PORT=1830    DEVICE_IP=${rib_owner_node_id}    DEVICE_USER=admin    DEVICE_PASSWORD=admin
     TemplatedRequests.Delete_Templated    ${NETCONF_DEV_FOLDER}    mapping=${mapping}    session=${CONFIG_SESSION}
-
-*** Keywords ***
-Setup_Everything
-    [Documentation]    Setup imported resources, SSH-login to tools system,
-    ...    create HTTP session, put Python tool to tools system.
-    SetupUtils.Setup_Utils_For_Setup_And_Teardown
-    ClusterManagement.ClusterManagement_Setup
-    RequestsLibrary.Create_Session    ${CONFIGURATION_1}    http://${ODL_SYSTEM_1_IP}:${RESTCONFPORT}${OPERATIONAL_API}    auth=${AUTH}
-    RequestsLibrary.Create_Session    ${CONFIGURATION_2}    http://${ODL_SYSTEM_2_IP}:${RESTCONFPORT}${OPERATIONAL_API}    auth=${AUTH}
-    RequestsLibrary.Create_Session    ${CONFIGURATION_3}    http://${ODL_SYSTEM_3_IP}:${RESTCONFPORT}${OPERATIONAL_API}    auth=${AUTH}
-    PrefixCounting.PC_Setup
-    SSHLibrary.Set_Default_Configuration    prompt=${TOOLS_SYSTEM_PROMPT}
-    SSHLibrary.Open_Connection    ${TOOLS_SYSTEM_IP}
-    Utils.Flexible_Mininet_Login
-    # 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.
-    SSHLibrary.Put_File    ${CURDIR}/../../../../tools/fastbgp/play.py
-    SSHKeywords.Require_Python
-    SSHKeywords.Assure_Library_Ipaddr    target_dir=.
-    # Calculate the timeout value based on how many routes are going to be pushed
-    # TODO: Replace 35 with some formula from period and repetitions.
-    ${timeout} =    BuiltIn.Evaluate    ${TEST_DURATION_MULTIPLIER} * (${COUNT} * 6.0 / 10000 + 35)
-    Builtin.Set_Suite_Variable    ${bgp_filling_timeout}    ${timeout}
-    Builtin.Set_Suite_Variable    ${bgp_emptying_timeout}    ${bgp_filling_timeout*3.0/4}
-    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'
-    RequestsLibrary.Delete_All_Sessions
-    SSHLibrary.Close_All_Connections
-
-Store_File_To_Workspace
-    [Arguments]    ${src_file_name}    ${dst_file_name}
-    [Documentation]    Store the provided file from the SSH client to workspace.
-    ${files}=    SSHLibrary.List Files In Directory    .
-    ${output_log}=    SSHLibrary.Execute_Command    cat ${src_file_name}
-    BuiltIn.Log    ${output_log}
-    Create File    ${dst_file_name}    ${output_log}
-
-Configure Netconf Device And Check Mounted
-    [Arguments]    ${mapping}
-    TemplatedRequests.Put_As_Xml_Templated    ${NETCONF_DEV_FOLDER}    mapping=${mapping}    session=${CONFIG_SESSION}
-    BuiltIn.Wait Until Keyword Succeeds    10x    3s    TemplatedRequests.Get_As_Xml_Templated    ${NETCONF_MOUNT_FOLDER}    mapping=${mapping}    session=${CONFIG_SESSION}
-
-Start Bgp Peer
-    [Documentation]    Starts bgp peer and verifies that the peer runs.
-    BGPSpeaker.Start_BGP_Speaker    --amount ${COUNT} --myip=${TOOLS_SYSTEM_IP} --myport=${BGP_TOOL_PORT} --peerip=${rib_owner_node_id} --peerport=${ODL_BGP_PORT} --insert=${INSERT} --withdraw=${WITHDRAW} --prefill ${PREFILL} --update ${UPDATE} --${BGP_TOOL_LOG_LEVEL} --results ${RESULTS_FILE_NAME}
-    BGPcliKeywords.Read_And_Fail_If_Prompt_Is_Seen
index 6417a8b09585764db97c73ae0d25546799d2bd7e..8e13216e75ac9081111bcce179f4a663d739f0e8 100644 (file)
@@ -14,8 +14,8 @@ Documentation     BGP performance of ingesting from 1 iBGP peer, data change cou
 ...               <dst-id> is recognized during the suite run, should be the Leader of default
 ...               operational Shard, otherwise the scenario would fail due to
 ...               https://bugs.opendaylight.org/show_bug.cgi?id=5536
-Suite Setup       Setup_Everything
-Suite Teardown    Teardown_Everything
+Suite Setup       PrefixcountKeywords.Setup_Everything
+Suite Teardown    PrefixcountKeywords.Teardown_Everything
 Test Setup        SetupUtils.Setup_Test_With_Logging_And_Fast_Failing
 Test Teardown     SetupUtils.Teardown_Test_Show_Bugs_And_Start_Fast_Failing_If_Test_Failed
 Library           SSHLibrary    timeout=10s
@@ -30,45 +30,17 @@ Resource          ${CURDIR}/../../../libraries/SetupUtils.robot
 Resource          ${CURDIR}/../../../libraries/ClusterManagement.robot
 Resource          ${CURDIR}/../../../libraries/SSHKeywords.robot
 Resource          ${CURDIR}/../../../libraries/TemplatedRequests.robot
+Resource          ${CURDIR}/PrefixcountKeywords.robot
 
 *** Variables ***
-${BGP_TOOL_LOG_LEVEL}    info
-${BGP_VARIABLES_FOLDER}    ${CURDIR}/../../../variables/bgpclustering/bgp_peer
-${BGP_VARIABLES_FOLDER_OP}    ${CURDIR}/../../../variables/bgpclustering/bgp_peer_operational
-${NETCONF_DEV_FOLDER}    ${CURDIR}/../../../variables/netconf/device/full-uri-device
-${NETCONF_MOUNT_FOLDER}    ${CURDIR}/../../../variables/netconf/device/full-uri-mount
-${CHECK_PERIOD}    10
 ${COUNT}          100000
-${HOLDTIME}       180
-${INSERT}         1
-${KARAF_LOG_LEVEL}    INFO
-${KARAF_BGPCEP_LOG_LEVEL}    ${KARAF_LOG_LEVEL}
-${KARAF_PROTOCOL_LOG_LEVEL}    ${KARAF_BGPCEP_LOG_LEVEL}
-${PREFILL}        0
-${REPETITIONS}    1
-${RESULTS_FILE_NAME}    bgp.csv
-${TEST_DURATION_MULTIPLIER}    1
-${UPDATE}         single
-${WITHDRAW}       0
-${INITIAL_RESTCONF_TIMEOUT}    30s
-${KARAF_HOME}     ${WORKSPACE}/${BUNDLEFOLDER}
-${SHARD_DEFAULT_CONFIG}    shard-default-config
-${SHARD_DEFAULT_OPERATIONAL}    shard-default-operational
-${CONFIG_SESSION}    config-session
-${CONFIGURATION_1}    operational-1
-${CONFIGURATION_2}    operational-2
-${CONFIGURATION_3}    operational-3
 ${EXAMPLE_IPV4_TOPOLOGY_PREF}    example-ipv4-topology-
-${DEVICE_NAME}    peer-controller-config
-${DEVICE_CHECK_TIMEOUT}    60s
-${RIB_INSTANCE}    example-bgp-rib
-${BGP_PEER_NAME}    example-bgp-peer
 
 *** Test Cases ***
 Get Default Operational Shard Leader
     ${dos_leader}    ${dos_followers}=    ClusterManagement.Get_Leader_And_Followers_For_Shard
-    BuiltIn.Set Suite variable    ${dos_leader}    ${dos_leader}
-    BuiltIn.Set Suite variable    ${default_oper_shard_leader_node_ip}    ${ODL_SYSTEM_${dos_leader}_IP}
+    BuiltIn.Set_Suite_Variable    ${dos_leader}    ${dos_leader}
+    BuiltIn.Set_Suite_Variable    ${default_oper_shard_leader_node_ip}    ${ODL_SYSTEM_${dos_leader}_IP}
     RequestsLibrary.Create_Session    ${CONFIG_SESSION}    http://${ODL_SYSTEM_${dos_leader}_IP}:${RESTCONFPORT}    auth=${AUTH}
 
 Check_For_Empty_Ipv4_Topology_Before_Talking_1
@@ -91,10 +63,10 @@ Check_For_Empty_Ipv4_Topology_Before_Talking_3
 
 Configure_Netconf_Device
     [Documentation]    Configures and verifies netconf device configuration. If configuration is not successful, it de-configures the device before the next attempt.
-    &{mapping}    Create Dictionary    DEVICE_NAME=${DEVICE_NAME}    DEVICE_PORT=1830    DEVICE_IP=${default_oper_shard_leader_node_ip}    DEVICE_USER=admin    DEVICE_PASSWORD=admin
+    &{mapping}    BuiltIn.Create_Dictionary    DEVICE_NAME=${DEVICE_NAME}    DEVICE_PORT=1830    DEVICE_IP=${default_oper_shard_leader_node_ip}    DEVICE_USER=admin    DEVICE_PASSWORD=admin
     # After the netconf device is configured, odl starts downloading schemas. If the downloading will not finish within akka timeout, more tries are needed, 3 is based on a user experience.
     : FOR    ${index}    IN RANGE    0    3
-    \    ${status}    ${value}=    Run Keyword And Ignore Error    Configure Netconf Device And Check Mounted    ${mapping}
+    \    ${status}    ${value}=    Run Keyword And Ignore Error    PrefixcountKeywords.Configure_Netconf_Device_And_Check_Mounted    ${mapping}
     \    Exit For Loop If    '${status}' == 'PASS'
     \    Run Keyword Unless    '${status}' == 'PASS'    TemplatedRequests.Delete_Templated    ${NETCONF_DEV_FOLDER}    mapping=${mapping}    session=${CONFIG_SESSION}
     Run Keyword Unless    '${status}' == 'PASS'    Fail
@@ -102,14 +74,14 @@ Configure_Netconf_Device
 Reconfigure_ODL_To_Accept_Connection
     [Documentation]    Configure BGP peer module with initiate-connection set to false.
     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
-    &{mapping}    Create Dictionary    DEVICE_NAME=${DEVICE_NAME}    BGP_NAME=${BGP_PEER_NAME}    IP=${TOOLS_SYSTEM_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}
+    &{mapping}    BuiltIn.Create_Dictionary    DEVICE_NAME=${DEVICE_NAME}    BGP_NAME=${BGP_PEER_NAME}    IP=${TOOLS_SYSTEM_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}
     ...    INITIATE=false    BGP_RIB=${RIB_INSTANCE}
     TemplatedRequests.Put_As_Json_Templated    ${BGP_VARIABLES_FOLDER}    mapping=${mapping}    session=${CONFIG_SESSION}
     [Teardown]    SetupUtils.Teardown_Test_Show_Bugs_If_Test_Failed
 
 Start_Talking_BGP_Speaker
-    [Documentation]    Start Python speaker to connect to ODL. We need to do WUKS until odl really starts to accept incomming bgp connection. The failure happens if the incomming connection comes too quickly after configuring the peer in the previous test case.
-    BuiltIn.Wait_Until_Keyword_Succeeds    3x    1s    Start Bgp Peer
+    [Documentation]    Start Python speaker to connect to ODL.
+    PrefixcountKeywords.Start_Bgp_Peer_And_Verify_Connected    connection_retries=${3}    peerip=${default_oper_shard_leader_node_ip}
 
 Wait_For_Stable_Talking_Ipv4_Topology_1
     [Documentation]    Wait until ${EXAMPLE_IPV4_TOPOLOGY_PREF}${dos_leader} becomes stable. This is done by checking stability of prefix count as seen from node 1.
@@ -184,63 +156,12 @@ Check_For_Empty_Ipv4_Topology_After_Listening_3
 Delete_Bgp_Peer_Configuration
     [Documentation]    Revert the BGP configuration to the original state: without any configured peers.
     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
-    &{mapping}    Create Dictionary    DEVICE_NAME=${DEVICE_NAME}    BGP_NAME=${BGP_PEER_NAME}    IP=${TOOLS_SYSTEM_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}
+    &{mapping}    BuiltIn.Create_Dictionary    DEVICE_NAME=${DEVICE_NAME}    BGP_NAME=${BGP_PEER_NAME}    IP=${TOOLS_SYSTEM_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}
     ...    INITIATE=false    BGP_RIB=${RIB_INSTANCE}
     TemplatedRequests.Delete_Templated    ${BGP_VARIABLES_FOLDER}    mapping=${mapping}    session=${CONFIG_SESSION}
 
 Delete_Netconf_Device_Configuration
     [Documentation]    Revert the netconf configuration to the original stat
     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
-    &{mapping}    Create Dictionary    DEVICE_NAME=${DEVICE_NAME}    DEVICE_PORT=1830    DEVICE_IP=${default_oper_shard_leader_node_ip}    DEVICE_USER=admin    DEVICE_PASSWORD=admin
+    &{mapping}    BuiltIn.Create_Dictionary    DEVICE_NAME=${DEVICE_NAME}    DEVICE_PORT=1830    DEVICE_IP=${default_oper_shard_leader_node_ip}    DEVICE_USER=admin    DEVICE_PASSWORD=admin
     TemplatedRequests.Delete_Templated    ${NETCONF_DEV_FOLDER}    mapping=${mapping}    session=${CONFIG_SESSION}
-
-*** Keywords ***
-Setup_Everything
-    [Documentation]    Setup imported resources, SSH-login to tools system,
-    ...    create HTTP session, put Python tool to tools system.
-    SetupUtils.Setup_Utils_For_Setup_And_Teardown
-    ClusterManagement.ClusterManagement_Setup
-    RequestsLibrary.Create_Session    ${CONFIGURATION_1}    http://${ODL_SYSTEM_1_IP}:${RESTCONFPORT}${OPERATIONAL_API}    auth=${AUTH}
-    RequestsLibrary.Create_Session    ${CONFIGURATION_2}    http://${ODL_SYSTEM_2_IP}:${RESTCONFPORT}${OPERATIONAL_API}    auth=${AUTH}
-    RequestsLibrary.Create_Session    ${CONFIGURATION_3}    http://${ODL_SYSTEM_3_IP}:${RESTCONFPORT}${OPERATIONAL_API}    auth=${AUTH}
-    PrefixCounting.PC_Setup
-    SSHLibrary.Set_Default_Configuration    prompt=${TOOLS_SYSTEM_PROMPT}
-    SSHLibrary.Open_Connection    ${TOOLS_SYSTEM_IP}
-    Utils.Flexible_Mininet_Login
-    # 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.
-    SSHLibrary.Put_File    ${CURDIR}/../../../../tools/fastbgp/play.py
-    SSHKeywords.Require_Python
-    SSHKeywords.Assure_Library_Ipaddr    target_dir=.
-    # Calculate the timeout value based on how many routes are going to be pushed
-    # TODO: Replace 35 with some formula from period and repetitions.
-    ${timeout} =    BuiltIn.Evaluate    ${TEST_DURATION_MULTIPLIER} * (${COUNT} * 6.0 / 10000 + 35)
-    Builtin.Set_Suite_Variable    ${bgp_filling_timeout}    ${timeout}
-    Builtin.Set_Suite_Variable    ${bgp_emptying_timeout}    ${bgp_filling_timeout*3.0/4}
-    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'
-    RequestsLibrary.Delete_All_Sessions
-    SSHLibrary.Close_All_Connections
-
-Store_File_To_Workspace
-    [Arguments]    ${src_file_name}    ${dst_file_name}
-    [Documentation]    Store the provided file from the SSH client to workspace.
-    ${files}=    SSHLibrary.List Files In Directory    .
-    ${output_log}=    SSHLibrary.Execute_Command    cat ${src_file_name}
-    BuiltIn.Log    ${output_log}
-    Create File    ${dst_file_name}    ${output_log}
-
-Configure Netconf Device And Check Mounted
-    [Arguments]    ${mapping}
-    TemplatedRequests.Put_As_Xml_Templated    ${NETCONF_DEV_FOLDER}    mapping=${mapping}    session=${CONFIG_SESSION}
-    BuiltIn.Wait Until Keyword Succeeds    10x    3s    TemplatedRequests.Get_As_Xml_Templated    ${NETCONF_MOUNT_FOLDER}    mapping=${mapping}    session=${CONFIG_SESSION}
-
-Start Bgp Peer
-    [Documentation]    Starts bgp peer and verifies that the peer runs.
-    BGPSpeaker.Start_BGP_Speaker    --amount ${COUNT} --myip=${TOOLS_SYSTEM_IP} --myport=${BGP_TOOL_PORT} --peerip=${default_oper_shard_leader_node_ip} --peerport=${ODL_BGP_PORT} --insert=${INSERT} --withdraw=${WITHDRAW} --prefill ${PREFILL} --update ${UPDATE} --${BGP_TOOL_LOG_LEVEL} --results ${RESULTS_FILE_NAME}
-    BGPcliKeywords.Read_And_Fail_If_Prompt_Is_Seen
diff --git a/csit/suites/bgpcep/bgpclustering/020_singlepeer_prefixcount_100kroutes_nonreplicated_rib.robot b/csit/suites/bgpcep/bgpclustering/020_singlepeer_prefixcount_100kroutes_nonreplicated_rib.robot
new file mode 100644 (file)
index 0000000..dba1c63
--- /dev/null
@@ -0,0 +1,97 @@
+*** Settings ***
+Documentation     BGP performance of ingesting from 1 iBGP peer, data change counter is NOT used.
+...
+...               Copyright (c) 2015-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 as single iBGP peer which talks to
+...               single controller in three node cluster configuration.
+...               Test suite checks changes of the the example-ipv4-topology default operational
+...               shard leader only. Less stress for cluster is expected as if followers were
+...               triggered for that.
+Suite Setup       PrefixcountKeywords.Setup_Everything
+Suite Teardown    PrefixcountKeywords.Teardown_Everything
+Test Setup        SetupUtils.Setup_Test_With_Logging_And_Fast_Failing
+Test Teardown     SetupUtils.Teardown_Test_Show_Bugs_And_Start_Fast_Failing_If_Test_Failed
+Library           SSHLibrary    timeout=10s
+Library           RequestsLibrary
+Variables         ${CURDIR}/../../../variables/Variables.py
+Resource          ${CURDIR}/../../../libraries/BGPSpeaker.robot
+Resource          ${CURDIR}/../../../libraries/BGPcliKeywords.robot
+Resource          ${CURDIR}/../../../libraries/FailFast.robot
+Resource          ${CURDIR}/../../../libraries/KillPythonTool.robot
+Resource          ${CURDIR}/../../../libraries/PrefixCounting.robot
+Resource          ${CURDIR}/../../../libraries/SetupUtils.robot
+Resource          ${CURDIR}/../../../libraries/ClusterManagement.robot
+Resource          ${CURDIR}/../../../libraries/SSHKeywords.robot
+Resource          ${CURDIR}/../../../libraries/TemplatedRequests.robot
+Resource          ${CURDIR}/PrefixcountKeywords.robot
+
+*** Variables ***
+${COUNT}          100000
+
+*** Test Cases ***
+Get Example Bgp Rib Owner
+    [Documentation]    Find an odl node which is able to accept incomming connection. To this node netconf connector should be configured.
+    ${rib_owner}    ${rib_candidates}=    ClusterManagement.Get_Owner_And_Successors_For_device    example-bgp-rib    org.opendaylight.mdsal.ServiceEntityType    1
+    BuiltIn.Set_Suite_Variable    ${rib_owner}    ${rib_owner}
+    BuiltIn.Set_Suite_Variable    ${rib_owner_node_id}    ${ODL_SYSTEM_${rib_owner}_IP}
+    RequestsLibrary.Create_Session    ${CONFIG_SESSION}    http://${ODL_SYSTEM_${rib_owner}_IP}:${RESTCONFPORT}    auth=${AUTH}
+
+Get Topology Operational Leader
+    [Documentation]    Gets the operational topology shard leader
+    ${leader}    ${followers}=    ClusterManagement.Get_Leader_And_Followers_For_Shard    shard_name=topology    shard_type=operational
+    BuiltIn.Set_Suite_Variable    ${topo_lead_ses}    operational-${leader}
+
+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    ${INITIAL_RESTCONF_TIMEOUT}    1s    PrefixCounting.Check_Ipv4_Topology_Is_Empty    session=${topo_lead_ses}    topology=${EXAMPLE_IPV4_TOPOLOGY}
+
+Reconfigure_ODL_To_Accept_Connection
+    [Documentation]    Configure BGP peer module in passive mode (not initiating connection)
+    [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
+    &{mapping}    Create Dictionary    IP=${TOOLS_SYSTEM_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}    PASSIVE_MODE=true    BGP_RIB=${RIB_INSTANCE}
+    TemplatedRequests.Post_As_Xml_Templated    ${BGP_PEER_FOLDER}    mapping=${mapping}    session=${CONFIG_SESSION}
+    [Teardown]    SetupUtils.Teardown_Test_Show_Bugs_If_Test_Failed
+
+Start_Talking_BGP_Speaker
+    [Documentation]    Start Python speaker to connect to ODL.
+    PrefixcountKeywords.Start_Bgp_Peer_And_Verify_Connected    connection_retries=${3}
+
+Wait_For_Stable_Talking_Ipv4_Topology
+    [Documentation]    Wait until ${EXAMPLE_IPV4_TOPOLOGY} becomes stable. This is done by checking stability of prefix count as seen from node 1.
+    PrefixCounting.Wait_For_Ipv4_Topology_Prefixes_To_Become_Stable    timeout=${bgp_filling_timeout}    period=${CHECK_PERIOD}    repetitions=${REPETITIONS}    excluded_count=0    session=${topo_lead_ses}    topology=${EXAMPLE_IPV4_TOPOLOGY}
+
+Check_Talking_Ipv4_Topology_Count
+    [Documentation]    Count the routes in ${EXAMPLE_IPV4_TOPOLOGY} and fail if the count is not correct as seen from node 1.
+    [Tags]    critical
+    [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
+    PrefixCounting.Check_Ipv4_Topology_Count    ${COUNT}    session=${topo_lead_ses}    topology=${EXAMPLE_IPV4_TOPOLOGY}
+
+Kill_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
+    BGPSpeaker.Kill_BGP_Speaker
+    FailFast.Do_Not_Fail_Fast_From_Now_On
+
+Wait_For_Stable_Ipv4_Topology_After_Listening
+    [Documentation]    Wait until ${EXAMPLE_IPV4_TOPOLOGY} becomes stable again as seen from node 1.
+    [Tags]    critical
+    PrefixCounting.Wait_For_Ipv4_Topology_Prefixes_To_Become_Stable    timeout=${bgp_filling_timeout}    period=${CHECK_PERIOD}    repetitions=${REPETITIONS}    excluded_count=${COUNT}    session=${topo_lead_ses}    topology=${EXAMPLE_IPV4_TOPOLOGY}
+
+Check_For_Empty_Ipv4_Topology_After_Listening
+    [Documentation]    Example-ipv4-topology should be empty now as seen from node 1.
+    [Tags]    critical
+    [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
+    PrefixCounting.Check_Ipv4_Topology_Is_Empty    session=${topo_lead_ses}    topology=${EXAMPLE_IPV4_TOPOLOGY}
+
+Delete_Bgp_Peer_Configuration
+    [Documentation]    Revert the BGP configuration to the original state: without any configured peers
+    &{mapping}    Create Dictionary    BGP_RIB=${RIB_INSTANCE}
+    TemplatedRequests.Delete_Templated    ${BGP_PEER_FOLDER}    mapping=${mapping}    session=${CONFIG_SESSION}
index 15b067b407fa53258fcf1543e9f12a9416120ac6..278b6f913fc62668d1a1501a1b10ce53fae3da15 100644 (file)
@@ -14,8 +14,8 @@ Documentation     BGP performance of ingesting from 1 iBGP peer, data change cou
 ...               <dst-id> is recognized during the suite run, should be the Leader of default
 ...               operational Shard, otherwise the scenario would fail due to
 ...               https://bugs.opendaylight.org/show_bug.cgi?id=5536
-Suite Setup       Setup_Everything
-Suite Teardown    Teardown_Everything
+Suite Setup       PrefixcountKeywords.Setup_Everything
+Suite Teardown    PrefixcountKeywords.Teardown_Everything
 Test Setup        SetupUtils.Setup_Test_With_Logging_And_Fast_Failing
 Test Teardown     SetupUtils.Teardown_Test_Show_Bugs_And_Start_Fast_Failing_If_Test_Failed
 Library           SSHLibrary    timeout=10s
@@ -30,46 +30,17 @@ Resource          ${CURDIR}/../../../libraries/SetupUtils.robot
 Resource          ${CURDIR}/../../../libraries/ClusterManagement.robot
 Resource          ${CURDIR}/../../../libraries/SSHKeywords.robot
 Resource          ${CURDIR}/../../../libraries/TemplatedRequests.robot
+Resource          ${CURDIR}/PrefixcountKeywords.robot
 
 *** Variables ***
-${BGP_TOOL_LOG_LEVEL}    info
-${BGP_VARIABLES_FOLDER}    ${CURDIR}/../../../variables/bgpclustering/bgp_peer
-${BGP_VARIABLES_FOLDER_OP}    ${CURDIR}/../../../variables/bgpclustering/bgp_peer_operational
-${NETCONF_DEV_FOLDER}    ${CURDIR}/../../../variables/netconf/device/full-uri-device
-${NETCONF_MOUNT_FOLDER}    ${CURDIR}/../../../variables/netconf/device/full-uri-mount
-${CHECK_PERIOD}    10
 ${COUNT}          1000000
-${HOLDTIME}       180
-${INSERT}         1
-${KARAF_LOG_LEVEL}    INFO
-${KARAF_BGPCEP_LOG_LEVEL}    ${KARAF_LOG_LEVEL}
-${KARAF_PROTOCOL_LOG_LEVEL}    ${KARAF_BGPCEP_LOG_LEVEL}
-${PREFILL}        0
-${REPETITIONS}    1
-${RESULTS_FILE_NAME}    bgp.csv
-${TEST_DURATION_MULTIPLIER}    1
-${UPDATE}         single
-${WITHDRAW}       0
-${INITIAL_RESTCONF_TIMEOUT}    30s
-${KARAF_HOME}     ${WORKSPACE}/${BUNDLEFOLDER}
-${SHARD_DEFAULT_CONFIG}    shard-default-config
-${SHARD_DEFAULT_OPERATIONAL}    shard-default-operational
-${CONFIG_SESSION}    config-session
-${CONFIGURATION_1}    operational-1
-${CONFIGURATION_2}    operational-2
-${CONFIGURATION_3}    operational-3
-${EXAMPLE_IPV4_TOPOLOGY}    example-ipv4-topology
-${DEVICE_NAME}    peer-controller-config
-${DEVICE_CHECK_TIMEOUT}    60s
-${RIB_INSTANCE}    example-bgp-rib
-${BGP_PEER_NAME}    example-bgp-peer
 
 *** Test Cases ***
 Get Example Bgp Rib Owner
     [Documentation]    Find an odl node which is able to accept incomming connection. To this node netconf connector should be configured.
     ${rib_owner}    ${rib_candidates}=    ClusterManagement.Get_Owner_And_Successors_For_device    example-bgp-rib    org.opendaylight.mdsal.ServiceEntityType    1
-    BuiltIn.Set Suite variable    ${rib_owner}    ${rib_owner}
-    BuiltIn.Set Suite variable    ${rib_owner_node_id}    ${ODL_SYSTEM_${rib_owner}_IP}
+    BuiltIn.Set_Suite_Variable    ${rib_owner}    ${rib_owner}
+    BuiltIn.Set_Suite_Variable    ${rib_owner_node_id}    ${ODL_SYSTEM_${rib_owner}_IP}
     RequestsLibrary.Create_Session    ${CONFIG_SESSION}    http://${ODL_SYSTEM_${rib_owner}_IP}:${RESTCONFPORT}    auth=${AUTH}
 
 Check_For_Empty_Ipv4_Topology_Before_Talking_1
@@ -92,10 +63,10 @@ Check_For_Empty_Ipv4_Topology_Before_Talking_3
 
 Configure_Netconf_Device
     [Documentation]    Configures and verifies netconf device configuration. If configuration is not successful, it de-configures the device before the next attempt.
-    &{mapping}    Create Dictionary    DEVICE_NAME=${DEVICE_NAME}    DEVICE_PORT=1830    DEVICE_IP=${rib_owner_node_id}    DEVICE_USER=admin    DEVICE_PASSWORD=admin
+    &{mapping}    BuiltIn.Create_Dictionary    DEVICE_NAME=${DEVICE_NAME}    DEVICE_PORT=1830    DEVICE_IP=${rib_owner_node_id}    DEVICE_USER=admin    DEVICE_PASSWORD=admin
     # After the netconf device is configured, odl starts downloading schemas. If the downloading will not finish within akka timeout, more tries are needed, 3 is based on a user experience.
     : FOR    ${index}    IN RANGE    0    3
-    \    ${status}    ${value}=    Run Keyword And Ignore Error    Configure Netconf Device And Check Mounted    ${mapping}
+    \    ${status}    ${value}=    Run Keyword And Ignore Error    PrefixcountKeywords.Configure_Netconf_Device_And_Check_Mounted    ${mapping}
     \    Exit For Loop If    '${status}' == 'PASS'
     \    Run Keyword Unless    '${status}' == 'PASS'    TemplatedRequests.Delete_Templated    ${NETCONF_DEV_FOLDER}    mapping=${mapping}    session=${CONFIG_SESSION}
     Run Keyword Unless    '${status}' == 'PASS'    Fail
@@ -103,14 +74,14 @@ Configure_Netconf_Device
 Reconfigure_ODL_To_Accept_Connection
     [Documentation]    Configure BGP peer module with initiate-connection set to false.
     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
-    &{mapping}    Create Dictionary    DEVICE_NAME=${DEVICE_NAME}    BGP_NAME=${BGP_PEER_NAME}    IP=${TOOLS_SYSTEM_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}
+    &{mapping}    BuiltIn.Create_Dictionary    DEVICE_NAME=${DEVICE_NAME}    BGP_NAME=${BGP_PEER_NAME}    IP=${TOOLS_SYSTEM_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}
     ...    INITIATE=false    BGP_RIB=${RIB_INSTANCE}
     TemplatedRequests.Put_As_Json_Templated    ${BGP_VARIABLES_FOLDER}    mapping=${mapping}    session=${CONFIG_SESSION}
     [Teardown]    SetupUtils.Teardown_Test_Show_Bugs_If_Test_Failed
 
 Start_Talking_BGP_Speaker
-    [Documentation]    Start Python speaker to connect to ODL. We need to do WUKS until odl really starts to accept incomming bgp connection. The failure happens if the incomming connection comes too quickly after configuring the peer in the previous test case.
-    BuiltIn.Wait_Until_Keyword_Succeeds    3x    1s    Start Bgp Peer
+    [Documentation]    Start Python speaker to connect to ODL.
+    PrefixcountKeywords.Start_Bgp_Peer_And_Verify_Connected    connection_retries=${3}
 
 Wait_For_Stable_Talking_Ipv4_Topology_1
     [Documentation]    Wait until ${EXAMPLE_IPV4_TOPOLOGY} becomes stable. This is done by checking stability of prefix count as seen from node 1.
@@ -185,63 +156,12 @@ Check_For_Empty_Ipv4_Topology_After_Listening_3
 Delete_Bgp_Peer_Configuration
     [Documentation]    Revert the BGP configuration to the original state: without any configured peers.
     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
-    &{mapping}    Create Dictionary    DEVICE_NAME=${DEVICE_NAME}    BGP_NAME=${BGP_PEER_NAME}    IP=${TOOLS_SYSTEM_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}
+    &{mapping}    BuiltIn.Create_Dictionary    DEVICE_NAME=${DEVICE_NAME}    BGP_NAME=${BGP_PEER_NAME}    IP=${TOOLS_SYSTEM_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}
     ...    INITIATE=false    BGP_RIB=${RIB_INSTANCE}
     TemplatedRequests.Delete_Templated    ${BGP_VARIABLES_FOLDER}    mapping=${mapping}    session=${CONFIG_SESSION}
 
 Delete_Netconf_Device_Configuration
     [Documentation]    Revert the netconf configuration to the original stat
     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
-    &{mapping}    Create Dictionary    DEVICE_NAME=${DEVICE_NAME}    DEVICE_PORT=1830    DEVICE_IP=${rib_owner_node_id}    DEVICE_USER=admin    DEVICE_PASSWORD=admin
+    &{mapping}    BuiltIn.Create_Dictionary    DEVICE_NAME=${DEVICE_NAME}    DEVICE_PORT=1830    DEVICE_IP=${rib_owner_node_id}    DEVICE_USER=admin    DEVICE_PASSWORD=admin
     TemplatedRequests.Delete_Templated    ${NETCONF_DEV_FOLDER}    mapping=${mapping}    session=${CONFIG_SESSION}
-
-*** Keywords ***
-Setup_Everything
-    [Documentation]    Setup imported resources, SSH-login to tools system,
-    ...    create HTTP session, put Python tool to tools system.
-    SetupUtils.Setup_Utils_For_Setup_And_Teardown
-    ClusterManagement.ClusterManagement_Setup
-    RequestsLibrary.Create_Session    ${CONFIGURATION_1}    http://${ODL_SYSTEM_1_IP}:${RESTCONFPORT}${OPERATIONAL_API}    auth=${AUTH}
-    RequestsLibrary.Create_Session    ${CONFIGURATION_2}    http://${ODL_SYSTEM_2_IP}:${RESTCONFPORT}${OPERATIONAL_API}    auth=${AUTH}
-    RequestsLibrary.Create_Session    ${CONFIGURATION_3}    http://${ODL_SYSTEM_3_IP}:${RESTCONFPORT}${OPERATIONAL_API}    auth=${AUTH}
-    PrefixCounting.PC_Setup
-    SSHLibrary.Set_Default_Configuration    prompt=${TOOLS_SYSTEM_PROMPT}
-    SSHLibrary.Open_Connection    ${TOOLS_SYSTEM_IP}
-    Utils.Flexible_Mininet_Login
-    # 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.
-    SSHLibrary.Put_File    ${CURDIR}/../../../../tools/fastbgp/play.py
-    SSHKeywords.Require_Python
-    SSHKeywords.Assure_Library_Ipaddr    target_dir=.
-    # Calculate the timeout value based on how many routes are going to be pushed
-    # TODO: Replace 35 with some formula from period and repetitions.
-    ${timeout} =    BuiltIn.Evaluate    ${TEST_DURATION_MULTIPLIER} * (${COUNT} * 6.0 / 10000 + 35)
-    Builtin.Set_Suite_Variable    ${bgp_filling_timeout}    ${timeout}
-    Builtin.Set_Suite_Variable    ${bgp_emptying_timeout}    ${bgp_filling_timeout*3.0/4}
-    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'
-    RequestsLibrary.Delete_All_Sessions
-    SSHLibrary.Close_All_Connections
-
-Store_File_To_Workspace
-    [Arguments]    ${src_file_name}    ${dst_file_name}
-    [Documentation]    Store the provided file from the SSH client to workspace.
-    ${files}=    SSHLibrary.List Files In Directory    .
-    ${output_log}=    SSHLibrary.Execute_Command    cat ${src_file_name}
-    BuiltIn.Log    ${output_log}
-    Create File    ${dst_file_name}    ${output_log}
-
-Configure Netconf Device And Check Mounted
-    [Arguments]    ${mapping}
-    TemplatedRequests.Put_As_Xml_Templated    ${NETCONF_DEV_FOLDER}    mapping=${mapping}    session=${CONFIG_SESSION}
-    BuiltIn.Wait Until Keyword Succeeds    10x    3s    TemplatedRequests.Get_As_Xml_Templated    ${NETCONF_MOUNT_FOLDER}    mapping=${mapping}    session=${CONFIG_SESSION}
-
-Start Bgp Peer
-    [Documentation]    Starts bgp peer and verifies that the peer runs.
-    BGPSpeaker.Start_BGP_Speaker    --amount ${COUNT} --myip=${TOOLS_SYSTEM_IP} --myport=${BGP_TOOL_PORT} --peerip=${rib_owner_node_id} --peerport=${ODL_BGP_PORT} --insert=${INSERT} --withdraw=${WITHDRAW} --prefill ${PREFILL} --update ${UPDATE} --${BGP_TOOL_LOG_LEVEL} --results ${RESULTS_FILE_NAME}
-    BGPcliKeywords.Read_And_Fail_If_Prompt_Is_Seen
index a1f1bbc4bc0bb1f1ce08600a87f25d895913d5dc..1e6d22b641ca2cc4f1811af6d94e84ad7f1b6b46 100644 (file)
@@ -14,8 +14,8 @@ Documentation     BGP performance of ingesting from 1 iBGP peer, data change cou
 ...               <dst-id> is recognized during the suite run, should be the Leader of default
 ...               operational Shard, otherwise the scenario would fail due to
 ...               https://bugs.opendaylight.org/show_bug.cgi?id=5536
-Suite Setup       Setup_Everything
-Suite Teardown    Teardown_Everything
+Suite Setup       PrefixcountKeywords.Setup_Everything
+Suite Teardown    PrefixcountKeywords.Teardown_Everything
 Test Setup        SetupUtils.Setup_Test_With_Logging_And_Fast_Failing
 Test Teardown     SetupUtils.Teardown_Test_Show_Bugs_And_Start_Fast_Failing_If_Test_Failed
 Library           SSHLibrary    timeout=10s
@@ -30,45 +30,17 @@ Resource          ${CURDIR}/../../../libraries/SetupUtils.robot
 Resource          ${CURDIR}/../../../libraries/ClusterManagement.robot
 Resource          ${CURDIR}/../../../libraries/SSHKeywords.robot
 Resource          ${CURDIR}/../../../libraries/TemplatedRequests.robot
+Resource          ${CURDIR}/PrefixcountKeywords.robot
 
 *** Variables ***
-${BGP_TOOL_LOG_LEVEL}    info
-${BGP_VARIABLES_FOLDER}    ${CURDIR}/../../../variables/bgpclustering/bgp_peer
-${BGP_VARIABLES_FOLDER_OP}    ${CURDIR}/../../../variables/bgpclustering/bgp_peer_operational
-${NETCONF_DEV_FOLDER}    ${CURDIR}/../../../variables/netconf/device/full-uri-device
-${NETCONF_MOUNT_FOLDER}    ${CURDIR}/../../../variables/netconf/device/full-uri-mount
-${CHECK_PERIOD}    10
 ${COUNT}          1000000
-${HOLDTIME}       180
-${INSERT}         1
-${KARAF_LOG_LEVEL}    INFO
-${KARAF_BGPCEP_LOG_LEVEL}    ${KARAF_LOG_LEVEL}
-${KARAF_PROTOCOL_LOG_LEVEL}    ${KARAF_BGPCEP_LOG_LEVEL}
-${PREFILL}        0
-${REPETITIONS}    1
-${RESULTS_FILE_NAME}    bgp.csv
-${TEST_DURATION_MULTIPLIER}    1
-${UPDATE}         single
-${WITHDRAW}       0
-${INITIAL_RESTCONF_TIMEOUT}    30s
-${KARAF_HOME}     ${WORKSPACE}/${BUNDLEFOLDER}
-${SHARD_DEFAULT_CONFIG}    shard-default-config
-${SHARD_DEFAULT_OPERATIONAL}    shard-default-operational
-${CONFIG_SESSION}    config-session
-${CONFIGURATION_1}    operational-1
-${CONFIGURATION_2}    operational-2
-${CONFIGURATION_3}    operational-3
 ${EXAMPLE_IPV4_TOPOLOGY_PREF}    example-ipv4-topology-
-${DEVICE_NAME}    peer-controller-config
-${DEVICE_CHECK_TIMEOUT}    60s
-${RIB_INSTANCE}    example-bgp-rib
-${BGP_PEER_NAME}    example-bgp-peer
 
 *** Test Cases ***
 Get Default Operational Shard Leader
     ${dos_leader}    ${dos_followers}=    ClusterManagement.Get_Leader_And_Followers_For_Shard
-    BuiltIn.Set Suite variable    ${dos_leader}    ${dos_leader}
-    BuiltIn.Set Suite variable    ${default_oper_shard_leader_node_ip}    ${ODL_SYSTEM_${dos_leader}_IP}
+    BuiltIn.Set_Suite_Variable    ${dos_leader}    ${dos_leader}
+    BuiltIn.Set_Suite_Variable    ${default_oper_shard_leader_node_ip}    ${ODL_SYSTEM_${dos_leader}_IP}
     RequestsLibrary.Create_Session    ${CONFIG_SESSION}    http://${ODL_SYSTEM_${dos_leader}_IP}:${RESTCONFPORT}    auth=${AUTH}
 
 Check_For_Empty_Ipv4_Topology_Before_Talking_1
@@ -91,10 +63,10 @@ Check_For_Empty_Ipv4_Topology_Before_Talking_3
 
 Configure_Netconf_Device
     [Documentation]    Configures and verifies netconf device configuration. If configuration is not successful, it de-configures the device before the next attempt.
-    &{mapping}    Create Dictionary    DEVICE_NAME=${DEVICE_NAME}    DEVICE_PORT=1830    DEVICE_IP=${default_oper_shard_leader_node_ip}    DEVICE_USER=admin    DEVICE_PASSWORD=admin
+    &{mapping}    BuiltIn.Create_Dictionary    DEVICE_NAME=${DEVICE_NAME}    DEVICE_PORT=1830    DEVICE_IP=${default_oper_shard_leader_node_ip}    DEVICE_USER=admin    DEVICE_PASSWORD=admin
     # After the netconf device is configured, odl starts downloading schemas. If the downloading will not finish within akka timeout, more tries are needed, 3 is based on a user experience.
     : FOR    ${index}    IN RANGE    0    3
-    \    ${status}    ${value}=    Run Keyword And Ignore Error    Configure Netconf Device And Check Mounted    ${mapping}
+    \    ${status}    ${value}=    Run Keyword And Ignore Error    PrefixcountKeywords.Configure_Netconf_Device_And_Check_Mounted    ${mapping}
     \    Exit For Loop If    '${status}' == 'PASS'
     \    Run Keyword Unless    '${status}' == 'PASS'    TemplatedRequests.Delete_Templated    ${NETCONF_DEV_FOLDER}    mapping=${mapping}    session=${CONFIG_SESSION}
     Run Keyword Unless    '${status}' == 'PASS'    Fail
@@ -102,14 +74,14 @@ Configure_Netconf_Device
 Reconfigure_ODL_To_Accept_Connection
     [Documentation]    Configure BGP peer module with initiate-connection set to false.
     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
-    &{mapping}    Create Dictionary    DEVICE_NAME=${DEVICE_NAME}    BGP_NAME=${BGP_PEER_NAME}    IP=${TOOLS_SYSTEM_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}
+    &{mapping}    BuiltIn.Create_Dictionary    DEVICE_NAME=${DEVICE_NAME}    BGP_NAME=${BGP_PEER_NAME}    IP=${TOOLS_SYSTEM_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}
     ...    INITIATE=false    BGP_RIB=${RIB_INSTANCE}
     TemplatedRequests.Put_As_Json_Templated    ${BGP_VARIABLES_FOLDER}    mapping=${mapping}    session=${CONFIG_SESSION}
     [Teardown]    SetupUtils.Teardown_Test_Show_Bugs_If_Test_Failed
 
 Start_Talking_BGP_Speaker
-    [Documentation]    Start Python speaker to connect to ODL. We need to do WUKS until odl really starts to accept incomming bgp connection. The failure happens if the incomming connection comes too quickly after configuring the peer in the previous test case.
-    BuiltIn.Wait_Until_Keyword_Succeeds    3x    1s    Start Bgp Peer
+    [Documentation]    Start Python speaker to connect to ODL.
+    PrefixcountKeywords.Start_Bgp_Peer_And_Verify_Connected    connection_retries=${3}    peerip=${default_oper_shard_leader_node_ip}
 
 Wait_For_Stable_Talking_Ipv4_Topology_1
     [Documentation]    Wait until ${EXAMPLE_IPV4_TOPOLOGY_PREF}${dos_leader} becomes stable. This is done by checking stability of prefix count as seen from node 1.
@@ -184,63 +156,12 @@ Check_For_Empty_Ipv4_Topology_After_Listening_3
 Delete_Bgp_Peer_Configuration
     [Documentation]    Revert the BGP configuration to the original state: without any configured peers.
     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
-    &{mapping}    Create Dictionary    DEVICE_NAME=${DEVICE_NAME}    BGP_NAME=${BGP_PEER_NAME}    IP=${TOOLS_SYSTEM_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}
+    &{mapping}    BuiltIn.Create_Dictionary    DEVICE_NAME=${DEVICE_NAME}    BGP_NAME=${BGP_PEER_NAME}    IP=${TOOLS_SYSTEM_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}
     ...    INITIATE=false    BGP_RIB=${RIB_INSTANCE}
     TemplatedRequests.Delete_Templated    ${BGP_VARIABLES_FOLDER}    mapping=${mapping}    session=${CONFIG_SESSION}
 
 Delete_Netconf_Device_Configuration
     [Documentation]    Revert the netconf configuration to the original stat
     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
-    &{mapping}    Create Dictionary    DEVICE_NAME=${DEVICE_NAME}    DEVICE_PORT=1830    DEVICE_IP=${default_oper_shard_leader_node_ip}    DEVICE_USER=admin    DEVICE_PASSWORD=admin
+    &{mapping}    BuiltIn.Create_Dictionary    DEVICE_NAME=${DEVICE_NAME}    DEVICE_PORT=1830    DEVICE_IP=${default_oper_shard_leader_node_ip}    DEVICE_USER=admin    DEVICE_PASSWORD=admin
     TemplatedRequests.Delete_Templated    ${NETCONF_DEV_FOLDER}    mapping=${mapping}    session=${CONFIG_SESSION}
-
-*** Keywords ***
-Setup_Everything
-    [Documentation]    Setup imported resources, SSH-login to tools system,
-    ...    create HTTP session, put Python tool to tools system.
-    SetupUtils.Setup_Utils_For_Setup_And_Teardown
-    ClusterManagement.ClusterManagement_Setup
-    RequestsLibrary.Create_Session    ${CONFIGURATION_1}    http://${ODL_SYSTEM_1_IP}:${RESTCONFPORT}${OPERATIONAL_API}    auth=${AUTH}
-    RequestsLibrary.Create_Session    ${CONFIGURATION_2}    http://${ODL_SYSTEM_2_IP}:${RESTCONFPORT}${OPERATIONAL_API}    auth=${AUTH}
-    RequestsLibrary.Create_Session    ${CONFIGURATION_3}    http://${ODL_SYSTEM_3_IP}:${RESTCONFPORT}${OPERATIONAL_API}    auth=${AUTH}
-    PrefixCounting.PC_Setup
-    SSHLibrary.Set_Default_Configuration    prompt=${TOOLS_SYSTEM_PROMPT}
-    SSHLibrary.Open_Connection    ${TOOLS_SYSTEM_IP}
-    Utils.Flexible_Mininet_Login
-    # 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.
-    SSHLibrary.Put_File    ${CURDIR}/../../../../tools/fastbgp/play.py
-    SSHKeywords.Require_Python
-    SSHKeywords.Assure_Library_Ipaddr    target_dir=.
-    # Calculate the timeout value based on how many routes are going to be pushed
-    # TODO: Replace 35 with some formula from period and repetitions.
-    ${timeout} =    BuiltIn.Evaluate    ${TEST_DURATION_MULTIPLIER} * (${COUNT} * 6.0 / 10000 + 35)
-    Builtin.Set_Suite_Variable    ${bgp_filling_timeout}    ${timeout}
-    Builtin.Set_Suite_Variable    ${bgp_emptying_timeout}    ${bgp_filling_timeout*3.0/4}
-    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'
-    RequestsLibrary.Delete_All_Sessions
-    SSHLibrary.Close_All_Connections
-
-Store_File_To_Workspace
-    [Arguments]    ${src_file_name}    ${dst_file_name}
-    [Documentation]    Store the provided file from the SSH client to workspace.
-    ${files}=    SSHLibrary.List Files In Directory    .
-    ${output_log}=    SSHLibrary.Execute_Command    cat ${src_file_name}
-    BuiltIn.Log    ${output_log}
-    Create File    ${dst_file_name}    ${output_log}
-
-Configure Netconf Device And Check Mounted
-    [Arguments]    ${mapping}
-    TemplatedRequests.Put_As_Xml_Templated    ${NETCONF_DEV_FOLDER}    mapping=${mapping}    session=${CONFIG_SESSION}
-    BuiltIn.Wait Until Keyword Succeeds    10x    3s    TemplatedRequests.Get_As_Xml_Templated    ${NETCONF_MOUNT_FOLDER}    mapping=${mapping}    session=${CONFIG_SESSION}
-
-Start Bgp Peer
-    [Documentation]    Starts bgp peer and verifies that the peer runs.
-    BGPSpeaker.Start_BGP_Speaker    --amount ${COUNT} --myip=${TOOLS_SYSTEM_IP} --myport=${BGP_TOOL_PORT} --peerip=${default_oper_shard_leader_node_ip} --peerport=${ODL_BGP_PORT} --insert=${INSERT} --withdraw=${WITHDRAW} --prefill ${PREFILL} --update ${UPDATE} --${BGP_TOOL_LOG_LEVEL} --results ${RESULTS_FILE_NAME}
-    BGPcliKeywords.Read_And_Fail_If_Prompt_Is_Seen
diff --git a/csit/suites/bgpcep/bgpclustering/030_singlepeer_prefixcount_1Mroutes_nonreplicated_rib.robot b/csit/suites/bgpcep/bgpclustering/030_singlepeer_prefixcount_1Mroutes_nonreplicated_rib.robot
new file mode 100644 (file)
index 0000000..2a30771
--- /dev/null
@@ -0,0 +1,97 @@
+*** Settings ***
+Documentation     BGP performance of ingesting from 1 iBGP peer, data change counter is NOT used.
+...
+...               Copyright (c) 2015-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 as single iBGP peer which talks to
+...               single controller in three node cluster configuration.
+...               Test suite checks changes of the the example-ipv4-topology default operational
+...               shard leader only. Less stress for cluster is expected as if followers were
+...               triggered for that.
+Suite Setup       PrefixcountKeywords.Setup_Everything
+Suite Teardown    PrefixcountKeywords.Teardown_Everything
+Test Setup        SetupUtils.Setup_Test_With_Logging_And_Fast_Failing
+Test Teardown     SetupUtils.Teardown_Test_Show_Bugs_And_Start_Fast_Failing_If_Test_Failed
+Library           SSHLibrary    timeout=10s
+Library           RequestsLibrary
+Variables         ${CURDIR}/../../../variables/Variables.py
+Resource          ${CURDIR}/../../../libraries/BGPSpeaker.robot
+Resource          ${CURDIR}/../../../libraries/BGPcliKeywords.robot
+Resource          ${CURDIR}/../../../libraries/FailFast.robot
+Resource          ${CURDIR}/../../../libraries/KillPythonTool.robot
+Resource          ${CURDIR}/../../../libraries/PrefixCounting.robot
+Resource          ${CURDIR}/../../../libraries/SetupUtils.robot
+Resource          ${CURDIR}/../../../libraries/ClusterManagement.robot
+Resource          ${CURDIR}/../../../libraries/SSHKeywords.robot
+Resource          ${CURDIR}/../../../libraries/TemplatedRequests.robot
+Resource          ${CURDIR}/PrefixcountKeywords.robot
+
+*** Variables ***
+${COUNT}          1000000
+
+*** Test Cases ***
+Get Example Bgp Rib Owner
+    [Documentation]    Find an odl node which is able to accept incomming connection. To this node netconf connector should be configured.
+    ${rib_owner}    ${rib_candidates}=    ClusterManagement.Get_Owner_And_Successors_For_device    example-bgp-rib    org.opendaylight.mdsal.ServiceEntityType    1
+    BuiltIn.Set_Suite_Variable    ${rib_owner}    ${rib_owner}
+    BuiltIn.Set_Suite_Variable    ${rib_owner_node_id}    ${ODL_SYSTEM_${rib_owner}_IP}
+    RequestsLibrary.Create_Session    ${CONFIG_SESSION}    http://${ODL_SYSTEM_${rib_owner}_IP}:${RESTCONFPORT}    auth=${AUTH}
+
+Get Topology Operational Leader
+    [Documentation]    Gets the operational topology shard leader
+    ${leader}    ${followers}=    ClusterManagement.Get_Leader_And_Followers_For_Shard    shard_name=topology    shard_type=operational
+    BuiltIn.Set_Suite_Variable    ${topo_lead_ses}    operational-${leader}
+
+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    ${INITIAL_RESTCONF_TIMEOUT}    1s    PrefixCounting.Check_Ipv4_Topology_Is_Empty    session=${topo_lead_ses}    topology=${EXAMPLE_IPV4_TOPOLOGY}
+
+Reconfigure_ODL_To_Accept_Connection
+    [Documentation]    Configure BGP peer module in passive mode (not initiating connection)
+    [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
+    &{mapping}    Create Dictionary    IP=${TOOLS_SYSTEM_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}    PASSIVE_MODE=true    BGP_RIB=${RIB_INSTANCE}
+    TemplatedRequests.Post_As_Xml_Templated    ${BGP_PEER_FOLDER}    mapping=${mapping}    session=${CONFIG_SESSION}
+    [Teardown]    SetupUtils.Teardown_Test_Show_Bugs_If_Test_Failed
+
+Start_Talking_BGP_Speaker
+    [Documentation]    Start Python speaker to connect to ODL.
+    PrefixcountKeywords.Start_Bgp_Peer_And_Verify_Connected    connection_retries=${3}
+
+Wait_For_Stable_Talking_Ipv4_Topology
+    [Documentation]    Wait until ${EXAMPLE_IPV4_TOPOLOGY} becomes stable. This is done by checking stability of prefix count as seen from node 1.
+    PrefixCounting.Wait_For_Ipv4_Topology_Prefixes_To_Become_Stable    timeout=${bgp_filling_timeout}    period=${CHECK_PERIOD}    repetitions=${REPETITIONS}    excluded_count=0    session=${topo_lead_ses}    topology=${EXAMPLE_IPV4_TOPOLOGY}
+
+Check_Talking_Ipv4_Topology_Count
+    [Documentation]    Count the routes in ${EXAMPLE_IPV4_TOPOLOGY} and fail if the count is not correct as seen from node 1.
+    [Tags]    critical
+    [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
+    PrefixCounting.Check_Ipv4_Topology_Count    ${COUNT}    session=${topo_lead_ses}    topology=${EXAMPLE_IPV4_TOPOLOGY}
+
+Kill_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
+    BGPSpeaker.Kill_BGP_Speaker
+    FailFast.Do_Not_Fail_Fast_From_Now_On
+
+Wait_For_Stable_Ipv4_Topology_After_Listening
+    [Documentation]    Wait until ${EXAMPLE_IPV4_TOPOLOGY} becomes stable again as seen from node 1.
+    [Tags]    critical
+    PrefixCounting.Wait_For_Ipv4_Topology_Prefixes_To_Become_Stable    timeout=${bgp_filling_timeout}    period=${CHECK_PERIOD}    repetitions=${REPETITIONS}    excluded_count=${COUNT}    session=${topo_lead_ses}    topology=${EXAMPLE_IPV4_TOPOLOGY}
+
+Check_For_Empty_Ipv4_Topology_After_Listening
+    [Documentation]    Example-ipv4-topology should be empty now as seen from node 1.
+    [Tags]    critical
+    [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
+    PrefixCounting.Check_Ipv4_Topology_Is_Empty    session=${topo_lead_ses}    topology=${EXAMPLE_IPV4_TOPOLOGY}
+
+Delete_Bgp_Peer_Configuration
+    [Documentation]    Revert the BGP configuration to the original state: without any configured peers
+    &{mapping}    Create Dictionary    BGP_RIB=${RIB_INSTANCE}
+    TemplatedRequests.Delete_Templated    ${BGP_PEER_FOLDER}    mapping=${mapping}    session=${CONFIG_SESSION}
diff --git a/csit/suites/bgpcep/bgpclustering/PrefixcountKeywords.robot b/csit/suites/bgpcep/bgpclustering/PrefixcountKeywords.robot
new file mode 100644 (file)
index 0000000..00601af
--- /dev/null
@@ -0,0 +1,117 @@
+*** Settings ***
+Documentation     BGP performance of ingesting from 1 iBGP peer, data change counter is NOT used.
+...
+...               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
+Library           SSHLibrary    timeout=10s
+Library           RequestsLibrary
+Variables         ${CURDIR}/../../../variables/Variables.py
+Resource          ${CURDIR}/../../../libraries/BGPSpeaker.robot
+Resource          ${CURDIR}/../../../libraries/BGPcliKeywords.robot
+Resource          ${CURDIR}/../../../libraries/FailFast.robot
+Resource          ${CURDIR}/../../../libraries/KillPythonTool.robot
+Resource          ${CURDIR}/../../../libraries/PrefixCounting.robot
+Resource          ${CURDIR}/../../../libraries/SetupUtils.robot
+Resource          ${CURDIR}/../../../libraries/ClusterManagement.robot
+Resource          ${CURDIR}/../../../libraries/SSHKeywords.robot
+Resource          ${CURDIR}/../../../libraries/TemplatedRequests.robot
+
+*** Variables ***
+${BGP_TOOL_LOG_LEVEL}    info
+${BGP_PEER_FOLDER}    ${CURDIR}/../../../variables/bgpfunctional/openconfig_bgp_peer    # used for configuration of bgp peer via openconfig
+${BGP_VARIABLES_FOLDER}    ${CURDIR}/../../../variables/bgpclustering/bgp_peer    # used for configuration of bgp peer vie netconf connector
+${BGP_VARIABLES_FOLDER_OP}    ${CURDIR}/../../../variables/bgpclustering/bgp_peer_operational
+${NETCONF_DEV_FOLDER}    ${CURDIR}/../../../variables/netconf/device/full-uri-device
+${NETCONF_MOUNT_FOLDER}    ${CURDIR}/../../../variables/netconf/device/full-uri-mount
+${CHECK_PERIOD}    10
+${HOLDTIME}       180
+${INSERT}         1
+${KARAF_LOG_LEVEL}    INFO
+${KARAF_BGPCEP_LOG_LEVEL}    ${KARAF_LOG_LEVEL}
+${KARAF_PROTOCOL_LOG_LEVEL}    ${KARAF_BGPCEP_LOG_LEVEL}
+${PREFILL}        0
+${REPETITIONS}    1
+${RESULTS_FILE_NAME}    bgp.csv
+${TEST_DURATION_MULTIPLIER}    1
+${UPDATE}         single
+${WITHDRAW}       0
+${INITIAL_RESTCONF_TIMEOUT}    30s
+${KARAF_HOME}     ${WORKSPACE}/${BUNDLEFOLDER}
+${SHARD_DEFAULT_CONFIG}    shard-default-config
+${SHARD_DEFAULT_OPERATIONAL}    shard-default-operational
+${CONFIG_SESSION}    config-session
+${CONFIGURATION_1}    operational-1
+${CONFIGURATION_2}    operational-2
+${CONFIGURATION_3}    operational-3
+${EXAMPLE_IPV4_TOPOLOGY}    example-ipv4-topology
+${DEVICE_NAME}    peer-controller-config
+${DEVICE_CHECK_TIMEOUT}    60s
+${RIB_INSTANCE}    example-bgp-rib
+${BGP_PEER_NAME}    example-bgp-peer
+${PEER_CHECK_URL}    /restconf/operational/bgp-rib:bgp-rib/rib/example-bgp-rib/peer/bgp:%2F%2F
+
+*** Keywords ***
+Setup_Everything
+    [Documentation]    Setup imported resources, SSH-login to tools system,
+    ...    create HTTP session, put Python tool to tools system.
+    SetupUtils.Setup_Utils_For_Setup_And_Teardown
+    RequestsLibrary.Create_Session    ${CONFIGURATION_1}    http://${ODL_SYSTEM_1_IP}:${RESTCONFPORT}${OPERATIONAL_API}    auth=${AUTH}
+    RequestsLibrary.Create_Session    ${CONFIGURATION_2}    http://${ODL_SYSTEM_2_IP}:${RESTCONFPORT}${OPERATIONAL_API}    auth=${AUTH}
+    RequestsLibrary.Create_Session    ${CONFIGURATION_3}    http://${ODL_SYSTEM_3_IP}:${RESTCONFPORT}${OPERATIONAL_API}    auth=${AUTH}
+    PrefixCounting.PC_Setup
+    SSHLibrary.Set_Default_Configuration    prompt=${TOOLS_SYSTEM_PROMPT}
+    SSHLibrary.Open_Connection    ${TOOLS_SYSTEM_IP}
+    Utils.Flexible_Mininet_Login
+    # 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.
+    SSHLibrary.Put_File    ${CURDIR}/../../../../tools/fastbgp/play.py
+    SSHKeywords.Require_Python
+    SSHKeywords.Assure_Library_Ipaddr    target_dir=.
+    # Calculate the timeout value based on how many routes are going to be pushed
+    # TODO: Replace 35 with some formula from period and repetitions.
+    ${timeout} =    BuiltIn.Evaluate    ${TEST_DURATION_MULTIPLIER} * (${COUNT} * 6.0 / 10000 + 35)
+    Builtin.Set_Suite_Variable    ${bgp_filling_timeout}    ${timeout}
+    Builtin.Set_Suite_Variable    ${bgp_emptying_timeout}    ${bgp_filling_timeout*3.0/4}
+    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'
+    RequestsLibrary.Delete_All_Sessions
+    SSHLibrary.Close_All_Connections
+
+Configure_Netconf_Device_And_Check_Mounted
+    [Arguments]    ${mapping}
+    [Documentation]    Configures netconf device
+    TemplatedRequests.Put_As_Xml_Templated    ${NETCONF_DEV_FOLDER}    mapping=${mapping}    session=${CONFIG_SESSION}
+    BuiltIn.Wait_Until_Keyword_Succeeds    10x    3s    TemplatedRequests.Get_As_Xml_Templated    ${NETCONF_MOUNT_FOLDER}    mapping=${mapping}    session=${CONFIG_SESSION}
+
+Start_Bgp_Peer
+    [Arguments]    ${peerip}=${rib_owner_node_id}
+    [Documentation]    Starts bgp peer and verifies that the peer runs.
+    BGPSpeaker.Start_BGP_Speaker    --amount ${COUNT} --myip=${TOOLS_SYSTEM_IP} --myport=${BGP_TOOL_PORT} --peerip=${peerip} --peerport=${ODL_BGP_PORT} --insert=${INSERT} --withdraw=${WITHDRAW} --prefill ${PREFILL} --update ${UPDATE} --${BGP_TOOL_LOG_LEVEL} --results ${RESULTS_FILE_NAME}
+
+Start_Bgp_Peer_And_Verify_Connected
+    [Arguments]    ${connection_retries}=${1}    ${peerip}=${rib_owner_node_id}
+    [Documentation]    Starts the peer and verifies its connection. The verification is done by checking the presence
+    ...    of the peer in the bgp rib.
+    : FOR    ${idx}    IN RANGE    ${connection_retries}
+    \    Start_Bgp_Peer    peerip=${peerip}
+    \    ${status}    ${value}=    BuiltIn.Run_Keyword_And_Ignore_Error    BuiltIn.Wait_Until_Keyword_Succeeds    3x    3s
+    \    ...    Verify_Bgp_Peer_Connection    ${CONFIG_SESSION}    ${TOOLS_SYSTEM_IP}    connected=${True}
+    \    BuiltIn.Run_Keyword_Unless    "${status}" == "PASS"    BGPSpeaker.Kill_BGP_Speaker
+    \    BuiltIn.Return_From_Keyword_If    "${status}" == "PASS"
+    BuiltIn.Fail    Unable to connect bgp peer to ODL
+
+Verify_Bgp_Peer_Connection
+    [Arguments]    ${session}    ${peer_ip}    ${connected}=${True}
+    [Documentation]    Checks peer presence in operational datastore
+    ${exp_status_code}=    BuiltIn.Set_Variable_If    ${connected}    ${200}    ${404}
+    ${rsp}=    RequestsLibrary.Get Request    ${session}    ${PEER_CHECK_URL}${peer_ip}
+    BuiltIn.Log    ${rsp.content}
+    BuiltIn.Should_Be_Equal_As_Numbers    ${exp_status_code}    ${rsp.status_code}
index 91254564fa898b52c2a6dee13fec7036283b5316..5fa767284f7909b5f62f6a50ba6e0a5166c345a6 100644 (file)
@@ -9,3 +9,9 @@ integration/test/csit/suites/netconf/ready/netconfready.robot
 integration/test/csit/suites/bgpcep/bgpclustering/010_singlepeer_prefixcount_1route.robot
 integration/test/csit/suites/bgpcep/bgpclustering/020_singlepeer_prefixcount_100kroutes.robot
 integration/test/csit/suites/bgpcep/bgpclustering/030_singlepeer_prefixcount_1Mroutes.robot
+integration/test/csit/suites/bgpcep/bgpclustering/005_Cluster_Reset_And_Set_Nonreplicated_Bgp_Rib.robot
+integration/test/csit/suites/netconf/ready/netconfready.robot
+integration/test/csit/suites/bgpcep/bgpclustering/010_singlepeer_prefixcount_1route_nonreplicated_rib.robot
+integration/test/csit/suites/bgpcep/bgpclustering/020_singlepeer_prefixcount_100kroutes_nonreplicated_rib.robot
+integration/test/csit/suites/bgpcep/bgpclustering/030_singlepeer_prefixcount_1Mroutes_nonreplicated_rib.robot
+