diff options
author | Ashlee Young <ashlee@wildernessvoice.com> | 2015-12-01 05:49:27 -0800 |
---|---|---|
committer | Ashlee Young <ashlee@wildernessvoice.com> | 2015-12-01 05:49:27 -0800 |
commit | e63291850fd0795c5700e25e67e5dee89ba54c5f (patch) | |
tree | 9707289536ad95bb739c9856761ad43275e07d8c /framework/src/onos/core/api/src/main/java/org/onosproject/net/flowobjective/DefaultNextObjective.java | |
parent | 671823e12bc13be9a8b87a5d7de33da1bb7a44e8 (diff) |
onos commit hash c2999f30c69e50df905a9d175ef80b3f23a98514
Change-Id: I2bb8562c4942b6d6a6d60b663db2e17540477b81
Signed-off-by: Ashlee Young <ashlee@wildernessvoice.com>
Diffstat (limited to 'framework/src/onos/core/api/src/main/java/org/onosproject/net/flowobjective/DefaultNextObjective.java')
-rw-r--r-- | framework/src/onos/core/api/src/main/java/org/onosproject/net/flowobjective/DefaultNextObjective.java | 65 |
1 files changed, 65 insertions, 0 deletions
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 index 20e89295..4701589f 100644 --- 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 @@ -18,6 +18,7 @@ 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; @@ -39,6 +40,7 @@ public final class DefaultNextObjective implements NextObjective { 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; @@ -47,6 +49,7 @@ public final class DefaultNextObjective implements NextObjective { this.id = builder.id; this.op = builder.op; this.context = Optional.ofNullable(builder.context); + this.meta = builder.meta; } @Override @@ -94,6 +97,11 @@ public final class DefaultNextObjective implements NextObjective { return context; } + @Override + public TrafficSelector meta() { + return meta; + } + /** * Returns a new builder. * @@ -111,6 +119,7 @@ public final class DefaultNextObjective implements NextObjective { private List<TrafficTreatment> treatments; private Operation op; private ObjectiveContext context; + private TrafficSelector meta; private final ImmutableList.Builder<TrafficTreatment> listBuilder = ImmutableList.builder(); @@ -172,6 +181,12 @@ public final class DefaultNextObjective implements NextObjective { } @Override + public Builder setMeta(TrafficSelector meta) { + this.meta = meta; + return this; + } + + @Override public NextObjective add() { treatments = listBuilder.build(); op = Operation.ADD; @@ -218,5 +233,55 @@ public final class DefaultNextObjective implements NextObjective { 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); + } + } + } |