Update Robot Framework format - step 3
[integration/test.git] / csit / suites / bgpcep / bgpingest / singlepeer_prefixcount.robot
index 3db541ab3ab93fef0f62f31fbac8753c08120dc3..751d805ffbefd6e6d706bdbc739e3a15c8f655ba 100644 (file)
@@ -1,76 +1,80 @@
 *** Settings ***
-Documentation     BGP performance of ingesting from 1 iBGP peer, data change counter is NOT used.
+Documentation       BGP performance of ingesting from 1 iBGP peer, data change counter is NOT used.
 ...
-...               Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
+...                 Copyright (c) 2015 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 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.
-...               The suite only looks at example-ipv4-topology, so RIB is not examined.
+...                 This suite uses play.py as single iBGP peer.
+...                 The suite only looks at example-ipv4-topology, so RIB is not examined.
 ...
-...               The suite consists of two halves, differing on which side initiates BGP connection.
-...               State of "work is being done" is detected by increasing value of prefixes in topology.
-...               The time for Wait_For_Stable_* cases to finish is the main performance metric.
-...               After waiting for stability is done, full check on number of prefixes present is performed.
+...                 The suite consists of two halves, differing on which side initiates BGP connection.
+...                 State of "work is being done" is detected by increasing value of prefixes in topology.
+...                 The time for Wait_For_Stable_* cases to finish is the main performance metric.
+...                 After waiting for stability is done, full check on number of prefixes present is performed.
 ...
-...               Brief description how to configure BGP peer can be found here:
-...               https://wiki.opendaylight.org/view/BGP_LS_PCEP:User_Guide#BGP_Peer
-...               http://docs.opendaylight.org/en/stable-boron/user-guide/bgp-user-guide.html#bgp-peering
+...                 Brief description how to configure BGP peer can be found here:
+...                 https://wiki.opendaylight.org/view/BGP_LS_PCEP:User_Guide#BGP_Peer
+...                 http://docs.opendaylight.org/en/stable-boron/user-guide/bgp-user-guide.html#bgp-peering
 ...
-...               TODO: Currently, if a bug causes prefix count to remain at zero,
-...               affected test cases will wait for max time. Reconsider.
-...               If zero is allowed as stable, higher period or repetitions would be required.
+...                 TODO: Currently, if a bug causes prefix count to remain at zero,
+...                 affected test cases will wait for max time. Reconsider.
+...                 If zero is allowed as stable, higher period or repetitions would be required.
 ...
-...               The prefix counting is quite heavyweight and may induce large variation in time.
-...               Try the other version of the suite (singlepeer_changecount.robot) to get better precision.
-Suite Setup       Setup_Everything
-Suite Teardown    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
-Resource          ../../../libraries/BGPSpeaker.robot
-Resource          ../../../libraries/FailFast.robot
-Resource          ../../../libraries/KillPythonTool.robot
-Resource          ../../../libraries/PrefixCounting.robot
-Resource          ../../../libraries/SetupUtils.robot
-Resource          ../../../libraries/SSHKeywords.robot
-Resource          ../../../libraries/TemplatedRequests.robot
-Resource          ../../../libraries/Utils.robot
-Resource          ../../../variables/Variables.robot
+...                 The prefix counting is quite heavyweight and may induce large variation in time.
+...                 Try the other version of the suite (singlepeer_changecount.robot) to get better precision.
+
+Library             SSHLibrary    timeout=10s
+Library             RequestsLibrary
+Resource            ../../../libraries/BGPSpeaker.robot
+Resource            ../../../libraries/FailFast.robot
+Resource            ../../../libraries/KillPythonTool.robot
+Resource            ../../../libraries/PrefixCounting.robot
+Resource            ../../../libraries/SetupUtils.robot
+Resource            ../../../libraries/SSHKeywords.robot
+Resource            ../../../libraries/TemplatedRequests.robot
+Resource            ../../../libraries/Utils.robot
+Resource            ../../../variables/Variables.robot
+
+Suite Setup         Setup_Everything
+Suite Teardown      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
+
 
 *** Variables ***
