+/*
+ * Copyright (c) 2014, 2015 Cisco 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.nx.codec.match;
import io.netty.buffer.ByteBuf;
-
-import org.opendaylight.openflowjava.nx.api.NiciraConstants;
+import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderDeserializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderSerializer;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdMatchEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.ExperimenterIdMatchEntryBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ExperimenterId;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase;
-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.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
-
-public abstract class AbstractMatchCodec implements OFSerializer<MatchEntries>, OFDeserializer<MatchEntries> {
-
- private NxmHeader headerWithMask;
- private NxmHeader headerWithoutMask;
-
- protected MatchEntriesBuilder deserializeHeader(ByteBuf message) {
- MatchEntriesBuilder builder = new MatchEntriesBuilder();
+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;
+
+public abstract class AbstractMatchCodec implements
+ OFSerializer<MatchEntry>,
+ OFDeserializer<MatchEntry>,
+ HeaderSerializer<MatchEntry>,
+ HeaderDeserializer<MatchEntry> {
+
+ protected NxmHeader headerWithMask;
+ protected NxmHeader headerWithoutMask;
+
+ protected MatchEntryBuilder deserializeHeaderToBuilder(ByteBuf message) {
+ MatchEntryBuilder builder = new MatchEntryBuilder();
builder.setOxmClass(getOxmClass());
// skip oxm_class - provided
message.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
builder.setHasMask(hasMask);
// skip match entry length - not needed
message.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
- ExperimenterIdMatchEntryBuilder experimenterIdMatchEntryBuilder = new ExperimenterIdMatchEntryBuilder();
- experimenterIdMatchEntryBuilder.setExperimenter(new ExperimenterId(NiciraConstants.NX_VENDOR_ID));
- builder.addAugmentation(ExperimenterIdMatchEntry.class, experimenterIdMatchEntryBuilder.build());
return builder;
}
- protected void serializeHeader(MatchEntries input, ByteBuf outBuffer) {
+ @Override
+ public MatchEntry deserializeHeader(ByteBuf message) {
+ return deserializeHeaderToBuilder(message).build();
+ }
+
+ @Override
+ public void serializeHeader(MatchEntry input, ByteBuf outBuffer) {
outBuffer.writeInt(serializeHeaderToLong(input.isHasMask()).intValue());
}
}
/**
- * @return numeric representation of nxm_field
+ * Returns the numeric representation of nxm_field.
*/
public abstract int getNxmFieldCode();
/**
- * @return numeric representation of oxm_class
+ * Returns the numeric representation of oxm_class.
*/
public abstract int getOxmClassCode();
/**
- * @return match entry value length
+ * Returns the match entry value length.
*/
public abstract int getValueLength();
/**
- * @return nxm_field class
+ * Returns the nxm_field class.
*/
public abstract Class<? extends MatchField> getNxmField();
/**
- * @return oxm_class class
+ * Returns the oxm_class class.
*/
public abstract Class<? extends OxmClassBase> getOxmClass();