package org.opendaylight.openflowplugin.impl.protocol.deserialization;
+import com.google.common.annotations.VisibleForTesting;
import java.util.function.Consumer;
import java.util.function.Function;
-
import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerExtensionProvider;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowplugin.impl.protocol.deserialization.action.SetQueueActionDeserializer;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
-import com.google.common.annotations.VisibleForTesting;
-
class ActionDeserializerInjector {
/**
- * Injects action deserializers into provided {@link org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerExtensionProvider}
+ * Injects action deserializers into provided
+ * {@link org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerExtensionProvider}.
+ *
* @param provider OpenflowJava deserializer extension provider
*/
static void injectDeserializers(final DeserializerExtensionProvider provider) {
}
/**
- * Create injector that will inject new deserializers into #{@link org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerExtensionProvider}
+ * Create injector that will inject new deserializers into
+ * #{@link org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerExtensionProvider}.
+ *
* @param provider OpenflowJava deserializer extension provider
- * @param version Openflow version
+ * @param version Openflow version
* @return injector
*/
@VisibleForTesting
import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerExtensionProvider;
/**
- * Util class for injecting new deserializers into OpenflowJava
+ * Util class for injecting new deserializers into OpenflowJava.
*/
public class DeserializerInjector {
/**
- * Injects deserializers into provided {@link org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerExtensionProvider}
+ * Injects deserializers into provided.
+ * {@link org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerExtensionProvider}
+ *
* @param provider OpenflowJava deserializer extension provider
*/
public static void injectDeserializers(final DeserializerExtensionProvider provider) {
}
/**
- * Reverts original deserializers in provided {@link org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerExtensionProvider}
+ * Reverts original deserializers in provided.
+ * {@link org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerExtensionProvider}
+ *
* @param provider OpenflowJava deserializer extension provider
*/
public static void revertDeserializers(final DeserializerExtensionProvider provider) {
package org.opendaylight.openflowplugin.impl.protocol.deserialization;
+import com.google.common.annotations.VisibleForTesting;
import java.util.Objects;
import java.util.function.Consumer;
import java.util.function.Function;
-
import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerExtensionProvider;
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.openflowplugin.api.openflow.protocol.deserialization.MessageCodeExperimenterKey;
import org.opendaylight.openflowplugin.extension.api.path.ActionPath;
-import org.opendaylight.openflowplugin.impl.protocol.deserialization.key.MessageCodeActionExperimenterKey;
import org.opendaylight.openflowplugin.impl.protocol.deserialization.instruction.ApplyActionsInstructionDeserializer;
import org.opendaylight.openflowplugin.impl.protocol.deserialization.instruction.ClearActionsInstructionDeserializer;
import org.opendaylight.openflowplugin.impl.protocol.deserialization.instruction.GoToTableInstructionDeserializer;
import org.opendaylight.openflowplugin.impl.protocol.deserialization.instruction.MeterInstructionDeserializer;
import org.opendaylight.openflowplugin.impl.protocol.deserialization.instruction.WriteActionsInstructionDeserializer;
import org.opendaylight.openflowplugin.impl.protocol.deserialization.instruction.WriteMetadataInstructionDeserializer;
+import org.opendaylight.openflowplugin.impl.protocol.deserialization.key.MessageCodeActionExperimenterKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction;
-import com.google.common.annotations.VisibleForTesting;
-
class InstructionDeserializerInjector {
/**
- * Injects instruction deserializers into provided {@link org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerExtensionProvider}
+ * Injects instruction deserializers into provided
+ * {@link org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerExtensionProvider}.
+ *
* @param provider OpenflowJava deserializer extension provider
*/
static void injectDeserializers(final DeserializerExtensionProvider provider) {
createInjector(provider, EncodeConstants.OF13_VERSION_ID);
injector.apply(InstructionConstants.GOTO_TABLE_TYPE).apply(null).accept(new GoToTableInstructionDeserializer());
- injector.apply(InstructionConstants.WRITE_METADATA_TYPE).apply(null).accept(new WriteMetadataInstructionDeserializer());
- injector.apply(InstructionConstants.CLEAR_ACTIONS_TYPE).apply(null).accept(new ClearActionsInstructionDeserializer());
+ injector.apply(InstructionConstants.WRITE_METADATA_TYPE)
+ .apply(null).accept(new WriteMetadataInstructionDeserializer());
+ injector.apply(InstructionConstants.CLEAR_ACTIONS_TYPE)
+ .apply(null).accept(new ClearActionsInstructionDeserializer());
injector.apply(InstructionConstants.METER_TYPE).apply(null).accept(new MeterInstructionDeserializer());
for (ActionPath path : ActionPath.values()) {
- injector.apply(InstructionConstants.WRITE_ACTIONS_TYPE).apply(path).accept(new WriteActionsInstructionDeserializer(path));
- injector.apply(InstructionConstants.APPLY_ACTIONS_TYPE).apply(path).accept(new ApplyActionsInstructionDeserializer(path));
+ injector.apply(InstructionConstants.WRITE_ACTIONS_TYPE).apply(path).accept(new
+ WriteActionsInstructionDeserializer(path));
+ injector.apply(InstructionConstants.APPLY_ACTIONS_TYPE).apply(path).accept(new
+ ApplyActionsInstructionDeserializer(path));
}
}
/**
- * Create injector that will inject new deserializers into #{@link org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerExtensionProvider}
+ * Create injector that will inject new deserializers into
+ * #{@link org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerExtensionProvider}.
+ *
* @param provider OpenflowJava deserializer extension provider
- * @param version Openflow version
+ * @param version Openflow version
* @return injector
*/
@VisibleForTesting
final short version) {
return code -> actionPath -> deserializer -> {
provider.registerDeserializer((Objects.nonNull(actionPath)
- ? new MessageCodeActionExperimenterKey(version, code, Instruction.class, actionPath, null)
- : new MessageCodeExperimenterKey(version, code, Instruction.class, null)),
+ ? new MessageCodeActionExperimenterKey(version, code, Instruction.class, actionPath, null)
+ : new MessageCodeExperimenterKey(version, code, Instruction.class, null)),
deserializer);
};
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match;
/**
- * Util class for injecting new match entry deserializers into OpenflowJava
+ * Util class for injecting new match entry deserializers into OpenflowJava.
*/
public class MatchDeserializerInjector {
/**
- * Injects deserializers into provided {@link org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerExtensionProvider}
+ * Injects deserializers into provided
+ * {@link org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerExtensionProvider}.
+ *
* @param provider OpenflowJava deserializer extension provider
*/
static void injectDeserializers(final DeserializerExtensionProvider provider) {
final MatchDeserializer deserializer = new MatchDeserializer(path);
provider.registerDeserializer(
new MessageCodeMatchKey(
- EncodeConstants.OF13_VERSION_ID,
- EncodeConstants.EMPTY_LENGTH,
- Match.class,
- path),
+ EncodeConstants.OF13_VERSION_ID,
+ EncodeConstants.EMPTY_LENGTH,
+ Match.class,
+ path),
deserializer);
// Inject new match entry serializers here using injector created by createInjector method
final Function<Integer, Function<Long, Function<Integer, Consumer<MatchEntryDeserializer>>>> injector =
- createInjector(deserializer, EncodeConstants.OF13_VERSION_ID);
-
+ createInjector(deserializer, EncodeConstants.OF13_VERSION_ID);
// Wrapped injector that uses OPENFLOW_BASIC_CLASS
final Function<Integer, Consumer<MatchEntryDeserializer>> basicInjector =
- injector.apply(OxmMatchConstants.OPENFLOW_BASIC_CLASS).apply(null);
+ injector.apply(OxmMatchConstants.OPENFLOW_BASIC_CLASS).apply(null);
// Wrapped injector that uses EXPERIMENTER_CLASS
final Function<Long, Function<Integer, Consumer<MatchEntryDeserializer>>> experInjector =
- injector.apply(OxmMatchConstants.EXPERIMENTER_CLASS);
+ injector.apply(OxmMatchConstants.EXPERIMENTER_CLASS);
basicInjector.apply(OxmMatchConstants.ARP_OP).accept(new ArpOpEntryDeserializer());
basicInjector.apply(OxmMatchConstants.ARP_SHA).accept(new ArpSourceHardwareAddressEntryDeserializer());
basicInjector.apply(OxmMatchConstants.MPLS_TC).accept(new MplsTcEntryDeserializer());
basicInjector.apply(OxmMatchConstants.PBB_ISID).accept(new PbbEntryDeserializer());
basicInjector.apply(OxmMatchConstants.TUNNEL_ID).accept(new TunnelIdEntryDeserializer());
- experInjector.apply(EncodeConstants.ONF_EXPERIMENTER_ID).apply(EncodeConstants.ONFOXM_ET_TCP_FLAGS).accept(new TcpFlagsEntryDeserializer());
+ experInjector.apply(EncodeConstants.ONF_EXPERIMENTER_ID).apply(EncodeConstants.ONFOXM_ET_TCP_FLAGS)
+ .accept(new TcpFlagsEntryDeserializer());
}
}
/**
- * Create injector that will inject new serializers into {@link org.opendaylight.openflowplugin.api.openflow.protocol.deserialization.MatchEntryDeserializerRegistry}
+ * Create injector that will inject new serializers into
+ * {@link org.opendaylight.openflowplugin.api.openflow.protocol.deserialization.MatchEntryDeserializerRegistry}.
+ *
* @param registry Match entry deserializer registry
- * @param version Openflow version
+ * @param version Openflow version
* @return injector
*/
@VisibleForTesting
static Function<Integer, Function<Long, Function<Integer, Consumer<MatchEntryDeserializer>>>> createInjector(
final MatchEntryDeserializerRegistry registry,
- final short version
- ) {
+ final short version) {
return oxmClass -> expId -> oxmField -> deserializer -> {
final MatchEntryDeserializerKey key = new MatchEntryDeserializerKey(version, oxmClass, oxmField);
key.setExperimenterId(expId);
class MessageDeserializerInjector {
/**
- * Injects message deserializers into provided {@link org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerExtensionProvider}
+ * Injects message deserializers into provided.
+ * {@link org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerExtensionProvider}
+ *
* @param provider OpenflowJava deserializer extension provider
*/
static void injectDeserializers(final DeserializerExtensionProvider provider) {
// Inject new message deserializers here using injector created by createInjector method
- final Function<Integer, Function<Class<? extends OfHeader>, Consumer<OFDeserializer<? extends OfHeader>>>> injector =
- createInjector(provider, EncodeConstants.OF13_VERSION_ID);
+ final Function<Integer, Function<Class<? extends OfHeader>, Consumer<OFDeserializer<? extends OfHeader>>>>
+ injector = createInjector(provider, EncodeConstants.OF13_VERSION_ID);
injector.apply(10).apply(org.opendaylight.yang.gen.v1.urn.opendaylight.packet.service.rev130709
.PacketInMessage.class).accept(new PacketInMessageDeserializer());
}
/**
- * Reverts original message deserializers in provided {@link org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerExtensionProvider}
+ * Reverts original message deserializers in provided.
+ * {@link org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerExtensionProvider}
+ *
* @param provider OpenflowJava deserializer extension provider
*/
static void revertDeserializers(final DeserializerExtensionProvider provider) {
provider.unregisterDeserializerMapping(new TypeToClassKey(EncodeConstants.OF13_VERSION_ID, 10));
- provider.registerDeserializerMapping(new TypeToClassKey(EncodeConstants.OF13_VERSION_ID, 10), PacketInMessage.class);
+ provider.registerDeserializerMapping(new TypeToClassKey(EncodeConstants.OF13_VERSION_ID, 10),
+ PacketInMessage.class);
provider.unregisterDeserializerMapping(new TypeToClassKey(EncodeConstants.OF13_VERSION_ID, 19));
- provider.registerDeserializerMapping(new TypeToClassKey(EncodeConstants.OF13_VERSION_ID, 19), MultipartReplyMessage.class);
+ provider.registerDeserializerMapping(new TypeToClassKey(EncodeConstants.OF13_VERSION_ID, 19),
+ MultipartReplyMessage.class);
}
/**
- * Create injector that will inject new deserializers into #{@link org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerExtensionProvider}
+ * Create injector that will inject new deserializers into.
+ * #{@link org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerExtensionProvider}
+ *
* @param provider OpenflowJava deserializer extension provider
- * @param version Openflow version
+ * @param version Openflow version
* @return injector
*/
@VisibleForTesting
- static Function<Integer, Function<Class<? extends OfHeader>, Consumer<OFDeserializer<? extends OfHeader>>>> createInjector(
+ static Function<Integer, Function<Class<? extends OfHeader>, Consumer<OFDeserializer<? extends OfHeader>>>>
+ createInjector(
final DeserializerExtensionProvider provider,
final short version) {
return code -> retType -> deserializer -> {
@VisibleForTesting
static void injectLegacyDeserializers(final DeserializerExtensionProvider provider) {
- final Function<Integer, Function<Class<? extends OfHeader>, Consumer<OFDeserializer<? extends OfHeader>>>> injector =
- createInjector(provider, EncodeConstants.OF13_VERSION_ID);
+ final Function<Integer, Function<Class<? extends OfHeader>, Consumer<OFDeserializer<? extends OfHeader>>>>
+ injector = createInjector(provider, EncodeConstants.OF13_VERSION_ID);
- injector.apply(14).apply(FlowMessage.class).accept(new FlowMessageDeserializer());
- injector.apply(15).apply(GroupMessage.class).accept(new GroupMessageDeserializer());
- injector.apply(29).apply(MeterMessage.class).accept(new MeterMessageDeserializer());
- injector.apply(16).apply(PortMessage.class).accept(new PortMessageDeserializer());
+ injector.apply(14).apply(FlowMessage.class).accept(new FlowMessageDeserializer());
+ injector.apply(15).apply(GroupMessage.class).accept(new GroupMessageDeserializer());
+ injector.apply(29).apply(MeterMessage.class).accept(new MeterMessageDeserializer());
+ injector.apply(16).apply(PortMessage.class).accept(new PortMessageDeserializer());
}
@VisibleForTesting
static void revertLegacyDeserializers(final DeserializerExtensionProvider provider) {
provider.unregisterDeserializerMapping(new TypeToClassKey(EncodeConstants.OF13_VERSION_ID, 14));
- provider.registerDeserializerMapping(new TypeToClassKey(EncodeConstants.OF13_VERSION_ID, 14), FlowModInput.class);
+ provider.registerDeserializerMapping(new TypeToClassKey(EncodeConstants.OF13_VERSION_ID, 14),
+ FlowModInput.class);
provider.unregisterDeserializerMapping(new TypeToClassKey(EncodeConstants.OF13_VERSION_ID, 15));
- provider.registerDeserializerMapping(new TypeToClassKey(EncodeConstants.OF13_VERSION_ID, 15), GroupModInput.class);
+ provider.registerDeserializerMapping(new TypeToClassKey(EncodeConstants.OF13_VERSION_ID, 15),
+ GroupModInput.class);
provider.unregisterDeserializerMapping(new TypeToClassKey(EncodeConstants.OF13_VERSION_ID, 29));
- provider.registerDeserializerMapping(new TypeToClassKey(EncodeConstants.OF13_VERSION_ID, 29), MeterModInput.class);
+ provider.registerDeserializerMapping(new TypeToClassKey(EncodeConstants.OF13_VERSION_ID, 29),
+ MeterModInput.class);
provider.unregisterDeserializerMapping(new TypeToClassKey(EncodeConstants.OF13_VERSION_ID, 16));
- provider.registerDeserializerMapping(new TypeToClassKey(EncodeConstants.OF13_VERSION_ID, 16), PortModInput.class);
+ provider.registerDeserializerMapping(new TypeToClassKey(EncodeConstants.OF13_VERSION_ID, 16),
+ PortModInput.class);
provider.unregisterDeserializerMapping(new TypeToClassKey(EncodeConstants.OF13_VERSION_ID, 19));
}
class MultipartDeserializerInjector {
/**
- * Injects message deserializers into provided {@link org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerExtensionProvider}
+ * Injects message deserializers into provided
+ * {@link org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerExtensionProvider}.
+ *
* @param provider OpenflowJava deserializer extension provider
*/
static void injectDeserializers(final DeserializerExtensionProvider provider) {
createInjector(provider, version);
injector.apply(MultipartType.OFPMPDESC.getIntValue()).accept(new MultipartReplyDescDeserializer());
injector.apply(MultipartType.OFPMPFLOW.getIntValue()).accept(new MultipartReplyFlowStatsDeserializer());
- injector.apply(MultipartType.OFPMPAGGREGATE.getIntValue()).accept(new MultipartReplyFlowAggregateStatsDeserializer());
+ injector.apply(MultipartType.OFPMPAGGREGATE.getIntValue())
+ .accept(new MultipartReplyFlowAggregateStatsDeserializer());
injector.apply(MultipartType.OFPMPTABLE.getIntValue()).accept(new MultipartReplyFlowTableStatsDeserializer());
injector.apply(MultipartType.OFPMPPORTSTATS.getIntValue()).accept(new MultipartReplyPortStatsDeserializer());
injector.apply(MultipartType.OFPMPQUEUE.getIntValue()).accept(new MultipartReplyQueueStatsDeserializer());
injector.apply(MultipartType.OFPMPGROUP.getIntValue()).accept(new MultipartReplyGroupStatsDeserializer());
injector.apply(MultipartType.OFPMPGROUPDESC.getIntValue()).accept(new MultipartReplyGroupDescDeserializer());
- injector.apply(MultipartType.OFPMPGROUPFEATURES.getIntValue()).accept(new MultipartReplyGroupFeaturesDeserializer());
+ injector.apply(MultipartType.OFPMPGROUPFEATURES.getIntValue())
+ .accept(new MultipartReplyGroupFeaturesDeserializer());
injector.apply(MultipartType.OFPMPMETER.getIntValue()).accept(new MultipartReplyMeterStatsDeserializer());
- injector.apply(MultipartType.OFPMPMETERCONFIG.getIntValue()).accept(new MultipartReplyMeterConfigDeserializer());
- injector.apply(MultipartType.OFPMPMETERFEATURES.getIntValue()).accept(new MultipartReplyMeterFeaturesDeserializer());
- injector.apply(MultipartType.OFPMPTABLEFEATURES.getIntValue()).accept(new MultipartReplyTableFeaturesDeserializer());
+ injector.apply(MultipartType.OFPMPMETERCONFIG.getIntValue())
+ .accept(new MultipartReplyMeterConfigDeserializer());
+ injector.apply(MultipartType.OFPMPMETERFEATURES.getIntValue())
+ .accept(new MultipartReplyMeterFeaturesDeserializer());
+ injector.apply(MultipartType.OFPMPTABLEFEATURES.getIntValue())
+ .accept(new MultipartReplyTableFeaturesDeserializer());
injector.apply(MultipartType.OFPMPPORTDESC.getIntValue()).accept(new MultipartReplyPortDescDeserializer());
- injector.apply(MultipartType.OFPMPEXPERIMENTER.getIntValue()).accept(new MultipartReplyExperimenterDeserializer());
+ injector.apply(MultipartType.OFPMPEXPERIMENTER.getIntValue())
+ .accept(new MultipartReplyExperimenterDeserializer());
}
/**
- * Create injector that will inject new deserializers into #{@link org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerExtensionProvider}
+ * Create injector that will inject new deserializers into
+ * #{@link org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerExtensionProvider}.
+ *
* @param provider OpenflowJava deserializer extension provider
- * @param version Openflow version
+ * @param version Openflow version
* @return injector
*/
@VisibleForTesting
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;
-import io.netty.buffer.ByteBuf;
-
public abstract class AbstractActionDeserializer implements OFDeserializer<Action>, HeaderDeserializer<Action> {
/**
- * Skip first few bytes of action message because they are irrelevant
+ * Skip first few bytes of action message because they are irrelevant.
+ *
* @param message Openflow buffered message
**/
protected static void processHeader(ByteBuf message) {
*/
package org.opendaylight.openflowplugin.impl.protocol.deserialization.action;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlInCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.copy.ttl.in._case.CopyTtlInBuilder;
+import io.netty.buffer.ByteBuf;
import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
-
-import io.netty.buffer.ByteBuf;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlInCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.copy.ttl.in._case.CopyTtlInBuilder;
public class CopyTtlInActionDeserializer extends AbstractActionDeserializer {
message.skipBytes(ActionConstants.PADDING_IN_ACTION_HEADER);
return new CopyTtlInCaseBuilder()
- .setCopyTtlIn(new CopyTtlInBuilder().build())
- .build();
+ .setCopyTtlIn(new CopyTtlInBuilder().build())
+ .build();
}
@Override
*/
package org.opendaylight.openflowplugin.impl.protocol.deserialization.action;
+import io.netty.buffer.ByteBuf;
import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.CopyTtlOutCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.copy.ttl.out._case.CopyTtlOutBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
-
-import io.netty.buffer.ByteBuf;
public class CopyTtlOutActionDeserializer extends AbstractActionDeserializer {
message.skipBytes(ActionConstants.PADDING_IN_ACTION_HEADER);
return new CopyTtlOutCaseBuilder()
- .setCopyTtlOut(new CopyTtlOutBuilder().build())
- .build();
+ .setCopyTtlOut(new CopyTtlOutBuilder().build())
+ .build();
}
*/
package org.opendaylight.openflowplugin.impl.protocol.deserialization.action;
+import io.netty.buffer.ByteBuf;
import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DecMplsTtlCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.dec.mpls.ttl._case.DecMplsTtlBuilder;
-import io.netty.buffer.ByteBuf;
-
public class DecMplsTtlActionDeserializer extends AbstractActionDeserializer {
@Override
message.skipBytes(ActionConstants.PADDING_IN_ACTION_HEADER);
return new DecMplsTtlCaseBuilder()
- .setDecMplsTtl(new DecMplsTtlBuilder().build())
- .build();
+ .setDecMplsTtl(new DecMplsTtlBuilder().build())
+ .build();
}
@Override
*/
package org.opendaylight.openflowplugin.impl.protocol.deserialization.action;
+import io.netty.buffer.ByteBuf;
import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.DecNwTtlCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.dec.nw.ttl._case.DecNwTtlBuilder;
-import io.netty.buffer.ByteBuf;
-
public class DecNwTtlActionDeserializer extends AbstractActionDeserializer {
@Override
message.skipBytes(ActionConstants.PADDING_IN_ACTION_HEADER);
return new DecNwTtlCaseBuilder()
- .setDecNwTtl(new DecNwTtlBuilder().build())
- .build();
+ .setDecNwTtl(new DecNwTtlBuilder().build())
+ .build();
}
@Override
*/
package org.opendaylight.openflowplugin.impl.protocol.deserialization.action;
+import io.netty.buffer.ByteBuf;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.GroupActionCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.group.action._case.GroupActionBuilder;
-import io.netty.buffer.ByteBuf;
-
public class GroupActionDeserializer extends AbstractActionDeserializer {
@Override
processHeader(message);
return new GroupActionCaseBuilder()
- .setGroupAction(new GroupActionBuilder()
- .setGroupId(message.readUnsignedInt())
- .build())
- .build();
+ .setGroupAction(new GroupActionBuilder()
+ .setGroupId(message.readUnsignedInt())
+ .build())
+ .build();
}
@Override
processHeader(message);
final Uri portUri = OpenflowPortsUtil
- .getProtocolAgnosticPortUri(EncodeConstants.OF13_VERSION_ID, message.readUnsignedInt());
+ .getProtocolAgnosticPortUri(EncodeConstants.OF13_VERSION_ID, message.readUnsignedInt());
final int maxLength = message.readUnsignedShort();
message.skipBytes(ActionConstants.OUTPUT_PADDING);
return new OutputActionCaseBuilder()
- .setOutputAction(new OutputActionBuilder()
- .setOutputNodeConnector(portUri)
- .setMaxLength(maxLength)
- .build())
- .build();
+ .setOutputAction(new OutputActionBuilder()
+ .setOutputNodeConnector(portUri)
+ .setMaxLength(maxLength)
+ .build())
+ .build();
}
@Override
*/
package org.opendaylight.openflowplugin.impl.protocol.deserialization.action;
+import io.netty.buffer.ByteBuf;
import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopMplsActionCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.mpls.action._case.PopMplsActionBuilder;
-import io.netty.buffer.ByteBuf;
-
public class PopMplsActionDeserializer extends AbstractActionDeserializer {
@Override
message.skipBytes(ActionConstants.ETHERTYPE_ACTION_PADDING);
return new PopMplsActionCaseBuilder()
- .setPopMplsAction(new PopMplsActionBuilder()
- .setEthernetType(ethType)
- .build())
- .build();
+ .setPopMplsAction(new PopMplsActionBuilder()
+ .setEthernetType(ethType)
+ .build())
+ .build();
}
@Override
*/
package org.opendaylight.openflowplugin.impl.protocol.deserialization.action;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopPbbActionCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.pbb.action._case.PopPbbActionBuilder;
+import io.netty.buffer.ByteBuf;
import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
-
-import io.netty.buffer.ByteBuf;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopPbbActionCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.pbb.action._case.PopPbbActionBuilder;
public class PopPbbActionDeserializer extends AbstractActionDeserializer {
message.skipBytes(ActionConstants.PADDING_IN_ACTION_HEADER);
return new PopPbbActionCaseBuilder()
- .setPopPbbAction(new PopPbbActionBuilder().build())
- .build();
+ .setPopPbbAction(new PopPbbActionBuilder().build())
+ .build();
}
@Override
*/
package org.opendaylight.openflowplugin.impl.protocol.deserialization.action;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopVlanActionCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.vlan.action._case.PopVlanActionBuilder;
+import io.netty.buffer.ByteBuf;
import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
-
-import io.netty.buffer.ByteBuf;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PopVlanActionCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.vlan.action._case.PopVlanActionBuilder;
public class PopVlanActionDeserializer extends AbstractActionDeserializer {
message.skipBytes(ActionConstants.PADDING_IN_ACTION_HEADER);
return new PopVlanActionCaseBuilder()
- .setPopVlanAction(new PopVlanActionBuilder().build())
- .build();
+ .setPopVlanAction(new PopVlanActionBuilder().build())
+ .build();
}
@Override
*/
package org.opendaylight.openflowplugin.impl.protocol.deserialization.action;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushMplsActionCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.mpls.action._case.PushMplsActionBuilder;
+import io.netty.buffer.ByteBuf;
import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
-
-import io.netty.buffer.ByteBuf;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushMplsActionCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.mpls.action._case.PushMplsActionBuilder;
public class PushMplsActionDeserializer extends AbstractActionDeserializer {
message.skipBytes(ActionConstants.ETHERTYPE_ACTION_PADDING);
return new PushMplsActionCaseBuilder()
- .setPushMplsAction(new PushMplsActionBuilder()
- .setEthernetType(ethType)
- .build())
- .build();
+ .setPushMplsAction(new PushMplsActionBuilder()
+ .setEthernetType(ethType)
+ .build())
+ .build();
}
@Override
*/
package org.opendaylight.openflowplugin.impl.protocol.deserialization.action;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushPbbActionCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.pbb.action._case.PushPbbActionBuilder;
+import io.netty.buffer.ByteBuf;
import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
-
-import io.netty.buffer.ByteBuf;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushPbbActionCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.pbb.action._case.PushPbbActionBuilder;
public class PushPbbActionDeserializer extends AbstractActionDeserializer {
message.skipBytes(ActionConstants.ETHERTYPE_ACTION_PADDING);
return new PushPbbActionCaseBuilder()
- .setPushPbbAction(new PushPbbActionBuilder()
- .setEthernetType(ethType)
- .build())
- .build();
+ .setPushPbbAction(new PushPbbActionBuilder()
+ .setEthernetType(ethType)
+ .build())
+ .build();
}
@Override
*/
package org.opendaylight.openflowplugin.impl.protocol.deserialization.action;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushVlanActionCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.vlan.action._case.PushVlanActionBuilder;
+import io.netty.buffer.ByteBuf;
import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
-
-import io.netty.buffer.ByteBuf;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushVlanActionCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.push.vlan.action._case.PushVlanActionBuilder;
public class PushVlanActionDeserializer extends AbstractActionDeserializer {
message.skipBytes(ActionConstants.ETHERTYPE_ACTION_PADDING);
return new PushVlanActionCaseBuilder()
- .setPushVlanAction(new PushVlanActionBuilder()
- .setEthernetType(ethType)
- .build())
- .build();
+ .setPushVlanAction(new PushVlanActionBuilder()
+ .setEthernetType(ethType)
+ .build())
+ .build();
}
@Override
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match;
public class SetFieldActionDeserializer extends AbstractActionDeserializer
- implements DeserializerRegistryInjector {
+ implements DeserializerRegistryInjector {
private static final MessageCodeKey MATCH_KEY = new MessageCodeMatchKey(
EncodeConstants.OF13_VERSION_ID,
}
return new SetFieldCaseBuilder()
- .setSetField(MatchUtil.transformMatch(builder.build(), SetField.class))
- .build();
+ .setSetField(MatchUtil.transformMatch(builder.build(), SetField.class))
+ .build();
}
@Override
*/
package org.opendaylight.openflowplugin.impl.protocol.deserialization.action;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetMplsTtlActionCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.mpls.ttl.action._case.SetMplsTtlActionBuilder;
+import io.netty.buffer.ByteBuf;
import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
-
-import io.netty.buffer.ByteBuf;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetMplsTtlActionCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.mpls.ttl.action._case.SetMplsTtlActionBuilder;
public class SetMplsTtlActionDeserializer extends AbstractActionDeserializer {
message.skipBytes(ActionConstants.SET_MPLS_TTL_PADDING);
return new SetMplsTtlActionCaseBuilder()
- .setSetMplsTtlAction(new SetMplsTtlActionBuilder()
- .setMplsTtl(mplsTtl)
- .build())
- .build();
+ .setSetMplsTtlAction(new SetMplsTtlActionBuilder()
+ .setMplsTtl(mplsTtl)
+ .build())
+ .build();
}
@Override
*/
package org.opendaylight.openflowplugin.impl.protocol.deserialization.action;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwTtlActionCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.ttl.action._case.SetNwTtlActionBuilder;
+import io.netty.buffer.ByteBuf;
import org.opendaylight.openflowjava.protocol.impl.util.ActionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
-
-import io.netty.buffer.ByteBuf;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetNwTtlActionCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.nw.ttl.action._case.SetNwTtlActionBuilder;
public class SetNwTtlActionDeserializer extends AbstractActionDeserializer {
message.skipBytes(ActionConstants.SET_NW_TTL_PADDING);
return new SetNwTtlActionCaseBuilder()
- .setSetNwTtlAction(new SetNwTtlActionBuilder()
- .setNwTtl(nwTtl)
- .build())
- .build();
+ .setSetNwTtlAction(new SetNwTtlActionBuilder()
+ .setNwTtl(nwTtl)
+ .build())
+ .build();
}
@Override
*/
package org.opendaylight.openflowplugin.impl.protocol.deserialization.action;
+import io.netty.buffer.ByteBuf;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetQueueActionCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.queue.action._case.SetQueueActionBuilder;
-import io.netty.buffer.ByteBuf;
-
public class SetQueueActionDeserializer extends AbstractActionDeserializer {
@Override
final long queueId = message.readUnsignedInt();
return new SetQueueActionCaseBuilder()
- .setSetQueueAction(new SetQueueActionBuilder()
- .setQueueId(queueId)
- .build())
- .build();
+ .setSetQueueAction(new SetQueueActionBuilder()
+ .setQueueId(queueId)
+ .build())
+ .build();
}
@Override
package org.opendaylight.openflowplugin.impl.protocol.deserialization.instruction;
+import io.netty.buffer.ByteBuf;
import java.util.ArrayList;
import java.util.List;
-
import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistryInjector;
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;
import org.opendaylight.openflowplugin.extension.api.path.ActionPath;
import org.opendaylight.openflowplugin.impl.protocol.deserialization.util.ActionUtil;
-import org.opendaylight.openflowplugin.api.openflow.protocol.deserialization.MessageCodeExperimenterKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
-import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;
-import org.opendaylight.openflowplugin.api.openflow.protocol.deserialization.MessageCodeExperimenterKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionKey;
-import io.netty.buffer.ByteBuf;
-
public abstract class AbstractActionInstructionDeserializer extends AbstractInstructionDeserializer
- implements DeserializerRegistryInjector {
+ implements DeserializerRegistryInjector {
private DeserializerRegistry registry;
private final ActionPath actionPath;
/**
- * Create new instacte of action instruction deserializer
+ * Create new instacte of action instruction deserializer.
+ *
* @param actionPath action extension path
*/
public AbstractActionInstructionDeserializer(final ActionPath actionPath) {
}
/**
- * Skip first few bytes of instruction message because they are irrelevant and then return length
+ * Skip first few bytes of instruction message because they are irrelevant and then return length.
+ *
* @param message Openflow buffered message
* @return instruction length
**/
}
/**
- * Read list of actions from message
+ * Read list of actions from message.
+ *
* @param message Openflow buffered message
- * @param length instruction length
+ * @param length instruction length
* @return list of actions
**/
protected List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list
- .Action> readActions(ByteBuf message, int length) {
+ .Action> readActions(ByteBuf message, int length) {
final int instrLength = length - InstructionConstants.STANDARD_INSTRUCTION_LENGTH;
final List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list
- .Action> actions = new ArrayList<>();
+ .Action> actions = new ArrayList<>();
if (message.readableBytes() > 0) {
final int startIndex = message.readerIndex();
.setKey(new ActionKey(offset))
.setOrder(offset)
.setAction(ActionUtil
- .readAction(EncodeConstants.OF13_VERSION_ID, message, registry, actionPath))
+ .readAction(EncodeConstants.OF13_VERSION_ID, message, registry, actionPath))
.build());
offset++;
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;
-import io.netty.buffer.ByteBuf;
-
-public abstract class AbstractInstructionDeserializer implements OFDeserializer<Instruction>, HeaderDeserializer<Instruction> {
+public abstract class AbstractInstructionDeserializer implements OFDeserializer<Instruction>,
+ HeaderDeserializer<Instruction> {
/**
- * Skip first few bytes of instruction message because they are irrelevant
+ * Skip first few bytes of instruction message because they are irrelevant.
+ *
* @param message Openflow buffered message
**/
protected static void processHeader(ByteBuf message) {
package org.opendaylight.openflowplugin.impl.protocol.deserialization.instruction;
+import io.netty.buffer.ByteBuf;
import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;
import org.opendaylight.openflowplugin.extension.api.path.ActionPath;
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.ApplyActionsCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.apply.actions._case.ApplyActionsBuilder;
-import io.netty.buffer.ByteBuf;
-
public class ApplyActionsInstructionDeserializer extends AbstractActionInstructionDeserializer {
public ApplyActionsInstructionDeserializer(ActionPath path) {
message.skipBytes(InstructionConstants.PADDING_IN_ACTIONS_INSTRUCTION);
return new ApplyActionsCaseBuilder()
- .setApplyActions(new ApplyActionsBuilder()
- .setAction(readActions(message, length))
- .build())
- .build();
+ .setApplyActions(new ApplyActionsBuilder()
+ .setAction(readActions(message, length))
+ .build())
+ .build();
}
@Override
package org.opendaylight.openflowplugin.impl.protocol.deserialization.instruction;
+import io.netty.buffer.ByteBuf;
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.ClearActionsCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.clear.actions._case.ClearActionsBuilder;
-import io.netty.buffer.ByteBuf;
-
public class ClearActionsInstructionDeserializer extends AbstractInstructionDeserializer {
@Override
message.skipBytes(InstructionConstants.PADDING_IN_ACTIONS_INSTRUCTION);
return new ClearActionsCaseBuilder()
- .setClearActions(new ClearActionsBuilder().build())
- .build();
+ .setClearActions(new ClearActionsBuilder().build())
+ .build();
}
@Override
package org.opendaylight.openflowplugin.impl.protocol.deserialization.instruction;
+import io.netty.buffer.ByteBuf;
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.GoToTableCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.go.to.table._case.GoToTableBuilder;
-import io.netty.buffer.ByteBuf;
-
public class GoToTableInstructionDeserializer extends AbstractInstructionDeserializer {
@Override
message.skipBytes(InstructionConstants.PADDING_IN_GOTO_TABLE);
return new GoToTableCaseBuilder()
- .setGoToTable(new GoToTableBuilder()
- .setTableId(tableId)
- .build())
- .build();
+ .setGoToTable(new GoToTableBuilder()
+ .setTableId(tableId)
+ .build())
+ .build();
}
@Override
package org.opendaylight.openflowplugin.impl.protocol.deserialization.instruction;
+import io.netty.buffer.ByteBuf;
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.MeterCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.meter._case.MeterBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId;
-import io.netty.buffer.ByteBuf;
-
public class MeterInstructionDeserializer extends AbstractInstructionDeserializer {
@Override
package org.opendaylight.openflowplugin.impl.protocol.deserialization.instruction;
+import io.netty.buffer.ByteBuf;
import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;
import org.opendaylight.openflowplugin.extension.api.path.ActionPath;
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.WriteActionsCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.write.actions._case.WriteActionsBuilder;
-import io.netty.buffer.ByteBuf;
-
public class WriteActionsInstructionDeserializer extends AbstractActionInstructionDeserializer {
public WriteActionsInstructionDeserializer(ActionPath path) {
message.skipBytes(InstructionConstants.PADDING_IN_ACTIONS_INSTRUCTION);
return new WriteActionsCaseBuilder()
- .setWriteActions(new WriteActionsBuilder()
- .setAction(readActions(message, length))
- .build())
- .build();
+ .setWriteActions(new WriteActionsBuilder()
+ .setAction(readActions(message, length))
+ .build())
+ .build();
}
@Override
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;
-import io.netty.buffer.ByteBuf;
-
public class WriteMetadataInstructionDeserializer extends AbstractInstructionDeserializer {
@Override
message.readBytes(metaMask);
return new WriteMetadataCaseBuilder()
- .setWriteMetadata(new WriteMetadataBuilder()
- .setMetadata(new BigInteger(1, meta))
- .setMetadataMask(new BigInteger(1, metaMask))
- .build())
- .build();
+ .setWriteMetadata(new WriteMetadataBuilder()
+ .setMetadata(new BigInteger(1, meta))
+ .setMetadataMask(new BigInteger(1, metaMask))
+ .build())
+ .build();
}
@Override
package org.opendaylight.openflowplugin.impl.protocol.deserialization.key;
import java.util.Objects;
-
import org.opendaylight.openflowplugin.api.openflow.protocol.deserialization.MessageCodeExperimenterKey;
import org.opendaylight.openflowplugin.extension.api.path.ActionPath;
private ActionPath actionPath;
/**
- * Constructor
- * @param version wire protocol version
- * @param value used as distinguisher (read from binary data / buffer)
- * @param clazz class of object that is going to be deserialized
+ * Constructor.
+ *
+ * @param version wire protocol version
+ * @param value used as distinguisher (read from binary data / buffer)
+ * @param clazz class of object that is going to be deserialized
* @param experimenterId experimenter id
*/
- public MessageCodeActionExperimenterKey(short version, int value, Class<?> clazz, ActionPath actionPath, Long experimenterId) {
+ public MessageCodeActionExperimenterKey(short version, int value, Class<?> clazz, ActionPath actionPath, Long
+ experimenterId) {
super(version, value, clazz, experimenterId);
this.actionPath = actionPath;
}
package org.opendaylight.openflowplugin.impl.protocol.deserialization.key;
import java.util.Objects;
-
import org.opendaylight.openflowjava.protocol.api.keys.MessageCodeKey;
import org.opendaylight.openflowplugin.extension.api.path.MatchPath;
private MatchPath matchPath;
/**
- * Constructor
- * @param version wire protocol version
- * @param value used as distinguisher (read from binary data / buffer)
- * @param clazz class of object that is going to be deserialized
+ * Constructor.
+ *
+ * @param version wire protocol version
+ * @param value used as distinguisher (read from binary data / buffer)
+ * @param clazz class of object that is going to be deserialized
* @param matchPath match extension path
*/
public MessageCodeMatchKey(short version, int value, Class<?> clazz, MatchPath matchPath) {
public abstract class AbstractMatchEntryDeserializer implements MatchEntryDeserializer {
/**
- * Processes match entry header and returns if it have mask, or not
+ * Processes match entry header and returns if it have mask, or not.
* @param in input buffer
* @return true if match entry has mask, false otherwise
*/
}
/**
- * Read Ipv4Prefix from message
+ * Read Ipv4Prefix from message.
* @param message buffered message
* @param hasMask determines if prefix has mask or not
* @return IPv4 prefix
}
/**
- * Throw error on malformed match builder input
+ * Throw error on malformed match builder input.
* @param builder match builder
* @param propertyName name of property that already containsData
*/
}
/**
- * Throw error on malformed match builder input
+ * Throw error on malformed match builder input.
* @param builder match builder
* @param propertyName name of property that already containsData
*/
final long port = message.readUnsignedInt();
if (Objects.isNull(builder.getInPhyPort())) {
- builder.setInPhyPort(new NodeConnectorId(OpenflowPortsUtil.getProtocolAgnosticPortUri(EncodeConstants.OF13_VERSION_ID, port)));
+ builder.setInPhyPort(new NodeConnectorId(OpenflowPortsUtil
+ .getProtocolAgnosticPortUri(EncodeConstants.OF13_VERSION_ID, port)));
} else {
throwErrorOnMalformed(builder, "inPhyPort");
}
final long port = message.readUnsignedInt();
if (Objects.isNull(builder.getInPort())) {
- builder.setInPort(new NodeConnectorId(OpenflowPortsUtil.getProtocolAgnosticPortUri(EncodeConstants.OF13_VERSION_ID, port)));
+ builder.setInPort(new NodeConnectorId(OpenflowPortsUtil.getProtocolAgnosticPortUri(EncodeConstants
+ .OF13_VERSION_ID, port)));
} else {
throwErrorOnMalformed(builder, "inPort");
}
package org.opendaylight.openflowplugin.impl.protocol.deserialization.match;
+import io.netty.buffer.ByteBuf;
import java.util.Objects;
-
import javax.annotation.Nullable;
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmDeserializerHelper;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchArbitraryBitMaskBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchBuilder;
-import io.netty.buffer.ByteBuf;
-
public class Ipv4DestinationEntryDeserializer extends AbstractMatchEntryDeserializer {
@Override
}
}
- private static void setPrefixMatch(final MatchBuilder builder, final Ipv4Address address, @Nullable final byte[] mask) {
+ private static void setPrefixMatch(final MatchBuilder builder, final Ipv4Address address, @Nullable final byte[]
+ mask) {
if (Objects.isNull(builder.getLayer3Match())) {
builder.setLayer3Match(new Ipv4MatchBuilder()
- .setIpv4Destination(IpConversionUtil.createPrefix(address, mask))
- .build());
+ .setIpv4Destination(IpConversionUtil.createPrefix(address, mask))
+ .build());
} else if (Ipv4Match.class.isInstance(builder.getLayer3Match())
- && Objects.isNull(Ipv4Match.class.cast(builder.getLayer3Match()).getIpv4Destination())) {
+ && Objects.isNull(Ipv4Match.class.cast(builder.getLayer3Match()).getIpv4Destination())) {
builder.setLayer3Match(new Ipv4MatchBuilder(Ipv4Match.class.cast(builder.getLayer3Match()))
- .setIpv4Destination(IpConversionUtil.createPrefix(address, mask))
- .build());
+ .setIpv4Destination(IpConversionUtil.createPrefix(address, mask))
+ .build());
} else {
throwErrorOnMalformed(builder, "layer3Match", "ipv4Destination");
}
}
private static void setArbitraryMatch(final MatchBuilder builder, final Ipv4Address address,
- final byte[] mask) {
+ final byte[] mask) {
if (Objects.isNull(builder.getLayer3Match())) {
builder.setLayer3Match(new Ipv4MatchArbitraryBitMaskBuilder()
.setIpv4DestinationAddressNoMask(address)
.setIpv4DestinationArbitraryBitmask(IpConversionUtil.createArbitraryBitMask(mask))
.build());
} else if (Ipv4MatchArbitraryBitMask.class.isInstance(builder.getLayer3Match())
- && Objects.isNull(Ipv4MatchArbitraryBitMask.class.cast(builder.getLayer3Match()).getIpv4DestinationAddressNoMask())) {
- builder.setLayer3Match(new Ipv4MatchArbitraryBitMaskBuilder(Ipv4MatchArbitraryBitMask.class.cast(builder.getLayer3Match()))
+ && Objects.isNull(Ipv4MatchArbitraryBitMask.class.cast(builder.getLayer3Match())
+ .getIpv4DestinationAddressNoMask())) {
+ builder.setLayer3Match(new Ipv4MatchArbitraryBitMaskBuilder(Ipv4MatchArbitraryBitMask.class.cast(builder
+ .getLayer3Match()))
.setIpv4DestinationAddressNoMask(address)
.setIpv4DestinationArbitraryBitmask(IpConversionUtil.createArbitraryBitMask(mask))
.build());
package org.opendaylight.openflowplugin.impl.protocol.deserialization.match;
+import io.netty.buffer.ByteBuf;
import java.util.Objects;
-
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmDeserializerHelper;
import org.opendaylight.openflowjava.util.ByteBufUtils;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchArbitraryBitMaskBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchBuilder;
-import io.netty.buffer.ByteBuf;
-
public class Ipv4SourceEntryDeserializer extends AbstractMatchEntryDeserializer {
@Override
private static void setPrefixMatch(final MatchBuilder builder, final Ipv4Address address, final byte[] mask) {
if (Objects.isNull(builder.getLayer3Match())) {
builder.setLayer3Match(new Ipv4MatchBuilder()
- .setIpv4Source(IpConversionUtil.createPrefix(address, mask))
- .build());
+ .setIpv4Source(IpConversionUtil.createPrefix(address, mask))
+ .build());
} else if (Ipv4Match.class.isInstance(builder.getLayer3Match())
- && Objects.isNull(Ipv4Match.class.cast(builder.getLayer3Match()).getIpv4Source())) {
+ && Objects.isNull(Ipv4Match.class.cast(builder.getLayer3Match()).getIpv4Source())) {
builder.setLayer3Match(new Ipv4MatchBuilder(Ipv4Match.class.cast(builder.getLayer3Match()))
- .setIpv4Source(IpConversionUtil.createPrefix(address, mask))
- .build());
+ .setIpv4Source(IpConversionUtil.createPrefix(address, mask))
+ .build());
} else {
throwErrorOnMalformed(builder, "layer3Match", "ipv4Source");
}
}
private static void setArbitraryMatch(final MatchBuilder builder, final Ipv4Address address,
- final byte[] mask) {
+ final byte[] mask) {
if (Objects.isNull(builder.getLayer3Match())) {
builder.setLayer3Match(new Ipv4MatchArbitraryBitMaskBuilder()
.setIpv4SourceAddressNoMask(address)
.setIpv4SourceArbitraryBitmask(IpConversionUtil.createArbitraryBitMask(mask))
.build());
} else if (Ipv4MatchArbitraryBitMask.class.isInstance(builder.getLayer3Match())
- && Objects.isNull(Ipv4MatchArbitraryBitMask.class.cast(builder.getLayer3Match()).getIpv4SourceAddressNoMask())) {
- builder.setLayer3Match(new Ipv4MatchArbitraryBitMaskBuilder(Ipv4MatchArbitraryBitMask.class.cast(builder.getLayer3Match()))
+ && Objects.isNull(Ipv4MatchArbitraryBitMask.class.cast(builder.getLayer3Match())
+ .getIpv4SourceAddressNoMask())) {
+ builder.setLayer3Match(new Ipv4MatchArbitraryBitMaskBuilder(Ipv4MatchArbitraryBitMask.class.cast(builder
+ .getLayer3Match()))
.setIpv4SourceAddressNoMask(address)
.setIpv4SourceArbitraryBitmask(IpConversionUtil.createArbitraryBitMask(mask))
.build());
package org.opendaylight.openflowplugin.impl.protocol.deserialization.match;
+import io.netty.buffer.ByteBuf;
import java.util.Objects;
-
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmDeserializerHelper;
import org.opendaylight.openflowjava.util.ByteBufUtils;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchArbitraryBitMaskBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder;
-import io.netty.buffer.ByteBuf;
-
public class Ipv6DestinationEntryDeserializer extends AbstractMatchEntryDeserializer {
@Override
final Ipv6Address address = ByteBufUtils.readIetfIpv6Address(message);
if (hasMask) {
- final byte[] mask = OxmDeserializerHelper.convertMask(message, EncodeConstants.SIZE_OF_IPV6_ADDRESS_IN_BYTES);
+ final byte[] mask = OxmDeserializerHelper.convertMask(message, EncodeConstants
+ .SIZE_OF_IPV6_ADDRESS_IN_BYTES);
if (IpConversionUtil.isIpv6ArbitraryBitMask(mask)) {
setArbitraryMatch(builder, address, mask);
private static void setPrefixMatch(final MatchBuilder builder, final Ipv6Address address, final byte[] mask) {
if (Objects.isNull(builder.getLayer3Match())) {
builder.setLayer3Match(new Ipv6MatchBuilder()
- .setIpv6Destination(IpConversionUtil.createPrefix(address, mask))
- .build());
+ .setIpv6Destination(IpConversionUtil.createPrefix(address, mask))
+ .build());
} else if (Ipv6Match.class.isInstance(builder.getLayer3Match())
- && Objects.isNull(Ipv6Match.class.cast(builder.getLayer3Match()).getIpv6Destination())) {
+ && Objects.isNull(Ipv6Match.class.cast(builder.getLayer3Match()).getIpv6Destination())) {
builder.setLayer3Match(new Ipv6MatchBuilder(Ipv6Match.class.cast(builder.getLayer3Match()))
- .setIpv6Destination(IpConversionUtil.createPrefix(address, mask))
- .build());
+ .setIpv6Destination(IpConversionUtil.createPrefix(address, mask))
+ .build());
} else {
throwErrorOnMalformed(builder, "layer3Match", "ipv6Destination");
}
}
private static void setArbitraryMatch(final MatchBuilder builder, final Ipv6Address address,
- final byte[] mask) {
+ final byte[] mask) {
if (Objects.isNull(builder.getLayer3Match())) {
builder.setLayer3Match(new Ipv6MatchArbitraryBitMaskBuilder()
.setIpv6DestinationAddressNoMask(address)
.setIpv6DestinationArbitraryBitmask(IpConversionUtil.createIpv6ArbitraryBitMask(mask))
.build());
} else if (Ipv6MatchArbitraryBitMask.class.isInstance(builder.getLayer3Match())
- && Objects.isNull(Ipv6MatchArbitraryBitMask.class.cast(builder.getLayer3Match()).getIpv6DestinationAddressNoMask())) {
+ && Objects.isNull(Ipv6MatchArbitraryBitMask.class.cast(builder.getLayer3Match())
+ .getIpv6DestinationAddressNoMask())) {
final Ipv6MatchArbitraryBitMask match = Ipv6MatchArbitraryBitMask.class.cast(builder.getLayer3Match());
builder.setLayer3Match(new Ipv6MatchArbitraryBitMaskBuilder(match)
.setIpv6DestinationAddressNoMask(address)
package org.opendaylight.openflowplugin.impl.protocol.deserialization.match;
+import io.netty.buffer.ByteBuf;
import java.util.Objects;
-
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.model.match.types.rev131026.match.layer._3.match.Ipv6Match;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder;
-import io.netty.buffer.ByteBuf;
-
public class Ipv6FlabelEntryDeserializer extends AbstractMatchEntryDeserializer {
@Override
package org.opendaylight.openflowplugin.impl.protocol.deserialization.match;
+import io.netty.buffer.ByteBuf;
import java.util.Objects;
-
import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmDeserializerHelper;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
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.Ipv6Match;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder;
-import io.netty.buffer.ByteBuf;
-
public class Ipv6NdSllEntryDeserializer extends AbstractMatchEntryDeserializer {
@Override
package org.opendaylight.openflowplugin.impl.protocol.deserialization.match;
+import io.netty.buffer.ByteBuf;
import java.util.Objects;
-
import org.opendaylight.openflowjava.util.ByteBufUtils;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
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.Ipv6Match;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder;
-import io.netty.buffer.ByteBuf;
-
public class Ipv6NdTargetEntryDeserializer extends AbstractMatchEntryDeserializer {
@Override
package org.opendaylight.openflowplugin.impl.protocol.deserialization.match;
+import io.netty.buffer.ByteBuf;
import java.util.Objects;
-
import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmDeserializerHelper;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
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.Ipv6Match;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder;
-import io.netty.buffer.ByteBuf;
-
public class Ipv6NdTllEntryDeserializer extends AbstractMatchEntryDeserializer {
@Override
package org.opendaylight.openflowplugin.impl.protocol.deserialization.match;
+import io.netty.buffer.ByteBuf;
import java.util.Objects;
-
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmDeserializerHelper;
import org.opendaylight.openflowjava.util.ByteBufUtils;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchArbitraryBitMaskBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder;
-import io.netty.buffer.ByteBuf;
-
public class Ipv6SourceEntryDeserializer extends AbstractMatchEntryDeserializer {
@Override
final Ipv6Address address = ByteBufUtils.readIetfIpv6Address(message);
if (hasMask) {
- final byte[] mask = OxmDeserializerHelper.convertMask(message, EncodeConstants.SIZE_OF_IPV6_ADDRESS_IN_BYTES);
+ final byte[] mask = OxmDeserializerHelper.convertMask(message, EncodeConstants
+ .SIZE_OF_IPV6_ADDRESS_IN_BYTES);
if (IpConversionUtil.isIpv6ArbitraryBitMask(mask)) {
setArbitraryMatch(builder, address, mask);
private static void setPrefixMatch(final MatchBuilder builder, final Ipv6Address address, final byte[] mask) {
if (Objects.isNull(builder.getLayer3Match())) {
builder.setLayer3Match(new Ipv6MatchBuilder()
- .setIpv6Source(IpConversionUtil.createPrefix(address, mask))
- .build());
+ .setIpv6Source(IpConversionUtil.createPrefix(address, mask))
+ .build());
} else if (Ipv6Match.class.isInstance(builder.getLayer3Match())
- && Objects.isNull(Ipv6Match.class.cast(builder.getLayer3Match()).getIpv6Source())) {
+ && Objects.isNull(Ipv6Match.class.cast(builder.getLayer3Match()).getIpv6Source())) {
builder.setLayer3Match(new Ipv6MatchBuilder(Ipv6Match.class.cast(builder.getLayer3Match()))
- .setIpv6Source(IpConversionUtil.createPrefix(address, mask))
- .build());
+ .setIpv6Source(IpConversionUtil.createPrefix(address, mask))
+ .build());
} else {
throwErrorOnMalformed(builder, "layer3Match", "ipv6Source");
}
}
private static void setArbitraryMatch(final MatchBuilder builder, final Ipv6Address address,
- final byte[] mask) {
+ final byte[] mask) {
if (Objects.isNull(builder.getLayer3Match())) {
builder.setLayer3Match(new Ipv6MatchArbitraryBitMaskBuilder()
.setIpv6SourceAddressNoMask(address)
.setIpv6SourceArbitraryBitmask(IpConversionUtil.createIpv6ArbitraryBitMask(mask))
.build());
} else if (Ipv6MatchArbitraryBitMask.class.isInstance(builder.getLayer3Match())
- && Objects.isNull(Ipv6MatchArbitraryBitMask.class.cast(builder.getLayer3Match()).getIpv6SourceAddressNoMask())) {
+ && Objects.isNull(Ipv6MatchArbitraryBitMask.class.cast(builder.getLayer3Match())
+ .getIpv6SourceAddressNoMask())) {
final Ipv6MatchArbitraryBitMask match = Ipv6MatchArbitraryBitMask.class.cast(builder.getLayer3Match());
builder.setLayer3Match(new Ipv6MatchArbitraryBitMaskBuilder(match)
.setIpv6SourceAddressNoMask(address)
@Override
public Match deserialize(ByteBuf inBuffer) {
- if (inBuffer.readableBytes() <= 0) return null;
+ if (inBuffer.readableBytes() <= 0) {
+ return null;
+ }
final MatchBuilder builder = new MatchBuilder();
@Override
public void deserializeEntry(ByteBuf inBuffer, MatchBuilder builder) {
- if (inBuffer.readableBytes() <= 0) return;
+ if (inBuffer.readableBytes() <= 0) {
+ return;
+ }
int oxmClass = inBuffer.getUnsignedShort(inBuffer.readerIndex());
int oxmField = inBuffer.getUnsignedByte(inBuffer.readerIndex()
+ EncodeConstants.SIZE_OF_SHORT_IN_BYTES) >>> 1;
package org.opendaylight.openflowplugin.impl.protocol.deserialization.match;
+import io.netty.buffer.ByteBuf;
import java.util.Objects;
-
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.ProtocolMatchFieldsBuilder;
-import io.netty.buffer.ByteBuf;
-
public class MplsBosEntryDeserializer extends AbstractMatchEntryDeserializer {
@Override
package org.opendaylight.openflowplugin.impl.protocol.deserialization.match;
+import io.netty.buffer.ByteBuf;
import java.util.Objects;
-
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.ProtocolMatchFieldsBuilder;
-import io.netty.buffer.ByteBuf;
-
public class MplsLabelEntryDeserializer extends AbstractMatchEntryDeserializer {
@Override
package org.opendaylight.openflowplugin.impl.protocol.deserialization.match;
+import io.netty.buffer.ByteBuf;
import java.util.Objects;
-
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.ProtocolMatchFieldsBuilder;
-import io.netty.buffer.ByteBuf;
-
public class MplsTcEntryDeserializer extends AbstractMatchEntryDeserializer {
@Override
package org.opendaylight.openflowplugin.impl.protocol.deserialization.match;
+import io.netty.buffer.ByteBuf;
import java.util.Objects;
-
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.ProtocolMatchFieldsBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.protocol.match.fields.PbbBuilder;
-import io.netty.buffer.ByteBuf;
-
public class PbbEntryDeserializer extends AbstractMatchEntryDeserializer {
@Override
package org.opendaylight.openflowplugin.impl.protocol.deserialization.match;
+import io.netty.buffer.ByteBuf;
import java.util.Objects;
-
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.TcpFlagsMatchBuilder;
-import io.netty.buffer.ByteBuf;
-
public class TcpFlagsEntryDeserializer extends AbstractMatchEntryDeserializer {
@Override
message.readUnsignedInt(); // Just skip experimenter ID for now, not used
final TcpFlagsMatchBuilder tcpFlagsBuilder = new TcpFlagsMatchBuilder()
- .setTcpFlags(message.readUnsignedShort());
+ .setTcpFlags(message.readUnsignedShort());
if (hasMask) {
tcpFlagsBuilder.setTcpFlagsMask(message.readUnsignedShort());
package org.opendaylight.openflowplugin.impl.protocol.deserialization.match;
+import io.netty.buffer.ByteBuf;
import java.math.BigInteger;
import java.util.Objects;
-
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;
-import io.netty.buffer.ByteBuf;
-
public class TunnelIdEntryDeserializer extends AbstractMatchEntryDeserializer {
@Override
package org.opendaylight.openflowplugin.impl.protocol.deserialization.messages;
+import io.netty.buffer.ByteBuf;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
-
import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistryInjector;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowModCommand;
-import io.netty.buffer.ByteBuf;
-
public class FlowMessageDeserializer implements OFDeserializer<FlowMessage>, DeserializerRegistryInjector {
private static final byte PADDING = 2;
private DeserializerRegistry registry;
@Override
+ @SuppressWarnings("checkstyle:LineLength")
public FlowMessage deserialize(ByteBuf message) {
final FlowMessageBuilder builder = new FlowMessageBuilder()
.setVersion((short) EncodeConstants.OF13_VERSION_ID)
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 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
}
deserializer = registry.getDeserializer(
}
private static FlowModFlags createFlowModFlagsFromBitmap(int input) {
- final Boolean _oFPFFSENDFLOWREM = (input & (1 << 0)) > 0;
- final Boolean _oFPFFCHECKOVERLAP = (input & (1 << 1)) > 0;
- final Boolean _oFPFFRESETCOUNTS = (input & (1 << 2)) > 0;
- final Boolean _oFPFFNOPKTCOUNTS = (input & (1 << 3)) > 0;
- final Boolean _oFPFFNOBYTCOUNTS = (input & (1 << 4)) > 0;
- return new FlowModFlags(_oFPFFCHECKOVERLAP, _oFPFFNOBYTCOUNTS, _oFPFFNOPKTCOUNTS, _oFPFFRESETCOUNTS,
- _oFPFFSENDFLOWREM);
+ final Boolean ofp_FF_SendFlowRem = (input & (1 << 0)) > 0;
+ final Boolean ofp_FF_CheckOverlap = (input & (1 << 1)) > 0;
+ final Boolean ofp_FF_ResetCounts = (input & (1 << 2)) > 0;
+ final Boolean ofp_FF_NoPktCounts = (input & (1 << 3)) > 0;
+ final Boolean ofp_FF_NoBytCounts = (input & (1 << 4)) > 0;
+ return new FlowModFlags(ofp_FF_CheckOverlap, ofp_FF_NoBytCounts, ofp_FF_NoPktCounts, ofp_FF_ResetCounts,
+ ofp_FF_SendFlowRem);
}
@Override
private static final byte BUCKETS_HEADER_LENGTH = 16;
private static final Comparator<Bucket> COMPARATOR = (bucket1, bucket2) -> {
- if (bucket1.getBucketId() == null || bucket2.getBucketId() == null) return 0;
+ if (bucket1.getBucketId() == null || bucket2.getBucketId() == null) {
+ return 0;
+ }
return bucket1.getBucketId().getValue().compareTo(bucket2.getBucketId().getValue());
};
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.meter.band.headers.MeterBandHeaderBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.meter.band.headers.meter.band.header.MeterBandTypesBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterModCommand;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class MeterMessageDeserializer implements OFDeserializer<MeterMessage>, DeserializerRegistryInjector {
+ private static final Logger LOG = LoggerFactory.getLogger(MeterMessageDeserializer.class);
private static final int OFPMBTDROP = 1;
private static final int OFPMBTDSCP = 2;
private static final int OFPMBTEXPERIMENTER = 0xFFFF;
}
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 * EncodeConstants.SIZE_OF_INT_IN_BYTES);
message.readerIndex(bandStartIndex);
OFDeserializer<Experimenter> deserializer = registry.getDeserializer(
- new ExperimenterIdDeserializerKey(EncodeConstants.OF13_VERSION_ID, expId, Experimenter.class));
+ new ExperimenterIdDeserializerKey(EncodeConstants.OF13_VERSION_ID, expId,
+ Experimenter.class));
bandBuilder
.setMeterBandTypes(new MeterBandTypesBuilder()
.setBandType(deserializer.deserialize(message));
break;
}
+ default:
+ // no operation
}
bands.add(bandBuilder.build());
private static MeterFlags readMeterFlags(ByteBuf message) {
int input = message.readUnsignedShort();
- final Boolean mfKBPS = (input & (1)) != 0;
- final Boolean mfPKTPS = (input & (1 << 1)) != 0;
- final Boolean mfBURST = (input & (1 << 2)) != 0;
- final Boolean mfSTATS = (input & (1 << 3)) != 0;
- return new MeterFlags(mfBURST, mfKBPS, mfPKTPS, mfSTATS);
+ final Boolean mfKbps = (input & (1)) != 0;
+ final Boolean mfPktps = (input & (1 << 1)) != 0;
+ final Boolean mfBurst = (input & (1 << 2)) != 0;
+ final Boolean mfStats = (input & (1 << 3)) != 0;
+ return new MeterFlags(mfBurst, mfKbps, mfPktps, mfStats);
}
}
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class MultipartReplyExperimenterDeserializer implements OFDeserializer<MultipartReplyBody>, DeserializerRegistryInjector {
+public class MultipartReplyExperimenterDeserializer implements OFDeserializer<MultipartReplyBody>,
+ DeserializerRegistryInjector {
private static final Logger LOG = LoggerFactory.getLogger(MultipartReplyExperimenterDeserializer.class);
private DeserializerRegistry registry;
try {
final OFDeserializer<ExperimenterMessageOfChoice> deserializer = registry
- .getDeserializer(new ExperimenterIdTypeDeserializerKey(
+ .getDeserializer(new ExperimenterIdTypeDeserializerKey(
EncodeConstants.OF13_VERSION_ID, expId, expType, ExperimenterMessageOfChoice.class));
builder.setExperimenterMessageOfChoice(deserializer.deserialize(message));
} catch (ClassCastException | IllegalStateException es) {
final OFDeserializer<ExperimenterDataOfChoice> deserializer = registry.getDeserializer(
ExperimenterDeserializerKeyFactory.createMultipartReplyMessageDeserializerKey(
- EncodeConstants.OF13_VERSION_ID, expId, expType));
+ EncodeConstants.OF13_VERSION_ID, expId, expType));
final ExperimenterDataOfChoice data = deserializer.deserialize(message);
final MessageTypeKey<? extends ExperimenterDataOfChoice> key = new MessageTypeKey<>(
(Class<? extends ExperimenterDataOfChoice>) data.getImplementedInterface());
final ConvertorMessageFromOFJava<ExperimenterDataOfChoice, MessagePath> convertor = OFSessionUtil
- .getExtensionConvertorProvider()
- .getMessageConverter(key);
+ .getExtensionConvertorProvider()
+ .getMessageConverter(key);
try {
builder.setExperimenterMessageOfChoice(convertor.convert(data, MessagePath.MPMESSAGE_RPC_OUTPUT));
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.statistics.types.rev130925.duration.DurationBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.multipart.reply.MultipartReplyBody;
-public class MultipartReplyFlowStatsDeserializer implements OFDeserializer<MultipartReplyBody>, DeserializerRegistryInjector {
+public class MultipartReplyFlowStatsDeserializer implements OFDeserializer<MultipartReplyBody>,
+ DeserializerRegistryInjector {
private static final MessageCodeKey MATCH_KEY = new MessageCodeMatchKey(EncodeConstants.OF13_VERSION_ID,
EncodeConstants.EMPTY_VALUE, Match.class,
itemMessage.skipBytes(PADDING_IN_FLOW_STATS_HEADER_01);
itemBuilder
- .setDuration(new DurationBuilder()
- .setSecond(new Counter32(itemMessage.readUnsignedInt()))
- .setNanosecond(new Counter32(itemMessage.readUnsignedInt()))
- .build())
- .setPriority(itemMessage.readUnsignedShort())
- .setIdleTimeout(itemMessage.readUnsignedShort())
- .setHardTimeout(itemMessage.readUnsignedShort())
- .setFlags(createFlowModFlagsFromBitmap(itemMessage.readUnsignedShort()));
+ .setDuration(new DurationBuilder()
+ .setSecond(new Counter32(itemMessage.readUnsignedInt()))
+ .setNanosecond(new Counter32(itemMessage.readUnsignedInt()))
+ .build())
+ .setPriority(itemMessage.readUnsignedShort())
+ .setIdleTimeout(itemMessage.readUnsignedShort())
+ .setHardTimeout(itemMessage.readUnsignedShort())
+ .setFlags(createFlowModFlagsFromBitmap(itemMessage.readUnsignedShort()));
itemMessage.skipBytes(PADDING_IN_FLOW_STATS_HEADER_02);
itemMessage.readBytes(byteCount);
itemBuilder
- .setCookie(new FlowCookie(new BigInteger(1, cookie)))
- .setCookieMask(new FlowCookie(OFConstants.DEFAULT_COOKIE_MASK))
- .setPacketCount(new Counter64(new BigInteger(1, packetCount)))
- .setByteCount(new Counter64(new BigInteger(1, byteCount)));
+ .setCookie(new FlowCookie(new BigInteger(1, cookie)))
+ .setCookieMask(new FlowCookie(OFConstants.DEFAULT_COOKIE_MASK))
+ .setPacketCount(new Counter64(new BigInteger(1, packetCount)))
+ .setByteCount(new Counter64(new BigInteger(1, byteCount)));
final OFDeserializer<Match> matchDeserializer = registry.getDeserializer(MATCH_KEY);
itemBuilder.setMatch(MatchUtil.transformMatch(matchDeserializer.deserialize(itemMessage),
if (length > 0) {
final List<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list
- .Instruction> instructions = new ArrayList<>();
+ .Instruction> instructions = new ArrayList<>();
final int startIndex = itemMessage.readerIndex();
int offset = 0;
.setKey(new InstructionKey(offset))
.setOrder(offset)
.setInstruction(InstructionUtil
- .readInstruction(EncodeConstants.OF13_VERSION_ID, itemMessage, registry))
+ .readInstruction(EncodeConstants.OF13_VERSION_ID, itemMessage, registry))
.build());
offset++;
}
return builder
- .setFlowAndStatisticsMapList(items)
- .build();
+ .setFlowAndStatisticsMapList(items)
+ .build();
}
private static FlowModFlags createFlowModFlagsFromBitmap(int input) {
- final Boolean _oFPFFSENDFLOWREM = (input & (1)) > 0;
- final Boolean _oFPFFCHECKOVERLAP = (input & (1 << 1)) > 0;
- final Boolean _oFPFFRESETCOUNTS = (input & (1 << 2)) > 0;
- final Boolean _oFPFFNOPKTCOUNTS = (input & (1 << 3)) > 0;
- final Boolean _oFPFFNOBYTCOUNTS = (input & (1 << 4)) > 0;
- return new FlowModFlags(_oFPFFCHECKOVERLAP, _oFPFFNOBYTCOUNTS, _oFPFFNOPKTCOUNTS, _oFPFFRESETCOUNTS,
- _oFPFFSENDFLOWREM);
+ final Boolean ofp_FF_SendFlowRem = (input & (1)) > 0;
+ final Boolean ofp_FF_CheckOverlap = (input & (1 << 1)) > 0;
+ final Boolean ofp_FF_ResetCounts = (input & (1 << 2)) > 0;
+ final Boolean ofp_FF_NoPktCounts = (input & (1 << 3)) > 0;
+ final Boolean ofp_FF_NoBytCounts = (input & (1 << 4)) > 0;
+ return new FlowModFlags(ofp_FF_CheckOverlap, ofp_FF_NoBytCounts, ofp_FF_NoPktCounts, ofp_FF_ResetCounts,
+ ofp_FF_SendFlowRem);
}
@Override
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.desc.stats.reply.GroupDescStatsKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.multipart.reply.MultipartReplyBody;
-public class MultipartReplyGroupDescDeserializer implements OFDeserializer<MultipartReplyBody>, DeserializerRegistryInjector {
+public class MultipartReplyGroupDescDeserializer implements OFDeserializer<MultipartReplyBody>,
+ DeserializerRegistryInjector {
private static final byte PADDING_IN_GROUP_DESC_HEADER = 1;
private static final byte PADDING_IN_BUCKETS_HEADER = 4;
final int itemLength = message.readUnsignedShort();
final GroupDescStatsBuilder itemBuilder = new GroupDescStatsBuilder()
- .setGroupType(GroupTypes.forValue(message.readUnsignedByte()));
+ .setGroupType(GroupTypes.forValue(message.readUnsignedByte()));
message.skipBytes(PADDING_IN_GROUP_DESC_HEADER);
itemBuilder.setGroupId(new GroupId(message.readUnsignedInt()));
final int bucketsLength = message.readUnsignedShort();
final BucketBuilder bucketBuilder = new BucketBuilder()
- .setBucketId(new BucketId(bucketKey))
- .setKey(new BucketKey(new BucketId(bucketKey)))
- .setWeight(message.readUnsignedShort())
- .setWatchPort(message.readUnsignedInt())
- .setWatchGroup(message.readUnsignedInt());
+ .setBucketId(new BucketId(bucketKey))
+ .setKey(new BucketKey(new BucketId(bucketKey)))
+ .setWeight(message.readUnsignedShort())
+ .setWatchPort(message.readUnsignedInt())
+ .setWatchGroup(message.readUnsignedInt());
message.skipBytes(PADDING_IN_BUCKETS_HEADER);
final List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list
- .Action> actions = new ArrayList<>();
+ .Action> actions = new ArrayList<>();
final int startIndex = message.readerIndex();
final int bucketLength = bucketsLength - BUCKETS_HEADER_LENGTH;
int offset = 0;
}
items.add(itemBuilder
- .setBuckets(new BucketsBuilder()
- .setBucket(subItems)
- .build())
- .build());
+ .setBuckets(new BucketsBuilder()
+ .setBucket(subItems)
+ .build())
+ .build());
}
return builder
- .setGroupDescStats(items)
- .build();
+ .setGroupDescStats(items)
+ .build();
}
@Override
final boolean gcChaining = ((capabilitiesMask) & (1 << 2)) != 0;
final boolean gcChainingChecks = ((capabilitiesMask) & (1 << 3)) != 0;
- if (gcSelectWeight) groupCapabilities.add(SelectWeight.class);
- if (gcSelectLiveness) groupCapabilities.add(SelectLiveness.class);
- if (gcChaining) groupCapabilities.add(Chaining.class);
- if (gcChainingChecks) groupCapabilities.add(ChainingChecks.class);
+ if (gcSelectWeight) {
+ groupCapabilities.add(SelectWeight.class);
+ }
+ if (gcSelectLiveness) {
+ groupCapabilities.add(SelectLiveness.class);
+ }
+ if (gcChaining) {
+ groupCapabilities.add(Chaining.class);
+ }
+ if (gcChainingChecks) {
+ groupCapabilities.add(ChainingChecks.class);
+ }
return groupCapabilities;
}
final boolean gtIndirect = ((typesMask) & (1 << 2)) != 0;
final boolean gtFF = ((typesMask) & (1 << 3)) != 0;
- if (gtAll) groupTypes.add(GroupAll.class);
- if (gtSelect) groupTypes.add(GroupSelect.class);
- if (gtIndirect) groupTypes.add(GroupIndirect.class);
- if (gtFF) groupTypes.add(GroupFf.class);
+ if (gtAll) {
+ groupTypes.add(GroupAll.class);
+ }
+ if (gtSelect) {
+ groupTypes.add(GroupSelect.class);
+ }
+ if (gtIndirect) {
+ groupTypes.add(GroupIndirect.class);
+ }
+ if (gtFF) {
+ groupTypes.add(GroupFf.class);
+ }
return groupTypes;
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.meter.band.headers.MeterBandHeaderBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.meter.band.headers.meter.band.header.MeterBandTypesBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.multipart.reply.MultipartReplyBody;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
-public class MultipartReplyMeterConfigDeserializer implements OFDeserializer<MultipartReplyBody>, DeserializerRegistryInjector {
+public class MultipartReplyMeterConfigDeserializer implements OFDeserializer<MultipartReplyBody>,
+ DeserializerRegistryInjector {
- private static final byte METER_CONFIG_LENGTH = 8;
+ private static final Logger LOG = LoggerFactory.getLogger(MultipartReplyMeterConfigDeserializer.class);
+ private static final byte METER_CONFIG_LENGTH = 8;
private static final int OFPMBTDROP = 1;
private static final int OFPMBTDSCP = 2;
private static final int OFPMBTEXPERIMENTER = 0xFFFF;
final int itemLength = message.readUnsignedShort();
final MeterConfigStatsBuilder itemBuilder = new MeterConfigStatsBuilder()
- .setFlags(readMeterFlags(message))
- .setMeterId(new MeterId(message.readUnsignedInt()));
+ .setFlags(readMeterFlags(message))
+ .setMeterId(new MeterId(message.readUnsignedInt()));
final List<MeterBandHeader> subItems = new ArrayList<>();
int actualLength = METER_CONFIG_LENGTH;
switch (itemBandType) {
case OFPMBTDROP:
subItemBuilder
- .setMeterBandTypes(new MeterBandTypesBuilder()
- .setFlags(new MeterBandType(true, false, false))
- .build())
- .setBandType(new DropBuilder()
- .setDropRate(message.readUnsignedInt())
- .setDropBurstSize(message.readUnsignedInt())
- .build());
+ .setMeterBandTypes(new MeterBandTypesBuilder()
+ .setFlags(new MeterBandType(true, false, false))
+ .build())
+ .setBandType(new DropBuilder()
+ .setDropRate(message.readUnsignedInt())
+ .setDropBurstSize(message.readUnsignedInt())
+ .build());
message.skipBytes(PADDING_IN_METER_BAND_DROP_HEADER);
break;
case OFPMBTDSCP:
subItemBuilder
- .setMeterBandTypes(new MeterBandTypesBuilder()
- .setFlags(new MeterBandType(false, true, false))
- .build())
- .setBandType(new DscpRemarkBuilder()
- .setDscpRemarkRate(message.readUnsignedInt())
- .setDscpRemarkBurstSize(message.readUnsignedInt())
- .setPrecLevel(message.readUnsignedByte())
- .build());
+ .setMeterBandTypes(new MeterBandTypesBuilder()
+ .setFlags(new MeterBandType(false, true, false))
+ .build())
+ .setBandType(new DscpRemarkBuilder()
+ .setDscpRemarkRate(message.readUnsignedInt())
+ .setDscpRemarkBurstSize(message.readUnsignedInt())
+ .setPrecLevel(message.readUnsignedByte())
+ .build());
message.skipBytes(PADDING_IN_METER_BAND_DSCP_HEADER);
break;
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 * EncodeConstants
+ .SIZE_OF_INT_IN_BYTES);
message.readerIndex(itemStartIndex);
final OFDeserializer<Experimenter> deserializer = registry.getDeserializer(
- new ExperimenterIdDeserializerKey(EncodeConstants.OF13_VERSION_ID, expId, Experimenter.class));
+ new ExperimenterIdDeserializerKey(EncodeConstants.OF13_VERSION_ID, expId,
+ Experimenter.class));
subItemBuilder
- .setMeterBandTypes(new MeterBandTypesBuilder()
- .setFlags(new MeterBandType(false, false, true))
- .build())
- .setBandType(deserializer.deserialize(message));
+ .setMeterBandTypes(new MeterBandTypesBuilder()
+ .setFlags(new MeterBandType(false, false, true))
+ .build())
+ .setBandType(deserializer.deserialize(message));
break;
+ default:
+ // no operation
}
subItems.add(subItemBuilder.build());
}
items.add(itemBuilder
- .setKey(new MeterConfigStatsKey(itemBuilder.getMeterId()))
- .setMeterBandHeaders(new MeterBandHeadersBuilder()
- .setMeterBandHeader(subItems)
- .build())
- .build());
+ .setKey(new MeterConfigStatsKey(itemBuilder.getMeterId()))
+ .setMeterBandHeaders(new MeterBandHeadersBuilder()
+ .setMeterBandHeader(subItems)
+ .build())
+ .build());
}
return builder
- .setMeterConfigStats(items)
- .build();
+ .setMeterConfigStats(items)
+ .build();
}
private static MeterFlags readMeterFlags(ByteBuf message) {
int input = message.readUnsignedShort();
- final Boolean mfKBPS = (input & (1)) != 0;
- final Boolean mfPKTPS = (input & (1 << 1)) != 0;
- final Boolean mfBURST = (input & (1 << 2)) != 0;
- final Boolean mfSTATS = (input & (1 << 3)) != 0;
- return new MeterFlags(mfBURST, mfKBPS, mfPKTPS, mfSTATS);
+ final Boolean mfKbps = (input & (1)) != 0;
+ final Boolean mfPktps = (input & (1 << 1)) != 0;
+ final Boolean mfBurst = (input & (1 << 2)) != 0;
+ final Boolean mfStats = (input & (1 << 3)) != 0;
+ return new MeterFlags(mfBurst, mfKbps, mfPktps, mfStats);
}
@Override
@Override
public MultipartReplyBody deserialize(ByteBuf message) {
return new MultipartReplyMeterFeaturesBuilder()
- .setMaxMeter(new Counter32(message.readUnsignedInt()))
- .setMeterBandSupported(readMeterBands(message))
- .setMeterCapabilitiesSupported(readMeterCapabilities(message))
- .setMaxBands(message.readUnsignedByte())
- .setMaxColor(message.readUnsignedByte())
- .build();
+ .setMaxMeter(new Counter32(message.readUnsignedInt()))
+ .setMeterBandSupported(readMeterBands(message))
+ .setMeterCapabilitiesSupported(readMeterCapabilities(message))
+ .setMaxBands(message.readUnsignedByte())
+ .setMaxColor(message.readUnsignedByte())
+ .build();
}
private static List<Class<? extends MeterBand>> readMeterBands(ByteBuf message) {
final List<Class<? extends MeterBand>> bandTypes = new ArrayList<>();
final long typesMask = message.readUnsignedInt();
- final boolean mbtDROP = (typesMask & (1)) != 0;
- final boolean mbtDSCPREMARK = (typesMask & (1 << 1)) != 0;
+ final boolean mbtDrop = (typesMask & (1)) != 0;
+ final boolean mbtDscpRemark = (typesMask & (1 << 1)) != 0;
- if (mbtDROP) bandTypes.add(MeterBandDrop.class);
- if (mbtDSCPREMARK) bandTypes.add(MeterBandDscpRemark.class);
+ if (mbtDrop) {
+ bandTypes.add(MeterBandDrop.class);
+ }
+ if (mbtDscpRemark) {
+ bandTypes.add(MeterBandDscpRemark.class);
+ }
return bandTypes;
}
final List<Class<? extends MeterCapability>> meterCapabilities = new ArrayList<>();
final long capabilitiesMask = message.readUnsignedInt();
- final boolean mfKBPS = (capabilitiesMask & (1)) != 0;
- final boolean mfPKTPS = (capabilitiesMask & (1 << 1)) != 0;
- final boolean mfBURST = (capabilitiesMask & (1 << 2)) != 0;
- final boolean mfSTATS = (capabilitiesMask & (1 << 3)) != 0;
+ final boolean mfKbps = (capabilitiesMask & (1)) != 0;
+ final boolean mfPktps = (capabilitiesMask & (1 << 1)) != 0;
+ final boolean mfBurst = (capabilitiesMask & (1 << 2)) != 0;
+ final boolean mfStats = (capabilitiesMask & (1 << 3)) != 0;
- if (mfKBPS) meterCapabilities.add(MeterKbps.class);
- if (mfPKTPS) meterCapabilities.add(MeterPktps.class);
- if (mfBURST) meterCapabilities.add(MeterBurst.class);
- if (mfSTATS) meterCapabilities.add(MeterStats.class);
+ if (mfKbps) {
+ meterCapabilities.add(MeterKbps.class);
+ }
+ if (mfPktps) {
+ meterCapabilities.add(MeterPktps.class);
+ }
+ if (mfBurst) {
+ meterCapabilities.add(MeterBurst.class);
+ }
+ if (mfStats) {
+ meterCapabilities.add(MeterStats.class);
+ }
return meterCapabilities;
}
while (message.readableBytes() > 0) {
final NodeConnectorStatisticsAndPortNumberMapBuilder itemBuilder =
- new NodeConnectorStatisticsAndPortNumberMapBuilder();
+ new NodeConnectorStatisticsAndPortNumberMapBuilder();
final long port = message.readUnsignedInt();
- itemBuilder.setNodeConnectorId(new NodeConnectorId(OpenflowPortsUtil.getProtocolAgnosticPortUri(EncodeConstants.OF13_VERSION_ID, port)));
+ itemBuilder.setNodeConnectorId(new NodeConnectorId(OpenflowPortsUtil
+ .getProtocolAgnosticPortUri(EncodeConstants.OF13_VERSION_ID, port)));
message.skipBytes(PADDING_IN_PORT_STATS_HEADER);
message.readBytes(collisionCount);
items.add(itemBuilder
- .setKey(new NodeConnectorStatisticsAndPortNumberMapKey(itemBuilder.getNodeConnectorId()))
- .setPackets(new PacketsBuilder()
- .setReceived(new BigInteger(1, recPack))
- .setTransmitted(new BigInteger(1, txPack))
- .build())
- .setBytes(new BytesBuilder()
- .setReceived(new BigInteger(1, recByt))
- .setTransmitted(new BigInteger(1, txByt))
- .build())
- .setReceiveDrops(new BigInteger(1, recDrop))
- .setTransmitDrops(new BigInteger(1, txDrop))
- .setReceiveErrors(new BigInteger(1, recError))
- .setTransmitErrors(new BigInteger(1, txError))
- .setReceiveFrameError(new BigInteger(1, recFrameError))
- .setReceiveOverRunError(new BigInteger(1, recOverRunError))
- .setReceiveCrcError(new BigInteger(1, recCrcError))
- .setCollisionCount(new BigInteger(1, collisionCount))
- .setDuration(new DurationBuilder()
- .setSecond(new Counter32(message.readUnsignedInt()))
- .setNanosecond(new Counter32(message.readUnsignedInt()))
- .build())
- .build());
+ .setKey(new NodeConnectorStatisticsAndPortNumberMapKey(itemBuilder.getNodeConnectorId()))
+ .setPackets(new PacketsBuilder()
+ .setReceived(new BigInteger(1, recPack))
+ .setTransmitted(new BigInteger(1, txPack))
+ .build())
+ .setBytes(new BytesBuilder()
+ .setReceived(new BigInteger(1, recByt))
+ .setTransmitted(new BigInteger(1, txByt))
+ .build())
+ .setReceiveDrops(new BigInteger(1, recDrop))
+ .setTransmitDrops(new BigInteger(1, txDrop))
+ .setReceiveErrors(new BigInteger(1, recError))
+ .setTransmitErrors(new BigInteger(1, txError))
+ .setReceiveFrameError(new BigInteger(1, recFrameError))
+ .setReceiveOverRunError(new BigInteger(1, recOverRunError))
+ .setReceiveCrcError(new BigInteger(1, recCrcError))
+ .setCollisionCount(new BigInteger(1, collisionCount))
+ .setDuration(new DurationBuilder()
+ .setSecond(new Counter32(message.readUnsignedInt()))
+ .setNanosecond(new Counter32(message.readUnsignedInt()))
+ .build())
+ .build());
}
return builder
- .setNodeConnectorStatisticsAndPortNumberMap(items)
- .build();
+ .setNodeConnectorStatisticsAndPortNumberMap(items)
+ .build();
}
}
while (message.readableBytes() > 0) {
final long port = message.readUnsignedInt();
- final NodeConnectorId nodeConnectorId = new NodeConnectorId(OpenflowPortsUtil.getProtocolAgnosticPortUri(EncodeConstants.OF13_VERSION_ID, port));
+ final NodeConnectorId nodeConnectorId = new NodeConnectorId(OpenflowPortsUtil
+ .getProtocolAgnosticPortUri(EncodeConstants.OF13_VERSION_ID, port));
final QueueId queueId = new QueueId(message.readUnsignedInt());
final byte[] txBytes = new byte[EncodeConstants.SIZE_OF_LONG_IN_BYTES];
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class MultipartReplyTableFeaturesDeserializer implements OFDeserializer<MultipartReplyBody>, DeserializerRegistryInjector {
+public class MultipartReplyTableFeaturesDeserializer implements OFDeserializer<MultipartReplyBody>,
+ DeserializerRegistryInjector {
private static final Logger LOG = LoggerFactory.getLogger(MultipartReplyTableFeaturesDeserializer.class);
private static final byte PADDING_IN_MULTIPART_REPLY_TABLE_FEATURES = 5;
private static final byte MAX_TABLE_NAME_LENGTH = 32;
private static final byte MULTIPART_REPLY_TABLE_FEATURES_STRUCTURE_LENGTH = 64;
private static final byte COMMON_PROPERTY_LENGTH = 4;
private static final TableFeaturesMatchFieldDeserializer MATCH_FIELD_DESERIALIZER =
- new TableFeaturesMatchFieldDeserializer();
+ new TableFeaturesMatchFieldDeserializer();
private DeserializerRegistry registry;
while (message.readableBytes() > 0) {
final int itemLength = message.readUnsignedShort();
final TableFeaturesBuilder itemBuilder = new TableFeaturesBuilder()
- .setTableId(message.readUnsignedByte());
+ .setTableId(message.readUnsignedByte());
message.skipBytes(PADDING_IN_MULTIPART_REPLY_TABLE_FEATURES);
message.readBytes(write);
items.add(itemBuilder
- .setKey(new TableFeaturesKey(itemBuilder.getTableId()))
- .setName(name)
- .setMetadataMatch(new BigInteger(1, match))
- .setMetadataWrite(new BigInteger(1, write))
- .setConfig(readTableConfig(message))
- .setMaxEntries(message.readUnsignedInt())
- .setTableProperties(readTableProperties(message,
- itemLength - MULTIPART_REPLY_TABLE_FEATURES_STRUCTURE_LENGTH))
- .build());
+ .setKey(new TableFeaturesKey(itemBuilder.getTableId()))
+ .setName(name)
+ .setMetadataMatch(new BigInteger(1, match))
+ .setMetadataWrite(new BigInteger(1, write))
+ .setConfig(readTableConfig(message))
+ .setMaxEntries(message.readUnsignedInt())
+ .setTableProperties(readTableProperties(message,
+ itemLength - MULTIPART_REPLY_TABLE_FEATURES_STRUCTURE_LENGTH))
+ .build());
}
return builder
- .setTableFeatures(items)
- .build();
+ .setTableFeatures(items)
+ .build();
}
- private final TableConfig readTableConfig(ByteBuf message) {
+ private TableConfig readTableConfig(ByteBuf message) {
final long input = message.readUnsignedInt();
final boolean deprecated = (input & 3) != 0;
return new TableConfig(deprecated);
}
- private final TableProperties readTableProperties(ByteBuf message, int length) {
+ private TableProperties readTableProperties(ByteBuf message, int length) {
final List<TableFeatureProperties> items = new ArrayList<>();
int tableFeaturesLength = length;
int order = 0;
propDeserializer.deserialize(message);
LOG.debug("Table feature property type {} is not handled yet.", propType);
break;
+ default:
+ // no operation
}
while ((message.readerIndex() - startIndex) < length) {
MATCH_FIELD_DESERIALIZER
- .deserialize(message)
- .map(matchFields::add)
- .orElseGet(() -> {
- message.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
- return Boolean.FALSE;
- });
+ .deserialize(message)
+ .map(matchFields::add)
+ .orElseGet(() -> {
+ message.skipBytes(2 * EncodeConstants.SIZE_OF_SHORT_IN_BYTES);
+ return Boolean.FALSE;
+ });
}
return matchFields;
.Instruction> readInstructions(ByteBuf message, int length) {
final List<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list
- .Instruction> instructions = new ArrayList<>();
+ .Instruction> instructions = new ArrayList<>();
final int startIndex = message.readerIndex();
int offset = 0;
while ((message.readerIndex() - startIndex) < length) {
try {
instructions.add(new InstructionBuilder()
- .setKey(new InstructionKey(offset))
- .setOrder(offset)
- .setInstruction(InstructionUtil
- .readInstructionHeader(EncodeConstants.OF13_VERSION_ID, message, registry))
- .build());
+ .setKey(new InstructionKey(offset))
+ .setOrder(offset)
+ .setInstruction(InstructionUtil
+ .readInstructionHeader(EncodeConstants.OF13_VERSION_ID, message, registry))
+ .build());
offset++;
} catch (ClassCastException | IllegalStateException e) {
return instructions;
}
+ @SuppressWarnings("checkstyle:LineLength")
private List<Action> readActions(ByteBuf message, int length) {
final List<Action> actions = new ArrayList<>();
final int startIndex = message.readerIndex();
.setKey(new ActionKey(offset))
.setOrder(offset)
.setAction(ActionUtil.readActionHeader(EncodeConstants.OF13_VERSION_ID, message, registry,
- ActionPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION))
+ ActionPath
+ .FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION))
.build());
offset++;
public class TableFeaturesMatchFieldDeserializer {
/**
- * Mapping of match entry code to match set field class
+ * Mapping of match entry code to match set field class.
*/
- private final Map<MatchEntryDeserializerKey, Class<? extends MatchField>> CODE_TO_FIELD = ImmutableMap
+ private final Map<MatchEntryDeserializerKey, Class<? extends MatchField>> codeToFieldMap = ImmutableMap
.<MatchEntryDeserializerKey, Class<? extends MatchField>>builder()
.put(new MatchEntryDeserializerKey(
EncodeConstants.OF13_VERSION_ID,
OxmMatchConstants.NXM_NX_TCP_FLAG), TcpFlags.class)
.build();
-/**
- * Processes match entry header and returns if it have mask, or not
+ /**
+ * Processes match entry header and returns if it have mask, or not.
+ *
* @param in input buffer
* @return SetFieldMatchBuilder with hasMask properly set
*/
in.skipBytes(EncodeConstants.SIZE_OF_BYTE_IN_BYTES); // skip match entry length
return new SetFieldMatchBuilder()
- .setHasMask(hasMask);
+ .setHasMask(hasMask);
}
/**
- * Deserialize match field if deserializer supports it, otherwise returns empty optional
+ * Deserialize match field if deserializer supports it, otherwise returns empty optional.
+ *
* @param message input buffer
* @return set field match
*/
}
final MatchEntryDeserializerKey key =
- new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, oxmClass, oxmField);
+ new MatchEntryDeserializerKey(EncodeConstants.OF13_VERSION_ID, oxmClass, oxmField);
key.setExperimenterId(expId);
return Optional
- .ofNullable(CODE_TO_FIELD.get(key))
- .map(clazz -> processHeader(message)
- .setKey(new SetFieldMatchKey(clazz))
- .setMatchType(clazz)
- .build());
- }}
+ .ofNullable(codeToFieldMap.get(key))
+ .map(clazz -> processHeader(message)
+ .setKey(new SetFieldMatchKey(clazz))
+ .setMatchType(clazz)
+ .build());
+ }
+}
package org.opendaylight.openflowplugin.impl.protocol.deserialization.util;
+import io.netty.buffer.ByteBuf;
import java.util.Objects;
-
import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;
import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderDeserializer;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
import org.opendaylight.openflowplugin.openflow.md.core.extension.ActionExtensionHelper;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
-import io.netty.buffer.ByteBuf;
-
/**
- * Utility class for action deserialization
+ * Utility class for action deserialization.
*/
public class ActionUtil {
/**
- * Deserialize OpenFlow action, using extension converter if available
+ * Deserialize OpenFlow action, using extension converter if available.
* TODO: Remove also extension converters
*
- * @param version OpenFlow version
- * @param message OpenFlow buffered message
+ * @param version OpenFlow version
+ * @param message OpenFlow buffered message
* @param registry deserializer registry
- * @param path Action path
+ * @param path Action path
*/
public static Action readAction(short version, ByteBuf message, DeserializerRegistry registry,
- ActionPath path) {
+ ActionPath path) {
int type = message.getUnsignedShort(message.readerIndex());
Long expId = null;
try {
final MessageCodeExperimenterKey key = new MessageCodeExperimenterKey(
- version, type, Action.class, expId);
+ version, type, Action.class, expId);
final OFDeserializer<Action> deserializer = registry.getDeserializer(key);
return deserializer.deserialize(message);
} catch (ClassCastException | IllegalStateException e) {
final MessageCodeKey key = Objects.nonNull(expId)
- ? new ExperimenterActionDeserializerKey(version, expId)
- : new ActionDeserializerKey(version, type, expId);
+ ? new ExperimenterActionDeserializerKey(version, expId)
+ : new ActionDeserializerKey(version, type, expId);
final OFDeserializer<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203
- .actions.grouping.Action> deserializer = registry.getDeserializer(key);
+ .actions.grouping.Action> deserializer = registry.getDeserializer(key);
return ActionExtensionHelper.processAlienAction(deserializer.deserialize(message),
OpenflowVersion.get(version), path);
}
/**
- * Deserialize OpenFlow action header, using extension converter if available
+ * Deserialize OpenFlow action header, using extension converter if available.
* TODO: Remove also extension converters
*
- * @param version OpenFlow version
- * @param message OpenFlow buffered message
+ * @param version OpenFlow version
+ * @param message OpenFlow buffered message
* @param registry deserializer registry
- * @param path Action path
+ * @param path Action path
*/
public static Action readActionHeader(short version, ByteBuf message, DeserializerRegistry registry,
- ActionPath path) {
+ ActionPath path) {
int type = message.getUnsignedShort(message.readerIndex());
Long expId = null;
try {
final MessageCodeExperimenterKey key = new MessageCodeExperimenterKey(
- version, type, Action.class, expId);
+ version, type, Action.class, expId);
final HeaderDeserializer<Action> deserializer = registry.getDeserializer(key);
return deserializer.deserializeHeader(message);
} catch (ClassCastException | IllegalStateException e) {
final MessageCodeKey key = Objects.nonNull(expId)
- ? new ExperimenterActionDeserializerKey(version, expId)
- : new ActionDeserializerKey(version, type, expId);
+ ? new ExperimenterActionDeserializerKey(version, expId)
+ : new ActionDeserializerKey(version, type, expId);
final HeaderDeserializer<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203
- .actions.grouping.Action> deserializer = registry.getDeserializer(key);
+ .actions.grouping.Action> deserializer = registry.getDeserializer(key);
return ActionExtensionHelper.processAlienAction(deserializer.deserializeHeader(message),
OpenflowVersion.get(version), path);
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction;
/**
- * Utility class for action deserialization
+ * Utility class for action deserialization.
*/
public class InstructionUtil {
/**
- * Deserialize OpenFlow instruction
+ * Deserialize OpenFlow instruction.
*
- * @param version OpenFlow version
- * @param message OpenFlow buffered message
+ * @param version OpenFlow version
+ * @param message OpenFlow buffered message
* @param registry deserializer registry
*/
+ @SuppressWarnings("checkstyle:LineLength")
public static Instruction readInstruction(final short version,
final ByteBuf message,
final DeserializerRegistry registry) {
if (InstructionConstants.APPLY_ACTIONS_TYPE == type) {
deserializer = registry.getDeserializer(
- new MessageCodeActionExperimenterKey(
- version, type, Instruction.class,
- ActionPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION,
- null));
+ new MessageCodeActionExperimenterKey(
+ version, type, Instruction.class,
+ ActionPath
+ .FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION,
+ null));
} else if (InstructionConstants.WRITE_ACTIONS_TYPE == type) {
deserializer = registry.getDeserializer(
- new MessageCodeActionExperimenterKey(
- version, type, Instruction.class,
- ActionPath.FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION,
- null));
+ new MessageCodeActionExperimenterKey(
+ version, type, Instruction.class,
+ ActionPath
+ .FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_INSTRUCTIONS_INSTRUCTION_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION,
+ null));
} else {
Long expId = null;
}
deserializer = registry.getDeserializer(
- new MessageCodeExperimenterKey(
- version, type, Instruction.class, expId));
+ new MessageCodeExperimenterKey(
+ version, type, Instruction.class, expId));
}
return deserializer.deserialize(message);
}
/**
- * Deserialize OpenFlow instruction header
+ * Deserialize OpenFlow instruction header.
*
- * @param version OpenFlow version
- * @param message OpenFlow buffered message
+ * @param version OpenFlow version
+ * @param message OpenFlow buffered message
* @param registry deserializer registry
*/
+ @SuppressWarnings("checkstyle:LineLength")
public static Instruction readInstructionHeader(final short version,
final ByteBuf message,
final DeserializerRegistry registry) {
if (InstructionConstants.APPLY_ACTIONS_TYPE == type) {
deserializer = registry.getDeserializer(
- new MessageCodeActionExperimenterKey(
- version, type, Instruction.class,
- ActionPath.NODES_NODE_TABLE_FLOW_INSTRUCTIONS_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION_EXTENSIONLIST_EXTENSION,
- null));
+ new MessageCodeActionExperimenterKey(
+ version, type, Instruction.class,
+ ActionPath
+ .NODES_NODE_TABLE_FLOW_INSTRUCTIONS_INSTRUCTION_APPLYACTIONSCASE_APPLYACTIONS_ACTION_ACTION_EXTENSIONLIST_EXTENSION,
+ null));
} else if (InstructionConstants.WRITE_ACTIONS_TYPE == type) {
deserializer = registry.getDeserializer(
- new MessageCodeActionExperimenterKey(
- version, type, Instruction.class,
- ActionPath.NODES_NODE_TABLE_FLOW_INSTRUCTIONS_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION_EXTENSIONLIST_EXTENSION,
- null));
+ new MessageCodeActionExperimenterKey(
+ version, type, Instruction.class,
+ ActionPath
+ .NODES_NODE_TABLE_FLOW_INSTRUCTIONS_INSTRUCTION_WRITEACTIONSCASE_WRITEACTIONS_ACTION_ACTION_EXTENSIONLIST_EXTENSION,
+ null));
} else {
Long expId = null;
}
deserializer = registry.getDeserializer(
- new MessageCodeExperimenterKey(
- version, type, Instruction.class, expId));
+ new MessageCodeExperimenterKey(
+ version, type, Instruction.class, expId));
}
return deserializer.deserializeHeader(message);
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.StripVlanActionCase;
/**
- * Util class for injecting new action serializers into OpenflowJava
+ * Util class for injecting new action serializers into OpenflowJava.
*/
class ActionSerializerInjector {
/**
- * Injects serializers into provided {@link org.opendaylight.openflowjava.protocol.api.extensibility.SerializerExtensionProvider}
+ * Injects serializers into provided
+ * {@link org.opendaylight.openflowjava.protocol.api.extensibility.SerializerExtensionProvider}.
+ *
* @param provider OpenflowJava serializer extension provider
*/
static void injectSerializers(final SerializerExtensionProvider provider) {
}
/**
- * Create injector that will inject new serializers into #{@link org.opendaylight.openflowjava.protocol.api.extensibility.SerializerExtensionProvider}
+ * Create injector that will inject new serializers into
+ * #{@link org.opendaylight.openflowjava.protocol.api.extensibility.SerializerExtensionProvider}.
+ *
* @param provider OpenflowJava serializer extension provider
- * @param version Openflow version
+ * @param version Openflow version
* @return injector
*/
@VisibleForTesting
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.WriteMetadataCase;
/**
- * Util class for injecting new instruction serializers into OpenflowJava
+ * Util class for injecting new instruction serializers into OpenflowJava.
*/
class InstructionSerializerInjector {
/**
- * Injects serializers into provided {@link org.opendaylight.openflowjava.protocol.api.extensibility.SerializerExtensionProvider}
+ * Injects serializers into provided
+ * {@link org.opendaylight.openflowjava.protocol.api.extensibility.SerializerExtensionProvider}.
+ *
* @param provider OpenflowJava serializer extension provider
*/
static void injectSerializers(final SerializerExtensionProvider provider) {
}
/**
- * Create injector that will inject new serializers into #{@link org.opendaylight.openflowjava.protocol.api.extensibility.SerializerExtensionProvider}
+ * Create injector that will inject new serializers into
+ * #{@link org.opendaylight.openflowjava.protocol.api.extensibility.SerializerExtensionProvider}.
+ *
* @param provider OpenflowJava serializer extension provider
- * @param version Openflow version
+ * @param version Openflow version
* @return injector
*/
@VisibleForTesting
- static Function<Class<? extends Instruction>, Consumer<OFSerializer<? extends Instruction>>> createInjector(final SerializerExtensionProvider provider,
- final byte version) {
+ static Function<Class<? extends Instruction>, Consumer<OFSerializer<? extends Instruction>>> createInjector(
+ final SerializerExtensionProvider provider,
+ final byte version) {
return type -> serializer ->
provider.registerSerializer(
new MessageTypeKey<>(version, type),
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match;
/**
- * Util class for injecting new match serializers into OpenflowJava
+ * Util class for injecting new match serializers into OpenflowJava.
*/
class MatchSerializerInjector {
/**
- * Injects match serializers into provided {@link org.opendaylight.openflowjava.protocol.api.extensibility.SerializerExtensionProvider}
+ * Injects match serializers into provided
+ * {@link org.opendaylight.openflowjava.protocol.api.extensibility.SerializerExtensionProvider}.
+ *
* @param provider OpenflowJava serializer extension provider
*/
static void injectSerializers(final SerializerExtensionProvider provider) {
}
/**
- * Create injector that will inject new match entry serializers into #{@link org.opendaylight.openflowplugin.api.openflow.protocol.serialization.MatchEntrySerializerRegistry}
+ * Create injector that will inject new match entry serializers into
+ * #{@link org.opendaylight.openflowplugin.api.openflow.protocol.serialization.MatchEntrySerializerRegistry}.
+ *
* @param registry Match entry serializer registry
- * @param version Openflow version
+ * @param version Openflow version
* @return injector
*/
@VisibleForTesting
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
/**
- * Util class for injecting new message serializers into OpenflowJava
+ * Util class for injecting new message serializers into OpenflowJava.
*/
class MessageSerializerInjector {
/**
- * Injects message serializers into provided {@link org.opendaylight.openflowjava.protocol.api.extensibility.SerializerExtensionProvider}
+ * Injects message serializers into provided
+ * {@link org.opendaylight.openflowjava.protocol.api.extensibility.SerializerExtensionProvider}.
+ *
* @param provider OpenflowJava serializer extension provider
*/
static void injectSerializers(final SerializerExtensionProvider provider) {
}
/**
- * Create injector that will inject new serializers into #{@link org.opendaylight.openflowjava.protocol.api.extensibility.SerializerExtensionProvider}
+ * Create injector that will inject new serializers into
+ * #{@link org.opendaylight.openflowjava.protocol.api.extensibility.SerializerExtensionProvider}.
+ *
* @param provider OpenflowJava serializer extension provider
- * @param version Openflow version
+ * @param version Openflow version
* @return injector
*/
@VisibleForTesting
- static Function<Class<?>, Consumer<OFSerializer<? extends OfHeader>>> createInjector(final SerializerExtensionProvider provider,
- final byte version) {
+ static Function<Class<?>, Consumer<OFSerializer<? extends OfHeader>>> createInjector(
+ final SerializerExtensionProvider provider,
+ final byte version) {
return type -> serializer ->
provider.registerSerializer(
new MessageTypeKey<>(version, type),
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch;
/**
- * Util class for injecting new multipart match field serializers into OpenflowJava
+ * Util class for injecting new multipart match field serializers into OpenflowJava.
*/
class MultipartMatchFieldSerializerInjector {
/**
- * Injects multipart match field serializers into provided {@link org.opendaylight.openflowjava.protocol.api.extensibility.SerializerExtensionProvider}
+ * Injects multipart match field serializers into provided
+ * {@link org.opendaylight.openflowjava.protocol.api.extensibility.SerializerExtensionProvider}.
+ *
* @param provider OpenflowJava serializer extension provider
*/
static void injectSerializers(final SerializerExtensionProvider provider) {
// Inject new message serializers here using injector created by createInjector method
final Function<Class<? extends MatchField>, Consumer<OFSerializer<SetFieldMatch>>> injector =
- createInjector(provider, EncodeConstants.OF13_VERSION_ID);
+ createInjector(provider, EncodeConstants.OF13_VERSION_ID);
injector.apply(ArpOp.class).accept(new ArpOpMatchFieldSerializer());
injector.apply(ArpSha.class).accept(new ArpShaMatchFieldSerializer());
}
/**
- * Create injector that will inject new multipart match field features serializers into #{@link org.opendaylight.openflowjava.protocol.api.extensibility.SerializerExtensionProvider}
+ * Create injector that will inject new multipart match field features serializers into
+ * #{@link org.opendaylight.openflowjava.protocol.api.extensibility.SerializerExtensionProvider}.
+ *
* @param provider OpenflowJava serializer extension provider
- * @param version Openflow version
+ * @param version Openflow version
* @return injector
*/
@VisibleForTesting
static Function<Class<? extends MatchField>, Consumer<OFSerializer<SetFieldMatch>>> createInjector(
- final SerializerExtensionProvider provider,
- final byte version) {
+ final SerializerExtensionProvider provider,
+ final byte version) {
return type -> serializer ->
- provider.registerSerializer(
- new MessageTypeKey<>(version, type),
- serializer);
+ provider.registerSerializer(
+ new MessageTypeKey<>(version, type),
+ serializer);
}
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.multipart.request.multipart.request.body.MultipartRequestTableFeatures;
/**
- * Util class for injecting new multipart serializers into OpenflowJava
+ * Util class for injecting new multipart serializers into OpenflowJava.
*/
class MultipartSerializerInjector {
/**
- * Injects multipart serializers into provided {@link org.opendaylight.openflowjava.protocol.api.extensibility.SerializerExtensionProvider}
+ * Injects multipart serializers into provided
+ * {@link org.opendaylight.openflowjava.protocol.api.extensibility.SerializerExtensionProvider}.
+ *
* @param provider OpenflowJava serializer extension provider
*/
static void injectSerializers(final SerializerExtensionProvider provider) {
// Inject new message serializers here using injector created by createInjector method
final Function<Class<? extends MultipartRequestBody>, Consumer<OFSerializer<MultipartRequestBody>>> injector =
- createInjector(provider, EncodeConstants.OF13_VERSION_ID);
+ createInjector(provider, EncodeConstants.OF13_VERSION_ID);
MultipartMatchFieldSerializerInjector.injectSerializers(provider);
MultipartTableFeaturesSerializerInjector.injectSerializers(provider);
injector.apply(MultipartRequestPortStats.class).accept(new MultipartRequestPortStatsSerializer());
injector.apply(MultipartRequestQueueStats.class).accept(new MultipartRequestQueueStatsSerializer());
injector.apply(MultipartRequestFlowStats.class).accept(new MultipartRequestFlowStatsSerializer());
- injector.apply(MultipartRequestFlowAggregateStats.class).accept(new MultipartRequestFlowAggregateStatsSerializer());
+ injector.apply(MultipartRequestFlowAggregateStats.class)
+ .accept(new MultipartRequestFlowAggregateStatsSerializer());
injector.apply(MultipartRequestExperimenter.class).accept(new MultipartRequestExperimenterSerializer());
injector.apply(MultipartRequestTableFeatures.class).accept(new MultipartRequestTableFeaturesSerializer());
}
/**
- * Create injector that will inject new multipart serializers into #{@link org.opendaylight.openflowjava.protocol.api.extensibility.SerializerExtensionProvider}
+ * Create injector that will inject new multipart serializers into
+ * #{@link org.opendaylight.openflowjava.protocol.api.extensibility.SerializerExtensionProvider}.
+ *
* @param provider OpenflowJava serializer extension provider
- * @param version Openflow version
+ * @param version Openflow version
* @return injector
*/
@VisibleForTesting
static Function<Class<? extends MultipartRequestBody>, Consumer<OFSerializer<MultipartRequestBody>>> createInjector(
- final SerializerExtensionProvider provider,
- final byte version) {
+ final SerializerExtensionProvider provider,
+ final byte version) {
return type -> serializer ->
- provider.registerSerializer(
- new MessageTypeKey<>(version, type),
- serializer);
+ provider.registerSerializer(
+ new MessageTypeKey<>(version, type),
+ serializer);
}
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteSetfieldMiss;
/**
- * Util class for injecting new multipart table features serializers into OpenflowJava
+ * Util class for injecting new multipart table features serializers into OpenflowJava.
*/
class MultipartTableFeaturesSerializerInjector {
/**
- * Injects multipart table features serializers into provided {@link org.opendaylight.openflowjava.protocol.api.extensibility.SerializerExtensionProvider}
+ * Injects multipart table features serializers into provided
+ * {@link org.opendaylight.openflowjava.protocol.api.extensibility.SerializerExtensionProvider}.
+ *
* @param provider OpenflowJava serializer extension provider
*/
static void injectSerializers(final SerializerExtensionProvider provider) {
// Inject new message serializers here using injector created by createInjector method
final Function<Class<? extends TableFeaturePropType>, Consumer<OFSerializer<TableFeaturePropType>>> injector =
- createInjector(provider, EncodeConstants.OF13_VERSION_ID);
+ createInjector(provider, EncodeConstants.OF13_VERSION_ID);
injector.apply(Instructions.class).accept(new InstructionsTablePropertySerializer());
injector.apply(InstructionsMiss.class).accept(new InstructionsMissTablePropertySerializer());
}
/**
- * Create injector that will inject new multipart table features serializers into #{@link org.opendaylight.openflowjava.protocol.api.extensibility.SerializerExtensionProvider}
+ * Create injector that will inject new multipart table features serializers into
+ * #{@link org.opendaylight.openflowjava.protocol.api.extensibility.SerializerExtensionProvider}.
+ *
* @param provider OpenflowJava serializer extension provider
- * @param version Openflow version
+ * @param version Openflow version
* @return injector
*/
@VisibleForTesting
static Function<Class<? extends TableFeaturePropType>, Consumer<OFSerializer<TableFeaturePropType>>> createInjector(
- final SerializerExtensionProvider provider,
- final byte version) {
+ final SerializerExtensionProvider provider,
+ final byte version) {
return type -> serializer ->
- provider.registerSerializer(
- new MessageTypeKey<>(version, type),
- serializer);
+ provider.registerSerializer(
+ new MessageTypeKey<>(version, type),
+ serializer);
}
}
import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerExtensionProvider;
/**
- * Util class for injecting new serializers into OpenflowJava
+ * Util class for injecting new serializers into OpenflowJava.
*/
public class SerializerInjector {
/**
- * Injects serializers into provided {@link org.opendaylight.openflowjava.protocol.api.extensibility.SerializerExtensionProvider}
+ * Injects serializers into provided
+ * {@link org.opendaylight.openflowjava.protocol.api.extensibility.SerializerExtensionProvider}.
+ *
* @param provider OpenflowJava serializer extension provider
*/
public static void injectSerializers(final SerializerExtensionProvider provider) {
}
/**
+ * Get type.
+ *
* @return numeric representation of action type
*/
protected abstract int getType();
/**
+ * Get length.
+ *
* @return action length
*/
protected abstract int getLength();
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetFieldCase;
-public abstract class AbstractSetFieldActionSerializer extends AbstractActionSerializer implements SerializerRegistryInjector {
+public abstract class AbstractSetFieldActionSerializer extends AbstractActionSerializer implements
+ SerializerRegistryInjector {
- private SerializerRegistry registry;
+ private SerializerRegistry registry;
- @Override
- public void serialize(Action input, ByteBuf outBuffer) {
- final OFSerializer<Action> serializer = registry
+ @Override
+ public void serialize(Action input, ByteBuf outBuffer) {
+ final OFSerializer<Action> serializer = registry
.getSerializer(new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, SetFieldCase.class));
- serializer.serialize(buildAction(input), outBuffer);
- }
-
- /**
- * Build #{@link org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetFieldCase}
- * from #{@link org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action}
- * @param input input action
- * @return set field action
- */
- protected abstract SetFieldCase buildAction(Action input);
-
- @Override
- protected int getType() {
- return ActionConstants.SET_FIELD_CODE;
- }
-
- @Override
- protected int getLength() {
- return ActionConstants.GENERAL_ACTION_LENGTH;
- }
-
- @Override
- public void injectSerializerRegistry(SerializerRegistry serializerRegistry) {
- registry = serializerRegistry;
- }
+ serializer.serialize(buildAction(input), outBuffer);
+ }
+
+ /**
+ * Build #{@link org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetFieldCase}
+ * from #{@link org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action}.
+ *
+ * @param input input action
+ * @return set field action
+ */
+ protected abstract SetFieldCase buildAction(Action input);
+
+ @Override
+ protected int getType() {
+ return ActionConstants.SET_FIELD_CODE;
+ }
+
+ @Override
+ protected int getLength() {
+ return ActionConstants.GENERAL_ACTION_LENGTH;
+ }
+
+ @Override
+ public void injectSerializerRegistry(SerializerRegistry serializerRegistry) {
+ registry = serializerRegistry;
+ }
}
.setSetField(new SetFieldBuilder()
.setEthernetMatch(new EthernetMatchBuilder()
.setEthernetDestination(new EthernetDestinationBuilder()
- .setAddress(SetDlDstActionCase.class.cast(input).getSetDlDstAction().getAddress())
+ .setAddress(SetDlDstActionCase.class.cast(input).getSetDlDstAction()
+ .getAddress())
.build())
.build())
.build())
.setSetField(new SetFieldBuilder()
.setEthernetMatch(new EthernetMatchBuilder()
.setEthernetSource(new EthernetSourceBuilder()
- .setAddress(SetDlSrcActionCase.class.cast(input).getSetDlSrcAction().getAddress())
+ .setAddress(SetDlSrcActionCase.class.cast(input).getSetDlSrcAction()
+ .getAddress())
.build())
.build())
.build())
@Override
public void serialize(Action action, ByteBuf outBuffer) {
// Serialize field type and save position
- int startIndex = outBuffer.writerIndex();
+ final int startIndex = outBuffer.writerIndex();
outBuffer.writeShort(getType());
- int lengthIndex = outBuffer.writerIndex();
+ final int lengthIndex = outBuffer.writerIndex();
outBuffer.writeShort(EncodeConstants.EMPTY_LENGTH);
// Serialize match (using small workaround with serializeHeader method to serialize only match entries)
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv6MatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatchBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class SetTpDstActionSerializer extends AbstractSetFieldActionSerializer {
+ private static final Logger LOG = LoggerFactory.getLogger(SetTpDstActionSerializer.class);
@Override
protected SetFieldCase buildAction(Action input) {
.build());
break;
}
+ default:
+ // no operation
}
});
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv6MatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatchBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
public class SetTpSrcActionSerializer extends AbstractSetFieldActionSerializer {
+ private static final Logger LOG = LoggerFactory.getLogger(SetTpSrcActionSerializer.class);
@Override
protected SetFieldCase buildAction(Action input) {
.build());
break;
}
+ default:
+ // no operation
}
});
.setVlanMatch(new VlanMatchBuilder()
.setVlanId(new VlanIdBuilder()
.setVlanIdPresent(true)
- .setVlanId(SetVlanIdActionCase.class.cast(input).getSetVlanIdAction().getVlanId())
+ .setVlanId(SetVlanIdActionCase.class.cast(input).getSetVlanIdAction()
+ .getVlanId())
.build())
.build())
.build())
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.ActionList;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction;
-public abstract class AbstractActionInstructionSerializer extends AbstractInstructionSerializer implements SerializerRegistryInjector {
+public abstract class AbstractActionInstructionSerializer extends AbstractInstructionSerializer implements
+ SerializerRegistryInjector {
private SerializerRegistry registry;
}
/**
- * Try to write list of OpenFlowPlugin actions to output buffer
+ * Try to write list of OpenFlowPlugin actions to output buffer.
+ *
* @param actions List of OpenFlowPlugin actions
* @param outBuffer output buffer
* @param startIndex start index of byte buffer
*/
protected void writeActions(ActionList actions, short version, ByteBuf outBuffer, int startIndex) {
Optional.ofNullable(actions).flatMap(as -> Optional.ofNullable(as.getAction())).map(as -> {
- int lengthIndex = outBuffer.writerIndex();
+ final int lengthIndex = outBuffer.writerIndex();
outBuffer.writeShort(EncodeConstants.EMPTY_LENGTH);
outBuffer.writeZero(InstructionConstants.PADDING_IN_ACTIONS_INSTRUCTION);
as.stream().sorted(OrderComparator.build()).forEach(a -> ActionUtil
import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction;
-public abstract class AbstractInstructionSerializer implements OFSerializer<Instruction>, HeaderSerializer<Instruction> {
+public abstract class AbstractInstructionSerializer implements OFSerializer<Instruction>,
+ HeaderSerializer<Instruction> {
@Override
public void serialize(Instruction input, ByteBuf outBuffer) {
}
/**
- * @return numeric representation of instruction type
+ * Get type.
+ *
+ * @return numeric representation of instruction type.
*/
protected abstract int getType();
/**
- * @return instruction length
+ * Get length.
+ *
+ * @return instruction length.
*/
protected abstract int getLength();
super.serialize(input, outBuffer);
final WriteMetadata writeMetadata = WriteMetadataCase.class.cast(input).getWriteMetadata();
outBuffer.writeZero(InstructionConstants.PADDING_IN_WRITE_METADATA);
- outBuffer.writeBytes(ByteUtil.convertBigIntegerToNBytes(writeMetadata.getMetadata(), EncodeConstants.SIZE_OF_LONG_IN_BYTES));
- outBuffer.writeBytes(ByteUtil.convertBigIntegerToNBytes(writeMetadata.getMetadataMask(), EncodeConstants.SIZE_OF_LONG_IN_BYTES));
+ outBuffer.writeBytes(ByteUtil
+ .convertBigIntegerToNBytes(writeMetadata.getMetadata(), EncodeConstants.SIZE_OF_LONG_IN_BYTES));
+ outBuffer.writeBytes(ByteUtil
+ .convertBigIntegerToNBytes(writeMetadata.getMetadataMask(), EncodeConstants.SIZE_OF_LONG_IN_BYTES));
}
@Override
}
/**
+ * Get experimenter id.
+ *
* @return experimenter match entry id
*/
protected abstract long getExperimenterId();
}
/**
- * Serialize byte mask to bytes. checking for mask length
+ * Serialize byte mask to bytes. checking for mask length.
+ *
* @param mask byte mask
* @param outBuffer output buffer
* @param length mask length
*/
protected static void writeMask(byte[] mask, ByteBuf outBuffer, int length) {
if (mask != null && mask.length != length) {
- throw new IllegalArgumentException("incorrect length of mask: "+
- mask.length + ", expected: " + length);
+ throw new IllegalArgumentException("incorrect length of mask: "
+ + mask.length + ", expected: " + length);
}
outBuffer.writeBytes(mask);
}
/**
- * Serialize Ipv4 address to bytes
+ * Serialize Ipv4 address to bytes.
+ *
* @param address Ipv4 address
* @param outBuffer output buffer
*/
}
/**
- * Serialize Ipv6 address to bytes
+ * Serialize Ipv6 address to bytes.
+ *
* @param address Ipv6 address
* @param outBuffer output buffer
*/
}
/**
- * Serialize Mac address to bytes
+ * Serialize Mac address to bytes.
+ *
* @param address Mac address
* @param outBuffer output buffer
*/
}
/**
- * Serialize Ipv4 prefix (address and mask)
+ * Serialize Ipv4 prefix (address and mask).
+ *
* @param prefix Ipv4 prefix
* @param outBuffer output buffer
*/
}
/**
- * Serialize Ipv6 prefix (address and mask)
+ * Serialize Ipv6 prefix (address and mask).
+ *
* @param prefix Ipv6 prefix
* @param outBuffer output buffer
*/
}
/**
+ * Has mask getter.
+ *
* @param match Openflow match
* @return if field has or has not mask
*/
- protected abstract boolean getHasMask(final Match match);
+ protected abstract boolean getHasMask(Match match);
/**
+ * Oxm field numeric representation.
+ *
* @return numeric representation of oxm_field
*/
protected abstract int getOxmFieldCode();
/**
+ * Oxm class code.
+ *
* @return numeric representation of oxm_class
*/
protected abstract int getOxmClassCode();
/**
+ * Get value length.
+ *
* @return match entry value length (without mask length)
*/
protected abstract int getValueLength();
@Override
public boolean matchTypeCheck(Match match) {
- return Objects.nonNull(match.getLayer3Match()) &&
- ArpMatch.class.isInstance(match.getLayer3Match()) &&
- Objects.nonNull(ArpMatch.class.cast(match.getLayer3Match()).getArpOp());
+ return Objects.nonNull(match.getLayer3Match())
+ && ArpMatch.class.isInstance(match.getLayer3Match())
+ && Objects.nonNull(ArpMatch.class.cast(match.getLayer3Match()).getArpOp());
}
@Override
@Override
public boolean matchTypeCheck(Match match) {
- return Objects.nonNull(match.getLayer3Match()) &&
- ArpMatch.class.isInstance(match.getLayer3Match()) &&
- Objects.nonNull(ArpMatch.class.cast(match.getLayer3Match()).getArpSourceHardwareAddress());
+ return Objects.nonNull(match.getLayer3Match())
+ && ArpMatch.class.isInstance(match.getLayer3Match())
+ && Objects.nonNull(ArpMatch.class.cast(match.getLayer3Match()).getArpSourceHardwareAddress());
}
@Override
@Override
public boolean matchTypeCheck(Match match) {
- return Objects.nonNull(match.getLayer3Match()) &&
- ArpMatch.class.isInstance(match.getLayer3Match()) &&
- Objects.nonNull(ArpMatch.class.cast(match.getLayer3Match()).getArpSourceTransportAddress());
+ return Objects.nonNull(match.getLayer3Match())
+ && ArpMatch.class.isInstance(match.getLayer3Match())
+ && Objects.nonNull(ArpMatch.class.cast(match.getLayer3Match()).getArpSourceTransportAddress());
}
@Override
@Override
public boolean matchTypeCheck(Match match) {
- return Objects.nonNull(match.getLayer3Match()) &&
- ArpMatch.class.isInstance(match.getLayer3Match()) &&
- Objects.nonNull(ArpMatch.class.cast(match.getLayer3Match()).getArpTargetHardwareAddress());
+ return Objects.nonNull(match.getLayer3Match())
+ && ArpMatch.class.isInstance(match.getLayer3Match())
+ && Objects.nonNull(ArpMatch.class.cast(match.getLayer3Match()).getArpTargetHardwareAddress());
}
@Override
@Override
public boolean matchTypeCheck(Match match) {
- return Objects.nonNull(match.getLayer3Match()) &&
- ArpMatch.class.isInstance(match.getLayer3Match()) &&
- Objects.nonNull(ArpMatch.class.cast(match.getLayer3Match()).getArpTargetTransportAddress());
+ return Objects.nonNull(match.getLayer3Match())
+ && ArpMatch.class.isInstance(match.getLayer3Match())
+ && Objects.nonNull(ArpMatch.class.cast(match.getLayer3Match()).getArpTargetTransportAddress());
}
@Override
@Override
public boolean matchTypeCheck(Match match) {
- return Objects.nonNull(match.getEthernetMatch()) &&
- Objects.nonNull(match.getEthernetMatch().getEthernetDestination());
+ return Objects.nonNull(match.getEthernetMatch())
+ && Objects.nonNull(match.getEthernetMatch().getEthernetDestination());
}
@Override
@Override
public boolean matchTypeCheck(Match match) {
- return Objects.nonNull(match.getEthernetMatch()) &&
- Objects.nonNull(match.getEthernetMatch().getEthernetSource());
+ return Objects.nonNull(match.getEthernetMatch())
+ && Objects.nonNull(match.getEthernetMatch().getEthernetSource());
}
@Override
@Override
public boolean matchTypeCheck(Match match) {
- return Objects.nonNull(match.getEthernetMatch()) &&
- Objects.nonNull(match.getEthernetMatch().getEthernetType());
+ return Objects.nonNull(match.getEthernetMatch())
+ && Objects.nonNull(match.getEthernetMatch().getEthernetType());
}
@Override
@Override
public boolean matchTypeCheck(Match match) {
- return Objects.nonNull(match.getIcmpv4Match()) &&
- Objects.nonNull(match.getIcmpv4Match().getIcmpv4Code());
+ return Objects.nonNull(match.getIcmpv4Match())
+ && Objects.nonNull(match.getIcmpv4Match().getIcmpv4Code());
}
@Override
@Override
public boolean matchTypeCheck(Match match) {
- return Objects.nonNull(match.getIcmpv4Match()) &&
- Objects.nonNull(match.getIcmpv4Match().getIcmpv4Type());
+ return Objects.nonNull(match.getIcmpv4Match())
+ && Objects.nonNull(match.getIcmpv4Match().getIcmpv4Type());
}
@Override
@Override
public boolean matchTypeCheck(Match match) {
- return Objects.nonNull(match.getIcmpv6Match()) &&
- Objects.nonNull(match.getIcmpv6Match().getIcmpv6Code());
+ return Objects.nonNull(match.getIcmpv6Match())
+ && Objects.nonNull(match.getIcmpv6Match().getIcmpv6Code());
}
@Override
@Override
public boolean matchTypeCheck(Match match) {
- return Objects.nonNull(match.getIcmpv6Match()) &&
- Objects.nonNull(match.getIcmpv6Match().getIcmpv6Type());
+ return Objects.nonNull(match.getIcmpv6Match())
+ && Objects.nonNull(match.getIcmpv6Match().getIcmpv6Type());
}
@Override
@Override
public boolean matchTypeCheck(Match match) {
- return Objects.nonNull(match.getIpMatch()) &&
- Objects.nonNull(match.getIpMatch().getIpDscp());
+ return Objects.nonNull(match.getIpMatch())
+ && Objects.nonNull(match.getIpMatch().getIpDscp());
}
@Override
@Override
public boolean matchTypeCheck(Match match) {
- return Objects.nonNull(match.getIpMatch()) &&
- Objects.nonNull(match.getIpMatch().getIpEcn());
+ return Objects.nonNull(match.getIpMatch())
+ && Objects.nonNull(match.getIpMatch().getIpEcn());
}
@Override
@Override
public boolean matchTypeCheck(Match match) {
- return Objects.nonNull(match.getIpMatch()) &&
- Objects.nonNull(match.getIpMatch().getIpProtocol());
+ return Objects.nonNull(match.getIpMatch())
+ && Objects.nonNull(match.getIpMatch().getIpProtocol());
}
@Override
@Override
public boolean matchTypeCheck(Match match) {
if (isPrefix(match)) {
- return Objects.nonNull(match.getLayer3Match()) &&
- Objects.nonNull(Ipv4Match.class.cast(match.getLayer3Match()).getIpv4Destination());
+ return Objects.nonNull(match.getLayer3Match())
+ && Objects.nonNull(Ipv4Match.class.cast(match.getLayer3Match()).getIpv4Destination());
} else if (isArbitrary(match)) {
- return Objects.nonNull(match.getLayer3Match()) &&
- Objects.nonNull(Ipv4MatchArbitraryBitMask.class.cast(match.getLayer3Match()).getIpv4DestinationAddressNoMask());
+ return Objects.nonNull(match.getLayer3Match())
+ && Objects.nonNull(Ipv4MatchArbitraryBitMask.class.cast(match.getLayer3Match())
+ .getIpv4DestinationAddressNoMask());
}
return false;
@Override
public boolean matchTypeCheck(Match match) {
if (isPrefix(match)) {
- return Objects.nonNull(match.getLayer3Match()) &&
- Objects.nonNull(Ipv4Match.class.cast(match.getLayer3Match()).getIpv4Source());
+ return Objects.nonNull(match.getLayer3Match())
+ && Objects.nonNull(Ipv4Match.class.cast(match.getLayer3Match()).getIpv4Source());
} else if (isArbitrary(match)) {
- return Objects.nonNull(match.getLayer3Match()) &&
- Objects.nonNull(Ipv4MatchArbitraryBitMask.class.cast(match.getLayer3Match()).getIpv4SourceAddressNoMask());
+ return Objects.nonNull(match.getLayer3Match())
+ && Objects.nonNull(Ipv4MatchArbitraryBitMask.class.cast(match.getLayer3Match())
+ .getIpv4SourceAddressNoMask());
}
return false;
writeIpv6Address(ipv6.getIpv6DestinationAddressNoMask(), outBuffer);
if (getHasMask(match)) {
- writeMask(IpConversionUtil.convertIpv6ArbitraryMaskToByteArray(ipv6.getIpv6DestinationArbitraryBitmask()),
+ writeMask(IpConversionUtil
+ .convertIpv6ArbitraryMaskToByteArray(ipv6.getIpv6DestinationArbitraryBitmask()),
outBuffer,
getValueLength());
}
@Override
public boolean matchTypeCheck(Match match) {
if (isPrefix(match)) {
- return Objects.nonNull(match.getLayer3Match()) &&
- Objects.nonNull(Ipv6Match.class.cast(match.getLayer3Match()).getIpv6Destination());
+ return Objects.nonNull(match.getLayer3Match())
+ && Objects.nonNull(Ipv6Match.class.cast(match.getLayer3Match()).getIpv6Destination());
} else if (isArbitrary(match)) {
- return Objects.nonNull(match.getLayer3Match()) &&
- Objects.nonNull(Ipv6MatchArbitraryBitMask.class.cast(match.getLayer3Match()).getIpv6DestinationAddressNoMask());
+ return Objects.nonNull(match.getLayer3Match())
+ && Objects.nonNull(Ipv6MatchArbitraryBitMask.class.cast(match.getLayer3Match())
+ .getIpv6DestinationAddressNoMask());
}
return false;
@Override
protected boolean getHasMask(Match match) {
if (isPrefix(match)) {
- if (null != IpConversionUtil.hasIpv6Prefix(Ipv6Match.class.cast(match.getLayer3Match()).getIpv6Destination())) {
+ if (null != IpConversionUtil.hasIpv6Prefix(Ipv6Match.class.cast(match.getLayer3Match())
+ .getIpv6Destination())) {
return Objects.nonNull(IpConversionUtil
.extractIpv6Prefix(Ipv6Match.class.cast(match.getLayer3Match()).getIpv6Destination()));
}
} else if (isArbitrary(match)) {
- return Objects.nonNull(Ipv6MatchArbitraryBitMask.class.cast(match.getLayer3Match()).getIpv6DestinationArbitraryBitmask());
+ return Objects.nonNull(Ipv6MatchArbitraryBitMask.class.cast(match.getLayer3Match())
+ .getIpv6DestinationArbitraryBitmask());
}
return false;
@Override
public boolean matchTypeCheck(Match match) {
- return Objects.nonNull(match.getLayer3Match()) &&
- Ipv6Match.class.isInstance(match.getLayer3Match()) &&
- Objects.nonNull(Ipv6Match.class.cast(match.getLayer3Match()).getIpv6ExtHeader());
+ return Objects.nonNull(match.getLayer3Match())
+ && Ipv6Match.class.isInstance(match.getLayer3Match())
+ && Objects.nonNull(Ipv6Match.class.cast(match.getLayer3Match()).getIpv6ExtHeader());
}
@Override
@Override
public boolean matchTypeCheck(Match match) {
- return Objects.nonNull(match.getLayer3Match()) &&
- Ipv6Match.class.isInstance(match.getLayer3Match()) &&
- Objects.nonNull(Ipv6Match.class.cast(match.getLayer3Match()).getIpv6Label());
+ return Objects.nonNull(match.getLayer3Match())
+ && Ipv6Match.class.isInstance(match.getLayer3Match())
+ && Objects.nonNull(Ipv6Match.class.cast(match.getLayer3Match()).getIpv6Label());
}
@Override
@Override
public boolean matchTypeCheck(Match match) {
- return Objects.nonNull(match.getLayer3Match()) &&
- Ipv6Match.class.isInstance(match.getLayer3Match()) &&
- Objects.nonNull(Ipv6Match.class.cast(match.getLayer3Match()).getIpv6NdSll());
+ return Objects.nonNull(match.getLayer3Match())
+ && Ipv6Match.class.isInstance(match.getLayer3Match())
+ && Objects.nonNull(Ipv6Match.class.cast(match.getLayer3Match()).getIpv6NdSll());
}
@Override
@Override
public boolean matchTypeCheck(Match match) {
- return Objects.nonNull(match.getLayer3Match()) &&
- Ipv6Match.class.isInstance(match.getLayer3Match()) &&
- Objects.nonNull(Ipv6Match.class.cast(match.getLayer3Match()).getIpv6NdTarget());
+ return Objects.nonNull(match.getLayer3Match())
+ && Ipv6Match.class.isInstance(match.getLayer3Match())
+ && Objects.nonNull(Ipv6Match.class.cast(match.getLayer3Match()).getIpv6NdTarget());
}
@Override
@Override
public boolean matchTypeCheck(Match match) {
- return Objects.nonNull(match.getLayer3Match()) &&
- Ipv6Match.class.isInstance(match.getLayer3Match()) &&
- Objects.nonNull(Ipv6Match.class.cast(match.getLayer3Match()).getIpv6NdTll());
+ return Objects.nonNull(match.getLayer3Match())
+ && Ipv6Match.class.isInstance(match.getLayer3Match())
+ && Objects.nonNull(Ipv6Match.class.cast(match.getLayer3Match()).getIpv6NdTll());
}
@Override
@Override
public boolean matchTypeCheck(Match match) {
if (isPrefix(match)) {
- return Objects.nonNull(match.getLayer3Match()) &&
- Objects.nonNull(Ipv6Match.class.cast(match.getLayer3Match()).getIpv6Source());
+ return Objects.nonNull(match.getLayer3Match())
+ && Objects.nonNull(Ipv6Match.class.cast(match.getLayer3Match()).getIpv6Source());
} else if (isArbitrary(match)) {
- return Objects.nonNull(match.getLayer3Match()) &&
- Objects.nonNull(Ipv6MatchArbitraryBitMask.class.cast(match.getLayer3Match()).getIpv6SourceAddressNoMask());
+ return Objects.nonNull(match.getLayer3Match())
+ && Objects.nonNull(Ipv6MatchArbitraryBitMask.class.cast(match.getLayer3Match())
+ .getIpv6SourceAddressNoMask());
}
return false;
.extractIpv6Prefix(Ipv6Match.class.cast(match.getLayer3Match()).getIpv6Source()));
}
} else if (isArbitrary(match)) {
- return Objects.nonNull(Ipv6MatchArbitraryBitMask.class.cast(match.getLayer3Match()).getIpv6SourceArbitraryBitmask());
+ return Objects.nonNull(Ipv6MatchArbitraryBitMask.class.cast(match.getLayer3Match())
+ .getIpv6SourceArbitraryBitmask());
}
return false;
private final int oxmField;
/**
- * Create new instance of MatchEntrySerializerKeyImpl
+ * Create new instance of MatchEntrySerializerKeyImpl.
+ *
* @param version openflow version
* @param oxmClass match entry oxm class
* @param oxmField match entry field code
private static final Logger LOG = LoggerFactory.getLogger(MatchSerializer.class);
private static final byte OXM_MATCH_TYPE_CODE = 1;
- private final Map<org.opendaylight.openflowplugin.api.openflow.protocol.serialization.
- MatchEntrySerializerKey, MatchEntrySerializer> entryRegistry = new LinkedHashMap<>();
+ private final Map<org.opendaylight.openflowplugin.api.openflow.protocol.serialization.MatchEntrySerializerKey,
+ MatchEntrySerializer> entryRegistry = new LinkedHashMap<>();
private SerializerRegistry registry;
@Override
public void serialize(Match match, ByteBuf outBuffer) {
// Save start index in buffer
- int matchStartIndex = outBuffer.writerIndex();
+ final int matchStartIndex = outBuffer.writerIndex();
// With OpenflowPlugin models, we cannot check difference between OXM and Standard match type
// so all matches will be OXM
}
@Override
- public void registerEntrySerializer(org.opendaylight.openflowplugin.api.openflow.protocol.serialization.MatchEntrySerializerKey key, MatchEntrySerializer serializer) {
+ public void registerEntrySerializer(org.opendaylight.openflowplugin.api.openflow.protocol.serialization
+ .MatchEntrySerializerKey key, MatchEntrySerializer serializer) {
if (Objects.isNull(key) || Objects.isNull(serializer)) {
throw new IllegalArgumentException("MatchEntrySerializerKey or Serializer is null");
}
}
@Override
- public boolean unregisterEntrySerializer(org.opendaylight.openflowplugin.api.openflow.protocol.serialization.MatchEntrySerializerKey key) {
+ public boolean unregisterEntrySerializer(org.opendaylight.openflowplugin.api.openflow.protocol.serialization
+ .MatchEntrySerializerKey key) {
return Objects.nonNull(entryRegistry.remove(key));
}
}
@Override
public boolean matchTypeCheck(Match match) {
- return Objects.nonNull(match.getProtocolMatchFields()) &&
- Objects.nonNull(match.getProtocolMatchFields().getMplsBos());
+ return Objects.nonNull(match.getProtocolMatchFields())
+ && Objects.nonNull(match.getProtocolMatchFields().getMplsBos());
}
@Override
@Override
public boolean matchTypeCheck(Match match) {
- return Objects.nonNull(match.getProtocolMatchFields()) &&
- Objects.nonNull(match.getProtocolMatchFields().getMplsLabel());
+ return Objects.nonNull(match.getProtocolMatchFields())
+ && Objects.nonNull(match.getProtocolMatchFields().getMplsLabel());
}
@Override
@Override
public boolean matchTypeCheck(Match match) {
- return Objects.nonNull(match.getProtocolMatchFields()) &&
- Objects.nonNull(match.getProtocolMatchFields().getMplsTc());
+ return Objects.nonNull(match.getProtocolMatchFields())
+ && Objects.nonNull(match.getProtocolMatchFields().getMplsTc());
}
@Override
@Override
public boolean matchTypeCheck(Match match) {
- return Objects.nonNull(match.getProtocolMatchFields()) &&
- Objects.nonNull(match.getProtocolMatchFields().getPbb());
+ return Objects.nonNull(match.getProtocolMatchFields())
+ && Objects.nonNull(match.getProtocolMatchFields().getPbb());
}
@Override
@Override
public boolean matchTypeCheck(Match match) {
- return Objects.nonNull(match.getLayer4Match()) &&
- SctpMatch.class.isInstance(match.getLayer4Match()) &&
- Objects.nonNull(SctpMatch.class.cast(match.getLayer4Match()).getSctpDestinationPort());
+ return Objects.nonNull(match.getLayer4Match())
+ && SctpMatch.class.isInstance(match.getLayer4Match())
+ && Objects.nonNull(SctpMatch.class.cast(match.getLayer4Match()).getSctpDestinationPort());
}
@Override
@Override
public boolean matchTypeCheck(Match match) {
- return Objects.nonNull(match.getLayer4Match()) &&
- SctpMatch.class.isInstance(match.getLayer4Match()) &&
- Objects.nonNull(SctpMatch.class.cast(match.getLayer4Match()).getSctpSourcePort());
+ return Objects.nonNull(match.getLayer4Match())
+ && SctpMatch.class.isInstance(match.getLayer4Match())
+ && Objects.nonNull(SctpMatch.class.cast(match.getLayer4Match()).getSctpSourcePort());
}
@Override
@Override
public boolean matchTypeCheck(Match match) {
- return Objects.nonNull(match.getLayer4Match()) &&
- TcpMatch.class.isInstance(match.getLayer4Match()) &&
- Objects.nonNull(TcpMatch.class.cast(match.getLayer4Match()).getTcpDestinationPort());
+ return Objects.nonNull(match.getLayer4Match())
+ && TcpMatch.class.isInstance(match.getLayer4Match())
+ && Objects.nonNull(TcpMatch.class.cast(match.getLayer4Match()).getTcpDestinationPort());
}
@Override
@Override
public boolean matchTypeCheck(Match match) {
- return Objects.nonNull(match.getTcpFlagsMatch()) &&
- Objects.nonNull(match.getTcpFlagsMatch().getTcpFlags());
+ return Objects.nonNull(match.getTcpFlagsMatch())
+ && Objects.nonNull(match.getTcpFlagsMatch().getTcpFlags());
}
@Override
@Override
public boolean matchTypeCheck(Match match) {
- return Objects.nonNull(match.getLayer4Match()) &&
- TcpMatch.class.isInstance(match.getLayer4Match()) &&
- Objects.nonNull(TcpMatch.class.cast(match.getLayer4Match()).getTcpSourcePort());
+ return Objects.nonNull(match.getLayer4Match())
+ && TcpMatch.class.isInstance(match.getLayer4Match())
+ && Objects.nonNull(TcpMatch.class.cast(match.getLayer4Match()).getTcpSourcePort());
}
@Override
@Override
public boolean matchTypeCheck(Match match) {
- return Objects.nonNull(match.getTunnel()) &&
- Objects.nonNull(match.getTunnel().getTunnelId());
+ return Objects.nonNull(match.getTunnel())
+ && Objects.nonNull(match.getTunnel().getTunnelId());
}
@Override
@Override
public boolean matchTypeCheck(Match match) {
- return Objects.nonNull(match.getLayer3Match()) &&
- TunnelIpv4Match.class.isInstance(match.getLayer3Match()) &&
- Objects.nonNull(TunnelIpv4Match.class.cast(match.getLayer3Match()).getTunnelIpv4Destination());
+ return Objects.nonNull(match.getLayer3Match())
+ && TunnelIpv4Match.class.isInstance(match.getLayer3Match())
+ && Objects.nonNull(TunnelIpv4Match.class.cast(match.getLayer3Match()).getTunnelIpv4Destination());
}
@Override
@Override
public boolean matchTypeCheck(Match match) {
- return Objects.nonNull(match.getLayer3Match()) &&
- TunnelIpv4Match.class.isInstance(match.getLayer3Match()) &&
- Objects.nonNull(TunnelIpv4Match.class.cast(match.getLayer3Match()).getTunnelIpv4Source());
+ return Objects.nonNull(match.getLayer3Match())
+ && TunnelIpv4Match.class.isInstance(match.getLayer3Match())
+ && Objects.nonNull(TunnelIpv4Match.class.cast(match.getLayer3Match()).getTunnelIpv4Source());
}
@Override
@Override
public boolean matchTypeCheck(Match match) {
- return Objects.nonNull(match.getLayer4Match()) &&
- UdpMatch.class.isInstance(match.getLayer4Match()) &&
- Objects.nonNull(UdpMatch.class.cast(match.getLayer4Match()).getUdpDestinationPort());
+ return Objects.nonNull(match.getLayer4Match())
+ && UdpMatch.class.isInstance(match.getLayer4Match())
+ && Objects.nonNull(UdpMatch.class.cast(match.getLayer4Match()).getUdpDestinationPort());
}
@Override
@Override
public boolean matchTypeCheck(Match match) {
- return Objects.nonNull(match.getLayer4Match()) &&
- UdpMatch.class.isInstance(match.getLayer4Match()) &&
- Objects.nonNull(UdpMatch.class.cast(match.getLayer4Match()).getUdpSourcePort());
+ return Objects.nonNull(match.getLayer4Match())
+ && UdpMatch.class.isInstance(match.getLayer4Match())
+ && Objects.nonNull(UdpMatch.class.cast(match.getLayer4Match()).getUdpSourcePort());
}
@Override
@Override
public boolean matchTypeCheck(Match match) {
- return Objects.nonNull(match.getVlanMatch()) &&
- Objects.nonNull(match.getVlanMatch().getVlanPcp());
+ return Objects.nonNull(match.getVlanMatch())
+ && Objects.nonNull(match.getVlanMatch().getVlanPcp());
}
@Override
@Override
public boolean matchTypeCheck(Match match) {
- return Objects.nonNull(match.getVlanMatch()) &&
- Objects.nonNull(match.getVlanMatch().getVlanId());
+ return Objects.nonNull(match.getVlanMatch())
+ && Objects.nonNull(match.getVlanMatch().getVlanId());
}
@Override
protected boolean getHasMask(Match match) {
final VlanId vlanId = match.getVlanMatch().getVlanId();
- return Boolean.TRUE.equals(vlanId.isVlanIdPresent()) &&
- (Objects.isNull(vlanId.getVlanId()) || vlanId.getVlanId().getValue() == 0);
+ return Boolean.TRUE.equals(vlanId.isVlanIdPresent())
+ && (Objects.isNull(vlanId.getVlanId()) || vlanId.getVlanId().getValue() == 0);
}
@Override
}
/**
+ * Message type getter.
+ *
* @return of message type
*/
protected abstract byte getMessageType();
* Translates FlowMod messages.
* OF protocol versions: 1.3
*/
-public class FlowMessageSerializer extends AbstractMessageSerializer<FlowMessage> implements SerializerRegistryInjector {
+public class FlowMessageSerializer extends AbstractMessageSerializer<FlowMessage> implements
+ SerializerRegistryInjector {
private static final FlowCookie DEFAULT_COOKIE = new FlowCookie(OFConstants.DEFAULT_COOKIE);
private static final FlowCookie DEFAULT_COOKIE_MASK = new FlowCookie(OFConstants.DEFAULT_COOKIE_MASK);
private static final Short DEFAULT_TABLE_ID = (short) 0;
/**
* Serialize flow message. Needs to be separated from main serialize method to prevent recursion
- * when serializing SetVlanId flows
- * @param message flow message
+ * when serializing SetVlanId flows.
+ *
+ * @param message flow message
* @param outBuffer output buffer
*/
private void writeFlow(final FlowMessage message, final ByteBuf outBuffer) {
- int index = outBuffer.writerIndex();
+ final int index = outBuffer.writerIndex();
super.serialize(message, outBuffer);
outBuffer.writeLong(MoreObjects.firstNonNull(message.getCookie(), DEFAULT_COOKIE).getValue().longValue());
- outBuffer.writeLong(MoreObjects.firstNonNull(message.getCookieMask(), DEFAULT_COOKIE_MASK).getValue().longValue());
+ outBuffer.writeLong(MoreObjects.firstNonNull(message.getCookieMask(), DEFAULT_COOKIE_MASK).getValue()
+ .longValue());
outBuffer.writeByte(MoreObjects.firstNonNull(message.getTableId(), DEFAULT_TABLE_ID));
outBuffer.writeByte(message.getCommand().getIntValue());
outBuffer.writeShort(MoreObjects.firstNonNull(message.getIdleTimeout(), DEFAULT_IDLE_TIMEOUT));
/**
* Instead of serializing this flow normally, we need to split it to two parts if flow contains
- * #{@link org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanIdActionCase}
- * @param message flow mod message
+ * #{@link org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanIdActionCase}.
+ *
+ * @param message flow mod message
* @param outBuffer output buffer
*/
private void writeVlanFlow(final FlowMessage message, final ByteBuf outBuffer) {
writeFlow(
- new FlowMessageBuilder(message)
- .setMatch(new MatchBuilder(message.getMatch())
- .setVlanMatch(VLAN_MATCH_FALSE)
- .build())
- .setInstructions(new InstructionsBuilder()
- .setInstruction(updateSetVlanIdAction(message))
- .build())
- .build(),
- outBuffer);
+ new FlowMessageBuilder(message)
+ .setMatch(new MatchBuilder(message.getMatch())
+ .setVlanMatch(VLAN_MATCH_FALSE)
+ .build())
+ .setInstructions(new InstructionsBuilder()
+ .setInstruction(updateSetVlanIdAction(message))
+ .build())
+ .build(),
+ outBuffer);
writeFlow(
- new FlowMessageBuilder(message)
- .setMatch(new MatchBuilder(message.getMatch())
- .setVlanMatch(VLAN_MATCH_TRUE)
- .build())
- .build(),
- outBuffer);
+ new FlowMessageBuilder(message)
+ .setMatch(new MatchBuilder(message.getMatch())
+ .setVlanMatch(VLAN_MATCH_TRUE)
+ .build())
+ .build(),
+ outBuffer);
}
/**
- * Serialize OpenFlowPlugin match to raw bytes
- * @param message OpenFlow flow mod message
+ * Serialize OpenFlowPlugin match to raw bytes.
+ *
+ * @param message OpenFlow flow mod message
* @param outBuffer output buffer
*/
private void writeMatch(final FlowMessage message, final ByteBuf outBuffer) {
}
/**
- * Serialize OpenFlowPlugin instructions and set ip protocol of set-tp-src and set-tp-dst actions of need
- * @param message OpenFlow flow mod message
+ * Serialize OpenFlowPlugin instructions and set ip protocol of set-tp-src and set-tp-dst actions of need.
+ *
+ * @param message OpenFlow flow mod message
* @param outBuffer output buffer
*/
@SuppressWarnings("unchecked")
.stream()
.filter(Objects::nonNull)
.sorted(OrderComparator.build())
- .map(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.Instruction::getInstruction)
+ .map(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types
+ .rev131026.Instruction::getInstruction)
.filter(Objects::nonNull)
.map(i -> protocol.flatMap(p -> updateInstruction(i, p)).orElse(i))
- .forEach(i -> InstructionUtil.writeInstruction(i, EncodeConstants.OF13_VERSION_ID, registry, outBuffer)));
+ .forEach(i -> InstructionUtil.writeInstruction(i, EncodeConstants.OF13_VERSION_ID, registry,
+ outBuffer)));
}
/**
- * Determine type of instruction and update it's actions if it is apply-actions instruction
+ * Determine type of instruction and update it's actions if it is apply-actions instruction.
+ *
* @param instruction instruction
- * @param protocol protocol
+ * @param protocol protocol
* @return updated instruction or empty
*/
private static Optional<Instruction> updateInstruction(final Instruction instruction, final Short protocol) {
- if( ApplyActionsCase.class.isInstance(instruction)) {
+ if (ApplyActionsCase.class.isInstance(instruction)) {
return Optional
- .ofNullable(ApplyActionsCase.class.cast(instruction).getApplyActions())
- .flatMap(aa -> Optional.ofNullable(aa.getAction()))
- .map(as -> new ApplyActionsCaseBuilder()
- .setApplyActions(new ApplyActionsBuilder()
- .setAction(as
- .stream()
- .filter(Objects::nonNull)
- .map(a -> updateSetTpActions(a, protocol))
- .collect(Collectors.toList()))
- .build())
- .build());
+ .ofNullable(ApplyActionsCase.class.cast(instruction).getApplyActions())
+ .flatMap(aa -> Optional.ofNullable(aa.getAction()))
+ .map(as -> new ApplyActionsCaseBuilder()
+ .setApplyActions(new ApplyActionsBuilder()
+ .setAction(as
+ .stream()
+ .filter(Objects::nonNull)
+ .map(a -> updateSetTpActions(a, protocol))
+ .collect(Collectors.toList()))
+ .build())
+ .build());
}
return Optional.empty();
}
/**
- * If action is set-tp-src or set-tp-dst, inject IP protocol into it, otherwise return original action
- * @param action OpenFlow action
+ * If action is set-tp-src or set-tp-dst, inject IP protocol into it, otherwise return original action.
+ *
+ * @param action OpenFlow action
* @param protocol IP protocol
* @return updated OpenFlow action
*/
}
/**
- * Create copy of instructions of original flow but insert #{@link org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushVlanActionCase}
- * before each #{@link org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanIdActionCase}
+ * Create copy of instructions of original flow but insert
+ * #{@link org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushVlanActionCase}
+ * before each
+ * #{@link org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanIdActionCase}.
+ *
* @param message OpenFlowPlugin flow mod message
* @return list of instructions
*/
return message.getInstructions().getInstruction()
.stream()
.map(i -> {
- final int[] offset = { 0 };
+ final int[] offset = {0};
return ApplyActionsCase.class.isInstance(i.getInstruction())
? Optional
.map(a -> a.stream()
.sorted(OrderComparator.build())
.flatMap(action -> {
- final List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112
- .action.list.Action> actions = new ArrayList<>();
+ final List<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112
+ .action.list.Action> actions = new ArrayList<>();
- // If current action is SetVlanId, insert PushVlan action before it and update order
- if (SetVlanIdActionCase.class.isInstance(action.getAction())) {
- actions.add(new ActionBuilder()
- .setAction(new PushVlanActionCaseBuilder()
- .setPushVlanAction(new PushVlanActionBuilder()
- .setCfi(new VlanCfi(1))
- .setVlanId(SetVlanIdActionCase.class.cast(action.getAction()).getSetVlanIdAction().getVlanId())
- .setEthernetType(PUSH_VLAN)
- .setTag(PUSH_VLAN)
+ // If current action is SetVlanId, insert PushVlan action before it and
+ // update order
+ if (SetVlanIdActionCase.class.isInstance(action.getAction())) {
+ actions.add(new ActionBuilder()
+ .setAction(new PushVlanActionCaseBuilder()
+ .setPushVlanAction(new PushVlanActionBuilder()
+ .setCfi(new VlanCfi(1))
+ .setVlanId(SetVlanIdActionCase.class.cast(action
+ .getAction()).getSetVlanIdAction()
+ .getVlanId())
+ .setEthernetType(PUSH_VLAN)
+ .setTag(PUSH_VLAN)
+ .build())
.build())
- .build())
- .setKey(action.getKey())
- .setOrder(action.getOrder() + offset[0])
- .build());
+ .setKey(action.getKey())
+ .setOrder(action.getOrder() + offset[0])
+ .build());
- offset[0]++;
- }
+ offset[0]++;
+ }
- // Update offset of action if there is any inserted PushVlan actions
- actions.add(offset[0] > 0
- ? new ActionBuilder(action).setOrder(action.getOrder() + offset[0]).build()
- : action);
+ // Update offset of action if there is any inserted PushVlan actions
+ actions.add(offset[0] > 0
+ ? new ActionBuilder(action).setOrder(action.getOrder() + offset[0])
+ .build()
+ : action);
- return actions.stream();
- }))
+ return actions.stream();
+ }))
.map(as -> new InstructionBuilder(i)
.setInstruction(new ApplyActionsCaseBuilder()
.setApplyActions(new ApplyActionsBuilder()
}
/**
- * Create integer bit mask from #{@link org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowModFlags}
+ * Create integer bit mask from
+ * #{@link org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowModFlags}.
+ *
* @param flags flow mod flags
* @return bit mask
*/
}
/**
- * Determine if flow contains vlan match
+ * Determine if flow contains vlan match.
+ *
* @param flow flow
* @return true if flow contains vlan match
*/
private static boolean isVlanMatchPresent(final Flow flow) {
return Optional
- .ofNullable(flow.getMatch())
- .flatMap(m -> Optional.ofNullable(m.getVlanMatch()))
- .isPresent();
+ .ofNullable(flow.getMatch())
+ .flatMap(m -> Optional.ofNullable(m.getVlanMatch()))
+ .isPresent();
}
/**
- * Determine if flow contains #{@link org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCase}
- * instruction with #{@link org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanIdActionCase} action
+ * Determine if flow contains
+ * #{@link org.opendaylight.yang.gen.v1.urn.opendaylight
+ * .flow.types.rev131026.instruction.instruction.ApplyActionsCase} instruction with
+ * #{@link org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetVlanIdActionCase}
+ * action.
+ *
* @param flow OpenFlowPlugin flow
* @return true if flow contains SetVlanIdAction
*/
.flatMap(is -> Optional.ofNullable(is.getInstruction()))
.flatMap(is -> is
.stream()
- .map(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.Instruction::getInstruction)
+ .map(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types
+ .rev131026.Instruction::getInstruction)
.filter(ApplyActionsCase.class::isInstance)
.map(i -> ApplyActionsCase.class.cast(i).getApplyActions())
.filter(Objects::nonNull)
* Translates GroupMod messages.
* OF protocol versions: 1.3.
*/
-public class GroupMessageSerializer extends AbstractMessageSerializer<GroupMessage> implements SerializerRegistryInjector {
+public class GroupMessageSerializer extends AbstractMessageSerializer<GroupMessage> implements
+ SerializerRegistryInjector {
private static final byte PADDING_IN_GROUP_MOD_MESSAGE = 1;
private static final byte PADDING_IN_BUCKET = 4;
private static final Comparator<Bucket> COMPARATOR = (bucket1, bucket2) -> {
- if (bucket1.getBucketId() == null || bucket2.getBucketId() == null) return 0;
+ if (bucket1.getBucketId() == null || bucket2.getBucketId() == null) {
+ return 0;
+ }
return bucket1.getBucketId().getValue().compareTo(bucket2.getBucketId().getValue());
};
@Override
public void serialize(GroupMessage message, ByteBuf outBuffer) {
- int index = outBuffer.writerIndex();
+ final int index = outBuffer.writerIndex();
super.serialize(message, outBuffer);
outBuffer.writeShort(message.getCommand().getIntValue());
outBuffer.writeByte(message.getGroupType().getIntValue());
.ifPresent(b -> b.stream()
.sorted(COMPARATOR)
.forEach(bucket -> {
- int bucketIndex = outBuffer.writerIndex();
+ final int bucketIndex = outBuffer.writerIndex();
outBuffer.writeShort(EncodeConstants.EMPTY_LENGTH);
outBuffer.writeShort(MoreObjects.firstNonNull(bucket.getWeight(), 0));
- outBuffer.writeInt(MoreObjects.firstNonNull(bucket.getWatchPort(), OFConstants.OFPG_ANY).intValue());
- outBuffer.writeInt(MoreObjects.firstNonNull(bucket.getWatchGroup(), OFConstants.OFPG_ANY).intValue());
+ outBuffer.writeInt(MoreObjects.firstNonNull(bucket.getWatchPort(), OFConstants.OFPG_ANY)
+ .intValue());
+ outBuffer.writeInt(MoreObjects.firstNonNull(bucket.getWatchGroup(), OFConstants.OFPG_ANY)
+ .intValue());
outBuffer.writeZero(PADDING_IN_BUCKET);
Optional.ofNullable(bucket.getAction()).ifPresent(as -> as.forEach(a ->
* Translates MeterMod messages
* OF protocol versions: 1.3.
*/
-public class MeterMessageSerializer extends AbstractMessageSerializer<MeterMessage> implements SerializerRegistryInjector {
+public class MeterMessageSerializer extends AbstractMessageSerializer<MeterMessage> implements
+ SerializerRegistryInjector {
private static final Logger LOG = LoggerFactory.getLogger(MeterMessageSerializer.class);
private static final short LENGTH_OF_METER_BANDS = 16;
private static final short PADDING_IN_METER_BAND_DROP = 4;
@Override
public void serialize(final MeterMessage message, final ByteBuf outBuffer) {
- int index = outBuffer.writerIndex();
+ final int index = outBuffer.writerIndex();
super.serialize(message, outBuffer);
outBuffer.writeShort(message.getCommand().getIntValue());
outBuffer.writeShort(createMeterFlagsBitMask(
@Override
public void serialize(final PortMessage message, final ByteBuf outBuffer) {
- int index = outBuffer.writerIndex();
+ final int index = outBuffer.writerIndex();
super.serialize(message, outBuffer);
- outBuffer.writeInt(OpenflowPortsUtil.getProtocolPortNumber(OpenflowVersion.OF13, message.getPortNumber()).intValue());
+ outBuffer.writeInt(OpenflowPortsUtil
+ .getProtocolPortNumber(OpenflowVersion.OF13, message.getPortNumber()).intValue());
outBuffer.writeZero(PADDING_IN_PORT_MOD_MESSAGE_01);
outBuffer.writeBytes(IetfYangUtil.INSTANCE.bytesFor(message.getHardwareAddress()));
outBuffer.writeZero(PADDING_IN_PORT_MOD_MESSAGE_02);
outBuffer.writeInt(createPortConfigBitMask(message.getConfiguration()));
- outBuffer.writeInt(MoreObjects.firstNonNull(createPortConfigBitMask(message.getMask()), DEFAULT_PORT_CONFIG_MASK));
+ outBuffer.writeInt(MoreObjects
+ .firstNonNull(createPortConfigBitMask(message.getMask()), DEFAULT_PORT_CONFIG_MASK));
outBuffer.writeInt(createPortFeaturesBitMask(message.getAdvertisedFeatures()));
outBuffer.writeZero(PADDING_IN_PORT_MOD_MESSAGE_03);
outBuffer.setShort(index + 2, outBuffer.writerIndex() - index);
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.experimenter.types.rev151020.experimenter.core.message.ExperimenterMessageOfChoice;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.experimenter.types.rev151020.multipart.request.multipart.request.body.MultipartRequestExperimenter;
-public class MultipartRequestExperimenterSerializer implements OFSerializer<MultipartRequestBody>, SerializerRegistryInjector {
+public class MultipartRequestExperimenterSerializer implements OFSerializer<MultipartRequestBody>,
+ SerializerRegistryInjector {
private SerializerRegistry registry;
@SuppressWarnings("unchecked")
public void serialize(final MultipartRequestBody multipartRequestBody, final ByteBuf byteBuf) {
final MultipartRequestExperimenter multipartRequestExperimenter = MultipartRequestExperimenter
- .class
- .cast(multipartRequestBody);
+ .class
+ .cast(multipartRequestBody);
try {
final OFSerializer<ExperimenterMessageOfChoice> serializer = registry
- .getSerializer(new MessageTypeKey<>(
- EncodeConstants.OF13_VERSION_ID,
- multipartRequestExperimenter.getExperimenterMessageOfChoice().getImplementedInterface()));
+ .getSerializer(new MessageTypeKey<>(
+ EncodeConstants.OF13_VERSION_ID,
+ multipartRequestExperimenter.getExperimenterMessageOfChoice().getImplementedInterface()));
serializer.serialize(multipartRequestExperimenter.getExperimenterMessageOfChoice(), byteBuf);
} catch (ClassCastException | IllegalStateException ex) {
Optional
- .ofNullable(OFSessionUtil.getExtensionConvertorProvider().<ExperimenterMessageOfChoice, ExperimenterDataOfChoice>getMessageConverter(new TypeVersionKey<>(
- (Class<ExperimenterMessageOfChoice>)multipartRequestExperimenter.getExperimenterMessageOfChoice().getImplementedInterface(),
- OFConstants.OFP_VERSION_1_3)))
- .ifPresent(converter -> {
- final OFSerializer<ExperimenterDataOfChoice> serializer = registry
- .getSerializer(ExperimenterSerializerKeyFactory
- .createMultipartRequestSerializerKey(
- EncodeConstants.OF13_VERSION_ID,
- converter.getExperimenterId().getValue(),
- converter.getType()));
+ .ofNullable(OFSessionUtil.getExtensionConvertorProvider().<ExperimenterMessageOfChoice,
+ ExperimenterDataOfChoice>getMessageConverter(new TypeVersionKey<>(
+ (Class<ExperimenterMessageOfChoice>) multipartRequestExperimenter
+ .getExperimenterMessageOfChoice().getImplementedInterface(),
+ OFConstants.OFP_VERSION_1_3)))
+ .ifPresent(converter -> {
+ final OFSerializer<ExperimenterDataOfChoice> serializer = registry
+ .getSerializer(ExperimenterSerializerKeyFactory
+ .createMultipartRequestSerializerKey(
+ EncodeConstants.OF13_VERSION_ID,
+ converter.getExperimenterId().getValue(),
+ converter.getType()));
- try {
- serializer.serialize(converter.convert(multipartRequestExperimenter.getExperimenterMessageOfChoice()), byteBuf);
- } catch (ConversionException e) {
- throw new IllegalStateException(e);
- }
- });
+ try {
+ serializer.serialize(converter.convert(multipartRequestExperimenter
+ .getExperimenterMessageOfChoice()), byteBuf);
+ } catch (ConversionException e) {
+ throw new IllegalStateException(e);
+ }
+ });
}
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match;
import org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.multipart.request.MultipartRequestBody;
-public class MultipartRequestFlowAggregateStatsSerializer implements OFSerializer<MultipartRequestBody>, SerializerRegistryInjector {
+public class MultipartRequestFlowAggregateStatsSerializer implements OFSerializer<MultipartRequestBody>,
+ SerializerRegistryInjector {
private static final byte PADDING_IN_MULTIPART_REQUEST_FLOW_BODY_01 = 3;
private static final byte PADDING_IN_MULTIPART_REQUEST_FLOW_BODY_02 = 4;
@Override
public void serialize(final MultipartRequestBody multipartRequestBody, final ByteBuf byteBuf) {
final MultipartRequestFlowAggregateStats multipartRequestFlowAggregateStats = MultipartRequestFlowAggregateStats
- .class
- .cast(multipartRequestBody);
+ .class
+ .cast(multipartRequestBody);
- byteBuf.writeByte(MoreObjects.firstNonNull(multipartRequestFlowAggregateStats.getTableId(), OFConstants.OFPTT_ALL).byteValue());
+ byteBuf.writeByte(MoreObjects.firstNonNull(multipartRequestFlowAggregateStats.getTableId(),
+ OFConstants.OFPTT_ALL).byteValue());
byteBuf.writeZero(PADDING_IN_MULTIPART_REQUEST_FLOW_BODY_01);
- byteBuf.writeInt(MoreObjects.firstNonNull(multipartRequestFlowAggregateStats.getOutPort(), OFConstants.OFPP_ANY).intValue());
- byteBuf.writeInt(MoreObjects.firstNonNull(multipartRequestFlowAggregateStats.getOutGroup(), OFConstants.OFPG_ANY).intValue());
+ byteBuf.writeInt(MoreObjects.firstNonNull(multipartRequestFlowAggregateStats.getOutPort(),
+ OFConstants.OFPP_ANY).intValue());
+ byteBuf.writeInt(MoreObjects.firstNonNull(multipartRequestFlowAggregateStats.getOutGroup(),
+ OFConstants.OFPG_ANY).intValue());
byteBuf.writeZero(PADDING_IN_MULTIPART_REQUEST_FLOW_BODY_02);
- byteBuf.writeLong(MoreObjects.firstNonNull(multipartRequestFlowAggregateStats.getCookie(), new FlowCookie(OFConstants.DEFAULT_COOKIE)).getValue().longValue());
- byteBuf.writeLong(MoreObjects.firstNonNull(multipartRequestFlowAggregateStats.getCookieMask(), new FlowCookie(OFConstants.DEFAULT_COOKIE_MASK)).getValue().longValue());
+ byteBuf.writeLong(MoreObjects.firstNonNull(multipartRequestFlowAggregateStats.getCookie(),
+ new FlowCookie(OFConstants.DEFAULT_COOKIE)).getValue().longValue());
+ byteBuf.writeLong(MoreObjects.firstNonNull(multipartRequestFlowAggregateStats.getCookieMask(),
+ new FlowCookie(OFConstants.DEFAULT_COOKIE_MASK)).getValue().longValue());
registry.<Match, OFSerializer<Match>>getSerializer(
- new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, Match.class))
- .serialize(multipartRequestFlowAggregateStats.getMatch(), byteBuf);
+ new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, Match.class))
+ .serialize(multipartRequestFlowAggregateStats.getMatch(), byteBuf);
}
@Override
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match;
import org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.multipart.request.MultipartRequestBody;
-public class MultipartRequestFlowStatsSerializer implements OFSerializer<MultipartRequestBody>, SerializerRegistryInjector {
+public class MultipartRequestFlowStatsSerializer implements OFSerializer<MultipartRequestBody>,
+ SerializerRegistryInjector {
private static final byte PADDING_IN_MULTIPART_REQUEST_FLOW_BODY_01 = 3;
private static final byte PADDING_IN_MULTIPART_REQUEST_FLOW_BODY_02 = 4;
.class
.cast(multipartRequestBody);
- byteBuf.writeByte(MoreObjects.firstNonNull(multipartRequestFlowStats.getTableId(), OFConstants.OFPTT_ALL).byteValue());
+ byteBuf.writeByte(MoreObjects.firstNonNull(multipartRequestFlowStats.getTableId(),
+ OFConstants.OFPTT_ALL).byteValue());
byteBuf.writeZero(PADDING_IN_MULTIPART_REQUEST_FLOW_BODY_01);
- byteBuf.writeInt(MoreObjects.firstNonNull(multipartRequestFlowStats.getOutPort(), OFConstants.OFPP_ANY).intValue());
- byteBuf.writeInt(MoreObjects.firstNonNull(multipartRequestFlowStats.getOutGroup(), OFConstants.OFPG_ANY).intValue());
+ byteBuf.writeInt(MoreObjects.firstNonNull(multipartRequestFlowStats.getOutPort(),
+ OFConstants.OFPP_ANY).intValue());
+ byteBuf.writeInt(MoreObjects.firstNonNull(multipartRequestFlowStats.getOutGroup(),
+ OFConstants.OFPG_ANY).intValue());
byteBuf.writeZero(PADDING_IN_MULTIPART_REQUEST_FLOW_BODY_02);
- byteBuf.writeLong(MoreObjects.firstNonNull(multipartRequestFlowStats.getCookie(), new FlowCookie(OFConstants.DEFAULT_COOKIE)).getValue().longValue());
- byteBuf.writeLong(MoreObjects.firstNonNull(multipartRequestFlowStats.getCookieMask(), new FlowCookie(OFConstants.DEFAULT_COOKIE_MASK)).getValue().longValue());
+ byteBuf.writeLong(MoreObjects.firstNonNull(multipartRequestFlowStats.getCookie(),
+ new FlowCookie(OFConstants.DEFAULT_COOKIE)).getValue().longValue());
+ byteBuf.writeLong(MoreObjects.firstNonNull(multipartRequestFlowStats.getCookieMask(),
+ new FlowCookie(OFConstants.DEFAULT_COOKIE_MASK)).getValue().longValue());
registry.<Match, OFSerializer<Match>>getSerializer(
new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, Match.class))
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.multipart.request.multipart.request.body.MultipartRequestTableFeatures;
import org.opendaylight.yangtools.yang.binding.DataContainer;
-public class MultipartRequestMessageSerializer extends AbstractMessageSerializer<MultipartRequest> implements SerializerRegistryInjector {
+public class MultipartRequestMessageSerializer extends AbstractMessageSerializer<MultipartRequest> implements
+ SerializerRegistryInjector {
private static final byte PADDING_IN_MULTIPART_REQUEST_MESSAGE = 4;
private SerializerRegistry registry;
final MultipartRequestBody multipartRequestBody = message.getMultipartRequestBody();
final MultipartType multipartType = getMultipartType(multipartRequestBody);
- int index = outBuffer.writerIndex();
+ final int index = outBuffer.writerIndex();
super.serialize(message, outBuffer);
outBuffer.writeShort(multipartType.getIntValue());
outBuffer.writeShort(ByteBufUtils.fillBitMask(0, message.isRequestMore()));
.class
.cast(multipartRequestBody);
- byteBuf.writeInt(MoreObjects.firstNonNull(multipartRequestMeterConfig.getMeterId(), new MeterId(OFConstants.OFPM_ALL))
- .getValue().intValue());
+ byteBuf.writeInt(MoreObjects.firstNonNull(multipartRequestMeterConfig.getMeterId(),
+ new MeterId(OFConstants.OFPM_ALL)).getValue().intValue());
byteBuf.writeZero(PADDING_IN_MULTIPART_REQUEST_METER_CONFIG_BODY);
}
.cast(multipartRequestBody);
byteBuf.writeInt(MoreObjects
- .firstNonNull(multipartRequestMeterStats.getMeterId(), new MeterId(OFConstants.OFPM_ALL)).getValue().intValue());
+ .firstNonNull(multipartRequestMeterStats.getMeterId(), new MeterId(OFConstants.OFPM_ALL))
+ .getValue().intValue());
byteBuf.writeZero(PADDING_IN_MULTIPART_REQUEST_METER_BODY);
}
}
byteBuf.writeInt(MoreObjects
- .firstNonNull(multipartRequestQueueStats.getQueueId(), new QueueId(OFConstants.OFPQ_ALL)).getValue().intValue());
+ .firstNonNull(multipartRequestQueueStats.getQueueId(), new QueueId(OFConstants.OFPQ_ALL))
+ .getValue().intValue());
}
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.TableFeaturePropType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features.TableProperties;
-public class MultipartRequestTableFeaturesSerializer implements OFSerializer<MultipartRequestBody>, SerializerRegistryInjector {
+public class MultipartRequestTableFeaturesSerializer implements OFSerializer<MultipartRequestBody>,
+ SerializerRegistryInjector {
private static final byte PADDING_IN_MULTIPART_REQUEST_TABLE_FEATURES_BODY = 5;
private SerializerRegistry registry;
.getTableFeaturePropType()
.getImplementedInterface();
- registry.
- <TableFeaturePropType, OFSerializer<TableFeaturePropType>>getSerializer(
+ registry.<TableFeaturePropType, OFSerializer<TableFeaturePropType>>getSerializer(
new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, clazz))
.serialize(property.getTableFeaturePropType(), byteBuf);
}));
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableFeaturesPropType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.TableFeaturePropType;
-public abstract class AbstractTablePropertySerializer<T extends TableFeaturePropType> implements OFSerializer<TableFeaturePropType> {
+public abstract class AbstractTablePropertySerializer<T extends TableFeaturePropType> implements
+ OFSerializer<TableFeaturePropType> {
@Override
public void serialize(final TableFeaturePropType tableFeaturePropType, final ByteBuf byteBuf) {
byteBuf.writeZero(padding);
}
- protected abstract void serializeProperty(final T property, final ByteBuf byteBuf);
+ protected abstract void serializeProperty(T property, ByteBuf byteBuf);
+
protected abstract TableFeaturesPropType getType();
+
protected abstract Class<T> getClazz();
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableFeaturesPropType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplyActionsMiss;
-public class ApplyActionsMissTablePropertySerializer extends AbstractTablePropertySerializer<ApplyActionsMiss> implements SerializerRegistryInjector {
+public class ApplyActionsMissTablePropertySerializer extends
+ AbstractTablePropertySerializer<ApplyActionsMiss> implements SerializerRegistryInjector {
private SerializerRegistry registry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableFeaturesPropType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplyActions;
-public class ApplyActionsTablePropertySerializer extends AbstractTablePropertySerializer<ApplyActions> implements SerializerRegistryInjector {
+public class ApplyActionsTablePropertySerializer extends AbstractTablePropertySerializer<ApplyActions> implements
+ SerializerRegistryInjector {
private SerializerRegistry registry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplySetfieldMiss;
-public class ApplySetfieldMissTablePropertySerializer extends AbstractTablePropertySerializer<ApplySetfieldMiss> implements SerializerRegistryInjector {
+public class ApplySetfieldMissTablePropertySerializer extends
+ AbstractTablePropertySerializer<ApplySetfieldMiss> implements SerializerRegistryInjector {
private SerializerRegistry registry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplySetfield;
-public class ApplySetfieldTablePropertySerializer extends AbstractTablePropertySerializer<ApplySetfield> implements SerializerRegistryInjector {
+public class ApplySetfieldTablePropertySerializer extends AbstractTablePropertySerializer<ApplySetfield> implements
+ SerializerRegistryInjector {
private SerializerRegistry registry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableFeaturesPropType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.InstructionsMiss;
-public class InstructionsMissTablePropertySerializer extends AbstractTablePropertySerializer<InstructionsMiss> implements SerializerRegistryInjector {
+public class InstructionsMissTablePropertySerializer extends
+ AbstractTablePropertySerializer<InstructionsMiss> implements SerializerRegistryInjector {
private SerializerRegistry registry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableFeaturesPropType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.Instructions;
-public class InstructionsTablePropertySerializer extends AbstractTablePropertySerializer<Instructions> implements SerializerRegistryInjector {
+public class InstructionsTablePropertySerializer extends AbstractTablePropertySerializer<Instructions> implements
+ SerializerRegistryInjector {
private SerializerRegistry registry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.Match;
-public class MatchTablePropertySerializer extends AbstractTablePropertySerializer<Match> implements SerializerRegistryInjector {
+public class MatchTablePropertySerializer extends AbstractTablePropertySerializer<Match> implements
+ SerializerRegistryInjector {
private SerializerRegistry registry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.Wildcards;
-public class WildcardsTablePropertySerializer extends AbstractTablePropertySerializer<Wildcards> implements SerializerRegistryInjector {
+public class WildcardsTablePropertySerializer extends AbstractTablePropertySerializer<Wildcards> implements
+ SerializerRegistryInjector {
private SerializerRegistry registry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableFeaturesPropType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteActionsMiss;
-public class WriteActionsMissTablePropertySerializer extends AbstractTablePropertySerializer<WriteActionsMiss> implements SerializerRegistryInjector {
+public class WriteActionsMissTablePropertySerializer extends
+ AbstractTablePropertySerializer<WriteActionsMiss> implements SerializerRegistryInjector {
private SerializerRegistry registry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableFeaturesPropType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteActions;
-public class WriteActionsTablePropertySerializer extends AbstractTablePropertySerializer<WriteActions> implements SerializerRegistryInjector {
+public class WriteActionsTablePropertySerializer extends AbstractTablePropertySerializer<WriteActions> implements
+ SerializerRegistryInjector {
private SerializerRegistry registry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteSetfieldMiss;
-public class WriteSetfieldMissTablePropertySerializer extends AbstractTablePropertySerializer<WriteSetfieldMiss> implements SerializerRegistryInjector {
+public class WriteSetfieldMissTablePropertySerializer extends
+ AbstractTablePropertySerializer<WriteSetfieldMiss> implements SerializerRegistryInjector {
private SerializerRegistry registry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteSetfield;
-public class WriteSetfieldTablePropertySerializer extends AbstractTablePropertySerializer<WriteSetfield> implements SerializerRegistryInjector {
+public class WriteSetfieldTablePropertySerializer extends AbstractTablePropertySerializer<WriteSetfield> implements
+ SerializerRegistryInjector {
private SerializerRegistry registry;
}
protected abstract int getOxmClassCode();
+
protected abstract int getOxmFieldCode();
+
protected abstract int getValueLength();
}
import org.slf4j.LoggerFactory;
/**
- * Utility class for action serialization
+ * Utility class for action serialization.
*/
public class ActionUtil {
private static final Logger LOG = LoggerFactory.getLogger(ActionUtil.class);
/**
- * Serialize OpenFlow action, using extension converter if available
+ * Serialize OpenFlow action, using extension converter if available.
* TODO: Remove also extension converters
*
* @param action OpenFlowPlugin action
public static void writeAction(Action action, short version, SerializerRegistry registry, ByteBuf outBuffer) {
try {
Optional.ofNullable(OFSessionUtil.getExtensionConvertorProvider())
- .flatMap(provider ->
- (GeneralExtensionGrouping.class.isInstance(action)
- ? convertExtensionGrouping(provider, action, version)
- : convertGenericAction(provider, action, version))
- .map(ofjAction -> {
- final OFSerializer<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common
- .action.rev150203.actions.grouping.Action> serializer = registry
- .getSerializer(TypeKeyMakerFactory.createActionKeyMaker(version)
- .make(ofjAction));
-
- serializer.serialize(ofjAction, outBuffer);
- return action;
- })
- ).orElseGet(() -> {
- final OFSerializer<Action> serializer = registry.getSerializer(
- new MessageTypeKey<>(
- version, (Class<? extends Action>) action.getImplementedInterface()));
-
- serializer.serialize(action, outBuffer);
- return action;
- });
+ .flatMap(provider ->
+ (GeneralExtensionGrouping.class.isInstance(action)
+ ? convertExtensionGrouping(provider, action, version)
+ : convertGenericAction(provider, action, version))
+ .map(ofjAction -> {
+ final OFSerializer<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common
+ .action.rev150203.actions.grouping.Action> serializer = registry
+ .getSerializer(TypeKeyMakerFactory.createActionKeyMaker(version)
+ .make(ofjAction));
+
+ serializer.serialize(ofjAction, outBuffer);
+ return action;
+ })
+ ).orElseGet(() -> {
+ final OFSerializer<Action> serializer = registry.getSerializer(
+ new MessageTypeKey<>(
+ version, (Class<? extends Action>) action.getImplementedInterface()));
+
+ serializer.serialize(action, outBuffer);
+ return action;
+ });
} catch (final IllegalStateException | ClassCastException e) {
LOG.warn("Serializer for action {} for version {} not found.", action.getImplementedInterface(), version);
}
}
/**
- * Serialize OpenFlow action header, using extension converter if available
+ * Serialize OpenFlow action header, using extension converter if available.
* TODO: Remove also extension converters
*
* @param action OpenFlowPlugin action
public static void writeActionHeader(Action action, short version, SerializerRegistry registry, ByteBuf outBuffer) {
try {
Optional.ofNullable(OFSessionUtil.getExtensionConvertorProvider())
- .flatMap(provider ->
- (GeneralExtensionGrouping.class.isInstance(action)
- ? convertExtensionGrouping(provider, action, version)
- : convertGenericAction(provider, action, version))
- .map(ofjAction -> {
- final HeaderSerializer<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common
- .action.rev150203.actions.grouping.Action> serializer = registry
- .getSerializer(TypeKeyMakerFactory.createActionKeyMaker(version)
- .make(ofjAction));
-
- serializer.serializeHeader(ofjAction, outBuffer);
- return action;
- })
- ).orElseGet(() -> {
- final HeaderSerializer<Action> serializer = registry.getSerializer(
- new MessageTypeKey<>(
- version, (Class<? extends Action>) action.getImplementedInterface()));
-
- serializer.serializeHeader(action, outBuffer);
- return action;
- });
+ .flatMap(provider ->
+ (GeneralExtensionGrouping.class.isInstance(action)
+ ? convertExtensionGrouping(provider, action, version)
+ : convertGenericAction(provider, action, version))
+ .map(ofjAction -> {
+ final HeaderSerializer<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow
+ .common
+ .action.rev150203.actions.grouping.Action> serializer = registry
+ .getSerializer(TypeKeyMakerFactory.createActionKeyMaker(version)
+ .make(ofjAction));
+
+ serializer.serializeHeader(ofjAction, outBuffer);
+ return action;
+ })
+ ).orElseGet(() -> {
+ final HeaderSerializer<Action> serializer = registry.getSerializer(
+ new MessageTypeKey<>(
+ version, (Class<? extends Action>) action.getImplementedInterface()));
+
+ serializer.serializeHeader(action, outBuffer);
+ return action;
+ });
} catch (final IllegalStateException | ClassCastException e) {
- LOG.warn("Header Serializer for action {} for version {} not found.", action.getImplementedInterface(), version);
+ LOG.warn("Header Serializer for action {} for version {} not found.", action.getImplementedInterface(),
+ version);
}
}
/**
- * Try to convert action that implements #{@link org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.GeneralExtensionGrouping}
+ * Try to convert action that implements
+ * #{@link org.opendaylight.yang.gen.v1.urn
+ * .opendaylight.openflowplugin.extension.general.rev140714.GeneralExtensionGrouping}.
* to OpenFlowJava action
*
* @param provider extension converter provider
- * @param action OpenFlowPlugin action
- * @param version OpenFlow version
+ * @param action OpenFlowPlugin action
+ * @param version OpenFlow version
* @return optional OpenFlowJava action
*/
private static Optional<org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions
}
/**
- * Try to convert generic OpenFlowPlugin action to OpenFlowJava action
+ * Try to convert generic OpenFlowPlugin action to OpenFlowJava action.
*
* @param provider extension converter provider
- * @param action OpenFlowPlugin action
- * @param version OpenFlow version
+ * @param action OpenFlowPlugin action
+ * @param version OpenFlow version
* @return optional OpenFlowJava action
*/
@SuppressWarnings("unchecked")
package org.opendaylight.openflowplugin.impl.protocol.serialization.util;
-
import io.netty.buffer.ByteBuf;
import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderSerializer;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction;
/**
- * Utility class for instruction serialization
+ * Utility class for instruction serialization.
*/
public class InstructionUtil {
/**
- * Serialize instruction
+ * Serialize instruction.
+ *
* @param instruction OpenFlow instruction
* @param version OpenFlow version
* @param registry OpenFlowJava serializer registry
/**
- * Serialize instruction header
+ * Serialize instruction header.
+ *
* @param instruction OpenFlow instruction
* @param version OpenFlow version
* @param registry OpenFlowJava serializer registry
deviceRegistry.getDeviceGroupRegistry());
break;
default:
- LOG.warn("Unsupported type {}", getMultipartType());
+ // no operation
}
}
deviceRegistry.getDeviceGroupRegistry().processMarks();
break;
default:
- LOG.warn("Unsupported type {}", getMultipartType());
+ // no operation
}
}