BUG-4132 add ip src,dst and icmp type match attrs 35/32135/1
authorJosh <jhershbe@redhat.com>
Tue, 5 Jan 2016 13:47:31 +0000 (15:47 +0200)
committerJosh <jhershbe@redhat.com>
Tue, 5 Jan 2016 13:47:31 +0000 (15:47 +0200)
ip src, ip dst, and icmp type fields are required
to construct the proper response to ICMP echo
requests. OVS 2.5 will support these fields.
Changes in ovsdb to follow.

Change-Id: Ife6961a13be346e39b9218cb2032ec5141cd6d5a
Signed-off-by: Josh <jhershbe@redhat.com>
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/NiciraMatchCodecs.java
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/IcmpTypeCodec.java [new file with mode: 0644]
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/IpDstCodec.java [new file with mode: 0644]
extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/IpSrcCodec.java [new file with mode: 0644]
extension/openflowjava-extension-nicira/src/main/yang/nicira-match.yang
extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/action/RegMoveConvertor.java
extension/openflowplugin-extension-nicira/src/main/yang/openflowplugin-extension-nicira-action.yang
extension/openflowplugin-extension-nicira/src/main/yang/openflowplugin-extension-nicira-match.yang

index c730a128a3acdd42cb8ede07f03f360d3c554bce..d0c08b88d31fd8babdcf32ee3b5fdcaa873df994 100644 (file)
@@ -1,5 +1,5 @@
-/**
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+/*
+ * Copyright (c) 2014, 2016 Cisco Systems, Inc. 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,
@@ -17,6 +17,9 @@ import org.opendaylight.openflowjava.nx.codec.match.CtZoneCodec;
 import org.opendaylight.openflowjava.nx.codec.match.EthDstCodec;
 import org.opendaylight.openflowjava.nx.codec.match.EthSrcCodec;
 import org.opendaylight.openflowjava.nx.codec.match.EthTypeCodec;
+import org.opendaylight.openflowjava.nx.codec.match.IcmpTypeCodec;
+import org.opendaylight.openflowjava.nx.codec.match.IpSrcCodec;
+import org.opendaylight.openflowjava.nx.codec.match.IpDstCodec;
 import org.opendaylight.openflowjava.nx.codec.match.Nshc1Codec;
 import org.opendaylight.openflowjava.nx.codec.match.Nshc2Codec;
 import org.opendaylight.openflowjava.nx.codec.match.Nshc3Codec;
@@ -41,7 +44,7 @@ import org.opendaylight.openflowjava.nx.codec.match.UdpSrcCodec;
 
 /**
  * @author msunal
- *
+ * @author Josh Hershberg (jhershbe@redhat.com)
  */
 public class NiciraMatchCodecs {
 
@@ -76,4 +79,7 @@ public class NiciraMatchCodecs {
     public static final UdpDstCodec UDP_DST_CODEC = new UdpDstCodec();
     public static final CtStateCodec CT_ST_CODEC = new CtStateCodec();
     public static final CtZoneCodec CT_ZONE_CODEC = new CtZoneCodec();
+    public static final IpSrcCodec IP_SRC_CODEC = new IpSrcCodec();
+    public static final IpDstCodec IP_DST_CODEC = new IpDstCodec();
+    public static final IcmpTypeCodec ICMP_TYPE_CODEC = new IcmpTypeCodec();
 }
diff --git a/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/IcmpTypeCodec.java b/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/IcmpTypeCodec.java
new file mode 100644 (file)
index 0000000..3353382
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2016 Red Hat, Inc. 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.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.NxmOfIcmpType;
+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.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.IcmpTypeCaseValue;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.of.match.icmp.type.grouping.IcmpTypeValuesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.IcmpTypeCaseValueBuilder;
+
+/**
+ * @author Josh Hershberg (jhershbe@redhat.com)
+ */
+public class IcmpTypeCodec extends AbstractMatchCodec {
+    private static final int VALUE_LENGTH = 1;
+    private static final int NXM_FIELD_CODE = 13;
+    public static final MatchEntrySerializerKey<Nxm0Class, NxmOfIcmpType> SERIALIZER_KEY = new MatchEntrySerializerKey<>(
+            EncodeConstants.OF13_VERSION_ID, Nxm0Class.class, NxmOfIcmpType.class);
+    public static final MatchEntryDeserializerKey DESERIALIZER_KEY = new MatchEntryDeserializerKey(
+            EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_0_CLASS, NXM_FIELD_CODE);
+
+    @Override
+    public MatchEntry deserialize(ByteBuf message) {
+        MatchEntryBuilder matchEntriesBuilder = deserializeHeader(message);
+        IcmpTypeCaseValueBuilder icmpTypeCaseValueBuilder = new IcmpTypeCaseValueBuilder();
+        icmpTypeCaseValueBuilder.setIcmpTypeValues(new IcmpTypeValuesBuilder().setValue(message.readUnsignedByte()).build());
+        matchEntriesBuilder.setMatchEntryValue(icmpTypeCaseValueBuilder.build());
+        matchEntriesBuilder.setHasMask(false);
+        return matchEntriesBuilder.build();
+    }
+
+    @Override
+    public void serialize(MatchEntry input, ByteBuf outBuffer) {
+        serializeHeader(input, outBuffer);
+        IcmpTypeCaseValue icmpTypeValue = ((IcmpTypeCaseValue) input.getMatchEntryValue());
+        outBuffer.writeByte(icmpTypeValue.getIcmpTypeValues().getValue());
+    }
+
+    @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 NxmOfIcmpType.class;
+    }
+
+    @Override
+    public Class<? extends OxmClassBase> getOxmClass() {
+        return Nxm0Class.class;
+    }
+}
diff --git a/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/IpDstCodec.java b/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/IpDstCodec.java
new file mode 100644 (file)
index 0000000..bd22d5d
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2016 Red Hat, Inc. 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.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.NxmOfIpDst;
+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.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.IpDstCaseValue;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.IpDstCaseValueBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.of.match.ip.dst.grouping.IpDstValuesBuilder;
+
+/**
+ * @author Josh Hershberg (jhershbe@redhat.com)
+ */
+public class IpDstCodec extends AbstractMatchCodec {
+
+    private static final int VALUE_LENGTH = 4;
+    private static final int NXM_FIELD_CODE = 8;
+    public static final MatchEntrySerializerKey<Nxm0Class, NxmOfIpDst> SERIALIZER_KEY = new MatchEntrySerializerKey<>(
+            EncodeConstants.OF13_VERSION_ID, Nxm0Class.class, NxmOfIpDst.class);
+    public static final MatchEntryDeserializerKey DESERIALIZER_KEY = new MatchEntryDeserializerKey(
+            EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_0_CLASS, NXM_FIELD_CODE);
+
+
+    @Override
+    public MatchEntry deserialize(ByteBuf message) {
+        MatchEntryBuilder matchEntriesBuilder = deserializeHeader(message);
+        IpDstCaseValueBuilder caseBuilder = new IpDstCaseValueBuilder();
+        caseBuilder.setIpDstValues(new IpDstValuesBuilder().setValue(message.readUnsignedInt()).build());
+        matchEntriesBuilder.setMatchEntryValue(caseBuilder.build());
+        return matchEntriesBuilder.build();
+    }
+
+    @Override
+    public void serialize(MatchEntry input, ByteBuf outBuffer) {
+        serializeHeader(input, outBuffer);
+        IpDstCaseValue ipDstCase = ((IpDstCaseValue) input.getMatchEntryValue());
+        outBuffer.writeInt(ipDstCase.getIpDstValues().getValue().intValue());
+    }
+
+    @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 NxmOfIpDst.class;
+    }
+
+    @Override
+    public Class<? extends OxmClassBase> getOxmClass() {
+        return Nxm0Class.class;
+    }
+
+}
diff --git a/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/IpSrcCodec.java b/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/IpSrcCodec.java
new file mode 100644 (file)
index 0000000..eb48ef0
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2016 Red Hat, Inc. 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.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.NxmOfIpSrc;
+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.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.IpSrcCaseValue;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.IpSrcCaseValueBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.ofj.nxm.of.match.ip.src.grouping.IpSrcValuesBuilder;
+
+/**
+ * @author Josh Hershberg (jhershbe@redhat.com)
+ */
+public class IpSrcCodec extends AbstractMatchCodec {
+
+    private static final int VALUE_LENGTH = 4;
+    private static final int NXM_FIELD_CODE = 7;
+    public static final MatchEntrySerializerKey<Nxm0Class, NxmOfIpSrc> SERIALIZER_KEY = new MatchEntrySerializerKey<>(
+            EncodeConstants.OF13_VERSION_ID, Nxm0Class.class, NxmOfIpSrc.class);
+    public static final MatchEntryDeserializerKey DESERIALIZER_KEY = new MatchEntryDeserializerKey(
+            EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_0_CLASS, NXM_FIELD_CODE);
+
+
+    @Override
+    public MatchEntry deserialize(ByteBuf message) {
+        MatchEntryBuilder matchEntriesBuilder = deserializeHeader(message);
+        IpSrcCaseValueBuilder caseBuilder = new IpSrcCaseValueBuilder();
+        caseBuilder.setIpSrcValues(new IpSrcValuesBuilder().setValue(message.readUnsignedInt()).build());
+        matchEntriesBuilder.setMatchEntryValue(caseBuilder.build());
+        return matchEntriesBuilder.build();
+    }
+
+    @Override
+    public void serialize(MatchEntry input, ByteBuf outBuffer) {
+        serializeHeader(input, outBuffer);
+        IpSrcCaseValue ipSrcCase = ((IpSrcCaseValue) input.getMatchEntryValue());
+        outBuffer.writeInt(ipSrcCase.getIpSrcValues().getValue().intValue());
+    }
+
+    @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 NxmOfIpSrc.class;
+    }
+
+    @Override
+    public Class<? extends OxmClassBase> getOxmClass() {
+        return Nxm0Class.class;
+    }
+
+}
index 07f9962a0ed158929f16576bbe82e3d1f359a1a8..043c84dfa3f4f7f4d0d52870eab2d6bcb22f497f 100644 (file)
@@ -111,7 +111,16 @@ module nicira-match {
     identity nxm-nx-ct-state {
         base ofoxm:match-field;
     }
-     identity nxm-nx-ct-zone {
+    identity nxm-nx-ct-zone {
+        base ofoxm:match-field;
+    }
+    identity nxm-of-ip-dst {
+        base ofoxm:match-field;
+    }
+    identity nxm-of-ip-src {
+        base ofoxm:match-field;
+    }
+    identity nxm-of-icmp-type {
         base ofoxm:match-field;
     }
 
@@ -299,6 +308,28 @@ module nicira-match {
             }
         }
     }
