summaryrefslogtreecommitdiffstats
path: root/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent
diff options
context:
space:
mode:
Diffstat (limited to 'framework/src/onos/core/api/src/main/java/org/onosproject/net/intent')
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/ConnectivityIntent.java187
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/Constraint.java53
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/FlowRuleIntent.java97
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/HostToHostIntent.java211
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/Intent.java218
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentBatchDelegate.java35
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentClockService.java34
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentCompiler.java44
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentData.java327
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentEvent.java146
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentException.java53
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentExtensionService.java51
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentId.java87
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentListener.java26
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentOperation.java124
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentService.java123
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentState.java117
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentStore.java143
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentStoreDelegate.java42
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentUtils.java84
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/Key.java176
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/LinkCollectionIntent.java241
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/MplsIntent.java276
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/MplsPathIntent.java184
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/MultiPointToSinglePointIntent.java223
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/OpticalCircuitIntent.java219
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/OpticalConnectivityIntent.java223
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/OpticalPathIntent.java234
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/PartitionEvent.java35
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/PartitionEventListener.java26
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/PartitionService.java48
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/PathIntent.java201
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/PointToPointIntent.java215
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/SinglePointToMultiPointIntent.java219
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/TwoWayP2PIntent.java195
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/constraint/AnnotationConstraint.java113
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/constraint/AsymmetricPathConstraint.java64
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/constraint/BandwidthConstraint.java109
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/constraint/BooleanConstraint.java64
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/constraint/EncapsulationConstraint.java83
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/constraint/LambdaConstraint.java91
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/constraint/LatencyConstraint.java93
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/constraint/LinkTypeConstraint.java108
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/constraint/ObstacleConstraint.java92
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/constraint/PartialFailureConstraint.java49
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/constraint/WaypointConstraint.java117
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/constraint/package-info.java20
-rw-r--r--framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/package-info.java83
48 files changed, 0 insertions, 6003 deletions
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/ConnectivityIntent.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/ConnectivityIntent.java
deleted file mode 100644
index 7caee3e8..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/ConnectivityIntent.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * Copyright 2014-2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.net.intent;
-
-import com.google.common.annotations.Beta;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-import org.onosproject.core.ApplicationId;
-import org.onosproject.net.Link;
-import org.onosproject.net.NetworkResource;
-import org.onosproject.net.flow.DefaultTrafficSelector;
-import org.onosproject.net.flow.DefaultTrafficTreatment;
-import org.onosproject.net.flow.TrafficSelector;
-import org.onosproject.net.flow.TrafficTreatment;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * Abstraction of connectivity intent for traffic matching some criteria.
- */
-@Beta
-public abstract class ConnectivityIntent extends Intent {
-
- // TODO: other forms of intents should be considered for this family:
- // point-to-point with constraints (waypoints/obstacles)
- // multi-to-single point with constraints (waypoints/obstacles)
- // single-to-multi point with constraints (waypoints/obstacles)
- // concrete path (with alternate)
- // ...
-
- private final TrafficSelector selector;
- private final TrafficTreatment treatment;
- private final List<Constraint> constraints;
-
- /**
- * 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
- * @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) {
- super(appId, key, resources, priority);
- this.selector = checkNotNull(selector);
- this.treatment = checkNotNull(treatment);
- this.constraints = checkNotNull(constraints);
- }
-
- /**
- * Constructor for serializer.
- */
- protected ConnectivityIntent() {
- super();
- this.selector = null;
- this.treatment = null;
- this.constraints = Collections.emptyList();
- }
-
- /**
- * Abstract builder for connectivity intents.
- */
- public abstract static class Builder extends Intent.Builder {
- protected TrafficSelector selector = DefaultTrafficSelector.emptySelector();
- protected TrafficTreatment treatment = DefaultTrafficTreatment.emptyTreatment();
- protected List<Constraint> constraints = ImmutableList.of();
-
- @Override
- public Builder appId(ApplicationId appId) {
- return (Builder) super.appId(appId);
- }
-
- @Override
- public Builder key(Key key) {
- return (Builder) super.key(key);
- }
-
- @Override
- public Builder priority(int priority) {
- return (Builder) super.priority(priority);
- }
-
-
- /**
- * Sets the traffic selector for the intent that will be built.
- *
- * @param selector selector to use for built intent
- * @return this builder
- */
- public Builder selector(TrafficSelector selector) {
- this.selector = selector;
- return this;
- }
-
- /**
- * Sets the traffic treatment for the intent that will be built.
- *
- * @param treatment treatment to use for built intent
- * @return this builder
- */
- public Builder treatment(TrafficTreatment treatment) {
- this.treatment = treatment;
- return this;
- }
-
- /**
- * Sets the constraints for the intent that will be built.
- *
- * @param constraints constraints to use for built intent
- * @return this builder
- */
- public Builder constraints(List<Constraint> constraints) {
- this.constraints = ImmutableList.copyOf(constraints);
- return this;
- }
- }
-
-
- /**
- * Returns the match specifying the type of traffic.
- *
- * @return traffic match
- */
- public TrafficSelector selector() {
- return selector;
- }
-
- /**
- * Returns the action applied to the traffic.
- *
- * @return applied action
- */
- public TrafficTreatment treatment() {
- return treatment;
- }
-
- /**
- * Returns the set of connectivity constraints.
- *
- * @return list of intent constraints
- */
- public List<Constraint> constraints() {
- return constraints;
- }
-
- /**
- * Produces a collection of network resources from the given links.
- *
- * @param links collection of links
- * @return collection of link resources
- */
- protected static Collection<NetworkResource> resources(Collection<Link> links) {
- return ImmutableSet.copyOf(links);
- }
-
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/Constraint.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/Constraint.java
deleted file mode 100644
index 03acf17c..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/Constraint.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright 2014 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.net.intent;
-
-import com.google.common.annotations.Beta;
-import org.onosproject.net.Link;
-import org.onosproject.net.Path;
-import org.onosproject.net.resource.link.LinkResourceService;
-
-/**
- * Representation of a connectivity constraint capable of evaluating a link
- * and determining the cost of traversing that link in the context of this
- * constraint.
- */
-@Beta
-public interface Constraint {
-
- // TODO: Consider separating cost vs viability.
-
- /**
- * Evaluates the specified link and provides the cost for its traversal.
- *
- * @param link link to be evaluated
- * @param resourceService resource service for validating availability of
- * link resources
- * @return cost of link traversal
- */
- double cost(Link link, LinkResourceService resourceService);
-
- /**
- * Validates that the specified path satisfies the constraint.
- *
- * @param path path to be validated
- * @param resourceService resource service for validating availability of
- * link resources
- * @return cost of link traversal
- */
- boolean validate(Path path, LinkResourceService resourceService);
-
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/FlowRuleIntent.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/FlowRuleIntent.java
deleted file mode 100644
index 2a2d7c78..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/FlowRuleIntent.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.net.intent;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.MoreObjects;
-import com.google.common.collect.ImmutableList;
-import org.onosproject.core.ApplicationId;
-import org.onosproject.net.NetworkResource;
-import org.onosproject.net.flow.FlowRule;
-
-import java.util.Collection;
-import java.util.List;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * An intent that enables to tell flow level operation.
- * This instance holds a collection of flow rules that may be executed in parallel.
- */
-@Beta
-public class FlowRuleIntent extends Intent {
-
- private final Collection<FlowRule> flowRules;
-
- /**
- * Creates a flow rule intent with the specified flow rules and resources.
- *
- * @param appId application id
- * @param flowRules flow rules to be set
- * @param resources network resource to be set
- */
- public FlowRuleIntent(ApplicationId appId, List<FlowRule> flowRules, Collection<NetworkResource> resources) {
- this(appId, null, flowRules, resources);
- }
-
- /**
- * Creates an 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
- */
- public FlowRuleIntent(ApplicationId appId, Key key, Collection<FlowRule> flowRules,
- Collection<NetworkResource> resources) {
- super(appId, key, resources, DEFAULT_INTENT_PRIORITY);
- this.flowRules = ImmutableList.copyOf(checkNotNull(flowRules));
- }
-
- /**
- * Constructor for serializer.
- */
- protected FlowRuleIntent() {
- super();
- this.flowRules = null;
- }
-
- /**
- * Returns a collection of flow rules to be set.
- *
- * @return a collection of flow rules
- */
- public Collection<FlowRule> flowRules() {
- return flowRules;
- }
-
- @Override
- public boolean isInstallable() {
- return true;
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(this)
- .add("id", id())
- .add("key", key())
- .add("appId", appId())
- .add("resources", resources())
- .add("flowRule", flowRules)
- .toString();
- }
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/HostToHostIntent.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/HostToHostIntent.java
deleted file mode 100644
index 306597b3..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/HostToHostIntent.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * Copyright 2014-2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.net.intent;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.MoreObjects;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-
-import org.onosproject.core.ApplicationId;
-import org.onosproject.net.HostId;
-import org.onosproject.net.Link;
-import org.onosproject.net.flow.TrafficSelector;
-import org.onosproject.net.flow.TrafficTreatment;
-import org.onosproject.net.intent.constraint.LinkTypeConstraint;
-
-import java.util.List;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * Abstraction of end-station to end-station bidirectional connectivity.
- */
-@Beta
-public final class HostToHostIntent extends ConnectivityIntent {
-
- static final LinkTypeConstraint NOT_OPTICAL = new LinkTypeConstraint(false, Link.Type.OPTICAL);
-
- private final HostId one;
- private final HostId two;
-
- /**
- * Returns a new host to host intent builder.
- *
- * @return host to host intent builder
- */
- public static Builder builder() {
- return new Builder();
- }
-
- /**
- * Builder of a host to host intent.
- */
- public static final class Builder extends ConnectivityIntent.Builder {
- HostId one;
- HostId two;
-
- private Builder() {
- // Hide constructor
- }
-
- @Override
- public Builder appId(ApplicationId appId) {
- return (Builder) super.appId(appId);
- }
-
- @Override
- public Builder key(Key key) {
- return (Builder) super.key(key);
- }
-
- @Override
- public Builder selector(TrafficSelector selector) {
- return (Builder) super.selector(selector);
- }
-
- @Override
- public Builder treatment(TrafficTreatment treatment) {
- return (Builder) super.treatment(treatment);
- }
-
- @Override
- public Builder constraints(List<Constraint> constraints) {
- return (Builder) super.constraints(constraints);
- }
-
- @Override
- public Builder priority(int priority) {
- return (Builder) super.priority(priority);
- }
-
- /**
- * Sets the first host of the intent that will be built.
- *
- * @param one first host
- * @return this builder
- */
- public Builder one(HostId one) {
- this.one = one;
- return this;
- }
-
- /**
- * Sets the second host of the intent that will be built.
- *
- * @param two second host
- * @return this builder
- */
- public Builder two(HostId two) {
- this.two = two;
- return this;
- }
-
-
-
- /**
- * Builds a host to host intent from the accumulated parameters.
- *
- * @return point to point intent
- */
- public HostToHostIntent build() {
-
- List<Constraint> theConstraints = constraints;
- // If not-OPTICAL constraint hasn't been specified, add them
- if (!constraints.contains(NOT_OPTICAL)) {
- theConstraints = ImmutableList.<Constraint>builder()
- .add(NOT_OPTICAL)
- .addAll(constraints)
- .build();
- }
-
- return new HostToHostIntent(
- appId,
- key,
- one,
- two,
- selector,
- treatment,
- theConstraints,
- priority
- );
- }
- }
-
-
- /**
- * Creates a new host-to-host intent with the supplied host pair.
- *
- * @param appId application identifier
- * @param key intent key
- * @param one first host
- * @param two second host
- * @param selector action
- * @param treatment ingress port
- * @param constraints optional prioritized list of path selection constraints
- * @param priority priority to use for flows generated by 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) {
- super(appId, key, ImmutableSet.of(one, two), selector, treatment,
- constraints, priority);
-
- // TODO: consider whether the case one and two are same is allowed
- this.one = checkNotNull(one);
- this.two = checkNotNull(two);
-
- }
-
- /**
- * Returns identifier of the first host.
- *
- * @return first host identifier
- */
- public HostId one() {
- return one;
- }
-
- /**
- * Returns identifier of the second host.
- *
- * @return second host identifier
- */
- public HostId two() {
- return two;
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(getClass())
- .add("id", id())
- .add("key", key())
- .add("appId", appId())
- .add("priority", priority())
- .add("resources", resources())
- .add("selector", selector())
- .add("treatment", treatment())
- .add("constraints", constraints())
- .add("one", one)
- .add("two", two)
- .toString();
- }
-
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/Intent.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/Intent.java
deleted file mode 100644
index 077fd895..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/Intent.java
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
- * Copyright 2014-2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-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 static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
-
-/**
- * Abstraction of an application level intent.
- * <p>
- * Make sure that an Intent should be immutable when a new type is defined.
- * </p>
- */
-@Beta
-public abstract class Intent {
-
- private final IntentId id;
-
- private final ApplicationId appId;
- 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 static IdGenerator idGenerator;
-
- /**
- * Constructor for serializer.
- */
- protected Intent() {
- this.id = null;
- this.appId = null;
- this.key = null;
- this.resources = null;
- this.priority = DEFAULT_INTENT_PRIORITY;
- }
-
- /**
- * Creates a new intent.
- *
- * @param appId application identifier
- * @param key optional key
- * @param resources required network resources (optional)
- * @param priority flow rule priority
- */
- protected Intent(ApplicationId appId,
- Key key,
- Collection<NetworkResource> resources,
- int priority) {
- 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);
- }
-
- /**
- * Abstract builder for intents.
- */
- public abstract static class Builder {
- protected ApplicationId appId;
- protected Key key;
- protected int priority = Intent.DEFAULT_INTENT_PRIORITY;
-
- /**
- * Sets the application id for the intent that will be built.
- *
- * @param appId application id to use for built intent
- * @return this builder
- */
- public Builder appId(ApplicationId appId) {
- this.appId = appId;
- return this;
- }
-
- /**
- * Sets the key for the intent that will be built.
- *
- * @param key key to use for built intent
- * @return this builder
- */
- public Builder key(Key key) {
- this.key = key;
- return this;
- }
-
- /**
- * Sets the priority for the intent that will be built.
- *
- * @param priority priority to use for built intent
- * @return this builder
- */
- public Builder priority(int priority) {
- this.priority = priority;
- return this;
- }
-
- }
-
- /**
- * Returns the intent identifier.
- *
- * @return intent fingerprint
- */
- public IntentId id() {
- return id;
- }
-
- /**
- * Returns the identifier of the application that requested the intent.
- *
- * @return application identifier
- */
- public ApplicationId 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.
- *
- * @return collection of resources; may be null
- */
- public Collection<NetworkResource> resources() {
- return resources;
- }
-
- /**
- * Indicates whether or not the intent is installable.
- *
- * @return true if installable
- */
- public boolean isInstallable() {
- return false;
- }
-
- @Override
- public final int hashCode() {
- return id.hashCode();
- }
-
- @Override
- public final boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null || getClass() != obj.getClass()) {
- return false;
- }
- final Intent other = (Intent) obj;
- return this.id().equals(other.id());
- }
-
- /**
- * Binds an id generator for unique intent id generation.
- *
- * Note: A generator cannot be bound if there is already a generator bound.
- *
- * @param newIdGenerator id generator
- */
- public static void bindIdGenerator(IdGenerator newIdGenerator) {
- checkState(idGenerator == null, "Id generator is already bound.");
- idGenerator = checkNotNull(newIdGenerator);
- }
-
- /**
- * Unbinds an id generator.
- *
- * Note: The caller must provide the old id generator to succeed.
- *
- * @param oldIdGenerator the current id generator
- */
- public static void unbindIdGenerator(IdGenerator oldIdGenerator) {
- if (Objects.equals(idGenerator, oldIdGenerator)) {
- idGenerator = null;
- }
- }
-
- public Key key() {
- return key;
- }
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentBatchDelegate.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentBatchDelegate.java
deleted file mode 100644
index e4babfb1..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentBatchDelegate.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright 2014-2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.net.intent;
-
-import com.google.common.annotations.Beta;
-
-import java.util.Collection;
-
-/**
- * Facade for receiving notifications from the intent batch service.
- */
-@Beta
-public interface IntentBatchDelegate {
-
- /**
- * Submits the specified batch of intent operations for processing.
- *
- * @param operations batch of operations
- */
- void execute(Collection<IntentData> operations);
-
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentClockService.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentClockService.java
deleted file mode 100644
index d0dbacf8..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentClockService.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.net.intent;
-
-import com.google.common.annotations.Beta;
-import org.onosproject.store.Timestamp;
-
-/**
- * Logical clock service that issues per-intent timestamps.
- */
-@Beta
-public interface IntentClockService {
-
- /**
- * Returns a new timestamp for the specified intent.
- *
- * @param intentId identifier for the intent.
- * @return timestamp
- */
- Timestamp getTimestamp(IntentId intentId);
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentCompiler.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentCompiler.java
deleted file mode 100644
index 9a059be8..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentCompiler.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright 2014 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.net.intent;
-
-import com.google.common.annotations.Beta;
-import org.onosproject.net.resource.link.LinkResourceAllocations;
-
-import java.util.List;
-import java.util.Set;
-
-/**
- * Abstraction of a compiler which is capable of taking an intent
- * and translating it to other, potentially installable, intents.
- *
- * @param <T> the type of intent
- */
-@Beta
-public interface IntentCompiler<T extends Intent> {
- /**
- * Compiles the specified intent into other intents.
- *
- * @param intent intent to be compiled
- * @param installable previously compilation result; optional
- * @param resources previously allocated resources; optional
- * @return list of resulting intents
- * @throws IntentException if issues are encountered while compiling the intent
- */
- List<Intent> compile(T intent, List<Intent> installable,
- Set<LinkResourceAllocations> resources);
-
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentData.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentData.java
deleted file mode 100644
index e24e14e0..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentData.java
+++ /dev/null
@@ -1,327 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.net.intent;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.MoreObjects;
-import com.google.common.collect.ImmutableList;
-import org.onosproject.cluster.NodeId;
-import org.onosproject.store.Timestamp;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Objects;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.onosproject.net.intent.IntentState.*;
-
-/**
- * A wrapper class that contains an intents, its state, and other metadata for
- * internal use.
- */
-@Beta
-public class IntentData { //FIXME need to make this "immutable"
- // manager should be able to mutate a local copy while processing
-
- private static final Logger log = LoggerFactory.getLogger(IntentData.class);
-
- private final Intent intent;
-
- private final IntentState request; //TODO perhaps we want a full fledged object for requests
- private IntentState state;
- private Timestamp version;
- private NodeId origin;
- private int errorCount;
-
- private List<Intent> installables;
-
- /**
- * Creates a new intent data object.
- *
- * @param intent intent this metadata references
- * @param state intent state
- * @param version version of the intent for this key
- */
- public IntentData(Intent intent, IntentState state, Timestamp version) {
- this.intent = intent;
- this.state = state;
- this.request = state;
- this.version = version;
- }
-
- /**
- * Copy constructor.
- *
- * @param intentData intent data to copy
- */
- public IntentData(IntentData intentData) {
- checkNotNull(intentData);
-
- intent = intentData.intent;
- state = intentData.state;
- request = intentData.request;
- version = intentData.version;
- origin = intentData.origin;
- installables = intentData.installables;
- errorCount = intentData.errorCount;
- }
-
- // kryo constructor
- protected IntentData() {
- intent = null;
- request = null;
- }
-
- /**
- * Returns the intent this metadata references.
- *
- * @return intent
- */
- public Intent intent() {
- return intent;
- }
-
- /**
- * Returns the state of the intent.
- *
- * @return intent state
- */
- public IntentState state() {
- return state;
- }
-
- public IntentState request() {
- return request;
- }
-
- /**
- * Returns the intent key.
- *
- * @return intent key
- */
- public Key key() {
- return intent.key();
- }
-
- /**
- * Returns the version of the intent for this key.
- *
- * @return intent version
- */
- public Timestamp version() {
- return version;
- }
-
- /**
- * Sets the origin, which is the node that created the intent.
- *
- * @param origin origin instance
- */
- public void setOrigin(NodeId origin) {
- this.origin = origin;
- }
-
- /**
- * Returns the origin node that created this intent.
- *
- * @return origin node ID
- */
- public NodeId origin() {
- return origin;
- }
-
- /**
- * Updates the state of the intent to the given new state.
- *
- * @param newState new state of the intent
- */
- public void setState(IntentState newState) {
- this.state = newState;
- }
-
- /**
- * Sets the version for this intent data.
- * <p>
- * The store should call this method only once when the IntentData is
- * first passed into the pending map. Ideally, an IntentData is timestamped
- * on the same thread that the called used to submit the intents.
- * </p>
- *
- * @param version the version/timestamp for this intent data
- */
- public void setVersion(Timestamp version) {
- this.version = version;
- }
-
- /**
- * Increments the error count for this intent.
- */
- public void incrementErrorCount() {
- errorCount++;
- }
-
- /**
- * Sets the error count for this intent.
- *
- * @param newCount new count
- */
- public void setErrorCount(int newCount) {
- errorCount = newCount;
- }
-
- /**
- * Returns the number of times that this intent has encountered an error
- * during installation or withdrawal.
- *
- * @return error count
- */
- public int errorCount() {
- return errorCount;
- }
-
- /**
- * Sets the intent installables to the given list of intents.
- *
- * @param installables list of installables for this intent
- */
- public void setInstallables(List<Intent> installables) {
- this.installables = ImmutableList.copyOf(installables);
- }
-
- /**
- * Returns the installables associated with this intent.
- *
- * @return list of installable intents
- */
- public List<Intent> installables() {
- return installables != null ? installables : Collections.emptyList();
- }
-
- /**
- * Determines whether an intent data update is allowed. The update must
- * either have a higher version than the current data, or the state
- * transition between two updates of the same version must be sane.
- *
- * @param currentData existing intent data in the store
- * @param newData new intent data update proposal
- * @return true if we can apply the update, otherwise false
- */
- public static boolean isUpdateAcceptable(IntentData currentData, IntentData newData) {
-
- if (currentData == null) {
- return true;
- } else if (currentData.version().isOlderThan(newData.version())) {
- return true;
- } else if (currentData.version().isNewerThan(newData.version())) {
- return false;
- }
-
- // current and new data versions are the same
- IntentState currentState = currentData.state();
- IntentState newState = newData.state();
-
- switch (newState) {
- case INSTALLING:
- if (currentState == INSTALLING) {
- return false;
- }
- // FALLTHROUGH
- case INSTALLED:
- if (currentState == INSTALLED) {
- return false;
- } else if (currentState == WITHDRAWING || currentState == WITHDRAWN
- || currentState == PURGE_REQ) {
- log.warn("Invalid state transition from {} to {} for intent {}",
- currentState, newState, newData.key());
- return false;
- }
- return true;
-
- case WITHDRAWING:
- if (currentState == WITHDRAWING) {
- return false;
- }
- // FALLTHROUGH
- case WITHDRAWN:
- if (currentState == WITHDRAWN) {
- return false;
- } else if (currentState == INSTALLING || currentState == INSTALLED
- || currentState == PURGE_REQ) {
- log.warn("Invalid state transition from {} to {} for intent {}",
- currentState, newState, newData.key());
- return false;
- }
- return true;
-
- case FAILED:
- if (currentState == FAILED) {
- return false;
- }
- return true;
-
- case CORRUPT:
- if (currentState == CORRUPT) {
- return false;
- }
- return true;
-
- case PURGE_REQ:
- // TODO we should enforce that only WITHDRAWN intents can be purged
- return true;
-
- case COMPILING:
- case RECOMPILING:
- case INSTALL_REQ:
- case WITHDRAW_REQ:
- default:
- log.warn("Invalid state {} for intent {}", newState, newData.key());
- return false;
- }
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(intent, version);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null || getClass() != obj.getClass()) {
- return false;
- }
- final IntentData other = (IntentData) obj;
- return Objects.equals(this.intent, other.intent)
- && Objects.equals(this.version, other.version);
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(getClass())
- .add("key", key())
- .add("state", state())
- .add("version", version())
- .add("intent", intent())
- .add("origin", origin())
- .add("installables", installables())
- .toString();
- }
-
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentEvent.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentEvent.java
deleted file mode 100644
index b27a5074..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentEvent.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Copyright 2014-2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.net.intent;
-
-import com.google.common.annotations.Beta;
-import org.onosproject.event.AbstractEvent;
-
-/**
- * A class to represent an intent related event.
- */
-@Beta
-public class IntentEvent extends AbstractEvent<IntentEvent.Type, Intent> {
-
- public enum Type {
- /**
- * Signifies that an intent is to be installed or reinstalled.
- */
- INSTALL_REQ,
-
- /**
- * Signifies that an intent has been successfully installed.
- */
- INSTALLED,
-
- /**
- * Signifies that an intent has failed compilation and that it cannot
- * be satisfied by the network at this time.
- */
- FAILED,
-
- /**
- * Signifies that an intent will be withdrawn.
- */
- WITHDRAW_REQ,
-
- /**
- * Signifies that an intent has been withdrawn from the system.
- */
- WITHDRAWN,
-
- /**
- * Signifies that an intent has failed installation or withdrawal, but
- * still hold some or all of its resources.
- * (e.g. link reservations, flow rules on the data plane, etc.)
- */
- CORRUPT,
-
- /**
- * Signifies that an intent has been purged from the system.
- */
- PURGED
- }
-
- /**
- * Creates an event of a given type and for the specified intent and the
- * current time.
- *
- * @param type event type
- * @param intent subject intent
- * @param time time the event created in milliseconds since start of epoch
- */
- public IntentEvent(Type type, Intent intent, long time) {
- super(type, intent, time);
- }
-
- /**
- * Creates an event of a given type and for the specified intent and the
- * current time.
- *
- * @param type event type
- * @param intent subject intent
- */
- public IntentEvent(Type type, Intent intent) {
- super(type, intent);
- }
-
- /**
- * Creates an IntentEvent based on the state contained in the given intent
- * data. Some states are not sent as external events, and these states will
- * return null events.
- *
- * @param data the intent data to create an event for
- * @return new intent event if the state is valid, otherwise null.
- */
- public static IntentEvent getEvent(IntentData data) {
- return getEvent(data.state(), data.intent());
- }
-
- /**
- * Creates an IntentEvent based on the given state and intent. Some states
- * are not sent as external events, and these states will return null events.
- *
- * @param state new state of the intent
- * @param intent intent to put in event
- * @return new intent event if the state is valid, otherwise null.
- */
- public static IntentEvent getEvent(IntentState state, Intent intent) {
- Type type;
- switch (state) {
- case INSTALL_REQ:
- type = Type.INSTALL_REQ;
- break;
- case INSTALLED:
- type = Type.INSTALLED;
- break;
- case WITHDRAW_REQ:
- type = Type.WITHDRAW_REQ;
- break;
- case WITHDRAWN:
- type = Type.WITHDRAWN;
- break;
- case FAILED:
- type = Type.FAILED;
- break;
- case CORRUPT:
- type = Type.CORRUPT;
- break;
- case PURGE_REQ:
- type = Type.PURGED;
- break;
-
- // fallthrough to default from here
- case COMPILING:
- case INSTALLING:
- case RECOMPILING:
- case WITHDRAWING:
- default:
- return null;
- }
- return new IntentEvent(type, intent);
- }
-
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentException.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentException.java
deleted file mode 100644
index 3ac1df50..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentException.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright 2014 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.net.intent;
-
-import com.google.common.annotations.Beta;
-
-/**
- * Represents an intent related error.
- */
-@Beta
-public class IntentException extends RuntimeException {
-
- private static final long serialVersionUID = 1907263634145241319L;
-
- /**
- * Constructs an exception with no message and no underlying cause.
- */
- public IntentException() {
- }
-
- /**
- * Constructs an exception with the specified message.
- *
- * @param message the message describing the specific nature of the error
- */
- public IntentException(String message) {
- super(message);
- }
-
- /**
- * Constructs an exception with the specified message and the underlying cause.
- *
- * @param message the message describing the specific nature of the error
- * @param cause the underlying cause of this error
- */
- public IntentException(String message, Throwable cause) {
- super(message, cause);
- }
-
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentExtensionService.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentExtensionService.java
deleted file mode 100644
index d7c7c641..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentExtensionService.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright 2014-2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.net.intent;
-
-import com.google.common.annotations.Beta;
-
-import java.util.Map;
-
-/**
- * Service for extending the capability of intent framework by
- * adding additional compilers or/and installers.
- */
-@Beta
-public interface IntentExtensionService {
- /**
- * Registers the specified compiler for the given intent class.
- *
- * @param cls intent class
- * @param compiler intent compiler
- * @param <T> the type of intent
- */
- <T extends Intent> void registerCompiler(Class<T> cls, IntentCompiler<T> compiler);
-
- /**
- * Unregisters the compiler for the specified intent class.
- *
- * @param cls intent class
- * @param <T> the type of intent
- */
- <T extends Intent> void unregisterCompiler(Class<T> cls);
-
- /**
- * Returns immutable set of bindings of currently registered intent compilers.
- *
- * @return the set of compiler bindings
- */
- Map<Class<? extends Intent>, IntentCompiler<? extends Intent>> getCompilers();
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentId.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentId.java
deleted file mode 100644
index b9a30d2d..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentId.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright 2014-2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.net.intent;
-
-import com.google.common.annotations.Beta;
-import org.onosproject.net.newresource.ResourceConsumer;
-
-/**
- * Intent identifier suitable as an external key.
- * <p>This class is immutable.</p>
- */
-@Beta
-public final class IntentId implements ResourceConsumer {
-
- private final long value;
-
- /**
- * Creates an intent identifier from the specified long representation.
- *
- * @param value long value
- * @return intent identifier
- */
- public static IntentId valueOf(long value) {
- return new IntentId(value);
- }
-
- /**
- * Constructor for serializer.
- */
- IntentId() {
- this.value = 0;
- }
-
- /**
- * Constructs the ID corresponding to a given long value.
- *
- * @param value the underlying value of this ID
- */
- IntentId(long value) {
- this.value = value;
- }
-
- /**
- * Returns the backing value.
- *
- * @return the value
- */
- public long fingerprint() {
- return value;
- }
-
- @Override
- public int hashCode() {
- return Long.hashCode(value);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == this) {
- return true;
- }
- if (!(obj instanceof IntentId)) {
- return false;
- }
- IntentId that = (IntentId) obj;
- return this.value == that.value;
- }
-
- @Override
- public String toString() {
- return "0x" + Long.toHexString(value);
- }
-
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentListener.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentListener.java
deleted file mode 100644
index 4858c7ed..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentListener.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright 2014 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.net.intent;
-
-import com.google.common.annotations.Beta;
-import org.onosproject.event.EventListener;
-
-/**
- * Listener for {@link IntentEvent intent events}.
- */
-@Beta
-public interface IntentListener extends EventListener<IntentEvent> {
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentOperation.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentOperation.java
deleted file mode 100644
index 1b51b4f3..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentOperation.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Copyright 2014-2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.net.intent;
-
-
-import com.google.common.annotations.Beta;
-
-import java.util.Objects;
-
-import static com.google.common.base.MoreObjects.toStringHelper;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * Abstraction of an intent-related operation, e.g. add, remove, replace.
- */
-@Beta
-public final class IntentOperation {
-
- private final Type type;
- private final Intent intent;
-
- /**
- * Operation type.
- */
- public enum Type {
- /**
- * Indicates that an intent should be added.
- */
- SUBMIT,
-
- /**
- * Indicates that an intent should be removed.
- */
- WITHDRAW,
- }
-
- /**
- * Creates an intent operation.
- *
- * @param type operation type
- * @param intent intent subject
- */
- public IntentOperation(Type type, Intent intent) {
- this.type = checkNotNull(type);
- this.intent = intent;
- }
-
- /**
- * Returns the type of the operation.
- *
- * @return operation type
- */
- public Type type() {
- return type;
- }
-
- /**
- * Returns the identifier of the intent to which this operation applies.
- *
- * @return intent identifier
- */
- public IntentId intentId() {
- return intent.id();
- }
-
- /**
- * Returns the key for this intent.
- *
- * @return key value
- */
- public Key key() {
- return intent.key();
- }
-
- /**
- * Returns the intent to which this operation applied. For remove,
- * this can be null.
- *
- * @return intent that is the subject of the operation; null for remove
- */
- public Intent intent() {
- return intent;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(type, intent);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null || getClass() != obj.getClass()) {
- return false;
- }
- final IntentOperation other = (IntentOperation) obj;
- return Objects.equals(this.type, other.type) &&
- Objects.equals(this.intent, other.intent);
- }
-
-
- @Override
- public String toString() {
- return toStringHelper(this)
- .add("type", type)
- .add("intent", intent)
- .toString();
- }
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentService.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentService.java
deleted file mode 100644
index 8533cebc..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentService.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright 2014-2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.net.intent;
-
-
-import com.google.common.annotations.Beta;
-import org.onosproject.event.ListenerService;
-
-import java.util.List;
-
-/**
- * Service for application submitting or withdrawing their intents.
- */
-@Beta
-public interface IntentService
- extends ListenerService<IntentEvent, IntentListener> {
-
- /**
- * Submits an intent into the system.
- * <p>
- * This is an asynchronous request meaning that any compiling or
- * installation activities may be done at later time.
- * </p>
- * @param intent intent to be submitted
- */
- void submit(Intent intent);
-
- /**
- * Withdraws an intent from the system.
- * <p>
- * This is an asynchronous request meaning that the environment may be
- * affected at later time.
- * </p>
- * @param intent intent to be withdrawn
- */
- void withdraw(Intent intent);
-
- /**
- * Purges a specific intent from the system if it is <b>FAILED</b> or
- * <b>WITHDRAWN</b>. Otherwise, the intent remains in its current state.
- *
- * @param intent intent to purge
- */
- void purge(Intent intent);
-
- /**
- * Fetches an intent based on its key.
- *
- * @param key key of the intent
- * @return intent object if the key is found, null otherwise
- */
- Intent getIntent(Key key);
-
- /**
- * Returns an iterable of intents currently in the system.
- *
- * @return set of intents
- */
- Iterable<Intent> getIntents();
-
- /**
- * Returns an iterable of intent data objects currently in the system.
- *
- * @return set of intent data objects
- */
- Iterable<IntentData> getIntentData();
-
- /**
- * Returns the number of intents currently in the system.
- *
- * @return number of intents
- */
- long getIntentCount();
-
- /**
- * Retrieves the state of an intent by its identifier.
- *
- * @param intentKey intent identifier
- * @return the intent state or null if one with the given identifier is not
- * found
- */
- IntentState getIntentState(Key intentKey);
-
- /**
- * Returns the list of the installable events associated with the specified
- * top-level intent.
- *
- * @param intentKey top-level intent identifier
- * @return compiled installable intents
- */
- List<Intent> getInstallableIntents(Key intentKey);
-
- /**
- * Signifies whether the local node is responsible for processing the given
- * intent key.
- *
- * @param intentKey intent key to check
- * @return true if the local node is responsible for the intent key,
- * otherwise false
- */
- boolean isLocal(Key intentKey);
-
- /**
- * Returns the list of intent requests pending processing.
- *
- * @return intents pending processing
- */
- Iterable<Intent> getPending();
-
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentState.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentState.java
deleted file mode 100644
index 1e5fd054..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentState.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright 2014-2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.net.intent;
-
-import com.google.common.annotations.Beta;
-
-/**
- * Representation of the phases an intent may attain during its lifecycle.
- */
-@Beta
-public enum IntentState {
-
- /**
- * Signifies that the intent has been submitted and will start compiling
- * shortly. However, this compilation may not necessarily occur on the
- * local controller instance.
- * <p>
- * All intent in the runtime take this state first.
- * </p><p>
- * Intents will also pass through this state when they are updated.
- * </p>
- */
- INSTALL_REQ, // TODO submit_REQ?
-
- /**
- * Signifies that the intent is being compiled into installable intents.
- * This is a transitional state after which the intent will enter either
- * {@link #FAILED} state or {@link #INSTALLING} state.
- */
- COMPILING, //TODO do we really need this?
-
- /**
- * Signifies that the resulting installable intents are being installed
- * into the network environment. This is a transitional state after which
- * the intent will enter either {@link #INSTALLED} state or
- * {@link #RECOMPILING} state.
- */
- INSTALLING,
-
- /**
- * The intent has been successfully installed. This is a state where the
- * intent may remain parked until it is withdrawn by the application or
- * until the network environment changes in some way to make the original
- * set of installable intents untenable.
- */
- INSTALLED,
-
- /**
- * Signifies that the intent is being recompiled into installable intents
- * as an attempt to adapt to an anomaly in the network environment.
- * This is a transitional state after which the intent will enter either
- * {@link #FAILED} state or {@link #INSTALLING} state.
- * <p>
- * Exit to the {@link #FAILED} state may be caused by failure to compile
- * or by compiling into the same set of installable intents which have
- * previously failed to be installed.
- * </p>
- */
- RECOMPILING, // TODO perhaps repurpose as BROKEN.
-
- /**
- * Indicates that an application has requested that an intent be withdrawn.
- * It will start withdrawing shortly, but not necessarily on this instance.
- * Intents can also be parked here if it is impossible to withdraw them.
- */
- WITHDRAW_REQ,
-
- /**
- * Indicates that the intent is being withdrawn. This is a transitional
- * state, triggered by invocation of the
- * {@link IntentService#withdraw(Intent)} but one with only one outcome,
- * which is the the intent being placed in the {@link #WITHDRAWN} state.
- */
- WITHDRAWING,
-
- /**
- * Indicates that the intent has been successfully withdrawn.
- */
- WITHDRAWN,
-
- /**
- * Signifies that the intent has failed to be installed and cannot be
- * satisfied given current network conditions. But, the framework will
- * reattempt to install it when network conditions change until it is
- * withdrawn by an application.
- */
- FAILED, //TODO consider renaming to UNSATISFIABLE
-
- /**
- * Signifies that an intent has failed either installation or withdrawal,
- * and still hold some or all of its resources.
- * (e.g. link reservations, flow rules on the data plane, etc.)
- */
- CORRUPT, //TODO consider renaming to ERROR
-
- /**
- * Indicates that the intent should be purged from the database.
- * <p>
- * Note: This operation will only be performed if the intent is already
- * in WITHDRAWN or FAILED.
- * </p>
- */
- PURGE_REQ
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentStore.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentStore.java
deleted file mode 100644
index 167ba152..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentStore.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Copyright 2014-2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.net.intent;
-
-import com.google.common.annotations.Beta;
-import org.onosproject.store.Store;
-
-import java.util.List;
-
-/**
- * Manages inventory of end-station intents; not intended for direct use.
- */
-@Beta
-public interface IntentStore extends Store<IntentEvent, IntentStoreDelegate> {
-
- /**
- * Returns the number of intents in the store.
- *
- * @return the number of intents in the store
- */
- long getIntentCount();
-
- /**
- * Returns an iterable of all intents in the store.
- *
- * @return iterable of all intents
- */
- Iterable<Intent> getIntents();
-
-
- /**
- * Returns an iterable of all intent data objects in the store.
- *
- * @param localOnly should only intents for which this instance is master
- * be returned
- * @param olderThan specified duration in milliseconds (0 for "now")
- * @return iterable of all intent data objects
- */
- Iterable<IntentData> getIntentData(boolean localOnly, long olderThan);
-
- /**
- * Returns the state of the specified intent.
- *
- * @param intentKey intent identification
- * @return current intent state
- */
- IntentState getIntentState(Key intentKey);
-
- /**
- * Returns the list of the installable events associated with the specified
- * original intent.
- *
- * @param intentKey original intent identifier
- * @return compiled installable intents, or null if no installables exist
- */
- List<Intent> getInstallableIntents(Key intentKey);
-
- /**
- * Writes an IntentData object to the store.
- *
- * @param newData new intent data to write
- */
- void write(IntentData newData);
-
- /**
- * Writes a batch of IntentData objects to the store. A batch has no
- * semantics, this is simply a convenience API.
- *
- * @param updates collection of intent data objects to write
- */
- void batchWrite(Iterable<IntentData> updates);
-
- /**
- * Returns the intent with the specified identifier.
- *
- * @param key key
- * @return intent or null if not found
- */
- Intent getIntent(Key key);
-
- /**
- * Returns the intent data object associated with the specified key.
- *
- * @param key key to look up
- * @return intent data object
- */
- IntentData getIntentData(Key key);
-
- /**
- * Adds a new operation, which should be persisted and delegated.
- *
- * @param intent operation
- */
- void addPending(IntentData intent);
-
- /**
- * Checks to see whether the calling instance is the master for processing
- * this intent, or more specifically, the key contained in this intent.
- *
- * @param intentKey intentKey to check
- * @return true if master; false, otherwise
- */
- //TODO better name
- boolean isMaster(Key intentKey);
-
- /**
- * Returns the intent requests pending processing.
- *
- * @return pending intents
- */
- Iterable<Intent> getPending();
-
- /**
- * Returns the intent data objects that are pending processing.
- *
- * @return pending intent data objects
- */
- Iterable<IntentData> getPendingData();
-
- /**
- * Returns the intent data objects that are pending processing for longer
- * than the specified duration.
- *
- * @param localOnly should only intents for which this instance is master
- * be returned
- * @param olderThan specified duration in milliseconds (0 for "now")
- * @return pending intent data objects
- */
- Iterable<IntentData> getPendingData(boolean localOnly, long olderThan);
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentStoreDelegate.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentStoreDelegate.java
deleted file mode 100644
index fd99881c..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentStoreDelegate.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2014-2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.net.intent;
-
-import com.google.common.annotations.Beta;
-import org.onosproject.store.StoreDelegate;
-
-/**
- * Intent store delegate abstraction.
- */
-@Beta
-public interface IntentStoreDelegate extends StoreDelegate<IntentEvent> {
-
- /**
- * Provides an intent data object that should be processed (compiled and
- * installed) by this manager.
- *
- * @param intentData intent data object
- */
- void process(IntentData intentData);
-
- /**
- * Called when a new intent has been updated for which this node is the master.
- *
- * @param intentData intent data object
- */
- default void onUpdate(IntentData intentData) {
- }
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentUtils.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentUtils.java
deleted file mode 100644
index f6e33b6b..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/IntentUtils.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.net.intent;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.Objects;
-
-/**
- * Utilities for dealing with intents.
- */
-public final class IntentUtils {
-
- private static final Logger log = LoggerFactory.getLogger(IntentUtils.class);
-
- private IntentUtils() {
- }
-
- /**
- * Checks if two intents represent the same value.
- *
- * <p>({@link Intent#equals(Object)} only checks ID equality)</p>
- *
- * <p>Both intents must be of the same type.</p>
- *
- * @param one first intent
- * @param two second intent
- * @return true if the two intents represent the same value, otherwise false
- */
- public static boolean equals(Intent one, Intent two) {
- if (one.getClass() != two.getClass()) {
- return false;
- }
-
- if (!(Objects.equals(one.appId(), two.appId()) &&
- Objects.equals(one.key(), two.key()))) {
- return false;
- }
-
- if (one instanceof SinglePointToMultiPointIntent) {
- SinglePointToMultiPointIntent intent1 = (SinglePointToMultiPointIntent) one;
- SinglePointToMultiPointIntent intent2 = (SinglePointToMultiPointIntent) two;
-
- return Objects.equals(intent1.selector(), intent2.selector()) &&
- Objects.equals(intent1.treatment(), intent2.treatment()) &&
- Objects.equals(intent1.ingressPoint(), intent2.ingressPoint()) &&
- Objects.equals(intent1.egressPoints(), intent2.egressPoints());
- } else if (one instanceof MultiPointToSinglePointIntent) {
- MultiPointToSinglePointIntent intent1 = (MultiPointToSinglePointIntent) one;
- MultiPointToSinglePointIntent intent2 = (MultiPointToSinglePointIntent) two;
-
- return Objects.equals(intent1.selector(), intent2.selector()) &&
- Objects.equals(intent1.treatment(), intent2.treatment()) &&
- Objects.equals(intent1.ingressPoints(), intent2.ingressPoints()) &&
- Objects.equals(intent1.egressPoint(), intent2.egressPoint());
- } else if (one instanceof PointToPointIntent) {
- PointToPointIntent intent1 = (PointToPointIntent) one;
- PointToPointIntent intent2 = (PointToPointIntent) two;
-
- return Objects.equals(intent1.selector(), intent2.selector()) &&
- Objects.equals(intent1.treatment(), intent2.treatment()) &&
- Objects.equals(intent1.ingressPoint(), intent2.ingressPoint()) &&
- Objects.equals(intent1.egressPoint(), intent2.egressPoint());
- } else {
- log.error("Unimplemented intent type");
- return false;
- }
- }
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/Key.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/Key.java
deleted file mode 100644
index 0344acbf..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/Key.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.net.intent;
-
-import com.google.common.annotations.Beta;
-import com.google.common.hash.HashFunction;
-import com.google.common.hash.Hashing;
-import org.onosproject.core.ApplicationId;
-
-import java.nio.charset.StandardCharsets;
-import java.util.Objects;
-
-/**
- * Key class for Intents.
- */
-// TODO maybe pull this up to utils
-@Beta
-public abstract class Key implements Comparable<Key> {
-
- //TODO consider making this a HashCode object (worry about performance)
- private final long hash;
- private static final HashFunction HASH_FN = Hashing.md5();
-
- protected Key(long hash) {
- this.hash = hash;
- }
-
- public long hash() {
- return hash;
- }
-
- @Override
- public int hashCode() {
- return Long.hashCode(hash);
- }
-
- @Override
- public abstract boolean equals(Object obj);
-
- /**
- * Creates a key based on the provided string.
- * <p>
- * Note: Two keys with equal value, but different appId, are not equal.
- * </p>
- *
- * @param key the provided string
- * @param appId application id to associate with this key
- * @return the key for the string
- */
- public static Key of(String key, ApplicationId appId) {
- return new StringKey(key, appId);
- }
-
- /**
- * Creates a key based on the provided long.
- * <p>
- * Note: Two keys with equal value, but different appId, are not equal.
- * Also, "10" and 10L are different.
- * </p>
- *
- * @param key the provided long
- * @param appId application id to associate with this key
- * @return the key for the long
- */
- public static Key of(long key, ApplicationId appId) {
- return new LongKey(key, appId);
- }
-
- private static final class StringKey extends Key {
-
- private final ApplicationId appId;
- private final String key;
-
- private StringKey(String key, ApplicationId appId) {
- super(HASH_FN.newHasher()
- .putShort(appId.id())
- .putString(key, StandardCharsets.UTF_8)
- .hash().asLong());
- this.key = key;
- this.appId = appId;
- }
-
- @Override
- public String toString() {
- return key;
- }
-
- // checkstyle requires this
- @Override
- public int hashCode() {
- return super.hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null || getClass() != obj.getClass()) {
- return false;
- }
- final StringKey other = (StringKey) obj;
- return this.hash() == other.hash() &&
- Objects.equals(this.appId, other.appId) &&
- Objects.equals(this.key, other.key);
- }
-
- @Override
- public int compareTo(Key o) {
- StringKey sk = (StringKey) o;
- return this.key.compareTo(sk.key);
- }
- }
-
- private static final class LongKey extends Key {
-
- private final ApplicationId appId;
- private final long key;
-
- private LongKey(long key, ApplicationId appId) {
- super(HASH_FN.newHasher()
- .putShort(appId.id())
- .putLong(key)
- .hash().asLong());
- this.key = key;
- this.appId = appId;
- }
-
- @Override
- public String toString() {
- return "0x" + Long.toHexString(key);
- }
-
- // checkstyle requires this
- @Override
- public int hashCode() {
- return super.hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null || getClass() != obj.getClass()) {
- return false;
- }
- final LongKey other = (LongKey) obj;
- return this.hash() == other.hash() &&
- this.key == other.key &&
- Objects.equals(this.appId, other.appId);
- }
-
- @Override
- public int compareTo(Key o) {
- Long myKey = key;
- Long otherKey = ((LongKey) o).key;
- return myKey.compareTo(otherKey);
- }
- }
-}
-
-
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/LinkCollectionIntent.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/LinkCollectionIntent.java
deleted file mode 100644
index d7953fd8..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/LinkCollectionIntent.java
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * Copyright 2014-2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.net.intent;
-
-import java.util.List;
-import java.util.Set;
-
-import com.google.common.annotations.Beta;
-import org.onosproject.core.ApplicationId;
-import org.onosproject.net.ConnectPoint;
-import org.onosproject.net.Link;
-import org.onosproject.net.flow.TrafficSelector;
-import org.onosproject.net.flow.TrafficTreatment;
-
-import com.google.common.base.MoreObjects;
-import com.google.common.collect.ImmutableSet;
-
-/**
- * Abstraction of a connectivity intent that is implemented by a set of path
- * segments.
- */
-@Beta
-public final class LinkCollectionIntent extends ConnectivityIntent {
-
- private final Set<Link> links;
-
- private final Set<ConnectPoint> ingressPoints;
- private final Set<ConnectPoint> egressPoints;
-
- /**
- * Creates a new actionable intent capable of funneling the selected
- * traffic along the specified convergent tree and out the given egress
- * point satisfying the specified constraints.
- *
- * @param appId application identifier
- * @param key key to use for the intent
- * @param selector traffic match
- * @param treatment action
- * @param links traversed links
- * @param ingressPoints ingress points
- * @param egressPoints egress points
- * @param constraints optional list of constraints
- * @param priority priority to use for the flows generated by this intent
- * @throws NullPointerException {@code path} is null
- */
- private LinkCollectionIntent(ApplicationId appId,
- Key key,
- TrafficSelector selector,
- TrafficTreatment treatment,
- Set<Link> links,
- Set<ConnectPoint> ingressPoints,
- Set<ConnectPoint> egressPoints,
- List<Constraint> constraints,
- int priority) {
- super(appId, key, resources(links), selector, treatment, constraints, priority);
- this.links = links;
- this.ingressPoints = ingressPoints;
- this.egressPoints = egressPoints;
- }
-
- /**
- * Constructor for serializer.
- */
- protected LinkCollectionIntent() {
- super();
- this.links = null;
- this.ingressPoints = null;
- this.egressPoints = null;
- }
-
- /**
- * Returns a new link collection intent builder. The application id,
- * ingress point and egress points are required fields. If they are
- * not set by calls to the appropriate methods, an exception will
- * be thrown.
- *
- * @return single point to multi point builder
- */
- public static Builder builder() {
- return new Builder();
- }
-
- /**
- * Builder of a single point to multi point intent.
- */
- public static final class Builder extends ConnectivityIntent.Builder {
- Set<Link> links;
- Set<ConnectPoint> ingressPoints;
- Set<ConnectPoint> egressPoints;
-
- private Builder() {
- // Hide constructor
- }
-
- @Override
- public Builder appId(ApplicationId appId) {
- return (Builder) super.appId(appId);
- }
-
- @Override
- public Builder key(Key key) {
- return (Builder) super.key(key);
- }
-
- @Override
- public Builder selector(TrafficSelector selector) {
- return (Builder) super.selector(selector);
- }
-
- @Override
- public Builder treatment(TrafficTreatment treatment) {
- return (Builder) super.treatment(treatment);
- }
-
- @Override
- public Builder constraints(List<Constraint> constraints) {
- return (Builder) super.constraints(constraints);
- }
-
- @Override
- public Builder priority(int priority) {
- return (Builder) super.priority(priority);
- }
-
- /**
- * Sets the ingress point of the single point to multi point intent
- * that will be built.
- *
- * @param ingressPoints ingress connect points
- * @return this builder
- */
- public Builder ingressPoints(Set<ConnectPoint> ingressPoints) {
- this.ingressPoints = ImmutableSet.copyOf(ingressPoints);
- return this;
- }
-
- /**
- * Sets the egress points of the single point to multi point intent
- * that will be built.
- *
- * @param egressPoints egress connect points
- * @return this builder
- */
- public Builder egressPoints(Set<ConnectPoint> egressPoints) {
- this.egressPoints = ImmutableSet.copyOf(egressPoints);
- return this;
- }
-
- /**
- * Sets the links of the link collection intent
- * that will be built.
- *
- * @param links links for the intent
- * @return this builder
- */
- public Builder links(Set<Link> links) {
- this.links = ImmutableSet.copyOf(links);
- return this;
- }
-
-
- /**
- * Builds a single point to multi point intent from the
- * accumulated parameters.
- *
- * @return point to point intent
- */
- public LinkCollectionIntent build() {
-
- return new LinkCollectionIntent(
- appId,
- key,
- selector,
- treatment,
- links,
- ingressPoints,
- egressPoints,
- constraints,
- priority
- );
- }
- }
-
-
- /**
- * Returns the set of links that represent the network connections needed
- * by this intent.
- *
- * @return Set of links for the network hops needed by this intent
- */
- public Set<Link> links() {
- return links;
- }
-
- /**
- * Returns the ingress points of the intent.
- *
- * @return the ingress points
- */
- public Set<ConnectPoint> ingressPoints() {
- return ingressPoints;
- }
-
- /**
- * Returns the egress points of the intent.
- *
- * @return the egress points
- */
- public Set<ConnectPoint> egressPoints() {
- return egressPoints;
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(getClass())
- .add("id", id())
- .add("key", key())
- .add("appId", appId())
- .add("priority", priority())
- .add("resources", resources())
- .add("selector", selector())
- .add("treatment", treatment())
- .add("links", links())
- .add("ingress", ingressPoints())
- .add("egress", egressPoints())
- .toString();
- }
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/MplsIntent.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/MplsIntent.java
deleted file mode 100644
index 7df3c81e..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/MplsIntent.java
+++ /dev/null
@@ -1,276 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.net.intent;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Optional;
-
-import com.google.common.annotations.Beta;
-import org.onlab.packet.MplsLabel;
-import org.onosproject.core.ApplicationId;
-import org.onosproject.net.ConnectPoint;
-import org.onosproject.net.flow.TrafficSelector;
-import org.onosproject.net.flow.TrafficTreatment;
-
-import com.google.common.base.MoreObjects;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-
-/**
- * Abstraction of MPLS label-switched connectivity.
- */
-@Beta
-public final class MplsIntent extends ConnectivityIntent {
-
- private final ConnectPoint ingressPoint;
- private final Optional<MplsLabel> ingressLabel;
- private final ConnectPoint egressPoint;
- private final Optional<MplsLabel> egressLabel;
-
- /**
- * Creates a new point-to-point intent with the supplied ingress/egress
- * ports, labels and constraints.
- *
- * @param appId application identifier
- * @param selector traffic selector
- * @param treatment treatment
- * @param ingressPoint ingress port
- * @param ingressLabel ingress MPLS label
- * @param egressPoint egress port
- * @param egressLabel egress MPLS label
- * @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.
- */
- private MplsIntent(ApplicationId appId,
- Key key,
- TrafficSelector selector,
- TrafficTreatment treatment,
- ConnectPoint ingressPoint,
- Optional<MplsLabel> ingressLabel,
- ConnectPoint egressPoint,
- Optional<MplsLabel> egressLabel,
- List<Constraint> constraints,
- int priority) {
-
- super(appId, key, Collections.emptyList(), selector, treatment, constraints,
- priority);
-
- this.ingressPoint = checkNotNull(ingressPoint);
- this.ingressLabel = checkNotNull(ingressLabel);
- this.egressPoint = checkNotNull(egressPoint);
- this.egressLabel = checkNotNull(egressLabel);
-
- checkArgument(!ingressPoint.equals(egressPoint),
- "ingress and egress should be different (ingress: %s, egress: %s)",
- ingressPoint, egressPoint);
- }
-
- /**
- * Returns a new MPLS intent builder. The application id,
- * ingress point, egress point, ingress label and egress label are
- * required fields. If they are not set by calls to the appropriate
- * methods, an exception will be thrown.
- *
- * @return point to point builder
- */
- public static Builder builder() {
- return new Builder();
- }
-
- /**
- * Builder of an MPLS intent.
- */
- public static final class Builder extends ConnectivityIntent.Builder {
- ConnectPoint ingressPoint;
- ConnectPoint egressPoint;
- Optional<MplsLabel> ingressLabel;
- Optional<MplsLabel> egressLabel;
-
- private Builder() {
- // Hide constructor
- }
-
- @Override
- public Builder appId(ApplicationId appId) {
- return (Builder) super.appId(appId);
- }
-
- @Override
- public Builder key(Key key) {
- return (Builder) super.key(key);
- }
-
- @Override
- public Builder selector(TrafficSelector selector) {
- return (Builder) super.selector(selector);
- }
-
- @Override
- public Builder treatment(TrafficTreatment treatment) {
- return (Builder) super.treatment(treatment);
- }
-
- @Override
- public Builder constraints(List<Constraint> constraints) {
- return (Builder) super.constraints(constraints);
- }
-
- @Override
- public Builder priority(int priority) {
- return (Builder) super.priority(priority);
- }
-
- /**
- * Sets the ingress point of the point to point intent that will be built.
- *
- * @param ingressPoint ingress connect point
- * @return this builder
- */
- public Builder ingressPoint(ConnectPoint ingressPoint) {
- this.ingressPoint = ingressPoint;
- return this;
- }
-
- /**
- * Sets the egress point of the point to point intent that will be built.
- *
- * @param egressPoint egress connect point
- * @return this builder
- */
- public Builder egressPoint(ConnectPoint egressPoint) {
- this.egressPoint = egressPoint;
- return this;
- }
-
- /**
- * Sets the ingress label of the intent that will be built.
- *
- * @param ingressLabel ingress label
- * @return this builder
- */
- public Builder ingressLabel(Optional<MplsLabel> ingressLabel) {
- this.ingressLabel = ingressLabel;
- return this;
- }
-
- /**
- * Sets the ingress label of the intent that will be built.
- *
- * @param egressLabel ingress label
- * @return this builder
- */
- public Builder egressLabel(Optional<MplsLabel> egressLabel) {
- this.egressLabel = egressLabel;
- return this;
- }
-
- /**
- * Builds a point to point intent from the accumulated parameters.
- *
- * @return point to point intent
- */
- public MplsIntent build() {
-
- return new MplsIntent(
- appId,
- key,
- selector,
- treatment,
- ingressPoint,
- ingressLabel,
- egressPoint,
- egressLabel,
- constraints,
- priority
- );
- }
- }
-
-
-
- /**
- * Constructor for serializer.
- */
- protected MplsIntent() {
- super();
- this.ingressPoint = null;
- this.ingressLabel = null;
- this.egressPoint = null;
- this.egressLabel = null;
- }
-
- /**
- * Returns the port on which the ingress traffic should be connected to
- * the egress.
- *
- * @return ingress switch port
- */
- public ConnectPoint ingressPoint() {
- return ingressPoint;
- }
-
- /**
- * Returns the port on which the traffic should egress.
- *
- * @return egress switch port
- */
- public ConnectPoint egressPoint() {
- return egressPoint;
- }
-
-
- /**
- * Returns the MPLS label which the ingress traffic should tagged.
- *
- * @return ingress MPLS label
- */
- public Optional<MplsLabel> ingressLabel() {
- return ingressLabel;
- }
-
- /**
- * Returns the MPLS label which the egress traffic should tagged.
- *
- * @return egress MPLS label
- */
- public Optional<MplsLabel> egressLabel() {
- return egressLabel;
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(getClass())
- .add("id", id())
- .add("appId", appId())
- .add("key", key())
- .add("priority", priority())
- .add("selector", selector())
- .add("treatment", treatment())
- .add("ingressPoint", ingressPoint)
- .add("ingressLabel", ingressLabel)
- .add("egressPoint", egressPoint)
- .add("egressLabel", egressLabel)
- .add("constraints", constraints())
- .toString();
- }
-
-
-
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/MplsPathIntent.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/MplsPathIntent.java
deleted file mode 100644
index 4548c44d..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/MplsPathIntent.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.net.intent;
-
-import java.util.List;
-import java.util.Optional;
-
-import com.google.common.annotations.Beta;
-import org.onlab.packet.MplsLabel;
-import org.onosproject.core.ApplicationId;
-import org.onosproject.net.Path;
-import org.onosproject.net.flow.TrafficSelector;
-import org.onosproject.net.flow.TrafficTreatment;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-
-/**
- * Abstraction of explicit MPLS label-switched path.
- */
-@Beta
-public final class MplsPathIntent extends PathIntent {
-
- private final Optional<MplsLabel> ingressLabel;
- private final Optional<MplsLabel> egressLabel;
-
- /**
- * Creates a new point-to-point intent with the supplied ingress/egress
- * ports and using the specified explicit path.
- *
- * @param appId application identifier
- * @param key intent key
- * @param selector traffic selector
- * @param treatment treatment
- * @param path traversed links
- * @param ingressLabel MPLS egress label
- * @param egressLabel MPLS ingress label
- * @param constraints optional list of constraints
- * @param priority priority to use for flows generated by this intent
- * @throws NullPointerException {@code path} is null
- */
- private MplsPathIntent(ApplicationId appId, Key key, TrafficSelector selector,
- TrafficTreatment treatment, Path path, Optional<MplsLabel> ingressLabel,
- Optional<MplsLabel> egressLabel, List<Constraint> constraints,
- int priority) {
- super(appId, key, selector, treatment, path, constraints,
- priority);
-
- this.ingressLabel = checkNotNull(ingressLabel);
- this.egressLabel = checkNotNull(egressLabel);
- }
-
- /**
- * Returns a new host to host intent builder.
- *
- * @return host to host intent builder
- */
- public static Builder builder() {
- return new Builder();
- }
-
- /**
- * Builder of a host to host intent.
- */
- public static final class Builder extends PathIntent.Builder {
- private Optional<MplsLabel> ingressLabel = Optional.empty();
- private Optional<MplsLabel> egressLabel = Optional.empty();
-
- private Builder() {
- // Hide constructor
- }
-
- @Override
- public Builder appId(ApplicationId appId) {
- return (Builder) super.appId(appId);
- }
-
- @Override
- public Builder key(Key key) {
- return (Builder) super.key(key);
- }
-
- @Override
- public Builder selector(TrafficSelector selector) {
- return (Builder) super.selector(selector);
- }
-
- @Override
- public Builder treatment(TrafficTreatment treatment) {
- return (Builder) super.treatment(treatment);
- }
-
- @Override
- public Builder constraints(List<Constraint> constraints) {
- return (Builder) super.constraints(constraints);
- }
-
- @Override
- public Builder priority(int priority) {
- return (Builder) super.priority(priority);
- }
-
- @Override
- public Builder path(Path path) {
- return (Builder) super.path(path);
- }
-
- /**
- * Sets the ingress label of the intent that will be built.
- *
- * @param ingressLabel ingress label
- * @return this builder
- */
- public Builder ingressLabel(Optional<MplsLabel> ingressLabel) {
- this.ingressLabel = ingressLabel;
- return this;
- }
-
- /**
- * Sets the ingress label of the intent that will be built.
- *
- * @param egressLabel ingress label
- * @return this builder
- */
- public Builder egressLabel(Optional<MplsLabel> egressLabel) {
- this.egressLabel = egressLabel;
- return this;
- }
-
-
- /**
- * Builds a host to host intent from the accumulated parameters.
- *
- * @return point to point intent
- */
- public MplsPathIntent build() {
-
- return new MplsPathIntent(
- appId,
- key,
- selector,
- treatment,
- path,
- ingressLabel,
- egressLabel,
- constraints,
- priority
- );
- }
- }
-
-
- /**
- * Returns the MPLS label which the ingress traffic should tagged.
- *
- * @return ingress MPLS label
- */
- public Optional<MplsLabel> ingressLabel() {
- return ingressLabel;
- }
-
- /**
- * Returns the MPLS label which the egress traffic should tagged.
- *
- * @return egress MPLS label
- */
- public Optional<MplsLabel> egressLabel() {
- return egressLabel;
- }
-
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/MultiPointToSinglePointIntent.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/MultiPointToSinglePointIntent.java
deleted file mode 100644
index ac6061c7..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/MultiPointToSinglePointIntent.java
+++ /dev/null
@@ -1,223 +0,0 @@
-/*
- * Copyright 2014-2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.net.intent;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.MoreObjects;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Sets;
-import org.onosproject.core.ApplicationId;
-import org.onosproject.net.ConnectPoint;
-import org.onosproject.net.flow.TrafficSelector;
-import org.onosproject.net.flow.TrafficTreatment;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * Abstraction of multiple source to single destination connectivity intent.
- */
-@Beta
-public final class MultiPointToSinglePointIntent extends ConnectivityIntent {
-
- private final Set<ConnectPoint> ingressPoints;
- private final ConnectPoint egressPoint;
-
- /**
- * Creates a new multi-to-single point connectivity intent for the specified
- * traffic selector and treatment.
- *
- * @param appId application identifier
- * @param key intent key
- * @param selector traffic selector
- * @param treatment treatment
- * @param ingressPoints set of ports from which ingress traffic originates
- * @param egressPoint port to which traffic will egress
- * @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
- * {@code egressPoint} is null.
- * @throws IllegalArgumentException if the size of {@code ingressPoints} is
- * not more than 1
- */
- private MultiPointToSinglePointIntent(ApplicationId appId,
- Key key,
- TrafficSelector selector,
- TrafficTreatment treatment,
- Set<ConnectPoint> ingressPoints,
- ConnectPoint egressPoint,
- List<Constraint> constraints,
- int priority) {
- super(appId, key, Collections.emptyList(), selector, treatment, constraints,
- priority);
-
- checkNotNull(ingressPoints);
- checkArgument(!ingressPoints.isEmpty(), "Ingress point set cannot be empty");
- checkNotNull(egressPoint);
- checkArgument(!ingressPoints.contains(egressPoint),
- "Set of ingresses should not contain egress (egress: %s)", egressPoint);
-
- this.ingressPoints = Sets.newHashSet(ingressPoints);
- this.egressPoint = egressPoint;
- }
-
- /**
- * Constructor for serializer.
- */
- protected MultiPointToSinglePointIntent() {
- super();
- this.ingressPoints = null;
- this.egressPoint = null;
- }
-
- /**
- * Returns a new multi point to single point intent builder. The application id,
- * ingress points and egress point are required fields. If they are
- * not set by calls to the appropriate methods, an exception will
- * be thrown.
- *
- * @return single point to multi point builder
- */
- public static Builder builder() {
- return new Builder();
- }
-
- /**
- * Builder of a multi point to single point intent.
- */
- public static final class Builder extends ConnectivityIntent.Builder {
- Set<ConnectPoint> ingressPoints;
- ConnectPoint egressPoint;
-
- private Builder() {
- // Hide constructor
- }
-
- @Override
- public Builder appId(ApplicationId appId) {
- return (Builder) super.appId(appId);
- }
-
- @Override
- public Builder key(Key key) {
- return (Builder) super.key(key);
- }
-
- @Override
- public Builder selector(TrafficSelector selector) {
- return (Builder) super.selector(selector);
- }
-
- @Override
- public Builder treatment(TrafficTreatment treatment) {
- return (Builder) super.treatment(treatment);
- }
-
- @Override
- public Builder constraints(List<Constraint> constraints) {
- return (Builder) super.constraints(constraints);
- }
-
- @Override
- public Builder priority(int priority) {
- return (Builder) super.priority(priority);
- }
-
- /**
- * Sets the ingress point of the single point to multi point intent
- * that will be built.
- *
- * @param ingressPoints ingress connect points
- * @return this builder
- */
- public Builder ingressPoints(Set<ConnectPoint> ingressPoints) {
- this.ingressPoints = ImmutableSet.copyOf(ingressPoints);
- return this;
- }
-
- /**
- * Sets the egress point of the multi point to single point intent
- * that will be built.
- *
- * @param egressPoint egress connect point
- * @return this builder
- */
- public Builder egressPoint(ConnectPoint egressPoint) {
- this.egressPoint = egressPoint;
- return this;
- }
-
- /**
- * Builds a multi point to single point intent from the
- * accumulated parameters.
- *
- * @return point to point intent
- */
- public MultiPointToSinglePointIntent build() {
-
- return new MultiPointToSinglePointIntent(
- appId,
- key,
- selector,
- treatment,
- ingressPoints,
- egressPoint,
- constraints,
- priority
- );
- }
- }
-
-
- /**
- * Returns the set of ports on which ingress traffic should be connected to
- * the egress port.
- *
- * @return set of ingress ports
- */
- public Set<ConnectPoint> ingressPoints() {
- return ingressPoints;
- }
-
- /**
- * Returns the port on which the traffic should egress.
- *
- * @return egress port
- */
- public ConnectPoint egressPoint() {
- return egressPoint;
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(getClass())
- .add("id", id())
- .add("key", key())
- .add("appId", appId())
- .add("priority", priority())
- .add("resources", resources())
- .add("selector", selector())
- .add("treatment", treatment())
- .add("ingress", ingressPoints())
- .add("egress", egressPoint())
- .add("constraints", constraints())
- .toString();
- }
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/OpticalCircuitIntent.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/OpticalCircuitIntent.java
deleted file mode 100644
index 1e515c8c..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/OpticalCircuitIntent.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.net.intent;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.MoreObjects;
-import org.onosproject.core.ApplicationId;
-import org.onosproject.net.ConnectPoint;
-import org.onosproject.net.OduCltPort;
-
-import java.util.Collections;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * An optical layer intent for circuits between two OduClt ports.
- * No traffic selector or traffic treatment are needed.
- */
-@Beta
-public class OpticalCircuitIntent extends Intent {
- private final ConnectPoint src;
- private final ConnectPoint dst;
- private final OduCltPort.SignalType signalType;
- private final boolean 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
- */
- protected OpticalCircuitIntent(ApplicationId appId, Key key, ConnectPoint src, ConnectPoint dst,
- OduCltPort.SignalType signalType, boolean isBidirectional, int priority) {
- super(appId, key, Collections.emptyList(), priority);
- this.src = checkNotNull(src);
- this.dst = checkNotNull(dst);
- this.signalType = checkNotNull(signalType);
- this.isBidirectional = isBidirectional;
- }
-
- /**
- * Returns a new optical circuit intent builder.
- *
- * @return host to host intent builder
- */
- public static Builder builder() {
- return new Builder();
- }
-
-
- /**
- * Builder for optical circuit intents.
- */
- public static class Builder extends Intent.Builder {
- private ConnectPoint src;
- private ConnectPoint dst;
- private OduCltPort.SignalType signalType;
- private boolean isBidirectional;
-
- @Override
- public Builder appId(ApplicationId appId) {
- return (Builder) super.appId(appId);
- }
-
- @Override
- public Builder key(Key key) {
- return (Builder) super.key(key);
- }
-
- @Override
- public Builder priority(int priority) {
- return (Builder) super.priority(priority);
- }
-
- /**
- * Sets the source for the intent that will be built.
- *
- * @param src source to use for built intent
- * @return this builder
- */
- public Builder src(ConnectPoint src) {
- this.src = src;
- return this;
- }
-
- /**
- * Sets the destination for the intent that will be built.
- *
- * @param dst dest to use for built intent
- * @return this builder
- */
- public Builder dst(ConnectPoint dst) {
- this.dst = dst;
- return this;
- }
-
- /**
- * Sets the ODU signal type for the intent that will be built.
- *
- * @param signalType signal type to use for built intent
- * @return this builder
- */
- public Builder signalType(OduCltPort.SignalType signalType) {
- this.signalType = signalType;
- return this;
- }
-
- /**
- * Sets the directionality of the intent.
- *
- * @param isBidirectional true if bidirectional, false if unidirectional
- * @return this builder
- */
- public Builder bidirectional(boolean isBidirectional) {
- this.isBidirectional = isBidirectional;
- return this;
- }
-
- /**
- * Builds an optical circuit intent from the accumulated parameters.
- *
- * @return point to point intent
- */
- public OpticalCircuitIntent build() {
-
- return new OpticalCircuitIntent(
- appId,
- key,
- src,
- dst,
- signalType,
- isBidirectional,
- priority
- );
- }
- }
-
- /**
- * Constructor for serializer.
- */
- protected OpticalCircuitIntent() {
- super();
- this.src = null;
- this.dst = null;
- this.signalType = null;
- this.isBidirectional = false;
- }
-
- /**
- * Returns the source transponder port.
- *
- * @return source transponder port
- */
- public ConnectPoint getSrc() {
- return src;
- }
-
- /**
- * Returns the destination transponder port.
- *
- * @return source transponder port
- */
- public ConnectPoint getDst() {
- return dst;
- }
-
- /**
- * Returns the ODU signal type.
- *
- * @return ODU signal type
- */
- public OduCltPort.SignalType getSignalType() {
- return signalType;
- }
-
- /**
- * Returns the directionality of the intent.
- *
- * @return true if bidirectional, false if unidirectional
- */
- public boolean isBidirectional() {
- return isBidirectional;
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(this)
- .add("id", id())
- .add("key", key())
- .add("appId", appId())
- .add("priority", priority())
- .add("resources", resources())
- .add("src", src)
- .add("dst", dst)
- .add("signalType", signalType)
- .add("isBidirectional", isBidirectional)
- .toString();
- }
-
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/OpticalConnectivityIntent.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/OpticalConnectivityIntent.java
deleted file mode 100644
index aeb0255f..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/OpticalConnectivityIntent.java
+++ /dev/null
@@ -1,223 +0,0 @@
-/*
- * Copyright 2014-2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.net.intent;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.MoreObjects;
-import org.onosproject.core.ApplicationId;
-import org.onosproject.net.ConnectPoint;
-import org.onosproject.net.OduSignalType;
-
-import java.util.Collections;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * An optical layer intent for connectivity between two OCh ports.
- * No traffic selector or traffic treatment are needed.
- */
-@Beta
-public final class OpticalConnectivityIntent extends Intent {
- private final ConnectPoint src;
- private final ConnectPoint dst;
- private final OduSignalType signalType;
- private final boolean 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
- */
- protected OpticalConnectivityIntent(ApplicationId appId,
- Key key,
- ConnectPoint src,
- ConnectPoint dst,
- OduSignalType signalType,
- boolean isBidirectional,
- int priority) {
- super(appId, key, Collections.emptyList(), priority);
- this.src = checkNotNull(src);
- this.dst = checkNotNull(dst);
- this.signalType = checkNotNull(signalType);
- this.isBidirectional = isBidirectional;
- }
-
- /**
- * Returns a new optical connectivity intent builder.
- *
- * @return host to host intent builder
- */
- public static Builder builder() {
- return new Builder();
- }
-
-
- /**
- * Builder for optical connectivity intents.
- */
- public static class Builder extends Intent.Builder {
- private ConnectPoint src;
- private ConnectPoint dst;
- private OduSignalType signalType;
- private boolean isBidirectional;
-
- @Override
- public Builder appId(ApplicationId appId) {
- return (Builder) super.appId(appId);
- }
-
- @Override
- public Builder key(Key key) {
- return (Builder) super.key(key);
- }
-
- @Override
- public Builder priority(int priority) {
- return (Builder) super.priority(priority);
- }
-
- /**
- * Sets the source for the intent that will be built.
- *
- * @param src source to use for built intent
- * @return this builder
- */
- public Builder src(ConnectPoint src) {
- this.src = src;
- return this;
- }
-
- /**
- * Sets the destination for the intent that will be built.
- *
- * @param dst dest to use for built intent
- * @return this builder
- */
- public Builder dst(ConnectPoint dst) {
- this.dst = dst;
- return this;
- }
-
- /**
- * Sets the ODU signal type for the intent that will be built.
- *
- * @param signalType ODU signal type
- * @return this builder
- */
- public Builder signalType(OduSignalType signalType) {
- this.signalType = signalType;
- return this;
- }
-
- /**
- * Sets the directionality of the intent.
- *
- * @param isBidirectional true if bidirectional, false if unidirectional
- * @return this builder
- */
- public Builder bidirectional(boolean isBidirectional) {
- this.isBidirectional = isBidirectional;
- return this;
- }
-
- /**
- * Builds an optical connectivity intent from the accumulated parameters.
- *
- * @return point to point intent
- */
- public OpticalConnectivityIntent build() {
-
- return new OpticalConnectivityIntent(
- appId,
- key,
- src,
- dst,
- signalType,
- isBidirectional,
- priority
- );
- }
- }
-
- /**
- * Constructor for serializer.
- */
- protected OpticalConnectivityIntent() {
- super();
- this.src = null;
- this.dst = null;
- this.signalType = null;
- this.isBidirectional = false;
- }
-
- /**
- * Returns the source transponder port.
- *
- * @return source transponder port
- */
- public ConnectPoint getSrc() {
- return src;
- }
-
- /**
- * Returns the destination transponder port.
- *
- * @return source transponder port
- */
- public ConnectPoint getDst() {
- return dst;
- }
-
- /**
- * Returns the ODU signal type.
- *
- * @return ODU signal type
- */
- public OduSignalType getSignalType() {
- return signalType;
- }
-
- /**
- * Returns the directionality of the intent.
- *
- * @return true if bidirectional, false if unidirectional
- */
- public boolean isBidirectional() {
- return isBidirectional;
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(this)
- .add("id", id())
- .add("key", key())
- .add("appId", appId())
- .add("priority", priority())
- .add("resources", resources())
- .add("src", src)
- .add("dst", dst)
- .add("signalType", signalType)
- .add("isBidirectional", isBidirectional)
- .toString();
- }
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/OpticalPathIntent.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/OpticalPathIntent.java
deleted file mode 100644
index 5a5461cb..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/OpticalPathIntent.java
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- * Copyright 2014-2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.net.intent;
-
-import com.google.common.annotations.Beta;
-import org.onosproject.core.ApplicationId;
-import org.onosproject.net.ConnectPoint;
-import org.onosproject.net.OchSignal;
-import org.onosproject.net.OchSignalType;
-import org.onosproject.net.Path;
-
-import com.google.common.base.MoreObjects;
-import com.google.common.collect.ImmutableSet;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * An optical layer intent with explicitly selected path.
- */
-@Beta
-public final class OpticalPathIntent extends Intent {
-
- private final ConnectPoint src;
- private final ConnectPoint dst;
- private final Path path;
- private final OchSignal lambda;
- private final OchSignalType signalType;
- private final boolean isBidirectional;
-
- private OpticalPathIntent(ApplicationId appId,
- Key key,
- ConnectPoint src,
- ConnectPoint dst,
- Path path,
- OchSignal lambda,
- OchSignalType signalType,
- boolean isBidirectional,
- int priority) {
- super(appId, key, ImmutableSet.copyOf(path.links()), priority);
- this.src = checkNotNull(src);
- this.dst = checkNotNull(dst);
- this.path = checkNotNull(path);
- this.lambda = checkNotNull(lambda);
- this.signalType = checkNotNull(signalType);
- this.isBidirectional = isBidirectional;
- }
-
- protected OpticalPathIntent() {
- this.src = null;
- this.dst = null;
- this.path = null;
- this.lambda = null;
- this.signalType = null;
- this.isBidirectional = true;
- }
-
- /**
- * Returns a new optical connectivity intent builder.
- *
- * @return host to host intent builder
- */
- public static Builder builder() {
- return new Builder();
- }
-
-
- /**
- * Builder for optical path intents.
- */
- public static class Builder extends Intent.Builder {
- private ConnectPoint src;
- private ConnectPoint dst;
- private Path path;
- private OchSignal lambda;
- private OchSignalType signalType;
- private boolean isBidirectional;
- Key key;
-
- @Override
- public Builder appId(ApplicationId appId) {
- return (Builder) super.appId(appId);
- }
-
- @Override
- public Builder key(Key key) {
- return (Builder) super.key(key);
- }
-
- @Override
- public Builder priority(int priority) {
- return (Builder) super.priority(priority);
- }
-
- /**
- * Sets the source for the intent that will be built.
- *
- * @param src source to use for built intent
- * @return this builder
- */
- public Builder src(ConnectPoint src) {
- this.src = src;
- return this;
- }
-
- /**
- * Sets the destination for the intent that will be built.
- *
- * @param dst dest to use for built intent
- * @return this builder
- */
- public Builder dst(ConnectPoint dst) {
- this.dst = dst;
- return this;
- }
-
- /**
- * Sets the path for the intent that will be built.
- *
- * @param path path to use for built intent
- * @return this builder
- */
- public Builder path(Path path) {
- this.path = path;
- return this;
- }
-
- /**
- * Sets the optical channel (lambda) for the intent that will be built.
- *
- * @param lambda the optical channel
- * @return this builder
- */
- public Builder lambda(OchSignal lambda) {
- this.lambda = lambda;
- return this;
- }
-
- /**
- * Sets the optical signal type for the intent that will be built.
- *
- * @param signalType the optical signal type
- * @return this builder
- */
- public Builder signalType(OchSignalType signalType) {
- this.signalType = signalType;
- return this;
- }
-
- /**
- * Sets the intent's direction.
- *
- * @param isBidirectional indicates if intent is bidirectional
- * @return this builder
- */
- public Builder bidirectional(boolean isBidirectional) {
- this.isBidirectional = isBidirectional;
- return this;
- }
-
- /**
- * Builds an optical path intent from the accumulated parameters.
- *
- * @return optical path intent
- */
- public OpticalPathIntent build() {
-
- return new OpticalPathIntent(
- appId,
- key,
- src,
- dst,
- path,
- lambda,
- signalType,
- isBidirectional,
- priority
- );
- }
- }
-
-
- public ConnectPoint src() {
- return src;
- }
-
- public ConnectPoint dst() {
- return dst;
- }
-
- public Path path() {
- return path;
- }
-
- public OchSignal lambda() {
- return lambda;
- }
-
- public OchSignalType signalType() {
- return signalType;
- }
-
- public boolean isBidirectional() {
- return isBidirectional;
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(getClass())
- .add("id", id())
- .add("appId", appId())
- .add("key", key())
- .add("resources", resources())
- .add("ingressPort", src)
- .add("egressPort", dst)
- .add("path", path)
- .add("lambda", lambda)
- .add("signalType", signalType)
- .add("isBidirectional", isBidirectional)
- .toString();
- }
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/PartitionEvent.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/PartitionEvent.java
deleted file mode 100644
index c79a3818..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/PartitionEvent.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.net.intent;
-
-import com.google.common.annotations.Beta;
-import org.onosproject.event.AbstractEvent;
-
-/**
- * Partition event.
- */
-//TODO change String into a proper object type
-@Beta
-public class PartitionEvent extends AbstractEvent<PartitionEvent.Type, String> {
-
- public enum Type {
- LEADER_CHANGED
- }
-
- public PartitionEvent(Type type, String partition) {
- super(type, partition);
- }
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/PartitionEventListener.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/PartitionEventListener.java
deleted file mode 100644
index 5f1da334..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/PartitionEventListener.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.net.intent;
-
-import com.google.common.annotations.Beta;
-import org.onosproject.event.EventListener;
-
-/**
- * Entity capable of receiving device partition-related events.
- */
-@Beta
-public interface PartitionEventListener extends EventListener<PartitionEvent> {
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/PartitionService.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/PartitionService.java
deleted file mode 100644
index 02ccccac..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/PartitionService.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.net.intent;
-
-import com.google.common.annotations.Beta;
-import org.onosproject.cluster.NodeId;
-import org.onosproject.event.ListenerService;
-
-/**
- * Service for interacting with the partition-to-instance assignments.
- */
-@Beta
-public interface PartitionService
- extends ListenerService<PartitionEvent, PartitionEventListener> {
-
- /**
- * Returns whether the given intent key is in a partition owned by this
- * instance or not.
- *
- * @param intentKey intent key to query
- * @return true if the key is owned by this instance, otherwise false
- */
- boolean isMine(Key intentKey);
-
- /**
- * Returns the leader for a particular key.
- *
- * @param intentKey intent key to query
- * @return the leader node
- */
- NodeId getLeader(Key intentKey);
-
- // TODO add API for rebalancing partitions
-
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/PathIntent.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/PathIntent.java
deleted file mode 100644
index 9bf137a1..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/PathIntent.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * Copyright 2014-2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.net.intent;
-
-import java.util.List;
-
-import com.google.common.annotations.Beta;
-import org.onosproject.core.ApplicationId;
-import org.onosproject.net.Link;
-import org.onosproject.net.Path;
-import org.onosproject.net.flow.TrafficSelector;
-import org.onosproject.net.flow.TrafficTreatment;
-
-import com.google.common.base.MoreObjects;
-import com.google.common.collect.Iterables;
-
-import static com.google.common.base.Preconditions.checkArgument;
-
-/**
- * Abstraction of explicitly path specified connectivity intent.
- */
-@Beta
-public class PathIntent extends ConnectivityIntent {
-
- private final Path path;
-
- /**
- * Creates a new point-to-point intent with the supplied ingress/egress
- * ports and using the specified explicit path.
- *
- * @param appId application identifier
- * @param key intent key
- * @param selector traffic selector
- * @param treatment treatment
- * @param path traversed links
- * @param constraints optional list of constraints
- * @param priority priority to use for the generated flows
- * @throws NullPointerException {@code path} is null
- */
- protected PathIntent(ApplicationId appId,
- Key key,
- TrafficSelector selector,
- TrafficTreatment treatment,
- Path path,
- List<Constraint> constraints,
- int priority) {
- super(appId, key, resources(path.links()), selector, treatment, constraints,
- priority);
- PathIntent.validate(path.links());
- this.path = path;
- }
-
- /**
- * Constructor for serializer.
- */
- protected PathIntent() {
- super();
- this.path = null;
- }
-
- /**
- * Returns a new host to host intent builder.
- *
- * @return host to host intent builder
- */
- public static Builder builder() {
- return new Builder();
- }
-
- /**
- * Builder of a host to host intent.
- */
- public static class Builder extends ConnectivityIntent.Builder {
- Path path;
-
- protected Builder() {
- // Hide default constructor
- }
-
- @Override
- public Builder appId(ApplicationId appId) {
- return (Builder) super.appId(appId);
- }
-
- @Override
- public Builder key(Key key) {
- return (Builder) super.key(key);
- }
-
- @Override
- public Builder selector(TrafficSelector selector) {
- return (Builder) super.selector(selector);
- }
-
- @Override
- public Builder treatment(TrafficTreatment treatment) {
- return (Builder) super.treatment(treatment);
- }
-
- @Override
- public Builder constraints(List<Constraint> constraints) {
- return (Builder) super.constraints(constraints);
- }
-
- @Override
- public Builder priority(int priority) {
- return (Builder) super.priority(priority);
- }
-
- /**
- * Sets the path of the intent that will be built.
- *
- * @param path path for the intent
- * @return this builder
- */
- public Builder path(Path path) {
- this.path = path;
- return this;
- }
-
- /**
- * Builds a path intent from the accumulated parameters.
- *
- * @return point to point intent
- */
- public PathIntent build() {
-
- return new PathIntent(
- appId,
- key,
- selector,
- treatment,
- path,
- constraints,
- priority
- );
- }
- }
-
-
-
- // NOTE: This methods takes linear time with the number of links.
- /**
- * Validates that source element ID and destination element ID of a link are
- * different for the specified all links and that destination element ID of a link and source
- * element ID of the next adjacent source element ID are same for the specified all links.
- *
- * @param links links to be validated
- */
- public static void validate(List<Link> links) {
- checkArgument(Iterables.all(links, link -> !link.src().elementId().equals(link.dst().elementId())),
- "element of src and dst in a link must be different: {}", links);
-
- boolean adjacentSame = true;
- for (int i = 0; i < links.size() - 1; i++) {
- if (!links.get(i).dst().elementId().equals(links.get(i + 1).src().elementId())) {
- adjacentSame = false;
- break;
- }
- }
- checkArgument(adjacentSame, "adjacent links must share the same element: {}", links);
- }
-
- /**
- * Returns the links which the traffic goes along.
- *
- * @return traversed links
- */
- public Path path() {
- return path;
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(getClass())
- .add("id", id())
- .add("key", key())
- .add("appId", appId())
- .add("priority", priority())
- .add("resources", resources())
- .add("selector", selector())
- .add("treatment", treatment())
- .add("constraints", constraints())
- .add("path", path)
- .toString();
- }
-
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/PointToPointIntent.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/PointToPointIntent.java
deleted file mode 100644
index d3f7529d..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/PointToPointIntent.java
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- * Copyright 2014-2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.net.intent;
-
-import java.util.Collections;
-import java.util.List;
-
-import com.google.common.annotations.Beta;
-import org.onosproject.core.ApplicationId;
-import org.onosproject.net.ConnectPoint;
-import org.onosproject.net.flow.TrafficSelector;
-import org.onosproject.net.flow.TrafficTreatment;
-
-import com.google.common.base.MoreObjects;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * Abstraction of point-to-point connectivity.
- */
-@Beta
-public final class PointToPointIntent extends ConnectivityIntent {
-
- private final ConnectPoint ingressPoint;
- private final ConnectPoint egressPoint;
-
- /**
- * Returns a new point to point intent builder. The application id,
- * ingress point and egress point are required fields. If they are
- * not set by calls to the appropriate methods, an exception will
- * be thrown.
- *
- * @return point to point builder
- */
- public static PointToPointIntent.Builder builder() {
- return new Builder();
- }
-
- /**
- * Builder of a point to point intent.
- */
- public static final class Builder extends ConnectivityIntent.Builder {
- ConnectPoint ingressPoint;
- ConnectPoint egressPoint;
-
- private Builder() {
- // Hide constructor
- }
-
- @Override
- public Builder appId(ApplicationId appId) {
- return (Builder) super.appId(appId);
- }
-
- @Override
- public Builder key(Key key) {
- return (Builder) super.key(key);
- }
-
- @Override
- public Builder selector(TrafficSelector selector) {
- return (Builder) super.selector(selector);
- }
-
- @Override
- public Builder treatment(TrafficTreatment treatment) {
- return (Builder) super.treatment(treatment);
- }
-
- @Override
- public Builder constraints(List<Constraint> constraints) {
- return (Builder) super.constraints(constraints);
- }
-
- @Override
- public Builder priority(int priority) {
- return (Builder) super.priority(priority);
- }
-
- /**
- * Sets the ingress point of the point to point intent that will be built.
- *
- * @param ingressPoint ingress connect point
- * @return this builder
- */
- public Builder ingressPoint(ConnectPoint ingressPoint) {
- this.ingressPoint = ingressPoint;
- return this;
- }
-
- /**
- * Sets the egress point of the point to point intent that will be built.
- *
- * @param egressPoint egress connect point
- * @return this builder
- */
- public Builder egressPoint(ConnectPoint egressPoint) {
- this.egressPoint = egressPoint;
- return this;
- }
-
- /**
- * Builds a point to point intent from the accumulated parameters.
- *
- * @return point to point intent
- */
- public PointToPointIntent build() {
-
- return new PointToPointIntent(
- appId,
- key,
- selector,
- treatment,
- ingressPoint,
- egressPoint,
- constraints,
- priority
- );
- }
- }
-
-
-
- /**
- * Creates a new point-to-point intent with the supplied ingress/egress
- * ports and constraints.
- *
- * @param appId application identifier
- * @param key key of the intent
- * @param selector traffic selector
- * @param treatment treatment
- * @param ingressPoint ingress port
- * @param egressPoint 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
- * {@code egressPoints} or {@code appId} is null.
- */
- private PointToPointIntent(ApplicationId appId,
- Key key,
- TrafficSelector selector,
- TrafficTreatment treatment,
- ConnectPoint ingressPoint,
- ConnectPoint egressPoint,
- List<Constraint> constraints,
- int priority) {
- super(appId, key, Collections.emptyList(), selector, treatment, constraints,
- priority);
-
- checkArgument(!ingressPoint.equals(egressPoint),
- "ingress and egress should be different (ingress: %s, egress: %s)", ingressPoint, egressPoint);
-
- this.ingressPoint = checkNotNull(ingressPoint);
- this.egressPoint = checkNotNull(egressPoint);
- }
-
- /**
- * Constructor for serializer.
- */
- protected PointToPointIntent() {
- super();
- this.ingressPoint = null;
- this.egressPoint = null;
- }
-
- /**
- * Returns the port on which the ingress traffic should be connected to
- * the egress.
- *
- * @return ingress port
- */
- public ConnectPoint ingressPoint() {
- return ingressPoint;
- }
-
- /**
- * Returns the port on which the traffic should egress.
- *
- * @return egress port
- */
- public ConnectPoint egressPoint() {
- return egressPoint;
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(getClass())
- .add("id", id())
- .add("key", key())
- .add("appId", appId())
- .add("priority", priority())
- .add("resources", resources())
- .add("selector", selector())
- .add("treatment", treatment())
- .add("ingress", ingressPoint)
- .add("egress", egressPoint)
- .add("constraints", constraints())
- .toString();
- }
-
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/SinglePointToMultiPointIntent.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/SinglePointToMultiPointIntent.java
deleted file mode 100644
index de555cf0..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/SinglePointToMultiPointIntent.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * Copyright 2014-2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.net.intent;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.MoreObjects;
-import com.google.common.collect.ImmutableSet;
-
-import org.onosproject.core.ApplicationId;
-import org.onosproject.net.ConnectPoint;
-import org.onosproject.net.flow.TrafficSelector;
-import org.onosproject.net.flow.TrafficTreatment;
-
-import java.util.Collections;
-import java.util.Set;
-import java.util.List;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * Abstraction of single source, multiple destination connectivity intent.
- */
-@Beta
-public final class SinglePointToMultiPointIntent extends ConnectivityIntent {
-
- private final ConnectPoint ingressPoint;
- private final Set<ConnectPoint> egressPoints;
-
- /**
- * Creates a new single-to-multi point connectivity intent.
- *
- * @param appId application identifier
- * @param key intent key
- * @param selector traffic selector
- * @param treatment treatment
- * @param ingressPoint port on which traffic will ingress
- * @param egressPoints set of ports on which traffic will egress
- * @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
- * {@code egressPoints} is null
- * @throws IllegalArgumentException if the size of {@code egressPoints} is
- * not more than 1
- */
- private SinglePointToMultiPointIntent(ApplicationId appId,
- Key key,
- TrafficSelector selector, TrafficTreatment treatment,
- ConnectPoint ingressPoint, Set<ConnectPoint> egressPoints,
- List<Constraint> constraints,
- int priority) {
- super(appId, key, Collections.emptyList(), selector, treatment, constraints,
- priority);
- checkNotNull(egressPoints);
- checkNotNull(ingressPoint);
- checkArgument(!egressPoints.isEmpty(), "Egress point set cannot be empty");
- checkArgument(!egressPoints.contains(ingressPoint),
- "Set of egresses should not contain ingress (ingress: %s)", ingressPoint);
-
- this.ingressPoint = checkNotNull(ingressPoint);
- this.egressPoints = egressPoints;
- }
-
- /**
- * Returns a new single point to multi point intent builder. The application id,
- * ingress point and egress points are required fields. If they are
- * not set by calls to the appropriate methods, an exception will
- * be thrown.
- *
- * @return single point to multi point builder
- */
- public static Builder builder() {
- return new Builder();
- }
-
- /**
- * Builder of a single point to multi point intent.
- */
- public static final class Builder extends ConnectivityIntent.Builder {
- ConnectPoint ingressPoint;
- Set<ConnectPoint> egressPoints;
-
- private Builder() {
- // Hide constructor
- }
-
- @Override
- public Builder appId(ApplicationId appId) {
- return (Builder) super.appId(appId);
- }
-
- @Override
- public Builder key(Key key) {
- return (Builder) super.key(key);
- }
-
- @Override
- public Builder selector(TrafficSelector selector) {
- return (Builder) super.selector(selector);
- }
-
- @Override
- public Builder treatment(TrafficTreatment treatment) {
- return (Builder) super.treatment(treatment);
- }
-
- @Override
- public Builder constraints(List<Constraint> constraints) {
- return (Builder) super.constraints(constraints);
- }
-
- @Override
- public Builder priority(int priority) {
- return (Builder) super.priority(priority);
- }
-
- /**
- * Sets the ingress point of the single point to multi point intent
- * that will be built.
- *
- * @param ingressPoint ingress connect point
- * @return this builder
- */
- public Builder ingressPoint(ConnectPoint ingressPoint) {
- this.ingressPoint = ingressPoint;
- return this;
- }
-
- /**
- * Sets the egress points of the single point to multi point intent
- * that will be built.
- *
- * @param egressPoints egress connect points
- * @return this builder
- */
- public Builder egressPoints(Set<ConnectPoint> egressPoints) {
- this.egressPoints = ImmutableSet.copyOf(egressPoints);
- return this;
- }
-
- /**
- * Builds a single point to multi point intent from the
- * accumulated parameters.
- *
- * @return point to point intent
- */
- public SinglePointToMultiPointIntent build() {
-
- return new SinglePointToMultiPointIntent(
- appId,
- key,
- selector,
- treatment,
- ingressPoint,
- egressPoints,
- constraints,
- priority
- );
- }
- }
-
- /**
- * Constructor for serializer.
- */
- protected SinglePointToMultiPointIntent() {
- super();
- this.ingressPoint = null;
- this.egressPoints = null;
- }
-
- /**
- * Returns the port on which the ingress traffic should be connected to the
- * egress.
- *
- * @return ingress port
- */
- public ConnectPoint ingressPoint() {
- return ingressPoint;
- }
-
- /**
- * Returns the set of ports on which the traffic should egress.
- *
- * @return set of egress ports
- */
- public Set<ConnectPoint> egressPoints() {
- return egressPoints;
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(getClass())
- .add("id", id())
- .add("key", key())
- .add("appId", appId())
- .add("priority", priority())
- .add("resources", resources())
- .add("selector", selector())
- .add("treatment", treatment())
- .add("ingress", ingressPoint)
- .add("egress", egressPoints)
- .add("constraints", constraints())
- .toString();
- }
-
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/TwoWayP2PIntent.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/TwoWayP2PIntent.java
deleted file mode 100644
index b9f126f4..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/TwoWayP2PIntent.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.net.intent;
-
-import java.util.Collections;
-import java.util.List;
-
-import com.google.common.annotations.Beta;
-import org.onosproject.core.ApplicationId;
-import org.onosproject.net.ConnectPoint;
-import org.onosproject.net.flow.TrafficSelector;
-import org.onosproject.net.flow.TrafficTreatment;
-
-import com.google.common.base.MoreObjects;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * Abstraction of bidirectional connectivity between two points in the network.
- */
-@Beta
-public final class TwoWayP2PIntent extends ConnectivityIntent {
-
- private final ConnectPoint one;
- private final ConnectPoint two;
-
-
- /**
- * Creates a new host-to-host intent with the supplied host pair.
- *
- * @param appId application identifier
- * @param key intent key
- * @param one first host
- * @param two second host
- * @param selector action
- * @param treatment ingress port
- * @param constraints optional prioritized list of path selection constraints
- * @param priority priority to use for flows generated by 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) {
- super(appId, key, Collections.emptyList(), selector, treatment, constraints,
- priority);
-
- // TODO: consider whether the case one and two are same is allowed
- this.one = checkNotNull(one);
- this.two = checkNotNull(two);
-
- }
-
- /**
- * Returns a new two way intent builder.
- *
- * @return two way intent builder
- */
- public static Builder builder() {
- return new Builder();
- }
-
- /**
- * Builder of a point to point intent.
- */
- public static final class Builder extends ConnectivityIntent.Builder {
- ConnectPoint one;
- ConnectPoint two;
-
- private Builder() {
- // Hide constructor
- }
-
- @Override
- public Builder appId(ApplicationId appId) {
- return (Builder) super.appId(appId);
- }
-
- @Override
- public Builder key(Key key) {
- return (Builder) super.key(key);
- }
-
- @Override
- public Builder selector(TrafficSelector selector) {
- return (Builder) super.selector(selector);
- }
-
- @Override
- public Builder treatment(TrafficTreatment treatment) {
- return (Builder) super.treatment(treatment);
- }
-
- @Override
- public Builder constraints(List<Constraint> constraints) {
- return (Builder) super.constraints(constraints);
- }
-
- @Override
- public Builder priority(int priority) {
- return (Builder) super.priority(priority);
- }
-
- /**
- * Sets the first connection point of the two way intent that will be built.
- *
- * @param one first connect point
- * @return this builder
- */
- public Builder one(ConnectPoint one) {
- this.one = one;
- return this;
- }
-
- /**
- * Sets the second connection point of the two way intent that will be built.
- *
- * @param two second connect point
- * @return this builder
- */
- public Builder two(ConnectPoint two) {
- this.two = two;
- return this;
- }
-
- /**
- * Builds a point to point intent from the accumulated parameters.
- *
- * @return point to point intent
- */
- public TwoWayP2PIntent build() {
-
- return new TwoWayP2PIntent(
- appId,
- key,
- one,
- two,
- selector,
- treatment,
- constraints,
- priority
- );
- }
- }
-
- /**
- * Returns identifier of the first host.
- *
- * @return first host identifier
- */
- public ConnectPoint one() {
- return one;
- }
-
- /**
- * Returns identifier of the second host.
- *
- * @return second host identifier
- */
- public ConnectPoint two() {
- return two;
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(getClass())
- .add("id", id())
- .add("key", key())
- .add("appId", appId())
- .add("priority", priority())
- .add("resources", resources())
- .add("selector", selector())
- .add("treatment", treatment())
- .add("constraints", constraints())
- .add("one", one)
- .add("two", two)
- .toString();
- }
-
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/constraint/AnnotationConstraint.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/constraint/AnnotationConstraint.java
deleted file mode 100644
index f5439efd..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/constraint/AnnotationConstraint.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright 2014 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.net.intent.constraint;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.MoreObjects;
-import org.onosproject.net.Link;
-import org.onosproject.net.resource.link.LinkResourceService;
-
-import java.util.Objects;
-
-import static org.onosproject.net.AnnotationKeys.getAnnotatedValue;
-
-/**
- * Constraint that evaluates an arbitrary link annotated value is under the specified threshold.
- */
-@Beta
-public class AnnotationConstraint extends BooleanConstraint {
-
- private final String key;
- private final double threshold;
-
- /**
- * Creates a new constraint to keep the value for the specified key
- * of link annotation under the threshold.
- *
- * @param key key of link annotation
- * @param threshold threshold value of the specified link annotation
- */
- public AnnotationConstraint(String key, double threshold) {
- this.key = key;
- this.threshold = threshold;
- }
-
- // Constructor for serialization
- private AnnotationConstraint() {
- this.key = "";
- this.threshold = 0;
- }
-
- /**
- * Returns the key of link annotation this constraint designates.
- * @return key of link annotation
- */
- public String key() {
- return key;
- }
-
- /**
- * Returns the threshold this constraint ensures as link annotated value.
- *
- * @return threshold as link annotated value
- */
- public double threshold() {
- return threshold;
- }
-
- @Override
- public boolean isValid(Link link, LinkResourceService resourceService) {
- double value = getAnnotatedValue(link, key);
-
- return value <= threshold;
- }
-
- @Override
- public double cost(Link link, LinkResourceService resourceService) {
- if (isValid(link, resourceService)) {
- return getAnnotatedValue(link, key);
- } else {
- return -1;
- }
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(key, threshold);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
-
- if (!(obj instanceof AnnotationConstraint)) {
- return false;
- }
-
- final AnnotationConstraint other = (AnnotationConstraint) obj;
- return Objects.equals(this.key, other.key) && Objects.equals(this.threshold, other.threshold);
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(this)
- .add("key", key)
- .add("threshold", threshold)
- .toString();
- }
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/constraint/AsymmetricPathConstraint.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/constraint/AsymmetricPathConstraint.java
deleted file mode 100644
index e0f8614c..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/constraint/AsymmetricPathConstraint.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright 2014 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.net.intent.constraint;
-
-import com.google.common.annotations.Beta;
-import org.onosproject.net.Link;
-import org.onosproject.net.Path;
-import org.onosproject.net.intent.Constraint;
-import org.onosproject.net.resource.link.LinkResourceService;
-
-import java.util.Objects;
-
-import static com.google.common.base.MoreObjects.toStringHelper;
-
-/**
- * Constraint that serves as a request for asymmetric bi-directional path.
- */
-@Beta
-public class AsymmetricPathConstraint implements Constraint {
-
- @Override
- public double cost(Link link, LinkResourceService resourceService) {
- return 1;
- }
-
- @Override
- public boolean validate(Path path, LinkResourceService resourceService) {
- return true;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(true);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null || getClass() != obj.getClass()) {
- return false;
- }
- return true;
- }
-
- @Override
- public String toString() {
- return toStringHelper(this).toString();
- }
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/constraint/BandwidthConstraint.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/constraint/BandwidthConstraint.java
deleted file mode 100644
index 1b4a2600..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/constraint/BandwidthConstraint.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright 2014 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.net.intent.constraint;
-
-import com.google.common.annotations.Beta;
-
-import org.onlab.util.Bandwidth;
-import org.onlab.util.DataRateUnit;
-import org.onosproject.net.Link;
-import org.onosproject.net.resource.link.BandwidthResourceRequest;
-import org.onosproject.net.resource.link.LinkResourceService;
-import org.onosproject.net.resource.ResourceRequest;
-import org.onosproject.net.resource.ResourceType;
-
-import java.util.Objects;
-
-import static com.google.common.base.MoreObjects.toStringHelper;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * Constraint that evaluates links based on available bandwidths.
- */
-@Beta
-public final class BandwidthConstraint extends BooleanConstraint {
-
- private final Bandwidth bandwidth;
-
- /**
- * Creates a new bandwidth constraint.
- *
- * @param bandwidth required bandwidth
- */
- public BandwidthConstraint(Bandwidth bandwidth) {
- this.bandwidth = checkNotNull(bandwidth, "Bandwidth cannot be null");
- }
-
- /**
- * Creates a new bandwidth constraint.
- *
- * @param v required amount of bandwidth
- * @param unit {@link DataRateUnit} of {@code v}
- * @return {@link BandwidthConstraint} instance with given bandwidth requirement
- */
- public static BandwidthConstraint of(double v, DataRateUnit unit) {
- return new BandwidthConstraint(Bandwidth.of(v, unit));
- }
-
- // Constructor for serialization
- private BandwidthConstraint() {
- this.bandwidth = null;
- }
-
- @Override
- public boolean isValid(Link link, LinkResourceService resourceService) {
- for (ResourceRequest request : resourceService.getAvailableResources(link)) {
- if (request.type() == ResourceType.BANDWIDTH) {
- BandwidthResourceRequest brr = (BandwidthResourceRequest) request;
- if (brr.bandwidth().toDouble() >= bandwidth.bps()) {
- return true;
- }
- }
- }
- return false;
- }
-
- /**
- * Returns the bandwidth required by this constraint.
- *
- * @return required bandwidth
- */
- public Bandwidth bandwidth() {
- return bandwidth;
- }
-
- @Override
- public int hashCode() {
- return bandwidth.hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null || getClass() != obj.getClass()) {
- return false;
- }
- final BandwidthConstraint other = (BandwidthConstraint) obj;
- return Objects.equals(this.bandwidth, other.bandwidth);
- }
-
- @Override
- public String toString() {
- return toStringHelper(this).add("bandwidth", bandwidth).toString();
- }
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/constraint/BooleanConstraint.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/constraint/BooleanConstraint.java
deleted file mode 100644
index f1d4ad9f..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/constraint/BooleanConstraint.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright 2014 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.net.intent.constraint;
-
-import com.google.common.annotations.Beta;
-import org.onosproject.net.Link;
-import org.onosproject.net.Path;
-import org.onosproject.net.intent.Constraint;
-import org.onosproject.net.resource.link.LinkResourceService;
-
-/**
- * Abstract base class for various constraints that evaluate link viability
- * in a yes/no fashion.
- */
-@Beta
-public abstract class BooleanConstraint implements Constraint {
-
- /**
- * Returns true if the specified link satisfies the constraint.
- *
- * @param link link to be validated
- * @param resourceService resource service for checking available link resources
- * @return true if link is viable
- */
- public abstract boolean isValid(Link link, LinkResourceService resourceService);
-
- /**
- * {@inheritDoc}
- *
- * Negative return value means the specified link does not satisfy this constraint.
- *
- * @param link {@inheritDoc}
- * @param resourceService {@inheritDoc}
- * @return {@inheritDoc}
- */
- @Override
- public double cost(Link link, LinkResourceService resourceService) {
- return isValid(link, resourceService) ? +1 : -1;
- }
-
- @Override
- public boolean validate(Path path, LinkResourceService resourceService) {
- for (Link link : path.links()) {
- if (!isValid(link, resourceService)) {
- return false;
- }
- }
- return true;
- }
-
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/constraint/EncapsulationConstraint.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/constraint/EncapsulationConstraint.java
deleted file mode 100644
index e8539398..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/constraint/EncapsulationConstraint.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright 2014-2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onosproject.net.intent.constraint;
-
-
-import org.onosproject.net.EncapsulationType;
-import org.onosproject.net.Link;
-import org.onosproject.net.resource.link.LinkResourceService;
-
-import static com.google.common.base.MoreObjects.toStringHelper;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * Encapsulation to manage core transportation.
- */
-public class EncapsulationConstraint extends BooleanConstraint {
-
- private EncapsulationType encapType;
-
- /**
- * Creates a new encapsulation constraint.
- *
- * @param encapType the encapsulation type {@link EncapsulationType}
- */
- public EncapsulationConstraint(EncapsulationType encapType) {
- checkNotNull(encapType, "EncapsulationType cannot be null");
- this.encapType = encapType;
- }
-
-
- @Override
- public boolean isValid(Link link, LinkResourceService resourceService) {
- //TODO: validate the availability of the resources for each link in the path.
- //e.g., availability of MPLSlabels, VLANID
-
- return true;
- }
-
- /**
- * Returns the encapsulation type required by this constraint.
- *
- * @return encapType
- */
- public EncapsulationType encapType() {
- return encapType;
- }
-
- @Override
- public int hashCode() {
- return encapType.hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null || getClass() != obj.getClass()) {
- return false;
- }
- final EncapsulationConstraint other = (EncapsulationConstraint) obj;
- return this.encapType() == other.encapType();
- }
-
- @Override
- public String toString() {
- return toStringHelper(this).add("encapType", encapType).toString();
- }
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/constraint/LambdaConstraint.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/constraint/LambdaConstraint.java
deleted file mode 100644
index eba28984..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/constraint/LambdaConstraint.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright 2014 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.net.intent.constraint;
-
-import com.google.common.annotations.Beta;
-import org.onosproject.net.IndexedLambda;
-import org.onosproject.net.Link;
-import org.onosproject.net.resource.link.LinkResourceService;
-import org.onosproject.net.resource.ResourceRequest;
-import org.onosproject.net.resource.ResourceType;
-
-import java.util.Objects;
-
-import static com.google.common.base.MoreObjects.toStringHelper;
-
-/**
- * Constraint that evaluates links based on available lambda.
- */
-@Beta
-public class LambdaConstraint extends BooleanConstraint {
-
- private final IndexedLambda lambda;
-
- /**
- * Creates a new optical lambda constraint.
- *
- * @param lambda optional lambda to indicate a specific lambda
- */
- public LambdaConstraint(IndexedLambda lambda) {
- this.lambda = lambda;
- }
-
- // Constructor for serialization
- private LambdaConstraint() {
- this.lambda = null;
- }
-
- @Override
- public boolean isValid(Link link, LinkResourceService resourceService) {
- for (ResourceRequest request : resourceService.getAvailableResources(link)) {
- if (request.type() == ResourceType.LAMBDA) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Returns the lambda required by this constraint.
- *
- * @return required lambda
- */
- public IndexedLambda lambda() {
- return lambda;
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(lambda);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null || getClass() != obj.getClass()) {
- return false;
- }
- final LambdaConstraint other = (LambdaConstraint) obj;
- return Objects.equals(this.lambda, other.lambda);
- }
-
- @Override
- public String toString() {
- return toStringHelper(this).add("lambda", lambda).toString();
- }
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/constraint/LatencyConstraint.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/constraint/LatencyConstraint.java
deleted file mode 100644
index aecef879..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/constraint/LatencyConstraint.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright 2014 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.net.intent.constraint;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.MoreObjects;
-import org.onosproject.net.Link;
-import org.onosproject.net.Path;
-import org.onosproject.net.intent.Constraint;
-import org.onosproject.net.resource.link.LinkResourceService;
-
-import java.time.Duration;
-import java.time.temporal.ChronoUnit;
-import java.util.Objects;
-
-import static org.onosproject.net.AnnotationKeys.LATENCY;
-import static org.onosproject.net.AnnotationKeys.getAnnotatedValue;
-
-/**
- * Constraint that evaluates the latency through a path.
- */
-@Beta
-public class LatencyConstraint implements Constraint {
-
- private final Duration latency;
-
- /**
- * Creates a new constraint to keep under specified latency through a path.
- * @param latency latency to be kept
- */
- public LatencyConstraint(Duration latency) {
- this.latency = latency;
- }
-
- // Constructor for serialization
- private LatencyConstraint() {
- this.latency = Duration.ZERO;
- }
-
- public Duration latency() {
- return latency;
- }
-
- @Override
- public double cost(Link link, LinkResourceService resourceService) {
- return getAnnotatedValue(link, LATENCY);
- }
-
- @Override
- public boolean validate(Path path, LinkResourceService resourceService) {
- double pathLatency = path.links().stream().mapToDouble(link -> cost(link, resourceService)).sum();
- return Duration.of((long) pathLatency, ChronoUnit.MICROS).compareTo(latency) <= 0;
- }
-
- @Override
- public int hashCode() {
- return latency.hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
-
- if (!(obj instanceof LatencyConstraint)) {
- return false;
- }
-
- final LatencyConstraint that = (LatencyConstraint) obj;
- return Objects.equals(this.latency, that.latency);
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(this)
- .add("latency", latency)
- .toString();
- }
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/constraint/LinkTypeConstraint.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/constraint/LinkTypeConstraint.java
deleted file mode 100644
index ffa4405b..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/constraint/LinkTypeConstraint.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Copyright 2014 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.net.intent.constraint;
-
-import com.google.common.annotations.Beta;
-import com.google.common.collect.ImmutableSet;
-import org.onosproject.net.Link;
-import org.onosproject.net.resource.link.LinkResourceService;
-
-import java.util.Objects;
-import java.util.Set;
-
-import static com.google.common.base.MoreObjects.toStringHelper;
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * Constraint that evaluates links based on their type.
- */
-@Beta
-public class LinkTypeConstraint extends BooleanConstraint {
-
- private final Set<Link.Type> types;
- private final boolean isInclusive;
-
- /**
- * Creates a new constraint for requesting connectivity using or avoiding
- * the specified link types.
- *
- * @param inclusive indicates whether the given link types are to be
- * permitted or avoided
- * @param types link types
- */
- public LinkTypeConstraint(boolean inclusive, Link.Type... types) {
- checkNotNull(types, "Link types cannot be null");
- checkArgument(types.length > 0, "There must be more than one type");
- this.types = ImmutableSet.copyOf(types);
- this.isInclusive = inclusive;
- }
-
- // Constructor for serialization
- private LinkTypeConstraint() {
- this.types = null;
- this.isInclusive = false;
- }
-
- @Override
- public boolean isValid(Link link, LinkResourceService resourceService) {
- boolean contains = types.contains(link.type());
- return isInclusive ? contains : !contains;
- }
-
- /**
- * Returns the set of link types.
- *
- * @return set of link types
- */
- public Set<Link.Type> types() {
- return types;
- }
-
- /**
- * Indicates if the constraint is inclusive or exclusive.
- *
- * @return true if inclusive
- */
- public boolean isInclusive() {
- return isInclusive;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(types, isInclusive);
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null || getClass() != obj.getClass()) {
- return false;
- }
- final LinkTypeConstraint other = (LinkTypeConstraint) obj;
- return Objects.equals(this.types, other.types) && Objects.equals(this.isInclusive, other.isInclusive);
- }
-
- @Override
- public String toString() {
- return toStringHelper(this)
- .add("inclusive", isInclusive)
- .add("types", types)
- .toString();
- }
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/constraint/ObstacleConstraint.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/constraint/ObstacleConstraint.java
deleted file mode 100644
index ca4f3fd3..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/constraint/ObstacleConstraint.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright 2014-2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.net.intent.constraint;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.MoreObjects;
-import com.google.common.collect.ImmutableSet;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.Link;
-import org.onosproject.net.resource.link.LinkResourceService;
-
-import java.util.Collections;
-import java.util.Objects;
-import java.util.Set;
-
-/**
- * Constraint that evaluates elements not passed through.
- */
-@Beta
-public class ObstacleConstraint extends BooleanConstraint {
-
- private final Set<DeviceId> obstacles;
-
- /**
- * Creates a new constraint that the specified device are not passed through.
- * @param obstacles devices not to be passed
- */
- public ObstacleConstraint(DeviceId... obstacles) {
- this.obstacles = ImmutableSet.copyOf(obstacles);
- }
-
- // Constructor for serialization
- private ObstacleConstraint() {
- this.obstacles = Collections.emptySet();
- }
-
- /**
- * Returns the obstacle device ids.
- *
- * @return Set of obstacle device ids
- */
- public Set<DeviceId> obstacles() {
- return obstacles;
- }
-
- @Override
- public boolean isValid(Link link, LinkResourceService resourceService) {
- DeviceId src = link.src().deviceId();
- DeviceId dst = link.dst().deviceId();
-
- return !(obstacles.contains(src) || obstacles.contains(dst));
- }
-
- @Override
- public int hashCode() {
- return obstacles.hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
-
- if (!(obj instanceof ObstacleConstraint)) {
- return false;
- }
-
- final ObstacleConstraint that = (ObstacleConstraint) obj;
- return Objects.equals(this.obstacles, that.obstacles);
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(this)
- .add("obstacles", obstacles)
- .toString();
- }
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/constraint/PartialFailureConstraint.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/constraint/PartialFailureConstraint.java
deleted file mode 100644
index 827859b1..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/constraint/PartialFailureConstraint.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.net.intent.constraint;
-
-import org.onosproject.net.Link;
-import org.onosproject.net.Path;
-import org.onosproject.net.intent.ConnectivityIntent;
-import org.onosproject.net.intent.Constraint;
-import org.onosproject.net.intent.Intent;
-import org.onosproject.net.resource.link.LinkResourceService;
-
-/**
- * A constraint that allows intents that can only be partially compiled
- * (i.e. MultiPointToSinglePointIntent or SinglePointToMultiPointIntent)
- * to be installed when some endpoints or paths are not found.
- */
-public class PartialFailureConstraint implements Constraint {
- @Override
- public double cost(Link link, LinkResourceService resourceService) {
- return 1;
- }
-
- @Override
- public boolean validate(Path path, LinkResourceService resourceService) {
- return true;
- }
-
- public static boolean intentAllowsPartialFailure(Intent intent) {
- if (intent instanceof ConnectivityIntent) {
- ConnectivityIntent connectivityIntent = (ConnectivityIntent) intent;
- return connectivityIntent.constraints().stream()
- .anyMatch(c -> c instanceof PartialFailureConstraint);
- }
- return false;
- }
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/constraint/WaypointConstraint.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/constraint/WaypointConstraint.java
deleted file mode 100644
index 4839feec..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/constraint/WaypointConstraint.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright 2014 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.net.intent.constraint;
-
-import com.google.common.annotations.Beta;
-import com.google.common.base.MoreObjects;
-import com.google.common.collect.ImmutableList;
-import org.onosproject.net.DeviceId;
-import org.onosproject.net.Link;
-import org.onosproject.net.Path;
-import org.onosproject.net.intent.Constraint;
-import org.onosproject.net.resource.link.LinkResourceService;
-
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Objects;
-
-import static com.google.common.base.Preconditions.checkArgument;
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * Constraint that evaluates elements passed through in order.
- */
-@Beta
-public class WaypointConstraint implements Constraint {
-
- private final List<DeviceId> waypoints;
-
- /**
- * Creates a new waypoint constraint.
- *
- * @param waypoints waypoints
- */
- public WaypointConstraint(DeviceId... waypoints) {
- checkNotNull(waypoints, "waypoints cannot be null");
- checkArgument(waypoints.length > 0, "length of waypoints should be more than 0");
- this.waypoints = ImmutableList.copyOf(waypoints);
- }
-
- // Constructor for serialization
- private WaypointConstraint() {
- this.waypoints = Collections.emptyList();
- }
-
- public List<DeviceId> waypoints() {
- return waypoints;
- }
-
- @Override
- public double cost(Link link, LinkResourceService resourceService) {
- // Always consider the number of hops
- return 1;
- }
-
- @Override
- public boolean validate(Path path, LinkResourceService resourceService) {
- LinkedList<DeviceId> waypoints = new LinkedList<>(this.waypoints);
- DeviceId current = waypoints.poll();
- // This is safe because Path class ensures the number of links are more than 0
- Link firstLink = path.links().get(0);
- if (firstLink.src().elementId().equals(current)) {
- current = waypoints.poll();
- }
-
- for (Link link : path.links()) {
- if (link.dst().elementId().equals(current)) {
- current = waypoints.poll();
- // Empty waypoints means passing through all waypoints in the specified order
- if (current == null) {
- return true;
- }
- }
- }
-
- return false;
- }
-
- @Override
- public int hashCode() {
- return waypoints.hashCode();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
-
- if (!(obj instanceof WaypointConstraint)) {
- return false;
- }
-
- final WaypointConstraint that = (WaypointConstraint) obj;
- return Objects.equals(this.waypoints, that.waypoints);
- }
-
- @Override
- public String toString() {
- return MoreObjects.toStringHelper(this)
- .add("waypoints", waypoints)
- .toString();
- }
-}
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/constraint/package-info.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/constraint/package-info.java
deleted file mode 100644
index 60d8df16..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/constraint/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright 2014 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Definitions of constraints used to refine intent specifications.
- */
-package org.onosproject.net.intent.constraint;
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/package-info.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/package-info.java
deleted file mode 100644
index a86b3118..00000000
--- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/intent/package-info.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright 2014-2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Set of abstractions for conveying high-level intents for treatment of
- * selected network traffic by allowing applications to express the
- * <em>what</em> rather than the <em>how</em>. This makes such instructions
- * largely independent of topology and device specifics, thus allowing them to
- * survive topology mutations.
- * <p>
- * The controller core provides a suite of built-in intents and their compilers
- * and installers. However, the intent framework is extensible in that it allows
- * additional intents and their compilers or installers to be added
- * dynamically at run-time. This allows others to enhance the initial arsenal of
- * connectivity and policy-based intents available in base controller software.
- * </p>
- * <p>
- * The following diagram depicts the state transition diagram for each top-level intent:<br>
- * <img src="doc-files/intent-states.png" alt="ONOS intent states">
- * </p>
- * <p>
- * The controller core accepts the intent specifications and translates them, via a
- * process referred to as intent compilation, to installable intents, which are
- * essentially actionable operations on the network environment.
- * These actions are carried out by intent installation process, which results
- * in some changes to the environment, e.g. tunnel links being provisioned,
- * flow rules being installed on the data-plane, optical lambdas being reserved.
- * </p>
- * <p>
- * After an intent is submitted by an application, it will be sent immediately
- * (but asynchronously) into a compiling phase, then to installing phase and if
- * all goes according to plan into installed state. Once an application decides
- * it no longer wishes the intent to hold, it can withdraw it. This describes
- * the nominal flow. However, it may happen that some issue is encountered.
- * For example, an application may ask for an objective that is not currently
- * achievable, e.g. connectivity across to unconnected network segments.
- * If this is the case, the compiling phase may fail to produce a set of
- * installable intents and instead result in a failed compile. If this occurs,
- * only a change in the environment can trigger a transition back to the
- * compiling state.
- * </p>
- * <p>
- * Similarly, an issue may be encountered during the installation phase in
- * which case the framework will attempt to recompile the intent to see if an
- * alternate approach is available. If so, the intent will be sent back to
- * installing phase. Otherwise, it will be parked in the failed state. Another
- * scenario that’s very likely to be encountered is where the intent is
- * successfully compiled and installed, but due to some topology event, such
- * as a downed or downgraded link, loss of throughput may occur or connectivity
- * may be lost altogether, thus impacting the viability of a previously
- * satisfied intent. If this occurs, the framework will attempt to recompile
- * the intent, and if an alternate approach is available, its installation
- * will be attempted. Otherwise, the original top-level intent will be parked
- * in the failed state.
- * </p>
- * <p>
- * Please note that all *ing states, depicted in orange, are transitional and
- * are expected to last only a brief amount of time. The rest of the states
- * are parking states where the intent may spent some time; except for the
- * submitted state of course. There, the intent may pause, but only briefly,
- * while the system determines where to perform the compilation or while it
- * performs global recomputation/optimization across all prior intents.
- * </p>
- * <p>
- * The figure below depicts the general interactions between different
- * components of the intent subsystem.<br>
- * <img src="doc-files/intent-design.png" alt="ONOS intent subsystem design">
- * </p>
- */
-package org.onosproject.net.intent;