NETVIRT-1586 46/81346/6
authornithi thomas <nithi.t@altencalsoftlabs.com>
Tue, 2 Apr 2019 08:42:21 +0000 (14:12 +0530)
committerFaseela K <faseela.k@ericsson.com>
Tue, 20 Aug 2019 09:35:57 +0000 (09:35 +0000)
OVS Based NA Responder for IPv6 default Gateway

Change-Id: Idd52407babc7bbd9bc45da1910cb0767c4511af3
Signed-off-by: nithi thomas <nithi.t@altencalsoftlabs.com>
mdsalutil/mdsalutil-api/pom.xml
mdsalutil/mdsalutil-api/src/main/java/org/opendaylight/genius/mdsalutil/EricMatchInfo.java [new file with mode: 0644]
mdsalutil/mdsalutil-api/src/main/java/org/opendaylight/genius/mdsalutil/NwConstants.java
mdsalutil/mdsalutil-api/src/main/java/org/opendaylight/genius/mdsalutil/actions/ActionNdOptionType.java [new file with mode: 0644]
mdsalutil/mdsalutil-api/src/main/java/org/opendaylight/genius/mdsalutil/actions/ActionNdReserved.java [new file with mode: 0644]
mdsalutil/mdsalutil-api/src/main/java/org/opendaylight/genius/mdsalutil/actions/ActionSetIpv6NdTarget.java [new file with mode: 0644]
mdsalutil/mdsalutil-api/src/main/java/org/opendaylight/genius/mdsalutil/actions/ActionSetIpv6NdTll.java [new file with mode: 0644]
mdsalutil/mdsalutil-api/src/main/java/org/opendaylight/genius/mdsalutil/ericmatches/EricMatchInfoHelper.java [new file with mode: 0644]
mdsalutil/mdsalutil-api/src/main/java/org/opendaylight/genius/mdsalutil/ericmatches/MatchNdOptionType.java [new file with mode: 0644]
mdsalutil/mdsalutil-api/src/main/java/org/opendaylight/genius/mdsalutil/matches/MatchIpv6NdSll.java [new file with mode: 0644]

index a539624a478eae3edbb05cd63afd5f23339eaaf6..1009ed9e992ebec77c54e77b4499a2663d4e896c 100644 (file)
@@ -58,6 +58,16 @@ and is available at http://www.eclipse.org/legal/epl-v10.html
       <groupId>org.opendaylight.openflowplugin</groupId>
       <artifactId>openflowjava-extension-nicira</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.opendaylight.openflowplugin</groupId>
