Kavitha Alagesan

Fix for the Issue - flow rules greater than max-priority ONOS-4613 .

Change-Id: I8870eb5f8840ed2f04cfac3b5c70d6bd7f249a1d
...@@ -106,10 +106,10 @@ public class DefaultFlowRule implements FlowRule { ...@@ -106,10 +106,10 @@ public class DefaultFlowRule implements FlowRule {
106 ApplicationId appId, int timeout, boolean permanent, 106 ApplicationId appId, int timeout, boolean permanent,
107 FlowRuleExtPayLoad payLoad) { 107 FlowRuleExtPayLoad payLoad) {
108 108
109 - if (priority < FlowRule.MIN_PRIORITY) { 109 + checkArgument(priority >= MIN_PRIORITY, "Priority cannot be less than " +
110 - throw new IllegalArgumentException("Priority cannot be less than " 110 + MIN_PRIORITY);
111 - + MIN_PRIORITY); 111 + checkArgument(priority <= MAX_PRIORITY, "Priority cannot be greater than " +
112 - } 112 + MAX_PRIORITY);
113 113
114 this.deviceId = deviceId; 114 this.deviceId = deviceId;
115 this.priority = priority; 115 this.priority = priority;
...@@ -153,10 +153,10 @@ public class DefaultFlowRule implements FlowRule { ...@@ -153,10 +153,10 @@ public class DefaultFlowRule implements FlowRule {
153 ApplicationId appId, GroupId groupId, int timeout, 153 ApplicationId appId, GroupId groupId, int timeout,
154 boolean permanent, FlowRuleExtPayLoad payLoad) { 154 boolean permanent, FlowRuleExtPayLoad payLoad) {
155 155
156 - if (priority < FlowRule.MIN_PRIORITY) { 156 + checkArgument(priority >= MIN_PRIORITY, "Priority cannot be less than " +
157 - throw new IllegalArgumentException("Priority cannot be less than " 157 + MIN_PRIORITY);
158 - + MIN_PRIORITY); 158 + checkArgument(priority <= MAX_PRIORITY, "Priority cannot be greater than " +
159 - } 159 + MAX_PRIORITY);
160 160
161 this.deviceId = deviceId; 161 this.deviceId = deviceId;
162 this.priority = priority; 162 this.priority = priority;
...@@ -379,7 +379,8 @@ public class DefaultFlowRule implements FlowRule { ...@@ -379,7 +379,8 @@ public class DefaultFlowRule implements FlowRule {
379 checkNotNull(priority, "Priority cannot be null"); 379 checkNotNull(priority, "Priority cannot be null");
380 checkArgument(priority >= MIN_PRIORITY, "Priority cannot be less than " + 380 checkArgument(priority >= MIN_PRIORITY, "Priority cannot be less than " +
381 MIN_PRIORITY); 381 MIN_PRIORITY);
382 - 382 + checkArgument(priority <= MAX_PRIORITY, "Priority cannot be greater than " +
383 + MAX_PRIORITY);
383 // Computing a flow ID based on appId takes precedence over setting 384 // Computing a flow ID based on appId takes precedence over setting
384 // the flow ID directly 385 // the flow ID directly
385 if (appId != null) { 386 if (appId != null) {
......
...@@ -27,6 +27,7 @@ public interface FlowRule { ...@@ -27,6 +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 + int MAX_PRIORITY = 65535;
30 31
31 /** 32 /**
32 * Returns the ID of this flow. 33 * Returns the ID of this flow.
......