2 Documentation Functional test for ipv6 connection with bgp.
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 distribution,
8 ... and is available at http://www.eclipse.org/legal/epl-v10.html
10 ... This suite tests simple connection between one ibgp peer (exabgp) and Odl.
11 ... Peer is configured with ipv6, and exabgp connectes to odl via ipv6.
12 ... Exabgp sends one ipv6 unicast route, which presence is verified in
13 ... example-ipv6-topology. Tests this connection multiple times, with
14 ... different ipv6 accepted formats, e.g. (::1, 0:0:0:0:0:0:0:1, full text)
15 ... This suite also tests a combination of afi-safis on odl and exabgp.
16 ... ipv6 route injection is carried out from odl to the ibgp peer without
17 ... ipv6 family enabled on the peer device and checked for exceptions
18 Suite Setup Start_Suite
19 Suite Teardown Stop_Suite
20 Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
21 Library RequestsLibrary
23 Resource ../../../libraries/BGPcliKeywords.robot
24 Resource ../../../libraries/ExaBgpLib.robot
25 Resource ../../../libraries/Genius.robot
26 Resource ../../../libraries/SetupUtils.robot
27 Resource ../../../libraries/SSHKeywords.robot
28 Resource ../../../libraries/TemplatedRequests.robot
29 Resource ../../../libraries/Utils.robot
30 Resource ../../../variables/Variables.robot
33 ${BGP_VAR_FOLDER} ${CURDIR}/../../../variables/bgpfunctional/ipv6
34 ${CONFIG_SESSION} config-session
35 ${CONTROLLER_IPV6} ::1
37 ${EXABGP_ID_2} 127.0.0.1
38 ${EXABGP_CFG} exaipv6.cfg
39 ${EXABGP_LOG} exaipv6.log
40 ${EXABGP2_CFG} exaipv4.cfg
41 ${EXABGP2_LOG} exaipv4.log
43 ${CONTROLLER_IPV4} ${ODL_SYSTEM_IP}
44 ${IPV6_IP} 2607:f0d0:1002:0011:0000:0000:0000:0002
45 ${IPV6_IP_2} 2607:f0d0:1002:11:0:0:0:2
46 ${IPV6_IP_3} 2607:f0d0:1002:11::2
47 ${IPV6_IP_GW} 2607:f0d0:1002:0011:0000:0000:0000:0001
49 ${RIB_INSTANCE} example-bgp-rib
52 Reconfigure_ODL_To_Accept_Connections
53 [Documentation] Configure BGP peer modules with initiate-connection set to false with short ipv6 address.
54 &{mapping} Create Dictionary IP=${IPV6_IP} HOLDTIME=${HOLDTIME} PEER_PORT=${BGP_TOOL_PORT} INITIATE=false BGP_RIB=${RIB_INSTANCE}
55 ... PASSIVE_MODE=true BGP_RIB_OPENCONFIG=${RIB_INSTANCE} RIB_INSTANCE_NAME=${RIB_INSTANCE}
56 TemplatedRequests.Put_As_Xml_Templated ${BGP_VAR_FOLDER}/bgp_peer mapping=${mapping} session=${CONFIG_SESSION}
59 [Documentation] Start exabgp with
61 ${cmd} BuiltIn.Set_Variable ${EXABGP_CFG} > ${EXABGP_LOG}
62 ExaBgpLib.Start_ExaBgp_And_Verify_Connected ${cmd} ${CONFIG_SESSION} ${EXABGP_ID}
64 Verify_Ipv6_Topology_Filled
65 [Documentation] Verifies that example-ipv6-topology is filled after starting exabgp.
67 Verify_Rib_Status_Filled
69 Delete_Bgp_Peer_Configuration
70 [Documentation] Revert the BGP configuration to the original state: without any configured peers.
71 &{mapping} Create Dictionary IP=${IPV6_IP} HOLDTIME=${HOLDTIME} PEER_PORT=${BGP_TOOL_PORT} INITIATE=false BGP_RIB=${RIB_INSTANCE}
72 ... PASSIVE_MODE=true BGP_RIB_OPENCONFIG=${RIB_INSTANCE} RIB_INSTANCE_NAME=${RIB_INSTANCE}
73 TemplatedRequests.Delete_Templated ${BGP_VAR_FOLDER}/bgp_peer mapping=${mapping} session=${CONFIG_SESSION}
75 Verify_Ipv6_Topology_Empty
76 [Documentation] Verifies that example-ipv6-topology is empty after deconfiguring peer for the first time.
78 Verify_Rib_Status_Empty
80 Reconfigure_ODL_To_Accept_Connections_2
81 [Documentation] Configure BGP peer modules with initiate-connection set to false with ipv6 address without "::" shortened version.
82 &{mapping} Create Dictionary IP=${IPV6_IP_2} HOLDTIME=${HOLDTIME} PEER_PORT=${BGP_TOOL_PORT} INITIATE=false BGP_RIB=${RIB_INSTANCE}
83 ... PASSIVE_MODE=true BGP_RIB_OPENCONFIG=${RIB_INSTANCE} RIB_INSTANCE_NAME=${RIB_INSTANCE}
84 TemplatedRequests.Put_As_Xml_Templated ${BGP_VAR_FOLDER}/bgp_peer mapping=${mapping} session=${CONFIG_SESSION}
86 Verify_Ipv6_Topology_Filled_2
87 [Documentation] Verifies that example-ipv6-topology is filled after configuring the peer for the second time.
89 Verify_Rib_Status_Filled
91 Delete_Bgp_Peer_Configuration_2
92 [Documentation] Revert the BGP configuration to the original state: without any configured peers.
93 &{mapping} Create Dictionary IP=${IPV6_IP_2} HOLDTIME=${HOLDTIME} PEER_PORT=${BGP_TOOL_PORT} INITIATE=false BGP_RIB=${RIB_INSTANCE}
94 ... PASSIVE_MODE=true BGP_RIB_OPENCONFIG=${RIB_INSTANCE} RIB_INSTANCE_NAME=${RIB_INSTANCE}
95 TemplatedRequests.Delete_Templated ${BGP_VAR_FOLDER}/bgp_peer mapping=${mapping} session=${CONFIG_SESSION}
97 Verify_Ipv6_Topology_Empty_2
98 [Documentation] Verifies that example-ipv6-topology is empty after deconfiguring peer for the second time.
100 Verify_Rib_Status_Empty
102 Reconfigure_ODL_To_Accept_Connections_3
103 [Documentation] Configure BGP peer modules with initiate-connection set to false with full text ipv6 address.
104 &{mapping} Create Dictionary IP=${IPV6_IP_3} HOLDTIME=${HOLDTIME} PEER_PORT=${BGP_TOOL_PORT} INITIATE=false BGP_RIB=${RIB_INSTANCE}
105 ... PASSIVE_MODE=true BGP_RIB_OPENCONFIG=${RIB_INSTANCE} RIB_INSTANCE_NAME=${RIB_INSTANCE}
106 TemplatedRequests.Put_As_Xml_Templated ${BGP_VAR_FOLDER}/bgp_peer mapping=${mapping} session=${CONFIG_SESSION}
108 Verify_Ipv6_Topology_Filled_3
109 [Documentation] Verifies that example-ipv6-topology is filled after configuring the peer for the third time.
111 Verify_Rib_Status_Filled
113 Delete_Bgp_Peer_Configuration_3
114 [Documentation] Revert the BGP configuration to the original state: without any configured peers.
115 &{mapping} Create Dictionary IP=${IPV6_IP_3} HOLDTIME=${HOLDTIME} PEER_PORT=${BGP_TOOL_PORT} INITIATE=false BGP_RIB=${RIB_INSTANCE}
116 ... PASSIVE_MODE=true BGP_RIB_OPENCONFIG=${RIB_INSTANCE} RIB_INSTANCE_NAME=${RIB_INSTANCE}
117 TemplatedRequests.Delete_Templated ${BGP_VAR_FOLDER}/bgp_peer mapping=${mapping} session=${CONFIG_SESSION}
119 Verify_Ipv6_Topology_Empty_3
120 [Documentation] Verifies that example-ipv6-topology is empty after final deconfiguration.
122 Verify_Rib_Status_Empty
125 [Documentation] Save exabgp logs as exaipv6.log, and stop exabgp with ctrl-c bash signal
126 BGPcliKeywords.Store_File_To_Workspace ${EXABGP_LOG} ${EXABGP_LOG}
127 ExaBgpLib.Stop_ExaBgp
130 [Documentation] Configures bgp application peer.
131 [Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
132 &{mapping} Create Dictionary IP=127.0.0.12 HOLDTIME=${HOLDTIME} PEER_PORT=${BGP_TOOL_PORT} INITIATE=false BGP_RIB=${RIB_INSTANCE}
133 ... PASSIVE_MODE=true BGP_RIB_OPENCONFIG=${RIB_INSTANCE} RIB_INSTANCE_NAME=${RIB_INSTANCE}
134 TemplatedRequests.Put_As_Xml_Templated ${BGP_VAR_FOLDER}/application_peer mapping=${mapping} session=${CONFIG_SESSION}
136 Reconfigure_ODL_To_Accept_Connections_4
137 [Documentation] Configure BGP peer modules with initiate-connection set to false with short ipv6 address.
138 &{mapping} Create Dictionary IP=${IPV4_IP} HOLDTIME=${HOLDTIME} PEER_PORT=${BGP_TOOL_PORT} INITIATE=false BGP_RIB=${RIB_INSTANCE}
139 ... PASSIVE_MODE=true BGP_RIB_OPENCONFIG=${RIB_INSTANCE} RIB_INSTANCE_NAME=${RIB_INSTANCE}
140 TemplatedRequests.Put_As_Xml_Templated ${BGP_VAR_FOLDER}/bgp_neighbor_rib mapping=${mapping} session=${CONFIG_SESSION}
141 RequestsLibrary.Create Session session http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH} headers=${HEADERS} timeout=5
144 [Documentation] Start exabgp and Verify BGP connection
146 ${cmd} BuiltIn.Set_Variable ${EXABGP2_CFG} > ${EXABGP2_LOG}
147 ExaBgpLib.Start_ExaBgp_And_Verify_Connected ${cmd} ${CONFIG_SESSION} 127.0.0.1
150 [Documentation] Inject the Ipv6 route from controller
151 &{mapping} Create Dictionary IP=127.0.0.12 HOLDTIME=${HOLDTIME} PEER_PORT=${BGP_TOOL_PORT} INITIATE=false BGP_RIB=${RIB_INSTANCE}
152 ... PASSIVE_MODE=true BGP_RIB_OPENCONFIG=${RIB_INSTANCE} RIB_INSTANCE_NAME=${RIB_INSTANCE}
153 TemplatedRequests.Post_As_Xml_Templated ${BGP_VAR_FOLDER}/ipv6_route_injection mapping=${mapping} session=${CONFIG_SESSION}
155 Check_Ipv6_Prefix_In_Bgp_Rib_1
156 [Documentation] Check for the presence of Ipv6 Prefix in the BGP RIB
157 &{mapping} Create Dictionary IP=${CONTROLLER_IPV4} HOLDTIME=${HOLDTIME} PEER_PORT=${BGP_TOOL_PORT} INITIATE=false BGP_RIB=${RIB_INSTANCE}
158 ... PASSIVE_MODE=true BGP_RIB_OPENCONFIG=${RIB_INSTANCE} RIB_INSTANCE_NAME=${RIB_INSTANCE}
159 BuiltIn.Wait_Until_Keyword_Succeeds 5x 2s TemplatedRequests.Get_As_Json_Templated ${BGP_VAR_FOLDER}/bgp_rib session=${CONFIG_SESSION} mapping=${mapping}
161 Delete_Injected_Ipv6_Routes_1
162 [Documentation] Delete the injected IPV6 routes
163 &{mapping} Create Dictionary IP=127.0.0.12 HOLDTIME=${HOLDTIME} PEER_PORT=${BGP_TOOL_PORT} INITIATE=false BGP_RIB=${RIB_INSTANCE}
164 ... PASSIVE_MODE=true BGP_RIB_OPENCONFIG=${RIB_INSTANCE} RIB_INSTANCE_NAME=${RIB_INSTANCE}
165 TemplatedRequests.Delete_Templated ${BGP_VAR_FOLDER}/ipv6_route_injection mapping=${mapping} session=${CONFIG_SESSION}
166 KarafKeywords.Fail If Exceptions Found During Test ${SUITE_NAME}.${TEST_NAME} fail=${True}
168 Delete_Bgp_Peer_Configuration_4
169 [Documentation] Revert the BGP configuration to the original state: without any configured peers.
170 &{mapping} Create Dictionary IP=${IPV4_IP} HOLDTIME=${HOLDTIME} PEER_PORT=${BGP_TOOL_PORT} INITIATE=false BGP_RIB=${RIB_INSTANCE}
171 ... PASSIVE_MODE=true BGP_RIB_OPENCONFIG=${RIB_INSTANCE} RIB_INSTANCE_NAME=${RIB_INSTANCE}
172 TemplatedRequests.Delete_Templated ${BGP_VAR_FOLDER}/bgp_neighbor_rib mapping=${mapping} session=${CONFIG_SESSION}
174 Verify_Ipv6_Topology_Empty_4
175 [Documentation] Verifies that example-ipv6-topology is empty after deconfiguring peer for the first time.
177 Verify_Rib_Status_Empty
179 Reconfigure_ODL_To_Accept_Connections_5
180 [Documentation] Configure BGP peer modules with initiate-connection set to false with short ipv6 address.
181 &{mapping} Create Dictionary IP=${IPV4_IP} HOLDTIME=${HOLDTIME} PEER_PORT=${BGP_TOOL_PORT} INITIATE=false BGP_RIB=${RIB_INSTANCE}
182 ... PASSIVE_MODE=true BGP_RIB_OPENCONFIG=${RIB_INSTANCE} RIB_INSTANCE_NAME=${RIB_INSTANCE}
183 TemplatedRequests.Put_As_Xml_Templated ${BGP_VAR_FOLDER}/bgp_peer mapping=${mapping} session=${CONFIG_SESSION}
186 [Documentation] Inject the Ipv6 route from controller
187 &{mapping} Create Dictionary IP=127.0.0.12 HOLDTIME=${HOLDTIME} PEER_PORT=${BGP_TOOL_PORT} INITIATE=false BGP_RIB=${RIB_INSTANCE}
188 ... PASSIVE_MODE=true BGP_RIB_OPENCONFIG=${RIB_INSTANCE} RIB_INSTANCE_NAME=${RIB_INSTANCE}
189 TemplatedRequests.Post_As_Xml_Templated ${BGP_VAR_FOLDER}/ipv6_route_injection mapping=${mapping} session=${CONFIG_SESSION}
191 Check_Ipv6_Prefix_In_Bgp_Rib_2
192 [Documentation] Check for the presence of Ipv6 Prefix in the BGP RIB
193 &{mapping} Create Dictionary IP=${CONTROLLER_IPV4} HOLDTIME=${HOLDTIME} PEER_PORT=${BGP_TOOL_PORT} INITIATE=false BGP_RIB=${RIB_INSTANCE}
194 ... PASSIVE_MODE=true BGP_RIB_OPENCONFIG=${RIB_INSTANCE} RIB_INSTANCE_NAME=${RIB_INSTANCE}
195 BuiltIn.Wait_Until_Keyword_Succeeds 5x 2s TemplatedRequests.Get_As_Json_Templated ${BGP_VAR_FOLDER}/bgp_rib session=${CONFIG_SESSION} mapping=${mapping}
197 Delete_Injected_Ipv6_Routes_2
198 [Documentation] Delete the injected IPV6 routes
199 &{mapping} Create Dictionary IP=127.0.0.12 HOLDTIME=${HOLDTIME} PEER_PORT=${BGP_TOOL_PORT} INITIATE=false BGP_RIB=${RIB_INSTANCE}
200 ... PASSIVE_MODE=true BGP_RIB_OPENCONFIG=${RIB_INSTANCE} RIB_INSTANCE_NAME=${RIB_INSTANCE}
201 TemplatedRequests.Delete_Templated ${BGP_VAR_FOLDER}/ipv6_route_injection mapping=${mapping} session=${CONFIG_SESSION}
202 KarafKeywords.Fail If Exceptions Found During Test ${SUITE_NAME}.${TEST_NAME} fail=${True}
205 [Documentation] Deletes bgp application peer.
206 [Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
207 &{mapping} Create Dictionary IP=127.0.0.12 HOLDTIME=${HOLDTIME} PEER_PORT=${BGP_TOOL_PORT} INITIATE=false BGP_RIB=${RIB_INSTANCE}
208 ... PASSIVE_MODE=true BGP_RIB_OPENCONFIG=${RIB_INSTANCE} RIB_INSTANCE_NAME=${RIB_INSTANCE}
209 TemplatedRequests.Delete_Templated ${BGP_VAR_FOLDER}/application_peer mapping=${mapping} session=${CONFIG_SESSION}
211 Delete_Bgp_Peer_Configuration_5
212 [Documentation] Revert the BGP configuration to the original state: without any configured peers.
213 &{mapping} Create Dictionary IP=${IPV4_IP} HOLDTIME=${HOLDTIME} PEER_PORT=${BGP_TOOL_PORT} INITIATE=false BGP_RIB=${RIB_INSTANCE}
214 ... PASSIVE_MODE=true BGP_RIB_OPENCONFIG=${RIB_INSTANCE} RIB_INSTANCE_NAME=${RIB_INSTANCE}
215 TemplatedRequests.Delete_Templated ${BGP_VAR_FOLDER}/bgp_peer mapping=${mapping} session=${CONFIG_SESSION}
217 Verify_Ipv6_Topology_Empty_5
218 [Documentation] Verifies that example-ipv6-topology is empty after deconfiguring peer for the first time.
220 Verify_Rib_Status_Empty
223 [Documentation] Save exabgp logs as exaipv6.log, and stop exabgp with ctrl-c bash signal
224 BGPcliKeywords.Store_File_To_Workspace ${EXABGP2_LOG} ${EXABGP2_LOG}
225 ExaBgpLib.Stop_ExaBgp
226 ${Log_Content} OperatingSystem.Get File ${EXABGP2_LOG}
231 [Documentation] Suite setup keyword.
232 SetupUtils.Setup_Utils_For_Setup_And_Teardown
233 ${conn_id}= SSHLibrary.Open Connection ${ODL_SYSTEM_IP} prompt=${DEFAULT_LINUX_PROMPT} timeout=10s
234 Builtin.Set_Suite_Variable ${conn_id}
235 SSHKeywords.Flexible_Controller_Login
236 Configure_Ipv6_Network
237 SSHKeywords.Virtual_Env_Create
238 SSHKeywords.Virtual_Env_Install_Package setuptools==44.0.0
239 SSHKeywords.Virtual_Env_Install_Package exabgp==4.2.4
240 RequestsLibrary.Create_Session ${CONFIG_SESSION} http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH}
242 Upload_Config_Files_exabgp_ipv4
245 [Documentation] Suite teardown keyword
246 SSHKeywords.Virtual_Env_Delete
247 SSHLibrary.Close_All_Connections
248 RequestsLibrary.Delete_All_Sessions
249 BuiltIn.Run Keyword And Ignore Error ExaBgpLib.Stop_ExaBgp
251 Configure_Ipv6_Network
252 [Documentation] Reconfigures basic network settings on controller
253 SSHLibrary.Execute_Command sudo sh -c 'echo "NETWORKING_IPV6=yes" >> /etc/sysconfig/network'
254 SSHLibrary.Execute_Command sudo sh -c 'echo "IPV6INIT=yes" >> /etc/sysconfig/network-scripts/ifcfg-eth0'
255 SSHLibrary.Execute_Command sudo sh -c 'echo "IPV6ADDR=${IPV6_IP}" >> /etc/sysconfig/network-scripts/ifcfg-eth0'
256 SSHLibrary.Execute_Command sudo sh -c 'echo "IPV6_DEFAULTGW=${IPV6_IP_GW}" >> /etc/sysconfig/network-scripts/ifcfg-eth0'
257 SSHLibrary.Execute_Command sudo /etc/init.d/network restart
259 Verify_Rib_Status_Empty
260 [Documentation] Verifies that example-ipv6-topology is empty
261 BuiltIn.Wait_Until_Keyword_Succeeds 5x 2s TemplatedRequests.Get_As_Json_Templated ${BGP_VAR_FOLDER}/ipv6_topology_empty session=${CONFIG_SESSION} verify=True
263 Verify_Rib_Status_Filled
264 [Documentation] Verifies that example-ipv6-topology is filled with ipv6 route
265 BuiltIn.Wait_Until_Keyword_Succeeds 5x 2s TemplatedRequests.Get_As_Json_Templated ${BGP_VAR_FOLDER}/ipv6_topology_filled session=${CONFIG_SESSION} verify=True
268 [Documentation] Uploads exabgp config files
269 SSHLibrary.Put_File ${BGP_VAR_FOLDER}/${EXABGP_CFG} .
270 @{cfgfiles}= SSHLibrary.List_Files_In_Directory . *.cfg
271 FOR ${cfgfile} IN @{cfgfiles}
272 SSHLibrary.Execute_Command sed -i -e 's/EXABGPIP/${IPV6_IP}/g' ${cfgfile}
273 SSHLibrary.Execute_Command sed -i -e 's/ODLIP/${CONTROLLER_IPV6}/g' ${cfgfile}
274 SSHLibrary.Execute_Command sed -i -e 's/ROUTERID/${EXABGP_ID}/g' ${cfgfile}
275 SSHLibrary.Execute_Command sed -i -e 's/ROUTEREFRESH/disable/g' ${cfgfile}
276 SSHLibrary.Execute_Command sed -i -e 's/ADDPATH/disable/g' ${cfgfile}
277 ${stdout}= SSHLibrary.Execute_Command cat ${cfgfile}
281 Upload_Config_Files_exabgp_ipv4
282 [Documentation] Uploads exabgp config files
283 SSHLibrary.Put_File ${BGP_VAR_FOLDER}/${EXABGP2_CFG} .
284 @{cfgfiles}= SSHLibrary.List_Files_In_Directory . *ipv4.cfg
285 FOR ${cfgfile} IN @{cfgfiles}
286 SSHLibrary.Execute_Command sed -i -e 's/EXABGPIP/127.0.0.1/g' ${cfgfile}
287 SSHLibrary.Execute_Command sed -i -e 's/ODLIP/${ODL_SYSTEM_IP}/g' ${cfgfile}
288 SSHLibrary.Execute_Command sed -i -e 's/ROUTERID/127.0.0.1/g' ${cfgfile}
289 SSHLibrary.Execute_Command sed -i -e 's/ROUTEREFRESH/disable/g' ${cfgfile}
290 SSHLibrary.Execute_Command sed -i -e 's/ADDPATH/disable/g' ${cfgfile}
291 ${stdout}= SSHLibrary.Execute_Command cat ${cfgfile}