Fix for the Issue - flow rules greater than max-priority ONOS-4613 .
Change-Id: I3bb873b9a263f77ff7c687cbe3506f49b1d72c1c
Showing
2 changed files
with
11 additions
and
9 deletions
... | @@ -101,10 +101,10 @@ public class DefaultFlowRule implements FlowRule { | ... | @@ -101,10 +101,10 @@ public class DefaultFlowRule implements FlowRule { |
101 | ApplicationId appId, int timeout, boolean permanent, | 101 | ApplicationId appId, int timeout, boolean permanent, |
102 | FlowRuleExtPayLoad payLoad) { | 102 | FlowRuleExtPayLoad payLoad) { |
103 | 103 | ||
104 | - if (priority < FlowRule.MIN_PRIORITY) { | 104 | + checkArgument(priority >= MIN_PRIORITY, "Priority cannot be less than " + |
105 | - throw new IllegalArgumentException("Priority cannot be less than " | 105 | + MIN_PRIORITY); |
106 | - + MIN_PRIORITY); | 106 | + checkArgument(priority <= MAX_PRIORITY, "Priority cannot be greater than " + |
107 | - } | 107 | + MAX_PRIORITY); |
108 | 108 | ||
109 | this.deviceId = deviceId; | 109 | this.deviceId = deviceId; |
110 | this.priority = priority; | 110 | this.priority = priority; |
... | @@ -148,10 +148,10 @@ public class DefaultFlowRule implements FlowRule { | ... | @@ -148,10 +148,10 @@ public class DefaultFlowRule implements FlowRule { |
148 | ApplicationId appId, GroupId groupId, int timeout, | 148 | ApplicationId appId, GroupId groupId, int timeout, |
149 | boolean permanent, FlowRuleExtPayLoad payLoad) { | 149 | boolean permanent, FlowRuleExtPayLoad payLoad) { |
150 | 150 | ||
151 | - if (priority < FlowRule.MIN_PRIORITY) { | 151 | + checkArgument(priority >= MIN_PRIORITY, "Priority cannot be less than " + |
152 | - throw new IllegalArgumentException("Priority cannot be less than " | 152 | + MIN_PRIORITY); |
153 | - + MIN_PRIORITY); | 153 | + checkArgument(priority <= MAX_PRIORITY, "Priority cannot be greater than " + |
154 | - } | 154 | + MAX_PRIORITY); |
155 | 155 | ||
156 | this.deviceId = deviceId; | 156 | this.deviceId = deviceId; |
157 | this.priority = priority; | 157 | this.priority = priority; |
... | @@ -373,6 +373,8 @@ public class DefaultFlowRule implements FlowRule { | ... | @@ -373,6 +373,8 @@ public class DefaultFlowRule implements FlowRule { |
373 | checkNotNull(priority, "Priority cannot be null"); | 373 | checkNotNull(priority, "Priority cannot be null"); |
374 | checkArgument(priority >= MIN_PRIORITY, "Priority cannot be less than " + | 374 | checkArgument(priority >= MIN_PRIORITY, "Priority cannot be less than " + |
375 | MIN_PRIORITY); | 375 | MIN_PRIORITY); |
376 | + checkArgument(priority <= MAX_PRIORITY, "Priority cannot be greater than " + | ||
377 | + MAX_PRIORITY); | ||
376 | 378 | ||
377 | // Computing a flow ID based on appId takes precedence over setting | 379 | // Computing a flow ID based on appId takes precedence over setting |
378 | // the flow ID directly | 380 | // the flow ID directly | ... | ... |
... | @@ -27,7 +27,7 @@ public interface FlowRule { | ... | @@ -27,7 +27,7 @@ public interface FlowRule { |
27 | 27 | ||
28 | int MAX_TIMEOUT = 60; | 28 | int MAX_TIMEOUT = 60; |
29 | int MIN_PRIORITY = 0; | 29 | int MIN_PRIORITY = 0; |
30 | - | 30 | + int MAX_PRIORITY = 65535; |
31 | /** | 31 | /** |
32 | * Returns the ID of this flow. | 32 | * Returns the ID of this flow. |
33 | * | 33 | * | ... | ... |
-
Please register or login to post a comment