enabling drop-test on cpqd 30/3730/2
authorEd Warnicke <eaw@cisco.com>
Sat, 14 Dec 2013 21:37:04 +0000 (22:37 +0100)
committerEd Warnicke <eaw@cisco.com>
Sat, 14 Dec 2013 23:17:52 +0000 (15:17 -0800)
Change-Id: I4a049007df2b8bb9a27280bec30467e47381cf2f
Signed-off-by: Michal Rehak <mirehak@cisco.com>
Signed-off-by: Ed Warnicke <eaw@cisco.com>
drop-test/src/main/java/org/opendaylight/openflowplugin/droptest/DropTestCommiter.xtend
openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/sal/ModelDrivenSwitchImpl.java
test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTestCommandProvider.java

index 029cd0e3e140dc513f175388695bf1cc05db1fc9..5c36218ebb79fe34f6187345f5fe6d1ebca287e3 100644 (file)
@@ -98,10 +98,6 @@ class DropTestCommiter implements PacketProcessingListener {
         fb.setHardTimeout(300);
         fb.setIdleTimeout(240);
         fb.setFlags(new FlowModFlags(false, false, false, false, false));
-//        fb.setTableId((short) 2);
-//        fb.setOutGroup(new Long(2));
-//        fb.setOutPort(value);
-//        fb.setKey(key);
         
         // Construct the flow instance id
         val flowInstanceId = InstanceIdentifier.builder(Nodes) // File under nodes
index f659fd54c31683bc9e91416d5658b963832d23e9..d580fba61d82f879604cec52e7cd3ddcec203140 100644 (file)
@@ -1126,16 +1126,8 @@ public class ModelDrivenSwitchImpl extends AbstractModelDrivenSwitch {
 
         // convert and inject match
         MatchReactor.getInstance().convert(arg0.getMatch(), version, mprFlowRequestBuilder);
-//        if(version == OFConstants.OFP_VERSION_1_0){
-//            mprFlowRequestBuilder.setMatchV10(MatchConvertor.toMatchV10(arg0.getMatch()));
-//        }
         //TODO: repeating code
         if(version == OFConstants.OFP_VERSION_1_3){
-//            MatchBuilder matchBuilder = new MatchBuilder();
-//            matchBuilder.setMatchEntries(MatchConvertor.toMatch(arg0.getMatch()));
-//            matchBuilder.setType(OxmMatchType.class);
-//            mprFlowRequestBuilder.setMatch(matchBuilder.build());
-        
             mprFlowRequestBuilder.setCookie(arg0.getCookie());
             mprFlowRequestBuilder.setCookieMask(arg0.getCookieMask());
             mprFlowRequestBuilder.setOutGroup(arg0.getOutGroup());
@@ -1241,16 +1233,8 @@ public class ModelDrivenSwitchImpl extends AbstractModelDrivenSwitch {
 
 
         MatchReactor.getInstance().convert(arg0.getMatch(), version, mprAggregateRequestBuilder);
-//        if(version == OFConstants.OFP_VERSION_1_0){
-//            mprAggregateRequestBuilder.setMatchV10(MatchConvertor.toMatchV10(arg0.getMatch()));
-//        }
         //TODO: repeating code
         if(version == OFConstants.OFP_VERSION_1_3){
-//            MatchBuilder matchBuilder = new MatchBuilder();
-//            matchBuilder.setMatchEntries(MatchConvertor.toMatch(arg0.getMatch()));
-//            matchBuilder.setType(OxmMatchType.class);
-//            mprAggregateRequestBuilder.setMatch(matchBuilder.build());
-        
             mprAggregateRequestBuilder.setCookie(arg0.getCookie());
             mprAggregateRequestBuilder.setCookieMask(arg0.getCookieMask());
             mprAggregateRequestBuilder.setOutGroup(arg0.getOutGroup());
index 8a6371bfd4e63a67e5d00bf0993fe648bb867223..9612e94b57d2f111bdab8329a56645e3a2064426 100644 (file)
@@ -102,6 +102,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.acti
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.sw.path.action._case.SwPathActionBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv4Builder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.config.rev130819.Flows;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
@@ -468,7 +469,6 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
             flow.setMatch(createPbbMatch().build());
             flow.setInstructions(createMeterInstructions().build());
             break;
-
         case "51":
             id += 51;
             flow.setMatch(createIPMatch().build());
@@ -486,7 +486,11 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
             flow.setMatch(createL4UDPMatch().build());
             flow.setInstructions(createDropInstructions().build());
             break;
-
+        case "f54":
+            id += 51;
+            flow.setMatch(new MatchBuilder().build());
+            flow.setInstructions(createSentToControllerInstructions().build());
+            break;
         default:
             LOG.warn("flow type not understood: {}", flowType);
         }
@@ -691,6 +695,36 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         isb.setInstruction(instructions);
         return isb;
     }
+    
+    private static InstructionsBuilder createSentToControllerInstructions() {
+        List<Action> actionList = new ArrayList<Action>();
+        ActionBuilder ab = new ActionBuilder();
+
+        OutputActionBuilder output = new OutputActionBuilder();
+        output.setMaxLength(56);
+        Uri value = new Uri("CONTROLLER");
+        output.setOutputNodeConnector(value);
+        ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build());
+        ab.setOrder(0);
+        ab.setKey(new ActionKey(0));
+        actionList.add(ab.build());
+        // Create an Apply Action
+        ApplyActionsBuilder aab = new ApplyActionsBuilder();
+        aab.setAction(actionList);
+
+        // Wrap our Apply Action in an Instruction
+        InstructionBuilder ib = new InstructionBuilder();
+        ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build());
+        ib.setOrder(0);
+        ib.setKey(new InstructionKey(0));
+
+        // Put our Instruction in a list of Instructions
+        InstructionsBuilder isb = new InstructionsBuilder();
+        List<Instruction> instructions = new ArrayList<Instruction>();
+        instructions.add(ib.build());
+        isb.setInstruction(instructions);
+        return isb;
+    }
 
     private static InstructionsBuilder createAppyActionInstruction2() {
 
@@ -1585,7 +1619,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
 
         return match;
     }
-
+    
     private static MatchBuilder createInphyportMatch() {
         MatchBuilder match = new MatchBuilder();
         match.setInPort(202L);
@@ -1955,7 +1989,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider {
         return match;
 
     }
-
+    
     /**
      * @return
      */