Code Review
/
controller.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Merge "Fix: IPProtocols not parsing correctly"
[controller.git]
/
opendaylight
/
forwardingrulesmanager
/
api
/
src
/
main
/
java
/
org
/
opendaylight
/
controller
/
forwardingrulesmanager
/
FlowConfig.java
diff --git
a/opendaylight/forwardingrulesmanager/api/src/main/java/org/opendaylight/controller/forwardingrulesmanager/FlowConfig.java
b/opendaylight/forwardingrulesmanager/api/src/main/java/org/opendaylight/controller/forwardingrulesmanager/FlowConfig.java
index ba69c8a3d29f8286f2d4f3157f6547a8f54c717b..e0b8e9a786878fe6af6b67dd04aeee52958118db 100644
(file)
--- a/
opendaylight/forwardingrulesmanager/api/src/main/java/org/opendaylight/controller/forwardingrulesmanager/FlowConfig.java
+++ b/
opendaylight/forwardingrulesmanager/api/src/main/java/org/opendaylight/controller/forwardingrulesmanager/FlowConfig.java
@@
-655,6
+655,11
@@
public class FlowConfig implements Serializable {
return ((to >= 0) && (to <= 0xffff));
}
return ((to >= 0) && (to <= 0xffff));
}
+ public boolean isProtocolValid(String protocol) {
+ IPProtocols proto = IPProtocols.fromString(protocol);
+ return (proto != null);
+ }
+
private Status conflictWithContainerFlow(IContainer container) {
// Return true if it's default container
if (container.getName().equals(GlobalConstants.DEFAULT.toString())) {
private Status conflictWithContainerFlow(IContainer container) {
// Return true if it's default container
if (container.getName().equals(GlobalConstants.DEFAULT.toString())) {
@@
-762,6
+767,10
@@
public class FlowConfig implements Serializable {
}
}
}
}
+ if ((protocol != null) && !isProtocolValid(protocol)) {
+ return new Status(StatusCode.BADREQUEST, String.format("Protocol %s is not valid", protocol));
+ }
+
if ((tosBits != null) && !isTOSBitsValid(tosBits)) {
return new Status(StatusCode.BADREQUEST, String.format("IP ToS bits %s is not in the range 0 - 63",
tosBits));
if ((tosBits != null) && !isTOSBitsValid(tosBits)) {
return new Status(StatusCode.BADREQUEST, String.format("IP ToS bits %s is not in the range 0 - 63",
tosBits));
@@
-1021,7
+1030,7
@@
public class FlowConfig implements Serializable {
mask = NetUtils.getInetNetworkMask(maskLen, ip instanceof Inet6Address);
match.setField(MatchType.NW_DST, ip, mask);
}
mask = NetUtils.getInetNetworkMask(maskLen, ip instanceof Inet6Address);
match.setField(MatchType.NW_DST, ip, mask);
}
- if (
this.protocol != null
) {
+ if (
IPProtocols.fromString(this.protocol) != IPProtocols.ANY
) {
match.setField(MatchType.NW_PROTO, IPProtocols.getProtocolNumberByte(this.protocol));
}
if (this.tosBits != null) {
match.setField(MatchType.NW_PROTO, IPProtocols.getProtocolNumberByte(this.protocol));
}
if (this.tosBits != null) {