Merge "BUG2608: Using the right buffer id for no buffer"
authorPrasanna Huddar <prasanna.k.huddar@gmail.com>
Tue, 20 Jan 2015 05:06:09 +0000 (05:06 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Tue, 20 Jan 2015 05:06:09 +0000 (05:06 +0000)
drop-test/pom.xml
drop-test/src/main/java/org/opendaylight/openflowplugin/outputtest/OutputTestCommandProvider.java
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/convertor/FlowConvertor.java
samples/learning-switch/pom.xml
samples/learning-switch/src/main/java/org/opendaylight/openflowplugin/learningswitch/FlowUtils.java

index 5da0a710182d73e286b070fded9652fd145ab94f..a0d210518623cdd8f191e8d72151554e356616c1 100644 (file)
             <groupId>org.opendaylight.controller.model</groupId>
             <artifactId>model-inventory</artifactId>
         </dependency>
-         <dependency>
+        <dependency>
                <groupId>equinoxSDK381</groupId>
                <artifactId>org.eclipse.osgi</artifactId>
-             </dependency>
-             <dependency>
+           </dependency>
+           <dependency>
             <groupId>commons-lang</groupId>
             <artifactId>commons-lang</artifactId>
-          </dependency>
-             
+        </dependency>
+        <dependency>
+            <groupId>org.opendaylight.openflowplugin</groupId>
+            <artifactId>openflowplugin-api</artifactId>
+        </dependency>
     </dependencies>
 
     <build>
index 84d0f17977a020209924004075fbb73069d4e92e..cd7d638c16af83095a07d36e1127c441b769ba05 100644 (file)
@@ -14,6 +14,7 @@ import org.apache.commons.lang.ArrayUtils;
 import org.eclipse.osgi.framework.console.CommandInterpreter;
 import org.eclipse.osgi.framework.console.CommandProvider;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.ProviderContext;
+import org.opendaylight.openflowplugin.api.OFConstants;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Uri;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.OutputActionCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.output.action._case.OutputActionBuilder;
@@ -138,7 +139,7 @@ public class OutputTestCommandProvider implements CommandProvider {
             packet_out.setNode(ref);
             packet_out.setIngress(nIngressConRef);
             packet_out.setEgress(nEngressConRef);
-            packet_out.setBufferId(Long.valueOf(0xffffffffL));
+            packet_out.setBufferId(OFConstants.OFP_NO_BUFFER);
 
             packetProcessingService.transmitPacket(packet_out.build());
         } else {
index 8da0d7bd040993c95140eb128b841c9623524471..348795112f16118da44c4967a2b21132c3ef7332 100644 (file)
@@ -91,7 +91,7 @@ public class FlowConvertor {
     public static final Integer DEFAULT_HARD_TIMEOUT = 10 * 60;
     /** Default priority */
     public static final Integer DEFAULT_PRIORITY = Integer.parseInt("8000", 16);
-    private static final Long DEFAULT_BUFFER_ID = Long.parseLong("ffffffff", 16);
+    private static final Long DEFAULT_BUFFER_ID = OFConstants.OFP_NO_BUFFER;
     private static final Long OFPP_ANY = Long.parseLong("ffffffff", 16);
     private static final Long DEFAULT_OUT_PORT = OFPP_ANY;
     private static final Long OFPG_ANY = Long.parseLong("ffffffff", 16);
@@ -199,7 +199,7 @@ public class FlowConvertor {
             flowMod.setOutGroup(DEFAULT_OUT_GROUP);
         }
 
-        
+
         // convert and inject flowFlags
         FlowFlagReactor.getInstance().convert(flow.getFlags(), version, flowMod,datapathid);
 
@@ -211,7 +211,7 @@ public class FlowConvertor {
             flowMod.setAction(getActions(version,datapathid, flow));
         }
         flowMod.setVersion(version);
-        
+
         return flowMod;
     }
 
@@ -298,12 +298,12 @@ public class FlowConvertor {
         }
         return instructionsList;
     }
-    
+
     /*private static List<Action> getActions(
             org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Instructions instructions,
             short version,BigInteger datapathid) {*/
     private static List<Action> getActions(short version,BigInteger datapathid, Flow flow) {
-        
+
         org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Instructions instructions = flow.getInstructions();
         List<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction> sortedInstructions =
             Ordering.from(OrderComparator.<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction>build())
@@ -454,13 +454,13 @@ public class FlowConvertor {
 
         org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder instructionBuilder =
                 new org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder();
-        
+
         for (int i=0; i < srcInstructionList.size(); i++) {
-            org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction srcInstruction = 
+            org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction srcInstruction =
                     srcInstructionList.get(i);
-            org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction curSrcInstruction = 
+            org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction curSrcInstruction =
                     srcInstruction.getInstruction();
-            
+
             if (curSrcInstruction instanceof ApplyActionsCase) {
                 ApplyActionsCase applyActionscase = (ApplyActionsCase) curSrcInstruction;
                 ApplyActions applyActions = applyActionscase.getApplyActions();
@@ -502,7 +502,7 @@ public class FlowConvertor {
                         actionBuilder.setOrder(actionItem.getOrder() + offset);
                         actionItem = actionBuilder.build();
                     }
-                    
+
                     targetActionList.add(actionItem);
                 }
 
@@ -510,17 +510,17 @@ public class FlowConvertor {
                 ApplyActionsBuilder applyActionsBuilder = new ApplyActionsBuilder();
                 applyActionsBuilder.setAction(targetActionList);
                 applyActionsCaseBuilder.setApplyActions(applyActionsBuilder.build());
-                    
+
                 instructionBuilder.setInstruction(applyActionsCaseBuilder.build());
             } else {
                 instructionBuilder.setInstruction(curSrcInstruction);
             }
-            
+
             instructionBuilder
                 .setKey(srcInstruction.getKey())
                 .setOrder(srcInstruction.getOrder());
             targetInstructionList.add(instructionBuilder.build());
-            
+
         }
 
         return targetInstructionList;
index 0d9345241737267e96e10ca279f2fecdf4ddb0a6..972cd1b45f601606ed163e000c3b8377a381ea19 100644 (file)
             <groupId>org.opendaylight.yangtools</groupId>
             <artifactId>yang-binding</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.opendaylight.openflowplugin</groupId>
+            <artifactId>openflowplugin-api</artifactId>
+        </dependency>
         <dependency>
           <groupId>org.osgi</groupId>
           <artifactId>org.osgi.core</artifactId>
index 95f40ab8c411cf0a995fe633cddfa6cf9ec32899..a469992c3dbbeecb1fda36050fda935ef7c423ae 100644 (file)
@@ -3,6 +3,7 @@ package org.opendaylight.openflowplugin.learningswitch;
 import java.util.ArrayList;
 import java.util.List;
 
+import org.opendaylight.openflowplugin.api.OFConstants;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Uri;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.OutputActionCaseBuilder;
@@ -95,7 +96,7 @@ public class FlowUtils {
                         .setInstruction(ImmutableList.of(applyActionsInstruction)) //
                         .build()) //
                 .setPriority(priority) //
-                .setBufferId(0L) //
+                .setBufferId(OFConstants.OFP_NO_BUFFER) //
                 .setHardTimeout(0) //
                 .setIdleTimeout(0) //
                 .setFlags(new FlowModFlags(false, false, false, false, false));
@@ -149,7 +150,7 @@ public class FlowUtils {
             .setMatch(matchBuilder.build()) //
             .setInstructions(isb.build()) //
             .setPriority(priority) //
-            .setBufferId(0L) //
+            .setBufferId(OFConstants.OFP_NO_BUFFER) //
             .setHardTimeout(0) //
             .setIdleTimeout(0) //
             .setFlags(new FlowModFlags(false, false, false, false, false));