Work toward cleaning up the Topology Manager and the Topology Publisher
ONOS-1890
* Removed explicit calls "linkDiscovery.disableDiscoveryOnPort()"
when adding a new switch. Those calls were added as a work-around
to deal with publishing the link discovery before publishing
the switch or port discovery. The current implementation can tolerate
reordering, hence those calls are not needed.
* Renamed methods TopologyPublisher.putFoo() and removeFoo() to
publishAddFoo() and publishRemoveFoo()
* Refactored all publishAddFoo() and publishRemoveFoo() methods
in the TopologyPublisher:
- Track properly the published state.
- Update the publish semantics: publishAddFoo() is allowed to proceed
only if the instance is the current Master for the corresponding DPID.
On the other hand, publishRemoveFoo() is allowed if we publishAddFoo()
was previously allowed.
- Track switch-to-port, port-to-link, and port-to-host dependencies
and call publishRemoveFoo() to cleanup as appropriate based on that
dependency.
Change-Id: I0725ee68508e96f462f6a134ca5d0e2c7ce91ba9
diff --git a/src/main/java/net/floodlightcontroller/core/internal/Controller.java b/src/main/java/net/floodlightcontroller/core/internal/Controller.java
index 69f706c..23d61bb 100644
--- a/src/main/java/net/floodlightcontroller/core/internal/Controller.java
+++ b/src/main/java/net/floodlightcontroller/core/internal/Controller.java
@@ -353,14 +353,7 @@
return false;
activeMasterSwitches.put(dpid, sw);
}
- // XXX Workaround to prevent race condition where a link is detected
- // and attempted to be written to the database before the port is in
- // the database. We now suppress link discovery on ports until we're
- // sure they're in the database.
- for (OFPortDesc port : sw.getPorts()) {
- linkDiscovery.disableDiscoveryOnPort(sw.getId(),
- port.getPortNo().getShortPortNumber());
- }
+
// update counters and events
counters.switchActivated.updateCounterWithFlush();
evSwitch.updateEventWithFlush(new SwitchEvent(dpid, "activeMaster"));
@@ -463,15 +456,6 @@
return;
}
- if (changeType == PortChangeType.ADD) {
- // XXX Workaround to prevent race condition where a link is detected
- // and attempted to be written to the database before the port is in
- // the database. We now suppress link discovery on ports until we're
- // sure they're in the database.
- linkDiscovery.disableDiscoveryOnPort(dpid, port.getPortNo()
- .getShortPortNumber());
- }
-
SwitchUpdate update = new SwitchUpdate(dpid, SwitchUpdateType.PORTCHANGED,
port, changeType);
addUpdateToQueue(update);