-/*\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.MessageTypeKey;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;\r
-import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
-import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionsInstruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionsInstructionBuilder;\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.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.MetadataInstruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataInstructionBuilder;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MeterIdInstruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MeterIdInstructionBuilder;\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.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.TableIdInstruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TableIdInstructionBuilder;\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.PopPbb;\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.SetNwTtl;\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.instruction.rev130731.ApplyActions;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ClearActions;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.GotoTable;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.Meter;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteActions;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteMetadata;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;\r
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder;\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
-\r
-/**\r
- * @author michal.polkorab\r
- *\r
- */\r
-public class OF13InstructionsSerializerTest {\r
-\r
- private SerializerRegistry registry;\r
- private OFSerializer<Instruction> instructionSerializer;\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
- instructionSerializer = registry.getSerializer(\r
- new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, Instruction.class));\r
- }\r
-\r
- /**\r
- * Testing instructions translation\r
- */\r
- @Test\r
- public void test() {\r
- List<Instruction> instructions = new ArrayList<>();\r
- // Goto_table instruction\r
- InstructionBuilder builder = new InstructionBuilder();\r
- builder.setType(GotoTable.class);\r
- TableIdInstructionBuilder tableIdBuilder = new TableIdInstructionBuilder();\r
- tableIdBuilder.setTableId((short) 5);\r
- builder.addAugmentation(TableIdInstruction.class, tableIdBuilder.build());\r
- instructions.add(builder.build());\r
- builder = new InstructionBuilder();\r
- // Write_metadata instruction\r
- builder.setType(WriteMetadata.class);\r
- MetadataInstructionBuilder metaBuilder = new MetadataInstructionBuilder();\r
- metaBuilder.setMetadata(ByteBufUtils.hexStringToBytes("00 01 02 03 04 05 06 07"));\r
- metaBuilder.setMetadataMask(ByteBufUtils.hexStringToBytes("07 06 05 04 03 02 01 00"));\r
- builder.addAugmentation(MetadataInstruction.class, metaBuilder.build());\r
- instructions.add(builder.build());\r
- // Clear_actions instruction\r
- builder = new InstructionBuilder();\r
- builder.setType(ClearActions.class);\r
- instructions.add(builder.build());\r
- // Meter instruction\r
- builder = new InstructionBuilder();\r
- builder.setType(Meter.class);\r
- MeterIdInstructionBuilder meterBuilder = new MeterIdInstructionBuilder();\r
- meterBuilder.setMeterId(42L);\r
- builder.addAugmentation(MeterIdInstruction.class, meterBuilder.build());\r
- instructions.add(builder.build());\r
- // Write_actions instruction\r
- builder = new InstructionBuilder();\r
- builder.setType(WriteActions.class);\r
- ActionsInstructionBuilder actionsBuilder = new ActionsInstructionBuilder();\r
- List<Action> actions = new ArrayList<>();\r
- ActionBuilder actionBuilder = new ActionBuilder();\r
- actionBuilder.setType(Output.class);\r
- PortActionBuilder portBuilder = new PortActionBuilder();\r
- portBuilder.setPort(new PortNumber(45L));\r
- actionBuilder.addAugmentation(PortAction.class, portBuilder.build());\r
- MaxLengthActionBuilder maxBuilder = new MaxLengthActionBuilder();\r
- maxBuilder.setMaxLength(55);\r
- actionBuilder.addAugmentation(MaxLengthAction.class, maxBuilder.build());\r
- actions.add(actionBuilder.build());\r
- actionBuilder = new ActionBuilder();\r
- actionBuilder.setType(SetNwTtl.class);\r
- NwTtlActionBuilder nwTtl = new NwTtlActionBuilder();\r
- nwTtl.setNwTtl((short) 64);\r
- actionBuilder.addAugmentation(NwTtlAction.class, nwTtl.build());\r
- actions.add(actionBuilder.build());\r
- actionsBuilder.setAction(actions);\r
- builder.addAugmentation(ActionsInstruction.class, actionsBuilder.build());\r
- instructions.add(builder.build());\r
- // Apply_actions instruction\r
- builder = new InstructionBuilder();\r
- builder.setType(ApplyActions.class);\r
- actionsBuilder = new ActionsInstructionBuilder();\r
- actions = new ArrayList<>();\r
- actionBuilder = new ActionBuilder();\r
- actionBuilder.setType(PushVlan.class);\r
- EthertypeActionBuilder ethertypeBuilder = new EthertypeActionBuilder();\r
- ethertypeBuilder.setEthertype(new EtherType(14));\r
- actionBuilder.addAugmentation(EthertypeAction.class, ethertypeBuilder.build());\r
- actions.add(actionBuilder.build());\r
- actionBuilder = new ActionBuilder();\r
- actionBuilder.setType(PopPbb.class);\r
- actions.add(actionBuilder.build());\r
- actionsBuilder.setAction(actions);\r
- builder.addAugmentation(ActionsInstruction.class, actionsBuilder.build());\r
- instructions.add(builder.build());\r
- \r
- ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();\r
- CodingUtils.serializeList(instructions, instructionSerializer, out);\r
- \r
- Assert.assertEquals("Wrong instruction type", 1, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong instruction length", 8, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong instruction table-id", 5, out.readUnsignedByte());\r
- out.skipBytes(3);\r
- Assert.assertEquals("Wrong instruction type", 2, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong instruction length", 24, out.readUnsignedShort());\r
- out.skipBytes(4);\r
- byte[] actual = new byte[8];\r
- out.readBytes(actual);\r
- Assert.assertEquals("Wrong instruction metadata", "00 01 02 03 04 05 06 07",\r
- ByteBufUtils.bytesToHexString(actual));\r
- actual = new byte[8];\r
- out.readBytes(actual);\r
- Assert.assertEquals("Wrong instruction metadata-mask", "07 06 05 04 03 02 01 00",\r
- ByteBufUtils.bytesToHexString(actual));\r
- Assert.assertEquals("Wrong instruction type", 5, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong instruction length", 8, out.readUnsignedShort());\r
- out.skipBytes(4);\r
- Assert.assertEquals("Wrong instruction type", 6, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong instruction length", 8, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong instruction meter-id", 42, out.readUnsignedInt());\r
- Assert.assertEquals("Wrong instruction type", 3, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong instruction length", 32, out.readUnsignedShort());\r
- out.skipBytes(4);\r
- Assert.assertEquals("Wrong action type", 0, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action length", 16, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action type", 45, out.readUnsignedInt());\r
- Assert.assertEquals("Wrong action type", 55, out.readUnsignedShort());\r
- out.skipBytes(6);\r
- Assert.assertEquals("Wrong action type", 23, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong action type", 64, out.readUnsignedByte());\r
- out.skipBytes(3);\r
- Assert.assertEquals("Wrong instruction type", 4, out.readUnsignedShort());\r
- Assert.assertEquals("Wrong instruction length", 24, 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", 14, 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("Not all data were read", 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.openflowjava.util.ByteBufUtils;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionsInstruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionsInstructionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthertypeAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.EthertypeActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaxLengthActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataInstruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MetadataInstructionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MeterIdInstruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MeterIdInstructionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTtlAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NwTtlActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortAction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PortActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TableIdInstruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TableIdInstructionBuilder;
+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.PopPbb;
+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.SetNwTtl;
+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.instruction.rev130731.ApplyActions;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.ClearActions;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.GotoTable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.Meter;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteActions;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.WriteMetadata;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.InstructionBuilder;
+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;
+
+/**
+ * @author michal.polkorab
+ *
+ */
+public class OF13InstructionsSerializerTest {
+
+ private SerializerRegistry registry;
+
+ /**
+ * Initializes serializer table and stores correct factory in field
+ */
+ @Before
+ public void startUp() {
+ registry = new SerializerRegistryImpl();
+ registry.init();
+ }
+
+ /**
+ * Testing instructions translation
+ */
+ @Test
+ public void test() {
+ List<Instruction> instructions = new ArrayList<>();
+ // Goto_table instruction
+ InstructionBuilder builder = new InstructionBuilder();
+ builder.setType(GotoTable.class);
+ TableIdInstructionBuilder tableIdBuilder = new TableIdInstructionBuilder();
+ tableIdBuilder.setTableId((short) 5);
+ builder.addAugmentation(TableIdInstruction.class, tableIdBuilder.build());
+ instructions.add(builder.build());
+ builder = new InstructionBuilder();
+ // Write_metadata instruction
+ builder.setType(WriteMetadata.class);
+ MetadataInstructionBuilder metaBuilder = new MetadataInstructionBuilder();
+ metaBuilder.setMetadata(ByteBufUtils.hexStringToBytes("00 01 02 03 04 05 06 07"));
+ metaBuilder.setMetadataMask(ByteBufUtils.hexStringToBytes("07 06 05 04 03 02 01 00"));
+ builder.addAugmentation(MetadataInstruction.class, metaBuilder.build());
+ instructions.add(builder.build());
+ // Clear_actions instruction
+ builder = new InstructionBuilder();
+ builder.setType(ClearActions.class);
+ instructions.add(builder.build());
+ // Meter instruction
+ builder = new InstructionBuilder();
+ builder.setType(Meter.class);
+ MeterIdInstructionBuilder meterBuilder = new MeterIdInstructionBuilder();
+ meterBuilder.setMeterId(42L);
+ builder.addAugmentation(MeterIdInstruction.class, meterBuilder.build());
+ instructions.add(builder.build());
+ // Write_actions instruction
+ builder = new InstructionBuilder();
+ builder.setType(WriteActions.class);
+ ActionsInstructionBuilder actionsBuilder = new ActionsInstructionBuilder();
+ List<Action> actions = new ArrayList<>();
+ ActionBuilder actionBuilder = new ActionBuilder();
+ actionBuilder.setType(Output.class);
+ PortActionBuilder portBuilder = new PortActionBuilder();
+ portBuilder.setPort(new PortNumber(45L));
+ actionBuilder.addAugmentation(PortAction.class, portBuilder.build());
+ MaxLengthActionBuilder maxBuilder = new MaxLengthActionBuilder();
+ maxBuilder.setMaxLength(55);
+ actionBuilder.addAugmentation(MaxLengthAction.class, maxBuilder.build());
+ actions.add(actionBuilder.build());
+ actionBuilder = new ActionBuilder();
+ actionBuilder.setType(SetNwTtl.class);
+ NwTtlActionBuilder nwTtl = new NwTtlActionBuilder();
+ nwTtl.setNwTtl((short) 64);
+ actionBuilder.addAugmentation(NwTtlAction.class, nwTtl.build());
+ actions.add(actionBuilder.build());
+ actionsBuilder.setAction(actions);
+ builder.addAugmentation(ActionsInstruction.class, actionsBuilder.build());
+ instructions.add(builder.build());
+ // Apply_actions instruction
+ builder = new InstructionBuilder();
+ builder.setType(ApplyActions.class);
+ actionsBuilder = new ActionsInstructionBuilder();
+ actions = new ArrayList<>();
+ actionBuilder = new ActionBuilder();
+ actionBuilder.setType(PushVlan.class);
+ EthertypeActionBuilder ethertypeBuilder = new EthertypeActionBuilder();
+ ethertypeBuilder.setEthertype(new EtherType(14));
+ actionBuilder.addAugmentation(EthertypeAction.class, ethertypeBuilder.build());
+ actions.add(actionBuilder.build());
+ actionBuilder = new ActionBuilder();
+ actionBuilder.setType(PopPbb.class);
+ actions.add(actionBuilder.build());
+ actionsBuilder.setAction(actions);
+ builder.addAugmentation(ActionsInstruction.class, actionsBuilder.build());
+ instructions.add(builder.build());
+
+ ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+ ListSerializer.serializeList(instructions, TypeKeyMakerFactory
+ .createInstructionKeyMaker(EncodeConstants.OF13_VERSION_ID), registry, out);
+
+ Assert.assertEquals("Wrong instruction type", 1, out.readUnsignedShort());
+ Assert.assertEquals("Wrong instruction length", 8, out.readUnsignedShort());
+ Assert.assertEquals("Wrong instruction table-id", 5, out.readUnsignedByte());
+ out.skipBytes(3);
+ Assert.assertEquals("Wrong instruction type", 2, out.readUnsignedShort());
+ Assert.assertEquals("Wrong instruction length", 24, out.readUnsignedShort());
+ out.skipBytes(4);
+ byte[] actual = new byte[8];
+ out.readBytes(actual);
+ Assert.assertEquals("Wrong instruction metadata", "00 01 02 03 04 05 06 07",
+ ByteBufUtils.bytesToHexString(actual));
+ actual = new byte[8];
+ out.readBytes(actual);
+ Assert.assertEquals("Wrong instruction metadata-mask", "07 06 05 04 03 02 01 00",
+ ByteBufUtils.bytesToHexString(actual));
+ Assert.assertEquals("Wrong instruction type", 5, out.readUnsignedShort());
+ Assert.assertEquals("Wrong instruction length", 8, out.readUnsignedShort());
+ out.skipBytes(4);
+ Assert.assertEquals("Wrong instruction type", 6, out.readUnsignedShort());
+ Assert.assertEquals("Wrong instruction length", 8, out.readUnsignedShort());
+ Assert.assertEquals("Wrong instruction meter-id", 42, out.readUnsignedInt());
+ Assert.assertEquals("Wrong instruction type", 3, out.readUnsignedShort());
+ Assert.assertEquals("Wrong instruction length", 32, out.readUnsignedShort());
+ out.skipBytes(4);
+ Assert.assertEquals("Wrong action type", 0, out.readUnsignedShort());
+ Assert.assertEquals("Wrong action length", 16, out.readUnsignedShort());
+ Assert.assertEquals("Wrong action type", 45, out.readUnsignedInt());
+ Assert.assertEquals("Wrong action type", 55, out.readUnsignedShort());
+ out.skipBytes(6);
+ Assert.assertEquals("Wrong action type", 23, out.readUnsignedShort());
+ Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
+ Assert.assertEquals("Wrong action type", 64, out.readUnsignedByte());
+ out.skipBytes(3);
+ Assert.assertEquals("Wrong instruction type", 4, out.readUnsignedShort());
+ Assert.assertEquals("Wrong instruction length", 24, 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", 14, 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("Not all data were read", out.readableBytes() == 0);
+ }
+
+}