Committed by
Brian O'Connor
Fixing host-to-host compiler not to produce any installables if one == two.
Change-Id: I369e747537ee140c4bb5d63169e516e9700a3361
Showing
1 changed file
with
7 additions
and
0 deletions
... | @@ -15,6 +15,7 @@ | ... | @@ -15,6 +15,7 @@ |
15 | */ | 15 | */ |
16 | package org.onosproject.net.intent.impl.compiler; | 16 | package org.onosproject.net.intent.impl.compiler; |
17 | 17 | ||
18 | +import com.google.common.collect.ImmutableList; | ||
18 | import org.apache.felix.scr.annotations.Activate; | 19 | import org.apache.felix.scr.annotations.Activate; |
19 | import org.apache.felix.scr.annotations.Component; | 20 | import org.apache.felix.scr.annotations.Component; |
20 | import org.apache.felix.scr.annotations.Deactivate; | 21 | import org.apache.felix.scr.annotations.Deactivate; |
... | @@ -35,6 +36,7 @@ import org.onosproject.net.intent.constraint.AsymmetricPathConstraint; | ... | @@ -35,6 +36,7 @@ import org.onosproject.net.intent.constraint.AsymmetricPathConstraint; |
35 | import java.util.ArrayList; | 36 | import java.util.ArrayList; |
36 | import java.util.Arrays; | 37 | import java.util.Arrays; |
37 | import java.util.List; | 38 | import java.util.List; |
39 | +import java.util.Objects; | ||
38 | 40 | ||
39 | import static org.onosproject.net.flow.DefaultTrafficSelector.builder; | 41 | import static org.onosproject.net.flow.DefaultTrafficSelector.builder; |
40 | 42 | ||
... | @@ -60,6 +62,11 @@ public class HostToHostIntentCompiler | ... | @@ -60,6 +62,11 @@ public class HostToHostIntentCompiler |
60 | 62 | ||
61 | @Override | 63 | @Override |
62 | public List<Intent> compile(HostToHostIntent intent, List<Intent> installable) { | 64 | public List<Intent> compile(HostToHostIntent intent, List<Intent> installable) { |
65 | + // If source and destination are the same, there are never any installables. | ||
66 | + if (Objects.equals(intent.one(), intent.two())) { | ||
67 | + return ImmutableList.of(); | ||
68 | + } | ||
69 | + | ||
63 | boolean isAsymmetric = intent.constraints().contains(new AsymmetricPathConstraint()); | 70 | boolean isAsymmetric = intent.constraints().contains(new AsymmetricPathConstraint()); |
64 | Path pathOne = getPath(intent, intent.one(), intent.two()); | 71 | Path pathOne = getPath(intent, intent.one(), intent.two()); |
65 | Path pathTwo = isAsymmetric ? | 72 | Path pathTwo = isAsymmetric ? | ... | ... |
-
Please register or login to post a comment