blob: 6a432f3910ed4c0893e7c8181ee1ac3545e88ca6 [file] [log] [blame]
Thejaswi N K6a4cd002015-09-21 17:19:55 +05301/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2015-present Open Networking Laboratory
Thejaswi N K6a4cd002015-09-21 17:19:55 +05303 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.onosproject.bgp.controller;
17
18import java.util.TreeMap;
19
20/**
21 * Abstraction of an BGP configuration. Manages the BGP configuration from CLI to the BGP controller.
22 */
Shashikanth VH5dd8dbe2015-11-26 13:22:18 +053023public interface BgpCfg {
Thejaswi N K6a4cd002015-09-21 17:19:55 +053024
25 enum State {
26 /**
27 * Signifies that its just created.
28 */
29 INIT,
30
31 /**
32 * Signifies that only IP Address is configured.
33 */
34 IP_CONFIGURED,
35
36 /**
37 * Signifies that only Autonomous System is configured.
38 */
39 AS_CONFIGURED,
40
41 /**
42 * Signifies that both IP and Autonomous System is configured.
43 */
44 IP_AS_CONFIGURED
45 }
46
Shashikanth VH580bdeb2016-02-19 17:26:03 +053047 enum FlowSpec {
48
49 /**
50 * Signifies that peer support IPV4 flow specification.
51 */
52 IPV4,
53
54 /**
55 * Signifies that peer support VPNV4 flow specification.
56 */
57 VPNV4,
58
59 /**
60 * Signifies that peer support IPV4 and VPNV4 flow specification.
61 */
62 IPV4_VPNV4,
63
64 /**
65 * Signifies that peer flow specification capability disabled.
66 */
67 NONE
68 }
69
Thejaswi N K6a4cd002015-09-21 17:19:55 +053070 /**
71 * Returns the status of the configuration based on this state certain operations like connection is handled.
72 *
Satish Ke107e662015-09-21 19:00:17 +053073 * @return State of the configuration
Thejaswi N K6a4cd002015-09-21 17:19:55 +053074 */
75 State getState();
76
77 /**
78 * To set the current state of the configuration.
79 *
Satish Ke107e662015-09-21 19:00:17 +053080 * @param state Configuration State enum
Thejaswi N K6a4cd002015-09-21 17:19:55 +053081 */
82 void setState(State state);
83
84 /**
85 * Get the status of the link state support for this BGP speaker.
86 *
Shashikanth VH0a82a8e2016-02-02 20:42:53 +053087 * @return true if the link state is supported else false
Thejaswi N K6a4cd002015-09-21 17:19:55 +053088 */
89 boolean getLsCapability();
90
91 /**
92 * Set the link state support to this BGP speaker.
93 *
Satish Ke107e662015-09-21 19:00:17 +053094 * @param lscapability true value if link state is supported else false
Thejaswi N K6a4cd002015-09-21 17:19:55 +053095 */
96 void setLsCapability(boolean lscapability);
97
98 /**
99 * Get the status of the 32 bit AS support for this BGP speaker.
100 *
Satish Ke107e662015-09-21 19:00:17 +0530101 * @return true if the 32 bit AS number is supported else false
Thejaswi N K6a4cd002015-09-21 17:19:55 +0530102 */
103 boolean getLargeASCapability();
104
105 /**
106 * Set the 32 bit AS support capability to this BGP speaker.
107 *
Shashikanth VH0a82a8e2016-02-02 20:42:53 +0530108 * @param largeAs true value if the 32 bit AS is supported else false
Thejaswi N K6a4cd002015-09-21 17:19:55 +0530109 */
110 void setLargeASCapability(boolean largeAs);
111
112 /**
113 * Set the AS number to which this BGP speaker belongs.
114 *
Satish Ke107e662015-09-21 19:00:17 +0530115 * @param localAs 16 or 32 bit AS number, length is dependent on the capability
Thejaswi N K6a4cd002015-09-21 17:19:55 +0530116 */
117 void setAsNumber(int localAs);
118
119 /**
120 * Get the AS number to which this BGP speaker belongs.
121 *
Satish Ke107e662015-09-21 19:00:17 +0530122 * @return 16 or 32 bit AS number, length is dependent on the capability
Thejaswi N K6a4cd002015-09-21 17:19:55 +0530123 */
124 int getAsNumber();
125
126 /**
127 * Get the connection retry count number.
128 *
Satish Ke107e662015-09-21 19:00:17 +0530129 * @return connection retry count if there is a connection error
Thejaswi N K6a4cd002015-09-21 17:19:55 +0530130 */
131 int getMaxConnRetryCount();
132
133 /**
134 * Set the connection retry count.
135 *
Satish Ke107e662015-09-21 19:00:17 +0530136 * @param retryCount number of times to try to connect if there is any error
Thejaswi N K6a4cd002015-09-21 17:19:55 +0530137 */
138 void setMaxConnRetryCout(int retryCount);
139
140 /**
141 * Get the connection retry time in seconds.
142 *
Satish Ke107e662015-09-21 19:00:17 +0530143 * @return connection retry time in seconds
Thejaswi N K6a4cd002015-09-21 17:19:55 +0530144 */
145 int getMaxConnRetryTime();
146
147 /**
148 * Set the connection retry time in seconds.
149 *
Satish Ke107e662015-09-21 19:00:17 +0530150 * @param retryTime connection retry times in seconds
Thejaswi N K6a4cd002015-09-21 17:19:55 +0530151 */
152 void setMaxConnRetryTime(int retryTime);
153
154 /**
155 * Set the keep alive timer for the connection.
156 *
Satish Ke107e662015-09-21 19:00:17 +0530157 * @param holdTime connection hold timer in seconds
Thejaswi N K6a4cd002015-09-21 17:19:55 +0530158 */
159 void setHoldTime(short holdTime);
160
161 /**
162 * Returns the connection hold timer in seconds.
163 *
Satish Ke107e662015-09-21 19:00:17 +0530164 * @return connection hold timer in seconds
Thejaswi N K6a4cd002015-09-21 17:19:55 +0530165 */
166 short getHoldTime();
167
168 /**
169 * Returns the maximum number of session supported.
170 *
Satish Ke107e662015-09-21 19:00:17 +0530171 * @return maximum number of session supported
Thejaswi N K6a4cd002015-09-21 17:19:55 +0530172 */
173 int getMaxSession();
174
175 /**
176 * Set the maximum number of sessions to support.
177 *
Satish Ke107e662015-09-21 19:00:17 +0530178 * @param maxsession maximum number of session
Thejaswi N K6a4cd002015-09-21 17:19:55 +0530179 */
180 void setMaxSession(int maxsession);
181
182 /**
183 * Returns the Router ID of this BGP speaker.
184 *
Satish Ke107e662015-09-21 19:00:17 +0530185 * @return IP address in string format
Thejaswi N K6a4cd002015-09-21 17:19:55 +0530186 */
187 String getRouterId();
188
189 /**
190 * Set the Router ID of this BGP speaker.
191 *
Shashikanth VH0a82a8e2016-02-02 20:42:53 +0530192 * @param routerid IP address in string format
Thejaswi N K6a4cd002015-09-21 17:19:55 +0530193 */
194 void setRouterId(String routerid);
195
196 /**
197 * Add the BGP peer IP address and the AS number to which it belongs.
198 *
Satish Ke107e662015-09-21 19:00:17 +0530199 * @param routerid IP address in string format
Shashikanth VH0a82a8e2016-02-02 20:42:53 +0530200 * @param remoteAs AS number to which it belongs
Satish Ke107e662015-09-21 19:00:17 +0530201 *
202 * @return true if added successfully else false
Thejaswi N K6a4cd002015-09-21 17:19:55 +0530203 */
204 boolean addPeer(String routerid, int remoteAs);
205
206 /**
207 * Add the BGP peer IP address and the keep alive time.
208 *
Satish Ke107e662015-09-21 19:00:17 +0530209 * @param routerid IP address in string format
210 * @param holdTime keep alive time for the connection
211 *
212 * @return true if added successfully else false
Thejaswi N K6a4cd002015-09-21 17:19:55 +0530213 */
214 boolean addPeer(String routerid, short holdTime);
215
216 /**
217 * Add the BGP peer IP address, the AS number to which it belongs and keep alive time.
218 *
Satish Ke107e662015-09-21 19:00:17 +0530219 * @param routerid IP address in string format
220 * @param remoteAs AS number to which it belongs
221 * @param holdTime keep alive time for the connection
222 *
Shashikanth VH0a82a8e2016-02-02 20:42:53 +0530223 * @return true if added successfully else false
Thejaswi N K6a4cd002015-09-21 17:19:55 +0530224 */
225 boolean addPeer(String routerid, int remoteAs, short holdTime);
226
227 /**
228 * Remove the BGP peer with this IP address.
229 *
Satish Ke107e662015-09-21 19:00:17 +0530230 * @param routerid router IP address
231 *
232 * @return true if removed successfully else false
Thejaswi N K6a4cd002015-09-21 17:19:55 +0530233 */
234 boolean removePeer(String routerid);
235
236 /**
237 * Connect to BGP peer with this IP address.
238 *
Satish Ke107e662015-09-21 19:00:17 +0530239 * @param routerid router IP address
240 *
Shashikanth VH0a82a8e2016-02-02 20:42:53 +0530241 * @return true of the configuration is found and able to connect else false
Thejaswi N K6a4cd002015-09-21 17:19:55 +0530242 */
243 boolean connectPeer(String routerid);
244
245 /**
246 * Disconnect this BGP peer with this IP address.
247 *
Shashikanth VH0a82a8e2016-02-02 20:42:53 +0530248 * @param routerid router IP address in string format
Satish Ke107e662015-09-21 19:00:17 +0530249 *
250 * @return true if the configuration is found and able to disconnect else false
Thejaswi N K6a4cd002015-09-21 17:19:55 +0530251 */
252 boolean disconnectPeer(String routerid);
253
254 /**
255 * Returns the peer tree information.
256 *
Satish Ke107e662015-09-21 19:00:17 +0530257 * @return return the tree map with IP as key and BGPPeerCfg as object
Thejaswi N K6a4cd002015-09-21 17:19:55 +0530258 */
Shashikanth VH5dd8dbe2015-11-26 13:22:18 +0530259 TreeMap<String, BgpPeerCfg> displayPeers();
Thejaswi N K6a4cd002015-09-21 17:19:55 +0530260
261 /**
262 * Return the BGP Peer information with this matching IP.
263 *
Satish Ke107e662015-09-21 19:00:17 +0530264 * @param routerid router IP address in string format
265 *
266 * @return BGPPeerCfg object
Thejaswi N K6a4cd002015-09-21 17:19:55 +0530267 */
Shashikanth VH5dd8dbe2015-11-26 13:22:18 +0530268 BgpPeerCfg displayPeers(String routerid);
Thejaswi N K6a4cd002015-09-21 17:19:55 +0530269
270 /**
271 * Check if this BGP peer is configured.
272 *
Shashikanth VH0a82a8e2016-02-02 20:42:53 +0530273 * @param routerid router IP address in string format
Satish Ke107e662015-09-21 19:00:17 +0530274 *
Shashikanth VH0a82a8e2016-02-02 20:42:53 +0530275 * @return true if configured exists else false
Thejaswi N K6a4cd002015-09-21 17:19:55 +0530276 */
277 boolean isPeerConfigured(String routerid);
278
279 /**
280 * Check if this BGP speaker is having connection with the peer.
281 *
Satish Ke107e662015-09-21 19:00:17 +0530282 * @param routerid router IP address in string format
283 *
284 * @return true if the connection exists else false
Thejaswi N K6a4cd002015-09-21 17:19:55 +0530285 */
286 boolean isPeerConnected(String routerid);
287
288 /**
289 * Return the peer tree map.
290 *
Satish Ke107e662015-09-21 19:00:17 +0530291 * @return return the tree map with IP as key and BGPPeerCfg as object
Thejaswi N K6a4cd002015-09-21 17:19:55 +0530292 */
Shashikanth VH5dd8dbe2015-11-26 13:22:18 +0530293 TreeMap<String, BgpPeerCfg> getPeerTree();
Thejaswi N K6a4cd002015-09-21 17:19:55 +0530294
295 /**
296 * Set the current connection state information.
297 *
Shashikanth VH0a82a8e2016-02-02 20:42:53 +0530298 * @param routerid router IP address in string format
Satish Ke107e662015-09-21 19:00:17 +0530299 * @param state state information
Thejaswi N K6a4cd002015-09-21 17:19:55 +0530300 */
Shashikanth VH5dd8dbe2015-11-26 13:22:18 +0530301 void setPeerConnState(String routerid, BgpPeerCfg.State state);
Thejaswi N K6a4cd002015-09-21 17:19:55 +0530302
303 /**
304 * Check if the peer can be connected or not.
305 *
Shashikanth VH0a82a8e2016-02-02 20:42:53 +0530306 * @param routerid router IP address in string format
Satish Ke107e662015-09-21 19:00:17 +0530307 *
Shashikanth VH0a82a8e2016-02-02 20:42:53 +0530308 * @return true if the peer can be connected else false
Thejaswi N K6a4cd002015-09-21 17:19:55 +0530309 */
310 boolean isPeerConnectable(String routerid);
311
312 /**
313 * Get the current peer connection state information.
314 *
Satish Ke107e662015-09-21 19:00:17 +0530315 * @param routerid router IP address in string format
316 *
317 * @return state information
Thejaswi N K6a4cd002015-09-21 17:19:55 +0530318 */
Shashikanth VH5dd8dbe2015-11-26 13:22:18 +0530319 BgpPeerCfg.State getPeerConnState(String routerid);
Shashikanth VH580bdeb2016-02-19 17:26:03 +0530320
321 /**
322 * Gets the flow specification capability.
323 *
324 * @return flow specification capability
325 */
326 FlowSpec flowSpecCapability();
327
328 /**
329 * Sets the flow specification capability.
330 *
331 * @param flowSpec flow specification capability
332 */
333 void setFlowSpecCapability(FlowSpec flowSpec);
Shashikanth VHb650bfa2016-04-18 12:54:03 +0530334
335 /**
336 * Returns the flow specification route policy distribution capability.
337 *
338 * @return RDP flow specification capability
339 */
340 boolean flowSpecRpdCapability();
341
342 /**
343 * Sets the flow specification route policy distribution capability.
344 *
345 * @param rpdCapability flow specification RPD capability
346 */
347 void setFlowSpecRpdCapability(boolean rpdCapability);
Thejaswi N K6a4cd002015-09-21 17:19:55 +0530348}