Simplify MP2S compiler, fix ingress/egress on same switch bug in SP2M compiler
Change-Id: Ib47bba01aac0f358f2caa5525c18e0e90a0b13ff
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/SinglePointToMultiPointIntentCompiler.java b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/SinglePointToMultiPointIntentCompiler.java
index 91341d2..5656590 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/SinglePointToMultiPointIntentCompiler.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/SinglePointToMultiPointIntentCompiler.java
@@ -15,11 +15,7 @@
*/
package org.onosproject.net.intent.impl.compiler;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
+import com.google.common.collect.ImmutableSet;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
@@ -32,7 +28,10 @@
import org.onosproject.net.provider.ProviderId;
import org.onosproject.net.resource.link.LinkResourceAllocations;
-import com.google.common.collect.ImmutableSet;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
@Component(immediate = true)
public class SinglePointToMultiPointIntentCompiler
@@ -59,8 +58,12 @@
List<Intent> installable,
Set<LinkResourceAllocations> resources) {
Set<Link> links = new HashSet<>();
- //FIXME: need to handle the case where ingress/egress points are on same switch
+
for (ConnectPoint egressPoint : intent.egressPoints()) {
+ if (egressPoint.deviceId().equals(intent.ingressPoint().deviceId())) {
+ continue;
+ }
+
Path path = getPath(intent, intent.ingressPoint().deviceId(), egressPoint.deviceId());
links.addAll(path.links());
}