-${BGP_TOOL_LOG_LEVEL}    info
-${BGP_VARIABLES_FOLDER}    ${CURDIR}/../../../variables/bgpuser/
-${CHECK_PERIOD}    60
-${CHECK_PERIOD_PREFIX_COUNT}    ${CHECK_PERIOD}
-${CHECK_PERIOD_PREFIX_COUNT_SINGLE}    ${CHECK_PERIOD_PREFIX_COUNT}
-${COUNT}          600000
-${COUNT_PREFIX_COUNT}    ${COUNT}
-${COUNT_PREFIX_COUNT_SINGLE}    ${COUNT_PREFIX_COUNT}
-${HOLDTIME}       180
-${HOLDTIME_PREFIX_COUNT}    ${HOLDTIME}
-${HOLDTIME_PREFIX_COUNT_SINGLE}    ${HOLDTIME_PREFIX_COUNT}
-${INSERT}         1
-${PREFILL}        0
-${REPETITIONS}    1
-${REPETITIONS_PREFIX_COUNT}    ${REPETITIONS}
-${REPETITIONS_PREFIX_COUNT_SINGLE}    ${REPETITIONS_PREFIX_COUNT}
-${RESULTS_FILE_NAME}    bgp.csv
-${TEST_DURATION_MULTIPLIER}    1
-${TEST_DURATION_MULTIPLIER_PREFIX_COUNT}    ${TEST_DURATION_MULTIPLIER}
-${TEST_DURATION_MULTIPLIER_PREFIX_COUNT_SINGLE}    ${TEST_DURATION_MULTIPLIER_PREFIX_COUNT}
-${UPDATE}         single
-${WITHDRAW}       0
-${RIB_INSTANCE}    example-bgp-rib
-${PROTOCOL_OPENCONFIG}    ${RIB_INSTANCE}
-${DEVICE_NAME}    controller-config
-${BGP_PEER_NAME}    example-bgp-peer
+${BGP_TOOL_LOG_LEVEL}                               info
+${BGP_VARIABLES_FOLDER}                             ${CURDIR}/../../../variables/bgpuser/
+${CHECK_PERIOD}                                     60
+${CHECK_PERIOD_PREFIX_COUNT}                        ${CHECK_PERIOD}
+${CHECK_PERIOD_PREFIX_COUNT_SINGLE}                 ${CHECK_PERIOD_PREFIX_COUNT}
+${COUNT}                                            600000
+${COUNT_PREFIX_COUNT}                               ${COUNT}
+${COUNT_PREFIX_COUNT_SINGLE}                        ${COUNT_PREFIX_COUNT}
+${HOLDTIME}                                         180
+${HOLDTIME_PREFIX_COUNT}                            ${HOLDTIME}
+${HOLDTIME_PREFIX_COUNT_SINGLE}                     ${HOLDTIME_PREFIX_COUNT}
+${INSERT}                                           1
+${PREFILL}                                          0
+${REPETITIONS}                                      1
+${REPETITIONS_PREFIX_COUNT}                         ${REPETITIONS}
+${REPETITIONS_PREFIX_COUNT_SINGLE}                  ${REPETITIONS_PREFIX_COUNT}
+${RESULTS_FILE_NAME}                                bgp.csv
+${TEST_DURATION_MULTIPLIER}                         1
+${TEST_DURATION_MULTIPLIER_PREFIX_COUNT}            ${TEST_DURATION_MULTIPLIER}
+${TEST_DURATION_MULTIPLIER_PREFIX_COUNT_SINGLE}     ${TEST_DURATION_MULTIPLIER_PREFIX_COUNT}
+${UPDATE}                                           single
+${WITHDRAW}                                         0
+${RIB_INSTANCE}                                     example-bgp-rib
+${PROTOCOL_OPENCONFIG}                              ${RIB_INSTANCE}
+${DEVICE_NAME}                                      controller-config
+${BGP_PEER_NAME}                                    example-bgp-peer
 # TODO: Option names can be better.
 
+
 *** Test Cases ***
 Check_For_Empty_Ipv4_Topology_Before_Talking
     [Documentation]    Wait for example-ipv4-topology to come up and empty. Give large timeout for case when BGP boots slower than restconf.
@@ -80,18 +84,32 @@ Check_For_Empty_Ipv4_Topology_Before_Talking
 
 Reconfigure_ODL_To_Accept_Connection
     [Documentation]    Configure BGP peer module with initiate-connection set to false.
