List of usage examples for io.netty.buffer ByteBuf skipBytes
public abstract ByteBuf skipBytes(int length);
From source file:org.opendaylight.netide.openflowjava.protocol.impl.serialization.factories.MultipartReplyMessageFactoryTest.java
License:Open Source License
@Test public void testMeterSerialize() { builder.setType(MultipartType.forValue(9)); MultipartReplyMeterCaseBuilder meterCase = new MultipartReplyMeterCaseBuilder(); MultipartReplyMeterBuilder meter = new MultipartReplyMeterBuilder(); meter.setMeterStats(createMeterStats()); meterCase.setMultipartReplyMeter(meter.build()); builder.setMultipartReplyBody(meterCase.build()); message = builder.build();/* w w w .j ava 2 s. c o m*/ ByteBuf serializedBuffer = UnpooledByteBufAllocator.DEFAULT.buffer(); serializer.serialize(message, serializedBuffer); BufferHelper.checkHeaderV13(serializedBuffer, MESSAGE_TYPE, 74); Assert.assertEquals("Wrong type", MultipartType.OFPMPMETER.getIntValue(), serializedBuffer.readShort()); Assert.assertEquals("Wrong flags", message.getFlags(), createMultipartRequestFlags(serializedBuffer.readShort())); serializedBuffer.skipBytes(PADDING); MultipartReplyMeterCase body = (MultipartReplyMeterCase) message.getMultipartReplyBody(); MultipartReplyMeter messageOutput = body.getMultipartReplyMeter(); MeterStats meterStats = messageOutput.getMeterStats().get(0); Assert.assertEquals("Wrong meterId", meterStats.getMeterId().getValue().intValue(), serializedBuffer.readInt()); Assert.assertEquals("Wrong len", 58, serializedBuffer.readInt()); serializedBuffer.skipBytes(6); Assert.assertEquals("Wrong flow count", meterStats.getFlowCount().intValue(), serializedBuffer.readInt()); Assert.assertEquals("Wrong packet in count", meterStats.getPacketInCount().longValue(), serializedBuffer.readLong()); Assert.assertEquals("Wrong byte in count", meterStats.getByteInCount().longValue(), serializedBuffer.readLong()); Assert.assertEquals("Wrong duration sec", meterStats.getDurationSec().intValue(), serializedBuffer.readInt()); Assert.assertEquals("Wrong duration nsec", meterStats.getDurationNsec().intValue(), serializedBuffer.readInt()); MeterBandStats meterBandStats = meterStats.getMeterBandStats().get(0); Assert.assertEquals("Wrong packet in count", meterBandStats.getPacketBandCount().longValue(), serializedBuffer.readLong()); Assert.assertEquals("Wrong byte in count", meterBandStats.getByteBandCount().longValue(), serializedBuffer.readLong()); }
From source file:org.opendaylight.netide.openflowjava.protocol.impl.serialization.factories.MultipartReplyMessageFactoryTest.java
License:Open Source License
@Test public void testGroupFeaturesSerialize() { builder.setType(MultipartType.forValue(8)); MultipartReplyGroupFeaturesCaseBuilder featureCase = new MultipartReplyGroupFeaturesCaseBuilder(); MultipartReplyGroupFeaturesBuilder feature = new MultipartReplyGroupFeaturesBuilder(); feature.setTypes(new GroupTypes(true, false, true, false)); feature.setCapabilities(new GroupCapabilities(true, false, true, true)); List<Long> maxGroups = new ArrayList<>(); maxGroups.add(1L);/* w w w . j a v a2 s.co m*/ maxGroups.add(2L); maxGroups.add(3L); maxGroups.add(4L); feature.setMaxGroups(maxGroups); feature.setActionsBitmap(createActionType()); featureCase.setMultipartReplyGroupFeatures(feature.build()); builder.setMultipartReplyBody(featureCase.build()); message = builder.build(); ByteBuf serializedBuffer = UnpooledByteBufAllocator.DEFAULT.buffer(); serializer.serialize(message, serializedBuffer); BufferHelper.checkHeaderV13(serializedBuffer, MESSAGE_TYPE, 56); Assert.assertEquals("Wrong type", MultipartType.OFPMPGROUPFEATURES.getIntValue(), serializedBuffer.readShort()); Assert.assertEquals("Wrong flags", message.getFlags(), createMultipartRequestFlags(serializedBuffer.readShort())); serializedBuffer.skipBytes(PADDING); MultipartReplyGroupFeaturesCase body = (MultipartReplyGroupFeaturesCase) message.getMultipartReplyBody(); MultipartReplyGroupFeatures messageOutput = body.getMultipartReplyGroupFeatures(); Assert.assertEquals("Wrong type", messageOutput.getTypes(), createGroupTypes(serializedBuffer.readInt())); Assert.assertEquals("Wrong capabilities", messageOutput.getCapabilities(), createGroupCapabilities(serializedBuffer.readInt())); Assert.assertEquals("Wrong max groups", messageOutput.getMaxGroups().get(0).intValue(), serializedBuffer.readInt()); Assert.assertEquals("Wrong max groups", messageOutput.getMaxGroups().get(1).intValue(), serializedBuffer.readInt()); Assert.assertEquals("Wrong max groups", messageOutput.getMaxGroups().get(2).intValue(), serializedBuffer.readInt()); Assert.assertEquals("Wrong max groups", messageOutput.getMaxGroups().get(3).intValue(), serializedBuffer.readInt()); Assert.assertEquals("Wrong actions", messageOutput.getActionsBitmap().get(0), createActionType(serializedBuffer.readInt())); Assert.assertEquals("Wrong actions", messageOutput.getActionsBitmap().get(1), createActionType(serializedBuffer.readInt())); Assert.assertEquals("Wrong actions", messageOutput.getActionsBitmap().get(2), createActionType(serializedBuffer.readInt())); Assert.assertEquals("Wrong actions", messageOutput.getActionsBitmap().get(3), createActionType(serializedBuffer.readInt())); }
From source file:org.opendaylight.netide.openflowjava.protocol.impl.serialization.factories.MultipartReplyMessageFactoryTest.java
License:Open Source License
@Test public void testGroupDescSerialize() { builder.setType(MultipartType.forValue(7)); MultipartReplyGroupDescCaseBuilder groupCase = new MultipartReplyGroupDescCaseBuilder(); MultipartReplyGroupDescBuilder group = new MultipartReplyGroupDescBuilder(); group.setGroupDesc(createGroupDesc()); groupCase.setMultipartReplyGroupDesc(group.build()); builder.setMultipartReplyBody(groupCase.build()); message = builder.build();/* w w w . j ava2s .c o m*/ ByteBuf serializedBuffer = UnpooledByteBufAllocator.DEFAULT.buffer(); serializer.serialize(message, serializedBuffer); BufferHelper.checkHeaderV13(serializedBuffer, MESSAGE_TYPE, 64); Assert.assertEquals("Wrong type", MultipartType.OFPMPGROUPDESC.getIntValue(), serializedBuffer.readShort()); Assert.assertEquals("Wrong flags", message.getFlags(), createMultipartRequestFlags(serializedBuffer.readShort())); serializedBuffer.skipBytes(PADDING); MultipartReplyGroupDescCase body = (MultipartReplyGroupDescCase) message.getMultipartReplyBody(); MultipartReplyGroupDesc messageOutput = body.getMultipartReplyGroupDesc(); GroupDesc groupDesc = messageOutput.getGroupDesc().get(0); Assert.assertEquals("Wrong length", 48, serializedBuffer.readShort()); Assert.assertEquals("Wrong type", groupDesc.getType().getIntValue(), serializedBuffer.readUnsignedByte()); serializedBuffer.skipBytes(1); Assert.assertEquals("Wrong group id", groupDesc.getGroupId().getValue().intValue(), serializedBuffer.readInt()); BucketsList bucketList = groupDesc.getBucketsList().get(0); Assert.assertEquals("Wrong length", 40, serializedBuffer.readShort()); Assert.assertEquals("Wrong weight", bucketList.getWeight().intValue(), serializedBuffer.readShort()); Assert.assertEquals("Wrong watch port", bucketList.getWatchPort().getValue().intValue(), serializedBuffer.readInt()); Assert.assertEquals("Wrong watch group", bucketList.getWatchGroup().intValue(), serializedBuffer.readInt()); serializedBuffer.skipBytes(4); Assert.assertEquals("Wrong action type", 0, serializedBuffer.readUnsignedShort()); Assert.assertEquals("Wrong action length", 16, serializedBuffer.readUnsignedShort()); Assert.assertEquals("Wrong action type", 45, serializedBuffer.readUnsignedInt()); Assert.assertEquals("Wrong action type", 55, serializedBuffer.readUnsignedShort()); serializedBuffer.skipBytes(6); Assert.assertEquals("Wrong action type", 23, serializedBuffer.readUnsignedShort()); Assert.assertEquals("Wrong action length", 8, serializedBuffer.readUnsignedShort()); Assert.assertEquals("Wrong action type", 64, serializedBuffer.readUnsignedByte()); serializedBuffer.skipBytes(3); Assert.assertTrue("Not all data were read", serializedBuffer.readableBytes() == 0); }
From source file:org.opendaylight.netide.openflowjava.protocol.impl.serialization.factories.MultipartReplyMessageFactoryTest.java
License:Open Source License
@Test public void testGroupSerialize() { builder.setType(MultipartType.forValue(6)); MultipartReplyGroupCaseBuilder groupCase = new MultipartReplyGroupCaseBuilder(); MultipartReplyGroupBuilder group = new MultipartReplyGroupBuilder(); group.setGroupStats(createGroupStats()); groupCase.setMultipartReplyGroup(group.build()); builder.setMultipartReplyBody(groupCase.build()); message = builder.build();/* www . j av a 2 s. c om*/ ByteBuf serializedBuffer = UnpooledByteBufAllocator.DEFAULT.buffer(); serializer.serialize(message, serializedBuffer); BufferHelper.checkHeaderV13(serializedBuffer, MESSAGE_TYPE, 72); Assert.assertEquals("Wrong type", MultipartType.OFPMPGROUP.getIntValue(), serializedBuffer.readShort()); Assert.assertEquals("Wrong flags", message.getFlags(), createMultipartRequestFlags(serializedBuffer.readShort())); serializedBuffer.skipBytes(PADDING); MultipartReplyGroupCase body = (MultipartReplyGroupCase) message.getMultipartReplyBody(); MultipartReplyGroup messageOutput = body.getMultipartReplyGroup(); GroupStats groupStats = messageOutput.getGroupStats().get(0); Assert.assertEquals("Wrong length", 56, serializedBuffer.readShort()); serializedBuffer.skipBytes(2); Assert.assertEquals("Wrong group id", groupStats.getGroupId().getValue().intValue(), serializedBuffer.readInt()); Assert.assertEquals("Wrong ref count", groupStats.getRefCount().intValue(), serializedBuffer.readInt()); serializedBuffer.skipBytes(4); Assert.assertEquals("Wrong Packet count", groupStats.getPacketCount().longValue(), serializedBuffer.readLong()); Assert.assertEquals("Wrong Byte count", groupStats.getByteCount().longValue(), serializedBuffer.readLong()); Assert.assertEquals("Wrong duration sec", groupStats.getDurationSec().intValue(), serializedBuffer.readInt()); Assert.assertEquals("Wrong duration nsec", groupStats.getDurationNsec().intValue(), serializedBuffer.readInt()); BucketStats bucketStats = groupStats.getBucketStats().get(0); Assert.assertEquals("Wrong Packet count", bucketStats.getPacketCount().longValue(), serializedBuffer.readLong()); Assert.assertEquals("Wrong Byte count", bucketStats.getByteCount().longValue(), serializedBuffer.readLong()); }
From source file:org.opendaylight.netide.openflowjava.protocol.impl.serialization.factories.MultipartReplyMessageFactoryTest.java
License:Open Source License
@Test public void testQueueSerialize() { builder.setType(MultipartType.forValue(5)); MultipartReplyQueueCaseBuilder queueCase = new MultipartReplyQueueCaseBuilder(); MultipartReplyQueueBuilder queue = new MultipartReplyQueueBuilder(); queue.setQueueStats(createQueueStats()); queueCase.setMultipartReplyQueue(queue.build()); builder.setMultipartReplyBody(queueCase.build()); message = builder.build();//from w w w. jav a 2 s .c om ByteBuf serializedBuffer = UnpooledByteBufAllocator.DEFAULT.buffer(); serializer.serialize(message, serializedBuffer); BufferHelper.checkHeaderV13(serializedBuffer, MESSAGE_TYPE, 56); Assert.assertEquals("Wrong type", MultipartType.OFPMPQUEUE.getIntValue(), serializedBuffer.readShort()); Assert.assertEquals("Wrong flags", message.getFlags(), createMultipartRequestFlags(serializedBuffer.readShort())); serializedBuffer.skipBytes(PADDING); MultipartReplyQueueCase body = (MultipartReplyQueueCase) message.getMultipartReplyBody(); MultipartReplyQueue messageOutput = body.getMultipartReplyQueue(); QueueStats queueStats = messageOutput.getQueueStats().get(0); Assert.assertEquals("Wrong PortNo", queueStats.getPortNo().intValue(), serializedBuffer.readUnsignedInt()); Assert.assertEquals("Wrong queue id", queueStats.getQueueId().intValue(), serializedBuffer.readUnsignedInt()); Assert.assertEquals("Wrong tx bytes", queueStats.getTxBytes().longValue(), serializedBuffer.readLong()); Assert.assertEquals("Wrong tx packets", queueStats.getTxPackets().longValue(), serializedBuffer.readLong()); Assert.assertEquals("Wrong tx errors", queueStats.getTxErrors().longValue(), serializedBuffer.readLong()); Assert.assertEquals("Wrong duration sec", queueStats.getDurationSec().intValue(), serializedBuffer.readInt()); Assert.assertEquals("Wrong duration nsec", queueStats.getDurationNsec().intValue(), serializedBuffer.readInt()); }
From source file:org.opendaylight.netide.openflowjava.protocol.impl.serialization.factories.MultipartReplyMessageFactoryTest.java
License:Open Source License
@Test public void testPortStatsSerialize() { builder.setType(MultipartType.forValue(4)); MultipartReplyPortStatsCaseBuilder portStatsCase = new MultipartReplyPortStatsCaseBuilder(); MultipartReplyPortStatsBuilder portStats = new MultipartReplyPortStatsBuilder(); portStats.setPortStats(createPortStats()); portStatsCase.setMultipartReplyPortStats(portStats.build()); builder.setMultipartReplyBody(portStatsCase.build()); message = builder.build();/*from w w w .j a v a2 s .co m*/ ByteBuf serializedBuffer = UnpooledByteBufAllocator.DEFAULT.buffer(); serializer.serialize(message, serializedBuffer); BufferHelper.checkHeaderV13(serializedBuffer, MESSAGE_TYPE, 128); Assert.assertEquals("Wrong type", MultipartType.OFPMPPORTSTATS.getIntValue(), serializedBuffer.readShort()); Assert.assertEquals("Wrong flags", message.getFlags(), createMultipartRequestFlags(serializedBuffer.readShort())); serializedBuffer.skipBytes(PADDING); MultipartReplyPortStatsCase body = (MultipartReplyPortStatsCase) message.getMultipartReplyBody(); MultipartReplyPortStats messageOutput = body.getMultipartReplyPortStats(); PortStats portStatsOutput = messageOutput.getPortStats().get(0); Assert.assertEquals("Wrong port no", portStatsOutput.getPortNo().intValue(), serializedBuffer.readInt()); serializedBuffer.skipBytes(4); Assert.assertEquals("Wrong rx packets", portStatsOutput.getRxPackets().longValue(), serializedBuffer.readLong()); Assert.assertEquals("Wrong tx packets", portStatsOutput.getTxPackets().longValue(), serializedBuffer.readLong()); Assert.assertEquals("Wrong rx bytes", portStatsOutput.getRxBytes().longValue(), serializedBuffer.readLong()); Assert.assertEquals("Wrong tx bytes", portStatsOutput.getTxBytes().longValue(), serializedBuffer.readLong()); Assert.assertEquals("Wrong rx dropped", portStatsOutput.getRxDropped().longValue(), serializedBuffer.readLong()); Assert.assertEquals("Wrong tx dropped", portStatsOutput.getTxDropped().longValue(), serializedBuffer.readLong()); Assert.assertEquals("Wrong rx errors", portStatsOutput.getRxErrors().longValue(), serializedBuffer.readLong()); Assert.assertEquals("Wrong tx errors", portStatsOutput.getTxErrors().longValue(), serializedBuffer.readLong()); Assert.assertEquals("Wrong rx frame err", portStatsOutput.getRxFrameErr().longValue(), serializedBuffer.readLong()); Assert.assertEquals("Wrong rx over err", portStatsOutput.getRxOverErr().longValue(), serializedBuffer.readLong()); Assert.assertEquals("Wrong rx crc err", portStatsOutput.getRxCrcErr().longValue(), serializedBuffer.readLong()); Assert.assertEquals("Wrong collisions", portStatsOutput.getCollisions().longValue(), serializedBuffer.readLong()); Assert.assertEquals("Wrong duration sec", portStatsOutput.getDurationSec().intValue(), serializedBuffer.readInt()); Assert.assertEquals("Wrong duration nsec", portStatsOutput.getDurationNsec().intValue(), serializedBuffer.readInt()); }
From source file:org.opendaylight.netide.openflowjava.protocol.impl.serialization.factories.MultipartReplyMessageFactoryTest.java
License:Open Source License
@Test public void testTableSerialize() { builder.setType(MultipartType.forValue(3)); MultipartReplyTableCaseBuilder tableCase = new MultipartReplyTableCaseBuilder(); MultipartReplyTableBuilder table = new MultipartReplyTableBuilder(); table.setTableStats(createTableStats()); tableCase.setMultipartReplyTable(table.build()); builder.setMultipartReplyBody(tableCase.build()); message = builder.build();//from w w w. j a va 2s . co m ByteBuf serializedBuffer = UnpooledByteBufAllocator.DEFAULT.buffer(); serializer.serialize(message, serializedBuffer); BufferHelper.checkHeaderV13(serializedBuffer, MESSAGE_TYPE, 40); Assert.assertEquals("Wrong type", MultipartType.OFPMPTABLE.getIntValue(), serializedBuffer.readShort()); Assert.assertEquals("Wrong flags", message.getFlags(), createMultipartRequestFlags(serializedBuffer.readShort())); serializedBuffer.skipBytes(PADDING); MultipartReplyTableCase body = (MultipartReplyTableCase) message.getMultipartReplyBody(); MultipartReplyTable messageOutput = body.getMultipartReplyTable(); TableStats tableStats = messageOutput.getTableStats().get(0); Assert.assertEquals("Wrong tableId", tableStats.getTableId().shortValue(), serializedBuffer.readUnsignedByte()); serializedBuffer.skipBytes(3); Assert.assertEquals("Wrong active count", tableStats.getActiveCount().longValue(), serializedBuffer.readInt()); Assert.assertEquals("Wrong lookup count", tableStats.getLookupCount().longValue(), serializedBuffer.readLong()); Assert.assertEquals("Wrong matched count", tableStats.getMatchedCount().longValue(), serializedBuffer.readLong()); }
From source file:org.opendaylight.netide.openflowjava.protocol.impl.serialization.factories.MultipartReplyMessageFactoryTest.java
License:Open Source License
@Test public void testAggregateSerialize() { builder.setType(MultipartType.forValue(2)); MultipartReplyAggregateCaseBuilder aggregateCase = new MultipartReplyAggregateCaseBuilder(); MultipartReplyAggregateBuilder aggregate = new MultipartReplyAggregateBuilder(); aggregate.setPacketCount(BigInteger.valueOf(1L)); aggregate.setByteCount(BigInteger.valueOf(1L)); aggregate.setFlowCount(1L);/*from ww w.jav a 2 s .com*/ aggregateCase.setMultipartReplyAggregate(aggregate.build()); builder.setMultipartReplyBody(aggregateCase.build()); message = builder.build(); ByteBuf serializedBuffer = UnpooledByteBufAllocator.DEFAULT.buffer(); serializer.serialize(message, serializedBuffer); BufferHelper.checkHeaderV13(serializedBuffer, MESSAGE_TYPE, 40); Assert.assertEquals("Wrong type", MultipartType.OFPMPAGGREGATE.getIntValue(), serializedBuffer.readShort()); Assert.assertEquals("Wrong flags", message.getFlags(), createMultipartRequestFlags(serializedBuffer.readShort())); serializedBuffer.skipBytes(PADDING); MultipartReplyAggregateCase body = (MultipartReplyAggregateCase) message.getMultipartReplyBody(); MultipartReplyAggregate messageOutput = body.getMultipartReplyAggregate(); Assert.assertEquals("Wrong Packet count", messageOutput.getPacketCount().longValue(), serializedBuffer.readLong()); Assert.assertEquals("Wrong Byte count", messageOutput.getByteCount().longValue(), serializedBuffer.readLong()); Assert.assertEquals("Wrong Flow count", messageOutput.getFlowCount().longValue(), serializedBuffer.readInt()); serializedBuffer.skipBytes(4); }
From source file:org.opendaylight.netide.openflowjava.protocol.impl.serialization.factories.MultipartReplyMessageFactoryTest.java
License:Open Source License
@Test public void testFlowSerialize() { builder.setType(MultipartType.forValue(1)); MultipartReplyFlowCaseBuilder flowCase = new MultipartReplyFlowCaseBuilder(); MultipartReplyFlowBuilder flow = new MultipartReplyFlowBuilder(); flow.setFlowStats(createFlowStats()); flowCase.setMultipartReplyFlow(flow.build()); builder.setMultipartReplyBody(flowCase.build()); message = builder.build();/* www.j av a 2 s .co m*/ ByteBuf serializedBuffer = UnpooledByteBufAllocator.DEFAULT.buffer(); serializer.serialize(message, serializedBuffer); BufferHelper.checkHeaderV13(serializedBuffer, MESSAGE_TYPE, 192); Assert.assertEquals("Wrong type", MultipartType.OFPMPFLOW.getIntValue(), serializedBuffer.readShort()); Assert.assertEquals("Wrong flags", message.getFlags(), createMultipartRequestFlags(serializedBuffer.readShort())); serializedBuffer.skipBytes(PADDING); testFlowBody(message.getMultipartReplyBody(), serializedBuffer); }
From source file:org.opendaylight.netide.openflowjava.protocol.impl.serialization.factories.MultipartReplyMessageFactoryTest.java
License:Open Source License
private static void testFlowBody(MultipartReplyBody body, ByteBuf output) { MultipartReplyFlowCase flowCase = (MultipartReplyFlowCase) body; MultipartReplyFlow flow = flowCase.getMultipartReplyFlow(); FlowStats flowStats = flow.getFlowStats().get(0); Assert.assertEquals("Wrong length", 176, output.readShort()); Assert.assertEquals("Wrong Table ID", flowStats.getTableId().intValue(), output.readUnsignedByte()); output.skipBytes(1); Assert.assertEquals("Wrong duration sec", flowStats.getDurationSec().intValue(), output.readInt()); Assert.assertEquals("Wrong duration nsec", flowStats.getDurationNsec().intValue(), output.readInt()); Assert.assertEquals("Wrong priority", flowStats.getPriority().intValue(), output.readShort()); Assert.assertEquals("Wrong idle timeout", flowStats.getIdleTimeout().intValue(), output.readShort()); Assert.assertEquals("Wrong hard timeout", flowStats.getHardTimeout().intValue(), output.readShort()); output.skipBytes(6);/*from www . java2 s . c o m*/ Assert.assertEquals("Wrong cookie", flowStats.getCookie().longValue(), output.readLong()); Assert.assertEquals("Wrong Packet count", flowStats.getPacketCount().longValue(), output.readLong()); Assert.assertEquals("Wrong Byte count", flowStats.getByteCount().longValue(), output.readLong()); Assert.assertEquals("Wrong match type", 1, output.readUnsignedShort()); output.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES); Assert.assertEquals("Wrong oxm class", 0x8000, output.readUnsignedShort()); short fieldAndMask = output.readUnsignedByte(); Assert.assertEquals("Wrong oxm hasMask", 0, fieldAndMask & 1); Assert.assertEquals("Wrong oxm field", 1, fieldAndMask >> 1); output.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES); Assert.assertEquals("Wrong oxm value", 42, output.readUnsignedInt()); Assert.assertEquals("Wrong oxm class", 0x8000, output.readUnsignedShort()); fieldAndMask = output.readUnsignedByte(); Assert.assertEquals("Wrong oxm hasMask", 0, fieldAndMask & 1); Assert.assertEquals("Wrong oxm field", 9, fieldAndMask >> 1); output.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES); Assert.assertEquals("Wrong oxm value", 4, output.readUnsignedByte()); output.skipBytes(7); Assert.assertEquals("Wrong instruction type", 1, output.readUnsignedShort()); Assert.assertEquals("Wrong instruction length", 8, output.readUnsignedShort()); Assert.assertEquals("Wrong instruction table-id", 5, output.readUnsignedByte()); output.skipBytes(3); Assert.assertEquals("Wrong instruction type", 2, output.readUnsignedShort()); Assert.assertEquals("Wrong instruction length", 24, output.readUnsignedShort()); output.skipBytes(4); byte[] actual = new byte[8]; output.readBytes(actual); Assert.assertEquals("Wrong instruction metadata", "00 01 02 03 04 05 06 07", ByteBufUtils.bytesToHexString(actual)); actual = new byte[8]; output.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, output.readUnsignedShort()); Assert.assertEquals("Wrong instruction length", 8, output.readUnsignedShort()); output.skipBytes(4); Assert.assertEquals("Wrong instruction type", 6, output.readUnsignedShort()); Assert.assertEquals("Wrong instruction length", 8, output.readUnsignedShort()); Assert.assertEquals("Wrong instruction meter-id", 42, output.readUnsignedInt()); Assert.assertEquals("Wrong instruction type", 3, output.readUnsignedShort()); Assert.assertEquals("Wrong instruction length", 32, output.readUnsignedShort()); output.skipBytes(4); Assert.assertEquals("Wrong action type", 0, output.readUnsignedShort()); Assert.assertEquals("Wrong action length", 16, output.readUnsignedShort()); Assert.assertEquals("Wrong action type", 45, output.readUnsignedInt()); Assert.assertEquals("Wrong action type", 55, output.readUnsignedShort()); output.skipBytes(6); Assert.assertEquals("Wrong action type", 23, output.readUnsignedShort()); Assert.assertEquals("Wrong action length", 8, output.readUnsignedShort()); Assert.assertEquals("Wrong action type", 64, output.readUnsignedByte()); output.skipBytes(3); Assert.assertEquals("Wrong instruction type", 4, output.readUnsignedShort()); Assert.assertEquals("Wrong instruction length", 24, output.readUnsignedShort()); output.skipBytes(4); Assert.assertEquals("Wrong action type", 17, output.readUnsignedShort()); Assert.assertEquals("Wrong action length", 8, output.readUnsignedShort()); Assert.assertEquals("Wrong action ethertype", 14, output.readUnsignedShort()); output.skipBytes(2); Assert.assertEquals("Wrong action type", 27, output.readUnsignedShort()); Assert.assertEquals("Wrong action length", 8, output.readUnsignedShort()); output.skipBytes(4); Assert.assertTrue("Not all data were read", output.readableBytes() == 0); }