Migrate openflow-protocol-impl tests to Uint types
[openflowplugin.git] / openflowjava / openflow-protocol-impl / src / test / java / org / opendaylight / openflowjava / protocol / impl / serialization / factories / OF10FlowModInputMessageFactoryTest.java
index d65ec2e8e4dd001a0f340205908e6628485a75c1..ae2576be82435845f8328b1e3988e5f5cb784062 100644 (file)
@@ -38,6 +38,10 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev13
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.v10.grouping.MatchV10Builder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowModInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowModInputBuilder;
+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 OF10FlowModInputMessageFactory.
@@ -69,29 +73,29 @@ public class OF10FlowModInputMessageFactoryTest {
         BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);
         MatchV10Builder matchBuilder = new MatchV10Builder();
         matchBuilder.setWildcards(new FlowWildcardsV10(true, true, true, true, true, true, true, true, true, true));
-        matchBuilder.setNwSrcMask((short) 0);
-        matchBuilder.setNwDstMask((short) 0);
-        matchBuilder.setInPort(58);
+        matchBuilder.setNwSrcMask(Uint8.ZERO);
+        matchBuilder.setNwDstMask(Uint8.ZERO);
+        matchBuilder.setInPort(Uint16.valueOf(58));
         matchBuilder.setDlSrc(new MacAddress("01:01:01:01:01:01"));
         matchBuilder.setDlDst(new MacAddress("ff:ff:ff:ff:ff:ff"));
-        matchBuilder.setDlVlan(18);
-        matchBuilder.setDlVlanPcp((short) 5);
-        matchBuilder.setDlType(42);
-        matchBuilder.setNwTos((short) 4);
-        matchBuilder.setNwProto((short) 7);
+        matchBuilder.setDlVlan(Uint16.valueOf(18));
+        matchBuilder.setDlVlanPcp(Uint8.valueOf(5));
+        matchBuilder.setDlType(Uint16.valueOf(42));
+        matchBuilder.setNwTos(Uint8.valueOf(4));
+        matchBuilder.setNwProto(Uint8.valueOf(7));
         matchBuilder.setNwSrc(new Ipv4Address("8.8.8.8"));
         matchBuilder.setNwDst(new Ipv4Address("16.16.16.16"));
-        matchBuilder.setTpSrc(6653);
-        matchBuilder.setTpDst(6633);
+        matchBuilder.setTpSrc(Uint16.valueOf(6653));
+        matchBuilder.setTpDst(Uint16.valueOf(6633));
         builder.setMatchV10(matchBuilder.build());
-        byte[] cookie = new byte[]{(byte) 0xFF, 0x01, 0x04, 0x01, 0x06, 0x00, 0x07, 0x01};
-        builder.setCookie(new BigInteger(1, cookie));
+        final byte[] cookie = new byte[]{(byte) 0xFF, 0x01, 0x04, 0x01, 0x06, 0x00, 0x07, 0x01};
+        builder.setCookie(Uint64.valueOf(new BigInteger(1, cookie)));
         builder.setCommand(FlowModCommand.forValue(0));
-        builder.setIdleTimeout(12);
-        builder.setHardTimeout(16);
-        builder.setPriority(1);
-        builder.setBufferId(2L);
-        builder.setOutPort(new PortNumber(4422L));
+        builder.setIdleTimeout(Uint16.valueOf(12));
+        builder.setHardTimeout(Uint16.valueOf(16));
+        builder.setPriority(Uint16.ONE);
+        builder.setBufferId(Uint32.TWO);
+        builder.setOutPort(new PortNumber(Uint32.valueOf(4422)));
         builder.setFlagsV10(new FlowModFlagsV10(true, false, true));
         final List<Action> actions = new ArrayList<>();
         ActionBuilder actionBuilder = new ActionBuilder();
@@ -104,7 +108,7 @@ public class OF10FlowModInputMessageFactoryTest {
         actionBuilder = new ActionBuilder();
         SetTpSrcCaseBuilder tpSrcCaseBuilder = new SetTpSrcCaseBuilder();
         SetTpSrcActionBuilder tpSrcBuilder = new SetTpSrcActionBuilder();
-        tpSrcBuilder.setPort(new PortNumber(42L));
+        tpSrcBuilder.setPort(new PortNumber(Uint32.valueOf(42)));
         tpSrcCaseBuilder.setSetTpSrcAction(tpSrcBuilder.build());
         actionBuilder.setActionChoice(tpSrcCaseBuilder.build());
         actions.add(actionBuilder.build());