-    &{mapping}    Create Dictionary    DEVICE_NAME=${DEVICE_NAME}    BGP_NAME=${BGP_PEER_NAME}    IP=${TOOLS_SYSTEM_IP}    HOLDTIME=${HOLDTIME_PREFIX_COUNT_SINGLE}    PEER_PORT=${BGP_TOOL_PORT}
-    ...    INITIATE=false    BGP_RIB=${RIB_INSTANCE}    PASSIVE_MODE=true    BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG}    RIB_INSTANCE_NAME=${RIB_INSTANCE}
+    &{mapping}    Create Dictionary
+    ...    DEVICE_NAME=${DEVICE_NAME}
+    ...    BGP_NAME=${BGP_PEER_NAME}
+    ...    IP=${TOOLS_SYSTEM_IP}
+    ...    HOLDTIME=${HOLDTIME_PREFIX_COUNT_SINGLE}
+    ...    PEER_PORT=${BGP_TOOL_PORT}
+    ...    INITIATE=false
+    ...    BGP_RIB=${RIB_INSTANCE}
+    ...    PASSIVE_MODE=true
+    ...    BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG}
+    ...    RIB_INSTANCE_NAME=${RIB_INSTANCE}
     TemplatedRequests.Put_As_Xml_Templated    ${BGP_VARIABLES_FOLDER}${/}bgp_peer    mapping=${mapping}
 
 Start_Talking_BGP_Speaker
     [Documentation]    Start Python speaker to connect to ODL.
     # Myport value is needed for checking whether connection at precise port was established.
-    BGPSpeaker.Start_BGP_Speaker    --amount ${COUNT_PREFIX_COUNT_SINGLE} --myip=${TOOLS_SYSTEM_IP} --myport=${BGP_TOOL_PORT} --peerip=${ODL_SYSTEM_IP} --peerport=${ODL_BGP_PORT} --insert=${INSERT} --withdraw=${WITHDRAW} --prefill ${PREFILL} --update ${UPDATE} --${BGP_TOOL_LOG_LEVEL} --results ${RESULTS_FILE_NAME}
+    BGPSpeaker.Start_BGP_Speaker
+    ...    --amount ${COUNT_PREFIX_COUNT_SINGLE} --myip=${TOOLS_SYSTEM_IP} --myport=${BGP_TOOL_PORT} --peerip=${ODL_SYSTEM_IP} --peerport=${ODL_BGP_PORT} --insert=${INSERT} --withdraw=${WITHDRAW} --prefill ${PREFILL} --update ${UPDATE} --${BGP_TOOL_LOG_LEVEL} --results ${RESULTS_FILE_NAME}
 
 Wait_For_Stable_Talking_Ipv4_Topology
     [Documentation]    Wait until example-ipv4-topology becomes stable. This is done by checking stability of prefix count.
-    PrefixCounting.Wait_For_Ipv4_Topology_Prefixes_To_Become_Stable    timeout=${bgp_filling_timeout}    period=${CHECK_PERIOD_PREFIX_COUNT_SINGLE}    repetitions=${REPETITIONS_PREFIX_COUNT_SINGLE}    excluded_count=0
+    PrefixCounting.Wait_For_Ipv4_Topology_Prefixes_To_Become_Stable
+    ...    timeout=${bgp_filling_timeout}
+    ...    period=${CHECK_PERIOD_PREFIX_COUNT_SINGLE}
+    ...    repetitions=${REPETITIONS_PREFIX_COUNT_SINGLE}
+    ...    excluded_count=0
 
 Check_Talking_Ipv4_Topology_Count
     [Documentation]    Count the routes in example-ipv4-topology and fail if the count is not correct.
@@ -122,7 +140,11 @@ Wait_For_Stable_Ipv4_Topology_After_Talking
     # TODO: Is is possible to have failed at Check_Talking_Ipv4_Topology_Count and still have initial period of constant count?
     # FIXME: If yes, do count here to get the initial value and use it (if nonzero).
     # TODO: If yes, decide whether access to the FailFast state should have keyword or just variable name.
