Fix PathCompiler in case of VLAN encapsulation
constraint and 1 hop.
Change-Id: Iea82fb4076c79bfa3770836459ffe5f25b5a79c1
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/PathCompiler.java b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/PathCompiler.java
index 3994b90..69faaae 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/PathCompiler.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/compiler/PathCompiler.java
@@ -484,7 +484,7 @@
.filter(constraint -> constraint instanceof EncapsulationConstraint)
.map(x -> (EncapsulationConstraint) x).findAny();
//if no encapsulation or is involved only a single switch use the default behaviour
- if (!encapConstraint.isPresent() || links.size() == 1) {
+ if (!encapConstraint.isPresent() || links.size() == 2) {
for (int i = 0; i < links.size() - 1; i++) {
ConnectPoint ingress = links.get(i).dst();
ConnectPoint egress = links.get(i + 1).src();
@@ -492,6 +492,7 @@
ingress, egress, intent.priority(),
isLast(links, i), flows, devices);
}
+ return;
}
encapConstraint.map(EncapsulationConstraint::encapType)