updating expected results for boron stream
[integration/test.git] / csit / suites / bgpcep / bgpuser / ibgp_peers_basic.robot
1 *** Settings ***
2 Documentation     Basic tests for iBGP peers.
3 ...
4 ...               Copyright (c) 2015-2016 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 iBGP functional test cases for
11 ...               BGP peers in different roles (iBGP, iBGP RR-client):
12 ...
13 ...               Test Case 1: Two iBGP RR-client peers introduce prefixes
14 ...               Expected result: controller forwards updates towards both peers
15 ...
16 ...               Test Case 2: Two iBGP peers: one RR client and one non-client introduces prefixes
17 ...               Expected result: controller forwards updates towards both peers
18 ...
19 ...               Test Case 3: Two iBGP RR non-client peers introduce prefixes
20 ...               Expected result: controller does not forward any update towards peers
21 ...
22 ...               For polices see: https://wiki.opendaylight.org/view/BGP_LS_PCEP:BGP
23 ...
24 ...               Covered bugs:
25 ...               Bug 4791 - BGPSessionImpl: Failed to send message Update logged even all UPDATE mesages received by iBGP peer
26 ...               Bug 4819 - No routes advertised to one of newly configured iBGP RR-client peer
27 Suite Setup       Setup_Everything
28 Suite Teardown    Teardown_Everything
29 Test Setup        SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
30 Test Teardown     FailFast.Start_Failing_Fast_If_This_Failed
31 Library           OperatingSystem
32 Library           RequestsLibrary
33 Library           DateTime
34 Library           ${CURDIR}/../../../libraries/HsfJson/hsf_json.py
35 Variables         ${CURDIR}/../../../variables/Variables.py
36 Variables         ${CURDIR}/../../../variables/bgpuser/variables.py    ${TOOLS_SYSTEM_IP}    ${ODL_STREAM}
37 Resource          ${CURDIR}/../../../libraries/BGPcliKeywords.robot
38 Resource          ${CURDIR}/../../../libraries/BGPSpeaker.robot
39 Resource          ${CURDIR}/../../../libraries/ConfigViaRestconf.robot
40 Resource          ${CURDIR}/../../../libraries/FailFast.robot
41 Resource          ${CURDIR}/../../../libraries/KarafKeywords.robot
42 Resource          ${CURDIR}/../../../libraries/KillPythonTool.robot
43 Resource          ${CURDIR}/../../../libraries/SetupUtils.robot
44 Resource          ${CURDIR}/../../../libraries/SSHKeywords.robot
45 Resource          ${CURDIR}/../../../libraries/Utils.robot
46 Resource          ${CURDIR}/../../../libraries/WaitForFailure.robot
47
48 *** Variables ***
49 ${BGP_VARIABLES_FOLDER}    ${CURDIR}/../../../variables/bgpuser/
50 ${HOLDTIME}       180
51 ${BGP_PEER_LOG_LEVEL}    debug
52 ${CONTROLLER_LOG_LEVEL}    INFO
53 ${CONTROLLER_BGP_LOG_LEVEL}    DEFAULT
54 ${BGP_PEER1_IP}    127.0.0.1
55 ${BGP_PEER2_IP}    127.0.0.2
56 ${BGP_PEER1_FIRST_PREFIX_IP}    8.1.0.0
57 ${BGP_PEER2_FIRST_PREFIX_IP}    8.2.0.0
58 ${PREFIX_LEN}     28
59 ${BGP_PEER1_PREFIX_LEN}    ${PREFIX_LEN}
60 ${BGP_PEER2_PREFIX_LEN}    ${PREFIX_LEN}
61 ${PREFIX_COUNT}    3
62 ${BGP_PEER1_PREFIX_COUNT}    ${PREFIX_COUNT}
63 ${BGP_PEER2_PREFIX_COUNT}    ${PREFIX_COUNT}
64 ${BGP_PEER1_LOG_FILE}    bgp_peer1.log
65 ${BGP_PEER2_LOG_FILE}    bgp_peer2.log
66 ${BGP_PEER1_COMMAND}    python play.py --firstprefix ${BGP_PEER1_FIRST_PREFIX_IP} --prefixlen ${BGP_PEER1_PREFIX_LEN} --amount ${BGP_PEER1_PREFIX_COUNT} --myip=${BGP_PEER1_IP} --myport=${BGP_TOOL_PORT} --peerip=${ODL_SYSTEM_IP} --peerport=${ODL_BGP_PORT} --${BGP_PEER_LOG_LEVEL} --logfile ${BGP_PEER1_LOG_FILE}
67 ${BGP_PEER2_COMMAND}    python play.py --firstprefix ${BGP_PEER2_FIRST_PREFIX_IP} --prefixlen ${BGP_PEER2_PREFIX_LEN} --amount ${BGP_PEER2_PREFIX_COUNT} --myip=${BGP_PEER2_IP} --myport=${BGP_TOOL_PORT} --peerip=${ODL_SYSTEM_IP} --peerport=${ODL_BGP_PORT} --${BGP_PEER_LOG_LEVEL} --logfile ${BGP_PEER2_LOG_FILE}
68 ${BGP_PEER1_OPTIONS}    &>${BGP_PEER1_LOG_FILE}
69 ${BGP_PEER2_OPTIONS}    &>${BGP_PEER2_LOG_FILE}
70 ${DEFAULT_LOG_CHECK_TIMEOUT}    20s
71 ${DEFAULT_LOG_CHECK_PERIOD}    1s
72 ${DEFAULT_TOPOLOGY_CHECK_TIMEOUT}    10s
73 ${DEFAULT_TOPOLOGY_CHECK_PERIOD}    1s
74
75 *** Test Cases ***
76 TC1_Configure_Two_iBGP_Route_Reflector_Client_Peers
77     [Documentation]    Configure two iBGP peers as routing reflector clients.
78     [Tags]    critical
79     ${template_as_string}=    BuiltIn.Set_Variable    {'NAME': 'example-bgp-peer1', 'IP': '${BGP_PEER1_IP}', 'HOLDTIME': '${HOLDTIME}', 'PEER_PORT': '${BGP_TOOL_PORT}','PEER_ROLE': 'rr-client', 'INITIATE': 'false'}
80     ConfigViaRestconf.Put_Xml_Template_Folder_Config_Via_Restconf    ${BGP_VARIABLES_FOLDER}${/}ibgp_peers    ${template_as_string}
81     ${template_as_string}=    BuiltIn.Set_Variable    {'NAME': 'example-bgp-peer2', 'IP': '${BGP_PEER2_IP}', 'HOLDTIME': '${HOLDTIME}', 'PEER_PORT': '${BGP_TOOL_PORT}','PEER_ROLE': 'rr-client', 'INITIATE': 'false'}
82     ConfigViaRestconf.Put_Xml_Template_Folder_Config_Via_Restconf    ${BGP_VARIABLES_FOLDER}${/}ibgp_peers    ${template_as_string}
83     ${template_as_string}=    BuiltIn.Set_Variable    {'NAME': 'example-bgp-peer1'}
84     ${result}=    ConfigViaRestconf.Get_Xml_Template_Folder_Config_Via_Restconf    ${BGP_VARIABLES_FOLDER}${/}ibgp_peers    ${template_as_string}
85     BuiltIn.Log    ${result}
86     ${template_as_string}=    BuiltIn.Set_Variable    {'NAME': 'example-bgp-peer2'}
87     ${result}=    ConfigViaRestconf.Get_Xml_Template_Folder_Config_Via_Restconf    ${BGP_VARIABLES_FOLDER}${/}ibgp_peers    ${template_as_string}
88     BuiltIn.Log    ${result}
89
90 TC1_Connect_BGP_Peer1
91     [Documentation]    Connect BGP peer
92     [Tags]    critical
93     SSHLibrary.Switch Connection    bgp_peer1_console
94     Start_Console_Tool    ${BGP_PEER1_COMMAND}    ${BGP_PEER1_OPTIONS}
95     BuiltIn.Wait_Until_Keyword_Succeeds    ${DEFAULT_TOPOLOGY_CHECK_TIMEOUT}    ${DEFAULT_TOPOLOGY_CHECK_PERIOD}    Check_Example_IPv4_Topology_Content    {"prefix":"${BGP_PEER1_FIRST_PREFIX_IP}/${PREFIX_LEN}"}
96
97 TC1_Connect_BGP_Peer2
98     [Documentation]    Connect BGP peer
99     [Tags]    critical
100     SSHLibrary.Switch Connection    bgp_peer2_console
101     Start_Console_Tool    ${BGP_PEER2_COMMAND}    ${BGP_PEER2_OPTIONS}
102     BuiltIn.Wait_Until_Keyword_Succeeds    ${DEFAULT_TOPOLOGY_CHECK_TIMEOUT}    ${DEFAULT_TOPOLOGY_CHECK_PERIOD}    Check_Example_IPv4_Topology_Content    {"prefix":"${BGP_PEER2_FIRST_PREFIX_IP}/${PREFIX_LEN}"}
103
104 TC1_BGP_Peer1_Check_Log_For_Introduced_Prefixes
105     [Documentation]    Check incomming updates for new routes
106     [Tags]    critical
107     SSHLibrary.Switch Connection    bgp_peer1_console
108     BuiltIn.Wait_Until_Keyword_Succeeds    ${DEFAULT_LOG_CHECK_TIMEOUT}    ${DEFAULT_LOG_CHECK_PERIOD}    Check_File_For_Word_Count    ${BGP_PEER1_LOG_FILE}    nlri_prefix_received:    ${BGP_PEER2_PREFIX_COUNT}
109     Check_File_For_Word_Count    ${BGP_PEER1_LOG_FILE}    nlri_prefix_received: ${BGP_PEER2_FIRST_PREFIX_IP}/${BGP_PEER2_PREFIX_LEN}    1
110     Check_File_For_Word_Count    ${BGP_PEER1_LOG_FILE}    withdrawn_prefix_received:    0
111     [Teardown]    Report_Failure_Due_To_Bug    4819
112
113 TC1_BGP_Peer2_Check_Log_For_Introduced_Prefixes
114     [Documentation]    Check incomming updates for new routes
115     [Tags]    critical
116     SSHLibrary.Switch Connection    bgp_peer2_console
117     BuiltIn.Wait_Until_Keyword_Succeeds    ${DEFAULT_LOG_CHECK_TIMEOUT}    ${DEFAULT_LOG_CHECK_PERIOD}    Check_File_For_Word_Count    ${BGP_PEER2_LOG_FILE}    nlri_prefix_received:    ${BGP_PEER1_PREFIX_COUNT}
118     Check_File_For_Word_Count    ${BGP_PEER2_LOG_FILE}    nlri_prefix_received: ${BGP_PEER1_FIRST_PREFIX_IP}/${BGP_PEER1_PREFIX_LEN}    1
119     Check_File_For_Word_Count    ${BGP_PEER2_LOG_FILE}    withdrawn_prefix_received:    0
120     [Teardown]    Report_Failure_Due_To_Bug    4819
121
122 TC1_Disconnect_BGP_Peer1
123     [Documentation]    Stop BGP peer & store logs
124     [Tags]    critical
125     SSHLibrary.Switch Connection    bgp_peer1_console
126     Stop_Console_Tool
127     Store_File_To_Workspace    ${BGP_PEER1_LOG_FILE}    tc1_${BGP_PEER1_LOG_FILE}
128
129 TC1_BGP_Peer2_Check_Log_For_Withdrawn_Prefixes
130     [Documentation]    Check incomming updates for withdrawn routes
131     [Tags]    critical
132     SSHLibrary.Switch Connection    bgp_peer2_console
133     BuiltIn.Wait_Until_Keyword_Succeeds    ${DEFAULT_LOG_CHECK_TIMEOUT}    ${DEFAULT_LOG_CHECK_PERIOD}    Check_File_For_Word_Count    ${BGP_PEER2_LOG_FILE}    withdrawn_prefix_received:    ${BGP_PEER1_PREFIX_COUNT}
134     Check_File_For_Word_Count    ${BGP_PEER2_LOG_FILE}    withdrawn_prefix_received: ${BGP_PEER1_FIRST_PREFIX_IP}/${BGP_PEER1_PREFIX_LEN}    1
135     [Teardown]    Report_Failure_Due_To_Bug    4819
136
137 TC1_Disconnect_BGP_Peer2
138     [Documentation]    Stop BGP peer & store logs
139     [Tags]    critical
140     SSHLibrary.Switch Connection    bgp_peer2_console
141     Stop_Console_Tool
142     Store_File_To_Workspace    ${BGP_PEER2_LOG_FILE}    tc1_${BGP_PEER2_LOG_FILE}
143
144 TC_1_Check_for_Empty_IPv4_Topology
145     BuiltIn.Wait_Until_Keyword_Succeeds    ${DEFAULT_TOPOLOGY_CHECK_TIMEOUT}    ${DEFAULT_TOPOLOGY_CHECK_PERIOD}    Check_Example_IPv4_Topology_Does_Not_Contain    prefix
146
147 TC1_Delete_BGP_Peers_Configuration
148     [Documentation]    Delete all previously configured BGP peers.
149     [Tags]    critical
150     ${template_as_string}=    BuiltIn.Set_Variable    {'NAME': 'example-bgp-peer1'}
151     ConfigViaRestconf.Delete_Xml_Template_Folder_Config_Via_Restconf    ${BGP_VARIABLES_FOLDER}${/}ibgp_peers    ${template_as_string}
152     ${template_as_string}=    BuiltIn.Set_Variable    {'NAME': 'example-bgp-peer2'}
153     ConfigViaRestconf.Delete_Xml_Template_Folder_Config_Via_Restconf    ${BGP_VARIABLES_FOLDER}${/}ibgp_peers    ${template_as_string}
154
155 TC2_Configure_One_iBGP_Route_Reflector_Client_And_One_iBGP_Non_Client
156     [Documentation]    Configure iBGP peers: 1st one as RR client, 2nd one as RR non-client.
157     [Tags]    critical
158     ${template_as_string}=    BuiltIn.Set_Variable    {'NAME': 'example-bgp-peer1', 'IP': '${BGP_PEER1_IP}', 'HOLDTIME': '${HOLDTIME}', 'PEER_PORT': '${BGP_TOOL_PORT}','PEER_ROLE': 'rr-client', 'INITIATE': 'false'}
159     ConfigViaRestconf.Put_Xml_Template_Folder_Config_Via_Restconf    ${BGP_VARIABLES_FOLDER}${/}ibgp_peers    ${template_as_string}
160     ${template_as_string}=    BuiltIn.Set_Variable    {'NAME': 'example-bgp-peer2', 'IP': '${BGP_PEER2_IP}', 'HOLDTIME': '${HOLDTIME}', 'PEER_PORT': '${BGP_TOOL_PORT}','PEER_ROLE': 'ibgp', 'INITIATE': 'false'}
161     ConfigViaRestconf.Put_Xml_Template_Folder_Config_Via_Restconf    ${BGP_VARIABLES_FOLDER}${/}ibgp_peers    ${template_as_string}
162     ${template_as_string}=    BuiltIn.Set_Variable    {'NAME': 'example-bgp-peer1'}
163     ${result}=    ConfigViaRestconf.Get_Xml_Template_Folder_Config_Via_Restconf    ${BGP_VARIABLES_FOLDER}${/}ibgp_peers    ${template_as_string}
164     BuiltIn.Log    ${result}
165     ${template_as_string}=    BuiltIn.Set_Variable    {'NAME': 'example-bgp-peer2'}
166     ${result}=    ConfigViaRestconf.Get_Xml_Template_Folder_Config_Via_Restconf    ${BGP_VARIABLES_FOLDER}${/}ibgp_peers    ${template_as_string}
167     BuiltIn.Log    ${result}
168
169 TC2_Connect_BGP_Peer1
170     [Documentation]    Connect BGP peer
171     [Tags]    critical
172     SSHLibrary.Switch Connection    bgp_peer1_console
173     Start_Console_Tool    ${BGP_PEER1_COMMAND}    ${BGP_PEER1_OPTIONS}
174     BuiltIn.Wait_Until_Keyword_Succeeds    ${DEFAULT_TOPOLOGY_CHECK_TIMEOUT}    ${DEFAULT_TOPOLOGY_CHECK_PERIOD}    Check_Example_IPv4_Topology_Content    {"prefix":"${BGP_PEER1_FIRST_PREFIX_IP}/${PREFIX_LEN}"}
175
176 TC2_Connect_BGP_Peer2
177     [Documentation]    Connect BGP peer
178     [Tags]    critical
179     SSHLibrary.Switch Connection    bgp_peer2_console
180     Start_Console_Tool    ${BGP_PEER2_COMMAND}    ${BGP_PEER2_OPTIONS}
181     BuiltIn.Wait_Until_Keyword_Succeeds    ${DEFAULT_TOPOLOGY_CHECK_TIMEOUT}    ${DEFAULT_TOPOLOGY_CHECK_PERIOD}    Check_Example_IPv4_Topology_Content    {"prefix":"${BGP_PEER2_FIRST_PREFIX_IP}/${PREFIX_LEN}"}
182
183 TC2_BGP_Peer1_Check_Log_For_Introduced_Prefixes
184     [Documentation]    Check incomming updates for new routes
185     [Tags]    critical
186     SSHLibrary.Switch Connection    bgp_peer1_console
187     BuiltIn.Wait_Until_Keyword_Succeeds    ${DEFAULT_LOG_CHECK_TIMEOUT}    ${DEFAULT_LOG_CHECK_PERIOD}    Check_File_For_Word_Count    ${BGP_PEER1_LOG_FILE}    nlri_prefix_received:    ${BGP_PEER2_PREFIX_COUNT}
188     Check_File_For_Word_Count    ${BGP_PEER1_LOG_FILE}    nlri_prefix_received: ${BGP_PEER2_FIRST_PREFIX_IP}/${BGP_PEER2_PREFIX_LEN}    1
189     Check_File_For_Word_Count    ${BGP_PEER1_LOG_FILE}    withdrawn_prefix_received:    0
190
191 TC2_BGP_Peer2_Check_Log_For_Introduced_Prefixes
192     [Documentation]    Check incomming updates for new routes
193     [Tags]    critical
194     SSHLibrary.Switch Connection    bgp_peer2_console
195     BuiltIn.Wait_Until_Keyword_Succeeds    ${DEFAULT_LOG_CHECK_TIMEOUT}    ${DEFAULT_LOG_CHECK_PERIOD}    Check_File_For_Word_Count    ${BGP_PEER2_LOG_FILE}    nlri_prefix_received:    ${BGP_PEER1_PREFIX_COUNT}
196     Check_File_For_Word_Count    ${BGP_PEER2_LOG_FILE}    nlri_prefix_received: ${BGP_PEER1_FIRST_PREFIX_IP}/${BGP_PEER1_PREFIX_LEN}    1
197     Check_File_For_Word_Count    ${BGP_PEER2_LOG_FILE}    withdrawn_prefix_received:    0
198     [Teardown]    Report_Failure_Due_To_Bug    4791
199
200 TC2_Disconnect_BGP_Peer1
201     [Documentation]    Stop BGP peer & store logs
202     [Tags]    critical
203     SSHLibrary.Switch Connection    bgp_peer1_console
204     Stop_Console_Tool
205     Store_File_To_Workspace    ${BGP_PEER1_LOG_FILE}    tc2_${BGP_PEER1_LOG_FILE}
206
207 TC2_BGP_Peer2_Check_Log_For_Withdrawn_Prefixes
208     [Documentation]    Check incomming updates for withdrawn routes
209     [Tags]    critical
210     SSHLibrary.Switch Connection    bgp_peer2_console
211     BuiltIn.Wait_Until_Keyword_Succeeds    ${DEFAULT_LOG_CHECK_TIMEOUT}    ${DEFAULT_LOG_CHECK_PERIOD}    Check_File_For_Word_Count    ${BGP_PEER2_LOG_FILE}    withdrawn_prefix_received:    ${BGP_PEER1_PREFIX_COUNT}
212     Check_File_For_Word_Count    ${BGP_PEER2_LOG_FILE}    withdrawn_prefix_received: ${BGP_PEER1_FIRST_PREFIX_IP}/${BGP_PEER1_PREFIX_LEN}    1
213
214 TC2_Disconnect_BGP_Peer2
215     [Documentation]    Stop BGP peer & store logs
216     [Tags]    critical
217     SSHLibrary.Switch Connection    bgp_peer2_console
218     Stop_Console_Tool
219     Store_File_To_Workspace    ${BGP_PEER2_LOG_FILE}    tc2_${BGP_PEER2_LOG_FILE}
220
221 TC_2_Check_for_Empty_IPv4_Topology
222     BuiltIn.Wait_Until_Keyword_Succeeds    ${DEFAULT_TOPOLOGY_CHECK_TIMEOUT}    ${DEFAULT_TOPOLOGY_CHECK_PERIOD}    Check_Example_IPv4_Topology_Does_Not_Contain    prefix
223
224 TC2_Delete_BGP_Peers_Configuration
225     [Documentation]    Delete all previously configured BGP peers.
226     [Tags]    critical
227     ${template_as_string}=    BuiltIn.Set_Variable    {'NAME': 'example-bgp-peer1'}
228     ConfigViaRestconf.Delete_Xml_Template_Folder_Config_Via_Restconf    ${BGP_VARIABLES_FOLDER}${/}ibgp_peers    ${template_as_string}
229     ${template_as_string}=    BuiltIn.Set_Variable    {'NAME': 'example-bgp-peer2'}
230     ConfigViaRestconf.Delete_Xml_Template_Folder_Config_Via_Restconf    ${BGP_VARIABLES_FOLDER}${/}ibgp_peers    ${template_as_string}
231
232 TC3_Configure_Two_iBGP_Non_Client_Peers
233     [Documentation]    Configure iBGP peers: 1st one as RR client, 2nd one as RR non-client.
234     [Tags]    critical
235     ${template_as_string}=    BuiltIn.Set_Variable    {'NAME': 'example-bgp-peer1', 'IP': '${BGP_PEER1_IP}', 'HOLDTIME': '${HOLDTIME}', 'PEER_PORT': '${BGP_TOOL_PORT}','PEER_ROLE': 'ibgp', 'INITIATE': 'false'}
236     ConfigViaRestconf.Put_Xml_Template_Folder_Config_Via_Restconf    ${BGP_VARIABLES_FOLDER}${/}ibgp_peers    ${template_as_string}
237     ${template_as_string}=    BuiltIn.Set_Variable    {'NAME': 'example-bgp-peer2', 'IP': '${BGP_PEER2_IP}', 'HOLDTIME': '${HOLDTIME}', 'PEER_PORT': '${BGP_TOOL_PORT}','PEER_ROLE': 'ibgp', 'INITIATE': 'false'}
238     ConfigViaRestconf.Put_Xml_Template_Folder_Config_Via_Restconf    ${BGP_VARIABLES_FOLDER}${/}ibgp_peers    ${template_as_string}
239     ${template_as_string}=    BuiltIn.Set_Variable    {'NAME': 'example-bgp-peer1'}
240     ${result}=    ConfigViaRestconf.Get_Xml_Template_Folder_Config_Via_Restconf    ${BGP_VARIABLES_FOLDER}${/}ibgp_peers    ${template_as_string}
241     BuiltIn.Log    ${result}
242     ${template_as_string}=    BuiltIn.Set_Variable    {'NAME': 'example-bgp-peer2'}
243     ${result}=    ConfigViaRestconf.Get_Xml_Template_Folder_Config_Via_Restconf    ${BGP_VARIABLES_FOLDER}${/}ibgp_peers    ${template_as_string}
244     BuiltIn.Log    ${result}
245
246 TC3_Connect_BGP_Peer1
247     [Documentation]    Connect BGP peer
248     [Tags]    critical
249     SSHLibrary.Switch Connection    bgp_peer1_console
250     Start_Console_Tool    ${BGP_PEER1_COMMAND}    ${BGP_PEER1_OPTIONS}
251     BuiltIn.Wait_Until_Keyword_Succeeds    ${DEFAULT_TOPOLOGY_CHECK_TIMEOUT}    ${DEFAULT_TOPOLOGY_CHECK_PERIOD}    Check_Example_IPv4_Topology_Content    {"prefix":"${BGP_PEER1_FIRST_PREFIX_IP}/${PREFIX_LEN}"}
252
253 TC3_Connect_BGP_Peer2
254     [Documentation]    Connect BGP peer
255     [Tags]    critical
256     SSHLibrary.Switch Connection    bgp_peer2_console
257     Start_Console_Tool    ${BGP_PEER2_COMMAND}    ${BGP_PEER2_OPTIONS}
258     BuiltIn.Wait_Until_Keyword_Succeeds    ${DEFAULT_TOPOLOGY_CHECK_TIMEOUT}    ${DEFAULT_TOPOLOGY_CHECK_PERIOD}    Check_Example_IPv4_Topology_Content    {"prefix":"${BGP_PEER2_FIRST_PREFIX_IP}/${PREFIX_LEN}"}
259
260 TC3_BGP_Peer1_Check_Log_For_No_Updates
261     [Documentation]    Check for no updates received by iBGP peer No. 1
262     [Tags]    critical
263     SSHLibrary.Switch Connection    bgp_peer1_console
264     BuiltIn.Wait_Until_Keyword_Succeeds    ${DEFAULT_LOG_CHECK_TIMEOUT}    ${DEFAULT_LOG_CHECK_PERIOD}    Check_File_For_Word_Count    ${BGP_PEER1_LOG_FILE}    total_received_update_message_counter: 0    2
265
266 TC3_Disconnect_BGP_Peer1
267     [Documentation]    Stop BGP peer & store logs
268     [Tags]    critical
269     SSHLibrary.Switch Connection    bgp_peer1_console
270     Stop_Console_Tool
271     Store_File_To_Workspace    ${BGP_PEER1_LOG_FILE}    tc3_${BGP_PEER1_LOG_FILE}
272
273 TC3_BGP_Peer2_Check_Log_For_No_Updates
274     [Documentation]    Consequent check for no updates received by iBGP peer No. 2
275     [Tags]    critical
276     SSHLibrary.Switch Connection    bgp_peer2_console
277     ${log_check_timeout}=    DateTime.Convert_Time    ${DEFAULT_LOG_CHECK_TIMEOUT}    result_format=number
278     BuiltIn.Wait_Until_Keyword_Succeeds    ${log_check_timeout*2}    ${DEFAULT_LOG_CHECK_PERIOD}    Check_File_For_Word_Count    ${BGP_PEER2_LOG_FILE}    total_received_update_message_counter: 0    4
279
280 TC3_Disconnect_BGP_Peer2
281     [Documentation]    Stop BGP peer & store logs
282     [Tags]    critical
283     SSHLibrary.Switch Connection    bgp_peer2_console
284     Stop_Console_Tool
285     Store_File_To_Workspace    ${BGP_PEER2_LOG_FILE}    tc3_${BGP_PEER2_LOG_FILE}
286
287 TC_3_Check_for_Empty_IPv4_Topology
288     BuiltIn.Wait_Until_Keyword_Succeeds    ${DEFAULT_TOPOLOGY_CHECK_TIMEOUT}    ${DEFAULT_TOPOLOGY_CHECK_PERIOD}    Check_Example_IPv4_Topology_Does_Not_Contain    prefix
289
290 TC3_Delete_BGP_Peers_Configuration
291     [Documentation]    Delete all previously configured BGP peers.
292     [Tags]    critical
293     ${template_as_string}=    BuiltIn.Set_Variable    {'NAME': 'example-bgp-peer1'}
294     ConfigViaRestconf.Delete_Xml_Template_Folder_Config_Via_Restconf    ${BGP_VARIABLES_FOLDER}${/}ibgp_peers    ${template_as_string}
295     ${template_as_string}=    BuiltIn.Set_Variable    {'NAME': 'example-bgp-peer2'}
296     ConfigViaRestconf.Delete_Xml_Template_Folder_Config_Via_Restconf    ${BGP_VARIABLES_FOLDER}${/}ibgp_peers    ${template_as_string}
297
298 *** Keywords ***
299 Setup_Everything
300     [Documentation]    SSH-login to mininet machine, create HTTP session,
301     ...    prepare directories for responses, put Python tool to mininet machine, setup imported resources.
302     # TODO: Choose keywords used by more than one test suite to be placed in a common place.
303     SetupUtils.Setup_Utils_For_Setup_And_Teardown
304     SSHLibrary.Set_Default_Configuration    prompt=${ODL_SYSTEM_PROMPT}
305     SSHLibrary.Open_Connection    ${ODL_SYSTEM_IP}    alias=bgp_peer1_console
306     Utils.Flexible_Controller_Login
307     SSHLibrary.Open_Connection    ${ODL_SYSTEM_IP}    alias=bgp_peer2_console
308     Utils.Flexible_Controller_Login
309     SSHKeywords.Require_Python
310     SSHKeywords.Assure_Library_Ipaddr    target_dir=.
311     SSHLibrary.Put_File    ${CURDIR}/../../../../tools/fastbgp/play.py
312     RequestsLibrary.Create_Session    operational    http://${ODL_SYSTEM_IP}:${RESTCONFPORT}${OPERATIONAL_TOPO_API}    auth=${AUTH}
313     ConfigViaRestconf.Setup_Config_Via_Restconf
314     KarafKeywords.Execute_Controller_Karaf_Command_On_Background    log:set ${CONTROLLER_LOG_LEVEL}
315     KarafKeywords.Execute_Controller_Karaf_Command_On_Background    log:set ${CONTROLLER_BGP_LOG_LEVEL} org.opendaylight.bgpcep
316     KarafKeywords.Execute_Controller_Karaf_Command_On_Background    log:set ${CONTROLLER_BGP_LOG_LEVEL} org.opendaylight.protocol
317
318 Teardown_Everything
319     [Documentation]    Create and Log the diff between expected and actual responses, make sure Python tool was killed.
320     ...    Tear down imported Resources.
321     KillPythonTool.Search_And_Kill_Remote_Python    'play\.py'
322     ConfigViaRestconf.Teardown_Config_Via_Restconf
323     RequestsLibrary.Delete_All_Sessions
324     SSHLibrary.Close_All_Connections
325
326 Check_Example_IPv4_Topology_Content
327     [Arguments]    ${string_to_check}=${EMPTY}
328     [Documentation]    Check the example-ipv4-topology content for string
329     ${response}=    RequestsLibrary.Get Request    operational    topology/example-ipv4-topology
330     BuiltIn.Log    ${response.status_code}
331     BuiltIn.Log    ${response.text}
332     BuiltIn.Should_Contain    ${response.text}    ${string_to_check}
333
334 Check_Example_IPv4_Topology_Does_Not_Contain
335     [Arguments]    ${string_to_check}
336     [Documentation]    Check the example-ipv4-topology does not contain the string
337     ${response}=    RequestsLibrary.Get Request    operational    topology/example-ipv4-topology
338     BuiltIn.Log    ${response.status_code}
339     BuiltIn.Log    ${response.text}
340     BuiltIn.Should_Not_Contain    ${response.text}    ${string_to_check}