+    grouping ofj-nxm-of-match-ip-dst-grouping {
+        container ip-dst-values {
+            leaf value {
+                type uint32;
+            }
+        }
+    }
+    grouping ofj-nxm-of-match-ip-src-grouping {
+        container ip-src-values {
+            leaf value {
+                type uint32;
+            }
+        }
+    }
+    grouping ofj-nxm-of-match-icmp-type-grouping {
+        container icmp-type-values {
+            leaf value {
+                type uint8;
+            }
+        }
+    }
+
     augment "/ofoxm:oxm-container/ofoxm:match-entry-value" {
         ext:augment-identifier "ofj-aug-nx-match";
         case reg-case-value {
@@ -374,6 +405,15 @@ module nicira-match {
         case ct-zone-case-value {
             uses ofj-nxm-nx-match-ct-zone-grouping;
         }
+        case ip-dst-case-value {
+            uses ofj-nxm-of-match-ip-dst-grouping;
+        }
+        case ip-src-case-value {
+            uses ofj-nxm-of-match-ip-src-grouping;
+        }
+        case icmp-type-case-value {
+            uses ofj-nxm-of-match-icmp-type-grouping;
+        }
 
     }
 
index 9a1f34658154c154aabfa27bf89be9eb00a77704..958a7cc062ba575cc1fc37fd8fb57c2111636294 100644 (file)
@@ -1,5 +1,5 @@
-/**
- * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+/*
+ * Copyright (c) 2014, 2016 Cisco Systems, Inc. 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,
@@ -63,6 +63,12 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.ni
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstOfEthDstCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstOfEthSrcCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstOfEthSrcCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstOfIcmpTypeCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstOfIcmpTypeCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstOfIpDstCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstOfIpDstCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstOfIpSrcCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.dst.choice.grouping.dst.choice.DstOfIpSrcCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.flows.statistics.update.flow.and.statistics.map.list.instructions.instruction.instruction.apply.actions._case.apply.actions.action.action.NxActionRegMoveNotifFlowsStatisticsUpdateApplyActionsCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.flows.statistics.update.flow.and.statistics.map.list.instructions.instruction.instruction.write.actions._case.write.actions.action.action.NxActionRegMoveNotifFlowsStatisticsUpdateWriteActionsCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.group.desc.stats.updated.group.desc.stats.buckets.bucket.action.action.NxActionRegMoveNotifGroupDescStatsUpdatedCaseBuilder;
@@ -110,11 +116,17 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.ni
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcOfEthSrcCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcOfEthTypeCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcOfEthTypeCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcOfIpDstCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcOfIpDstCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcOfIpSrcCase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.nicira.action.rev140714.src.choice.grouping.src.choice.SrcOfIpSrcCaseBuilder;
+
 
 import com.google.common.base.Preconditions;
 
 /**
  * @author msunal
+ * @author Josh Hershberg (jhershbe@redhat.com)
  */
 public class RegMoveConvertor implements
         ConvertorActionToOFJava<org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.Action, Action>,
@@ -190,6 +202,16 @@ public class RegMoveConvertor implements
         if (dstValue == NiciraMatchCodecs.NSC4_CODEC.getHeaderWithoutHasMask().toLong()) {
             return new DstNxNshc4CaseBuilder().setNxNshc4Dst(true).build();
         }
+        if (dstValue == NiciraMatchCodecs.IP_SRC_CODEC.getHeaderWithoutHasMask().toLong()) {
+            return new DstOfIpSrcCaseBuilder().setOfIpSrc(true).build();
+        }
+        if (dstValue == NiciraMatchCodecs.IP_DST_CODEC.getHeaderWithoutHasMask().toLong()) {
+            return new DstOfIpDstCaseBuilder().setOfIpDst(true).build();
+        }
+        if (dstValue == NiciraMatchCodecs.ICMP_TYPE_CODEC.getHeaderWithoutHasMask().toLong()) {
+            return new DstOfIcmpTypeCaseBuilder().setOfIcmpType(true).build();
+        }
+
         throw new CodecPreconditionException("Missing codec for " + new NxmHeader(dstValue));
     }
 
@@ -249,6 +271,13 @@ public class RegMoveConvertor implements
         if (srcValue == NiciraMatchCodecs.NSC4_CODEC.getHeaderWithoutHasMask().toLong()) {
             return new SrcNxNshc4CaseBuilder().setNxNshc4Dst(true).build();
         }
+        if (srcValue == NiciraMatchCodecs.IP_DST_CODEC.getHeaderWithoutHasMask().toLong()) {
+            return new SrcOfIpDstCaseBuilder().setOfIpDst(true).build();
+        }
+        if (srcValue == NiciraMatchCodecs.IP_SRC_CODEC.getHeaderWithoutHasMask().toLong()) {
+            return new SrcOfIpSrcCaseBuilder().setOfIpSrc(true).build();
+        }
+
         throw new CodecPreconditionException("Missing codec for " + new NxmHeader(srcValue));
     }
 
