Added more tests 92/3792/1
authorMichal Polkorab <michal.polkorab@pantheon.sk>
Tue, 17 Dec 2013 13:50:17 +0000 (14:50 +0100)
committerMichal Polkorab <michal.polkorab@pantheon.sk>
Tue, 17 Dec 2013 15:19:15 +0000 (16:19 +0100)
Signed-off-by: Michal Polkorab <michal.polkorab@pantheon.sk>
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/OF10ActionsDeserializer.java
openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/OF10ActionsSerializer.java
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/util/OF10ActionsDeserializerTest.java [new file with mode: 0644]
openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/util/OF10ActionsSerializerTest.java [new file with mode: 0644]

index 96d74567d6e12fc6aeb1dd8678f97e42519c2032..6cf233de50ea3e59d89b2c096fab7b6ce2ada80a 100644 (file)
@@ -17,6 +17,7 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.
 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.openflow.augments.rev131002.DlAddressAction;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DlAddressActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterAction;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterActionBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IpAddressAction;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IpAddressActionBuilder;
@@ -28,10 +29,12 @@ 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.augments.rev131002.QueueIdAction;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpAction;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpActionBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidAction;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidActionBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Enqueue;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Experimenter;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetDlDst;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetDlSrc;
@@ -157,7 +160,7 @@ public class OF10ActionsDeserializer {
         VlanPcpActionBuilder vlanBuilder = new VlanPcpActionBuilder();
         vlanBuilder.setVlanPcp(input.readUnsignedByte());
         input.skipBytes(PADDING_IN_SET_VLAN_PCP_ACTION);
-        actionBuilder.addAugmentation(VlanVidAction.class, vlanBuilder.build());
+        actionBuilder.addAugmentation(VlanPcpAction.class, vlanBuilder.build());
         builder.setAction(actionBuilder.build());
         return builder.build();
     }
