2 Documentation Functional test for bgp - route-target-constrain safi
4 ... Copyright (c) 2018 AT&T Intellectual Property. 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 distbmution,
8 ... and is available at http://www.eclipse.org/legal/epl-v10.html
10 ... This suite tests advertising rt-constrain routes to odl. For advertising from peer,
11 ... play.py is used, sending hex messages to odl.
12 ... For advertising to app-peer, we are sending post requests with routes in xml.
14 Library RequestsLibrary
17 Library ../../../libraries/BgpRpcClient.py ${TOOLS_SYSTEM_IP}
18 Resource ../../../libraries/BGPcliKeywords.robot
19 Resource ../../../libraries/BgpOperations.robot
20 Resource ../../../libraries/BGPSpeaker.robot
21 Resource ../../../libraries/SetupUtils.robot
22 Resource ../../../libraries/SSHKeywords.robot
23 Resource ../../../libraries/TemplatedRequests.robot
24 Resource ../../../variables/Variables.robot
26 Suite Setup Start_Suite
27 Suite Teardown Stop_Suite
28 Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
33 ${CONFIG_SESSION} config-session
34 ${RT_CONSTRAIN_DIR} ${CURDIR}/../../../variables/bgpfunctional/rt_constrain
35 ${PLAY_SCRIPT} ${CURDIR}/../../../../tools/fastbgp/play.py
36 ${RIB_NAME} example-bgp-rib
37 &{RT_CONSTRAIN_APP_PEER} IP=${ODL_SYSTEM_IP} BGP_RIB=${RIB_NAME}
38 &{RT_CONSTRAIN_ODL_CONFIG}
39 ... IP=${TOOLS_SYSTEM_IP}
40 ... HOLDTIME=${HOLDTIME}
41 ... PEER_PORT=${BGP_TOOL_PORT}
43 ... BGP_RIB=${RIB_NAME}
49 [Documentation] Configures bgp application peer.
50 [Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
51 TemplatedRequests.Put_As_Xml_Templated
52 ... ${RT_CONSTRAIN_DIR}/app_peer
53 ... mapping=${RT_CONSTRAIN_APP_PEER}
54 ... session=${CONFIG_SESSION}
56 Reconfigure_ODL_To_Accept_Connection
57 [Documentation] Configures BGP peer module with initiate-connection set to false.
58 [Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
59 TemplatedRequests.Put_As_Xml_Templated
60 ... ${RT_CONSTRAIN_DIR}/bgp_peer
61 ... mapping=${RT_CONSTRAIN_ODL_CONFIG}
62 ... session=${CONFIG_SESSION}
65 [Documentation] Start Python speaker to connect to ODL. We need to do WUKS until odl really starts to accept incomming bgp connection. The failure happens if the incomming connection comes too quickly after configuring the peer in the previous test case.
66 [Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
67 BuiltIn.Wait_Until_Keyword_Succeeds 3x 1s Start_Bgp_Peer
69 Odl_To_Play_rt_constrain_default
70 [Template] Odl_To_Play_Template
71 rt_constrain_default ${RT_CONSTRAIN_DIR}
73 Play_To_Odl_rt_constrain_default
74 [Template] Play_To_Odl_Template
75 rt_constrain_default ${RT_CONSTRAIN_DIR}
77 Odl_To_Play_rt_constrain_type_0
78 [Template] Odl_To_Play_Template
79 rt_constrain_type_0 ${RT_CONSTRAIN_DIR}
81 Play_To_Odl_rt_constrain_type_0
82 [Template] Play_To_Odl_Template
83 rt_constrain_type_0 ${RT_CONSTRAIN_DIR}
85 Odl_To_Play_rt_constrain_type_1
86 [Template] Odl_To_Play_Template
87 rt_constrain_type_1 ${RT_CONSTRAIN_DIR}
89 Play_To_Odl_rt_constrain_type_1
90 [Template] Play_To_Odl_Template
91 rt_constrain_type_1 ${RT_CONSTRAIN_DIR}
93 Odl_To_Play_rt_constrain_type_2
94 [Template] Odl_To_Play_Template
95 rt_constrain_type_2 ${RT_CONSTRAIN_DIR}
97 Play_To_Odl_rt_constrain_type_2
98 [Template] Play_To_Odl_Template
99 rt_constrain_type_2 ${RT_CONSTRAIN_DIR}
101 Kill_Talking_BGP_Speaker
102 [Documentation] Abort the Python speaker
103 [Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
104 BGPSpeaker.Kill_BGP_Speaker
105 BGPcliKeywords.Store_File_To_Workspace play.py.out rt_constrain_play.log
107 Delete_Bgp_Peer_Configuration
108 [Documentation] Revert the BGP configuration to the original state: without any configured peers.
109 [Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
110 TemplatedRequests.Delete_Templated
111 ... ${RT_CONSTRAIN_DIR}/bgp_peer
112 ... mapping=${RT_CONSTRAIN_ODL_CONFIG}
113 ... session=${CONFIG_SESSION}
116 [Documentation] Revert the BGP configuration to the original state: without application peer
117 [Setup] SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
118 TemplatedRequests.Delete_Templated
119 ... ${RT_CONSTRAIN_DIR}/app_peer
120 ... mapping=${RT_CONSTRAIN_APP_PEER}
121 ... session=${CONFIG_SESSION}
126 [Documentation] Initialize SetupUtils. Suite setup keyword.
127 SetupUtils.Setup_Utils_For_Setup_And_Teardown
128 ${mininet_conn_id} = SSHLibrary.Open Connection
129 ... ${TOOLS_SYSTEM_IP}
130 ... prompt=${DEFAULT_LINUX_PROMPT}
132 Builtin.Set Suite Variable ${mininet_conn_id}
133 SSHKeywords.Flexible Mininet Login ${TOOLS_SYSTEM_USER}
134 RequestsLibrary.Create Session ${CONFIG_SESSION} http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH}
135 SSHLibrary.Put File ${PLAY_SCRIPT} .
136 SSHKeywords.Assure_Library_Ipaddr target_dir=.
139 [Documentation] Suite teardown keyword
140 SSHLibrary.Close_All_Connections
141 RequestsLibrary.Delete_All_Sessions
144 [Documentation] Starts bgp peer and verifies that the peer runs.
145 BGPSpeaker.Start_BGP_Speaker
146 ... --amount 0 --myip=${TOOLS_SYSTEM_IP} --myport=${BGP_TOOL_PORT} --peerip=${ODL_SYSTEM_IP} --peerport=${ODL_BGP_PORT} --debug --rt_constrain --wfr 1
147 BGPcliKeywords.Read_And_Fail_If_Prompt_Is_Seen