2 Documentation BGP performance of ingesting from 1 iBGP peer, data change counter is used.
4 ... Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
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
11 ... This suite uses play.py as single iBGP peer.
12 ... The suite only looks at example-ipv4-topology, so RIB is not examined.
14 ... This suite requires odl-bgpcep-data-change-counter to be installed so
15 ... make sure it is added to "install-features" of any jobs that are going
18 ... The suite consists of two halves, differing on which side initiates BGP connection.
19 ... Data change counter is a lightweight way to detect "work is being done".
20 ... WaitUtils provide a nice Keyword to wait for stability, but it needs
21 ... initial value, that is why Store_Change_Count appears just before work-inducing action.
22 ... The time for Wait_For_Stable_* cases to finish is the main performance metric.
23 ... After waiting for stability is done, full check on number of prefixes present is performed.
25 ... Brief description how to configure BGP peer can be found here:
26 ... https://wiki.opendaylight.org/view/BGP_LS_PCEP:User_Guide#BGP_Peer
27 ... http://docs.opendaylight.org/en/stable-boron/user-guide/bgp-user-guide.html#bgp-peering
28 ... The peer configuration depends on the ${ODL_STREAM}. For "boron" and older streams it uses netconf connector and
29 ... for carbon and further it configures peer via openconfig.
31 ... TODO: Currently, if a bug causes zero increase of data changes,
32 ... affected test cases will wait for max time. Reconsider.
33 ... If zero increase is allowed as stable, higher number of repetitions should be required.
35 ... Additionally this test suite is not compatible with Helium and Hydrogen
36 ... releases as they don't include data change counter feature.
37 ... Use the other version of the suite (singlepeer_prefixcount.robot) to test them.
38 Suite Setup Setup_Everything
39 Suite Teardown Teardown_Everything
40 Test Setup SetupUtils.Setup_Test_With_Logging_And_Fast_Failing
41 Test Teardown SetupUtils.Teardown_Test_Show_Bugs_And_Start_Fast_Failing_If_Test_Failed
42 Library SSHLibrary timeout=10s
43 Library RequestsLibrary
44 Variables ${CURDIR}/../../../variables/Variables.py
45 Resource ${CURDIR}/../../../libraries/BGPSpeaker.robot
46 Resource ${CURDIR}/../../../libraries/ChangeCounter.robot
47 Resource ${CURDIR}/../../../libraries/FailFast.robot
48 Resource ${CURDIR}/../../../libraries/KillPythonTool.robot
49 Resource ${CURDIR}/../../../libraries/PrefixCounting.robot
50 Resource ${CURDIR}/../../../libraries/SetupUtils.robot
51 Resource ${CURDIR}/../../../libraries/SSHKeywords.robot
52 Resource ${CURDIR}/../../../libraries/TemplatedRequests.robot
55 ${BGP_TOOL_LOG_LEVEL} info
56 ${BGP_VARIABLES_FOLDER} ${CURDIR}/../../../variables/bgpuser/
58 ${CHECK_PERIOD_CHANGE_COUNT} ${CHECK_PERIOD}
59 ${CHECK_PERIOD_CHANGE_COUNT_SINGLE} ${CHECK_PERIOD_CHANGE_COUNT}
61 ${COUNT_CHANGE_COUNT} ${COUNT}
62 ${COUNT_CHANGE_COUNT_SINGLE} ${COUNT_CHANGE_COUNT}
64 ${HOLDTIME_CHANGE_COUNT} ${HOLDTIME}
65 ${HOLDTIME_CHANGE_COUNT_SINGLE} ${HOLDTIME_CHANGE_COUNT}
67 ${KARAF_LOG_LEVEL} INFO
68 ${KARAF_BGPCEP_LOG_LEVEL} ${KARAF_LOG_LEVEL}
69 ${KARAF_PROTOCOL_LOG_LEVEL} ${KARAF_BGPCEP_LOG_LEVEL}
72 ${REPETITIONS_CHANGE_COUNT} ${REPETITIONS}
73 ${REPETITIONS_CHANGE_COUNT_SINGLE} ${REPETITIONS_CHANGE_COUNT}
74 ${RESULTS_FILE_NAME} bgp.csv
75 ${TEST_DURATION_MULTIPLIER} 1
76 ${TEST_DURATION_MULTIPLIER_CHANGE_COUNT} ${TEST_DURATION_MULTIPLIER}
77 ${TEST_DURATION_MULTIPLIER_CHANGE_COUNT_SINGLE} ${TEST_DURATION_MULTIPLIER_CHANGE_COUNT}
80 ${RIB_INSTANCE} example-bgp-rib
81 ${PROTOCOL_OPENCONFIG} ${RIB_INSTANCE}
82 ${DEVICE_NAME} controller-config
83 ${BGP_PEER_NAME} example-bgp-peer
84 # TODO: Option names can be better.
85 ${last_change_count_single} -1
86 ${NETCONF_DEV_FOLDER} ${CURDIR}/../../../variables/netconf/device/full-uri-device
87 ${NETCONF_MOUNT_FOLDER} ${CURDIR}/../../../variables/netconf/device/full-uri-mount
90 Check_For_Empty_Ipv4_Topology_Before_Talking
91 [Documentation] Wait for example-ipv4-topology to come up and empty. Give large timeout for case when BGP boots slower than restconf.
93 # TODO: Choose which tags to assign and make sure they are assigned correctly.
94 BuiltIn.Wait_Until_Keyword_Succeeds 120s 1s PrefixCounting.Check_Ipv4_Topology_Is_Empty
96 Configure_Netconf_Device
97 [Documentation] Configures netconf device if ${USE_NETCONF_CONNECTOR} is False.
98 BuiltIn.Run_Keyword_If """${USE_NETCONF_CONNECTOR}""" == """True""" BuiltIn.Pass_Execution No need to configure netconf device because netconf connector is present.
99 &{mapping} BuiltIn.Create_Dictionary DEVICE_NAME=${DEVICE_NAME} DEVICE_PORT=1830 DEVICE_IP=${ODL_SYSTEM_IP} DEVICE_USER=admin DEVICE_PASSWORD=admin
100 TemplatedRequests.Put_As_Xml_Templated ${NETCONF_DEV_FOLDER} mapping=${mapping}
101 BuiltIn.Wait_Until_Keyword_Succeeds 10x 3s TemplatedRequests.Get_As_Xml_Templated ${NETCONF_MOUNT_FOLDER} mapping=${mapping}
103 Reconfigure_ODL_To_Accept_Connection
104 [Documentation] Configure BGP peer module with initiate-connection set to false.
105 &{mapping} Create Dictionary DEVICE_NAME=${DEVICE_NAME} BGP_NAME=${BGP_PEER_NAME} IP=${TOOLS_SYSTEM_IP} HOLDTIME=${HOLDTIME_CHANGE_COUNT_SINGLE} PEER_PORT=${BGP_TOOL_PORT}
106 ... INITIATE=false BGP_RIB=${RIB_INSTANCE} PASSIVE_MODE=true BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG} RIB_INSTANCE_NAME=${RIB_INSTANCE}
107 TemplatedRequests.Put_As_Xml_Templated ${BGP_VARIABLES_FOLDER}${/}bgp_peer mapping=${mapping}
109 Wait_For_Data_Change_Counter_Ready
110 [Documentation] Data change counter might have been slower to start than ipv4 topology, wait for it.
111 BuiltIn.Wait_Until_Keyword_Succeeds 180s 1s ChangeCounter.Get_Change_Count
113 Reconfigure_Data_Change_Counter
114 [Documentation] Configure data change counter to count transactions in example-ipv4-topology instead of example-linkstate-topology.
115 ChangeCounter.Reconfigure_Topology_Name example-ipv4-topology
117 Change_Karaf_Logging_Levels
118 [Documentation] We may want to set more verbose logging here after configuration is done.
119 KarafKeywords.Set_Bgpcep_Log_Levels bgpcep_level=${KARAF_BGPCEP_LOG_LEVEL} protocol_level=${KARAF_PROTOCOL_LOG_LEVEL}
121 Start_Talking_BGP_Speaker
122 [Documentation] Start Python speaker to connect to ODL.
124 # Myport value is needed for checking whether connection at precise port was established.
125 BGPSpeaker.Start_BGP_Speaker --amount ${COUNT_CHANGE_COUNT_SINGLE} --myip=${TOOLS_SYSTEM_IP} --myport=${BGP_TOOL_PORT} --peerip=${ODL_SYSTEM_IP} --peerport=${ODL_BGP_PORT} --insert=${INSERT} --withdraw=${WITHDRAW} --prefill ${PREFILL} --update ${UPDATE} --${BGP_TOOL_LOG_LEVEL} --results ${RESULTS_FILE_NAME}
127 Wait_For_Stable_Talking_Ipv4_Topology
128 [Documentation] Wait until example-ipv4-topology becomes stable. This is done by checking the change counter.
129 ChangeCounter.Wait_For_Change_Count_To_Become_Stable timeout=${bgp_filling_timeout} period=${CHECK_PERIOD_CHANGE_COUNT_SINGLE} repetitions=${REPETITIONS_CHANGE_COUNT_SINGLE} count_to_overcome=${last_change_count_single}
131 Check_Talking_Ipv4_Topology_Count
132 [Documentation] Count the routes in example-ipv4-topology and fail if the count is not correct.
134 [Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
135 PrefixCounting.Check_Ipv4_Topology_Count ${COUNT_CHANGE_COUNT_SINGLE}
137 Kill_Talking_BGP_Speaker
138 [Documentation] Abort the Python speaker. Also, attempt to stop failing fast.
140 [Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
142 BGPSpeaker.Kill_BGP_Speaker
143 FailFast.Do_Not_Fail_Fast_From_Now_On
144 # NOTE: It is still possible to remain failing fast, if both previous and this test have failed.
145 [Teardown] SetupUtils.Teardown_Test_Show_Bugs_If_Test_Failed
147 Store_Results_For_Talking_BGP_Speaker
148 [Documentation] Store results for plotting
149 [Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
150 Store_File_To_Workspace totals-${RESULTS_FILE_NAME} totals-${RESULTS_FILE_NAME}
151 Store_File_To_Workspace performance-${RESULTS_FILE_NAME} performance-${RESULTS_FILE_NAME}
152 Store_File_To_Workspace totals-${RESULTS_FILE_NAME} changecount-talking-totals-${RESULTS_FILE_NAME}
153 Store_File_To_Workspace performance-${RESULTS_FILE_NAME} changecount-talking-performance-${RESULTS_FILE_NAME}
155 Wait_For_Stable_Ipv4_Topology_After_Talking
156 [Documentation] Wait until example-ipv4-topology becomes stable again.
158 ChangeCounter.Wait_For_Change_Count_To_Become_Stable timeout=${bgp_emptying_timeout} period=${CHECK_PERIOD_CHANGE_COUNT_SINGLE} repetitions=${REPETITIONS_CHANGE_COUNT_SINGLE} count_to_overcome=${last_change_count_single}
160 Check_For_Empty_Ipv4_Topology_After_Talking
161 [Documentation] Example-ipv4-topology should be empty now.
163 [Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
164 PrefixCounting.Check_Ipv4_Topology_Is_Empty
166 Start_Listening_BGP_Speaker
167 [Documentation] Start Python speaker in listening mode.
168 BGPSpeaker.Start_BGP_Speaker --amount ${COUNT_CHANGE_COUNT_SINGLE} --listen --myip=${TOOLS_SYSTEM_IP} --myport=${BGP_TOOL_PORT} --peerip=${ODL_SYSTEM_IP} --insert=${INSERT} --withdraw=${WITHDRAW} --prefill ${PREFILL} --update ${UPDATE} --${BGP_TOOL_LOG_LEVEL} --results ${RESULTS_FILE_NAME}
170 Reconfigure_ODL_To_Initiate_Connection
171 [Documentation] Replace BGP peer config module, now with initiate-connection set to true.
173 &{mapping} Create Dictionary DEVICE_NAME=${DEVICE_NAME} BGP_NAME=${BGP_PEER_NAME} IP=${TOOLS_SYSTEM_IP} HOLDTIME=${HOLDTIME_CHANGE_COUNT_SINGLE} PEER_PORT=${BGP_TOOL_PORT}
174 ... INITIATE=true BGP_RIB=${RIB_INSTANCE} PASSIVE_MODE=false BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG} RIB_INSTANCE_NAME=${RIB_INSTANCE}
175 TemplatedRequests.Put_As_Xml_Templated ${BGP_VARIABLES_FOLDER}${/}bgp_peer mapping=${mapping}
177 Wait_For_Stable_Listening_Ipv4_Topology
178 [Documentation] Wait until example-ipv4-topology becomes stable.
179 ChangeCounter.Wait_For_Change_Count_To_Become_Stable timeout=${bgp_filling_timeout} period=${CHECK_PERIOD_CHANGE_COUNT_SINGLE} repetitions=${REPETITIONS_CHANGE_COUNT_SINGLE} count_to_overcome=${last_change_count_single}
181 Check_Listening_Ipv4_Topology_Count
182 [Documentation] Count the routes in example-ipv4-topology and fail if the count is not correct.
184 [Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
185 PrefixCounting.Check_Ipv4_Topology_Count ${COUNT_CHANGE_COUNT_SINGLE}
187 Kill_Listening_BGP_Speaker
188 [Documentation] Abort the Python speaker. Also, attempt to stop failing fast.
190 [Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
192 BGPSpeaker.Kill_BGP_Speaker
193 FailFast.Do_Not_Fail_Fast_From_Now_On
194 # NOTE: It is still possible to remain failing fast, if both previous and this test have failed.
195 [Teardown] SetupUtils.Teardown_Test_Show_Bugs_If_Test_Failed
197 Store_Results_For_Listening_BGP_Speaker
198 [Documentation] Store results for plotting
199 [Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
200 Store_File_To_Workspace totals-${RESULTS_FILE_NAME} totals-${RESULTS_FILE_NAME}
201 Store_File_To_Workspace performance-${RESULTS_FILE_NAME} performance-${RESULTS_FILE_NAME}
202 Store_File_To_Workspace totals-${RESULTS_FILE_NAME} changecount-listening-totals-${RESULTS_FILE_NAME}
203 Store_File_To_Workspace performance-${RESULTS_FILE_NAME} changecount-listening-performance-${RESULTS_FILE_NAME}
205 Wait_For_Stable_Ipv4_Topology_After_Listening
206 [Documentation] Wait until example-ipv4-topology becomes stable again.
208 ChangeCounter.Wait_For_Change_Count_To_Become_Stable timeout=${bgp_emptying_timeout} period=${CHECK_PERIOD_CHANGE_COUNT_SINGLE} repetitions=${REPETITIONS_CHANGE_COUNT_SINGLE} count_to_overcome=${last_change_count_single}
210 Check_For_Empty_Ipv4_Topology_After_Listening
211 [Documentation] Example-ipv4-topology should be empty now.
213 [Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
214 PrefixCounting.Check_Ipv4_Topology_Is_Empty
216 Restore_Karaf_Logging_Levels
217 [Documentation] Set logging on bgpcep and protocol to the global value.
218 KarafKeywords.Set_Bgpcep_Log_Levels bgpcep_level=${KARAF_LOG_LEVEL} protocol_level=${KARAF_LOG_LEVEL}
220 Restore_Data_Change_Counter_Configuration
221 [Documentation] Configure data change counter back to count transactions affecting example-linkstate-topology.
222 [Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
223 ChangeCounter.Reconfigure_Topology_Name example-linkstate-topology
225 Delete_Bgp_Peer_Configuration
226 [Documentation] Revert the BGP configuration to the original state: without any configured peers.
227 [Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
228 &{mapping} BuiltIn.Create_Dictionary DEVICE_NAME=${DEVICE_NAME} BGP_NAME=${BGP_PEER_NAME} IP=${TOOLS_SYSTEM_IP} BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG}
229 TemplatedRequests.Delete_Templated ${BGP_VARIABLES_FOLDER}${/}bgp_peer mapping=${mapping}
231 Remove_Netconf_Device
232 [Documentation] Removes netconf device if ${USE_NETCONF_CONNECTOR} is False.
233 [Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
234 BuiltIn.Run_Keyword_If """${USE_NETCONF_CONNECTOR}""" == """True""" BuiltIn.Pass_Execution No need to remove netconf device because netconf connector is present.
235 &{mapping} BuiltIn.Create_Dictionary DEVICE_NAME=${DEVICE_NAME} DEVICE_PORT=1830 DEVICE_IP=${ODL_SYSTEM_IP} DEVICE_USER=admin DEVICE_PASSWORD=admin
236 TemplatedRequests.Delete_Templated ${NETCONF_DEV_FOLDER} mapping=${mapping}
240 [Documentation] Setup imported resources, SSH-login to tools system,
241 ... create HTTP session, put Python tool to tools system.
242 SetupUtils.Setup_Utils_For_Setup_And_Teardown
243 TemplatedRequests.Create_Default_Session
244 ChangeCounter.CC_Setup
245 PrefixCounting.PC_Setup
246 RequestsLibrary.Create_Session operational http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH} timeout=125 max_retries=0
247 # TODO: Do not include slash in ${OPERATIONAL_TOPO_API}, having it typed here is more readable.
248 # TODO: Alternatively, create variable in Variables which starts with http.
249 # Both TODOs would probably need to update every suite relying on current Variables.
250 SSHLibrary.Set_Default_Configuration prompt=${TOOLS_SYSTEM_PROMPT}
251 SSHLibrary.Open_Connection ${TOOLS_SYSTEM_IP}
252 SSHKeywords.Flexible_Mininet_Login
253 SSHKeywords.Require_Python
254 SSHKeywords.Assure_Library_Ipaddr target_dir=.
255 SSHLibrary.Put_File ${CURDIR}/../../../../tools/fastbgp/play.py
256 # Calculate the timeout value based on how many routes are going to be pushed
257 # TODO: Unify formulas with other suites in this directory.
258 ${timeout} = BuiltIn.Evaluate ${TEST_DURATION_MULTIPLIER_CHANGE_COUNT_SINGLE} * (${COUNT_CHANGE_COUNT_SINGLE} * 9.0 / 10000 + 20)
259 Builtin.Set_Suite_Variable ${bgp_filling_timeout} ${timeout}
260 Builtin.Set_Suite_Variable ${bgp_emptying_timeout} ${bgp_filling_timeout*3.0/4}
261 KarafKeywords.Execute_Controller_Karaf_Command_On_Background log:set ${KARAF_LOG_LEVEL}
264 [Documentation] Make sure Python tool was killed and tear down imported Resources.
265 # Environment issue may have dropped the SSH connection, but we do not want Teardown to fail.
266 BuiltIn.Run_Keyword_And_Ignore_Error KillPythonTool.Search_And_Kill_Remote_Python 'play\.py'
267 RequestsLibrary.Delete_All_Sessions
268 SSHLibrary.Close_All_Connections
271 [Documentation] Get the count of changes from BGP change counter. Ignore error or store the value.
272 ${status} ${count} = BuiltIn.Run_Keyword_And_Ignore_Error ChangeCounter.Get_Change_Count
273 BuiltIn.Run_Keyword_If '${status}' == 'PASS' BuiltIn.Set_Suite_Variable ${last_change_count_single} ${count}
275 Store_File_To_Workspace
276 [Arguments] ${src_file_name} ${dst_file_name}
277 [Documentation] Store the provided file from the SSH client to workspace.
278 ${files}= SSHLibrary.List Files In Directory .
279 ${output_log}= SSHLibrary.Execute_Command cat ${src_file_name}
280 BuiltIn.Log ${output_log}
281 Create File ${dst_file_name} ${output_log}