Fix for MP2S intent with ingress/egress on same switch.

Fixes ONOS-1872 to enable support for 2 external SDN-IP connections on
the same switch.

Porting the fix forward from onos-1.0 branch.

Change-Id: I4475485f2f611c61e33ca34f17bef1950c3b4ed8
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/MultiPointToSinglePointIntentCompiler.java b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/MultiPointToSinglePointIntentCompiler.java
index 6403019..1196540 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/MultiPointToSinglePointIntentCompiler.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/MultiPointToSinglePointIntentCompiler.java
@@ -15,13 +15,8 @@
  */
 package org.onosproject.net.intent.impl.compiler;
 
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
+import com.google.common.collect.ImmutableSet;
+import com.google.common.collect.Sets;
 import org.apache.felix.scr.annotations.Activate;
 import org.apache.felix.scr.annotations.Component;
 import org.apache.felix.scr.annotations.Deactivate;
@@ -41,8 +36,12 @@
 import org.onosproject.net.resource.LinkResourceAllocations;
 import org.onosproject.net.topology.PathService;
 
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Sets;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
 /**
  * An intent compiler for
@@ -74,6 +73,9 @@
         Map<DeviceId, Link> links = new HashMap<>();
 
         for (ConnectPoint ingressPoint : intent.ingressPoints()) {
+            if (ingressPoint.deviceId().equals(intent.egressPoint().deviceId())) {
+                continue;
+            }
             Path path = getPath(ingressPoint, intent.egressPoint());
             for (Link link : path.links()) {
                 if (links.containsKey(link.src().deviceId())) {