Bgp and Pcep maintaiability
Change-Id: I2c14cc29d4900ef2f0fbffd4761b0d78e282910f
diff --git a/protocols/bgp/api/src/main/java/org/onosproject/bgp/controller/BgpConnectPeer.java b/protocols/bgp/api/src/main/java/org/onosproject/bgp/controller/BgpConnectPeer.java
index 03310a6..d42d32c 100644
--- a/protocols/bgp/api/src/main/java/org/onosproject/bgp/controller/BgpConnectPeer.java
+++ b/protocols/bgp/api/src/main/java/org/onosproject/bgp/controller/BgpConnectPeer.java
@@ -17,12 +17,28 @@
*/
public interface BgpConnectPeer {
/**
- * Initiate bgp peer connection.
- */
+ * Initiate bgp peer connection.
+ */
void connectPeer();
/**
- * End bgp peer connection.
- */
+ * End bgp peer connection.
+ */
void disconnectPeer();
+
+ /**
+ * Returns the peer port.
+ *
+ * @return PeerPort
+ */
+ int getPeerPort();
+
+ /**
+ * Returns the connect retry counter.
+ *
+ * @return connectRetryCounter
+ */
+ int getConnectRetryCounter();
+
+
}
diff --git a/protocols/bgp/api/src/main/java/org/onosproject/bgp/controller/BgpController.java b/protocols/bgp/api/src/main/java/org/onosproject/bgp/controller/BgpController.java
index 90a8eed..e562b94 100644
--- a/protocols/bgp/api/src/main/java/org/onosproject/bgp/controller/BgpController.java
+++ b/protocols/bgp/api/src/main/java/org/onosproject/bgp/controller/BgpController.java
@@ -19,6 +19,7 @@
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.protocol.BgpMessage;
+import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -61,7 +62,7 @@
* Send a message to a particular bgp peer.
*
* @param bgpId the id of the peer to send message.
- * @param msg the message to send
+ * @param msg the message to send
*/
void writeMsg(BgpId bgpId, BgpMessage msg);
@@ -69,14 +70,13 @@
* Process a message and notify the appropriate listeners.
*
* @param bgpId id of the peer the message arrived on
- * @param msg the message to process.
+ * @param msg the message to process.
* @throws BgpParseException on data processing error
*/
void processBgpPacket(BgpId bgpId, BgpMessage msg) throws BgpParseException;
/**
* Close all connected BGP peers.
- *
*/
void closeConnectedPeers();
@@ -149,4 +149,35 @@
* @return link listener
*/
Set<BgpLinkListener> linkListener();
+
+ /**
+ * Stores the exceptions occured during an active session.
+ *
+ * @param peerId BGP peer id
+ * @param exception exceptions based on the peer id.
+ */
+ void activeSessionExceptionAdd(String peerId, String exception);
+
+ /**
+ * Stores the exceptions occured during an closed session.
+ *
+ * @param peerId BGP peer id
+ * @param exception exceptions based on the peer id
+ */
+ void closedSessionExceptionAdd(String peerId, String exception);
+
+ /**
+ * Return active session exceptions.
+ *
+ * @return activeSessionMap
+ */
+ Map<String, List<String>> activeSessionMap();
+
+ /**
+ * Return closed session exceptions.
+ *
+ * @return closedSessionMap
+ */
+ Map<String, List<String>> closedSessionMap();
+
}
diff --git a/protocols/bgp/api/src/main/java/org/onosproject/bgp/controller/BgpDpid.java b/protocols/bgp/api/src/main/java/org/onosproject/bgp/controller/BgpDpid.java
index a0f5952..fb9ca1d 100644
--- a/protocols/bgp/api/src/main/java/org/onosproject/bgp/controller/BgpDpid.java
+++ b/protocols/bgp/api/src/main/java/org/onosproject/bgp/controller/BgpDpid.java
@@ -61,8 +61,10 @@
this.stringBuilder.append(":ROUTINGUNIVERSE=").append(((BgpLinkLsNlriVer4) linkNlri).getIdentifier());
if (nodeDescriptorType == NODE_DESCRIPTOR_LOCAL) {
+ log.debug("Local node descriptor added");
add(linkNlri.localNodeDescriptors());
} else if (nodeDescriptorType == NODE_DESCRIPTOR_REMOTE) {
+ log.debug("Remote node descriptor added");
add(linkNlri.remoteNodeDescriptors());
}
}
@@ -93,7 +95,7 @@
this.stringBuilder.append(":ROUTINGUNIVERSE=").append(((BgpNodeLSNlriVer4) nlri).getIdentifier());
add(((BgpNodeLSNlriVer4) nlri).getLocalNodeDescriptors().getNodedescriptors());
- log.info("BgpDpid :: add");
+ log.debug("BgpDpid :: add");
}
/**
@@ -103,7 +105,7 @@
* @return instance of this class
*/
public BgpDpid add(final NodeDescriptors value) {
- log.info("BgpDpid :: add function");
+ log.debug("BgpDpid :: add function");
if (value != null) {
List<BgpValueType> subTlvs = value.getSubTlvs();
ListIterator<BgpValueType> listIterator = subTlvs.listIterator();
@@ -148,7 +150,7 @@
try {
return new URI(SCHEME, value, null);
} catch (URISyntaxException e) {
- log.info("Exception BgpId URI: " + e.toString());
+ log.debug("Exception BgpId URI: " + e.toString());
}
return null;
}
diff --git a/protocols/bgp/api/src/main/java/org/onosproject/bgp/controller/BgpLocalRib.java b/protocols/bgp/api/src/main/java/org/onosproject/bgp/controller/BgpLocalRib.java
index 456ecd2..a10fafc 100644
--- a/protocols/bgp/api/src/main/java/org/onosproject/bgp/controller/BgpLocalRib.java
+++ b/protocols/bgp/api/src/main/java/org/onosproject/bgp/controller/BgpLocalRib.java
@@ -16,8 +16,14 @@
import org.onosproject.bgpio.exceptions.BgpParseException;
import org.onosproject.bgpio.protocol.BgpLSNlri;
import org.onosproject.bgpio.protocol.linkstate.PathAttrNlriDetails;
+import org.onosproject.bgpio.protocol.linkstate.PathAttrNlriDetailsLocalRib;
+import org.onosproject.bgpio.protocol.linkstate.BgpNodeLSIdentifier;
+import org.onosproject.bgpio.protocol.linkstate.BgpLinkLSIdentifier;
+import org.onosproject.bgpio.protocol.linkstate.BgpPrefixLSIdentifier;
import org.onosproject.bgpio.types.RouteDistinguisher;
+import java.util.Map;
+
/**
* Abstraction of BGP local RIB.
*/
@@ -62,4 +68,46 @@
* @throws BgpParseException while deleting NLRI from local rib
*/
void delete(BgpLSNlri nlri, RouteDistinguisher routeDistinguisher) throws BgpParseException;
+
+ /**
+ * Returns node NLRI tree.
+ *
+ * @return node tree
+ */
+ Map<BgpNodeLSIdentifier, PathAttrNlriDetailsLocalRib> nodeTree();
+
+ /**
+ * Returns link NLRI tree.
+ *
+ * @return link tree
+ */
+ Map<BgpLinkLSIdentifier, PathAttrNlriDetailsLocalRib> linkTree();
+
+ /**
+ * Returns prefix NLRI tree.
+ *
+ * @return prefix tree
+ */
+ Map<BgpPrefixLSIdentifier, PathAttrNlriDetailsLocalRib> prefixTree();
+
+ /**
+ * Returns VPN node NLRI tree.
+ *
+ * @return vpn node NLRI tree
+ */
+ Map<RouteDistinguisher, Map<BgpNodeLSIdentifier, PathAttrNlriDetailsLocalRib>> vpnNodeTree();
+
+ /**
+ * Returns VPN link NLRI tree.
+ *
+ * @return vpn link NLRI Tree
+ */
+ Map<RouteDistinguisher, Map<BgpLinkLSIdentifier, PathAttrNlriDetailsLocalRib>> vpnLinkTree();
+
+ /**
+ * Returns VPN prefix NLRI tree.
+ *
+ * @return vpn prefix NLRI Tree
+ */
+ Map<RouteDistinguisher, Map<BgpPrefixLSIdentifier, PathAttrNlriDetailsLocalRib>> vpnPrefixTree();
}