Jayasree Ghosh
Committed by Charles Chan

ONOS-4635:Fix Issue with add flows using flowobjective-forward REST API with incorrect priority

cherry-picked from https://gerrit.onosproject.org/#/c/9815/

Change-Id: I9637c6c0fa6906146fe6d60403c1b540b3e5531c
......@@ -272,6 +272,8 @@ public final class DefaultFilteringObjective implements FilteringObjective {
checkNotNull(type, "Must have a type.");
checkArgument(!conditions.isEmpty(), "Must have at least one condition.");
checkNotNull(appId, "Must supply an application id");
checkArgument(priority <= MAX_PRIORITY && priority >= MIN_PRIORITY, "Priority " +
"out of range");
return new DefaultFilteringObjective(this);
}
......
......@@ -284,6 +284,8 @@ public final class DefaultForwardingObjective implements ForwardingObjective {
"least a treatment and/or a nextId");
checkNotNull(appId, "Must supply an application id");
op = Operation.ADD;
checkArgument(priority <= MAX_PRIORITY && priority >= MIN_PRIORITY, "Priority " +
"out of range");
return new DefaultForwardingObjective(this);
}
......
......@@ -29,6 +29,8 @@ public interface Objective {
boolean DEFAULT_PERMANENT = true;
int DEFAULT_TIMEOUT = 0;
int DEFAULT_PRIORITY = 32768;
int MIN_PRIORITY = 0;
int MAX_PRIORITY = 65535;
/**
* Type of operation.
......