f9f70f466fe5eb896c873769d11429605689079c
[integration/test.git] / csit / suites / bgpcep / bgpfunct / bgp_ipv6_basic.robot
1 *** Settings ***
2 Documentation       Functional test for ipv6 connection with bgp.
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 distribution,
8 ...                 and is available at http://www.eclipse.org/legal/epl-v10.html
9 ...
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
19 Library             RequestsLibrary
20 Library             SSHLibrary
21 Resource            ../../../libraries/BGPcliKeywords.robot
22 Resource            ../../../libraries/ExaBgpLib.robot
23 Resource            ../../../libraries/Genius.robot
24 Resource            ../../../libraries/SetupUtils.robot
25 Resource            ../../../libraries/SSHKeywords.robot
26 Resource            ../../../libraries/TemplatedRequests.robot
27 Resource            ../../../libraries/Utils.robot
28 Resource            ../../../variables/Variables.robot
29 Resource            ../../../libraries/KarafKeywords.robot
30
31 Suite Setup         Start_Suite
32 Suite Teardown      Stop_Suite
33 Test Setup          SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
34
35
36 *** Variables ***
37 ${BGP_VAR_FOLDER}           ${CURDIR}/../../../variables/bgpfunctional/ipv6
38 ${CONFIG_SESSION}           config-session
39 ${CONTROLLER_IPV6}          ::1
40 ${EXABGP_ID}                1.2.3.4
41 ${EXABGP_ID_2}              127.0.0.1
42 ${EXABGP_CFG}               exaipv6.cfg
43 ${EXABGP_LOG}               exaipv6.log
44 ${EXABGP2_CFG}              exaipv4.cfg
45 ${EXABGP2_LOG}              exaipv4.log
46 ${EXABGP3_CFG}              exabgp_graceful_restart.cfg
47 ${EXABGP3_LOG}              exabgp_graceful_restart.log
48 ${EXABGP4_CFG}              exa4.cfg
49 ${EXABGP4_LOG}              exa4.log
50 ${IPV4_IP}                  127.0.0.1
51 ${CONTROLLER_IPV4}          ${ODL_SYSTEM_IP}
52 ${IPV6_IP}                  2607:f0d0:1002:0011:0000:0000:0000:0002
53 ${IPV6_IP_2}                2607:f0d0:1002:11:0:0:0:2
54 ${IPV6_IP_3}                2607:f0d0:1002:11::2
55 ${IPV6_IP_GW}               2607:f0d0:1002:0011:0000:0000:0000:0001
56 ${IPV6_PREFIX_LENGTH}       64
57 ${HOLDTIME}                 180
58 ${RIB_INSTANCE}             example-bgp-rib
59
60
61 *** Test Cases ***
62 Reconfigure_ODL_To_Accept_Connections
63     [Documentation]    Configure BGP peer modules with initiate-connection set to false with short ipv6 address.
64     &{mapping}    Create Dictionary
65     ...    IP=${IPV6_IP}
66     ...    HOLDTIME=${HOLDTIME}
67     ...    PEER_PORT=${BGP_TOOL_PORT}
68     ...    INITIATE=false
69     ...    BGP_RIB=${RIB_INSTANCE}
70     ...    PASSIVE_MODE=true
71     ...    BGP_RIB_OPENCONFIG=${RIB_INSTANCE}
72     ...    RIB_INSTANCE_NAME=${RIB_INSTANCE}
73     TemplatedRequests.Put_As_Xml_Templated
74     ...    ${BGP_VAR_FOLDER}/bgp_peer
75     ...    mapping=${mapping}
76     ...    session=${CONFIG_SESSION}
77
78 Start_Exabgp
79     [Documentation]    Start exabgp with
80     [Tags]    critical
81     ${cmd}    BuiltIn.Set_Variable    ${EXABGP_CFG} > ${EXABGP_LOG}
82     ExaBgpLib.Start_ExaBgp_And_Verify_Connected    ${cmd}    ${CONFIG_SESSION}    ${EXABGP_ID}
83
84 Verify_Ipv6_Topology_Filled
85     [Documentation]    Verifies that example-ipv6-topology is filled after starting exabgp.
86     [Tags]    critical
87     Verify_Rib_Status_Filled
88
89 Delete_Bgp_Peer_Configuration
90     [Documentation]    Revert the BGP configuration to the original state: without any configured peers.
91     &{mapping}    Create Dictionary
92     ...    IP=${IPV6_IP}
93     ...    HOLDTIME=${HOLDTIME}
94     ...    PEER_PORT=${BGP_TOOL_PORT}
95     ...    INITIATE=false
96     ...    BGP_RIB=${RIB_INSTANCE}
97     ...    PASSIVE_MODE=true
98     ...    BGP_RIB_OPENCONFIG=${RIB_INSTANCE}
99     ...    RIB_INSTANCE_NAME=${RIB_INSTANCE}
100     TemplatedRequests.Delete_Templated    ${BGP_VAR_FOLDER}/bgp_peer    mapping=${mapping}    session=${CONFIG_SESSION}
101
102 Verify_Ipv6_Topology_Empty
103     [Documentation]    Verifies that example-ipv6-topology is empty after deconfiguring peer for the first time.
104     [Tags]    critical
105     Verify_Rib_Status_Empty
106
107 Reconfigure_ODL_To_Accept_Connections_2
108     [Documentation]    Configure BGP peer modules with initiate-connection set to false with ipv6 address without "::" shortened version.
109     &{mapping}    Create Dictionary
110     ...    IP=${IPV6_IP_2}
111     ...    HOLDTIME=${HOLDTIME}
112     ...    PEER_PORT=${BGP_TOOL_PORT}
113     ...    INITIATE=false
114     ...    BGP_RIB=${RIB_INSTANCE}
115     ...    PASSIVE_MODE=true
116     ...    BGP_RIB_OPENCONFIG=${RIB_INSTANCE}
117     ...    RIB_INSTANCE_NAME=${RIB_INSTANCE}
118     TemplatedRequests.Put_As_Xml_Templated
119     ...    ${BGP_VAR_FOLDER}/bgp_peer
120     ...    mapping=${mapping}
121     ...    session=${CONFIG_SESSION}
122
123 Verify_Ipv6_Topology_Filled_2
124     [Documentation]    Verifies that example-ipv6-topology is filled after configuring the peer for the second time.
125     [Tags]    critical
126     Verify_Rib_Status_Filled
127
128 Delete_Bgp_Peer_Configuration_2
129     [Documentation]    Revert the BGP configuration to the original state: without any configured peers.
130     &{mapping}    Create Dictionary
131     ...    IP=${IPV6_IP_2}
132     ...    HOLDTIME=${HOLDTIME}
133     ...    PEER_PORT=${BGP_TOOL_PORT}
134     ...    INITIATE=false
135     ...    BGP_RIB=${RIB_INSTANCE}
136     ...    PASSIVE_MODE=true
137     ...    BGP_RIB_OPENCONFIG=${RIB_INSTANCE}
138     ...    RIB_INSTANCE_NAME=${RIB_INSTANCE}
139     TemplatedRequests.Delete_Templated    ${BGP_VAR_FOLDER}/bgp_peer    mapping=${mapping}    session=${CONFIG_SESSION}
140
141 Verify_Ipv6_Topology_Empty_2
142     [Documentation]    Verifies that example-ipv6-topology is empty after deconfiguring peer for the second time.
143     [Tags]    critical
144     Verify_Rib_Status_Empty
145
146 Reconfigure_ODL_To_Accept_Connections_3
147     [Documentation]    Configure BGP peer modules with initiate-connection set to false with full text ipv6 address.
148     &{mapping}    Create Dictionary
149     ...    IP=${IPV6_IP_3}
150     ...    HOLDTIME=${HOLDTIME}
151     ...    PEER_PORT=${BGP_TOOL_PORT}
152     ...    INITIATE=false
153     ...    BGP_RIB=${RIB_INSTANCE}
154     ...    PASSIVE_MODE=true
155     ...    BGP_RIB_OPENCONFIG=${RIB_INSTANCE}
156     ...    RIB_INSTANCE_NAME=${RIB_INSTANCE}
157     TemplatedRequests.Put_As_Xml_Templated
158     ...    ${BGP_VAR_FOLDER}/bgp_peer
159     ...    mapping=${mapping}
160     ...    session=${CONFIG_SESSION}
161
162 Verify_Ipv6_Topology_Filled_3
163     [Documentation]    Verifies that example-ipv6-topology is filled after configuring the peer for the third time.
164     [Tags]    critical
165     Verify_Rib_Status_Filled
166
167 Delete_Bgp_Peer_Configuration_3
168     [Documentation]    Revert the BGP configuration to the original state: without any configured peers.
169     &{mapping}    Create Dictionary
170     ...    IP=${IPV6_IP_3}
171     ...    HOLDTIME=${HOLDTIME}
172     ...    PEER_PORT=${BGP_TOOL_PORT}
173     ...    INITIATE=false
174     ...    BGP_RIB=${RIB_INSTANCE}
175     ...    PASSIVE_MODE=true
176     ...    BGP_RIB_OPENCONFIG=${RIB_INSTANCE}
177     ...    RIB_INSTANCE_NAME=${RIB_INSTANCE}
178     TemplatedRequests.Delete_Templated    ${BGP_VAR_FOLDER}/bgp_peer    mapping=${mapping}    session=${CONFIG_SESSION}
179
180 Verify_Ipv6_Topology_Empty_3
181     [Documentation]    Verifies that example-ipv6-topology is empty after final deconfiguration.
182     [Tags]    critical
183     Verify_Rib_Status_Empty
184
185 Stop_All_Exabgps
186     [Documentation]    Save exabgp logs as exaipv6.log, and stop exabgp with ctrl-c bash signal
187     BGPcliKeywords.Store_File_To_Workspace    ${EXABGP_LOG}    ${EXABGP_LOG}
188     ExaBgpLib.Stop_ExaBgp
189
190 Configure_App_Peer
191     [Documentation]    Configures bgp application peer.
192     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
193     &{mapping}    Create Dictionary
194     ...    IP=127.0.0.12
195     ...    HOLDTIME=${HOLDTIME}
196     ...    PEER_PORT=${BGP_TOOL_PORT}
197     ...    INITIATE=false
198     ...    BGP_RIB=${RIB_INSTANCE}
199     ...    PASSIVE_MODE=true
200     ...    BGP_RIB_OPENCONFIG=${RIB_INSTANCE}
201     ...    RIB_INSTANCE_NAME=${RIB_INSTANCE}
202     TemplatedRequests.Put_As_Xml_Templated
203     ...    ${BGP_VAR_FOLDER}/application_peer
204     ...    mapping=${mapping}
205     ...    session=${CONFIG_SESSION}
206
207 Reconfigure_ODL_To_Accept_Connections_4
208     [Documentation]    Configure BGP peer modules with initiate-connection set to false with short ipv6 address.
209     &{mapping}    Create Dictionary
210     ...    IP=${IPV4_IP}
211     ...    HOLDTIME=${HOLDTIME}
212     ...    PEER_PORT=${BGP_TOOL_PORT}
213     ...    INITIATE=false
214     ...    BGP_RIB=${RIB_INSTANCE}
215     ...    PASSIVE_MODE=true
216     ...    BGP_RIB_OPENCONFIG=${RIB_INSTANCE}
217     ...    RIB_INSTANCE_NAME=${RIB_INSTANCE}
218     TemplatedRequests.Put_As_Xml_Templated
219     ...    ${BGP_VAR_FOLDER}/bgp_neighbor_rib
220     ...    mapping=${mapping}
221     ...    session=${CONFIG_SESSION}
222     RequestsLibrary.Create Session
223     ...    session
224     ...    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}
225     ...    auth=${AUTH}
226     ...    headers=${HEADERS}
227     ...    timeout=5
228
229 Start_Exabgp_2
230     [Documentation]    Start exabgp and Verify BGP connection
231     [Tags]    critical
232     ${cmd}    BuiltIn.Set_Variable    ${EXABGP2_CFG} > ${EXABGP2_LOG}
233     ExaBgpLib.Start_ExaBgp_And_Verify_Connected    ${cmd}    ${CONFIG_SESSION}    127.0.0.1
234
235 Inject_Ipv6_Route_1
236     [Documentation]    Inject the Ipv6 route from controller
237     &{mapping}    Create Dictionary
238     ...    IP=127.0.0.12
239     ...    HOLDTIME=${HOLDTIME}
240     ...    PEER_PORT=${BGP_TOOL_PORT}
241     ...    INITIATE=false
242     ...    BGP_RIB=${RIB_INSTANCE}
243     ...    PASSIVE_MODE=true
244     ...    BGP_RIB_OPENCONFIG=${RIB_INSTANCE}
245     ...    RIB_INSTANCE_NAME=${RIB_INSTANCE}
246     TemplatedRequests.Post_As_Xml_Templated
247     ...    ${BGP_VAR_FOLDER}/ipv6_route_injection
248     ...    mapping=${mapping}
249     ...    session=${CONFIG_SESSION}
250
251 Check_Ipv6_Prefix_In_Bgp_Rib_1
252     [Documentation]    Check for the presence of Ipv6 Prefix in the BGP RIB
253     &{mapping}    Create Dictionary
254     ...    IP=${CONTROLLER_IPV4}
255     ...    HOLDTIME=${HOLDTIME}
256     ...    PEER_PORT=${BGP_TOOL_PORT}
257     ...    INITIATE=false
258     ...    BGP_RIB=${RIB_INSTANCE}
259     ...    PASSIVE_MODE=true
260     ...    BGP_RIB_OPENCONFIG=${RIB_INSTANCE}
261     ...    RIB_INSTANCE_NAME=${RIB_INSTANCE}
262     BuiltIn.Wait_Until_Keyword_Succeeds
263     ...    5x
264     ...    2s
265     ...    TemplatedRequests.Get_As_Json_Templated
266     ...    ${BGP_VAR_FOLDER}/bgp_rib
267     ...    session=${CONFIG_SESSION}
268     ...    mapping=${mapping}
269
270 Delete_Injected_Ipv6_Routes_1
271     [Documentation]    Delete the injected IPV6 routes
272     &{mapping}    Create Dictionary
273     ...    IP=127.0.0.12
274     ...    HOLDTIME=${HOLDTIME}
275     ...    PEER_PORT=${BGP_TOOL_PORT}
276     ...    INITIATE=false
277     ...    BGP_RIB=${RIB_INSTANCE}
278     ...    PASSIVE_MODE=true
279     ...    BGP_RIB_OPENCONFIG=${RIB_INSTANCE}
280     ...    RIB_INSTANCE_NAME=${RIB_INSTANCE}
281     TemplatedRequests.Delete_Templated
282     ...    ${BGP_VAR_FOLDER}/ipv6_route_injection
283     ...    mapping=${mapping}
284     ...    session=${CONFIG_SESSION}
285     KarafKeywords.Fail If Exceptions Found During Test    ${SUITE_NAME}.${TEST_NAME}    fail=${True}
286
287 Delete_Bgp_Peer_Configuration_4
288     [Documentation]    Revert the BGP configuration to the original state: without any configured peers.
289     &{mapping}    Create Dictionary
290     ...    IP=${IPV4_IP}
291     ...    HOLDTIME=${HOLDTIME}
292     ...    PEER_PORT=${BGP_TOOL_PORT}
293     ...    INITIATE=false
294     ...    BGP_RIB=${RIB_INSTANCE}
295     ...    PASSIVE_MODE=true
296     ...    BGP_RIB_OPENCONFIG=${RIB_INSTANCE}
297     ...    RIB_INSTANCE_NAME=${RIB_INSTANCE}
298     TemplatedRequests.Delete_Templated
299     ...    ${BGP_VAR_FOLDER}/bgp_neighbor_rib
300     ...    mapping=${mapping}
301     ...    session=${CONFIG_SESSION}
302
303 Verify_Ipv6_Topology_Empty_4
304     [Documentation]    Verifies that example-ipv6-topology is empty after deconfiguring peer for the first time.
305     [Tags]    critical
306     Verify_Rib_Status_Empty
307
308 Reconfigure_ODL_To_Accept_Connections_5
309     [Documentation]    Configure BGP peer modules with initiate-connection set to false with short ipv6 address.
310     &{mapping}    Create Dictionary
311     ...    IP=${IPV4_IP}
312     ...    HOLDTIME=${HOLDTIME}
313     ...    PEER_PORT=${BGP_TOOL_PORT}
314     ...    INITIATE=false
315     ...    BGP_RIB=${RIB_INSTANCE}
316     ...    PASSIVE_MODE=true
317     ...    BGP_RIB_OPENCONFIG=${RIB_INSTANCE}
318     ...    RIB_INSTANCE_NAME=${RIB_INSTANCE}
319     TemplatedRequests.Put_As_Xml_Templated
320     ...    ${BGP_VAR_FOLDER}/bgp_peer
321     ...    mapping=${mapping}
322     ...    session=${CONFIG_SESSION}
323
324 Inject_Ipv6_Route_2
325     [Documentation]    Inject the Ipv6 route from controller
326     &{mapping}    Create Dictionary
327     ...    IP=127.0.0.12
328     ...    HOLDTIME=${HOLDTIME}
329     ...    PEER_PORT=${BGP_TOOL_PORT}
330     ...    INITIATE=false
331     ...    BGP_RIB=${RIB_INSTANCE}
332     ...    PASSIVE_MODE=true
333     ...    BGP_RIB_OPENCONFIG=${RIB_INSTANCE}
334     ...    RIB_INSTANCE_NAME=${RIB_INSTANCE}
335     TemplatedRequests.Post_As_Xml_Templated
336     ...    ${BGP_VAR_FOLDER}/ipv6_route_injection
337     ...    mapping=${mapping}
338     ...    session=${CONFIG_SESSION}
339
340 Check_Ipv6_Prefix_In_Bgp_Rib_2
341     [Documentation]    Check for the presence of Ipv6 Prefix in the BGP RIB
342     &{mapping}    Create Dictionary
343     ...    IP=${CONTROLLER_IPV4}
344     ...    HOLDTIME=${HOLDTIME}
345     ...    PEER_PORT=${BGP_TOOL_PORT}
346     ...    INITIATE=false
347     ...    BGP_RIB=${RIB_INSTANCE}
348     ...    PASSIVE_MODE=true
349     ...    BGP_RIB_OPENCONFIG=${RIB_INSTANCE}
350     ...    RIB_INSTANCE_NAME=${RIB_INSTANCE}
351     BuiltIn.Wait_Until_Keyword_Succeeds
352     ...    5x
353     ...    2s
354     ...    TemplatedRequests.Get_As_Json_Templated
355     ...    ${BGP_VAR_FOLDER}/bgp_rib
356     ...    session=${CONFIG_SESSION}
357     ...    mapping=${mapping}
358
359 Delete_Injected_Ipv6_Routes_2
360     [Documentation]    Delete the injected IPV6 routes
361     &{mapping}    Create Dictionary
362     ...    IP=127.0.0.12
363     ...    HOLDTIME=${HOLDTIME}
364     ...    PEER_PORT=${BGP_TOOL_PORT}
365     ...    INITIATE=false
366     ...    BGP_RIB=${RIB_INSTANCE}
367     ...    PASSIVE_MODE=true
368     ...    BGP_RIB_OPENCONFIG=${RIB_INSTANCE}
369     ...    RIB_INSTANCE_NAME=${RIB_INSTANCE}
370     TemplatedRequests.Delete_Templated
371     ...    ${BGP_VAR_FOLDER}/ipv6_route_injection
372     ...    mapping=${mapping}
373     ...    session=${CONFIG_SESSION}
374     KarafKeywords.Fail If Exceptions Found During Test    ${SUITE_NAME}.${TEST_NAME}    fail=${True}
375
376 Delete_App_Peer
377     [Documentation]    Deletes bgp application peer.
378     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
379     &{mapping}    Create Dictionary
380     ...    IP=127.0.0.12
381     ...    HOLDTIME=${HOLDTIME}
382     ...    PEER_PORT=${BGP_TOOL_PORT}
383     ...    INITIATE=false
384     ...    BGP_RIB=${RIB_INSTANCE}
385     ...    PASSIVE_MODE=true
386     ...    BGP_RIB_OPENCONFIG=${RIB_INSTANCE}
387     ...    RIB_INSTANCE_NAME=${RIB_INSTANCE}
388     TemplatedRequests.Delete_Templated
389     ...    ${BGP_VAR_FOLDER}/application_peer
390     ...    mapping=${mapping}
391     ...    session=${CONFIG_SESSION}
392
393 Delete_Bgp_Peer_Configuration_5
394     [Documentation]    Revert the BGP configuration to the original state: without any configured peers.
395     &{mapping}    Create Dictionary
396     ...    IP=${IPV4_IP}
397     ...    HOLDTIME=${HOLDTIME}
398     ...    PEER_PORT=${BGP_TOOL_PORT}
399     ...    INITIATE=false
400     ...    BGP_RIB=${RIB_INSTANCE}
401     ...    PASSIVE_MODE=true
402     ...    BGP_RIB_OPENCONFIG=${RIB_INSTANCE}
403     ...    RIB_INSTANCE_NAME=${RIB_INSTANCE}
404     TemplatedRequests.Delete_Templated    ${BGP_VAR_FOLDER}/bgp_peer    mapping=${mapping}    session=${CONFIG_SESSION}
405
406 Verify_Ipv6_Topology_Empty_5
407     [Documentation]    Verifies that example-ipv6-topology is empty after deconfiguring peer for the first time.
408     [Tags]    critical
409     Verify_Rib_Status_Empty
410
411 Stop_All_Exabgps_2
412     [Documentation]    Save exabgp logs as exaipv6.log, and stop exabgp with ctrl-c bash signal
413     BGPcliKeywords.Store_File_To_Workspace    ${EXABGP2_LOG}    ${EXABGP2_LOG}
414     ExaBgpLib.Stop_ExaBgp
415     ${Log_Content}    OperatingSystem.Get File    ${EXABGP2_LOG}
416     Log    ${Log_Content}
417
418 Reconfigure_ODL_To_Accept_Connections_6
419     [Documentation]    Configure BGP peer modules with initiate-connection set to false with short ipv6 address.
420     &{mapping}    Create Dictionary
421     ...    IP=${IPV6_IP}
422     ...    HOLDTIME=${HOLDTIME}
423     ...    PEER_PORT=${BGP_TOOL_PORT}
424     ...    INITIATE=false
425     ...    BGP_RIB=${RIB_INSTANCE}
426     ...    PASSIVE_MODE=true
427     ...    BGP_RIB_OPENCONFIG=${RIB_INSTANCE}
428     ...    RIB_INSTANCE_NAME=${RIB_INSTANCE}
429     TemplatedRequests.Put_As_Xml_Templated
430     ...    ${BGP_VAR_FOLDER}/graceful_restart
431     ...    mapping=${mapping}
432     ...    session=${CONFIG_SESSION}
433
434 Start_Exabgp_3
435     [Documentation]    Start exabgp with
436     [Tags]    critical
437     ${cmd}    BuiltIn.Set_Variable    ${EXABGP3_CFG} > ${EXABGP3_LOG}
438     ExaBgpLib.Start_ExaBgp_And_Verify_Connected    ${cmd}    ${CONFIG_SESSION}    ${EXABGP_ID}
439
440 Stop_All_Exabgps_3
441     [Documentation]    Save exabgp logs as exabgp_graceful_restart.log, and stop exabgp with ctrl-c bash signal
442     BGPcliKeywords.Store_File_To_Workspace    ${EXABGP3_LOG}    ${EXABGP3_LOG}
443     ExaBgpLib.Stop_ExaBgp
444     Sleep    40s
445     KarafKeywords.Fail If Exceptions Found During Test    ${SUITE_NAME}.${TEST_NAME}    fail=${True}
446
447 Start_Exabgp_4
448     [Documentation]    Start exabgp with
449     [Tags]    critical
450     ${cmd}    BuiltIn.Set_Variable    ${EXABGP3_CFG} > ${EXABGP3_LOG}
451     ExaBgpLib.Start_ExaBgp_And_Verify_Connected    ${cmd}    ${CONFIG_SESSION}    ${EXABGP_ID}
452
453 Delete_Bgp_Peer_Configuration_6
454     [Documentation]    Revert the BGP configuration to the original state: without any configured peers.
455     &{mapping}    Create Dictionary
456     ...    IP=${IPV6_IP}
457     ...    HOLDTIME=${HOLDTIME}
458     ...    PEER_PORT=${BGP_TOOL_PORT}
459     ...    INITIATE=false
460     ...    BGP_RIB=${RIB_INSTANCE}
461     ...    PASSIVE_MODE=true
462     ...    BGP_RIB_OPENCONFIG=${RIB_INSTANCE}
463     ...    RIB_INSTANCE_NAME=${RIB_INSTANCE}
464     TemplatedRequests.Delete_Templated
465     ...    ${BGP_VAR_FOLDER}/graceful_restart
466     ...    mapping=${mapping}
467     ...    session=${CONFIG_SESSION}
468
469 Stop_All_Exabgps_4
470     [Documentation]    Save exabgp logs as exabgp_graceful_restart.log, and stop exabgp with ctrl-c bash signal
471     BGPcliKeywords.Store_File_To_Workspace    ${EXABGP3_LOG}    ${EXABGP3_LOG}
472     ExaBgpLib.Stop_ExaBgp
473
474 Reconfigure_ODL_To_Accept_Connections_7
475     [Documentation]    Configure BGP peer modules with initiate-connection set to false with short ipv6 address.
476     [Tags]    exclude
477     &{mapping}    Create Dictionary
478     ...    IP=${IPV6_IP}
479     ...    HOLDTIME=${HOLDTIME}
480     ...    PEER_PORT=${BGP_TOOL_PORT}
481     ...    INITIATE=false
482     ...    BGP_RIB=${RIB_INSTANCE}
483     ...    PASSIVE_MODE=true
484     ...    BGP_RIB_OPENCONFIG=${RIB_INSTANCE}
485     ...    RIB_INSTANCE_NAME=${RIB_INSTANCE}
486     TemplatedRequests.Put_As_Xml_Templated
487     ...    ${BGP_VAR_FOLDER}/bgp_peer
488     ...    mapping=${mapping}
489     ...    session=${CONFIG_SESSION}
490
491 Start_Exabgp_5
492     [Documentation]    Start exabgp with
493     [Tags]    exclude
494     ${cmd}    BuiltIn.Set_Variable    ${EXABGP4_CFG} > ${EXABGP4_LOG}
495     ExaBgpLib.Start_ExaBgp_And_Verify_Connected    ${cmd}    ${CONFIG_SESSION}    ${EXABGP_ID}
496
497 Delete_Bgp_Peer_Configuration_7
498     [Documentation]    Revert the BGP configuration to the original state: without any configured peers.
499     [Tags]    exclude
500     &{mapping}    Create Dictionary
501     ...    IP=${IPV6_IP}
502     ...    HOLDTIME=${HOLDTIME}
503     ...    PEER_PORT=${BGP_TOOL_PORT}
504     ...    INITIATE=false
505     ...    BGP_RIB=${RIB_INSTANCE}
506     ...    PASSIVE_MODE=true
507     ...    BGP_RIB_OPENCONFIG=${RIB_INSTANCE}
508     ...    RIB_INSTANCE_NAME=${RIB_INSTANCE}
509     TemplatedRequests.Delete_Templated    ${BGP_VAR_FOLDER}/bgp_peer    mapping=${mapping}    session=${CONFIG_SESSION}
510
511 Stop_All_Exabgps_5
512     [Documentation]    Save exabgp logs as exabgp_graceful_restart.log, and stop exabgp with ctrl-c bash signal
513     [Tags]    exclude
514     BGPcliKeywords.Store_File_To_Workspace    ${EXABGP4_LOG}    ${EXABGP4_LOG}
515     ExaBgpLib.Stop_ExaBgp
516
517
518 *** Keywords ***
519 Start_Suite
520     [Documentation]    Suite setup keyword.
521     SetupUtils.Setup_Utils_For_Setup_And_Teardown
522     ${conn_id}    SSHLibrary.Open Connection    ${ODL_SYSTEM_IP}    prompt=${DEFAULT_LINUX_PROMPT}    timeout=10s
523     Builtin.Set_Suite_Variable    ${conn_id}
524     SSHKeywords.Flexible_Controller_Login
525     Configure_Ipv6_Network
526     SSHKeywords.Virtual_Env_Create
527     SSHKeywords.Virtual_Env_Install_Package    setuptools==44.0.0
528     SSHKeywords.Virtual_Env_Install_Package    exabgp==4.2.4
529     RequestsLibrary.Create_Session    ${CONFIG_SESSION}    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}
530     Upload_Config_Files
531     Upload_Config_Files_exabgp_ipv4
532     Upload_Config_Files_exabgp_graceful_restart
533     Upload_Config_Files_Exabgp_AS_Value_Reconfigured
534
535 Stop_Suite
536     [Documentation]    Suite teardown keyword
537     SSHKeywords.Virtual_Env_Delete
538     SSHLibrary.Close_All_Connections
539     RequestsLibrary.Delete_All_Sessions
540     BuiltIn.Run Keyword And Ignore Error    ExaBgpLib.Stop_ExaBgp
541
542 Configure_Ipv6_Network
543     [Documentation]    Reconfigures basic network settings on controller
544     SSHLibrary.Execute_Command    sudo ip -6 addr add ${IPV6_IP}/${IPV6_PREFIX_LENGTH} dev eth0
545     SSHLibrary.Execute_Command    sudo ip -6 route add default via ${IPV6_IP_GW}
546     ${stdout}    SSHLibrary.Execute_Command    sudo ip -6 addr show
547     Log    ${stdout}
548     ${stdout}    SSHLibrary.Execute_Command    sudo ip -6 route show
549     Log    ${stdout}
550
551 Verify_Rib_Status_Empty
552     [Documentation]    Verifies that example-ipv6-topology is empty
553     BuiltIn.Wait_Until_Keyword_Succeeds
554     ...    5x
555     ...    2s
556     ...    TemplatedRequests.Get_As_Json_Templated
557     ...    ${BGP_VAR_FOLDER}/ipv6_topology_empty
558     ...    session=${CONFIG_SESSION}
559     ...    verify=True
560
561 Verify_Rib_Status_Filled
562     [Documentation]    Verifies that example-ipv6-topology is filled with ipv6 route
563     BuiltIn.Wait_Until_Keyword_Succeeds
564     ...    5x
565     ...    2s
566     ...    TemplatedRequests.Get_As_Json_Templated
567     ...    ${BGP_VAR_FOLDER}/ipv6_topology_filled
568     ...    session=${CONFIG_SESSION}
569     ...    verify=True
570
571 Upload_Config_Files
572     [Documentation]    Uploads exabgp config files
573     SSHLibrary.Put_File    ${BGP_VAR_FOLDER}/${EXABGP_CFG}    .
574     @{cfgfiles}    SSHLibrary.List_Files_In_Directory    .    *.cfg
575     FOR    ${cfgfile}    IN    @{cfgfiles}
576         SSHLibrary.Execute_Command    sed -i -e 's/EXABGPIP/${IPV6_IP}/g' ${cfgfile}
577         SSHLibrary.Execute_Command    sed -i -e 's/ODLIP/${CONTROLLER_IPV6}/g' ${cfgfile}
578         SSHLibrary.Execute_Command    sed -i -e 's/ROUTERID/${EXABGP_ID}/g' ${cfgfile}
579         SSHLibrary.Execute_Command    sed -i -e 's/ROUTEREFRESH/disable/g' ${cfgfile}
580         SSHLibrary.Execute_Command    sed -i -e 's/ADDPATH/disable/g' ${cfgfile}
581         ${stdout}    SSHLibrary.Execute_Command    cat ${cfgfile}
582         Log    ${stdout}
583     END
584
585 Upload_Config_Files_exabgp_ipv4
586     [Documentation]    Uploads exabgp config files
587     SSHLibrary.Put_File    ${BGP_VAR_FOLDER}/${EXABGP2_CFG}    .
588     @{cfgfiles}    SSHLibrary.List_Files_In_Directory    .    *ipv4.cfg
589     FOR    ${cfgfile}    IN    @{cfgfiles}
590         SSHLibrary.Execute_Command    sed -i -e 's/EXABGPIP/127.0.0.1/g' ${cfgfile}
591         SSHLibrary.Execute_Command    sed -i -e 's/ODLIP/${ODL_SYSTEM_IP}/g' ${cfgfile}
592         SSHLibrary.Execute_Command    sed -i -e 's/ROUTERID/127.0.0.1/g' ${cfgfile}
593         SSHLibrary.Execute_Command    sed -i -e 's/ROUTEREFRESH/disable/g' ${cfgfile}
594         SSHLibrary.Execute_Command    sed -i -e 's/ADDPATH/disable/g' ${cfgfile}
595         ${stdout}    SSHLibrary.Execute_Command    cat ${cfgfile}
596         Log    ${stdout}
597     END
598
599 Upload_Config_Files_exabgp_graceful_restart
600     [Documentation]    Uploads exabgp config files
601     SSHLibrary.Put_File    ${BGP_VAR_FOLDER}/${EXABGP3_CFG}    .
602     @{cfgfiles}    SSHLibrary.List_Files_In_Directory    .    *restart.cfg
603     FOR    ${cfgfile}    IN    @{cfgfiles}
604         SSHLibrary.Execute_Command    sed -i -e 's/EXABGPIP/${IPV6_IP}/g' ${cfgfile}
605         SSHLibrary.Execute_Command    sed -i -e 's/ODLIP/${CONTROLLER_IPV6}/g' ${cfgfile}
606         SSHLibrary.Execute_Command    sed -i -e 's/ROUTERID/${EXABGP_ID}/g' ${cfgfile}
607         SSHLibrary.Execute_Command    sed -i -e 's/ROUTEREFRESH/disable/g' ${cfgfile}
608         SSHLibrary.Execute_Command    sed -i -e 's/ADDPATH/disable/g' ${cfgfile}
609         ${stdout}    SSHLibrary.Execute_Command    cat ${cfgfile}
610         Log    ${stdout}
611     END
612
613 Upload_Config_Files_Exabgp_AS_Value_Reconfigured
614     [Documentation]    Uploads exabgp config files
615     SSHLibrary.Put_File    ${BGP_VAR_FOLDER}/${EXABGP4_CFG}    .
616     @{cfgfiles}    SSHLibrary.List_Files_In_Directory    .    *exa4.cfg
617     FOR    ${cfgfile}    IN    @{cfgfiles}
618         SSHLibrary.Execute_Command    sed -i -e 's/EXABGPIP/${IPV6_IP}/g' ${cfgfile}
619         SSHLibrary.Execute_Command    sed -i -e 's/ODLIP/${CONTROLLER_IPV6}/g' ${cfgfile}
620         SSHLibrary.Execute_Command    sed -i -e 's/ROUTERID/${EXABGP_ID}/g' ${cfgfile}
621         SSHLibrary.Execute_Command    sed -i -e 's/ROUTEREFRESH/disable/g' ${cfgfile}
622         SSHLibrary.Execute_Command    sed -i -e 's/ADDPATH/disable/g' ${cfgfile}
623         ${stdout}    SSHLibrary.Execute_Command    cat ${cfgfile}
624         Log    ${stdout}
625     END