Merge "Bug 1585 - switch features removed after node updated"
authorEd Warnicke <eaw@cisco.com>
Thu, 21 Aug 2014 10:57:14 +0000 (10:57 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Thu, 21 Aug 2014 10:57:14 +0000 (10:57 +0000)
opendaylight/md-sal/inventory-manager/src/main/java/org/opendaylight/controller/md/inventory/manager/NodeChangeCommiter.java
opendaylight/md-sal/topology-manager/src/main/java/org/opendaylight/md/controller/topology/manager/FlowCapableTopologyExporter.java

index 57ec893..b14bfd4 100644 (file)
@@ -32,8 +32,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.No
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
 import org.opendaylight.yangtools.yang.binding.DataObject;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.InstanceIdentifierBuilder;
@@ -81,7 +79,7 @@ class NodeChangeCommiter implements OpendaylightInventoryListener {
                 InstanceIdentifier<NodeConnector> value = (InstanceIdentifier<NodeConnector>) ref.getValue();
                 LOG.debug("updating node connector : {}.", value);
                 NodeConnector build = data.build();
-                tx.put(LogicalDatastoreType.OPERATIONAL, value, build);
+                tx.merge(LogicalDatastoreType.OPERATIONAL, value, build, true);
             }
         });
     }
@@ -139,13 +137,9 @@ class NodeChangeCommiter implements OpendaylightInventoryListener {
         manager.enqueue(new InventoryOperation() {
             @Override
             public void applyOperation(final ReadWriteTransaction tx) {
-                final NodeBuilder nodeBuilder = new NodeBuilder(node);
-                nodeBuilder.setKey(new NodeKey(node.getId()));
-
                 final FlowCapableNode augment = InventoryMapping.toInventoryAugment(flowNode);
-                nodeBuilder.addAugmentation(FlowCapableNode.class, augment);
                 LOG.debug("updating node :{} ", path);
-                tx.put(LogicalDatastoreType.OPERATIONAL, path, augment);
+                tx.merge(LogicalDatastoreType.OPERATIONAL, path, augment, true);
             }
         });
     }
index d7ce948..451cad4 100644 (file)
@@ -91,7 +91,7 @@ class FlowCapableTopologyExporter implements FlowTopologyDiscoveryListener, Open
                 public void applyOperation(final ReadWriteTransaction transaction) {
                     final Node node = toTopologyNode(toTopologyNodeId(notification.getId()), notification.getNodeRef());
                     final InstanceIdentifier<Node> path = getNodePath(toTopologyNodeId(notification.getId()));
-                    transaction.put(LogicalDatastoreType.OPERATIONAL, path, node);
+                    transaction.merge(LogicalDatastoreType.OPERATIONAL, path, node, true);
                 }
             });
         }
@@ -130,7 +130,7 @@ class FlowCapableTopologyExporter implements FlowTopologyDiscoveryListener, Open
                     TerminationPoint point = toTerminationPoint(toTerminationPointId(notification.getId()),
                             notification.getNodeConnectorRef());
                     final InstanceIdentifier<TerminationPoint> path = tpPath(nodeId, point.getKey().getTpId());
-                    transaction.put(LogicalDatastoreType.OPERATIONAL, path, point);
+                    transaction.merge(LogicalDatastoreType.OPERATIONAL, path, point, true);
                     if ((fcncu.getState() != null && fcncu.getState().isLinkDown())
                             || (fcncu.getConfiguration() != null && fcncu.getConfiguration().isPORTDOWN())) {
                         removeAffectedLinks(point.getTpId());