Fix tox errors
[integration/test.git] / csit / suites / bgpcep / bgpuser / basic.robot
1 *** Settings ***
2 Documentation     Basic tests for odl-bgpcep-bgp-all feature.
3 ...
4 ...               Copyright (c) 2015 Cisco Systems, Inc. and others. 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 ...               Test suite performs basic BGP functional test cases:
11 ...               BGP peer initiated connection
12 ...               - introduce and check 3 prefixes in one update message
13 ...               ODL controller initiated connection:
14 ...               - introduce and check 3 prefixes in one update message
15 ...               - introduce 2 prefixes in first update message and then additional 2 prefixes
16 ...               in another update while the very first prefix is withdrawn
17 ...               - introduce 3 prefixes and try to withdraw the first one
18 ...               (to be ignored by controller) in a single update message
19 ...
20 ...               For versions Oxygen and above, there are TC_R (test case reset) which
21 ...               test session-reset functionality.
22 ...               Resets the session, and than verifies that example-ipv4-topology is empty again.
23 ...
24 ...               For versions Fluorine and above, there are test cases:
25 ...               TC_LA (test case local address)
26 ...               test configuration of internal peer with local-address configured
27 ...               - configure peer with local-address and connect bgp-speaker to it
28 ...               with tools_system_ip
29 ...               - check filled topology
30 ...
31 ...               TC_PG (test case peer group) which
32 ...               tests configuration and reconfiguration of peer-groups and neighbors configured by them.
33 ...               - configure peer-group, and assign neighbor to this peer-group
34 ...               - check filled topology
35 ...               - reconfigure peer-group without ipv4 unicast afi-safi
36 ...               - check empty topology
37 ...               - reconfigre neighbor without peer-group, delete peer-group
38 ...
39 ...               Brief description how to perform BGP functional test:
40 ...               https://wiki.opendaylight.org/view/BGP_LS_PCEP:Lithium_Feature_Tests#How_to_test_2
41 Suite Setup       Setup_Everything
42 Suite Teardown    Teardown_Everything
43 Test Setup        SetupUtils.Setup_Test_With_Logging_And_Fast_Failing
44 Test Teardown     FailFast.Start_Failing_Fast_If_This_Failed
45 Library           OperatingSystem
46 Library           SSHLibrary    timeout=10s
47 Library           RequestsLibrary
48 Resource          ../../../libraries/BGPcliKeywords.robot
49 Resource          ../../../libraries/BGPSpeaker.robot
50 Resource          ../../../libraries/CompareStream.robot
51 Resource          ../../../libraries/FailFast.robot
52 Resource          ../../../libraries/KarafKeywords.robot
53 Resource          ../../../libraries/KillPythonTool.robot
54 Resource          ../../../libraries/SetupUtils.robot
55 Resource          ../../../libraries/SSHKeywords.robot
56 Resource          ../../../libraries/TemplatedRequests.robot
57 Resource          ../../../variables/Variables.robot
58 Resource          ../../../libraries/WaitForFailure.robot
59
60 *** Variables ***
61 ${BGP_PEER_NAME}    example-bgp-peer
62 ${BGP_TOOL_LOG_LEVEL}    info
63 ${BGP_VARIABLES_FOLDER}    ${CURDIR}/../../../variables/bgpuser/
64 ${CONFIG_SESSION}    session
65 ${DEVICE_NAME}    controller-config
66 ${HOLDTIME}       180
67 ${ODL_BGP_LOG_LEVEL}    DEFAULT
68 ${ODL_LOG_LEVEL}    INFO
69 ${PEER_GROUP}     internal-neighbors
70 ${RIB_NAME}       example-bgp-rib
71 ${TOOLS_SYSTEM_PROMPT}    ${DEFAULT_LINUX_PROMPT}
72
73 *** Test Cases ***
74 Check_For_Empty_Topology_Before_Talking
75     [Documentation]    Sanity check example-ipv4-topology is up but empty.
76     [Tags]    critical
77     Wait_For_Topology_To_Change_To    empty_topology    timeout=180s
78
79 TC_LA_Reconfigure_Odl_To_Initiate_Connection
80     [Documentation]    Configure ibgp peer with local-address.
81     CompareStream.Run_Keyword_If_Less_Than_Fluorine    BuiltIn.Pass_Execution    Test case valid only for versions fluorine and above.
82     &{mapping}    Create Dictionary    IP=${TOOLS_SYSTEM_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}    PASSIVE_MODE=false    BGP_RIB_OPENCONFIG=${RIB_NAME}
83     ...    LOCAL=${ODL_SYSTEM_IP}
84     TemplatedRequests.Put_As_Xml_Templated    ${BGP_VARIABLES_FOLDER}${/}ibgp_local_address    mapping=${mapping}    session=${CONFIG_SESSION}
85     [Teardown]    SetupUtils.Teardown_Test_Show_Bugs_If_Test_Failed
86
87 TC_LA_Start_Bgp_Speaker_And_Verify_Connected
88     [Documentation]    Verify that peer is present in odl's rib under local-address ip.
89     [Tags]    critical
90     CompareStream.Run_Keyword_If_Less_Than_Fluorine    BuiltIn.Pass_Execution    Test case valid only for versions fluorine and above.
91     ${speaker_args}    BuiltIn.Set_Variable    --amount 3 --listen --myip=${TOOLS_SYSTEM_IP} --myport=${BGP_TOOL_PORT} --peerip=${ODL_SYSTEM_IP} --debug
92     ${output}    BGPSpeaker.Start_BGP_Speaker_And_Verify_Connected    ${speaker_args}    session=${CONFIG_SESSION}    speaker_ip=${TOOLS_SYSTEM_IP}
93     BuiltIn.Log    ${output}
94
95 TC_LA_Kill_Bgp_Speaker
96     [Documentation]    Abort the Python speaker. Also, attempt to stop failing fast.
97     [Tags]    critical
98     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
99     CompareStream.Run_Keyword_If_Less_Than_Fluorine    BuiltIn.Pass_Execution    Test case valid only for versions fluorine and above.
100     BGPSpeaker.Kill_BGP_Speaker
101     FailFast.Do_Not_Fail_Fast_From_Now_On
102     # NOTE: It is still possible to remain failing fast, if both previous and this test have failed.
103     [Teardown]    FailFast.Do_Not_Start_Failing_If_This_Failed
104
105 TC_LA_Delete_Bgp_Peer_Configuration
106     [Documentation]    Delete peer configuration.
107     CompareStream.Run_Keyword_If_Less_Than_Fluorine    BuiltIn.Pass_Execution    Test case valid only for versions fluorine and above.
108     &{mapping}    Create Dictionary    IP=${TOOLS_SYSTEM_IP}    BGP_RIB_OPENCONFIG=${RIB_NAME}
109     TemplatedRequests.Delete_Templated    ${BGP_VARIABLES_FOLDER}${/}ibgp_local_address    mapping=${mapping}    session=${CONFIG_SESSION}
110
111 Reconfigure_ODL_To_Accept_Connection
112     [Documentation]    Configure BGP peer module with initiate-connection set to false.
113     &{mapping}    Create Dictionary    DEVICE_NAME=${DEVICE_NAME}    BGP_NAME=${BGP_PEER_NAME}    IP=${TOOLS_SYSTEM_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}
114     ...    INITIATE=false    BGP_RIB=${RIB_NAME}    PASSIVE_MODE=true    BGP_RIB_OPENCONFIG=${RIB_NAME}
115     TemplatedRequests.Put_As_Xml_Templated    ${BGP_VARIABLES_FOLDER}${/}bgp_peer    mapping=${mapping}    session=${CONFIG_SESSION}
116     [Teardown]    SetupUtils.Teardown_Test_Show_Bugs_If_Test_Failed
117
118 Start_Talking_BGP_speaker
119     [Documentation]    Start Python speaker to connect to ODL, verify that the tool does not promptly exit.
120     # Myport value is needed for checking whether connection at precise port was established.
121     BGPSpeaker.Start_BGP_Speaker    --amount 3 --myip=${TOOLS_SYSTEM_IP} --myport=${BGP_TOOL_PORT} --peerip=${ODL_SYSTEM_IP} --peerport=${ODL_BGP_PORT} --${BGP_TOOL_LOG_LEVEL}
122     Read_And_Fail_If_Prompt_Is_Seen
123
124 Check_Talking_Connection_Is_Established
125     [Documentation]    See TCP (BGP) connection in established state.
126     # This case is separate from the previous one, to resemble structure of the second half of this suite more closely.
127     Check_Speaker_Is_Connected
128
129 Check_Talking_Topology_Is_Filled
130     [Documentation]    See new routes in example-ipv4-topology as a proof that synchronization was correct.
131     [Tags]    critical
132     Wait_For_Topology_To_Change_To    filled_topology
133
134 TC_R_Reset_Bgp_Peer_Session
135     [Documentation]    Reset Peer Session
136     [Tags]    Critical
137     CompareStream.Run_Keyword_If_Less_Than_Oxygen    BuiltIn.Pass_Execution    Test case valid only for versions oxygen and above.
138     &{mapping}    Create Dictionary    IP=${TOOLS_SYSTEM_IP}    RIB_INSTANCE_NAME=${RIB_NAME}
139     TemplatedRequests.Post_As_Xml_Templated    folder=${BGP_VARIABLES_FOLDER}${/}peer_session/restart    mapping=${mapping}    session=${CONFIG_SESSION}
140
141 TC_R_Check_For_Empty_Topology_After_Resetting
142     [Documentation]    See example-ipv4-topology empty after resetting session
143     [Tags]    critical
144     CompareStream.Run_Keyword_If_Less_Than_Oxygen    BuiltIn.Pass_Execution    Test case valid only for versions oxygen and above.
145     Wait_For_Topology_To_Change_To    empty_topology
146
147 TC_PG_Reconfigure_ODL_With_Peer_Group_To_Accept_Connection
148     [Documentation]    Configure BGP peer module with initiate-connection set to false.
149     CompareStream.Run_Keyword_If_Less_Than_Fluorine    BuiltIn.Pass_Execution    Test case valid only for versions fluorine and above.
150     &{mapping}    BuiltIn.Create_Dictionary    DEVICE_NAME=${DEVICE_NAME}    BGP_NAME=${BGP_PEER_NAME}    IP=${TOOLS_SYSTEM_IP}    BGP_RIB_OPENCONFIG=${RIB_NAME}
151     TemplatedRequests.Delete_Templated    ${BGP_VARIABLES_FOLDER}${/}bgp_peer    mapping=${mapping}    session=${CONFIG_SESSION}
152     Configure_Peer_Group
153     &{mapping}    Create Dictionary    DEVICE_NAME=${DEVICE_NAME}    BGP_NAME=${BGP_PEER_NAME}    IP=${TOOLS_SYSTEM_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}
154     ...    PEER_GROUP_NAME=${PEER_GROUP}    INITIATE=false    BGP_RIB=${RIB_NAME}    PASSIVE_MODE=true    BGP_RIB_OPENCONFIG=${RIB_NAME}
155     TemplatedRequests.Put_As_Xml_Templated    ${BGP_VARIABLES_FOLDER}${/}bgp_peer_group    mapping=${mapping}    session=${CONFIG_SESSION}
156     [Teardown]    SetupUtils.Teardown_Test_Show_Bugs_If_Test_Failed
157
158 TC_PG_Restart_Talking_BGP_Speaker
159     [Documentation]    Abort the Python speaker. Also, attempt to stop failing fast.
160     [Tags]    critical
161     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
162     CompareStream.Run_Keyword_If_Less_Than_Fluorine    BuiltIn.Pass_Execution    Test case valid only for versions fluorine and above.
163     Restart_Talking_BGP_Speaker
164     [Teardown]    FailFast.Do_Not_Start_Failing_If_This_Failed
165
166 TC_PG_Check_Talking_Topology_Is_Filled
167     [Documentation]    See new routes in example-ipv4-topology as a proof that synchronization was correct.
168     [Tags]    critical
169     CompareStream.Run_Keyword_If_Less_Than_Fluorine    BuiltIn.Pass_Execution    Test case valid only for versions fluorine and above.
170     Wait_For_Topology_To_Change_To    filled_topology
171
172 TC_PG_Reconfigure_ODL_With_Peer_Group_Without_Ipv4_Unicast
173     [Documentation]    Configure BGP peer module with initiate-connection set to false. (Fluorine only)
174     CompareStream.Run_Keyword_If_Less_Than_Fluorine    BuiltIn.Pass_Execution    Test case valid only for versions fluorine and above.
175     Configure_Peer_Group    peer_group_folder=peer_group_without_ipv4
176     [Teardown]    SetupUtils.Teardown_Test_Show_Bugs_If_Test_Failed
177
178 TC_PG_Check_For_Empty_Topology_After_Deconfiguration
179     [Documentation]    See example-ipv4-topology empty after resetting session (Fluorine only)
180     [Tags]    critical
181     CompareStream.Run_Keyword_If_Less_Than_Fluorine    BuiltIn.Pass_Execution    Test case valid only for versions fluorine and above.
182     Wait_For_Topology_To_Change_To    empty_topology
183
184 TC_PG_Reconfigure_ODL_To_Accept_Connection
185     [Documentation]    Configure BGP peer module with initiate-connection set to false. (Fluorine only)
186     CompareStream.Run_Keyword_If_Less_Than_Fluorine    BuiltIn.Pass_Execution    Test case valid only for versions fluorine and above.
187     &{mapping}    Create Dictionary    DEVICE_NAME=${DEVICE_NAME}    BGP_NAME=${BGP_PEER_NAME}    IP=${TOOLS_SYSTEM_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}
188     ...    PEER_GROUP_NAME=${PEER_GROUP}    INITIATE=false    BGP_RIB=${RIB_NAME}    PASSIVE_MODE=true    BGP_RIB_OPENCONFIG=${RIB_NAME}
189     TemplatedRequests.Delete_Templated    ${BGP_VARIABLES_FOLDER}${/}bgp_peer_group    mapping=${mapping}    session=${CONFIG_SESSION}
190     TemplatedRequests.Put_As_Xml_Templated    ${BGP_VARIABLES_FOLDER}${/}bgp_peer    mapping=${mapping}    session=${CONFIG_SESSION}
191     Deconfigure_Peer_Group
192     [Teardown]    SetupUtils.Teardown_Test_Show_Bugs_If_Test_Failed
193
194 Kill_Talking_BGP_Speaker
195     [Documentation]    Abort the Python speaker. Also, attempt to stop failing fast.
196     [Tags]    critical
197     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
198     BGPSpeaker.Kill_BGP_Speaker
199     FailFast.Do_Not_Fail_Fast_From_Now_On
200     # NOTE: It is still possible to remain failing fast, if both previous and this test have failed.
201     [Teardown]    FailFast.Do_Not_Start_Failing_If_This_Failed
202
203 Check_For_Empty_Topology_After_Talking
204     [Documentation]    See example-ipv4-topology empty again.
205     [Tags]    critical
206     Wait_For_Topology_To_Change_To    empty_topology
207
208 Start_Listening_BGP_Speaker
209     [Documentation]    Start Python speaker in listening mode, verify that the tool does not exit quickly.
210     BGPSpeaker.Start_BGP_Speaker    --amount 3 --listen --myip=${TOOLS_SYSTEM_IP} --myport=${BGP_TOOL_PORT} --peerip=${ODL_SYSTEM_IP} --${BGP_TOOL_LOG_LEVEL}
211     Read_And_Fail_If_Prompt_Is_Seen
212
213 Check_Listening_Connection_Is_Not_Established_Yet
214     [Documentation]    See no TCP connection, as both ODL and tool are in listening mode.
215     Check_Speaker_Is_Not_Connected
216
217 Check_For_Empty_Topology_Before_Listening
218     [Documentation]    Sanity check example-ipv4-topology is still empty.
219     [Tags]    critical
220     Verify_That_Topology_Does_Not_Change_From    empty_topology
221
222 Reconfigure_ODL_To_Initiate_Connection
223     [Documentation]    Replace BGP peer config module, now with initiate-connection set to true.
224     &{mapping}    Create Dictionary    DEVICE_NAME=${DEVICE_NAME}    BGP_NAME=${BGP_PEER_NAME}    IP=${TOOLS_SYSTEM_IP}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}
225     ...    INITIATE=true    BGP_RIB=${RIB_NAME}    PASSIVE_MODE=false    BGP_RIB_OPENCONFIG=${RIB_NAME}
226     TemplatedRequests.Put_As_Xml_Templated    ${BGP_VARIABLES_FOLDER}${/}bgp_peer    mapping=${mapping}    session=${CONFIG_SESSION}
227
228 Check_Listening_Connection_Is_Established
229     [Documentation]    See TCP (BGP) connection in established state.
230     Check_Speaker_Is_Connected
231
232 Check_Listening_Topology_Is_Filled
233     [Documentation]    See new routes in example-ipv4-topology as a proof that synchronization was correct.
234     [Tags]    critical
235     Wait_For_Topology_To_Change_To    filled_topology
236
237 Kill_Listening_BGP_Speaker
238     [Documentation]    Abort the Python speaker. Also, attempt to stop failing fast.
239     [Tags]    critical
240     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
241     BGPSpeaker.Kill_BGP_Speaker
242     FailFast.Do_Not_Fail_Fast_From_Now_On
243     # NOTE: It is still possible to remain failing fast, if both previous and this test have failed.
244     [Teardown]    FailFast.Do_Not_Start_Failing_If_This_Failed
245
246 Check_For_Empty_Topology_After_Listening
247     [Documentation]    Post-condition: Check example-ipv4-topology is empty again.
248     [Tags]    critical
249     Wait_For_Topology_To_Change_To    empty_topology
250
251 Start_Listening_BGP_Speaker_Case_2
252     [Documentation]    BGP Speaker introduces 2 prefixes in the first update & another 2 prefixes while the very first is withdrawn in 2nd update
253     BGPSpeaker.Start_BGP_Speaker    --amount 3 --listen --myip=${TOOLS_SYSTEM_IP} --myport=${BGP_TOOL_PORT} --peerip=${ODL_SYSTEM_IP} --prefill=2 --insert=2 --withdraw=1 --updates=single --firstprefix=8.0.0.240 --${BGP_TOOL_LOG_LEVEL}
254     Read_And_Fail_If_Prompt_Is_Seen
255
256 Check_Listening_Connection_Is_Established_Case_2
257     [Documentation]    See TCP (BGP) connection in established state.
258     Check_Speaker_Is_Connected
259
260 Check_Listening_Topology_Is_Filled_Case_2
261     [Documentation]    See new routes in example-ipv4-topology as a proof that synchronization was correct.
262     [Tags]    critical
263     Wait_For_Topology_To_Change_To    filled_topology
264
265 Kill_Listening_BGP_Speaker_Case_2
266     [Documentation]    Abort the Python speaker. Also, attempt to stop failing fast.
267     [Tags]    critical
268     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
269     BGPSpeaker.Kill_BGP_Speaker
270     FailFast.Do_Not_Fail_Fast_From_Now_On
271     # NOTE: It is still possible to remain failing fast, if both previous and this test have failed.
272     [Teardown]    FailFast.Do_Not_Start_Failing_If_This_Failed
273
274 Check_For_Empty_Topology_After_Listening_Case_2
275     [Documentation]    Post-condition: Check example-ipv4-topology is empty again.
276     [Tags]    critical
277     Wait_For_Topology_To_Change_To    empty_topology
278
279 Start_Listening_BGP_Speaker_Case_3
280     [Documentation]    BGP Speaker introduces 3 prefixes while the first one occures again in the withdrawn list (to be ignored by controller)
281     BGPSpeaker.Start_BGP_Speaker    --amount 2 --listen --myip=${TOOLS_SYSTEM_IP} --myport=${BGP_TOOL_PORT} --peerip=${ODL_SYSTEM_IP} --prefill=0 --insert=3 --withdraw=1 --updates=single --${BGP_TOOL_LOG_LEVEL}
282     Read_And_Fail_If_Prompt_Is_Seen
283
284 Check_Listening_Connection_Is_Established_Case_3
285     [Documentation]    See TCP (BGP) connection in established state.
286     Check_Speaker_Is_Connected
287
288 Check_Listening_Topology_Is_Filled_Case_3
289     [Documentation]    See new routes in example-ipv4-topology as a proof that synchronization was correct.
290     [Tags]    critical
291     Wait_For_Topology_To_Change_To    filled_topology
292
293 Kill_Listening_BGP_Speaker_Case_3
294     [Documentation]    Abort the Python speaker. Also, attempt to stop failing fast.
295     [Tags]    critical
296     [Setup]    SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
297     BGPSpeaker.Kill_BGP_Speaker
298     FailFast.Do_Not_Fail_Fast_From_Now_On
299     # NOTE: It is still possible to remain failing fast, if both previous and this test have failed.
300     [Teardown]    FailFast.Do_Not_Start_Failing_If_This_Failed
301
302 Check_For_Empty_Topology_After_Listening_Case_3
303     [Documentation]    Post-condition: Check example-ipv4-topology is empty again.
304     [Tags]    critical
305     Wait_For_Topology_To_Change_To    empty_topology
306
307 Delete_Bgp_Peer_Configuration
308     [Documentation]    Revert the BGP configuration to the original state: without any configured peers.
309     &{mapping}    BuiltIn.Create_Dictionary    DEVICE_NAME=${DEVICE_NAME}    BGP_NAME=${BGP_PEER_NAME}    IP=${TOOLS_SYSTEM_IP}    BGP_RIB_OPENCONFIG=${RIB_NAME}
310     TemplatedRequests.Delete_Templated    ${BGP_VARIABLES_FOLDER}${/}bgp_peer    mapping=${mapping}    session=${CONFIG_SESSION}
311
312 *** Keywords ***
313 Setup_Everything
314     [Documentation]    Initialize SetupUtils. SSH-login to mininet machine, create HTTP session,
315     ...    put Python tool to mininet machine, setup imported resources.
316     SetupUtils.Setup_Utils_For_Setup_And_Teardown
317     SSHLibrary.Set_Default_Configuration    prompt=${TOOLS_SYSTEM_PROMPT}
318     SSHLibrary.Open_Connection    ${TOOLS_SYSTEM_IP}
319     SSHKeywords.Flexible_Mininet_Login
320     SSHKeywords.Require_Python
321     SSHKeywords.Assure_Library_Ipaddr    target_dir=.
322     SSHLibrary.Put_File    ${CURDIR}/../../../../tools/fastbgp/play.py
323     RequestsLibrary.Create_Session    ${CONFIG_SESSION}    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}    auth=${AUTH}
324     KarafKeywords.Execute_Controller_Karaf_Command_On_Background    log:set ${ODL_LOG_LEVEL}
325     KarafKeywords.Execute_Controller_Karaf_Command_On_Background    log:set ${ODL_BGP_LOG_LEVEL} org.opendaylight.bgpcep
326     KarafKeywords.Execute_Controller_Karaf_Command_On_Background    log:set ${ODL_BGP_LOG_LEVEL} org.opendaylight.protocol
327
328 Teardown_Everything
329     [Documentation]    Make sure Python tool was killed, delete all sessions, tear down imported Resources.
330     KillPythonTool.Search_And_Kill_Remote_Python    'play\.py'
331     RequestsLibrary.Delete_All_Sessions
332     SSHLibrary.Close_All_Connections
333
334 Wait_For_Topology_To_Change_To
335     [Arguments]    ${folder_name}    ${timeout}=10s    ${refresh}=1s
336     [Documentation]    Wait until Compare_Topology matches expected result.
337     BuiltIn.Wait_Until_Keyword_Succeeds    ${timeout}    ${refresh}    Compare_Topology    ${folder_name}
338
339 Verify_That_Topology_Does_Not_Change_From
340     [Arguments]    ${folder_name}    ${timeout}=10s    ${refresh}=1s
341     [Documentation]    Verify that Compare_Topology keeps passing, it will hold its last result.
342     WaitForFailure.Verify_Keyword_Does_Not_Fail_Within_Timeout    ${timeout}    ${refresh}    Compare_Topology    ${folder_name}
343
344 Compare_Topology
345     [Arguments]    ${folder_name}
346     [Documentation]    Get current example-ipv4-topology as json, and compare it to expected result.
347     TemplatedRequests.Get_As_Json_Templated    ${BGP_VARIABLES_FOLDER}${/}${folder_name}    session=${CONFIG_SESSION}    verify=True
348
349 Check_Speaker_Is_Not_Connected
350     [Documentation]    Give it a few tries to see zero established connections.
351     BuiltIn.Wait_Until_Keyword_Succeeds    3s    1s    Check_Number_Of_Speaker_Connections    0
352
353 Check_Speaker_Is_Connected
354     [Documentation]    Give it several tries to see exactly one established connection.
355     BuiltIn.Wait_Until_Keyword_Succeeds    5s    1s    Check_Number_Of_Speaker_Connections    1
356
357 Check_Number_Of_Speaker_Connections
358     [Arguments]    ${howmany}
359     [Documentation]    Run netstat in mininet machine and parse it for number of established connections. Check it is ${howmany}.
360     ${output}=    SSHKeywords.Count_Port_Occurences    17900    ESTABLISHED    python
361     BuiltIn.Should_Be_Equal_As_Strings    ${output}    ${howmany}
362
363 Configure_Peer_Group
364     [Arguments]    ${peer_group_folder}=peer_group
365     [Documentation]    Configures peer group which is template for all the neighbors which are going
366     ...    to be configured. Also after PUT, this case verifies presence of peer group within
367     ...    peer-groups. This case is specific to versions Fluorine and above.
368     &{mapping}    Create Dictionary    DEVICE_NAME=${DEVICE_NAME}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}    INITIATE=false    BGP_RIB=${RIB_NAME}
369     ...    PASSIVE_MODE=true    BGP_RIB_OPENCONFIG=${RIB_NAME}    PEER_GROUP_NAME=${PEER_GROUP}    RR_CLIENT=false
370     TemplatedRequests.Put_As_Xml_Templated    ${BGP_VARIABLES_FOLDER}${/}${peer_group_folder}    mapping=${mapping}    session=${CONFIG_SESSION}
371     TemplatedRequests.Get_As_Json_Templated    ${BGP_VARIABLES_FOLDER}${/}verify_${peer_group_folder}    mapping=${mapping}    session=${CONFIG_SESSION}    verify=True
372
373 Deconfigure_Peer_Group
374     [Documentation]    Deconfigures peer group which is template for all the neighbors
375     ...    This test case is specific to versions Fluorine and above.
376     &{mapping}    Create Dictionary    DEVICE_NAME=${DEVICE_NAME}    HOLDTIME=${HOLDTIME}    PEER_PORT=${BGP_TOOL_PORT}    INITIATE=false    BGP_RIB=${RIB_NAME}
377     ...    PASSIVE_MODE=true    BGP_RIB_OPENCONFIG=${RIB_NAME}    PEER_GROUP_NAME=${PEER_GROUP}    RR_CLIENT=false
378     TemplatedRequests.Delete_Templated    ${BGP_VARIABLES_FOLDER}${/}peer_group    mapping=${mapping}    session=${CONFIG_SESSION}
379
380 Restart_Talking_BGP_Speaker
381     [Documentation]    Abort the Python speaker. Also, attempt to stop failing fast. And Start it again.
382     ...    We have to restart it this way because we reset session before
383     BGPSpeaker.Kill_BGP_Speaker
384     FailFast.Do_Not_Fail_Fast_From_Now_On
385     BGPSpeaker.Start_BGP_Speaker    --amount 3 --myip=${TOOLS_SYSTEM_IP} --myport=${BGP_TOOL_PORT} --peerip=${ODL_SYSTEM_IP} --peerport=${ODL_BGP_PORT} --${BGP_TOOL_LOG_LEVEL}
386     Read_And_Fail_If_Prompt_Is_Seen