Augments the low-level openflowjava models and
OF13 implementation to support flow based tunnels
rather then port based tunnels only which is ovsdb
specific thus making a more generic TEP implementation.
I used the v4 parent serializer
AbstractOxmIpv4AddressSerializer since its pretty
class agnostic except for the v4 OpenflowBasic
match but it that is abstracted from the DP and
I don't see any glaring issues uses it. If you
guys would prefer an NXM1Class/NXM0Class specific
ipv4 super just say the word. I have both
implementations local with the same result in the DP.
Output of tests and ovs integration is posted here:
https://gist.github.com/
22f0749bba00df1a3cf6
Change-Id: I0f3ebed560bba0137553944fe342704456b4658e
Signed-off-by: Brent Salisbury <brent.salisbury@gmail.com>
type uint16;\r
}\r
}\r
+ augment "/oxm:oxm-container/oxm:match-entries" {\r
+ ext:augment-identifier "tunnel-ipv4-dst-match-entry";\r
+ leaf tunnel-ipv4-dst {\r
+ type inet:ipv4-address;\r
+ }\r
+ }\r
+ augment "/oxm:oxm-container/oxm:match-entries" {\r
+ ext:augment-identifier "tunnel-ipv4-src-match-entry";\r
+ leaf tunnel-ipv4-src {\r
+ type inet:ipv4-address;\r
+ }\r
+ }\r
\r
// OFP_ACTION AUGMENTS\r
augment "/ofaction:actions-container/ofaction:action" {\r
base match-field;
description "NXM field for NXM_NX_TCP_FLAGS";
}
+ identity tunnel_ipv4_dst {
+ base match-field;
+ description "NXM field for NXM_NX_TUN_IPV4_DST";
+ }
+ identity tunnel_ipv4_src {
+ base match-field;
+ description "NXM field for NXM_NX_TUN_IPV4_SRC";
+ }
container oxm-container {
uses oxm-fields-grouping;
}
\r
import org.opendaylight.openflowjava.protocol.api.extensibility.DeserializerRegistry;\r
import org.opendaylight.openflowjava.protocol.impl.deserialization.match.NxmTcpFlagDeserializer;\r
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.NxmTunnelIpv4DstDeserializer;\r
+import org.opendaylight.openflowjava.protocol.impl.deserialization.match.NxmTunnelIpv4SrcDeserializer;\r
import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmArpOpDeserializer;\r
import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmArpShaDeserializer;\r
import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmArpSpaDeserializer;\r
MatchEntryDeserializerRegistryHelper nxm1helper =\r
new MatchEntryDeserializerRegistryHelper(EncodeConstants.OF13_VERSION_ID,\r
OxmMatchConstants.NXM_1_CLASS, registry);\r
+ nxm1helper.register(OxmMatchConstants.NXM_NX_TUN_IPV4_SRC, new NxmTunnelIpv4SrcDeserializer());\r
+ nxm1helper.register(OxmMatchConstants.NXM_NX_TUN_IPV4_DST, new NxmTunnelIpv4DstDeserializer());\r
nxm1helper.register(OxmMatchConstants.NXM_NX_TCP_FLAG, new NxmTcpFlagDeserializer());\r
\r
}\r
--- /dev/null
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * 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.protocol.impl.deserialization.match;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Clazz;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Nxm1Class;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TunnelIpv4Dst;
+
+/**
+ * @author brent.salisbury
+ *
+ */
+public class NxmTunnelIpv4DstDeserializer extends AbstractOxmIpv4AddressDeserializer {
+
+ @Override
+ protected Class<? extends MatchField> getOxmField() {
+ return TunnelIpv4Dst.class;
+ }
+
+ @Override
+ protected Class<? extends Clazz> getOxmClass() {
+ return Nxm1Class.class;
+ }
+}
--- /dev/null
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * 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.protocol.impl.deserialization.match;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Clazz;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Nxm1Class;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TunnelIpv4Src;
+
+/**
+ * @author brent.salisbury
+ *
+ */
+public class NxmTunnelIpv4SrcDeserializer extends AbstractOxmIpv4AddressDeserializer {
+
+ @Override
+ protected Class<? extends MatchField> getOxmField() {
+ return TunnelIpv4Src.class;
+ }
+
+ @Override
+ protected Class<? extends Clazz> getOxmClass() {
+ return Nxm1Class.class;
+ }
+}
\r
import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;\r
import org.opendaylight.openflowjava.protocol.impl.serialization.match.NxmTcpFlagSerializer;\r
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.NxmTunnelIpv4DstSerializer;\r
+import org.opendaylight.openflowjava.protocol.impl.serialization.match.NxmTunnelIpv4SrcSerializer;\r
import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmArpOpSerializer;\r
import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmArpShaSerializer;\r
import org.opendaylight.openflowjava.protocol.impl.serialization.match.OxmArpSpaSerializer;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TcpFlag;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TcpSrc;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TunnelId;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TunnelIpv4Dst;\r
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.TunnelIpv4Src;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.UdpDst;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.UdpSrc;\r
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.VlanPcp;\r
Class<Nxm1Class> nxm1Class = Nxm1Class.class;\r
EnhancedKeyRegistryHelper<Nxm1Class> nxm1RegistryHelper =\r
new EnhancedKeyRegistryHelper<>(EncodeConstants.OF13_VERSION_ID, nxm1Class, serializerRegistry);\r
+ nxm1RegistryHelper.registerSerializer(TunnelIpv4Dst.class, new NxmTunnelIpv4DstSerializer());\r
+ nxm1RegistryHelper.registerSerializer(TunnelIpv4Src.class, new NxmTunnelIpv4SrcSerializer());\r
nxm1RegistryHelper.registerSerializer(TcpFlag.class, new NxmTcpFlagSerializer());\r
}\r
}\r
--- /dev/null
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * 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.protocol.impl.serialization.match;
+
+import org.opendaylight.openflowjava.protocol.impl.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.util.OxmMatchConstants;
+
+/**
+ * @author brent.salisbury
+ *
+ */
+public class NxmTunnelIpv4DstSerializer extends AbstractOxmIpv4AddressSerializer {
+
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.NXM_1_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.NXM_NX_TUN_IPV4_DST;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ }
+
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (C) 2014 Red Hat, Inc.
+ *
+ * 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.protocol.impl.serialization.match;
+
+import org.opendaylight.openflowjava.protocol.impl.util.EncodeConstants;
+import org.opendaylight.openflowjava.protocol.impl.util.OxmMatchConstants;
+
+/**
+ * @author brent.salisbury
+ *
+ */
+public class NxmTunnelIpv4SrcSerializer extends AbstractOxmIpv4AddressSerializer {
+
+ @Override
+ protected int getOxmClassCode() {
+ return OxmMatchConstants.NXM_1_CLASS;
+ }
+
+ @Override
+ protected int getOxmFieldCode() {
+ return OxmMatchConstants.NXM_NX_TUN_IPV4_SRC;
+ }
+
+ @Override
+ protected int getValueLength() {
+ return EncodeConstants.SIZE_OF_INT_IN_BYTES;
+ }
+
+}
* OFPXMC_NXM_1 class Constants\r
*/\r
\r
+ /** NXM IPv4 Tunnel Endpoint Source */\r
+ public static final int NXM_NX_TUN_IPV4_SRC = 31;\r
+ /** NXM IPv4 Tunnel Endpoint Destination */\r
+ public static final int NXM_NX_TUN_IPV4_DST = 32;\r
/** NXM TCP_Flag value */\r
public static final int NXM_NX_TCP_FLAG = 34;\r
}
\ No newline at end of file