Bug 998 - fix for update flow 35/6935/1
authorVaclav Demcak <vdemcak@cisco.com>
Tue, 13 May 2014 16:07:52 +0000 (18:07 +0200)
committerVaclav Demcak <vdemcak@cisco.com>
Tue, 13 May 2014 16:08:06 +0000 (18:08 +0200)
Change-Id: Iad157785a9f42e89d6b99d4211fdce591efcea41
Signed-off-by: Vaclav Demcak <vdemcak@cisco.com>
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/OFRpcTaskFactory.java

index 5bb111913873c390554b4ad83d999639093b7f1c..2d2067984d8d82b69d12d0236632f919a3b8a99a 100644 (file)
@@ -1,6 +1,6 @@
 /**
  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
- * 
+ *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
@@ -22,21 +22,21 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731
 import org.opendaylight.yangtools.yang.common.RpcResult;
 
 /**
- * 
+ *
  */
 public abstract class OFRpcTaskFactory {
 
     /**
-     * @param maxTimeout 
-     * @param maxTimeoutUnit 
-     * @param helper 
+     * @param maxTimeout
+     * @param maxTimeoutUnit
+     * @param helper
      * @return UpdateFlow task
      */
     public static OFRpcTask<AddFlowInput, RpcResult<UpdateFlowOutput>> createAddFlowTask(
             final long maxTimeout, final TimeUnit maxTimeoutUnit, final OFRpcTaskHelper helper) {
-        OFRpcTask<AddFlowInput, RpcResult<UpdateFlowOutput>> task = 
+        OFRpcTask<AddFlowInput, RpcResult<UpdateFlowOutput>> task =
                 new OFRpcTask<AddFlowInput, RpcResult<UpdateFlowOutput>>() {
-            
+
             @Override
             public void run() {
                 helper.rawBarrierSend(maxTimeout, maxTimeoutUnit, getInput().isBarrier(), getCookie(), getResult());
@@ -45,7 +45,7 @@ public abstract class OFRpcTaskFactory {
                 }
 
                 // Convert the AddFlowInput to FlowModInput
-                FlowModInputBuilder ofFlowModInput = FlowConvertor.toFlowModInput(getInput(), 
+                FlowModInputBuilder ofFlowModInput = FlowConvertor.toFlowModInput(getInput(),
                         getVersion(), getSession().getFeatures().getDatapathId());
                 Long xId = getSession().getNextXid();
                 ofFlowModInput.setXid(xId);
@@ -59,25 +59,25 @@ public abstract class OFRpcTaskFactory {
                 }
 
                 getSession().getbulkTransactionCache().put(new TransactionKey(xId), getInput());
-                Future<RpcResult<UpdateFlowOutput>> resultFromOFLib = 
+                Future<RpcResult<UpdateFlowOutput>> resultFromOFLib =
                         getMessageService().flowMod(ofFlowModInput.build(), getCookie());
                 OFRpcTaskHelper.chainFutures(resultFromOFLib, getResult());
             }
         };
         return task;
     }
-    
+
     /**
-     * @param maxTimeout 
-     * @param maxTimeoutUnit 
-     * @param helper 
+     * @param maxTimeout
+     * @param maxTimeoutUnit
+     * @param helper
      * @return UpdateFlow task
      */
     public static OFRpcTask<UpdateFlowInput, RpcResult<UpdateFlowOutput>> createUpdateFlowTask(
             final long maxTimeout, final TimeUnit maxTimeoutUnit, final OFRpcTaskHelper helper) {
-        OFRpcTask<UpdateFlowInput, RpcResult<UpdateFlowOutput>> task = 
+        OFRpcTask<UpdateFlowInput, RpcResult<UpdateFlowOutput>> task =
                 new OFRpcTask<UpdateFlowInput, RpcResult<UpdateFlowOutput>>() {
-            
+
             @Override
             public void run() {
                 helper.rawBarrierSend(maxTimeout, maxTimeoutUnit, getInput().getUpdatedFlow().isBarrier(), getCookie(), getResult());
@@ -86,26 +86,25 @@ public abstract class OFRpcTaskFactory {
                 }
 
                 // Convert the AddFlowInput to FlowModInput
-                FlowModInputBuilder ofFlowModInput = FlowConvertor.toFlowModInput(getInput().getUpdatedFlow(), 
+                FlowModInputBuilder ofFlowModInput = FlowConvertor.toFlowModInput(getInput().getUpdatedFlow(),
                         getVersion(), getSession().getFeatures().getDatapathId());
                 Long xId = getSession().getNextXid();
                 ofFlowModInput.setXid(xId);
 
                 if (null != getRpcNotificationProviderService()) {
-                    FlowAddedBuilder newFlow = new FlowAddedBuilder(
-                            (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.Flow) getInput());
+                    FlowAddedBuilder newFlow = new FlowAddedBuilder(getInput().getUpdatedFlow());
                     newFlow.setTransactionId(new TransactionId(BigInteger.valueOf(xId.intValue())));
                     newFlow.setFlowRef(getInput().getFlowRef());
                     getRpcNotificationProviderService().publish(newFlow.build());
                 }
 
                 getSession().getbulkTransactionCache().put(new TransactionKey(xId), getInput());
-                Future<RpcResult<UpdateFlowOutput>> resultFromOFLib = 
+                Future<RpcResult<UpdateFlowOutput>> resultFromOFLib =
                         getMessageService().flowMod(ofFlowModInput.build(), getCookie());
                 OFRpcTaskHelper.chainFutures(resultFromOFLib, getResult());
             }
         };
         return task;
     }
-    
+
 }