Bug 2987 - Set-Vlan action on OF1.3 Sends 2 remove flows (similar to addFlow)
[openflowplugin.git] / openflowplugin / src / main / java / org / opendaylight / openflowplugin / openflow / md / core / sal / OFRpcTaskFactory.java
index c7f9662ecfb2ef3a5a9229e551197b85a4ea4b3f..1ef7abe356bf0a27e49de9aff850f2b0b46d6451 100644 (file)
@@ -700,19 +700,15 @@ public abstract class OFRpcTaskFactory {
                 ListenableFuture<RpcResult<UpdateFlowOutput>> result = SettableFuture.create();
 
                 // Convert the AddFlowInput to FlowModInput
-                FlowModInputBuilder ofFlowModInput = FlowConvertor.toFlowModInput(getInput(),
+                List<FlowModInputBuilder> ofFlowModInputs = FlowConvertor.toFlowModInputs(getInput(),
                         getVersion(), getSession().getFeatures().getDatapathId());
-                final Long xId = getSession().getNextXid();
-                ofFlowModInput.setXid(xId);
-
-                Future<RpcResult<UpdateFlowOutput>> resultFromOFLib =
-                        getMessageService().flowMod(ofFlowModInput.build(), getCookie());
-                result = JdkFutureAdapters.listenInPoolThread(resultFromOFLib);
 
+                result = chainFlowMods(ofFlowModInputs, 0, getTaskContext(), getCookie());
                 result = OFRpcTaskUtil.chainFutureBarrier(this, result);
-                OFRpcTaskUtil.hookFutureNotification(this, result,
-                        getRpcNotificationProviderService(), createFlowRemovedNotification(getInput()));
 
+                OFRpcTaskUtil.hookFutureNotification(this, result,
+                        getRpcNotificationProviderService(),
+                        createFlowRemovedNotification(getInput()));
                 return result;
             }
         }