Added missing keys. This allows to reuse DTOs for operational/configuration data. 35/5835/1
authorTony Tkacik <ttkacik@cisco.com>
Tue, 1 Apr 2014 14:56:01 +0000 (16:56 +0200)
committerTony Tkacik <ttkacik@cisco.com>
Tue, 1 Apr 2014 14:56:01 +0000 (16:56 +0200)
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/TableFeaturesReplyConvertor.java
samples/learning-switch/src/main/java/org/opendaylight/openflowplugin/learningswitch/FlowUtils.java

index fcbce55b59ae017452cc8d7d307049949624c11c..7422003e12a66d6574cb9d7971cd05d8b3197083 100644 (file)
@@ -115,7 +115,7 @@ public class TableFeaturesReplyConvertor {
     private static final Logger logger = LoggerFactory.getLogger(TableFeaturesReplyConvertor.class);
 
     public static List<TableFeatures> toTableFeaturesReply(
-            MultipartReplyTableFeatures ofTableFeaturesList) {
+            final MultipartReplyTableFeatures ofTableFeaturesList) {
         if (ofTableFeaturesList == null || ofTableFeaturesList.getTableFeatures() == null) {
             return Collections.<TableFeatures> emptyList();
         }
@@ -142,7 +142,7 @@ public class TableFeaturesReplyConvertor {
         return salTableFeaturesList;
     }
 
-    private static TableProperties toTableProperties(List<TableFeatureProperties> ofTablePropertiesList) {
+    private static TableProperties toTableProperties(final List<TableFeatureProperties> ofTablePropertiesList) {
         if (ofTablePropertiesList == null) {
             return new TablePropertiesBuilder()
                     .setTableFeatureProperties(
@@ -225,25 +225,25 @@ public class TableFeaturesReplyConvertor {
                 case OFPTFPTWRITESETFIELD:
                     WriteSetfieldBuilder writeSetfieldBuilder = new WriteSetfieldBuilder();
                     writeSetfieldBuilder.setSetFieldMatch(setSetFieldTableFeatureProperty(property, false));
-                    propBuilder.setTableFeaturePropType(new 
+                    propBuilder.setTableFeaturePropType(new
                             org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteSetfieldBuilder().setWriteSetfield(writeSetfieldBuilder.build()).build());
                     break;
                 case OFPTFPTWRITESETFIELDMISS:
                     WriteSetfieldMissBuilder writeSetfieldMissBuilder = new WriteSetfieldMissBuilder();
                     writeSetfieldMissBuilder.setSetFieldMatch(setSetFieldTableFeatureProperty(property, false));
-                    propBuilder.setTableFeaturePropType(new 
+                    propBuilder.setTableFeaturePropType(new
                             org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteSetfieldMissBuilder().setWriteSetfieldMiss(writeSetfieldMissBuilder.build()).build());
                     break;
                 case OFPTFPTAPPLYSETFIELD:
                     ApplySetfieldBuilder applySetfieldBuilder = new ApplySetfieldBuilder();
                     applySetfieldBuilder.setSetFieldMatch(setSetFieldTableFeatureProperty(property, false));
-                    propBuilder.setTableFeaturePropType(new 
+                    propBuilder.setTableFeaturePropType(new
                             org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplySetfieldBuilder().setApplySetfield(applySetfieldBuilder.build()).build());
                     break;
                 case OFPTFPTAPPLYSETFIELDMISS:
                     ApplySetfieldMissBuilder applySetfieldMissBuilder = new ApplySetfieldMissBuilder();
                     applySetfieldMissBuilder.setSetFieldMatch(setSetFieldTableFeatureProperty(property, false));
-                    propBuilder.setTableFeaturePropType(new 
+                    propBuilder.setTableFeaturePropType(new
                             org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplySetfieldMissBuilder().setApplySetfieldMiss(applySetfieldMissBuilder.build()).build());
                     break;
                 case OFPTFPTEXPERIMENTER:
@@ -262,7 +262,7 @@ public class TableFeaturesReplyConvertor {
         return new TablePropertiesBuilder().setTableFeatureProperties(salTablePropertiesList).build();
     }
 
-    private static List<Instruction> setInstructionTableFeatureProperty(TableFeatureProperties properties) {
+    private static List<Instruction> setInstructionTableFeatureProperty(final TableFeatureProperties properties) {
         List<Instruction> instructionList = new ArrayList<>();
         org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder builder = new org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder();
         for (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731
@@ -303,7 +303,7 @@ public class TableFeaturesReplyConvertor {
         return instructionList;
     }
 
-    private static List<Short> setNextTableFeatureProperty(TableFeatureProperties properties) {
+    private static List<Short> setNextTableFeatureProperty(final TableFeatureProperties properties) {
         List<Short> nextTableIdsList = new ArrayList<>();
         for (NextTableIds tableId : properties.getAugmentation(NextTableRelatedTableFeatureProperty.class)
                 .getNextTableIds()) {
@@ -313,12 +313,15 @@ public class TableFeaturesReplyConvertor {
     }
 
     private static List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action> setActionTableFeatureProperty(
-            TableFeatureProperties properties) {
+            final TableFeatureProperties properties) {
         List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action> actionList = new ArrayList<>();
-        org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder actionBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder();
+        int order=0;
         for (Action action : properties
                 .getAugmentation(ActionRelatedTableFeatureProperty.class).getAction()) {
             if (action != null) {
+                org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder actionBuilder = new org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder();
+
+                actionBuilder.setOrder(order++);
                 Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionBase> actionType = action
                         .getType();
                 if (actionType
@@ -379,8 +382,8 @@ public class TableFeaturesReplyConvertor {
         return actionList;
     }
 
-    private static List<SetFieldMatch> setSetFieldTableFeatureProperty(TableFeatureProperties properties,
-            boolean setHasMask) {
+    private static List<SetFieldMatch> setSetFieldTableFeatureProperty(final TableFeatureProperties properties,
+            final boolean setHasMask) {
         List<SetFieldMatch> setFieldMatchList = new ArrayList<>();
         SetFieldMatchBuilder setFieldMatchBuilder = new SetFieldMatchBuilder();
         Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.MatchField> salMatchField = null;
index 5ea397f50b55d125135b58dbd794def74f89b273..95f40ab8c411cf0a995fe633cddfa6cf9ec32899 100644 (file)
@@ -42,8 +42,8 @@ public class FlowUtils {
      * @param dstPort
      * @return {@link FlowBuilder} forwarding all packets to controller port
      */
-    public static FlowBuilder createDirectMacToMacFlow(Short tableId, int priority, MacAddress srcMac,
-            MacAddress dstMac, NodeConnectorRef dstPort) {
+    public static FlowBuilder createDirectMacToMacFlow(final Short tableId, final int priority, final MacAddress srcMac,
+            final MacAddress dstMac, final NodeConnectorRef dstPort) {
         FlowBuilder macToMacFlow = new FlowBuilder() //
                 .setTableId(tableId) //
                 .setFlowName("mac2mac");
@@ -64,6 +64,7 @@ public class FlowUtils {
         Uri outputPort = dstPort.getValue().firstKeyOf(NodeConnector.class, NodeConnectorKey.class).getId();
 
         Action outputToControllerAction = new ActionBuilder() //
+                .setOrder(0)
                 .setAction(new OutputActionCaseBuilder() //
                         .setOutputAction(new OutputActionBuilder() //
                                 .setMaxLength(new Integer(0xffff)) //
@@ -78,6 +79,7 @@ public class FlowUtils {
 
         // Wrap our Apply Action in an Instruction
         Instruction applyActionsInstruction = new InstructionBuilder() //
+                .setOrder(0)
                 .setInstruction(new ApplyActionsCaseBuilder()//
                         .setApplyActions(applyActions) //
                         .build()) //
@@ -107,7 +109,7 @@ public class FlowUtils {
      * @param flowId
      * @return {@link FlowBuilder} forwarding all packets to controller port
      */
-    public static FlowBuilder createFwdAllToControllerFlow(Short tableId, int priority, FlowId flowId) {
+    public static FlowBuilder createFwdAllToControllerFlow(final Short tableId, final int priority, final FlowId flowId) {
         FlowBuilder allToCtrlFlow = new FlowBuilder().setTableId(tableId).setFlowName("allPacketsToCtrl").setId(flowId)
                 .setKey(new FlowKey(flowId));