bgp prefixcount suite with nonreplicated bgp_rib
[integration/test.git] / csit / suites / bgpcep / bgpclustering / 010_singlepeer_prefixcount_1route.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-<dst_id> on all nodes.
13 ...               RIB is not examined.
14 ...               <dst-id> is recognized during the suite run, should be the Leader of default
15 ...               operational Shard, otherwise the scenario would fail due to
16 ...               https://bugs.opendaylight.org/show_bug.cgi?id=5536
17 Suite Setup       PrefixcountKeywords.Setup_Everything
18 Suite Teardown    PrefixcountKeywords.Teardown_Everything
19 Test Setup        SetupUtils.Setup_Test_With_Logging_And_Fast_Failing
20 Test Teardown     SetupUtils.Teardown_Test_Show_Bugs_And_Start_Fast_Failing_If_Test_Failed
21 Library           SSHLibrary    timeout=10s
22 Library           RequestsLibrary
23 Variables         ${CURDIR}/../../../variables/Variables.py
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 *** Variables ***
36 ${COUNT}          1
37
38 *** Test Cases ***
39 Get Example Bgp Rib Owner
40     [Documentation]    Find an odl node which is able to accept incomming connection. To this node netconf connector should be configured.
41     ${rib_owner}    ${rib_candidates}=    ClusterManagement.Get_Owner_And_Successors_For_device    example-bgp-rib    org.opendaylight.mdsal.ServiceEntityType    1
42     BuiltIn.Set_Suite_Variable    ${rib_owner}    ${rib_owner}
43     BuiltIn.Set_Suite_Variable    ${rib_owner_node_id}    ${ODL_SYSTEM_${rib_owner}_IP}
44     RequestsLibrary.Create_Session    ${CONFIG_SESSION}    http://${ODL_SYSTEM_${rib_owner}_IP}:${RESTCONFPORT}    auth=${AUTH}
45
46 Check_For_Empty_Ipv4_Topology_Before_Talking_1
47     [Documentation]    Wait for ${EXAMPLE_IPV4_TOPOLOGY} to come up and empty. Give large timeout for case when BGP boots slower than restconf.
48     [Tags]    critical
49     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
50     BuiltIn.Wait_Until_Keyword_Succeeds    ${INITIAL_RESTCONF_TIMEOUT}    1s    PrefixCounting.Check_Ipv4_Topology_Is_Empty    session=${CONFIGURATION_1}    topology=${EXAMPLE_IPV4_TOPOLOGY}
51
52 Check_For_Empty_Ipv4_Topology_Before_Talking_2
53     [Documentation]    Wait for ${EXAMPLE_IPV4_TOPOLOGY} to come up and empty. Give large timeout for case when BGP boots slower than restconf.
54     [Tags]    critical
55     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
56     BuiltIn.Wait_Until_Keyword_Succeeds    ${INITIAL_RESTCONF_TIMEOUT}    1s    PrefixCounting.Check_Ipv4_Topology_Is_Empty    session=${CONFIGURATION_2}    topology=${EXAMPLE_IPV4_TOPOLOGY}
57
58 Check_For_Empty_Ipv4_Topology_Before_Talking_3
59     [Documentation]    Wait for ${EXAMPLE_IPV4_TOPOLOGY} to come up and empty. Give large timeout for case when BGP boots slower than restconf.
60     [Tags]    critical
61     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
62     BuiltIn.Wait_Until_Keyword_Succeeds    ${INITIAL_RESTCONF_TIMEOUT}    1s    PrefixCounting.Check_Ipv4_Topology_Is_Empty    session=${CONFIGURATION_3}    topology=${EXAMPLE_IPV4_TOPOLOGY}
63
64 Configure_Netconf_Device
65     [Documentation]    Configures and verifies netconf device configuration. If configuration is not successful, it de-configures the device before the next attempt.
66     &{mapping}    BuiltIn.Create_Dictionary    DEVICE_NAME=${DEVICE_NAME}    DEVICE_PORT=1830    DEVICE_IP=${rib_owner_node_id}    DEVICE_USER=admin    DEVICE_PASSWORD=admin
67     # After the netconf device is configured, odl starts downloading schemas. If the downloading will not finish within akka timeout, more tries are needed, 3 is based on a user experience.
68     : FOR    ${index}    IN RANGE    0    3
69     \    ${status}    ${value}=    Run Keyword And Ignore Error    PrefixcountKeywords.Configure_Netconf_Device_And_Check_Mounted    ${mapping}
70     \    Exit For Loop If    '${status}' == 'PASS'
71     \    Run Keyword Unless    '${status}' == 'PASS'    TemplatedRequests.Delete_Templated    ${NETCONF_DEV_FOLDER}    mapping=${mapping}    session=${CONFIG_SESSION}
72     Run Keyword Unless    '${status}' == 'PASS'    Fail
73
74 Reconfigure_ODL_To_Accept_Connection
75     [Documentation]    Configure BGP peer module with initiate-connection set to false.
76     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
77     &{mapping}    BuiltIn.Create_Dictionary    DEVICE_NAME=${DEVICE_NAME}    BGP_NAME=${BGP_PEER_NAME}    IP=${TOOLS_SYSTEM_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}
78     ...    INITIATE=false    BGP_RIB=${RIB_INSTANCE}
79     TemplatedRequests.Put_As_Json_Templated    ${BGP_VARIABLES_FOLDER}    mapping=${mapping}    session=${CONFIG_SESSION}
80     [Teardown]    SetupUtils.Teardown_Test_Show_Bugs_If_Test_Failed
81
82 Start_Talking_BGP_Speaker
83     [Documentation]    Start Python speaker to connect to ODL.
84     PrefixcountKeywords.Start_Bgp_Peer_And_Verify_Connected    connection_retries=${3}
85
86 Wait_For_Stable_Talking_Ipv4_Topology_1
87     [Documentation]    Wait until ${EXAMPLE_IPV4_TOPOLOGY} becomes stable. This is done by checking stability of prefix count as seen from node 1.
88     PrefixCounting.Wait_For_Ipv4_Topology_Prefixes_To_Become_Stable    timeout=${bgp_filling_timeout}    period=${CHECK_PERIOD}    repetitions=${REPETITIONS}    excluded_count=0    session=${CONFIGURATION_1}    topology=${EXAMPLE_IPV4_TOPOLOGY}
89
90 Wait_For_Stable_Talking_Ipv4_Topology_2
91     [Documentation]    Wait until ${EXAMPLE_IPV4_TOPOLOGY} becomes stable. This is done by checking stability of prefix count as seen from node 2.
92     PrefixCounting.Wait_For_Ipv4_Topology_Prefixes_To_Become_Stable    timeout=${bgp_filling_timeout}    period=${CHECK_PERIOD}    repetitions=${REPETITIONS}    excluded_count=0    session=${CONFIGURATION_2}    topology=${EXAMPLE_IPV4_TOPOLOGY}
93
94 Wait_For_Stable_Talking_Ipv4_Topology_3
95     [Documentation]    Wait until ${EXAMPLE_IPV4_TOPOLOGY} becomes stable. This is done by checking stability of prefix count as seen from node 3.
96     PrefixCounting.Wait_For_Ipv4_Topology_Prefixes_To_Become_Stable    timeout=${bgp_filling_timeout}    period=${CHECK_PERIOD}    repetitions=${REPETITIONS}    excluded_count=0    session=${CONFIGURATION_3}    topology=${EXAMPLE_IPV4_TOPOLOGY}
97
98 Check_Talking_Ipv4_Topology_Count_1
99     [Documentation]    Count the routes in ${EXAMPLE_IPV4_TOPOLOGY} and fail if the count is not correct as seen from node 1.
100     [Tags]    critical
101     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
102     PrefixCounting.Check_Ipv4_Topology_Count    ${COUNT}    session=${CONFIGURATION_1}    topology=${EXAMPLE_IPV4_TOPOLOGY}
103
104 Check_Talking_Ipv4_Topology_Count_2
105     [Documentation]    Count the routes in ${EXAMPLE_IPV4_TOPOLOGY} and fail if the count is not correct as seen from node 2.
106     [Tags]    critical
107     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
108     PrefixCounting.Check_Ipv4_Topology_Count    ${COUNT}    session=${CONFIGURATION_2}    topology=${EXAMPLE_IPV4_TOPOLOGY}
109
110 Check_Talking_Ipv4_Topology_Count_3
111     [Documentation]    Count the routes in ${EXAMPLE_IPV4_TOPOLOGY} and fail if the count is not correct as seen from node 3.
112     [Tags]    critical
113     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
114     PrefixCounting.Check_Ipv4_Topology_Count    ${COUNT}    session=${CONFIGURATION_3}    topology=${EXAMPLE_IPV4_TOPOLOGY}
115
116 Kill_Talking_BGP_Speaker
117     [Documentation]    Abort the Python speaker. Also, attempt to stop failing fast.
118     [Tags]    critical
119     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
120     BGPSpeaker.Kill_BGP_Speaker
121     FailFast.Do_Not_Fail_Fast_From_Now_On
122
123 Wait_For_Stable_Ipv4_Topology_After_Listening_1
124     [Documentation]    Wait until ${EXAMPLE_IPV4_TOPOLOGY} becomes stable again as seen from node 1.
125     [Tags]    critical
126     PrefixCounting.Wait_For_Ipv4_Topology_Prefixes_To_Become_Stable    timeout=${bgp_filling_timeout}    period=${CHECK_PERIOD}    repetitions=${REPETITIONS}    excluded_count=${COUNT}    session=${CONFIGURATION_1}    topology=${EXAMPLE_IPV4_TOPOLOGY}
127
128 Wait_For_Stable_Ipv4_Topology_After_Listening_2
129     [Documentation]    Wait until ${EXAMPLE_IPV4_TOPOLOGY} becomes stable again as seen from node 2.
130     [Tags]    critical
131     PrefixCounting.Wait_For_Ipv4_Topology_Prefixes_To_Become_Stable    timeout=${bgp_filling_timeout}    period=${CHECK_PERIOD}    repetitions=${REPETITIONS}    excluded_count=${COUNT}    session=${CONFIGURATION_2}    topology=${EXAMPLE_IPV4_TOPOLOGY}
132
133 Wait_For_Stable_Ipv4_Topology_After_Listening_3
134     [Documentation]    Wait until ${EXAMPLE_IPV4_TOPOLOGY} becomes stable again as seen from node 3.
135     [Tags]    critical
136     PrefixCounting.Wait_For_Ipv4_Topology_Prefixes_To_Become_Stable    timeout=${bgp_filling_timeout}    period=${CHECK_PERIOD}    repetitions=${REPETITIONS}    excluded_count=${COUNT}    session=${CONFIGURATION_3}    topology=${EXAMPLE_IPV4_TOPOLOGY}
137
138 Check_For_Empty_Ipv4_Topology_After_Listening_1
139     [Documentation]    Example-ipv4-topology should be empty now as seen from node 1.
140     [Tags]    critical
141     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
142     PrefixCounting.Check_Ipv4_Topology_Is_Empty    session=${CONFIGURATION_1}    topology=${EXAMPLE_IPV4_TOPOLOGY}
143
144 Check_For_Empty_Ipv4_Topology_After_Listening_2
145     [Documentation]    Example-ipv4-topology should be empty now as seen from node 2.
146     [Tags]    critical
147     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
148     PrefixCounting.Check_Ipv4_Topology_Is_Empty    session=${CONFIGURATION_2}    topology=${EXAMPLE_IPV4_TOPOLOGY}
149
150 Check_For_Empty_Ipv4_Topology_After_Listening_3
151     [Documentation]    Example-ipv4-topology should be empty now as seen from node 3.
152     [Tags]    critical
153     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
154     PrefixCounting.Check_Ipv4_Topology_Is_Empty    session=${CONFIGURATION_3}    topology=${EXAMPLE_IPV4_TOPOLOGY}
155
156 Delete_Bgp_Peer_Configuration
157     [Documentation]    Revert the BGP configuration to the original state: without any configured peers.
158     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
159     &{mapping}    BuiltIn.Create_Dictionary    DEVICE_NAME=${DEVICE_NAME}    BGP_NAME=${BGP_PEER_NAME}    IP=${TOOLS_SYSTEM_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}
160     ...    INITIATE=false    BGP_RIB=${RIB_INSTANCE}
161     TemplatedRequests.Delete_Templated    ${BGP_VARIABLES_FOLDER}    mapping=${mapping}    session=${CONFIG_SESSION}
162
163 Delete_Netconf_Device_Configuration
164     [Documentation]    Revert the netconf configuration to the original stat
165     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
166     &{mapping}    BuiltIn.Create_Dictionary    DEVICE_NAME=${DEVICE_NAME}    DEVICE_PORT=1830    DEVICE_IP=${rib_owner_node_id}    DEVICE_USER=admin    DEVICE_PASSWORD=admin
167     TemplatedRequests.Delete_Templated    ${NETCONF_DEV_FOLDER}    mapping=${mapping}    session=${CONFIG_SESSION}