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