* 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.eric.codec.match;
import io.netty.buffer.ByteBuf;
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.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;
MatchEntryBuilder builder = new MatchEntryBuilder();
builder.setOxmClass(getOxmClass());
// skip oxm_class - provided
- message.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ message.skipBytes(Short.BYTES);
builder.setOxmMatchField(getEricField());
boolean hasMask = (message.readUnsignedByte() & 1) != 0;
builder.setHasMask(hasMask);
// skip experimenter class, match length and experimenter id - not needed
- message.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ message.skipBytes(Byte.BYTES);
return builder;
}
* Returns the oxm_class class.
*/
public abstract Class<? extends OxmClassBase> getOxmClass();
-}
\ No newline at end of file
+}
protected static final ActionBuilder deserializeHeader(final ByteBuf message) {
// size of experimenter type
- message.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ message.skipBytes(Short.BYTES);
// size of length
- message.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ message.skipBytes(Short.BYTES);
// vendor id
- message.skipBytes(EncodeConstants.SIZE_OF_INT_IN_BYTES);
+ message.skipBytes(Integer.BYTES);
// subtype
- message.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ message.skipBytes(Short.BYTES);
ActionBuilder actionBuilder = new ActionBuilder();
actionBuilder.setExperimenterId(getExperimenterId());
return actionBuilder;
protected static final void writePaddingAndSetLength(ByteBuf outBuffer, int startIndex) {
int nonPaddedSize = outBuffer.writerIndex() - startIndex;
outBuffer.writeZero(getPaddingRemainder(nonPaddedSize));
- outBuffer.setShort(startIndex + EncodeConstants.SIZE_OF_SHORT_IN_BYTES, outBuffer.writerIndex() - startIndex);
+ outBuffer.setShort(startIndex + Short.BYTES, outBuffer.writerIndex() - startIndex);
}
protected static void writeNxmHeader(final Uint64 value, final ByteBuf outBuffer) {
protected static BigInteger readNxmHeader(final ByteBuf message) {
int value = message.getUnsignedShort(message.readerIndex());
- byte[] bytes = new byte[value == EncodeConstants.EXPERIMENTER_VALUE
- ? EncodeConstants.SIZE_OF_LONG_IN_BYTES
- : EncodeConstants.SIZE_OF_INT_IN_BYTES];
+ byte[] bytes = new byte[value == EncodeConstants.EXPERIMENTER_VALUE ? Long.BYTES : Integer.BYTES];
message.readBytes(bytes);
return new BigInteger(1, bytes);
}
public Action deserialize(ByteBuf message) {
final int startPosition = message.readerIndex();
// size of experimenter type
- message.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ message.skipBytes(Short.BYTES);
// size of length
- message.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ message.skipBytes(Short.BYTES);
long experimenterId = message.readUnsignedInt();
if (NiciraConstants.NX_VENDOR_ID.toJava() != experimenterId) {
throw new IllegalStateException("Experimenter ID is not Nicira vendor id but is " + experimenterId);
ctActionsBuilder.setOfpactActions(caseBuilder.build());
ctActionsList.add(ctActionsBuilder.build());
// padding
- message.skipBytes(EncodeConstants.SIZE_OF_INT_IN_BYTES);
+ message.skipBytes(Integer.BYTES);
}
}
private static short deserializeCtHeaderWithoutSubtype(final ByteBuf message) {
// size of experimenter type / size of set field code (in case of ct_mark)
- message.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ message.skipBytes(Short.BYTES);
// size of length
short length = message.readShort();
// vendor id / 00 01 d6 04 (in case of ct_mark)
- message.skipBytes(EncodeConstants.SIZE_OF_INT_IN_BYTES);
+ message.skipBytes(Integer.BYTES);
return length;
}
private static short deserializeCtHeader(final ByteBuf message) {
short length = deserializeCtHeaderWithoutSubtype(message);
// subtype
- message.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ message.skipBytes(Short.BYTES);
return length;
}
}
public Action deserialize(ByteBuf message) {
final ActionBuilder actionBuilder = deserializeHeader(message);
// skip header size, not used
- message.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ message.skipBytes(Short.BYTES);
NxActionEncap nxActionEncap = new NxActionEncapBuilder().setPacketType(readUint32(message)).build();
ActionEncap actionEncap = new ActionEncapBuilder().setNxActionEncap(nxActionEncap).build();
actionBuilder.setActionChoice(actionEncap);
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionLearn;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.FlowModAddMatchFromFieldCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.flow.mod.spec.flow.mod.spec.FlowModAddMatchFromFieldCaseBuilder;
import org.slf4j.LoggerFactory;
public final class LearnCodecUtil {
-
private static final Logger LOG = LoggerFactory.getLogger(LearnCodecUtil.class);
public static final int HEADER_LENGTH = 32;
private static final short SRC_MASK = 0x2000;
static short deserializeHeader(ByteBuf message) {
// size of experimenter type
- message.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ message.skipBytes(Short.BYTES);
// size of length
short messageLength = message.readShort();
// vendor id
- message.skipBytes(EncodeConstants.SIZE_OF_INT_IN_BYTES);
+ message.skipBytes(Integer.BYTES);
// subtype
- message.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ message.skipBytes(Short.BYTES);
return messageLength;
}
private static FlowMods readFlowMod(ByteBuf message) {
short header = message.readShort();
- length -= EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ length -= Short.BYTES;
if (header == 0) {
return null;
}
builder.setDstField(readUint32(message));
builder.setDstOfs((int) message.readShort());
builder.setFlowModNumBits((int) numBits);
- length -= FROM_FIELD_LENGTH - EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ length -= FROM_FIELD_LENGTH - Short.BYTES;
FlowModsBuilder flowModsBuilder = new FlowModsBuilder();
FlowModAddMatchFromFieldCaseBuilder caseBuilder = new FlowModAddMatchFromFieldCaseBuilder();
builder.setSrcField(readUint32(message));
builder.setSrcOfs((int) message.readShort());
builder.setFlowModNumBits((int) numBits);
- length -= FROM_VALUE_LENGTH - EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ length -= FROM_VALUE_LENGTH - Short.BYTES;
FlowModsBuilder flowModsBuilder = new FlowModsBuilder();
FlowModAddMatchFromValueCaseBuilder caseBuilder = new FlowModAddMatchFromValueCaseBuilder();
builder.setDstField(readUint32(message));
builder.setDstOfs((int) message.readShort());
builder.setFlowModNumBits((int) numBits);
- length -= FROM_FIELD_LENGTH - EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ length -= FROM_FIELD_LENGTH - Short.BYTES;
FlowModsBuilder flowModsBuilder = new FlowModsBuilder();
FlowModCopyFieldIntoFieldCaseBuilder caseBuilder = new FlowModCopyFieldIntoFieldCaseBuilder();
builder.setDstField(readUint32(message));
builder.setDstOfs((int) message.readShort());
builder.setFlowModNumBits((int) numBits);
- length -= FROM_VALUE_LENGTH - EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ length -= FROM_VALUE_LENGTH - Short.BYTES;
FlowModsBuilder flowModsBuilder = new FlowModsBuilder();
FlowModCopyValueIntoFieldCaseBuilder caseBuilder = new FlowModCopyValueIntoFieldCaseBuilder();
builder.setSrcField(readUint32(message));
builder.setSrcOfs((int) message.readShort());
builder.setFlowModNumBits((int) numBits);
- length -= TO_PORT_LENGTH - EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ length -= TO_PORT_LENGTH - Short.BYTES;
FlowModsBuilder flowModsBuilder = new FlowModsBuilder();
FlowModOutputToPortCaseBuilder caseBuilder = new FlowModOutputToPortCaseBuilder();
ActionBuilder actionBuilder = deserializeHeader(message);
int oxmClass = message.getUnsignedShort(message.readerIndex());
- int oxmField = message.getUnsignedByte(message.readerIndex() + EncodeConstants.SIZE_OF_SHORT_IN_BYTES) >>> 1;
+ int oxmField = message.getUnsignedByte(message.readerIndex() + Short.BYTES) >>> 1;
MatchEntryDeserializerKey key = new MatchEntryDeserializerKey(
EncodeConstants.OF13_VERSION_ID,
oxmClass,
oxmField);
if (oxmClass == EncodeConstants.EXPERIMENTER_VALUE) {
- long expId = message.getUnsignedInt(message.readerIndex()
- + EncodeConstants.SIZE_OF_SHORT_IN_BYTES
- + EncodeConstants.SIZE_OF_BYTE_IN_BYTES * 2);
+ long expId = message.getUnsignedInt(message.readerIndex() + Short.BYTES + Byte.BYTES * 2);
key.setExperimenterId(Uint32.valueOf(expId));
}
OFDeserializer<MatchEntry> matchDeserializer = deserializerRegistry.getDeserializer(key);
* 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.eclipse.jdt.annotation.NonNull;
import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;
import org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey;
-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.augments.rev150225.oxm.container.match.entry.value.ExperimenterIdCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev150225.oxm.container.match.entry.value.ExperimenterIdCaseBuilder;
final MatchEntryBuilder matchEntryBuilder = deserializeHeaderToBuilder(message);
// skip experimenter Id
- message.skipBytes(EncodeConstants.SIZE_OF_INT_IN_BYTES);
+ message.skipBytes(Integer.BYTES);
ExperimenterIdCaseBuilder expCaseBuilder = new ExperimenterIdCaseBuilder();
ExperimenterBuilder expBuilder = new ExperimenterBuilder();
return new NxmHeader(
getNxmFieldCode(),
hasMask,
- EncodeConstants.SIZE_OF_INT_IN_BYTES + (hasMask ? getValueLength() * 2 : getValueLength()),
+ Integer.BYTES + (hasMask ? getValueLength() * 2 : getValueLength()),
getExperimenterId().longValue());
}
* 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.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.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;
MatchEntryBuilder builder = new MatchEntryBuilder();
builder.setOxmClass(getOxmClass());
// skip oxm_class - provided
- message.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ message.skipBytes(Short.BYTES);
builder.setOxmMatchField(getNxmField());
boolean hasMask = (message.readUnsignedByte() & 1) != 0;
builder.setHasMask(hasMask);
// skip match entry length - not needed
- message.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ message.skipBytes(Byte.BYTES);
return builder;
}
import io.netty.buffer.ByteBuf;
import org.opendaylight.openflowjava.nx.api.NiciraConstants;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.experimenter.id._case.NxExpMatchEntryValue;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.experimenter.id._case.nx.exp.match.entry.value.NshcCaseValue;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.experimenter.id._case.nx.exp.match.entry.value.NshcCaseValueBuilder;
import org.opendaylight.yangtools.yang.common.Uint32;
public abstract class AbstractNshcCodec extends AbstractExperimenterMatchCodec {
-
- private static final int VALUE_LENGTH = EncodeConstants.SIZE_OF_INT_IN_BYTES;
-
@Override
protected void serializeValue(NxExpMatchEntryValue value, boolean hasMask, ByteBuf outBuffer) {
NshcCaseValue nshcCaseValue = (NshcCaseValue) value;
@Override
public int getValueLength() {
- return VALUE_LENGTH;
+ return Integer.BYTES;
}
}
public class NshFlagsCodec extends AbstractExperimenterMatchCodec {
- private static final int VALUE_LENGTH = EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ private static final int VALUE_LENGTH = Byte.BYTES;
private static final int NXM_FIELD_CODE = 1;
public static final MatchEntrySerializerKey<ExperimenterClass, NxmNxNshFlags> SERIALIZER_KEY =
createSerializerKey(
public class NshMdtypeCodec extends AbstractExperimenterMatchCodec {
- private static final int VALUE_LENGTH = EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ private static final int VALUE_LENGTH = Byte.BYTES;
private static final int NXM_FIELD_CODE = 2;
public static final MatchEntrySerializerKey<ExperimenterClass, NxmNxNshMdtype> SERIALIZER_KEY =
createSerializerKey(
public class NshNpCodec extends AbstractExperimenterMatchCodec {
- private static final int VALUE_LENGTH = EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ private static final int VALUE_LENGTH = Byte.BYTES;
private static final int NXM_FIELD_CODE = 3;
public static final MatchEntrySerializerKey<ExperimenterClass, NxmNxNshNp> SERIALIZER_KEY =
createSerializerKey(
public class NshTtlCodec extends AbstractExperimenterMatchCodec {
- private static final int VALUE_LENGTH = EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ private static final int VALUE_LENGTH = Byte.BYTES;
private static final int NXM_FIELD_CODE = 10;
public static final MatchEntrySerializerKey<ExperimenterClass, NxmNxNshTtl> SERIALIZER_KEY =
createSerializerKey(
public class NsiCodec extends AbstractExperimenterMatchCodec {
- private static final int VALUE_LENGTH = EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ private static final int VALUE_LENGTH = Byte.BYTES;
private static final int NXM_FIELD_CODE = 5;
public static final MatchEntrySerializerKey<ExperimenterClass, NxmNxNsi> SERIALIZER_KEY =
createSerializerKey(
public class NspCodec extends AbstractExperimenterMatchCodec {
- private static final int VALUE_LENGTH = EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ private static final int VALUE_LENGTH = Integer.BYTES;
private static final int NXM_FIELD_CODE = 4;
public static final MatchEntrySerializerKey<ExperimenterClass, NxmNxNsp> SERIALIZER_KEY =
createSerializerKey(
assertEquals(EncodeConstants.EXPERIMENTER_VALUE, buffer.readUnsignedShort());
assertEquals(FIELD_CODE << 1, buffer.readUnsignedByte());
- assertEquals(EncodeConstants.SIZE_OF_INT_IN_BYTES + VALUE_LENGTH, buffer.readUnsignedByte());
+ assertEquals(Integer.BYTES + VALUE_LENGTH, buffer.readUnsignedByte());
assertEquals(EXPERIMENTER_ID.longValue(), buffer.readUnsignedInt());
assertFalse(buffer.isReadable());
verify(testCodec).serializeValue(null, false, buffer);
assertEquals(EncodeConstants.EXPERIMENTER_VALUE, buffer.readUnsignedShort());
assertEquals(FIELD_CODE << 1 | 1, buffer.readUnsignedByte());
- assertEquals(EncodeConstants.SIZE_OF_INT_IN_BYTES + VALUE_LENGTH * 2, buffer.readUnsignedByte());
+ assertEquals(Integer.BYTES + VALUE_LENGTH * 2, buffer.readUnsignedByte());
assertEquals(EXPERIMENTER_ID.longValue(), buffer.readUnsignedInt());
assertFalse(buffer.isReadable());
verify(testCodec).serializeValue(null, true, buffer);
static void writeBuffer(ByteBuf message, boolean hasMask) {
int fieldMask = FIELD_CODE << 1;
- int length = EncodeConstants.SIZE_OF_INT_IN_BYTES + VALUE_LENGTH;
+ int length = Integer.BYTES + VALUE_LENGTH;
if (hasMask) {
fieldMask |= 1;
length += VALUE_LENGTH;
/** Length of ipv6 address in bytes. */
byte SIZE_OF_IPV6_ADDRESS_IN_BYTES = 8 * Short.SIZE / Byte.SIZE;
- /** Length of long in bytes. */
- byte SIZE_OF_LONG_IN_BYTES = Long.SIZE / Byte.SIZE;
-
- /** Length of int in bytes. */
- byte SIZE_OF_INT_IN_BYTES = Integer.SIZE / Byte.SIZE;
-
- /** Length of short in bytes. */
- byte SIZE_OF_SHORT_IN_BYTES = Short.SIZE / Byte.SIZE;
-
- /** Length of byte in bytes. */
- byte SIZE_OF_BYTE_IN_BYTES = Byte.SIZE / Byte.SIZE;
-
/** Length of 3 bytes. */
byte SIZE_OF_3_BYTES = 3;
* 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;
import io.netty.buffer.ByteBuf;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
import org.opendaylight.openflowjava.protocol.api.keys.MessageCodeKey;
import org.opendaylight.openflowjava.protocol.api.keys.TypeToClassKey;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.yangtools.yang.binding.DataObject;
/**
* @author giuseppex.petralia@intel.com
*/
public class DeserializationFactory {
-
private final Map<TypeToClassKey, Class<?>> messageClassMap = new ConcurrentHashMap<>();
private final DeserializerRegistry registry;
DataObject dataObject = null;
int type = rawMessage.readUnsignedByte();
Class<?> clazz = messageClassMap.get(new TypeToClassKey(version, type));
- rawMessage.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ rawMessage.skipBytes(Short.BYTES);
OFDeserializer<DataObject> deserializer = registry.getDeserializer(new MessageCodeKey(version, type, clazz));
dataObject = deserializer.deserialize(rawMessage);
return dataObject;
* 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.action;
import io.netty.buffer.ByteBuf;
import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderDeserializer;
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.common.action.rev150203.action.grouping.ActionChoice;
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.action.rev150203.actions.grouping.ActionBuilder;
*/
public abstract class AbstractActionDeserializer implements OFDeserializer<Action>,
HeaderDeserializer<Action> {
-
@Override
public Action deserializeHeader(ByteBuf input) {
ActionBuilder actionBuilder = new ActionBuilder();
- input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ input.skipBytes(2 * Short.BYTES);
actionBuilder.setActionChoice(getType());
return actionBuilder.build();
}
protected abstract ActionChoice getType();
-
}
import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint32;
import io.netty.buffer.ByteBuf;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.ActionChoice;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.EnqueueCaseBuilder;
public class OF10EnqueueActionDeserializer extends AbstractActionDeserializer {
@Override
public Action deserialize(ByteBuf input) {
- input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ input.skipBytes(2 * Short.BYTES);
EnqueueActionBuilder actionBuilder = new EnqueueActionBuilder();
actionBuilder.setPort(new PortNumber(readUint16(input).toUint32()));
input.skipBytes(ActionConstants.PADDING_IN_ENQUEUE_ACTION);
import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint16;
import io.netty.buffer.ByteBuf;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.ActionChoice;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.OutputActionCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.output.action._case.OutputActionBuilder;
@Override
public Action deserialize(ByteBuf input) {
final ActionBuilder builder = new ActionBuilder();
- input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ input.skipBytes(2 * Short.BYTES);
OutputActionCaseBuilder caseBuilder = new OutputActionCaseBuilder();
OutputActionBuilder actionBuilder = new OutputActionBuilder();
actionBuilder.setPort(new PortNumber(readUint16(input).toUint32()));
* 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.action;
import io.netty.buffer.ByteBuf;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
import org.opendaylight.openflowjava.util.ByteBufUtils;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.ActionChoice;
* @author michal.polkorab
*/
public class OF10SetDlDstActionDeserializer extends AbstractActionDeserializer {
-
@Override
public Action deserialize(final ByteBuf input) {
final ActionBuilder builder = new ActionBuilder();
- input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ input.skipBytes(2 * Short.BYTES);
SetDlDstCaseBuilder caseBuilder = new SetDlDstCaseBuilder();
SetDlDstActionBuilder actionBuilder = new SetDlDstActionBuilder();
actionBuilder.setDlDstAddress(ByteBufUtils.readIetfMacAddress(input));
protected ActionChoice getType() {
return new SetDlDstCaseBuilder().build();
}
-
}
* 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.action;
import io.netty.buffer.ByteBuf;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
import org.opendaylight.openflowjava.util.ByteBufUtils;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.ActionChoice;
* @author michal.polkorab
*/
public class OF10SetDlSrcActionDeserializer extends AbstractActionDeserializer {
-
@Override
public Action deserialize(final ByteBuf input) {
final ActionBuilder builder = new ActionBuilder();
- input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ input.skipBytes(2 * Short.BYTES);
SetDlSrcCaseBuilder caseBuilder = new SetDlSrcCaseBuilder();
SetDlSrcActionBuilder actionBuilder = new SetDlSrcActionBuilder();
actionBuilder.setDlSrcAddress(ByteBufUtils.readIetfMacAddress(input));
protected ActionChoice getType() {
return new SetDlSrcCaseBuilder().build();
}
-
}
* 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.action;
import io.netty.buffer.ByteBuf;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.util.ByteBufUtils;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.ActionChoice;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetNwDstCaseBuilder;
* @author michal.polkorab
*/
public class OF10SetNwDstActionDeserializer extends AbstractActionDeserializer {
-
@Override
public Action deserialize(final ByteBuf input) {
final ActionBuilder builder = new ActionBuilder();
- input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ input.skipBytes(2 * Short.BYTES);
SetNwDstCaseBuilder caseBuilder = new SetNwDstCaseBuilder();
SetNwDstActionBuilder actionBuilder = new SetNwDstActionBuilder();
actionBuilder.setIpAddress(ByteBufUtils.readIetfIpv4Address(input));
protected ActionChoice getType() {
return new SetNwDstCaseBuilder().build();
}
-
}
* 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.action;
import io.netty.buffer.ByteBuf;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.util.ByteBufUtils;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.ActionChoice;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetNwSrcCaseBuilder;
* @author michal.polkorab
*/
public class OF10SetNwSrcActionDeserializer extends AbstractActionDeserializer {
-
@Override
public Action deserialize(final ByteBuf input) {
final ActionBuilder builder = new ActionBuilder();
- input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ input.skipBytes(2 * Short.BYTES);
SetNwSrcCaseBuilder caseBuilder = new SetNwSrcCaseBuilder();
SetNwSrcActionBuilder actionBuilder = new SetNwSrcActionBuilder();
actionBuilder.setIpAddress(ByteBufUtils.readIetfIpv4Address(input));
protected ActionChoice getType() {
return new SetNwSrcCaseBuilder().build();
}
-
}
import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint8;
import io.netty.buffer.ByteBuf;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.ActionChoice;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetNwTosCaseBuilder;
@Override
public Action deserialize(ByteBuf input) {
final ActionBuilder builder = new ActionBuilder();
- input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ input.skipBytes(2 * Short.BYTES);
SetNwTosCaseBuilder caseBuilder = new SetNwTosCaseBuilder();
SetNwTosActionBuilder tosBuilder = new SetNwTosActionBuilder();
tosBuilder.setNwTos(readUint8(input));
import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint16;
import io.netty.buffer.ByteBuf;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.ActionChoice;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetTpDstCaseBuilder;
@Override
public Action deserialize(ByteBuf input) {
final ActionBuilder builder = new ActionBuilder();
- input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ input.skipBytes(2 * Short.BYTES);
SetTpDstCaseBuilder caseBuilder = new SetTpDstCaseBuilder();
SetTpDstActionBuilder actionBuilder = new SetTpDstActionBuilder();
actionBuilder.setPort(new PortNumber(readUint16(input).toUint32()));
import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint16;
import io.netty.buffer.ByteBuf;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.ActionChoice;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetTpSrcCaseBuilder;
@Override
public Action deserialize(ByteBuf input) {
final ActionBuilder builder = new ActionBuilder();
- input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ input.skipBytes(2 * Short.BYTES);
SetTpSrcCaseBuilder caseBuilder = new SetTpSrcCaseBuilder();
SetTpSrcActionBuilder actionBuilder = new SetTpSrcActionBuilder();
actionBuilder.setPort(new PortNumber(readUint16(input).toUint32()));
import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint8;
import io.netty.buffer.ByteBuf;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.ActionChoice;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetVlanPcpCaseBuilder;
public class OF10SetVlanPcpActionDeserializer extends AbstractActionDeserializer {
@Override
public Action deserialize(ByteBuf input) {
- final org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping
- .ActionBuilder builder = new ActionBuilder();
- input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ final ActionBuilder builder = new ActionBuilder();
+ input.skipBytes(2 * Short.BYTES);
SetVlanPcpCaseBuilder caseBuilder = new SetVlanPcpCaseBuilder();
SetVlanPcpActionBuilder actionBuilder = new SetVlanPcpActionBuilder();
actionBuilder.setVlanPcp(readUint8(input));
import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint16;
import io.netty.buffer.ByteBuf;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.ActionChoice;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetVlanVidCaseBuilder;
* @author michal.polkorab
*/
public class OF10SetVlanVidActionDeserializer extends AbstractActionDeserializer {
-
@Override
public Action deserialize(ByteBuf input) {
- input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ input.skipBytes(2 * Short.BYTES);
final ActionBuilder builder = new ActionBuilder()
.setActionChoice(new SetVlanVidCaseBuilder()
.setSetVlanVidAction(new SetVlanVidActionBuilder().setVlanVid(readUint16(input)).build())
protected ActionChoice getType() {
return new SetVlanVidCaseBuilder().build();
}
-
}
* 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.action;
import io.netty.buffer.ByteBuf;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.ActionChoice;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.StripVlanCaseBuilder;
* @author michal.polkorab
*/
public class OF10StripVlanActionDeserializer extends AbstractActionDeserializer {
-
@Override
public Action deserialize(ByteBuf input) {
final ActionBuilder builder = new ActionBuilder();
- input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ input.skipBytes(2 * Short.BYTES);
builder.setActionChoice(getType());
input.skipBytes(ActionConstants.PADDING_IN_ACTION_HEADER);
return builder.build();
protected ActionChoice getType() {
return new StripVlanCaseBuilder().build();
}
-
}
* 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.action;
import io.netty.buffer.ByteBuf;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.ActionChoice;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.CopyTtlInCaseBuilder;
* @author michal.polkorab
*/
public class OF13CopyTtlInActionDeserializer extends AbstractActionDeserializer {
-
@Override
public Action deserialize(ByteBuf input) {
ActionBuilder builder = new ActionBuilder();
- input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ input.skipBytes(2 * Short.BYTES);
builder.setActionChoice(getType());
input.skipBytes(ActionConstants.PADDING_IN_ACTION_HEADER);
return builder.build();
protected ActionChoice getType() {
return new CopyTtlInCaseBuilder().build();
}
-
}
* 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.action;
import io.netty.buffer.ByteBuf;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.ActionChoice;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.CopyTtlOutCaseBuilder;
* @author michal.polkorab
*/
public class OF13CopyTtlOutActionDeserializer extends AbstractActionDeserializer {
-
@Override
public Action deserialize(ByteBuf input) {
ActionBuilder builder = new ActionBuilder();
- input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ input.skipBytes(2 * Short.BYTES);
builder.setActionChoice(getType());
input.skipBytes(ActionConstants.PADDING_IN_ACTION_HEADER);
return builder.build();
protected ActionChoice getType() {
return new CopyTtlOutCaseBuilder().build();
}
-
}
* 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.action;
import io.netty.buffer.ByteBuf;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.ActionChoice;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.DecMplsTtlCaseBuilder;
* @author michal.polkorab
*/
public class OF13DecMplsTtlActionDeserializer extends AbstractActionDeserializer {
-
@Override
public Action deserialize(ByteBuf input) {
ActionBuilder builder = new ActionBuilder();
- input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ input.skipBytes(2 * Short.BYTES);
builder.setActionChoice(getType());
input.skipBytes(ActionConstants.PADDING_IN_ACTION_HEADER);
return builder.build();
protected ActionChoice getType() {
return new DecMplsTtlCaseBuilder().build();
}
-
}
* 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.action;
import io.netty.buffer.ByteBuf;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.ActionChoice;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.DecNwTtlCaseBuilder;
* @author michal.polkorab
*/
public class OF13DecNwTtlActionDeserializer extends AbstractActionDeserializer {
-
@Override
public Action deserialize(ByteBuf input) {
ActionBuilder builder = new ActionBuilder();
- input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ input.skipBytes(2 * Short.BYTES);
builder.setActionChoice(getType());
input.skipBytes(ActionConstants.PADDING_IN_ACTION_HEADER);
return builder.build();
protected ActionChoice getType() {
return new DecNwTtlCaseBuilder().build();
}
-
}
import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint32;
import io.netty.buffer.ByteBuf;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.ActionChoice;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.GroupCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.group._case.GroupActionBuilder;
public class OF13GroupActionDeserializer extends AbstractActionDeserializer {
@Override
public Action deserialize(ByteBuf input) {
- input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ input.skipBytes(2 * Short.BYTES);
return new ActionBuilder()
.setActionChoice(new GroupCaseBuilder()
.setGroupAction(new GroupActionBuilder().setGroupId(readUint32(input)).build())
import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint32;
import io.netty.buffer.ByteBuf;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.ActionChoice;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.OutputActionCaseBuilder;
public Action deserialize(ByteBuf input) {
final org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping
.ActionBuilder builder = new ActionBuilder();
- input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ input.skipBytes(2 * Short.BYTES);
OutputActionCaseBuilder caseBuilder = new OutputActionCaseBuilder();
OutputActionBuilder actionBuilder = new OutputActionBuilder();
actionBuilder.setPort(new PortNumber(readUint32(input)));
package org.opendaylight.openflowjava.protocol.impl.deserialization.action;
import io.netty.buffer.ByteBuf;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.ActionChoice;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PopMplsCaseBuilder;
public class OF13PopMplsActionDeserializer extends AbstractActionDeserializer {
@Override
public Action deserialize(ByteBuf input) {
- input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ input.skipBytes(2 * Short.BYTES);
final ActionBuilder builder = new ActionBuilder()
.setActionChoice(new PopMplsCaseBuilder()
.setPopMplsAction(new PopMplsActionBuilder()
* 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.action;
import io.netty.buffer.ByteBuf;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.ActionChoice;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PopPbbCaseBuilder;
* @author michal.polkorab
*/
public class OF13PopPbbActionDeserializer extends AbstractActionDeserializer {
-
@Override
public Action deserialize(ByteBuf input) {
ActionBuilder builder = new ActionBuilder();
- input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ input.skipBytes(2 * Short.BYTES);
builder.setActionChoice(getType());
input.skipBytes(ActionConstants.PADDING_IN_ACTION_HEADER);
return builder.build();
protected ActionChoice getType() {
return new PopPbbCaseBuilder().build();
}
-
}
* 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.action;
import io.netty.buffer.ByteBuf;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.ActionChoice;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PopVlanCaseBuilder;
* @author michal.polkorab
*/
public class OF13PopVlanActionDeserializer extends AbstractActionDeserializer {
-
@Override
public Action deserialize(ByteBuf input) {
ActionBuilder builder = new ActionBuilder();
- input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ input.skipBytes(2 * Short.BYTES);
builder.setActionChoice(getType());
input.skipBytes(ActionConstants.PADDING_IN_ACTION_HEADER);
return builder.build();
protected ActionChoice getType() {
return new PopVlanCaseBuilder().build();
}
-
}
package org.opendaylight.openflowjava.protocol.impl.deserialization.action;
import io.netty.buffer.ByteBuf;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.ActionChoice;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PushMplsCaseBuilder;
* @author michal.polkorab
*/
public class OF13PushMplsActionDeserializer extends AbstractActionDeserializer {
-
@Override
public Action deserialize(ByteBuf input) {
final ActionBuilder builder = new ActionBuilder();
- input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ input.skipBytes(2 * Short.BYTES);
PushMplsCaseBuilder caseBuilder = new PushMplsCaseBuilder();
PushMplsActionBuilder mplsBuilder = new PushMplsActionBuilder();
mplsBuilder.setEthertype(new EtherType(ByteBufUtils.readUint16(input)));
package org.opendaylight.openflowjava.protocol.impl.deserialization.action;
import io.netty.buffer.ByteBuf;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.ActionChoice;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PushPbbCaseBuilder;
public class OF13PushPbbActionDeserializer extends AbstractActionDeserializer {
@Override
public Action deserialize(ByteBuf input) {
- input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ input.skipBytes(2 * Short.BYTES);
final ActionBuilder builder = new ActionBuilder()
.setActionChoice(new PushPbbCaseBuilder()
.setPushPbbAction(new PushPbbActionBuilder()
package org.opendaylight.openflowjava.protocol.impl.deserialization.action;
import io.netty.buffer.ByteBuf;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.ActionChoice;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.PushVlanCaseBuilder;
public class OF13PushVlanActionDeserializer extends AbstractActionDeserializer {
@Override
public Action deserialize(ByteBuf input) {
- input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ input.skipBytes(2 * Short.BYTES);
final ActionBuilder builder = new ActionBuilder()
.setActionChoice(new PushVlanCaseBuilder()
.setPushVlanAction(new PushVlanActionBuilder()
final org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping
.ActionBuilder builder = new ActionBuilder();
final int startIndex = input.readerIndex();
- input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ input.skipBytes(2 * Short.BYTES);
final SetFieldCaseBuilder caseBuilder = new SetFieldCaseBuilder();
SetFieldActionBuilder actionBuilder = new SetFieldActionBuilder();
int oxmClass = input.getUnsignedShort(input.readerIndex());
// get oxm_field & hasMask byte and extract the field value
- int oxmField = input.getUnsignedByte(input.readerIndex()
- + EncodeConstants.SIZE_OF_SHORT_IN_BYTES) >>> 1;
+ int oxmField = input.getUnsignedByte(input.readerIndex() + Short.BYTES) >>> 1;
MatchEntryDeserializerKey key = new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID,
oxmClass, oxmField);
if (oxmClass == EncodeConstants.EXPERIMENTER_VALUE) {
- long expId = input.getUnsignedInt(input.readerIndex() + EncodeConstants.SIZE_OF_SHORT_IN_BYTES
- + 2 * EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ long expId = input.getUnsignedInt(input.readerIndex() + Short.BYTES + 2 * Byte.BYTES);
key.setExperimenterId(Uint32.valueOf(expId));
}
OFDeserializer<MatchEntry> matchDeserializer = registry.getDeserializer(key);
import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint8;
import io.netty.buffer.ByteBuf;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.ActionChoice;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetMplsTtlCaseBuilder;
@Override
public Action deserialize(ByteBuf input) {
final ActionBuilder builder = new ActionBuilder();
- input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ input.skipBytes(2 * Short.BYTES);
SetMplsTtlCaseBuilder caseBuilder = new SetMplsTtlCaseBuilder();
SetMplsTtlActionBuilder actionBuilder = new SetMplsTtlActionBuilder();
actionBuilder.setMplsTtl(readUint8(input));
import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint8;
import io.netty.buffer.ByteBuf;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.ActionChoice;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetNwTtlCaseBuilder;
@Override
public Action deserialize(ByteBuf input) {
final ActionBuilder builder = new ActionBuilder();
- input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ input.skipBytes(2 * Short.BYTES);
SetNwTtlCaseBuilder caseBuilder = new SetNwTtlCaseBuilder();
SetNwTtlActionBuilder actionBuilder = new SetNwTtlActionBuilder();
actionBuilder.setNwTtl(readUint8(input));
import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint32;
import io.netty.buffer.ByteBuf;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.ActionChoice;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.SetQueueCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.action.choice.set.queue._case.SetQueueActionBuilder;
@Override
public Action deserialize(ByteBuf input) {
final ActionBuilder builder = new ActionBuilder();
- input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ input.skipBytes(2 * Short.BYTES);
SetQueueCaseBuilder caseBuilder = new SetQueueCaseBuilder();
SetQueueActionBuilder actionBuilder = new SetQueueActionBuilder();
actionBuilder.setQueueId(readUint32(input));
OFDeserializer<ErrorMessage> deserializer = registry.getDeserializer(
ExperimenterDeserializerKeyFactory.createExperimenterErrorDeserializerKey(
EncodeConstants.OF13_VERSION_ID, rawMessage.getUnsignedInt(
- rawMessage.readerIndex() + EncodeConstants.SIZE_OF_SHORT_IN_BYTES)));
+ rawMessage.readerIndex() + Short.BYTES)));
rawMessage.readerIndex(startIndex);
return deserializer.deserialize(rawMessage);
}
bandsBuilder.setMeterBand(bandDscpRemarkCaseBuilder.build());
break;
case 0xFFFF:
- long expId = rawMessage.getUnsignedInt(rawMessage.readerIndex()
- + 2 * EncodeConstants.SIZE_OF_INT_IN_BYTES);
+ long expId = rawMessage.getUnsignedInt(rawMessage.readerIndex() + 2 * Integer.BYTES);
rawMessage.readerIndex(bandStartIndex);
OFDeserializer<MeterBandExperimenterCase> deserializer = registry
.getDeserializer(ExperimenterDeserializerKeyFactory
while (input.readableBytes() > 0) {
FlowStatsBuilder flowStatsBuilder = new FlowStatsBuilder();
int flowRecordLength = input.readUnsignedShort();
- ByteBuf subInput = input.readSlice(flowRecordLength - EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ ByteBuf subInput = input.readSlice(flowRecordLength - Short.BYTES);
flowStatsBuilder.setTableId(readUint8(subInput));
subInput.skipBytes(PADDING_IN_FLOW_STATS_HEADER_01);
flowStatsBuilder.setDurationSec(readUint32(subInput));
featuresBuilder.setTableId(readUint8(input));
input.skipBytes(PADDING_IN_MULTIPART_REPLY_TABLE_FEATURES);
featuresBuilder.setName(ByteBufUtils.decodeNullTerminatedString(input, MAX_TABLE_NAME_LENGTH));
- byte[] metadataMatch = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ byte[] metadataMatch = new byte[Long.BYTES];
input.readBytes(metadataMatch);
featuresBuilder.setMetadataMatch(metadataMatch);
- byte[] metadataWrite = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ byte[] metadataWrite = new byte[Long.BYTES];
input.readBytes(metadataWrite);
featuresBuilder.setMetadataWrite(metadataWrite);
featuresBuilder.setConfig(createTableConfig(input.readUnsignedInt()));
break;
case 0xFFFF:
actualLength += input.readUnsignedShort();
- final long expId = input.getUnsignedInt(input.readerIndex()
- + 2 * EncodeConstants.SIZE_OF_INT_IN_BYTES);
+ final long expId = input.getUnsignedInt(input.readerIndex() + 2 * Integer.BYTES);
input.readerIndex(bandStartIndex);
OFDeserializer<MeterBandExperimenterCase> deserializer = registry.getDeserializer(
ExperimenterDeserializerKeyFactory.createMeterBandDeserializerKey(
* 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.instruction;
import io.netty.buffer.ByteBuf;
import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderDeserializer;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.ApplyActionsCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.apply.actions._case.ApplyActionsBuilder;
*/
public class ApplyActionsInstructionDeserializer extends AbstractActionInstructionDeserializer
implements HeaderDeserializer<Instruction> {
-
@Override
public Instruction deserialize(ByteBuf input) {
final InstructionBuilder builder = new InstructionBuilder();
- input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ input.skipBytes(Short.BYTES);
int instructionLength = input.readUnsignedShort();
input.skipBytes(InstructionConstants.PADDING_IN_ACTIONS_INSTRUCTION);
ApplyActionsCaseBuilder caseBuilder = new ApplyActionsCaseBuilder();
@Override
public Instruction deserializeHeader(ByteBuf input) {
InstructionBuilder builder = new InstructionBuilder();
- input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ input.skipBytes(2 * Short.BYTES);
builder.setInstructionChoice(new ApplyActionsCaseBuilder().build());
return builder.build();
}
-
}
* 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.instruction;
import io.netty.buffer.ByteBuf;
import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderDeserializer;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.ClearActionsCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
*/
public class ClearActionsInstructionDeserializer implements OFDeserializer<Instruction>,
HeaderDeserializer<Instruction> {
-
@Override
public Instruction deserialize(ByteBuf input) {
InstructionBuilder builder = new InstructionBuilder();
- input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ input.skipBytes(2 * Short.BYTES);
input.skipBytes(InstructionConstants.PADDING_IN_ACTIONS_INSTRUCTION);
builder.setInstructionChoice(new ClearActionsCaseBuilder().build());
return builder.build();
@Override
public Instruction deserializeHeader(ByteBuf input) {
InstructionBuilder builder = new InstructionBuilder();
- input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ input.skipBytes(2 * Short.BYTES);
builder.setInstructionChoice(new ClearActionsCaseBuilder().build());
return builder.build();
}
import io.netty.buffer.ByteBuf;
import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderDeserializer;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.GotoTableCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice._goto.table._case.GotoTableBuilder;
*/
public class GoToTableInstructionDeserializer implements OFDeserializer<Instruction>,
HeaderDeserializer<Instruction> {
-
@Override
public Instruction deserialize(ByteBuf input) {
- input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ input.skipBytes(2 * Short.BYTES);
final InstructionBuilder builder = new InstructionBuilder()
.setInstructionChoice(new GotoTableCaseBuilder()
.setGotoTable(new GotoTableBuilder().setTableId(readUint8(input)).build())
@Override
public Instruction deserializeHeader(ByteBuf input) {
- input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ input.skipBytes(2 * Short.BYTES);
return new InstructionBuilder().setInstructionChoice(new GotoTableCaseBuilder().build()).build();
}
}
import io.netty.buffer.ByteBuf;
import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderDeserializer;
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.common.instruction.rev130731.instruction.grouping.instruction.choice.MeterCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.meter._case.MeterBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instructions.grouping.Instruction;
*/
public class MeterInstructionDeserializer implements OFDeserializer<Instruction>,
HeaderDeserializer<Instruction> {
-
@Override
public Instruction deserialize(ByteBuf input) {
- input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ input.skipBytes(2 * Short.BYTES);
return new InstructionBuilder()
.setInstructionChoice(new MeterCaseBuilder()
.setMeter(new MeterBuilder().setMeterId(readUint32(input)).build())
@Override
public Instruction deserializeHeader(ByteBuf input) {
- input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ input.skipBytes(2 * Short.BYTES);
return new InstructionBuilder().setInstructionChoice(new MeterCaseBuilder().build()).build();
}
}
* 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.instruction;
import io.netty.buffer.ByteBuf;
import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderDeserializer;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.WriteActionsCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.write.actions._case.WriteActionsBuilder;
*/
public class WriteActionsInstructionDeserializer extends AbstractActionInstructionDeserializer
implements HeaderDeserializer<Instruction> {
-
@Override
public Instruction deserialize(ByteBuf input) {
final InstructionBuilder builder = new InstructionBuilder();
- input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ input.skipBytes(Short.BYTES);
int instructionLength = input.readUnsignedShort();
input.skipBytes(InstructionConstants.PADDING_IN_ACTIONS_INSTRUCTION);
WriteActionsCaseBuilder caseBuilder = new WriteActionsCaseBuilder();
@Override
public Instruction deserializeHeader(ByteBuf input) {
InstructionBuilder builder = new InstructionBuilder();
- input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ input.skipBytes(2 * Short.BYTES);
builder.setInstructionChoice(new WriteActionsCaseBuilder().build());
return builder.build();
}
-
}
* 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.instruction;
import io.netty.buffer.ByteBuf;
import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderDeserializer;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.WriteMetadataCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.instruction.rev130731.instruction.grouping.instruction.choice.write.metadata._case.WriteMetadataBuilder;
*/
public class WriteMetadataInstructionDeserializer implements OFDeserializer<Instruction>,
HeaderDeserializer<Instruction> {
-
@Override
public Instruction deserialize(ByteBuf input) {
final InstructionBuilder builder = new InstructionBuilder();
- input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ input.skipBytes(2 * Short.BYTES);
input.skipBytes(InstructionConstants.PADDING_IN_WRITE_METADATA);
final WriteMetadataCaseBuilder caseBuilder = new WriteMetadataCaseBuilder();
WriteMetadataBuilder metadataBuilder = new WriteMetadataBuilder();
- byte[] metadata = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ byte[] metadata = new byte[Long.BYTES];
input.readBytes(metadata);
metadataBuilder.setMetadata(metadata);
- byte[] metadataMask = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ byte[] metadataMask = new byte[Long.BYTES];
input.readBytes(metadataMask);
metadataBuilder.setMetadataMask(metadataMask);
caseBuilder.setWriteMetadata(metadataBuilder.build());
@Override
public Instruction deserializeHeader(ByteBuf input) {
InstructionBuilder builder = new InstructionBuilder();
- input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ input.skipBytes(2 * Short.BYTES);
builder.setInstructionChoice(new WriteMetadataCaseBuilder().build());
return builder.build();
}
import io.netty.buffer.ByteBuf;
import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderDeserializer;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
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;
* @author michal.polkorab
*/
public abstract class AbstractOxmMatchEntryDeserializer implements HeaderDeserializer<MatchEntry> {
-
@Override
public MatchEntry deserializeHeader(ByteBuf input) {
MatchEntryBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
MatchEntryBuilder builder = new MatchEntryBuilder();
builder.setOxmClass(oxmClass);
// skip oxm_class (provided)
- input.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ input.skipBytes(Short.BYTES);
builder.setOxmMatchField(oxmField);
boolean hasMask = (input.readUnsignedByte() & 1) != 0;
builder.setHasMask(hasMask);
// skip match entry length - not needed
- input.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ input.skipBytes(Byte.BYTES);
return builder;
}
-
}
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.common.types.rev130731.Ipv6ExthdrFlags;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Ipv6Exthdr;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.MatchField;
*/
public class OxmIpv6ExtHdrDeserializer extends AbstractOxmMatchEntryDeserializer
implements OFDeserializer<MatchEntry> {
-
@Override
public MatchEntry deserialize(ByteBuf input) {
MatchEntryBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
Ipv6ExthdrBuilder extHdrBuilder = new Ipv6ExthdrBuilder();
extHdrBuilder.setPseudoField(convertPseudofields(input));
if (builder.isHasMask()) {
- extHdrBuilder.setMask(OxmDeserializerHelper
- .convertMask(input, EncodeConstants.SIZE_OF_SHORT_IN_BYTES));
+ extHdrBuilder.setMask(OxmDeserializerHelper.convertMask(input, Short.BYTES));
}
caseBuilder.setIpv6Exthdr(extHdrBuilder.build());
builder.setMatchEntryValue(caseBuilder.build());
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.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6FlowLabel;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Ipv6Flabel;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.MatchField;
*/
public class OxmIpv6FlabelDeserializer extends AbstractOxmMatchEntryDeserializer
implements OFDeserializer<MatchEntry> {
-
@Override
public MatchEntry deserialize(ByteBuf input) {
MatchEntryBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
Ipv6FlabelBuilder labelBuilder = new Ipv6FlabelBuilder();
labelBuilder.setIpv6Flabel(new Ipv6FlowLabel(readUint32(input)));
if (builder.isHasMask()) {
- labelBuilder.setMask(OxmDeserializerHelper.convertMask(input,
- EncodeConstants.SIZE_OF_INT_IN_BYTES));
+ labelBuilder.setMask(OxmDeserializerHelper.convertMask(input, Integer.BYTES));
}
caseBuilder.setIpv6Flabel(labelBuilder.build());
builder.setMatchEntryValue(caseBuilder.build());
protected Class<? extends OxmClassBase> getOxmClass() {
return OpenflowBasicClass.class;
}
-
}
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.oxm.rev150225.MatchField;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Metadata;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OpenflowBasicClass;
private static void addMetadataValue(ByteBuf input, MatchEntryBuilder builder) {
final MetadataCaseBuilder caseBuilder = new MetadataCaseBuilder();
MetadataBuilder metadataBuilder = new MetadataBuilder();
- byte[] metadataBytes = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ byte[] metadataBytes = new byte[Long.BYTES];
input.readBytes(metadataBytes);
metadataBuilder.setMetadata(metadataBytes);
if (builder.isHasMask()) {
- metadataBuilder.setMask(OxmDeserializerHelper
- .convertMask(input, EncodeConstants.SIZE_OF_LONG_IN_BYTES));
+ metadataBuilder.setMask(OxmDeserializerHelper.convertMask(input, Long.BYTES));
}
caseBuilder.setMetadata(metadataBuilder.build());
builder.setMatchEntryValue(caseBuilder.build());
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.oxm.rev150225.MatchField;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OpenflowBasicClass;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OxmClassBase;
private static void addTunnelIdValue(ByteBuf input, MatchEntryBuilder builder) {
final TunnelIdCaseBuilder caseBuilder = new TunnelIdCaseBuilder();
TunnelIdBuilder tunnelIdBuilder = new TunnelIdBuilder();
- byte[] metadataBytes = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ byte[] metadataBytes = new byte[Long.BYTES];
input.readBytes(metadataBytes);
tunnelIdBuilder.setTunnelId(metadataBytes);
if (builder.isHasMask()) {
- tunnelIdBuilder.setMask(OxmDeserializerHelper
- .convertMask(input, EncodeConstants.SIZE_OF_LONG_IN_BYTES));
+ tunnelIdBuilder.setMask(OxmDeserializerHelper.convertMask(input, Long.BYTES));
}
caseBuilder.setTunnelId(tunnelIdBuilder.build());
builder.setMatchEntryValue(caseBuilder.build());
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.oxm.rev150225.MatchField;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OpenflowBasicClass;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OxmClassBase;
*/
public class OxmVlanVidDeserializer extends AbstractOxmMatchEntryDeserializer
implements OFDeserializer<MatchEntry> {
-
@Override
public MatchEntry deserialize(ByteBuf input) {
MatchEntryBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
vlanBuilder.setCfiBit((vidEntryValue & 1 << 12) != 0); // cfi is 13-th bit
vlanBuilder.setVlanVid(Uint16.valueOf(vidEntryValue & (1 << 12) - 1)); // value without 13-th bit
if (builder.isHasMask()) {
- vlanBuilder.setMask(OxmDeserializerHelper
- .convertMask(input, EncodeConstants.SIZE_OF_SHORT_IN_BYTES));
+ vlanBuilder.setMask(OxmDeserializerHelper.convertMask(input, Short.BYTES));
}
caseBuilder.setVlanVid(vlanBuilder.build());
builder.setMatchEntryValue(caseBuilder.build());
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.TcpFlagsContainerBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.approved.extensions.rev160802.oxm.container.match.entry.value.experimenter.id._case.TcpFlagsBuilder;
*/
public class OnfOxmTcpFlagsDeserializer extends AbstractOxmExperimenterMatchEntryDeserializer
implements OFDeserializer<MatchEntry> {
-
@Override
public MatchEntry deserialize(ByteBuf input) {
MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder(deserializeHeader(input));
TcpFlagsBuilder flagsBuilder = new TcpFlagsBuilder();
flagsBuilder.setFlags(readUint16(input));
if (hasMask) {
- byte[] mask = new byte[EncodeConstants.SIZE_OF_SHORT_IN_BYTES];
+ byte[] mask = new byte[Short.BYTES];
input.readBytes(mask);
flagsBuilder.setMask(mask);
}
package org.opendaylight.openflowjava.protocol.impl.serialization.match;
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.oxm.rev150225.match.entries.grouping.MatchEntry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ArpOpCase;
* @author michal.polkorab
*/
public class OxmArpOpSerializer extends AbstractOxmMatchEntrySerializer {
-
@Override
public void serialize(MatchEntry entry, ByteBuf outBuffer) {
super.serialize(entry, outBuffer);
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ return Short.BYTES;
}
}
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ return Integer.BYTES;
}
}
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ return Integer.BYTES;
}
}
package org.opendaylight.openflowjava.protocol.impl.serialization.match;
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.oxm.rev150225.match.entries.grouping.MatchEntry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.EthTypeCase;
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ return Short.BYTES;
}
}
package org.opendaylight.openflowjava.protocol.impl.serialization.match;
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.oxm.rev150225.match.entries.grouping.MatchEntry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Icmpv4CodeCase;
* @author michal.polkorab
*/
public class OxmIcmpv4CodeSerializer extends AbstractOxmMatchEntrySerializer {
-
@Override
public void serialize(MatchEntry entry, ByteBuf outBuffer) {
super.serialize(entry, outBuffer);
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ return Byte.BYTES;
}
}
package org.opendaylight.openflowjava.protocol.impl.serialization.match;
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.oxm.rev150225.match.entries.grouping.MatchEntry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Icmpv4TypeCase;
* @author michal.polkorab
*/
public class OxmIcmpv4TypeSerializer extends AbstractOxmMatchEntrySerializer {
-
@Override
public void serialize(MatchEntry entry, ByteBuf outBuffer) {
super.serialize(entry, outBuffer);
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ return Byte.BYTES;
}
}
package org.opendaylight.openflowjava.protocol.impl.serialization.match;
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.oxm.rev150225.match.entries.grouping.MatchEntry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Icmpv6CodeCase;
* @author michal.polkorab
*/
public class OxmIcmpv6CodeSerializer extends AbstractOxmMatchEntrySerializer {
-
@Override
public void serialize(MatchEntry entry, ByteBuf outBuffer) {
super.serialize(entry, outBuffer);
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ return Byte.BYTES;
}
}
package org.opendaylight.openflowjava.protocol.impl.serialization.match;
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.oxm.rev150225.match.entries.grouping.MatchEntry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Icmpv6TypeCase;
* @author michal.polkorab
*/
public class OxmIcmpv6TypeSerializer extends AbstractOxmMatchEntrySerializer {
-
@Override
public void serialize(MatchEntry entry, ByteBuf outBuffer) {
super.serialize(entry, outBuffer);
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ return Byte.BYTES;
}
}
package org.opendaylight.openflowjava.protocol.impl.serialization.match;
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.oxm.rev150225.match.entries.grouping.MatchEntry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.InPhyPortCase;
* @author michal.polkorab
*/
public class OxmInPhyPortSerializer extends AbstractOxmMatchEntrySerializer {
-
@Override
public void serialize(MatchEntry entry, ByteBuf outBuffer) {
super.serialize(entry, outBuffer);
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ return Integer.BYTES;
}
}
package org.opendaylight.openflowjava.protocol.impl.serialization.match;
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.oxm.rev150225.match.entries.grouping.MatchEntry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.InPortCase;
* @author michal.polkorab
*/
public class OxmInPortSerializer extends AbstractOxmMatchEntrySerializer {
-
@Override
public void serialize(MatchEntry entry, ByteBuf outBuffer) {
super.serialize(entry, outBuffer);
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ return Integer.BYTES;
}
}
package org.opendaylight.openflowjava.protocol.impl.serialization.match;
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.oxm.rev150225.match.entries.grouping.MatchEntry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.IpDscpCase;
* @author michal.polkorab
*/
public class OxmIpDscpSerializer extends AbstractOxmMatchEntrySerializer {
-
@Override
public void serialize(MatchEntry entry, ByteBuf outBuffer) {
super.serialize(entry, outBuffer);
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ return Byte.BYTES;
}
}
package org.opendaylight.openflowjava.protocol.impl.serialization.match;
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.oxm.rev150225.match.entries.grouping.MatchEntry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.IpEcnCase;
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ return Byte.BYTES;
}
}
package org.opendaylight.openflowjava.protocol.impl.serialization.match;
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.oxm.rev150225.match.entries.grouping.MatchEntry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.IpProtoCase;
* @author michal.polkorab
*/
public class OxmIpProtoSerializer extends AbstractOxmMatchEntrySerializer {
-
@Override
public void serialize(MatchEntry entry, ByteBuf outBuffer) {
super.serialize(entry, outBuffer);
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ return Byte.BYTES;
}
}
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ return Integer.BYTES;
}
}
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ return Integer.BYTES;
}
}
package org.opendaylight.openflowjava.protocol.impl.serialization.match;
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.util.ByteBufUtils;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Ipv6ExthdrFlags;
* @author michal.polkorab
*/
public class OxmIpv6ExtHdrSerializer extends AbstractOxmMatchEntrySerializer {
-
@Override
public void serialize(MatchEntry entry, ByteBuf outBuffer) {
super.serialize(entry, outBuffer);
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ return Short.BYTES;
}
}
package org.opendaylight.openflowjava.protocol.impl.serialization.match;
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.oxm.rev150225.match.entries.grouping.MatchEntry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Ipv6FlabelCase;
* @author michal.polkorab
*/
public class OxmIpv6FlabelSerializer extends AbstractOxmMatchEntrySerializer {
-
@Override
public void serialize(MatchEntry entry, ByteBuf outBuffer) {
super.serialize(entry, outBuffer);
Ipv6FlabelCase entryValue = (Ipv6FlabelCase) entry.getMatchEntryValue();
outBuffer.writeInt(entryValue.getIpv6Flabel().getIpv6Flabel().getValue().intValue());
if (entry.isHasMask()) {
- writeMask(entryValue.getIpv6Flabel().getMask(), outBuffer, EncodeConstants.SIZE_OF_INT_IN_BYTES);
+ writeMask(entryValue.getIpv6Flabel().getMask(), outBuffer, Integer.BYTES);
}
}
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ return Integer.BYTES;
}
}
package org.opendaylight.openflowjava.protocol.impl.serialization.match;
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.oxm.rev150225.match.entries.grouping.MatchEntry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.MetadataCase;
* @author michal.polkorab
*/
public class OxmMetadataSerializer extends AbstractOxmMatchEntrySerializer {
-
@Override
public void serialize(MatchEntry entry, ByteBuf outBuffer) {
super.serialize(entry, outBuffer);
MetadataCase entryValue = (MetadataCase) entry.getMatchEntryValue();
outBuffer.writeBytes(entryValue.getMetadata().getMetadata());
if (entry.isHasMask()) {
- writeMask(entryValue.getMetadata().getMask(), outBuffer,
- EncodeConstants.SIZE_OF_LONG_IN_BYTES);
+ writeMask(entryValue.getMetadata().getMask(), outBuffer, Long.BYTES);
}
}
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_LONG_IN_BYTES;
+ return Long.BYTES;
}
}
package org.opendaylight.openflowjava.protocol.impl.serialization.match;
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.oxm.rev150225.match.entries.grouping.MatchEntry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.MplsBosCase;
* @author michal.polkorab
*/
public class OxmMplsBosSerializer extends AbstractOxmMatchEntrySerializer {
-
@Override
public void serialize(MatchEntry entry, ByteBuf outBuffer) {
super.serialize(entry, outBuffer);
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ return Byte.BYTES;
}
}
package org.opendaylight.openflowjava.protocol.impl.serialization.match;
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.oxm.rev150225.match.entries.grouping.MatchEntry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.MplsLabelCase;
* @author michal.polkorab
*/
public class OxmMplsLabelSerializer extends AbstractOxmMatchEntrySerializer {
-
@Override
public void serialize(MatchEntry entry, ByteBuf outBuffer) {
super.serialize(entry, outBuffer);
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ return Integer.BYTES;
}
}
package org.opendaylight.openflowjava.protocol.impl.serialization.match;
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.oxm.rev150225.match.entries.grouping.MatchEntry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.MplsTcCase;
* @author michal.polkorab
*/
public class OxmMplsTcSerializer extends AbstractOxmMatchEntrySerializer {
-
@Override
public void serialize(MatchEntry entry, ByteBuf outBuffer) {
super.serialize(entry, outBuffer);
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ return Byte.BYTES;
}
}
* 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;
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.oxm.rev150225.match.entries.grouping.MatchEntry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.PacketTypeCase;
public class OxmPacketTypeSerializer extends AbstractOxmMatchEntrySerializer {
-
@Override
public void serialize(MatchEntry entry, ByteBuf outBuffer) {
super.serialize(entry, outBuffer);
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ return Integer.BYTES;
}
}
package org.opendaylight.openflowjava.protocol.impl.serialization.match;
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.oxm.rev150225.match.entries.grouping.MatchEntry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.SctpDstCase;
* @author michal.polkorab
*/
public class OxmSctpDstSerializer extends AbstractOxmMatchEntrySerializer {
-
@Override
public void serialize(MatchEntry entry, ByteBuf outBuffer) {
super.serialize(entry, outBuffer);
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ return Short.BYTES;
}
}
package org.opendaylight.openflowjava.protocol.impl.serialization.match;
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.oxm.rev150225.match.entries.grouping.MatchEntry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.SctpSrcCase;
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ return Short.BYTES;
}
}
package org.opendaylight.openflowjava.protocol.impl.serialization.match;
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.oxm.rev150225.match.entries.grouping.MatchEntry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.TcpDstCase;
* @author michal.polkorab
*/
public class OxmTcpDstSerializer extends AbstractOxmMatchEntrySerializer {
-
@Override
public void serialize(MatchEntry entry, ByteBuf outBuffer) {
super.serialize(entry, outBuffer);
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ return Short.BYTES;
}
}
package org.opendaylight.openflowjava.protocol.impl.serialization.match;
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.oxm.rev150225.match.entries.grouping.MatchEntry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.TcpSrcCase;
* @author michal.polkorab
*/
public class OxmTcpSrcSerializer extends AbstractOxmMatchEntrySerializer {
-
@Override
public void serialize(MatchEntry entry, ByteBuf outBuffer) {
super.serialize(entry, outBuffer);
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ return Short.BYTES;
}
}
package org.opendaylight.openflowjava.protocol.impl.serialization.match;
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.oxm.rev150225.match.entries.grouping.MatchEntry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.TunnelIdCase;
* @author michal.polkorab
*/
public class OxmTunnelIdSerializer extends AbstractOxmMatchEntrySerializer {
-
@Override
public void serialize(MatchEntry entry, ByteBuf outBuffer) {
super.serialize(entry, outBuffer);
TunnelIdCase entryValue = (TunnelIdCase) entry.getMatchEntryValue();
outBuffer.writeBytes(entryValue.getTunnelId().getTunnelId());
if (entry.isHasMask()) {
- writeMask(entryValue.getTunnelId().getMask(), outBuffer,
- EncodeConstants.SIZE_OF_LONG_IN_BYTES);
+ writeMask(entryValue.getTunnelId().getMask(), outBuffer, Long.BYTES);
}
}
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_LONG_IN_BYTES;
+ return Long.BYTES;
}
}
package org.opendaylight.openflowjava.protocol.impl.serialization.match;
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.oxm.rev150225.match.entries.grouping.MatchEntry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.UdpDstCase;
* @author michal.polkorab
*/
public class OxmUdpDstSerializer extends AbstractOxmMatchEntrySerializer {
-
@Override
public void serialize(MatchEntry entry, ByteBuf outBuffer) {
super.serialize(entry, outBuffer);
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ return Short.BYTES;
}
}
package org.opendaylight.openflowjava.protocol.impl.serialization.match;
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.oxm.rev150225.match.entries.grouping.MatchEntry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.UdpSrcCase;
* @author michal.polkorab
*/
public class OxmUdpSrcSerializer extends AbstractOxmMatchEntrySerializer {
-
@Override
public void serialize(MatchEntry entry, ByteBuf outBuffer) {
super.serialize(entry, outBuffer);
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ return Short.BYTES;
}
-
}
package org.opendaylight.openflowjava.protocol.impl.serialization.match;
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.oxm.rev150225.match.entries.grouping.MatchEntry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.VlanPcpCase;
* @author michal.polkorab
*/
public class OxmVlanPcpSerializer extends AbstractOxmMatchEntrySerializer {
-
@Override
public void serialize(MatchEntry entry, ByteBuf outBuffer) {
super.serialize(entry, outBuffer);
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ return Byte.BYTES;
}
-
}
package org.opendaylight.openflowjava.protocol.impl.serialization.match;
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.oxm.rev150225.match.entries.grouping.MatchEntry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.VlanVidCase;
* @author michal.polkorab
*/
public class OxmVlanVidSerializer extends AbstractOxmMatchEntrySerializer {
-
@Override
public void serialize(MatchEntry entry, ByteBuf outBuffer) {
super.serialize(entry, outBuffer);
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ return Short.BYTES;
}
-
}
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.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(final MatchEntry entry, final ByteBuf outBuffer) {
serializeHeader(entry, outBuffer);
}
//Add experimenter-id lenge
- length = length + EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ length = length + Integer.BYTES;
out.writeByte(fieldAndMask);
out.writeByte(length);
}
*/
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ return Short.BYTES;
}
}
@Override
public MessageCodeKey make(final ByteBuf input) {
int oxmClass = input.getUnsignedShort(input.readerIndex());
- int oxmField = input.getUnsignedByte(input.readerIndex()
- + EncodeConstants.SIZE_OF_SHORT_IN_BYTES) >>> 1;
+ int oxmField = input.getUnsignedByte(input.readerIndex() + Short.BYTES) >>> 1;
MatchEntryDeserializerKey key = new MatchEntryDeserializerKey(getVersion(),
oxmClass, oxmField);
if (oxmClass == EncodeConstants.EXPERIMENTER_VALUE) {
- long expId = input.getUnsignedInt(input.readerIndex() + EncodeConstants.SIZE_OF_SHORT_IN_BYTES
- + 2 * EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ long expId = input.getUnsignedInt(input.readerIndex() + Short.BYTES + 2 * Byte.BYTES);
key.setExperimenterId(Uint32.valueOf(expId));
return key;
}
public MessageCodeKey make(final ByteBuf input) {
int type = input.getUnsignedShort(input.readerIndex());
if (type == EncodeConstants.EXPERIMENTER_VALUE) {
- Long expId = input.getUnsignedInt(input.readerIndex()
- + 2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ Long expId = input.getUnsignedInt(input.readerIndex() + 2 * Short.BYTES);
return new ExperimenterActionDeserializerKey(getVersion(), expId);
}
ActionDeserializerKey actionDeserializerKey = new ActionDeserializerKey(getVersion(), type, null);
public MessageCodeKey make(final ByteBuf input) {
int type = input.getUnsignedShort(input.readerIndex());
if (type == EncodeConstants.EXPERIMENTER_VALUE) {
- Long expId = input.getUnsignedInt(input.readerIndex()
- + 2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ Long expId = input.getUnsignedInt(input.readerIndex() + 2 * Short.BYTES);
return new ExperimenterInstructionDeserializerKey(getVersion(), expId);
}
return new InstructionDeserializerKey(getVersion(), type, null);
* 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.util;
import io.netty.buffer.ByteBuf;
import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderDeserializer;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
import org.opendaylight.openflowjava.protocol.api.keys.MessageCodeKey;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
}
exceptionLogged = true;
}
- input.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ input.skipBytes(2 * Short.BYTES);
continue;
}
E item = deserializer.deserializeHeader(input);
CodeKeyMaker keyMaker = CodeKeyMakerFactory
.createMatchEntriesKeyMaker(EncodeConstants.OF13_VERSION_ID);
List<MatchEntry> entries = ListDeserializer.deserializeList(EncodeConstants.OF13_VERSION_ID,
- length - 2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES, input, keyMaker, registry);
+ length - 2 * Short.BYTES, input, keyMaker, registry);
builder.setMatchEntry(entries);
int paddingRemainder = length % EncodeConstants.PADDING;
if (paddingRemainder != 0) {
out.readShort();
BufferHelper.checkHeaderV13(out,(byte) 14, 128);
- cookie = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ cookie = new byte[Long.BYTES];
out.readBytes(cookie);
Assert.assertEquals("Wrong cookie", message.getCookie(), Uint64.valueOf("FF01040106000701", 16));
- cookieMask = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ cookieMask = new byte[Long.BYTES];
out.readBytes(cookieMask);
Assert.assertEquals("Wrong cookieMask", message.getCookieMask(), Uint64.valueOf("FF05000009300030", 16));
Assert.assertEquals("Wrong tableId", message.getTableId().getValue().intValue(), out.readUnsignedByte());
Assert.assertEquals("Wrong flags", message.getFlags(), createFlowModFlagsFromBitmap(out.readUnsignedShort()));
out.skipBytes(PADDING_IN_FLOW_MOD_MESSAGE);
Assert.assertEquals("Wrong match type", 1, out.readUnsignedShort());
- out.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ out.skipBytes(Short.BYTES);
Assert.assertEquals("Wrong oxm class", 0x8000, out.readUnsignedShort());
short fieldAndMask = out.readUnsignedByte();
Assert.assertEquals("Wrong oxm hasMask", 0, fieldAndMask & 1);
Assert.assertEquals("Wrong oxm field", 1, fieldAndMask >> 1);
- out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ out.skipBytes(Byte.BYTES);
Assert.assertEquals("Wrong oxm value", 42, out.readUnsignedInt());
Assert.assertEquals("Wrong oxm class", 0x8000, out.readUnsignedShort());
fieldAndMask = out.readUnsignedByte();
Assert.assertEquals("Wrong oxm hasMask", 0, fieldAndMask & 1);
Assert.assertEquals("Wrong oxm field", 9, fieldAndMask >> 1);
- out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ out.skipBytes(Byte.BYTES);
Assert.assertEquals("Wrong oxm value", 4, out.readUnsignedByte());
out.skipBytes(7);
Assert.assertEquals("Wrong instruction type", 1, out.readUnsignedShort());
- out.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ out.skipBytes(Short.BYTES);
Assert.assertEquals("Wrong instruction value", 43, out.readUnsignedByte());
out.skipBytes(3);
Assert.assertEquals("Wrong instruction type", 2, out.readUnsignedShort());
- out.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
- out.skipBytes(EncodeConstants.SIZE_OF_INT_IN_BYTES);
- byte[] cookieRead = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ out.skipBytes(Short.BYTES);
+ out.skipBytes(Integer.BYTES);
+ byte[] cookieRead = new byte[Long.BYTES];
out.readBytes(cookieRead);
- byte[] cookieMaskRead = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ byte[] cookieMaskRead = new byte[Long.BYTES];
out.readBytes(cookieMaskRead);
Assert.assertArrayEquals("Wrong metadata", cookie, cookieRead);
Assert.assertArrayEquals("Wrong metadata mask", cookieMask, cookieMaskRead);
Assert.assertEquals("Wrong Packet count", message.getPacketCount().longValue(), serializedBuffer.readLong());
Assert.assertEquals("Wrong Byte count", message.getByteCount().longValue(), serializedBuffer.readLong());
Assert.assertEquals("Wrong match type", 1, serializedBuffer.readUnsignedShort());
- serializedBuffer.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ serializedBuffer.skipBytes(Short.BYTES);
Assert.assertEquals("Wrong oxm class", 0x8000, serializedBuffer.readUnsignedShort());
short fieldAndMask = serializedBuffer.readUnsignedByte();
Assert.assertEquals("Wrong oxm hasMask", 0, fieldAndMask & 1);
Assert.assertEquals("Wrong oxm field", 1, fieldAndMask >> 1);
- serializedBuffer.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ serializedBuffer.skipBytes(Byte.BYTES);
Assert.assertEquals("Wrong oxm value", 42, serializedBuffer.readUnsignedInt());
Assert.assertEquals("Wrong oxm class", 0x8000, serializedBuffer.readUnsignedShort());
fieldAndMask = serializedBuffer.readUnsignedByte();
Assert.assertEquals("Wrong oxm hasMask", 0, fieldAndMask & 1);
Assert.assertEquals("Wrong oxm field", 9, fieldAndMask >> 1);
- serializedBuffer.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ serializedBuffer.skipBytes(Byte.BYTES);
Assert.assertEquals("Wrong oxm value", 4, serializedBuffer.readUnsignedByte());
serializedBuffer.skipBytes(7);
}
private static List<BucketsList> createBucketsListFromBufer(ByteBuf out) {
final List<BucketsList> bucketsList = new ArrayList<>();
BucketsListBuilder bucketsBuilder = new BucketsListBuilder();
- out.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ out.skipBytes(Short.BYTES);
bucketsBuilder.setWeight(out.readUnsignedShort());
bucketsBuilder.setWatchPort(new PortNumber(out.readUnsignedInt()));
bucketsBuilder.setWatchGroup(out.readUnsignedInt());
Assert.assertEquals("Wrong Packet count", flowStats.getPacketCount().longValue(), output.readLong());
Assert.assertEquals("Wrong Byte count", flowStats.getByteCount().longValue(), output.readLong());
Assert.assertEquals("Wrong match type", 1, output.readUnsignedShort());
- output.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ output.skipBytes(Short.BYTES);
Assert.assertEquals("Wrong oxm class", 0x8000, output.readUnsignedShort());
short fieldAndMask = output.readUnsignedByte();
Assert.assertEquals("Wrong oxm hasMask", 0, fieldAndMask & 1);
Assert.assertEquals("Wrong oxm field", 1, fieldAndMask >> 1);
- output.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ output.skipBytes(Byte.BYTES);
Assert.assertEquals("Wrong oxm value", 42, output.readUnsignedInt());
Assert.assertEquals("Wrong oxm class", 0x8000, output.readUnsignedShort());
fieldAndMask = output.readUnsignedByte();
Assert.assertEquals("Wrong oxm hasMask", 0, fieldAndMask & 1);
Assert.assertEquals("Wrong oxm field", 9, fieldAndMask >> 1);
- output.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ output.skipBytes(Byte.BYTES);
Assert.assertEquals("Wrong oxm value", 4, output.readUnsignedByte());
output.skipBytes(7);
Assert.assertEquals("Wrong instruction type", 1, output.readUnsignedShort());
builder.setOutPort(output.readUnsignedInt());
builder.setOutGroup(output.readUnsignedInt());
output.skipBytes(PADDING_IN_MULTIPART_REQUEST_FLOW_BODY_02);
- byte[] cookie = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ byte[] cookie = new byte[Long.BYTES];
output.readBytes(cookie);
builder.setCookie(new BigInteger(1, cookie));
- byte[] cookieMask = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ byte[] cookieMask = new byte[Long.BYTES];
output.readBytes(cookieMask);
builder.setCookieMask(new BigInteger(1, cookieMask));
caseBuilder.setMultipartRequestFlow(builder.build());
builder.setOutPort(output.readUnsignedInt());
builder.setOutGroup(output.readUnsignedInt());
output.skipBytes(PADDING_IN_MULTIPART_REQUEST_AGGREGATE_BODY_02);
- byte[] cookie = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ byte[] cookie = new byte[Long.BYTES];
output.readBytes(cookie);
builder.setCookie(new BigInteger(1, cookie));
- byte[] cookieMask = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ byte[] cookieMask = new byte[Long.BYTES];
output.readBytes(cookieMask);
builder.setCookieMask(new BigInteger(1, cookieMask));
caseBuilder.setMultipartRequestAggregate(builder.build());
Assert.assertEquals("Wrong reason", message.getReason().getIntValue(), serializedBuffer.readUnsignedByte());
Assert.assertEquals("Wrong tableId", message.getTableId().getValue().intValue(),
serializedBuffer.readUnsignedByte());
- cookie = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ cookie = new byte[Long.BYTES];
serializedBuffer.readBytes(cookie);
Assert.assertEquals("Wrong cookie", message.getCookie(), Uint64.valueOf(new BigInteger(1, cookie)));
Assert.assertEquals("Wrong match type", 1, serializedBuffer.readUnsignedShort());
- serializedBuffer.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ serializedBuffer.skipBytes(Short.BYTES);
Assert.assertEquals("Wrong oxm class", 0x8000, serializedBuffer.readUnsignedShort());
short fieldAndMask = serializedBuffer.readUnsignedByte();
Assert.assertEquals("Wrong oxm hasMask", 0, fieldAndMask & 1);
Assert.assertEquals("Wrong oxm field", 1, fieldAndMask >> 1);
- serializedBuffer.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ serializedBuffer.skipBytes(Byte.BYTES);
Assert.assertEquals("Wrong oxm value", 42, serializedBuffer.readUnsignedInt());
Assert.assertEquals("Wrong oxm class", 0x8000, serializedBuffer.readUnsignedShort());
fieldAndMask = serializedBuffer.readUnsignedByte();
Assert.assertEquals("Wrong oxm hasMask", 0, fieldAndMask & 1);
Assert.assertEquals("Wrong oxm field", 9, fieldAndMask >> 1);
- serializedBuffer.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ serializedBuffer.skipBytes(Byte.BYTES);
Assert.assertEquals("Wrong oxm value", 4, serializedBuffer.readUnsignedByte());
serializedBuffer.skipBytes(7);
serializedBuffer.skipBytes(PADDING);
Assert.assertEquals("Wrong action type", 17, out.readUnsignedShort());
Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
Assert.assertEquals("Wrong ethertype", 25, out.readUnsignedShort());
- out.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ out.skipBytes(Short.BYTES);
Assert.assertEquals("Wrong action type", 18, out.readUnsignedShort());
Assert.assertEquals("Wrong action length", 8, out.readUnsignedShort());
out.skipBytes(PADDING_IN_ACTION_HEADER);
Assert.assertEquals("Wrong role", message.getRole().getIntValue(),
ControllerRole.forValue((int) serializedBuffer.readUnsignedInt()).getIntValue());
serializedBuffer.skipBytes(PADDING);
- byte[] genId = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ byte[] genId = new byte[Long.BYTES];
serializedBuffer.readBytes(genId);
Assert.assertEquals("Wrong generation ID", message.getGenerationId(), Uint64.valueOf(new BigInteger(1, genId)));
}
Assert.assertEquals("Wrong role", message.getRole().getIntValue(),
ControllerRole.forValue((int) out.readUnsignedInt()).getIntValue());
out.skipBytes(PADDING_IN_ROLE_REQUEST_MESSAGE);
- byte[] genId = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ byte[] genId = new byte[Long.BYTES];
out.readBytes(genId);
Assert.assertEquals("Wrong generation ID", message.getGenerationId(), Uint64.valueOf(new BigInteger(1, genId)));
}
out.skipBytes(5);
Assert.assertEquals("Wrong name", "AAAABBBBCCCCDDDDEEEEFFFFGGGG",
ByteBufUtils.decodeNullTerminatedString(out, 32));
- byte[] metadataMatch = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ byte[] metadataMatch = new byte[Long.BYTES];
out.readBytes(metadataMatch);
Assert.assertArrayEquals("Wrong metadata-match",
new byte[] {0x00, 0x01, 0x02, 0x03, 0x01, 0x04, 0x08, 0x01}, metadataMatch);
- byte[] metadataWrite = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ byte[] metadataWrite = new byte[Long.BYTES];
out.readBytes(metadataWrite);
Assert.assertArrayEquals("Wrong metadata-write",
new byte[] {0x00, 0x07, 0x01, 0x05, 0x01, 0x00, 0x03, 0x01}, metadataWrite);
out.skipBytes(5);
Assert.assertEquals("Wrong name", "AAAABBBBCCCCDDDDEEEEFFFFGGGG",
ByteBufUtils.decodeNullTerminatedString(out, 32));
- metadataMatch = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ metadataMatch = new byte[Long.BYTES];
out.readBytes(metadataMatch);
Assert.assertArrayEquals("Wrong metadata-match",
new byte[] {0x00, 0x01, 0x02, 0x03, 0x01, 0x04, 0x08, 0x01}, metadataMatch);
- metadataWrite = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ metadataWrite = new byte[Long.BYTES];
out.readBytes(metadataWrite);
Assert.assertArrayEquals("Wrong metadata-write",
new byte[] {0x00, 0x07, 0x01, 0x05, 0x01, 0x00, 0x03, 0x01}, metadataWrite);
out.skipBytes(5);
Assert.assertEquals("Wrong name", "AAAABBBBCCCCDDDDEEEEFFFFGGGG",
ByteBufUtils.decodeNullTerminatedString(out, 32));
- byte[] metadataMatch = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ byte[] metadataMatch = new byte[Long.BYTES];
out.readBytes(metadataMatch);
Assert.assertArrayEquals("Wrong metadata-match",
new byte[] {0x00, 0x01, 0x02, 0x03, 0x01, 0x04, 0x08, 0x01}, metadataMatch);
- byte[] metadataWrite = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ byte[] metadataWrite = new byte[Long.BYTES];
out.readBytes(metadataWrite);
Assert.assertArrayEquals("Wrong metadata-write",
new byte[] {0x00, 0x07, 0x01, 0x05, 0x01, 0x00, 0x03, 0x01}, metadataWrite);
* 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;
import static org.junit.Assert.assertEquals;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.PooledByteBufAllocator;
import org.junit.Test;
-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.oxm.rev150225.ArpOp;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OpenflowBasicClass;
*/
@Test
public void testGetValueLength() {
- assertEquals("Wrong value length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, serializer.getValueLength());
+ assertEquals("Wrong value length", Short.BYTES, serializer.getValueLength());
}
private static MatchEntryBuilder prepareArpOpMatchEntry(int value) {
short fieldAndMask = buffer.readUnsignedByte();
assertEquals("Wrong oxm-field", OxmMatchConstants.ARP_OP, fieldAndMask >>> 1);
assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, buffer.readUnsignedByte());
+ assertEquals("Wrong length", Short.BYTES, buffer.readUnsignedByte());
}
}
* 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;
import static org.junit.Assert.assertEquals;
import io.netty.buffer.PooledByteBufAllocator;
import org.junit.Assert;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.ArpSpa;
*/
@Test
public void testGetValueLength() {
- assertEquals("Wrong value length", EncodeConstants.SIZE_OF_INT_IN_BYTES, serializer.getValueLength());
+ assertEquals("Wrong value length", Integer.BYTES, serializer.getValueLength());
}
private static MatchEntryBuilder prepareMatchEntry(boolean hasMask, String value) {
assertEquals("Wrong oxm-field", OxmMatchConstants.ARP_SPA, fieldAndMask >>> 1);
assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
if (hasMask) {
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_LONG_IN_BYTES, buffer.readUnsignedByte());
+ assertEquals("Wrong length", Long.BYTES, buffer.readUnsignedByte());
} else {
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_INT_IN_BYTES, buffer.readUnsignedByte());
+ assertEquals("Wrong length", Integer.BYTES, buffer.readUnsignedByte());
}
}
}
* 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;
import static org.junit.Assert.assertEquals;
import io.netty.buffer.PooledByteBufAllocator;
import org.junit.Assert;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.ArpTpa;
*/
@Test
public void testGetValueLength() {
- assertEquals("Wrong value length", EncodeConstants.SIZE_OF_INT_IN_BYTES, serializer.getValueLength());
+ assertEquals("Wrong value length", Integer.BYTES, serializer.getValueLength());
}
private static MatchEntryBuilder prepareMatchEntry(boolean hasMask, String value) {
assertEquals("Wrong oxm-field", OxmMatchConstants.ARP_TPA, fieldAndMask >>> 1);
assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
if (hasMask) {
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_LONG_IN_BYTES, buffer.readUnsignedByte());
+ assertEquals("Wrong length", Long.BYTES, buffer.readUnsignedByte());
} else {
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_INT_IN_BYTES, buffer.readUnsignedByte());
+ assertEquals("Wrong length", Integer.BYTES, buffer.readUnsignedByte());
}
}
}
* 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;
import static org.junit.Assert.assertEquals;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.PooledByteBufAllocator;
import org.junit.Test;
-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.common.types.rev130731.EtherType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.EthType;
*/
@Test
public void testGetValueLength() {
- assertEquals("Wrong value length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, serializer.getValueLength());
+ assertEquals("Wrong value length", Short.BYTES, serializer.getValueLength());
}
private static MatchEntryBuilder prepareEthTypeMatchEntry(int type) {
short fieldAndMask = buffer.readUnsignedByte();
assertEquals("Wrong oxm-field", OxmMatchConstants.ETH_TYPE, fieldAndMask >>> 1);
assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, buffer.readUnsignedByte());
+ assertEquals("Wrong length", Short.BYTES, buffer.readUnsignedByte());
}
}
* 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;
import static org.junit.Assert.assertEquals;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.PooledByteBufAllocator;
import org.junit.Test;
-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.oxm.rev150225.Icmpv4Code;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OpenflowBasicClass;
*/
@Test
public void testGetValueLength() {
- assertEquals("Wrong value length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, serializer.getValueLength());
+ assertEquals("Wrong value length", Byte.BYTES, serializer.getValueLength());
}
private static MatchEntryBuilder prepareIcmpv4CodeMatchEntry(short value) {
short fieldAndMask = buffer.readUnsignedByte();
assertEquals("Wrong oxm-field", OxmMatchConstants.ICMPV4_CODE, fieldAndMask >>> 1);
assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, buffer.readUnsignedByte());
+ assertEquals("Wrong length", Byte.BYTES, buffer.readUnsignedByte());
}
}
* 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;
import static org.junit.Assert.assertEquals;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.PooledByteBufAllocator;
import org.junit.Test;
-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.oxm.rev150225.Icmpv4Type;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OpenflowBasicClass;
*/
@Test
public void testGetValueLength() {
- assertEquals("Wrong value length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, serializer.getValueLength());
+ assertEquals("Wrong value length", Byte.BYTES, serializer.getValueLength());
}
private static MatchEntryBuilder prepareIcmpv4TypeMatchEntry(short value) {
short fieldAndMask = buffer.readUnsignedByte();
assertEquals("Wrong oxm-field", OxmMatchConstants.ICMPV4_TYPE, fieldAndMask >>> 1);
assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, buffer.readUnsignedByte());
+ assertEquals("Wrong length", Byte.BYTES, buffer.readUnsignedByte());
}
}
* 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;
import static org.junit.Assert.assertEquals;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.PooledByteBufAllocator;
import org.junit.Test;
-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.oxm.rev150225.Icmpv6Code;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OpenflowBasicClass;
*/
@Test
public void testGetValueLength() {
- assertEquals("Wrong value length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, serializer.getValueLength());
+ assertEquals("Wrong value length", Byte.BYTES, serializer.getValueLength());
}
private static MatchEntryBuilder prepareIcmpv6CodeMatchEntry(short value) {
short fieldAndMask = buffer.readUnsignedByte();
assertEquals("Wrong oxm-field", OxmMatchConstants.ICMPV6_CODE, fieldAndMask >>> 1);
assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, buffer.readUnsignedByte());
+ assertEquals("Wrong length", Byte.BYTES, buffer.readUnsignedByte());
}
}
* 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;
import static org.junit.Assert.assertEquals;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.PooledByteBufAllocator;
import org.junit.Test;
-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.oxm.rev150225.Icmpv6Type;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OpenflowBasicClass;
*/
@Test
public void testGetValueLength() {
- assertEquals("Wrong value length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, serializer.getValueLength());
+ assertEquals("Wrong value length", Byte.BYTES, serializer.getValueLength());
}
private static MatchEntryBuilder prepareIcmpv6TypeMatchEntry(short value) {
short fieldAndMask = buffer.readUnsignedByte();
assertEquals("Wrong oxm-field", OxmMatchConstants.ICMPV6_TYPE, fieldAndMask >>> 1);
assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, buffer.readUnsignedByte());
+ assertEquals("Wrong length", Byte.BYTES, buffer.readUnsignedByte());
}
}
* 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;
import static org.junit.Assert.assertEquals;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.PooledByteBufAllocator;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Dscp;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.IpDscp;
*/
@Test
public void testGetValueLength() {
- assertEquals("Wrong value length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, serializer.getValueLength());
+ assertEquals("Wrong value length", Byte.BYTES, serializer.getValueLength());
}
private static MatchEntryBuilder prepareIpDscpMatchEntry(short value) {
short fieldAndMask = buffer.readUnsignedByte();
assertEquals("Wrong oxm-field", OxmMatchConstants.IP_DSCP, fieldAndMask >>> 1);
assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, buffer.readUnsignedByte());
+ assertEquals("Wrong length", Byte.BYTES, buffer.readUnsignedByte());
}
}
* 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;
import static org.junit.Assert.assertEquals;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.PooledByteBufAllocator;
import org.junit.Test;
-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.oxm.rev150225.IpProto;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OpenflowBasicClass;
*/
@Test
public void testGetValueLength() {
- assertEquals("Wrong value length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, serializer.getValueLength());
+ assertEquals("Wrong value length", Byte.BYTES, serializer.getValueLength());
}
private static MatchEntryBuilder prepareMatchEntry(short value) {
short fieldAndMask = buffer.readUnsignedByte();
assertEquals("Wrong oxm-field", OxmMatchConstants.IP_PROTO, fieldAndMask >>> 1);
assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, buffer.readUnsignedByte());
+ assertEquals("Wrong length", Byte.BYTES, buffer.readUnsignedByte());
}
}
* 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;
import static org.junit.Assert.assertEquals;
import io.netty.buffer.PooledByteBufAllocator;
import org.junit.Assert;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Ipv4Dst;
*/
@Test
public void testGetValueLength() {
- assertEquals("Wrong value length", EncodeConstants.SIZE_OF_INT_IN_BYTES, serializer.getValueLength());
+ assertEquals("Wrong value length", Integer.BYTES, serializer.getValueLength());
}
private static MatchEntryBuilder prepareMatchEntry(boolean hasMask, String value) {
assertEquals("Wrong oxm-field", OxmMatchConstants.IPV4_DST, fieldAndMask >>> 1);
assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
if (hasMask) {
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_LONG_IN_BYTES, buffer.readUnsignedByte());
+ assertEquals("Wrong length", Long.BYTES, buffer.readUnsignedByte());
} else {
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_INT_IN_BYTES, buffer.readUnsignedByte());
+ assertEquals("Wrong length", Integer.BYTES, buffer.readUnsignedByte());
}
}
}
* 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;
import static org.junit.Assert.assertEquals;
import io.netty.buffer.PooledByteBufAllocator;
import org.junit.Assert;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Ipv4Src;
*/
@Test
public void testGetValueLength() {
- assertEquals("Wrong value length", EncodeConstants.SIZE_OF_INT_IN_BYTES, serializer.getValueLength());
+ assertEquals("Wrong value length", Integer.BYTES, serializer.getValueLength());
}
private static MatchEntryBuilder prepareMatchEntry(boolean hasMask, String value) {
assertEquals("Wrong oxm-field", OxmMatchConstants.IPV4_SRC, fieldAndMask >>> 1);
assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
if (hasMask) {
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_LONG_IN_BYTES, buffer.readUnsignedByte());
+ assertEquals("Wrong length", Long.BYTES, buffer.readUnsignedByte());
} else {
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_INT_IN_BYTES, buffer.readUnsignedByte());
+ assertEquals("Wrong length", Integer.BYTES, buffer.readUnsignedByte());
}
}
}
* 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;
import static org.junit.Assert.assertEquals;
import io.netty.buffer.PooledByteBufAllocator;
import org.junit.Assert;
import org.junit.Test;
-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.common.types.rev130731.Ipv6ExthdrFlags;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Ipv6Exthdr;
*/
@Test
public void testGetValueLength() {
- assertEquals("Wrong value length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, serializer.getValueLength());
+ assertEquals("Wrong value length", Short.BYTES, serializer.getValueLength());
}
private static MatchEntryBuilder prepareIpv6ExtHdrMatchEntry(boolean hasMask, Ipv6ExthdrFlags flags) {
assertEquals("Wrong oxm-field", OxmMatchConstants.IPV6_EXTHDR, fieldAndMask >>> 1);
assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
if (hasMask) {
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_INT_IN_BYTES, buffer.readUnsignedByte());
+ assertEquals("Wrong length", Integer.BYTES, buffer.readUnsignedByte());
} else {
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, buffer.readUnsignedByte());
+ assertEquals("Wrong length", Short.BYTES, buffer.readUnsignedByte());
}
}
}
* 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;
import static org.junit.Assert.assertEquals;
import io.netty.buffer.PooledByteBufAllocator;
import org.junit.Assert;
import org.junit.Test;
-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.oxm.rev150225.Metadata;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OpenflowBasicClass;
*/
@Test
public void testGetValueLength() {
- assertEquals("Wrong value length", EncodeConstants.SIZE_OF_LONG_IN_BYTES, serializer.getValueLength());
+ assertEquals("Wrong value length", Long.BYTES, serializer.getValueLength());
}
private static MatchEntryBuilder prepareMatchEntry(boolean hasMask, byte[] value) {
assertEquals("Wrong oxm-field", OxmMatchConstants.METADATA, fieldAndMask >>> 1);
assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
if (hasMask) {
- assertEquals("Wrong length", 2 * EncodeConstants.SIZE_OF_LONG_IN_BYTES, buffer.readUnsignedByte());
+ assertEquals("Wrong length", 2 * Long.BYTES, buffer.readUnsignedByte());
} else {
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_LONG_IN_BYTES, buffer.readUnsignedByte());
+ assertEquals("Wrong length", Long.BYTES, buffer.readUnsignedByte());
}
}
}
* 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;
import static org.junit.Assert.assertEquals;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.PooledByteBufAllocator;
import org.junit.Test;
-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.oxm.rev150225.MplsBos;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OpenflowBasicClass;
*/
@Test
public void testGetValueLength() {
- assertEquals("Wrong value length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, serializer.getValueLength());
+ assertEquals("Wrong value length", Byte.BYTES, serializer.getValueLength());
}
private static MatchEntryBuilder prepareMplsBosMatchEntry(boolean bos) {
short fieldAndMask = buffer.readUnsignedByte();
assertEquals("Wrong oxm-field", OxmMatchConstants.MPLS_BOS, fieldAndMask >>> 1);
assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, buffer.readUnsignedByte());
+ assertEquals("Wrong length", Byte.BYTES, buffer.readUnsignedByte());
}
}
* 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;
import static org.junit.Assert.assertEquals;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.PooledByteBufAllocator;
import org.junit.Test;
-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.oxm.rev150225.MplsLabel;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OpenflowBasicClass;
*/
@Test
public void testGetValueLength() {
- assertEquals("Wrong value length", EncodeConstants.SIZE_OF_INT_IN_BYTES, serializer.getValueLength());
+ assertEquals("Wrong value length", Integer.BYTES, serializer.getValueLength());
}
private static MatchEntryBuilder prepareMplsLabelMatchEntry(long label) {
short fieldAndMask = buffer.readUnsignedByte();
assertEquals("Wrong oxm-field", OxmMatchConstants.MPLS_LABEL, fieldAndMask >>> 1);
assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_INT_IN_BYTES, buffer.readUnsignedByte());
+ assertEquals("Wrong length", Integer.BYTES, buffer.readUnsignedByte());
}
}
* 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;
import static org.junit.Assert.assertEquals;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.PooledByteBufAllocator;
import org.junit.Test;
-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.oxm.rev150225.MplsTc;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OpenflowBasicClass;
*/
@Test
public void testGetValueLength() {
- assertEquals("Wrong value length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, serializer.getValueLength());
+ assertEquals("Wrong value length", Byte.BYTES, serializer.getValueLength());
}
private static MatchEntryBuilder prepareMplsTcMatchEntry(short value) {
short fieldAndMask = buffer.readUnsignedByte();
assertEquals("Wrong oxm-field", OxmMatchConstants.MPLS_TC, fieldAndMask >>> 1);
assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, buffer.readUnsignedByte());
+ assertEquals("Wrong length", Byte.BYTES, buffer.readUnsignedByte());
}
}
import io.netty.buffer.PooledByteBufAllocator;
import org.junit.Before;
import org.junit.Test;
-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.oxm.rev150225.OpenflowBasicClass;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.PacketType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.packet.type._case.PacketTypeBuilder;
public class OxmPacketTypeSerializerTest {
-
private ByteBuf buffer;
private OxmPacketTypeSerializer serializer;
short fieldMask = buffer.readUnsignedByte();
assertEquals(OxmMatchConstants.PACKET_TYPE, fieldMask >> 1);
assertEquals(0, fieldMask & 1);
- assertEquals(EncodeConstants.SIZE_OF_INT_IN_BYTES, buffer.readUnsignedByte());
+ assertEquals(Integer.BYTES, buffer.readUnsignedByte());
assertEquals(packetType, buffer.readUnsignedInt());
}
.setMatchEntryValue(packetTypeCase)
.build();
}
-}
\ No newline at end of file
+}
* 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;
import static org.junit.Assert.assertEquals;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.PooledByteBufAllocator;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OpenflowBasicClass;
*/
@Test
public void testGetValueLength() {
- assertEquals("Wrong value length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, serializer.getValueLength());
+ assertEquals("Wrong value length", Short.BYTES, serializer.getValueLength());
}
private static MatchEntryBuilder prepareMatchEntry(int value) {
short fieldAndMask = buffer.readUnsignedByte();
assertEquals("Wrong oxm-field", OxmMatchConstants.SCTP_DST, fieldAndMask >>> 1);
assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, buffer.readUnsignedByte());
+ assertEquals("Wrong length", Short.BYTES, buffer.readUnsignedByte());
}
}
* 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;
import static org.junit.Assert.assertEquals;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.PooledByteBufAllocator;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OpenflowBasicClass;
*/
@Test
public void testGetValueLength() {
- assertEquals("Wrong value length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, serializer.getValueLength());
+ assertEquals("Wrong value length", Short.BYTES, serializer.getValueLength());
}
private static MatchEntryBuilder prepareMatchEntry(int value) {
short fieldAndMask = buffer.readUnsignedByte();
assertEquals("Wrong oxm-field", OxmMatchConstants.SCTP_SRC, fieldAndMask >>> 1);
assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, buffer.readUnsignedByte());
+ assertEquals("Wrong length", Short.BYTES, buffer.readUnsignedByte());
}
}
* 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;
import static org.junit.Assert.assertEquals;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.PooledByteBufAllocator;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OpenflowBasicClass;
*/
@Test
public void testGetValueLength() {
- assertEquals("Wrong value length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, serializer.getValueLength());
+ assertEquals("Wrong value length", Short.BYTES, serializer.getValueLength());
}
private static MatchEntryBuilder prepareMatchEntry(int value) {
short fieldAndMask = buffer.readUnsignedByte();
assertEquals("Wrong oxm-field", OxmMatchConstants.TCP_DST, fieldAndMask >>> 1);
assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, buffer.readUnsignedByte());
+ assertEquals("Wrong length", Short.BYTES, buffer.readUnsignedByte());
}
}
* 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;
import static org.junit.Assert.assertEquals;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.PooledByteBufAllocator;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OpenflowBasicClass;
*/
@Test
public void testGetValueLength() {
- assertEquals("Wrong value length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, serializer.getValueLength());
+ assertEquals("Wrong value length", Short.BYTES, serializer.getValueLength());
}
private static MatchEntryBuilder prepareMatchEntry(int value) {
short fieldAndMask = buffer.readUnsignedByte();
assertEquals("Wrong oxm-field", OxmMatchConstants.TCP_SRC, fieldAndMask >>> 1);
assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, buffer.readUnsignedByte());
+ assertEquals("Wrong length", Short.BYTES, buffer.readUnsignedByte());
}
}
* 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;
import static org.junit.Assert.assertEquals;
import io.netty.buffer.PooledByteBufAllocator;
import org.junit.Assert;
import org.junit.Test;
-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.oxm.rev150225.OpenflowBasicClass;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.TunnelId;
*/
@Test
public void testGetValueLength() {
- assertEquals("Wrong value length", EncodeConstants.SIZE_OF_LONG_IN_BYTES, serializer.getValueLength());
+ assertEquals("Wrong value length", Long.BYTES, serializer.getValueLength());
}
private static MatchEntryBuilder prepareMatchEntry(boolean hasMask, byte[] value) {
assertEquals("Wrong oxm-field", OxmMatchConstants.TUNNEL_ID, fieldAndMask >>> 1);
assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
if (hasMask) {
- assertEquals("Wrong length", 2 * EncodeConstants.SIZE_OF_LONG_IN_BYTES, buffer.readUnsignedByte());
+ assertEquals("Wrong length", 2 * Long.BYTES, buffer.readUnsignedByte());
} else {
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_LONG_IN_BYTES, buffer.readUnsignedByte());
+ assertEquals("Wrong length", Long.BYTES, buffer.readUnsignedByte());
}
}
}
* 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;
import static org.junit.Assert.assertEquals;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.PooledByteBufAllocator;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OpenflowBasicClass;
*/
@Test
public void testGetValueLength() {
- assertEquals("Wrong value length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, serializer.getValueLength());
+ assertEquals("Wrong value length", Short.BYTES, serializer.getValueLength());
}
private static MatchEntryBuilder prepareMatchEntry(int value) {
short fieldAndMask = buffer.readUnsignedByte();
assertEquals("Wrong oxm-field", OxmMatchConstants.UDP_DST, fieldAndMask >>> 1);
assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, buffer.readUnsignedByte());
+ assertEquals("Wrong length", Short.BYTES, buffer.readUnsignedByte());
}
}
* 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;
import static org.junit.Assert.assertEquals;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.PooledByteBufAllocator;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OpenflowBasicClass;
*/
@Test
public void testGetValueLength() {
- assertEquals("Wrong value length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, serializer.getValueLength());
+ assertEquals("Wrong value length", Short.BYTES, serializer.getValueLength());
}
private static MatchEntryBuilder prepareMatchEntry(int value) {
short fieldAndMask = buffer.readUnsignedByte();
assertEquals("Wrong oxm-field", OxmMatchConstants.UDP_SRC, fieldAndMask >>> 1);
assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, buffer.readUnsignedByte());
+ assertEquals("Wrong length", Short.BYTES, buffer.readUnsignedByte());
}
}
* 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;
import static org.junit.Assert.assertEquals;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.PooledByteBufAllocator;
import org.junit.Test;
-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.oxm.rev150225.OpenflowBasicClass;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.VlanPcp;
*/
@Test
public void testGetValueLength() {
- assertEquals("Wrong value length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, serializer.getValueLength());
+ assertEquals("Wrong value length", Byte.BYTES, serializer.getValueLength());
}
private static MatchEntryBuilder prepareVlanPcpMatchEntry(short value) {
short fieldAndMask = buffer.readUnsignedByte();
assertEquals("Wrong oxm-field", OxmMatchConstants.VLAN_PCP, fieldAndMask >>> 1);
assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, buffer.readUnsignedByte());
+ assertEquals("Wrong length", Byte.BYTES, buffer.readUnsignedByte());
}
}
* 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;
import static org.junit.Assert.assertEquals;
import io.netty.buffer.PooledByteBufAllocator;
import org.junit.Assert;
import org.junit.Test;
-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.oxm.rev150225.OpenflowBasicClass;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.VlanVid;
*/
@Test
public void testGetValueLength() {
- assertEquals("Wrong value length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, serializer.getValueLength());
+ assertEquals("Wrong value length", Short.BYTES, serializer.getValueLength());
}
private static MatchEntryBuilder prepareVlanVidMatchEntry(boolean hasMask, boolean cfiBit) {
assertEquals("Wrong oxm-field", OxmMatchConstants.VLAN_VID, fieldAndMask >>> 1);
assertEquals("Wrong hasMask", hasMask, (fieldAndMask & 1) != 0);
if (hasMask) {
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_INT_IN_BYTES, buffer.readUnsignedByte());
+ assertEquals("Wrong length", Integer.BYTES, buffer.readUnsignedByte());
} else {
- assertEquals("Wrong length", EncodeConstants.SIZE_OF_SHORT_IN_BYTES, buffer.readUnsignedByte());
+ assertEquals("Wrong length", Short.BYTES, buffer.readUnsignedByte());
}
}
}
matchSerializer.serialize(match, out);
Assert.assertEquals("Wrong type", 1, out.readUnsignedShort());
- out.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ out.skipBytes(Short.BYTES);
Assert.assertEquals("Wrong class", 0x8000, out.readUnsignedShort());
Assert.assertEquals("Wrong field and mask", 22, out.readUnsignedByte());
- out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ out.skipBytes(Byte.BYTES);
Assert.assertEquals("Wrong ip address (first number)", 1, out.readUnsignedByte());
Assert.assertEquals("Wrong ip address (second number)", 2, out.readUnsignedByte());
Assert.assertEquals("Wrong ip address (third number)", 3, out.readUnsignedByte());
matchSerializer.serialize(match, out);
Assert.assertEquals("Wrong type", 1, out.readUnsignedShort());
- out.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ out.skipBytes(Short.BYTES);
Assert.assertEquals("Wrong class", 0x8000, out.readUnsignedShort());
Assert.assertEquals("Wrong field and mask", 52, out.readUnsignedByte());
Assert.assertEquals("Wrong entry length", 16, out.readUnsignedByte());
matchSerializer.serialize(match, out);
Assert.assertEquals("Wrong type", 1, out.readUnsignedShort());
- out.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ out.skipBytes(Short.BYTES);
Assert.assertEquals("Wrong class", 0x8000, out.readUnsignedShort());
Assert.assertEquals("Wrong field and mask", 56, out.readUnsignedByte());
- out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ out.skipBytes(Byte.BYTES);
byte[] label = new byte[4];
out.readBytes(label);
matchSerializer.serialize(match, out);
Assert.assertEquals("Wrong type", 1, out.readUnsignedShort());
- out.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ out.skipBytes(Short.BYTES);
Assert.assertEquals("Wrong class", 0x8000, out.readUnsignedShort());
Assert.assertEquals("Wrong field and mask", 57, out.readUnsignedByte());
- out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ out.skipBytes(Byte.BYTES);
byte[] label = new byte[4];
out.readBytes(label);
Assert.assertArrayEquals("Wrong ipv6FLabel", new byte[]{0, 0x0f, (byte) 0x9e, (byte) 0x8d}, label);
try {
int offset = 0;
for (int i = 0; i < EncodeConstants.MAC_ADDRESS_LENGTH - 1; ++i) {
- if (mac[offset + EncodeConstants.SIZE_OF_BYTE_IN_BYTES] == ':') {
+ if (mac[offset + Byte.BYTES] == ':') {
result[i] = UnsignedBytes.checkedCast(hexValue(mac[offset]));
offset++;
} else {
* 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.openflowplugin.impl.protocol.deserialization.action;
import io.netty.buffer.ByteBuf;
import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderDeserializer;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
public abstract class AbstractActionDeserializer implements OFDeserializer<Action>, HeaderDeserializer<Action> {
-
/**
* Skip first few bytes of action message because they are irrelevant.
*
* @param message Openflow buffered message
**/
protected static void processHeader(ByteBuf message) {
- message.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ message.skipBytes(2 * Short.BYTES);
}
-
}
* @return instruction length
**/
protected static int readHeader(ByteBuf message) {
- message.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ message.skipBytes(Short.BYTES);
return message.readUnsignedShort();
}
* 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.openflowplugin.impl.protocol.deserialization.instruction;
import io.netty.buffer.ByteBuf;
import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderDeserializer;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction;
public abstract class AbstractInstructionDeserializer implements OFDeserializer<Instruction>,
HeaderDeserializer<Instruction> {
-
/**
* Skip first few bytes of instruction message because they are irrelevant.
*
* @param message Openflow buffered message
**/
protected static void processHeader(ByteBuf message) {
- message.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ message.skipBytes(2 * Short.BYTES);
}
-
}
* 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.openflowplugin.impl.protocol.deserialization.instruction;
import io.netty.buffer.ByteBuf;
import java.math.BigInteger;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.WriteMetadataCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.write.metadata._case.WriteMetadataBuilder;
public class WriteMetadataInstructionDeserializer extends AbstractInstructionDeserializer {
-
@Override
public Instruction deserialize(ByteBuf message) {
processHeader(message);
message.skipBytes(InstructionConstants.PADDING_IN_WRITE_METADATA);
- final byte[] meta = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ final byte[] meta = new byte[Long.BYTES];
message.readBytes(meta);
- final byte[] metaMask = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ final byte[] metaMask = new byte[Long.BYTES];
message.readBytes(metaMask);
return new WriteMetadataCaseBuilder()
processHeader(message);
return new WriteMetadataCaseBuilder().build();
}
-
}
* @return true if match entry has mask, false otherwise
*/
protected static boolean processHeader(ByteBuf in) {
- in.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES); // skip oxm_class
+ in.skipBytes(Short.BYTES); // skip oxm_class
boolean hasMask = (in.readUnsignedByte() & 1) != 0;
- in.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES); // skip match entry length
+ in.skipBytes(Byte.BYTES); // skip match entry length
return hasMask;
}
package org.opendaylight.openflowplugin.impl.protocol.deserialization.match;
import io.netty.buffer.ByteBuf;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmDeserializerHelper;
import org.opendaylight.openflowplugin.openflow.md.util.ByteUtil;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder;
public class Ipv6ExtHeaderEntryDeserializer extends AbstractMatchEntryDeserializer {
-
@Override
public void deserializeEntry(ByteBuf message, MatchBuilder builder) {
final boolean hasMask = processHeader(message);
.setIpv6Exthdr(message.readUnsignedShort());
if (hasMask) {
- final byte[] mask = OxmDeserializerHelper.convertMask(message, EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ final byte[] mask = OxmDeserializerHelper.convertMask(message, Short.BYTES);
extHeaderBuilder.setIpv6ExthdrMask(ByteUtil.bytesToUnsignedShort(mask));
}
package org.opendaylight.openflowplugin.impl.protocol.deserialization.match;
import io.netty.buffer.ByteBuf;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmDeserializerHelper;
import org.opendaylight.openflowplugin.openflow.md.util.ByteUtil;
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.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder;
public class Ipv6FlabelEntryDeserializer extends AbstractMatchEntryDeserializer {
-
@Override
public void deserializeEntry(ByteBuf message, MatchBuilder builder) {
final boolean hasMask = processHeader(message);
.setIpv6Flabel(new Ipv6FlowLabel(message.readUnsignedInt()));
if (hasMask) {
- final byte[] mask = OxmDeserializerHelper.convertMask(message, EncodeConstants.SIZE_OF_INT_IN_BYTES);
+ final byte[] mask = OxmDeserializerHelper.convertMask(message, Integer.BYTES);
ipv6labelBuilder.setFlabelMask(new Ipv6FlowLabel(ByteUtil.bytesToUnsignedInt(mask)));
}
final int length = inBuffer.readUnsignedShort();
final int startIndex = inBuffer.readerIndex();
- final int entriesLength = length - 2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ final int entriesLength = length - 2 * Short.BYTES;
while (inBuffer.readerIndex() - startIndex < entriesLength) {
deserializeEntry(inBuffer, builder);
return;
}
int oxmClass = inBuffer.getUnsignedShort(inBuffer.readerIndex());
- int oxmField = inBuffer.getUnsignedByte(inBuffer.readerIndex()
- + EncodeConstants.SIZE_OF_SHORT_IN_BYTES) >>> 1;
+ int oxmField = inBuffer.getUnsignedByte(inBuffer.readerIndex() + Short.BYTES) >>> 1;
final MatchEntryDeserializerKey key = new MatchEntryDeserializerKey(
EncodeConstants.OF13_VERSION_ID, oxmClass, oxmField);
if (oxmClass == EncodeConstants.EXPERIMENTER_VALUE) {
- long expId = inBuffer.getUnsignedInt(inBuffer.readerIndex()
- + EncodeConstants.SIZE_OF_SHORT_IN_BYTES
- + 2 * EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
-
+ long expId = inBuffer.getUnsignedInt(inBuffer.readerIndex() + Short.BYTES + 2 * Byte.BYTES);
key.setExperimenterId(Uint32.valueOf(expId));
}
import io.netty.buffer.ByteBuf;
import java.math.BigInteger;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Metadata;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.MetadataBuilder;
public class MetadataEntryDeserializer extends AbstractMatchEntryDeserializer {
-
@Override
public void deserializeEntry(ByteBuf message, MatchBuilder builder) {
final boolean hasMask = processHeader(message);
final Metadata metadata = builder.getMetadata();
- final byte[] metaByte = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ final byte[] metaByte = new byte[Long.BYTES];
message.readBytes(metaByte);
final MetadataBuilder metadataBuilder = new MetadataBuilder()
.setMetadata(new BigInteger(1, metaByte));
if (hasMask) {
- final byte[] metaMask = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ final byte[] metaMask = new byte[Long.BYTES];
message.readBytes(metaMask);
metadataBuilder.setMetadataMask(new BigInteger(1, metaMask));
}
import io.netty.buffer.ByteBuf;
import java.math.BigInteger;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.TunnelBuilder;
public class TunnelIdEntryDeserializer extends AbstractMatchEntryDeserializer {
-
@Override
public void deserializeEntry(ByteBuf message, MatchBuilder builder) {
final boolean hasMask = processHeader(message);
- final byte[] tunnelId = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ final byte[] tunnelId = new byte[Long.BYTES];
message.readBytes(tunnelId);
final TunnelBuilder tunnelBuilder = new TunnelBuilder()
.setTunnelId(new BigInteger(1, tunnelId));
if (hasMask) {
- final byte[] tunnelMask = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ final byte[] tunnelMask = new byte[Long.BYTES];
message.readBytes(tunnelMask);
tunnelBuilder.setTunnelMask(new BigInteger(1, tunnelMask));
}
package org.opendaylight.openflowplugin.impl.protocol.deserialization.match;
import io.netty.buffer.ByteBuf;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.VlanMatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.vlan.match.fields.VlanIdBuilder;
public class VlanVidEntryDeserializer extends AbstractMatchEntryDeserializer {
-
@Override
public void deserializeEntry(ByteBuf message, MatchBuilder builder) {
final boolean hasMask = processHeader(message);
final int vlanVidValue = message.readUnsignedShort();
if (hasMask) {
- message.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES); // Skip mask
+ message.skipBytes(Short.BYTES); // Skip mask
vlanIdBuilder
.setVlanId(new VlanId(0))
.setVlanIdPresent(true);
Long expId = null;
if (EncodeConstants.EXPERIMENTER_VALUE == type) {
- expId = message.getUnsignedInt(message.readerIndex()
- + 2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ expId = message.getUnsignedInt(message.readerIndex() + 2 * Short.BYTES);
}
deserializer = Preconditions.checkNotNull(registry).getDeserializer(
}
case OFPMBTEXPERIMENTER: {
// TODO: Finish meter band experimenter deserialization
- long expId =
- message.getUnsignedInt(message.readerIndex() + 2 * EncodeConstants.SIZE_OF_INT_IN_BYTES);
+ long expId = message.getUnsignedInt(message.readerIndex() + 2 * Integer.BYTES);
message.readerIndex(bandStartIndex);
OFDeserializer<Experimenter> deserializer = registry.getDeserializer(
.forValue(message.readUnsignedByte())))
.setTableId(new TableId(message.readUnsignedByte()));
- final byte[] cookie = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ final byte[] cookie = new byte[Long.BYTES];
message.readBytes(cookie);
packetInMessageBuilder
builder.setHardwareAddress(ByteBufUtils.readIetfMacAddress(message));
message.skipBytes(PADDING_IN_PORT_MOD_MESSAGE_2);
builder.setConfiguration(readPortConfig(message));
- message.skipBytes(EncodeConstants.SIZE_OF_INT_IN_BYTES); // Skip mask
+ message.skipBytes(Integer.BYTES); // Skip mask
builder.setAdvertisedFeatures(readPortFeatures(message));
message.skipBytes(PADDING_IN_PORT_MOD_MESSAGE_3);
return builder.build();
* 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.openflowplugin.impl.protocol.deserialization.multipart;
import io.netty.buffer.ByteBuf;
import java.math.BigInteger;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter32;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter64;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.multipart.reply.multipart.reply.body.MultipartReplyFlowAggregateStatsBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.multipart.reply.MultipartReplyBody;
public class MultipartReplyFlowAggregateStatsDeserializer implements OFDeserializer<MultipartReplyBody> {
-
private static final byte PADDING_IN_AGGREGATE_HEADER = 4;
@Override
public MultipartReplyBody deserialize(ByteBuf message) {
- final byte[] packetCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ final byte[] packetCount = new byte[Long.BYTES];
message.readBytes(packetCount);
- final byte[] byteCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ final byte[] byteCount = new byte[Long.BYTES];
message.readBytes(byteCount);
final MultipartReplyFlowAggregateStatsBuilder builder = new MultipartReplyFlowAggregateStatsBuilder()
message.skipBytes(PADDING_IN_AGGREGATE_HEADER);
return builder.build();
}
-
}
while (message.readableBytes() > 0) {
final FlowAndStatisticsMapListBuilder itemBuilder = new FlowAndStatisticsMapListBuilder();
final int itemLength = message.readUnsignedShort();
- final ByteBuf itemMessage = message.readSlice(itemLength - EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ final ByteBuf itemMessage = message.readSlice(itemLength - Short.BYTES);
itemBuilder.setTableId(itemMessage.readUnsignedByte());
itemMessage.skipBytes(PADDING_IN_FLOW_STATS_HEADER_01);
itemMessage.skipBytes(PADDING_IN_FLOW_STATS_HEADER_02);
- final byte[] cookie = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ final byte[] cookie = new byte[Long.BYTES];
itemMessage.readBytes(cookie);
- final byte[] packetCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ final byte[] packetCount = new byte[Long.BYTES];
itemMessage.readBytes(packetCount);
- final byte[] byteCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ final byte[] byteCount = new byte[Long.BYTES];
itemMessage.readBytes(byteCount);
itemBuilder
* 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.openflowplugin.impl.protocol.deserialization.multipart;
import io.netty.buffer.ByteBuf;
import java.util.ArrayList;
import java.util.List;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter32;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter64;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.flow.table.and.statistics.map.FlowTableAndStatisticsMap;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableId;
public class MultipartReplyFlowTableStatsDeserializer implements OFDeserializer<MultipartReplyBody> {
-
private static final byte PADDING_IN_TABLE_HEADER = 3;
@Override
.withKey(new FlowTableAndStatisticsMapKey(itemBuilder.getTableId()))
.setActiveFlows(new Counter32(message.readUnsignedInt()));
- final byte[] packetsLooked = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ final byte[] packetsLooked = new byte[Long.BYTES];
message.readBytes(packetsLooked);
- final byte[] packetsMatched = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ final byte[] packetsMatched = new byte[Long.BYTES];
message.readBytes(packetsMatched);
items.add(itemBuilder
.setFlowTableAndStatisticsMap(items)
.build();
}
-
}
* 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.openflowplugin.impl.protocol.deserialization.multipart;
import io.netty.buffer.ByteBuf;
import java.util.ArrayList;
import java.util.List;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter32;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter64;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.multipart.reply.multipart.reply.body.MultipartReplyGroupStatsBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.multipart.reply.MultipartReplyBody;
public class MultipartReplyGroupStatsDeserializer implements OFDeserializer<MultipartReplyBody> {
-
private static final byte PADDING_IN_GROUP_HEADER_01 = 2;
private static final byte PADDING_IN_GROUP_HEADER_02 = 4;
private static final byte GROUP_BODY_LENGTH = 40;
message.skipBytes(PADDING_IN_GROUP_HEADER_02);
- final byte[] packetCountg = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ final byte[] packetCountg = new byte[Long.BYTES];
message.readBytes(packetCountg);
- final byte[] byteCountg = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ final byte[] byteCountg = new byte[Long.BYTES];
message.readBytes(byteCountg);
itemBuilder
long bucketKey = 0;
while (actualLength < itemLength) {
- final byte[] packetCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ final byte[] packetCount = new byte[Long.BYTES];
message.readBytes(packetCount);
- final byte[] byteCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ final byte[] byteCount = new byte[Long.BYTES];
message.readBytes(byteCount);
subItems.add(new BucketCounterBuilder()
.setGroupStats(items)
.build();
}
-
}
case OFPMBTEXPERIMENTER:
// TODO: Finish meter band experimenter deserialization
- final long expId = message.getUnsignedInt(message.readerIndex() + 2 * EncodeConstants
- .SIZE_OF_INT_IN_BYTES);
+ final long expId = message.getUnsignedInt(message.readerIndex() + 2 * Integer.BYTES);
message.readerIndex(itemStartIndex);
final OFDeserializer<Experimenter> deserializer = registry.getDeserializer(
* 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.openflowplugin.impl.protocol.deserialization.multipart;
import io.netty.buffer.ByteBuf;
import java.util.ArrayList;
import java.util.List;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter32;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter64;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.multipart.reply.multipart.reply.body.MultipartReplyMeterStatsBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.multipart.reply.MultipartReplyBody;
public class MultipartReplyMeterStatsDeserializer implements OFDeserializer<MultipartReplyBody> {
-
private static final byte PADDING_IN_METER_STATS_HEADER = 6;
private static final byte METER_BODY_LENGTH = 40;
private static final byte METER_BAND_STATS_LENGTH = 16;
.withKey(new MeterStatsKey(itemBuilder.getMeterId()))
.setFlowCount(new Counter32(message.readUnsignedInt()));
- final byte[] packetCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ final byte[] packetCount = new byte[Long.BYTES];
message.readBytes(packetCount);
- final byte[] byteCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ final byte[] byteCount = new byte[Long.BYTES];
message.readBytes(byteCount);
itemBuilder
long bandKey = 0;
while (actualLength < itemLength) {
- final byte[] packetCountB = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ final byte[] packetCountB = new byte[Long.BYTES];
message.readBytes(packetCountB);
- final byte[] byteCountB = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ final byte[] byteCountB = new byte[Long.BYTES];
message.readBytes(byteCountB);
subItems.add(new BandStatBuilder()
.setMeterStats(items)
.build();
}
-
}
message.skipBytes(PADDING_IN_PORT_STATS_HEADER);
- final byte[] recPack = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ final byte[] recPack = new byte[Long.BYTES];
message.readBytes(recPack);
- final byte[] txPack = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ final byte[] txPack = new byte[Long.BYTES];
message.readBytes(txPack);
- final byte[] recByt = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ final byte[] recByt = new byte[Long.BYTES];
message.readBytes(recByt);
- final byte[] txByt = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ final byte[] txByt = new byte[Long.BYTES];
message.readBytes(txByt);
- final byte[] recDrop = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ final byte[] recDrop = new byte[Long.BYTES];
message.readBytes(recDrop);
- final byte[] txDrop = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ final byte[] txDrop = new byte[Long.BYTES];
message.readBytes(txDrop);
- final byte[] recError = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ final byte[] recError = new byte[Long.BYTES];
message.readBytes(recError);
- final byte[] txError = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ final byte[] txError = new byte[Long.BYTES];
message.readBytes(txError);
- final byte[] recFrameError = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ final byte[] recFrameError = new byte[Long.BYTES];
message.readBytes(recFrameError);
- final byte[] recOverRunError = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ final byte[] recOverRunError = new byte[Long.BYTES];
message.readBytes(recOverRunError);
- final byte[] recCrcError = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ final byte[] recCrcError = new byte[Long.BYTES];
message.readBytes(recCrcError);
- final byte[] collisionCount = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ final byte[] collisionCount = new byte[Long.BYTES];
message.readBytes(collisionCount);
items.add(itemBuilder
.getProtocolAgnosticPortUri(EncodeConstants.OF13_VERSION_ID, port));
final QueueId queueId = new QueueId(message.readUnsignedInt());
- final byte[] txBytes = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ final byte[] txBytes = new byte[Long.BYTES];
message.readBytes(txBytes);
- final byte[] txPackets = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ final byte[] txPackets = new byte[Long.BYTES];
message.readBytes(txPackets);
- final byte[] txErrors = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ final byte[] txErrors = new byte[Long.BYTES];
message.readBytes(txErrors);
items.add(new QueueIdAndStatisticsMapBuilder()
.deserialize(message)
.map(matchFields::add)
.orElseGet(() -> {
- message.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ message.skipBytes(2 * Short.BYTES);
return Boolean.FALSE;
});
}
offset++;
} catch (ClassCastException | IllegalStateException e) {
- message.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ message.skipBytes(2 * Short.BYTES);
}
}
offset++;
} catch (ClassCastException | IllegalStateException e) {
- message.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ message.skipBytes(2 * Short.BYTES);
}
}
* @return SetFieldMatchBuilder with hasMask properly set
*/
protected static SetFieldMatchBuilder processHeader(final ByteBuf in) {
- in.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES); // skip oxm_class
+ in.skipBytes(Short.BYTES); // skip oxm_class
boolean hasMask = (in.readUnsignedByte() & 1) != 0;
- in.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES); // skip match entry length
+ in.skipBytes(Byte.BYTES); // skip match entry length
return new SetFieldMatchBuilder()
.setHasMask(hasMask);
*/
public Optional<SetFieldMatch> deserialize(final ByteBuf message) {
int oxmClass = message.getUnsignedShort(message.readerIndex());
- int oxmField = message.getUnsignedByte(message.readerIndex() + EncodeConstants.SIZE_OF_SHORT_IN_BYTES) >>> 1;
+ int oxmField = message.getUnsignedByte(message.readerIndex() + Short.BYTES) >>> 1;
Uint32 expId = null;
if (oxmClass == EncodeConstants.EXPERIMENTER_VALUE) {
- expId = Uint32.valueOf(message.getUnsignedInt(message.readerIndex() + EncodeConstants.SIZE_OF_SHORT_IN_BYTES
- + 2 * EncodeConstants.SIZE_OF_BYTE_IN_BYTES));
+ expId = Uint32.valueOf(message.getUnsignedInt(message.readerIndex() + Short.BYTES + 2 * Byte.BYTES));
}
final MatchEntryDeserializerKey key =
final Long expId;
if (type == EncodeConstants.EXPERIMENTER_VALUE) {
- expId = message.getUnsignedInt(message.readerIndex()
- + 2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ expId = message.getUnsignedInt(message.readerIndex() + 2 * Short.BYTES);
} else {
expId = null;
}
final Long expId;
if (type == EncodeConstants.EXPERIMENTER_VALUE) {
- expId = message.getUnsignedInt(message.readerIndex()
- + 2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ expId = message.getUnsignedInt(message.readerIndex() + 2 * Short.BYTES);
} else {
expId = null;
}
Long expId = null;
if (EncodeConstants.EXPERIMENTER_VALUE == type) {
- expId = message.getUnsignedInt(message.readerIndex() + 2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ expId = message.getUnsignedInt(message.readerIndex() + 2 * Short.BYTES);
}
deserializer = registry.getDeserializer(
Long expId = null;
if (EncodeConstants.EXPERIMENTER_VALUE == type) {
- expId = message.getUnsignedInt(message.readerIndex() + 2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ expId = message.getUnsignedInt(message.readerIndex() + 2 * Short.BYTES);
}
deserializer = registry.getDeserializer(
import io.netty.buffer.ByteBuf;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
public abstract class AbstractExperimenterMatchEntrySerializer<E, M> extends AbstractMatchEntrySerializer<E, M> {
protected AbstractExperimenterMatchEntrySerializer(final int oxmFieldCode, final int valueLength,
final long experimenterId) {
this(new ConstantHeaderWriter<>(OxmMatchConstants.EXPERIMENTER_CLASS, oxmFieldCode, valueLength,
- EncodeConstants.SIZE_OF_INT_IN_BYTES), experimenterId);
+ Integer.BYTES), experimenterId);
}
@Override
import io.netty.buffer.ByteBuf;
import org.eclipse.jdt.annotation.NonNull;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.IpConversionUtil;
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.Ipv4Prefix;
abstract class AbstractIpv4PolymorphicEntrySerializer
extends AbstractPolymorphicEntrySerializer<Ipv4MatchArbitraryBitMask, Ipv4Match, Ipv4Prefix, DottedQuad> {
-
AbstractIpv4PolymorphicEntrySerializer(final int oxmClassCode, final int oxmFieldCode) {
- super(oxmClassCode, oxmFieldCode, EncodeConstants.SIZE_OF_INT_IN_BYTES, Ipv4MatchArbitraryBitMask.class,
- Ipv4Match.class, Ipv4Prefix.class, DottedQuad.class);
+ super(oxmClassCode, oxmFieldCode, Integer.BYTES, Ipv4MatchArbitraryBitMask.class, Ipv4Match.class,
+ Ipv4Prefix.class, DottedQuad.class);
}
@Override
final ByteBuf outBuffer) {
writeIpv4Address(extractArbitraryEntryAddress(arbitraryMatch), outBuffer);
if (mask != null) {
- writeMask(IpConversionUtil.convertArbitraryMaskToByteArray(mask), outBuffer,
- EncodeConstants.SIZE_OF_INT_IN_BYTES);
+ writeMask(IpConversionUtil.convertArbitraryMaskToByteArray(mask), outBuffer, Integer.BYTES);
}
}
package org.opendaylight.openflowplugin.impl.protocol.serialization.match;
import io.netty.buffer.ByteBuf;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.IpConversionUtil;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
public abstract class AbstractIpv4PrefixEntrySerializer extends AbstractMatchEntrySerializer<Ipv4Prefix, Integer> {
protected AbstractIpv4PrefixEntrySerializer(final int oxmClassCode, final int oxmFieldCode) {
- super(new ConstantHeaderWriter<>(oxmClassCode, oxmFieldCode, EncodeConstants.SIZE_OF_INT_IN_BYTES));
+ super(new ConstantHeaderWriter<>(oxmClassCode, oxmFieldCode, Integer.BYTES));
}
@Override
package org.opendaylight.openflowplugin.impl.protocol.serialization.match;
import io.netty.buffer.ByteBuf;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.yangtools.yang.common.Uint16;
public abstract class AbstractUint16EntrySerializer extends AbstractPrimitiveEntrySerializer<Uint16> {
protected AbstractUint16EntrySerializer(final int oxmClassCode, final int oxmFieldCode) {
- super(oxmClassCode, oxmFieldCode, EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ super(oxmClassCode, oxmFieldCode, Short.BYTES);
}
@Override
package org.opendaylight.openflowplugin.impl.protocol.serialization.match;
import io.netty.buffer.ByteBuf;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.yangtools.yang.common.Uint32;
public abstract class AbstractUint32EntrySerializer extends AbstractPrimitiveEntrySerializer<Uint32> {
protected AbstractUint32EntrySerializer(final int oxmClassCode, final int oxmFieldCode) {
- super(oxmClassCode, oxmFieldCode, EncodeConstants.SIZE_OF_INT_IN_BYTES);
+ super(oxmClassCode, oxmFieldCode, Integer.BYTES);
}
@Override
package org.opendaylight.openflowplugin.impl.protocol.serialization.match;
import io.netty.buffer.ByteBuf;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.yangtools.yang.common.Uint8;
public abstract class AbstractUint8EntrySerializer extends AbstractPrimitiveEntrySerializer<Uint8> {
protected AbstractUint8EntrySerializer(final int oxmClassCode, final int oxmFieldCode) {
- super(oxmClassCode, oxmFieldCode, EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ super(oxmClassCode, oxmFieldCode, Byte.BYTES);
}
@Override
* 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.openflowplugin.impl.protocol.serialization.match;
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.model.match.types.rev131026.Match;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetType;
public class EthernetTypeEntrySerializer extends AbstractPrimitiveEntrySerializer<EthernetType> {
public EthernetTypeEntrySerializer() {
- super(OxmMatchConstants.OPENFLOW_BASIC_CLASS, OxmMatchConstants.ETH_TYPE,
- EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ super(OxmMatchConstants.OPENFLOW_BASIC_CLASS, OxmMatchConstants.ETH_TYPE, Short.BYTES);
}
@Override
package org.opendaylight.openflowplugin.impl.protocol.serialization.match;
import io.netty.buffer.ByteBuf;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion;
import org.opendaylight.openflowplugin.openflow.md.util.InventoryDataServiceUtil;
public class InPhyPortEntrySerializer extends AbstractPrimitiveEntrySerializer<NodeConnectorId> {
public InPhyPortEntrySerializer() {
- super(OxmMatchConstants.OPENFLOW_BASIC_CLASS, OxmMatchConstants.IN_PHY_PORT,
- EncodeConstants.SIZE_OF_INT_IN_BYTES);
+ super(OxmMatchConstants.OPENFLOW_BASIC_CLASS, OxmMatchConstants.IN_PHY_PORT, Integer.BYTES);
}
@Override
package org.opendaylight.openflowplugin.impl.protocol.serialization.match;
import io.netty.buffer.ByteBuf;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion;
import org.opendaylight.openflowplugin.openflow.md.util.InventoryDataServiceUtil;
public class InPortEntrySerializer extends AbstractPrimitiveEntrySerializer<NodeConnectorId> {
public InPortEntrySerializer() {
- super(OxmMatchConstants.OPENFLOW_BASIC_CLASS, OxmMatchConstants.IN_PORT,EncodeConstants.SIZE_OF_INT_IN_BYTES);
+ super(OxmMatchConstants.OPENFLOW_BASIC_CLASS, OxmMatchConstants.IN_PORT, Integer.BYTES);
}
@Override
package org.opendaylight.openflowplugin.impl.protocol.serialization.match;
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.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Dscp;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match;
public class IpDscpEntrySerializer extends AbstractPrimitiveEntrySerializer<Dscp> {
public IpDscpEntrySerializer() {
- super(OxmMatchConstants.OPENFLOW_BASIC_CLASS, OxmMatchConstants.IP_DSCP, EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ super(OxmMatchConstants.OPENFLOW_BASIC_CLASS, OxmMatchConstants.IP_DSCP, Byte.BYTES);
}
@Override
package org.opendaylight.openflowplugin.impl.protocol.serialization.match;
import io.netty.buffer.ByteBuf;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.openflowplugin.openflow.md.util.ByteUtil;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match;
public class Ipv6ExtHeaderEntrySerializer extends AbstractMatchEntrySerializer<Ipv6ExtHeader, Uint16> {
public Ipv6ExtHeaderEntrySerializer() {
- super(OxmMatchConstants.OPENFLOW_BASIC_CLASS, OxmMatchConstants.IPV6_EXTHDR,
- EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ super(OxmMatchConstants.OPENFLOW_BASIC_CLASS, OxmMatchConstants.IPV6_EXTHDR, Short.BYTES);
}
@Override
protected void serializeEntry(final Ipv6ExtHeader entry, final Uint16 mask, final ByteBuf outBuffer) {
outBuffer.writeShort(entry.getIpv6Exthdr().shortValue());
if (mask != null) {
- writeMask(ByteUtil.unsignedShortToBytes(mask), outBuffer, EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ writeMask(ByteUtil.unsignedShortToBytes(mask), outBuffer, Short.BYTES);
}
}
}
package org.opendaylight.openflowplugin.impl.protocol.serialization.match;
import io.netty.buffer.ByteBuf;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.openflowplugin.openflow.md.util.ByteUtil;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6FlowLabel;
public class Ipv6LabelEntrySerializer extends AbstractMatchEntrySerializer<Ipv6Label, Ipv6FlowLabel> {
public Ipv6LabelEntrySerializer() {
- super(OxmMatchConstants.OPENFLOW_BASIC_CLASS, OxmMatchConstants.IPV6_FLABEL,
- EncodeConstants.SIZE_OF_INT_IN_BYTES);
+ super(OxmMatchConstants.OPENFLOW_BASIC_CLASS, OxmMatchConstants.IPV6_FLABEL, Integer.BYTES);
}
@Override
protected void serializeEntry(final Ipv6Label entry, final Ipv6FlowLabel mask, final ByteBuf outBuffer) {
outBuffer.writeInt(entry.getIpv6Flabel().getValue().intValue());
if (mask != null) {
- writeMask(ByteUtil.unsignedIntToBytes(mask.getValue()), outBuffer, EncodeConstants.SIZE_OF_INT_IN_BYTES);
+ writeMask(ByteUtil.unsignedIntToBytes(mask.getValue()), outBuffer, Integer.BYTES);
}
}
}
package org.opendaylight.openflowplugin.impl.protocol.serialization.match;
import io.netty.buffer.ByteBuf;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.openflowplugin.openflow.md.util.ByteUtil;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match;
public class MetadataEntrySerializer extends AbstractMatchEntrySerializer<Metadata, Uint64> {
public MetadataEntrySerializer() {
- super(OxmMatchConstants.OPENFLOW_BASIC_CLASS, OxmMatchConstants.METADATA,
- EncodeConstants.SIZE_OF_LONG_IN_BYTES);
+ super(OxmMatchConstants.OPENFLOW_BASIC_CLASS, OxmMatchConstants.METADATA, Long.BYTES);
}
@Override
protected void serializeEntry(Metadata entry, Uint64 mask, ByteBuf outBuffer) {
outBuffer.writeBytes(ByteUtil.uint64toBytes(entry.getMetadata()));
if (mask != null) {
- writeMask(ByteUtil.uint64toBytes(mask), outBuffer, EncodeConstants.SIZE_OF_LONG_IN_BYTES);
+ writeMask(ByteUtil.uint64toBytes(mask), outBuffer, Long.BYTES);
}
}
}
package org.opendaylight.openflowplugin.impl.protocol.serialization.match;
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.model.match.types.rev131026.Match;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.ProtocolMatchFields;
public class MplsBosEntrySerializer extends AbstractPrimitiveEntrySerializer<Uint8> {
public MplsBosEntrySerializer() {
- super(OxmMatchConstants.OPENFLOW_BASIC_CLASS, OxmMatchConstants.MPLS_BOS,
- EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ super(OxmMatchConstants.OPENFLOW_BASIC_CLASS, OxmMatchConstants.MPLS_BOS, Byte.BYTES);
}
@Override
public class TcpFlagsEntrySerializer extends AbstractExperimenterMatchEntrySerializer<TcpFlagsMatch, Uint16> {
public TcpFlagsEntrySerializer() {
- super(EncodeConstants.ONFOXM_ET_TCP_FLAGS, EncodeConstants.SIZE_OF_SHORT_IN_BYTES,
- EncodeConstants.ONF_EXPERIMENTER_ID.toJava());
+ super(EncodeConstants.ONFOXM_ET_TCP_FLAGS, Short.BYTES, EncodeConstants.ONF_EXPERIMENTER_ID.toJava());
}
@Override
protected void serializeEntryContent(TcpFlagsMatch entry, Uint16 mask, ByteBuf outBuffer) {
outBuffer.writeShort(entry.getTcpFlags().shortValue());
if (mask != null) {
- writeMask(ByteUtil.unsignedShortToBytes(mask), outBuffer, EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ writeMask(ByteUtil.unsignedShortToBytes(mask), outBuffer, Short.BYTES);
}
}
}
package org.opendaylight.openflowplugin.impl.protocol.serialization.match;
import io.netty.buffer.ByteBuf;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.openflowplugin.openflow.md.util.ByteUtil;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match;
public class TunnelIdEntrySerializer extends AbstractMatchEntrySerializer<Tunnel, Uint64> {
public TunnelIdEntrySerializer() {
- super(OxmMatchConstants.OPENFLOW_BASIC_CLASS, OxmMatchConstants.TUNNEL_ID,
- EncodeConstants.SIZE_OF_LONG_IN_BYTES);
+ super(OxmMatchConstants.OPENFLOW_BASIC_CLASS, OxmMatchConstants.TUNNEL_ID, Long.BYTES);
}
@Override
protected void serializeEntry(Tunnel entry, Uint64 mask, ByteBuf outBuffer) {
outBuffer.writeBytes(ByteUtil.uint64toBytes(entry.getTunnelId()));
if (mask != null) {
- writeMask(ByteUtil.uint64toBytes(mask), outBuffer, EncodeConstants.SIZE_OF_LONG_IN_BYTES);
+ writeMask(ByteUtil.uint64toBytes(mask), outBuffer, Long.BYTES);
}
}
}
package org.opendaylight.openflowplugin.impl.protocol.serialization.match;
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.l2.types.rev130827.VlanPcp;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match;
public class VlanPcpEntrySerializer extends AbstractPrimitiveEntrySerializer<VlanPcp> {
public VlanPcpEntrySerializer() {
- super(OxmMatchConstants.OPENFLOW_BASIC_CLASS, OxmMatchConstants.VLAN_PCP,
- EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ super(OxmMatchConstants.OPENFLOW_BASIC_CLASS, OxmMatchConstants.VLAN_PCP, Byte.BYTES);
}
@Override
package org.opendaylight.openflowplugin.impl.protocol.serialization.match;
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.model.match.types.rev131026.Match;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.VlanMatch;
private static final byte[] VLAN_VID_MASK = new byte[]{16, 0};
public VlanVidEntrySerializer() {
- super(OxmMatchConstants.OPENFLOW_BASIC_CLASS, OxmMatchConstants.VLAN_VID,
- EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ super(OxmMatchConstants.OPENFLOW_BASIC_CLASS, OxmMatchConstants.VLAN_VID, Short.BYTES);
}
@Override
outBuffer.writeShort(vlanVidValue);
if (mask != null) {
- writeMask(VLAN_VID_MASK, outBuffer, EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ writeMask(VLAN_VID_MASK, outBuffer, Short.BYTES);
}
}
}
* 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.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
public class ArpOpMatchFieldSerializer extends AbstractMatchFieldSerializer {
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ return Short.BYTES;
}
}
* 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.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
public class ArpSpaMatchFieldSerializer extends AbstractMatchFieldSerializer {
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ return Integer.BYTES;
}
}
* 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.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
public class ArpTpaMatchFieldSerializer extends AbstractMatchFieldSerializer {
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ return Integer.BYTES;
}
}
* 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.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
public class EthTypeMatchFieldSerializer extends AbstractMatchFieldSerializer {
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ return Short.BYTES;
}
}
* 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.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
public class Icmpv4CodeMatchFieldSerializer extends AbstractMatchFieldSerializer {
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ return Byte.BYTES;
}
}
* 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.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
public class Icmpv4TypeMatchFieldSerializer extends AbstractMatchFieldSerializer {
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ return Byte.BYTES;
}
}
* 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.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
public class Icmpv6CodeMatchFieldSerializer extends AbstractMatchFieldSerializer {
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ return Byte.BYTES;
}
}
* 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.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
public class Icmpv6TypeMatchFieldSerializer extends AbstractMatchFieldSerializer {
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ return Byte.BYTES;
}
}
* 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.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
public class InPhyPortMatchFieldSerializer extends AbstractMatchFieldSerializer {
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ return Integer.BYTES;
}
}
* 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.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
public class InPortMatchFieldSerializer extends AbstractMatchFieldSerializer {
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ return Integer.BYTES;
}
}
* 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.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
public class IpDscpMatchFieldSerializer extends AbstractMatchFieldSerializer {
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ return Byte.BYTES;
}
}
* 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.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
public class IpEcnMatchFieldSerializer extends AbstractMatchFieldSerializer {
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ return Byte.BYTES;
}
}
* 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.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
public class IpProtoMatchFieldSerializer extends AbstractMatchFieldSerializer {
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ return Byte.BYTES;
}
}
* 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.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
public class Ipv4DstMatchFieldSerializer extends AbstractMatchFieldSerializer {
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ return Integer.BYTES;
}
}
* 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.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
public class Ipv4SrcMatchFieldSerializer extends AbstractMatchFieldSerializer {
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ return Integer.BYTES;
}
}
* 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.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
public class Ipv6ExtHdrMatchFieldSerializer extends AbstractMatchFieldSerializer {
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ return Short.BYTES;
}
}
* 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.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
public class Ipv6FlabelMatchFieldSerializer extends AbstractMatchFieldSerializer {
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ return Integer.BYTES;
}
}
* 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.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
public class MetadataMatchFieldSerializer extends AbstractMatchFieldSerializer {
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_LONG_IN_BYTES;
+ return Long.BYTES;
}
}
* 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.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
public class MplsBosMatchFieldSerializer extends AbstractMatchFieldSerializer {
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ return Byte.BYTES;
}
}
* 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.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
public class MplsLabelMatchFieldSerializer extends AbstractMatchFieldSerializer {
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ return Integer.BYTES;
}
}
* 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.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
public class MplsTcMatchFieldSerializer extends AbstractMatchFieldSerializer {
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ return Byte.BYTES;
}
}
* 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.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
public class SctpDstMatchFieldSerializer extends AbstractMatchFieldSerializer {
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ return Short.BYTES;
}
}
* 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.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
public class SctpSrcMatchFieldSerializer extends AbstractMatchFieldSerializer {
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ return Short.BYTES;
}
}
* 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.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
public class TcpDstMatchFieldSerializer extends AbstractMatchFieldSerializer {
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ return Short.BYTES;
}
}
@Override
protected int getValueLength() {
// Increase length by experimenter ID length
- return EncodeConstants.SIZE_OF_SHORT_IN_BYTES + EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ return Short.BYTES + Integer.BYTES;
}
}
* 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.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
public class TcpSrcMatchFieldSerializer extends AbstractMatchFieldSerializer {
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ return Short.BYTES;
}
}
* 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.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
public class TunnelIdMatchFieldSerializer extends AbstractMatchFieldSerializer {
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_LONG_IN_BYTES;
+ return Long.BYTES;
}
}
* 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.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
public class UdpDstMatchFieldSerializer extends AbstractMatchFieldSerializer {
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ return Short.BYTES;
}
}
* 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.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
public class UdpSrcMatchFieldSerializer extends AbstractMatchFieldSerializer {
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ return Short.BYTES;
}
}
* 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.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
public class VlanPcpMatchFieldSerializer extends AbstractMatchFieldSerializer {
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ return Byte.BYTES;
}
}
* 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.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
public class VlanVidMatchFieldSerializer extends AbstractMatchFieldSerializer {
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ return Short.BYTES;
}
}
writeHeader(in);
in.writeShort(OxmMatchConstants.OPENFLOW_BASIC_CLASS);
in.writeByte(OxmMatchConstants.IN_PORT << 1);
- in.writeByte(EncodeConstants.SIZE_OF_INT_IN_BYTES);
+ in.writeByte(Integer.BYTES);
in.writeInt(portNum);
- in.writeZero(EncodeConstants.SIZE_OF_INT_IN_BYTES);
+ in.writeZero(Integer.BYTES);
final Action action = deserializeAction(in);
assertTrue(action instanceof SetFieldCase);
* 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.openflowplugin.impl.protocol.deserialization.instruction;
import static org.junit.Assert.assertArrayEquals;
import io.netty.buffer.UnpooledByteBufAllocator;
import java.math.BigInteger;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;
import org.opendaylight.openflowplugin.openflow.md.util.ByteUtil;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.WriteMetadataCase;
public class WriteMetadataInstructionDeserializerTest extends AbstractInstructionDeserializerTest {
-
@Test
public void testDeserialize() {
final ByteBuf in = UnpooledByteBufAllocator.DEFAULT.buffer();
final BigInteger metadataMask = BigInteger.valueOf(9876L);
writeHeader(in);
in.writeZero(InstructionConstants.PADDING_IN_WRITE_METADATA);
- in.writeBytes(ByteUtil.convertBigIntegerToNBytes(metadata, EncodeConstants.SIZE_OF_LONG_IN_BYTES));
- in.writeBytes(ByteUtil.convertBigIntegerToNBytes(metadataMask, EncodeConstants.SIZE_OF_LONG_IN_BYTES));
+ in.writeBytes(ByteUtil.convertBigIntegerToNBytes(metadata, Long.BYTES));
+ in.writeBytes(ByteUtil.convertBigIntegerToNBytes(metadataMask, Long.BYTES));
final Instruction instruction = deserializeInstruction(in);
assertEquals(WriteMetadataCase.class, instruction.implementedInterface());
assertArrayEquals(
- ByteUtil.convertBigIntegerToNBytes(metadata, EncodeConstants.SIZE_OF_LONG_IN_BYTES),
+ ByteUtil.convertBigIntegerToNBytes(metadata, Long.BYTES),
ByteUtil.uint64toBytes(((WriteMetadataCase) instruction).getWriteMetadata().getMetadata()));
assertArrayEquals(
- ByteUtil.convertBigIntegerToNBytes(metadataMask, EncodeConstants.SIZE_OF_LONG_IN_BYTES),
+ ByteUtil.convertBigIntegerToNBytes(metadataMask, Long.BYTES),
ByteUtil.uint64toBytes(((WriteMetadataCase) instruction).getWriteMetadata().getMetadataMask()));
assertEquals(0, in.readableBytes());
protected short getLength() {
return InstructionConstants.STANDARD_INSTRUCTION_LENGTH;
}
-
}
* 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.openflowplugin.impl.protocol.deserialization.match;
import static org.junit.Assert.assertEquals;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.ArpMatch;
public class ArpOpEntryDeserializerTest extends AbstractMatchEntryDeserializerTest {
-
@Test
public void deserializeEntry() {
final ByteBuf in = UnpooledByteBufAllocator.DEFAULT.buffer();
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ return Short.BYTES;
}
-}
\ No newline at end of file
+}
* 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.openflowplugin.impl.protocol.deserialization.match;
import static org.junit.Assert.assertEquals;
import io.netty.buffer.UnpooledByteBufAllocator;
import java.util.Iterator;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.IpConversionUtil;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.MatchConvertorUtil;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.ArpMatch;
public class ArpSourceTransportAddressEntryDeserializerTest extends AbstractMatchEntryDeserializerTest {
-
@Test
public void deserializeEntry() {
final ByteBuf in = UnpooledByteBufAllocator.DEFAULT.buffer();
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ return Integer.BYTES;
}
}
* 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.openflowplugin.impl.protocol.deserialization.match;
import static org.junit.Assert.assertEquals;
import io.netty.buffer.UnpooledByteBufAllocator;
import java.util.Iterator;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.IpConversionUtil;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.match.MatchConvertorUtil;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.ArpMatch;
public class ArpTargetTransportAddressEntryDeserializerTest extends AbstractMatchEntryDeserializerTest {
-
@Test
public void deserializeEntry() {
final ByteBuf in = UnpooledByteBufAllocator.DEFAULT.buffer();
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ return Integer.BYTES;
}
}
* 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.openflowplugin.impl.protocol.deserialization.match;
import static org.junit.Assert.assertEquals;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yangtools.yang.common.Uint32;
public class EthernetTypeEntryDeserializerTest extends AbstractMatchEntryDeserializerTest {
-
@Test
public void deserializeEntry() {
final ByteBuf in = UnpooledByteBufAllocator.DEFAULT.buffer();
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ return Short.BYTES;
}
}
* 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.openflowplugin.impl.protocol.deserialization.match;
import static org.junit.Assert.assertEquals;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
public class Icmpv4CodeEntryDeserializerTest extends AbstractMatchEntryDeserializerTest {
-
@Test
public void deserializeEntry() {
final ByteBuf in = UnpooledByteBufAllocator.DEFAULT.buffer();
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ return Byte.BYTES;
}
}
* 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.openflowplugin.impl.protocol.deserialization.match;
import static org.junit.Assert.assertEquals;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
public class Icmpv4TypeEntryDeserializerTest extends AbstractMatchEntryDeserializerTest {
-
@Test
public void deserializeEntry() {
final ByteBuf in = UnpooledByteBufAllocator.DEFAULT.buffer();
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ return Byte.BYTES;
}
}
* 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.openflowplugin.impl.protocol.deserialization.match;
import static org.junit.Assert.assertEquals;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
public class Icmpv6CodeEntryDeserializerTest extends AbstractMatchEntryDeserializerTest {
-
@Test
public void deserializeEntry() {
final ByteBuf in = UnpooledByteBufAllocator.DEFAULT.buffer();
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ return Byte.BYTES;
}
}
* 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.openflowplugin.impl.protocol.deserialization.match;
import static org.junit.Assert.assertEquals;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
public class Icmpv6TypeEntryDeserializerTest extends AbstractMatchEntryDeserializerTest {
-
@Test
public void deserializeEntry() {
final ByteBuf in = UnpooledByteBufAllocator.DEFAULT.buffer();
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ return Byte.BYTES;
}
}
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ return Integer.BYTES;
}
}
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ return Integer.BYTES;
}
}
* 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.openflowplugin.impl.protocol.deserialization.match;
import static org.junit.Assert.assertEquals;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
public class IpDscpEntryDeserializerTest extends AbstractMatchEntryDeserializerTest {
-
@Test
public void deserializeEntry() {
final ByteBuf in = UnpooledByteBufAllocator.DEFAULT.buffer();
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ return Byte.BYTES;
}
}
* 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.openflowplugin.impl.protocol.deserialization.match;
import static org.junit.Assert.assertEquals;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
public class IpEcnEntryDeserializerTest extends AbstractMatchEntryDeserializerTest {
-
@Test
public void deserializeEntry() {
final ByteBuf in = UnpooledByteBufAllocator.DEFAULT.buffer();
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ return Byte.BYTES;
}
}
* 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.openflowplugin.impl.protocol.deserialization.match;
import static org.junit.Assert.assertEquals;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
public class IpProtoEntryDeserializerTest extends AbstractMatchEntryDeserializerTest {
-
@Test
public void deserializeEntry() {
final ByteBuf in = UnpooledByteBufAllocator.DEFAULT.buffer();
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ return Byte.BYTES;
}
}
* 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.openflowplugin.impl.protocol.deserialization.match;
import static org.junit.Assert.assertEquals;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6Match;
public class Ipv6ExtHeaderEntryDeserializerTest extends AbstractMatchEntryDeserializerTest {
-
@Test
public void deserializeEntry() {
final ByteBuf in = UnpooledByteBufAllocator.DEFAULT.buffer();
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ return Short.BYTES;
}
-
}
* 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.openflowplugin.impl.protocol.deserialization.match;
import static org.junit.Assert.assertEquals;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6Match;
public class Ipv6FlabelEntryDeserializerTest extends AbstractMatchEntryDeserializerTest {
-
@Test
public void deserializeEntry() {
final ByteBuf in = UnpooledByteBufAllocator.DEFAULT.buffer();
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ return Integer.BYTES;
}
-
}
* 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.openflowplugin.impl.protocol.deserialization.match;
import static org.junit.Assert.assertEquals;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.openflowplugin.openflow.md.util.ByteUtil;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Metadata;
import org.opendaylight.yangtools.yang.common.Uint64;
public class MetadataEntryDeserializerTest extends AbstractMatchEntryDeserializerTest {
-
@Test
public void deserializeEntry() {
final ByteBuf in = UnpooledByteBufAllocator.DEFAULT.buffer();
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_LONG_IN_BYTES;
+ return Long.BYTES;
}
-
}
* 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.openflowplugin.impl.protocol.deserialization.match;
import static org.junit.Assert.assertEquals;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.ProtocolMatchFields;
public class MplsBosEntryDeserializerTest extends AbstractMatchEntryDeserializerTest {
-
@Test
public void deserializeEntry() {
final ByteBuf in = UnpooledByteBufAllocator.DEFAULT.buffer();
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ return Byte.BYTES;
}
-
}
* 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.openflowplugin.impl.protocol.deserialization.match;
import static org.junit.Assert.assertEquals;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.ProtocolMatchFields;
public class MplsLabelEntryDeserializerTest extends AbstractMatchEntryDeserializerTest {
-
@Test
public void deserializeEntry() {
final ByteBuf in = UnpooledByteBufAllocator.DEFAULT.buffer();
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ return Integer.BYTES;
}
-
}
* 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.openflowplugin.impl.protocol.deserialization.match;
import static org.junit.Assert.assertEquals;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.ProtocolMatchFields;
public class MplsTcEntryDeserializerTest extends AbstractMatchEntryDeserializerTest {
-
@Test
public void deserializeEntry() {
final ByteBuf in = UnpooledByteBufAllocator.DEFAULT.buffer();
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ return Byte.BYTES;
}
-
}
* 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.openflowplugin.impl.protocol.deserialization.match;
import static org.junit.Assert.assertEquals;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match;
import org.opendaylight.yangtools.yang.common.Uint32;
public class PacketTypeEntryDeserializerTest extends AbstractMatchEntryDeserializerTest {
-
@Test
public void deserializeEntryTest() {
final ByteBuf in = UnpooledByteBufAllocator.DEFAULT.buffer();
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ return Integer.BYTES;
}
-}
\ No newline at end of file
+}
* 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.openflowplugin.impl.protocol.deserialization.match;
import static org.junit.Assert.assertEquals;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.SctpMatch;
public class SctpDestinationPortEntryDeserializerTest extends AbstractMatchEntryDeserializerTest {
-
@Test
public void deserializeEntry() {
final ByteBuf in = UnpooledByteBufAllocator.DEFAULT.buffer();
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ return Short.BYTES;
}
}
* 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.openflowplugin.impl.protocol.deserialization.match;
import static org.junit.Assert.assertEquals;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.SctpMatch;
public class SctpSourcePortEntryDeserializerTest extends AbstractMatchEntryDeserializerTest {
-
@Test
public void deserializeEntry() {
final ByteBuf in = UnpooledByteBufAllocator.DEFAULT.buffer();
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ return Short.BYTES;
}
}
* 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.openflowplugin.impl.protocol.deserialization.match;
import static org.junit.Assert.assertEquals;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatch;
public class TcpDestinationPortEntryDeserializerTest extends AbstractMatchEntryDeserializerTest {
-
@Test
public void deserializeEntry() {
final ByteBuf in = UnpooledByteBufAllocator.DEFAULT.buffer();
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ return Short.BYTES;
}
}
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ return Short.BYTES;
}
}
* 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.openflowplugin.impl.protocol.deserialization.match;
import static org.junit.Assert.assertEquals;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatch;
public class TcpSourcePortEntryDeserializerTest extends AbstractMatchEntryDeserializerTest {
-
@Test
public void deserializeEntry() {
final ByteBuf in = UnpooledByteBufAllocator.DEFAULT.buffer();
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ return Short.BYTES;
}
}
* 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.openflowplugin.impl.protocol.deserialization.match;
import static org.junit.Assert.assertArrayEquals;
import io.netty.buffer.UnpooledByteBufAllocator;
import java.math.BigInteger;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.openflowplugin.openflow.md.util.ByteUtil;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Tunnel;
public class TunnelIdEntryDeserializerTest extends AbstractMatchEntryDeserializerTest {
-
@Test
public void deserializeEntry() {
final ByteBuf in = UnpooledByteBufAllocator.DEFAULT.buffer();
final BigInteger tunnelIdMask = BigInteger.valueOf(5);
writeHeader(in, false);
- in.writeBytes(ByteUtil.convertBigIntegerToNBytes(tunnelId, EncodeConstants.SIZE_OF_LONG_IN_BYTES));
+ in.writeBytes(ByteUtil.convertBigIntegerToNBytes(tunnelId, Long.BYTES));
Tunnel match = deserialize(in).getTunnel();
assertArrayEquals(
- ByteUtil.convertBigIntegerToNBytes(tunnelId, EncodeConstants.SIZE_OF_LONG_IN_BYTES),
+ ByteUtil.convertBigIntegerToNBytes(tunnelId, Long.BYTES),
ByteUtil.uint64toBytes(match.getTunnelId()));
assertEquals(0, in.readableBytes());
writeHeader(in, true);
- in.writeBytes(ByteUtil.convertBigIntegerToNBytes(tunnelId, EncodeConstants.SIZE_OF_LONG_IN_BYTES));
- in.writeBytes(ByteUtil.convertBigIntegerToNBytes(tunnelIdMask, EncodeConstants.SIZE_OF_LONG_IN_BYTES));
+ in.writeBytes(ByteUtil.convertBigIntegerToNBytes(tunnelId, Long.BYTES));
+ in.writeBytes(ByteUtil.convertBigIntegerToNBytes(tunnelIdMask, Long.BYTES));
match = deserialize(in).getTunnel();
assertArrayEquals(
- ByteUtil.convertBigIntegerToNBytes(tunnelId, EncodeConstants.SIZE_OF_LONG_IN_BYTES),
+ ByteUtil.convertBigIntegerToNBytes(tunnelId, Long.BYTES),
ByteUtil.uint64toBytes(match.getTunnelId()));
assertArrayEquals(
- ByteUtil.convertBigIntegerToNBytes(tunnelIdMask, EncodeConstants.SIZE_OF_LONG_IN_BYTES),
+ ByteUtil.convertBigIntegerToNBytes(tunnelIdMask, Long.BYTES),
ByteUtil.uint64toBytes(match.getTunnelMask()));
assertEquals(0, in.readableBytes());
}
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_LONG_IN_BYTES;
+ return Long.BYTES;
}
-
}
* 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.openflowplugin.impl.protocol.deserialization.match;
import static org.junit.Assert.assertEquals;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatch;
public class UdpDestinationPortEntryDeserializerTest extends AbstractMatchEntryDeserializerTest {
-
@Test
public void deserializeEntry() {
final ByteBuf in = UnpooledByteBufAllocator.DEFAULT.buffer();
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ return Short.BYTES;
}
}
* 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.openflowplugin.impl.protocol.deserialization.match;
import static org.junit.Assert.assertEquals;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatch;
public class UdpSourcePortEntryDeserializerTest extends AbstractMatchEntryDeserializerTest {
-
@Test
public void deserializeEntry() {
final ByteBuf in = UnpooledByteBufAllocator.DEFAULT.buffer();
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ return Short.BYTES;
}
}
* 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.openflowplugin.impl.protocol.deserialization.match;
import static org.junit.Assert.assertEquals;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
public class VlanPcpEntryDeserializerTest extends AbstractMatchEntryDeserializerTest {
-
@Test
public void deserializeEntry() {
final ByteBuf in = UnpooledByteBufAllocator.DEFAULT.buffer();
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ return Byte.BYTES;
}
}
* 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.openflowplugin.impl.protocol.deserialization.match;
import static org.junit.Assert.assertEquals;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.VlanMatch;
public class VlanVidEntryDeserializerTest extends AbstractMatchEntryDeserializerTest {
-
@Test
public void deserializeEntry() {
final ByteBuf in = UnpooledByteBufAllocator.DEFAULT.buffer();
@Override
protected int getValueLength() {
- return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ return Short.BYTES;
}
}
// MplsLabel match
buffer.writeShort(OxmMatchConstants.OPENFLOW_BASIC_CLASS);
buffer.writeByte(OxmMatchConstants.MPLS_LABEL << 1);
- buffer.writeByte(EncodeConstants.SIZE_OF_INT_IN_BYTES);
+ buffer.writeByte(Integer.BYTES);
buffer.writeInt(MPLS_LABEL);
// Match footer
// MplsLabel match
buffer.writeShort(OxmMatchConstants.OPENFLOW_BASIC_CLASS);
buffer.writeByte(OxmMatchConstants.MPLS_LABEL << 1);
- buffer.writeByte(EncodeConstants.SIZE_OF_INT_IN_BYTES);
+ buffer.writeByte(Integer.BYTES);
buffer.writeInt(MPLS_LABEL);
// Match footer
// MplsLabel match
buffer.writeShort(OxmMatchConstants.OPENFLOW_BASIC_CLASS);
buffer.writeByte(OxmMatchConstants.MPLS_LABEL << 1);
- buffer.writeByte(EncodeConstants.SIZE_OF_INT_IN_BYTES);
+ buffer.writeByte(Integer.BYTES);
buffer.writeInt(MPLS_LABEL);
// Match footer
// MplsLabel match
buffer.writeShort(OxmMatchConstants.OPENFLOW_BASIC_CLASS);
buffer.writeByte(OxmMatchConstants.MPLS_LABEL << 1);
- buffer.writeByte(EncodeConstants.SIZE_OF_INT_IN_BYTES);
+ buffer.writeByte(Integer.BYTES);
buffer.writeInt(MPLS_LABEL);
// Match footer
getSerializer().serialize(action, buffer);
assertEquals(buffer.readUnsignedShort(), getType());
assertEquals(buffer.readUnsignedShort(),
- EncodeConstants.SIZE_OF_SHORT_IN_BYTES // Size of action type
- + EncodeConstants.SIZE_OF_SHORT_IN_BYTES // Size of action length
- + EncodeConstants.SIZE_OF_SHORT_IN_BYTES // Match entry OXM class
- + EncodeConstants.SIZE_OF_BYTE_IN_BYTES // Match entry field and mask
- + EncodeConstants.SIZE_OF_BYTE_IN_BYTES // Match entry length
+ Short.BYTES // Size of action type
+ + Short.BYTES // Size of action length
+ + Short.BYTES // Match entry OXM class
+ + Byte.BYTES // Match entry field and mask
+ + Byte.BYTES // Match entry length
+ EncodeConstants.PADDING); // Size of set field (match entry)
// Skip match entry header, we have tests for this elsewhere
- buffer.skipBytes(EncodeConstants.SIZE_OF_INT_IN_BYTES);
+ buffer.skipBytes(Integer.BYTES);
assertBody.accept(buffer);
* 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.openflowplugin.impl.protocol.serialization.instructions;
import static org.junit.Assert.assertArrayEquals;
import java.util.Collections;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.apply.actions._case.ApplyActionsBuilder;
public class ApplyActionsInstructionSerializerTest extends AbstractInstructionSerializerTest {
-
@Test
public void testSerialize() {
final int order = 0;
assertInstruction(instruction, out -> {
out.skipBytes(InstructionConstants.PADDING_IN_ACTIONS_INSTRUCTION);
assertEquals(out.readUnsignedShort(), ActionConstants.SET_FIELD_CODE);
- out.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES); // Skip length of set field action
+ out.skipBytes(Short.BYTES); // Skip length of set field action
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.IPV4_SRC << 1);
- out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES); // Skip match entry length
+ out.skipBytes(Byte.BYTES); // Skip match entry length
byte[] addressBytes = new byte[4];
out.readBytes(addressBytes);
protected int getLength() {
return 24;
}
-
}
* 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.openflowplugin.impl.protocol.serialization.instructions;
import static org.junit.Assert.assertArrayEquals;
import java.util.Collections;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.write.actions._case.WriteActionsBuilder;
public class WriteActionsInstructionSerializerTest extends AbstractInstructionSerializerTest {
-
@Test
public void testSerialize() {
final int order = 0;
assertInstruction(instruction, out -> {
out.skipBytes(InstructionConstants.PADDING_IN_ACTIONS_INSTRUCTION);
assertEquals(out.readUnsignedShort(), ActionConstants.SET_FIELD_CODE);
- out.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES); // Skip length of set field action
+ out.skipBytes(Short.BYTES); // Skip length of set field action
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.IPV4_SRC << 1);
- out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES); // Skip match entry length
+ out.skipBytes(Byte.BYTES); // Skip match entry length
byte[] addressBytes = new byte[4];
out.readBytes(addressBytes);
protected int getLength() {
return 24;
}
-
}
getSerializer().serialize(match, buffer);
final int length = (hasMask ? 2 : 1) * getLength();
- final int lengthExp = length + EncodeConstants.SIZE_OF_INT_IN_BYTES; // add length of Experimenter ID
+ final int lengthExp = length + Integer.BYTES; // add length of Experimenter ID
assertEquals(buffer.readShort(), 1); // OXM_MATCH_TYPE
assertEquals(buffer.readShort(), // Total length of match
- EncodeConstants.SIZE_OF_SHORT_IN_BYTES // OXM_MATCH_TYPE length
- + EncodeConstants.SIZE_OF_SHORT_IN_BYTES // LENGTH length
- + EncodeConstants.SIZE_OF_SHORT_IN_BYTES // OXM_CLASS_CODE length
- + EncodeConstants.SIZE_OF_BYTE_IN_BYTES // OXM field and mask length
- + EncodeConstants.SIZE_OF_BYTE_IN_BYTES // OXM field and mask length length
+ Short.BYTES // OXM_MATCH_TYPE length
+ + Short.BYTES // LENGTH length
+ + Short.BYTES // OXM_CLASS_CODE length
+ + Byte.BYTES // OXM field and mask length
+ + Byte.BYTES // OXM field and mask length length
+ lengthExp // length of data in match entry
);
assertEquals(buffer.readShort(), 1); // OXM_MATCH_TYPE
assertEquals(buffer.readShort(), // Total length of match
- EncodeConstants.SIZE_OF_SHORT_IN_BYTES // OXM_MATCH_TYPE length
- + EncodeConstants.SIZE_OF_SHORT_IN_BYTES // LENGTH length
- + EncodeConstants.SIZE_OF_SHORT_IN_BYTES // OXM_CLASS_CODE length
- + EncodeConstants.SIZE_OF_BYTE_IN_BYTES // OXM field and mask length
- + EncodeConstants.SIZE_OF_BYTE_IN_BYTES // OXM field and mask length length
+ Short.BYTES // OXM_MATCH_TYPE length
+ + Short.BYTES // LENGTH length
+ + Short.BYTES // OXM_CLASS_CODE length
+ + Byte.BYTES // OXM field and mask length
+ + Byte.BYTES // OXM field and mask length length
+ length // length of data in match entry
);
* 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.openflowplugin.impl.protocol.serialization.match;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.ArpMatchBuilder;
public class ArpOpEntrySerializerTest extends AbstractMatchEntrySerializerTest {
-
@Test
public void testSerialize() {
final int arpOp = 42;
@Override
protected short getLength() {
- return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ return Short.BYTES;
}
@Override
protected int getOxmClassCode() {
return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
}
-
-}
\ No newline at end of file
+}
* 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.openflowplugin.impl.protocol.serialization.match;
import static org.junit.Assert.assertArrayEquals;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.ArpMatchBuilder;
public class ArpSourceTransportAddressEntrySerializerTest extends AbstractMatchEntrySerializerTest {
-
@Test
public void testSerialize() {
final Match arpSpaMatch = new MatchBuilder()
@Override
protected short getLength() {
- return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ return Integer.BYTES;
}
@Override
protected int getOxmClassCode() {
return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
}
-
}
* 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.openflowplugin.impl.protocol.serialization.match;
import static org.junit.Assert.assertArrayEquals;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.ArpMatchBuilder;
public class ArpTargetTransportAddressEntrySerializerTest extends AbstractMatchEntrySerializerTest {
-
@Test
public void testSerialize() {
final Match arpSpaMatch = new MatchBuilder()
@Override
protected short getLength() {
- return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ return Integer.BYTES;
}
@Override
protected int getOxmClassCode() {
return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
}
-
}
* 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.openflowplugin.impl.protocol.serialization.match;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder;
public class EthernetTypeEntrySerializerTest extends AbstractMatchEntrySerializerTest {
-
@Test
public void testSerialize() {
final long ethType = 0xffffL;
@Override
protected short getLength() {
- return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ return Short.BYTES;
}
@Override
protected int getOxmClassCode() {
return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
}
-
}
* 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.openflowplugin.impl.protocol.serialization.match;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv4MatchBuilder;
public class Icmpv4CodeEntrySerializerTest extends AbstractMatchEntrySerializerTest {
-
@Test
public void testSerialize() {
final short code = 200;
@Override
protected short getLength() {
- return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ return Byte.BYTES;
}
@Override
protected int getOxmClassCode() {
return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
}
-
}
* 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.openflowplugin.impl.protocol.serialization.match;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv4MatchBuilder;
public class Icmpv4TypeEntrySerializerTest extends AbstractMatchEntrySerializerTest {
-
@Test
public void testSerialize() {
final short type = 128;
@Override
protected short getLength() {
- return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ return Byte.BYTES;
}
@Override
protected int getOxmClassCode() {
return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
}
-
}
* 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.openflowplugin.impl.protocol.serialization.match;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv6MatchBuilder;
public class Icmpv6CodeEntrySerializerTest extends AbstractMatchEntrySerializerTest {
-
@Test
public void testSerialize() {
final short code = 101;
@Override
protected short getLength() {
- return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ return Byte.BYTES;
}
@Override
protected int getOxmClassCode() {
return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
}
-
}
* 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.openflowplugin.impl.protocol.serialization.match;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv6MatchBuilder;
public class Icmpv6TypeEntrySerializerTest extends AbstractMatchEntrySerializerTest {
-
@Test
public void testSerialize() {
final short type = 123;
@Override
protected short getLength() {
- return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ return Byte.BYTES;
}
@Override
protected int getOxmClassCode() {
return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
}
-
}
* 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.openflowplugin.impl.protocol.serialization.match;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId;
public class InPhyPortEntrySerializerTest extends AbstractMatchEntrySerializerTest {
-
@Test
public void testSerialize() {
final int port = 10122;
@Override
protected short getLength() {
- return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ return Integer.BYTES;
}
@Override
protected int getOxmClassCode() {
return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
}
-
}
* 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.openflowplugin.impl.protocol.serialization.match;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId;
public class InPortEntrySerializerTest extends AbstractMatchEntrySerializerTest {
-
@Test
public void testSerialize() {
final int port = 42;
@Override
protected short getLength() {
- return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ return Integer.BYTES;
}
@Override
protected int getOxmClassCode() {
return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
}
-
}
* 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.openflowplugin.impl.protocol.serialization.match;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Dscp;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatchBuilder;
public class IpDscpEntrySerializerTest extends AbstractMatchEntrySerializerTest {
-
@Test
public void testSerialize() {
final short dscp = (short) 58;
@Override
protected short getLength() {
- return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ return Byte.BYTES;
}
@Override
protected int getOxmClassCode() {
return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
}
-
}
* 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.openflowplugin.impl.protocol.serialization.match;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatchBuilder;
public class IpEcnEntrySerializerTest extends AbstractMatchEntrySerializerTest {
-
@Test
public void testSerialize() {
final short ecn = (short) 58;
@Override
protected short getLength() {
- return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ return Byte.BYTES;
}
@Override
protected int getOxmClassCode() {
return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
}
-
}
* 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.openflowplugin.impl.protocol.serialization.match;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatchBuilder;
public class IpProtoEntrySerializerTest extends AbstractMatchEntrySerializerTest {
-
@Test
public void testSerialize() {
final short proto = (short) 6; // TCP
@Override
protected short getLength() {
- return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ return Byte.BYTES;
}
@Override
protected int getOxmClassCode() {
return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
}
-
}
* 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.openflowplugin.impl.protocol.serialization.match;
import static org.junit.Assert.assertArrayEquals;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
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.yang.types.rev130715.DottedQuad;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchArbitraryBitMaskBuilder;
public class Ipv4ArbitraryBitMaskDestinationEntrySerializerTest extends AbstractMatchEntrySerializerTest {
-
@Test
public void testSerialize() {
final Ipv4Address ipv4Address = new Ipv4Address("192.168.10.0");
@Override
protected short getLength() {
- return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ return Integer.BYTES;
}
@Override
protected int getOxmClassCode() {
return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
}
-
}
* 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.openflowplugin.impl.protocol.serialization.match;
import static org.junit.Assert.assertArrayEquals;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
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.yang.types.rev130715.DottedQuad;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchArbitraryBitMaskBuilder;
public class Ipv4ArbitraryBitMaskSourceEntrySerializerTest extends AbstractMatchEntrySerializerTest {
-
@Test
public void testSerialize() {
final Ipv4Address ipv4Address = new Ipv4Address("192.168.10.0");
@Override
protected short getLength() {
- return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ return Integer.BYTES;
}
@Override
protected int getOxmClassCode() {
return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
}
-
}
* 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.openflowplugin.impl.protocol.serialization.match;
import static org.junit.Assert.assertArrayEquals;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchBuilder;
public class Ipv4DestinationEntrySerializerTest extends AbstractMatchEntrySerializerTest {
-
@Test
public void testSerialize() {
final Match ipv4match = new MatchBuilder()
@Override
protected short getLength() {
- return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ return Integer.BYTES;
}
@Override
protected int getOxmClassCode() {
return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
}
-
}
* 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.openflowplugin.impl.protocol.serialization.match;
import static org.junit.Assert.assertArrayEquals;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchBuilder;
public class Ipv4SourceEntrySerializerTest extends AbstractMatchEntrySerializerTest {
-
@Test
public void testSerialize() {
final Match ipv4match = new MatchBuilder()
@Override
protected short getLength() {
- return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ return Integer.BYTES;
}
@Override
protected int getOxmClassCode() {
return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
}
-
}
* 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.openflowplugin.impl.protocol.serialization.match;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.openflowplugin.openflow.md.util.ByteUtil;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder;
public class Ipv6ExtHeaderEntrySerializerTest extends AbstractMatchEntrySerializerTest {
-
@Test
public void testSerialize() {
final int ipv6extHdr = 358;
@Override
protected short getLength() {
- return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ return Short.BYTES;
}
@Override
protected int getOxmClassCode() {
return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
}
-
}
* 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.openflowplugin.impl.protocol.serialization.match;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.openflowplugin.openflow.md.util.ByteUtil;
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.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder;
public class Ipv6LabelEntrySerializerTest extends AbstractMatchEntrySerializerTest {
-
@Test
public void testSerialize() {
final long ipv6flowLabel = 358;
@Override
protected short getLength() {
- return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ return Integer.BYTES;
}
@Override
protected int getOxmClassCode() {
return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
}
-
}
* 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.openflowplugin.impl.protocol.serialization.match;
import static org.junit.Assert.assertArrayEquals;
import com.google.common.primitives.Longs;
import java.math.BigInteger;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.MetadataBuilder;
public class MetadataEntrySerializerTest extends AbstractMatchEntrySerializerTest {
-
@Test
public void testSerialize() {
final byte[] metadata = new byte[] { 0, 1, 2, 3, 4, 5, 6, 7 };
@Override
protected short getLength() {
- return EncodeConstants.SIZE_OF_LONG_IN_BYTES;
+ return Long.BYTES;
}
@Override
protected int getOxmClassCode() {
return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
}
-
}
* 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.openflowplugin.impl.protocol.serialization.match;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.ProtocolMatchFieldsBuilder;
public class MplsBosEntrySerializerTest extends AbstractMatchEntrySerializerTest {
-
@Test
public void testSerialize() {
final short mplsBos = (short) 1;
@Override
protected short getLength() {
- return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ return Byte.BYTES;
}
@Override
protected int getOxmClassCode() {
return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
}
-
}
* 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.openflowplugin.impl.protocol.serialization.match;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.ProtocolMatchFieldsBuilder;
public class MplsLabelEntrySerializerTest extends AbstractMatchEntrySerializerTest {
-
@Test
public void testSerialize() {
final long mplsLabel = 10L;
@Override
protected short getLength() {
- return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ return Integer.BYTES;
}
@Override
protected int getOxmClassCode() {
return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
}
-
}
* 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.openflowplugin.impl.protocol.serialization.match;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.ProtocolMatchFieldsBuilder;
public class MplsTcEntrySerializerTest extends AbstractMatchEntrySerializerTest {
-
@Test
public void testSerialize() {
final short mplsTc = (short) 1;
@Override
protected short getLength() {
- return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ return Byte.BYTES;
}
@Override
protected int getOxmClassCode() {
return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
}
-
}
* 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.openflowplugin.impl.protocol.serialization.match;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.PacketTypeMatchBuilder;
public class PacketTypeEntrySerializerTest extends AbstractMatchEntrySerializerTest {
-
@Test
public void serializeTest() {
final long packetType = 0x1894f;
@Override
protected short getLength() {
- return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ return Integer.BYTES;
}
-}
\ No newline at end of file
+}
* 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.openflowplugin.impl.protocol.serialization.match;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.SctpMatchBuilder;
public class SctpDestinationPortEntrySerializerTest extends AbstractMatchEntrySerializerTest {
-
@Test
public void testSerialize() {
final int sctp = 10;
@Override
protected short getLength() {
- return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ return Short.BYTES;
}
@Override
protected int getOxmClassCode() {
return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
}
-
}
* 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.openflowplugin.impl.protocol.serialization.match;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.SctpMatchBuilder;
public class SctpSourcePortEntrySerializerTest extends AbstractMatchEntrySerializerTest {
-
@Test
public void testSerialize() {
final int sctp = 10;
@Override
protected short getLength() {
- return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ return Short.BYTES;
}
@Override
protected int getOxmClassCode() {
return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
}
-
}
* 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.openflowplugin.impl.protocol.serialization.match;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatchBuilder;
public class TcpDestinationPortEntrySerializerTest extends AbstractMatchEntrySerializerTest {
-
@Test
public void testSerialize() {
final int tcp = 10;
@Override
protected short getLength() {
- return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ return Short.BYTES;
}
@Override
protected int getOxmClassCode() {
return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
}
-
}
@Override
protected short getLength() {
- return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ return Short.BYTES;
}
@Override
* 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.openflowplugin.impl.protocol.serialization.match;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatchBuilder;
public class TcpSourcePortEntrySerializerTest extends AbstractMatchEntrySerializerTest {
-
@Test
public void testSerialize() {
final int tcp = 10;
@Override
protected short getLength() {
- return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ return Short.BYTES;
}
@Override
protected int getOxmClassCode() {
return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
}
-
}
* 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.openflowplugin.impl.protocol.serialization.match;
import static org.junit.Assert.assertArrayEquals;
import java.math.BigInteger;
import java.nio.ByteBuffer;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.TunnelBuilder;
public class TunnelIdEntrySerializerTest extends AbstractMatchEntrySerializerTest {
-
@Test
public void testSerialize() {
final long tunnelId = 8;
@Override
protected short getLength() {
- return EncodeConstants.SIZE_OF_LONG_IN_BYTES;
+ return Long.BYTES;
}
@Override
protected int getOxmClassCode() {
return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
}
-
}
* 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.openflowplugin.impl.protocol.serialization.match;
import static org.junit.Assert.assertArrayEquals;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.TunnelIpv4MatchBuilder;
public class TunnelIpv4DestinationEntrySerializerTest extends AbstractMatchEntrySerializerTest {
-
@Test
public void testSerialize() {
final Match ipv4match = new MatchBuilder()
@Override
protected short getLength() {
- return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ return Integer.BYTES;
}
@Override
protected int getOxmClassCode() {
return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
}
-
}
* 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.openflowplugin.impl.protocol.serialization.match;
import static org.junit.Assert.assertArrayEquals;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.TunnelIpv4MatchBuilder;
public class TunnelIpv4SourceEntrySerializerTest extends AbstractMatchEntrySerializerTest {
-
@Test
public void testSerialize() {
final Match ipv4match = new MatchBuilder()
@Override
protected short getLength() {
- return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ return Integer.BYTES;
}
@Override
protected int getOxmClassCode() {
return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
}
-
}
* 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.openflowplugin.impl.protocol.serialization.match;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatchBuilder;
public class UdpDestinationPortEntrySerializerTest extends AbstractMatchEntrySerializerTest {
-
@Test
public void testSerialize() {
final int tcp = 10;
@Override
protected short getLength() {
- return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ return Short.BYTES;
}
@Override
protected int getOxmClassCode() {
return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
}
-
}
* 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.openflowplugin.impl.protocol.serialization.match;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatchBuilder;
public class UdpSourcePortEntrySerializerTest extends AbstractMatchEntrySerializerTest {
-
@Test
public void testSerialize() {
final int tcp = 10;
@Override
protected short getLength() {
- return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ return Short.BYTES;
}
@Override
protected int getOxmClassCode() {
return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
}
-
}
* 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.openflowplugin.impl.protocol.serialization.match;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanPcp;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.VlanMatchBuilder;
public class VlanPcpEntrySerializerTest extends AbstractMatchEntrySerializerTest {
-
@Test
public void testSerialize() {
final short vlan = (short) 1;
@Override
protected short getLength() {
- return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ return Byte.BYTES;
}
@Override
protected int getOxmClassCode() {
return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
}
-
}
* 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.openflowplugin.impl.protocol.serialization.match;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.vlan.match.fields.VlanIdBuilder;
public class VlanVidEntrySerializerTest extends AbstractMatchEntrySerializerTest {
-
@Test
public void testSerialize() {
final int vlan = (short) 1;
@Override
protected short getLength() {
- return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ return Short.BYTES;
}
@Override
protected int getOxmClassCode() {
return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
}
-
}
// Vlan false match
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.VLAN_VID << 1);
- assertEquals(out.readUnsignedByte(), EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ assertEquals(out.readUnsignedByte(), Short.BYTES);
assertEquals(out.readUnsignedShort(), 0);
// Ip proto match
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.IP_PROTO << 1);
- assertEquals(out.readUnsignedByte(), EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ assertEquals(out.readUnsignedByte(), Byte.BYTES);
assertEquals(out.readUnsignedByte(), IP_PROTOCOL_MATCH.shortValue());
int paddingRemainder = matchLength % EncodeConstants.PADDING;
assertEquals(out.readUnsignedShort(), setVlanIdLength);
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.VLAN_VID << 1);
- assertEquals(out.readUnsignedByte(), EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ assertEquals(out.readUnsignedByte(), Short.BYTES);
assertEquals(out.readUnsignedShort(), VLAN_ID | (1 << 12));
paddingRemainder = (out.readerIndex() - setVlanStartIndex) % EncodeConstants.PADDING;
assertEquals(out.readUnsignedShort(), setTpSrcLength);
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.UDP_SRC << 1);
- assertEquals(out.readUnsignedByte(), EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ assertEquals(out.readUnsignedByte(), Short.BYTES);
assertEquals(out.readUnsignedShort(), TP_SRC_PORT.intValue());
paddingRemainder = (out.readerIndex() - setTpSrcStartIndex) % EncodeConstants.PADDING;
assertEquals(out.readUnsignedShort(), setTpDstLength);
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.UDP_DST << 1);
- assertEquals(out.readUnsignedByte(), EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ assertEquals(out.readUnsignedByte(), Short.BYTES);
assertEquals(out.readUnsignedShort(), TP_DST_PORT.intValue());
paddingRemainder = (out.readerIndex() - setTpDstStartIndex) % EncodeConstants.PADDING;
// Vlan false match
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.VLAN_VID << 1 | 1);
- assertEquals(out.readUnsignedByte(), EncodeConstants.SIZE_OF_SHORT_IN_BYTES * 2);
+ assertEquals(out.readUnsignedByte(), Short.BYTES * 2);
assertEquals(out.readUnsignedShort(), (1 << 12));
byte[] vlanMask = new byte[2];
out.readBytes(vlanMask);
// Ip proto match
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.IP_PROTO << 1);
- assertEquals(out.readUnsignedByte(), EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ assertEquals(out.readUnsignedByte(), Byte.BYTES);
assertEquals(out.readUnsignedByte(), IP_PROTOCOL_MATCH.shortValue());
int paddingRemainder = matchLength % EncodeConstants.PADDING;
assertEquals(out.readUnsignedShort(), setVlanIdLength);
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.VLAN_VID << 1);
- assertEquals(out.readUnsignedByte(), EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ assertEquals(out.readUnsignedByte(), Short.BYTES);
assertEquals(out.readUnsignedShort(), VLAN_ID | (1 << 12));
paddingRemainder = (out.readerIndex() - setVlanStartIndex) % EncodeConstants.PADDING;
assertEquals(out.readUnsignedShort(), setTpSrcLength);
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.UDP_SRC << 1);
- assertEquals(out.readUnsignedByte(), EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ assertEquals(out.readUnsignedByte(), Short.BYTES);
assertEquals(out.readUnsignedShort(), TP_SRC_PORT.intValue());
paddingRemainder = (out.readerIndex() - setTpSrcStartIndex) % EncodeConstants.PADDING;
assertEquals(out.readUnsignedShort(), setTpDstLength);
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.UDP_DST << 1);
- assertEquals(out.readUnsignedByte(), EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ assertEquals(out.readUnsignedByte(), Short.BYTES);
assertEquals(out.readUnsignedShort(), TP_DST_PORT.intValue());
paddingRemainder = (out.readerIndex() - setTpDstStartIndex) % EncodeConstants.PADDING;
// Action
assertEquals(out.readUnsignedShort(), ActionConstants.SET_FIELD_CODE);
- assertEquals(out.readUnsignedShort(), EncodeConstants.SIZE_OF_SHORT_IN_BYTES // Size of action type
- + EncodeConstants.SIZE_OF_SHORT_IN_BYTES // Size of action length
- + EncodeConstants.SIZE_OF_SHORT_IN_BYTES // Match entry OXM class
- + EncodeConstants.SIZE_OF_BYTE_IN_BYTES // Match entry field and mask
- + EncodeConstants.SIZE_OF_BYTE_IN_BYTES // Match entry length
+ assertEquals(out.readUnsignedShort(), Short.BYTES // Size of action type
+ + Short.BYTES // Size of action length
+ + Short.BYTES // Match entry OXM class
+ + Byte.BYTES // Match entry field and mask
+ + Byte.BYTES // Match entry length
+ EncodeConstants.PADDING); // Size of set field (match entry)
// Skip match entry header, we have tests for this elsewhere
- out.skipBytes(EncodeConstants.SIZE_OF_INT_IN_BYTES);
+ out.skipBytes(Integer.BYTES);
// Actual match body
byte[] addressBytes = new byte[4];
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.IP_PROTO << 1);
- assertEquals(out.readUnsignedByte(), EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ assertEquals(out.readUnsignedByte(), Byte.BYTES);
assertEquals(out.readUnsignedByte(), IP_PROTOCOL_MATCH.shortValue());
int paddingRemainder = matchLength % EncodeConstants.PADDING;
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.IP_PROTO << 1);
- assertEquals(out.readUnsignedByte(), EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ assertEquals(out.readUnsignedByte(), Byte.BYTES);
assertEquals(out.readUnsignedByte(), IP_PROTOCOL_MATCH.shortValue());
int paddingRemainder = matchLength % EncodeConstants.PADDING;
final ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
serializer.serialize(BODY, out);
- out.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES); // skip length
+ out.skipBytes(Short.BYTES); // skip length
assertEquals(TABLE_ID, out.readUnsignedByte());
out.skipBytes(PADDING_IN_MULTIPART_REQUEST_TABLE_FEATURES_BODY);
assertEquals(NAME, ByteBufUtils.decodeNullTerminatedString(out, MAX_TABLE_NAME_LENGTH));
- final byte[] match = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ final byte[] match = new byte[Long.BYTES];
out.readBytes(match);
assertEquals(METADATA_MATCH, new BigInteger(1, match));
- final byte[] write = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ final byte[] write = new byte[Long.BYTES];
out.readBytes(write);
assertEquals(METADATA_WRITE, new BigInteger(1, write));
assertEquals(IS_DEPRECATED_MASK, (out.readUnsignedInt() & 3) != 0);
* 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.openflowplugin.impl.protocol.serialization.multipart.tablefeatures;
import static org.junit.Assert.assertEquals;
import java.util.Collections;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwSrcActionCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplyActionsMissBuilder;
public class ApplyActionsMissTablePropertySerializerTest extends AbstractTablePropertySerializerTest {
-
@Test
public void testSerialize() {
final ApplyActionsMiss property = new ApplyActionsMissBuilder()
assertProperty(property, out -> {
assertEquals(out.readUnsignedShort(), ActionConstants.SET_FIELD_CODE);
- out.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES); // Skip length of set field action
+ out.skipBytes(Short.BYTES); // Skip length of set field action
});
}
protected int getType() {
return TableFeaturesPropType.OFPTFPTAPPLYACTIONSMISS.getIntValue();
}
-
}
* 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.openflowplugin.impl.protocol.serialization.multipart.tablefeatures;
import static org.junit.Assert.assertEquals;
import java.util.Collections;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwSrcActionCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplyActionsBuilder;
public class ApplyActionsTablePropertySerializerTest extends AbstractTablePropertySerializerTest {
-
@Test
public void testSerialize() {
final ApplyActions property = new ApplyActionsBuilder()
assertProperty(property, out -> {
assertEquals(out.readUnsignedShort(), ActionConstants.SET_FIELD_CODE);
- out.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES); // Skip length of set field action
+ out.skipBytes(Short.BYTES); // Skip length of set field action
});
}
protected int getType() {
return TableFeaturesPropType.OFPTFPTAPPLYACTIONS.getIntValue();
}
-
}
* 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.openflowplugin.impl.protocol.serialization.multipart.tablefeatures;
import static org.junit.Assert.assertEquals;
import com.google.common.collect.ImmutableList;
import org.junit.Test;
-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.common.types.rev130731.TableFeaturesPropType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.ArpOp;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplySetfieldMissBuilder;
public class ApplySetfieldMissTablePropertySerializerTest extends AbstractTablePropertySerializerTest {
-
@Test
public void testSerialize() {
final ApplySetfieldMiss property = new ApplySetfieldMissBuilder()
assertProperty(property, out -> {
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.ARP_OP << 1);
- out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES); // Skip match entry length
+ out.skipBytes(Byte.BYTES); // Skip match entry length
});
}
protected int getType() {
return TableFeaturesPropType.OFPTFPTAPPLYSETFIELDMISS.getIntValue();
}
-
}
* 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.openflowplugin.impl.protocol.serialization.multipart.tablefeatures;
import static org.junit.Assert.assertEquals;
import com.google.common.collect.ImmutableList;
import org.junit.Test;
-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.common.types.rev130731.TableFeaturesPropType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.ArpOp;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplySetfieldBuilder;
public class ApplySetfieldTablePropertySerializerTest extends AbstractTablePropertySerializerTest {
-
@Test
public void testSerialize() {
final ApplySetfield property = new ApplySetfieldBuilder()
assertProperty(property, out -> {
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.ARP_OP << 1);
- out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES); // Skip match entry length
+ out.skipBytes(Byte.BYTES); // Skip match entry length
});
}
protected int getType() {
return TableFeaturesPropType.OFPTFPTAPPLYSETFIELD.getIntValue();
}
-
}
* 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.openflowplugin.impl.protocol.serialization.multipart.tablefeatures;
import static org.junit.Assert.assertEquals;
import java.util.Collections;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.InstructionsMissBuilder;
public class InstructionsMissTablePropertySerializerTest extends AbstractTablePropertySerializerTest {
-
@Test
public void testSerialize() {
final InstructionsMiss property = new InstructionsMissBuilder()
assertProperty(property, out -> {
assertEquals(out.readUnsignedShort(), InstructionConstants.APPLY_ACTIONS_TYPE);
- out.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES); // Skip length of set field action
+ out.skipBytes(Short.BYTES); // Skip length of set field action
});
}
protected int getType() {
return TableFeaturesPropType.OFPTFPTINSTRUCTIONSMISS.getIntValue();
}
-
}
* 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.openflowplugin.impl.protocol.serialization.multipart.tablefeatures;
import static org.junit.Assert.assertEquals;
import java.util.Collections;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.InstructionsBuilder;
public class InstructionsTablePropertySerializerTest extends AbstractTablePropertySerializerTest {
-
@Test
public void testSerialize() {
final Instructions property = new InstructionsBuilder()
assertProperty(property, out -> {
assertEquals(out.readUnsignedShort(), InstructionConstants.APPLY_ACTIONS_TYPE);
- out.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES); // Skip length of set field action
+ out.skipBytes(Short.BYTES); // Skip length of set field action
});
}
protected int getType() {
return TableFeaturesPropType.OFPTFPTINSTRUCTIONS.getIntValue();
}
-
}
* 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.openflowplugin.impl.protocol.serialization.multipart.tablefeatures;
import static org.junit.Assert.assertEquals;
import com.google.common.collect.ImmutableList;
import org.junit.Test;
-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.common.types.rev130731.TableFeaturesPropType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.ArpOp;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.match.MatchSetfieldBuilder;
public class MatchTablePropertySerializerTest extends AbstractTablePropertySerializerTest {
-
@Test
public void testSerialize() {
final Match property = new MatchBuilder()
assertProperty(property, out -> {
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.ARP_OP << 1);
- out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES); // Skip match entry length
+ out.skipBytes(Byte.BYTES); // Skip match entry length
});
}
protected int getType() {
return TableFeaturesPropType.OFPTFPTMATCH.getIntValue();
}
-
}
* 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.openflowplugin.impl.protocol.serialization.multipart.tablefeatures;
import static org.junit.Assert.assertEquals;
import com.google.common.collect.ImmutableList;
import org.junit.Test;
-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.common.types.rev130731.TableFeaturesPropType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.ArpOp;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.wildcards.WildcardSetfieldBuilder;
public class WildcardsTablePropertySerializerTest extends AbstractTablePropertySerializerTest {
-
@Test
public void testSerialize() {
final Wildcards property = new WildcardsBuilder()
assertProperty(property, out -> {
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.ARP_OP << 1);
- out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES); // Skip match entry length
+ out.skipBytes(Byte.BYTES); // Skip match entry length
});
}
protected int getType() {
return TableFeaturesPropType.OFPTFPTWILDCARDS.getIntValue();
}
-
}
* 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.openflowplugin.impl.protocol.serialization.multipart.tablefeatures;
import static org.junit.Assert.assertEquals;
import java.util.Collections;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwSrcActionCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteActionsMissBuilder;
public class WriteActionsMissTablePropertySerializerTest extends AbstractTablePropertySerializerTest {
-
@Test
public void testSerialize() {
final WriteActionsMiss property = new WriteActionsMissBuilder()
assertProperty(property, out -> {
assertEquals(out.readUnsignedShort(), ActionConstants.SET_FIELD_CODE);
- out.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES); // Skip length of set field action
+ out.skipBytes(Short.BYTES); // Skip length of set field action
});
}
protected int getType() {
return TableFeaturesPropType.OFPTFPTWRITEACTIONSMISS.getIntValue();
}
-
}
* 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.openflowplugin.impl.protocol.serialization.multipart.tablefeatures;
import static org.junit.Assert.assertEquals;
import java.util.Collections;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwSrcActionCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteActionsBuilder;
public class WriteActionsTablePropertySerializerTest extends AbstractTablePropertySerializerTest {
-
@Test
public void testSerialize() {
final WriteActions property = new WriteActionsBuilder()
assertProperty(property, out -> {
assertEquals(out.readUnsignedShort(), ActionConstants.SET_FIELD_CODE);
- out.skipBytes(EncodeConstants.SIZE_OF_SHORT_IN_BYTES); // Skip length of set field action
+ out.skipBytes(Short.BYTES); // Skip length of set field action
});
}
protected int getType() {
return TableFeaturesPropType.OFPTFPTWRITEACTIONS.getIntValue();
}
-
}
* 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.openflowplugin.impl.protocol.serialization.multipart.tablefeatures;
import static org.junit.Assert.assertEquals;
import com.google.common.collect.ImmutableList;
import org.junit.Test;
-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.common.types.rev130731.TableFeaturesPropType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.ArpOp;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteSetfieldMissBuilder;
public class WriteSetfieldMissTablePropertySerializerTest extends AbstractTablePropertySerializerTest {
-
@Test
public void testSerialize() {
final WriteSetfieldMiss property = new WriteSetfieldMissBuilder()
assertProperty(property, out -> {
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.ARP_OP << 1);
- out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES); // Skip match entry length
+ out.skipBytes(Byte.BYTES); // Skip match entry length
});
}
protected int getType() {
return TableFeaturesPropType.OFPTFPTWRITESETFIELDMISS.getIntValue();
}
-
}
* 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.openflowplugin.impl.protocol.serialization.multipart.tablefeatures;
import static org.junit.Assert.assertEquals;
import com.google.common.collect.ImmutableList;
import org.junit.Test;
-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.common.types.rev130731.TableFeaturesPropType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.ArpOp;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteSetfieldBuilder;
public class WriteSetfieldTablePropertySerializerTest extends AbstractTablePropertySerializerTest {
-
@Test
public void testSerialize() {
final WriteSetfield property = new WriteSetfieldBuilder()
assertProperty(property, out -> {
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.ARP_OP << 1);
- out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES); // Skip match entry length
+ out.skipBytes(Byte.BYTES); // Skip match entry length
});
}
protected int getType() {
return TableFeaturesPropType.OFPTFPTWRITESETFIELD.getIntValue();
}
-
}
assertProperty(property, out -> {
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.ARP_OP << 1);
- out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ out.skipBytes(Byte.BYTES);
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.ARP_SHA << 1);
- out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ out.skipBytes(Byte.BYTES);
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.ARP_SPA << 1);
- out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ out.skipBytes(Byte.BYTES);
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.ARP_THA << 1);
- out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ out.skipBytes(Byte.BYTES);
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.ARP_TPA << 1);
- out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ out.skipBytes(Byte.BYTES);
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.ETH_DST << 1);
- out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ out.skipBytes(Byte.BYTES);
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.ETH_SRC << 1);
- out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ out.skipBytes(Byte.BYTES);
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.ETH_TYPE << 1);
- out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ out.skipBytes(Byte.BYTES);
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.ICMPV4_CODE << 1);
- out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ out.skipBytes(Byte.BYTES);
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.ICMPV4_TYPE << 1);
- out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ out.skipBytes(Byte.BYTES);
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.ICMPV6_CODE << 1);
- out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ out.skipBytes(Byte.BYTES);
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.ICMPV6_TYPE << 1);
- out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ out.skipBytes(Byte.BYTES);
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.IN_PHY_PORT << 1);
- out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ out.skipBytes(Byte.BYTES);
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.IN_PORT << 1);
- out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ out.skipBytes(Byte.BYTES);
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.IP_DSCP << 1);
- out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ out.skipBytes(Byte.BYTES);
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.IP_ECN << 1);
- out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ out.skipBytes(Byte.BYTES);
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.IP_PROTO << 1);
- out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ out.skipBytes(Byte.BYTES);
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.IPV4_DST << 1);
- out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ out.skipBytes(Byte.BYTES);
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.IPV4_SRC << 1);
- out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ out.skipBytes(Byte.BYTES);
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.IPV6_DST << 1);
- out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ out.skipBytes(Byte.BYTES);
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.IPV6_EXTHDR << 1);
- out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ out.skipBytes(Byte.BYTES);
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.IPV6_FLABEL << 1);
- out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ out.skipBytes(Byte.BYTES);
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.IPV6_ND_SLL << 1);
- out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ out.skipBytes(Byte.BYTES);
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.IPV6_ND_TARGET << 1);
- out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ out.skipBytes(Byte.BYTES);
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.IPV6_ND_TLL << 1);
- out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ out.skipBytes(Byte.BYTES);
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.IPV6_SRC << 1);
- out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ out.skipBytes(Byte.BYTES);
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.METADATA << 1);
- out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ out.skipBytes(Byte.BYTES);
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.MPLS_BOS << 1);
- out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ out.skipBytes(Byte.BYTES);
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.MPLS_LABEL << 1);
- out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ out.skipBytes(Byte.BYTES);
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.MPLS_TC << 1);
- out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ out.skipBytes(Byte.BYTES);
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.PBB_ISID << 1);
- out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ out.skipBytes(Byte.BYTES);
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.SCTP_DST << 1);
- out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ out.skipBytes(Byte.BYTES);
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.SCTP_SRC << 1);
- out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ out.skipBytes(Byte.BYTES);
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.TCP_DST << 1);
- out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ out.skipBytes(Byte.BYTES);
assertEquals(out.readUnsignedShort(), OxmMatchConstants.EXPERIMENTER_CLASS);
assertEquals(out.readUnsignedByte(), EncodeConstants.ONFOXM_ET_TCP_FLAGS << 1);
- out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ out.skipBytes(Byte.BYTES);
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte() >>> 1, OxmMatchConstants.TCP_SRC);
- out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ out.skipBytes(Byte.BYTES);
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.TUNNEL_ID << 1);
- out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ out.skipBytes(Byte.BYTES);
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.UDP_DST << 1);
- out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ out.skipBytes(Byte.BYTES);
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.UDP_SRC << 1);
- out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ out.skipBytes(Byte.BYTES);
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.VLAN_PCP << 1);
- out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ out.skipBytes(Byte.BYTES);
assertEquals(out.readUnsignedShort(), OxmMatchConstants.OPENFLOW_BASIC_CLASS);
assertEquals(out.readUnsignedByte(), OxmMatchConstants.VLAN_VID << 1);
- out.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES);
+ out.skipBytes(Byte.BYTES);
});
}
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowplugin.api.OFConstants;
import org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.action.data.ActionConvertorData;
final TransmitPacketInput transmitPacketInput = transmitPacketInputBuilder.build();
Short version = (short) 0x04;
- byte[] datapathIdByte = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
+ byte[] datapathIdByte = new byte[Long.BYTES];
for (int i = 0; i < datapathIdByte.length; i++) {
datapathIdByte[i] = 1;
}