mirror of
https://github.com/opennetworkinglab/onos.git
synced 2025-10-18 19:01:06 +02:00
Add priority to Intents
Change-Id: Ibe63356f5b15a6aa6ca7731dba3382c3317a95ec
This commit is contained in:
parent
20207dfca7
commit
c24cde3305
@ -210,7 +210,8 @@ public class IntentPerfInstaller {
|
|||||||
Intent intent = new PointToPointIntent(appId, key,
|
Intent intent = new PointToPointIntent(appId, key,
|
||||||
selector, treatment,
|
selector, treatment,
|
||||||
ingress, egress,
|
ingress, egress,
|
||||||
Collections.emptyList());
|
Collections.emptyList(),
|
||||||
|
Intent.DEFAULT_INTENT_PRIORITY);
|
||||||
result.add(intent);
|
result.add(intent);
|
||||||
|
|
||||||
// Bump up the counter and remember this as the last key used.
|
// Bump up the counter and remember this as the last key used.
|
||||||
|
@ -75,7 +75,8 @@ public class AddMultiPointToSinglePointIntentCommand extends ConnectivityIntentC
|
|||||||
Intent intent = new MultiPointToSinglePointIntent(appId(), key(),
|
Intent intent = new MultiPointToSinglePointIntent(appId(), key(),
|
||||||
selector, treatment,
|
selector, treatment,
|
||||||
ingressPoints, egress,
|
ingressPoints, egress,
|
||||||
constraints);
|
constraints,
|
||||||
|
priority());
|
||||||
service.submit(intent);
|
service.submit(intent);
|
||||||
print("Multipoint to single point intent submitted:\n%s", intent.toString());
|
print("Multipoint to single point intent submitted:\n%s", intent.toString());
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,8 @@ public class AddPointToPointIntentCommand extends ConnectivityIntentCommand {
|
|||||||
Intent intent = new PointToPointIntent(appId(),
|
Intent intent = new PointToPointIntent(appId(),
|
||||||
key(),
|
key(),
|
||||||
selector, treatment,
|
selector, treatment,
|
||||||
ingress, egress, constraints);
|
ingress, egress, constraints,
|
||||||
|
priority());
|
||||||
service.submit(intent);
|
service.submit(intent);
|
||||||
print("Point to point intent submitted:\n%s", intent.toString());
|
print("Point to point intent submitted:\n%s", intent.toString());
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,10 @@
|
|||||||
*/
|
*/
|
||||||
package org.onosproject.cli.net;
|
package org.onosproject.cli.net;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import org.apache.karaf.shell.commands.Argument;
|
import org.apache.karaf.shell.commands.Argument;
|
||||||
import org.apache.karaf.shell.commands.Command;
|
import org.apache.karaf.shell.commands.Command;
|
||||||
import org.onosproject.net.ConnectPoint;
|
import org.onosproject.net.ConnectPoint;
|
||||||
@ -27,10 +31,6 @@ import org.onosproject.net.intent.Constraint;
|
|||||||
import org.onosproject.net.intent.IntentService;
|
import org.onosproject.net.intent.IntentService;
|
||||||
import org.onosproject.net.intent.SinglePointToMultiPointIntent;
|
import org.onosproject.net.intent.SinglePointToMultiPointIntent;
|
||||||
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import static org.onosproject.net.DeviceId.deviceId;
|
import static org.onosproject.net.DeviceId.deviceId;
|
||||||
import static org.onosproject.net.PortNumber.portNumber;
|
import static org.onosproject.net.PortNumber.portNumber;
|
||||||
|
|
||||||
@ -79,7 +79,8 @@ public class AddSinglePointToMultiPointIntentCommand extends ConnectivityIntentC
|
|||||||
treatment,
|
treatment,
|
||||||
ingressPoint,
|
ingressPoint,
|
||||||
egressPoints,
|
egressPoints,
|
||||||
constraints);
|
constraints,
|
||||||
|
priority());
|
||||||
service.submit(intent);
|
service.submit(intent);
|
||||||
print("Single point to multipoint intent submitted:\n%s", intent.toString());
|
print("Single point to multipoint intent submitted:\n%s", intent.toString());
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ import org.onosproject.net.flow.DefaultTrafficSelector;
|
|||||||
import org.onosproject.net.flow.TrafficSelector;
|
import org.onosproject.net.flow.TrafficSelector;
|
||||||
import org.onosproject.net.flow.TrafficTreatment;
|
import org.onosproject.net.flow.TrafficTreatment;
|
||||||
import org.onosproject.net.intent.Constraint;
|
import org.onosproject.net.intent.Constraint;
|
||||||
|
import org.onosproject.net.intent.Intent;
|
||||||
import org.onosproject.net.intent.Key;
|
import org.onosproject.net.intent.Key;
|
||||||
import org.onosproject.net.intent.constraint.BandwidthConstraint;
|
import org.onosproject.net.intent.constraint.BandwidthConstraint;
|
||||||
import org.onosproject.net.intent.constraint.LambdaConstraint;
|
import org.onosproject.net.intent.constraint.LambdaConstraint;
|
||||||
@ -96,6 +97,11 @@ public abstract class ConnectivityIntentCommand extends AbstractShellCommand {
|
|||||||
required = false, multiValued = false)
|
required = false, multiValued = false)
|
||||||
private String setEthDstString = null;
|
private String setEthDstString = null;
|
||||||
|
|
||||||
|
// Priorities
|
||||||
|
@Option(name = "-p", aliases = "--priority", description = "Priority",
|
||||||
|
required = false, multiValued = false)
|
||||||
|
private int priority = Intent.DEFAULT_INTENT_PRIORITY;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a traffic selector based on the command line arguments
|
* Constructs a traffic selector based on the command line arguments
|
||||||
* presented to the command.
|
* presented to the command.
|
||||||
@ -200,4 +206,13 @@ public abstract class ConnectivityIntentCommand extends AbstractShellCommand {
|
|||||||
}
|
}
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the priority to use for the intent.
|
||||||
|
*
|
||||||
|
* @return priority
|
||||||
|
*/
|
||||||
|
protected int priority() {
|
||||||
|
return priority;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -130,7 +130,8 @@ public class IntentCycleCommand extends AbstractShellCommand
|
|||||||
intents.add(new PointToPointIntent(appId(), Key.of(i + keyOffset, appId()),
|
intents.add(new PointToPointIntent(appId(), Key.of(i + keyOffset, appId()),
|
||||||
selector, treatment,
|
selector, treatment,
|
||||||
ingress, egress,
|
ingress, egress,
|
||||||
Collections.emptyList()));
|
Collections.emptyList(),
|
||||||
|
Intent.DEFAULT_INTENT_PRIORITY));
|
||||||
|
|
||||||
}
|
}
|
||||||
return intents;
|
return intents;
|
||||||
|
@ -139,7 +139,8 @@ public class IntentPushTestCommand extends AbstractShellCommand
|
|||||||
intents.add(new PointToPointIntent(appId(), Key.of(i + keyOffset, appId()),
|
intents.add(new PointToPointIntent(appId(), Key.of(i + keyOffset, appId()),
|
||||||
selector, treatment,
|
selector, treatment,
|
||||||
ingress, egress,
|
ingress, egress,
|
||||||
Collections.emptyList()));
|
Collections.emptyList(),
|
||||||
|
Intent.DEFAULT_INTENT_PRIORITY));
|
||||||
|
|
||||||
}
|
}
|
||||||
return intents;
|
return intents;
|
||||||
|
@ -61,7 +61,8 @@ public abstract class ConnectivityIntent extends Intent {
|
|||||||
Collection<NetworkResource> resources,
|
Collection<NetworkResource> resources,
|
||||||
TrafficSelector selector,
|
TrafficSelector selector,
|
||||||
TrafficTreatment treatment) {
|
TrafficTreatment treatment) {
|
||||||
this(appId, null, resources, selector, treatment, Collections.emptyList());
|
this(appId, null, resources, selector, treatment, Collections.emptyList(),
|
||||||
|
DEFAULT_INTENT_PRIORITY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -83,7 +84,8 @@ public abstract class ConnectivityIntent extends Intent {
|
|||||||
Collection<NetworkResource> resources,
|
Collection<NetworkResource> resources,
|
||||||
TrafficSelector selector,
|
TrafficSelector selector,
|
||||||
TrafficTreatment treatment) {
|
TrafficTreatment treatment) {
|
||||||
this(appId, key, resources, selector, treatment, Collections.emptyList());
|
this(appId, key, resources, selector, treatment, Collections.emptyList(),
|
||||||
|
DEFAULT_INTENT_PRIORITY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -99,6 +101,7 @@ public abstract class ConnectivityIntent extends Intent {
|
|||||||
* @param selector traffic selector
|
* @param selector traffic selector
|
||||||
* @param treatment treatment
|
* @param treatment treatment
|
||||||
* @param constraints optional prioritized list of constraints
|
* @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
|
* @throws NullPointerException if the selector or treatment is null
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -107,8 +110,9 @@ public abstract class ConnectivityIntent extends Intent {
|
|||||||
Collection<NetworkResource> resources,
|
Collection<NetworkResource> resources,
|
||||||
TrafficSelector selector,
|
TrafficSelector selector,
|
||||||
TrafficTreatment treatment,
|
TrafficTreatment treatment,
|
||||||
List<Constraint> constraints) {
|
List<Constraint> constraints,
|
||||||
super(appId, key, resources);
|
int priority) {
|
||||||
|
super(appId, key, resources, priority);
|
||||||
this.selector = checkNotNull(selector);
|
this.selector = checkNotNull(selector);
|
||||||
this.treatment = checkNotNull(treatment);
|
this.treatment = checkNotNull(treatment);
|
||||||
this.constraints = checkNotNull(constraints);
|
this.constraints = checkNotNull(constraints);
|
||||||
@ -126,6 +130,7 @@ public abstract class ConnectivityIntent extends Intent {
|
|||||||
* @param selector traffic selector
|
* @param selector traffic selector
|
||||||
* @param treatment treatment
|
* @param treatment treatment
|
||||||
* @param constraints optional prioritized list of constraints
|
* @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
|
* @throws NullPointerException if the selector or treatment is null
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -133,8 +138,9 @@ public abstract class ConnectivityIntent extends Intent {
|
|||||||
Collection<NetworkResource> resources,
|
Collection<NetworkResource> resources,
|
||||||
TrafficSelector selector,
|
TrafficSelector selector,
|
||||||
TrafficTreatment treatment,
|
TrafficTreatment treatment,
|
||||||
List<Constraint> constraints) {
|
List<Constraint> constraints,
|
||||||
super(appId, null, resources);
|
int priority) {
|
||||||
|
super(appId, null, resources, priority);
|
||||||
this.selector = checkNotNull(selector);
|
this.selector = checkNotNull(selector);
|
||||||
this.treatment = checkNotNull(treatment);
|
this.treatment = checkNotNull(treatment);
|
||||||
this.constraints = checkNotNull(constraints);
|
this.constraints = checkNotNull(constraints);
|
||||||
|
@ -106,7 +106,8 @@ public final class HostToHostIntent extends ConnectivityIntent {
|
|||||||
TrafficSelector selector,
|
TrafficSelector selector,
|
||||||
TrafficTreatment treatment,
|
TrafficTreatment treatment,
|
||||||
List<Constraint> constraints) {
|
List<Constraint> constraints) {
|
||||||
super(appId, key, Collections.emptyList(), selector, treatment, constraints);
|
super(appId, key, Collections.emptyList(), selector, treatment, constraints,
|
||||||
|
DEFAULT_INTENT_PRIORITY);
|
||||||
|
|
||||||
// TODO: consider whether the case one and two are same is allowed
|
// TODO: consider whether the case one and two are same is allowed
|
||||||
this.one = checkNotNull(one);
|
this.one = checkNotNull(one);
|
||||||
@ -146,6 +147,7 @@ public final class HostToHostIntent extends ConnectivityIntent {
|
|||||||
.add("id", id())
|
.add("id", id())
|
||||||
.add("key", key())
|
.add("key", key())
|
||||||
.add("appId", appId())
|
.add("appId", appId())
|
||||||
|
.add("priority", priority())
|
||||||
.add("resources", resources())
|
.add("resources", resources())
|
||||||
.add("selector", selector())
|
.add("selector", selector())
|
||||||
.add("treatment", treatment())
|
.add("treatment", treatment())
|
||||||
|
@ -22,6 +22,7 @@ import org.onosproject.net.NetworkResource;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Objects;
|
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.checkNotNull;
|
||||||
import static com.google.common.base.Preconditions.checkState;
|
import static com.google.common.base.Preconditions.checkState;
|
||||||
|
|
||||||
@ -38,6 +39,11 @@ public abstract class Intent {
|
|||||||
private final ApplicationId appId;
|
private final ApplicationId appId;
|
||||||
private final Key key;
|
private final Key key;
|
||||||
|
|
||||||
|
private final int priority;
|
||||||
|
public static final int DEFAULT_INTENT_PRIORITY = 100;
|
||||||
|
public static final int MAX_PRIORITY = (1 << 16) - 1;
|
||||||
|
public static final int MIN_PRIORITY = 1;
|
||||||
|
|
||||||
private final Collection<NetworkResource> resources;
|
private final Collection<NetworkResource> resources;
|
||||||
|
|
||||||
private static IdGenerator idGenerator;
|
private static IdGenerator idGenerator;
|
||||||
@ -50,6 +56,7 @@ public abstract class Intent {
|
|||||||
this.appId = null;
|
this.appId = null;
|
||||||
this.key = null;
|
this.key = null;
|
||||||
this.resources = null;
|
this.resources = null;
|
||||||
|
this.priority = DEFAULT_INTENT_PRIORITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -60,7 +67,7 @@ public abstract class Intent {
|
|||||||
*/
|
*/
|
||||||
protected Intent(ApplicationId appId,
|
protected Intent(ApplicationId appId,
|
||||||
Collection<NetworkResource> resources) {
|
Collection<NetworkResource> resources) {
|
||||||
this(appId, null, resources);
|
this(appId, null, resources, DEFAULT_INTENT_PRIORITY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -72,11 +79,14 @@ public abstract class Intent {
|
|||||||
*/
|
*/
|
||||||
protected Intent(ApplicationId appId,
|
protected Intent(ApplicationId appId,
|
||||||
Key key,
|
Key key,
|
||||||
Collection<NetworkResource> resources) {
|
Collection<NetworkResource> resources,
|
||||||
|
int priority) {
|
||||||
checkState(idGenerator != null, "Id generator is not bound.");
|
checkState(idGenerator != null, "Id generator is not bound.");
|
||||||
|
checkArgument(priority <= MAX_PRIORITY && priority >= MIN_PRIORITY);
|
||||||
this.id = IntentId.valueOf(idGenerator.getNewId());
|
this.id = IntentId.valueOf(idGenerator.getNewId());
|
||||||
this.appId = checkNotNull(appId, "Application ID cannot be null");
|
this.appId = checkNotNull(appId, "Application ID cannot be null");
|
||||||
this.key = (key != null) ? key : Key.of(id.fingerprint(), appId);
|
this.key = (key != null) ? key : Key.of(id.fingerprint(), appId);
|
||||||
|
this.priority = priority;
|
||||||
this.resources = checkNotNull(resources);
|
this.resources = checkNotNull(resources);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,6 +108,15 @@ public abstract class Intent {
|
|||||||
return appId;
|
return appId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the priority of the intent.
|
||||||
|
*
|
||||||
|
* @return intent priority
|
||||||
|
*/
|
||||||
|
public int priority() {
|
||||||
|
return priority;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the collection of resources required for this intent.
|
* Returns the collection of resources required for this intent.
|
||||||
*
|
*
|
||||||
|
@ -59,7 +59,7 @@ public final class LinkCollectionIntent extends ConnectivityIntent {
|
|||||||
ConnectPoint ingressPoint,
|
ConnectPoint ingressPoint,
|
||||||
ConnectPoint egressPoint) {
|
ConnectPoint egressPoint) {
|
||||||
this(appId, selector, treatment, links, ingressPoint, egressPoint,
|
this(appId, selector, treatment, links, ingressPoint, egressPoint,
|
||||||
Collections.emptyList());
|
Collections.emptyList(), DEFAULT_INTENT_PRIORITY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -74,6 +74,7 @@ public final class LinkCollectionIntent extends ConnectivityIntent {
|
|||||||
* @param ingressPoint ingress point
|
* @param ingressPoint ingress point
|
||||||
* @param egressPoint egress point
|
* @param egressPoint egress point
|
||||||
* @param constraints optional list of constraints
|
* @param constraints optional list of constraints
|
||||||
|
* @param priority priority to use for the flows generated by this intent
|
||||||
* @throws NullPointerException {@code path} is null
|
* @throws NullPointerException {@code path} is null
|
||||||
*/
|
*/
|
||||||
public LinkCollectionIntent(ApplicationId appId,
|
public LinkCollectionIntent(ApplicationId appId,
|
||||||
@ -82,8 +83,9 @@ public final class LinkCollectionIntent extends ConnectivityIntent {
|
|||||||
Set<Link> links,
|
Set<Link> links,
|
||||||
ConnectPoint ingressPoint,
|
ConnectPoint ingressPoint,
|
||||||
ConnectPoint egressPoint,
|
ConnectPoint egressPoint,
|
||||||
List<Constraint> constraints) {
|
List<Constraint> constraints,
|
||||||
super(appId, resources(links), selector, treatment, constraints);
|
int priority) {
|
||||||
|
super(appId, resources(links), selector, treatment, constraints, priority);
|
||||||
this.links = links;
|
this.links = links;
|
||||||
this.ingressPoints = ImmutableSet.of(ingressPoint);
|
this.ingressPoints = ImmutableSet.of(ingressPoint);
|
||||||
this.egressPoints = ImmutableSet.of(egressPoint);
|
this.egressPoints = ImmutableSet.of(egressPoint);
|
||||||
@ -101,6 +103,7 @@ public final class LinkCollectionIntent extends ConnectivityIntent {
|
|||||||
* @param ingressPoints Set of ingress points
|
* @param ingressPoints Set of ingress points
|
||||||
* @param egressPoints Set of egress points
|
* @param egressPoints Set of egress points
|
||||||
* @param constraints the constraints
|
* @param constraints the constraints
|
||||||
|
* @param priority priority to use for the flows generated by this intent
|
||||||
* @throws NullPointerException {@code path} is null
|
* @throws NullPointerException {@code path} is null
|
||||||
*/
|
*/
|
||||||
public LinkCollectionIntent(ApplicationId appId,
|
public LinkCollectionIntent(ApplicationId appId,
|
||||||
@ -109,8 +112,9 @@ public final class LinkCollectionIntent extends ConnectivityIntent {
|
|||||||
Set<Link> links,
|
Set<Link> links,
|
||||||
Set<ConnectPoint> ingressPoints,
|
Set<ConnectPoint> ingressPoints,
|
||||||
Set<ConnectPoint> egressPoints,
|
Set<ConnectPoint> egressPoints,
|
||||||
List<Constraint> constraints) {
|
List<Constraint> constraints,
|
||||||
super(appId, resources(links), selector, treatment, constraints);
|
int priority) {
|
||||||
|
super(appId, resources(links), selector, treatment, constraints, priority);
|
||||||
|
|
||||||
this.links = links;
|
this.links = links;
|
||||||
this.ingressPoints = ImmutableSet.copyOf(ingressPoints);
|
this.ingressPoints = ImmutableSet.copyOf(ingressPoints);
|
||||||
@ -166,6 +170,7 @@ public final class LinkCollectionIntent extends ConnectivityIntent {
|
|||||||
.add("id", id())
|
.add("id", id())
|
||||||
.add("key", key())
|
.add("key", key())
|
||||||
.add("appId", appId())
|
.add("appId", appId())
|
||||||
|
.add("priority", priority())
|
||||||
.add("resources", resources())
|
.add("resources", resources())
|
||||||
.add("selector", selector())
|
.add("selector", selector())
|
||||||
.add("treatment", treatment())
|
.add("treatment", treatment())
|
||||||
|
@ -74,7 +74,8 @@ public final class MplsIntent extends ConnectivityIntent {
|
|||||||
Optional<MplsLabel> egressLabel,
|
Optional<MplsLabel> egressLabel,
|
||||||
List<Constraint> constraints) {
|
List<Constraint> constraints) {
|
||||||
|
|
||||||
super(appId, Collections.emptyList(), selector, treatment, constraints);
|
super(appId, Collections.emptyList(), selector, treatment, constraints,
|
||||||
|
DEFAULT_INTENT_PRIORITY);
|
||||||
|
|
||||||
checkNotNull(ingressPoint);
|
checkNotNull(ingressPoint);
|
||||||
checkNotNull(egressPoint);
|
checkNotNull(egressPoint);
|
||||||
@ -144,6 +145,7 @@ public final class MplsIntent extends ConnectivityIntent {
|
|||||||
return MoreObjects.toStringHelper(getClass())
|
return MoreObjects.toStringHelper(getClass())
|
||||||
.add("id", id())
|
.add("id", id())
|
||||||
.add("appId", appId())
|
.add("appId", appId())
|
||||||
|
.add("priority", priority())
|
||||||
.add("selector", selector())
|
.add("selector", selector())
|
||||||
.add("treatment", treatment())
|
.add("treatment", treatment())
|
||||||
.add("ingressPoint", ingressPoint)
|
.add("ingressPoint", ingressPoint)
|
||||||
|
@ -59,7 +59,8 @@ public final class MplsPathIntent extends PathIntent {
|
|||||||
public MplsPathIntent(ApplicationId appId, TrafficSelector selector,
|
public MplsPathIntent(ApplicationId appId, TrafficSelector selector,
|
||||||
TrafficTreatment treatment, Path path, Optional<MplsLabel> ingressLabel,
|
TrafficTreatment treatment, Path path, Optional<MplsLabel> ingressLabel,
|
||||||
Optional<MplsLabel> egressLabel, List<Constraint> constraints) {
|
Optional<MplsLabel> egressLabel, List<Constraint> constraints) {
|
||||||
super(appId, selector, treatment, path, constraints);
|
super(appId, selector, treatment, path, constraints,
|
||||||
|
DEFAULT_INTENT_PRIORITY);
|
||||||
|
|
||||||
checkNotNull(ingressLabel);
|
checkNotNull(ingressLabel);
|
||||||
checkNotNull(egressLabel);
|
checkNotNull(egressLabel);
|
||||||
|
@ -56,7 +56,8 @@ public final class MultiPointToSinglePointIntent extends ConnectivityIntent {
|
|||||||
TrafficTreatment treatment,
|
TrafficTreatment treatment,
|
||||||
Set<ConnectPoint> ingressPoints,
|
Set<ConnectPoint> ingressPoints,
|
||||||
ConnectPoint egressPoint) {
|
ConnectPoint egressPoint) {
|
||||||
this(appId, selector, treatment, ingressPoints, egressPoint, Collections.emptyList());
|
this(appId, selector, treatment, ingressPoints, egressPoint,
|
||||||
|
Collections.emptyList(), DEFAULT_INTENT_PRIORITY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -70,6 +71,7 @@ public final class MultiPointToSinglePointIntent extends ConnectivityIntent {
|
|||||||
* @param ingressPoints set of ports from which ingress traffic originates
|
* @param ingressPoints set of ports from which ingress traffic originates
|
||||||
* @param egressPoint port to which traffic will egress
|
* @param egressPoint port to which traffic will egress
|
||||||
* @param constraints constraints to apply to the intent
|
* @param constraints constraints to apply to the intent
|
||||||
|
* @param priority priority to use for flows generated by this intent
|
||||||
* @throws NullPointerException if {@code ingressPoints} or
|
* @throws NullPointerException if {@code ingressPoints} or
|
||||||
* {@code egressPoint} is null.
|
* {@code egressPoint} is null.
|
||||||
* @throws IllegalArgumentException if the size of {@code ingressPoints} is
|
* @throws IllegalArgumentException if the size of {@code ingressPoints} is
|
||||||
@ -81,8 +83,10 @@ public final class MultiPointToSinglePointIntent extends ConnectivityIntent {
|
|||||||
TrafficTreatment treatment,
|
TrafficTreatment treatment,
|
||||||
Set<ConnectPoint> ingressPoints,
|
Set<ConnectPoint> ingressPoints,
|
||||||
ConnectPoint egressPoint,
|
ConnectPoint egressPoint,
|
||||||
List<Constraint> constraints) {
|
List<Constraint> constraints,
|
||||||
super(appId, key, Collections.emptyList(), selector, treatment, constraints);
|
int priority) {
|
||||||
|
super(appId, key, Collections.emptyList(), selector, treatment, constraints,
|
||||||
|
priority);
|
||||||
|
|
||||||
checkNotNull(ingressPoints);
|
checkNotNull(ingressPoints);
|
||||||
checkArgument(!ingressPoints.isEmpty(), "Ingress point set cannot be empty");
|
checkArgument(!ingressPoints.isEmpty(), "Ingress point set cannot be empty");
|
||||||
@ -104,6 +108,7 @@ public final class MultiPointToSinglePointIntent extends ConnectivityIntent {
|
|||||||
* @param ingressPoints set of ports from which ingress traffic originates
|
* @param ingressPoints set of ports from which ingress traffic originates
|
||||||
* @param egressPoint port to which traffic will egress
|
* @param egressPoint port to which traffic will egress
|
||||||
* @param constraints constraints to apply to the intent
|
* @param constraints constraints to apply to the intent
|
||||||
|
* @param priority priority to use for flows generated by this intent
|
||||||
* @throws NullPointerException if {@code ingressPoints} or
|
* @throws NullPointerException if {@code ingressPoints} or
|
||||||
* {@code egressPoint} is null.
|
* {@code egressPoint} is null.
|
||||||
* @throws IllegalArgumentException if the size of {@code ingressPoints} is
|
* @throws IllegalArgumentException if the size of {@code ingressPoints} is
|
||||||
@ -114,8 +119,10 @@ public final class MultiPointToSinglePointIntent extends ConnectivityIntent {
|
|||||||
TrafficTreatment treatment,
|
TrafficTreatment treatment,
|
||||||
Set<ConnectPoint> ingressPoints,
|
Set<ConnectPoint> ingressPoints,
|
||||||
ConnectPoint egressPoint,
|
ConnectPoint egressPoint,
|
||||||
List<Constraint> constraints) {
|
List<Constraint> constraints,
|
||||||
this(appId, null, selector, treatment, ingressPoints, egressPoint, constraints);
|
int priority) {
|
||||||
|
this(appId, null, selector, treatment, ingressPoints, egressPoint,
|
||||||
|
constraints, priority);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -152,6 +159,7 @@ public final class MultiPointToSinglePointIntent extends ConnectivityIntent {
|
|||||||
.add("id", id())
|
.add("id", id())
|
||||||
.add("key", key())
|
.add("key", key())
|
||||||
.add("appId", appId())
|
.add("appId", appId())
|
||||||
|
.add("priority", priority())
|
||||||
.add("resources", resources())
|
.add("resources", resources())
|
||||||
.add("selector", selector())
|
.add("selector", selector())
|
||||||
.add("treatment", treatment())
|
.add("treatment", treatment())
|
||||||
|
@ -54,7 +54,7 @@ public final class OpticalConnectivityIntent extends Intent {
|
|||||||
public OpticalConnectivityIntent(ApplicationId appId,
|
public OpticalConnectivityIntent(ApplicationId appId,
|
||||||
Key key,
|
Key key,
|
||||||
ConnectPoint src, ConnectPoint dst) {
|
ConnectPoint src, ConnectPoint dst) {
|
||||||
super(appId, key, Collections.emptyList());
|
super(appId, key, Collections.emptyList(), DEFAULT_INTENT_PRIORITY);
|
||||||
this.src = src;
|
this.src = src;
|
||||||
this.dst = dst;
|
this.dst = dst;
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,8 @@ public class PathIntent extends ConnectivityIntent {
|
|||||||
*/
|
*/
|
||||||
public PathIntent(ApplicationId appId, TrafficSelector selector,
|
public PathIntent(ApplicationId appId, TrafficSelector selector,
|
||||||
TrafficTreatment treatment, Path path) {
|
TrafficTreatment treatment, Path path) {
|
||||||
this(appId, selector, treatment, path, Collections.emptyList());
|
this(appId, selector, treatment, path, Collections.emptyList(),
|
||||||
|
DEFAULT_INTENT_PRIORITY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -60,11 +61,14 @@ public class PathIntent extends ConnectivityIntent {
|
|||||||
* @param treatment treatment
|
* @param treatment treatment
|
||||||
* @param path traversed links
|
* @param path traversed links
|
||||||
* @param constraints optional list of constraints
|
* @param constraints optional list of constraints
|
||||||
|
* @param priority priority to use for the generated flows
|
||||||
* @throws NullPointerException {@code path} is null
|
* @throws NullPointerException {@code path} is null
|
||||||
*/
|
*/
|
||||||
public PathIntent(ApplicationId appId, TrafficSelector selector,
|
public PathIntent(ApplicationId appId, TrafficSelector selector,
|
||||||
TrafficTreatment treatment, Path path, List<Constraint> constraints) {
|
TrafficTreatment treatment, Path path, List<Constraint> constraints,
|
||||||
super(appId, resources(path.links()), selector, treatment, constraints);
|
int priority) {
|
||||||
|
super(appId, resources(path.links()), selector, treatment, constraints,
|
||||||
|
priority);
|
||||||
PathIntent.validate(path.links());
|
PathIntent.validate(path.links());
|
||||||
this.path = path;
|
this.path = path;
|
||||||
}
|
}
|
||||||
@ -123,6 +127,7 @@ public class PathIntent extends ConnectivityIntent {
|
|||||||
return MoreObjects.toStringHelper(getClass())
|
return MoreObjects.toStringHelper(getClass())
|
||||||
.add("id", id())
|
.add("id", id())
|
||||||
.add("appId", appId())
|
.add("appId", appId())
|
||||||
|
.add("priority", priority())
|
||||||
.add("resources", resources())
|
.add("resources", resources())
|
||||||
.add("selector", selector())
|
.add("selector", selector())
|
||||||
.add("treatment", treatment())
|
.add("treatment", treatment())
|
||||||
|
@ -49,6 +49,7 @@ public final class PointToPointIntent extends ConnectivityIntent {
|
|||||||
* @param ingressPoint ingress port
|
* @param ingressPoint ingress port
|
||||||
* @param egressPoint egress port
|
* @param egressPoint egress port
|
||||||
* @param constraints optional list of constraints
|
* @param constraints optional list of constraints
|
||||||
|
* @param priority priority to use for flows generated by this intent
|
||||||
* @throws NullPointerException if {@code ingressPoint} or {@code egressPoints} is null.
|
* @throws NullPointerException if {@code ingressPoint} or {@code egressPoints} is null.
|
||||||
*/
|
*/
|
||||||
public PointToPointIntent(ApplicationId appId,
|
public PointToPointIntent(ApplicationId appId,
|
||||||
@ -57,8 +58,10 @@ public final class PointToPointIntent extends ConnectivityIntent {
|
|||||||
TrafficTreatment treatment,
|
TrafficTreatment treatment,
|
||||||
ConnectPoint ingressPoint,
|
ConnectPoint ingressPoint,
|
||||||
ConnectPoint egressPoint,
|
ConnectPoint egressPoint,
|
||||||
List<Constraint> constraints) {
|
List<Constraint> constraints,
|
||||||
super(appId, key, Collections.emptyList(), selector, treatment, constraints);
|
int priority) {
|
||||||
|
super(appId, key, Collections.emptyList(), selector, treatment, constraints,
|
||||||
|
priority);
|
||||||
|
|
||||||
checkNotNull(ingressPoint);
|
checkNotNull(ingressPoint);
|
||||||
checkNotNull(egressPoint);
|
checkNotNull(egressPoint);
|
||||||
@ -85,7 +88,8 @@ public final class PointToPointIntent extends ConnectivityIntent {
|
|||||||
ConnectPoint ingressPoint,
|
ConnectPoint ingressPoint,
|
||||||
ConnectPoint egressPoint) {
|
ConnectPoint egressPoint) {
|
||||||
this(appId, null, selector, treatment, ingressPoint, egressPoint,
|
this(appId, null, selector, treatment, ingressPoint, egressPoint,
|
||||||
ImmutableList.of(new LinkTypeConstraint(false, Link.Type.OPTICAL)));
|
ImmutableList.of(new LinkTypeConstraint(false, Link.Type.OPTICAL)),
|
||||||
|
DEFAULT_INTENT_PRIORITY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -98,14 +102,17 @@ public final class PointToPointIntent extends ConnectivityIntent {
|
|||||||
* @param ingressPoint ingress port
|
* @param ingressPoint ingress port
|
||||||
* @param egressPoint egress port
|
* @param egressPoint egress port
|
||||||
* @param constraints optional list of constraints
|
* @param constraints optional list of constraints
|
||||||
|
* @param priority priority to use for flows generated by this intent
|
||||||
* @throws NullPointerException if {@code ingressPoint} or {@code egressPoints} is null.
|
* @throws NullPointerException if {@code ingressPoint} or {@code egressPoints} is null.
|
||||||
*/
|
*/
|
||||||
public PointToPointIntent(ApplicationId appId, TrafficSelector selector,
|
public PointToPointIntent(ApplicationId appId, TrafficSelector selector,
|
||||||
TrafficTreatment treatment,
|
TrafficTreatment treatment,
|
||||||
ConnectPoint ingressPoint,
|
ConnectPoint ingressPoint,
|
||||||
ConnectPoint egressPoint,
|
ConnectPoint egressPoint,
|
||||||
List<Constraint> constraints) {
|
List<Constraint> constraints,
|
||||||
super(appId, null, Collections.emptyList(), selector, treatment, constraints);
|
int priority) {
|
||||||
|
super(appId, null, Collections.emptyList(), selector, treatment,
|
||||||
|
constraints, priority);
|
||||||
|
|
||||||
checkNotNull(ingressPoint);
|
checkNotNull(ingressPoint);
|
||||||
checkNotNull(egressPoint);
|
checkNotNull(egressPoint);
|
||||||
@ -150,6 +157,7 @@ public final class PointToPointIntent extends ConnectivityIntent {
|
|||||||
.add("id", id())
|
.add("id", id())
|
||||||
.add("key", key())
|
.add("key", key())
|
||||||
.add("appId", appId())
|
.add("appId", appId())
|
||||||
|
.add("priority", priority())
|
||||||
.add("resources", resources())
|
.add("resources", resources())
|
||||||
.add("selector", selector())
|
.add("selector", selector())
|
||||||
.add("treatment", treatment())
|
.add("treatment", treatment())
|
||||||
|
@ -54,7 +54,9 @@ public final class SinglePointToMultiPointIntent extends ConnectivityIntent {
|
|||||||
public SinglePointToMultiPointIntent(ApplicationId appId,
|
public SinglePointToMultiPointIntent(ApplicationId appId,
|
||||||
TrafficSelector selector, TrafficTreatment treatment,
|
TrafficSelector selector, TrafficTreatment treatment,
|
||||||
ConnectPoint ingressPoint, Set<ConnectPoint> egressPoints) {
|
ConnectPoint ingressPoint, Set<ConnectPoint> egressPoints) {
|
||||||
this(appId, null, selector, treatment, ingressPoint, egressPoints, Collections.emptyList());
|
this(appId, null, selector, treatment, ingressPoint, egressPoints,
|
||||||
|
Collections.emptyList(),
|
||||||
|
DEFAULT_INTENT_PRIORITY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -67,6 +69,7 @@ public final class SinglePointToMultiPointIntent extends ConnectivityIntent {
|
|||||||
* @param ingressPoint port on which traffic will ingress
|
* @param ingressPoint port on which traffic will ingress
|
||||||
* @param egressPoints set of ports on which traffic will egress
|
* @param egressPoints set of ports on which traffic will egress
|
||||||
* @param constraints constraints to apply to the intent
|
* @param constraints constraints to apply to the intent
|
||||||
|
* @param priority priority to use for flows generated by this intent
|
||||||
* @throws NullPointerException if {@code ingressPoint} or
|
* @throws NullPointerException if {@code ingressPoint} or
|
||||||
* {@code egressPoints} is null
|
* {@code egressPoints} is null
|
||||||
* @throws IllegalArgumentException if the size of {@code egressPoints} is
|
* @throws IllegalArgumentException if the size of {@code egressPoints} is
|
||||||
@ -76,8 +79,10 @@ public final class SinglePointToMultiPointIntent extends ConnectivityIntent {
|
|||||||
Key key,
|
Key key,
|
||||||
TrafficSelector selector, TrafficTreatment treatment,
|
TrafficSelector selector, TrafficTreatment treatment,
|
||||||
ConnectPoint ingressPoint, Set<ConnectPoint> egressPoints,
|
ConnectPoint ingressPoint, Set<ConnectPoint> egressPoints,
|
||||||
List<Constraint> constraints) {
|
List<Constraint> constraints,
|
||||||
super(appId, key, Collections.emptyList(), selector, treatment, constraints);
|
int priority) {
|
||||||
|
super(appId, key, Collections.emptyList(), selector, treatment, constraints,
|
||||||
|
priority);
|
||||||
checkNotNull(egressPoints);
|
checkNotNull(egressPoints);
|
||||||
checkNotNull(ingressPoint);
|
checkNotNull(ingressPoint);
|
||||||
checkArgument(!egressPoints.isEmpty(), "Egress point set cannot be empty");
|
checkArgument(!egressPoints.isEmpty(), "Egress point set cannot be empty");
|
||||||
@ -122,6 +127,7 @@ public final class SinglePointToMultiPointIntent extends ConnectivityIntent {
|
|||||||
.add("id", id())
|
.add("id", id())
|
||||||
.add("key", key())
|
.add("key", key())
|
||||||
.add("appId", appId())
|
.add("appId", appId())
|
||||||
|
.add("priority", priority())
|
||||||
.add("resources", resources())
|
.add("resources", resources())
|
||||||
.add("selector", selector())
|
.add("selector", selector())
|
||||||
.add("treatment", treatment())
|
.add("treatment", treatment())
|
||||||
|
@ -107,7 +107,8 @@ public final class TwoWayP2PIntent extends ConnectivityIntent {
|
|||||||
TrafficSelector selector,
|
TrafficSelector selector,
|
||||||
TrafficTreatment treatment,
|
TrafficTreatment treatment,
|
||||||
List<Constraint> constraints) {
|
List<Constraint> constraints) {
|
||||||
super(appId, key, Collections.emptyList(), selector, treatment, constraints);
|
super(appId, key, Collections.emptyList(), selector, treatment, constraints,
|
||||||
|
DEFAULT_INTENT_PRIORITY);
|
||||||
|
|
||||||
// TODO: consider whether the case one and two are same is allowed
|
// TODO: consider whether the case one and two are same is allowed
|
||||||
this.one = checkNotNull(one);
|
this.one = checkNotNull(one);
|
||||||
@ -147,6 +148,7 @@ public final class TwoWayP2PIntent extends ConnectivityIntent {
|
|||||||
.add("id", id())
|
.add("id", id())
|
||||||
.add("key", key())
|
.add("key", key())
|
||||||
.add("appId", appId())
|
.add("appId", appId())
|
||||||
|
.add("priority", priority())
|
||||||
.add("resources", resources())
|
.add("resources", resources())
|
||||||
.add("selector", selector())
|
.add("selector", selector())
|
||||||
.add("treatment", treatment())
|
.add("treatment", treatment())
|
||||||
|
@ -134,7 +134,8 @@ public class LinkCollectionIntentTest extends IntentTest {
|
|||||||
links1,
|
links1,
|
||||||
ingress,
|
ingress,
|
||||||
egress,
|
egress,
|
||||||
constraints);
|
constraints,
|
||||||
|
8888);
|
||||||
|
|
||||||
final Set<Link> createdLinks = collectionIntent.links();
|
final Set<Link> createdLinks = collectionIntent.links();
|
||||||
assertThat(createdLinks, hasSize(1));
|
assertThat(createdLinks, hasSize(1));
|
||||||
|
@ -98,7 +98,8 @@ public class HostToHostIntentCompiler
|
|||||||
TrafficSelector selector = builder(intent.selector())
|
TrafficSelector selector = builder(intent.selector())
|
||||||
.matchEthSrc(src.mac()).matchEthDst(dst.mac()).build();
|
.matchEthSrc(src.mac()).matchEthDst(dst.mac()).build();
|
||||||
return new PathIntent(intent.appId(), selector, intent.treatment(),
|
return new PathIntent(intent.appId(), selector, intent.treatment(),
|
||||||
path, intent.constraints());
|
path, intent.constraints(),
|
||||||
|
intent.priority());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -89,12 +89,14 @@ public class MultiPointToSinglePointIntentCompiler
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Set<ConnectPoint> egress = ImmutableSet.of(intent.egressPoint());
|
||||||
Intent result = new LinkCollectionIntent(intent.appId(),
|
Intent result = new LinkCollectionIntent(intent.appId(),
|
||||||
intent.selector(), intent.treatment(),
|
intent.selector(), intent.treatment(),
|
||||||
Sets.newHashSet(links.values()),
|
Sets.newHashSet(links.values()),
|
||||||
intent.ingressPoints(),
|
intent.ingressPoints(),
|
||||||
ImmutableSet.of(intent.egressPoint()),
|
ImmutableSet.of(intent.egressPoint()),
|
||||||
Collections.emptyList());
|
Collections.emptyList(),
|
||||||
|
intent.priority());
|
||||||
return Arrays.asList(result);
|
return Arrays.asList(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,7 +93,8 @@ public class PointToPointIntentCompiler
|
|||||||
PointToPointIntent intent) {
|
PointToPointIntent intent) {
|
||||||
return new PathIntent(intent.appId(),
|
return new PathIntent(intent.appId(),
|
||||||
intent.selector(), intent.treatment(), path,
|
intent.selector(), intent.treatment(), path,
|
||||||
intent.constraints());
|
intent.constraints(),
|
||||||
|
intent.priority());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,9 @@ public class SinglePointToMultiPointIntentCompiler
|
|||||||
intent.selector(),
|
intent.selector(),
|
||||||
intent.treatment(), links,
|
intent.treatment(), links,
|
||||||
ImmutableSet.of(intent.ingressPoint()),
|
ImmutableSet.of(intent.ingressPoint()),
|
||||||
intent.egressPoints(), Collections.emptyList());
|
intent.egressPoints(),
|
||||||
|
Collections.emptyList(),
|
||||||
|
intent.priority());
|
||||||
|
|
||||||
return Arrays.asList(result);
|
return Arrays.asList(result);
|
||||||
}
|
}
|
||||||
|
@ -51,11 +51,11 @@ public class TwoWayP2PIntentCompiler
|
|||||||
new PointToPointIntent(intent.appId(), intent.key(),
|
new PointToPointIntent(intent.appId(), intent.key(),
|
||||||
intent.selector(), intent.treatment(),
|
intent.selector(), intent.treatment(),
|
||||||
intent.one(), intent.two(),
|
intent.one(), intent.two(),
|
||||||
intent.constraints()),
|
intent.constraints(), Intent.DEFAULT_INTENT_PRIORITY),
|
||||||
new PointToPointIntent(intent.appId(), intent.key(),
|
new PointToPointIntent(intent.appId(), intent.key(),
|
||||||
intent.selector(), intent.treatment(),
|
intent.selector(), intent.treatment(),
|
||||||
intent.two(), intent.one(),
|
intent.two(), intent.one(),
|
||||||
intent.constraints()));
|
intent.constraints(), Intent.DEFAULT_INTENT_PRIORITY));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -186,7 +186,7 @@ public class LinkCollectionIntentInstaller
|
|||||||
treatment = intentTreatment;
|
treatment = intentTreatment;
|
||||||
}
|
}
|
||||||
FlowRule rule = new DefaultFlowRule(deviceId,
|
FlowRule rule = new DefaultFlowRule(deviceId,
|
||||||
selector, treatment, 123, appId,
|
selector, treatment, intent.priority(), appId,
|
||||||
new DefaultGroupId((short) (intent.id().fingerprint() & 0xffff)),
|
new DefaultGroupId((short) (intent.id().fingerprint() & 0xffff)),
|
||||||
0, true);
|
0, true);
|
||||||
result.add(new FlowRuleOperation(rule, operation));
|
result.add(new FlowRuleOperation(rule, operation));
|
||||||
|
@ -280,7 +280,7 @@ public class MplsPathIntentInstaller implements IntentInstaller<MplsPathIntent>
|
|||||||
deviceId,
|
deviceId,
|
||||||
selector,
|
selector,
|
||||||
treat,
|
treat,
|
||||||
123, // FIXME 123
|
intent.priority(),
|
||||||
appId,
|
appId,
|
||||||
0,
|
0,
|
||||||
true);
|
true);
|
||||||
|
@ -99,7 +99,7 @@ public class PathIntentInstaller implements IntentInstaller<PathIntent> {
|
|||||||
.setOutput(link.src().port()).build();
|
.setOutput(link.src().port()).build();
|
||||||
|
|
||||||
FlowRule rule = new DefaultFlowRule(link.src().deviceId(),
|
FlowRule rule = new DefaultFlowRule(link.src().deviceId(),
|
||||||
builder.build(), treatment, 123, //FIXME 123
|
builder.build(), treatment, intent.priority(),
|
||||||
appId,
|
appId,
|
||||||
new DefaultGroupId((short) (intent.id().fingerprint() & 0xffff)),
|
new DefaultGroupId((short) (intent.id().fingerprint() & 0xffff)),
|
||||||
0, true);
|
0, true);
|
||||||
@ -127,7 +127,7 @@ public class PathIntentInstaller implements IntentInstaller<PathIntent> {
|
|||||||
(links.hasNext() ? builder() : builder(intent.treatment()))
|
(links.hasNext() ? builder() : builder(intent.treatment()))
|
||||||
.setOutput(link.src().port()).build();
|
.setOutput(link.src().port()).build();
|
||||||
FlowRule rule = new DefaultFlowRule(link.src().deviceId(),
|
FlowRule rule = new DefaultFlowRule(link.src().deviceId(),
|
||||||
builder.build(), treatment, 123, appId,
|
builder.build(), treatment, intent.priority(), appId,
|
||||||
new DefaultGroupId((short) (intent.id().fingerprint() & 0xffff)),
|
new DefaultGroupId((short) (intent.id().fingerprint() & 0xffff)),
|
||||||
0, true);
|
0, true);
|
||||||
rules.add(new FlowRuleOperation(rule, FlowRuleOperation.Type.REMOVE));
|
rules.add(new FlowRuleOperation(rule, FlowRuleOperation.Type.REMOVE));
|
||||||
|
@ -90,7 +90,7 @@ public class PointToPointIntentCompilerTest extends AbstractIntentTest {
|
|||||||
return new PointToPointIntent(APPID, selector, treatment,
|
return new PointToPointIntent(APPID, selector, treatment,
|
||||||
connectPoint(ingressIdString, 1),
|
connectPoint(ingressIdString, 1),
|
||||||
connectPoint(egressIdString, 1),
|
connectPoint(egressIdString, 1),
|
||||||
constraints);
|
constraints, Intent.DEFAULT_INTENT_PRIORITY);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -74,7 +74,7 @@ public class PathConstraintCalculationTest extends AbstractIntentTest {
|
|||||||
private PathIntent createPathIntent(List<Link> links, List<Constraint> constraints) {
|
private PathIntent createPathIntent(List<Link> links, List<Constraint> constraints) {
|
||||||
int hops = links.size() - 1;
|
int hops = links.size() - 1;
|
||||||
return new PathIntent(APP_ID, selector, treatment,
|
return new PathIntent(APP_ID, selector, treatment,
|
||||||
new DefaultPath(PID, links, hops), constraints);
|
new DefaultPath(PID, links, hops), constraints, 333);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -62,7 +62,8 @@ public class PathIntentInstallerTest extends IntentInstallerTest {
|
|||||||
installer.coreService = testCoreService;
|
installer.coreService = testCoreService;
|
||||||
installer.intentManager = new MockIntentManager(PathIntent.class);
|
installer.intentManager = new MockIntentManager(PathIntent.class);
|
||||||
intent = new PathIntent(APP_ID, selector, treatment,
|
intent = new PathIntent(APP_ID, selector, treatment,
|
||||||
new DefaultPath(PID, links, hops), ImmutableList.of());
|
new DefaultPath(PID, links, hops), ImmutableList.of(),
|
||||||
|
77);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -52,6 +52,8 @@ public final class ConnectivityIntentCodec extends JsonCodec<ConnectivityIntent>
|
|||||||
result.set("treatment", treatmentCodec.encode(intent.treatment(), context));
|
result.set("treatment", treatmentCodec.encode(intent.treatment(), context));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
result.put("priority", intent.priority());
|
||||||
|
|
||||||
if (intent.constraints() != null) {
|
if (intent.constraints() != null) {
|
||||||
final ArrayNode jsonConstraints = result.putArray("constraints");
|
final ArrayNode jsonConstraints = result.putArray("constraints");
|
||||||
|
|
||||||
|
@ -38,6 +38,7 @@ import org.onosproject.net.flow.TrafficTreatment;
|
|||||||
import org.onosproject.net.intent.Constraint;
|
import org.onosproject.net.intent.Constraint;
|
||||||
import org.onosproject.net.intent.HostToHostIntent;
|
import org.onosproject.net.intent.HostToHostIntent;
|
||||||
import org.onosproject.net.intent.AbstractIntentTest;
|
import org.onosproject.net.intent.AbstractIntentTest;
|
||||||
|
import org.onosproject.net.intent.Intent;
|
||||||
import org.onosproject.net.intent.PointToPointIntent;
|
import org.onosproject.net.intent.PointToPointIntent;
|
||||||
import org.onosproject.net.intent.constraint.AnnotationConstraint;
|
import org.onosproject.net.intent.constraint.AnnotationConstraint;
|
||||||
import org.onosproject.net.intent.constraint.AsymmetricPathConstraint;
|
import org.onosproject.net.intent.constraint.AsymmetricPathConstraint;
|
||||||
@ -147,7 +148,8 @@ public class IntentCodecTest extends AbstractIntentTest {
|
|||||||
|
|
||||||
final PointToPointIntent intent =
|
final PointToPointIntent intent =
|
||||||
new PointToPointIntent(appId, selector, treatment,
|
new PointToPointIntent(appId, selector, treatment,
|
||||||
ingress, egress, constraints);
|
ingress, egress, constraints,
|
||||||
|
Intent.DEFAULT_INTENT_PRIORITY);
|
||||||
|
|
||||||
final CodecContext context = new MockCodecContext();
|
final CodecContext context = new MockCodecContext();
|
||||||
final JsonCodec<PointToPointIntent> intentCodec =
|
final JsonCodec<PointToPointIntent> intentCodec =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user