Hotfix bug 1556 - FRM: NPE thrown in notification 82/9982/1
authorVaclav Demcak <vdemcak@cisco.com>
Fri, 15 Aug 2014 15:18:41 +0000 (17:18 +0200)
committerVaclav Demcak <vdemcak@cisco.com>
Fri, 15 Aug 2014 16:02:49 +0000 (18:02 +0200)
* FlowCapableTopologyExpoerter - flow:1 is not exist because it is not created correctly

Change-Id: Ifa5b984329796e5df7aa0f71b1932b73d0ff99a0
Signed-off-by: Vaclav Demcak <vdemcak@cisco.com>
opendaylight/md-sal/topology-manager/src/main/java/org/opendaylight/md/controller/topology/manager/FlowCapableTopologyProvider.java

index 0a3b9f6a6b7c53c193cd3fd523504d4e729df180..556047091c1a779f6af251d9da0e00c50f6c6536 100644 (file)
@@ -8,6 +8,7 @@
 package org.opendaylight.md.controller.topology.manager;
 
 import java.util.concurrent.ExecutionException;
+
 import org.opendaylight.controller.md.sal.binding.api.DataBroker;
 import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
@@ -44,16 +45,15 @@ public class FlowCapableTopologyProvider extends AbstractBindingAwareProvider im
         final String name = "flow:1";
         final TopologyKey key = new TopologyKey(new TopologyId(name));
         final InstanceIdentifier<Topology> path = InstanceIdentifier
-                .builder(NetworkTopology.class)
-                .child(Topology.class, key)
-                .build();
+                .create(NetworkTopology.class)
+                .child(Topology.class, key);
 
         final OperationProcessor processor = new OperationProcessor(dataBroker);
         final FlowCapableTopologyExporter listener = new FlowCapableTopologyExporter(processor, path);
         this.listenerRegistration = notificationService.registerNotificationListener(listener);
 
         final ReadWriteTransaction tx = dataBroker.newReadWriteTransaction();
-        tx.put(LogicalDatastoreType.OPERATIONAL, path, new TopologyBuilder().setKey(key).build());
+        tx.put(LogicalDatastoreType.OPERATIONAL, path, new TopologyBuilder().setKey(key).build(), true);
         try {
             tx.submit().get();
         } catch (InterruptedException | ExecutionException e) {