X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fforwarding%2Fstaticrouting%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fforwarding%2Fstaticrouting%2FStaticRouteConfig.java;h=7726c0f4e78c3bc9684e0384e13da23fb1e9d9b2;hp=a4505c8b1c8e6a732127de0aebbb4746874aacee;hb=a360d770ab0e49dbaed475178e9b5c1569ee8fca;hpb=ed237395f6e2e4834f20c982ab1a4a1a7260b18a diff --git a/opendaylight/forwarding/staticrouting/src/main/java/org/opendaylight/controller/forwarding/staticrouting/StaticRouteConfig.java b/opendaylight/forwarding/staticrouting/src/main/java/org/opendaylight/controller/forwarding/staticrouting/StaticRouteConfig.java index a4505c8b1c..7726c0f4e7 100644 --- a/opendaylight/forwarding/staticrouting/src/main/java/org/opendaylight/controller/forwarding/staticrouting/StaticRouteConfig.java +++ b/opendaylight/forwarding/staticrouting/src/main/java/org/opendaylight/controller/forwarding/staticrouting/StaticRouteConfig.java @@ -18,6 +18,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import org.opendaylight.controller.configuration.ConfigurationObject; import org.opendaylight.controller.sal.utils.GUIField; import org.opendaylight.controller.sal.utils.Status; import org.opendaylight.controller.sal.utils.StatusCode; @@ -25,7 +26,7 @@ import org.opendaylight.controller.sal.utils.StatusCode; /** * This class defines all the necessary configuration information for a static route. */ -public class StaticRouteConfig implements Serializable { +public class StaticRouteConfig extends ConfigurationObject implements Serializable { private static final long serialVersionUID = 1L; private static final String regexSubnet = "^([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\." + "([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\." @@ -150,7 +151,7 @@ public class StaticRouteConfig implements Serializable { * @return SUCCESS if the config is valid */ public Status isValid() { - if ((name == null) || (name.trim().length() < 1)) { + if (!isValidResourceName(name)) { return new Status(StatusCode.BADREQUEST, "Invalid Static Route name"); } @@ -207,8 +208,9 @@ public class StaticRouteConfig implements Serializable { if (getNextHopType().equalsIgnoreCase( StaticRoute.NextHopType.SWITCHPORT.toString())) { String pieces[] = nextHop.split("/"); - if (pieces.length < 2) + if (pieces.length < 2) { return false; + } return isValidSwitchId(pieces[0]); } return false; @@ -350,20 +352,26 @@ public class StaticRouteConfig implements Serializable { } StaticRouteConfig other = (StaticRouteConfig) obj; if (name == null) { - if (other.name != null) + if (other.name != null) { return false; - } else if (!name.equals(other.name)) + } + } else if (!name.equals(other.name)) { return false; + } if (nextHop == null) { - if (other.nextHop != null) + if (other.nextHop != null) { return false; - } else if (!nextHop.equals(other.nextHop)) + } + } else if (!nextHop.equals(other.nextHop)) { return false; + } if (staticRoute == null) { - if (other.staticRoute != null) + if (other.staticRoute != null) { return false; - } else if (!staticRoute.equals(other.staticRoute)) + } + } else if (!staticRoute.equals(other.staticRoute)) { return false; + } return true; }