2 Documentation Functional test for bgp - mvpn
4 ... Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
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
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 ... TODO: Unify Keywords with 070_bgp_functional_l3vpn_mcast.robot test suite
15 Suite Setup Start_Suite
16 Suite Teardown Stop_Suite
17 Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
18 Library RequestsLibrary
21 Library ../../../libraries/BgpRpcClient.py ${TOOLS_SYSTEM_IP}
22 Resource ../../../libraries/BGPcliKeywords.robot
23 Resource ../../../libraries/BGPSpeaker.robot
24 Resource ../../../libraries/SetupUtils.robot
25 Resource ../../../libraries/SSHKeywords.robot
26 Resource ../../../libraries/TemplatedRequests.robot
27 Resource ../../../variables/Variables.robot
31 ${CONFIG_SESSION} config-session
32 ${MVPN_DIR} ${CURDIR}/../../../variables/bgpfunctional/mvpn
33 ${PLAY_SCRIPT} ${CURDIR}/../../../../tools/fastbgp/play.py
34 ${RIB_NAME} example-bgp-rib
35 &{MVPN_ADJ_RIB_IN} PATH=peer/bgp:%2F%2F${TOOLS_SYSTEM_IP}/adj-rib-in BGP_RIB=${RIB_NAME}
36 &{MVPN_LOC_RIB} PATH=loc-rib BGP_RIB=${RIB_NAME}
37 &{MVPN_EFFECTIVE_RIB_IN} PATH=peer/bgp:%2F%2F${TOOLS_SYSTEM_IP}/effective-rib-in BGP_RIB=${RIB_NAME}
38 &{MVPN_APP_PEER} IP=${ODL_SYSTEM_IP} BGP_RIB=${RIB_NAME}
39 &{MVPN_ODL_CONFIG} IP=${TOOLS_SYSTEM_IP} HOLDTIME=${HOLDTIME} PEER_PORT=${BGP_TOOL_PORT} INITIATE=false BGP_RIB=${RIB_NAME} PASSIVE_MODE=true
43 [Documentation] Configures bgp application peer.
44 [Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
45 TemplatedRequests.Put_As_Xml_Templated ${MVPN_DIR}/app_peer mapping=${MVPN_APP_PEER} session=${CONFIG_SESSION}
47 Reconfigure_ODL_To_Accept_Connection
48 [Documentation] Configures BGP peer module with initiate-connection set to false.
49 [Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
50 TemplatedRequests.Put_As_Xml_Templated ${MVPN_DIR}/bgp_peer mapping=${MVPN_ODL_CONFIG} session=${CONFIG_SESSION}
53 [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.
54 [Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
55 BuiltIn.Wait_Until_Keyword_Succeeds 3x 1s Start Bgp Peer
57 Odl_To_Play_intra_as_ipmsi_ad
58 [Template] Odl_To_Play_Template
61 Play_To_Odl_intra_as_ipmsi_ad
62 [Template] Play_To_Odl_Template
65 Odl_To_Play_inter_as_ipmsi_ad
66 [Template] Odl_To_Play_Template
69 Play_To_Odl_inter_as_ipmsi_ad
70 [Template] Play_To_Odl_Template
74 [Template] Odl_To_Play_Template
78 [Template] Play_To_Odl_Template
82 [Template] Odl_To_Play_Template
86 [Template] Play_To_Odl_Template
89 Odl_To_Play_source_active_ad
90 [Template] Odl_To_Play_Template
93 Play_To_Odl_source_active_ad
94 [Template] Play_To_Odl_Template
97 Odl_To_Play_shared_tree_join
98 [Template] Odl_To_Play_Template
101 Play_To_Odl_shared_tree_join
102 [Template] Play_To_Odl_Template
105 Odl_To_Play_source_tree_join
106 [Template] Odl_To_Play_Template
109 Play_To_Odl_source_tree_join
110 [Template] Play_To_Odl_Template
113 Odl_To_Play_intra_pe_distinguisher
114 [Template] Odl_To_Play_Template
115 intra_pe_distinguisher
117 Play_To_Odl_intra_pe_distinguisher
118 [Template] Play_To_Odl_Template
119 intra_pe_distinguisher
121 Odl_To_Play_intra_vrf
122 [Template] Odl_To_Play_Template
125 Play_To_Odl_intra_vrf
126 [Template] Play_To_Odl_Template
129 Odl_To_Play_intra_source_as
130 [Template] Odl_To_Play_Template
133 Play_To_Odl_intra_source_as
134 [Template] Play_To_Odl_Template
137 Odl_To_Play_intra_source_as_4
138 [Template] Odl_To_Play_Template
141 Play_To_Odl_intra_source_as_4
142 [Template] Play_To_Odl_Template
145 Kill_Talking_BGP_Speaker
146 [Documentation] Abort the Python speaker
147 [Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
148 BGPSpeaker.Kill_BGP_Speaker
149 BGPcliKeywords.Store_File_To_Workspace play.py.out mvpn_play.log
151 Delete_Bgp_Peer_Configuration
152 [Documentation] Revert the BGP configuration to the original state: without any configured peers.
153 [Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
154 TemplatedRequests.Delete_Templated ${MVPN_DIR}/bgp_peer mapping=${MVPN_ODL_CONFIG} session=${CONFIG_SESSION}
157 [Documentation] Revert the BGP configuration to the original state: without application peer
158 [Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
159 TemplatedRequests.Delete_Templated ${MVPN_DIR}/app_peer mapping=${MVPN_APP_PEER} session=${CONFIG_SESSION}
163 [Documentation] Initialize SetupUtils. Suite setup keyword.
164 SetupUtils.Setup_Utils_For_Setup_And_Teardown
165 ${mininet_conn_id} = SSHLibrary.Open Connection ${TOOLS_SYSTEM_IP} prompt=${DEFAULT_LINUX_PROMPT} timeout=6s
166 Builtin.Set Suite Variable ${mininet_conn_id}
167 SSHKeywords.Flexible Mininet Login ${TOOLS_SYSTEM_USER}
168 RequestsLibrary.Create Session ${CONFIG_SESSION} http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH}
169 SSHLibrary.Put File ${PLAY_SCRIPT} .
170 SSHKeywords.Assure_Library_Ipaddr target_dir=.
173 [Documentation] Suite teardown keyword
174 SSHLibrary.Close_All_Connections
175 RequestsLibrary.Delete_All_Sessions
178 [Documentation] Starts bgp peer and verifies that the peer runs.
179 BGPSpeaker.Start_BGP_Speaker --amount 0 --myip=${TOOLS_SYSTEM_IP} --myport=${BGP_TOOL_PORT} --peerip=${ODL_SYSTEM_IP} --peerport=${ODL_BGP_PORT} --debug --mvpn --wfr 1
180 BGPcliKeywords.Read_And_Fail_If_Prompt_Is_Seen
183 [Arguments] ${totest}
184 ${announce_hex} = OperatingSystem.Get_File ${MVPN_DIR}/${totest}/announce_${totest}.hex
185 ${announce_hex} = String.Remove_String ${announce_hex} \n
186 ${withdraw_hex} = OperatingSystem.Get_File ${MVPN_DIR}/${totest}/withdraw_${totest}.hex
187 ${withdraw_hex} = String.Remove_String ${withdraw_hex} \n
188 BgpRpcClient.play_clean
189 TemplatedRequests.Post_As_Xml_Templated ${MVPN_DIR}/${totest}/app mapping=${MVPN_APP_PEER} session=${CONFIG_SESSION}
190 ${update} BuiltIn.Wait_Until_Keyword_Succeeds 3x 2s Get_Update_Message
191 BuiltIn.Should_Be_Equal_As_Strings ${update} ${announce_hex}
192 BgpRpcClient.play_clean
193 Remove_Configured_Routes ${totest}
194 ${update} BuiltIn.Wait_Until_Keyword_Succeeds 3x 2s Get_Update_Message
195 BuiltIn.Should_Be_Equal_As_Strings ${update} ${withdraw_hex}
196 [Teardown] Remove_Configured_Routes ${totest}
199 [Arguments] ${totest}
200 ${announce_hex} = OperatingSystem.Get_File ${MVPN_DIR}/${totest}/announce_${totest}.hex
201 ${withdraw_hex} = OperatingSystem.Get_File ${MVPN_DIR}/${totest}/withdraw_${totest}.hex
202 BgpRpcClient.play_clean
203 BgpRpcClient.play_send ${announce_hex}
204 BuiltIn.Wait_Until_Keyword_Succeeds 3x 2s TemplatedRequests.Get_As_Json_Templated ${MVPN_DIR}/${totest}/rib mapping=${MVPN_ADJ_RIB_IN} session=${CONFIG_SESSION}
206 BuiltIn.Wait_Until_Keyword_Succeeds 3x 2s TemplatedRequests.Get_As_Json_Templated ${MVPN_DIR}/${totest}/rib mapping=${MVPN_EFFECTIVE_RIB_IN} session=${CONFIG_SESSION}
208 BuiltIn.Wait_Until_Keyword_Succeeds 3x 2s TemplatedRequests.Get_As_Json_Templated ${MVPN_DIR}/${totest}/rib mapping=${MVPN_LOC_RIB} session=${CONFIG_SESSION}
210 BgpRpcClient.play_send ${withdraw_hex}
211 ${ipv} BuiltIn.Set_Variable_If '${totest}' == 'intra_ipv6' ipv6 ipv4
212 BuiltIn.Wait_Until_Keyword_Succeeds 3x 2s TemplatedRequests.Get_As_Json_Templated ${MVPN_DIR}/empty_routes/${ipv} mapping=${MVPN_LOC_RIB} session=${CONFIG_SESSION}
214 [Teardown] BgpRpcClient.play_send ${withdraw_hex}
217 [Documentation] Returns hex update message.
218 ${update} = BgpRpcClient.play_get
219 BuiltIn.Should_Not_Be_Equal ${update} ${Empty}
222 Remove_Configured_Routes
223 [Arguments] ${totest}
224 [Documentation] Removes the route if present.
225 BuiltIn.Run_Keyword_And_Ignore_Error TemplatedRequests.Delete_Templated ${MVPN_DIR}/${totest}/app mapping=${MVPN_APP_PEER} session=${CONFIG_SESSION}