Committed by
Gerrit Code Review
Added a TrafficTreatment to the filtering objective to cover those
pipelines where the filtering action is accompanied by a corresponding change to the permitted packet. Fixed Filtering Objective javadocs. Change-Id: I7f3c1a1a3553c0fdbfe5e7e48c6426cde1602efd
Showing
2 changed files
with
60 additions
and
21 deletions
| ... | @@ -18,6 +18,7 @@ package org.onosproject.net.flowobjective; | ... | @@ -18,6 +18,7 @@ package org.onosproject.net.flowobjective; |
| 18 | import com.google.common.annotations.Beta; | 18 | import com.google.common.annotations.Beta; |
| 19 | import com.google.common.collect.ImmutableList; | 19 | import com.google.common.collect.ImmutableList; |
| 20 | import org.onosproject.core.ApplicationId; | 20 | import org.onosproject.core.ApplicationId; |
| 21 | +import org.onosproject.net.flow.TrafficTreatment; | ||
| 21 | import org.onosproject.net.flow.criteria.Criteria; | 22 | import org.onosproject.net.flow.criteria.Criteria; |
| 22 | import org.onosproject.net.flow.criteria.Criterion; | 23 | import org.onosproject.net.flow.criteria.Criterion; |
| 23 | 24 | ||
| ... | @@ -46,6 +47,7 @@ public final class DefaultFilteringObjective implements FilteringObjective { | ... | @@ -46,6 +47,7 @@ public final class DefaultFilteringObjective implements FilteringObjective { |
| 46 | private final int id; | 47 | private final int id; |
| 47 | private final Operation op; | 48 | private final Operation op; |
| 48 | private final Optional<ObjectiveContext> context; | 49 | private final Optional<ObjectiveContext> context; |
| 50 | + private final TrafficTreatment meta; | ||
| 49 | 51 | ||
| 50 | private DefaultFilteringObjective(Builder builder) { | 52 | private DefaultFilteringObjective(Builder builder) { |
| 51 | this.key = builder.key; | 53 | this.key = builder.key; |
| ... | @@ -57,6 +59,7 @@ public final class DefaultFilteringObjective implements FilteringObjective { | ... | @@ -57,6 +59,7 @@ public final class DefaultFilteringObjective implements FilteringObjective { |
| 57 | this.conditions = builder.conditions; | 59 | this.conditions = builder.conditions; |
| 58 | this.op = builder.op; | 60 | this.op = builder.op; |
| 59 | this.context = Optional.ofNullable(builder.context); | 61 | this.context = Optional.ofNullable(builder.context); |
| 62 | + this.meta = builder.meta; | ||
| 60 | 63 | ||
| 61 | this.id = Objects.hash(type, key, conditions, permanent, | 64 | this.id = Objects.hash(type, key, conditions, permanent, |
| 62 | timeout, appId, priority); | 65 | timeout, appId, priority); |
| ... | @@ -83,6 +86,12 @@ public final class DefaultFilteringObjective implements FilteringObjective { | ... | @@ -83,6 +86,12 @@ public final class DefaultFilteringObjective implements FilteringObjective { |
| 83 | } | 86 | } |
| 84 | 87 | ||
| 85 | @Override | 88 | @Override |
| 89 | + public TrafficTreatment meta() { | ||
| 90 | + return meta; | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + | ||
| 94 | + @Override | ||
| 86 | public int priority() { | 95 | public int priority() { |
| 87 | return priority; | 96 | return priority; |
| 88 | } | 97 | } |
| ... | @@ -135,6 +144,7 @@ public final class DefaultFilteringObjective implements FilteringObjective { | ... | @@ -135,6 +144,7 @@ public final class DefaultFilteringObjective implements FilteringObjective { |
| 135 | private List<Criterion> conditions; | 144 | private List<Criterion> conditions; |
| 136 | private Operation op; | 145 | private Operation op; |
| 137 | private ObjectiveContext context; | 146 | private ObjectiveContext context; |
| 147 | + private TrafficTreatment meta; | ||
| 138 | 148 | ||
| 139 | @Override | 149 | @Override |
| 140 | public Builder withKey(Criterion key) { | 150 | public Builder withKey(Criterion key) { |
| ... | @@ -186,6 +196,12 @@ public final class DefaultFilteringObjective implements FilteringObjective { | ... | @@ -186,6 +196,12 @@ public final class DefaultFilteringObjective implements FilteringObjective { |
| 186 | } | 196 | } |
| 187 | 197 | ||
| 188 | @Override | 198 | @Override |
| 199 | + public Builder setMeta(TrafficTreatment treatment) { | ||
| 200 | + this.meta = treatment; | ||
| 201 | + return this; | ||
| 202 | + } | ||
| 203 | + | ||
| 204 | + @Override | ||
| 189 | public FilteringObjective add() { | 205 | public FilteringObjective add() { |
| 190 | conditions = listBuilder.build(); | 206 | conditions = listBuilder.build(); |
| 191 | op = Operation.ADD; | 207 | op = Operation.ADD; | ... | ... |
| ... | @@ -17,49 +17,54 @@ package org.onosproject.net.flowobjective; | ... | @@ -17,49 +17,54 @@ package org.onosproject.net.flowobjective; |
| 17 | 17 | ||
| 18 | import com.google.common.annotations.Beta; | 18 | import com.google.common.annotations.Beta; |
| 19 | import org.onosproject.core.ApplicationId; | 19 | import org.onosproject.core.ApplicationId; |
| 20 | +import org.onosproject.net.flow.TrafficTreatment; | ||
| 20 | import org.onosproject.net.flow.criteria.Criterion; | 21 | import org.onosproject.net.flow.criteria.Criterion; |
| 21 | 22 | ||
| 22 | import java.util.Collection; | 23 | import java.util.Collection; |
| 23 | 24 | ||
| 24 | /** | 25 | /** |
| 25 | * Represents a filtering flow objective. Each filtering flow objective | 26 | * Represents a filtering flow objective. Each filtering flow objective |
| 26 | - * is made up of a key (criterion) to a set of criteria. Using this information | 27 | + * is made up of a key (typically a PortCriterion) mapped to a set of criteria. |
| 27 | - * a pipeline aware driver will decide how this objective should be mapped | 28 | + * Using this information, a pipeline aware driver will decide how this objective |
| 28 | - * to the specific device pipeline. For example, consider the following | 29 | + * should be mapped to the device specific pipeline-tables in order to satisfy the |
| 29 | - * filtering objective: | 30 | + * filtering condition. For example, consider the following PERMIT filtering |
| 30 | - * | 31 | + * objective: |
| 31 | - * portX -> {MAC1, IP1, MAC2} | 32 | + * <p> |
| 32 | - * | 33 | + * portX -> {MAC1, VLAN1} |
| 33 | - * The driver could decide to pass L3 packet to the L3 table and L2 packets to | 34 | + * <p> |
| 34 | - * the L2 table for packets arriving on portX. | 35 | + * The driver could decide to pass packets to the MAC table or VLAN or PORT |
| 35 | - * | 36 | + * tables to ensure that only those packets arriving with the correct dst MAC |
| 36 | - * Filtering objectives do not only represent what should be permitted into the | 37 | + * and VLAN ids from Port X are allowed into the pipeline. |
| 37 | - * pipeline but can also be used to deny or drop unwanted packets by specifying | 38 | + * <p> |
| 38 | - * the appropriate type of filtering objective. It is also important to note | 39 | + * Filtering objectives of type PERMIT allow packets that match the key:criteria |
| 39 | - * that submitting a filtering objective does not necessarily result in rules | 40 | + * to enter the pipeline. As a result, the implication is that packets that don't |
| 40 | - * programmed at the switch, the driver is free to decide when these rules are | 41 | + * match are automatically denied (dropped). |
| 41 | - * programmed. For example, a filtering rule may only be programmed once a | 42 | + * <p> |
| 42 | - * corresponding forwarding objective has been received. | 43 | + * Filtering objectives of type DENY, are used to deny packets that would |
| 44 | + * otherwise be permitted and forwarded through the pipeline (ie. those packets | ||
| 45 | + * that make it through the PERMIT filters). | ||
| 43 | */ | 46 | */ |
| 44 | @Beta | 47 | @Beta |
| 45 | public interface FilteringObjective extends Objective { | 48 | public interface FilteringObjective extends Objective { |
| 46 | 49 | ||
| 47 | enum Type { | 50 | enum Type { |
| 48 | /** | 51 | /** |
| 49 | - * Enables the filtering condition. | 52 | + * Permits packets that match the filtering condition to be processed |
| 53 | + * by the rest of the pipeline. Automatically denies packets that don't | ||
| 54 | + * match the criteria. | ||
| 50 | */ | 55 | */ |
| 51 | PERMIT, | 56 | PERMIT, |
| 52 | 57 | ||
| 53 | /** | 58 | /** |
| 54 | - * Disables the filtering condition. | 59 | + * Denies packets that make it through the permit filters. |
| 55 | */ | 60 | */ |
| 56 | DENY | 61 | DENY |
| 57 | } | 62 | } |
| 58 | 63 | ||
| 59 | /** | 64 | /** |
| 60 | - * Obtain the key for this filter. | 65 | + * Obtain the key for this filter. The filter may or may not require a key. |
| 61 | * | 66 | * |
| 62 | - * @return a criterion | 67 | + * @return a criterion, which could be null if no key was provided. |
| 63 | */ | 68 | */ |
| 64 | Criterion key(); | 69 | Criterion key(); |
| 65 | 70 | ||
| ... | @@ -78,6 +83,16 @@ public interface FilteringObjective extends Objective { | ... | @@ -78,6 +83,16 @@ public interface FilteringObjective extends Objective { |
| 78 | Collection<Criterion> conditions(); | 83 | Collection<Criterion> conditions(); |
| 79 | 84 | ||
| 80 | /** | 85 | /** |
| 86 | + * Auxiliary optional information provided to the device-driver.Typically | ||
| 87 | + * conveys information about changes (treatments) to packets that are | ||
| 88 | + * permitted into the pipeline by the PERMIT filtering condition. | ||
| 89 | + * | ||
| 90 | + * @return a treatment on the packets that make it through the PERMIT filters. | ||
| 91 | + * Value may be null if no meta information is provided. | ||
| 92 | + */ | ||
| 93 | + TrafficTreatment meta(); | ||
| 94 | + | ||
| 95 | + /** | ||
| 81 | * Builder of Filtering objective entities. | 96 | * Builder of Filtering objective entities. |
| 82 | */ | 97 | */ |
| 83 | interface Builder extends Objective.Builder { | 98 | interface Builder extends Objective.Builder { |
| ... | @@ -113,11 +128,19 @@ public interface FilteringObjective extends Objective { | ... | @@ -113,11 +128,19 @@ public interface FilteringObjective extends Objective { |
| 113 | Builder deny(); | 128 | Builder deny(); |
| 114 | 129 | ||
| 115 | /** | 130 | /** |
| 131 | + * Set meta information about this filtering condition set. | ||
| 132 | + * | ||
| 133 | + * @return a filtering builder | ||
| 134 | + */ | ||
| 135 | + Builder setMeta(TrafficTreatment treatment); | ||
| 136 | + | ||
| 137 | + /** | ||
| 116 | * Assigns an application id. | 138 | * Assigns an application id. |
| 117 | * | 139 | * |
| 118 | * @param appId an application id | 140 | * @param appId an application id |
| 119 | * @return a filtering builder | 141 | * @return a filtering builder |
| 120 | */ | 142 | */ |
| 143 | + @Override | ||
| 121 | Builder fromApp(ApplicationId appId); | 144 | Builder fromApp(ApplicationId appId); |
| 122 | 145 | ||
| 123 | /** | 146 | /** | ... | ... |
-
Please register or login to post a comment