Migrate Get Requests invocations(libraries)
[integration/test.git] / csit / suites / bgpcep / bgpfunct / 060_bgp_functional_mvpn.robot
1 *** Settings ***
2 Documentation       Functional test for bgp - mvpn
3 ...
4 ...                 Copyright (c) 2018 AT&T Intellectual Property. 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 distbmution,
8 ...                 and is available at http://www.eclipse.org/legal/epl-v10.html
9 ...
10 ...                 This suite tests advertising mvpn routes to odl. For advertising play.py is used,
11 ...                 and particular files are stored as *.hex files. There are 7 different
12 ...                 types of routes used for auto-discovery of multicast network. Also 4 more routes
13 ...                 with new attributes specific for mvpn.
14
15 Library             RequestsLibrary
16 Library             SSHLibrary
17 Library             String
18 Library             ../../../libraries/BgpRpcClient.py    ${TOOLS_SYSTEM_IP}
19 Resource            ../../../libraries/BGPcliKeywords.robot
20 Resource            ../../../libraries/BGPSpeaker.robot
21 Resource            ../../../libraries/BgpOperations.robot
22 Resource            ../../../libraries/SetupUtils.robot
23 Resource            ../../../libraries/SSHKeywords.robot
24 Resource            ../../../libraries/TemplatedRequests.robot
25 Resource            ../../../variables/Variables.robot
26
27 Suite Setup         Start_Suite
28 Suite Teardown      Stop_Suite
29 Test Setup          SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
30
31
32 *** Variables ***
33 ${HOLDTIME}             180
34 ${CONFIG_SESSION}       config-session
35 ${MVPN_DIR}             ${CURDIR}/../../../variables/bgpfunctional/mvpn
36 ${PLAY_SCRIPT}          ${CURDIR}/../../../../tools/fastbgp/play.py
37 ${RIB_NAME}             example-bgp-rib
38 &{MVPN_APP_PEER}        IP=${ODL_SYSTEM_IP}    BGP_RIB=${RIB_NAME}
39 &{MVPN_ODL_CONFIG}
40 ...                     IP=${TOOLS_SYSTEM_IP}
41 ...                     HOLDTIME=${HOLDTIME}
42 ...                     PEER_PORT=${BGP_TOOL_PORT}
43 ...                     INITIATE=false
44 ...                     BGP_RIB=${RIB_NAME}
45 ...                     PASSIVE_MODE=true
46
47
48 *** Test Cases ***
49 Configure_App_Peer
50     [Documentation]    Configures bgp application peer.
51     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
52     TemplatedRequests.Put_As_Xml_Templated
53     ...    ${MVPN_DIR}/app_peer
54     ...    mapping=${MVPN_APP_PEER}
55     ...    session=${CONFIG_SESSION}
56
57 Reconfigure_ODL_To_Accept_Connection
58     [Documentation]    Configures BGP peer module with initiate-connection set to false.
59     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
60     TemplatedRequests.Put_As_Xml_Templated
61     ...    ${MVPN_DIR}/bgp_peer
62     ...    mapping=${MVPN_ODL_CONFIG}
63     ...    session=${CONFIG_SESSION}
64
65 Start_Bgp_Peer
66     [Documentation]    Start Python speaker to connect to ODL. We need to do WUKS until odl really starts to accept incomming bgp connection. The failure happens if the incomming connection comes too quickly after configuring the peer in the previous test case.
67     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
68     BuiltIn.Wait_Until_Keyword_Succeeds    3x    1s    Start Bgp Peer
69
70 Odl_To_Play_intra_as_ipmsi_ad
71     [Template]    Odl_To_Play_Template
72     intra_as_ipmsi_ad    ${MVPN_DIR}
73
74 Play_To_Odl_intra_as_ipmsi_ad
75     [Template]    Play_To_Odl_Template
76     intra_as_ipmsi_ad    ${MVPN_DIR}
77
78 Odl_To_Play_inter_as_ipmsi_ad
79     [Template]    Odl_To_Play_Template
80     inter_as_ipmsi_ad    ${MVPN_DIR}
81
82 Play_To_Odl_inter_as_ipmsi_ad
83     [Template]    Play_To_Odl_Template
84     inter_as_ipmsi_ad    ${MVPN_DIR}
85
86 Odl_To_Play_spmsi_ad
87     [Template]    Odl_To_Play_Template
88     spmsi_ad    ${MVPN_DIR}
89
90 Play_To_Odl_spmsi_ad
91     [Template]    Play_To_Odl_Template
92     spmsi_ad    ${MVPN_DIR}
93
94 Odl_To_Play_leaf_ad
95     [Template]    Odl_To_Play_Template
96     leaf_ad    ${MVPN_DIR}
97
98 Play_To_Odl_leaf_ad
99     [Template]    Play_To_Odl_Template
100     leaf_ad    ${MVPN_DIR}
101
102 Odl_To_Play_source_active_ad
103     [Template]    Odl_To_Play_Template
104     source_active_ad    ${MVPN_DIR}
105
106 Play_To_Odl_source_active_ad
107     [Template]    Play_To_Odl_Template
108     source_active_ad    ${MVPN_DIR}
109
110 Odl_To_Play_shared_tree_join
111     [Template]    Odl_To_Play_Template
112     shared_tree_join    ${MVPN_DIR}
113
114 Play_To_Odl_shared_tree_join
115     [Template]    Play_To_Odl_Template
116     shared_tree_join    ${MVPN_DIR}
117
118 Odl_To_Play_source_tree_join
119     [Template]    Odl_To_Play_Template
120     source_tree_join    ${MVPN_DIR}
121
122 Play_To_Odl_source_tree_join
123     [Template]    Play_To_Odl_Template
124     source_tree_join    ${MVPN_DIR}
125
126 Odl_To_Play_intra_pe_distinguisher
127     [Template]    Odl_To_Play_Template
128     intra_pe_distinguisher    ${MVPN_DIR}
129
130 Play_To_Odl_intra_pe_distinguisher
131     [Template]    Play_To_Odl_Template
132     intra_pe_distinguisher    ${MVPN_DIR}
133
134 Odl_To_Play_intra_vrf
135     [Template]    Odl_To_Play_Template
136     intra_vrf    ${MVPN_DIR}
137
138 Play_To_Odl_intra_vrf
139     [Template]    Play_To_Odl_Template
140     intra_vrf    ${MVPN_DIR}
141
142 Odl_To_Play_intra_source_as
143     [Template]    Odl_To_Play_Template
144     intra_source_as    ${MVPN_DIR}
145
146 Play_To_Odl_intra_source_as
147     [Template]    Play_To_Odl_Template
148     intra_source_as    ${MVPN_DIR}
149
150 Odl_To_Play_intra_source_as_4
151     [Template]    Odl_To_Play_Template
152     intra_source_as_4    ${MVPN_DIR}
153
154 Play_To_Odl_intra_source_as_4
155     [Template]    Play_To_Odl_Template
156     intra_source_as_4    ${MVPN_DIR}
157
158 Play_To_Odl_intra_ipv6
159     [Template]    Play_To_Odl_Template
160     intra_ipv6    ${MVPN_DIR}    ipv6
161
162 Kill_Talking_BGP_Speaker
163     [Documentation]    Abort the Python speaker
164     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
165     BGPSpeaker.Kill_BGP_Speaker
166     BGPcliKeywords.Store_File_To_Workspace    play.py.out    mvpn_play.log
167
168 Delete_Bgp_Peer_Configuration
169     [Documentation]    Revert the BGP configuration to the original state: without any configured peers.
170     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
171     TemplatedRequests.Delete_Templated
172     ...    ${MVPN_DIR}/bgp_peer
173     ...    mapping=${MVPN_ODL_CONFIG}
174     ...    session=${CONFIG_SESSION}
175
176 Deconfigure_App_Peer
177     [Documentation]    Revert the BGP configuration to the original state: without application peer
178     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
179     TemplatedRequests.Delete_Templated    ${MVPN_DIR}/app_peer    mapping=${MVPN_APP_PEER}    session=${CONFIG_SESSION}
180
181
182 *** Keywords ***
183 Start_Suite
184     [Documentation]    Initialize SetupUtils. Suite setup keyword.
185     SetupUtils.Setup_Utils_For_Setup_And_Teardown
186     ${mininet_conn_id} =    SSHLibrary.Open Connection
187     ...    ${TOOLS_SYSTEM_IP}
188     ...    prompt=${DEFAULT_LINUX_PROMPT}
189     ...    timeout=6s
190     Builtin.Set Suite Variable    ${mininet_conn_id}
191     SSHKeywords.Flexible Mininet Login    ${TOOLS_SYSTEM_USER}
192     RequestsLibrary.Create Session    ${CONFIG_SESSION}    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}
193     SSHLibrary.Put File    ${PLAY_SCRIPT}    .
194     SSHKeywords.Assure_Library_Ipaddr    target_dir=.
195
196 Stop_Suite
197     [Documentation]    Suite teardown keyword
198     SSHLibrary.Close_All_Connections
199     RequestsLibrary.Delete_All_Sessions
200
201 Start_Bgp_Peer
202     [Documentation]    Starts bgp peer and verifies that the peer runs.
203     BGPSpeaker.Start_BGP_Speaker
204     ...    --amount 0 --myip=${TOOLS_SYSTEM_IP} --myport=${BGP_TOOL_PORT} --peerip=${ODL_SYSTEM_IP} --peerport=${ODL_BGP_PORT} --debug --mvpn --wfr 1
205     BGPcliKeywords.Read_And_Fail_If_Prompt_Is_Seen