Kavitha Alagesan

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

Change-Id: I3bb873b9a263f77ff7c687cbe3506f49b1d72c1c
......@@ -101,10 +101,10 @@ public class DefaultFlowRule implements FlowRule {
ApplicationId appId, int timeout, boolean permanent,
FlowRuleExtPayLoad payLoad) {
if (priority < FlowRule.MIN_PRIORITY) {
throw new IllegalArgumentException("Priority cannot be less than "
+ MIN_PRIORITY);
}
checkArgument(priority >= MIN_PRIORITY, "Priority cannot be less than " +
MIN_PRIORITY);
checkArgument(priority <= MAX_PRIORITY, "Priority cannot be greater than " +
MAX_PRIORITY);
this.deviceId = deviceId;
this.priority = priority;
......@@ -148,10 +148,10 @@ public class DefaultFlowRule implements FlowRule {
ApplicationId appId, GroupId groupId, int timeout,
boolean permanent, FlowRuleExtPayLoad payLoad) {
if (priority < FlowRule.MIN_PRIORITY) {
throw new IllegalArgumentException("Priority cannot be less than "
+ MIN_PRIORITY);
}
checkArgument(priority >= MIN_PRIORITY, "Priority cannot be less than " +
MIN_PRIORITY);
checkArgument(priority <= MAX_PRIORITY, "Priority cannot be greater than " +
MAX_PRIORITY);
this.deviceId = deviceId;
this.priority = priority;
......@@ -373,6 +373,8 @@ public class DefaultFlowRule implements FlowRule {
checkNotNull(priority, "Priority cannot be null");
checkArgument(priority >= MIN_PRIORITY, "Priority cannot be less than " +
MIN_PRIORITY);
checkArgument(priority <= MAX_PRIORITY, "Priority cannot be greater than " +
MAX_PRIORITY);
// Computing a flow ID based on appId takes precedence over setting
// the flow ID directly
......
......@@ -27,7 +27,7 @@ public interface FlowRule {
int MAX_TIMEOUT = 60;
int MIN_PRIORITY = 0;
int MAX_PRIORITY = 65535;
/**
* Returns the ID of this flow.
*
......