@@ -373,6 +402,16 @@ public class RegMoveConvertor implements
         if (dstChoice instanceof DstNxNshc4Case) {
             return  NiciraMatchCodecs.NSC4_CODEC.getHeaderWithoutHasMask().toLong();
         }
+        if (dstChoice instanceof DstOfIpSrcCase) {
+            return NiciraMatchCodecs.IP_SRC_CODEC.getHeaderWithoutHasMask().toLong();
+        }
+        if (dstChoice instanceof DstOfIpDstCase) {
+            return NiciraMatchCodecs.IP_DST_CODEC.getHeaderWithoutHasMask().toLong();
+        }
+        if (dstChoice instanceof DstOfIcmpTypeCase) {
+            return NiciraMatchCodecs.ICMP_TYPE_CODEC.getHeaderWithoutHasMask().toLong();
+        }
+
 
         throw new CodecPreconditionException("Missing implementation of a case in dst-choice? " + dstChoice.getClass());
     }
@@ -438,10 +477,14 @@ public class RegMoveConvertor implements
         if (srcChoice instanceof SrcNxNshc4Case) {
             return  NiciraMatchCodecs.NSC4_CODEC.getHeaderWithoutHasMask().toLong();
         }
+        if (srcChoice instanceof SrcOfIpSrcCase) {
+            return NiciraMatchCodecs.IP_SRC_CODEC.getHeaderWithoutHasMask().toLong();
+        }
+        if (srcChoice instanceof SrcOfIpDstCase) {
+            return NiciraMatchCodecs.IP_DST_CODEC.getHeaderWithoutHasMask().toLong();
+        }
 
