Fix for missing flow-mods for L3 context changes. 72/18172/2
authorThomas Bachman <tbachman@yahoo.com>
Sun, 12 Apr 2015 21:39:00 +0000 (14:39 -0700)
committerThomas Bachman <tbachman@yahoo.com>
Sun, 12 Apr 2015 21:57:40 +0000 (14:57 -0700)
This is a workaround for making sure that all the
flow-mods are on the vSwitch.

Change-Id: I54b9303568ba766431f015fba8562919f4f772f5
Signed-off-by: Thomas Bachman <tbachman@yahoo.com>
renderers/ofoverlay/src/main/java/org/opendaylight/groupbasedpolicy/renderer/ofoverlay/PolicyManager.java

index 65b45a9727a07586ada6dc8811aa3a331a0b44f9..96d3e34d9f8376ee898fbf53e510d10b657c2948 100644 (file)
@@ -248,6 +248,27 @@ public class PolicyManager
 
         public void commitToDataStore() {
             if (dataBroker != null) {
+                // TODO: tbachman: Remove for Lithium -- this is a workaround
+                //       where some flow-mods aren't getting installed
+                //       on vSwitches when changing L3 contexts
+                WriteTransaction d = dataBroker.newWriteOnlyTransaction();
+
+                for( Entry<InstanceIdentifier<Table>, TableBuilder> entry : flowMap.entrySet()) {
+                    d.delete(LogicalDatastoreType.CONFIGURATION, entry.getKey());
+                }
+
+                CheckedFuture<Void, TransactionCommitFailedException> fu = d.submit();
+                Futures.addCallback(fu, new FutureCallback<Void>() {
+                    @Override
+                    public void onFailure(Throwable th) {
+                        LOG.error("Could not write flow table.", th);
+                    }
+
+                    @Override
+                    public void onSuccess(Void result) {
+                        LOG.debug("Flow table updated.");
+                    }
+                });
                 WriteTransaction t = dataBroker.newWriteOnlyTransaction();
 
                 for( Entry<InstanceIdentifier<Table>, TableBuilder> entry : flowMap.entrySet()) {