description "Initial revision of experimenter basic types";
}
-
grouping experimenter-core-message {
choice experimenter-message-of-choice {
// to be augmented by vendors
}
}
+ augment "/multipart:multipart-request/multipart:multipart-request-body" {
+ case multipart-request-experimenter {
+ uses experimenter-core-message;
+ }
+ }
}
import opendaylight-meter-types {prefix meter; revision-date "2013-09-18";}
import openflow-protocol { prefix ofproto; revision-date "2013-07-31"; }
import openflow-types { prefix oft; revision-date "2013-07-31"; }
+ import opendaylight-multipart-types { prefix multipart; revision-date "2017-01-12"; }
revision "2013-10-26" {
description "Initial revision of flow service";
}
-
+
typedef flow-ref {
type instance-identifier;
}
-
+
typedef flow-cookie {
description "openflow specific type - flow cookie / flow cookie mask";
type uint64;
}
-
+
typedef output-port-values {
type enumeration {
enum MAX {
}
}
}
-
+
case write-metadata-case {
container write-metadata {
leaf metadata {
type uint64;
}
-
+
leaf metadata-mask {
type uint64;
}
}
}
-
+
case write-actions-case {
container write-actions {
uses action:action-list;
}
}
-
+
case apply-actions-case {
container apply-actions {
uses action:action-list;
}
}
-
+
case clear-actions-case {
container clear-actions {
uses action:action-list;
}
}
-
+
case meter-case {
container meter {
leaf meter-id {
type meter:meter-id;
- }
+ }
}
}
}
}
-
+
typedef flow-mod-flags {
type bits {
bit CHECK_OVERLAP;
}
}
-
+
grouping generic_flow_attributes {
leaf priority {
type uint16;
}
-
+
leaf idle-timeout {
type uint16;
}
-
+
leaf hard-timeout {
type uint16;
}
-
+
leaf cookie {
type flow-cookie;
}
-
+
leaf table_id {
type uint8;
}
}
-
+
grouping flow {
container match {
uses match:match;
}
-
+
container instructions {
uses instruction-list;
- }
-
+ }
+
uses generic_flow_attributes;
-
+
leaf container-name {
- type string;
+ type string;
}
-
+
leaf cookie_mask {
type flow-cookie;
}
-
+
leaf buffer_id {
type uint32;
}
-
+
leaf out_port {
type uint64;
}
-
+
leaf out_group {
type uint32;
}
-
+
leaf flags {
type flow-mod-flags;
}
-
+
leaf flow-name {
type string;
}
-
+
leaf installHw {
type boolean;
}
grouping flow-table-statistics {
leaf active {
type yang:counter64;
- }
+ }
leaf lookup {
type yang:counter64;
}
leaf matched {
- type yang:counter64;
+ type yang:counter64;
}
}
-
+
grouping flow-mod-removed {
uses generic_flow_attributes;
-
+
leaf removed_reason {
type removed-flow-reason;
}
leaf duration_nsec {
type uint32;
}
-
+
leaf duration_sec {
type uint32;
}
leaf byte_count {
type uint64;
}
-
+
container match {
uses match:match;
}
type oft:flow-mod-command;
}
}
+
+ augment "/multipart:multipart-request/multipart:multipart-request-body" {
+ case multipart-request-flow-stats {
+ uses flow;
+ }
+ case multipart-request-flow-aggregate-stats {
+ uses flow;
+ }
+ }
}
description "Initial revision";
}
- container multipart-reply {
+ grouping multipart-header {
uses ofproto:ofHeader;
leaf request-more {
type boolean;
default false;
}
+ }
+
+ container multipart-reply {
+ uses multipart-header;
choice multipart-reply-body {
}
}
+
+ container multipart-request {
+ uses multipart-header;
+
+ choice multipart-request-body {
+ }
+ }
}
}
}
}
+
+
+ augment "/multipart:multipart-request/multipart:multipart-request-body" {
+ case multipart-request-port-desc {
+ // Empty case
+ }
+ }
}
import opendaylight-flow-types {prefix flow;revision-date "2013-10-26";}
import opendaylight-action-types {prefix action;}
+ import opendaylight-multipart-types { prefix multipart; revision-date "2017-01-12"; }
revision "2013-10-26" {
description "Initial revision of table service";
typedef table-ref {
type instance-identifier;
}
-
+
typedef table-config {
type bits {
bit DEPRECATED-MASK;
}
leaf has-mask {
type boolean;
- }
+ }
}
}
-
+
grouping table-feature-prop-type {
choice table-feature-prop-type {
- case instructions {
+ case instructions {
container instructions {
uses flow:instruction-list;
- }
+ }
}
-
- case instructions-miss {
+
+ case instructions-miss {
container instructions-miss {
uses flow:instruction-list;
- }
+ }
}
- case next-table {
+ case next-table {
container tables {
leaf-list table-ids {
type uint8;
}
- }
+ }
}
-
- case next-table-miss {
+
+ case next-table-miss {
container tables-miss {
leaf-list table-ids {
type uint8;
}
- }
+ }
}
-
- case write-actions {
+
+ case write-actions {
container write-actions {
uses action:action-list;
- }
+ }
}
-
- case write-actions-miss {
+
+ case write-actions-miss {
container write-actions-miss {
uses action:action-list;
- }
+ }
}
-
- case apply-actions {
+
+ case apply-actions {
container apply-actions {
uses action:action-list;
- }
+ }
}
-
- case apply-actions-miss {
+
+ case apply-actions-miss {
container apply-actions-miss {
uses action:action-list;
- }
+ }
}
-
+
case match {
container match-setfield {
- uses set-field-match;
+ uses set-field-match;
}
}
-
- case wildcards {
+
+ case wildcards {
container wildcard-setfield {
uses set-field-match;
}
}
-
- case write-setfield {
+
+ case write-setfield {
container write-setfield {
uses set-field-match;
}
}
-
- case write-setfield-miss {
+
+ case write-setfield-miss {
container write-setfield-miss {
uses set-field-match;
}
}
-
- case apply-setfield {
+
+ case apply-setfield {
container apply-setfield {
- uses set-field-match;
+ uses set-field-match;
}
}
-
- case apply-setfield-miss {
+
+ case apply-setfield-miss {
container apply-setfield-miss {
- uses set-field-match;
+ uses set-field-match;
}
}
}
- }
-
+ }
+
grouping table-features {
list table-features {
key "table-id";
-
+
leaf table-id {
type uint8;
- }
-
+ }
+
leaf name {
description "Name of the table";
- type string;
+ type string;
}
-
+
leaf metadata-match {
description "Bits of metadata table can match";
- type uint64;
+ type uint64;
}
-
+
leaf metadata-write {
description "Bits of metadata table can write";
- type uint64;
+ type uint64;
}
-
+
leaf max-entries {
description "Max number of entries supported";
- type uint32;
+ type uint32;
}
-
+
leaf config {
description "Bitmap of OFPTC_ values";
type table-config;
}
-
+
container table-properties {
list table-feature-properties {
key "order";
}
}
}
- }
+ }
+
+ augment "/multipart:multipart-reply/multipart:multipart-reply-body" {
+ case multipart-reply-table-features {
+ uses table-features;
+ }
+ }
+
+ augment "/multipart:multipart-request/multipart:multipart-request-body" {
+ case multipart-request-table-features {
+ uses table-features;
+ }
+ }
}
uses desc;
}
}
+
+ augment "/multipart:multipart-request/multipart:multipart-request-body" {
+ case multipart-request-desc {
+ // Empty request case
+ }
+ }
}
import opendaylight-inventory {prefix inv;revision-date "2013-08-19";}
import opendaylight-table-types {prefix table-type;revision-date "2013-10-26";}
import flow-capable-transaction {prefix tr; revision-date "2015-03-04";}
- import opendaylight-multipart-types { prefix multipart; revision-date "2017-01-12"; }
description "Openflow table management.";
revision "2013-10-26" {
description "Initial revision of table service";
}
-
+
grouping table-update {
description "Openflow table configuration structure suitable for rpc (contains node-context-ref)";
uses table-type:table-features;
}
}
-
+
rpc update-table {
description "Configuring openflow table.";
-
+
input {
uses tr:transaction-metadata;
leaf table-ref {
uses tr:transaction-aware;
}
}
-
+
notification table-updated {
status deprecated;
uses tr:multipart-transaction-aware;
uses table-type:table-features;
}
-
-
- augment "/multipart:multipart-reply/multipart:multipart-reply-body" {
- case multipart-reply-table-features {
- uses table-type:table-features;
- }
- }
}
uses flow-table-and-statistics-map;
}
}
+
+ augment "/multipart:multipart-request/multipart:multipart-request-body" {
+ case multipart-request-flow-table-stats {
+ // Empty request case
+ }
+ }
}
uses group-types:group-features-reply;
}
}
+
+ augment "/multipart:multipart-request/multipart:multipart-request-body" {
+ case multipart-request-group-desc {
+ // Empty request case
+ }
+ case multipart-request-group-features {
+ // Empty request case
+ }
+ case multipart-request-group-stats {
+ leaf group-id {
+ type group-types:group-id;
+ }
+ }
+ }
}
uses meter-types:meter-features-reply;
}
}
+
+ augment "/multipart:multipart-request/multipart:multipart-request-body" {
+ case multipart-request-meter-config {
+ leaf meter-id {
+ type meter-types:meter-id;
+ }
+ }
+ case multipart-request-meter-features {
+ // Empty request case
+ }
+ case multipart-request-meter-stats {
+ leaf meter-id {
+ type meter-types:meter-id;
+ }
+ }
+ }
}
uses node-connector-statistics-and-port-number-map;
}
}
+
+ augment "/multipart:multipart-request/multipart:multipart-request-body" {
+ case multipart-request-port-stats {
+ leaf node-connector-id {
+ type inv:node-connector-id;
+ }
+ }
+ }
}
uses queue-id-and-statistics-map;
}
}
+
+ augment "/multipart:multipart-request/multipart:multipart-request-body" {
+ case multipart-request-queue-stats {
+ leaf queue-id {
+ type queue-types:queue-id;
+ }
+
+ leaf node-connector-id {
+ type inv:node-connector-id;
+ }
+ }
+ }
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.multipart.reply.multipart.reply.body.MultipartReplyQueueStatsBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.queue.id.and.statistics.map.QueueIdAndStatisticsMap;
import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.queue.id.and.statistics.map.QueueIdAndStatisticsMapBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.multipart.reply.multipart.reply.body.MultipartReplyTableFeaturesBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.multipart.reply.multipart.reply.body.MultipartReplyTableFeaturesBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
.build();
}
- private static org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.multipart.reply.multipart.reply.body
+ private static org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.multipart.reply.multipart.reply.body
.MultipartReplyTableFeatures translateTableFeatures(final MultipartReply msg,
final short version,
final ConvertorExecutor convertorExecutor) {
import com.google.common.annotations.VisibleForTesting;
-public class ActionDeserializerInjector {
+class ActionDeserializerInjector {
/**
* Injects action deserializers into provided {@link org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerExtensionProvider}
import com.google.common.annotations.VisibleForTesting;
-public class InstructionDeserializerInjector {
+class InstructionDeserializerInjector {
/**
* Injects instruction deserializers into provided {@link org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerExtensionProvider}
import java.util.function.Function;
import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerExtensionProvider;
import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;
-import org.opendaylight.openflowjava.protocol.api.keys.MessageCodeKey;
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
-import org.opendaylight.openflowplugin.impl.protocol.deserialization.key.MessageCodeMatchKey;
-import org.opendaylight.openflowplugin.impl.protocol.deserialization.match.MatchDeserializer;
-import org.opendaylight.openflowplugin.impl.protocol.deserialization.match.MatchDeserializer;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
import org.opendaylight.openflowplugin.api.openflow.protocol.deserialization.MatchEntryDeserializer;
import org.opendaylight.openflowplugin.api.openflow.protocol.deserialization.MatchEntryDeserializerRegistry;
import org.opendaylight.openflowplugin.extension.api.path.MatchPath;
+import org.opendaylight.openflowplugin.impl.protocol.deserialization.key.MessageCodeMatchKey;
import org.opendaylight.openflowplugin.impl.protocol.deserialization.match.ArpOpEntryDeserializer;
import org.opendaylight.openflowplugin.impl.protocol.deserialization.match.ArpSourceHardwareAddressEntryDeserializer;
import org.opendaylight.openflowplugin.impl.protocol.deserialization.match.ArpSourceTransportAddressEntryDeserializer;
* 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) {
+ static void injectDeserializers(final DeserializerExtensionProvider provider) {
for (MatchPath path : MatchPath.values()) {
final MatchDeserializer deserializer = new MatchDeserializer(path);
provider.registerDeserializer(
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortModInput;
-public class MessageDeserializerInjector {
+class MessageDeserializerInjector {
/**
* Injects message deserializers into provided {@link org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerExtensionProvider}
import org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.multipart.reply.MultipartReplyBody;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
-public class MultipartDeserializerInjector {
+class MultipartDeserializerInjector {
/**
* Injects message deserializers into provided {@link org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerExtensionProvider}
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.multipart.reply.MultipartReplyBody;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableFeaturesPropType;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.multipart.reply.multipart.reply.body.MultipartReplyTableFeaturesBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableConfig;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.multipart.reply.multipart.reply.body.MultipartReplyTableFeaturesBuilder;
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.ApplyActionsBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplyActionsMissBuilder;
/**
* Util class for injecting new match serializers into OpenflowJava
*/
-public class MatchSerializerInjector {
+class MatchSerializerInjector {
/**
* Injects match serializers into provided {@link org.opendaylight.openflowjava.protocol.api.extensibility.SerializerExtensionProvider}
* @param provider OpenflowJava serializer extension provider
*/
- public static void injectSerializers(final SerializerExtensionProvider provider) {
+ static void injectSerializers(final SerializerExtensionProvider provider) {
final MatchSerializer serializer = new MatchSerializer();
provider.registerSerializer(
new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, Match.class),
import org.opendaylight.openflowplugin.impl.protocol.serialization.messages.GroupMessageSerializer;
import org.opendaylight.openflowplugin.impl.protocol.serialization.messages.MeterMessageSerializer;
import org.opendaylight.openflowplugin.impl.protocol.serialization.messages.PortMessageSerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.MultipartRequestMessageSerializer;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortMessage;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowMessage;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupMessage;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterMessage;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.MultipartRequest;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
/**
// Inject new message serializers here using injector created by createInjector method
final Function<Class<?>, Consumer<OFSerializer<? extends OfHeader>>> injector =
createInjector(provider, EncodeConstants.OF13_VERSION_ID);
-
+
injector.apply(FlowMessage.class).accept(new FlowMessageSerializer());
injector.apply(MeterMessage.class).accept(new MeterMessageSerializer());
injector.apply(PortMessage.class).accept(new PortMessageSerializer());
injector.apply(GroupMessage.class).accept(new GroupMessageSerializer());
+ injector.apply(MultipartRequest.class).accept(new MultipartRequestMessageSerializer());
}
/**
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization;
+
+import com.google.common.annotations.VisibleForTesting;
+import java.util.function.Consumer;
+import java.util.function.Function;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerExtensionProvider;
+import org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.ArpOpMatchFieldSerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.ArpShaMatchFieldSerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.ArpSpaMatchFieldSerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.ArpThaMatchFieldSerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.ArpTpaMatchFieldSerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.EthDstMatchFieldSerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.EthSrcMatchFieldSerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.EthTypeMatchFieldSerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.Icmpv4CodeMatchFieldSerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.Icmpv4TypeMatchFieldSerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.Icmpv6CodeMatchFieldSerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.Icmpv6TypeMatchFieldSerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.InPhyPortMatchFieldSerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.InPortMatchFieldSerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.IpDscpMatchFieldSerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.IpEcnMatchFieldSerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.IpProtoMatchFieldSerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.Ipv4DstMatchFieldSerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.Ipv4SrcMatchFieldSerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.Ipv6DstMatchFieldSerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.Ipv6ExtHdrMatchFieldSerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.Ipv6FlabelMatchFieldSerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.Ipv6NdSllMatchFieldSerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.Ipv6NdTargetMatchFieldSerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.Ipv6NdTllMatchFieldSerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.Ipv6SrcMatchFieldSerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.MetadataMatchFieldSerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.MplsBosMatchFieldSerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.MplsLabelMatchFieldSerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.MplsTcMatchFieldSerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.PbbIsidMatchFieldSerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.SctpDstMatchFieldSerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.SctpSrcMatchFieldSerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.TcpDstMatchFieldSerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.TcpFlagsMatchFieldSerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.TcpSrcMatchFieldSerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.TunnelIdMatchFieldSerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.UdpDstMatchFieldSerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.UdpSrcMatchFieldSerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.VlanPcpMatchFieldSerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield.VlanVidMatchFieldSerializer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.ArpOp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.ArpSha;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.ArpSpa;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.ArpTha;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.ArpTpa;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.EthDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.EthSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.EthType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Icmpv4Code;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Icmpv4Type;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Icmpv6Code;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Icmpv6Type;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.InPhyPort;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.InPort;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.IpDscp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.IpEcn;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.IpProto;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv4Dst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv4Src;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv6Dst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv6Exthdr;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv6Flabel;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv6NdSll;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv6NdTarget;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv6NdTll;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv6Src;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Metadata;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.MplsBos;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.MplsLabel;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.MplsTc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.PbbIsid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.SctpDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.SctpSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TcpDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TcpFlags;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TcpSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TunnelId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TunnelIpv4Dst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TunnelIpv4Src;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.UdpDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.UdpSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.VlanPcp;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.VlanVid;
+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
+ */
+class MultipartMatchFieldSerializerInjector {
+
+ /**
+ * 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);
+
+ injector.apply(ArpOp.class).accept(new ArpOpMatchFieldSerializer());
+ injector.apply(ArpSha.class).accept(new ArpShaMatchFieldSerializer());
+ injector.apply(ArpSpa.class).accept(new ArpSpaMatchFieldSerializer());
+ injector.apply(ArpTha.class).accept(new ArpThaMatchFieldSerializer());
+ injector.apply(ArpTpa.class).accept(new ArpTpaMatchFieldSerializer());
+ injector.apply(EthDst.class).accept(new EthDstMatchFieldSerializer());
+ injector.apply(EthSrc.class).accept(new EthSrcMatchFieldSerializer());
+ injector.apply(EthType.class).accept(new EthTypeMatchFieldSerializer());
+ injector.apply(Icmpv4Code.class).accept(new Icmpv4CodeMatchFieldSerializer());
+ injector.apply(Icmpv4Type.class).accept(new Icmpv4TypeMatchFieldSerializer());
+ injector.apply(Icmpv6Code.class).accept(new Icmpv6CodeMatchFieldSerializer());
+ injector.apply(Icmpv6Type.class).accept(new Icmpv6TypeMatchFieldSerializer());
+ injector.apply(InPhyPort.class).accept(new InPhyPortMatchFieldSerializer());
+ injector.apply(InPort.class).accept(new InPortMatchFieldSerializer());
+ injector.apply(IpDscp.class).accept(new IpDscpMatchFieldSerializer());
+ injector.apply(IpEcn.class).accept(new IpEcnMatchFieldSerializer());
+ injector.apply(IpProto.class).accept(new IpProtoMatchFieldSerializer());
+ injector.apply(Ipv4Dst.class).accept(new Ipv4DstMatchFieldSerializer());
+ injector.apply(Ipv4Src.class).accept(new Ipv4SrcMatchFieldSerializer());
+ injector.apply(Ipv6Dst.class).accept(new Ipv6DstMatchFieldSerializer());
+ injector.apply(Ipv6Exthdr.class).accept(new Ipv6ExtHdrMatchFieldSerializer());
+ injector.apply(Ipv6Flabel.class).accept(new Ipv6FlabelMatchFieldSerializer());
+ injector.apply(Ipv6NdSll.class).accept(new Ipv6NdSllMatchFieldSerializer());
+ injector.apply(Ipv6NdTarget.class).accept(new Ipv6NdTargetMatchFieldSerializer());
+ injector.apply(Ipv6NdTll.class).accept(new Ipv6NdTllMatchFieldSerializer());
+ injector.apply(Ipv6Src.class).accept(new Ipv6SrcMatchFieldSerializer());
+ injector.apply(Metadata.class).accept(new MetadataMatchFieldSerializer());
+ injector.apply(MplsBos.class).accept(new MplsBosMatchFieldSerializer());
+ injector.apply(MplsLabel.class).accept(new MplsLabelMatchFieldSerializer());
+ injector.apply(MplsTc.class).accept(new MplsTcMatchFieldSerializer());
+ injector.apply(PbbIsid.class).accept(new PbbIsidMatchFieldSerializer());
+ injector.apply(SctpDst.class).accept(new SctpDstMatchFieldSerializer());
+ injector.apply(SctpSrc.class).accept(new SctpSrcMatchFieldSerializer());
+ injector.apply(TcpDst.class).accept(new TcpDstMatchFieldSerializer());
+ injector.apply(TcpFlags.class).accept(new TcpFlagsMatchFieldSerializer());
+ injector.apply(TcpSrc.class).accept(new TcpSrcMatchFieldSerializer());
+ injector.apply(TunnelId.class).accept(new TunnelIdMatchFieldSerializer());
+ // TODO: Finish implementation of Tunnel Ipv4 src and dst
+ injector.apply(TunnelIpv4Dst.class).accept(new Ipv4DstMatchFieldSerializer());
+ injector.apply(TunnelIpv4Src.class).accept(new Ipv4SrcMatchFieldSerializer());
+ injector.apply(UdpDst.class).accept(new UdpDstMatchFieldSerializer());
+ injector.apply(UdpSrc.class).accept(new UdpSrcMatchFieldSerializer());
+ injector.apply(VlanPcp.class).accept(new VlanPcpMatchFieldSerializer());
+ injector.apply(VlanVid.class).accept(new VlanVidMatchFieldSerializer());
+ }
+
+ /**
+ * 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
+ * @return injector
+ */
+ @VisibleForTesting
+ static Function<Class<? extends MatchField>, Consumer<OFSerializer<SetFieldMatch>>> createInjector(
+ final SerializerExtensionProvider provider,
+ final byte version) {
+ return type -> serializer ->
+ provider.registerSerializer(
+ new MessageTypeKey<>(version, type),
+ serializer);
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization;
+
+import com.google.common.annotations.VisibleForTesting;
+import java.util.function.Consumer;
+import java.util.function.Function;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerExtensionProvider;
+import org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.MultipartRequestDescSerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.MultipartRequestExperimenterSerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.MultipartRequestFlowAggregateStatsSerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.MultipartRequestFlowStatsSerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.MultipartRequestFlowTableStatsSerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.MultipartRequestGroupDescSerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.MultipartRequestGroupFeaturesSerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.MultipartRequestGroupStatsSerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.MultipartRequestMeterConfigSerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.MultipartRequestMeterFeaturesSerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.MultipartRequestMeterStatsSerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.MultipartRequestPortDescSerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.MultipartRequestPortStatsSerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.MultipartRequestQueueStatsSerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.MultipartRequestTableFeaturesSerializer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.multipart.request.multipart.request.body.MultipartRequestDesc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.multipart.request.multipart.request.body.MultipartRequestFlowTableStats;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.multipart.request.multipart.request.body.MultipartRequestPortDesc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.multipart.request.multipart.request.body.MultipartRequestFlowAggregateStats;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.multipart.request.multipart.request.body.MultipartRequestFlowStats;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.multipart.request.multipart.request.body.MultipartRequestGroupDesc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.multipart.request.multipart.request.body.MultipartRequestGroupFeatures;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.multipart.request.multipart.request.body.MultipartRequestGroupStats;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.multipart.request.multipart.request.body.MultipartRequestMeterConfig;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.multipart.request.multipart.request.body.MultipartRequestMeterFeatures;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.multipart.request.multipart.request.body.MultipartRequestMeterStats;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.multipart.request.MultipartRequestBody;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.experimenter.types.rev151020.multipart.request.multipart.request.body.MultipartRequestExperimenter;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.multipart.request.multipart.request.body.MultipartRequestPortStats;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.multipart.request.multipart.request.body.MultipartRequestQueueStats;
+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
+ */
+class MultipartSerializerInjector {
+
+ /**
+ * 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);
+
+ MultipartMatchFieldSerializerInjector.injectSerializers(provider);
+ MultipartTableFeaturesSerializerInjector.injectSerializers(provider);
+
+ injector.apply(MultipartRequestDesc.class).accept(new MultipartRequestDescSerializer());
+ injector.apply(MultipartRequestFlowTableStats.class).accept(new MultipartRequestFlowTableStatsSerializer());
+ injector.apply(MultipartRequestGroupDesc.class).accept(new MultipartRequestGroupDescSerializer());
+ injector.apply(MultipartRequestGroupFeatures.class).accept(new MultipartRequestGroupFeaturesSerializer());
+ injector.apply(MultipartRequestGroupStats.class).accept(new MultipartRequestGroupStatsSerializer());
+ injector.apply(MultipartRequestMeterFeatures.class).accept(new MultipartRequestMeterFeaturesSerializer());
+ injector.apply(MultipartRequestMeterStats.class).accept(new MultipartRequestMeterStatsSerializer());
+ injector.apply(MultipartRequestMeterConfig.class).accept(new MultipartRequestMeterConfigSerializer());
+ injector.apply(MultipartRequestPortDesc.class).accept(new MultipartRequestPortDescSerializer());
+ 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(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}
+ * @param provider OpenflowJava serializer extension provider
+ * @param version Openflow version
+ * @return injector
+ */
+ @VisibleForTesting
+ static Function<Class<? extends MultipartRequestBody>, Consumer<OFSerializer<MultipartRequestBody>>> createInjector(
+ final SerializerExtensionProvider provider,
+ final byte version) {
+ return type -> serializer ->
+ provider.registerSerializer(
+ new MessageTypeKey<>(version, type),
+ serializer);
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization;
+
+import com.google.common.annotations.VisibleForTesting;
+import java.util.function.Consumer;
+import java.util.function.Function;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerExtensionProvider;
+import org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.ApplyActionsMissTablePropertySerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.ApplyActionsTablePropertySerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.ApplySetfieldMissTablePropertySerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.ApplySetfieldTablePropertySerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.InstructionsMissTablePropertySerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.InstructionsTablePropertySerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.MatchTablePropertySerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.NextTableMissTablePropertySerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.NextTableTablePropertySerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.WildcardsTablePropertySerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.WriteActionsMissTablePropertySerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.WriteActionsTablePropertySerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.WriteSetfieldMissTablePropertySerializer;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.WriteSetfieldTablePropertySerializer;
+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.feature.prop.type.table.feature.prop.type.ApplyActions;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplyActionsMiss;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplySetfield;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplySetfieldMiss;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.Instructions;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.InstructionsMiss;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.Match;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.NextTable;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.NextTableMiss;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.Wildcards;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteActions;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteActionsMiss;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.WriteSetfield;
+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
+ */
+class MultipartTableFeaturesSerializerInjector {
+
+ /**
+ * 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);
+
+ injector.apply(Instructions.class).accept(new InstructionsTablePropertySerializer());
+ injector.apply(InstructionsMiss.class).accept(new InstructionsMissTablePropertySerializer());
+ injector.apply(NextTable.class).accept(new NextTableTablePropertySerializer());
+ injector.apply(NextTableMiss.class).accept(new NextTableMissTablePropertySerializer());
+ injector.apply(ApplyActions.class).accept(new ApplyActionsTablePropertySerializer());
+ injector.apply(ApplyActionsMiss.class).accept(new ApplyActionsMissTablePropertySerializer());
+ injector.apply(WriteActions.class).accept(new WriteActionsTablePropertySerializer());
+ injector.apply(WriteActionsMiss.class).accept(new WriteActionsMissTablePropertySerializer());
+ injector.apply(Match.class).accept(new MatchTablePropertySerializer());
+ injector.apply(Wildcards.class).accept(new WildcardsTablePropertySerializer());
+ injector.apply(WriteSetfield.class).accept(new WriteSetfieldTablePropertySerializer());
+ injector.apply(WriteSetfieldMiss.class).accept(new WriteSetfieldMissTablePropertySerializer());
+ injector.apply(ApplySetfield.class).accept(new ApplySetfieldTablePropertySerializer());
+ injector.apply(ApplySetfieldMiss.class).accept(new ApplySetfieldMissTablePropertySerializer());
+ // TODO: Add support for experimenters
+ }
+
+ /**
+ * 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
+ * @return injector
+ */
+ @VisibleForTesting
+ static Function<Class<? extends TableFeaturePropType>, Consumer<OFSerializer<TableFeaturePropType>>> createInjector(
+ final SerializerExtensionProvider provider,
+ final byte version) {
+ return type -> serializer ->
+ provider.registerSerializer(
+ new MessageTypeKey<>(version, type),
+ serializer);
+ }
+
+}
MatchSerializerInjector.injectSerializers(provider);
ActionSerializerInjector.injectSerializers(provider);
InstructionSerializerInjector.injectSerializers(provider);
+ MultipartSerializerInjector.injectSerializers(provider);
MessageSerializerInjector.injectSerializers(provider);
}
}
import org.opendaylight.openflowjava.util.ByteBufUtils;
import org.opendaylight.openflowplugin.api.OFConstants;
import org.opendaylight.openflowplugin.impl.protocol.serialization.util.ActionUtil;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.util.InstructionUtil;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.ActionList;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.VlanCfi;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.PushVlanActionCaseBuilder;
.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 -> registry.<Instruction, OFSerializer<Instruction>>getSerializer(
- new MessageTypeKey<>(
- EncodeConstants.OF13_VERSION_ID,
- (Class<Instruction>) i.getImplementedInterface()))
- .serialize(i, outBuffer)
- ));
+ .forEach(i -> InstructionUtil.writeInstruction(i, EncodeConstants.OF13_VERSION_ID, registry, outBuffer)));
}
/**
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart;
+
+import io.netty.buffer.ByteBuf;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.multipart.request.MultipartRequestBody;
+
+public class MultipartRequestDescSerializer implements OFSerializer<MultipartRequestBody> {
+
+ @Override
+ public void serialize(final MultipartRequestBody multipartRequestBody, final ByteBuf byteBuf) {
+ // NOOP
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart;
+
+import io.netty.buffer.ByteBuf;
+import java.util.Optional;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistryInjector;
+import org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.util.ExperimenterSerializerKeyFactory;
+import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.extension.api.TypeVersionKey;
+import org.opendaylight.openflowplugin.extension.api.exception.ConversionException;
+import org.opendaylight.openflowplugin.openflow.md.core.session.OFSessionUtil;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.multipart.request.MultipartRequestBody;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.experimenter.core.ExperimenterDataOfChoice;
+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 {
+
+ private SerializerRegistry registry;
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public void serialize(final MultipartRequestBody multipartRequestBody, final ByteBuf byteBuf) {
+ final MultipartRequestExperimenter multipartRequestExperimenter = MultipartRequestExperimenter
+ .class
+ .cast(multipartRequestBody);
+
+ try {
+ final OFSerializer<ExperimenterMessageOfChoice> serializer = registry
+ .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()));
+
+ try {
+ serializer.serialize(converter.convert(multipartRequestExperimenter.getExperimenterMessageOfChoice()), byteBuf);
+ } catch (ConversionException e) {
+ throw new IllegalStateException(e);
+ }
+ });
+ }
+ }
+
+ @Override
+ public void injectSerializerRegistry(final SerializerRegistry serializerRegistry) {
+ registry = serializerRegistry;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart;
+
+import com.google.common.base.MoreObjects;
+import io.netty.buffer.ByteBuf;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistryInjector;
+import org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.multipart.request.multipart.request.body.MultipartRequestFlowAggregateStats;
+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 {
+
+ private static final byte PADDING_IN_MULTIPART_REQUEST_FLOW_BODY_01 = 3;
+ private static final byte PADDING_IN_MULTIPART_REQUEST_FLOW_BODY_02 = 4;
+ private SerializerRegistry registry;
+
+ @Override
+ public void serialize(final MultipartRequestBody multipartRequestBody, final ByteBuf byteBuf) {
+ final MultipartRequestFlowAggregateStats multipartRequestFlowAggregateStats = MultipartRequestFlowAggregateStats
+ .class
+ .cast(multipartRequestBody);
+
+ 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.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());
+
+ registry.<Match, OFSerializer<Match>>getSerializer(
+ new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, Match.class))
+ .serialize(multipartRequestFlowAggregateStats.getMatch(), byteBuf);
+ }
+
+ @Override
+ public void injectSerializerRegistry(final SerializerRegistry serializerRegistry) {
+ registry = serializerRegistry;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart;
+
+import com.google.common.base.MoreObjects;
+import io.netty.buffer.ByteBuf;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistryInjector;
+import org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.multipart.request.multipart.request.body.MultipartRequestFlowStats;
+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 {
+
+ private static final byte PADDING_IN_MULTIPART_REQUEST_FLOW_BODY_01 = 3;
+ private static final byte PADDING_IN_MULTIPART_REQUEST_FLOW_BODY_02 = 4;
+ private SerializerRegistry registry;
+
+ @Override
+ public void serialize(final MultipartRequestBody multipartRequestBody, final ByteBuf byteBuf) {
+ final MultipartRequestFlowStats multipartRequestFlowStats = MultipartRequestFlowStats
+ .class
+ .cast(multipartRequestBody);
+
+ 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.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());
+
+ registry.<Match, OFSerializer<Match>>getSerializer(
+ new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, Match.class))
+ .serialize(multipartRequestFlowStats.getMatch(), byteBuf);
+ }
+
+ @Override
+ public void injectSerializerRegistry(final SerializerRegistry serializerRegistry) {
+ registry = serializerRegistry;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart;
+
+import io.netty.buffer.ByteBuf;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.multipart.request.MultipartRequestBody;
+
+public class MultipartRequestFlowTableStatsSerializer implements OFSerializer<MultipartRequestBody> {
+
+ @Override
+ public void serialize(final MultipartRequestBody multipartRequestBody, final ByteBuf byteBuf) {
+ // NOOP
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart;
+
+import io.netty.buffer.ByteBuf;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.multipart.request.MultipartRequestBody;
+
+public class MultipartRequestGroupDescSerializer implements OFSerializer<MultipartRequestBody> {
+
+ @Override
+ public void serialize(final MultipartRequestBody multipartRequestBody, final ByteBuf byteBuf) {
+ // NOOP
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart;
+
+import io.netty.buffer.ByteBuf;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.multipart.request.MultipartRequestBody;
+
+public class MultipartRequestGroupFeaturesSerializer implements OFSerializer<MultipartRequestBody> {
+
+ @Override
+ public void serialize(final MultipartRequestBody multipartRequestBody, final ByteBuf byteBuf) {
+ // NOOP
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart;
+
+import com.google.common.base.MoreObjects;
+import io.netty.buffer.ByteBuf;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.multipart.request.multipart.request.body.MultipartRequestGroupStats;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.multipart.request.MultipartRequestBody;
+
+public class MultipartRequestGroupStatsSerializer implements OFSerializer<MultipartRequestBody> {
+
+ private static final byte PADDING_IN_MULTIPART_REQUEST_GROUP_BODY = 4;
+
+ @Override
+ public void serialize(final MultipartRequestBody multipartRequestBody, final ByteBuf byteBuf) {
+ final MultipartRequestGroupStats multipartRequestGroupStats = MultipartRequestGroupStats
+ .class
+ .cast(multipartRequestBody);
+
+ byteBuf.writeInt(MoreObjects
+ .firstNonNull(multipartRequestGroupStats.getGroupId(), new GroupId(OFConstants.OFPG_ALL))
+ .getValue().intValue());
+
+ byteBuf.writeZero(PADDING_IN_MULTIPART_REQUEST_GROUP_BODY);
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart;
+
+import io.netty.buffer.ByteBuf;
+import java.util.Objects;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistryInjector;
+import org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.util.ByteBufUtils;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.messages.AbstractMessageSerializer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.multipart.request.multipart.request.body.MultipartRequestDesc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.table.statistics.rev131215.multipart.request.multipart.request.body.MultipartRequestFlowTableStats;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.multipart.request.multipart.request.body.MultipartRequestPortDesc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.multipart.request.multipart.request.body.MultipartRequestFlowAggregateStats;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.multipart.request.multipart.request.body.MultipartRequestFlowStats;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.multipart.request.multipart.request.body.MultipartRequestGroupDesc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.multipart.request.multipart.request.body.MultipartRequestGroupFeatures;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.multipart.request.multipart.request.body.MultipartRequestGroupStats;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.multipart.request.multipart.request.body.MultipartRequestMeterConfig;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.multipart.request.multipart.request.body.MultipartRequestMeterFeatures;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.multipart.request.multipart.request.body.MultipartRequestMeterStats;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.MultipartRequest;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.multipart.request.MultipartRequestBody;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.experimenter.types.rev151020.multipart.request.multipart.request.body.MultipartRequestExperimenter;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.multipart.request.multipart.request.body.MultipartRequestPortStats;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.multipart.request.multipart.request.body.MultipartRequestQueueStats;
+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 {
+ private static final byte PADDING_IN_MULTIPART_REQUEST_MESSAGE = 4;
+ private SerializerRegistry registry;
+
+ @Override
+ public void serialize(final MultipartRequest message, final ByteBuf outBuffer) {
+ final MultipartRequestBody multipartRequestBody = message.getMultipartRequestBody();
+ final MultipartType multipartType = getMultipartType(multipartRequestBody);
+
+ int index = outBuffer.writerIndex();
+ super.serialize(message, outBuffer);
+ outBuffer.writeShort(multipartType.getIntValue());
+ outBuffer.writeShort(ByteBufUtils.fillBitMask(0, message.isRequestMore()));
+ outBuffer.writeZero(PADDING_IN_MULTIPART_REQUEST_MESSAGE);
+
+ final OFSerializer<MultipartRequestBody> serializer = registry
+ .getSerializer(new MessageTypeKey<>(
+ EncodeConstants.OF13_VERSION_ID,
+ multipartRequestBody.getImplementedInterface()));
+
+ serializer.serialize(multipartRequestBody, outBuffer);
+ outBuffer.setShort(index + 2, outBuffer.writerIndex() - index);
+ }
+
+ @Override
+ protected byte getMessageType() {
+ return 18;
+ }
+
+ private static MultipartType getMultipartType(final MultipartRequestBody multipartRequestBody) {
+ final Class<? extends DataContainer> clazz = multipartRequestBody.getImplementedInterface();
+
+ final MultipartType multipartType = MultipartRequestDesc.class.equals(clazz) ? MultipartType.OFPMPDESC
+ : MultipartRequestFlowTableStats.class.equals(clazz) ? MultipartType.OFPMPTABLE
+ : MultipartRequestGroupDesc.class.equals(clazz) ? MultipartType.OFPMPGROUPDESC
+ : MultipartRequestGroupFeatures.class.equals(clazz) ? MultipartType.OFPMPGROUPFEATURES
+ : MultipartRequestGroupStats.class.equals(clazz) ? MultipartType.OFPMPGROUP
+ : MultipartRequestMeterFeatures.class.equals(clazz) ? MultipartType.OFPMPMETERFEATURES
+ : MultipartRequestMeterStats.class.equals(clazz) ? MultipartType.OFPMPMETER
+ : MultipartRequestMeterConfig.class.equals(clazz) ? MultipartType.OFPMPMETERCONFIG
+ : MultipartRequestPortDesc.class.equals(clazz) ? MultipartType.OFPMPPORTDESC
+ : MultipartRequestPortStats.class.equals(clazz) ? MultipartType.OFPMPPORTSTATS
+ : MultipartRequestFlowStats.class.equals(clazz) ? MultipartType.OFPMPFLOW
+ : MultipartRequestFlowAggregateStats.class.equals(clazz) ? MultipartType.OFPMPAGGREGATE
+ : MultipartRequestTableFeatures.class.equals(clazz) ? MultipartType.OFPMPTABLEFEATURES
+ : MultipartRequestQueueStats.class.equals(clazz) ? MultipartType.OFPMPQUEUE
+ : MultipartRequestExperimenter.class.equals(clazz) ? MultipartType.OFPMPEXPERIMENTER
+ : null;
+
+ if (Objects.isNull(multipartType)) {
+ throw new IllegalArgumentException(clazz.toString() + " is not valid multipart type");
+ }
+
+ return multipartType;
+ }
+
+ @Override
+ public void injectSerializerRegistry(final SerializerRegistry serializerRegistry) {
+ registry = serializerRegistry;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart;
+
+import com.google.common.base.MoreObjects;
+import io.netty.buffer.ByteBuf;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.multipart.request.multipart.request.body.MultipartRequestMeterConfig;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.multipart.request.MultipartRequestBody;
+
+public class MultipartRequestMeterConfigSerializer implements OFSerializer<MultipartRequestBody> {
+
+ private static final byte PADDING_IN_MULTIPART_REQUEST_METER_CONFIG_BODY = 4;
+
+ @Override
+ public void serialize(final MultipartRequestBody multipartRequestBody, final ByteBuf byteBuf) {
+ final MultipartRequestMeterConfig multipartRequestMeterConfig = MultipartRequestMeterConfig
+ .class
+ .cast(multipartRequestBody);
+
+ byteBuf.writeInt(MoreObjects.firstNonNull(multipartRequestMeterConfig.getMeterId(), new MeterId(OFConstants.OFPM_ALL))
+ .getValue().intValue());
+ byteBuf.writeZero(PADDING_IN_MULTIPART_REQUEST_METER_CONFIG_BODY);
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart;
+
+import io.netty.buffer.ByteBuf;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.multipart.request.MultipartRequestBody;
+
+public class MultipartRequestMeterFeaturesSerializer implements OFSerializer<MultipartRequestBody> {
+
+ @Override
+ public void serialize(final MultipartRequestBody multipartRequestBody, final ByteBuf byteBuf) {
+ // NOOP
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart;
+
+import com.google.common.base.MoreObjects;
+import io.netty.buffer.ByteBuf;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.multipart.request.multipart.request.body.MultipartRequestMeterStats;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.multipart.request.MultipartRequestBody;
+
+public class MultipartRequestMeterStatsSerializer implements OFSerializer<MultipartRequestBody> {
+
+ private static final byte PADDING_IN_MULTIPART_REQUEST_METER_BODY = 4;
+
+ @Override
+ public void serialize(final MultipartRequestBody multipartRequestBody, final ByteBuf byteBuf) {
+ final MultipartRequestMeterStats multipartRequestMeterStats = MultipartRequestMeterStats
+ .class
+ .cast(multipartRequestBody);
+
+ byteBuf.writeInt(MoreObjects
+ .firstNonNull(multipartRequestMeterStats.getMeterId(), new MeterId(OFConstants.OFPM_ALL)).getValue().intValue());
+ byteBuf.writeZero(PADDING_IN_MULTIPART_REQUEST_METER_BODY);
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart;
+
+import io.netty.buffer.ByteBuf;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.multipart.request.MultipartRequestBody;
+
+public class MultipartRequestPortDescSerializer implements OFSerializer<MultipartRequestBody> {
+
+ @Override
+ public void serialize(final MultipartRequestBody multipartRequestBody, final ByteBuf byteBuf) {
+ // NOOP
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart;
+
+import io.netty.buffer.ByteBuf;
+import java.util.Objects;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion;
+import org.opendaylight.openflowplugin.openflow.md.util.InventoryDataServiceUtil;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.multipart.request.MultipartRequestBody;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.multipart.request.multipart.request.body.MultipartRequestPortStats;
+
+public class MultipartRequestPortStatsSerializer implements OFSerializer<MultipartRequestBody> {
+
+ private static final byte PADDING_IN_MULTIPART_REQUEST_PORTSTATS_BODY = 4;
+
+ @Override
+ public void serialize(final MultipartRequestBody multipartRequestBody, final ByteBuf byteBuf) {
+ final MultipartRequestPortStats multipartRequestPortStats = MultipartRequestPortStats
+ .class
+ .cast(multipartRequestBody);
+
+ if (Objects.isNull(multipartRequestPortStats.getNodeConnectorId())) {
+ byteBuf.writeInt(OFConstants.OFPP_ANY.intValue());
+ } else {
+ byteBuf.writeInt(InventoryDataServiceUtil
+ .portNumberfromNodeConnectorId(
+ OpenflowVersion.OF13,
+ multipartRequestPortStats.getNodeConnectorId()).intValue());
+ }
+
+ byteBuf.writeZero(PADDING_IN_MULTIPART_REQUEST_PORTSTATS_BODY);
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart;
+
+import com.google.common.base.MoreObjects;
+import io.netty.buffer.ByteBuf;
+import java.util.Objects;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.openflowplugin.api.OFConstants;
+import org.opendaylight.openflowplugin.api.openflow.md.util.OpenflowVersion;
+import org.opendaylight.openflowplugin.openflow.md.util.InventoryDataServiceUtil;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.queue.rev130925.QueueId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.multipart.request.MultipartRequestBody;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.multipart.request.multipart.request.body.MultipartRequestQueueStats;
+
+public class MultipartRequestQueueStatsSerializer implements OFSerializer<MultipartRequestBody> {
+
+ @Override
+ public void serialize(final MultipartRequestBody multipartRequestBody, final ByteBuf byteBuf) {
+ final MultipartRequestQueueStats multipartRequestQueueStats = MultipartRequestQueueStats
+ .class
+ .cast(multipartRequestBody);
+
+ if (Objects.isNull(multipartRequestQueueStats.getNodeConnectorId())) {
+ byteBuf.writeInt(OFConstants.OFPP_ANY.intValue());
+ } else {
+ byteBuf.writeInt(InventoryDataServiceUtil
+ .portNumberfromNodeConnectorId(
+ OpenflowVersion.OF13,
+ multipartRequestQueueStats.getNodeConnectorId()).intValue());
+ }
+
+ byteBuf.writeInt(MoreObjects
+ .firstNonNull(multipartRequestQueueStats.getQueueId(), new QueueId(OFConstants.OFPQ_ALL)).getValue().intValue());
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart;
+
+import io.netty.buffer.ByteBuf;
+import java.util.Objects;
+import java.util.Optional;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistryInjector;
+import org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.util.ByteBufUtils;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.multipart.request.MultipartRequestBody;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.multipart.request.multipart.request.body.MultipartRequestTableFeatures;
+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 {
+
+ private static final byte PADDING_IN_MULTIPART_REQUEST_TABLE_FEATURES_BODY = 5;
+ private SerializerRegistry registry;
+
+ @Override
+ public void serialize(final MultipartRequestBody multipartRequestBody, final ByteBuf byteBuf) {
+ final MultipartRequestTableFeatures multipartRequestTableFeatures = MultipartRequestTableFeatures
+ .class
+ .cast(multipartRequestBody);
+
+ Optional
+ .ofNullable(multipartRequestTableFeatures.getTableFeatures())
+ .ifPresent(tableFeatures -> tableFeatures
+ .stream()
+ .filter(Objects::nonNull)
+ .forEach(tableFeature -> {
+ final int featureIndex = byteBuf.writerIndex();
+ byteBuf.writeShort(EncodeConstants.EMPTY_LENGTH);
+ byteBuf.writeByte(tableFeature.getTableId().byteValue());
+ byteBuf.writeZero(PADDING_IN_MULTIPART_REQUEST_TABLE_FEATURES_BODY);
+ byteBuf.writeBytes(tableFeature.getName().getBytes());
+ byteBuf.writeZero(32 - tableFeature.getName().getBytes().length);
+ byteBuf.writeLong(tableFeature.getMetadataMatch().longValue());
+ byteBuf.writeLong(tableFeature.getMetadataWrite().longValue());
+ byteBuf.writeInt(ByteBufUtils.fillBitMask(0, tableFeature.getConfig().isDEPRECATEDMASK()));
+ byteBuf.writeInt(tableFeature.getMaxEntries().intValue());
+ serializeProperties(tableFeature.getTableProperties(), byteBuf);
+ byteBuf.setShort(featureIndex, byteBuf.writerIndex() - featureIndex);
+ }));
+ }
+
+ @SuppressWarnings("unchecked")
+ private void serializeProperties(final TableProperties tableProperties, final ByteBuf byteBuf) {
+ Optional
+ .ofNullable(tableProperties)
+ .flatMap(properties -> Optional.ofNullable(properties.getTableFeatureProperties()))
+ .ifPresent(properties -> properties
+ .stream()
+ .filter(Objects::nonNull)
+ .forEach(property -> {
+ final Class<? extends TableFeaturePropType> clazz = (Class<? extends TableFeaturePropType>) property
+ .getTableFeaturePropType()
+ .getImplementedInterface();
+
+ registry.
+ <TableFeaturePropType, OFSerializer<TableFeaturePropType>>getSerializer(
+ new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, clazz))
+ .serialize(property.getTableFeaturePropType(), byteBuf);
+ }));
+ }
+
+ @Override
+ public void injectSerializerRegistry(final SerializerRegistry serializerRegistry) {
+ registry = serializerRegistry;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures;
+
+import io.netty.buffer.ByteBuf;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.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> {
+
+ @Override
+ public void serialize(final TableFeaturePropType tableFeaturePropType, final ByteBuf byteBuf) {
+ final int startIndex = byteBuf.writerIndex();
+ byteBuf.writeShort(getType().getIntValue());
+ final int lengthIndex = byteBuf.writerIndex();
+ byteBuf.writeShort(EncodeConstants.EMPTY_LENGTH);
+
+ serializeProperty(getClazz().cast(tableFeaturePropType), byteBuf);
+
+ final int length = byteBuf.writerIndex() - startIndex;
+ byteBuf.setShort(lengthIndex, length);
+
+ int paddingRemainder = length % EncodeConstants.PADDING;
+ int padding = 0;
+
+ if (paddingRemainder != 0) {
+ padding = EncodeConstants.PADDING - paddingRemainder;
+ }
+
+ byteBuf.writeZero(padding);
+ }
+
+ protected abstract void serializeProperty(final T property, final ByteBuf byteBuf);
+ protected abstract TableFeaturesPropType getType();
+ protected abstract Class<T> getClazz();
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures;
+
+import io.netty.buffer.ByteBuf;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistryInjector;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.util.ActionUtil;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.Action;
+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 {
+
+ private SerializerRegistry registry;
+
+ @Override
+ protected void serializeProperty(final ApplyActionsMiss property, final ByteBuf byteBuf) {
+ property
+ .getApplyActionsMiss()
+ .getAction()
+ .stream()
+ .map(Action::getAction)
+ .forEach(action -> ActionUtil
+ .writeActionHeader(
+ action,
+ EncodeConstants.OF13_VERSION_ID,
+ registry,
+ byteBuf));
+ }
+
+ @Override
+ protected TableFeaturesPropType getType() {
+ return TableFeaturesPropType.OFPTFPTAPPLYACTIONSMISS;
+ }
+
+ @Override
+ protected Class<ApplyActionsMiss> getClazz() {
+ return ApplyActionsMiss.class;
+ }
+
+ @Override
+ public void injectSerializerRegistry(final SerializerRegistry serializerRegistry) {
+ registry = serializerRegistry;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures;
+
+import io.netty.buffer.ByteBuf;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistryInjector;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.util.ActionUtil;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.Action;
+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 {
+
+ private SerializerRegistry registry;
+
+ @Override
+ protected void serializeProperty(final ApplyActions property, final ByteBuf byteBuf) {
+ property
+ .getApplyActions()
+ .getAction()
+ .stream()
+ .map(Action::getAction)
+ .forEach(action -> ActionUtil
+ .writeActionHeader(
+ action,
+ EncodeConstants.OF13_VERSION_ID,
+ registry,
+ byteBuf));
+ }
+
+ @Override
+ protected TableFeaturesPropType getType() {
+ return TableFeaturesPropType.OFPTFPTAPPLYACTIONS;
+ }
+
+ @Override
+ protected Class<ApplyActions> getClazz() {
+ return ApplyActions.class;
+ }
+
+ @Override
+ public void injectSerializerRegistry(final SerializerRegistry serializerRegistry) {
+ registry = serializerRegistry;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures;
+
+import io.netty.buffer.ByteBuf;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistryInjector;
+import org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableFeaturesPropType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.MatchField;
+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 {
+
+ private SerializerRegistry registry;
+
+ @Override
+ protected void serializeProperty(final ApplySetfieldMiss property, final ByteBuf byteBuf) {
+ property
+ .getApplySetfieldMiss()
+ .getSetFieldMatch()
+ .forEach(setFieldMatch -> registry
+ .<MatchField, OFSerializer<SetFieldMatch>>getSerializer(
+ new MessageTypeKey<>(
+ EncodeConstants.OF13_VERSION_ID,
+ setFieldMatch.getMatchType()))
+ .serialize(setFieldMatch, byteBuf));
+ }
+
+ @Override
+ protected TableFeaturesPropType getType() {
+ return TableFeaturesPropType.OFPTFPTAPPLYSETFIELDMISS;
+ }
+
+ @Override
+ protected Class<ApplySetfieldMiss> getClazz() {
+ return ApplySetfieldMiss.class;
+ }
+
+ @Override
+ public void injectSerializerRegistry(final SerializerRegistry serializerRegistry) {
+ registry = serializerRegistry;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures;
+
+import io.netty.buffer.ByteBuf;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistryInjector;
+import org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableFeaturesPropType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.MatchField;
+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 {
+
+ private SerializerRegistry registry;
+
+ @Override
+ protected void serializeProperty(final ApplySetfield property, final ByteBuf byteBuf) {
+ property
+ .getApplySetfield()
+ .getSetFieldMatch()
+ .forEach(setFieldMatch -> registry
+ .<MatchField, OFSerializer<SetFieldMatch>>getSerializer(
+ new MessageTypeKey<>(
+ EncodeConstants.OF13_VERSION_ID,
+ setFieldMatch.getMatchType()))
+ .serialize(setFieldMatch, byteBuf));
+ }
+
+ @Override
+ protected TableFeaturesPropType getType() {
+ return TableFeaturesPropType.OFPTFPTAPPLYSETFIELD;
+ }
+
+ @Override
+ protected Class<ApplySetfield> getClazz() {
+ return ApplySetfield.class;
+ }
+
+ @Override
+ public void injectSerializerRegistry(final SerializerRegistry serializerRegistry) {
+ registry = serializerRegistry;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures;
+
+import io.netty.buffer.ByteBuf;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistryInjector;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.util.InstructionUtil;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.Instruction;
+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 {
+
+ private SerializerRegistry registry;
+
+ @Override
+ protected void serializeProperty(final InstructionsMiss property, final ByteBuf byteBuf) {
+ property
+ .getInstructionsMiss()
+ .getInstruction()
+ .stream()
+ .map(Instruction::getInstruction)
+ .forEach(instruction -> InstructionUtil
+ .writeInstructionHeader(
+ instruction,
+ EncodeConstants.OF13_VERSION_ID,
+ registry,
+ byteBuf));
+ }
+
+ @Override
+ protected TableFeaturesPropType getType() {
+ return TableFeaturesPropType.OFPTFPTINSTRUCTIONSMISS;
+ }
+
+ @Override
+ protected Class<InstructionsMiss> getClazz() {
+ return InstructionsMiss.class;
+ }
+
+ @Override
+ public void injectSerializerRegistry(final SerializerRegistry serializerRegistry) {
+ registry = serializerRegistry;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures;
+
+import io.netty.buffer.ByteBuf;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistryInjector;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.util.InstructionUtil;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.Instruction;
+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 {
+
+ private SerializerRegistry registry;
+
+ @Override
+ protected void serializeProperty(final Instructions property, final ByteBuf byteBuf) {
+ property
+ .getInstructions()
+ .getInstruction()
+ .stream()
+ .map(Instruction::getInstruction)
+ .forEach(instruction -> InstructionUtil
+ .writeInstructionHeader(
+ instruction,
+ EncodeConstants.OF13_VERSION_ID,
+ registry,
+ byteBuf));
+ }
+
+ @Override
+ protected TableFeaturesPropType getType() {
+ return TableFeaturesPropType.OFPTFPTINSTRUCTIONS;
+ }
+
+ @Override
+ protected Class<Instructions> getClazz() {
+ return Instructions.class;
+ }
+
+ @Override
+ public void injectSerializerRegistry(final SerializerRegistry serializerRegistry) {
+ registry = serializerRegistry;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures;
+
+import io.netty.buffer.ByteBuf;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistryInjector;
+import org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableFeaturesPropType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.MatchField;
+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 {
+
+ private SerializerRegistry registry;
+
+ @Override
+ protected void serializeProperty(final Match property, final ByteBuf byteBuf) {
+ property
+ .getMatchSetfield()
+ .getSetFieldMatch()
+ .forEach(setFieldMatch -> registry
+ .<MatchField, OFSerializer<SetFieldMatch>>getSerializer(
+ new MessageTypeKey<>(
+ EncodeConstants.OF13_VERSION_ID,
+ setFieldMatch.getMatchType()))
+ .serialize(setFieldMatch, byteBuf));
+ }
+
+ @Override
+ protected TableFeaturesPropType getType() {
+ return TableFeaturesPropType.OFPTFPTMATCH;
+ }
+
+ @Override
+ protected Class<Match> getClazz() {
+ return Match.class;
+ }
+
+ @Override
+ public void injectSerializerRegistry(final SerializerRegistry serializerRegistry) {
+ registry = serializerRegistry;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures;
+
+import io.netty.buffer.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.table.feature.prop.type.NextTableMiss;
+
+public class NextTableMissTablePropertySerializer extends AbstractTablePropertySerializer<NextTableMiss> {
+
+ @Override
+ protected void serializeProperty(final NextTableMiss property, final ByteBuf byteBuf) {
+ property
+ .getTablesMiss()
+ .getTableIds()
+ .forEach(byteBuf::writeByte);
+ }
+
+ @Override
+ protected TableFeaturesPropType getType() {
+ return TableFeaturesPropType.OFPTFPTNEXTTABLESMISS;
+ }
+
+ @Override
+ protected Class<NextTableMiss> getClazz() {
+ return NextTableMiss.class;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures;
+
+import io.netty.buffer.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.table.feature.prop.type.NextTable;
+
+public class NextTableTablePropertySerializer extends AbstractTablePropertySerializer<NextTable> {
+
+ @Override
+ protected void serializeProperty(final NextTable property, final ByteBuf byteBuf) {
+ property
+ .getTables()
+ .getTableIds()
+ .forEach(byteBuf::writeByte);
+ }
+
+ @Override
+ protected TableFeaturesPropType getType() {
+ return TableFeaturesPropType.OFPTFPTNEXTTABLES;
+ }
+
+ @Override
+ protected Class<NextTable> getClazz() {
+ return NextTable.class;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures;
+
+import io.netty.buffer.ByteBuf;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistryInjector;
+import org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableFeaturesPropType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.MatchField;
+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 {
+
+ private SerializerRegistry registry;
+
+ @Override
+ protected void serializeProperty(final Wildcards property, final ByteBuf byteBuf) {
+ property
+ .getWildcardSetfield()
+ .getSetFieldMatch()
+ .forEach(setFieldMatch -> registry
+ .<MatchField, OFSerializer<SetFieldMatch>>getSerializer(
+ new MessageTypeKey<>(
+ EncodeConstants.OF13_VERSION_ID,
+ setFieldMatch.getMatchType()))
+ .serialize(setFieldMatch, byteBuf));
+ }
+
+ @Override
+ protected TableFeaturesPropType getType() {
+ return TableFeaturesPropType.OFPTFPTWILDCARDS;
+ }
+
+ @Override
+ protected Class<Wildcards> getClazz() {
+ return Wildcards.class;
+ }
+
+ @Override
+ public void injectSerializerRegistry(final SerializerRegistry serializerRegistry) {
+ registry = serializerRegistry;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures;
+
+import io.netty.buffer.ByteBuf;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistryInjector;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.util.ActionUtil;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.Action;
+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 {
+
+ private SerializerRegistry registry;
+
+ @Override
+ protected void serializeProperty(final WriteActionsMiss property, final ByteBuf byteBuf) {
+ property
+ .getWriteActionsMiss()
+ .getAction()
+ .stream()
+ .map(Action::getAction)
+ .forEach(action -> ActionUtil
+ .writeActionHeader(
+ action,
+ EncodeConstants.OF13_VERSION_ID,
+ registry,
+ byteBuf));
+ }
+
+ @Override
+ protected TableFeaturesPropType getType() {
+ return TableFeaturesPropType.OFPTFPTWRITEACTIONSMISS;
+ }
+
+ @Override
+ protected Class<WriteActionsMiss> getClazz() {
+ return WriteActionsMiss.class;
+ }
+
+ @Override
+ public void injectSerializerRegistry(final SerializerRegistry serializerRegistry) {
+ registry = serializerRegistry;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures;
+
+import io.netty.buffer.ByteBuf;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistryInjector;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.util.ActionUtil;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.Action;
+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 {
+
+ private SerializerRegistry registry;
+
+ @Override
+ protected void serializeProperty(final WriteActions property, final ByteBuf byteBuf) {
+ property
+ .getWriteActions()
+ .getAction()
+ .stream()
+ .map(Action::getAction)
+ .forEach(action -> ActionUtil
+ .writeActionHeader(
+ action,
+ EncodeConstants.OF13_VERSION_ID,
+ registry,
+ byteBuf));
+ }
+
+ @Override
+ protected TableFeaturesPropType getType() {
+ return TableFeaturesPropType.OFPTFPTWRITEACTIONS;
+ }
+
+ @Override
+ protected Class<WriteActions> getClazz() {
+ return WriteActions.class;
+ }
+
+ @Override
+ public void injectSerializerRegistry(final SerializerRegistry serializerRegistry) {
+ registry = serializerRegistry;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures;
+
+import io.netty.buffer.ByteBuf;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistryInjector;
+import org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableFeaturesPropType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.MatchField;
+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 {
+
+ private SerializerRegistry registry;
+
+ @Override
+ protected void serializeProperty(final WriteSetfieldMiss property, final ByteBuf byteBuf) {
+ property
+ .getWriteSetfieldMiss()
+ .getSetFieldMatch()
+ .forEach(setFieldMatch -> registry
+ .<MatchField, OFSerializer<SetFieldMatch>>getSerializer(
+ new MessageTypeKey<>(
+ EncodeConstants.OF13_VERSION_ID,
+ setFieldMatch.getMatchType()))
+ .serialize(setFieldMatch, byteBuf));
+ }
+
+ @Override
+ protected TableFeaturesPropType getType() {
+ return TableFeaturesPropType.OFPTFPTWRITESETFIELDMISS;
+ }
+
+ @Override
+ protected Class<WriteSetfieldMiss> getClazz() {
+ return WriteSetfieldMiss.class;
+ }
+
+ @Override
+ public void injectSerializerRegistry(final SerializerRegistry serializerRegistry) {
+ registry = serializerRegistry;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures;
+
+import io.netty.buffer.ByteBuf;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistryInjector;
+import org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableFeaturesPropType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.MatchField;
+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 {
+
+ private SerializerRegistry registry;
+
+ @Override
+ protected void serializeProperty(final WriteSetfield property, final ByteBuf byteBuf) {
+ property
+ .getWriteSetfield()
+ .getSetFieldMatch()
+ .forEach(setFieldMatch -> registry
+ .<MatchField, OFSerializer<SetFieldMatch>>getSerializer(
+ new MessageTypeKey<>(
+ EncodeConstants.OF13_VERSION_ID,
+ setFieldMatch.getMatchType()))
+ .serialize(setFieldMatch, byteBuf));
+ }
+
+ @Override
+ protected TableFeaturesPropType getType() {
+ return TableFeaturesPropType.OFPTFPTWRITESETFIELD;
+ }
+
+ @Override
+ protected Class<WriteSetfield> getClazz() {
+ return WriteSetfield.class;
+ }
+
+ @Override
+ public void injectSerializerRegistry(final SerializerRegistry serializerRegistry) {
+ registry = serializerRegistry;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
+
+import io.netty.buffer.ByteBuf;
+import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.set.field.match.SetFieldMatch;
+
+public abstract class AbstractMatchFieldSerializer implements OFSerializer<SetFieldMatch> {
+
+ @Override
+ public void serialize(final SetFieldMatch setFieldMatch, final ByteBuf byteBuf) {
+ byteBuf.writeShort(getOxmClassCode());
+
+ int fieldAndMask = getOxmFieldCode() << 1;
+ int length = getValueLength();
+
+ if (setFieldMatch.isHasMask()) {
+ fieldAndMask |= 1;
+ length *= 2;
+ }
+
+ byteBuf.writeByte(fieldAndMask);
+ byteBuf.writeByte(length);
+ }
+
+ protected abstract int getOxmClassCode();
+ protected abstract int getOxmFieldCode();
+ protected abstract int getValueLength();
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+public class ArpOpMatchFieldSerializer extends AbstractMatchFieldSerializer {
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.ARP_OP;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+public class ArpShaMatchFieldSerializer extends AbstractMatchFieldSerializer {
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.ARP_SHA;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.MAC_ADDRESS_LENGTH;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+public class ArpSpaMatchFieldSerializer extends AbstractMatchFieldSerializer {
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.ARP_SPA;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+public class ArpThaMatchFieldSerializer extends AbstractMatchFieldSerializer {
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.ARP_THA;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.MAC_ADDRESS_LENGTH;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+public class ArpTpaMatchFieldSerializer extends AbstractMatchFieldSerializer {
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.ARP_TPA;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+public class EthDstMatchFieldSerializer extends AbstractMatchFieldSerializer {
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.ETH_DST;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.MAC_ADDRESS_LENGTH;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+public class EthSrcMatchFieldSerializer extends AbstractMatchFieldSerializer {
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.ETH_SRC;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.MAC_ADDRESS_LENGTH;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+public class EthTypeMatchFieldSerializer extends AbstractMatchFieldSerializer {
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.ETH_TYPE;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+public class Icmpv4CodeMatchFieldSerializer extends AbstractMatchFieldSerializer {
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.ICMPV4_CODE;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+public class Icmpv4TypeMatchFieldSerializer extends AbstractMatchFieldSerializer {
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.ICMPV4_TYPE;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+public class Icmpv6CodeMatchFieldSerializer extends AbstractMatchFieldSerializer {
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.ICMPV6_CODE;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+public class Icmpv6TypeMatchFieldSerializer extends AbstractMatchFieldSerializer {
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.ICMPV6_TYPE;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+public class InPhyPortMatchFieldSerializer extends AbstractMatchFieldSerializer {
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.IN_PHY_PORT;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+public class InPortMatchFieldSerializer extends AbstractMatchFieldSerializer {
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.IN_PORT;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+public class IpDscpMatchFieldSerializer extends AbstractMatchFieldSerializer {
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.IP_DSCP;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+public class IpEcnMatchFieldSerializer extends AbstractMatchFieldSerializer {
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.IP_ECN;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+public class IpProtoMatchFieldSerializer extends AbstractMatchFieldSerializer {
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.IP_PROTO;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+public class Ipv4DstMatchFieldSerializer extends AbstractMatchFieldSerializer {
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.IPV4_DST;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+public class Ipv4SrcMatchFieldSerializer extends AbstractMatchFieldSerializer {
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.IPV4_SRC;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+public class Ipv6DstMatchFieldSerializer extends AbstractMatchFieldSerializer {
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.IPV6_DST;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_IPV6_ADDRESS_IN_BYTES;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+public class Ipv6ExtHdrMatchFieldSerializer extends AbstractMatchFieldSerializer {
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.IPV6_EXTHDR;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+public class Ipv6FlabelMatchFieldSerializer extends AbstractMatchFieldSerializer {
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.IPV6_FLABEL;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+public class Ipv6NdSllMatchFieldSerializer extends AbstractMatchFieldSerializer {
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.IPV6_ND_SLL;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.MAC_ADDRESS_LENGTH;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+public class Ipv6NdTargetMatchFieldSerializer extends AbstractMatchFieldSerializer {
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.IPV6_ND_TARGET;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_IPV6_ADDRESS_IN_BYTES;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+public class Ipv6NdTllMatchFieldSerializer extends AbstractMatchFieldSerializer {
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.IPV6_ND_TLL;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.MAC_ADDRESS_LENGTH;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+public class Ipv6SrcMatchFieldSerializer extends AbstractMatchFieldSerializer {
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.IPV6_SRC;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_IPV6_ADDRESS_IN_BYTES;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+public class MetadataMatchFieldSerializer extends AbstractMatchFieldSerializer {
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.METADATA;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_LONG_IN_BYTES;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+public class MplsBosMatchFieldSerializer extends AbstractMatchFieldSerializer {
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.MPLS_BOS;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+public class MplsLabelMatchFieldSerializer extends AbstractMatchFieldSerializer {
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.MPLS_LABEL;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+public class MplsTcMatchFieldSerializer extends AbstractMatchFieldSerializer {
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.MPLS_TC;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+public class PbbIsidMatchFieldSerializer extends AbstractMatchFieldSerializer {
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.PBB_ISID;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_3_BYTES;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+public class SctpDstMatchFieldSerializer extends AbstractMatchFieldSerializer {
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.SCTP_DST;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+public class SctpSrcMatchFieldSerializer extends AbstractMatchFieldSerializer {
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.SCTP_SRC;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+public class TcpDstMatchFieldSerializer extends AbstractMatchFieldSerializer {
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.TCP_DST;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+public class TcpFlagsMatchFieldSerializer extends AbstractMatchFieldSerializer {
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.EXPERIMENTER_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return EncodeConstants.ONFOXM_ET_TCP_FLAGS;
+ }
+
+ @Override
+ protected int getValueLength() {
+ // Increase length by experimenter ID length
+ return EncodeConstants.SIZE_OF_SHORT_IN_BYTES + EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+public class TcpSrcMatchFieldSerializer extends AbstractMatchFieldSerializer {
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.TCP_SRC;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+public class TunnelIdMatchFieldSerializer extends AbstractMatchFieldSerializer {
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.TUNNEL_ID;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_LONG_IN_BYTES;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+public class UdpDstMatchFieldSerializer extends AbstractMatchFieldSerializer {
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.UDP_DST;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+public class UdpSrcMatchFieldSerializer extends AbstractMatchFieldSerializer {
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.UDP_SRC;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+public class VlanPcpMatchFieldSerializer extends AbstractMatchFieldSerializer {
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.VLAN_PCP;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_BYTE_IN_BYTES;
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart.tablefeatures.matchfield;
+
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+public class VlanVidMatchFieldSerializer extends AbstractMatchFieldSerializer {
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.OPENFLOW_BASIC_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.VLAN_VID;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_SHORT_IN_BYTES;
+ }
+}
import io.netty.buffer.ByteBuf;
import java.util.List;
import java.util.Optional;
+import org.opendaylight.openflowjava.protocol.api.extensibility.HeaderSerializer;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
import org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey;
}
}
+ /**
+ * Serialize OpenFlow action header, using extension converter if available
+ * TODO: Remove also extension converters
+ *
+ * @param action OpenFlowPlugin action
+ * @param version OpenFlow version
+ * @param registry serializer registry
+ * @param outBuffer output buffer
+ */
+ @SuppressWarnings("unchecked")
+ 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;
+ });
+ } catch (final IllegalStateException | ClassCastException e) {
+ 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}
* to OpenFlowJava action
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.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.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.Instruction;
+
+/**
+ * Utility class for instruction serialization
+ */
+public class InstructionUtil {
+
+ /**
+ * Serialize instruction
+ * @param instruction OpenFlow instruction
+ * @param version OpenFlow version
+ * @param registry OpenFlowJava serializer registry
+ * @param outBuffer output buffer
+ */
+ @SuppressWarnings("unchecked")
+ public static void writeInstruction(final Instruction instruction,
+ final short version,
+ final SerializerRegistry registry,
+ final ByteBuf outBuffer) {
+
+ registry.<Instruction, OFSerializer<Instruction>>getSerializer(
+ new MessageTypeKey<>(
+ EncodeConstants.OF13_VERSION_ID,
+ (Class<Instruction>) instruction.getImplementedInterface()))
+ .serialize(instruction, outBuffer);
+ }
+
+
+ /**
+ * Serialize instruction header
+ * @param instruction OpenFlow instruction
+ * @param version OpenFlow version
+ * @param registry OpenFlowJava serializer registry
+ * @param outBuffer output buffer
+ */
+ @SuppressWarnings("unchecked")
+ public static void writeInstructionHeader(final Instruction instruction,
+ final short version,
+ final SerializerRegistry registry,
+ final ByteBuf outBuffer) {
+
+ registry.<Instruction, HeaderSerializer<Instruction>>getSerializer(
+ new MessageTypeKey<>(
+ EncodeConstants.OF13_VERSION_ID,
+ (Class<Instruction>) instruction.getImplementedInterface()))
+ .serializeHeader(instruction, outBuffer);
+ }
+
+}
MdSalRegistrationUtils.registerServices(this, deviceContext, extensionConverterProvider, convertorExecutor);
- if (isStatisticsRpcEnabled) {
+ if (isStatisticsRpcEnabled && !deviceContext.canUseSingleLayerSerialization()) {
MdSalRegistrationUtils.registerStatCompatibilityServices(
this,
deviceContext,
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableOutputBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.multipart.reply.multipart.reply.body.MultipartReplyTableFeatures;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.multipart.reply.multipart.reply.body.MultipartReplyTableFeatures;
import org.opendaylight.yangtools.yang.common.RpcError.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.opendaylight.openflowjava.protocol.impl.util.InstructionConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableFeaturesPropType;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.multipart.reply.multipart.reply.body.MultipartReplyTableFeatures;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.multipart.reply.multipart.reply.body.MultipartReplyTableFeatures;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplyActions;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplyActionsMiss;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.ApplySetfield;
--- /dev/null
+/*
+ * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowplugin.impl.protocol.serialization.multipart;
+
+import static org.junit.Assert.assertEquals;
+
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.UnpooledByteBufAllocator;
+import org.junit.Test;
+import org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.util.ByteBufUtils;
+import org.opendaylight.openflowplugin.impl.protocol.serialization.AbstractSerializerTest;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.multipart.request.multipart.request.body.MultipartRequestDescBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.MultipartRequest;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.multipart.types.rev170112.MultipartRequestBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
+
+public class MultipartRequestMessageSerializerTest extends AbstractSerializerTest {
+ // Multipart request message constants
+ private static final byte PADDING_IN_MULTIPART_REQUEST_MESSAGE = 4;
+ private static final short LENGTH = 16;
+ private static final Long XID = 42L;
+ private static final short VERSION = EncodeConstants.OF13_VERSION_ID;
+ private static final boolean IS_REQUEST_MORE = false;
+ private static final MultipartType MULTIPART_TYPE = MultipartType.OFPMPDESC;
+ private static final int MESSAGE_TYPE = 18;
+
+ // Message
+ private static final MultipartRequest MESSAGE = new MultipartRequestBuilder()
+ .setRequestMore(IS_REQUEST_MORE)
+ .setXid(XID)
+ .setVersion(VERSION)
+ .setMultipartRequestBody(new MultipartRequestDescBuilder()
+ .build())
+ .build();
+
+ private MultipartRequestMessageSerializer serializer;
+
+
+ @Override
+ protected void init() {
+ serializer = getRegistry().getSerializer(new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, MultipartRequest.class)) ;
+ }
+
+ @Test
+ public void testSerialize() throws Exception {
+ final ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
+ serializer.serialize(MESSAGE, out);
+
+ // Header
+ assertEquals(out.readByte(), VERSION);
+ assertEquals(out.readByte(), MESSAGE_TYPE);
+ assertEquals(out.readUnsignedShort(), LENGTH);
+ assertEquals(out.readInt(), XID.intValue());
+
+ // Body
+ assertEquals(out.readShort(), MULTIPART_TYPE.getIntValue());
+ assertEquals(out.readUnsignedShort(), ByteBufUtils.fillBitMask(0, IS_REQUEST_MORE));
+ out.skipBytes(PADDING_IN_MULTIPART_REQUEST_MESSAGE);
+
+ assertEquals(out.readableBytes(), 0);
+ }
+
+}
\ No newline at end of file