Network GraphRefactoring: Removed unused interface and code.
* Removed interface NetworkGraphReplicationInterface, because it is not
needed anymore.
* Removed the ONOS Instance Origin ID for each notification, because
it won't be needed.
Change-Id: Ia2035cc34ea1c1b8cefa90d35eab5a10f5f8a2eb
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 a01057b..f620614 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/networkgraph/TopologyManager.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/networkgraph/TopologyManager.java
@@ -39,8 +39,7 @@
* re-ordering. e.g.) Link Add came in, but Switch was not there.
*
*/
-public class TopologyManager implements NetworkGraphDiscoveryInterface,
- NetworkGraphReplicationInterface {
+public class TopologyManager implements NetworkGraphDiscoveryInterface {
private static final Logger log = LoggerFactory
.getLogger(TopologyManager.class);
@@ -142,10 +141,6 @@
*/
private void processEvents(Collection<EventEntry<TopologyEvent>> events) {
for (EventEntry<TopologyEvent> event : events) {
- if (event.eventData().getOriginID().equals(registryService.getControllerId())) {
- // ignore event triggered by myself
- continue;
- }
TopologyEvent topologyEvent = event.eventData();
switch (event.eventType()) {
case ENTRY_ADD:
@@ -251,8 +246,7 @@
public void putSwitchDiscoveryEvent(SwitchEvent switchEvent) {
if (datastore.addSwitch(switchEvent)) {
// Send out notification
- TopologyEvent topologyEvent =
- new TopologyEvent(switchEvent, registryService.getControllerId());
+ TopologyEvent topologyEvent = new TopologyEvent(switchEvent);
eventChannel.addEntry(topologyEvent.getID(), topologyEvent);
}
}
@@ -269,8 +263,7 @@
public void putPortDiscoveryEvent(PortEvent portEvent) {
if (datastore.addPort(portEvent)) {
// Send out notification
- TopologyEvent topologyEvent =
- new TopologyEvent(portEvent, registryService.getControllerId());
+ TopologyEvent topologyEvent = new TopologyEvent(portEvent);
}
}
@@ -286,8 +279,7 @@
public void putLinkDiscoveryEvent(LinkEvent linkEvent) {
if (datastore.addLink(linkEvent)) {
// Send out notification
- TopologyEvent topologyEvent =
- new TopologyEvent(linkEvent, registryService.getControllerId());
+ TopologyEvent topologyEvent = new TopologyEvent(linkEvent);
eventChannel.addEntry(topologyEvent.getID(), topologyEvent);
}
}
@@ -304,9 +296,7 @@
public void putDeviceDiscoveryEvent(DeviceEvent deviceEvent) {
if (datastore.addDevice(deviceEvent)) {
// Send out notification
- TopologyEvent topologyEvent =
- new TopologyEvent(deviceEvent,
- registryService.getControllerId());
+ TopologyEvent topologyEvent = new TopologyEvent(deviceEvent);
eventChannel.addEntry(topologyEvent.getID(), topologyEvent);
}
}
@@ -319,6 +309,82 @@
}
}
+ /* ************************************************
+ * Internal methods for processing the replication events
+ * ************************************************/
+
+ private void putSwitchReplicationEvent(SwitchEvent switchEvent) {
+ if (prepareForAddSwitchEvent(switchEvent)) {
+ putSwitch(switchEvent);
+ }
+ // TODO handle invariant violation
+ // trigger instance local topology event handler
+ dispatchPutSwitchEvent(switchEvent);
+ }
+
+ private void removeSwitchReplicationEvent(SwitchEvent switchEvent) {
+ if (prepareForRemoveSwitchEvent(switchEvent)) {
+ removeSwitch(switchEvent);
+ }
+ // TODO handle invariant violation
+ // trigger instance local topology event handler
+ dispatchRemoveSwitchEvent(switchEvent);
+ }
+
+ private void putPortReplicationEvent(PortEvent portEvent) {
+ if (prepareForAddPortEvent(portEvent)) {
+ putPort(portEvent);
+ }
+ // TODO handle invariant violation
+ // trigger instance local topology event handler
+ dispatchPutPortEvent(portEvent);
+ }
+
+ private void removePortReplicationEvent(PortEvent portEvent) {
+ if (prepareForRemovePortEvent(portEvent)) {
+ removePort(portEvent);
+ }
+ // TODO handle invariant violation
+ // trigger instance local topology event handler
+ dispatchRemovePortEvent(portEvent);
+ }
+
+ private void putLinkReplicationEvent(LinkEvent linkEvent) {
+ if (prepareForAddLinkEvent(linkEvent)) {
+ putLink(linkEvent);
+ }
+ // TODO handle invariant violation
+ // trigger instance local topology event handler
+ dispatchPutLinkEvent(linkEvent);
+ }
+
+ private void removeLinkReplicationEvent(LinkEvent linkEvent) {
+ if (prepareForRemoveLinkEvent(linkEvent)) {
+ removeLink(linkEvent);
+ }
+ // TODO handle invariant violation
+ // trigger instance local topology event handler
+ dispatchRemoveLinkEvent(linkEvent);
+ }
+
+ private void putDeviceReplicationEvent(DeviceEvent deviceEvent) {
+ if (prepareForAddDeviceEvent(deviceEvent)) {
+ putDevice(deviceEvent);
+ }
+ // TODO handle invariant violation
+ // trigger instance local topology event handler
+ dispatchPutDeviceEvent(deviceEvent);
+ }
+
+ private void removeDeviceReplicationEvent(DeviceEvent deviceEvent) {
+ if (prepareForRemoveDeviceEvent(deviceEvent)) {
+ removeDevice(deviceEvent);
+ }
+ // TODO handle invariant violation
+ // trigger instance local topology event handler
+ dispatchRemoveDeviceEvent(deviceEvent);
+ }
+
/* *****************
* Internal methods to maintain invariants of the network graph
* *****************/
@@ -543,90 +609,6 @@
return true;
}
- /* ******************************
- * NetworkGraphReplicationInterface methods
- * ******************************/
-
- @Override
- public void putSwitchReplicationEvent(SwitchEvent switchEvent) {
- if (prepareForAddSwitchEvent(switchEvent)) {
- putSwitch(switchEvent);
- }
- // TODO handle invariant violation
- // trigger instance local topology event handler
- dispatchPutSwitchEvent(switchEvent);
- }
-
- @Override
- public void removeSwitchReplicationEvent(SwitchEvent switchEvent) {
- if (prepareForRemoveSwitchEvent(switchEvent)) {
- removeSwitch(switchEvent);
- }
- // TODO handle invariant violation
- // trigger instance local topology event handler
- dispatchRemoveSwitchEvent(switchEvent);
- }
-
- @Override
- public void putPortReplicationEvent(PortEvent portEvent) {
- if (prepareForAddPortEvent(portEvent)) {
- putPort(portEvent);
- }
- // TODO handle invariant violation
- // trigger instance local topology event handler
- dispatchPutPortEvent(portEvent);
- }
-
- @Override
- public void removePortReplicationEvent(PortEvent portEvent) {
- if (prepareForRemovePortEvent(portEvent)) {
- removePort(portEvent);
- }
- // TODO handle invariant violation
- // trigger instance local topology event handler
- dispatchRemovePortEvent(portEvent);
- }
-
- @Override
- public void putLinkReplicationEvent(LinkEvent linkEvent) {
- if (prepareForAddLinkEvent(linkEvent)) {
- putLink(linkEvent);
- }
- // TODO handle invariant violation
- // trigger instance local topology event handler
- dispatchPutLinkEvent(linkEvent);
- }
-
- @Override
- public void removeLinkReplicationEvent(LinkEvent linkEvent) {
- if (prepareForRemoveLinkEvent(linkEvent)) {
- removeLink(linkEvent);
- }
- // TODO handle invariant violation
- // trigger instance local topology event handler
- dispatchRemoveLinkEvent(linkEvent);
- }
-
- @Override
- public void putDeviceReplicationEvent(DeviceEvent deviceEvent) {
- if (prepareForAddDeviceEvent(deviceEvent)) {
- putDevice(deviceEvent);
- }
- // TODO handle invariant violation
- // trigger instance local topology event handler
- dispatchPutDeviceEvent(deviceEvent);
- }
-
- @Override
- public void removeDeviceReplicationEvent(DeviceEvent deviceEvent) {
- if (prepareForRemoveDeviceEvent(deviceEvent)) {
- removeDevice(deviceEvent);
- }
- // TODO handle invariant violation
- // trigger instance local topology event handler
- dispatchRemoveDeviceEvent(deviceEvent);
- }
-
/* ************************************************
* Internal In-memory object mutation methods.
* ************************************************/