Add support for reconfiguring interfaces in SDN-IP.
Change-Id: I2ea85d85432e661c3cbdca5e5a8b16678a242369
diff --git a/core/api/src/main/java/org/onosproject/net/intent/ConnectivityIntent.java b/core/api/src/main/java/org/onosproject/net/intent/ConnectivityIntent.java
index 7caee3e..13f07a2 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/ConnectivityIntent.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/ConnectivityIntent.java
@@ -96,6 +96,26 @@
protected TrafficTreatment treatment = DefaultTrafficTreatment.emptyTreatment();
protected List<Constraint> constraints = ImmutableList.of();
+ /**
+ * Creates a new empty builder.
+ */
+ protected Builder() {
+ }
+
+ /**
+ * Creates a new builder pre-populated with the information in the given
+ * intent.
+ *
+ * @param intent initial intent
+ */
+ protected Builder(ConnectivityIntent intent) {
+ super(intent);
+
+ this.selector(intent.selector())
+ .treatment(intent.treatment())
+ .constraints(intent.constraints());
+ }
+
@Override
public Builder appId(ApplicationId appId) {
return (Builder) super.appId(appId);
@@ -111,7 +131,6 @@
return (Builder) super.priority(priority);
}
-
/**
* Sets the traffic selector for the intent that will be built.
*
@@ -146,7 +165,6 @@
}
}
-
/**
* Returns the match specifying the type of traffic.
*
diff --git a/core/api/src/main/java/org/onosproject/net/intent/Intent.java b/core/api/src/main/java/org/onosproject/net/intent/Intent.java
index 077fd89..d27d057 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/Intent.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/Intent.java
@@ -15,14 +15,14 @@
*/
package org.onosproject.net.intent;
-import java.util.Collection;
-import java.util.Objects;
-
import com.google.common.annotations.Beta;
import org.onosproject.core.ApplicationId;
import org.onosproject.core.IdGenerator;
import org.onosproject.net.NetworkResource;
+import java.util.Collection;
+import java.util.Objects;
+
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkState;
@@ -91,6 +91,24 @@
protected int priority = Intent.DEFAULT_INTENT_PRIORITY;
/**
+ * Creates a new empty builder.
+ */
+ protected Builder() {
+ }
+
+ /**
+ * Creates a new builder pre-populated with the information in the given
+ * intent.
+ *
+ * @param intent initial intent
+ */
+ protected Builder(Intent intent) {
+ this.appId(intent.appId())
+ .key(intent.key())
+ .priority(intent.priority());
+ }
+
+ /**
* Sets the application id for the intent that will be built.
*
* @param appId application id to use for built intent
diff --git a/core/api/src/main/java/org/onosproject/net/intent/MultiPointToSinglePointIntent.java b/core/api/src/main/java/org/onosproject/net/intent/MultiPointToSinglePointIntent.java
index ac6061c..44d407e 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/MultiPointToSinglePointIntent.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/MultiPointToSinglePointIntent.java
@@ -100,6 +100,17 @@
}
/**
+ * Creates a new builder pre-populated with the information in the given
+ * intent.
+ *
+ * @param intent initial intent
+ * @return intent builder
+ */
+ public static Builder builder(MultiPointToSinglePointIntent intent) {
+ return new Builder(intent);
+ }
+
+ /**
* Builder of a multi point to single point intent.
*/
public static final class Builder extends ConnectivityIntent.Builder {
@@ -110,6 +121,19 @@
// Hide constructor
}
+ /**
+ * Creates a new builder pre-populated with information from the given
+ * intent.
+ *
+ * @param intent initial intent
+ */
+ protected Builder(MultiPointToSinglePointIntent intent) {
+ super(intent);
+
+ this.ingressPoints(intent.ingressPoints())
+ .egressPoint(intent.egressPoint());
+ }
+
@Override
public Builder appId(ApplicationId appId) {
return (Builder) super.appId(appId);