Fix bug in validate() in BooleanConstraint
- Flip the branch condition in validate()
Change-Id: I7bafb710440513d3ccce8178c1bd6bb30ed06d4f
diff --git a/core/api/src/main/java/org/onlab/onos/net/intent/constraint/BooleanConstraint.java b/core/api/src/main/java/org/onlab/onos/net/intent/constraint/BooleanConstraint.java
index 97c5695..4e9fc9a 100644
--- a/core/api/src/main/java/org/onlab/onos/net/intent/constraint/BooleanConstraint.java
+++ b/core/api/src/main/java/org/onlab/onos/net/intent/constraint/BooleanConstraint.java
@@ -52,7 +52,7 @@
@Override
public boolean validate(Path path, LinkResourceService resourceService) {
for (Link link : path.links()) {
- if (isValid(link, resourceService)) {
+ if (!isValid(link, resourceService)) {
return false;
}
}
diff --git a/core/api/src/main/java/org/onlab/onos/net/intent/constraint/ObstacleConstraint.java b/core/api/src/main/java/org/onlab/onos/net/intent/constraint/ObstacleConstraint.java
index 3ed3fae..6d73fc2 100644
--- a/core/api/src/main/java/org/onlab/onos/net/intent/constraint/ObstacleConstraint.java
+++ b/core/api/src/main/java/org/onlab/onos/net/intent/constraint/ObstacleConstraint.java
@@ -19,7 +19,6 @@
import com.google.common.collect.ImmutableSet;
import org.onlab.onos.net.DeviceId;
import org.onlab.onos.net.Link;
-import org.onlab.onos.net.Path;
import org.onlab.onos.net.resource.LinkResourceService;
import java.util.Objects;
@@ -49,17 +48,6 @@
}
@Override
- public boolean validate(Path path, LinkResourceService resourceService) {
- for (Link link : path.links()) {
- if (!isValid(link, resourceService)) {
- return false;
- }
- }
-
- return true;
- }
-
- @Override
public int hashCode() {
return Objects.hash(obstacles);
}