-    PrefixCounting.Wait_For_Ipv4_Topology_Prefixes_To_Become_Stable    timeout=${bgp_filling_timeout}    period=${CHECK_PERIOD_PREFIX_COUNT_SINGLE}    repetitions=${REPETITIONS_PREFIX_COUNT_SINGLE}    excluded_count=${COUNT_PREFIX_COUNT_SINGLE}
+    PrefixCounting.Wait_For_Ipv4_Topology_Prefixes_To_Become_Stable
+    ...    timeout=${bgp_filling_timeout}
+    ...    period=${CHECK_PERIOD_PREFIX_COUNT_SINGLE}
+    ...    repetitions=${REPETITIONS_PREFIX_COUNT_SINGLE}
+    ...    excluded_count=${COUNT_PREFIX_COUNT_SINGLE}
 
 Check_For_Empty_Ipv4_Topology_After_Talking
     [Documentation]    Example-ipv4-topology should be empty now.
@@ -132,17 +154,31 @@ Check_For_Empty_Ipv4_Topology_After_Talking
 
 Start_Listening_BGP_Speaker
     [Documentation]    Start Python speaker in listening mode.
-    BGPSpeaker.Start_BGP_Speaker    --amount ${COUNT_PREFIX_COUNT_SINGLE} --listen --myip=${TOOLS_SYSTEM_IP} --myport=${BGP_TOOL_PORT} --peerip=${ODL_SYSTEM_IP} --insert=${INSERT} --withdraw=${WITHDRAW} --prefill ${PREFILL} --update ${UPDATE} --${BGP_TOOL_LOG_LEVEL} --results ${RESULTS_FILE_NAME}
+    BGPSpeaker.Start_BGP_Speaker
+    ...    --amount ${COUNT_PREFIX_COUNT_SINGLE} --listen --myip=${TOOLS_SYSTEM_IP} --myport=${BGP_TOOL_PORT} --peerip=${ODL_SYSTEM_IP} --insert=${INSERT} --withdraw=${WITHDRAW} --prefill ${PREFILL} --update ${UPDATE} --${BGP_TOOL_LOG_LEVEL} --results ${RESULTS_FILE_NAME}
 
 Reconfigure_ODL_To_Initiate_Connection
     [Documentation]    Replace BGP peer config module, now with initiate-connection set to true.
-    &{mapping}    Create Dictionary    DEVICE_NAME=${DEVICE_NAME}    BGP_NAME=${BGP_PEER_NAME}    IP=${TOOLS_SYSTEM_IP}    HOLDTIME=${HOLDTIME_PREFIX_COUNT_SINGLE}    PEER_PORT=${BGP_TOOL_PORT}
-    ...    INITIATE=true    BGP_RIB=${RIB_INSTANCE}    PASSIVE_MODE=false    BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG}    RIB_INSTANCE_NAME=${RIB_INSTANCE}
+    &{mapping}    Create Dictionary
+    ...    DEVICE_NAME=${DEVICE_NAME}
+    ...    BGP_NAME=${BGP_PEER_NAME}
+    ...    IP=${TOOLS_SYSTEM_IP}
+    ...    HOLDTIME=${HOLDTIME_PREFIX_COUNT_SINGLE}
+    ...    PEER_PORT=${BGP_TOOL_PORT}
+    ...    INITIATE=true
+    ...    BGP_RIB=${RIB_INSTANCE}
+    ...    PASSIVE_MODE=false
+    ...    BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG}
+    ...    RIB_INSTANCE_NAME=${RIB_INSTANCE}
     TemplatedRequests.Put_As_Xml_Templated    ${BGP_VARIABLES_FOLDER}${/}bgp_peer    mapping=${mapping}
 
 Wait_For_Stable_Listening_Ipv4_Topology
     [Documentation]    Wait until example-ipv4-topology becomes stable.
-    PrefixCounting.Wait_For_Ipv4_Topology_Prefixes_To_Become_Stable    timeout=${bgp_filling_timeout}    period=${CHECK_PERIOD_PREFIX_COUNT_SINGLE}    repetitions=${REPETITIONS_PREFIX_COUNT_SINGLE}    excluded_count=0
+    PrefixCounting.Wait_For_Ipv4_Topology_Prefixes_To_Become_Stable
+    ...    timeout=${bgp_filling_timeout}
+    ...    period=${CHECK_PERIOD_PREFIX_COUNT_SINGLE}
+    ...    repetitions=${REPETITIONS_PREFIX_COUNT_SINGLE}
+    ...    excluded_count=0
 
 Check_Listening_Ipv4_Topology_Count
     [Documentation]    Count the routes in example-ipv4-topology and fail if the count is not correct.