-
-
-        throw new CodecPreconditionException("Missing implementation of a case in dst-choice? " + srcChoice.getClass());
+        throw new CodecPreconditionException("Missing implementation of a case in src-choice? " + srcChoice.getClass());
     }
 
     private static long resolveReg(Class<? extends NxmNxReg> reg) {
index 21e7d444d41824c6dd6e5fbb7877ae0ccce8a1f9..ceeddeedcc45acdab0013e0348ce42b9651e8096 100644 (file)
@@ -123,6 +123,21 @@ module openflowplugin-extension-nicira-action {
             type empty;
         }
     }
+    grouping nxm-of-ip-src-grouping {
+        leaf of-ip-src {
+            type empty;
+        }
+    }
+    grouping nxm-of-ip-dst-grouping {
+        leaf of-ip-dst {
+            type empty;
+        }
+    }
+    grouping nxm-of-icmp-type-grouping {
+        leaf of-icmp-type {
+            type empty;
+        }
+    }
 
     grouping dst-choice-grouping {
         choice dst-choice {
@@ -177,6 +192,15 @@ module openflowplugin-extension-nicira-action {
             case dst-nx-nshc-4-case {
                 uses nxm-nx-nshc-4-grouping;
             }
+            case dst-of-ip-src-case {
+                uses nxm-of-ip-src-grouping;
+            }
+            case dst-of-ip-dst-case {
+                uses nxm-of-ip-dst-grouping;
+            }
+            case dst-of-icmp-type-case {
+                uses nxm-of-icmp-type-grouping;
+            }
         }
     }
 
@@ -236,6 +260,12 @@ module openflowplugin-extension-nicira-action {
             case src-nx-nshc-4-case {
                 uses nxm-nx-nshc-4-grouping;
             }
+            case src-of-ip-src-case {
+                uses nxm-of-ip-src-grouping;
+            }
+            case src-of-ip-dst-case {
+                uses nxm-of-ip-dst-grouping;
+            }
         }
     }
 