+      <artifactId>openflowplugin-extension-eric</artifactId>
+      <version>${openflowplugin.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.openflowplugin</groupId>
+      <artifactId>openflowjava-extension-eric</artifactId>
+      <version>${openflowplugin.version}</version>
+    </dependency>
     <dependency>
       <groupId>org.opendaylight.ovsdb</groupId>
       <artifactId>hwvtepsouthbound-api</artifactId>
diff --git a/mdsalutil/mdsalutil-api/src/main/java/org/opendaylight/genius/mdsalutil/EricMatchInfo.java b/mdsalutil/mdsalutil-api/src/main/java/org/opendaylight/genius/mdsalutil/EricMatchInfo.java
new file mode 100644 (file)
index 0000000..9a4181f
--- /dev/null
@@ -0,0 +1,11 @@
+/*
+ * Copyright (c) 2019 Alten Calsoft Labs India Pvt Ltd. 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.genius.mdsalutil;
+
+public interface EricMatchInfo extends MatchInfoBase {
+}
index 2783d6c98316c58484dd07b9f5e4cb14ccf7e332..9827c25aeb3ace38fded869c6e8cadace1f645c4 100644 (file)
@@ -227,6 +227,8 @@ public interface NwConstants {
         NXM_OF_ICMPv6_CODE(0x0001, 22, 1, 8),
         NXM_NX_ND_TARGET(0x0001, 23, 16, 128),
         NXM_NX_ND_TARGET_W(0x0001, 23, 16, 128),
+        OXM_OF_ICMPV6_TYPE(0x8000L, 29, 1, 8),
+        OXM_OF_IPV6_ND_TARGET(0x8000L, 31, 16, 128),
         NXM_NX_ND_SLL(0x0001, 24, 6, 48),
         NXM_NX_ND_TLL(0x0001, 25, 6, 48),
         NXM_NX_IP_FRAG(0x0001, 26, 1, 8),
diff --git a/mdsalutil/mdsalutil-api/src/main/java/org/opendaylight/genius/mdsalutil/actions/ActionNdOptionType.java b/mdsalutil/mdsalutil-api/src/main/java/org/opendaylight/genius/mdsalutil/actions/ActionNdOptionType.java
new file mode 100644 (file)
index 0000000..8a0f8aa
--- /dev/null
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2019 Alten Calsoft Labs India Pvt Ltd. 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.genius.mdsalutil.actions;
+
+import java.util.Collections;
+
+import org.opendaylight.genius.mdsalutil.ActionInfo;
+import org.opendaylight.openflowplugin.extension.api.ExtensionAugment;
+import org.opendaylight.openflowplugin.extension.api.GroupingLooseResolver;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetFieldCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.field._case.SetFieldBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.eric.match.rev180730.EricAugMatchNodesNodeTableFlow;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.eric.match.rev180730.EricAugMatchNodesNodeTableFlowBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.eric.match.rev180730.Icmpv6NdOptionsTypeKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.eric.match.rev180730.eric.of.icmpv6.nd.options.type.grouping.EricOfIcmpv6NdOptionsTypeBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.GeneralAugMatchNodesNodeTableFlowWriteActionsSetField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.GeneralAugMatchNodesNodeTableFlowWriteActionsSetFieldBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.GeneralExtensionListGrouping;
+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.general.rev140714.general.extension.grouping.ExtensionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.list.grouping.ExtensionListBuilder;
+import org.opendaylight.yangtools.yang.binding.Augmentation;
+
+/**
+ * Set source IPv6 action.
+ */
+public class ActionNdOptionType extends ActionInfo {
+
+    private final short ndOptionType;
+
+    public ActionNdOptionType(short ndOptionType) {
+        this(0, ndOptionType);
+    }
+
+    public ActionNdOptionType(int actionKey, short ndOptionType) {
+        super(actionKey);
+        this.ndOptionType = ndOptionType;
+    }
+
+    public short getNdOptionType() {
+        return ndOptionType;
+    }
+
+    @Override
+    public Action buildAction() {
+        return buildAction(getActionKey());
+    }
+
+    @Override
+    public Action buildAction(int newActionKey) {
+        GroupingLooseResolver<GeneralExtensionListGrouping> eqGroup =
+                new GroupingLooseResolver<>(GeneralExtensionListGrouping.class);
+        eqGroup.add(GeneralAugMatchNodesNodeTableFlowWriteActionsSetField.class);
+
+        ExtensionAugment<? extends Augmentation<Extension>> extensionMatch
+                =  new ExtensionAugment<>(EricAugMatchNodesNodeTableFlow.class,
+                new EricAugMatchNodesNodeTableFlowBuilder().setEricOfIcmpv6NdOptionsType(
+                        new EricOfIcmpv6NdOptionsTypeBuilder().setIcmpv6NdOptionsType(ndOptionType).build()).build(),
+                Icmpv6NdOptionsTypeKey.class);
+
+        ExtensionListBuilder extListBld = null;
+        ExtensionBuilder extBld = new ExtensionBuilder();
+        extBld.addAugmentation(extensionMatch.getAugmentationClass(), extensionMatch.getAugmentationObject());
+
+        extListBld = new ExtensionListBuilder();
+        extListBld.setExtension(extBld.build());
+        extListBld.setExtensionKey(extensionMatch.getKey());
+
+        GeneralAugMatchNodesNodeTableFlowWriteActionsSetField ndOptionsTypeSetField =
+                new GeneralAugMatchNodesNodeTableFlowWriteActionsSetFieldBuilder()
+                        .setExtensionList(Collections.singletonList(extListBld.build())).build();
+
+        return new ActionBuilder()
+                .setAction(new SetFieldCaseBuilder()
+                        .setSetField(new SetFieldBuilder()
+                                .addAugmentation(GeneralAugMatchNodesNodeTableFlowWriteActionsSetField.class,
+                                        ndOptionsTypeSetField)
+                                .build())
+                        .build())
+                .withKey(new ActionKey(newActionKey))
+                .build();
+    }
+
+
+    @Override
+    public boolean equals(Object other) {
+        if (this == other) {
+            return true;
+        }
+        if (other == null || getClass() != other.getClass()) {
+            return false;
+        }
+        if (!super.equals(other)) {
+            return false;
+        }
+
+        ActionNdOptionType that = (ActionNdOptionType) other;
+
+        return ndOptionType == that.ndOptionType;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = super.hashCode();
+        result = 31 * result + ndOptionType;
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        return "ActionNdOptionType [source=" + ndOptionType + ", getActionKey()=" + getActionKey() + "]";
+    }
+}
diff --git a/mdsalutil/mdsalutil-api/src/main/java/org/opendaylight/genius/mdsalutil/actions/ActionNdReserved.java b/mdsalutil/mdsalutil-api/src/main/java/org/opendaylight/genius/mdsalutil/actions/ActionNdReserved.java
new file mode 100644 (file)
index 0000000..6d255af
--- /dev/null
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2019 Alten Calsoft Labs India Pvt Ltd. 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.genius.mdsalutil.actions;
+
+import java.util.Collections;
+
+import org.opendaylight.genius.mdsalutil.ActionInfo;
+import org.opendaylight.openflowplugin.extension.api.ExtensionAugment;
+import org.opendaylight.openflowplugin.extension.api.GroupingLooseResolver;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetFieldCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.field._case.SetFieldBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.eric.match.rev180730.EricAugMatchNodesNodeTableFlow;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.eric.match.rev180730.EricAugMatchNodesNodeTableFlowBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.eric.match.rev180730.Icmpv6NdReservedKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.eric.match.rev180730.eric.of.icmpv6.nd.reserved.grouping.EricOfIcmpv6NdReservedBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.GeneralAugMatchNodesNodeTableFlowWriteActionsSetField;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.GeneralAugMatchNodesNodeTableFlowWriteActionsSetFieldBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.GeneralExtensionListGrouping;
+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.general.rev140714.general.extension.grouping.ExtensionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.list.grouping.ExtensionListBuilder;
+import org.opendaylight.yangtools.yang.binding.Augmentation;
+
+/**
+ * Set source IPv6 action.
+ */
+public class ActionNdReserved extends ActionInfo {
+
+    private final long ndReserved;
+
+    public ActionNdReserved(long ndReserved) {
+        this(0, ndReserved);
+    }
+
+    public ActionNdReserved(int actionKey, long ndReserved) {
+        super(actionKey);
+        this.ndReserved = ndReserved;
+    }
+
+    public long getNdReserved() {
+        return ndReserved;
+    }
+
+    @Override
+    public Action buildAction() {
+        return buildAction(getActionKey());
+    }
+
+    @Override
+    public Action buildAction(int newActionKey) {
+        GroupingLooseResolver<GeneralExtensionListGrouping> eqGroup =
+                new GroupingLooseResolver<>(GeneralExtensionListGrouping.class);
+        eqGroup.add(GeneralAugMatchNodesNodeTableFlowWriteActionsSetField.class);
+
+        ExtensionAugment<? extends Augmentation<Extension>> extensionMatch
+                =  new ExtensionAugment<>(EricAugMatchNodesNodeTableFlow.class,
+                new EricAugMatchNodesNodeTableFlowBuilder().setEricOfIcmpv6NdReserved(
+                        new EricOfIcmpv6NdReservedBuilder().setIcmpv6NdReserved(ndReserved).build()).build(),
+                Icmpv6NdReservedKey.class);
+
+        ExtensionListBuilder extListBld = null;
+        ExtensionBuilder extBld = new ExtensionBuilder();
+        extBld.addAugmentation(extensionMatch.getAugmentationClass(), extensionMatch.getAugmentationObject());
+
+        extListBld = new ExtensionListBuilder();
+        extListBld.setExtension(extBld.build());
+        extListBld.setExtensionKey(extensionMatch.getKey());
+
+        GeneralAugMatchNodesNodeTableFlowWriteActionsSetField ndReservedSetField =
+                new GeneralAugMatchNodesNodeTableFlowWriteActionsSetFieldBuilder()
+                        .setExtensionList(Collections.singletonList(extListBld.build())).build();
+
+        return new ActionBuilder()
+                .setAction(new SetFieldCaseBuilder()
+                        .setSetField(new SetFieldBuilder()
+                                .addAugmentation(GeneralAugMatchNodesNodeTableFlowWriteActionsSetField.class,
+                                        ndReservedSetField)
+                                .build())
+                        .build())
+                .withKey(new ActionKey(newActionKey))
+                .build();
+    }
+
+    @Override
+    public boolean equals(Object other) {
+        if (this == other) {
+            return true;
+        }
+        if (other == null || getClass() != other.getClass()) {
+            return false;
+        }
+        if (!super.equals(other)) {
+            return false;
+        }
+
+        ActionNdReserved that = (ActionNdReserved) other;
+
+        return ndReserved == that.ndReserved;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = super.hashCode();
+        result = 31 * result + (int) (ndReserved ^ ndReserved >>> 32);
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        return "ActionNdReserved [source=" + ndReserved + ", getActionKey()=" + getActionKey() + "]";
+    }
+}
diff --git a/mdsalutil/mdsalutil-api/src/main/java/org/opendaylight/genius/mdsalutil/actions/ActionSetIpv6NdTarget.java b/mdsalutil/mdsalutil-api/src/main/java/org/opendaylight/genius/mdsalutil/actions/ActionSetIpv6NdTarget.java
new file mode 100644 (file)
index 0000000..cb33e16
--- /dev/null
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2019 Alten Calsoft Labs India Pvt Ltd. 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.genius.mdsalutil.actions;
+
+import org.opendaylight.genius.mdsalutil.ActionInfo;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetFieldCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.field._case.SetFieldBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder;
+
+/**
+ * Set IPv6 ND TarAbstractClusteredAsyncDataTreeChangeListenerget action.
+ */
+public class ActionSetIpv6NdTarget extends ActionInfo {
+
+    private final Ipv6Address ndTarget;
+
+
+    public ActionSetIpv6NdTarget(Ipv6Address ndTarget) {
+        this(0, ndTarget);
+    }
+
+    public ActionSetIpv6NdTarget(int actionKey, Ipv6Address ndTarget) {
+        super(actionKey);
+        this.ndTarget = ndTarget;
+    }
+
+    @Override
+    public Action buildAction() {
+        return buildAction(getActionKey());
+    }
+
+    @Override
+    public Action buildAction(int newActionKey) {
+        return new ActionBuilder()
+                .setAction(new SetFieldCaseBuilder()
+                        .setSetField(new SetFieldBuilder()
+                                .setLayer3Match(new Ipv6MatchBuilder()
+                                        .setIpv6NdTarget(new Ipv6Address(ndTarget)).build())
+                                .build())
+                        .build())
+                .withKey(new ActionKey(newActionKey))
+                .build();
+    }
+
+    public Ipv6Address getNdTarget() {
+        return ndTarget;
+    }
+
+    @Override
+    public boolean equals(Object other) {
+        if (this == other) {
+            return true;
+        }
+        if (other == null || getClass() != other.getClass()) {
+            return false;
+        }
+        if (!super.equals(other)) {
+            return false;
+        }
+
+        ActionSetIpv6NdTarget that = (ActionSetIpv6NdTarget) other;
+
+        return ndTarget != null ? ndTarget.equals(that.ndTarget) : that.ndTarget == null;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = super.hashCode();
+        result = 31 * result + (ndTarget != null ? ndTarget.hashCode() : 0);
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        return "ActionSetIpv6NdTarget [source=" + ndTarget + ", getActionKey()=" + getActionKey() + "]";
+    }
+
+}
diff --git a/mdsalutil/mdsalutil-api/src/main/java/org/opendaylight/genius/mdsalutil/actions/ActionSetIpv6NdTll.java b/mdsalutil/mdsalutil-api/src/main/java/org/opendaylight/genius/mdsalutil/actions/ActionSetIpv6NdTll.java
new file mode 100644 (file)
index 0000000..53c3cb7
--- /dev/null
@@ -0,0 +1,88 @@
+/*
+ * Copyright © 2018 Alten Calsoftlabs India Pvt Ltd. and others.
+ *
+ * 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.genius.mdsalutil.actions;
+
+import org.opendaylight.genius.mdsalutil.ActionInfo;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SetFieldCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.set.field._case.SetFieldBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder;
+
+/**
+ * Set IPv6 ND TLL action.
+ */
+public class ActionSetIpv6NdTll extends ActionInfo {
+
+    private final MacAddress ndTll;
+
+
+    public ActionSetIpv6NdTll(MacAddress ndTll) {
+        this(0, ndTll);
+    }
+
+    public ActionSetIpv6NdTll(int actionKey, MacAddress ndTll) {
+        super(actionKey);
+        this.ndTll = ndTll;
+    }
+
+    @Override
+    public Action buildAction() {
+        return buildAction(getActionKey());
+    }
+
+    @Override
+    public Action buildAction(int newActionKey) {
+        return new ActionBuilder()
+                .setAction(new SetFieldCaseBuilder()
+                        .setSetField(new SetFieldBuilder()
+                                .setLayer3Match(new Ipv6MatchBuilder()
+                                        .setIpv6NdTll(new MacAddress(ndTll)).build())
+                                .build())
+                        .build())
+                .withKey(new ActionKey(newActionKey))
+                .build();
+    }
+
+    public MacAddress getNdTll() {
+        return ndTll;
+    }
+
+    @Override
+    public boolean equals(Object other) {
+        if (this == other) {
+            return true;
+        }
+        if (other == null || getClass() != other.getClass()) {
+            return false;
+        }
+        if (!super.equals(other)) {
+            return false;
+        }
+
+        ActionSetIpv6NdTll that = (ActionSetIpv6NdTll) other;
+
+        return ndTll != null ? ndTll.equals(that.ndTll) : that.ndTll == null;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = super.hashCode();
+        result = 31 * result + (ndTll != null ? ndTll.hashCode() : 0);
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        return "ActionSetIpv6NdTll [source=" + ndTll + ", getActionKey()=" + getActionKey() + "]";
+    }
+
+}
diff --git a/mdsalutil/mdsalutil-api/src/main/java/org/opendaylight/genius/mdsalutil/ericmatches/EricMatchInfoHelper.java b/mdsalutil/mdsalutil-api/src/main/java/org/opendaylight/genius/mdsalutil/ericmatches/EricMatchInfoHelper.java
new file mode 100644 (file)
index 0000000..9f2abdb
--- /dev/null
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 2019 Alten Calsoft Labs India Pvt Ltd. 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.genius.mdsalutil.ericmatches;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.opendaylight.genius.mdsalutil.MatchInfo;
+import org.opendaylight.genius.utils.SuperTypeUtil;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.eric.match.rev180730.EricAugMatchNodesNodeTableFlow;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.eric.match.rev180730.EricAugMatchNodesNodeTableFlowBuilder;
+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.GeneralAugMatchNodesNodeTableFlow;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.GeneralAugMatchNodesNodeTableFlowBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.grouping.ExtensionBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.list.grouping.ExtensionList;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.general.extension.list.grouping.ExtensionListBuilder;
+import org.opendaylight.yangtools.concepts.Builder;
+import org.opendaylight.yangtools.yang.binding.DataObject;
+
+
+public abstract class EricMatchInfoHelper<T extends DataObject, B extends Builder<T>> extends MatchInfo {
+    private final Class<B> builderClass;
+    // The key class can't be a type parameter, it varies in some subclasses
+    private final Class<? extends ExtensionKey> keyClass;
+
+    protected EricMatchInfoHelper(Class<? extends ExtensionKey> keyClass) {
+        this.keyClass = keyClass;
+        builderClass = SuperTypeUtil.getTypeParameter(getClass(), 1);
+    }
+
+    @Override
+    public void createInnerMatchBuilder(Map<Class<?>, Object> mapMatchBuilder) {
+        populateBuilder((B) mapMatchBuilder.computeIfAbsent(builderClass, key -> {
+            try {
+                return builderClass.newInstance();
+            } catch (InstantiationException | IllegalAccessException e) {
+                throw new IllegalStateException("Unable to create an instance of " + builderClass, e);
+            }
+        }));
+    }
+
+    @Override
+    public void setMatch(MatchBuilder matchBuilder, Map<Class<?>, Object> mapMatchBuilder) {
+        B builder = (B) mapMatchBuilder.remove(builderClass);
+
+        if (builder != null) {
+
+            EricAugMatchNodesNodeTableFlowBuilder ericAugMatchBuilder = new EricAugMatchNodesNodeTableFlowBuilder();
+            applyValue(ericAugMatchBuilder, builder.build());
+            EricAugMatchNodesNodeTableFlow ericAugMatch = ericAugMatchBuilder.build();
+            GeneralAugMatchNodesNodeTableFlow existingAugmentations = matchBuilder
+                    .augmentation(GeneralAugMatchNodesNodeTableFlow.class);
+            GeneralAugMatchNodesNodeTableFlow genAugMatch = generalAugMatchBuilder(existingAugmentations,
+                    ericAugMatch, keyClass);
+            matchBuilder.addAugmentation(GeneralAugMatchNodesNodeTableFlow.class, genAugMatch);
+        }
+    }
+
+    private GeneralAugMatchNodesNodeTableFlow generalAugMatchBuilder(
+            GeneralAugMatchNodesNodeTableFlow existingAugmentations, EricAugMatchNodesNodeTableFlow ericAugMatch,
+            Class<? extends ExtensionKey> extentionKey) {
+        List<ExtensionList> extensions = null;
+        if (existingAugmentations != null) {
+            extensions = existingAugmentations.getExtensionList();
+        }
+        if (extensions == null) {
+            extensions = new ArrayList<>();
+        }
+        extensions.add(new ExtensionListBuilder().setExtensionKey(extentionKey)
+                .setExtension(
+                        new ExtensionBuilder().addAugmentation(EricAugMatchNodesNodeTableFlow.class, ericAugMatch)
+                                .build())
+                .build());
+        return new GeneralAugMatchNodesNodeTableFlowBuilder().setExtensionList(extensions).build();
+    }
+
+    protected abstract void applyValue(EricAugMatchNodesNodeTableFlowBuilder matchBuilder, T value);
+
+    protected abstract void populateBuilder(B builder);
+
+    @Override
+    public boolean equals(Object other) {
+        if (this == other) {
+            return true;
+        }
+        if (other == null || getClass() != other.getClass()) {
+            return false;
+        }
+
+        EricMatchInfoHelper<?, ?> that = (EricMatchInfoHelper<?, ?>) other;
+
+        if (builderClass != null ? !builderClass.equals(that.builderClass) : that.builderClass != null) {
+            return false;
+        }
+        return keyClass != null ? keyClass.equals(that.keyClass) : that.keyClass == null;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = builderClass != null ? builderClass.hashCode() : 0;
+        result = 31 * result + (keyClass != null ? keyClass.hashCode() : 0);
+        return result;
+    }
+}
diff --git a/mdsalutil/mdsalutil-api/src/main/java/org/opendaylight/genius/mdsalutil/ericmatches/MatchNdOptionType.java b/mdsalutil/mdsalutil-api/src/main/java/org/opendaylight/genius/mdsalutil/ericmatches/MatchNdOptionType.java
new file mode 100644 (file)
index 0000000..646ad44
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2019 Alten Calsoft Labs India Pvt Ltd. 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.genius.mdsalutil.ericmatches;
+
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.eric.match.rev180730.EricAugMatchNodesNodeTableFlowBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.eric.match.rev180730.Icmpv6NdOptionsTypeKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.eric.match.rev180730.eric.of.icmpv6.nd.options.type.grouping.EricOfIcmpv6NdOptionsType;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.eric.match.rev180730.eric.of.icmpv6.nd.options.type.grouping.EricOfIcmpv6NdOptionsTypeBuilder;
+
+/**
+ * MatchNdOptionType match.
+ */
+public class MatchNdOptionType
+        extends EricMatchInfoHelper<EricOfIcmpv6NdOptionsType, EricOfIcmpv6NdOptionsTypeBuilder> {
+
+    private Short ndOptionType;
+
+    public MatchNdOptionType(Short ndOptionType) {
+        super(Icmpv6NdOptionsTypeKey.class);
+        this.ndOptionType = ndOptionType;
+    }
+
+    @Override
+    protected void applyValue(EricAugMatchNodesNodeTableFlowBuilder matchBuilder, EricOfIcmpv6NdOptionsType value) {
+        matchBuilder.setEricOfIcmpv6NdOptionsType(value);
+    }
+
+    @Override
+    protected void populateBuilder(EricOfIcmpv6NdOptionsTypeBuilder builder) {
+        builder.setIcmpv6NdOptionsType(ndOptionType);
+    }
+
+    public Short getNdOptionType() {
+        return ndOptionType;
+    }
+
+    @Override
+    public boolean equals(Object other) {
+        if (this == other) {
+            return true;
+        }
+        if (other == null || getClass() != other.getClass()) {
+            return false;
+        }
+        if (!super.equals(other)) {
+            return false;
+        }
+
+        MatchNdOptionType that = (MatchNdOptionType) other;
+
+        return this.ndOptionType.equals(that.ndOptionType);
+    }
+
+    @Override
+    public int hashCode() {
+        int result = super.hashCode();
+        result = 31 * result +  ndOptionType;
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        return "MatchNdOptionType[" + ndOptionType + "]";
+    }
+
+}
diff --git a/mdsalutil/mdsalutil-api/src/main/java/org/opendaylight/genius/mdsalutil/matches/MatchIpv6NdSll.java b/mdsalutil/mdsalutil-api/src/main/java/org/opendaylight/genius/mdsalutil/matches/MatchIpv6NdSll.java
new file mode 100644 (file)
index 0000000..0888bcd
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2019 Alten Calsoft Labs India Pvt Ltd. 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.genius.mdsalutil.matches;
+
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6Match;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder;
+
+/**
+ * Match IPv6 ND SLL match.
+ */
+public class MatchIpv6NdSll extends MatchInfoHelper<Ipv6Match, Ipv6MatchBuilder> {
+
+    private final MacAddress address;
+
+    public MacAddress getAddress() {
+        return address;
+    }
+
+    public MatchIpv6NdSll(MacAddress address) {
+        this.address = address;
+    }
+
+
+    @Override
+    protected void applyValue(MatchBuilder matchBuilder, Ipv6Match value) {
+        matchBuilder.setLayer3Match(value);
+    }
+
+    @Override
+    protected void populateBuilder(Ipv6MatchBuilder builder) {
+        builder.setIpv6NdSll(address);
+    }
+
+    @Override
+    public boolean equals(Object other) {
+        if (this == other) {
+            return true;
+        }
+        if (other == null || getClass() != other.getClass()) {
+            return false;
+        }
+        if (!super.equals(other)) {
+            return false;
+        }
+
+        MatchIpv6NdSll that = (MatchIpv6NdSll) other;
+
+        return address != null ? address.equals(that.address) : that.address == null;
+    }
+
+    @Override
+    public int hashCode() {
+        int result = super.hashCode();
+        result = 31 * result + (address != null ? address.hashCode() : 0);
+        return result;
+    }
+
+    @Override
+    public String toString() {
+        return "MatchIpv6NdSll[" + address + "]";
+    }
+}