@@ -165,12 +201,18 @@ Store_Results_For_Listening_BGP_Speaker
     Store_File_To_Workspace    totals-${RESULTS_FILE_NAME}    totals-${RESULTS_FILE_NAME}
     Store_File_To_Workspace    performance-${RESULTS_FILE_NAME}    performance-${RESULTS_FILE_NAME}
     Store_File_To_Workspace    totals-${RESULTS_FILE_NAME}    prefixcount-listening-totals-${RESULTS_FILE_NAME}
-    Store_File_To_Workspace    performance-${RESULTS_FILE_NAME}    prefixcount-listening-performance-${RESULTS_FILE_NAME}
+    Store_File_To_Workspace
+    ...    performance-${RESULTS_FILE_NAME}
+    ...    prefixcount-listening-performance-${RESULTS_FILE_NAME}
 
 Wait_For_Stable_Ipv4_Topology_After_Listening
     [Documentation]    Wait until example-ipv4-topology becomes stable again.
     [Tags]    critical
-    PrefixCounting.Wait_For_Ipv4_Topology_Prefixes_To_Become_Stable    timeout=${bgp_filling_timeout}    period=${CHECK_PERIOD_PREFIX_COUNT_SINGLE}    repetitions=${REPETITIONS_PREFIX_COUNT_SINGLE}    excluded_count=${COUNT_PREFIX_COUNT_SINGLE}
+    PrefixCounting.Wait_For_Ipv4_Topology_Prefixes_To_Become_Stable
+    ...    timeout=${bgp_filling_timeout}
+    ...    period=${CHECK_PERIOD_PREFIX_COUNT_SINGLE}
+    ...    repetitions=${REPETITIONS_PREFIX_COUNT_SINGLE}
+    ...    excluded_count=${COUNT_PREFIX_COUNT_SINGLE}
 
 Check_For_Empty_Ipv4_Topology_After_Listening
     [Documentation]    Example-ipv4-topology should be empty now.
@@ -181,9 +223,14 @@ Check_For_Empty_Ipv4_Topology_After_Listening
 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}    BuiltIn.Create_Dictionary    DEVICE_NAME=${DEVICE_NAME}    BGP_NAME=${BGP_PEER_NAME}    IP=${TOOLS_SYSTEM_IP}    BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG}
+    &{mapping}    BuiltIn.Create_Dictionary
+    ...    DEVICE_NAME=${DEVICE_NAME}
+    ...    BGP_NAME=${BGP_PEER_NAME}
+    ...    IP=${TOOLS_SYSTEM_IP}
+    ...    BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG}
     TemplatedRequests.Delete_Templated    ${BGP_VARIABLES_FOLDER}${/}bgp_peer    mapping=${mapping}
 
+
 *** Keywords ***
 Setup_Everything
     [Documentation]    Setup imported resources, SSH-login to tools system,
@@ -191,7 +238,12 @@ Setup_Everything
     SetupUtils.Setup_Utils_For_Setup_And_Teardown
     TemplatedRequests.Create_Default_Session
     PrefixCounting.PC_Setup
-    RequestsLibrary.Create_Session    operational    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    timeout=125    max_retries=0
+    RequestsLibrary.Create_Session
+    ...    operational
+    ...    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}
+    ...    auth=${AUTH}
+    ...    timeout=125
+    ...    max_retries=0
     # 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.
@@ -203,7 +255,8 @@ Setup_Everything
     SSHLibrary.Put_File    ${CURDIR}/../../../../tools/fastbgp/play.py
     # Calculate the timeout value based on how many routes are going to be pushed
     # TODO: Replace 20 with some formula from period and repetitions.
-    ${timeout} =    BuiltIn.Evaluate    ${TEST_DURATION_MULTIPLIER_PREFIX_COUNT_SINGLE} * (${COUNT_PREFIX_COUNT_SINGLE} * 9.0 / 10000 + 20)
+    ${timeout}    BuiltIn.Evaluate
+    ...    ${TEST_DURATION_MULTIPLIER_PREFIX_COUNT_SINGLE} * (${COUNT_PREFIX_COUNT_SINGLE} * 9.0 / 10000 + 20)
     Builtin.Set_Suite_Variable    ${bgp_filling_timeout}    ${timeout}
 
 Teardown_Everything
@@ -215,9 +268,9 @@ Teardown_Everything
     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}
+    [Arguments]    ${src_file_name}    ${dst_file_name}
+    ${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}