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.

Porting the fix forward from onos-1.0 branch.

Change-Id: I4475485f2f611c61e33ca34f17bef1950c3b4ed8
...@@ -15,13 +15,8 @@ ...@@ -15,13 +15,8 @@
15 */ 15 */
16 package org.onosproject.net.intent.impl.compiler; 16 package org.onosproject.net.intent.impl.compiler;
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;
...@@ -41,8 +36,12 @@ import org.onosproject.net.intent.impl.PathNotFoundException; ...@@ -41,8 +36,12 @@ import org.onosproject.net.intent.impl.PathNotFoundException;
41 import org.onosproject.net.resource.LinkResourceAllocations; 36 import org.onosproject.net.resource.LinkResourceAllocations;
42 import org.onosproject.net.topology.PathService; 37 import org.onosproject.net.topology.PathService;
43 38
44 -import com.google.common.collect.ImmutableSet; 39 +import java.util.Arrays;
45 -import com.google.common.collect.Sets; 40 +import java.util.Collections;
41 +import java.util.HashMap;
42 +import java.util.List;
43 +import java.util.Map;
44 +import java.util.Set;
46 45
47 /** 46 /**
48 * An intent compiler for 47 * An intent compiler for
...@@ -74,6 +73,9 @@ public class MultiPointToSinglePointIntentCompiler ...@@ -74,6 +73,9 @@ public class MultiPointToSinglePointIntentCompiler
74 Map<DeviceId, Link> links = new HashMap<>(); 73 Map<DeviceId, Link> links = new HashMap<>();
75 74
76 for (ConnectPoint ingressPoint : intent.ingressPoints()) { 75 for (ConnectPoint ingressPoint : intent.ingressPoints()) {
76 + if (ingressPoint.deviceId().equals(intent.egressPoint().deviceId())) {
77 + continue;
78 + }
77 Path path = getPath(ingressPoint, intent.egressPoint()); 79 Path path = getPath(ingressPoint, intent.egressPoint());
78 for (Link link : path.links()) { 80 for (Link link : path.links()) {
79 if (links.containsKey(link.src().deviceId())) { 81 if (links.containsKey(link.src().deviceId())) {
......