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

Change-Id: I8870eb5f8840ed2f04cfac3b5c70d6bd7f249a1d
diff --git a/core/api/src/main/java/org/onosproject/net/flow/DefaultFlowRule.java b/core/api/src/main/java/org/onosproject/net/flow/DefaultFlowRule.java
index 313cbfc..f94c8a7 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/DefaultFlowRule.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/DefaultFlowRule.java
@@ -106,10 +106,10 @@
                            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;
@@ -153,10 +153,10 @@
                            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;
@@ -379,7 +379,8 @@
             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
             if (appId != null) {