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%2Fmatch%2FAbstractOxmMatchEntrySerializer.java;h=d2b96e20737e62932f51311dee314711695946a5;hb=29a2a074c78708f6d18583779ece96bb6573f0c6;hp=5c6696475089db3577705bffcffad4624cb5f823;hpb=435f3e8a95843a6e9a326ab56663c31ff6d7cdb7;p=openflowjava.git diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/AbstractOxmMatchEntrySerializer.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/AbstractOxmMatchEntrySerializer.java index 5c669647..d2b96e20 100644 --- a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/AbstractOxmMatchEntrySerializer.java +++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/serialization/match/AbstractOxmMatchEntrySerializer.java @@ -11,37 +11,33 @@ import io.netty.buffer.ByteBuf; import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderSerializer; import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer; -import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry; -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; /** * Parent for all match entry serializers * @author michal.polkorab */ public abstract class AbstractOxmMatchEntrySerializer - implements OFSerializer, HeaderSerializer{ + implements OFSerializer, HeaderSerializer{ @Override - public void serialize(MatchEntries entry, ByteBuf outBuffer) { + public void serialize(MatchEntry entry, ByteBuf outBuffer) { serializeHeader(entry, outBuffer); } @Override - public void serializeHeader(MatchEntries entry, ByteBuf outBuffer) { + public void serializeHeader(MatchEntry entry, ByteBuf outBuffer) { outBuffer.writeShort(getOxmClassCode()); writeOxmFieldAndLength(outBuffer, getOxmFieldCode(), entry.isHasMask(), getValueLength()); } - protected static void writeMask(MatchEntries entry, ByteBuf out, int length) { - if (entry.isHasMask()) { - byte[] mask = entry.getAugmentation(MaskMatchEntry.class).getMask(); - if (mask != null && mask.length != length) { - throw new IllegalArgumentException("incorrect length of mask: "+ - mask.length + ", expected: " + length); - } - out.writeBytes(mask); + protected static void writeMask(byte[] mask, ByteBuf out, int length) { + if (mask != null && mask.length != length) { + throw new IllegalArgumentException("incorrect length of mask: "+ + mask.length + ", expected: " + length); } + out.writeBytes(mask); } protected static void writeOxmFieldAndLength(ByteBuf out, int fieldValue, boolean hasMask, int lengthArg) {