Refactoring intent API.
diff --git a/core/api/src/main/java/org/onlab/onos/net/intent/PathIntent.java b/core/api/src/main/java/org/onlab/onos/net/intent/PathIntent.java
index ff2e917..4138172 100644
--- a/core/api/src/main/java/org/onlab/onos/net/intent/PathIntent.java
+++ b/core/api/src/main/java/org/onlab/onos/net/intent/PathIntent.java
@@ -1,19 +1,15 @@
package org.onlab.onos.net.intent;
import com.google.common.base.MoreObjects;
-import org.onlab.onos.net.ConnectPoint;
-import org.onlab.onos.net.Link;
+import org.onlab.onos.ApplicationId;
import org.onlab.onos.net.Path;
import org.onlab.onos.net.flow.TrafficSelector;
import org.onlab.onos.net.flow.TrafficTreatment;
-import java.util.Collection;
-import java.util.Objects;
-
/**
* Abstraction of explicitly path specified connectivity intent.
*/
-public class PathIntent extends PointToPointIntent implements InstallableIntent {
+public class PathIntent extends ConnectivityIntent {
private final Path path;
@@ -21,21 +17,22 @@
* Creates a new point-to-point intent with the supplied ingress/egress
* ports and using the specified explicit path.
*
- * @param id intent identifier
- * @param match traffic match
- * @param action action
- * @param ingressPort ingress port
- * @param egressPort egress port
- * @param path traversed links
+ * @param appId application identifier
+ * @param selector traffic selector
+ * @param treatment treatment
+ * @param path traversed links
* @throws NullPointerException {@code path} is null
*/
- public PathIntent(IntentId id, TrafficSelector match, TrafficTreatment action,
- ConnectPoint ingressPort, ConnectPoint egressPort,
- Path path) {
- super(id, match, action, ingressPort, egressPort);
+ public PathIntent(ApplicationId appId, TrafficSelector selector,
+ TrafficTreatment treatment, Path path) {
+ super(id(PathIntent.class, selector, treatment, path), appId,
+ resources(path.links()), selector, treatment);
this.path = path;
}
+ /**
+ * Constructor for serializer.
+ */
protected PathIntent() {
super();
this.path = null;
@@ -51,46 +48,18 @@
}
@Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
- if (!super.equals(o)) {
- return false;
- }
-
- PathIntent that = (PathIntent) o;
-
- if (!path.equals(that.path)) {
- return false;
- }
-
+ public boolean isInstallable() {
return true;
}
@Override
- public int hashCode() {
- return Objects.hash(super.hashCode(), path);
- }
-
- @Override
public String toString() {
return MoreObjects.toStringHelper(getClass())
.add("id", id())
.add("match", selector())
.add("action", treatment())
- .add("ingressPort", ingressPoint())
- .add("egressPort", egressPoint())
.add("path", path)
.toString();
}
- @Override
- public Collection<Link> requiredLinks() {
- return path.links();
- }
-
}