Added javadoc for all the helper classes in SDN-IP.
Also changed a couple of names to better reflect the usage or comply with
naming standards:
in IBgpRouteService.java: getBGPdRestIp -> getBgpdRestIp
in Prefix.java: MAX_BYTES -> ADDRESS_LENGTH
Change-Id: Id23b6bb077d79d671d21e2490ab410f322d7c166
diff --git a/src/main/java/net/onrc/onos/apps/bgproute/RibEntry.java b/src/main/java/net/onrc/onos/apps/bgproute/RibEntry.java
index ae16c8f..7ad1d3d 100644
--- a/src/main/java/net/onrc/onos/apps/bgproute/RibEntry.java
+++ b/src/main/java/net/onrc/onos/apps/bgproute/RibEntry.java
@@ -4,6 +4,14 @@
import com.google.common.net.InetAddresses;
+/**
+ * Represents an entry in the Routing Information Base (RIB) of a router.
+ * <p/>
+ * A route update from the BGP daemon contains a prefix and a RibEntry
+ * containing the next hop for the route. The RibEntry also contains
+ * information related to the synchronization mechanism between BGPd and
+ * SDN-IP, such as sequence numbers.
+ */
public class RibEntry {
private final InetAddress routerId;
private final InetAddress nextHop;
@@ -24,6 +32,14 @@
*/
private static final long NULL_TIME = -1;
+ /**
+ * Class constructor, taking the router ID and next hop IP address as
+ * {@link InetAddress} objects.
+ *
+ * @param routerId the router ID which identifies the route table in BGPd
+ * that this update came from
+ * @param nextHop next hop IP address for this route entry
+ */
public RibEntry(InetAddress routerId, InetAddress nextHop) {
this.routerId = routerId;
this.nextHop = nextHop;
@@ -31,6 +47,15 @@
sysUpTime = NULL_TIME;
}
+ /**
+ * Class constructor, taking the router ID and next hop IP address as
+ * Strings. The addresses must be in dot-notation form
+ * (e.g. {@code 0.0.0.0}).
+ *
+ * @param routerId the router ID which identifies the route table in BGPd
+ * that this update came from
+ * @param nextHop next hop IP address for this route entry
+ */
public RibEntry(String routerId, String nextHop) {
this.routerId = InetAddresses.forString(routerId);
this.nextHop = InetAddresses.forString(nextHop);
@@ -38,22 +63,49 @@
sysUpTime = NULL_TIME;
}
- public RibEntry(String routerId, String nextHop, long sysUpTime
- , long sequenceNum) {
+ /**
+ * Class constructor, taking the router ID and next hop IP address as
+ * Strings, as well as the sequence numbers of the updates. Sequence
+ * numbers are used to establish ordering of updates from BGPd. The
+ * addresses must be in dot-notation form (e.g. {@code 0.0.0.0}).
+ *
+ * @param routerId the router ID which identifies the route table in BGPd
+ * that this update came from
+ * @param nextHop next hop IP address for this route entry
+ * @param sysUpTime the sysuptime parameter on the update from BGPd
+ * @param sequenceNum the sequencenum parameter on the update from BGPd
+ */
+ public RibEntry(String routerId, String nextHop, long sysUpTime,
+ long sequenceNum) {
this.routerId = InetAddresses.forString(routerId);
this.nextHop = InetAddresses.forString(nextHop);
this.sequenceNum = sequenceNum;
this.sysUpTime = sysUpTime;
}
+ /**
+ * Gets the next hop IP address of this route entry.
+ *
+ * @return the next hop IP address
+ */
public InetAddress getNextHop() {
return nextHop;
}
+ /**
+ * Gets the sysuptime parameter sent with the update from BGPd.
+ *
+ * @return the sysuptime parameter
+ */
public long getSysUpTime() {
return sysUpTime;
}
+ /**
+ * Gets the sequencenum parameter sent with the update from BGPd.
+ *
+ * @return the sequencenum parameter
+ */
public long getSequenceNum() {
return sequenceNum;
}