Migrate Get Requests invocations(libraries)
[integration/test.git] / csit / suites / bgpcep / bgpclustering / 030_singlepeer_prefixcount_1Mroutes_nonreplicated_rib.robot
1 *** Settings ***
2 Documentation       BGP performance of ingesting from 1 iBGP peer, data change counter is NOT used.
3 ...
4 ...                 Copyright (c) 2015-2016 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 default operational
13 ...                 shard leader only. Less stress for cluster is expected as if followers were
14 ...                 triggered for that.
15
16 Library             SSHLibrary    timeout=10s
17 Library             RequestsLibrary
18 Resource            ../../../libraries/BGPcliKeywords.robot
19 Resource            ../../../libraries/BGPSpeaker.robot
20 Resource            ../../../libraries/ClusterManagement.robot
21 Resource            ../../../libraries/FailFast.robot
22 Resource            ../../../libraries/KillPythonTool.robot
23 Resource            ../../../libraries/PrefixCounting.robot
24 Resource            ../../../libraries/SetupUtils.robot
25 Resource            ../../../libraries/SSHKeywords.robot
26 Resource            ../../../libraries/TemplatedRequests.robot
27 Resource            ../../../variables/Variables.robot
28 Resource            PrefixcountKeywords.robot
29
30 Suite Setup         PrefixcountKeywords.Setup_Everything
31 Suite Teardown      PrefixcountKeywords.Teardown_Everything
32 Test Setup          SetupUtils.Setup_Test_With_Logging_And_Fast_Failing
33 Test Teardown       SetupUtils.Teardown_Test_Show_Bugs_And_Start_Fast_Failing_If_Test_Failed
34
35
36 *** Variables ***
37 ${COUNT}    1000000
38
39
40 *** Test Cases ***
41 Get Example Bgp Rib Owner
42     [Documentation]    Find an odl node which is able to accept incomming connection.
43     ${rib_owner}    ${rib_candidates}=    ClusterManagement.Get_Owner_And_Successors_For_device
44     ...    example-bgp-rib
45     ...    Bgpcep
46     ...    1
47     BuiltIn.Set_Suite_Variable    ${rib_owner}    ${rib_owner}
48     BuiltIn.Set_Suite_Variable    ${rib_owner_node_id}    ${ODL_SYSTEM_${rib_owner}_IP}
49     ${session}=    ClusterManagement.Resolve_Http_Session_For_Member    ${rib_owner}
50     BuiltIn.Set_Suite_Variable    ${config_session}    ${session}
51
52 Get Topology Operational Leader
53     [Documentation]    Gets the operational topology shard leader
54     ${leader}    ${followers}=    ClusterManagement.Get_Leader_And_Followers_For_Shard
55     ...    shard_name=topology
56     ...    shard_type=operational
57     ${session}=    ClusterManagement.Resolve_Http_Session_For_Member    ${leader}
58     BuiltIn.Set_Suite_Variable    ${topo_lead_ses}    ${session}
59
60 Check_For_Empty_Ipv4_Topology_Before_Talking
61     [Documentation]    Wait for ${EXAMPLE_IPV4_TOPOLOGY} to come up and empty. Give large timeout for case when BGP boots slower than restconf.
62     [Tags]    critical
63     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
64     BuiltIn.Wait_Until_Keyword_Succeeds
65     ...    ${INITIAL_RESTCONF_TIMEOUT}
66     ...    1s
67     ...    PrefixCounting.Check_Ipv4_Topology_Is_Empty
68     ...    session=${topo_lead_ses}
69     ...    topology=${EXAMPLE_IPV4_TOPOLOGY}
70
71 Reconfigure_ODL_To_Accept_Connection
72     [Documentation]    Configure BGP peer module in passive mode (not initiating connection)
73     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
74     &{mapping}=    Create Dictionary
75     ...    BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG}
76     ...    IP=${TOOLS_SYSTEM_IP}
77     ...    HOLDTIME=${HOLDTIME}
78     ...    PEER_PORT=${BGP_TOOL_PORT}
79     ...    PASSIVE_MODE=true
80     TemplatedRequests.Put_As_Xml_Templated    ${BGP_PEER_FOLDER}    mapping=${mapping}    session=${config_session}
81     [Teardown]    SetupUtils.Teardown_Test_Show_Bugs_If_Test_Failed
82
83 Start_Talking_BGP_Speaker
84     [Documentation]    Start Python speaker to connect to ODL.
85     PrefixcountKeywords.Start_Bgp_Peer_And_Verify_Connected    connection_retries=${3}
86
87 Wait_For_Stable_Talking_Ipv4_Topology
88     [Documentation]    Wait until ${EXAMPLE_IPV4_TOPOLOGY} becomes stable. This is done by checking stability of prefix count as seen from node 1.
89     PrefixCounting.Wait_For_Ipv4_Topology_Prefixes_To_Become_Stable
90     ...    timeout=${bgp_filling_timeout}
91     ...    period=${CHECK_PERIOD}
92     ...    repetitions=${REPETITIONS}
93     ...    excluded_count=0
94     ...    session=${topo_lead_ses}
95     ...    topology=${EXAMPLE_IPV4_TOPOLOGY}
96
97 Check_Talking_Ipv4_Topology_Count
98     [Documentation]    Count the routes in ${EXAMPLE_IPV4_TOPOLOGY} and fail if the count is not correct as seen from node 1.
99     [Tags]    critical
100     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
101     PrefixCounting.Check_Ipv4_Topology_Count
102     ...    ${COUNT}
103     ...    session=${topo_lead_ses}
104     ...    topology=${EXAMPLE_IPV4_TOPOLOGY}
105
106 Kill_Talking_BGP_Speaker
107     [Documentation]    Abort the Python speaker. Also, attempt to stop failing fast.
108     [Tags]    critical
109     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
110     BGPSpeaker.Kill_BGP_Speaker
111     FailFast.Do_Not_Fail_Fast_From_Now_On
112
113 Wait_For_Stable_Ipv4_Topology_After_Listening
114     [Documentation]    Wait until ${EXAMPLE_IPV4_TOPOLOGY} becomes stable again as seen from node 1.
115     [Tags]    critical
116     PrefixCounting.Wait_For_Ipv4_Topology_Prefixes_To_Become_Stable
117     ...    timeout=${bgp_filling_timeout}
118     ...    period=${CHECK_PERIOD}
119     ...    repetitions=${REPETITIONS}
120     ...    excluded_count=${COUNT}
121     ...    session=${topo_lead_ses}
122     ...    topology=${EXAMPLE_IPV4_TOPOLOGY}
123
124 Check_For_Empty_Ipv4_Topology_After_Listening
125     [Documentation]    Example-ipv4-topology should be empty now as seen from node 1.
126     [Tags]    critical
127     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
128     PrefixCounting.Check_Ipv4_Topology_Is_Empty    session=${topo_lead_ses}    topology=${EXAMPLE_IPV4_TOPOLOGY}
129
130 Delete_Bgp_Peer_Configuration
131     [Documentation]    Revert the BGP configuration to the original state: without any configured peers
132     &{mapping}=    Create Dictionary    BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG}    IP=${TOOLS_SYSTEM_IP}
133     TemplatedRequests.Delete_Templated    ${BGP_PEER_FOLDER}    mapping=${mapping}    session=${config_session}