Update Robot Framework format - step 3
[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
19 Library             SSHLibrary    timeout=10s
20 Resource            ${CURDIR}/../../../variables/Variables.robot
21 Resource            ${CURDIR}/../../../libraries/BGPSpeaker.robot
22 Resource            ${CURDIR}/../../../libraries/BGPcliKeywords.robot
23 Resource            ${CURDIR}/../../../libraries/KillPythonTool.robot
24 Resource            ${CURDIR}/../../../libraries/PrefixCounting.robot
25 Resource            ${CURDIR}/../../../libraries/SetupUtils.robot
26 Resource            ${CURDIR}/../../../libraries/ClusterManagement.robot
27 Resource            ${CURDIR}/../../../libraries/SSHKeywords.robot
28 Resource            ${CURDIR}/../../../libraries/TemplatedRequests.robot
29 Resource            ${CURDIR}/../../../libraries/WaitForFailure.robot
30 Resource            ${CURDIR}/PrefixcountKeywords.robot
31
32 Suite Setup         PrefixcountKeywords.Setup_Everything
33 Suite Teardown      PrefixcountKeywords.Teardown_Everything
34 Test Setup          SetupUtils.Setup_Test_With_Logging_And_Fast_Failing
35 Test Teardown       SetupUtils.Teardown_Test_Show_Bugs_And_Start_Fast_Failing_If_Test_Failed
36
37 Default Tags        critical
38
39
40 *** Variables ***
41 ${COUNT}                                300000
42 # TODO: change back to 24h when releng has more granular steps to kill VMs than days; now 23h=82800s
43 ${LONGEVITY_TEST_DURATION_IN_SECS}      82800
44
45
46 *** Test Cases ***
47 Configure_Prefixes_Longevity
48     [Documentation]    Configure bgp peer, repeat the test scenario for 24h and deconfigure it.
49     ${rib_owner}    ${rib_candidates}=    ClusterManagement.Get_Owner_And_Successors_For_device
50     ...    example-bgp-rib
51     ...    Bgpcep
52     ...    1
53     PrefixcountKeywords.Set_Shard_Leaders_Location_And_Verify    ${rib_owner}
54     BuiltIn.Wait_Until_Keyword_Succeeds
55     ...    ${INITIAL_RESTCONF_TIMEOUT}
56     ...    1s
57     ...    Check_For_Empty_Ipv4_Topology_On_All_Nodes
58     &{mapping}=    BuiltIn.Create_Dictionary
59     ...    DEVICE_NAME=${DEVICE_NAME}
60     ...    BGP_NAME=${BGP_PEER_NAME}
61     ...    IP=${TOOLS_SYSTEM_IP}
62     ...    HOLDTIME=${HOLDTIME}
63     ...    PEER_PORT=${BGP_TOOL_PORT}
64     ...    INITIATE=false
65     ...    BGP_RIB=${RIB_INSTANCE}
66     ...    PASSIVE_MODE=true
67     ...    BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG}
68     Check_For_Empty_Ipv4_Topology_On_All_Nodes
69     ${session}=    ClusterManagement.Resolve_Http_Session_For_Member    member_index=${rib_owner}
70     BuiltIn.Set_Suite_Variable    ${config_session}    ${session}
71     # TODO: Either define BGP_VARIABLES_FOLDER in this file, or create a Resource with the definition and wrapping keywords
72     TemplatedRequests.Put_As_Json_Templated    ${BGP_VARIABLES_FOLDER}    mapping=${mapping}    session=${session}
73     WaitForFailure.Verify_Keyword_Does_Not_Fail_Within_Timeout
74     ...    ${LONGEVITY_TEST_DURATION_IN_SECS}
75     ...    1s
76     ...    Test_Scenario
77     ...    ${rib_owner}
78     TemplatedRequests.Delete_Templated    ${BGP_VARIABLES_FOLDER}    mapping=${mapping}    session=${session}
79
80
81 *** Keywords ***
82 Test_Scenario
83     [Documentation]    Connect bgp peer, advertize prefixes and disconnect. Check correct count of prefixes on odl.
84     [Arguments]    ${rib_owner_id}
85     PrefixcountKeywords.Start_Bgp_Peer_And_Verify_Connected
86     ...    connection_retries=${3}
87     ...    peerip=${ODL_SYSTEM_${rib_owner_id}_IP}
88     Wait_For_Stable_Talking_Ipv4_Topology_On_All_Nodes    excluded_count=0
89     Check_Talking_Ipv4_Topology_Count_On_All_Nodes
90     BGPSpeaker.Kill_BGP_Speaker
91     Wait_For_Stable_Talking_Ipv4_Topology_On_All_Nodes    excluded_count=${COUNT}
92     Check_For_Empty_Ipv4_Topology_On_All_Nodes
93
94 Check_For_Empty_Ipv4_Topology_On_All_Nodes
95     [Documentation]    Check the topology is empty on all 3 nodes.
96     PrefixCounting.Check_Ipv4_Topology_Is_Empty    session=${operational_1}    topology=${EXAMPLE_IPV4_TOPOLOGY}
97     PrefixCounting.Check_Ipv4_Topology_Is_Empty    session=${operational_2}    topology=${EXAMPLE_IPV4_TOPOLOGY}
98     PrefixCounting.Check_Ipv4_Topology_Is_Empty    session=${operational_3}    topology=${EXAMPLE_IPV4_TOPOLOGY}
99
100 Wait_For_Stable_Talking_Ipv4_Topology_On_All_Nodes
101     [Documentation]    Wait until ${EXAMPLE_IPV4_TOPOLOGY} becomes stable. This is done by checking stability of prefix count.
102     [Arguments]    ${excluded_count}
103     # TODO: Make the keyword accept member_index_list (or at least session_list) to monitor at once, so that robot can fail faster.
104     PrefixCounting.Wait_For_Ipv4_Topology_Prefixes_To_Become_Stable
105     ...    timeout=${bgp_filling_timeout}
106     ...    period=${CHECK_PERIOD}
107     ...    repetitions=${REPETITIONS}
108     ...    excluded_count=${excluded_count}
109     ...    session=${operational_1}
110     ...    topology=${EXAMPLE_IPV4_TOPOLOGY}
111     ...    shards_list=${SHARD_MONITOR_LIST}
112     ...    shards_details=${init_shard_details}
113     PrefixCounting.Wait_For_Ipv4_Topology_Prefixes_To_Become_Stable
114     ...    timeout=${bgp_filling_timeout}
115     ...    period=${CHECK_PERIOD}
116     ...    repetitions=${REPETITIONS}
117     ...    excluded_count=${excluded_count}
118     ...    session=${operational_2}
119     ...    topology=${EXAMPLE_IPV4_TOPOLOGY}
120     ...    shards_list=${SHARD_MONITOR_LIST}
121     ...    shards_details=${init_shard_details}
122     PrefixCounting.Wait_For_Ipv4_Topology_Prefixes_To_Become_Stable
123     ...    timeout=${bgp_filling_timeout}
124     ...    period=${CHECK_PERIOD}
125     ...    repetitions=${REPETITIONS}
126     ...    excluded_count=${excluded_count}
127     ...    session=${operational_3}
128     ...    topology=${EXAMPLE_IPV4_TOPOLOGY}
129     ...    shards_list=${SHARD_MONITOR_LIST}
130     ...    shards_details=${init_shard_details}
131
132 Check_Talking_Ipv4_Topology_Count_On_All_Nodes
133     [Documentation]    Count the routes in ${EXAMPLE_IPV4_TOPOLOGY} on all nodes and fail if the count is not correct.
134     PrefixCounting.Check_Ipv4_Topology_Count
135     ...    ${COUNT}
136     ...    session=${operational_1}
137     ...    topology=${EXAMPLE_IPV4_TOPOLOGY}
138     PrefixCounting.Check_Ipv4_Topology_Count
139     ...    ${COUNT}
140     ...    session=${operational_2}
141     ...    topology=${EXAMPLE_IPV4_TOPOLOGY}
142     PrefixCounting.Check_Ipv4_Topology_Count
143     ...    ${COUNT}
144     ...    session=${operational_3}
145     ...    topology=${EXAMPLE_IPV4_TOPOLOGY}