Update MRI projects for Aluminium
[openflowplugin.git] / openflowplugin / src / test / java / org / opendaylight / openflowplugin / openflow / md / core / sal / convertor / flow / FlowConvertorTest.java
index 55d1d0e9b3720684148a27dd9c5d917ac3067101..e8d20f28c50035f9cbda76985add5a6ebdae34dd 100644 (file)
@@ -69,7 +69,10 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev13
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowModFlags;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowModInputBuilder;
 import org.opendaylight.yangtools.yang.binding.Augmentation;
-import org.opendaylight.yangtools.yang.binding.DataContainer;
+import org.opendaylight.yangtools.yang.common.Uint16;
+import org.opendaylight.yangtools.yang.common.Uint32;
+import org.opendaylight.yangtools.yang.common.Uint64;
+import org.opendaylight.yangtools.yang.common.Uint8;
 
 /**
  * Unit tests for flow conversion.
@@ -106,7 +109,7 @@ public class FlowConvertorTest {
         RemoveFlowInput flow = flowBuilder.build();
 
         VersionDatapathIdConvertorData data = new VersionDatapathIdConvertorData(OFConstants.OFP_VERSION_1_3);
-        data.setDatapathId(new BigInteger("42"));
+        data.setDatapathId(Uint64.valueOf(42));
 
         List<FlowModInputBuilder> flowMod = convert(flow, data);
 
@@ -126,7 +129,7 @@ public class FlowConvertorTest {
         Assert.assertEquals("Wrong match",
                 "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OxmMatchType",
                 flowMod.get(0).getMatch().getType().getName());
-        Assert.assertEquals("Wrong match entries size", 0, flowMod.get(0).getMatch().getMatchEntry().size());
+        Assert.assertEquals("Wrong match entries size", 0, flowMod.get(0).getMatch().nonnullMatchEntry().size());
     }
 
     /**
@@ -139,7 +142,7 @@ public class FlowConvertorTest {
         UpdatedFlow flow = flowBuilder.build();
 
         VersionDatapathIdConvertorData data = new VersionDatapathIdConvertorData(OFConstants.OFP_VERSION_1_0);
-        data.setDatapathId(new BigInteger("42"));
+        data.setDatapathId(Uint64.valueOf(42));
 
         List<FlowModInputBuilder> flowMod = convert(flow, data);
 
@@ -215,7 +218,7 @@ public class FlowConvertorTest {
         AddFlowInput flow = flowBuilder.build();
 
         VersionDatapathIdConvertorData data = new VersionDatapathIdConvertorData(OFConstants.OFP_VERSION_1_0);
-        data.setDatapathId(new BigInteger("42"));
+        data.setDatapathId(Uint64.valueOf(42));
         List<FlowModInputBuilder> flowMod = convert(flow, data);
 
         Assert.assertEquals("Wrong version", 1, flowMod.get(0).getVersion().intValue());
@@ -225,13 +228,13 @@ public class FlowConvertorTest {
             .grouping.Instruction instruction = flowMod.get(0).getInstruction().get(0);
         Assert.assertEquals("Wrong type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"
                 + ".instruction.rev130731.instruction.grouping.instruction.choice.GotoTableCase",
-                instruction.getInstructionChoice().getImplementedInterface().getName());
+                instruction.getInstructionChoice().implementedInterface().getName());
         GotoTableCase gotoTableCase = (GotoTableCase) instruction.getInstructionChoice();
         Assert.assertEquals("Wrong table id", 1, gotoTableCase.getGotoTable().getTableId().intValue());
         instruction = flowMod.get(0).getInstruction().get(1);
         Assert.assertEquals("Wrong type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"
                 + ".instruction.rev130731.instruction.grouping.instruction.choice.WriteMetadataCase",
-                instruction.getInstructionChoice().getImplementedInterface().getName());
+                instruction.getInstructionChoice().implementedInterface().getName());
         WriteMetadataCase writeMetadataCase = (WriteMetadataCase) instruction.getInstructionChoice();
         Assert.assertArrayEquals("Wrong metadata", new byte[]{0, 0, 0, 0, 0, 0, 0, 2},
                 writeMetadataCase.getWriteMetadata().getMetadata());
@@ -241,23 +244,23 @@ public class FlowConvertorTest {
         instruction = flowMod.get(0).getInstruction().get(2);
         Assert.assertEquals("Wrong type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"
                 + ".instruction.rev130731.instruction.grouping.instruction.choice.WriteActionsCase",
-                instruction.getInstructionChoice().getImplementedInterface().getName());
+                instruction.getInstructionChoice().implementedInterface().getName());
         WriteActionsCase writeActionsCase = (WriteActionsCase) instruction.getInstructionChoice();
-        Assert.assertEquals("Wrong actions size", 0, writeActionsCase.getWriteActions().getAction().size());
+        Assert.assertEquals("Wrong actions size", 0, writeActionsCase.getWriteActions().nonnullAction().size());
         instruction = flowMod.get(0).getInstruction().get(3);
         Assert.assertEquals("Wrong type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"
                 + ".instruction.rev130731.instruction.grouping.instruction.choice.ApplyActionsCase",
-                instruction.getInstructionChoice().getImplementedInterface().getName());
+                instruction.getInstructionChoice().implementedInterface().getName());
         ApplyActionsCase applyActionsCase =  (ApplyActionsCase) instruction.getInstructionChoice();
-        Assert.assertEquals("Wrong actions size", 0, applyActionsCase.getApplyActions().getAction().size());
+        Assert.assertEquals("Wrong actions size", 0, applyActionsCase.getApplyActions().nonnullAction().size());
         instruction = flowMod.get(0).getInstruction().get(4);
         Assert.assertEquals("Wrong type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"
                 + ".instruction.rev130731.instruction.grouping.instruction.choice.ClearActionsCase",
-                instruction.getInstructionChoice().getImplementedInterface().getName());
+                instruction.getInstructionChoice().implementedInterface().getName());
         instruction = flowMod.get(0).getInstruction().get(5);
         Assert.assertEquals("Wrong type", "org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common"
                 + ".instruction.rev130731.instruction.grouping.instruction.choice.MeterCase",
-                instruction.getInstructionChoice().getImplementedInterface().getName());
+                instruction.getInstructionChoice().implementedInterface().getName());
         MeterCase meterCase = (MeterCase) instruction.getInstructionChoice();
         Assert.assertEquals("Wrong meter id", 5, meterCase.getMeter().getMeterId().intValue());
     }
@@ -275,7 +278,7 @@ public class FlowConvertorTest {
         mockFlow.setInstructions(toApplyInstruction(Collections.singletonList(action1)));
 
         VersionDatapathIdConvertorData data = new VersionDatapathIdConvertorData(OFConstants.OFP_VERSION_1_3);
-        data.setDatapathId(BigInteger.ONE);
+        data.setDatapathId(Uint64.ONE);
 
         List<FlowModInputBuilder> flowModInputBuilders = convert(mockFlow, data);
 
@@ -283,7 +286,7 @@ public class FlowConvertorTest {
 
     }
 
-    private List<FlowModInputBuilder> convert(Flow flow, VersionDatapathIdConvertorData data) {
+    private List<FlowModInputBuilder> convert(final Flow flow, final VersionDatapathIdConvertorData data) {
         Optional<List<FlowModInputBuilder>> flowModOptional = convertorManager.convert(flow, data);
         Assert.assertTrue("Flow convertor not found", flowModOptional.isPresent());
         return flowModOptional.get();
@@ -303,7 +306,8 @@ public class FlowConvertorTest {
     }
 
     private static Instructions toApplyInstruction(
-            List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action> actions) {
+            final List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list
+                .Action> actions) {
         return new InstructionsBuilder().setInstruction(Collections.singletonList(new InstructionBuilder().setOrder(0)
                 .setInstruction(new ApplyActionsCaseBuilder()
                         .setApplyActions(new ApplyActionsBuilder().setAction(actions).build()).build())
@@ -359,17 +363,17 @@ public class FlowConvertorTest {
         }
 
         @Override
-        public Long getBufferId() {
+        public Uint32 getBufferId() {
             return null;
         }
 
         @Override
-        public BigInteger getOutPort() {
+        public Uint64 getOutPort() {
             return null;
         }
 
         @Override
-        public Long getOutGroup() {
+        public Uint32 getOutGroup() {
             return null;
         }
 
@@ -399,17 +403,17 @@ public class FlowConvertorTest {
         }
 
         @Override
-        public Integer getPriority() {
+        public Uint16 getPriority() {
             return null;
         }
 
         @Override
-        public Integer getIdleTimeout() {
+        public Uint16 getIdleTimeout() {
             return null;
         }
 
         @Override
-        public Integer getHardTimeout() {
+        public Uint16 getHardTimeout() {
             return null;
         }
 
@@ -419,7 +423,7 @@ public class FlowConvertorTest {
         }
 
         @Override
-        public Short getTableId() {
+        public Uint8 getTableId() {
             return null;
         }
 
@@ -434,8 +438,8 @@ public class FlowConvertorTest {
         }
 
         @Override
-        public Class<? extends DataContainer> getImplementedInterface() {
-            return Flow.class;
+        public Class<AddFlowInput> implementedInterface() {
+            return AddFlowInput.class;
         }
     }
 }