index 7e148a5d83c4a40eeb84da308adbd66379fc52c6..f4a3bd04db92a92624ecfd5b6e52ef0223170b06 100644 (file)
@@ -115,6 +115,15 @@ module openflowplugin-extension-nicira-match {
     identity nxm-nx-ct-zone-key {
         base ext-gen:extension-key;
     }
+    identity nxm-of-ip-dst-key {
+        base ext-gen:extension-key;
+    }
+    identity nxm-of-ip-src-key {
+        base ext-gen:extension-key;
+    }
+    identity nxm-of-icmp-type-key {
+        base ext-gen:extension-key;
+    }
     grouping ipv4-address-grouping {
         leaf ipv4-address {
             type inet:ipv4-address;
@@ -301,6 +310,23 @@ module openflowplugin-extension-nicira-match {
             }
         }
     }
+    grouping nxm-of-ip-dst-grouping {
+        container nxm-of-ip-dst {
+            uses ipv4-address-grouping;
+        }
+    }
+    grouping nxm-of-ip-src-grouping {
+        container nxm-of-ip-src {
+            uses ipv4-address-grouping;
+        }
+    }
+    grouping nxm-of-icmp-type-grouping {
+        container nxm-of-icmp-type {
+            leaf value {
+                type uint8;
+            }
+        }
+    }
 
 
     grouping all-matches-grouping {
@@ -328,6 +354,9 @@ module openflowplugin-extension-nicira-match {
         uses nxm-of-udp-dst-grouping;
         uses nxm-nx-ct-state-grouping;
         uses nxm-nx-ct-zone-grouping;
+        uses nxm-of-ip-dst-grouping;
+        uses nxm-of-ip-src-grouping;
+        uses nxm-of-icmp-type-grouping;
     }
 
     // MATCH augmentations