[ONOS-4595] Harmonize the sb of the Intent Framework
Changes:
- Moves PointToPointIntent to LinkCollectionIntent;
- Moves PointToPointIntent to the new FilteredConnectPoint API;
- Updates unit tests;
Change-Id: Iade5090b9289c5b2d9f4ee41aa0d2d01b5e3699c
diff --git a/core/api/src/main/java/org/onosproject/net/intent/PointToPointIntent.java b/core/api/src/main/java/org/onosproject/net/intent/PointToPointIntent.java
index 6e205e1..ba3b2c2 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/PointToPointIntent.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/PointToPointIntent.java
@@ -21,6 +21,7 @@
import com.google.common.annotations.Beta;
import org.onosproject.core.ApplicationId;
import org.onosproject.net.ConnectPoint;
+import org.onosproject.net.FilteredConnectPoint;
import org.onosproject.net.flow.TrafficSelector;
import org.onosproject.net.flow.TrafficTreatment;
@@ -35,8 +36,8 @@
@Beta
public final class PointToPointIntent extends ConnectivityIntent {
- private final ConnectPoint ingressPoint;
- private final ConnectPoint egressPoint;
+ private final FilteredConnectPoint ingressPoint;
+ private final FilteredConnectPoint egressPoint;
/**
* Returns a new point to point intent builder. The application id,
@@ -54,8 +55,8 @@
* Builder of a point to point intent.
*/
public static final class Builder extends ConnectivityIntent.Builder {
- ConnectPoint ingressPoint;
- ConnectPoint egressPoint;
+ FilteredConnectPoint ingressPoint;
+ FilteredConnectPoint egressPoint;
private Builder() {
// Hide constructor
@@ -97,8 +98,9 @@
* @param ingressPoint ingress connect point
* @return this builder
*/
+ @Deprecated
public Builder ingressPoint(ConnectPoint ingressPoint) {
- this.ingressPoint = ingressPoint;
+ this.ingressPoint = new FilteredConnectPoint(ingressPoint);
return this;
}
@@ -108,11 +110,37 @@
* @param egressPoint egress connect point
* @return this builder
*/
+ @Deprecated
public Builder egressPoint(ConnectPoint egressPoint) {
+ this.egressPoint = new FilteredConnectPoint(egressPoint);
+ return this;
+ }
+
+ /**
+ * Sets the filtered ingress point of the point to
+ * point intent that will be built.
+ *
+ * @param ingressPoint filtered ingress connect point
+ * @return this builder
+ */
+ public Builder filteredIngressPoint(FilteredConnectPoint ingressPoint) {
+ this.ingressPoint = ingressPoint;
+ return this;
+ }
+
+ /**
+ * Sets the filtered egress point of the point to
+ * point intent that will be built.
+ *
+ * @param egressPoint filtered egress connect point
+ * @return this builder
+ */
+ public Builder filteredEgressPoint(FilteredConnectPoint egressPoint) {
this.egressPoint = egressPoint;
return this;
}
+
/**
* Builds a point to point intent from the accumulated parameters.
*
@@ -143,8 +171,8 @@
* @param key key of the intent
* @param selector traffic selector
* @param treatment treatment
- * @param ingressPoint ingress port
- * @param egressPoint egress port
+ * @param ingressPoint filtered ingress port
+ * @param egressPoint filtered egress port
* @param constraints optional list of constraints
* @param priority priority to use for flows generated by this intent
* @throws NullPointerException if {@code ingressPoint} or
@@ -154,8 +182,8 @@
Key key,
TrafficSelector selector,
TrafficTreatment treatment,
- ConnectPoint ingressPoint,
- ConnectPoint egressPoint,
+ FilteredConnectPoint ingressPoint,
+ FilteredConnectPoint egressPoint,
List<Constraint> constraints,
int priority) {
super(appId, key, Collections.emptyList(), selector, treatment, constraints,
@@ -183,8 +211,9 @@
*
* @return ingress port
*/
+ @Deprecated
public ConnectPoint ingressPoint() {
- return ingressPoint;
+ return ingressPoint.connectPoint();
}
/**
@@ -192,7 +221,27 @@
*
* @return egress port
*/
+ @Deprecated
public ConnectPoint egressPoint() {
+ return egressPoint.connectPoint();
+ }
+
+ /**
+ * Returns the filtered port on which the ingress traffic should be connected to the
+ * egress.
+ *
+ * @return ingress port
+ */
+ public FilteredConnectPoint filteredIngressPoint() {
+ return ingressPoint;
+ }
+
+ /**
+ * Return the filtered port on which the traffic should exit.
+ *
+ * @return egress port
+ */
+ public FilteredConnectPoint filteredEgressPoint() {
return egressPoint;
}
@@ -206,8 +255,8 @@
.add("resources", resources())
.add("selector", selector())
.add("treatment", treatment())
- .add("ingress", ingressPoint)
- .add("egress", egressPoint)
+ .add("ingress", filteredIngressPoint())
+ .add("egress", filteredEgressPoint())
.add("constraints", constraints())
.toString();
}