diff options
Diffstat (limited to 'framework/src/onos/bgp/api')
4 files changed, 88 insertions, 99 deletions
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 deleted file mode 100755 index a2a66438..00000000 --- a/framework/src/onos/bgp/api/src/main/java/org/onosproject/bgp/controller/BGPConnectPeer.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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 java.util.concurrent.ExecutorService; - -/** - * Abstraction of an BGP connect peer, initiate remote connection to BGP peer on configuration. - */ -public interface BGPConnectPeer { - - /** - * Returns the executor initialized to connect peer. - * - * @return connectExecutor the connection executor - */ - ExecutorService connectExecutor(); -} 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 49432aab..9d44041e 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 @@ -16,11 +16,15 @@ 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; /** - * Abstraction of an BGP controller. Serves as a one stop shop for obtaining BGP devices and (un)register listeners - * on bgp events + * 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 { @@ -40,6 +44,34 @@ public interface BGPController { BGPPeer getPeer(BGPId bgpId); /** + * Register a listener for BGP message events. + * + * @param listener the listener to notify + */ + void addListener(BgpNodeListener listener); + + /** + * Unregister a listener. + * + * @param listener the listener to unregister + */ + 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. @@ -52,8 +84,9 @@ public interface BGPController { * * @param bgpId id of the peer the message arrived on * @param msg the message to process. + * @throws BGPParseException on data processing error */ - void processBGPPacket(BGPId bgpId, BGPMessage msg); + void processBGPPacket(BGPId bgpId, BGPMessage msg) throws BGPParseException; /** * Close all connected BGP peers. @@ -73,5 +106,33 @@ public interface BGPController { * * @return the integer number */ - int getBGPConnNumber(); -}
\ No newline at end of file + int connectedPeerCount(); + + /** + * Return BGP peer manager. + * + * @return BGPPeerManager peer manager instance + */ + BgpPeerManager peerManager(); + + /** + * Return BGP connected peers. + * + * @return connectedPeers connected peers + */ + Map<BGPId, BGPPeer> connectedPeers(); + + /** + * Return BGP node listener. + * + * @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/BGPPeer.java b/framework/src/onos/bgp/api/src/main/java/org/onosproject/bgp/controller/BGPPeer.java index 1b022c76..aafaf06e 100755 --- 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,30 +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.protocol.BGPVersion; /** - * Represents the peer side of an bgp peer. + * Represents the peer side of an BGP peer. * */ public interface BGPPeer { /** - * Sets the BGP version for this bgp peer. - * - * @param bgpVersion the version to set. - */ - void setBgpPeerVersion(BGPVersion bgpVersion); - - /** - * Gets the BGP version for this bgp peer. - * - * @return bgp identifier. - */ - int getBgpPeerIdentifier(); - - /** * Sets the associated Netty channel for this bgp peer. * * @param channel the Netty channel @@ -54,27 +40,6 @@ public interface BGPPeer { Channel getChannel(); /** - * Sets the AS Number for this bgp peer. - * - * @param peerASNum the autonomous system number value to set. - */ - void setBgpPeerASNum(short peerASNum); - - /** - * Sets the hold time for this bgp peer. - * - * @param peerHoldTime the hold timer value to set. - */ - void setBgpPeerHoldTime(short peerHoldTime); - - /** - * Sets the peer identifier value. - * - * @param peerIdentifier the bgp peer identifier value. - */ - void setBgpPeerIdentifier(int peerIdentifier); - - /** * Sets whether the bgp peer is connected. * * @param connected whether the bgp peer is connected @@ -82,15 +47,6 @@ public interface BGPPeer { void setConnected(boolean connected); /** - * Initialises the behaviour. - * - * @param bgpId id of bgp peer - * @param bgpVersion BGP version - * @param pktStats packet statistics - */ - void init(BGPId bgpId, BGPVersion bgpVersion, BGPPacketStats pktStats); - - /** * Checks whether the handshake is complete. * * @return true is finished, false if not. @@ -112,18 +68,11 @@ public interface BGPPeer { void sendMessage(List<BGPMessage> msgs); /** - * Gets a string version of the ID for this bgp peer. + * Provides the factory for BGP version. * - * @return string version of the ID + * @return BGP version specific factory. */ - String getStringId(); - - /** - * Gets the ipAddress of the peer. - * - * @return the peer bgpId in IPAddress format - */ - BGPId getBGPId(); + BGPFactory factory(); /** * Checks if the bgp peer is still connected. @@ -146,16 +95,9 @@ public interface BGPPeer { String channelId(); /** - * Gets the negotiated hold time. - * - * @return the negotiated hold time - */ - int getNegotiatedHoldTime(); - - /** - * Sets negotiated hold time for the peer. + * Return the BGP session info. * - * @param negotiatedHoldTime negotiated hold time + * @return sessionInfo bgp session info */ - void setNegotiatedHoldTime(short negotiatedHoldTime); + BgpSessionInfo sessionInfo(); } 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 87ec031f..e7c5d9b4 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 @@ -163,4 +163,18 @@ public interface BGPPeerCfg { * AS number */ void setPeerRouterId(String peerId, int asNumber); + + /** + * Set the peer connect instance. + * + * @param connectpeer connect peer instance + */ + void setConnectPeer(BgpConnectPeer connectpeer); + + /** + * Get the peer connect instance. + * + * @return peer connect instance + */ + BgpConnectPeer connectPeer(); } |