32375595af76846e016c93389f65414fd44e226b
[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}/../../../libraries/CompareStream.robot
34 Resource          ${CURDIR}/PrefixcountKeywords.robot
35
36 *** Variables ***
37 ${COUNT}          1
38
39 *** Test Cases ***
40 Get Example Bgp Rib Owner
41     [Documentation]    Find an odl node which is able to accept incomming connection. To this node netconf connector should be configured.
42     ${rib_owner}    ${rib_candidates}=    ClusterManagement.Get_Owner_And_Successors_For_device    example-bgp-rib    org.opendaylight.mdsal.ServiceEntityType    1
43     BuiltIn.Set_Suite_Variable    ${rib_owner}    ${rib_owner}
44     BuiltIn.Set_Suite_Variable    ${rib_owner_node_id}    ${ODL_SYSTEM_${rib_owner}_IP}
45     ${session} =    ClusterManagement.Resolve_Http_Session_For_Member    ${rib_owner}
46     BuiltIn.Set_Suite_Variable    ${config_session}    ${session}
47
48 Check_For_Empty_Ipv4_Topology_Before_Talking_1
49     [Documentation]    Wait for ${EXAMPLE_IPV4_TOPOLOGY} to come up and empty. Give large timeout for case when BGP boots slower than restconf.
50     [Tags]    critical
51     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
52     BuiltIn.Wait_Until_Keyword_Succeeds    ${INITIAL_RESTCONF_TIMEOUT}    1s    PrefixCounting.Check_Ipv4_Topology_Is_Empty    session=${operational_1}    topology=${EXAMPLE_IPV4_TOPOLOGY}
53
54 Check_For_Empty_Ipv4_Topology_Before_Talking_2
55     [Documentation]    Wait for ${EXAMPLE_IPV4_TOPOLOGY} to come up and empty. Give large timeout for case when BGP boots slower than restconf.
56     [Tags]    critical
57     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
58     BuiltIn.Wait_Until_Keyword_Succeeds    ${INITIAL_RESTCONF_TIMEOUT}    1s    PrefixCounting.Check_Ipv4_Topology_Is_Empty    session=${operational_2}    topology=${EXAMPLE_IPV4_TOPOLOGY}
59
60 Check_For_Empty_Ipv4_Topology_Before_Talking_3
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    ${INITIAL_RESTCONF_TIMEOUT}    1s    PrefixCounting.Check_Ipv4_Topology_Is_Empty    session=${operational_3}    topology=${EXAMPLE_IPV4_TOPOLOGY}
65
66 Configure_Netconf_Device
67     [Documentation]    Configures and verifies netconf device configuration. If configuration is not successful, it de-configures the device before the next attempt.
68     # No need for configuring netconf device in carbon and above, openconfig is used
69     CompareStream.Run_Keyword_If_At_Least_Carbon    BuiltIn.Pass_Execution    Openconfig usage does not need netconf connector
70     &{mapping}    BuiltIn.Create_Dictionary    DEVICE_NAME=${DEVICE_NAME}    DEVICE_PORT=1830    DEVICE_IP=${rib_owner_node_id}    DEVICE_USER=admin    DEVICE_PASSWORD=admin
71     # 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.
72     : FOR    ${index}    IN RANGE    0    3
73     \    ${status}    ${value}=    Run Keyword And Ignore Error    PrefixcountKeywords.Configure_Netconf_Device_And_Check_Mounted    ${mapping}
74     \    Exit For Loop If    '${status}' == 'PASS'
75     \    Run Keyword Unless    '${status}' == 'PASS'    TemplatedRequests.Delete_Templated    ${NETCONF_DEV_FOLDER}    mapping=${mapping}    session=${config_session}
76     Run Keyword Unless    '${status}' == 'PASS'    Fail
77
78 Reconfigure_ODL_To_Accept_Connection
79     [Documentation]    Configure BGP peer module with initiate-connection set to false.
80     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
81     &{mapping}    BuiltIn.Create_Dictionary    DEVICE_NAME=${DEVICE_NAME}    BGP_NAME=${BGP_PEER_NAME}    IP=${TOOLS_SYSTEM_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}
82     ...    INITIATE=false    BGP_RIB=${RIB_INSTANCE}    PASSIVE_MODE=true    BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG}
83     TemplatedRequests.Put_As_Json_Templated    ${BGP_VARIABLES_FOLDER}    mapping=${mapping}    session=${config_session}
84     [Teardown]    SetupUtils.Teardown_Test_Show_Bugs_If_Test_Failed
85
86 Start_Talking_BGP_Speaker
87     [Documentation]    Start Python speaker to connect to ODL.
88     PrefixcountKeywords.Start_Bgp_Peer_And_Verify_Connected    connection_retries=${3}
89
90 Wait_For_Stable_Talking_Ipv4_Topology_1
91     [Documentation]    Wait until ${EXAMPLE_IPV4_TOPOLOGY} becomes stable. This is done by checking stability of prefix count as seen from node 1.
92     PrefixCounting.Wait_For_Ipv4_Topology_Prefixes_To_Become_Stable    timeout=${bgp_filling_timeout}    period=${CHECK_PERIOD}    repetitions=${REPETITIONS}    excluded_count=0    session=${operational_1}    topology=${EXAMPLE_IPV4_TOPOLOGY}
93
94 Wait_For_Stable_Talking_Ipv4_Topology_2
95     [Documentation]    Wait until ${EXAMPLE_IPV4_TOPOLOGY} becomes stable. This is done by checking stability of prefix count as seen from node 2.
96     PrefixCounting.Wait_For_Ipv4_Topology_Prefixes_To_Become_Stable    timeout=${bgp_filling_timeout}    period=${CHECK_PERIOD}    repetitions=${REPETITIONS}    excluded_count=0    session=${operational_2}    topology=${EXAMPLE_IPV4_TOPOLOGY}
97
98 Wait_For_Stable_Talking_Ipv4_Topology_3
99     [Documentation]    Wait until ${EXAMPLE_IPV4_TOPOLOGY} becomes stable. This is done by checking stability of prefix count as seen from node 3.
100     PrefixCounting.Wait_For_Ipv4_Topology_Prefixes_To_Become_Stable    timeout=${bgp_filling_timeout}    period=${CHECK_PERIOD}    repetitions=${REPETITIONS}    excluded_count=0    session=${operational_3}    topology=${EXAMPLE_IPV4_TOPOLOGY}
101
102 Check_Talking_Ipv4_Topology_Count_1
103     [Documentation]    Count the routes in ${EXAMPLE_IPV4_TOPOLOGY} and fail if the count is not correct as seen from node 1.
104     [Tags]    critical
105     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
106     PrefixCounting.Check_Ipv4_Topology_Count    ${COUNT}    session=${operational_1}    topology=${EXAMPLE_IPV4_TOPOLOGY}
107
108 Check_Talking_Ipv4_Topology_Count_2
109     [Documentation]    Count the routes in ${EXAMPLE_IPV4_TOPOLOGY} and fail if the count is not correct as seen from node 2.
110     [Tags]    critical
111     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
112     PrefixCounting.Check_Ipv4_Topology_Count    ${COUNT}    session=${operational_2}    topology=${EXAMPLE_IPV4_TOPOLOGY}
113
114 Check_Talking_Ipv4_Topology_Count_3
115     [Documentation]    Count the routes in ${EXAMPLE_IPV4_TOPOLOGY} and fail if the count is not correct as seen from node 3.
116     [Tags]    critical
117     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
118     PrefixCounting.Check_Ipv4_Topology_Count    ${COUNT}    session=${operational_3}    topology=${EXAMPLE_IPV4_TOPOLOGY}
119
120 Kill_Talking_BGP_Speaker
121     [Documentation]    Abort the Python speaker. Also, attempt to stop failing fast.
122     [Tags]    critical
123     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
124     BGPSpeaker.Kill_BGP_Speaker
125     FailFast.Do_Not_Fail_Fast_From_Now_On
126
127 Wait_For_Stable_Ipv4_Topology_After_Listening_1
128     [Documentation]    Wait until ${EXAMPLE_IPV4_TOPOLOGY} becomes stable again as seen from node 1.
129     [Tags]    critical
130     PrefixCounting.Wait_For_Ipv4_Topology_Prefixes_To_Become_Stable    timeout=${bgp_filling_timeout}    period=${CHECK_PERIOD}    repetitions=${REPETITIONS}    excluded_count=${COUNT}    session=${operational_1}    topology=${EXAMPLE_IPV4_TOPOLOGY}
131
132 Wait_For_Stable_Ipv4_Topology_After_Listening_2
133     [Documentation]    Wait until ${EXAMPLE_IPV4_TOPOLOGY} becomes stable again as seen from node 2.
134     [Tags]    critical
135     PrefixCounting.Wait_For_Ipv4_Topology_Prefixes_To_Become_Stable    timeout=${bgp_filling_timeout}    period=${CHECK_PERIOD}    repetitions=${REPETITIONS}    excluded_count=${COUNT}    session=${operational_2}    topology=${EXAMPLE_IPV4_TOPOLOGY}
136
137 Wait_For_Stable_Ipv4_Topology_After_Listening_3
138     [Documentation]    Wait until ${EXAMPLE_IPV4_TOPOLOGY} becomes stable again as seen from node 3.
139     [Tags]    critical
140     PrefixCounting.Wait_For_Ipv4_Topology_Prefixes_To_Become_Stable    timeout=${bgp_filling_timeout}    period=${CHECK_PERIOD}    repetitions=${REPETITIONS}    excluded_count=${COUNT}    session=${operational_3}    topology=${EXAMPLE_IPV4_TOPOLOGY}
141
142 Check_For_Empty_Ipv4_Topology_After_Listening_1
143     [Documentation]    Example-ipv4-topology should be empty now as seen from node 1.
144     [Tags]    critical
145     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
146     PrefixCounting.Check_Ipv4_Topology_Is_Empty    session=${operational_1}    topology=${EXAMPLE_IPV4_TOPOLOGY}
147
148 Check_For_Empty_Ipv4_Topology_After_Listening_2
149     [Documentation]    Example-ipv4-topology should be empty now as seen from node 2.
150     [Tags]    critical
151     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
152     PrefixCounting.Check_Ipv4_Topology_Is_Empty    session=${operational_2}    topology=${EXAMPLE_IPV4_TOPOLOGY}
153
154 Check_For_Empty_Ipv4_Topology_After_Listening_3
155     [Documentation]    Example-ipv4-topology should be empty now as seen from node 3.
156     [Tags]    critical
157     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
158     PrefixCounting.Check_Ipv4_Topology_Is_Empty    session=${operational_3}    topology=${EXAMPLE_IPV4_TOPOLOGY}
159
160 Delete_Bgp_Peer_Configuration
161     [Documentation]    Revert the BGP configuration to the original state: without any configured peers.
162     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
163     &{mapping}    BuiltIn.Create_Dictionary    DEVICE_NAME=${DEVICE_NAME}    BGP_NAME=${BGP_PEER_NAME}    IP=${TOOLS_SYSTEM_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}
164     ...    INITIATE=false    BGP_RIB=${RIB_INSTANCE}    BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG}
165     TemplatedRequests.Delete_Templated    ${BGP_VARIABLES_FOLDER}    mapping=${mapping}    session=${config_session}
166
167 Delete_Netconf_Device_Configuration
168     [Documentation]    Revert the netconf configuration to the original stat
169     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
170     CompareStream.Run_Keyword_If_At_Least_Carbon    BuiltIn.Pass_Execution    Openconfig usage does not need netconf connector
171     &{mapping}    BuiltIn.Create_Dictionary    DEVICE_NAME=${DEVICE_NAME}    DEVICE_PORT=1830    DEVICE_IP=${rib_owner_node_id}    DEVICE_USER=admin    DEVICE_PASSWORD=admin
172     TemplatedRequests.Delete_Templated    ${NETCONF_DEV_FOLDER}    mapping=${mapping}    session=${config_session}