From: Michal Polkorab Date: Tue, 2 Aug 2016 09:25:28 +0000 (+0200) Subject: Bug 5895 - Support of Ext109 openflow tcp flag matching X-Git-Tag: release/boron~4 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=openflowjava.git;a=commitdiff_plain;h=c1db8b191643be117b28bb82a3a6371d4b23d6e9 Bug 5895 - Support of Ext109 openflow tcp flag matching - added openflow-approved-extensions.yang module - added (de)serializer for TCP flags match entry (ext-109) - also a reference material for adding other approved match entry extensions Change-Id: I042d71e5a8b56f6b6460ef235442568d411533da Signed-off-by: Michal Polkorab Also-By: Anil Vishnoi --- diff --git a/openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/util/OxmMatchConstants.java b/openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/util/OxmMatchConstants.java index 3768f2f5..f4da03ce 100644 --- a/openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/util/OxmMatchConstants.java +++ b/openflow-protocol-api/src/main/java/org/opendaylight/openflowjava/protocol/api/util/OxmMatchConstants.java @@ -115,6 +115,15 @@ public abstract class OxmMatchConstants { /** NXM TCP_Flag value */ public static final int NXM_NX_TCP_FLAG = 34; + /** + * ONF Approved Extensions Constants + */ + + /** ONFOXM_ET_TCP_FLAGS value */ + public static final int ONFOXM_ET_TCP_FLAGS = 42; + /** ONFOXM_ET_TCP_FLAGS Experimenter Id (0x4F4E4600) */ + public static final long ONFOXM_ET_TCP_FLAGS_EXP_ID = 1330529792; + private OxmMatchConstants() { //not called } diff --git a/openflow-protocol-api/src/main/yang/openflow-approved-extensions.yang b/openflow-protocol-api/src/main/yang/openflow-approved-extensions.yang new file mode 100644 index 00000000..d4afa880 --- /dev/null +++ b/openflow-protocol-api/src/main/yang/openflow-approved-extensions.yang @@ -0,0 +1,40 @@ +module openflow-approved-extensions { + namespace "urn:opendaylight:openflow:approved:extensions"; + prefix "ofext"; + + import yang-ext {prefix ext;} + import ietf-inet-types {prefix inet;} + import ietf-yang-types {prefix yang;} + + import openflow-types {prefix oft;} + import openflow-protocol {prefix ofproto;} + import openflow-action {prefix ofaction;} + import openflow-instruction {prefix ofinstruction;} + import openflow-extensible-match {prefix oxm;} + import openflow-augments {prefix aug;} + + revision "2016-08-02" { + description "Openflow approved extensions definition"; + } + + //ONF Approved OpenFlow Extensions + + // Extension 109 - TCP FLAGS + identity tcp_flags { + base oxm:match-field; + description "TCP flags from the TCP header"; + } + + augment "/oxm:oxm-container/oxm:match-entry-value/aug:experimenter-id-case" { + ext:augment-identifier "tcp-flags-container"; + container tcp-flags { + leaf flags { + type uint16; + } + leaf mask { + type binary; + } + } + } + +} \ No newline at end of file diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/MatchEntryDeserializerInitializer.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/MatchEntryDeserializerInitializer.java index 21d9dcb1..dc1bae06 100644 --- a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/MatchEntryDeserializerInitializer.java +++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/MatchEntryDeserializerInitializer.java @@ -49,6 +49,7 @@ import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmUdpS import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmVlanPcpDeserializer; import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmVlanVidDeserializer; import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants; +import org.opendaylight.openflowjava.protocol.impl.deserialization.match.ext.OnfOxmTcpFlagsDeserializer; import org.opendaylight.openflowjava.protocol.impl.util.MatchEntryDeserializerRegistryHelper; import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants; @@ -111,5 +112,9 @@ public final class MatchEntryDeserializerInitializer { helper.register(OxmMatchConstants.PBB_ISID, new OxmPbbIsidDeserializer()); helper.register(OxmMatchConstants.TUNNEL_ID, new OxmTunnelIdDeserializer()); helper.register(OxmMatchConstants.IPV6_EXTHDR, new OxmIpv6ExtHdrDeserializer()); + + // Register approved openflow match entry deserializers + helper.registerExperimenter(OxmMatchConstants.ONFOXM_ET_TCP_FLAGS, OxmMatchConstants.ONFOXM_ET_TCP_FLAGS_EXP_ID, + new OnfOxmTcpFlagsDeserializer()); } } diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/ext/AbstractOxmExperimenterMatchEntryDeserializer.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/ext/AbstractOxmExperimenterMatchEntryDeserializer.java new file mode 100644 index 00000000..e9535d8e --- /dev/null +++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/ext/AbstractOxmExperimenterMatchEntryDeserializer.java @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2016 Brocade Communications Systems, Inc. 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.deserialization.match.ext; + +import io.netty.buffer.ByteBuf; +import org.opendaylight.openflowjava.protocol.impl.deserialization.match.AbstractOxmMatchEntryDeserializer; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.oxm.container.match.entry.value.ExperimenterIdCaseBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.oxm.container.match.entry.value.experimenter.id._case.ExperimenterBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder; + +/** + * Created by Anil Vishnoi (avishnoi@Brocade.com) on 7/26/16. + */ +public abstract class AbstractOxmExperimenterMatchEntryDeserializer extends AbstractOxmMatchEntryDeserializer { + + protected ExperimenterIdCaseBuilder createExperimenterIdCase(MatchEntryBuilder entryBuilder, ByteBuf input) { + ExperimenterIdCaseBuilder expCaseBuilder = new ExperimenterIdCaseBuilder(); + ExperimenterBuilder expBuilder = new ExperimenterBuilder(); + expBuilder.setExperimenter(new ExperimenterId(input.readUnsignedInt())); + expCaseBuilder.setExperimenter(expBuilder.build()); + return expCaseBuilder; + } + +} diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/ext/OnfOxmTcpFlagsDeserializer.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/ext/OnfOxmTcpFlagsDeserializer.java new file mode 100644 index 00000000..e03ed77a --- /dev/null +++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/ext/OnfOxmTcpFlagsDeserializer.java @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2016 Brocade Communications Systems, Inc. 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.deserialization.match.ext; + +import io.netty.buffer.ByteBuf; +import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer; +import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.approved.extensions.rev160802.TcpFlags; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.approved.extensions.rev160802.TcpFlagsContainer; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.approved.extensions.rev160802.TcpFlagsContainerBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.approved.extensions.rev160802.oxm.container.match.entry.value.experimenter.id._case.TcpFlagsBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.oxm.container.match.entry.value.ExperimenterIdCaseBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.ExperimenterClass; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.MatchField; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OxmClassBase; +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.entries.grouping.MatchEntryBuilder; + +/** + * Created by Anil Vishnoi (avishnoi@Brocade.com) on 7/26/16. + */ +public class OnfOxmTcpFlagsDeserializer extends AbstractOxmExperimenterMatchEntryDeserializer + implements OFDeserializer { + + @Override + public MatchEntry deserialize(ByteBuf input) { + MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder(deserializeHeader(input)); + ExperimenterIdCaseBuilder expCaseBuilder = createExperimenterIdCase(matchEntryBuilder, input); + addTcpFlagsAugmentation(input, expCaseBuilder, matchEntryBuilder.isHasMask()); + matchEntryBuilder.setMatchEntryValue(expCaseBuilder.build()); + return matchEntryBuilder.build(); + + } + + private static void addTcpFlagsAugmentation(ByteBuf input, ExperimenterIdCaseBuilder expCaseBuilder, boolean hasMask) { + TcpFlagsContainerBuilder flagsContainerBuilder = new TcpFlagsContainerBuilder(); + TcpFlagsBuilder flagsBuilder = new TcpFlagsBuilder(); + flagsBuilder.setFlags(input.readUnsignedShort()); + if (hasMask) { + byte[] mask = new byte[EncodeConstants.SIZE_OF_SHORT_IN_BYTES]; + input.readBytes(mask); + flagsBuilder.setMask(mask); + } + flagsContainerBuilder.setTcpFlags(flagsBuilder.build()); + expCaseBuilder.addAugmentation(TcpFlagsContainer.class, flagsContainerBuilder.build()); + } + + /** + * @return oxm_field class + */ + @Override + protected Class getOxmField() { + return TcpFlags.class; + } + + /** + * @return oxm_class class + */ + @Override + protected Class getOxmClass() { + return ExperimenterClass.class; + } +} diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/MatchEntriesInitializer.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/MatchEntriesInitializer.java index 55d92239..2ed24e59 100644 --- a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/MatchEntriesInitializer.java +++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/MatchEntriesInitializer.java @@ -9,6 +9,7 @@ package org.opendaylight.openflowjava.protocol.impl.serialization; import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry; import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants; +import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants; import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmArpOpSerializer; import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmArpShaSerializer; import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmArpSpaSerializer; @@ -49,7 +50,9 @@ import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmUdpDst import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmUdpSrcSerializer; import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmVlanPcpSerializer; import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmVlanVidSerializer; +import org.opendaylight.openflowjava.protocol.impl.serialization.match.ext.OnfOxmTcpFlagsSerializer; import org.opendaylight.openflowjava.protocol.impl.util.MatchEntrySerializerRegistryHelper; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.approved.extensions.rev160802.TcpFlags; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.ArpOp; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.ArpSha; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.ArpSpa; @@ -152,5 +155,9 @@ public final class MatchEntriesInitializer { helper.registerSerializer(PbbIsid.class, new OxmPbbIsidSerializer()); helper.registerSerializer(TunnelId.class, new OxmTunnelIdSerializer()); helper.registerSerializer(Ipv6Exthdr.class, new OxmIpv6ExtHdrSerializer()); + + // Register approved openflow match entry serializers + helper.registerExperimenterSerializer(TcpFlags.class, OxmMatchConstants.ONFOXM_ET_TCP_FLAGS_EXP_ID, + new OnfOxmTcpFlagsSerializer()); } } diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/ext/AbstractOxmExperimenterMatchEntrySerializer.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/ext/AbstractOxmExperimenterMatchEntrySerializer.java new file mode 100644 index 00000000..fec3df21 --- /dev/null +++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/ext/AbstractOxmExperimenterMatchEntrySerializer.java @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2016 Brocade Communications Systems, Inc. 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.serialization.match.ext; + +import io.netty.buffer.ByteBuf; +import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants; +import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants; +import org.opendaylight.openflowjava.protocol.impl.serialization.match.AbstractOxmMatchEntrySerializer; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.oxm.container.match.entry.value.ExperimenterIdCase; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry; + +/** + * Created by Anil Vishnoi (avishnoi@Brocade.com) on 7/25/16. + */ +public abstract class AbstractOxmExperimenterMatchEntrySerializer extends AbstractOxmMatchEntrySerializer { + + @Override + public void serialize(MatchEntry entry, ByteBuf outBuffer) { + serializeHeader(entry, outBuffer); + } + + @Override + public void serializeHeader(MatchEntry entry, ByteBuf outBuffer) { + outBuffer.writeShort(getOxmClassCode()); + writeOxmFieldAndLength(outBuffer, getOxmFieldCode(), entry.isHasMask(), + getValueLength()); + } + + protected static void writeOxmFieldAndLength(ByteBuf out, int fieldValue, boolean hasMask, int lengthArg) { + int fieldAndMask = fieldValue << 1; + int length = lengthArg; + if (hasMask) { + fieldAndMask |= 1; + length *= 2; + } + + //Add experimenter-id lenge + length = length + EncodeConstants.SIZE_OF_INT_IN_BYTES; + out.writeByte(fieldAndMask); + out.writeByte(length); + } + + protected ExperimenterIdCase serializeExperimenterId(MatchEntry matchEntry, ByteBuf out) { + ExperimenterIdCase expCase = (ExperimenterIdCase) matchEntry.getMatchEntryValue(); + out.writeInt(expCase.getExperimenter().getExperimenter().getValue().intValue()); + return expCase; + } + + /** + * @return Experimenter match entry ID + */ + protected abstract long getExperimenterId(); +} + diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/ext/OnfOxmTcpFlagsSerializer.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/ext/OnfOxmTcpFlagsSerializer.java new file mode 100644 index 00000000..340dc7ae --- /dev/null +++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/ext/OnfOxmTcpFlagsSerializer.java @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2016 Brocade Communications Systems, Inc. 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.serialization.match.ext; + +import io.netty.buffer.ByteBuf; +import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants; +import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.approved.extensions.rev160802.TcpFlagsContainer; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.approved.extensions.rev160802.oxm.container.match.entry.value.experimenter.id._case.TcpFlags; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.oxm.container.match.entry.value.ExperimenterIdCase; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry; + +/** + * Created by Anil Vishnoi (avishnoi@Brocade.com) on 7/25/16. + */ +public class OnfOxmTcpFlagsSerializer extends AbstractOxmExperimenterMatchEntrySerializer { + + @Override + public void serialize(MatchEntry entry, ByteBuf outBuffer) { + super.serialize(entry, outBuffer); + ExperimenterIdCase expCase = serializeExperimenterId(entry, outBuffer); + TcpFlags tcpFlags = expCase.getAugmentation(TcpFlagsContainer.class).getTcpFlags(); + outBuffer.writeShort(tcpFlags.getFlags()); + if (entry.isHasMask()) { + outBuffer.writeBytes(tcpFlags.getMask()); + } + } + + /** + * @return Experimenter match entry ID + */ + @Override + protected long getExperimenterId() { + return OxmMatchConstants.ONFOXM_ET_TCP_FLAGS_EXP_ID; + } + + /** + * @return numeric representation of oxm_field + */ + @Override + protected int getOxmFieldCode() { + return OxmMatchConstants.ONFOXM_ET_TCP_FLAGS; + } + + /** + * @return numeric representation of oxm_class + */ + @Override + protected int getOxmClassCode() { + return OxmMatchConstants.EXPERIMENTER_CLASS; + } + + /** + * @return match entry value length (without mask length) + */ + @Override + protected int getValueLength() { + return EncodeConstants.SIZE_OF_SHORT_IN_BYTES; + } +} diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/MatchEntryDeserializerRegistryHelper.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/MatchEntryDeserializerRegistryHelper.java index e666f11e..96d01c3d 100644 --- a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/MatchEntryDeserializerRegistryHelper.java +++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/MatchEntryDeserializerRegistryHelper.java @@ -10,6 +10,7 @@ package org.opendaylight.openflowjava.protocol.impl.util; import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry; import org.opendaylight.openflowjava.protocol.api.extensibility.OFGeneralDeserializer; import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey; +import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants; /** * @author michal.polkorab @@ -44,4 +45,11 @@ public class MatchEntryDeserializerRegistryHelper { key.setExperimenterId(null); registry.registerDeserializer(key, deserializer); } + + public void registerExperimenter(int oxmField, long expId, OFGeneralDeserializer deserializer) { + MatchEntryDeserializerKey key = + new MatchEntryDeserializerKey(version, OxmMatchConstants.EXPERIMENTER_CLASS, oxmField); + key.setExperimenterId(expId); + registry.registerDeserializer(key, deserializer); + } } \ No newline at end of file diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/MatchEntrySerializerRegistryHelper.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/MatchEntrySerializerRegistryHelper.java index 1c704bb2..d9c76295 100644 --- a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/MatchEntrySerializerRegistryHelper.java +++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/util/MatchEntrySerializerRegistryHelper.java @@ -10,6 +10,7 @@ package org.opendaylight.openflowjava.protocol.impl.util; import org.opendaylight.openflowjava.protocol.api.extensibility.OFGeneralSerializer; import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry; import org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.ExperimenterClass; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.MatchField; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OxmClassBase; @@ -46,4 +47,17 @@ public class MatchEntrySerializerRegistryHelper { key.setExperimenterId(null); serializerRegistry.registerSerializer(key, serializer); } + + /** + * Registers ExperimenterClass type match serializer + * @param specificClass + * @param serializer + */ + public void registerExperimenterSerializer( + Class specificClass, long expId, OFGeneralSerializer serializer) { + MatchEntrySerializerKey key = new MatchEntrySerializerKey<>(version, ExperimenterClass.class, specificClass); + key.setExperimenterId(expId); + serializerRegistry.registerSerializer(key, serializer); + } + } diff --git a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/util/OF13MatchSerializerTest.java b/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/util/OF13MatchSerializerTest.java index 5dce30ab..0c2a6aa0 100644 --- a/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/util/OF13MatchSerializerTest.java +++ b/openflow-protocol-impl/src/test/java/org/opendaylight/openflowjava/protocol/impl/util/OF13MatchSerializerTest.java @@ -26,6 +26,8 @@ import org.opendaylight.openflowjava.util.ByteBufUtils; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6FlowLabel; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.approved.extensions.rev160802.TcpFlags; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.approved.extensions.rev160802.oxm.container.match.entry.value.experimenter.id._case.TcpFlagsBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.oxm.container.match.entry.value.ExperimenterIdCaseBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.oxm.container.match.entry.value.experimenter.id._case.ExperimenterBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId;