Merge branch 'master' of github.com:OPENNETWORKINGLAB/ONOS
diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java b/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java
index 11643fa..a9a2212 100644
--- a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java
+++ b/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java
@@ -82,10 +82,7 @@
import net.floodlightcontroller.topology.NodePortTuple;
import net.floodlightcontroller.util.EventHistory;
import net.floodlightcontroller.util.EventHistory.EvAction;
-
import net.onrc.onos.registry.controller.IControllerRegistryService;
-import net.onrc.onos.registry.controller.IControllerRegistryService.ControlChangeCallback;
-import net.onrc.onos.registry.controller.RegistryException;
import org.openflow.protocol.OFMessage;
import org.openflow.protocol.OFPacketIn;
@@ -130,6 +127,12 @@
IStorageSourceListener, ILinkDiscoveryService,
IFloodlightModule, IInfoProvider, IHAListener {
protected static Logger log = LoggerFactory.getLogger(LinkDiscoveryManager.class);
+
+ protected enum NetworkMapOperation {
+ NONE,
+ INSERT,
+ UPDATE
+ }
// Names of table/fields for links in the storage API
private static final String LINK_TABLE_NAME = "controller_link";
@@ -1025,6 +1028,7 @@
NodePortTuple srcNpt, dstNpt;
boolean linkChanged = false;
+ NetworkMapOperation operation = NetworkMapOperation.NONE;
lock.writeLock().lock();
try {
@@ -1073,7 +1077,8 @@
writeLinkToStorage(lt, newInfo);
// Write link to network map
- linkStore.update(lt, newInfo, DM_OPERATION.INSERT);
+ operation = NetworkMapOperation.INSERT;
+ //linkStore.update(lt, newInfo, DM_OPERATION.INSERT);
updateOperation = UpdateOperation.LINK_UPDATED;
linkChanged = true;
@@ -1132,7 +1137,8 @@
writeLinkToStorage(lt, newInfo);
// Write link to network map
- linkStore.update(lt, newInfo, DM_OPERATION.UPDATE);
+ operation = NetworkMapOperation.UPDATE;
+ //linkStore.update(lt, newInfo, DM_OPERATION.UPDATE);
if (linkChanged) {
updateOperation = getUpdateOperation(newInfo.getSrcPortState(),
@@ -1162,6 +1168,18 @@
} finally {
lock.writeLock().unlock();
}
+
+ switch (operation){
+ case INSERT:
+ linkStore.update(lt, newInfo, DM_OPERATION.INSERT);
+ break;
+ case UPDATE:
+ linkStore.update(lt, newInfo, DM_OPERATION.UPDATE);
+ break;
+ case NONE:
+ default:
+ break;
+ }
return linkChanged;
}