Renamed SDN-IP packages and classes.
The code use to use the name 'BgpRoute' in a number of places, which is not
descriptive and doesn't map to how we talk about SDN-IP (we always call it
SDN-IP in all other documents/presentations).
Details of changes are as follows:
net.onrc.onos.apps.bgproute -> net.onrc.onos.apps.sdnip
BgpRoute.java -> SdnIp.java
IBgpRouteService.java -> ISdnIpService.java
created new package for web classes: net.onrc.onos.apps.sdnip.web
BgpRouteResource.java -> IncomingRequestResource.java
BgpRouteResourceSynch.java -> OutgoingRequestResource.java
BgpRouteWebRoutable.java -> SdnIpWebRoutable.java
Change-Id: Ie6b1cbe4e95736d4cbd53b9f4def7cc3e0b46132
diff --git a/src/main/java/net/onrc/onos/apps/sdnip/RibEntry.java b/src/main/java/net/onrc/onos/apps/sdnip/RibEntry.java
new file mode 100644
index 0000000..47eca6b
--- /dev/null
+++ b/src/main/java/net/onrc/onos/apps/sdnip/RibEntry.java
@@ -0,0 +1,132 @@
+package net.onrc.onos.apps.sdnip;
+
+import java.net.InetAddress;
+
+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;
+
+ /*
+ * Store the sequence number information provided on the update here for
+ * now. I think this *should* really be in the RibUpdate, and we should
+ * store RibUpdates in the Ptree. But, that's a bigger change to change
+ * what the Ptree stores.
+ */
+ private final long sysUpTime;
+ private final long sequenceNum;
+
+ /*
+ * Marker for RibEntries where we don't have sequence number info.
+ * The user of this class should make sure they don't check this data
+ * if they don't provide it.
+ */
+ 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;
+ sequenceNum = NULL_TIME;
+ 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);
+ sequenceNum = NULL_TIME;
+ sysUpTime = NULL_TIME;
+ }
+
+ /**
+ * 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;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (!(other instanceof RibEntry)) {
+ return false;
+ }
+
+ RibEntry otherRibEntry = (RibEntry) other;
+
+ return this.routerId.equals(otherRibEntry.routerId)
+ && this.nextHop.equals(otherRibEntry.nextHop);
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 17;
+ hash = 31 * hash + routerId.hashCode();
+ hash = 31 * hash + nextHop.hashCode();
+ return hash;
+ }
+}