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/KarafKeywords.robot
20 Resource ../../../libraries/SetupUtils.robot
21 Resource ../../../libraries/SSHKeywords.robot
22 Resource ../../../libraries/TemplatedRequests.robot
23 Resource ../../../libraries/WaitForFailure.robot
24 Resource ../../../variables/Variables.robot
26 Suite Setup Setup_Everything
27 Suite Teardown BgpOperations.Teardown_Everything
28 Test Setup SetupUtils.Setup_Test_With_Logging_And_Without_Fast_Failing
29 Test Teardown SetupUtils.Teardown_Test_Show_Bugs_If_Test_Failed
33 ${BGP_VARIABLES_FOLDER} ${CURDIR}/../../../variables/bgpuser/
36 ${BGP_PEER_LOG_FILE} bgp_peer.log
38 ... 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
39 ${BGP_PEER_OPTIONS} &>${BGP_PEER_LOG_FILE}
40 ${DEFAULT_RIB_CHECK_PERIOD} 1s
41 ${DEFAULT_RIB_CHECK_TIMEOUT} 10s
42 ${BGP_PEER_LOG_LEVEL} debug
43 ${JSONKEYSTR} "linkstate-route"
44 ${BGP_PEER_NAME} example-bgp-peer
45 ${DEVICE_NAME} controller-config
46 ${CONFIG_SESSION} config-session
47 ${SKIP_PARAMS} --skipattr
48 ${RIB_INSTANCE} example-bgp-rib
49 ${PROTOCOL_OPENCONFIG} ${RIB_INSTANCE}
50 ${ROUTE_KEY} AAUAFQcAAAAAAAAAAQECAwQAAQABBQYHCA==
54 TC1_Configure_iBGP_Peer
55 [Documentation] Configure BGP peer module with initiate-connection set to false.
57 &{mapping} Create Dictionary
58 ... DEVICE_NAME=${DEVICE_NAME}
59 ... BGP_NAME=${BGP_PEER_NAME}
60 ... IP=${TOOLS_SYSTEM_IP}
61 ... HOLDTIME=${HOLDTIME}
62 ... PEER_PORT=${BGP_TOOL_PORT}
64 ... BGP_RIB=${RIB_INSTANCE}
66 ... BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG}
67 ... RIB_INSTANCE_NAME=${RIB_INSTANCE}
68 TemplatedRequests.Put_As_Xml_Templated
69 ... ${BGP_VARIABLES_FOLDER}${/}bgp_peer
70 ... mapping=${mapping}
71 ... session=${CONFIG_SESSION}
73 TC1_Check_Example_Bgp_Rib_Is_Empty
74 [Documentation] Check RIB for none linkstate-routes
76 BgpOperations.Check_Example_Bgp_Rib_Does_Not_Contain ${CONFIG_SESSION} ${JSONKEYSTR}
79 [Documentation] Connect BGP peer with advertising the routes without mandatory params like LOC_PREF.
81 BuiltIn.Run_Keyword_And_Ignore_Error
82 ... KarafKeywords.Log_Message_To_Controller_Karaf
83 ... Error = WELL_KNOWN_ATTR_MISSING is EXPECTED in this test case, and should be thrown when missing mandatory attributes.
84 BGPcliKeywords.Start_Console_Tool ${BGP_PEER_COMMAND} ${SKIP_PARAMS} ${BGP_PEER_OPTIONS}
85 BGPcliKeywords.Read_And_Fail_If_Prompt_Is_Seen
87 TC1_Check_Example_Bgp_Rib
88 [Documentation] Check RIB for not containig linkstate-route(s), because update messages were not good.
90 WaitForFailure.Verify_Keyword_Does_Not_Fail_Within_Timeout
91 ... ${DEFAULT_RIB_CHECK_TIMEOUT}
92 ... ${DEFAULT_RIB_CHECK_PERIOD}
93 ... BgpOperations.Check_Example_Bgp_Rib_Does_Not_Contain
97 TC1_Disconnect_BGP_Peer
98 [Documentation] Stop BGP peer & store logs
100 BGPcliKeywords.Stop_Console_Tool
101 BGPcliKeywords.Store_File_To_Workspace ${BGP_PEER_LOG_FILE} tc1_${BGP_PEER_LOG_FILE}
103 TC1_Deconfigure_iBGP_Peer
104 [Documentation] Revert the BGP configuration to the original state: without any configured peers.
105 &{mapping} BuiltIn.Create_Dictionary
106 ... DEVICE_NAME=${DEVICE_NAME}
107 ... BGP_NAME=${BGP_PEER_NAME}
108 ... IP=${TOOLS_SYSTEM_IP}
109 ... BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG}
110 TemplatedRequests.Delete_Templated
111 ... ${BGP_VARIABLES_FOLDER}/bgp_peer
112 ... mapping=${mapping}
113 ... session=${CONFIG_SESSION}
115 TC2_Configure_iBGP_Peer
116 [Documentation] Configures BGP peer module with initiate-connection set to false.
117 &{mapping} BuiltIn.Create_Dictionary
118 ... DEVICE_NAME=${DEVICE_NAME}
119 ... BGP_NAME=${BGP_PEER_NAME}
120 ... IP=${TOOLS_SYSTEM_IP}
121 ... HOLDTIME=${HOLDTIME}
122 ... PEER_PORT=${BGP_TOOL_PORT}
124 ... RIB_INSTANCE_NAME=${RIB_INSTANCE}
125 ... PASSIVE_MODE=true
126 ... BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG}
127 TemplatedRequests.Put_As_Xml_Templated
128 ... ${BGP_VARIABLES_FOLDER}/bgp_peer
129 ... mapping=${mapping}
130 ... session=${CONFIG_SESSION}
132 TC2_Check_Example_Bgp_Rib_Is_Empty
133 [Documentation] Check RIB for none linkstate-routes
135 BgpOperations.Check_Example_Bgp_Rib_Does_Not_Contain ${CONFIG_SESSION} ${JSONKEYSTR}
138 [Documentation] Connect BGP peer
140 BGPcliKeywords.Start_Console_Tool ${BGP_PEER_COMMAND} ${BGP_PEER_OPTIONS}
141 BGPcliKeywords.Read_And_Fail_If_Prompt_Is_Seen
143 TC2_Check_Example_Bgp_Rib
144 [Documentation] Check RIB for linkstate-route(s) and check all of their attributes.
146 &{mapping} BuiltIn.Create_Dictionary IP=${TOOLS_SYSTEM_IP} ROUTE_KEY=${ROUTE_KEY}
147 BuiltIn.Wait_Until_Keyword_Succeeds
148 ... ${DEFAULT_RIB_CHECK_TIMEOUT}
149 ... ${DEFAULT_RIB_CHECK_PERIOD}
150 ... TemplatedRequests.Get_As_Json_Templated
151 ... ${BGP_VARIABLES_FOLDER}/lsp/effective_rib_in
152 ... mapping=${mapping}
153 ... session=${CONFIG_SESSION}
156 TC2_Disconnect_BGP_Peer
157 [Documentation] Stop BGP peer & store logs
159 BGPcliKeywords.Stop_Console_Tool
160 BGPcliKeywords.Store_File_To_Workspace ${BGP_PEER_LOG_FILE} tc2_${BGP_PEER_LOG_FILE}
162 TC2_Deconfigure_iBGP_Peer
163 [Documentation] Revert the BGP configuration to the original state: without any configured peers.
164 &{mapping} BuiltIn.Create_Dictionary
165 ... DEVICE_NAME=${DEVICE_NAME}
166 ... BGP_NAME=${BGP_PEER_NAME}
167 ... IP=${TOOLS_SYSTEM_IP}
168 ... BGP_RIB_OPENCONFIG=${PROTOCOL_OPENCONFIG}
169 TemplatedRequests.Delete_Templated
170 ... ${BGP_VARIABLES_FOLDER}/bgp_peer
171 ... mapping=${mapping}
172 ... session=${CONFIG_SESSION}
177 [Documentation] Initialize SetupUtils. SSH-login to mininet machine, create HTTP session,
178 ... prepare directories for responses, put Python tool to mininet machine, setup imported resources.
179 SetupUtils.Setup_Utils_For_Setup_And_Teardown
180 SSHLibrary.Set_Default_Configuration prompt=${TOOLS_SYSTEM_PROMPT}
181 SSHLibrary.Open_Connection ${TOOLS_SYSTEM_IP}
182 SSHKeywords.Flexible_Mininet_Login
183 SSHKeywords.Require_Python
184 SSHKeywords.Assure_Library_Ipaddr target_dir=.
185 SSHLibrary.Put_File ${CURDIR}/../../../../tools/fastbgp/play.py
186 RequestsLibrary.Create_Session ${CONFIG_SESSION} http://${ODL_SYSTEM_IP}:${RESTCONFPORT} auth=${AUTH}
187 KarafKeywords.Setup_Karaf_Keywords