Minor model refactor
[openflowjava.git] / openflow-protocol-impl / src / test / java / org / opendaylight / openflowjava / protocol / impl / serialization / factories / OF10FlowModInputMessageFactoryTest.java
index fbb007575f283dbc78821880a9cde034b279fe86..12b2a945ebbac490b82113815a531d1b21d7fb8a 100644 (file)
@@ -28,9 +28,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortActionBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwDst;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetTpSrc;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.ActionsList;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.ActionsListBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.actions.list.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowModCommand;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowModFlagsV10;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowWildcardsV10;
@@ -54,7 +53,7 @@ public class OF10FlowModInputMessageFactoryTest {
         FlowModInputBuilder builder = new FlowModInputBuilder();
         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, true));
+        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);
@@ -70,8 +69,8 @@ public class OF10FlowModInputMessageFactoryTest {
         matchBuilder.setTpSrc(6653);
         matchBuilder.setTpDst(6633);
         builder.setMatchV10(matchBuilder.build());
-        byte[] cookie = new byte[]{0x00, 0x01, 0x04, 0x01, 0x06, 0x00, 0x07, 0x01};
-        builder.setCookie(new BigInteger(cookie));
+        byte[] cookie = new byte[]{(byte) 0xFF, 0x01, 0x04, 0x01, 0x06, 0x00, 0x07, 0x01};
+        builder.setCookie(new BigInteger(1, cookie));
         builder.setCommand(FlowModCommand.forValue(0));
         builder.setIdleTimeout(12);
         builder.setHardTimeout(16);
@@ -79,23 +78,20 @@ public class OF10FlowModInputMessageFactoryTest {
         builder.setBufferId(2L);
         builder.setOutPort(new PortNumber(4422L));
         builder.setFlagsV10(new FlowModFlagsV10(true, false, true));
-        List<ActionsList> actions = new ArrayList<>();
-        ActionsListBuilder actionsListBuilder = new ActionsListBuilder();
+        List<Action> actions = new ArrayList<>();
         ActionBuilder actionBuilder = new ActionBuilder();
         actionBuilder.setType(SetNwDst.class);
         IpAddressActionBuilder ipBuilder = new IpAddressActionBuilder();
         ipBuilder.setIpAddress(new Ipv4Address("2.2.2.2"));
         actionBuilder.addAugmentation(IpAddressAction.class, ipBuilder.build());
-        actionsListBuilder.setAction(actionBuilder.build());
-        actions.add(actionsListBuilder.build());
+        actions.add(actionBuilder.build());
         actionBuilder = new ActionBuilder();
         actionBuilder.setType(SetTpSrc.class);
         PortActionBuilder portBuilder = new PortActionBuilder();
         portBuilder.setPort(new PortNumber(42L));
         actionBuilder.addAugmentation(PortAction.class, portBuilder.build());
-        actionsListBuilder.setAction(actionBuilder.build());
-        actions.add(actionsListBuilder.build());
-        builder.setActionsList(actions);
+        actions.add(actionBuilder.build());
+        builder.setAction(actions);
         FlowModInput message = builder.build();
         
         ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
@@ -103,7 +99,7 @@ public class OF10FlowModInputMessageFactoryTest {
         factory.messageToBuffer(EncodeConstants.OF10_VERSION_ID, out, message);
         
         BufferHelper.checkHeaderV10(out, factory.getMessageType(), factory.computeLength(message));
-        Assert.assertEquals("Wrong wildcards", 4194303, out.readUnsignedInt());
+        Assert.assertEquals("Wrong wildcards", 3678463, out.readUnsignedInt());
         Assert.assertEquals("Wrong inPort", 58, out.readUnsignedShort());
         byte[] dlSrc = new byte[6];
         out.readBytes(dlSrc);