Committed by
Gerrit Code Review
ONOS-4635:Fix Issue with add flows using flowobjective-forward REST API with incorrect priority
Change-Id: I929918b61aec83c2dc2cdca456dfdb1d2d736c01
Showing
3 changed files
with
6 additions
and
0 deletions
... | @@ -272,6 +272,8 @@ public final class DefaultFilteringObjective implements FilteringObjective { | ... | @@ -272,6 +272,8 @@ public final class DefaultFilteringObjective implements FilteringObjective { |
272 | checkNotNull(type, "Must have a type."); | 272 | checkNotNull(type, "Must have a type."); |
273 | checkArgument(!conditions.isEmpty(), "Must have at least one condition."); | 273 | checkArgument(!conditions.isEmpty(), "Must have at least one condition."); |
274 | checkNotNull(appId, "Must supply an application id"); | 274 | checkNotNull(appId, "Must supply an application id"); |
275 | + checkArgument(priority <= MAX_PRIORITY && priority >= MIN_PRIORITY, "Priority " + | ||
276 | + "out of range"); | ||
275 | 277 | ||
276 | return new DefaultFilteringObjective(this); | 278 | return new DefaultFilteringObjective(this); |
277 | } | 279 | } | ... | ... |
... | @@ -266,6 +266,8 @@ public final class DefaultForwardingObjective implements ForwardingObjective { | ... | @@ -266,6 +266,8 @@ public final class DefaultForwardingObjective implements ForwardingObjective { |
266 | checkArgument(nextId != null || treatment != null, "Must supply at " + | 266 | checkArgument(nextId != null || treatment != null, "Must supply at " + |
267 | "least a treatment and/or a nextId"); | 267 | "least a treatment and/or a nextId"); |
268 | checkNotNull(appId, "Must supply an application id"); | 268 | checkNotNull(appId, "Must supply an application id"); |
269 | + checkArgument(priority <= MAX_PRIORITY && priority >= MIN_PRIORITY, "Priority " + | ||
270 | + "out of range"); | ||
269 | op = Operation.ADD; | 271 | op = Operation.ADD; |
270 | return new DefaultForwardingObjective(this); | 272 | return new DefaultForwardingObjective(this); |
271 | } | 273 | } | ... | ... |
... | @@ -29,6 +29,8 @@ public interface Objective { | ... | @@ -29,6 +29,8 @@ public interface Objective { |
29 | boolean DEFAULT_PERMANENT = true; | 29 | boolean DEFAULT_PERMANENT = true; |
30 | int DEFAULT_TIMEOUT = 0; | 30 | int DEFAULT_TIMEOUT = 0; |
31 | int DEFAULT_PRIORITY = 32768; | 31 | int DEFAULT_PRIORITY = 32768; |
32 | + int MIN_PRIORITY = 0; | ||
33 | + int MAX_PRIORITY = 65535; | ||
32 | 34 | ||
33 | /** | 35 | /** |
34 | * Type of operation. | 36 | * Type of operation. | ... | ... |
-
Please register or login to post a comment