import org.opendaylight.openflowjava.nx.codec.match.Reg5Codec;
import org.opendaylight.openflowjava.nx.codec.match.Reg6Codec;
import org.opendaylight.openflowjava.nx.codec.match.Reg7Codec;
+import org.opendaylight.openflowjava.nx.codec.match.TcpDstCodec;
+import org.opendaylight.openflowjava.nx.codec.match.TcpSrcCodec;
import org.opendaylight.openflowjava.nx.codec.match.TunIdCodec;
import org.opendaylight.openflowjava.nx.codec.match.TunIpv4DstCodec;
import org.opendaylight.openflowjava.nx.codec.match.TunIpv4SrcCodec;
+import org.opendaylight.openflowjava.nx.codec.match.UdpDstCodec;
+import org.opendaylight.openflowjava.nx.codec.match.UdpSrcCodec;
import com.google.common.base.Preconditions;
registrator.registerMatchEntryDeserializer(TunIpv4DstCodec.DESERIALIZER_KEY, NiciraMatchCodecs.TUN_IPV4_DST_CODEC);
registrator.registerMatchEntrySerializer(TunIpv4SrcCodec.SERIALIZER_KEY, NiciraMatchCodecs.TUN_IPV4_SRC_CODEC);
registrator.registerMatchEntryDeserializer(TunIpv4SrcCodec.DESERIALIZER_KEY, NiciraMatchCodecs.TUN_IPV4_SRC_CODEC);
+ registrator.registerMatchEntrySerializer(TcpSrcCodec.SERIALIZER_KEY, NiciraMatchCodecs.TCP_SRC_CODEC);
+ registrator.registerMatchEntryDeserializer(TcpSrcCodec.DESERIALIZER_KEY, NiciraMatchCodecs.TCP_SRC_CODEC);
+ registrator.registerMatchEntrySerializer(TcpDstCodec.SERIALIZER_KEY, NiciraMatchCodecs.TCP_DST_CODEC);
+ registrator.registerMatchEntryDeserializer(TcpDstCodec.DESERIALIZER_KEY, NiciraMatchCodecs.TCP_DST_CODEC);
+ registrator.registerMatchEntrySerializer(UdpSrcCodec.SERIALIZER_KEY, NiciraMatchCodecs.UDP_SRC_CODEC);
+ registrator.registerMatchEntryDeserializer(UdpSrcCodec.DESERIALIZER_KEY, NiciraMatchCodecs.UDP_SRC_CODEC);
+ registrator.registerMatchEntrySerializer(UdpDstCodec.SERIALIZER_KEY, NiciraMatchCodecs.UDP_DST_CODEC);
+ registrator.registerMatchEntryDeserializer(UdpDstCodec.DESERIALIZER_KEY, NiciraMatchCodecs.UDP_DST_CODEC);
}
public void unregisterExtensions() {
registrator.unregisterMatchEntryDeserializer(TunIpv4DstCodec.DESERIALIZER_KEY);
registrator.unregisterMatchEntrySerializer(TunIpv4SrcCodec.SERIALIZER_KEY);
registrator.unregisterMatchEntryDeserializer(TunIpv4SrcCodec.DESERIALIZER_KEY);
+ registrator.unregisterMatchEntrySerializer(TcpSrcCodec.SERIALIZER_KEY);
+ registrator.unregisterMatchEntryDeserializer(TcpSrcCodec.DESERIALIZER_KEY);
+ registrator.unregisterMatchEntrySerializer(TcpDstCodec.SERIALIZER_KEY);
+ registrator.unregisterMatchEntryDeserializer(TcpDstCodec.DESERIALIZER_KEY);
+ registrator.unregisterMatchEntrySerializer(UdpSrcCodec.SERIALIZER_KEY);
+ registrator.unregisterMatchEntryDeserializer(UdpSrcCodec.DESERIALIZER_KEY);
+ registrator.unregisterMatchEntrySerializer(UdpDstCodec.SERIALIZER_KEY);
+ registrator.unregisterMatchEntryDeserializer(UdpDstCodec.DESERIALIZER_KEY);
}
@Override
import org.opendaylight.openflowjava.nx.codec.match.Reg5Codec;
import org.opendaylight.openflowjava.nx.codec.match.Reg6Codec;
import org.opendaylight.openflowjava.nx.codec.match.Reg7Codec;
+import org.opendaylight.openflowjava.nx.codec.match.TcpDstCodec;
+import org.opendaylight.openflowjava.nx.codec.match.TcpSrcCodec;
import org.opendaylight.openflowjava.nx.codec.match.TunIdCodec;
import org.opendaylight.openflowjava.nx.codec.match.TunIpv4DstCodec;
import org.opendaylight.openflowjava.nx.codec.match.TunIpv4SrcCodec;
+import org.opendaylight.openflowjava.nx.codec.match.UdpDstCodec;
+import org.opendaylight.openflowjava.nx.codec.match.UdpSrcCodec;
/**
* @author msunal
public static final Nshc2Codec NSC2_CODEC = new Nshc2Codec();
public static final Nshc3Codec NSC3_CODEC = new Nshc3Codec();
public static final Nshc4Codec NSC4_CODEC = new Nshc4Codec();
+ public static final TcpSrcCodec TCP_SRC_CODEC = new TcpSrcCodec();
+ public static final TcpDstCodec TCP_DST_CODEC = new TcpDstCodec();
+ public static final UdpSrcCodec UDP_SRC_CODEC = new UdpSrcCodec();
+ public static final UdpDstCodec UDP_DST_CODEC = new UdpDstCodec();
}
--- /dev/null
+/*
+ * Copyright (c) 2015 Hewlett-Packard Enterprise and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.nx.codec.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm0Class;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
+
+import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmOfTcpDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.of.match.tcp.dst.grouping.TcpDstValuesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.TcpDstCaseValue;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.TcpDstCaseValueBuilder;
+
+/**
+ * @author Aswin Suryanarayanan.
+ */
+
+public class TcpDstCodec extends AbstractMatchCodec {
+
+ private static final int VALUE_LENGTH = 4;
+ private static final int NXM_FIELD_CODE = 10;
+ public static final MatchEntrySerializerKey<Nxm0Class, NxmOfTcpDst> SERIALIZER_KEY = new MatchEntrySerializerKey<>(
+ EncodeConstants.OF13_VERSION_ID, Nxm0Class.class, NxmOfTcpDst.class);
+ public static final MatchEntryDeserializerKey DESERIALIZER_KEY = new MatchEntryDeserializerKey(
+ EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_0_CLASS, NXM_FIELD_CODE);
+
+ @Override
+ public void serialize(MatchEntry input, ByteBuf outBuffer) {
+ serializeHeader(input, outBuffer);
+ TcpDstCaseValue tcpDstCase = ((TcpDstCaseValue) input.getMatchEntryValue());
+ outBuffer.writeShort(tcpDstCase.getTcpDstValues().getPort().getValue());
+ outBuffer.writeShort(tcpDstCase.getTcpDstValues().getMask());
+ }
+
+ @Override
+ public MatchEntry deserialize(ByteBuf message) {
+ MatchEntryBuilder matchEntryBuilder = deserializeHeader(message);
+ matchEntryBuilder.setHasMask(true);
+ int portNo = message.readUnsignedShort();
+ int mask = message.readUnsignedShort();
+ message.readBytes(mask);
+ TcpDstCaseValueBuilder caseBuilder = new TcpDstCaseValueBuilder();
+ TcpDstValuesBuilder tcpDstValuesBuilder = new TcpDstValuesBuilder();
+ tcpDstValuesBuilder.setPort(new PortNumber(portNo));
+ tcpDstValuesBuilder.setMask(portNo);
+ caseBuilder.setTcpDstValues(tcpDstValuesBuilder.build());
+ matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
+ return matchEntryBuilder.build();
+ }
+
+ @Override
+ public int getNxmFieldCode() {
+ return NXM_FIELD_CODE;
+ }
+
+ @Override
+ public int getOxmClassCode() {
+ return OxmMatchConstants.NXM_0_CLASS;
+ }
+
+ @Override
+ public int getValueLength() {
+ return VALUE_LENGTH;
+ }
+
+ @Override
+ public Class<? extends MatchField> getNxmField() {
+ return NxmOfTcpDst.class;
+ }
+
+ @Override
+ public Class<? extends OxmClassBase> getOxmClass() {
+ return Nxm0Class.class;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2015 Hewlett-Packard Enterprise and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.nx.codec.match;
+
+import io.netty.buffer.ByteBuf;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm0Class;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
+
+import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmOfTcpSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.of.match.tcp.src.grouping.TcpSrcValuesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.TcpSrcCaseValue;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.TcpSrcCaseValueBuilder;
+
+/**
+ * @author Aswin Suryanarayanan.
+ */
+
+public class TcpSrcCodec extends AbstractMatchCodec {
+
+ private static final int VALUE_LENGTH = 4;
+ private static final int NXM_FIELD_CODE = 9;
+ public static final MatchEntrySerializerKey<Nxm0Class, NxmOfTcpSrc> SERIALIZER_KEY = new MatchEntrySerializerKey<>(
+ EncodeConstants.OF13_VERSION_ID, Nxm0Class.class, NxmOfTcpSrc.class);
+ public static final MatchEntryDeserializerKey DESERIALIZER_KEY = new MatchEntryDeserializerKey(
+ EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_0_CLASS, NXM_FIELD_CODE);
+
+ @Override
+ public void serialize(MatchEntry input, ByteBuf outBuffer) {
+ serializeHeader(input, outBuffer);
+ TcpSrcCaseValue tcpSrcCase = ((TcpSrcCaseValue) input.getMatchEntryValue());
+ outBuffer.writeShort(tcpSrcCase.getTcpSrcValues().getPort().getValue());
+ outBuffer.writeShort(tcpSrcCase.getTcpSrcValues().getMask());
+ }
+
+ @Override
+ public MatchEntry deserialize(ByteBuf message) {
+ MatchEntryBuilder matchEntryBuilder = deserializeHeader(message);
+ matchEntryBuilder.setHasMask(true);
+ int portNo = message.readUnsignedShort();
+ int mask = message.readUnsignedShort();
+ message.readBytes(mask);
+ TcpSrcCaseValueBuilder caseBuilder = new TcpSrcCaseValueBuilder();
+ TcpSrcValuesBuilder tcpSrcValuesBuilder = new TcpSrcValuesBuilder();
+ tcpSrcValuesBuilder.setPort(new PortNumber(portNo));
+ tcpSrcValuesBuilder.setMask(portNo);
+ caseBuilder.setTcpSrcValues(tcpSrcValuesBuilder.build());
+ matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
+ return matchEntryBuilder.build();
+ }
+
+ @Override
+ public int getNxmFieldCode() {
+ return NXM_FIELD_CODE;
+ }
+
+ @Override
+ public int getOxmClassCode() {
+ return OxmMatchConstants.NXM_0_CLASS;
+ }
+
+ @Override
+ public int getValueLength() {
+ return VALUE_LENGTH;
+ }
+
+ @Override
+ public Class<? extends MatchField> getNxmField() {
+ return NxmOfTcpSrc.class;
+ }
+
+ @Override
+ public Class<? extends OxmClassBase> getOxmClass() {
+ return Nxm0Class.class;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2015 Hewlett-Packard Enterprise and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.nx.codec.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm0Class;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
+
+import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmOfUdpDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.of.match.udp.dst.grouping.UdpDstValuesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.UdpDstCaseValue;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.UdpDstCaseValueBuilder;
+
+/**
+ * @author Aswin Suryanarayanan.
+ */
+
+public class UdpDstCodec extends AbstractMatchCodec {
+
+ private static final int VALUE_LENGTH = 4;
+ private static final int NXM_FIELD_CODE = 12;
+ public static final MatchEntrySerializerKey<Nxm0Class, NxmOfUdpDst> SERIALIZER_KEY = new MatchEntrySerializerKey<>(
+ EncodeConstants.OF13_VERSION_ID, Nxm0Class.class, NxmOfUdpDst.class);
+ public static final MatchEntryDeserializerKey DESERIALIZER_KEY = new MatchEntryDeserializerKey(
+ EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_0_CLASS, NXM_FIELD_CODE);
+
+ @Override
+ public void serialize(MatchEntry input, ByteBuf outBuffer) {
+ serializeHeader(input, outBuffer);
+ UdpDstCaseValue udpDstCase = ((UdpDstCaseValue) input.getMatchEntryValue());
+ outBuffer.writeShort(udpDstCase.getUdpDstValues().getPort().getValue());
+ outBuffer.writeShort(udpDstCase.getUdpDstValues().getMask());
+ }
+
+ @Override
+ public MatchEntry deserialize(ByteBuf message) {
+ MatchEntryBuilder matchEntryBuilder = deserializeHeader(message);
+ matchEntryBuilder.setHasMask(true);
+ int portNo = message.readUnsignedShort();
+ int mask = message.readUnsignedShort();
+ message.readBytes(mask);
+ UdpDstCaseValueBuilder caseBuilder = new UdpDstCaseValueBuilder();
+ UdpDstValuesBuilder udpDstValuesBuilder = new UdpDstValuesBuilder();
+ udpDstValuesBuilder.setPort(new PortNumber(portNo));
+ udpDstValuesBuilder.setMask(portNo);
+ caseBuilder.setUdpDstValues(udpDstValuesBuilder.build());
+ matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
+ return matchEntryBuilder.build();
+ }
+
+ @Override
+ public int getNxmFieldCode() {
+ return NXM_FIELD_CODE;
+ }
+
+ @Override
+ public int getOxmClassCode() {
+ return OxmMatchConstants.NXM_0_CLASS;
+ }
+
+ @Override
+ public int getValueLength() {
+ return VALUE_LENGTH;
+ }
+
+ @Override
+ public Class<? extends MatchField> getNxmField() {
+ return NxmOfUdpDst.class;
+ }
+
+ @Override
+ public Class<? extends OxmClassBase> getOxmClass() {
+ return Nxm0Class.class;
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2015 Hewlett-Packard Enterprise and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.openflowjava.nx.codec.match;
+
+import io.netty.buffer.ByteBuf;
+
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm0Class;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OxmClassBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
+
+import org.opendaylight.openflowjava.protocol.api.keys.MatchEntryDeserializerKey;
+import org.opendaylight.openflowjava.protocol.api.keys.MatchEntrySerializerKey;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmOfUdpSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.of.match.udp.src.grouping.UdpSrcValuesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.UdpSrcCaseValue;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.UdpSrcCaseValueBuilder;
+
+/**
+ * @author Aswin Suryanarayanan.
+ */
+
+public class UdpSrcCodec extends AbstractMatchCodec {
+
+ private static final int VALUE_LENGTH = 4;
+ private static final int NXM_FIELD_CODE = 11;
+ public static final MatchEntrySerializerKey<Nxm0Class, NxmOfUdpSrc> SERIALIZER_KEY = new MatchEntrySerializerKey<>(
+ EncodeConstants.OF13_VERSION_ID, Nxm0Class.class, NxmOfUdpSrc.class);
+ public static final MatchEntryDeserializerKey DESERIALIZER_KEY = new MatchEntryDeserializerKey(
+ EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_0_CLASS, NXM_FIELD_CODE);
+
+ @Override
+ public void serialize(MatchEntry input, ByteBuf outBuffer) {
+ serializeHeader(input, outBuffer);
+ UdpSrcCaseValue udpSrcCase = ((UdpSrcCaseValue) input.getMatchEntryValue());
+ outBuffer.writeShort(udpSrcCase.getUdpSrcValues().getPort().getValue());
+ outBuffer.writeShort(udpSrcCase.getUdpSrcValues().getMask());
+ }
+
+ @Override
+ public MatchEntry deserialize(ByteBuf message) {
+ MatchEntryBuilder matchEntryBuilder = deserializeHeader(message);
+ matchEntryBuilder.setHasMask(true);
+ int portNo = message.readUnsignedShort();
+ int mask = message.readUnsignedShort();
+ message.readBytes(mask);
+ UdpSrcCaseValueBuilder caseBuilder = new UdpSrcCaseValueBuilder();
+ UdpSrcValuesBuilder udpSrcValuesBuilder = new UdpSrcValuesBuilder();
+ udpSrcValuesBuilder.setPort(new PortNumber(portNo));
+ udpSrcValuesBuilder.setMask(portNo);
+ caseBuilder.setUdpSrcValues(udpSrcValuesBuilder.build());
+ matchEntryBuilder.setMatchEntryValue(caseBuilder.build());
+ return matchEntryBuilder.build();
+ }
+
+ @Override
+ public int getNxmFieldCode() {
+ return NXM_FIELD_CODE;
+ }
+
+ @Override
+ public int getOxmClassCode() {
+ return OxmMatchConstants.NXM_0_CLASS;
+ }
+
+ @Override
+ public int getValueLength() {
+ return VALUE_LENGTH;
+ }
+
+ @Override
+ public Class<? extends MatchField> getNxmField() {
+ return NxmOfUdpSrc.class;
+ }
+
+ @Override
+ public Class<? extends OxmClassBase> getOxmClass() {
+ return Nxm0Class.class;
+ }
+
+}
namespace "urn:opendaylight:openflowjava:nx:match";
prefix "nicira-match";
-
+
import openflow-extensible-match {prefix ofoxm;}
import openflow-types {prefix oft;}
import ietf-yang-types {prefix yang; revision-date "2010-09-24";}
import yang-ext {prefix ext; revision-date "2013-07-09";}
+ import ietf-inet-types {prefix inet; revision-date "2010-09-24";}
- description
+ description
"Nicira openflow extensions of match.";
revision "2014-04-21" {
identity nxm-nx-nshc-4 {
base ofoxm:match-field;
}
+ identity nxm-of-tcp-src {
+ base ofoxm:match-field;
+ }
+ identity nxm-of-tcp-dst {
+ base ofoxm:match-field;
+ }
+ identity nxm-of-udp-src {
+ base ofoxm:match-field;
+ }
+ identity nxm-of-udp-dst {
+ base ofoxm:match-field;
+ }
grouping ofj-nxm-nx-match-reg-grouping {
container reg-values {
uses ofj-nxm-nx-match-nshc-grouping;
}
}
+ grouping ofj-nxm-of-match-tcp-src-grouping {
+ container tcp-src-values {
+ leaf port {
+ type inet:port-number;
+ }
+ leaf mask {
+ type uint16;
+ }
+ }
+ }
+ grouping ofj-nxm-of-match-tcp-dst-grouping {
+ container tcp-dst-values {
+ leaf port {
+ type inet:port-number;
+ }
+ leaf mask {
+ type uint16;
+ }
+ }
+ }
+ grouping ofj-nxm-of-match-udp-src-grouping {
+ container udp-src-values {
+ leaf port {
+ type inet:port-number;
+ }
+ leaf mask {
+ type uint16;
+ }
+ }
+ }
+ grouping ofj-nxm-of-match-udp-dst-grouping {
+ container udp-dst-values {
+ leaf port {
+ type inet:port-number;
+ }
+ leaf mask {
+ type uint16;
+ }
+ }
+ }
augment "/ofoxm:oxm-container/ofoxm:match-entry-value" {
ext:augment-identifier "ofj-aug-nx-match";
case nshc-4-case-value {
uses ofj-nxm-nx-match-nshc-4-grouping;
}
+ case tcp-src-case-value {
+ uses ofj-nxm-of-match-tcp-src-grouping;
+ }
+ case tcp-dst-case-value {
+ uses ofj-nxm-of-match-tcp-dst-grouping;
+ }
+ case udp-src-case-value {
+ uses ofj-nxm-of-match-udp-src-grouping;
+ }
+ case udp-dst-case-value {
+ uses ofj-nxm-of-match-udp-dst-grouping;
+ }
}
import org.opendaylight.openflowjava.nx.codec.match.Reg5Codec;
import org.opendaylight.openflowjava.nx.codec.match.Reg6Codec;
import org.opendaylight.openflowjava.nx.codec.match.Reg7Codec;
+import org.opendaylight.openflowjava.nx.codec.match.TcpSrcCodec;
+import org.opendaylight.openflowjava.nx.codec.match.TcpDstCodec;
import org.opendaylight.openflowjava.nx.codec.match.TunIdCodec;
import org.opendaylight.openflowjava.nx.codec.match.TunIpv4SrcCodec;
+import org.opendaylight.openflowjava.nx.codec.match.UdpSrcCodec;
+import org.opendaylight.openflowjava.nx.codec.match.UdpDstCodec;
import org.opendaylight.openflowjava.protocol.api.keys.ActionSerializerKey;
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowplugin.extension.api.ConverterExtensionKey;
import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.NsiConvertor;
import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.NspConvertor;
import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.RegConvertor;
+import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.TcpDstConvertor;
+import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.TcpSrcConvertor;
import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.TunIPv4SrcConvertor;
import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.TunIdConvertor;
+import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.UdpDstConvertor;
+import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.match.UdpSrcConvertor;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.action.grouping.ActionChoice;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.action.container.action.choice.ActionMultipath;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmOfEthDstKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmOfEthSrcKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmOfEthTypeKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmOfTcpDstKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmOfTcpSrcKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmOfUdpDstKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmOfUdpSrcKey;
import org.opendaylight.yangtools.concepts.ObjectRegistration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
private final static Nshc4Convertor NSC4_CONVERTOR = new Nshc4Convertor();
private final static TunIPv4SrcConvertor TUN_IPV4_SRC_CONVERTOR = new TunIPv4SrcConvertor();
private final static TunIPv4DstConvertor TUN_IPV4_DST_CONVERTOR = new TunIPv4DstConvertor();
+ private final static TcpSrcConvertor TCP_SRC_CONVERTOR = new TcpSrcConvertor();
+ private final static TcpDstConvertor TCP_DST_CONVERTOR = new TcpDstConvertor();
+ private final static UdpSrcConvertor UDP_SRC_CONVERTOR = new UdpSrcConvertor();
+ private final static UdpDstConvertor UDP_DST_CONVERTOR = new UdpDstConvertor();
@Override
public void close() {
registrations.add(extensionConverterRegistrator.registerMatchConvertor(TunIpv4SrcCodec.SERIALIZER_KEY, TUN_IPV4_SRC_CONVERTOR));
registrations.add(extensionConverterRegistrator.registerMatchConvertor(new ConverterExtensionKey<>(NxmNxTunIpv4DstKey.class, EncodeConstants.OF13_VERSION_ID), TUN_IPV4_DST_CONVERTOR));
registrations.add(extensionConverterRegistrator.registerMatchConvertor(TunIpv4DstCodec.SERIALIZER_KEY, TUN_IPV4_DST_CONVERTOR));
+ registrations.add(extensionConverterRegistrator.registerMatchConvertor(new ConverterExtensionKey<>(NxmOfTcpSrcKey.class, EncodeConstants.OF13_VERSION_ID), TCP_SRC_CONVERTOR));
+ registrations.add(extensionConverterRegistrator.registerMatchConvertor(TcpSrcCodec.SERIALIZER_KEY, TCP_SRC_CONVERTOR));
+ registrations.add(extensionConverterRegistrator.registerMatchConvertor(new ConverterExtensionKey<>(NxmOfTcpDstKey.class, EncodeConstants.OF13_VERSION_ID), TCP_DST_CONVERTOR));
+ registrations.add(extensionConverterRegistrator.registerMatchConvertor(TcpDstCodec.SERIALIZER_KEY, TCP_DST_CONVERTOR));
+ registrations.add(extensionConverterRegistrator.registerMatchConvertor(new ConverterExtensionKey<>(NxmOfUdpSrcKey.class, EncodeConstants.OF13_VERSION_ID), UDP_SRC_CONVERTOR));
+ registrations.add(extensionConverterRegistrator.registerMatchConvertor(UdpSrcCodec.SERIALIZER_KEY, UDP_SRC_CONVERTOR));
+ registrations.add(extensionConverterRegistrator.registerMatchConvertor(new ConverterExtensionKey<>(NxmOfUdpDstKey.class, EncodeConstants.OF13_VERSION_ID), UDP_DST_CONVERTOR));
+ registrations.add(extensionConverterRegistrator.registerMatchConvertor(UdpDstCodec.SERIALIZER_KEY, UDP_DST_CONVERTOR));
}
/**
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmOfEthDstGrouping;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmOfEthSrcGrouping;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmOfEthTypeGrouping;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmOfTcpDstGrouping;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmOfTcpSrcGrouping;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmOfUdpDstGrouping;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmOfUdpSrcGrouping;
import org.opendaylight.yangtools.yang.binding.Augmentation;
/**
NxmNxNshc3Grouping.class);
public final static GroupingResolver<NxmNxNshc4Grouping, Extension> nsc4Resolver = new GroupingResolver<>(
NxmNxNshc4Grouping.class);
+ public final static GroupingResolver<NxmOfTcpSrcGrouping, Extension> tcpSrcResolver = new GroupingResolver<>(
+ NxmOfTcpSrcGrouping.class);
+ public final static GroupingResolver<NxmOfTcpDstGrouping, Extension> tcpDstResolver = new GroupingResolver<>(
+ NxmOfTcpDstGrouping.class);
+ public final static GroupingResolver<NxmOfUdpSrcGrouping, Extension> udpSrcResolver = new GroupingResolver<>(
+ NxmOfUdpSrcGrouping.class);
+ public final static GroupingResolver<NxmOfUdpDstGrouping, Extension> udpDstResolver = new GroupingResolver<>(
+ NxmOfUdpDstGrouping.class);
+
static {
augmentationsOfExtension.add(NxAugMatchRpcAddFlow.class);
nsc2Resolver.setAugmentations(augmentationsOfExtension);
nsc3Resolver.setAugmentations(augmentationsOfExtension);
nsc4Resolver.setAugmentations(augmentationsOfExtension);
+ tcpSrcResolver.setAugmentations(augmentationsOfExtension);
+ tcpDstResolver.setAugmentations(augmentationsOfExtension);
+ udpSrcResolver.setAugmentations(augmentationsOfExtension);
+ udpDstResolver.setAugmentations(augmentationsOfExtension);
}
--- /dev/null
+/*
+ * Copyright (c) 2015 Hewlett-Packard Enterprise 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.extension.vendor.nicira.convertor.match;
+
+import com.google.common.base.Optional;
+
+import org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava;
+import org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava;
+import org.opendaylight.openflowplugin.extension.api.ExtensionAugment;
+import org.opendaylight.openflowplugin.extension.api.path.MatchPath;
+import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.CodecPreconditionException;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm0Class;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.ExtensionKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.grouping.Extension;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNotifPacketIn;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNotifPacketInBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNotifSwitchFlowRemoved;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNotifSwitchFlowRemovedBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNotifUpdateFlowStats;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNotifUpdateFlowStatsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmOfTcpDstGrouping;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmOfTcpDstKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.nxm.of.tcp.dst.grouping.NxmOfTcpDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.nxm.of.tcp.dst.grouping.NxmOfTcpDstBuilder;
+import org.opendaylight.yangtools.yang.binding.Augmentation;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.of.match.tcp.dst.grouping.TcpDstValuesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.TcpDstCaseValue;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.TcpDstCaseValueBuilder;
+
+/**
+ * @author Aswin Suryanarayanan.
+ */
+public class TcpDstConvertor implements ConvertorToOFJava<MatchEntry>, ConvertorFromOFJava<MatchEntry, MatchPath> {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava#convert
+ * (org.opendaylight.yangtools.yang.binding.DataContainer,
+ * org.opendaylight.openflowplugin.extension.api.path.AugmentationPath)
+ */
+ @Override
+ public ExtensionAugment<? extends Augmentation<Extension>> convert(MatchEntry input, MatchPath path) {
+ TcpDstCaseValue tcpDstCaseValue = ((TcpDstCaseValue) input.getMatchEntryValue());
+ NxmOfTcpDstBuilder tcpDstBuilder = new NxmOfTcpDstBuilder();
+ tcpDstBuilder.setPort(tcpDstCaseValue.getTcpDstValues().getPort());
+ tcpDstBuilder.setMask(tcpDstCaseValue.getTcpDstValues().getMask());
+ return resolveAugmentation(tcpDstBuilder.build(), path,
+ NxmOfTcpDstKey.class);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava#convert
+ * (org
+ * .opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general
+ * .rev140714.general.extension.grouping.Extension)
+ */
+ @Override
+ public MatchEntry convert(Extension extension) {
+ Optional<NxmOfTcpDstGrouping> matchGrouping = MatchUtil.tcpDstResolver.getExtension(extension);
+ if (!matchGrouping.isPresent()) {
+ throw new CodecPreconditionException(extension);
+ }
+ TcpDstCaseValueBuilder tcpDstCaseValueBuilder = new TcpDstCaseValueBuilder();
+ TcpDstValuesBuilder tcpDstValuesBuilder = new TcpDstValuesBuilder();
+ tcpDstValuesBuilder.setPort(matchGrouping.get().getNxmOfTcpDst().getPort());
+ tcpDstValuesBuilder.setMask(matchGrouping.get().getNxmOfTcpDst().getMask());
+ tcpDstCaseValueBuilder.setTcpDstValues(tcpDstValuesBuilder.build());
+ MatchEntryBuilder ofMatch = MatchUtil
+ .createDefaultMatchEntryBuilder(org.opendaylight.yang.gen.v1.urn
+ .opendaylight.openflowjava.nx.match.rev140421.NxmOfTcpDst.class,
+ Nxm0Class.class, tcpDstCaseValueBuilder.build());
+ ofMatch.setHasMask(true);
+ return ofMatch.build();
+ }
+
+ private static ExtensionAugment<? extends Augmentation<Extension>> resolveAugmentation(NxmOfTcpDst value,
+ MatchPath path, Class<? extends ExtensionKey> key) {
+ switch (path) {
+ case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH:
+ return new ExtensionAugment<>(NxAugMatchNotifUpdateFlowStats.class,
+ new NxAugMatchNotifUpdateFlowStatsBuilder().setNxmOfTcpDst(value).build(), key);
+ case PACKETRECEIVED_MATCH:
+ return new ExtensionAugment<>(NxAugMatchNotifPacketIn.class, new NxAugMatchNotifPacketInBuilder()
+ .setNxmOfTcpDst(value).build(), key);
+ case SWITCHFLOWREMOVED_MATCH:
+ return new ExtensionAugment<>(NxAugMatchNotifSwitchFlowRemoved.class,
+ new NxAugMatchNotifSwitchFlowRemovedBuilder().setNxmOfTcpDst(value).build(), key);
+ default:
+ throw new CodecPreconditionException(path);
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2015 Hewlett-Packard Enterprise 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.extension.vendor.nicira.convertor.match;
+
+import com.google.common.base.Optional;
+
+import org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava;
+import org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava;
+import org.opendaylight.openflowplugin.extension.api.ExtensionAugment;
+import org.opendaylight.openflowplugin.extension.api.path.MatchPath;
+import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.CodecPreconditionException;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm0Class;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.ExtensionKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.grouping.Extension;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNotifPacketIn;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNotifPacketInBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNotifSwitchFlowRemoved;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNotifSwitchFlowRemovedBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNotifUpdateFlowStats;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNotifUpdateFlowStatsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmOfTcpSrcGrouping;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmOfTcpSrcKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.nxm.of.tcp.src.grouping.NxmOfTcpSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.nxm.of.tcp.src.grouping.NxmOfTcpSrcBuilder;
+import org.opendaylight.yangtools.yang.binding.Augmentation;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.of.match.tcp.src.grouping.TcpSrcValuesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.TcpSrcCaseValue;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.TcpSrcCaseValueBuilder;
+
+/**
+ * @author Aswin Suryanarayanan.
+ */
+public class TcpSrcConvertor implements ConvertorToOFJava<MatchEntry>, ConvertorFromOFJava<MatchEntry, MatchPath> {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava#convert
+ * (org.opendaylight.yangtools.yang.binding.DataContainer,
+ * org.opendaylight.openflowplugin.extension.api.path.AugmentationPath)
+ */
+ @Override
+ public ExtensionAugment<? extends Augmentation<Extension>> convert(MatchEntry input, MatchPath path) {
+ TcpSrcCaseValue tcpSrcCaseValue = ((TcpSrcCaseValue) input.getMatchEntryValue());
+ NxmOfTcpSrcBuilder tcpSrcBuilder = new NxmOfTcpSrcBuilder();
+ tcpSrcBuilder.setPort(tcpSrcCaseValue.getTcpSrcValues().getPort());
+ tcpSrcBuilder.setMask(tcpSrcCaseValue.getTcpSrcValues().getMask());
+ return resolveAugmentation(tcpSrcBuilder.build(), path,
+ NxmOfTcpSrcKey.class);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava#convert
+ * (org
+ * .opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general
+ * .rev140714.general.extension.grouping.Extension)
+ */
+ @Override
+ public MatchEntry convert(Extension extension) {
+ Optional<NxmOfTcpSrcGrouping> matchGrouping = MatchUtil.tcpSrcResolver.getExtension(extension);
+ if (!matchGrouping.isPresent()) {
+ throw new CodecPreconditionException(extension);
+ }
+ TcpSrcCaseValueBuilder tcpSrcCaseValueBuilder = new TcpSrcCaseValueBuilder();
+ TcpSrcValuesBuilder tcpSrcValuesBuilder = new TcpSrcValuesBuilder();
+ tcpSrcValuesBuilder.setPort(matchGrouping.get().getNxmOfTcpSrc().getPort());
+ tcpSrcValuesBuilder.setMask(matchGrouping.get().getNxmOfTcpSrc().getMask());
+ tcpSrcCaseValueBuilder.setTcpSrcValues(tcpSrcValuesBuilder.build());
+ MatchEntryBuilder ofMatch = MatchUtil
+ .createDefaultMatchEntryBuilder(org.opendaylight.yang.gen.v1.urn
+ .opendaylight.openflowjava.nx.match.rev140421.NxmOfTcpSrc.class,
+ Nxm0Class.class, tcpSrcCaseValueBuilder.build());
+ ofMatch.setHasMask(true);
+ return ofMatch.build();
+ }
+
+ private static ExtensionAugment<? extends Augmentation<Extension>> resolveAugmentation(NxmOfTcpSrc value,
+ MatchPath path, Class<? extends ExtensionKey> key) {
+ switch (path) {
+ case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH:
+ return new ExtensionAugment<>(NxAugMatchNotifUpdateFlowStats.class,
+ new NxAugMatchNotifUpdateFlowStatsBuilder().setNxmOfTcpSrc(value).build(), key);
+ case PACKETRECEIVED_MATCH:
+ return new ExtensionAugment<>(NxAugMatchNotifPacketIn.class, new NxAugMatchNotifPacketInBuilder()
+ .setNxmOfTcpSrc(value).build(), key);
+ case SWITCHFLOWREMOVED_MATCH:
+ return new ExtensionAugment<>(NxAugMatchNotifSwitchFlowRemoved.class,
+ new NxAugMatchNotifSwitchFlowRemovedBuilder().setNxmOfTcpSrc(value).build(), key);
+ default:
+ throw new CodecPreconditionException(path);
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2015 Hewlett-Packard Enterprise 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.extension.vendor.nicira.convertor.match;
+
+import com.google.common.base.Optional;
+
+import org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava;
+import org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava;
+import org.opendaylight.openflowplugin.extension.api.ExtensionAugment;
+import org.opendaylight.openflowplugin.extension.api.path.MatchPath;
+import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.CodecPreconditionException;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm0Class;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.ExtensionKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.grouping.Extension;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNotifPacketIn;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNotifPacketInBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNotifSwitchFlowRemoved;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNotifSwitchFlowRemovedBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNotifUpdateFlowStats;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNotifUpdateFlowStatsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmOfUdpDstGrouping;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmOfUdpDstKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.nxm.of.udp.dst.grouping.NxmOfUdpDst;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.nxm.of.udp.dst.grouping.NxmOfUdpDstBuilder;
+import org.opendaylight.yangtools.yang.binding.Augmentation;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.of.match.udp.dst.grouping.UdpDstValuesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.UdpDstCaseValue;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.UdpDstCaseValueBuilder;
+
+/**
+ * @author Aswin Suryanarayanan.
+ */
+public class UdpDstConvertor implements ConvertorToOFJava<MatchEntry>, ConvertorFromOFJava<MatchEntry, MatchPath> {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava#convert
+ * (org.opendaylight.yangtools.yang.binding.DataContainer,
+ * org.opendaylight.openflowplugin.extension.api.path.AugmentationPath)
+ */
+ @Override
+ public ExtensionAugment<? extends Augmentation<Extension>> convert(MatchEntry input, MatchPath path) {
+ UdpDstCaseValue udpDstCaseValue = ((UdpDstCaseValue) input.getMatchEntryValue());
+ NxmOfUdpDstBuilder udpDstBuilder = new NxmOfUdpDstBuilder();
+ udpDstBuilder.setPort(udpDstCaseValue.getUdpDstValues().getPort());
+ udpDstBuilder.setMask(udpDstCaseValue.getUdpDstValues().getMask());
+ return resolveAugmentation(udpDstBuilder.build(), path,
+ NxmOfUdpDstKey.class);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava#convert
+ * (org
+ * .opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general
+ * .rev140714.general.extension.grouping.Extension)
+ */
+ @Override
+ public MatchEntry convert(Extension extension) {
+ Optional<NxmOfUdpDstGrouping> matchGrouping = MatchUtil.udpDstResolver.getExtension(extension);
+ if (!matchGrouping.isPresent()) {
+ throw new CodecPreconditionException(extension);
+ }
+ UdpDstCaseValueBuilder udpDstCaseValueBuilder = new UdpDstCaseValueBuilder();
+ UdpDstValuesBuilder udpDstValuesBuilder = new UdpDstValuesBuilder();
+ udpDstValuesBuilder.setPort(matchGrouping.get().getNxmOfUdpDst().getPort());
+ udpDstValuesBuilder.setMask(matchGrouping.get().getNxmOfUdpDst().getMask());
+ udpDstCaseValueBuilder.setUdpDstValues(udpDstValuesBuilder.build());
+ MatchEntryBuilder ofMatch = MatchUtil
+ .createDefaultMatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight
+ .openflowjava.nx.match.rev140421.NxmOfUdpDst.class,
+ Nxm0Class.class,udpDstCaseValueBuilder.build());
+ ofMatch.setHasMask(true);
+ return ofMatch.build();
+ }
+
+ private static ExtensionAugment<? extends Augmentation<Extension>> resolveAugmentation(NxmOfUdpDst value,
+ MatchPath path, Class<? extends ExtensionKey> key) {
+ switch (path) {
+ case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH:
+ return new ExtensionAugment<>(NxAugMatchNotifUpdateFlowStats.class,
+ new NxAugMatchNotifUpdateFlowStatsBuilder().setNxmOfUdpDst(value).build(), key);
+ case PACKETRECEIVED_MATCH:
+ return new ExtensionAugment<>(NxAugMatchNotifPacketIn.class, new NxAugMatchNotifPacketInBuilder()
+ .setNxmOfUdpDst(value).build(), key);
+ case SWITCHFLOWREMOVED_MATCH:
+ return new ExtensionAugment<>(NxAugMatchNotifSwitchFlowRemoved.class,
+ new NxAugMatchNotifSwitchFlowRemovedBuilder().setNxmOfUdpDst(value).build(), key);
+ default:
+ throw new CodecPreconditionException(path);
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (c) 2015 Hewlett-Packard Enterprise 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.extension.vendor.nicira.convertor.match;
+
+import com.google.common.base.Optional;
+
+import org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava;
+import org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava;
+import org.opendaylight.openflowplugin.extension.api.ExtensionAugment;
+import org.opendaylight.openflowplugin.extension.api.path.MatchPath;
+import org.opendaylight.openflowplugin.extension.vendor.nicira.convertor.CodecPreconditionException;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm0Class;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.ExtensionKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.grouping.Extension;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNotifPacketIn;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNotifPacketInBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNotifSwitchFlowRemoved;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNotifSwitchFlowRemovedBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNotifUpdateFlowStats;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxAugMatchNotifUpdateFlowStatsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmOfUdpSrcGrouping;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.NxmOfUdpSrcKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.nxm.of.udp.src.grouping.NxmOfUdpSrc;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.match.rev140714.nxm.of.udp.src.grouping.NxmOfUdpSrcBuilder;
+import org.opendaylight.yangtools.yang.binding.Augmentation;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.of.match.udp.src.grouping.UdpSrcValuesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.UdpSrcCaseValue;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.UdpSrcCaseValueBuilder;
+
+/**
+ * @author Aswin Suryanarayanan.
+ */
+public class UdpSrcConvertor implements ConvertorToOFJava<MatchEntry>, ConvertorFromOFJava<MatchEntry, MatchPath> {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.opendaylight.openflowplugin.extension.api.ConvertorFromOFJava#convert
+ * (org.opendaylight.yangtools.yang.binding.DataContainer,
+ * org.opendaylight.openflowplugin.extension.api.path.AugmentationPath)
+ */
+ @Override
+ public ExtensionAugment<? extends Augmentation<Extension>> convert(MatchEntry input, MatchPath path) {
+ UdpSrcCaseValue udpSrcCaseValue = ((UdpSrcCaseValue) input.getMatchEntryValue());
+ NxmOfUdpSrcBuilder udpSrcBuilder = new NxmOfUdpSrcBuilder();
+ udpSrcBuilder.setPort(udpSrcCaseValue.getUdpSrcValues().getPort());
+ udpSrcBuilder.setMask(udpSrcCaseValue.getUdpSrcValues().getMask());
+ return resolveAugmentation(udpSrcBuilder.build(), path,
+ NxmOfUdpSrcKey.class);
+ }
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.opendaylight.openflowplugin.extension.api.ConvertorToOFJava#convert
+ * (org
+ * .opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general
+ * .rev140714.general.extension.grouping.Extension)
+ */
+ @Override
+ public MatchEntry convert(Extension extension) {
+ Optional<NxmOfUdpSrcGrouping> matchGrouping = MatchUtil.udpSrcResolver.getExtension(extension);
+ if (!matchGrouping.isPresent()) {
+ throw new CodecPreconditionException(extension);
+ }
+ UdpSrcCaseValueBuilder udpSrcCaseValueBuilder = new UdpSrcCaseValueBuilder();
+ UdpSrcValuesBuilder udpSrcValuesBuilder = new UdpSrcValuesBuilder();
+ udpSrcValuesBuilder.setPort(matchGrouping.get().getNxmOfUdpSrc().getPort());
+ udpSrcValuesBuilder.setMask(matchGrouping.get().getNxmOfUdpSrc().getMask());
+ udpSrcCaseValueBuilder.setUdpSrcValues(udpSrcValuesBuilder.build());
+ MatchEntryBuilder ofMatch = MatchUtil
+ .createDefaultMatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight
+ .openflowjava.nx.match.rev140421.NxmOfUdpSrc.class,
+ Nxm0Class.class, udpSrcCaseValueBuilder.build());
+ ofMatch.setHasMask(true);
+ return ofMatch.build();
+ }
+
+ private static ExtensionAugment<? extends Augmentation<Extension>> resolveAugmentation(NxmOfUdpSrc value,
+ MatchPath path, Class<? extends ExtensionKey> key) {
+ switch (path) {
+ case FLOWSSTATISTICSUPDATE_FLOWANDSTATISTICSMAPLIST_MATCH:
+ return new ExtensionAugment<>(NxAugMatchNotifUpdateFlowStats.class,
+ new NxAugMatchNotifUpdateFlowStatsBuilder().setNxmOfUdpSrc(value).build(), key);
+ case PACKETRECEIVED_MATCH:
+ return new ExtensionAugment<>(NxAugMatchNotifPacketIn.class, new NxAugMatchNotifPacketInBuilder()
+ .setNxmOfUdpSrc(value).build(), key);
+ case SWITCHFLOWREMOVED_MATCH:
+ return new ExtensionAugment<>(NxAugMatchNotifSwitchFlowRemoved.class,
+ new NxAugMatchNotifSwitchFlowRemovedBuilder().setNxmOfUdpSrc(value).build(), key);
+ default:
+ throw new CodecPreconditionException(path);
+ }
+ }
+}
identity nxm-nx-nshc-4-key {
base ext-gen:extension-key;
}
+ identity nxm-of-tcp-src-key {
+ base ext-gen:extension-key;
+ }
+ identity nxm-of-tcp-dst-key {
+ base ext-gen:extension-key;
+ }
+ identity nxm-of-udp-src-key {
+ base ext-gen:extension-key;
+ }
+ identity nxm-of-udp-dst-key {
+ base ext-gen:extension-key;
+ }
grouping ipv4-address-grouping {
leaf ipv4-address {
type inet:ipv4-address;
uses ipv4-address-grouping;
}
}
+ grouping nxm-of-tcp-src-grouping {
+ container nxm-of-tcp-src {
+ leaf port {
+ type inet:port-number;
+ }
+ leaf mask {
+ type uint16;
+ }
+ }
+ }
+ grouping nxm-of-tcp-dst-grouping {
+ container nxm-of-tcp-dst {
+ leaf port {
+ type inet:port-number;
+ }
+ leaf mask {
+ type uint16;
+ }
+ }
+ }
+ grouping nxm-of-udp-src-grouping {
+ container nxm-of-udp-src {
+ leaf port {
+ type inet:port-number;
+ }
+ leaf mask {
+ type uint16;
+ }
+ }
+ }
+ grouping nxm-of-udp-dst-grouping {
+ container nxm-of-udp-dst {
+ leaf port {
+ type inet:port-number;
+ }
+ leaf mask {
+ type uint16;
+ }
+ }
+ }
grouping nxm-of-arp-tpa-grouping {
container nxm-of-arp-tpa {
description "Prereqs: NXM_OF_ETH_TYPE must match either 0x0806 or 0x8035.";
uses nxm-nx-nshc-2-grouping;
uses nxm-nx-nshc-3-grouping;
uses nxm-nx-nshc-4-grouping;
+ uses nxm-of-tcp-src-grouping;
+ uses nxm-of-tcp-dst-grouping;
+ uses nxm-of-udp-src-grouping;
+ uses nxm-of-udp-dst-grouping;
}
-
+
// MATCH augmentations
// RPCS
augment "/sal-flow:add-flow/sal-flow:input/sal-flow:match/ext-gen:extension-list/ext-gen:extension" {