X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=openflow-protocol-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fopenflowjava%2Fprotocol%2Fimpl%2Fdeserialization%2Ffactories%2FMultipartReplyMessageFactory.java;h=4074339a535908eb0daa07eebbaa9a19a48669c1;hb=05bc9fb5cb06c747be728f8d695d2723db911514;hp=002e979e16498766c3f5b80474d5aeae01310f04;hpb=1af28ce842ef5a96ad1293c8db0a6cb494c1fbdc;p=openflowjava.git diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/MultipartReplyMessageFactory.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/MultipartReplyMessageFactory.java index 002e979e..4074339a 100644 --- a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/MultipartReplyMessageFactory.java +++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/factories/MultipartReplyMessageFactory.java @@ -16,17 +16,16 @@ import java.util.List; import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry; import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistryInjector; -import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderDeserializer; import org.opendaylight.openflowjava.protocol.api.extensibility.MessageCodeKey; import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer; -import org.opendaylight.openflowjava.protocol.impl.util.ByteBufUtils; -import org.opendaylight.openflowjava.protocol.impl.util.DecodingUtils; -import org.opendaylight.openflowjava.protocol.impl.util.EncodeConstants; +import org.opendaylight.openflowjava.util.ByteBufUtils; +import org.opendaylight.openflowjava.protocol.impl.util.CodeKeyMaker; +import org.opendaylight.openflowjava.protocol.impl.util.CodeKeyMakerFactory; +import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants; +import org.opendaylight.openflowjava.protocol.impl.util.ListDeserializer; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionRelatedTableFeatureProperty; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ActionRelatedTableFeaturePropertyBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterRelatedTableFeatureProperty; -import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterRelatedTableFeaturePropertyBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.InstructionRelatedTableFeatureProperty; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.InstructionRelatedTableFeaturePropertyBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.NextTableRelatedTableFeatureProperty; @@ -56,6 +55,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev13 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.match.grouping.Match; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessage; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessageBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.buckets.grouping.BucketsList; @@ -284,10 +284,10 @@ public class MultipartReplyMessageFactory implements OFDeserializer matchDeserializer = registry.getDeserializer(new MessageCodeKey( EncodeConstants.OF13_VERSION_ID, EncodeConstants.EMPTY_VALUE, Match.class)); flowStatsBuilder.setMatch(matchDeserializer.deserialize(subInput)); - OFDeserializer insDeserializer = registry.getDeserializer(new MessageCodeKey( - EncodeConstants.OF13_VERSION_ID, EncodeConstants.EMPTY_VALUE, Instruction.class)); - List instructions = DecodingUtils.deserializeList( - subInput.readableBytes(), subInput, insDeserializer); + CodeKeyMaker keyMaker = CodeKeyMakerFactory + .createInstructionsKeyMaker(EncodeConstants.OF13_VERSION_ID); + List instructions = ListDeserializer.deserializeList( + EncodeConstants.OF13_VERSION_ID, subInput.readableBytes(), subInput, keyMaker, registry); flowStatsBuilder.setInstruction(instructions); flowStatsList.add(flowStatsBuilder.build()); } @@ -387,10 +387,9 @@ public class MultipartReplyMessageFactory implements OFDeserializer insDeserializer = registry.getDeserializer(new MessageCodeKey( - EncodeConstants.OF13_VERSION_ID, EncodeConstants.EMPTY_VALUE, Instruction.class)); - List instructions = DecodingUtils.deserializeHeaders( - propertyLength - COMMON_PROPERTY_LENGTH, input, insDeserializer); + CodeKeyMaker keyMaker = CodeKeyMakerFactory.createInstructionsKeyMaker(EncodeConstants.OF13_VERSION_ID); + List instructions = ListDeserializer.deserializeHeaders(EncodeConstants.OF13_VERSION_ID, + propertyLength - COMMON_PROPERTY_LENGTH, input, keyMaker, registry); insBuilder.setInstruction(instructions); builder.addAugmentation(InstructionRelatedTableFeatureProperty.class, insBuilder.build()); } else if (type.equals(TableFeaturesPropType.OFPTFPTNEXTTABLES) @@ -411,10 +410,9 @@ public class MultipartReplyMessageFactory implements OFDeserializer deserializer = registry.getDeserializer(new MessageCodeKey( - EncodeConstants.OF13_VERSION_ID, EncodeConstants.EMPTY_VALUE, Action.class)); - List actions = DecodingUtils.deserializeHeaders( - propertyLength - COMMON_PROPERTY_LENGTH, input, deserializer); + CodeKeyMaker keyMaker = CodeKeyMakerFactory.createActionsKeyMaker(EncodeConstants.OF13_VERSION_ID); + List actions = ListDeserializer.deserializeHeaders(EncodeConstants.OF13_VERSION_ID, + propertyLength - COMMON_PROPERTY_LENGTH, input, keyMaker, registry); actionBuilder.setAction(actions); builder.addAugmentation(ActionRelatedTableFeatureProperty.class, actionBuilder.build()); } else if (type.equals(TableFeaturesPropType.OFPTFPTMATCH) @@ -424,19 +422,23 @@ public class MultipartReplyMessageFactory implements OFDeserializer entries = ListDeserializer.deserializeHeaders(EncodeConstants.OF13_VERSION_ID, + propertyLength - COMMON_PROPERTY_LENGTH, input, keyMaker, registry); + oxmBuilder.setMatchEntries(entries); builder.addAugmentation(OxmRelatedTableFeatureProperty.class, oxmBuilder.build()); } else if (type.equals(TableFeaturesPropType.OFPTFPTEXPERIMENTER) || type.equals(TableFeaturesPropType.OFPTFPTEXPERIMENTERMISS)) { - ExperimenterRelatedTableFeaturePropertyBuilder expBuilder = new ExperimenterRelatedTableFeaturePropertyBuilder(); - expBuilder.setExperimenter(input.readUnsignedInt()); - expBuilder.setExpType(input.readUnsignedInt()); - OFDeserializer propDeserializer = registry.getDeserializer( + // return index to property start, so that the experimenter properties are deserialized + // correctly - as whole ofp_table_feature_prop_experimenter property + input.readerIndex(input.readerIndex() - 2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES); + OFDeserializer propDeserializer = registry.getDeserializer( new MessageCodeKey(EncodeConstants.OF13_VERSION_ID, - type.getIntValue(), ExperimenterRelatedTableFeatureProperty.class)); - ExperimenterRelatedTableFeatureProperty expProp = propDeserializer.deserialize(input); - builder.addAugmentation(ExperimenterRelatedTableFeatureProperty.class, expProp); + type.getIntValue(), TableFeatureProperties.class)); + TableFeatureProperties expProp = propDeserializer.deserialize(input); + properties.add(expProp); + continue; } if (paddingRemainder != 0) { input.skipBytes(EncodeConstants.PADDING - paddingRemainder); @@ -671,14 +673,15 @@ public class MultipartReplyMessageFactory implements OFDeserializer deserializer = registry.getDeserializer(new MessageCodeKey( - EncodeConstants.OF13_VERSION_ID, EncodeConstants.EMPTY_VALUE, Action.class)); - List actionsList = DecodingUtils.deserializeList( - bucketsLength - BUCKETS_HEADER_LENGTH, input, deserializer); - bucketsBuilder.setAction(actionsList); + CodeKeyMaker keyMaker = CodeKeyMakerFactory.createActionsKeyMaker(EncodeConstants.OF13_VERSION_ID); + List actions = ListDeserializer.deserializeList(EncodeConstants.OF13_VERSION_ID, + bucketsLength - BUCKETS_HEADER_LENGTH, input, keyMaker, registry); + bucketsBuilder.setAction(actions); bucketsList.add(bucketsBuilder.build()); actualLength += bucketsLength; }