-/*\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.openflowjava.util.ByteBufUtils;\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
-\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 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
- ListSerializer.serializeList(instructions, TypeKeyMakerFactory\r
- .createInstructionKeyMaker(EncodeConstants.OF13_VERSION_ID), registry, 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.common.action.rev150203.action.grouping.action.choice.OutputActionCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PopPbbCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PushVlanCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetNwTtlCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.output.action._case.OutputActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.push.vlan._case.PushVlanActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.nw.ttl._case.SetNwTtlActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.ApplyActionsCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.ClearActionsCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.GotoTableCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.MeterCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.WriteActionsCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.WriteMetadataCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice._goto.table._case.GotoTableBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.apply.actions._case.ApplyActionsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.meter._case.MeterBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.write.actions._case.WriteActionsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.write.metadata._case.WriteMetadataBuilder;
+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();
+ GotoTableCaseBuilder gotoCaseBuilder = new GotoTableCaseBuilder();
+ GotoTableBuilder instructionBuilder = new GotoTableBuilder();
+ instructionBuilder.setTableId((short) 5);
+ gotoCaseBuilder.setGotoTable(instructionBuilder.build());
+ builder.setInstructionChoice(gotoCaseBuilder.build());
+ instructions.add(builder.build());
+ // Write_metadata instruction
+ builder = new InstructionBuilder();
+ WriteMetadataCaseBuilder metadataCaseBuilder = new WriteMetadataCaseBuilder();
+ WriteMetadataBuilder metadataBuilder = new WriteMetadataBuilder();
+ metadataBuilder.setMetadata(ByteBufUtils.hexStringToBytes("00 01 02 03 04 05 06 07"));
+ metadataBuilder.setMetadataMask(ByteBufUtils.hexStringToBytes("07 06 05 04 03 02 01 00"));
+ metadataCaseBuilder.setWriteMetadata(metadataBuilder.build());
+ builder.setInstructionChoice(metadataCaseBuilder.build());
+ instructions.add(builder.build());
+ // Clear_actions instruction
+ builder = new InstructionBuilder();
+ builder.setInstructionChoice(new ClearActionsCaseBuilder().build());
+ instructions.add(builder.build());
+ // Meter instruction
+ builder = new InstructionBuilder();
+ MeterCaseBuilder meterCaseBuilder = new MeterCaseBuilder();
+ MeterBuilder meterBuilder = new MeterBuilder();
+ meterBuilder.setMeterId(42L);
+ meterCaseBuilder.setMeter(meterBuilder.build());
+ builder.setInstructionChoice(meterCaseBuilder.build());
+ instructions.add(builder.build());
+ // Write_actions instruction
+ builder = new InstructionBuilder();
+ WriteActionsCaseBuilder writeActionsCaseBuilder = new WriteActionsCaseBuilder();
+ WriteActionsBuilder writeActionsBuilder = new WriteActionsBuilder();
+ List<Action> actions = new ArrayList<>();
+ ActionBuilder actionBuilder = new ActionBuilder();
+ OutputActionCaseBuilder caseBuilder = new OutputActionCaseBuilder();
+ OutputActionBuilder outputBuilder = new OutputActionBuilder();
+ outputBuilder.setPort(new PortNumber(45L));
+ outputBuilder.setMaxLength(55);
+ caseBuilder.setOutputAction(outputBuilder.build());
+ actionBuilder.setActionChoice(caseBuilder.build());
+ actions.add(actionBuilder.build());
+ actionBuilder = new ActionBuilder();
+ SetNwTtlCaseBuilder ttlCaseBuilder = new SetNwTtlCaseBuilder();
+ SetNwTtlActionBuilder ttlActionBuilder = new SetNwTtlActionBuilder();
+ ttlActionBuilder.setNwTtl((short) 64);
+ ttlCaseBuilder.setSetNwTtlAction(ttlActionBuilder.build());
+ actionBuilder.setActionChoice(ttlCaseBuilder.build());
+ actions.add(actionBuilder.build());
+ writeActionsBuilder.setAction(actions);
+ writeActionsCaseBuilder.setWriteActions(writeActionsBuilder.build());
+ builder.setInstructionChoice(writeActionsCaseBuilder.build());
+ instructions.add(builder.build());
+ // Apply_actions instruction
+ builder = new InstructionBuilder();
+ ApplyActionsCaseBuilder applyActionsCaseBuilder = new ApplyActionsCaseBuilder();
+ ApplyActionsBuilder applyActionsBuilder = new ApplyActionsBuilder();
+ actions = new ArrayList<>();
+ actionBuilder = new ActionBuilder();
+ PushVlanCaseBuilder vlanCaseBuilder = new PushVlanCaseBuilder();
+ PushVlanActionBuilder vlanBuilder = new PushVlanActionBuilder();
+ vlanBuilder.setEthertype(new EtherType(new EtherType(14)));
+ vlanCaseBuilder.setPushVlanAction(vlanBuilder.build());
+ actionBuilder.setActionChoice(vlanCaseBuilder.build());
+ actions.add(actionBuilder.build());
+ actionBuilder = new ActionBuilder();
+ actionBuilder.setActionChoice(new PopPbbCaseBuilder().build());
+ actions.add(actionBuilder.build());
+ applyActionsBuilder.setAction(actions);
+ applyActionsCaseBuilder.setApplyActions(applyActionsBuilder.build());
+ builder.setInstructionChoice(applyActionsCaseBuilder.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);
+ }
+
+}