diff options
author | Ashlee Young <ashlee@wildernessvoice.com> | 2015-12-01 05:49:27 -0800 |
---|---|---|
committer | Ashlee Young <ashlee@wildernessvoice.com> | 2015-12-01 05:49:27 -0800 |
commit | e63291850fd0795c5700e25e67e5dee89ba54c5f (patch) | |
tree | 9707289536ad95bb739c9856761ad43275e07d8c /framework/src/onos/bgp/api | |
parent | 671823e12bc13be9a8b87a5d7de33da1bb7a44e8 (diff) |
onos commit hash c2999f30c69e50df905a9d175ef80b3f23a98514
Change-Id: I2bb8562c4942b6d6a6d60b663db2e17540477b81
Signed-off-by: Ashlee Young <ashlee@wildernessvoice.com>
Diffstat (limited to 'framework/src/onos/bgp/api')
13 files changed, 405 insertions, 58 deletions
diff --git a/framework/src/onos/bgp/api/src/main/java/org/onosproject/bgp/controller/BGPCfg.java b/framework/src/onos/bgp/api/src/main/java/org/onosproject/bgp/controller/BgpCfg.java index 46165d87..6f64d2bb 100755 --- a/framework/src/onos/bgp/api/src/main/java/org/onosproject/bgp/controller/BGPCfg.java +++ b/framework/src/onos/bgp/api/src/main/java/org/onosproject/bgp/controller/BgpCfg.java @@ -20,7 +20,7 @@ import java.util.TreeMap; /** * Abstraction of an BGP configuration. Manages the BGP configuration from CLI to the BGP controller. */ -public interface BGPCfg { +public interface BgpCfg { enum State { /** @@ -233,7 +233,7 @@ public interface BGPCfg { * * @return return the tree map with IP as key and BGPPeerCfg as object */ - TreeMap<String, BGPPeerCfg> displayPeers(); + TreeMap<String, BgpPeerCfg> displayPeers(); /** * Return the BGP Peer information with this matching IP. @@ -242,7 +242,7 @@ public interface BGPCfg { * * @return BGPPeerCfg object */ - BGPPeerCfg displayPeers(String routerid); + BgpPeerCfg displayPeers(String routerid); /** * Check if this BGP peer is configured. @@ -267,7 +267,7 @@ public interface BGPCfg { * * @return return the tree map with IP as key and BGPPeerCfg as object */ - TreeMap<String, BGPPeerCfg> getPeerTree(); + TreeMap<String, BgpPeerCfg> getPeerTree(); /** * Set the current connection state information. @@ -275,7 +275,7 @@ public interface BGPCfg { * @param routerid router IP address in string format * @param state state information */ - void setPeerConnState(String routerid, BGPPeerCfg.State state); + void setPeerConnState(String routerid, BgpPeerCfg.State state); /** * Check if the peer can be connected or not. @@ -293,5 +293,5 @@ public interface BGPCfg { * * @return state information */ - BGPPeerCfg.State getPeerConnState(String routerid); + BgpPeerCfg.State getPeerConnState(String routerid); } diff --git a/framework/src/onos/bgp/api/src/main/java/org/onosproject/bgp/controller/BgpConnectPeer.java b/framework/src/onos/bgp/api/src/main/java/org/onosproject/bgp/controller/BgpConnectPeer.java new file mode 100755 index 00000000..8f33ee87 --- /dev/null +++ b/framework/src/onos/bgp/api/src/main/java/org/onosproject/bgp/controller/BgpConnectPeer.java @@ -0,0 +1,28 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.onosproject.bgp.controller; + +/** + * Abstraction of an BGP connect peer, initiate remote connection to BGP peer on configuration. + */ +public interface BgpConnectPeer { + /** + * Initiate bgp peer connection. + */ + void connectPeer(); + + /** + * End bgp peer connection. + */ + void disconnectPeer(); +} diff --git a/framework/src/onos/bgp/api/src/main/java/org/onosproject/bgp/controller/BGPController.java b/framework/src/onos/bgp/api/src/main/java/org/onosproject/bgp/controller/BgpController.java index 9d44041e..cc87eb32 100755 --- a/framework/src/onos/bgp/api/src/main/java/org/onosproject/bgp/controller/BGPController.java +++ b/framework/src/onos/bgp/api/src/main/java/org/onosproject/bgp/controller/BgpController.java @@ -19,21 +19,21 @@ package org.onosproject.bgp.controller; import java.util.Map; import java.util.Set; -import org.onosproject.bgpio.exceptions.BGPParseException; -import org.onosproject.bgpio.protocol.BGPMessage; +import org.onosproject.bgpio.exceptions.BgpParseException; +import org.onosproject.bgpio.protocol.BgpMessage; /** * Abstraction of an BGP controller. Serves as a one stop shop for obtaining BGP devices and (un)register listeners on * bgp events */ -public interface BGPController { +public interface BgpController { /** * Returns list of bgp peers connected to this BGP controller. * * @return Iterable of BGPPeer elements */ - Iterable<BGPPeer> getPeers(); + Iterable<BgpPeer> getPeers(); /** * Returns the actual bgp peer for the given ip address. @@ -41,7 +41,7 @@ public interface BGPController { * @param bgpId the id of the bgp peer to fetch * @return the interface to this bgp peer */ - BGPPeer getPeer(BGPId bgpId); + BgpPeer getPeer(BgpId bgpId); /** * Register a listener for BGP message events. @@ -58,35 +58,21 @@ public interface BGPController { void removeListener(BgpNodeListener listener); /** - * Register a listener for BGP message events. - * - * @param listener the listener to notify - */ - void addLinkListener(BgpLinkListener listener); - - /** - * Unregister a listener. - * - * @param listener the listener to unregister - */ - void removeLinkListener(BgpLinkListener listener); - - /** * Send a message to a particular bgp peer. * * @param bgpId the id of the peer to send message. * @param msg the message to send */ - void writeMsg(BGPId bgpId, BGPMessage msg); + void writeMsg(BgpId bgpId, BgpMessage msg); /** * Process a message and notify the appropriate listeners. * * @param bgpId id of the peer the message arrived on * @param msg the message to process. - * @throws BGPParseException on data processing error + * @throws BgpParseException on data processing error */ - void processBGPPacket(BGPId bgpId, BGPMessage msg) throws BGPParseException; + void processBGPPacket(BgpId bgpId, BgpMessage msg) throws BgpParseException; /** * Close all connected BGP peers. @@ -99,7 +85,7 @@ public interface BGPController { * * @return configuration object */ - BGPCfg getConfig(); + BgpCfg getConfig(); /** * Get the BGP connected peers to this controller. @@ -120,7 +106,7 @@ public interface BGPController { * * @return connectedPeers connected peers */ - Map<BGPId, BGPPeer> connectedPeers(); + Map<BgpId, BgpPeer> connectedPeers(); /** * Return BGP node listener. @@ -128,11 +114,4 @@ public interface BGPController { * @return node listener */ Set<BgpNodeListener> listener(); - - /** - * Return BGP link listener. - * - * @return link listener - */ - Set<BgpLinkListener> linkListener(); } diff --git a/framework/src/onos/bgp/api/src/main/java/org/onosproject/bgp/controller/BgpDpid.java b/framework/src/onos/bgp/api/src/main/java/org/onosproject/bgp/controller/BgpDpid.java new file mode 100755 index 00000000..ed04dc94 --- /dev/null +++ b/framework/src/onos/bgp/api/src/main/java/org/onosproject/bgp/controller/BgpDpid.java @@ -0,0 +1,130 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onosproject.bgp.controller; + +import static com.google.common.base.Preconditions.checkArgument; + +import java.net.URI; +import java.net.URISyntaxException; + +import org.onosproject.bgpio.exceptions.BgpParseException; +import org.onosproject.bgpio.protocol.linkstate.BgpLinkLsNlriVer4; +import org.onosproject.bgpio.protocol.linkstate.BgpNodeLSNlriVer4; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * The class representing a network bgp device id. This class is immutable. + */ +public final class BgpDpid { + private static final Logger log = LoggerFactory.getLogger(BgpDpid.class); + + private static final String SCHEME = "bgp"; + private static final long UNKNOWN = 0; + private StringBuilder stringBuilder; + public static final int NODE_DESCRIPTOR_LOCAL = 1; + public static final int NODE_DESCRIPTOR_REMOTE = 2; + + /** + * Initialize bgp id to generate URI. + * + * @param linkNlri node Nlri. + * @param nodeDescriptorType node descriptor type, local/remote + */ + public BgpDpid(final BgpLinkLsNlriVer4 linkNlri, int nodeDescriptorType) { + this.stringBuilder = new StringBuilder("bgpls://"); + + if (linkNlri.getRouteDistinguisher() != null) { + this.stringBuilder.append(linkNlri.getRouteDistinguisher().getRouteDistinguisher()).append(':'); + } + + try { + this.stringBuilder.append(linkNlri.getProtocolId()).append(':').append(linkNlri.getIdentifier()) + .append('/'); + + if (nodeDescriptorType == NODE_DESCRIPTOR_LOCAL) { + add(linkNlri.localNodeDescriptors()); + } else if (nodeDescriptorType == NODE_DESCRIPTOR_REMOTE) { + add(linkNlri.remoteNodeDescriptors()); + } + } catch (BgpParseException e) { + log.info("Exception BgpId string: " + e.toString()); + } + + } + + /** + * Initialize bgp id to generate URI. + * + * @param nodeNlri node Nlri. + */ + public BgpDpid(final BgpNodeLSNlriVer4 nodeNlri) { + this.stringBuilder = new StringBuilder("bgpls://"); + + if (nodeNlri.getRouteDistinguisher() != null) { + this.stringBuilder.append(nodeNlri.getRouteDistinguisher().getRouteDistinguisher()).append(':'); + } + + try { + + this.stringBuilder.append(nodeNlri.getProtocolId()).append(':').append(nodeNlri.getIdentifier()) + .append('/'); + + add(nodeNlri.getLocalNodeDescriptors()); + + } catch (BgpParseException e) { + log.info("Exception node string: " + e.toString()); + } + } + + BgpDpid add(final Object value) { + if (value != null) { + this.stringBuilder.append('&').append('=').append(value.toString()); + } + return this; + } + + @Override + public String toString() { + return this.stringBuilder.toString(); + } + + /** + * Produces bgp URI. + * + * @param value string to get URI + * @return bgp URI, otherwise null + */ + public static URI uri(String value) { + try { + return new URI(SCHEME, value, null); + } catch (URISyntaxException e) { + log.info("Exception BgpId URI: " + e.toString()); + } + return null; + } + + /** + * Returns bgpDpid created from the given device URI. + * + * @param uri device URI + * @return object of BgpDpid + */ + public static BgpDpid bgpDpid(URI uri) { + checkArgument(uri.getScheme().equals(SCHEME), "Unsupported URI scheme"); + + // TODO: return BgpDpid generated from uri + return null; + } +} diff --git a/framework/src/onos/bgp/api/src/main/java/org/onosproject/bgp/controller/BGPId.java b/framework/src/onos/bgp/api/src/main/java/org/onosproject/bgp/controller/BgpId.java index 636e72f3..7a6c625d 100755 --- a/framework/src/onos/bgp/api/src/main/java/org/onosproject/bgp/controller/BGPId.java +++ b/framework/src/onos/bgp/api/src/main/java/org/onosproject/bgp/controller/BgpId.java @@ -27,7 +27,7 @@ import static com.google.common.base.Preconditions.checkArgument; * The class representing a network peer bgp ip. * This class is immutable. */ -public final class BGPId { +public final class BgpId { private static final String SCHEME = "bgp"; private static final long UNKNOWN = 0; @@ -36,7 +36,7 @@ public final class BGPId { /** * Private constructor. */ - private BGPId(IpAddress ipAddress) { + private BgpId(IpAddress ipAddress) { this.ipAddress = ipAddress; } @@ -46,8 +46,8 @@ public final class BGPId { * @param ipAddress IP address * @return object of BGPId */ - public static BGPId bgpId(IpAddress ipAddress) { - return new BGPId(ipAddress); + public static BgpId bgpId(IpAddress ipAddress) { + return new BgpId(ipAddress); } /** @@ -71,11 +71,11 @@ public final class BGPId { @Override public boolean equals(Object other) { - if (!(other instanceof BGPId)) { + if (!(other instanceof BgpId)) { return false; } - BGPId otherBGPid = (BGPId) other; + BgpId otherBGPid = (BgpId) other; return Objects.equals(ipAddress, otherBGPid.ipAddress); } @@ -90,9 +90,9 @@ public final class BGPId { * @param uri device URI * @return object of BGPId */ - public static BGPId bgpId(URI uri) { + public static BgpId bgpId(URI uri) { checkArgument(uri.getScheme().equals(SCHEME), "Unsupported URI scheme"); - return new BGPId(IpAddress.valueOf(uri.getSchemeSpecificPart())); + return new BgpId(IpAddress.valueOf(uri.getSchemeSpecificPart())); } /** @@ -101,7 +101,7 @@ public final class BGPId { * @param bgpId device bgpId * @return device URI */ - public static URI uri(BGPId bgpId) { + public static URI uri(BgpId bgpId) { return uri(bgpId.ipAddress()); } diff --git a/framework/src/onos/bgp/api/src/main/java/org/onosproject/bgp/controller/BgpLinkListener.java b/framework/src/onos/bgp/api/src/main/java/org/onosproject/bgp/controller/BgpLinkListener.java new file mode 100755 index 00000000..8b34e314 --- /dev/null +++ b/framework/src/onos/bgp/api/src/main/java/org/onosproject/bgp/controller/BgpLinkListener.java @@ -0,0 +1,35 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.onosproject.bgp.controller; + +import org.onosproject.bgpio.protocol.linkstate.BgpLinkLsNlriVer4; + +/** + * Allows for providers interested in Link events to be notified. + */ +public interface BgpLinkListener { + + /** + * Notify that got a packet of link from network and need do processing. + * + * @param linkNlri bgp link + */ + void addLink(BgpLinkLsNlriVer4 linkNlri); + + /** + * Notify that got a packet of link from network and need do processing. + * + * @param linkNlri bgp link + */ + void deleteLink(BgpLinkLsNlriVer4 linkNlri); +} diff --git a/framework/src/onos/bgp/api/src/main/java/org/onosproject/bgp/controller/BgpLocalRib.java b/framework/src/onos/bgp/api/src/main/java/org/onosproject/bgp/controller/BgpLocalRib.java new file mode 100755 index 00000000..636c1c85 --- /dev/null +++ b/framework/src/onos/bgp/api/src/main/java/org/onosproject/bgp/controller/BgpLocalRib.java @@ -0,0 +1,60 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onosproject.bgp.controller; + +import org.onosproject.bgpio.protocol.BgpLSNlri; +import org.onosproject.bgpio.protocol.linkstate.PathAttrNlriDetails; +import org.onosproject.bgpio.types.RouteDistinguisher; + +/** + * Abstraction of BGP local RIB. + */ +public interface BgpLocalRib { + + /** + * Add NLRI to local RIB. + * + * @param sessionInfo session info + * @param nlri network layer reach info + * @param details nlri details + */ + void add(BgpSessionInfo sessionInfo, BgpLSNlri nlri, PathAttrNlriDetails details); + + /** + * Removes NLRI identifier if it exists. + * + * @param nlri info + */ + void delete(BgpLSNlri nlri); + + /** + * Update NLRI identifier mapped with route distinguisher if it exists in tree otherwise add NLRI infomation mapped + * to respective route distinguisher. + * + * @param sessionInfo BGP session info + * @param nlri info + * @param details has pathattribute, protocol id and identifier + * @param routeDistinguisher unique for each VPN + */ + void add(BgpSessionInfo sessionInfo, BgpLSNlri nlri, PathAttrNlriDetails details, + RouteDistinguisher routeDistinguisher); + + /** + * Removes VPN NLRI identifier mapped to route distinguisher if it exists. + * + * @param nlri info + * @param routeDistinguisher unique for each VPN + */ + void delete(BgpLSNlri nlri, RouteDistinguisher routeDistinguisher); +} diff --git a/framework/src/onos/bgp/api/src/main/java/org/onosproject/bgp/controller/BgpNodeListener.java b/framework/src/onos/bgp/api/src/main/java/org/onosproject/bgp/controller/BgpNodeListener.java new file mode 100755 index 00000000..726d931b --- /dev/null +++ b/framework/src/onos/bgp/api/src/main/java/org/onosproject/bgp/controller/BgpNodeListener.java @@ -0,0 +1,35 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package org.onosproject.bgp.controller; + +import org.onosproject.bgpio.protocol.linkstate.BgpNodeLSNlriVer4; + +/** + * Allows for providers interested in node events to be notified. + */ +public interface BgpNodeListener { + + /** + * Notifies that the node was added. + * + * @param nodeNlri node rechability info + */ + void addNode(BgpNodeLSNlriVer4 nodeNlri); + + /** + * Notifies that the node was removed. + * + * @param nodeNlri node rechability info + */ + void deleteNode(BgpNodeLSNlriVer4 nodeNlri); +} diff --git a/framework/src/onos/bgp/api/src/main/java/org/onosproject/bgp/controller/BGPPacketStats.java b/framework/src/onos/bgp/api/src/main/java/org/onosproject/bgp/controller/BgpPacketStats.java index 95f83a2d..8fd3c688 100755 --- a/framework/src/onos/bgp/api/src/main/java/org/onosproject/bgp/controller/BGPPacketStats.java +++ b/framework/src/onos/bgp/api/src/main/java/org/onosproject/bgp/controller/BgpPacketStats.java @@ -21,7 +21,7 @@ package org.onosproject.bgp.controller; * to the event if blocked has been called. This packet context can be used to react to the packet in event with a * packet out. */ -public interface BGPPacketStats { +public interface BgpPacketStats { /** * Returns the count for no of packets sent out. * diff --git a/framework/src/onos/bgp/api/src/main/java/org/onosproject/bgp/controller/BGPPeer.java b/framework/src/onos/bgp/api/src/main/java/org/onosproject/bgp/controller/BgpPeer.java index aafaf06e..9f4d47da 100755..100644 --- a/framework/src/onos/bgp/api/src/main/java/org/onosproject/bgp/controller/BGPPeer.java +++ b/framework/src/onos/bgp/api/src/main/java/org/onosproject/bgp/controller/BgpPeer.java @@ -16,14 +16,16 @@ package org.onosproject.bgp.controller; import java.util.List; import org.jboss.netty.channel.Channel; -import org.onosproject.bgpio.protocol.BGPFactory; -import org.onosproject.bgpio.protocol.BGPMessage; +import org.onosproject.bgpio.exceptions.BgpParseException; +import org.onosproject.bgpio.protocol.BgpFactory; +import org.onosproject.bgpio.protocol.BgpMessage; +import org.onosproject.bgpio.types.BgpValueType; /** * Represents the peer side of an BGP peer. * */ -public interface BGPPeer { +public interface BgpPeer { /** * Sets the associated Netty channel for this bgp peer. @@ -58,21 +60,21 @@ public interface BGPPeer { * * @param msg the message to write */ - void sendMessage(BGPMessage msg); + void sendMessage(BgpMessage msg); /** * Writes the BGPMessage list to the peer. * * @param msgs the messages to be written */ - void sendMessage(List<BGPMessage> msgs); + void sendMessage(List<BgpMessage> msgs); /** * Provides the factory for BGP version. * * @return BGP version specific factory. */ - BGPFactory factory(); + BgpFactory factory(); /** * Checks if the bgp peer is still connected. @@ -95,6 +97,14 @@ public interface BGPPeer { String channelId(); /** + * Maintaining Adj-RIB-In separately for each peer. + * + * @param pathAttr list of Bgp path attributes + * @throws BgpParseException while building Adj-Rib-In + */ + void buildAdjRibIn(List<BgpValueType> pathAttr) throws BgpParseException; + + /** * Return the BGP session info. * * @return sessionInfo bgp session info diff --git a/framework/src/onos/bgp/api/src/main/java/org/onosproject/bgp/controller/BGPPeerCfg.java b/framework/src/onos/bgp/api/src/main/java/org/onosproject/bgp/controller/BgpPeerCfg.java index e7c5d9b4..2fb970fc 100755 --- a/framework/src/onos/bgp/api/src/main/java/org/onosproject/bgp/controller/BGPPeerCfg.java +++ b/framework/src/onos/bgp/api/src/main/java/org/onosproject/bgp/controller/BgpPeerCfg.java @@ -18,7 +18,7 @@ package org.onosproject.bgp.controller; /** * BGP Peer configuration information. */ -public interface BGPPeerCfg { +public interface BgpPeerCfg { enum State { diff --git a/framework/src/onos/bgp/api/src/main/java/org/onosproject/bgp/controller/BgpPeerManager.java b/framework/src/onos/bgp/api/src/main/java/org/onosproject/bgp/controller/BgpPeerManager.java index d2230967..895cc145 100755 --- a/framework/src/onos/bgp/api/src/main/java/org/onosproject/bgp/controller/BgpPeerManager.java +++ b/framework/src/onos/bgp/api/src/main/java/org/onosproject/bgp/controller/BgpPeerManager.java @@ -26,7 +26,7 @@ public interface BgpPeerManager { * * @return false if peer already exist, otherwise true */ - public boolean addConnectedPeer(BGPId bgpId, BGPPeer bgpPeer); + public boolean addConnectedPeer(BgpId bgpId, BgpPeer bgpPeer); /** * Validate wheather peer is connected. @@ -35,14 +35,14 @@ public interface BgpPeerManager { * * @return true if peer exist, otherwise false */ - public boolean isPeerConnected(BGPId bgpId); + public boolean isPeerConnected(BgpId bgpId); /** * Remove connected peer. * * @param bgpId BGP ID */ - public void removeConnectedPeer(BGPId bgpId); + public void removeConnectedPeer(BgpId bgpId); /** * Gets connected peer. @@ -50,5 +50,5 @@ public interface BgpPeerManager { * @param bgpId BGP ID * @return BGPPeer the connected peer, otherwise null */ - public BGPPeer getPeer(BGPId bgpId); + public BgpPeer getPeer(BgpId bgpId); } diff --git a/framework/src/onos/bgp/api/src/main/java/org/onosproject/bgp/controller/BgpSessionInfo.java b/framework/src/onos/bgp/api/src/main/java/org/onosproject/bgp/controller/BgpSessionInfo.java new file mode 100755 index 00000000..a21a23d2 --- /dev/null +++ b/framework/src/onos/bgp/api/src/main/java/org/onosproject/bgp/controller/BgpSessionInfo.java @@ -0,0 +1,70 @@ +/* + * Copyright 2015 Open Networking Laboratory + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ + +package org.onosproject.bgp.controller; + +import org.onosproject.bgpio.protocol.BgpVersion; + +/** + * Abstraction of an BGP session info. Maintian session parameters obtained during session creation. + */ +public interface BgpSessionInfo { + /** + * Gets the bgp session type iBGP/eBGP. + * + * @return isiBGPSession, true if session is of type internal, otherwise false. + */ + boolean isIbgpSession(); + + /** + * Gets the negotiated hold time for the session. + * + * @return negotiated hold time. + */ + short negotiatedholdTime(); + + /** + * Gets the BGP ID of BGP peer. + * + * @return bgp ID. + */ + BgpId remoteBgpId(); + + /** + * Gets the BGP version of peer. + * + * @return bgp version. + */ + BgpVersion remoteBgpVersion(); + + /** + * Gets the BGP remote bgp AS number. + * + * @return remoteBgpASNum peer AS number. + */ + long remoteBgpASNum(); + + /** + * Gets the BGP peer hold time. + * + * @return bgp hold time. + */ + short remoteBgpHoldTime(); + + /** + * Gets the BGP version for this bgp peer. + * + * @return bgp identifier. + */ + int remoteBgpIdentifier(); +} |