Fix incorrect BGP entity name & type pairs
[integration/test.git] / csit / suites / bgpcep / bgpclustering / singlepeer_pc_shm_300kroutes_longevity.robot
1 *** Settings ***
2 Documentation     BGP performance of ingesting from 1 iBGP peer, data change counter is NOT used.
3 ...
4 ...               Copyright (c) 2015-2017 Cisco Systems, Inc. and others. All rights reserved.
5 ...
6 ...               This program and the accompanying materials are made available under the
7 ...               terms of the Eclipse Public License v1.0 which accompanies this distribution,
8 ...               and is available at http://www.eclipse.org/legal/epl-v10.html
9 ...
10 ...               This suite uses play.py as single iBGP peer which talks to
11 ...               single controller in three node cluster configuration.
12 ...               Test suite checks changes of the the example-ipv4-topology on all nodes.
13 ...               RIB is not examined.
14 ...
15 ...               singlepeer_pc_shm_300kroutes_longevity.robot:
16 ...               pc - prefix counting
17 ...               shm - shard monitoring (during the process of prefix advertizing)
18 Suite Setup       PrefixcountKeywords.Setup_Everything
19 Suite Teardown    PrefixcountKeywords.Teardown_Everything
20 Test Setup        SetupUtils.Setup_Test_With_Logging_And_Fast_Failing
21 Test Teardown     SetupUtils.Teardown_Test_Show_Bugs_And_Start_Fast_Failing_If_Test_Failed
22 Default Tags      critical
23 Library           SSHLibrary    timeout=10s
24 Resource          ${CURDIR}/../../../variables/Variables.robot
25 Resource          ${CURDIR}/../../../libraries/BGPSpeaker.robot
26 Resource          ${CURDIR}/../../../libraries/BGPcliKeywords.robot
27 Resource          ${CURDIR}/../../../libraries/KillPythonTool.robot
28 Resource          ${CURDIR}/../../../libraries/PrefixCounting.robot
29 Resource          ${CURDIR}/../../../libraries/SetupUtils.robot
30 Resource          ${CURDIR}/../../../libraries/ClusterManagement.robot
31 Resource          ${CURDIR}/../../../libraries/SSHKeywords.robot
32 Resource          ${CURDIR}/../../../libraries/TemplatedRequests.robot
33 Resource          ${CURDIR}/../../../libraries/WaitForFailure.robot
34 Resource          ${CURDIR}/PrefixcountKeywords.robot
35
36 *** Variables ***
37 ${COUNT}          300000
38 # TODO: change back to 24h when releng has more granular steps to kill VMs than days; now 23h=82800s
39 ${LONGEVITY_TEST_DURATION_IN_SECS}    82800
40
41 *** Test Cases ***
42 Configure_Prefixes_Longevity
43     [Documentation]    Configure bgp peer, repeat the test scenario for 24h and deconfigure it.
44     ${rib_owner}    ${rib_candidates}=    ClusterManagement.Get_Owner_And_Successors_For_device    example-bgp-rib    Bgpcep    1
45     PrefixcountKeywords.Set_Shard_Leaders_Location_And_Verify    ${rib_owner}
46     BuiltIn.Wait_Until_Keyword_Succeeds    ${INITIAL_RESTCONF_TIMEOUT}    1s    Check_For_Empty_Ipv4_Topology_On_All_Nodes
47     &{mapping}    BuiltIn.Create_Dictionary    DEVICE_NAME=${DEVICE_NAME}    BGP_NAME=${BGP_PEER_NAME}    IP=${TOOLS_SYSTEM_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}
48     ...    INITIATE=false    BGP_RIB=${RIB_INSTANCE}    PASSIVE_MODE=true    BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG}
49     Check_For_Empty_Ipv4_Topology_On_All_Nodes
50     ${session} =    ClusterManagement.Resolve_Http_Session_For_Member    member_index=${rib_owner}
51     BuiltIn.Set_Suite_Variable    ${config_session}    ${session}
52     # TODO: Either define BGP_VARIABLES_FOLDER in this file, or create a Resource with the definition and wrapping keywords
53     TemplatedRequests.Put_As_Json_Templated    ${BGP_VARIABLES_FOLDER}    mapping=${mapping}    session=${session}
54     WaitForFailure.Verify_Keyword_Does_Not_Fail_Within_Timeout    ${LONGEVITY_TEST_DURATION_IN_SECS}    1s    Test_Scenario    ${rib_owner}
55     TemplatedRequests.Delete_Templated    ${BGP_VARIABLES_FOLDER}    mapping=${mapping}    session=${session}
56
57 *** Keywords ***
58 Test_Scenario
59     [Arguments]    ${rib_owner_id}
60     [Documentation]    Connect bgp peer, advertize prefixes and disconnect. Check correct count of prefixes on odl.
61     PrefixcountKeywords.Start_Bgp_Peer_And_Verify_Connected    connection_retries=${3}    peerip=${ODL_SYSTEM_${rib_owner_id}_IP}
62     Wait_For_Stable_Talking_Ipv4_Topology_On_All_Nodes    excluded_count=0
63     Check_Talking_Ipv4_Topology_Count_On_All_Nodes
64     BGPSpeaker.Kill_BGP_Speaker
65     Wait_For_Stable_Talking_Ipv4_Topology_On_All_Nodes    excluded_count=${COUNT}
66     Check_For_Empty_Ipv4_Topology_On_All_Nodes
67
68 Check_For_Empty_Ipv4_Topology_On_All_Nodes
69     [Documentation]    Check the topology is empty on all 3 nodes.
70     PrefixCounting.Check_Ipv4_Topology_Is_Empty    session=${operational_1}    topology=${EXAMPLE_IPV4_TOPOLOGY}
71     PrefixCounting.Check_Ipv4_Topology_Is_Empty    session=${operational_2}    topology=${EXAMPLE_IPV4_TOPOLOGY}
72     PrefixCounting.Check_Ipv4_Topology_Is_Empty    session=${operational_3}    topology=${EXAMPLE_IPV4_TOPOLOGY}
73
74 Wait_For_Stable_Talking_Ipv4_Topology_On_All_Nodes
75     [Arguments]    ${excluded_count}
76     [Documentation]    Wait until ${EXAMPLE_IPV4_TOPOLOGY} becomes stable. This is done by checking stability of prefix count.
77     # TODO: Make the keyword accept member_index_list (or at least session_list) to monitor at once, so that robot can fail faster.
78     PrefixCounting.Wait_For_Ipv4_Topology_Prefixes_To_Become_Stable    timeout=${bgp_filling_timeout}    period=${CHECK_PERIOD}    repetitions=${REPETITIONS}    excluded_count=${excluded_count}    session=${operational_1}    topology=${EXAMPLE_IPV4_TOPOLOGY}
79     ...    shards_list=${SHARD_MONITOR_LIST}    shards_details=${init_shard_details}
80     PrefixCounting.Wait_For_Ipv4_Topology_Prefixes_To_Become_Stable    timeout=${bgp_filling_timeout}    period=${CHECK_PERIOD}    repetitions=${REPETITIONS}    excluded_count=${excluded_count}    session=${operational_2}    topology=${EXAMPLE_IPV4_TOPOLOGY}
81     ...    shards_list=${SHARD_MONITOR_LIST}    shards_details=${init_shard_details}
82     PrefixCounting.Wait_For_Ipv4_Topology_Prefixes_To_Become_Stable    timeout=${bgp_filling_timeout}    period=${CHECK_PERIOD}    repetitions=${REPETITIONS}    excluded_count=${excluded_count}    session=${operational_3}    topology=${EXAMPLE_IPV4_TOPOLOGY}
83     ...    shards_list=${SHARD_MONITOR_LIST}    shards_details=${init_shard_details}
84
85 Check_Talking_Ipv4_Topology_Count_On_All_Nodes
86     [Documentation]    Count the routes in ${EXAMPLE_IPV4_TOPOLOGY} on all nodes and fail if the count is not correct.
87     PrefixCounting.Check_Ipv4_Topology_Count    ${COUNT}    session=${operational_1}    topology=${EXAMPLE_IPV4_TOPOLOGY}
88     PrefixCounting.Check_Ipv4_Topology_Count    ${COUNT}    session=${operational_2}    topology=${EXAMPLE_IPV4_TOPOLOGY}
89     PrefixCounting.Check_Ipv4_Topology_Count    ${COUNT}    session=${operational_3}    topology=${EXAMPLE_IPV4_TOPOLOGY}