X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Ftopology-manager%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fmd%2Fcontroller%2Ftopology%2Fmanager%2FFlowCapableTopologyExporter.java;h=c1996f4691632637abc9fc7dffacce0bcb12f2ad;hb=67d58d1ab50f3c3bbe19a96fb6f0d9d94211829f;hp=451cad48169ea81869ef11047895010715f0e30f;hpb=a3ebcb3c36804de1e4c0177f3462e33958b0c216;p=controller.git
diff --git a/opendaylight/md-sal/topology-manager/src/main/java/org/opendaylight/md/controller/topology/manager/FlowCapableTopologyExporter.java b/opendaylight/md-sal/topology-manager/src/main/java/org/opendaylight/md/controller/topology/manager/FlowCapableTopologyExporter.java
index 451cad4816..c1996f4691 100644
--- a/opendaylight/md-sal/topology-manager/src/main/java/org/opendaylight/md/controller/topology/manager/FlowCapableTopologyExporter.java
+++ b/opendaylight/md-sal/topology-manager/src/main/java/org/opendaylight/md/controller/topology/manager/FlowCapableTopologyExporter.java
@@ -15,11 +15,9 @@ import static org.opendaylight.md.controller.topology.manager.FlowCapableNodeMap
import static org.opendaylight.md.controller.topology.manager.FlowCapableNodeMapping.toTopologyNode;
import static org.opendaylight.md.controller.topology.manager.FlowCapableNodeMapping.toTopologyNodeId;
-import com.google.common.base.Optional;
-import com.google.common.base.Preconditions;
-import com.google.common.util.concurrent.CheckedFuture;
-import com.google.common.util.concurrent.FutureCallback;
-import com.google.common.util.concurrent.Futures;
+import java.util.Collections;
+import java.util.List;
+
import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
@@ -50,6 +48,12 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.google.common.base.Optional;
+import com.google.common.base.Preconditions;
+import com.google.common.util.concurrent.CheckedFuture;
+import com.google.common.util.concurrent.FutureCallback;
+import com.google.common.util.concurrent.Futures;
+
class FlowCapableTopologyExporter implements FlowTopologyDiscoveryListener, OpendaylightInventoryListener {
private final Logger LOG = LoggerFactory.getLogger(FlowCapableTopologyExporter.class);
@@ -147,7 +151,7 @@ class FlowCapableTopologyExporter implements FlowTopologyDiscoveryListener, Open
public void applyOperation(final ReadWriteTransaction transaction) {
final Link link = toTopologyLink(notification);
final InstanceIdentifier path = linkPath(link);
- transaction.put(LogicalDatastoreType.OPERATIONAL, path, link);
+ transaction.merge(LogicalDatastoreType.OPERATIONAL, path, link, true);
}
});
}
@@ -193,8 +197,9 @@ class FlowCapableTopologyExporter implements FlowTopologyDiscoveryListener, Open
@Override
public void onSuccess(Optional topologyOptional) {
if (topologyOptional.isPresent()) {
- Topology topologyData = topologyOptional.get();
- for (Link link : topologyData.getLink()) {
+ List linkList = topologyOptional.get().getLink() != null
+ ? topologyOptional.get().getLink() : Collections. emptyList();
+ for (Link link : linkList) {
if (id.equals(link.getSource().getSourceNode()) || id.equals(link.getDestination().getDestNode())) {
transaction.delete(LogicalDatastoreType.OPERATIONAL, linkPath(link));
}
@@ -220,8 +225,9 @@ class FlowCapableTopologyExporter implements FlowTopologyDiscoveryListener, Open
@Override
public void onSuccess(Optional topologyOptional) {
if (topologyOptional.isPresent()) {
- Topology topologyData = topologyOptional.get();
- for (Link link : topologyData.getLink()) {
+ List linkList = topologyOptional.get().getLink() != null
+ ? topologyOptional.get().getLink() : Collections. emptyList();
+ for (Link link : linkList) {
if (id.equals(link.getSource().getSourceTp()) || id.equals(link.getDestination().getDestTp())) {
transaction.delete(LogicalDatastoreType.OPERATIONAL, linkPath(link));
}