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