Fixed Bug : 287 82/4282/1
authorAnilkumar Vishnoi <avishnoi@in.ibm.com>
Wed, 15 Jan 2014 22:43:19 +0000 (04:13 +0530)
committerAnilkumar Vishnoi <avishnoi@in.ibm.com>
Wed, 15 Jan 2014 22:44:20 +0000 (04:14 +0530)
https://bugs.opendaylight.org/show_bug.cgi?id=287

Change-Id: Ie7bf61069843901155d81221f993d4c1e29659c6
Signed-off-by: Anilkumar Vishnoi <avishnoi@in.ibm.com>
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/FlowStatsResponseConvertor.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/OFToMDSalFlowConvertor.java

index 0c16970002c0357cdea8537c6153684fa9447364..3aa10487fddceb12be0c67da284cc5ab5aaff227 100644 (file)
@@ -68,6 +68,9 @@ public class FlowStatsResponseConvertor {
         salFlowStatsBuilder.setTableId(flowStats.getTableId());
         if(flowStats.getMatchV10() != null){
             salFlowStatsBuilder.setMatch(MatchConvertorImpl.fromOFMatchV10ToSALMatch(flowStats.getMatchV10(),datapathid));
+            if(flowStats.getActionsList().size()!=0){
+                salFlowStatsBuilder.setInstructions(OFToMDSalFlowConvertor.wrapOF10ActionsToInstruction(flowStats.getActionsList()));
+            }
         }
         if(flowStats.getMatch() != null){
             salFlowStatsBuilder.setMatch(MatchConvertorImpl.fromOFMatchToSALMatch(flowStats.getMatch(),datapathid));
@@ -83,6 +86,5 @@ public class FlowStatsResponseConvertor {
         }
         
         return salFlowStatsBuilder.build();
-        
     }
 }
index 2b2d5e43eefaa0231f08112766704b4ab17ff107..23c02f49739c6fc2a45c42a76800a4f575c5275c 100644 (file)
@@ -35,6 +35,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataInstruction;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MeterIdInstruction;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TableIdInstruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.ActionsList;
 
 public class OFToMDSalFlowConvertor {
     
@@ -71,7 +72,7 @@ public class OFToMDSalFlowConvertor {
                 applyActionsCaseBuilder.setApplyActions(applyActionsBuilder.build());
                 
                 InstructionBuilder instBuilder = new InstructionBuilder();
-                instBuilder.setInstruction(new ApplyActionsCaseBuilder().build());
+                instBuilder.setInstruction(applyActionsCaseBuilder.build());
                 salInstructionList.add(instBuilder.build());
             }else if(switchInst instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ClearActions){
                 InstructionBuilder instBuilder = new InstructionBuilder();
@@ -160,5 +161,32 @@ public class OFToMDSalFlowConvertor {
         return actions;
     }
 
+    /**
+     * Method wraps openflow 1.0 actions list to Apply Action Instructions
+     */
+    
+    public static Instructions wrapOF10ActionsToInstruction(List<ActionsList> actionsList) {
+        InstructionsBuilder instructionsBuilder = new InstructionsBuilder();
+        
+        List<Instruction> salInstructionList = new ArrayList<Instruction>();
+        
+        ApplyActionsCaseBuilder applyActionsCaseBuilder = new ApplyActionsCaseBuilder();
+        ApplyActionsBuilder applyActionsBuilder = new ApplyActionsBuilder();
 
+        applyActionsBuilder.setAction(
+                    wrapActionList(
+                                ActionConvertor.toMDSalActions(actionsList
+                                        )
+                            ));
+                
+        applyActionsCaseBuilder.setApplyActions(applyActionsBuilder.build());
+                
+        InstructionBuilder instBuilder = new InstructionBuilder();
+        instBuilder.setInstruction(applyActionsCaseBuilder.build());
+        salInstructionList.add(instBuilder.build());
+        
+        instructionsBuilder.setInstruction(salInstructionList);
+        return instructionsBuilder.build();
+    }
+    
 }