X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=openflow-protocol-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fopenflowjava%2Fprotocol%2Fimpl%2Fserialization%2Ffactories%2FMultipartRequestInputFactory.java;h=7afb253b4bc50d524d9faa4b59427d34c5f5cd96;hb=5f5622e79402f70a944fa93fd7ee2d84d1776b08;hp=0fdeff1cdc19b5f4341964cb42ff1b3def8beea2;hpb=f9f2b07fad8b5ed6180445a9ff7997ecaffe8cf3;p=openflowjava.git diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/MultipartRequestInputFactory.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/MultipartRequestInputFactory.java index 0fdeff1c..7afb253b 100644 --- a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/MultipartRequestInputFactory.java +++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/factories/MultipartRequestInputFactory.java @@ -10,30 +10,32 @@ package org.opendaylight.openflowjava.protocol.impl.serialization.factories; import io.netty.buffer.ByteBuf; -import java.util.HashMap; import java.util.List; -import java.util.Map; - -import org.opendaylight.openflowjava.protocol.impl.serialization.OFSerializer; -import org.opendaylight.openflowjava.protocol.impl.util.ActionsSerializer; -import org.opendaylight.openflowjava.protocol.impl.util.ByteBufUtils; -import org.opendaylight.openflowjava.protocol.impl.util.EncodeConstants; -import org.opendaylight.openflowjava.protocol.impl.util.InstructionsSerializer; -import org.opendaylight.openflowjava.protocol.impl.util.MatchSerializer; -import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionRelatedTableFeatureProperty; -import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterRelatedTableFeatureProperty; -import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.InstructionRelatedTableFeatureProperty; -import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NextTableRelatedTableFeatureProperty; -import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.OxmRelatedTableFeatureProperty; -import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.table.features.properties.container.table.feature.properties.NextTableIds; -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.instruction.rev130731.Experimenter; + +import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer; +import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry; +import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistryInjector; +import org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey; +import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants; +import org.opendaylight.openflowjava.protocol.impl.util.ListSerializer; +import org.opendaylight.openflowjava.protocol.impl.util.TypeKeyMaker; +import org.opendaylight.openflowjava.protocol.impl.util.TypeKeyMakerFactory; +import org.opendaylight.openflowjava.util.ByteBufUtils; +import org.opendaylight.openflowjava.util.ExperimenterSerializerKeyFactory; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.ActionRelatedTableFeatureProperty; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.ExperimenterIdMultipartRequest; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.ExperimenterIdTableFeatureProperty; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.InstructionRelatedTableFeatureProperty; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.NextTableRelatedTableFeatureProperty; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.OxmRelatedTableFeatureProperty; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.table.features.properties.container.table.feature.properties.NextTableIds; +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.instruction.rev130731.instructions.grouping.Instruction; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags; -import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableConfig; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableFeaturesPropType; -import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries; +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.grouping.Match; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.MultipartRequestBody; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestAggregateCase; @@ -68,12 +70,9 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731 * @author timotej.kubas * @author michal.polkorab */ -public class MultipartRequestInputFactory implements OFSerializer { +public class MultipartRequestInputFactory implements OFSerializer, SerializerRegistryInjector { private static final byte MESSAGE_TYPE = 18; - private static final int MESSAGE_LENGTH = 16; private static final byte PADDING_IN_MULTIPART_REQUEST_MESSAGE = 4; - private static final byte TABLE_FEAT_HEADER_LENGTH = 4; - private static MultipartRequestInputFactory instance; private static final byte INSTRUCTIONS_CODE = 0; private static final byte INSTRUCTIONS_MISS_CODE = 1; private static final byte NEXT_TABLE_CODE = 2; @@ -88,18 +87,6 @@ public class MultipartRequestInputFactory implements OFSerializer tableFeatures = body.getTableFeatures(); - for (TableFeatures feature : tableFeatures) { - length += computeSingleTableFeatureLength(feature); - } - } - return length; - } - - private static int computeSingleTableFeatureLength(TableFeatures feature) { - return TABLE_FEATURES_LENGTH + computeTableFeatPropsLength(feature); - } - - private static int computeTableFeatPropsLength(TableFeatures feature) { - int length = 0; - List featureProperties = feature.getTableFeatureProperties(); - if (featureProperties != null) { - for (TableFeatureProperties featProp : featureProperties) { - length += TABLE_FEAT_HEADER_LENGTH; - if (featProp.getAugmentation(InstructionRelatedTableFeatureProperty.class) != null) { - InstructionRelatedTableFeatureProperty property = - featProp.getAugmentation(InstructionRelatedTableFeatureProperty.class); - length += property.getInstruction().size() * STRUCTURE_HEADER_LENGTH; - length += paddingNeeded(length); - } else if (featProp.getAugmentation(NextTableRelatedTableFeatureProperty.class) != null) { - NextTableRelatedTableFeatureProperty property = - featProp.getAugmentation(NextTableRelatedTableFeatureProperty.class); - length += property.getNextTableIds().size(); - length += paddingNeeded(length); - } else if (featProp.getAugmentation(ActionRelatedTableFeatureProperty.class) != null) { - ActionRelatedTableFeatureProperty property = - featProp.getAugmentation(ActionRelatedTableFeatureProperty.class); - length += property.getAction().size() * STRUCTURE_HEADER_LENGTH; - length += paddingNeeded(length); - } else if (featProp.getAugmentation(OxmRelatedTableFeatureProperty.class) != null) { - OxmRelatedTableFeatureProperty property = - featProp.getAugmentation(OxmRelatedTableFeatureProperty.class); - length += property.getMatchEntries().size() * STRUCTURE_HEADER_LENGTH; - length += paddingNeeded(length); - } else if (featProp.getAugmentation(ExperimenterRelatedTableFeatureProperty.class) != null) { - ExperimenterRelatedTableFeatureProperty property = - featProp.getAugmentation(ExperimenterRelatedTableFeatureProperty.class); - length += 2 * (EncodeConstants.SIZE_OF_INT_IN_BYTES); - if (property.getData() != null) { - length += property.getData().length; - } - length += paddingNeeded(length); - } - } - } - return length; + private void serializeExperimenterBody(final MultipartRequestInput message, + final ByteBuf outBuffer) { + MultipartRequestExperimenterCase expCase = + (MultipartRequestExperimenterCase) message.getMultipartRequestBody(); + MultipartRequestExperimenter experimenter = expCase.getMultipartRequestExperimenter(); + long expId = experimenter.getAugmentation(ExperimenterIdMultipartRequest.class).getExperimenter().getValue(); + OFSerializer serializer = registry.getSerializer( + ExperimenterSerializerKeyFactory.createMultipartRequestSerializerKey( + EncodeConstants.OF13_VERSION_ID, expId)); + serializer.serialize(expCase, outBuffer); } - - - private static int createMultipartRequestFlagsBitmask(MultipartRequestFlags flags) { - int multipartRequestFlagsBitmask = 0; - Map multipartRequestFlagsMap = new HashMap<>(); - multipartRequestFlagsMap.put(0, flags.isOFPMPFREQMORE()); - - multipartRequestFlagsBitmask = ByteBufUtils.fillBitMaskFromMap(multipartRequestFlagsMap); - return multipartRequestFlagsBitmask; + private static int createMultipartRequestFlagsBitmask(final MultipartRequestFlags flags) { + return ByteBufUtils.fillBitMask(0, flags.isOFPMPFREQMORE()); } /** * @param multipartRequestBody * @param output */ - private void encodeDescBody(MultipartRequestBody multipartRequestBody, - ByteBuf output) { + private void serializeDescBody() { // The body of MultiPartRequestDesc is empty } @@ -296,8 +167,7 @@ public class MultipartRequestInputFactory implements OFSerializer serializer = registry.getSerializer(new MessageTypeKey<>( + EncodeConstants.OF13_VERSION_ID, Match.class)); + serializer.serialize(flow.getMatch(), output); } - private static void encodeAggregateBody(MultipartRequestBody multipartRequestBody, ByteBuf output) { + private void serializeAggregateBody(final MultipartRequestBody multipartRequestBody, final ByteBuf output) { MultipartRequestAggregateCase aggregateCase = (MultipartRequestAggregateCase) multipartRequestBody; MultipartRequestAggregate aggregate = aggregateCase.getMultipartRequestAggregate(); output.writeByte(aggregate.getTableId().byteValue()); - ByteBufUtils.padBuffer(PADDING_IN_MULTIPART_REQUEST_AGREGGATE_BODY_01, output); + output.writeZero(PADDING_IN_MULTIPART_REQUEST_AGREGGATE_BODY_01); output.writeInt(aggregate.getOutPort().intValue()); output.writeInt(aggregate.getOutGroup().intValue()); - ByteBufUtils.padBuffer(PADDING_IN_MULTIPART_REQUEST_AGREGGATE_BODY_02, output); + output.writeZero(PADDING_IN_MULTIPART_REQUEST_AGREGGATE_BODY_02); output.writeLong(aggregate.getCookie().longValue()); output.writeLong(aggregate.getCookieMask().longValue()); - MatchSerializer.encodeMatch(aggregate.getMatch(), output); + OFSerializer serializer = registry.getSerializer(new MessageTypeKey<>( + EncodeConstants.OF13_VERSION_ID, Match.class)); + serializer.serialize(aggregate.getMatch(), output); } - private static void encodePortStatsBody(MultipartRequestBody multipartRequestBody, ByteBuf output) { + private static void serializePortStatsBody(final MultipartRequestBody multipartRequestBody, final ByteBuf output) { MultipartRequestPortStatsCase portstatsCase = (MultipartRequestPortStatsCase) multipartRequestBody; MultipartRequestPortStats portstats = portstatsCase.getMultipartRequestPortStats(); output.writeInt(portstats.getPortNo().intValue()); - ByteBufUtils.padBuffer(PADDING_IN_MULTIPART_REQUEST_PORTSTATS_BODY, output); + output.writeZero(PADDING_IN_MULTIPART_REQUEST_PORTSTATS_BODY); } - private static void encodeQueueBody(MultipartRequestBody multipartRequestBody, ByteBuf output) { + private static void serializeQueueBody(final MultipartRequestBody multipartRequestBody, final ByteBuf output) { MultipartRequestQueueCase queueCase = (MultipartRequestQueueCase) multipartRequestBody; MultipartRequestQueue queue = queueCase.getMultipartRequestQueue(); output.writeInt(queue.getPortNo().intValue()); output.writeInt(queue.getQueueId().intValue()); } - private static void encodeGroupStatsBody(MultipartRequestBody multipartRequestBody, ByteBuf output) { + private static void serializeeGroupStatsBody(final MultipartRequestBody multipartRequestBody, final ByteBuf output) { MultipartRequestGroupCase groupStatsCase = (MultipartRequestGroupCase) multipartRequestBody; MultipartRequestGroup groupStats = groupStatsCase.getMultipartRequestGroup(); output.writeInt(groupStats.getGroupId().getValue().intValue()); - ByteBufUtils.padBuffer(PADDING_IN_MULTIPART_REQUEST_GROUP_BODY, output); + output.writeZero(PADDING_IN_MULTIPART_REQUEST_GROUP_BODY); } - private static void encodeMeterBody(MultipartRequestBody multipartRequestBody, ByteBuf output) { + private static void serializeMeterBody(final MultipartRequestBody multipartRequestBody, final ByteBuf output) { MultipartRequestMeterCase meterCase = (MultipartRequestMeterCase) multipartRequestBody; MultipartRequestMeter meter = meterCase.getMultipartRequestMeter(); output.writeInt(meter.getMeterId().getValue().intValue()); - ByteBufUtils.padBuffer(PADDING_IN_MULTIPART_REQUEST_METER_BODY, output); + output.writeZero(PADDING_IN_MULTIPART_REQUEST_METER_BODY); } - private static void encodeMeterConfigBody(MultipartRequestBody multipartRequestBody, ByteBuf output) { + private static void serializeMeterConfigBody(final MultipartRequestBody multipartRequestBody, final ByteBuf output) { MultipartRequestMeterConfigCase meterConfigCase = (MultipartRequestMeterConfigCase) multipartRequestBody; MultipartRequestMeterConfig meterConfig = meterConfigCase.getMultipartRequestMeterConfig(); output.writeInt(meterConfig.getMeterId().getValue().intValue()); - ByteBufUtils.padBuffer(PADDING_IN_MULTIPART_REQUEST_METER_CONFIG_BODY, output); - } - - private static void encodeExperimenterBody(MultipartRequestBody multipartRequestBody, ByteBuf output) { - MultipartRequestExperimenterCase experimenterCase = (MultipartRequestExperimenterCase) multipartRequestBody; - MultipartRequestExperimenter experimenter = experimenterCase.getMultipartRequestExperimenter(); - output.writeInt(experimenter.getExperimenter().intValue()); - output.writeInt(experimenter.getExpType().intValue()); - byte[] data = experimenter.getData(); - if (data != null) { - output.writeBytes(data); - } + output.writeZero(PADDING_IN_MULTIPART_REQUEST_METER_CONFIG_BODY); } - private static void encodeTableFeaturesBody(MultipartRequestBody multipartRequestBody, ByteBuf output) { + private void serializeTableFeaturesBody(final MultipartRequestBody multipartRequestBody, final ByteBuf output) { if (multipartRequestBody != null) { MultipartRequestTableFeaturesCase tableFeaturesCase = (MultipartRequestTableFeaturesCase) multipartRequestBody; MultipartRequestTableFeatures tableFeatures = tableFeaturesCase.getMultipartRequestTableFeatures(); if(tableFeatures.getTableFeatures() != null) { for (TableFeatures currTableFeature : tableFeatures.getTableFeatures()) { - int length = computeSingleTableFeatureLength(currTableFeature); - length += paddingNeeded(length); - output.writeShort(length); + int tableFeatureLengthIndex = output.writerIndex(); + output.writeShort(EncodeConstants.EMPTY_LENGTH); output.writeByte(currTableFeature.getTableId()); - ByteBufUtils.padBuffer(PADDING_IN_MULTIPART_REQUEST_TABLE_FEATURES_BODY, output); + output.writeZero(PADDING_IN_MULTIPART_REQUEST_TABLE_FEATURES_BODY); output.writeBytes(currTableFeature.getName().getBytes()); - ByteBufUtils.padBuffer((32 - currTableFeature.getName().getBytes().length), output); + output.writeZero(32 - currTableFeature.getName().getBytes().length); output.writeLong(currTableFeature.getMetadataMatch().longValue()); output.writeLong(currTableFeature.getMetadataWrite().longValue()); output.writeInt(createTableConfigBitmask(currTableFeature.getConfig())); output.writeInt(currTableFeature.getMaxEntries().intValue()); writeTableFeatureProperties(output, currTableFeature.getTableFeatureProperties()); + output.setShort(tableFeatureLengthIndex, output.writerIndex() - tableFeatureLengthIndex); } } } } - private static void writeTableFeatureProperties(ByteBuf output, List props) { + private void writeTableFeatureProperties(final ByteBuf output, final List props) { if (props != null) { for (TableFeatureProperties property : props) { TableFeaturesPropType type = property.getType(); @@ -465,61 +324,51 @@ public class MultipartRequestInputFactory implements OFSerializer instructions = property. getAugmentation(InstructionRelatedTableFeatureProperty.class).getInstruction(); - int length = TABLE_FEAT_HEADER_LENGTH; - int padding = 0; if (instructions != null) { - for (Instruction instruction : instructions) { - if (instruction.getType().isAssignableFrom(Experimenter.class)) { - length += EncodeConstants.EXPERIMENTER_IDS_LENGTH; - } else { - length += STRUCTURE_HEADER_LENGTH; - } - } - padding = paddingNeeded(length); - output.writeShort(length); - InstructionsSerializer.encodeInstructionIds(instructions, output); - } else { - padding = paddingNeeded(length); - output.writeShort(length); + TypeKeyMaker keyMaker = TypeKeyMakerFactory + .createInstructionKeyMaker(EncodeConstants.OF13_VERSION_ID); + ListSerializer.serializeHeaderList(instructions, keyMaker, registry, output); } - ByteBufUtils.padBuffer(padding, output); + int length = output.writerIndex() - startIndex; + output.setShort(lengthIndex, length); + output.writeZero(paddingNeeded(length)); } - private static void writeNextTableRelatedTableProperty(ByteBuf output, - TableFeatureProperties property, byte code) { + private static void writeNextTableRelatedTableProperty(final ByteBuf output, + final TableFeatureProperties property, final byte code) { + int startIndex = output.writerIndex(); output.writeShort(code); + int lengthIndex = output.writerIndex(); + output.writeShort(EncodeConstants.EMPTY_LENGTH); List nextTableIds = property. getAugmentation(NextTableRelatedTableFeatureProperty.class).getNextTableIds(); - int length = TABLE_FEAT_HEADER_LENGTH; - int padding = 0; if (nextTableIds != null) { - length += nextTableIds.size(); - padding = paddingNeeded(length); - output.writeShort(length); for (NextTableIds next : nextTableIds) { output.writeByte(next.getTableId()); } - } else { - padding = paddingNeeded(length); - output.writeShort(length + padding); } - ByteBufUtils.padBuffer(padding, output); + int length = output.writerIndex() - startIndex; + output.setShort(lengthIndex, length); + output.writeZero(paddingNeeded(length)); } - private static int paddingNeeded(int length) { + private static int paddingNeeded(final int length) { int paddingRemainder = length % EncodeConstants.PADDING; int result = 0; if (paddingRemainder != 0) { @@ -528,81 +377,57 @@ public class MultipartRequestInputFactory implements OFSerializer actions = property. getAugmentation(ActionRelatedTableFeatureProperty.class).getAction(); - int length = TABLE_FEAT_HEADER_LENGTH; - int padding = 0; if (actions != null) { - for (Action action : actions) { - if (action.getType().isAssignableFrom(Experimenter.class)) { - length += EncodeConstants.EXPERIMENTER_IDS_LENGTH; - } else { - length += STRUCTURE_HEADER_LENGTH; - } - } - length += actions.size() * STRUCTURE_HEADER_LENGTH; - padding += paddingNeeded(length); - output.writeShort(length); - ActionsSerializer.encodeActionIds(actions, output); - } else { - padding = paddingNeeded(length); - output.writeShort(length); + TypeKeyMaker keyMaker = TypeKeyMakerFactory + .createActionKeyMaker(EncodeConstants.OF13_VERSION_ID); + ListSerializer.serializeHeaderList(actions, keyMaker, registry, output); } - ByteBufUtils.padBuffer(padding, output); + int length = output.writerIndex() - startIndex; + output.setShort(lengthIndex, length); + output.writeZero(paddingNeeded(length)); } - private static void writeOxmRelatedTableProperty(ByteBuf output, - TableFeatureProperties property, byte code) { + private void writeOxmRelatedTableProperty(final ByteBuf output, + final TableFeatureProperties property, final byte code) { + int startIndex = output.writerIndex(); output.writeShort(code); - List entries = property. - getAugmentation(OxmRelatedTableFeatureProperty.class).getMatchEntries(); - int length = TABLE_FEAT_HEADER_LENGTH; - int padding = 0; + int lengthIndex = output.writerIndex(); + output.writeShort(EncodeConstants.EMPTY_LENGTH); + List entries = property. + getAugmentation(OxmRelatedTableFeatureProperty.class).getMatchEntry(); if (entries != null) { - // experimenter length / definition ? - length += entries.size() * STRUCTURE_HEADER_LENGTH; - padding = paddingNeeded(length); - output.writeShort(length); - MatchSerializer.encodeMatchIds(entries, output); - } else { - padding = paddingNeeded(length); - output.writeShort(length); + TypeKeyMaker keyMaker = TypeKeyMakerFactory + .createMatchEntriesKeyMaker(EncodeConstants.OF13_VERSION_ID); + ListSerializer.serializeHeaderList(entries, keyMaker, registry, output); } - ByteBufUtils.padBuffer(padding, output); + int length = output.writerIndex() - startIndex; + output.setShort(lengthIndex, length); + output.writeZero(paddingNeeded(length)); } - private static void writeExperimenterRelatedTableProperty(ByteBuf output, - TableFeatureProperties property, int code) { - output.writeShort(code); - ExperimenterRelatedTableFeatureProperty exp = property. - getAugmentation(ExperimenterRelatedTableFeatureProperty.class); - byte[] data = exp.getData(); - int length = TABLE_FEAT_HEADER_LENGTH + 2 * (EncodeConstants.SIZE_OF_INT_IN_BYTES); - int padding = 0; - if (data != null) { - output.writeShort(length + data.length); - padding = paddingNeeded(length + data.length); - output.writeInt(exp.getExperimenter().intValue()); - output.writeInt(exp.getExpType().intValue()); - output.writeBytes(data); - } else { - output.writeShort(length); - padding = paddingNeeded(length); - output.writeInt(exp.getExperimenter().intValue()); - output.writeInt(exp.getExpType().intValue()); - } - ByteBufUtils.padBuffer(padding, output); + private void writeExperimenterRelatedTableProperty(final ByteBuf output, + final TableFeatureProperties property) { + long expId = property.getAugmentation(ExperimenterIdTableFeatureProperty.class).getExperimenter().getValue(); + OFSerializer serializer = registry.getSerializer( + ExperimenterSerializerKeyFactory.createMultipartRequestTFSerializerKey( + EncodeConstants.OF13_VERSION_ID, expId)); + serializer.serialize(property, output); } - private static int createTableConfigBitmask(TableConfig tableConfig) { - int tableConfigBitmask = 0; - Map tableConfigMap = new HashMap<>(); - tableConfigMap.put(3, tableConfig.isOFPTCDEPRECATEDMASK()); + private static int createTableConfigBitmask(final TableConfig tableConfig) { + return ByteBufUtils.fillBitMask(3, tableConfig.isOFPTCDEPRECATEDMASK()); + } - tableConfigBitmask = ByteBufUtils.fillBitMaskFromMap(tableConfigMap); - return tableConfigBitmask; + @Override + public void injectSerializerRegistry(final SerializerRegistry serializerRegistry) { + this.registry = serializerRegistry; } }