Migrate Get Requests invocations(libraries)
[integration/test.git] / csit / suites / bgpcep / bgpclustering / singlepeer_pc_shm_300kroutes_shards_remote.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_shards_remote:
16 ...                 pc - prefix counting
17 ...                 shm - shard monitoring (during the process of prefix advertizing)
18 ...                 shards_remote - default and topology shards are on a different node as rib owner
19 ...                 singleton instance
20
21 Library             SSHLibrary    timeout=10s
22 Library             RequestsLibrary
23 Resource            ${CURDIR}/../../../variables/Variables.robot
24 Resource            ${CURDIR}/../../../libraries/BGPSpeaker.robot
25 Resource            ${CURDIR}/../../../libraries/BGPcliKeywords.robot
26 Resource            ${CURDIR}/../../../libraries/FailFast.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}/PrefixcountKeywords.robot
34
35 Suite Setup         PrefixcountKeywords.Setup_Everything
36 Suite Teardown      PrefixcountKeywords.Teardown_Everything
37 Test Setup          SetupUtils.Setup_Test_With_Logging_And_Fast_Failing
38 Test Teardown       SetupUtils.Teardown_Test_Show_Bugs_And_Start_Fast_Failing_If_Test_Failed
39
40
41 *** Variables ***
42 ${COUNT}    300000
43
44
45 *** Test Cases ***
46 Get_Example_Bgp_Rib_Owner
47     [Documentation]    Find an odl node which is able to accept incomming connection. It is a node, which is the owner of bgp rib, as it is a singleton service.
48     ...    This node should be used for bgp peer to connect to.
49     ${rib_owner}    ${rib_candidates}    ClusterManagement.Get_Owner_And_Successors_For_device
50     ...    example-bgp-rib
51     ...    Bgpcep
52     ...    1
53     BuiltIn.Set_Suite_Variable    ${rib_owner}    ${rib_owner}
54     BuiltIn.Set_Suite_Variable    ${rib_candidates}    ${rib_candidates}
55     BuiltIn.Set_Suite_Variable    ${rib_owner_node_id}    ${ODL_SYSTEM_${rib_owner}_IP}
56     ${session}    ClusterManagement.Resolve_Http_Session_For_Member    ${rib_owner}
57     BuiltIn.Set_Suite_Variable    ${config_session}    ${session}
58
59 Move_Shard_Leaders_If_Needed
60     [Documentation]    Set shard leaders to expected location
61     PrefixcountKeywords.Set_Shard_Leaders_Location_And_Verify    ${rib_candidates}[0]
62
63 Check_For_Empty_Ipv4_Topology_Before_Talking_1
64     [Documentation]    Wait for ${EXAMPLE_IPV4_TOPOLOGY} to come up and empty. Give large timeout for case when BGP boots slower than restconf.
65     [Tags]    critical
66     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
67     BuiltIn.Wait_Until_Keyword_Succeeds
68     ...    ${INITIAL_RESTCONF_TIMEOUT}
69     ...    1s
70     ...    PrefixCounting.Check_Ipv4_Topology_Is_Empty
71     ...    session=${operational_1}
72     ...    topology=${EXAMPLE_IPV4_TOPOLOGY}
73
74 Check_For_Empty_Ipv4_Topology_Before_Talking_2
75     [Documentation]    Wait for ${EXAMPLE_IPV4_TOPOLOGY} to come up and empty. Give large timeout for case when BGP boots slower than restconf.
76     [Tags]    critical
77     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
78     BuiltIn.Wait_Until_Keyword_Succeeds
79     ...    ${INITIAL_RESTCONF_TIMEOUT}
80     ...    1s
81     ...    PrefixCounting.Check_Ipv4_Topology_Is_Empty
82     ...    session=${operational_2}
83     ...    topology=${EXAMPLE_IPV4_TOPOLOGY}
84
85 Check_For_Empty_Ipv4_Topology_Before_Talking_3
86     [Documentation]    Wait for ${EXAMPLE_IPV4_TOPOLOGY} to come up and empty. Give large timeout for case when BGP boots slower than restconf.
87     [Tags]    critical
88     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
89     BuiltIn.Wait_Until_Keyword_Succeeds
90     ...    ${INITIAL_RESTCONF_TIMEOUT}
91     ...    1s
92     ...    PrefixCounting.Check_Ipv4_Topology_Is_Empty
93     ...    session=${operational_3}
94     ...    topology=${EXAMPLE_IPV4_TOPOLOGY}
95
96 Reconfigure_ODL_To_Accept_Connection
97     [Documentation]    Configure BGP peer module with initiate-connection set to false.
98     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
99     &{mapping}    BuiltIn.Create_Dictionary
100     ...    DEVICE_NAME=${DEVICE_NAME}
101     ...    BGP_NAME=${BGP_PEER_NAME}
102     ...    IP=${TOOLS_SYSTEM_IP}
103     ...    HOLDTIME=${HOLDTIME}
104     ...    PEER_PORT=${BGP_TOOL_PORT}
105     ...    INITIATE=false
106     ...    BGP_RIB=${RIB_INSTANCE}
107     ...    PASSIVE_MODE=true
108     ...    BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG}
109     TemplatedRequests.Put_As_Json_Templated
110     ...    ${BGP_VARIABLES_FOLDER}
111     ...    mapping=${mapping}
112     ...    session=${config_session}
113     [Teardown]    SetupUtils.Teardown_Test_Show_Bugs_If_Test_Failed
114
115 Start_Talking_BGP_Speaker
116     [Documentation]    Start Python speaker to connect to ODL.
117     PrefixcountKeywords.Start_Bgp_Peer_And_Verify_Connected    connection_retries=${3}
118
119 Wait_For_Stable_Talking_Ipv4_Topology_1
120     [Documentation]    Wait until ${EXAMPLE_IPV4_TOPOLOGY} becomes stable. This is done by checking stability of prefix count as seen from node 1.
121     PrefixCounting.Wait_For_Ipv4_Topology_Prefixes_To_Become_Stable
122     ...    timeout=${bgp_filling_timeout}
123     ...    period=${CHECK_PERIOD}
124     ...    repetitions=${REPETITIONS}
125     ...    excluded_count=0
126     ...    session=${operational_1}
127     ...    topology=${EXAMPLE_IPV4_TOPOLOGY}
128     ...    shards_list=${SHARD_MONITOR_LIST}
129     ...    shards_details=${init_shard_details}
130
131 Wait_For_Stable_Talking_Ipv4_Topology_2
132     [Documentation]    Wait until ${EXAMPLE_IPV4_TOPOLOGY} becomes stable. This is done by checking stability of prefix count as seen from node 2.
133     PrefixCounting.Wait_For_Ipv4_Topology_Prefixes_To_Become_Stable
134     ...    timeout=${bgp_filling_timeout}
135     ...    period=${CHECK_PERIOD}
136     ...    repetitions=${REPETITIONS}
137     ...    excluded_count=0
138     ...    session=${operational_2}
139     ...    topology=${EXAMPLE_IPV4_TOPOLOGY}
140     ...    shards_list=${SHARD_MONITOR_LIST}
141     ...    shards_details=${init_shard_details}
142
143 Wait_For_Stable_Talking_Ipv4_Topology_3
144     [Documentation]    Wait until ${EXAMPLE_IPV4_TOPOLOGY} becomes stable. This is done by checking stability of prefix count as seen from node 3.
145     PrefixCounting.Wait_For_Ipv4_Topology_Prefixes_To_Become_Stable
146     ...    timeout=${bgp_filling_timeout}
147     ...    period=${CHECK_PERIOD}
148     ...    repetitions=${REPETITIONS}
149     ...    excluded_count=0
150     ...    session=${operational_3}
151     ...    topology=${EXAMPLE_IPV4_TOPOLOGY}
152     ...    shards_list=${SHARD_MONITOR_LIST}
153     ...    shards_details=${init_shard_details}
154
155 Check_Talking_Ipv4_Topology_Count_1
156     [Documentation]    Count the routes in ${EXAMPLE_IPV4_TOPOLOGY} and fail if the count is not correct as seen from node 1.
157     [Tags]    critical
158     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
159     PrefixCounting.Check_Ipv4_Topology_Count
160     ...    ${COUNT}
161     ...    session=${operational_1}
162     ...    topology=${EXAMPLE_IPV4_TOPOLOGY}
163
164 Check_Talking_Ipv4_Topology_Count_2
165     [Documentation]    Count the routes in ${EXAMPLE_IPV4_TOPOLOGY} and fail if the count is not correct as seen from node 2.
166     [Tags]    critical
167     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
168     PrefixCounting.Check_Ipv4_Topology_Count
169     ...    ${COUNT}
170     ...    session=${operational_2}
171     ...    topology=${EXAMPLE_IPV4_TOPOLOGY}
172
173 Check_Talking_Ipv4_Topology_Count_3
174     [Documentation]    Count the routes in ${EXAMPLE_IPV4_TOPOLOGY} and fail if the count is not correct as seen from node 3.
175     [Tags]    critical
176     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
177     PrefixCounting.Check_Ipv4_Topology_Count
178     ...    ${COUNT}
179     ...    session=${operational_3}
180     ...    topology=${EXAMPLE_IPV4_TOPOLOGY}
181
182 Kill_Talking_BGP_Speaker
183     [Documentation]    Abort the Python speaker. Also, attempt to stop failing fast.
184     [Tags]    critical
185     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
186     BGPSpeaker.Kill_BGP_Speaker
187     FailFast.Do_Not_Fail_Fast_From_Now_On
188
189 Wait_For_Stable_Ipv4_Topology_After_Listening_1
190     [Documentation]    Wait until ${EXAMPLE_IPV4_TOPOLOGY} becomes stable again as seen from node 1.
191     [Tags]    critical
192     PrefixCounting.Wait_For_Ipv4_Topology_Prefixes_To_Become_Stable
193     ...    timeout=${bgp_filling_timeout}
194     ...    period=${CHECK_PERIOD}
195     ...    repetitions=${REPETITIONS}
196     ...    excluded_count=${COUNT}
197     ...    session=${operational_1}
198     ...    topology=${EXAMPLE_IPV4_TOPOLOGY}
199     ...    shards_list=${SHARD_MONITOR_LIST}
200     ...    shards_details=${init_shard_details}
201
202 Wait_For_Stable_Ipv4_Topology_After_Listening_2
203     [Documentation]    Wait until ${EXAMPLE_IPV4_TOPOLOGY} becomes stable again as seen from node 2.
204     [Tags]    critical
205     PrefixCounting.Wait_For_Ipv4_Topology_Prefixes_To_Become_Stable
206     ...    timeout=${bgp_filling_timeout}
207     ...    period=${CHECK_PERIOD}
208     ...    repetitions=${REPETITIONS}
209     ...    excluded_count=${COUNT}
210     ...    session=${operational_2}
211     ...    topology=${EXAMPLE_IPV4_TOPOLOGY}
212     ...    shards_list=${SHARD_MONITOR_LIST}
213     ...    shards_details=${init_shard_details}
214
215 Wait_For_Stable_Ipv4_Topology_After_Listening_3
216     [Documentation]    Wait until ${EXAMPLE_IPV4_TOPOLOGY} becomes stable again as seen from node 3.
217     [Tags]    critical
218     PrefixCounting.Wait_For_Ipv4_Topology_Prefixes_To_Become_Stable
219     ...    timeout=${bgp_filling_timeout}
220     ...    period=${CHECK_PERIOD}
221     ...    repetitions=${REPETITIONS}
222     ...    excluded_count=${COUNT}
223     ...    session=${operational_3}
224     ...    topology=${EXAMPLE_IPV4_TOPOLOGY}
225     ...    shards_list=${SHARD_MONITOR_LIST}
226     ...    shards_details=${init_shard_details}
227
228 Check_For_Empty_Ipv4_Topology_After_Listening_1
229     [Documentation]    Example-ipv4-topology should be empty now as seen from node 1.
230     [Tags]    critical
231     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
232     PrefixCounting.Check_Ipv4_Topology_Is_Empty    session=${operational_1}    topology=${EXAMPLE_IPV4_TOPOLOGY}
233
234 Check_For_Empty_Ipv4_Topology_After_Listening_2
235     [Documentation]    Example-ipv4-topology should be empty now as seen from node 2.
236     [Tags]    critical
237     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
238     PrefixCounting.Check_Ipv4_Topology_Is_Empty    session=${operational_2}    topology=${EXAMPLE_IPV4_TOPOLOGY}
239
240 Check_For_Empty_Ipv4_Topology_After_Listening_3
241     [Documentation]    Example-ipv4-topology should be empty now as seen from node 3.
242     [Tags]    critical
243     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
244     PrefixCounting.Check_Ipv4_Topology_Is_Empty    session=${operational_3}    topology=${EXAMPLE_IPV4_TOPOLOGY}
245
246 Delete_Bgp_Peer_Configuration
247     [Documentation]    Revert the BGP configuration to the original state: without any configured peers.
248     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
249     &{mapping}    BuiltIn.Create_Dictionary
250     ...    DEVICE_NAME=${DEVICE_NAME}
251     ...    BGP_NAME=${BGP_PEER_NAME}
252     ...    IP=${TOOLS_SYSTEM_IP}
253     ...    HOLDTIME=${HOLDTIME}
254     ...    PEER_PORT=${BGP_TOOL_PORT}
255     ...    INITIATE=false
256     ...    BGP_RIB=${RIB_INSTANCE}
257     ...    BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG}
258     TemplatedRequests.Delete_Templated    ${BGP_VARIABLES_FOLDER}    mapping=${mapping}    session=${config_session}