diff options
Diffstat (limited to 'framework/src/onos/core/api/src/main/java/org/onosproject/net/flowobjective')
14 files changed, 0 insertions, 1876 deletions
diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flowobjective/DefaultFilteringObjective.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flowobjective/DefaultFilteringObjective.java deleted file mode 100644 index 4d9d7225..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flowobjective/DefaultFilteringObjective.java +++ /dev/null @@ -1,255 +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.flowobjective; - -import com.google.common.annotations.Beta; -import com.google.common.collect.ImmutableList; -import org.onosproject.core.ApplicationId; -import org.onosproject.net.flow.TrafficTreatment; -import org.onosproject.net.flow.criteria.Criteria; -import org.onosproject.net.flow.criteria.Criterion; - -import java.util.Collection; -import java.util.List; -import java.util.Objects; -import java.util.Optional; - -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; - -/** - * Default implementation of a filtering objective. - */ -@Beta -public final class DefaultFilteringObjective implements FilteringObjective { - - - private final Type type; - private final boolean permanent; - private final int timeout; - private final ApplicationId appId; - private final int priority; - private final Criterion key; - private final List<Criterion> conditions; - private final int id; - private final Operation op; - private final Optional<ObjectiveContext> context; - private final TrafficTreatment meta; - - private DefaultFilteringObjective(Builder builder) { - this.key = builder.key; - this.type = builder.type; - this.permanent = builder.permanent; - this.timeout = builder.timeout; - this.appId = builder.appId; - this.priority = builder.priority; - this.conditions = builder.conditions; - this.op = builder.op; - this.context = Optional.ofNullable(builder.context); - this.meta = builder.meta; - - this.id = Objects.hash(type, key, conditions, permanent, - timeout, appId, priority); - } - - @Override - public Criterion key() { - return key; - } - - @Override - public Type type() { - return this.type; - } - - @Override - public Collection<Criterion> conditions() { - return conditions; - } - - @Override - public int id() { - return id; - } - - @Override - public TrafficTreatment meta() { - return meta; - } - - - @Override - public int priority() { - return priority; - } - - @Override - public ApplicationId appId() { - return appId; - } - - @Override - public int timeout() { - return timeout; - } - - @Override - public boolean permanent() { - return permanent; - } - - @Override - public Operation op() { - return op; - } - - @Override - public Optional<ObjectiveContext> context() { - return context; - } - - /** - * Returns a new builder. - * - * @return new builder - */ - public static Builder builder() { - return new Builder(); - } - - - public static final class Builder implements FilteringObjective.Builder { - private final ImmutableList.Builder<Criterion> listBuilder - = ImmutableList.builder(); - - private Type type; - private boolean permanent = DEFAULT_PERMANENT; - private int timeout = DEFAULT_TIMEOUT; - private ApplicationId appId; - private int priority = DEFAULT_PRIORITY; - private Criterion key = Criteria.dummy(); - private List<Criterion> conditions; - private Operation op; - private ObjectiveContext context; - private TrafficTreatment meta; - - @Override - public Builder withKey(Criterion key) { - this.key = key; - return this; - } - - @Override - public Builder addCondition(Criterion criterion) { - listBuilder.add(criterion); - return this; - } - - @Override - public Builder permit() { - this.type = Type.PERMIT; - return this; - } - - @Override - public Builder deny() { - this.type = Type.DENY; - return this; - } - - @Override - public Builder makeTemporary(int timeout) { - this.timeout = timeout; - permanent = false; - return this; - } - - @Override - public Builder makePermanent() { - permanent = true; - return this; - } - - @Override - public Builder fromApp(ApplicationId appId) { - this.appId = appId; - return this; - } - - @Override - public Builder withPriority(int priority) { - this.priority = priority; - return this; - } - - @Override - public Builder withMeta(TrafficTreatment treatment) { - this.meta = treatment; - return this; - } - - @Override - public FilteringObjective add() { - conditions = listBuilder.build(); - op = Operation.ADD; - checkNotNull(type, "Must have a type."); - checkArgument(!conditions.isEmpty(), "Must have at least one condition."); - checkNotNull(appId, "Must supply an application id"); - - return new DefaultFilteringObjective(this); - - } - - @Override - public FilteringObjective remove() { - conditions = listBuilder.build(); - checkNotNull(type, "Must have a type."); - checkArgument(!conditions.isEmpty(), "Must have at least one condition."); - checkNotNull(appId, "Must supply an application id"); - op = Operation.REMOVE; - - return new DefaultFilteringObjective(this); - - } - - @Override - public FilteringObjective add(ObjectiveContext context) { - conditions = listBuilder.build(); - checkNotNull(type, "Must have a type."); - checkArgument(!conditions.isEmpty(), "Must have at least one condition."); - checkNotNull(appId, "Must supply an application id"); - op = Operation.ADD; - this.context = context; - - return new DefaultFilteringObjective(this); - } - - @Override - public FilteringObjective remove(ObjectiveContext context) { - conditions = listBuilder.build(); - checkNotNull(type, "Must have a type."); - checkArgument(!conditions.isEmpty(), "Must have at least one condition."); - checkNotNull(appId, "Must supply an application id"); - op = Operation.REMOVE; - this.context = context; - - return new DefaultFilteringObjective(this); - } - - - } - -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flowobjective/DefaultForwardingObjective.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flowobjective/DefaultForwardingObjective.java deleted file mode 100644 index af481805..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flowobjective/DefaultForwardingObjective.java +++ /dev/null @@ -1,289 +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.flowobjective; - -import com.google.common.annotations.Beta; - -import org.onosproject.core.ApplicationId; -import org.onosproject.net.flow.TrafficSelector; -import org.onosproject.net.flow.TrafficTreatment; - -import java.util.Objects; -import java.util.Optional; - -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; - -/** - * Default implementation of a forwarding objective. - */ -@Beta -public final class DefaultForwardingObjective implements ForwardingObjective { - - private final TrafficSelector selector; - private final Flag flag; - private final boolean permanent; - private final int timeout; - private final ApplicationId appId; - private final int priority; - private final Integer nextId; - private final TrafficTreatment treatment; - private final Operation op; - private final Optional<ObjectiveContext> context; - - private final int id; - - private DefaultForwardingObjective(Builder builder) { - this.selector = builder.selector; - this.flag = builder.flag; - this.permanent = builder.permanent; - this.timeout = builder.timeout; - this.appId = builder.appId; - this.priority = builder.priority; - this.nextId = builder.nextId; - this.treatment = builder.treatment; - this.op = builder.op; - this.context = Optional.ofNullable(builder.context); - - this.id = Objects.hash(selector, flag, permanent, - timeout, appId, priority, nextId, - treatment, op); - } - - - @Override - public TrafficSelector selector() { - return selector; - } - - @Override - public Integer nextId() { - return nextId; - } - - @Override - public TrafficTreatment treatment() { - return treatment; - } - - - @Override - public Flag flag() { - return flag; - } - - @Override - public int id() { - return id; - } - - @Override - public int priority() { - return priority; - } - - @Override - public ApplicationId appId() { - return appId; - } - - @Override - public int timeout() { - return timeout; - } - - @Override - public boolean permanent() { - return permanent; - } - - @Override - public Operation op() { - return op; - } - - @Override - public Optional<ObjectiveContext> context() { - return context; - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#hashCode() - */ - @Override - public int hashCode() { - return Objects.hash(selector, flag, permanent, - timeout, appId, priority, nextId, - treatment, op); - } - - /* - * (non-Javadoc) - * - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(final Object obj) { - if (this == obj) { - return true; - } - if (!(obj instanceof DefaultForwardingObjective)) { - return false; - } - final DefaultForwardingObjective other = (DefaultForwardingObjective) obj; - boolean nextEq = false, treatmentEq = false; - if (this.selector.equals(other.selector) && - this.flag == other.flag && - this.permanent == other.permanent && - this.timeout == other.timeout && - this.appId.equals(other.appId) && - this.priority == other.priority && - this.op == other.op) { - if (this.nextId != null && other.nextId != null) { - nextEq = this.nextId == other.nextId; - } - if (this.treatment != null && other.treatment != null) { - treatmentEq = this.treatment.equals(other.treatment); - } - if (nextEq && treatmentEq) { - return true; - } - } - return false; - } - - /** - * Returns a new builder. - * - * @return new builder - */ - public static Builder builder() { - return new Builder(); - } - - public static final class Builder implements ForwardingObjective.Builder { - - private TrafficSelector selector; - private Flag flag; - private boolean permanent = DEFAULT_PERMANENT; - private int timeout = DEFAULT_TIMEOUT; - private int priority = DEFAULT_PRIORITY; - private ApplicationId appId; - private Integer nextId; - private TrafficTreatment treatment; - private Operation op; - private ObjectiveContext context; - - @Override - public Builder withSelector(TrafficSelector selector) { - this.selector = selector; - return this; - } - - @Override - public Builder nextStep(int nextId) { - this.nextId = nextId; - return this; - } - - @Override - public Builder withTreatment(TrafficTreatment treatment) { - this.treatment = treatment; - return this; - } - - @Override - public Builder withFlag(Flag flag) { - this.flag = flag; - return this; - } - - @Override - public Builder makeTemporary(int timeout) { - this.timeout = timeout; - this.permanent = false; - return this; - } - - @Override - public Builder makePermanent() { - this.permanent = true; - return this; - } - - @Override - public Builder fromApp(ApplicationId appId) { - this.appId = appId; - return this; - } - - @Override - public Builder withPriority(int priority) { - this.priority = priority; - return this; - } - - @Override - public ForwardingObjective add() { - checkNotNull(selector, "Must have a selector"); - checkNotNull(flag, "A flag must be set"); - checkArgument(nextId != null || treatment != null, "Must supply at " + - "least a treatment and/or a nextId"); - checkNotNull(appId, "Must supply an application id"); - op = Operation.ADD; - return new DefaultForwardingObjective(this); - } - - @Override - public ForwardingObjective remove() { - checkNotNull(selector, "Must have a selector"); - checkNotNull(flag, "A flag must be set"); - checkArgument(nextId != null || treatment != null, "Must supply at " + - "least a treatment and/or a nextId"); - checkNotNull(appId, "Must supply an application id"); - op = Operation.REMOVE; - return new DefaultForwardingObjective(this); - } - - @Override - public ForwardingObjective add(ObjectiveContext context) { - checkNotNull(selector, "Must have a selector"); - checkNotNull(flag, "A flag must be set"); - checkArgument(nextId != null || treatment != null, "Must supply at " + - "least a treatment and/or a nextId"); - checkNotNull(appId, "Must supply an application id"); - op = Operation.ADD; - this.context = context; - - return new DefaultForwardingObjective(this); - } - - @Override - public ForwardingObjective remove(ObjectiveContext context) { - checkNotNull(selector, "Must have a selector"); - checkNotNull(flag, "A flag must be set"); - checkArgument(nextId != null || treatment != null, "Must supply at " + - "least a treatment and/or a nextId"); - checkNotNull(appId, "Must supply an application id"); - op = Operation.REMOVE; - this.context = context; - - return new DefaultForwardingObjective(this); - } - } -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flowobjective/DefaultNextObjective.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flowobjective/DefaultNextObjective.java deleted file mode 100644 index bd580507..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flowobjective/DefaultNextObjective.java +++ /dev/null @@ -1,287 +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.flowobjective; - -import com.google.common.annotations.Beta; -import com.google.common.collect.ImmutableList; -import org.onosproject.core.ApplicationId; -import org.onosproject.net.flow.TrafficSelector; -import org.onosproject.net.flow.TrafficTreatment; - -import java.util.Collection; -import java.util.List; -import java.util.Optional; - -import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; - -/** - * Default implementation of a next objective. - */ -@Beta -public final class DefaultNextObjective implements NextObjective { - - private final List<TrafficTreatment> treatments; - private final ApplicationId appId; - private final Type type; - private final Integer id; - private final Operation op; - private final Optional<ObjectiveContext> context; - private final TrafficSelector meta; - - private DefaultNextObjective(Builder builder) { - this.treatments = builder.treatments; - this.appId = builder.appId; - this.type = builder.type; - this.id = builder.id; - this.op = builder.op; - this.context = Optional.ofNullable(builder.context); - this.meta = builder.meta; - } - - @Override - public Collection<TrafficTreatment> next() { - return treatments; - } - - @Override - public Type type() { - return type; - } - - @Override - public int id() { - return id; - } - - @Override - public int priority() { - return 0; - } - - @Override - public ApplicationId appId() { - return appId; - } - - @Override - public int timeout() { - return 0; - } - - @Override - public boolean permanent() { - return false; - } - - @Override - public Operation op() { - return op; - } - - @Override - public Optional<ObjectiveContext> context() { - return context; - } - - @Override - public TrafficSelector meta() { - return meta; - } - - /** - * Returns a new builder. - * - * @return new builder - */ - public static Builder builder() { - return new Builder(); - } - - public static final class Builder implements NextObjective.Builder { - - private ApplicationId appId; - private Type type; - private Integer id; - private List<TrafficTreatment> treatments; - private Operation op; - private ObjectiveContext context; - private TrafficSelector meta; - - private final ImmutableList.Builder<TrafficTreatment> listBuilder - = ImmutableList.builder(); - - @Override - public Builder withId(int nextId) { - this.id = nextId; - return this; - } - - @Override - public Builder withType(Type type) { - this.type = type; - return this; - } - - @Override - public Builder addTreatment(TrafficTreatment treatment) { - listBuilder.add(treatment); - return this; - } - - /** - * Noop. This method has no effect. - * - * @param timeout a timeout - * @return a next objective builder - */ - @Override - public Builder makeTemporary(int timeout) { - return this; - } - - /** - * Noop. This method has no effect. - * - * @return a next objective builder - */ - @Override - public Builder makePermanent() { - return this; - } - - @Override - public Builder fromApp(ApplicationId appId) { - this.appId = appId; - return this; - } - - /** - * Noop. This method has no effect. - * - * @param priority an integer - * @return a next objective builder - */ - @Override - public Builder withPriority(int priority) { - return this; - } - - @Override - public Builder withMeta(TrafficSelector meta) { - this.meta = meta; - return this; - } - - @Override - public NextObjective add() { - treatments = listBuilder.build(); - op = Operation.ADD; - checkNotNull(appId, "Must supply an application id"); - checkNotNull(id, "id cannot be null"); - checkNotNull(type, "The type cannot be null"); - checkArgument(!treatments.isEmpty(), "Must have at least one treatment"); - - return new DefaultNextObjective(this); - } - - @Override - public NextObjective remove() { - treatments = listBuilder.build(); - op = Operation.REMOVE; - checkNotNull(appId, "Must supply an application id"); - checkNotNull(id, "id cannot be null"); - checkNotNull(type, "The type cannot be null"); - - return new DefaultNextObjective(this); - } - - @Override - public NextObjective add(ObjectiveContext context) { - treatments = listBuilder.build(); - op = Operation.ADD; - this.context = context; - checkNotNull(appId, "Must supply an application id"); - checkNotNull(id, "id cannot be null"); - checkNotNull(type, "The type cannot be null"); - checkArgument(!treatments.isEmpty(), "Must have at least one treatment"); - - return new DefaultNextObjective(this); - } - - @Override - public NextObjective remove(ObjectiveContext context) { - treatments = listBuilder.build(); - op = Operation.REMOVE; - this.context = context; - checkNotNull(appId, "Must supply an application id"); - checkNotNull(id, "id cannot be null"); - checkNotNull(type, "The type cannot be null"); - - return new DefaultNextObjective(this); - } - - @Override - public NextObjective addToExisting() { - treatments = listBuilder.build(); - op = Operation.ADD_TO_EXISTING; - checkNotNull(appId, "Must supply an application id"); - checkNotNull(id, "id cannot be null"); - checkNotNull(type, "The type cannot be null"); - checkArgument(!treatments.isEmpty(), "Must have at least one treatment"); - - return new DefaultNextObjective(this); - } - - @Override - public NextObjective removeFromExisting() { - treatments = listBuilder.build(); - op = Operation.REMOVE_FROM_EXISTING; - checkNotNull(appId, "Must supply an application id"); - checkNotNull(id, "id cannot be null"); - checkNotNull(type, "The type cannot be null"); - - return new DefaultNextObjective(this); - } - - @Override - public NextObjective addToExisting(ObjectiveContext context) { - treatments = listBuilder.build(); - op = Operation.ADD_TO_EXISTING; - this.context = context; - checkNotNull(appId, "Must supply an application id"); - checkNotNull(id, "id cannot be null"); - checkNotNull(type, "The type cannot be null"); - checkArgument(!treatments.isEmpty(), "Must have at least one treatment"); - - return new DefaultNextObjective(this); - } - - @Override - public NextObjective removeFromExisting(ObjectiveContext context) { - treatments = listBuilder.build(); - op = Operation.REMOVE_FROM_EXISTING; - this.context = context; - checkNotNull(appId, "Must supply an application id"); - checkNotNull(id, "id cannot be null"); - checkNotNull(type, "The type cannot be null"); - - return new DefaultNextObjective(this); - } - - } - -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flowobjective/FilteringObjective.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flowobjective/FilteringObjective.java deleted file mode 100644 index 8ed793d0..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flowobjective/FilteringObjective.java +++ /dev/null @@ -1,182 +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.flowobjective; - -import com.google.common.annotations.Beta; -import org.onosproject.core.ApplicationId; -import org.onosproject.net.flow.TrafficTreatment; -import org.onosproject.net.flow.criteria.Criterion; - -import java.util.Collection; - -/** - * Represents a filtering flow objective. Each filtering flow objective - * is made up of a key (typically a PortCriterion) mapped to a set of criteria. - * Using this information, a pipeline aware driver will decide how this objective - * should be mapped to the device specific pipeline-tables in order to satisfy the - * filtering condition. For example, consider the following PERMIT filtering - * objective: - * <p> - * portX -> {MAC1, VLAN1} - * <p> - * The driver could decide to pass packets to the MAC table or VLAN or PORT - * tables to ensure that only those packets arriving with the correct dst MAC - * and VLAN ids from Port X are allowed into the pipeline. - * <p> - * Filtering objectives of type PERMIT allow packets that match the key:criteria - * to enter the pipeline. As a result, the implication is that packets that don't - * match are automatically denied (dropped). - * <p> - * Filtering objectives of type DENY, are used to deny packets that would - * otherwise be permitted and forwarded through the pipeline (ie. those packets - * that make it through the PERMIT filters). - */ -@Beta -public interface FilteringObjective extends Objective { - - enum Type { - /** - * Permits packets that match the filtering condition to be processed - * by the rest of the pipeline. Automatically denies packets that don't - * match the criteria. - */ - PERMIT, - - /** - * Denies packets that make it through the permit filters. - */ - DENY - } - - /** - * Obtain the key for this filter. The filter may or may not require a key. - * - * @return a criterion, which could be null if no key was provided. - */ - Criterion key(); - - /** - * Obtain this filtering type. - * - * @return the type - */ - Type type(); - - /** - * The set of conditions the filter must provision at the device. - * - * @return a collection of criteria - */ - Collection<Criterion> conditions(); - - /** - * Auxiliary optional information provided to the device-driver.Typically - * conveys information about changes (treatments) to packets that are - * permitted into the pipeline by the PERMIT filtering condition. - * - * @return a treatment on the packets that make it through the PERMIT filters. - * Value may be null if no meta information is provided. - */ - TrafficTreatment meta(); - - /** - * Builder of Filtering objective entities. - */ - interface Builder extends Objective.Builder { - - /** - * Specify the key for the filter. - * - * @param key a criterion - * @return a filter objective builder - */ - Builder withKey(Criterion key); - - /** - * Add a filtering condition. - * - * @param criterion new criterion - * @return a filtering builder - */ - Builder addCondition(Criterion criterion); - - /** - * Permit this filtering condition set. - * - * @return a filtering builder - */ - Builder permit(); - - /** - * Deny this filtering condition set. - * - * @return a filtering builder - */ - Builder deny(); - - /** - * Set meta information about this filtering condition set. - * - * @param treatment traffic treatment to use - * @return a filtering builder - */ - Builder withMeta(TrafficTreatment treatment); - - /** - * Assigns an application id. - * - * @param appId an application id - * @return a filtering builder - */ - @Override - Builder fromApp(ApplicationId appId); - - /** - * Builds the filtering objective that will be added. - * - * @return a filtering objective - */ - FilteringObjective add(); - - /** - * Builds the filtering objective that will be removed. - * - * @return a filtering objective. - */ - FilteringObjective remove(); - - /** - * Builds the filtering objective that will be added. - * The context will be used to notify the calling application. - * - * @param context an objective context - * @return a filtering objective - */ - FilteringObjective add(ObjectiveContext context); - - /** - * Builds the filtering objective that will be removed. - * The context will be used to notify the calling application. - * - * @param context an objective context - * @return a filtering objective - */ - FilteringObjective remove(ObjectiveContext context); - - - } - -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flowobjective/FlowObjectiveService.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flowobjective/FlowObjectiveService.java deleted file mode 100644 index d3254151..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flowobjective/FlowObjectiveService.java +++ /dev/null @@ -1,65 +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.flowobjective; - -import com.google.common.annotations.Beta; -import org.onosproject.net.DeviceId; - -/** - * Service for programming data plane flow rules in manner independent of - * specific device table pipeline configuration. - */ -@Beta -public interface FlowObjectiveService { - - /** - * Installs the filtering rules onto the specified device. - * - * @param deviceId device identifier - * @param filteringObjective the filtering objective - */ - void filter(DeviceId deviceId, FilteringObjective filteringObjective); - - /** - * Installs the forwarding rules onto the specified device. - * - * @param deviceId device identifier - * @param forwardingObjective the forwarding objective - */ - void forward(DeviceId deviceId, ForwardingObjective forwardingObjective); - - /** - * Installs the next hop elements into the specified device. - * - * @param deviceId device identifier - * @param nextObjective a next objective - */ - void next(DeviceId deviceId, NextObjective nextObjective); - - /** - * Obtains a globally unique next objective. - * - * @return an integer - */ - int allocateNextId(); - - /** - * Installs the filtering rules onto the specified device. - * - * @param policy policy expression - */ - void initPolicy(String policy); -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flowobjective/FlowObjectiveStore.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flowobjective/FlowObjectiveStore.java deleted file mode 100644 index ecf5d733..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flowobjective/FlowObjectiveStore.java +++ /dev/null @@ -1,50 +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.flowobjective; - -import com.google.common.annotations.Beta; -import org.onosproject.net.behaviour.NextGroup; -import org.onosproject.store.Store; - -/** - * The flow objective store. - */ -@Beta -public interface FlowObjectiveStore - extends Store<ObjectiveEvent, FlowObjectiveStoreDelegate> { - - /** - * Adds a NextGroup to the store. - * - * @param nextId an integer - * @param group a next group opaque object - */ - void putNextGroup(Integer nextId, NextGroup group); - - /** - * Fetch a next group from the store. - * @param nextId an integer - * @return a next group - */ - NextGroup getNextGroup(Integer nextId); - - /** - * Allocates a next objective id. This id is globally unique - * - * @return an integer - */ - int allocateNextId(); -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flowobjective/FlowObjectiveStoreDelegate.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flowobjective/FlowObjectiveStoreDelegate.java deleted file mode 100644 index 2189af1b..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flowobjective/FlowObjectiveStoreDelegate.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.flowobjective; - -import com.google.common.annotations.Beta; -import org.onosproject.store.StoreDelegate; - -/** - * Flow Objective store delegate abstraction. - */ -@Beta -public interface FlowObjectiveStoreDelegate extends StoreDelegate<ObjectiveEvent> { -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flowobjective/ForwardingObjective.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flowobjective/ForwardingObjective.java deleted file mode 100644 index 9857a710..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flowobjective/ForwardingObjective.java +++ /dev/null @@ -1,158 +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.flowobjective; - -import com.google.common.annotations.Beta; -import org.onosproject.net.flow.TrafficSelector; -import org.onosproject.net.flow.TrafficTreatment; - -/** - * Represents a description of which types of traffic need to - * be forwarded through the device. A forwarding objective may - * result in multiple rules at the device. There are two main types - * of forwarding objectives: - * - * - Versatile - * - Specific - * - * A versatile forwarding objective represents a composite rule that matches - * two or more header fields. The use of versatile usually indicates that this - * rule should be inserted in its entirety into the ACL table. Although, - * drivers for some devices are free to implement this differently. - * - * A specific forwarding objective represents a specific rule matching one or - * more header fields. The installation of this rule may result in several rules - * at the device. For example, one per table type. - */ -@Beta -public interface ForwardingObjective extends Objective { - - /** - * Represents whether this objective is monolithic or - * may be broken down into parts. - */ - enum Flag { - /** - * A decomposable objective. - */ - SPECIFIC, - - /** - * A monolithic objective. - */ - VERSATILE - } - - /** - * Obtain the selector for this objective. - * - * @return a traffic selector - */ - TrafficSelector selector(); - - /** - * Obtain the traffic treatment for this objective. Mutually exclusive with - * 'treatment'. - * - * @return an integer - */ - Integer nextId(); - - /** - * A traffic treatment for this forwarding objective. Mutually exclusive - * with a nextId. - * - * @return a traffic treatment - */ - TrafficTreatment treatment(); - - /** - * Obtain the type of this objective. - * - * @return a flag type - */ - Flag flag(); - - /** - * A forwarding objective builder. - */ - interface Builder extends Objective.Builder { - - /** - * Assigns a selector to the forwarding objective. - * - * @param selector a traffic selector - * @return a forwarding objective builder - */ - Builder withSelector(TrafficSelector selector); - - /** - * Assigns a next step to the forwarding objective. - * - * @param nextId a next objective id. - * @return a forwarding objective builder - */ - Builder nextStep(int nextId); - - /** - * Assigns the treatment for this forwarding objective. - * - * @param treatment a traffic treatment - * @return a forwarding objective - */ - Builder withTreatment(TrafficTreatment treatment); - - /** - * Assigns the flag to the forwarding objective. - * - * @param flag a flag - * @return a forwarding objective builder - */ - Builder withFlag(Flag flag); - - /** - * Builds the forwarding objective that will be added. - * - * @return a forwarding objective - */ - ForwardingObjective add(); - - /** - * Builds the forwarding objective that will be removed. - * - * @return a forwarding objective. - */ - ForwardingObjective remove(); - - /** - * Builds the forwarding objective that will be added. - * The context will be used to notify the calling application. - * - * @param context an objective context - * @return a forwarding objective - */ - ForwardingObjective add(ObjectiveContext context); - - /** - * Builds the forwarding objective that will be removed. - * The context will be used to notify the calling application. - * - * @param context an objective context - * @return a forwarding objective - */ - ForwardingObjective remove(ObjectiveContext context); - } -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flowobjective/NextObjective.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flowobjective/NextObjective.java deleted file mode 100644 index 36098d71..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flowobjective/NextObjective.java +++ /dev/null @@ -1,220 +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.flowobjective; - -import com.google.common.annotations.Beta; -import org.onosproject.core.ApplicationId; -import org.onosproject.net.flow.TrafficSelector; -import org.onosproject.net.flow.TrafficTreatment; - -import java.util.Collection; - -/** - * Represents a nexthop which will be translated by a driver - * into the appropriate group or actions needed to implement - * the egress function. - * - * A next objective is made up of a collection of traffic treatments - * associated with a type. These types are: - * - * - Hashed - * - Broadcast - * - Failover - * - Simple - * - * These types will indicate to the driver what the intended behavior is. - * For example, a broadcast next objective with a collection of output - * treatments will indicate to a driver that all output actions are expected - * to be executed simultaneously. The driver is then free to implement this - * as a group or a simple action list. - */ -@Beta -public interface NextObjective extends Objective { - - /** - * Represents the type of next phase to build. - */ - enum Type { - /** - * A hashed packet processing. - */ - HASHED, - - /** - * Broadcast packet process. - */ - BROADCAST, - - /** - * Failover handling. - */ - FAILOVER, - - /** - * Simple processing. Could be a group or a treatment. - */ - SIMPLE - } - - /** - * The collection of treatments that need to be applied to a set of traffic. - * - * @return a collection of traffic treatments - */ - Collection<TrafficTreatment> next(); - - /** - * The type of operation that will be applied to the traffic using the collection - * of treatments. - * - * @return a type - */ - Type type(); - - /** - * Auxiliary optional information provided to the device-driver.Typically - * conveys information about selectors (matches) that are intended to - * use this Next Objective. - * - * @return a selector intended to pass meta information to the device driver. - * Value may be null if no meta information is provided. - */ - TrafficSelector meta(); - - /** - * A next step builder. - */ - interface Builder extends Objective.Builder { - - /** - * Specifies the id for this next objective. - * - * @param nextId an integer - * @return a next objective builder - */ - Builder withId(int nextId); - - /** - * Sets the type of next step. - * - * @param type a type - * @return a next step builder - */ - Builder withType(Type type); - - /** - * Adds a treatment to this next step. - * - * @param treatment a traffic treatment - * @return a next step builder - */ - Builder addTreatment(TrafficTreatment treatment); - - /** - * Specifies the application which applied the filter. - * - * @param appId an application id - * @return an objective builder - */ - @Override - Builder fromApp(ApplicationId appId); - - /** - * Sets the priority for this objective. - * - * @param priority an integer - * @return an objective builder - */ - @Override - Builder withPriority(int priority); - - /** - * Set meta information related to this next objective. - * - * @param selector match conditions - * @return an objective builder - */ - Builder withMeta(TrafficSelector selector); - - /** - * Builds the next objective that will be added. - * - * @return a next objective - */ - NextObjective add(); - - /** - * Builds the next objective that will be removed. - * - * @return a next objective. - */ - NextObjective remove(); - - /** - * Builds the next objective that will be added. - * The context will be used to notify the calling application. - * - * @param context an objective context - * @return a next objective - */ - NextObjective add(ObjectiveContext context); - - /** - * Builds the next objective that will be removed. - * The context will be used to notify the calling application. - * - * @param context an objective context - * @return a next objective - */ - NextObjective remove(ObjectiveContext context); - - /** - * Build the next objective that will be added, with {@link Operation} - * ADD_TO_EXISTING. - * - * @return a next objective - */ - NextObjective addToExisting(); - - /** - * Build the next objective that will be removed, with {@link Operation} - * REMOVE_FROM_EXISTING. - * - * @return a next objective - */ - NextObjective removeFromExisting(); - - /** - * Builds the next objective that will be added, with {@link Operation} - * ADD_TO_EXISTING. The context will be used to notify the calling application. - * - * @param context an objective context - * @return a next objective - */ - NextObjective addToExisting(ObjectiveContext context); - - /** - * Builds the next objective that will be removed, with {@link Operation} - * REMOVE_FROM_EXISTING. The context will be used to notify the calling application. - * - * @param context an objective context - * @return a next objective - */ - NextObjective removeFromExisting(ObjectiveContext context); - - } - -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flowobjective/Objective.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flowobjective/Objective.java deleted file mode 100644 index b1d73a7c..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flowobjective/Objective.java +++ /dev/null @@ -1,151 +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.flowobjective; - -import com.google.common.annotations.Beta; -import org.onosproject.core.ApplicationId; - -import java.util.Optional; - -/** - * Base representation of a flow-objective description. - */ -@Beta -public interface Objective { - - boolean DEFAULT_PERMANENT = true; - int DEFAULT_TIMEOUT = 0; - int DEFAULT_PRIORITY = 32768; - - /** - * Type of operation. - */ - enum Operation { - /** - * Adds the objective. Can be used for any flow objective. For forwarding - * and filtering objectives, existing objectives with identical selector - * and priority fields (but different treatments or next) will be replaced. - * For next objectives, if modification is desired, ADD will not - * do anything - use ADD_TO_EXISTING. - */ - ADD, - - /** - * Removes the objective. Can be used for any flow objective. - */ - REMOVE, - - /** - * Add to an existing Next Objective. Should not be used for any other - * objective. - */ - ADD_TO_EXISTING, - - /** - * Remove from an existing Next Objective. Should not be used for any - * other objective. - */ - REMOVE_FROM_EXISTING - } - - /** - * An identifier for this objective. - * - * @return an integer - */ - int id(); - - /** - * The priority for this objective. - * - * @return an integer - */ - int priority(); - - /** - * The application which applied this objective. - * - * @return an application id - */ - ApplicationId appId(); - - /** - * The timeout for this objective. - * - * @return an integer - */ - int timeout(); - - /** - * Whether this objective is permanent. - * - * @return a boolean - */ - boolean permanent(); - - /** - * The type of operation for this objective. - * - * @return an operation - */ - Operation op(); - - /** - * Obtains an optional context. - * - * @return optional; which will be empty if there is no context. - * Otherwise it will return the context. - */ - Optional<ObjectiveContext> context(); - - /** - * An objective builder. - */ - interface Builder { - /** - * Makes the filtering objective temporary. - * - * @param timeout a timeout - * @return an objective builder - */ - Builder makeTemporary(int timeout); - - /** - * Makes the filtering objective permanent. - * - * @return an objective builder - */ - Builder makePermanent(); - - /** - * Specifies the application which applied the filter. - * - * @param appId an application id - * @return an objective builder - */ - Builder fromApp(ApplicationId appId); - - /** - * Sets the priority for this objective. - * - * @param priority an integer - * @return an objective builder - */ - Builder withPriority(int priority); - - } - -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flowobjective/ObjectiveContext.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flowobjective/ObjectiveContext.java deleted file mode 100644 index f3d23e4a..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flowobjective/ObjectiveContext.java +++ /dev/null @@ -1,47 +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.flowobjective; - -import com.google.common.annotations.Beta; - -/** - * The context of a objective that will become the subject of - * the notification. - * <p> - * Implementations of this class must be serializable. - * </p> - */ -@Beta -public interface ObjectiveContext { - - /** - * Invoked on successful execution of the flow objective. - * - * @param objective objective to execute - */ - default void onSuccess(Objective objective) { - } - - /** - * Invoked when error is encountered while executing the flow objective. - * - * @param objective objective to execute - * @param error error encountered - */ - default void onError(Objective objective, ObjectiveError error) { - } - -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flowobjective/ObjectiveError.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flowobjective/ObjectiveError.java deleted file mode 100644 index fd159d7e..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flowobjective/ObjectiveError.java +++ /dev/null @@ -1,60 +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.flowobjective; - -import com.google.common.annotations.Beta; - -/** - * Represents the set of errors possible when processing an objective. - */ -@Beta -public enum ObjectiveError { - - /** - * The driver processing this objective does not know how to process it. - */ - UNSUPPORTED, - - /** - * The flow installation for this objective failed. - */ - FLOWINSTALLATIONFAILED, - - /** - * THe group installation for this objective failed. - */ - GROUPINSTALLATIONFAILED, - - /** - * The group was reported as installed but is missing. - */ - GROUPMISSING, - - /** - * The device was not available to install objectives to. - */ - DEVICEMISSING, - - /** - * Incorrect Objective parameters passed in by the caller. - */ - BADPARAMS, - - /** - * An unknown error occurred. - */ - UNKNOWN -} diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flowobjective/ObjectiveEvent.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flowobjective/ObjectiveEvent.java deleted file mode 100644 index c6937e31..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flowobjective/ObjectiveEvent.java +++ /dev/null @@ -1,64 +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.flowobjective; - -import com.google.common.annotations.Beta; -import org.onosproject.event.AbstractEvent; - -/** - * Describes a objective event. - */ -@Beta -public class ObjectiveEvent extends AbstractEvent<ObjectiveEvent.Type, Integer> { - - /** - * Type of objective events. - */ - public enum Type { - /** - * Signifies that the objective has been added to the store. - */ - ADD, - - /** - * Signifies that the objective has been removed. - */ - REMOVE - } - - /** - * Creates an event of the given type for the specified objective id. - * - * @param type the type of the event - * @param objective the objective id the event is about - */ - public ObjectiveEvent(Type type, Integer objective) { - super(type, objective); - } - - /** - * Creates an event of the given type for the specified objective id at the given - * time. - * - * @param type the type of the event - * @param objective the objective id the event is about - * @param time the time of the event - */ - public ObjectiveEvent(Type type, Integer objective, long time) { - super(type, objective, time); - } -} - diff --git a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flowobjective/package-info.java b/framework/src/onos/core/api/src/main/java/org/onosproject/net/flowobjective/package-info.java deleted file mode 100644 index 105f7b59..00000000 --- a/framework/src/onos/core/api/src/main/java/org/onosproject/net/flowobjective/package-info.java +++ /dev/null @@ -1,22 +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. - */ - -/** - * Abstractions for objective-based flow programming of data plane without - * requiring device pipeline structure awareness. This subsystem is - * experimental and its interfaces will change in the upcoming release. - */ -package org.onosproject.net.flowobjective;
\ No newline at end of file |