Network Graph Refactoring: renamed the NetworkGraphDiscoveryInterface methods:
* The renaming is:
putFooEvent -> putFooDiscoveryEvent
removeFooEvent -> removeFooDiscoveryEvent
After the renaming the method names are more consistent with
NetworkGraphReplicationInterface
* Added Javadoc to the renamed NetworkGraphDiscoveryInterface methods.
Change-Id: I42516592a157dc4624f026e9317e59bbe105d8c0
diff --git a/src/main/java/net/onrc/onos/ofcontroller/floodlightlistener/RCNetworkGraphPublisher.java b/src/main/java/net/onrc/onos/ofcontroller/floodlightlistener/RCNetworkGraphPublisher.java
index a1d09df..9d58be5 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/floodlightlistener/RCNetworkGraphPublisher.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/floodlightlistener/RCNetworkGraphPublisher.java
@@ -120,7 +120,7 @@
links.addAll(reverseLinks);
*/
SwitchEvent switchEvent = new SwitchEvent(dpid);
- networkGraphDiscoveryInterface.removeSwitchEvent(switchEvent);
+ networkGraphDiscoveryInterface.removeSwitchDiscoveryEvent(switchEvent);
registryService.releaseControl(dpid);
// TODO publish UPDATE_SWITCH event here
@@ -162,7 +162,7 @@
switch (update.getOperation()) {
case LINK_ADDED:
- networkGraphDiscoveryInterface.putLinkEvent(linkEvent);
+ networkGraphDiscoveryInterface.putLinkDiscoveryEvent(linkEvent);
/*
TopologyElement topologyElement =
new TopologyElement(update.getSrc(),
@@ -177,7 +177,7 @@
// We never use it.
break;
case LINK_REMOVED:
- networkGraphDiscoveryInterface.removeLinkEvent(linkEvent);
+ networkGraphDiscoveryInterface.removeLinkDiscoveryEvent(linkEvent);
/*
TopologyElement topologyElement =
new TopologyElement(update.getSrc(),
@@ -195,14 +195,14 @@
@Override
public void switchPortAdded(Long switchId, OFPhysicalPort port) {
PortEvent portEvent = new PortEvent(switchId, (long)port.getPortNumber());
- networkGraphDiscoveryInterface.putPortEvent(portEvent);
+ networkGraphDiscoveryInterface.putPortDiscoveryEvent(portEvent);
linkDiscovery.RemoveFromSuppressLLDPs(switchId, port.getPortNumber());
}
@Override
public void switchPortRemoved(Long switchId, OFPhysicalPort port) {
PortEvent portEvent = new PortEvent(switchId, (long)port.getPortNumber());
- networkGraphDiscoveryInterface.removePortEvent(portEvent);
+ networkGraphDiscoveryInterface.removePortDiscoveryEvent(portEvent);
}
@Override
@@ -220,7 +220,7 @@
}
switchEvent.setPorts(portEvents);
- networkGraphDiscoveryInterface.putSwitchEvent(switchEvent);
+ networkGraphDiscoveryInterface.putSwitchDiscoveryEvent(switchEvent);
/*
// TODO publish ADD_SWITCH event here
@@ -263,7 +263,7 @@
public void removedSwitch(IOFSwitch sw) {
// TODO move to cleanup thread
//SwitchEvent switchEvent = new SwitchEvent(sw.getId());
- //networkGraphDiscoveryInterface.removeSwitchEvent(switchEvent);
+ //networkGraphDiscoveryInterface.removeSwitchDiscoveryEvent(switchEvent);
}
@Override
diff --git a/src/main/java/net/onrc/onos/ofcontroller/networkgraph/NetworkGraphDiscoveryInterface.java b/src/main/java/net/onrc/onos/ofcontroller/networkgraph/NetworkGraphDiscoveryInterface.java
index ffd95f5..87edb28 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/networkgraph/NetworkGraphDiscoveryInterface.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/networkgraph/NetworkGraphDiscoveryInterface.java
@@ -1,12 +1,63 @@
package net.onrc.onos.ofcontroller.networkgraph;
+/**
+ * Interface used by the Topology Discovery module to write topology-related
+ * events.
+ */
public interface NetworkGraphDiscoveryInterface {
- public void putSwitchEvent(SwitchEvent switchEvent);
- public void removeSwitchEvent(SwitchEvent switchEvent);
- public void putPortEvent(PortEvent portEvent);
- public void removePortEvent(PortEvent portEvent);
- public void putLinkEvent(LinkEvent linkEvent);
- public void removeLinkEvent(LinkEvent linkEvent);
- public void putDeviceEvent(DeviceEvent deviceEvent);
- public void removeDeviceEvent(DeviceEvent deviceEvent);
+ /**
+ * Switch discovered event.
+ *
+ * @param switchEvent the switch event.
+ */
+ public void putSwitchDiscoveryEvent(SwitchEvent switchEvent);
+
+ /**
+ * Switch removed event.
+ *
+ * @param switchEvent the switch event.
+ */
+ public void removeSwitchDiscoveryEvent(SwitchEvent switchEvent);
+
+ /**
+ * Port discovered event.
+ *
+ * @param portEvent the port event.
+ */
+ public void putPortDiscoveryEvent(PortEvent portEvent);
+
+ /**
+ * Port removed event.
+ *
+ * @param portEvent the port event.
+ */
+ public void removePortDiscoveryEvent(PortEvent portEvent);
+
+ /**
+ * Link discovered event.
+ *
+ * @param linkEvent the link event.
+ */
+ public void putLinkDiscoveryEvent(LinkEvent linkEvent);
+
+ /**
+ * Link removed event.
+ *
+ * @param linkEvent the link event.
+ */
+ public void removeLinkDiscoveryEvent(LinkEvent linkEvent);
+
+ /**
+ * Device discovered event.
+ *
+ * @param deviceEvent the device event.
+ */
+ public void putDeviceDiscoveryEvent(DeviceEvent deviceEvent);
+
+ /**
+ * Device removed event.
+ *
+ * @param deviceEvent the device event.
+ */
+ public void removeDeviceDiscoveryEvent(DeviceEvent deviceEvent);
}
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 25a322b..0118294 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/networkgraph/TopologyManager.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/networkgraph/TopologyManager.java
@@ -248,7 +248,7 @@
* ******************************/
@Override
- public void putSwitchEvent(SwitchEvent switchEvent) {
+ public void putSwitchDiscoveryEvent(SwitchEvent switchEvent) {
if (prepareForAddSwitchEvent(switchEvent)) {
datastore.addSwitch(switchEvent);
putSwitch(switchEvent);
@@ -261,7 +261,7 @@
}
@Override
- public void removeSwitchEvent(SwitchEvent switchEvent) {
+ public void removeSwitchDiscoveryEvent(SwitchEvent switchEvent) {
if (prepareForRemoveSwitchEvent(switchEvent)) {
datastore.deactivateSwitch(switchEvent);
removeSwitch(switchEvent);
@@ -272,7 +272,7 @@
}
@Override
- public void putPortEvent(PortEvent portEvent) {
+ public void putPortDiscoveryEvent(PortEvent portEvent) {
if (prepareForAddPortEvent(portEvent)) {
datastore.addPort(portEvent);
putPort(portEvent);
@@ -285,7 +285,7 @@
}
@Override
- public void removePortEvent(PortEvent portEvent) {
+ public void removePortDiscoveryEvent(PortEvent portEvent) {
if (prepareForRemovePortEvent(portEvent)) {
datastore.deactivatePort(portEvent);
removePort(portEvent);
@@ -296,7 +296,7 @@
}
@Override
- public void putLinkEvent(LinkEvent linkEvent) {
+ public void putLinkDiscoveryEvent(LinkEvent linkEvent) {
if (prepareForAddLinkEvent(linkEvent)) {
datastore.addLink(linkEvent);
putLink(linkEvent);
@@ -309,12 +309,12 @@
}
@Override
- public void removeLinkEvent(LinkEvent linkEvent) {
- removeLinkEvent(linkEvent, false);
+ public void removeLinkDiscoveryEvent(LinkEvent linkEvent) {
+ removeLinkDiscoveryEvent(linkEvent, false);
}
- private void removeLinkEvent(LinkEvent linkEvent,
- boolean dstCheckBeforeDBmodify) {
+ private void removeLinkDiscoveryEvent(LinkEvent linkEvent,
+ boolean dstCheckBeforeDBmodify) {
if (prepareForRemoveLinkEvent(linkEvent)) {
if (dstCheckBeforeDBmodify) {
// write to DB only if it is owner of the dst dpid
@@ -332,7 +332,7 @@
}
@Override
- public void putDeviceEvent(DeviceEvent deviceEvent) {
+ public void putDeviceDiscoveryEvent(DeviceEvent deviceEvent) {
if (prepareForAddDeviceEvent(deviceEvent)) {
// datastore.addDevice(deviceEvent);
// putDevice(deviceEvent);
@@ -348,7 +348,7 @@
}
@Override
- public void removeDeviceEvent(DeviceEvent deviceEvent) {
+ public void removeDeviceDiscoveryEvent(DeviceEvent deviceEvent) {
if (prepareForRemoveDeviceEvent(deviceEvent)) {
// datastore.removeDevice(deviceEvent);
// removeDevice(deviceEvent);
@@ -397,7 +397,7 @@
if (!port_noOnEvent.contains(p.getNumber())) {
//PortEvent rmEvent = new PortEvent(p.getSwitch().getDpid(), p.getNumber());
// calling Discovery removePort() API to wipe from DB, etc.
- //removePortEvent(rmEvent);
+ //removePortDiscoveryEvent(rmEvent);
// We can't remove ports here because this will trigger a remove
// from the switch's port list, which we are currently iterating
@@ -409,7 +409,7 @@
PortEvent rmEvent = new PortEvent(p.getSwitch().getDpid(),
p.getNumber());
// calling Discovery removePort() API to wipe from DB, etc.
- removePortEvent(rmEvent);
+ removePortDiscoveryEvent(rmEvent);
}
}
}
@@ -445,7 +445,7 @@
}
for (DeviceEvent devEvent : deviceEvents) {
// calling Discovery API to wipe from DB, etc.
- removeDeviceEvent(devEvent);
+ removeDeviceDiscoveryEvent(devEvent);
}
Set<Link> links = new HashSet<>();
@@ -465,7 +465,7 @@
// Call internal remove Link, which will check
// ownership of DST dpid and modify DB only if it is the owner
- removeLinkEvent(linkEvent, true);
+ removeLinkDiscoveryEvent(linkEvent, true);
}
return true;
}
@@ -497,7 +497,7 @@
}
for (DeviceEvent devEvent : deviceEvents) {
// calling Discovery API to wipe from DB, etc.
- removeDeviceEvent(devEvent);
+ removeDeviceDiscoveryEvent(devEvent);
}
return true;
@@ -718,15 +718,15 @@
portsToRemove.add(portEvent);
}
for (PortEvent portEvent : portsToRemove) {
- // XXX calling removePortEvent() may trigger duplicate event,
- // once at prepare phase, second time here
+ // XXX calling removePortDiscoveryEvent() may trigger duplicate
+ // event, once at prepare phase, second time here
// If event can be squashed, ignored etc. at receiver side it
// shouldn't be a problem, but if not need to re-visit this issue.
- // Note: removePortEvent() implies removal of attached Device, etc.
- // if we decide not to call removePortEvent(), Device needs to be
- // handled properly
- removePortEvent(portEvent);
+ // Note: removePortDiscoveryEvent() implies removal of attached
+ // Device, etc. if we decide not to call
+ // removePortDiscoveryEvent(), Device needs to be handled properly.
+ removePortDiscoveryEvent(portEvent);
}
networkGraph.removeSwitch(swEvent.getDpid());
@@ -783,13 +783,13 @@
devEvent.addAttachmentPoint(new SwitchPort(p.getSwitch().getDpid(),
p.getNumber()));
- // XXX calling removeDeviceEvent() may trigger duplicate event,
- // once at prepare phase, second time here
+ // XXX calling removeDeviceDiscoveryEvent() may trigger duplicate
+ // event, once at prepare phase, second time here.
// If event can be squashed, ignored etc. at receiver side it
// shouldn't be a problem, but if not need to re-visit
// calling Discovery API to wipe from DB, etc.
- removeDeviceEvent(devEvent);
+ removeDeviceDiscoveryEvent(devEvent);
}
Set<Link> links = new HashSet<>();
links.add(p.getOutgoingLink());
@@ -807,13 +807,13 @@
linksToRemove.add(linkEvent);
}
for (LinkEvent linkEvent : linksToRemove) {
- // XXX calling removeLinkEvent() may trigger duplicate event,
- // once at prepare phase, second time here
+ // XXX calling removeLinkDiscoveryEvent() may trigger duplicate
+ // event, once at prepare phase, second time here.
// If event can be squashed, ignored etc. at receiver side it
// shouldn't be a problem, but if not need to re-visit
// calling Discovery API to wipe from DB, etc.
- removeLinkEvent(linkEvent);
+ removeLinkDiscoveryEvent(linkEvent);
}
// remove Port from Switch
@@ -876,7 +876,7 @@
DeviceEvent rmEvent = new DeviceEvent(d.getMacAddress());
rmEvent.addAttachmentPoint(new SwitchPort(dstPort.getDpid(),
dstPort.getNumber()));
- removeDeviceEvent(rmEvent);
+ removeDeviceDiscoveryEvent(rmEvent);
}
dstPortMem.removeAllDevice();
for (Device d : srcPortMem.getDevices() ) {
@@ -889,7 +889,7 @@
DeviceEvent rmEvent = new DeviceEvent(d.getMacAddress());
rmEvent.addAttachmentPoint(new SwitchPort(dstPort.getDpid(),
dstPort.getNumber()));
- removeDeviceEvent(rmEvent);
+ removeDeviceDiscoveryEvent(rmEvent);
}
srcPortMem.removeAllDevice();
}