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