Resource group to share resources between intents
Change-Id: I5bf7d4261197449924d07dabac841cf8ccbe9389
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 113845d..827a042 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
@@ -21,6 +21,7 @@
import org.onosproject.core.ApplicationId;
import org.onosproject.net.Link;
import org.onosproject.net.NetworkResource;
+import org.onosproject.net.ResourceGroup;
import org.onosproject.net.flow.DefaultTrafficSelector;
import org.onosproject.net.flow.DefaultTrafficTreatment;
import org.onosproject.net.flow.TrafficSelector;
@@ -64,7 +65,9 @@
* @param constraints optional prioritized list of constraints
* @param priority priority to use for flows generated by this intent
* @throws NullPointerException if the selector or treatment is null
+ * @deprecated 1.9.1
*/
+ @Deprecated
protected ConnectivityIntent(ApplicationId appId,
Key key,
Collection<NetworkResource> resources,
@@ -79,6 +82,37 @@
}
/**
+ * Creates a connectivity intent that matches on the specified selector
+ * and applies the specified treatment.
+ * <p>
+ * Path will be optimized based on the first constraint if one is given.
+ * </p>
+ *
+ * @param appId application identifier
+ * @param key explicit key to use for intent
+ * @param resources required network resources (optional)
+ * @param selector traffic selector
+ * @param treatment treatment
+ * @param constraints optional prioritized list of constraints
+ * @param priority priority to use for flows generated by this intent
+ * @param resourceGroup resource group for this intent
+ * @throws NullPointerException if the selector or treatment is null
+ */
+ protected ConnectivityIntent(ApplicationId appId,
+ Key key,
+ Collection<NetworkResource> resources,
+ TrafficSelector selector,
+ TrafficTreatment treatment,
+ List<Constraint> constraints,
+ int priority,
+ ResourceGroup resourceGroup) {
+ super(appId, key, resources, priority, resourceGroup);
+ this.selector = checkNotNull(selector);
+ this.treatment = checkNotNull(treatment);
+ this.constraints = checkNotNull(constraints);
+ }
+
+ /**
* Constructor for serializer.
*/
protected ConnectivityIntent() {
diff --git a/core/api/src/main/java/org/onosproject/net/intent/FlowObjectiveIntent.java b/core/api/src/main/java/org/onosproject/net/intent/FlowObjectiveIntent.java
index b22a7ae..e1529e3 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/FlowObjectiveIntent.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/FlowObjectiveIntent.java
@@ -21,6 +21,7 @@
import org.onosproject.core.ApplicationId;
import org.onosproject.net.DeviceId;
import org.onosproject.net.NetworkResource;
+import org.onosproject.net.ResourceGroup;
import org.onosproject.net.flowobjective.Objective;
import java.util.Collection;
@@ -54,12 +55,14 @@
* @param devices list of target devices; in same order as the objectives
* @param objectives backing flow objectives
* @param resources backing network resources
+ * @deprecated 1.9.1
*/
+ @Deprecated
public FlowObjectiveIntent(ApplicationId appId,
List<DeviceId> devices,
List<Objective> objectives,
Collection<NetworkResource> resources) {
- this(appId, null, devices, objectives, resources);
+ this(appId, null, devices, objectives, resources, null);
}
/**
@@ -71,13 +74,35 @@
* @param devices list of target devices; in same order as the objectives
* @param objectives backing flow objectives
* @param resources backing network resources
+ * @deprecated 1.9.1
*/
+ @Deprecated
public FlowObjectiveIntent(ApplicationId appId,
Key key,
List<DeviceId> devices,
List<Objective> objectives,
Collection<NetworkResource> resources) {
- super(appId, key, resources, DEFAULT_INTENT_PRIORITY);
+ this(appId, key, devices, objectives, resources, null);
+ }
+
+ /**
+ * Creates a flow objective intent with the specified objectives and
+ * resources.
+ *
+ * @param appId application id
+ * @param key intent key
+ * @param devices list of target devices; in same order as the objectives
+ * @param objectives backing flow objectives
+ * @param resources backing network resources
+ * @param resourceGroup resource goup for this intent
+ */
+ public FlowObjectiveIntent(ApplicationId appId,
+ Key key,
+ List<DeviceId> devices,
+ List<Objective> objectives,
+ Collection<NetworkResource> resources,
+ ResourceGroup resourceGroup) {
+ super(appId, key, resources, DEFAULT_INTENT_PRIORITY, resourceGroup);
checkArgument(devices.size() == objectives.size(),
"Number of devices and objectives does not match");
this.objectives = ImmutableList.copyOf(objectives);
@@ -117,6 +142,7 @@
.add("resources", resources())
.add("device", devices())
.add("objectives", objectives())
+ .add("resourceGroup", resourceGroup())
.toString();
}
}
diff --git a/core/api/src/main/java/org/onosproject/net/intent/FlowRuleIntent.java b/core/api/src/main/java/org/onosproject/net/intent/FlowRuleIntent.java
index 0bffaaa..9f4b9b9 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/FlowRuleIntent.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/FlowRuleIntent.java
@@ -20,6 +20,7 @@
import com.google.common.collect.ImmutableList;
import org.onosproject.core.ApplicationId;
import org.onosproject.net.NetworkResource;
+import org.onosproject.net.ResourceGroup;
import org.onosproject.net.flow.FlowRule;
import java.util.Collection;
@@ -43,7 +44,9 @@
* @param appId application id
* @param flowRules flow rules to be set
* @param resources network resource to be set
+ * @deprecated 1.9.1
*/
+ @Deprecated
public FlowRuleIntent(ApplicationId appId, List<FlowRule> flowRules, Collection<NetworkResource> resources) {
this(appId, null, flowRules, resources);
}
@@ -55,10 +58,12 @@
* @param flowRules flow rules to be set
* @param resources network resource to be set
* @param type protection type
+ * @deprecated 1.9.1
*/
+ @Deprecated
public FlowRuleIntent(ApplicationId appId, List<FlowRule> flowRules, Collection<NetworkResource> resources,
PathIntent.ProtectionType type) {
- this(appId, null, flowRules, resources, type);
+ this(appId, null, flowRules, resources, type, null);
}
/**
@@ -69,10 +74,13 @@
* @param key key
* @param flowRules flow rules
* @param resources network resources
+ * @deprecated 1.9.1
*/
+ @Deprecated
public FlowRuleIntent(ApplicationId appId, Key key, Collection<FlowRule> flowRules,
Collection<NetworkResource> resources) {
- this(appId, key, flowRules, resources, PathIntent.ProtectionType.PRIMARY);
+ this(appId, key, flowRules, resources,
+ PathIntent.ProtectionType.PRIMARY, null);
}
/**
@@ -84,10 +92,32 @@
* @param flowRules flow rules
* @param resources network resources
* @param primary primary protection type
+ * @deprecated 1.9.1
+ */
+ @Deprecated
+ public FlowRuleIntent(ApplicationId appId,
+ Key key,
+ Collection<FlowRule> flowRules,
+ Collection<NetworkResource> resources,
+ PathIntent.ProtectionType primary) {
+ this(appId, key, flowRules, resources, primary, null);
+ }
+
+ /**
+ * Creates a flow rule intent with the specified key, flow rules to be set, and
+ * required network resources.
+ *
+ * @param appId application id
+ * @param key key
+ * @param flowRules flow rules
+ * @param resources network resources
+ * @param primary primary protection type
+ * @param resourceGroup resource group for this intent
*/
public FlowRuleIntent(ApplicationId appId, Key key, Collection<FlowRule> flowRules,
- Collection<NetworkResource> resources, PathIntent.ProtectionType primary) {
- super(appId, key, resources, DEFAULT_INTENT_PRIORITY);
+ Collection<NetworkResource> resources, PathIntent.ProtectionType primary,
+ ResourceGroup resourceGroup) {
+ super(appId, key, resources, DEFAULT_INTENT_PRIORITY, resourceGroup);
this.flowRules = ImmutableList.copyOf(checkNotNull(flowRules));
this.type = primary;
}
@@ -101,7 +131,7 @@
*/
public FlowRuleIntent(FlowRuleIntent intent, PathIntent.ProtectionType type) {
this(intent.appId(), intent.key(), intent.flowRules(),
- intent.resources(), type);
+ intent.resources(), type, intent.resourceGroup());
}
/**
@@ -139,6 +169,7 @@
.add("appId", appId())
.add("resources", resources())
.add("flowRule", flowRules)
+ .add("resourceGroup", resourceGroup())
.toString();
}
}
diff --git a/core/api/src/main/java/org/onosproject/net/intent/HostToHostIntent.java b/core/api/src/main/java/org/onosproject/net/intent/HostToHostIntent.java
index 92dd83b..a7505ae 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/HostToHostIntent.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/HostToHostIntent.java
@@ -23,6 +23,7 @@
import org.onosproject.core.ApplicationId;
import org.onosproject.net.HostId;
import org.onosproject.net.Link;
+import org.onosproject.net.ResourceGroup;
import org.onosproject.net.flow.TrafficSelector;
import org.onosproject.net.flow.TrafficTreatment;
import org.onosproject.net.intent.constraint.LinkTypeConstraint;
@@ -92,6 +93,11 @@
return (Builder) super.priority(priority);
}
+ @Override
+ public Builder resourceGroup(ResourceGroup resourceGroup) {
+ return (Builder) super.resourceGroup(resourceGroup);
+ }
+
/**
* Sets the first host of the intent that will be built.
*
@@ -114,8 +120,6 @@
return this;
}
-
-
/**
* Builds a host to host intent from the accumulated parameters.
*
@@ -140,12 +144,12 @@
selector,
treatment,
theConstraints,
- priority
+ priority,
+ resourceGroup
);
}
}
-
/**
* Creates a new host-to-host intent with the supplied host pair.
*
@@ -157,21 +161,22 @@
* @param treatment ingress port
* @param constraints optional prioritized list of path selection constraints
* @param priority priority to use for flows generated by this intent
+ * @param resourceGroup resource group for this intent
* @throws NullPointerException if {@code one} or {@code two} is null.
*/
private HostToHostIntent(ApplicationId appId, Key key,
- HostId one, HostId two,
- TrafficSelector selector,
- TrafficTreatment treatment,
- List<Constraint> constraints,
- int priority) {
+ HostId one, HostId two,
+ TrafficSelector selector,
+ TrafficTreatment treatment,
+ List<Constraint> constraints,
+ int priority,
+ ResourceGroup resourceGroup) {
super(appId, key, ImmutableSet.of(one, two), selector, treatment,
- constraints, priority);
+ constraints, priority, resourceGroup);
// TODO: consider whether the case one and two are same is allowed
this.one = checkNotNull(one);
this.two = checkNotNull(two);
-
}
/**
@@ -203,6 +208,7 @@
.add("selector", selector())
.add("treatment", treatment())
.add("constraints", constraints())
+ .add("resourceGroup", resourceGroup())
.add("one", one)
.add("two", two)
.toString();
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 4df13a6..12dad21 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
@@ -19,6 +19,7 @@
import org.onosproject.core.ApplicationId;
import org.onosproject.core.IdGenerator;
import org.onosproject.net.NetworkResource;
+import org.onosproject.net.ResourceGroup;
import java.util.Collection;
import java.util.Objects;
@@ -47,6 +48,7 @@
public static final int MIN_PRIORITY = 1;
private final Collection<NetworkResource> resources;
+ private final ResourceGroup resourceGroup;
private static IdGenerator idGenerator;
@@ -59,16 +61,18 @@
this.key = null;
this.resources = null;
this.priority = DEFAULT_INTENT_PRIORITY;
+ this.resourceGroup = null;
}
/**
* Creates a new intent.
- *
* @param appId application identifier
* @param key optional key
* @param resources required network resources (optional)
* @param priority flow rule priority
+ * @deprecated 1.9.1
*/
+ @Deprecated
protected Intent(ApplicationId appId,
Key key,
Collection<NetworkResource> resources,
@@ -80,6 +84,30 @@
this.key = (key != null) ? key : Key.of(id.fingerprint(), appId);
this.priority = priority;
this.resources = checkNotNull(resources);
+ this.resourceGroup = null;
+ }
+
+ /**
+ * Creates a new intent.
+ * @param appId application identifier
+ * @param key optional key
+ * @param resources required network resources (optional)
+ * @param priority flow rule priority
+ * @param resourceGroup the resource group for intent
+ */
+ protected Intent(ApplicationId appId,
+ Key key,
+ Collection<NetworkResource> resources,
+ int priority,
+ ResourceGroup resourceGroup) {
+ checkState(idGenerator != null, "Id generator is not bound.");
+ checkArgument(priority <= MAX_PRIORITY && priority >= MIN_PRIORITY);
+ this.id = IntentId.valueOf(idGenerator.getNewId());
+ this.appId = checkNotNull(appId, "Application ID cannot be null");
+ this.key = (key != null) ? key : Key.of(id.fingerprint(), appId);
+ this.priority = priority;
+ this.resources = checkNotNull(resources);
+ this.resourceGroup = resourceGroup;
}
/**
@@ -90,6 +118,7 @@
protected Key key;
protected int priority = Intent.DEFAULT_INTENT_PRIORITY;
protected Collection<NetworkResource> resources;
+ protected ResourceGroup resourceGroup;
/**
* Creates a new empty builder.
@@ -106,7 +135,8 @@
protected Builder(Intent intent) {
this.appId(intent.appId())
.key(intent.key())
- .priority(intent.priority());
+ .priority(intent.priority())
+ .resourceGroup(intent.resourceGroup());
}
/**
@@ -152,6 +182,17 @@
this.resources = resources;
return this;
}
+
+ /**
+ * Sets the resource group for this intent.
+ *
+ * @param resourceGroup the resource group
+ * @return this builder
+ */
+ public Builder resourceGroup(ResourceGroup resourceGroup) {
+ this.resourceGroup = resourceGroup;
+ return this;
+ }
}
/**
@@ -191,6 +232,15 @@
}
/**
+ * Returns the resource group for this intent.
+ *
+ * @return the resource group; may be null
+ */
+ public ResourceGroup resourceGroup() {
+ return resourceGroup;
+ }
+
+ /**
* Indicates whether or not the intent is installable.
*
* @return true if installable
diff --git a/core/api/src/main/java/org/onosproject/net/intent/LinkCollectionIntent.java b/core/api/src/main/java/org/onosproject/net/intent/LinkCollectionIntent.java
index 2b5d663..0361e98 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/LinkCollectionIntent.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/LinkCollectionIntent.java
@@ -27,6 +27,7 @@
import org.onosproject.net.FilteredConnectPoint;
import org.onosproject.net.Link;
import org.onosproject.net.NetworkResource;
+import org.onosproject.net.ResourceGroup;
import org.onosproject.net.flow.TrafficSelector;
import org.onosproject.net.flow.TrafficTreatment;
@@ -67,6 +68,7 @@
* @param priority priority to use for the flows generated by this intent
* @param egressTreatment true if treatment should be applied by the egress device
* @param cost the cost of the links
+ * @param resourceGroup resource group for this intent
* @throws NullPointerException {@code path} is null
*/
private LinkCollectionIntent(ApplicationId appId,
@@ -80,8 +82,9 @@
List<Constraint> constraints,
int priority,
boolean egressTreatment,
- double cost) {
- super(appId, key, resources(resources, links), selector, treatment, constraints, priority);
+ double cost,
+ ResourceGroup resourceGroup) {
+ super(appId, key, resources(resources, links), selector, treatment, constraints, priority, resourceGroup);
this.links = links;
this.ingressPoints = ingressPoints;
this.egressPoints = egressPoints;
@@ -163,6 +166,11 @@
return (Builder) super.resources(resources);
}
+ @Override
+ public Builder resourceGroup(ResourceGroup resourceGroup) {
+ return (Builder) super.resourceGroup(resourceGroup);
+ }
+
/**
* Sets the ingress point of the single point to multi point intent
* that will be built.
@@ -280,7 +288,8 @@
constraints,
priority,
egressTreatmentFlag,
- cost
+ cost,
+ resourceGroup
);
}
}
@@ -372,7 +381,8 @@
.add("links", links())
.add("ingress", ingressPoints())
.add("egress", egressPoints())
- .add("treatementOnEgress", applyTreatmentOnEgress())
+ .add("treatmentOnEgress", applyTreatmentOnEgress())
+ .add("resourceGroup", resourceGroup())
.add("cost", cost())
.toString();
}
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 3048aac..2b0e7a8 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
@@ -21,6 +21,7 @@
import org.onosproject.core.ApplicationId;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.FilteredConnectPoint;
+import org.onosproject.net.ResourceGroup;
import org.onosproject.net.flow.TrafficSelector;
import org.onosproject.net.flow.TrafficTreatment;
import org.slf4j.Logger;
@@ -66,10 +67,10 @@
Set<FilteredConnectPoint> ingressPoints,
FilteredConnectPoint egressPoint,
List<Constraint> constraints,
- int priority
- ) {
+ int priority,
+ ResourceGroup resourceGroup) {
super(appId, key, ImmutableSet.of(), selector, treatment, constraints,
- priority);
+ priority, resourceGroup);
checkNotNull(ingressPoints);
checkArgument(!ingressPoints.isEmpty(), "Ingress point set cannot be empty");
@@ -169,6 +170,11 @@
return (Builder) super.priority(priority);
}
+ @Override
+ public Builder resourceGroup(ResourceGroup resourceGroup) {
+ return (Builder) super.resourceGroup(resourceGroup);
+ }
+
/**
* Sets the ingress point of the single point to multi point intent
* that will be built.
@@ -245,7 +251,8 @@
ingressPoints,
egressPoint,
constraints,
- priority
+ priority,
+ resourceGroup
);
}
}
@@ -307,6 +314,7 @@
.add("filteredIngressCPs", filteredIngressPoints())
.add("filteredEgressCP", filteredEgressPoint())
.add("constraints", constraints())
+ .add("resourceGroup", resourceGroup())
.toString();
}
}
diff --git a/core/api/src/main/java/org/onosproject/net/intent/OpticalCircuitIntent.java b/core/api/src/main/java/org/onosproject/net/intent/OpticalCircuitIntent.java
index 3bc9db6..afe95bc 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/OpticalCircuitIntent.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/OpticalCircuitIntent.java
@@ -20,6 +20,7 @@
import org.onosproject.core.ApplicationId;
import org.onosproject.net.CltSignalType;
import org.onosproject.net.ConnectPoint;
+import org.onosproject.net.ResourceGroup;
import java.util.Collections;
@@ -47,10 +48,35 @@
* @param signalType ODU signal type
* @param isBidirectional indicate if intent is bidirectional
* @param priority priority to use for flows from this intent
+ * @deprecated 1.9.1
*/
+ @Deprecated
protected OpticalCircuitIntent(ApplicationId appId, Key key, ConnectPoint src, ConnectPoint dst,
CltSignalType signalType, boolean isBidirectional, int priority) {
- super(appId, key, Collections.emptyList(), priority);
+ super(appId, key, Collections.emptyList(), priority, null);
+ this.src = checkNotNull(src);
+ this.dst = checkNotNull(dst);
+ this.signalType = checkNotNull(signalType);
+ this.isBidirectional = isBidirectional;
+ }
+
+ /**
+ * Creates an optical circuit intent between the specified
+ * connection points.
+ *
+ * @param appId application identification
+ * @param key intent key
+ * @param src the source transponder port
+ * @param dst the destination transponder port
+ * @param signalType ODU signal type
+ * @param isBidirectional indicate if intent is bidirectional
+ * @param priority priority to use for flows from this intent
+ * @param resourceGroup resource group for this intent
+ */
+ protected OpticalCircuitIntent(ApplicationId appId, Key key, ConnectPoint src, ConnectPoint dst,
+ CltSignalType signalType, boolean isBidirectional, int priority,
+ ResourceGroup resourceGroup) {
+ super(appId, key, Collections.emptyList(), priority, resourceGroup);
this.src = checkNotNull(src);
this.dst = checkNotNull(dst);
this.signalType = checkNotNull(signalType);
@@ -91,6 +117,11 @@
return (Builder) super.priority(priority);
}
+ @Override
+ public Builder resourceGroup(ResourceGroup resourceGroup) {
+ return (Builder) super.resourceGroup(resourceGroup);
+ }
+
/**
* Sets the source for the intent that will be built.
*
@@ -149,7 +180,8 @@
dst,
signalType,
isBidirectional,
- priority
+ priority,
+ resourceGroup
);
}
}
@@ -213,6 +245,7 @@
.add("dst", dst)
.add("signalType", signalType)
.add("isBidirectional", isBidirectional)
+ .add("resourceGroup", resourceGroup())
.toString();
}
diff --git a/core/api/src/main/java/org/onosproject/net/intent/OpticalConnectivityIntent.java b/core/api/src/main/java/org/onosproject/net/intent/OpticalConnectivityIntent.java
index 651ba02..05efb15 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/OpticalConnectivityIntent.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/OpticalConnectivityIntent.java
@@ -20,6 +20,7 @@
import org.onosproject.core.ApplicationId;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.OduSignalType;
+import org.onosproject.net.ResourceGroup;
import java.util.Collections;
@@ -47,7 +48,9 @@
* @param signalType signal type
* @param isBidirectional indicates if intent is unidirectional
* @param priority priority to use for flows from this intent
+ * @deprecated 1.9.1
*/
+ @Deprecated
protected OpticalConnectivityIntent(ApplicationId appId,
Key key,
ConnectPoint src,
@@ -55,7 +58,35 @@
OduSignalType signalType,
boolean isBidirectional,
int priority) {
- super(appId, key, Collections.emptyList(), priority);
+ super(appId, key, Collections.emptyList(), priority, null);
+ this.src = checkNotNull(src);
+ this.dst = checkNotNull(dst);
+ this.signalType = checkNotNull(signalType);
+ this.isBidirectional = isBidirectional;
+ }
+
+ /**
+ * Creates an optical connectivity intent between the specified
+ * connection points.
+ *
+ * @param appId application identification
+ * @param key intent key
+ * @param src the source transponder port
+ * @param dst the destination transponder port
+ * @param signalType signal type
+ * @param isBidirectional indicates if intent is unidirectional
+ * @param priority priority to use for flows from this intent
+ * @param resourceGroup resource group of this intent
+ */
+ protected OpticalConnectivityIntent(ApplicationId appId,
+ Key key,
+ ConnectPoint src,
+ ConnectPoint dst,
+ OduSignalType signalType,
+ boolean isBidirectional,
+ int priority,
+ ResourceGroup resourceGroup) {
+ super(appId, key, Collections.emptyList(), priority, resourceGroup);
this.src = checkNotNull(src);
this.dst = checkNotNull(dst);
this.signalType = checkNotNull(signalType);
@@ -96,6 +127,11 @@
return (Builder) super.priority(priority);
}
+ @Override
+ public Builder resourceGroup(ResourceGroup resourceGroup) {
+ return (Builder) super.resourceGroup(resourceGroup);
+ }
+
/**
* Sets the source for the intent that will be built.
*
@@ -154,7 +190,8 @@
dst,
signalType,
isBidirectional,
- priority
+ priority,
+ resourceGroup
);
}
}
@@ -218,6 +255,7 @@
.add("dst", dst)
.add("signalType", signalType)
.add("isBidirectional", isBidirectional)
+ .add("resourceGroup", resourceGroup())
.toString();
}
}
diff --git a/core/api/src/main/java/org/onosproject/net/intent/OpticalOduIntent.java b/core/api/src/main/java/org/onosproject/net/intent/OpticalOduIntent.java
index 36c4dde..ec88542 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/OpticalOduIntent.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/OpticalOduIntent.java
@@ -20,6 +20,7 @@
import org.onosproject.core.ApplicationId;
import org.onosproject.net.CltSignalType;
import org.onosproject.net.ConnectPoint;
+import org.onosproject.net.ResourceGroup;
import java.util.Collections;
@@ -46,15 +47,44 @@
* @param signalType CltSignalType signal type
* @param isBidirectional indicate if intent is bidirectional
* @param priority priority to use for flows from this intent
+ * @deprecated 1.9.1
+ */
+ @Deprecated
+ protected OpticalOduIntent(ApplicationId appId,
+ Key key,
+ ConnectPoint src,
+ ConnectPoint dst,
+ CltSignalType signalType,
+ boolean isBidirectional,
+ int priority) {
+ super(appId, key, Collections.emptyList(), priority, null);
+ this.src = checkNotNull(src);
+ this.dst = checkNotNull(dst);
+ this.signalType = checkNotNull(signalType);
+ this.isBidirectional = isBidirectional;
+ }
+
+ /**
+ * Creates an optical ODU intent between the specified connection points.
+ *
+ * @param appId application identification
+ * @param key intent key
+ * @param src the source transponder port
+ * @param dst the destination transponder port
+ * @param signalType CltSignalType signal type
+ * @param isBidirectional indicate if intent is bidirectional
+ * @param priority priority to use for flows from this intent
+ * @param resourceGroup resource group for this intent
*/
protected OpticalOduIntent(ApplicationId appId,
- Key key,
- ConnectPoint src,
- ConnectPoint dst,
- CltSignalType signalType,
- boolean isBidirectional,
- int priority) {
- super(appId, key, Collections.emptyList(), priority);
+ Key key,
+ ConnectPoint src,
+ ConnectPoint dst,
+ CltSignalType signalType,
+ boolean isBidirectional,
+ int priority,
+ ResourceGroup resourceGroup) {
+ super(appId, key, Collections.emptyList(), priority, resourceGroup);
this.src = checkNotNull(src);
this.dst = checkNotNull(dst);
this.signalType = checkNotNull(signalType);
@@ -95,6 +125,11 @@
return (Builder) super.priority(priority);
}
+ @Override
+ public Builder resourceGroup(ResourceGroup resourceGroup) {
+ return (Builder) super.resourceGroup(resourceGroup);
+ }
+
/**
* Sets the source for the intent that will be built.
*
@@ -153,7 +188,8 @@
dst,
signalType,
isBidirectional,
- priority
+ priority,
+ resourceGroup
);
}
}
@@ -217,6 +253,7 @@
.add("dst", dst)
.add("signalType", signalType)
.add("isBidirectional", isBidirectional)
+ .add("resourceGroup", resourceGroup())
.toString();
}
diff --git a/core/api/src/main/java/org/onosproject/net/intent/OpticalPathIntent.java b/core/api/src/main/java/org/onosproject/net/intent/OpticalPathIntent.java
index 1a6ee30..d42ce99 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/OpticalPathIntent.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/OpticalPathIntent.java
@@ -24,6 +24,7 @@
import com.google.common.base.MoreObjects;
import com.google.common.collect.ImmutableSet;
+import org.onosproject.net.ResourceGroup;
import static com.google.common.base.Preconditions.checkNotNull;
@@ -48,8 +49,9 @@
OchSignal lambda,
OchSignalType signalType,
boolean isBidirectional,
- int priority) {
- super(appId, key, ImmutableSet.copyOf(path.links()), priority);
+ int priority,
+ ResourceGroup resourceGroup) {
+ super(appId, key, ImmutableSet.copyOf(path.links()), priority, resourceGroup);
this.src = checkNotNull(src);
this.dst = checkNotNull(dst);
this.path = checkNotNull(path);
@@ -104,6 +106,11 @@
return (Builder) super.priority(priority);
}
+ @Override
+ public Builder resourceGroup(ResourceGroup resourceGroup) {
+ return (Builder) super.resourceGroup(resourceGroup);
+ }
+
/**
* Sets the source for the intent that will be built.
*
@@ -186,7 +193,8 @@
lambda,
signalType,
isBidirectional,
- priority
+ priority,
+ resourceGroup
);
}
}
diff --git a/core/api/src/main/java/org/onosproject/net/intent/PathIntent.java b/core/api/src/main/java/org/onosproject/net/intent/PathIntent.java
index 94a05b2..3c386cc 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/PathIntent.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/PathIntent.java
@@ -21,6 +21,7 @@
import org.onosproject.core.ApplicationId;
import org.onosproject.net.Link;
import org.onosproject.net.Path;
+import org.onosproject.net.ResourceGroup;
import org.onosproject.net.flow.TrafficSelector;
import org.onosproject.net.flow.TrafficTreatment;
@@ -50,7 +51,9 @@
* @param constraints optional list of constraints
* @param priority priority to use for the generated flows
* @throws NullPointerException {@code path} is null
+ * @deprecated 1.9.1
*/
+ @Deprecated
protected PathIntent(ApplicationId appId,
Key key,
TrafficSelector selector,
@@ -59,7 +62,7 @@
List<Constraint> constraints,
int priority) {
this(appId, key, selector, treatment, path, constraints, priority,
- ProtectionType.PRIMARY);
+ ProtectionType.PRIMARY, null);
}
/**
@@ -75,6 +78,7 @@
* @param constraints optional list of constraints
* @param priority priority to use for the generated flows
* @param type PRIMARY or BACKUP
+ * @param resourceGroup resource group for this intent
* @throws NullPointerException {@code path} is null
*/
protected PathIntent(ApplicationId appId,
@@ -84,9 +88,10 @@
Path path,
List<Constraint> constraints,
int priority,
- ProtectionType type) {
+ ProtectionType type,
+ ResourceGroup resourceGroup) {
super(appId, key, resources(path.links()), selector, treatment, constraints,
- priority);
+ priority, resourceGroup);
PathIntent.validate(path.links());
this.path = path;
this.type = type;
@@ -151,6 +156,11 @@
return (Builder) super.priority(priority);
}
+ @Override
+ public Builder resourceGroup(ResourceGroup resourceGroup) {
+ return (Builder) super.resourceGroup(resourceGroup);
+ }
+
/**
* Sets the path of the intent that will be built.
*
@@ -182,7 +192,8 @@
path,
constraints,
priority,
- type == null ? ProtectionType.PRIMARY : type
+ type == null ? ProtectionType.PRIMARY : type,
+ resourceGroup
);
}
}
@@ -237,6 +248,7 @@
.add("constraints", constraints())
.add("path", path)
.add("type", type)
+ .add("resourceGroup", resourceGroup())
.toString();
}
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 ba3b2c2..77b4556 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
@@ -22,6 +22,7 @@
import org.onosproject.core.ApplicationId;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.FilteredConnectPoint;
+import org.onosproject.net.ResourceGroup;
import org.onosproject.net.flow.TrafficSelector;
import org.onosproject.net.flow.TrafficTreatment;
@@ -92,6 +93,11 @@
return (Builder) super.priority(priority);
}
+ @Override
+ public Builder resourceGroup(ResourceGroup resourceGroup) {
+ return (Builder) super.resourceGroup(resourceGroup);
+ }
+
/**
* Sets the ingress point of the point to point intent that will be built.
*
@@ -140,7 +146,6 @@
return this;
}
-
/**
* Builds a point to point intent from the accumulated parameters.
*
@@ -156,7 +161,8 @@
ingressPoint,
egressPoint,
constraints,
- priority
+ priority,
+ resourceGroup
);
}
}
@@ -179,15 +185,16 @@
* {@code egressPoints} or {@code appId} is null.
*/
private PointToPointIntent(ApplicationId appId,
- Key key,
- TrafficSelector selector,
- TrafficTreatment treatment,
- FilteredConnectPoint ingressPoint,
- FilteredConnectPoint egressPoint,
- List<Constraint> constraints,
- int priority) {
+ Key key,
+ TrafficSelector selector,
+ TrafficTreatment treatment,
+ FilteredConnectPoint ingressPoint,
+ FilteredConnectPoint egressPoint,
+ List<Constraint> constraints,
+ int priority,
+ ResourceGroup resourceGroup) {
super(appId, key, Collections.emptyList(), selector, treatment, constraints,
- priority);
+ priority, resourceGroup);
checkArgument(!ingressPoint.equals(egressPoint),
"ingress and egress should be different (ingress: %s, egress: %s)", ingressPoint, egressPoint);
@@ -258,6 +265,7 @@
.add("ingress", filteredIngressPoint())
.add("egress", filteredEgressPoint())
.add("constraints", constraints())
+ .add("resourceGroup", resourceGroup())
.toString();
}
diff --git a/core/api/src/main/java/org/onosproject/net/intent/ProtectedTransportIntent.java b/core/api/src/main/java/org/onosproject/net/intent/ProtectedTransportIntent.java
index 0ef0809..afc82e5 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/ProtectedTransportIntent.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/ProtectedTransportIntent.java
@@ -24,6 +24,7 @@
import org.onosproject.core.ApplicationId;
import org.onosproject.net.DeviceId;
import org.onosproject.net.NetworkResource;
+import org.onosproject.net.ResourceGroup;
import org.onosproject.net.flow.TrafficSelector;
import org.onosproject.net.flow.TrafficTreatment;
@@ -65,9 +66,10 @@
TrafficSelector selector,
TrafficTreatment treatment,
List<Constraint> constraints,
- int priority) {
+ int priority,
+ ResourceGroup resourceGroup) {
super(appId, key, resources, selector, treatment, constraints,
- priority);
+ priority, resourceGroup);
this.one = checkNotNull(one, "one cannot be null");
this.two = checkNotNull(two, "two cannot be null");
@@ -143,6 +145,11 @@
return (Builder) super.priority(priority);
}
+ @Override
+ public Builder resourceGroup(ResourceGroup resourceGroup) {
+ return (Builder) super.resourceGroup(resourceGroup);
+ }
+
/**
* Sets the transport endpoint device one.
*
@@ -181,7 +188,8 @@
selector,
treatment,
constraints,
- priority
+ priority,
+ resourceGroup
);
}
@@ -199,6 +207,7 @@
.add("one", one())
.add("two", two())
.add("constraints", constraints())
+ .add("resourceGroup", resourceGroup())
.toString();
}
diff --git a/core/api/src/main/java/org/onosproject/net/intent/ProtectionEndpointIntent.java b/core/api/src/main/java/org/onosproject/net/intent/ProtectionEndpointIntent.java
index 518db0b..e78e893 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/ProtectionEndpointIntent.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/ProtectionEndpointIntent.java
@@ -23,6 +23,7 @@
import org.onosproject.core.ApplicationId;
import org.onosproject.net.DeviceId;
import org.onosproject.net.NetworkResource;
+import org.onosproject.net.ResourceGroup;
import org.onosproject.net.behaviour.protection.ProtectedTransportEndpointDescription;
import com.google.common.annotations.Beta;
@@ -39,13 +40,47 @@
private final DeviceId deviceId;
private final ProtectedTransportEndpointDescription description;
-
+ /**
+ * Creates a ProtectionEndpointIntent by specific resource and description.
+ *
+ * @param appId application identification
+ * @param key intent key
+ * @param resources network resource to be set
+ * @param priority priority to use for flows from this intent
+ * @param deviceId target device id
+ * @param description protected transport endpoint description of the intent
+ * @deprecated 1.9.1
+ */
+ @Deprecated
protected ProtectionEndpointIntent(ApplicationId appId, Key key,
- Collection<NetworkResource> resources,
- int priority,
- DeviceId deviceId,
- ProtectedTransportEndpointDescription description) {
- super(appId, key, resources, priority);
+ Collection<NetworkResource> resources,
+ int priority,
+ DeviceId deviceId,
+ ProtectedTransportEndpointDescription description) {
+ super(appId, key, resources, priority, null);
+
+ this.deviceId = checkNotNull(deviceId);
+ this.description = checkNotNull(description);
+ }
+
+ /**
+ * Creates a ProtectionEndpointIntent by specific resource and description.
+ *
+ * @param appId application identification
+ * @param key intent key
+ * @param resources network resource to be set
+ * @param priority priority to use for flows from this intent
+ * @param deviceId target device id
+ * @param description protected transport endpoint description of the intent
+ * @param resourceGroup resource group for this intent
+ */
+ protected ProtectionEndpointIntent(ApplicationId appId, Key key,
+ Collection<NetworkResource> resources,
+ int priority,
+ DeviceId deviceId,
+ ProtectedTransportEndpointDescription description,
+ ResourceGroup resourceGroup) {
+ super(appId, key, resources, priority, resourceGroup);
this.deviceId = checkNotNull(deviceId);
this.description = checkNotNull(description);
@@ -146,6 +181,11 @@
return this;
}
+ @Override
+ public Builder resourceGroup(ResourceGroup resourceGroup) {
+ return (Builder) super.resourceGroup(resourceGroup);
+ }
+
public Builder deviceId(DeviceId deviceId) {
this.deviceId = deviceId;
return this;
@@ -163,7 +203,8 @@
resources,
priority,
deviceId,
- description);
+ description,
+ resourceGroup);
}
}
diff --git a/core/api/src/main/java/org/onosproject/net/intent/SinglePointToMultiPointIntent.java b/core/api/src/main/java/org/onosproject/net/intent/SinglePointToMultiPointIntent.java
index 8431a0a..2583b8a 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/SinglePointToMultiPointIntent.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/SinglePointToMultiPointIntent.java
@@ -24,6 +24,7 @@
import org.onosproject.core.ApplicationId;
import org.onosproject.net.ConnectPoint;
import org.onosproject.net.FilteredConnectPoint;
+import org.onosproject.net.ResourceGroup;
import org.onosproject.net.flow.TrafficSelector;
import org.onosproject.net.flow.TrafficTreatment;
import org.slf4j.Logger;
@@ -67,9 +68,10 @@
FilteredConnectPoint ingressPoint,
Set<FilteredConnectPoint> egressPoints,
List<Constraint> constraints,
- int priority) {
+ int priority,
+ ResourceGroup resourceGroup) {
super(appId, key, ImmutableList.of(), selector, treatment, constraints,
- priority);
+ priority, resourceGroup);
checkNotNull(egressPoints);
checkNotNull(ingressPoint);
checkArgument(!egressPoints.isEmpty(), "Egress point set cannot be empty");
@@ -159,6 +161,11 @@
return (Builder) super.priority(priority);
}
+ @Override
+ public Builder resourceGroup(ResourceGroup resourceGroup) {
+ return (Builder) super.resourceGroup(resourceGroup);
+ }
+
/**
* Sets the ingress point of the single point to multi point intent
* that will be built.
@@ -221,7 +228,6 @@
return this;
}
-
/**
* Builds a single point to multi point intent from the
* accumulated parameters.
@@ -238,7 +244,8 @@
ingressPoint,
egressPoints,
constraints,
- priority
+ priority,
+ resourceGroup
);
}
}
@@ -308,6 +315,7 @@
.add("filteredIngressCPs", filteredIngressPoint())
.add("filteredEgressCP", filteredEgressPoints())
.add("constraints", constraints())
+ .add("resourceGroup", resourceGroup())
.toString();
}
diff --git a/core/api/src/main/java/org/onosproject/net/intent/TwoWayP2PIntent.java b/core/api/src/main/java/org/onosproject/net/intent/TwoWayP2PIntent.java
index 2a47891..cc023a4 100644
--- a/core/api/src/main/java/org/onosproject/net/intent/TwoWayP2PIntent.java
+++ b/core/api/src/main/java/org/onosproject/net/intent/TwoWayP2PIntent.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.ResourceGroup;
import org.onosproject.net.flow.TrafficSelector;
import org.onosproject.net.flow.TrafficTreatment;
@@ -49,16 +50,18 @@
* @param treatment ingress port
* @param constraints optional prioritized list of path selection constraints
* @param priority priority to use for flows generated by this intent
+ * @param resourceGroup resource group for this intent
* @throws NullPointerException if {@code one} or {@code two} is null.
*/
private TwoWayP2PIntent(ApplicationId appId, Key key,
- ConnectPoint one, ConnectPoint two,
- TrafficSelector selector,
- TrafficTreatment treatment,
- List<Constraint> constraints,
- int priority) {
+ ConnectPoint one, ConnectPoint two,
+ TrafficSelector selector,
+ TrafficTreatment treatment,
+ List<Constraint> constraints,
+ int priority,
+ ResourceGroup resourceGroup) {
super(appId, key, Collections.emptyList(), selector, treatment, constraints,
- priority);
+ priority, resourceGroup);
// TODO: consider whether the case one and two are same is allowed
this.one = checkNotNull(one);
@@ -116,6 +119,11 @@
return (Builder) super.priority(priority);
}
+ @Override
+ public Builder resourceGroup(ResourceGroup resourceGroup) {
+ return (Builder) super.resourceGroup(resourceGroup);
+ }
+
/**
* Sets the first connection point of the two way intent that will be built.
*
@@ -153,7 +161,8 @@
selector,
treatment,
constraints,
- priority
+ priority,
+ resourceGroup
);
}
}
@@ -187,6 +196,7 @@
.add("selector", selector())
.add("treatment", treatment())
.add("constraints", constraints())
+ .add("resourceGroup", resourceGroup())
.add("one", one)
.add("two", two)
.toString();