@Test public void testSerialize() { GetFeaturesOutputFactory serializer = new GetFeaturesOutputFactory(); SerializerRegistry registry = new NetIdeSerializerRegistryImpl(); registry.init(); serializer.injectSerializerRegistry(registry); ByteBuf serializedBuffer = UnpooledByteBufAllocator.DEFAULT.buffer(); serializer.serialize(message, serializedBuffer); BufferHelper.checkHeaderV13(serializedBuffer, MESSAGE_TYPE, 32); Assert.assertEquals("Wrong DatapathId", message.getDatapathId().longValue(), serializedBuffer.readLong()); Assert.assertEquals("Wrong Buffer ID", message.getBuffers().longValue(), serializedBuffer.readInt()); Assert.assertEquals("Wrong tables", message.getTables().shortValue(), serializedBuffer.readUnsignedByte()); Assert.assertEquals("Wrong auxiliary ID", message.getAuxiliaryId().shortValue(), serializedBuffer.readUnsignedByte()); serializedBuffer.skipBytes(PADDING); Assert.assertEquals("Wrong Capabilities", message.getCapabilities(), createCapabilities(serializedBuffer.readInt())); Assert.assertEquals("Wrong reserved", message.getReserved().longValue(), serializedBuffer.readInt()); }
@Override public void serialize(GetFeaturesOutput message, ByteBuf outBuffer) { ByteBufUtils.writeOFHeader(MESSAGE_TYPE, message, outBuffer, EncodeConstants.EMPTY_LENGTH); outBuffer.writeLong(message.getDatapathId().longValue()); outBuffer.writeInt(message.getBuffers().intValue()); outBuffer.writeByte(message.getTables().intValue()); outBuffer.writeByte(message.getAuxiliaryId().intValue()); outBuffer.writeZero(PADDING); writeCapabilities(message.getCapabilities(), outBuffer); outBuffer.writeInt(message.getReserved().intValue()); ByteBufUtils.updateOFHeaderLength(outBuffer); }
GetFeaturesOutputFactory implements OFSerializer<GetFeaturesOutput>, SerializerRegistryInjector { @Override public void serialize(GetFeaturesOutput message, ByteBuf outBuffer) { ByteBufUtils.writeOFHeader(MESSAGE_TYPE, message, outBuffer, EncodeConstants.EMPTY_LENGTH); outBuffer.writeLong(message.getDatapathId().longValue()); outBuffer.writeInt(message.getBuffers().intValue()); outBuffer.writeByte(message.getTables().intValue()); outBuffer.writeByte(message.getAuxiliaryId().intValue()); outBuffer.writeZero(PADDING); writeCapabilities(message.getCapabilities(), outBuffer); outBuffer.writeInt(message.getReserved().intValue()); ByteBufUtils.updateOFHeaderLength(outBuffer); } }
GetFeaturesOutputFactory implements OFSerializer<GetFeaturesOutput>, SerializerRegistryInjector { @Override public void serialize(GetFeaturesOutput message, ByteBuf outBuffer) { ByteBufUtils.writeOFHeader(MESSAGE_TYPE, message, outBuffer, EncodeConstants.EMPTY_LENGTH); outBuffer.writeLong(message.getDatapathId().longValue()); outBuffer.writeInt(message.getBuffers().intValue()); outBuffer.writeByte(message.getTables().intValue()); outBuffer.writeByte(message.getAuxiliaryId().intValue()); outBuffer.writeZero(PADDING); writeCapabilities(message.getCapabilities(), outBuffer); outBuffer.writeInt(message.getReserved().intValue()); ByteBufUtils.updateOFHeaderLength(outBuffer); }  }
GetFeaturesOutputFactory implements OFSerializer<GetFeaturesOutput>, SerializerRegistryInjector { @Override public void serialize(GetFeaturesOutput message, ByteBuf outBuffer) { ByteBufUtils.writeOFHeader(MESSAGE_TYPE, message, outBuffer, EncodeConstants.EMPTY_LENGTH); outBuffer.writeLong(message.getDatapathId().longValue()); outBuffer.writeInt(message.getBuffers().intValue()); outBuffer.writeByte(message.getTables().intValue()); outBuffer.writeByte(message.getAuxiliaryId().intValue()); outBuffer.writeZero(PADDING); writeCapabilities(message.getCapabilities(), outBuffer); outBuffer.writeInt(message.getReserved().intValue()); ByteBufUtils.updateOFHeaderLength(outBuffer); }  @Override void serialize(GetFeaturesOutput message, ByteBuf outBuffer); @Override void injectSerializerRegistry(final SerializerRegistry serializerRegistry); }
GetFeaturesOutputFactory implements OFSerializer<GetFeaturesOutput>, SerializerRegistryInjector { @Override public void serialize(GetFeaturesOutput message, ByteBuf outBuffer) { ByteBufUtils.writeOFHeader(MESSAGE_TYPE, message, outBuffer, EncodeConstants.EMPTY_LENGTH); outBuffer.writeLong(message.getDatapathId().longValue()); outBuffer.writeInt(message.getBuffers().intValue()); outBuffer.writeByte(message.getTables().intValue()); outBuffer.writeByte(message.getAuxiliaryId().intValue()); outBuffer.writeZero(PADDING); writeCapabilities(message.getCapabilities(), outBuffer); outBuffer.writeInt(message.getReserved().intValue()); ByteBufUtils.updateOFHeaderLength(outBuffer); }  @Override void serialize(GetFeaturesOutput message, ByteBuf outBuffer); @Override void injectSerializerRegistry(final SerializerRegistry serializerRegistry);  }