Network Graph Refactoring: WIP
- Move method getPort() from TopologyManager to NetworkGraph
- Renamed NetworkGraph.getDeviceByIp() to getDevicesByIp() to reflect
the fact that it might return multiple devices.
- Added Javadoc comments to interface NetworkGraph
Change-Id: Ibc15497c287847716d92a5ee27a79deb9a635dd2
diff --git a/src/main/java/net/onrc/onos/ofcontroller/networkgraph/NetworkGraph.java b/src/main/java/net/onrc/onos/ofcontroller/networkgraph/NetworkGraph.java
index eff5952..45e4188 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/networkgraph/NetworkGraph.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/networkgraph/NetworkGraph.java
@@ -8,18 +8,76 @@
* The northbound interface to the topology network graph. This interface
* is presented to the rest of ONOS. It is currently read-only, as we want
* only the discovery modules to be allowed to modify the topology.
- *
*/
public interface NetworkGraph {
- public Switch getSwitch(Long dpid);
- public Iterable<Switch> getSwitches();
+ /**
+ * Get the switch for a given switch DPID.
+ *
+ * @param dpid the switch dpid.
+ * @return the switch if found, otherwise, null.
+ */
+ public Switch getSwitch(Long dpid);
- // TODO Not sure about the use-case of this method? Remove if not used at the end.
- public Iterable<Link> getLinks();
- // XXX next 2 method can be removed. getSwitch(dpid).getOutgoingLinks() is equivalent
- public Iterable<Link> getOutgoingLinksFromSwitch(Long dpid); // Toshi: unnecessary
- public Iterable<Link> getIncomingLinksFromSwitch(Long dpid); // Toshi: unnecessary
+ /**
+ * Get all switches in the network.
+ *
+ * @return all switches in the network.
+ */
+ public Iterable<Switch> getSwitches();
- public Iterable<Device> getDeviceByIp(InetAddress ipAddress);
- public Device getDeviceByMac(MACAddress address);
+ /**
+ * Get the port on a switch.
+ *
+ * @param dpid the switch DPID.
+ * @param number the switch port number.
+ * @return the switch port if found, otherwise, null.
+ */
+ public Port getPort(Long dpid, Long number);
+
+ /**
+ * Get all links in the network.
+ *
+ * TODO: Not clear if this method is needed. Remove if not used.
+ *
+ * @return all links in the network.
+ */
+ public Iterable<Link> getLinks();
+
+ /**
+ * Get all outgoing links for a switch.
+ *
+ * TODO: Not clear if this method is needed. Remove if not used.
+ * E.g, getSwitch(dpid).getOutgoingLinks() is equivalent.
+ *
+ * @param dpid the switch DPID.
+ * @return all outgoing links for a switch.
+ */
+ public Iterable<Link> getOutgoingLinksFromSwitch(Long dpid);
+
+ /**
+ * Get all incoming links for a switch.
+ *
+ * TODO: Not clear if this method is needed. Remove if not used.
+ * E.g, getSwitch(dpid).getIncomingLinks() is equivalent.
+ *
+ * @param dpid the switch DPID.
+ * @return all incoming links for a switch.
+ */
+ public Iterable<Link> getIncomingLinksFromSwitch(Long dpid);
+
+ /**
+ * Get the network devices for a given IP address.
+ *
+ * @param ipAddress the IP address to use.
+ * @return the network devices for the IP address.
+ */
+ public Iterable<Device> getDevicesByIp(InetAddress ipAddress);
+
+ /**
+ * Get the network device for a given MAC address.
+ *
+ * @param address the MAC address to use.
+ * @return the network device for the MAC address if found, otherwise null.
+ */
+ public Device getDeviceByMac(MACAddress address);
}