public boolean installInHw() {
if (installInHw == null) {
// backward compatibility
- installInHw = "true";
+ installInHw = Boolean.toString(true);
}
- return installInHw.equals("true");
+ return Boolean.valueOf(installInHw);
}
public void setInstallInHw(boolean inHw) {
- installInHw = inHw ? "true" : "false";
+ installInHw = String.valueOf(inHw);
}
public String getInstallInHw() {
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())) {
}
}
+ 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));
return new Status(StatusCode.BADREQUEST, msg);
}
}
+ } else {
+ String msg = String.format("Output port %s is not valid", t);
+ return new Status(StatusCode.BADREQUEST, msg);
}
}
continue;
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) {
}
public void toggleInstallation() {
- installInHw = (installInHw == null) ? "true" : (installInHw.equals("true")) ? "false" : "true";
+ installInHw = (installInHw == null) ? Boolean.toString(false) : Boolean.toString(!Boolean.valueOf(installInHw));
}
/*