@@ -271,10 +274,10 @@ public class OF10ActionsDeserializer {
 
     private static ActionsList createExperimenterAction(ByteBuf input, ActionsListBuilder builder) {
         ActionBuilder actionBuilder = new ActionBuilder();
-        actionBuilder.setType(Enqueue.class);
+        actionBuilder.setType(Experimenter.class);
         ExperimenterActionBuilder expBuilder = new ExperimenterActionBuilder();
         expBuilder.setExperimenter(input.readUnsignedInt());
-        actionBuilder.addAugmentation(QueueIdAction.class, expBuilder.build());
+        actionBuilder.addAugmentation(ExperimenterAction.class, expBuilder.build());
         builder.setAction(actionBuilder.build());
         return builder.build();
     }
index 29f42d86c3eab9366fb3e4ba1dbc1e53d7cc7fb3..803ae38c44210ea36e795c9aca2905c202c1a178 100644 (file)
@@ -148,8 +148,8 @@ public abstract class OF10ActionsSerializer {
     private static void encodeDlAddressAction(Action action, ByteBuf out, byte code) {
         out.writeShort(code);
         out.writeShort(DL_ADDRESS_ACTION_LENGTH);
-        out.writeBytes(action.getAugmentation(DlAddressAction.class)
-                .getDlAddress().getValue().getBytes());
+        out.writeBytes(ByteBufUtils.macAddressToBytes(action.getAugmentation(DlAddressAction.class)
+                .getDlAddress().getValue()));
         ByteBufUtils.padBuffer(PADDING_IN_DL_ADDRESS_ACTION, out);
     }
     
@@ -185,7 +185,7 @@ public abstract class OF10ActionsSerializer {
         out.writeShort(port.getPort().getValue().intValue());
         ByteBufUtils.padBuffer(PADDING_IN_ENQUEUE_ACTION, out);
         QueueIdAction queueId = action.getAugmentation(QueueIdAction.class);
-        out.writeShort(queueId.getQueueId().intValue());
+        out.writeInt(queueId.getQueueId().intValue());
     }
     
     private static void encodeExperimenterAction(Action action, ByteBuf outBuffer) {
diff --git a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/util/OF10ActionsDeserializerTest.java b/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/util/OF10ActionsDeserializerTest.java
new file mode 100644 (file)
index 0000000..d2db8e2
--- /dev/null
@@ -0,0 +1,125 @@
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+package org.opendaylight.openflowjava.protocol.impl.util;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+\r
+import java.util.List;\r
+\r
+import org.junit.Assert;\r
+import org.junit.Test;\r
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DlAddressAction;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterAction;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IpAddressAction;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTosAction;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdAction;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpAction;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidAction;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.ActionsList;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.actions.list.Action;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF10ActionsDeserializerTest {\r
+\r
+    /**\r
+     * Testing correct deserialization of actions (OF v1.0)\r
+     */\r
+    @Test\r
+    public void test() {\r
+        ByteBuf message = BufferHelper.buildBuffer("00 00 00 08 00 10 20 00 "\r
+                + "00 01 00 08 10 10 00 00 "\r
+                + "00 02 00 08 25 00 00 00 "\r
+                + "00 03 00 08 00 00 00 00 "\r
+                + "00 04 00 10 01 02 03 04 05 06 00 00 00 00 00 00 "\r
+                + "00 05 00 10 02 03 04 05 06 07 00 00 00 00 00 00 "\r
+                + "00 06 00 08 0A 00 00 01 "\r
+                + "00 07 00 08 0B 00 00 02 "\r
+                + "00 08 00 08 01 00 00 00 "\r
+                + "00 09 00 08 00 02 00 00 "\r
+                + "00 0A 00 08 00 03 00 00 "\r
+                + "00 0B 00 10 00 04 00 00 00 00 00 00 00 00 00 30 "\r
+                + "FF FF 00 08 00 00 12 34");\r
+        \r
+        message.skipBytes(4); // skip XID\r
+        List<ActionsList> actions = OF10ActionsDeserializer.createActionsList(message);\r
+        Assert.assertEquals("Wrong number of actions", 13, actions.size());\r
+        Action action1 = actions.get(0).getAction();\r
+        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"\r
+                + ".openflow.common.action.rev130731.Output", action1.getType().getName());\r
+        Assert.assertEquals("Wrong port", 16,\r
+                action1.getAugmentation(PortAction.class).getPort().getValue().intValue());\r
+        Assert.assertEquals("Wrong max-length", 8192,\r
+                action1.getAugmentation(MaxLengthAction.class).getMaxLength().intValue());\r
+        Action action2 = actions.get(1).getAction();\r
+        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"\r
+                + ".openflow.common.action.rev130731.SetVlanVid", action2.getType().getName());\r
+        Assert.assertEquals("Wrong vlan-vid", 4112,\r
+                action2.getAugmentation(VlanVidAction.class).getVlanVid().intValue());\r
+        Action action3 = actions.get(2).getAction();\r
+        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"\r
+                + ".openflow.common.action.rev130731.SetVlanPcp", action3.getType().getName());\r
+        Assert.assertEquals("Wrong vlan-pcp", 37,\r
+                action3.getAugmentation(VlanPcpAction.class).getVlanPcp().intValue());\r
+        Action action4 = actions.get(3).getAction();\r
+        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"\r
+                + ".openflow.common.action.rev130731.StripVlan", action4.getType().getName());\r
+        Action action5 = actions.get(4).getAction();\r
+        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"\r
+                + ".openflow.common.action.rev130731.SetDlSrc", action5.getType().getName());\r
+        Assert.assertArrayEquals("Wrong dl-src", ByteBufUtils.macAddressToBytes("01:02:03:04:05:06"), \r
+                ByteBufUtils.macAddressToBytes(action5.getAugmentation(DlAddressAction.class).getDlAddress().getValue()));\r
+        Action action6 = actions.get(5).getAction();\r
+        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"\r
+                + ".openflow.common.action.rev130731.SetDlDst", action6.getType().getName());\r
+        Assert.assertArrayEquals("Wrong dl-dst", ByteBufUtils.macAddressToBytes("02:03:04:05:06:07"), \r
+                ByteBufUtils.macAddressToBytes(action6.getAugmentation(DlAddressAction.class).getDlAddress().getValue()));\r
+        Action action7 = actions.get(6).getAction();\r
+        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"\r
+                + ".openflow.common.action.rev130731.SetNwSrc", action7.getType().getName());\r
+        Assert.assertEquals("Wrong nw-src", new Ipv4Address("10.0.0.1"),\r
+                action7.getAugmentation(IpAddressAction.class).getIpAddress());\r
+        Action action8 = actions.get(7).getAction();\r
+        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"\r
+                + ".openflow.common.action.rev130731.SetNwDst", action8.getType().getName());\r
+        Assert.assertEquals("Wrong nw-dst", new Ipv4Address("11.0.0.2"),\r
+                action8.getAugmentation(IpAddressAction.class).getIpAddress());\r
+        Action action9 = actions.get(8).getAction();\r
+        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"\r
+                + ".openflow.common.action.rev130731.SetNwTos", action9.getType().getName());\r
+        Assert.assertEquals("Wrong nw-tos", 1, action9.getAugmentation(NwTosAction.class).getNwTos().intValue());\r
+        Action action10 = actions.get(9).getAction();\r
+        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"\r
+                + ".openflow.common.action.rev130731.SetTpSrc", action10.getType().getName());\r
+        Assert.assertEquals("Wrong port", 2, action10.getAugmentation(PortAction.class)\r
+                .getPort().getValue().intValue());\r
+        Action action11 = actions.get(10).getAction();\r
+        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"\r
+                + ".openflow.common.action.rev130731.SetTpDst", action11.getType().getName());\r
+        Assert.assertEquals("Wrong port", 3, action11.getAugmentation(PortAction.class)\r
+                .getPort().getValue().intValue());\r
+        Action action12 = actions.get(11).getAction();\r
+        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"\r
+                + ".openflow.common.action.rev130731.Enqueue", action12.getType().getName());\r
+        Assert.assertEquals("Wrong port", 4, action12.getAugmentation(PortAction.class)\r
+                .getPort().getValue().intValue());\r
+        Assert.assertEquals("Wrong queue-id", 48,\r
+                action12.getAugmentation(QueueIdAction.class).getQueueId().intValue());\r
+        Action action13 = actions.get(12).getAction();\r
+        Assert.assertEquals("Wrong action type", "org.opendaylight.yang.gen.v1.urn.opendaylight"\r
+                + ".openflow.common.action.rev130731.Experimenter", action13.getType().getName());\r
+        Assert.assertEquals("Wrong port", 4660, action13.getAugmentation(ExperimenterAction.class)\r
+                .getExperimenter().intValue());\r
+    }\r
+\r
+}\r
diff --git a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/util/OF10ActionsSerializerTest.java b/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/util/OF10ActionsSerializerTest.java
new file mode 100644 (file)
index 0000000..1f5ad76
--- /dev/null
@@ -0,0 +1,241 @@
+/*\r
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.\r
+ *\r
+ * This program and the accompanying materials are made available under the\r
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,\r
+ * and is available at http://www.eclipse.org/legal/epl-v10.html\r
+ */\r
+package org.opendaylight.openflowjava.protocol.impl.util;\r
+\r
+import io.netty.buffer.ByteBuf;\r
+import io.netty.buffer.UnpooledByteBufAllocator;\r
+\r
+import java.util.ArrayList;\r
+import java.util.List;\r
+\r
+import org.junit.Assert;\r
+import org.junit.Test;\r
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;\r
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DlAddressAction;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.DlAddressActionBuilder;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterAction;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterActionBuilder;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IpAddressAction;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.IpAddressActionBuilder;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthActionBuilder;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTosAction;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTosActionBuilder;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortActionBuilder;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdAction;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.QueueIdActionBuilder;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpAction;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanPcpActionBuilder;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidAction;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.VlanVidActionBuilder;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Enqueue;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Experimenter;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Output;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetDlDst;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetDlSrc;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwDst;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwSrc;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwTos;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetTpDst;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetTpSrc;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetVlanPcp;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetVlanVid;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.StripVlan;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.ActionsList;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.ActionsListBuilder;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.actions.list.ActionBuilder;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber;\r
+\r
+/**\r
+ * @author michal.polkorab\r
+ *\r
+ */\r
+public class OF10ActionsSerializerTest {\r
+\r
+    /**\r
+     * Testing correct serialization of actions (OF v1.0) \r
+     */\r
+    @Test\r
+    public void test() {\r
+        List<ActionsList> actions = new ArrayList<>();\r
+        ActionsListBuilder listBuilder = new ActionsListBuilder();\r
+        ActionBuilder actionBuilder = new ActionBuilder();\r
+        actionBuilder.setType(Output.class);\r
+        PortActionBuilder portBuilder = new PortActionBuilder();\r
+        portBuilder.setPort(new PortNumber(42L));\r
+        actionBuilder.addAugmentation(PortAction.class, portBuilder.build());\r
+        MaxLengthActionBuilder maxLen = new MaxLengthActionBuilder();\r
+        maxLen.setMaxLength(32);\r
+        actionBuilder.addAugmentation(MaxLengthAction.class, maxLen.build());\r
+        listBuilder.setAction(actionBuilder.build());\r
+        actions.add(listBuilder.build());\r
+        listBuilder = new ActionsListBuilder();\r
+        actionBuilder = new ActionBuilder();\r
+        actionBuilder.setType(SetVlanVid.class);\r
+        VlanVidActionBuilder vlanBuilder = new VlanVidActionBuilder();\r
+        vlanBuilder.setVlanVid(15);\r
+        actionBuilder.addAugmentation(VlanVidAction.class, vlanBuilder.build());\r
+        listBuilder.setAction(actionBuilder.build());\r
+        actions.add(listBuilder.build());\r
+        listBuilder = new ActionsListBuilder();\r
+        actionBuilder = new ActionBuilder();\r
+        actionBuilder.setType(SetVlanPcp.class);\r
+        VlanPcpActionBuilder pcpBuilder = new VlanPcpActionBuilder();\r
+        pcpBuilder.setVlanPcp((short) 16);\r
+        actionBuilder.addAugmentation(VlanPcpAction.class, pcpBuilder.build());\r
+        listBuilder.setAction(actionBuilder.build());\r
+        actions.add(listBuilder.build());\r
+        listBuilder = new ActionsListBuilder();\r
+        actionBuilder = new ActionBuilder();\r
+        actionBuilder.setType(StripVlan.class);\r
+        listBuilder.setAction(actionBuilder.build());\r
+        actions.add(listBuilder.build());\r
+        listBuilder = new ActionsListBuilder();\r
+        actionBuilder = new ActionBuilder();\r
+        actionBuilder.setType(SetDlSrc.class);\r
+        DlAddressActionBuilder dlBuilder = new DlAddressActionBuilder();\r
+        dlBuilder.setDlAddress(new MacAddress("00:00:00:02:03:04"));\r
+        actionBuilder.addAugmentation(DlAddressAction.class, dlBuilder.build());\r
+        listBuilder.setAction(actionBuilder.build());\r
+        actions.add(listBuilder.build());\r
+        listBuilder = new ActionsListBuilder();\r
+        actionBuilder = new ActionBuilder();\r
+        actionBuilder.setType(SetDlDst.class);\r
+        dlBuilder = new DlAddressActionBuilder();\r
+        dlBuilder.setDlAddress(new MacAddress("00:00:00:01:02:03"));\r
+        actionBuilder.addAugmentation(DlAddressAction.class, dlBuilder.build());\r
+        listBuilder.setAction(actionBuilder.build());\r
+        actions.add(listBuilder.build());\r
+        listBuilder = new ActionsListBuilder();\r
+        actionBuilder = new ActionBuilder();\r
+        actionBuilder.setType(SetNwSrc.class);\r
+        IpAddressActionBuilder ipBuilder = new IpAddressActionBuilder();\r
+        ipBuilder.setIpAddress(new Ipv4Address("10.0.0.1"));\r
+        actionBuilder.addAugmentation(IpAddressAction.class, ipBuilder.build());\r
+        listBuilder.setAction(actionBuilder.build());\r
+        actions.add(listBuilder.build());\r
+        listBuilder = new ActionsListBuilder();\r
+        actionBuilder = new ActionBuilder();\r
+        actionBuilder.setType(SetNwDst.class);\r
+        ipBuilder = new IpAddressActionBuilder();\r
+        ipBuilder.setIpAddress(new Ipv4Address("10.0.0.3"));\r
+        actionBuilder.addAugmentation(IpAddressAction.class, ipBuilder.build());\r
+        listBuilder.setAction(actionBuilder.build());\r
+        actions.add(listBuilder.build());\r
+        listBuilder = new ActionsListBuilder();\r
+        actionBuilder = new ActionBuilder();\r
+        actionBuilder.setType(SetNwTos.class);\r
+        NwTosActionBuilder tosBuilder = new NwTosActionBuilder();\r
+        tosBuilder.setNwTos((short) 204);\r
+        actionBuilder.addAugmentation(NwTosAction.class, tosBuilder.build());\r
+        listBuilder.setAction(actionBuilder.build());\r
+        actions.add(listBuilder.build());\r
+        listBuilder = new ActionsListBuilder();\r
+        actionBuilder = new ActionBuilder();\r
+        actionBuilder.setType(SetTpSrc.class);\r
+        portBuilder = new PortActionBuilder();\r
+        portBuilder.setPort(new PortNumber(6653L));\r
+        actionBuilder.addAugmentation(PortAction.class, portBuilder.build());\r
+        listBuilder.setAction(actionBuilder.build());\r
+        actions.add(listBuilder.build());\r
+        listBuilder = new ActionsListBuilder();\r
+        actionBuilder = new ActionBuilder();\r
+        actionBuilder.setType(SetTpDst.class);\r
+        portBuilder = new PortActionBuilder();\r
+        portBuilder.setPort(new PortNumber(6633L));\r
+        actionBuilder.addAugmentation(PortAction.class, portBuilder.build());\r
+        listBuilder.setAction(actionBuilder.build());\r
+        actions.add(listBuilder.build());\r
+        listBuilder = new ActionsListBuilder();\r
+        actionBuilder = new ActionBuilder();\r
+        actionBuilder.setType(Enqueue.class);\r
+        portBuilder = new PortActionBuilder();\r
+        portBuilder.setPort(new PortNumber(6613L));\r
+        actionBuilder.addAugmentation(PortAction.class, portBuilder.build());\r
+        QueueIdActionBuilder queueBuilder = new QueueIdActionBuilder();\r
+        queueBuilder.setQueueId(400L);\r
+        actionBuilder.addAugmentation(QueueIdAction.class, queueBuilder.build());\r
+        listBuilder.setAction(actionBuilder.build());\r
+        actions.add(listBuilder.build());\r
+        listBuilder = new ActionsListBuilder();\r
+        actionBuilder = new ActionBuilder();\r
+        actionBuilder.setType(Experimenter.class);\r
+        ExperimenterActionBuilder expBuilder = new ExperimenterActionBuilder();\r
+        expBuilder.setExperimenter(500L);\r
+        actionBuilder.addAugmentation(ExperimenterAction.class, expBuilder.build());\r
+        listBuilder.setAction(actionBuilder.build());\r
+        actions.add(listBuilder.build());\r
+        \r
+        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
+        OF10ActionsSerializer.encodeActionsV10(out, actions);\r
+        \r
+        Assert.assertEquals("Wrong action type", 0, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong port", 42, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong max-length", 32, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong action type", 1, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong vlan-vid", 15, out.readUnsignedShort());\r
+        out.skipBytes(2);\r
+        Assert.assertEquals("Wrong action type", 2, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong vlan-pcp", 16, out.readUnsignedByte());\r
+        out.skipBytes(3);\r
+        Assert.assertEquals("Wrong action type", 3, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
+        out.skipBytes(4);\r
+        Assert.assertEquals("Wrong action type", 4, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong action length", 16, out.readUnsignedShort());\r
+        byte[] data = new byte[EncodeConstants.MAC_ADDRESS_LENGTH];\r
+        out.readBytes(data);\r
+        Assert.assertArrayEquals("Wrong dl-address", ByteBufUtils.macAddressToBytes("00:00:00:02:03:04"), data);\r
+        out.skipBytes(6);\r
+        Assert.assertEquals("Wrong action type", 5, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong action length", 16, out.readUnsignedShort());\r
+        data = new byte[EncodeConstants.MAC_ADDRESS_LENGTH];\r
+        out.readBytes(data);\r
+        Assert.assertArrayEquals("Wrong dl-address", ByteBufUtils.macAddressToBytes("00:00:00:01:02:03"), data);\r
+        out.skipBytes(6);\r
+        Assert.assertEquals("Wrong action type", 6, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong ip-address(1)", 10, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong ip-address(2)", 0, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong ip-address(3)", 0, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong ip-address(4)", 1, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong action type", 7, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong ip-address(1)", 10, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong ip-address(2)", 0, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong ip-address(3)", 0, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong ip-address(4)", 3, out.readUnsignedByte());\r
+        Assert.assertEquals("Wrong action type", 8, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong nw-tos", 204, out.readUnsignedByte());\r
+        out.skipBytes(3);\r
+        Assert.assertEquals("Wrong action type", 9, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong port", 6653, out.readUnsignedShort());\r
+        out.skipBytes(2);\r
+        Assert.assertEquals("Wrong action type", 10, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong port", 6633, out.readUnsignedShort());\r
+        out.skipBytes(2);\r
+        Assert.assertEquals("Wrong action type", 11, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong action length", 16, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong port", 6613, out.readUnsignedShort());\r
+        out.skipBytes(6);\r
+        Assert.assertEquals("Wrong queue-id", 400, out.readUnsignedInt());\r
+        Assert.assertEquals("Wrong action type", 65535, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
+        Assert.assertEquals("Wrong vendor-id", 500, out.readUnsignedInt());\r
+        Assert.assertTrue("Written more bytes than needed", out.readableBytes() == 0);\r
+    }\r
+    \r
+}
\ No newline at end of file