Jonathan Hart

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.

Change-Id: I4475485f2f611c61e33ca34f17bef1950c3b4ed8
...@@ -15,13 +15,8 @@ ...@@ -15,13 +15,8 @@
15 */ 15 */
16 package org.onosproject.net.intent.impl; 16 package org.onosproject.net.intent.impl;
17 17
18 -import java.util.Arrays; 18 +import com.google.common.collect.ImmutableSet;
19 -import java.util.Collections; 19 +import com.google.common.collect.Sets;
20 -import java.util.HashMap;
21 -import java.util.List;
22 -import java.util.Map;
23 -import java.util.Set;
24 -
25 import org.apache.felix.scr.annotations.Activate; 20 import org.apache.felix.scr.annotations.Activate;
26 import org.apache.felix.scr.annotations.Component; 21 import org.apache.felix.scr.annotations.Component;
27 import org.apache.felix.scr.annotations.Deactivate; 22 import org.apache.felix.scr.annotations.Deactivate;
...@@ -40,8 +35,12 @@ import org.onosproject.net.intent.PointToPointIntent; ...@@ -40,8 +35,12 @@ import org.onosproject.net.intent.PointToPointIntent;
40 import org.onosproject.net.resource.LinkResourceAllocations; 35 import org.onosproject.net.resource.LinkResourceAllocations;
41 import org.onosproject.net.topology.PathService; 36 import org.onosproject.net.topology.PathService;
42 37
43 -import com.google.common.collect.ImmutableSet; 38 +import java.util.Arrays;
44 -import com.google.common.collect.Sets; 39 +import java.util.Collections;
40 +import java.util.HashMap;
41 +import java.util.List;
42 +import java.util.Map;
43 +import java.util.Set;
45 44
46 /** 45 /**
47 * An intent compiler for 46 * An intent compiler for
...@@ -73,6 +72,9 @@ public class MultiPointToSinglePointIntentCompiler ...@@ -73,6 +72,9 @@ public class MultiPointToSinglePointIntentCompiler
73 Map<DeviceId, Link> links = new HashMap<>(); 72 Map<DeviceId, Link> links = new HashMap<>();
74 73
75 for (ConnectPoint ingressPoint : intent.ingressPoints()) { 74 for (ConnectPoint ingressPoint : intent.ingressPoints()) {
75 + if (ingressPoint.deviceId().equals(intent.egressPoint().deviceId())) {
76 + continue;
77 + }
76 Path path = getPath(ingressPoint, intent.egressPoint()); 78 Path path = getPath(ingressPoint, intent.egressPoint());
77 for (Link link : path.links()) { 79 for (Link link : path.links()) {
78 if (links.containsKey(link.src().deviceId())) { 80 if (links.containsKey(link.src().deviceId())) {
......