2 Documentation Basic tests for iBGP peers.
4 ... Copyright (c) 2015-2016 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
10 ... Test suite performs basic iBGP functional test case for
11 ... carrying LSP State Information in BGP as described in
12 ... http://tools.ietf.org/html/draft-ietf-idr-te-lsp-distribution-03
14 Library OperatingSystem
15 Library RequestsLibrary
17 Resource ../../../libraries/BGPcliKeywords.robot
18 Resource ../../../libraries/BgpOperations.robot
19 Resource ../../../libraries/CompareStream.robot
20 Resource ../../../libraries/KarafKeywords.robot
21 Resource ../../../libraries/SetupUtils.robot
22 Resource ../../../libraries/SSHKeywords.robot
23 Resource ../../../libraries/TemplatedRequests.robot
24 Resource ../../../libraries/WaitForFailure.robot
25 Resource ../../../variables/Variables.robot
27 Suite Setup Setup_Everything
28 Suite Teardown BgpOperations.Teardown_Everything
29 Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
30 Test Teardown SetupUtils.Teardown_Test_Show_Bugs_If_Test_Failed
34 ${BGP_VARIABLES_FOLDER} ${CURDIR}/../../../variables/bgpuser/
37 ${BGP_PEER_LOG_FILE} bgp_peer.log
39 ... python3 play.py --amount ${COUNT} --myip=${TOOLS_SYSTEM_IP} --myport=${BGP_TOOL_PORT} --peerip=${ODL_SYSTEM_IP} --peerport=${ODL_BGP_PORT} --${BGP_PEER_LOG_LEVEL} --logfile ${BGP_PEER_LOG_FILE} --bgpls True
40 ${BGP_PEER_OPTIONS} &>${BGP_PEER_LOG_FILE}
41 ${DEFAULT_RIB_CHECK_PERIOD} 1s
42 ${DEFAULT_RIB_CHECK_TIMEOUT} 10s
43 ${BGP_PEER_LOG_LEVEL} debug
44 ${JSONKEYSTR} "linkstate-route"
45 ${BGP_PEER_NAME} example-bgp-peer
46 ${DEVICE_NAME} controller-config
47 ${CONFIG_SESSION} config-session
48 ${SKIP_PARAMS} --skipattr
49 ${RIB_INSTANCE} example-bgp-rib
50 ${PROTOCOL_OPENCONFIG} ${RIB_INSTANCE}
51 ${OLD_ROUTE_KEY} [0, 5, 0, 21, 7, 0, 0, 0, 0, 0, 0, 0, 1, 1, 2, 3, 4, 0, 1, 0, 1, 5, 6, 7, 8]
52 ${NEW_ROUTE_KEY} AAUAFQcAAAAAAAAAAQECAwQAAQABBQYHCA==
56 TC1_Configure_iBGP_Peer
57 [Documentation] Configure BGP peer module with initiate-connection set to false.
59 &{mapping} Create Dictionary
60 ... DEVICE_NAME=${DEVICE_NAME}
61 ... BGP_NAME=${BGP_PEER_NAME}
62 ... IP=${TOOLS_SYSTEM_IP}
63 ... HOLDTIME=${HOLDTIME}
64 ... PEER_PORT=${BGP_TOOL_PORT}
66 ... BGP_RIB=${RIB_INSTANCE}
68 ... BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG}
69 ... RIB_INSTANCE_NAME=${RIB_INSTANCE}
70 TemplatedRequests.Put_As_Xml_Templated
71 ... ${BGP_VARIABLES_FOLDER}${/}bgp_peer
72 ... mapping=${mapping}
73 ... session=${CONFIG_SESSION}
75 TC1_Check_Example_Bgp_Rib_Is_Empty
76 [Documentation] Check RIB for none linkstate-routes
78 BgpOperations.Check_Example_Bgp_Rib_Does_Not_Contain ${CONFIG_SESSION} ${JSONKEYSTR}
81 [Documentation] Connect BGP peer with advertising the routes without mandatory params like LOC_PREF.
83 BuiltIn.Run_Keyword_And_Ignore_Error
84 ... KarafKeywords.Log_Message_To_Controller_Karaf
85 ... Error = WELL_KNOWN_ATTR_MISSING is EXPECTED in this test case, and should be thrown when missing mandatory attributes.
86 BGPcliKeywords.Start_Console_Tool ${BGP_PEER_COMMAND} ${SKIP_PARAMS} ${BGP_PEER_OPTIONS}
87 BGPcliKeywords.Read_And_Fail_If_Prompt_Is_Seen
89 TC1_Check_Example_Bgp_Rib
90 [Documentation] Check RIB for not containig linkstate-route(s), because update messages were not good.
92 WaitForFailure.Verify_Keyword_Does_Not_Fail_Within_Timeout
93 ... ${DEFAULT_RIB_CHECK_TIMEOUT}
94 ... ${DEFAULT_RIB_CHECK_PERIOD}
95 ... BgpOperations.Check_Example_Bgp_Rib_Does_Not_Contain
99 TC1_Disconnect_BGP_Peer
100 [Documentation] Stop BGP peer & store logs
102 BGPcliKeywords.Stop_Console_Tool
103 BGPcliKeywords.Store_File_To_Workspace ${BGP_PEER_LOG_FILE} tc1_${BGP_PEER_LOG_FILE}
105 TC1_Deconfigure_iBGP_Peer
106 [Documentation] Revert the BGP configuration to the original state: without any configured peers.
107 &{mapping} BuiltIn.Create_Dictionary
108 ... DEVICE_NAME=${DEVICE_NAME}
109 ... BGP_NAME=${BGP_PEER_NAME}
110 ... IP=${TOOLS_SYSTEM_IP}
111 ... BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG}
112 TemplatedRequests.Delete_Templated
113 ... ${BGP_VARIABLES_FOLDER}/bgp_peer
114 ... mapping=${mapping}
115 ... session=${CONFIG_SESSION}
117 TC2_Configure_iBGP_Peer
118 [Documentation] Configures BGP peer module with initiate-connection set to false.
119 &{mapping} BuiltIn.Create_Dictionary
120 ... DEVICE_NAME=${DEVICE_NAME}
121 ... BGP_NAME=${BGP_PEER_NAME}
122 ... IP=${TOOLS_SYSTEM_IP}
123 ... HOLDTIME=${HOLDTIME}
124 ... PEER_PORT=${BGP_TOOL_PORT}
126 ... RIB_INSTANCE_NAME=${RIB_INSTANCE}
127 ... PASSIVE_MODE=true
128 ... BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG}
129 TemplatedRequests.Put_As_Xml_Templated
130 ... ${BGP_VARIABLES_FOLDER}/bgp_peer
131 ... mapping=${mapping}
132 ... session=${CONFIG_SESSION}
134 TC2_Check_Example_Bgp_Rib_Is_Empty
135 [Documentation] Check RIB for none linkstate-routes
137 BgpOperations.Check_Example_Bgp_Rib_Does_Not_Contain ${CONFIG_SESSION} ${JSONKEYSTR}
140 [Documentation] Connect BGP peer
142 BGPcliKeywords.Start_Console_Tool ${BGP_PEER_COMMAND} ${BGP_PEER_OPTIONS}
143 BGPcliKeywords.Read_And_Fail_If_Prompt_Is_Seen
145 TC2_Check_Example_Bgp_Rib
146 [Documentation] Check RIB for linkstate-route(s) and check all of their attributes.
148 ${route_key} CompareStream.Set_Variable_If_At_Least_Fluorine ${NEW_ROUTE_KEY} ${OLD_ROUTE_KEY}
149 &{mapping} BuiltIn.Create_Dictionary IP=${TOOLS_SYSTEM_IP} ROUTE_KEY=${route_key}
150 BuiltIn.Wait_Until_Keyword_Succeeds
151 ... ${DEFAULT_RIB_CHECK_TIMEOUT}
152 ... ${DEFAULT_RIB_CHECK_PERIOD}
153 ... TemplatedRequests.Get_As_Json_Templated
154 ... ${BGP_VARIABLES_FOLDER}/lsp/effective_rib_in
155 ... mapping=${mapping}
156 ... session=${CONFIG_SESSION}
159 TC2_Disconnect_BGP_Peer
160 [Documentation] Stop BGP peer & store logs
162 BGPcliKeywords.Stop_Console_Tool
163 BGPcliKeywords.Store_File_To_Workspace ${BGP_PEER_LOG_FILE} tc2_${BGP_PEER_LOG_FILE}
165 TC2_Deconfigure_iBGP_Peer
166 [Documentation] Revert the BGP configuration to the original state: without any configured peers.
167 &{mapping} BuiltIn.Create_Dictionary
168 ... DEVICE_NAME=${DEVICE_NAME}
169 ... BGP_NAME=${BGP_PEER_NAME}
170 ... IP=${TOOLS_SYSTEM_IP}
171 ... BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG}
172 TemplatedRequests.Delete_Templated
173 ... ${BGP_VARIABLES_FOLDER}/bgp_peer
174 ... mapping=${mapping}
175 ... session=${CONFIG_SESSION}
180 [Documentation] Initialize SetupUtils. SSH-login to mininet machine, create HTTP session,
181 ... prepare directories for responses, put Python tool to mininet machine, setup imported resources.
182 SetupUtils.Setup_Utils_For_Setup_And_Teardown
183 SSHLibrary.Set_Default_Configuration prompt=${TOOLS_SYSTEM_PROMPT}
184 SSHLibrary.Open_Connection ${TOOLS_SYSTEM_IP}
185 SSHKeywords.Flexible_Mininet_Login
186 SSHKeywords.Require_Python
187 SSHKeywords.Assure_Library_Ipaddr target_dir=.
188 SSHLibrary.Put_File ${CURDIR}/../../../../tools/fastbgp/play.py
189 RequestsLibrary.Create_Session ${CONFIG_SESSION} http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH}
190 KarafKeywords.Setup_Karaf_Keywords