Test with AS Number configured more than 65535
[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 Suite Setup       Start_Suite
19 Suite Teardown    Stop_Suite
20 Test Setup        SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
21 Library           RequestsLibrary
22 Library           SSHLibrary
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
31 Resource          ../../../libraries/KarafKeywords.robot
32
33 *** Variables ***
34 ${BGP_VAR_FOLDER}    ${CURDIR}/../../../variables/bgpfunctional/ipv6
35 ${CONFIG_SESSION}    config-session
36 ${CONTROLLER_IPV6}    ::1
37 ${EXABGP_ID}      1.2.3.4
38 ${EXABGP_ID_2}    127.0.0.1
39 ${EXABGP_CFG}     exaipv6.cfg
40 ${EXABGP_LOG}     exaipv6.log
41 ${EXABGP2_CFG}    exaipv4.cfg
42 ${EXABGP2_LOG}    exaipv4.log
43 ${EXABGP3_CFG}    exabgp_graceful_restart.cfg
44 ${EXABGP3_LOG}    exabgp_graceful_restart.log
45 ${EXABGP4_CFG}    exa4.cfg
46 ${EXABGP4_LOG}    exa4.log
47 ${IPV4_IP}        127.0.0.1
48 ${CONTROLLER_IPV4}    ${ODL_SYSTEM_IP}
49 ${IPV6_IP}        2607:f0d0:1002:0011:0000:0000:0000:0002
50 ${IPV6_IP_2}      2607:f0d0:1002:11:0:0:0:2
51 ${IPV6_IP_3}      2607:f0d0:1002:11::2
52 ${IPV6_IP_GW}     2607:f0d0:1002:0011:0000:0000:0000:0001
53 ${HOLDTIME}       180
54 ${RIB_INSTANCE}    example-bgp-rib
55
56 *** Test Cases ***
57 Reconfigure_ODL_To_Accept_Connections
58     [Documentation]    Configure BGP peer modules with initiate-connection set to false with short ipv6 address.
59     &{mapping}    Create Dictionary    IP=${IPV6_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}    INITIATE=false    BGP_RIB=${RIB_INSTANCE}
60     ...    PASSIVE_MODE=true    BGP_RIB_OPENCONFIG=${RIB_INSTANCE}    RIB_INSTANCE_NAME=${RIB_INSTANCE}
61     TemplatedRequests.Put_As_Xml_Templated    ${BGP_VAR_FOLDER}/bgp_peer    mapping=${mapping}    session=${CONFIG_SESSION}
62
63 Start_Exabgp
64     [Documentation]    Start exabgp with
65     [Tags]    critical
66     ${cmd}    BuiltIn.Set_Variable    ${EXABGP_CFG} > ${EXABGP_LOG}
67     ExaBgpLib.Start_ExaBgp_And_Verify_Connected    ${cmd}    ${CONFIG_SESSION}    ${EXABGP_ID}
68
69 Verify_Ipv6_Topology_Filled
70     [Documentation]    Verifies that example-ipv6-topology is filled after starting exabgp.
71     [Tags]    critical
72     Verify_Rib_Status_Filled
73
74 Delete_Bgp_Peer_Configuration
75     [Documentation]    Revert the BGP configuration to the original state: without any configured peers.
76     &{mapping}    Create Dictionary    IP=${IPV6_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}    INITIATE=false    BGP_RIB=${RIB_INSTANCE}
77     ...    PASSIVE_MODE=true    BGP_RIB_OPENCONFIG=${RIB_INSTANCE}    RIB_INSTANCE_NAME=${RIB_INSTANCE}
78     TemplatedRequests.Delete_Templated    ${BGP_VAR_FOLDER}/bgp_peer    mapping=${mapping}    session=${CONFIG_SESSION}
79
80 Verify_Ipv6_Topology_Empty
81     [Documentation]    Verifies that example-ipv6-topology is empty after deconfiguring peer for the first time.
82     [Tags]    critical
83     Verify_Rib_Status_Empty
84
85 Reconfigure_ODL_To_Accept_Connections_2
86     [Documentation]    Configure BGP peer modules with initiate-connection set to false with ipv6 address without "::" shortened version.
87     &{mapping}    Create Dictionary    IP=${IPV6_IP_2}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}    INITIATE=false    BGP_RIB=${RIB_INSTANCE}
88     ...    PASSIVE_MODE=true    BGP_RIB_OPENCONFIG=${RIB_INSTANCE}    RIB_INSTANCE_NAME=${RIB_INSTANCE}
89     TemplatedRequests.Put_As_Xml_Templated    ${BGP_VAR_FOLDER}/bgp_peer    mapping=${mapping}    session=${CONFIG_SESSION}
90
91 Verify_Ipv6_Topology_Filled_2
92     [Documentation]    Verifies that example-ipv6-topology is filled after configuring the peer for the second time.
93     [Tags]    critical
94     Verify_Rib_Status_Filled
95
96 Delete_Bgp_Peer_Configuration_2
97     [Documentation]    Revert the BGP configuration to the original state: without any configured peers.
98     &{mapping}    Create Dictionary    IP=${IPV6_IP_2}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}    INITIATE=false    BGP_RIB=${RIB_INSTANCE}
99     ...    PASSIVE_MODE=true    BGP_RIB_OPENCONFIG=${RIB_INSTANCE}    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_2
103     [Documentation]    Verifies that example-ipv6-topology is empty after deconfiguring peer for the second time.
104     [Tags]    critical
105     Verify_Rib_Status_Empty
106
107 Reconfigure_ODL_To_Accept_Connections_3
108     [Documentation]    Configure BGP peer modules with initiate-connection set to false with full text ipv6 address.
109     &{mapping}    Create Dictionary    IP=${IPV6_IP_3}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}    INITIATE=false    BGP_RIB=${RIB_INSTANCE}
110     ...    PASSIVE_MODE=true    BGP_RIB_OPENCONFIG=${RIB_INSTANCE}    RIB_INSTANCE_NAME=${RIB_INSTANCE}
111     TemplatedRequests.Put_As_Xml_Templated    ${BGP_VAR_FOLDER}/bgp_peer    mapping=${mapping}    session=${CONFIG_SESSION}
112
113 Verify_Ipv6_Topology_Filled_3
114     [Documentation]    Verifies that example-ipv6-topology is filled after configuring the peer for the third time.
115     [Tags]    critical
116     Verify_Rib_Status_Filled
117
118 Delete_Bgp_Peer_Configuration_3
119     [Documentation]    Revert the BGP configuration to the original state: without any configured peers.
120     &{mapping}    Create Dictionary    IP=${IPV6_IP_3}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}    INITIATE=false    BGP_RIB=${RIB_INSTANCE}
121     ...    PASSIVE_MODE=true    BGP_RIB_OPENCONFIG=${RIB_INSTANCE}    RIB_INSTANCE_NAME=${RIB_INSTANCE}
122     TemplatedRequests.Delete_Templated    ${BGP_VAR_FOLDER}/bgp_peer    mapping=${mapping}    session=${CONFIG_SESSION}
123
124 Verify_Ipv6_Topology_Empty_3
125     [Documentation]    Verifies that example-ipv6-topology is empty after final deconfiguration.
126     [Tags]    critical
127     Verify_Rib_Status_Empty
128
129 Stop_All_Exabgps
130     [Documentation]    Save exabgp logs as exaipv6.log, and stop exabgp with ctrl-c bash signal
131     BGPcliKeywords.Store_File_To_Workspace    ${EXABGP_LOG}    ${EXABGP_LOG}
132     ExaBgpLib.Stop_ExaBgp
133
134 Configure_App_Peer
135     [Documentation]    Configures bgp application peer.
136     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
137     &{mapping}    Create Dictionary    IP=127.0.0.12    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}    INITIATE=false    BGP_RIB=${RIB_INSTANCE}
138     ...    PASSIVE_MODE=true    BGP_RIB_OPENCONFIG=${RIB_INSTANCE}    RIB_INSTANCE_NAME=${RIB_INSTANCE}
139     TemplatedRequests.Put_As_Xml_Templated    ${BGP_VAR_FOLDER}/application_peer    mapping=${mapping}    session=${CONFIG_SESSION}
140
141 Reconfigure_ODL_To_Accept_Connections_4
142     [Documentation]    Configure BGP peer modules with initiate-connection set to false with short ipv6 address.
143     &{mapping}    Create Dictionary    IP=${IPV4_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}    INITIATE=false    BGP_RIB=${RIB_INSTANCE}
144     ...    PASSIVE_MODE=true    BGP_RIB_OPENCONFIG=${RIB_INSTANCE}    RIB_INSTANCE_NAME=${RIB_INSTANCE}
145     TemplatedRequests.Put_As_Xml_Templated    ${BGP_VAR_FOLDER}/bgp_neighbor_rib    mapping=${mapping}    session=${CONFIG_SESSION}
146     RequestsLibrary.Create Session    session    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}    headers=${HEADERS}    timeout=5
147
148 Start_Exabgp_2
149     [Documentation]    Start exabgp and Verify BGP connection
150     [Tags]    critical
151     ${cmd}    BuiltIn.Set_Variable    ${EXABGP2_CFG} > ${EXABGP2_LOG}
152     ExaBgpLib.Start_ExaBgp_And_Verify_Connected    ${cmd}    ${CONFIG_SESSION}    127.0.0.1
153
154 Inject_Ipv6_Route_1
155     [Documentation]    Inject the Ipv6 route from controller
156     &{mapping}    Create Dictionary    IP=127.0.0.12    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}    INITIATE=false    BGP_RIB=${RIB_INSTANCE}
157     ...    PASSIVE_MODE=true    BGP_RIB_OPENCONFIG=${RIB_INSTANCE}    RIB_INSTANCE_NAME=${RIB_INSTANCE}
158     TemplatedRequests.Post_As_Xml_Templated    ${BGP_VAR_FOLDER}/ipv6_route_injection    mapping=${mapping}    session=${CONFIG_SESSION}
159
160 Check_Ipv6_Prefix_In_Bgp_Rib_1
161     [Documentation]    Check for the presence of Ipv6 Prefix in the BGP RIB
162     &{mapping}    Create Dictionary    IP=${CONTROLLER_IPV4}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}    INITIATE=false    BGP_RIB=${RIB_INSTANCE}
163     ...    PASSIVE_MODE=true    BGP_RIB_OPENCONFIG=${RIB_INSTANCE}    RIB_INSTANCE_NAME=${RIB_INSTANCE}
164     BuiltIn.Wait_Until_Keyword_Succeeds    5x    2s    TemplatedRequests.Get_As_Json_Templated    ${BGP_VAR_FOLDER}/bgp_rib    session=${CONFIG_SESSION}    mapping=${mapping}
165
166 Delete_Injected_Ipv6_Routes_1
167     [Documentation]    Delete the injected IPV6 routes
168     &{mapping}    Create Dictionary    IP=127.0.0.12    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}    INITIATE=false    BGP_RIB=${RIB_INSTANCE}
169     ...    PASSIVE_MODE=true    BGP_RIB_OPENCONFIG=${RIB_INSTANCE}    RIB_INSTANCE_NAME=${RIB_INSTANCE}
170     TemplatedRequests.Delete_Templated    ${BGP_VAR_FOLDER}/ipv6_route_injection    mapping=${mapping}    session=${CONFIG_SESSION}
171     KarafKeywords.Fail If Exceptions Found During Test    ${SUITE_NAME}.${TEST_NAME}    fail=${True}
172
173 Delete_Bgp_Peer_Configuration_4
174     [Documentation]    Revert the BGP configuration to the original state: without any configured peers.
175     &{mapping}    Create Dictionary    IP=${IPV4_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}    INITIATE=false    BGP_RIB=${RIB_INSTANCE}
176     ...    PASSIVE_MODE=true    BGP_RIB_OPENCONFIG=${RIB_INSTANCE}    RIB_INSTANCE_NAME=${RIB_INSTANCE}
177     TemplatedRequests.Delete_Templated    ${BGP_VAR_FOLDER}/bgp_neighbor_rib    mapping=${mapping}    session=${CONFIG_SESSION}
178
179 Verify_Ipv6_Topology_Empty_4
180     [Documentation]    Verifies that example-ipv6-topology is empty after deconfiguring peer for the first time.
181     [Tags]    critical
182     Verify_Rib_Status_Empty
183
184 Reconfigure_ODL_To_Accept_Connections_5
185     [Documentation]    Configure BGP peer modules with initiate-connection set to false with short ipv6 address.
186     &{mapping}    Create Dictionary    IP=${IPV4_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}    INITIATE=false    BGP_RIB=${RIB_INSTANCE}
187     ...    PASSIVE_MODE=true    BGP_RIB_OPENCONFIG=${RIB_INSTANCE}    RIB_INSTANCE_NAME=${RIB_INSTANCE}
188     TemplatedRequests.Put_As_Xml_Templated    ${BGP_VAR_FOLDER}/bgp_peer    mapping=${mapping}    session=${CONFIG_SESSION}
189
190 Inject_Ipv6_Route_2
191     [Documentation]    Inject the Ipv6 route from controller
192     &{mapping}    Create Dictionary    IP=127.0.0.12    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}    INITIATE=false    BGP_RIB=${RIB_INSTANCE}
193     ...    PASSIVE_MODE=true    BGP_RIB_OPENCONFIG=${RIB_INSTANCE}    RIB_INSTANCE_NAME=${RIB_INSTANCE}
194     TemplatedRequests.Post_As_Xml_Templated    ${BGP_VAR_FOLDER}/ipv6_route_injection    mapping=${mapping}    session=${CONFIG_SESSION}
195
196 Check_Ipv6_Prefix_In_Bgp_Rib_2
197     [Documentation]    Check for the presence of Ipv6 Prefix in the BGP RIB
198     &{mapping}    Create Dictionary    IP=${CONTROLLER_IPV4}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}    INITIATE=false    BGP_RIB=${RIB_INSTANCE}
199     ...    PASSIVE_MODE=true    BGP_RIB_OPENCONFIG=${RIB_INSTANCE}    RIB_INSTANCE_NAME=${RIB_INSTANCE}
200     BuiltIn.Wait_Until_Keyword_Succeeds    5x    2s    TemplatedRequests.Get_As_Json_Templated    ${BGP_VAR_FOLDER}/bgp_rib    session=${CONFIG_SESSION}    mapping=${mapping}
201
202 Delete_Injected_Ipv6_Routes_2
203     [Documentation]    Delete the injected IPV6 routes
204     &{mapping}    Create Dictionary    IP=127.0.0.12    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}    INITIATE=false    BGP_RIB=${RIB_INSTANCE}
205     ...    PASSIVE_MODE=true    BGP_RIB_OPENCONFIG=${RIB_INSTANCE}    RIB_INSTANCE_NAME=${RIB_INSTANCE}
206     TemplatedRequests.Delete_Templated    ${BGP_VAR_FOLDER}/ipv6_route_injection    mapping=${mapping}    session=${CONFIG_SESSION}
207     KarafKeywords.Fail If Exceptions Found During Test    ${SUITE_NAME}.${TEST_NAME}    fail=${True}
208
209 Delete_App_Peer
210     [Documentation]    Deletes bgp application peer.
211     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
212     &{mapping}    Create Dictionary    IP=127.0.0.12    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}    INITIATE=false    BGP_RIB=${RIB_INSTANCE}
213     ...    PASSIVE_MODE=true    BGP_RIB_OPENCONFIG=${RIB_INSTANCE}    RIB_INSTANCE_NAME=${RIB_INSTANCE}
214     TemplatedRequests.Delete_Templated    ${BGP_VAR_FOLDER}/application_peer    mapping=${mapping}    session=${CONFIG_SESSION}
215
216 Delete_Bgp_Peer_Configuration_5
217     [Documentation]    Revert the BGP configuration to the original state: without any configured peers.
218     &{mapping}    Create Dictionary    IP=${IPV4_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}    INITIATE=false    BGP_RIB=${RIB_INSTANCE}
219     ...    PASSIVE_MODE=true    BGP_RIB_OPENCONFIG=${RIB_INSTANCE}    RIB_INSTANCE_NAME=${RIB_INSTANCE}
220     TemplatedRequests.Delete_Templated    ${BGP_VAR_FOLDER}/bgp_peer    mapping=${mapping}    session=${CONFIG_SESSION}
221
222 Verify_Ipv6_Topology_Empty_5
223     [Documentation]    Verifies that example-ipv6-topology is empty after deconfiguring peer for the first time.
224     [Tags]    critical
225     Verify_Rib_Status_Empty
226
227 Stop_All_Exabgps_2
228     [Documentation]    Save exabgp logs as exaipv6.log, and stop exabgp with ctrl-c bash signal
229     BGPcliKeywords.Store_File_To_Workspace    ${EXABGP2_LOG}    ${EXABGP2_LOG}
230     ExaBgpLib.Stop_ExaBgp
231     ${Log_Content}    OperatingSystem.Get File    ${EXABGP2_LOG}
232     Log    ${Log_Content}
233
234 Reconfigure_ODL_To_Accept_Connections_6
235     [Documentation]    Configure BGP peer modules with initiate-connection set to false with short ipv6 address.
236     &{mapping}    Create Dictionary    IP=${IPV6_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}    INITIATE=false    BGP_RIB=${RIB_INSTANCE}
237     ...    PASSIVE_MODE=true    BGP_RIB_OPENCONFIG=${RIB_INSTANCE}    RIB_INSTANCE_NAME=${RIB_INSTANCE}
238     TemplatedRequests.Put_As_Xml_Templated    ${BGP_VAR_FOLDER}/graceful_restart    mapping=${mapping}    session=${CONFIG_SESSION}
239
240 Start_Exabgp_3
241     [Documentation]    Start exabgp with
242     [Tags]    critical
243     ${cmd}    BuiltIn.Set_Variable    ${EXABGP3_CFG} > ${EXABGP3_LOG}
244     ExaBgpLib.Start_ExaBgp_And_Verify_Connected    ${cmd}    ${CONFIG_SESSION}    ${EXABGP_ID}
245
246 Stop_All_Exabgps_3
247     [Documentation]    Save exabgp logs as exabgp_graceful_restart.log, and stop exabgp with ctrl-c bash signal
248     BGPcliKeywords.Store_File_To_Workspace    ${EXABGP3_LOG}    ${EXABGP3_LOG}
249     ExaBgpLib.Stop_ExaBgp
250     Sleep    40s
251     KarafKeywords.Fail If Exceptions Found During Test    ${SUITE_NAME}.${TEST_NAME}    fail=${True}
252
253 Start_Exabgp_4
254     [Documentation]    Start exabgp with
255     [Tags]    critical
256     ${cmd}    BuiltIn.Set_Variable    ${EXABGP3_CFG} > ${EXABGP3_LOG}
257     ExaBgpLib.Start_ExaBgp_And_Verify_Connected    ${cmd}    ${CONFIG_SESSION}    ${EXABGP_ID}
258
259 Delete_Bgp_Peer_Configuration_6
260     [Documentation]    Revert the BGP configuration to the original state: without any configured peers.
261     &{mapping}    Create Dictionary    IP=${IPV6_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}    INITIATE=false    BGP_RIB=${RIB_INSTANCE}
262     ...    PASSIVE_MODE=true    BGP_RIB_OPENCONFIG=${RIB_INSTANCE}    RIB_INSTANCE_NAME=${RIB_INSTANCE}
263     TemplatedRequests.Delete_Templated    ${BGP_VAR_FOLDER}/graceful_restart    mapping=${mapping}    session=${CONFIG_SESSION}
264
265 Stop_All_Exabgps_4
266     [Documentation]    Save exabgp logs as exabgp_graceful_restart.log, and stop exabgp with ctrl-c bash signal
267     BGPcliKeywords.Store_File_To_Workspace    ${EXABGP3_LOG}    ${EXABGP3_LOG}
268     ExaBgpLib.Stop_ExaBgp
269
270 Reconfigure_ODL_To_Accept_Connections_7
271     [Documentation]    Configure BGP peer modules with initiate-connection set to false with short ipv6 address.
272     &{mapping}    Create Dictionary    IP=${IPV6_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}    INITIATE=false    BGP_RIB=${RIB_INSTANCE}
273     ...    PASSIVE_MODE=true    BGP_RIB_OPENCONFIG=${RIB_INSTANCE}    RIB_INSTANCE_NAME=${RIB_INSTANCE}
274     TemplatedRequests.Put_As_Xml_Templated    ${BGP_VAR_FOLDER}/bgp_peer    mapping=${mapping}    session=${CONFIG_SESSION}
275
276 Start_Exabgp_5
277     [Documentation]    Start exabgp with
278     [Tags]    critical
279     ${cmd}    BuiltIn.Set_Variable    ${EXABGP4_CFG} > ${EXABGP4_LOG}
280     ExaBgpLib.Start_ExaBgp_And_Verify_Connected    ${cmd}    ${CONFIG_SESSION}    ${EXABGP_ID}
281
282 Delete_Bgp_Peer_Configuration_7
283     [Documentation]    Revert the BGP configuration to the original state: without any configured peers.
284     &{mapping}    Create Dictionary    IP=${IPV6_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}    INITIATE=false    BGP_RIB=${RIB_INSTANCE}
285     ...    PASSIVE_MODE=true    BGP_RIB_OPENCONFIG=${RIB_INSTANCE}    RIB_INSTANCE_NAME=${RIB_INSTANCE}
286     TemplatedRequests.Delete_Templated    ${BGP_VAR_FOLDER}/bgp_peer    mapping=${mapping}    session=${CONFIG_SESSION}
287
288 Stop_All_Exabgps_5
289     [Documentation]    Save exabgp logs as exabgp_graceful_restart.log, and stop exabgp with ctrl-c bash signal
290     BGPcliKeywords.Store_File_To_Workspace    ${EXABGP4_LOG}    ${EXABGP4_LOG}
291     ExaBgpLib.Stop_ExaBgp
292
293 *** Keywords ***
294 Start_Suite
295     [Documentation]    Suite setup keyword.
296     SetupUtils.Setup_Utils_For_Setup_And_Teardown
297     ${conn_id}=    SSHLibrary.Open Connection    ${ODL_SYSTEM_IP}    prompt=${DEFAULT_LINUX_PROMPT}    timeout=10s
298     Builtin.Set_Suite_Variable    ${conn_id}
299     SSHKeywords.Flexible_Controller_Login
300     Configure_Ipv6_Network
301     SSHKeywords.Virtual_Env_Create
302     SSHKeywords.Virtual_Env_Install_Package    setuptools==44.0.0
303     SSHKeywords.Virtual_Env_Install_Package    exabgp==4.2.4
304     RequestsLibrary.Create_Session    ${CONFIG_SESSION}    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}
305     Upload_Config_Files
306     Upload_Config_Files_exabgp_ipv4
307     Upload_Config_Files_exabgp_graceful_restart
308     Upload_Config_Files_Exabgp_AS_Value_Reconfigured
309
310 Stop_Suite
311     [Documentation]    Suite teardown keyword
312     SSHKeywords.Virtual_Env_Delete
313     SSHLibrary.Close_All_Connections
314     RequestsLibrary.Delete_All_Sessions
315     BuiltIn.Run Keyword And Ignore Error    ExaBgpLib.Stop_ExaBgp
316
317 Configure_Ipv6_Network
318     [Documentation]    Reconfigures basic network settings on controller
319     SSHLibrary.Execute_Command    sudo sh -c 'echo "NETWORKING_IPV6=yes" >> /etc/sysconfig/network'
320     SSHLibrary.Execute_Command    sudo sh -c 'echo "IPV6INIT=yes" >> /etc/sysconfig/network-scripts/ifcfg-eth0'
321     SSHLibrary.Execute_Command    sudo sh -c 'echo "IPV6ADDR=${IPV6_IP}" >> /etc/sysconfig/network-scripts/ifcfg-eth0'
322     SSHLibrary.Execute_Command    sudo sh -c 'echo "IPV6_DEFAULTGW=${IPV6_IP_GW}" >> /etc/sysconfig/network-scripts/ifcfg-eth0'
323     SSHLibrary.Execute_Command    sudo /etc/init.d/network restart
324
325 Verify_Rib_Status_Empty
326     [Documentation]    Verifies that example-ipv6-topology is empty
327     BuiltIn.Wait_Until_Keyword_Succeeds    5x    2s    TemplatedRequests.Get_As_Json_Templated    ${BGP_VAR_FOLDER}/ipv6_topology_empty    session=${CONFIG_SESSION}    verify=True
328
329 Verify_Rib_Status_Filled
330     [Documentation]    Verifies that example-ipv6-topology is filled with ipv6 route
331     BuiltIn.Wait_Until_Keyword_Succeeds    5x    2s    TemplatedRequests.Get_As_Json_Templated    ${BGP_VAR_FOLDER}/ipv6_topology_filled    session=${CONFIG_SESSION}    verify=True
332
333 Upload_Config_Files
334     [Documentation]    Uploads exabgp config files
335     SSHLibrary.Put_File    ${BGP_VAR_FOLDER}/${EXABGP_CFG}    .
336     @{cfgfiles}=    SSHLibrary.List_Files_In_Directory    .    *.cfg
337     FOR    ${cfgfile}    IN    @{cfgfiles}
338         SSHLibrary.Execute_Command    sed -i -e 's/EXABGPIP/${IPV6_IP}/g' ${cfgfile}
339         SSHLibrary.Execute_Command    sed -i -e 's/ODLIP/${CONTROLLER_IPV6}/g' ${cfgfile}
340         SSHLibrary.Execute_Command    sed -i -e 's/ROUTERID/${EXABGP_ID}/g' ${cfgfile}
341         SSHLibrary.Execute_Command    sed -i -e 's/ROUTEREFRESH/disable/g' ${cfgfile}
342         SSHLibrary.Execute_Command    sed -i -e 's/ADDPATH/disable/g' ${cfgfile}
343         ${stdout}=    SSHLibrary.Execute_Command    cat ${cfgfile}
344         Log    ${stdout}
345     END
346
347 Upload_Config_Files_exabgp_ipv4
348     [Documentation]    Uploads exabgp config files
349     SSHLibrary.Put_File    ${BGP_VAR_FOLDER}/${EXABGP2_CFG}    .
350     @{cfgfiles}=    SSHLibrary.List_Files_In_Directory    .    *ipv4.cfg
351     FOR    ${cfgfile}    IN    @{cfgfiles}
352         SSHLibrary.Execute_Command    sed -i -e 's/EXABGPIP/127.0.0.1/g' ${cfgfile}
353         SSHLibrary.Execute_Command    sed -i -e 's/ODLIP/${ODL_SYSTEM_IP}/g' ${cfgfile}
354         SSHLibrary.Execute_Command    sed -i -e 's/ROUTERID/127.0.0.1/g' ${cfgfile}
355         SSHLibrary.Execute_Command    sed -i -e 's/ROUTEREFRESH/disable/g' ${cfgfile}
356         SSHLibrary.Execute_Command    sed -i -e 's/ADDPATH/disable/g' ${cfgfile}
357         ${stdout}=    SSHLibrary.Execute_Command    cat ${cfgfile}
358         Log    ${stdout}
359     END
360
361 Upload_Config_Files_exabgp_graceful_restart
362     [Documentation]    Uploads exabgp config files
363     SSHLibrary.Put_File    ${BGP_VAR_FOLDER}/${EXABGP3_CFG}    .
364     @{cfgfiles}=    SSHLibrary.List_Files_In_Directory    .    *restart.cfg
365     FOR    ${cfgfile}    IN    @{cfgfiles}
366         SSHLibrary.Execute_Command    sed -i -e 's/EXABGPIP/${IPV6_IP}/g' ${cfgfile}
367         SSHLibrary.Execute_Command    sed -i -e 's/ODLIP/${CONTROLLER_IPV6}/g' ${cfgfile}
368         SSHLibrary.Execute_Command    sed -i -e 's/ROUTERID/${EXABGP_ID}/g' ${cfgfile}
369         SSHLibrary.Execute_Command    sed -i -e 's/ROUTEREFRESH/disable/g' ${cfgfile}
370         SSHLibrary.Execute_Command    sed -i -e 's/ADDPATH/disable/g' ${cfgfile}
371         ${stdout}=    SSHLibrary.Execute_Command    cat ${cfgfile}
372         Log    ${stdout}
373     END
374
375 Upload_Config_Files_Exabgp_AS_Value_Reconfigured
376     [Documentation]    Uploads exabgp config files
377     SSHLibrary.Put_File    ${BGP_VAR_FOLDER}/${EXABGP4_CFG}    .
378     @{cfgfiles}=    SSHLibrary.List_Files_In_Directory    .    *exa4.cfg
379     FOR    ${cfgfile}    IN    @{cfgfiles}
380         SSHLibrary.Execute_Command    sed -i -e 's/EXABGPIP/${IPV6_IP}/g' ${cfgfile}
381         SSHLibrary.Execute_Command    sed -i -e 's/ODLIP/${CONTROLLER_IPV6}/g' ${cfgfile}
382         SSHLibrary.Execute_Command    sed -i -e 's/ROUTERID/${EXABGP_ID}/g' ${cfgfile}
383         SSHLibrary.Execute_Command    sed -i -e 's/ROUTEREFRESH/disable/g' ${cfgfile}
384         SSHLibrary.Execute_Command    sed -i -e 's/ADDPATH/disable/g' ${cfgfile}
385         ${stdout}=    SSHLibrary.Execute_Command    cat ${cfgfile}
386         Log    ${stdout}
387     END