Network Graph Refactoring: Northbound API cleanup
* Renamed/shortened methods:
Link.getSourcePort() -> getSrcPort()
Link.getDestinationPort() -> getDstPort()
Link.getSourceSwitch() -> getSrcSwitch()
Link.getDestinationSwitch() -> getDstSwitch()
* Added Javadoc comments
* Removed deprecated and unused methods:
Link.getSourceSwitchDpid()
Link.getSorcePortNumber()
Link.getDestinationSwitchDpid()
Link.getDestinationPortNumber()
NetworkGraph.getOutgoingLinksFromSwitch()
NetworkGraph.getIncomingLinksFromSwitch()
* Moved method LinkEvent.getLink(NetworkGraph graph)
to NetworkGraph.getLink()
Change-Id: Ibedba53fc6cd04d77f508ee67d41b2cfa515d3fc
diff --git a/src/main/java/net/onrc/onos/ofcontroller/networkgraph/TopologyManager.java b/src/main/java/net/onrc/onos/ofcontroller/networkgraph/TopologyManager.java
index 0275575..a01057b 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/networkgraph/TopologyManager.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/networkgraph/TopologyManager.java
@@ -417,10 +417,10 @@
}
log.debug("Removing Link {} on Port {}", link, portEvent);
LinkEvent linkEvent =
- new LinkEvent(link.getSourceSwitchDpid(),
- link.getSourcePortNumber(),
- link.getDestinationSwitchDpid(),
- link.getDestinationPortNumber());
+ new LinkEvent(link.getSrcSwitch().getDpid(),
+ link.getSrcPort().getNumber(),
+ link.getDstSwitch().getDpid(),
+ link.getDstPort().getNumber());
// calling Discovery API to wipe from DB, etc.
// Call internal remove Link, which will check
@@ -480,8 +480,8 @@
// XXX Check if we should reject or just accept these cases.
// it should be harmless to remove the Link on event from DB anyways
if (link == null ||
- !link.getDestinationPortNumber().equals(linkEvent.getDst().number)
- || !link.getDestinationSwitchDpid().equals(linkEvent.getDst().dpid)) {
+ !link.getDstPort().getNumber().equals(linkEvent.getDst().number)
+ || !link.getDstSwitch().getDpid().equals(linkEvent.getDst().dpid)) {
log.warn("Dropping remove link event because link doesn't exist: {}", linkEvent);
return false;
}
@@ -760,10 +760,10 @@
continue;
}
log.debug("Removing Link {} on Port {}", link, portEvent);
- LinkEvent linkEvent = new LinkEvent(link.getSourceSwitchDpid(),
- link.getSourcePortNumber(),
- link.getDestinationSwitchDpid(),
- link.getDestinationPortNumber());
+ LinkEvent linkEvent = new LinkEvent(link.getSrcSwitch().getDpid(),
+ link.getSrcPort().getNumber(),
+ link.getDstSwitch().getDpid(),
+ link.getDstPort().getNumber());
linksToRemove.add(linkEvent);
}
for (LinkEvent linkEvent : linksToRemove) {