Bug 2756 - Match model update
[openflowjava.git] / openflow-protocol-impl / src / test / java / org / opendaylight / openflowjava / protocol / impl / util / OF13ActionsSerializerTest.java
index 76784c9258fc9bb3236bd488c28c2dceb7817bab..7e614b676dd3e92ab4392751f70d6377390544bb 100644 (file)
-/*\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.Before;\r
-import org.junit.Test;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthertypeAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthertypeActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.GroupIdAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.GroupIdActionBuilder;\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.MplsTtlAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MplsTtlActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTtlAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTtlActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OxmFieldsAction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OxmFieldsActionBuilder;\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.PortNumberMatchEntry;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortNumberMatchEntryBuilder;\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.common.action.rev130731.CopyTtlIn;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.CopyTtlOut;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.DecMplsTtl;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.DecNwTtl;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Group;\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.PopMpls;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopPbb;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopVlan;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushMpls;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushPbb;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushVlan;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetField;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetMplsTtl;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwTtl;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetQueue;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.Action;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.actions.grouping.ActionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.EtherType;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.InPort;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;\r
-\r
-/**\r
- * @author michal.polkorab\r
- * \r
- */\r
-public class OF13ActionsSerializerTest {\r
-\r
-    private SerializerRegistry registry;\r
-\r
-    /**\r
-     * Initializes serializer table and stores correct factory in field\r
-     */\r
-    @Before\r
-    public void startUp() {\r
-        registry = new SerializerRegistryImpl();\r
-        registry.init();\r
-    }\r
-\r
-    /**\r
-     * Testing correct serialization of actions\r
-     */\r
-    @Test\r
-    public void test() {\r
-        List<Action> actions = new ArrayList<>();\r
-        ActionBuilder actionBuilder = new ActionBuilder();\r
-        actionBuilder.setType(Output.class);\r
-        PortActionBuilder port = new PortActionBuilder();\r
-        port.setPort(new PortNumber(42L));\r
-        actionBuilder.addAugmentation(PortAction.class, port.build());\r
-        MaxLengthActionBuilder maxLen = new MaxLengthActionBuilder();\r
-        maxLen.setMaxLength(52);\r
-        actionBuilder.addAugmentation(MaxLengthAction.class, maxLen.build());\r
-        actions.add(actionBuilder.build());\r
-        actionBuilder = new ActionBuilder();\r
-        actionBuilder.setType(CopyTtlOut.class);\r
-        actions.add(actionBuilder.build());\r
-        actionBuilder = new ActionBuilder();\r
-        actionBuilder.setType(CopyTtlIn.class);\r
-        actions.add(actionBuilder.build());\r
-        actionBuilder = new ActionBuilder();\r
-        actionBuilder.setType(SetMplsTtl.class);\r
-        MplsTtlActionBuilder mplsTtl = new MplsTtlActionBuilder();\r
-        mplsTtl.setMplsTtl((short) 4);\r
-        actionBuilder.addAugmentation(MplsTtlAction.class, mplsTtl.build());\r
-        actions.add(actionBuilder.build());\r
-        actionBuilder = new ActionBuilder();\r
-        actionBuilder.setType(DecMplsTtl.class);\r
-        actions.add(actionBuilder.build());\r
-        actionBuilder = new ActionBuilder();\r
-        actionBuilder.setType(PushVlan.class);\r
-        EthertypeActionBuilder etherType = new EthertypeActionBuilder();\r
-        etherType.setEthertype(new EtherType(16));\r
-        actionBuilder.addAugmentation(EthertypeAction.class, etherType.build());\r
-        actions.add(actionBuilder.build());\r
-        actionBuilder = new ActionBuilder();\r
-        actionBuilder.setType(PopVlan.class);\r
-        actions.add(actionBuilder.build());\r
-        actionBuilder = new ActionBuilder();\r
-        actionBuilder.setType(PushMpls.class);\r
-        etherType = new EthertypeActionBuilder();\r
-        etherType.setEthertype(new EtherType(17));\r
-        actionBuilder.addAugmentation(EthertypeAction.class, etherType.build());\r
-        actions.add(actionBuilder.build());\r
-        actionBuilder = new ActionBuilder();\r
-        actionBuilder.setType(PopMpls.class);\r
-        etherType = new EthertypeActionBuilder();\r
-        etherType.setEthertype(new EtherType(18));\r
-        actionBuilder.addAugmentation(EthertypeAction.class, etherType.build());\r
-        actions.add(actionBuilder.build());\r
-        actionBuilder = new ActionBuilder();\r
-        actionBuilder.setType(SetQueue.class);\r
-        QueueIdActionBuilder queueId = new QueueIdActionBuilder();\r
-        queueId.setQueueId(1234L);\r
-        actionBuilder.addAugmentation(QueueIdAction.class, queueId.build());\r
-        actions.add(actionBuilder.build());\r
-        actionBuilder = new ActionBuilder();\r
-        actionBuilder.setType(Group.class);\r
-        GroupIdActionBuilder group = new GroupIdActionBuilder();\r
-        group.setGroupId(555L);\r
-        actionBuilder.addAugmentation(GroupIdAction.class, group.build());\r
-        actions.add(actionBuilder.build());\r
-        actionBuilder = new ActionBuilder();\r
-        actionBuilder.setType(SetNwTtl.class);\r
-        NwTtlActionBuilder nwTtl = new NwTtlActionBuilder();\r
-        nwTtl.setNwTtl((short) 8);\r
-        actionBuilder.addAugmentation(NwTtlAction.class, nwTtl.build());\r
-        actions.add(actionBuilder.build());\r
-        actionBuilder = new ActionBuilder();\r
-        actionBuilder.setType(DecNwTtl.class);\r
-        actions.add(actionBuilder.build());\r
-        actionBuilder = new ActionBuilder();\r
-        actionBuilder.setType(SetField.class);\r
-        OxmFieldsActionBuilder matchEntries = new OxmFieldsActionBuilder();\r
-        List<MatchEntries> entries = new ArrayList<>();\r
-        MatchEntriesBuilder matchBuilder = new MatchEntriesBuilder();\r
-        matchBuilder.setOxmClass(OpenflowBasicClass.class);\r
-        matchBuilder.setOxmMatchField(InPort.class);\r
-        matchBuilder.setHasMask(false);\r
-        PortNumberMatchEntryBuilder portBuilder = new PortNumberMatchEntryBuilder();\r
-        portBuilder.setPortNumber(new PortNumber(1L));\r
-        matchBuilder.addAugmentation(PortNumberMatchEntry.class, portBuilder.build());\r
-        entries.add(matchBuilder.build());\r
-        matchEntries.setMatchEntries(entries);\r
-        actionBuilder.addAugmentation(OxmFieldsAction.class, matchEntries.build());\r
-        actions.add(actionBuilder.build());\r
-        actionBuilder = new ActionBuilder();\r
-        actionBuilder.setType(PushPbb.class);\r
-        etherType = new EthertypeActionBuilder();\r
-        etherType.setEthertype(new EtherType(19));\r
-        actionBuilder.addAugmentation(EthertypeAction.class, etherType.build());\r
-        actions.add(actionBuilder.build());\r
-        actionBuilder = new ActionBuilder();\r
-        actionBuilder.setType(PopPbb.class);\r
-        actions.add(actionBuilder.build());\r
-        \r
-        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
-        ListSerializer.serializeList(actions, EnhancedTypeKeyMakerFactory\r
-                .createActionKeyMaker(EncodeConstants.OF13_VERSION_ID), registry, out);\r
-        \r
-        Assert.assertEquals("Wrong action type", 0, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action length", 16, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action port", 42, out.readUnsignedInt());\r
-        Assert.assertEquals("Wrong action max-length", 52, out.readUnsignedShort());\r
-        out.skipBytes(6);\r
-        Assert.assertEquals("Wrong action type", 11, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
-        out.skipBytes(4);\r
-        Assert.assertEquals("Wrong action type", 12, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
-        out.skipBytes(4);\r
-        Assert.assertEquals("Wrong action type", 15, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action mpls-ttl", 4, out.readUnsignedByte());\r
-        out.skipBytes(3);\r
-        Assert.assertEquals("Wrong action type", 16, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
-        out.skipBytes(4);\r
-        Assert.assertEquals("Wrong action type", 17, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action ethertype", 16, out.readUnsignedShort());\r
-        out.skipBytes(2);\r
-        Assert.assertEquals("Wrong action type", 18, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
-        out.skipBytes(4);\r
-        Assert.assertEquals("Wrong action type", 19, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action ethertype", 17, out.readUnsignedShort());\r
-        out.skipBytes(2);\r
-        Assert.assertEquals("Wrong action type", 20, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action ethertype", 18, out.readUnsignedShort());\r
-        out.skipBytes(2);\r
-        Assert.assertEquals("Wrong action type", 21, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action queue-id", 1234, out.readUnsignedInt());\r
-        Assert.assertEquals("Wrong action type", 22, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action group", 555, out.readUnsignedInt());\r
-        Assert.assertEquals("Wrong action type", 23, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action nw-ttl", 8, out.readUnsignedByte());\r
-        out.skipBytes(3);\r
-        Assert.assertEquals("Wrong action type", 24, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
-        out.skipBytes(4);\r
-        Assert.assertEquals("Wrong action type", 25, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action length", 16, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong match entry field & mask", 0, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry length", 4, out.readUnsignedByte());\r
-        Assert.assertEquals("Wrong match entry value", 1, out.readUnsignedInt());\r
-        out.skipBytes(4);\r
-        Assert.assertEquals("Wrong action type", 26, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action ethertype", 19, out.readUnsignedShort());\r
-        out.skipBytes(2);\r
-        Assert.assertEquals("Wrong action type", 27, out.readUnsignedShort());\r
-        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
-        out.skipBytes(4);\r
-        Assert.assertTrue("Unread data", out.readableBytes() == 0);\r
-    }\r
-\r
-}\r
+/*
+ * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+package org.opendaylight.openflowjava.protocol.impl.util;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.EthertypeAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.EthertypeActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.GroupIdAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.GroupIdActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.MaxLengthAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.MaxLengthActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.MplsTtlAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.MplsTtlActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.NwTtlAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.NwTtlActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.OxmFieldsAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.OxmFieldsActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.PortAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.PortActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.QueueIdAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.QueueIdActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.CopyTtlIn;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.CopyTtlOut;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.DecMplsTtl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.DecNwTtl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.Group;
+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.PopMpls;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopPbb;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PopVlan;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushMpls;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushPbb;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.PushVlan;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetMplsTtl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetNwTtl;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev130731.SetQueue;
+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.EtherType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumber;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.InPort;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.InPortCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.in.port._case.InPortBuilder;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13ActionsSerializerTest {
+
+    private SerializerRegistry registry;
+
+    /**
+     * Initializes serializer table and stores correct factory in field
+     */
+    @Before
+    public void startUp() {
+        registry = new SerializerRegistryImpl();
+        registry.init();
+    }
+
+    /**
+     * Testing correct serialization of actions
+     */
+    @Test
+    public void test() {
+        List<Action> actions = new ArrayList<>();
+        ActionBuilder actionBuilder = new ActionBuilder();
+        actionBuilder.setType(Output.class);
+        PortActionBuilder port = new PortActionBuilder();
+        port.setPort(new PortNumber(42L));
+        actionBuilder.addAugmentation(PortAction.class, port.build());
+        MaxLengthActionBuilder maxLen = new MaxLengthActionBuilder();
+        maxLen.setMaxLength(52);
+        actionBuilder.addAugmentation(MaxLengthAction.class, maxLen.build());
+        actions.add(actionBuilder.build());
+        actionBuilder = new ActionBuilder();
+        actionBuilder.setType(CopyTtlOut.class);
+        actions.add(actionBuilder.build());
+        actionBuilder = new ActionBuilder();
+        actionBuilder.setType(CopyTtlIn.class);
+        actions.add(actionBuilder.build());
+        actionBuilder = new ActionBuilder();
+        actionBuilder.setType(SetMplsTtl.class);
+        MplsTtlActionBuilder mplsTtl = new MplsTtlActionBuilder();
+        mplsTtl.setMplsTtl((short) 4);
+        actionBuilder.addAugmentation(MplsTtlAction.class, mplsTtl.build());
+        actions.add(actionBuilder.build());
+        actionBuilder = new ActionBuilder();
+        actionBuilder.setType(DecMplsTtl.class);
+        actions.add(actionBuilder.build());
+        actionBuilder = new ActionBuilder();
+        actionBuilder.setType(PushVlan.class);
+        EthertypeActionBuilder etherType = new EthertypeActionBuilder();
+        etherType.setEthertype(new EtherType(16));
+        actionBuilder.addAugmentation(EthertypeAction.class, etherType.build());
+        actions.add(actionBuilder.build());
+        actionBuilder = new ActionBuilder();
+        actionBuilder.setType(PopVlan.class);
+        actions.add(actionBuilder.build());
+        actionBuilder = new ActionBuilder();
+        actionBuilder.setType(PushMpls.class);
+        etherType = new EthertypeActionBuilder();
+        etherType.setEthertype(new EtherType(17));
+        actionBuilder.addAugmentation(EthertypeAction.class, etherType.build());
+        actions.add(actionBuilder.build());
+        actionBuilder = new ActionBuilder();
+        actionBuilder.setType(PopMpls.class);
+        etherType = new EthertypeActionBuilder();
+        etherType.setEthertype(new EtherType(18));
+        actionBuilder.addAugmentation(EthertypeAction.class, etherType.build());
+        actions.add(actionBuilder.build());
+        actionBuilder = new ActionBuilder();
+        actionBuilder.setType(SetQueue.class);
+        QueueIdActionBuilder queueId = new QueueIdActionBuilder();
+        queueId.setQueueId(1234L);
+        actionBuilder.addAugmentation(QueueIdAction.class, queueId.build());
+        actions.add(actionBuilder.build());
+        actionBuilder = new ActionBuilder();
+        actionBuilder.setType(Group.class);
+        GroupIdActionBuilder group = new GroupIdActionBuilder();
+        group.setGroupId(555L);
+        actionBuilder.addAugmentation(GroupIdAction.class, group.build());
+        actions.add(actionBuilder.build());
+        actionBuilder = new ActionBuilder();
+        actionBuilder.setType(SetNwTtl.class);
+        NwTtlActionBuilder nwTtl = new NwTtlActionBuilder();
+        nwTtl.setNwTtl((short) 8);
+        actionBuilder.addAugmentation(NwTtlAction.class, nwTtl.build());
+        actions.add(actionBuilder.build());
+        actionBuilder = new ActionBuilder();
+        actionBuilder.setType(DecNwTtl.class);
+        actions.add(actionBuilder.build());
+        actionBuilder = new ActionBuilder();
+        actionBuilder.setType(SetField.class);
+        OxmFieldsActionBuilder matchEntries = new OxmFieldsActionBuilder();
+        List<MatchEntry> entries = new ArrayList<>();
+        MatchEntryBuilder matchBuilder = new MatchEntryBuilder();
+        matchBuilder.setOxmClass(OpenflowBasicClass.class);
+        matchBuilder.setOxmMatchField(InPort.class);
+        matchBuilder.setHasMask(false);
+        InPortCaseBuilder inPortCaseBuilder = new InPortCaseBuilder();
+        InPortBuilder inPortBuilder = new InPortBuilder();
+        inPortBuilder.setPortNumber(new PortNumber(1L));
+        inPortCaseBuilder.setInPort(inPortBuilder.build());
+        matchBuilder.setMatchEntryValue(inPortCaseBuilder.build());
+        entries.add(matchBuilder.build());
+        matchEntries.setMatchEntry(entries);
+        actionBuilder.addAugmentation(OxmFieldsAction.class, matchEntries.build());
+        actions.add(actionBuilder.build());
+        actionBuilder = new ActionBuilder();
+        actionBuilder.setType(PushPbb.class);
+        etherType = new EthertypeActionBuilder();
+        etherType.setEthertype(new EtherType(19));
+        actionBuilder.addAugmentation(EthertypeAction.class, etherType.build());
+        actions.add(actionBuilder.build());
+        actionBuilder = new ActionBuilder();
+        actionBuilder.setType(PopPbb.class);
+        actions.add(actionBuilder.build());
+
+        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+        ListSerializer.serializeList(actions, TypeKeyMakerFactory
+                .createActionKeyMaker(EncodeConstants.OF13_VERSION_ID), registry, out);
+
+        Assert.assertEquals("Wrong action type", 0, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action length", 16, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action port", 42, out.readUnsignedInt());
+        Assert.assertEquals("Wrong action max-length", 52, out.readUnsignedShort());
+        out.skipBytes(6);
+        Assert.assertEquals("Wrong action type", 11, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+        out.skipBytes(4);
+        Assert.assertEquals("Wrong action type", 12, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+        out.skipBytes(4);
+        Assert.assertEquals("Wrong action type", 15, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action mpls-ttl", 4, out.readUnsignedByte());
+        out.skipBytes(3);
+        Assert.assertEquals("Wrong action type", 16, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+        out.skipBytes(4);
+        Assert.assertEquals("Wrong action type", 17, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action ethertype", 16, out.readUnsignedShort());
+        out.skipBytes(2);
+        Assert.assertEquals("Wrong action type", 18, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+        out.skipBytes(4);
+        Assert.assertEquals("Wrong action type", 19, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action ethertype", 17, out.readUnsignedShort());
+        out.skipBytes(2);
+        Assert.assertEquals("Wrong action type", 20, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action ethertype", 18, out.readUnsignedShort());
+        out.skipBytes(2);
+        Assert.assertEquals("Wrong action type", 21, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action queue-id", 1234, out.readUnsignedInt());
+        Assert.assertEquals("Wrong action type", 22, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action group", 555, out.readUnsignedInt());
+        Assert.assertEquals("Wrong action type", 23, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action nw-ttl", 8, out.readUnsignedByte());
+        out.skipBytes(3);
+        Assert.assertEquals("Wrong action type", 24, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+        out.skipBytes(4);
+        Assert.assertEquals("Wrong action type", 25, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action length", 16, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());
+        Assert.assertEquals("Wrong match entry field & mask", 0, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry length", 4, out.readUnsignedByte());
+        Assert.assertEquals("Wrong match entry value", 1, out.readUnsignedInt());
+        out.skipBytes(4);
+        Assert.assertEquals("Wrong action type", 26, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action ethertype", 19, out.readUnsignedShort());
+        out.skipBytes(2);
+        Assert.assertEquals("Wrong action type", 27, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+        out.skipBytes(4);
+        Assert.assertTrue("Unread data", out.readableBytes() == 0);
+    }
+
+    /**
+     * Testing correct serialization of actions
+     */
+    @Test
+    public void testHeaders() {
+        List<Action> actions = new ArrayList<>();
+        ActionBuilder actionBuilder = new ActionBuilder();
+        actionBuilder.setType(Output.class);
+        PortActionBuilder port = new PortActionBuilder();
+        port.setPort(new PortNumber(42L));
+        actionBuilder.addAugmentation(PortAction.class, port.build());
+        MaxLengthActionBuilder maxLen = new MaxLengthActionBuilder();
+        maxLen.setMaxLength(52);
+        actionBuilder.addAugmentation(MaxLengthAction.class, maxLen.build());
+        actions.add(actionBuilder.build());
+        actionBuilder = new ActionBuilder();
+        actionBuilder.setType(SetField.class);
+        OxmFieldsActionBuilder matchEntries = new OxmFieldsActionBuilder();
+        List<MatchEntry> entries = new ArrayList<>();
+        MatchEntryBuilder matchBuilder = new MatchEntryBuilder();
+        matchBuilder.setOxmClass(OpenflowBasicClass.class);
+        matchBuilder.setOxmMatchField(InPort.class);
+        matchBuilder.setHasMask(false);
+        InPortCaseBuilder inPortCaseBuilder = new InPortCaseBuilder();
+        InPortBuilder inPortBuilder = new InPortBuilder();
+        inPortBuilder.setPortNumber(new PortNumber(1L));
+        inPortCaseBuilder.setInPort(inPortBuilder.build());
+        matchBuilder.setMatchEntryValue(inPortCaseBuilder.build());
+        entries.add(matchBuilder.build());
+        matchEntries.setMatchEntry(entries);
+        actionBuilder.addAugmentation(OxmFieldsAction.class, matchEntries.build());
+        actions.add(actionBuilder.build());
+
+        ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+        ListSerializer.serializeHeaderList(actions, TypeKeyMakerFactory
+                .createActionKeyMaker(EncodeConstants.OF13_VERSION_ID), registry, out);
+
+        Assert.assertEquals("Wrong action type", 0, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action length", 4, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action type", 25, out.readUnsignedShort());
+        Assert.assertEquals("Wrong action length", 4, out.readUnsignedShort());
+        Assert.assertTrue("Unread data", out.readableBytes() == 0);
+    }
+}
\ No newline at end of file