Add javadoc to Switch/Port/Link/ShortestPathIntent
Change-Id: I7a53a1e40f24650de37c885d46e42db9f5d4cc14
diff --git a/src/main/java/net/onrc/onos/core/intent/ShortestPathIntent.java b/src/main/java/net/onrc/onos/core/intent/ShortestPathIntent.java
index f62ec38..94f3f36 100644
--- a/src/main/java/net/onrc/onos/core/intent/ShortestPathIntent.java
+++ b/src/main/java/net/onrc/onos/core/intent/ShortestPathIntent.java
@@ -21,6 +21,17 @@
protected ShortestPathIntent() {
}
+ /**
+ * Constructor for ShortestPathIntent.
+ *
+ * @param id Intent ID
+ * @param srcSwitch Source Switch DPID
+ * @param srcPort Source Port
+ * @param srcMac Source Host MAC Address
+ * @param dstSwitch Destination Switch DPID
+ * @param dstPort Destination Port
+ * @param dstMac Destination Host MAC Address
+ */
public ShortestPathIntent(String id,
long srcSwitch, long srcPort, long srcMac,
long dstSwitch, long dstPort, long dstMac) {
@@ -33,26 +44,56 @@
dstMacAddress = dstMac;
}
+ /**
+ * Gets the source Switch DPID.
+ *
+ * @return Source Switch DPID
+ */
public long getSrcSwitchDpid() {
return srcSwitchDpid;
}
+ /**
+ * Gets the source Port.
+ *
+ * @return Source Port
+ */
public long getSrcPortNumber() {
return srcPortNumber;
}
+ /**
+ * Gets the source Host MAC Address.
+ *
+ * @return Source Host MAC Address
+ */
public long getSrcMac() {
return srcMacAddress;
}
+ /**
+ * Gets the destination Switch DPID.
+ *
+ * @return Destination Switch DPID
+ */
public long getDstSwitchDpid() {
return dstSwitchDpid;
}
+ /**
+ * Gets the destination Port.
+ *
+ * @return Destination Port
+ */
public long getDstPortNumber() {
return dstPortNumber;
}
+ /**
+ * Gets the destination Host MAC Address.
+ *
+ * @return Destination Host MAC Address
+ */
public long getDstMac() {
return dstMacAddress;
}
diff --git a/src/main/java/net/onrc/onos/core/topology/Link.java b/src/main/java/net/onrc/onos/core/topology/Link.java
index 2acf7dc..8715b12 100644
--- a/src/main/java/net/onrc/onos/core/topology/Link.java
+++ b/src/main/java/net/onrc/onos/core/topology/Link.java
@@ -1,42 +1,41 @@
package net.onrc.onos.core.topology;
+// TODO Everything returned by these interfaces must be either Unmodifiable view,
+// immutable object, or a copy of the original "SB" In-memory Topology.
/**
- * Interface of Link Object exposed to the "NB" read-only Topology.
- * <p/>
- * Everything returned by these interfaces must be either Unmodifiable view,
- * immutable object, or a copy of the original "SB" In-memory Topology.
+ * Interface of Link object in Network Graph topology.
*/
public interface Link {
/**
- * Get the source switch for the link.
+ * Gets the source switch for the link.
*
* @return the source switch for the link.
*/
public Switch getSrcSwitch();
/**
- * Get the source port for the link.
+ * Gets the source port for the link.
*
* @return the source port for the link.
*/
public Port getSrcPort();
/**
- * Get the destination switch for the link.
+ * Gets the destination switch for the link.
*
* @return the destination switch for the link.
*/
public Switch getDstSwitch();
/**
- * Get the destination port for the link.
+ * Gets the destination port for the link.
*
* @return the destination port for the link.
*/
public Port getDstPort();
/**
- * Get the last seen time for the link.
+ * Gets the last seen time for the link.
* <p/>
* TODO: Not implemented yet.
* TODO: what is the time definition?
@@ -46,7 +45,7 @@
public long getLastSeenTime();
/**
- * Get the link cost.
+ * Gets the link cost.
* <p/>
* TODO: What is the unit?
*
@@ -55,7 +54,7 @@
public int getCost();
/**
- * Get the link capacity.
+ * Gets the link capacity.
* <p/>
* TODO: What is the unit?
*
diff --git a/src/main/java/net/onrc/onos/core/topology/Port.java b/src/main/java/net/onrc/onos/core/topology/Port.java
index 216d4b8..75aac52 100644
--- a/src/main/java/net/onrc/onos/core/topology/Port.java
+++ b/src/main/java/net/onrc/onos/core/topology/Port.java
@@ -1,26 +1,73 @@
package net.onrc.onos.core.topology;
-
+// TODO Everything returned by these interfaces must be either Unmodifiable view,
+// immutable object, or a copy of the original "SB" In-memory Topology.
/**
- * Interface of Port Object exposed to the "NB" read-only Topology.
- * <p/>
- * Everything returned by these interfaces must be either Unmodifiable view,
- * immutable object, or a copy of the original "SB" In-memory Topology.
+ * Interface of Port object in Network Graph topology.
*/
public interface Port {
+
+ /**
+ * Gets the data path ID (dpid) of the switch, which this port is on.
+ *
+ * @return data path ID (dpid)
+ */
public Long getDpid();
+ /**
+ * Gets the port number of this port.
+ *
+ * @return port number
+ */
public Long getNumber();
+ /**
+ * Gets the hardware address of this port.
+ * <p/>
+ * TODO Not implemented yet.
+ * TODO Should return value type be Long?
+ *
+ * @return hardware address
+ */
public Long getHardwareAddress();
+ /**
+ * Description of this port.
+ * <p/>
+ * TODO Not implemented yet.
+ *
+ * @return description of this port
+ */
public String getDescription();
+ /**
+ * Gets the parent switch.
+ *
+ * @return {@link Switch} instance
+ */
public Switch getSwitch();
+ /**
+ * Gets the outgoing link from this port.
+ *
+ * @return {@link Link} if there exist a outgoing link from this,
+ * {@code null} otherwise.
+ */
public Link getOutgoingLink();
+ /**
+ * Gets the incoming link to this port.
+ *
+ * @return {@link Link} if there exist a incoming link to this, {@code null}
+ * otherwise.
+ */
public Link getIncomingLink();
+ // XXX Iterable or Collection?
+ /**
+ * Gets all the devices attached to this port.
+ *
+ * @return {@link Device}s attached to this port
+ */
public Iterable<Device> getDevices();
}
diff --git a/src/main/java/net/onrc/onos/core/topology/Switch.java b/src/main/java/net/onrc/onos/core/topology/Switch.java
index 690cea8..5f635df 100644
--- a/src/main/java/net/onrc/onos/core/topology/Switch.java
+++ b/src/main/java/net/onrc/onos/core/topology/Switch.java
@@ -2,29 +2,75 @@
import java.util.Collection;
+// TOOD Everything returned by these interfaces must be either Unmodifiable view,
+// immutable object, or a copy of the original "SB" In-memory Topology.
/**
- * Interface of Switch Object exposed to the "NB" read-only Topology.
- * <p/>
- * Everything returned by these interfaces must be either Unmodifiable view,
- * immutable object, or a copy of the original "SB" In-memory Topology.
+ * Interface of Switch object in Network Graph topology.
*/
public interface Switch {
+
+ /**
+ * Gets the data path ID (dpid) of this switch.
+ *
+ * @return data path ID (dpid)
+ */
public Long getDpid();
+ /**
+ * Gets all the ports on this switch.
+ *
+ * @return Collection of {@link Port} on this switch.
+ */
public Collection<Port> getPorts();
+ /**
+ * Gets a port on switch by port number.
+ *
+ * @param number port number
+ * @return {@link Port} with {@code number} on this switch, or {@code null}
+ * if this switch did not have a port for specified port number
+ */
public Port getPort(Long number);
// Graph traversal API
- // XXX What is the Definition of neighbor? Link exist in both direction or one-way is sufficient to be a neighbor, etc.
+
+ // XXX What is the Definition of neighbor? Link exist in both direction or
+ // one-way is sufficient to be a neighbor, etc.
+ /**
+ * Gets all the neighbor switches.
+ *
+ * @return neighbor switches
+ */
public Iterable<Switch> getNeighbors();
+ /**
+ * Gets all the outgoing links.
+ *
+ * @return outgoing {@link Link}s from this switch.
+ */
public Iterable<Link> getOutgoingLinks();
+ /**
+ * Gets all the incoming links.
+ *
+ * @return outgoing {@link Link}s from this switch.
+ */
public Iterable<Link> getIncomingLinks();
+ /**
+ * Gets outgoing link to specified neighbor switch specified by dpid.
+ *
+ * @param dpid data path ID of neighbor switch.
+ * @return {@link Link} to neighbor switch {@code dpid} or {@code null} if
+ * link does not exist.
+ */
public Link getLinkToNeighbor(Long dpid);
// XXX Iterable or Collection?
+ /**
+ * Gets all the devices attached to this switch.
+ *
+ * @return {@link Device}s attached to this switch
+ */
public Collection<Device> getDevices();
}