Bug 1864 - Use unique flow-id for AbstractService pipeline flows 67/11167/1
authorMadhu Venugopal <mavenugo@gmail.com>
Sun, 14 Sep 2014 19:02:48 +0000 (12:02 -0700)
committerMadhu Venugopal <mavenugo@gmail.com>
Sun, 14 Sep 2014 19:02:48 +0000 (12:02 -0700)
Change-Id: I537436bdaad7bbea44ebe49b999d2dfd45f71ce5
Signed-off-by: Madhu Venugopal <mavenugo@gmail.com>
openstack/net-virt-providers/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/providers/openflow13/AbstractServiceInstance.java

index a9fc778431b09fa36425e12010dca8942009c3ac..488039ca16e28fbde868705b7f9f9da80bef7110 100644 (file)
@@ -120,21 +120,23 @@ public abstract class AbstractServiceInstance {
         }
 
         ReadWriteTransaction modification = dataBroker.newReadWriteTransaction();
+        InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node> nodePath = InstanceIdentifier.builder(Nodes.class)
+                .child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node.class, nodeBuilder.getKey()).toInstance();
+
+        modification.put(LogicalDatastoreType.CONFIGURATION, nodePath, nodeBuilder.build(), true);
         InstanceIdentifier<Flow> path1 = InstanceIdentifier.builder(Nodes.class).child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory
                 .rev130819.nodes.Node.class, nodeBuilder.getKey()).augmentation(FlowCapableNode.class).child(Table.class,
                 new TableKey(flowBuilder.getTableId())).child(Flow.class, flowBuilder.getKey()).build();
 
-        //modification.put(LogicalDatastoreType.OPERATIONAL, path1, flowBuilder.build());
         modification.put(LogicalDatastoreType.CONFIGURATION, path1, flowBuilder.build(), true /*createMissingParents*/);
 
-
         CheckedFuture<Void, TransactionCommitFailedException> commitFuture = modification.submit();
         try {
             commitFuture.get();  // TODO: Make it async (See bug 1362)
             logger.debug("Transaction success for write of Flow "+flowBuilder.getFlowName());
-        } catch (InterruptedException|ExecutionException e) {
+        } catch (Exception e) {
             logger.error(e.getMessage(), e);
-
+            modification.cancel();
         }
     }
 
@@ -230,7 +232,7 @@ public abstract class AbstractServiceInstance {
         // Add InstructionsBuilder to FlowBuilder
         flowBuilder.setInstructions(isb.build());
 
-        String flowId = "DEFAULT_PIPELINE_FLOW";
+        String flowId = "DEFAULT_PIPELINE_FLOW_"+service.getTable();
         flowBuilder.setId(new FlowId(flowId));
         FlowKey key = new FlowKey(new FlowId(flowId));
         flowBuilder.setMatch(matchBuilder.build());