Subnet gw can be configured w/o name 69/2469/3
authorAlessandro Boch <aboch@cisco.com>
Wed, 6 Nov 2013 22:30:36 +0000 (14:30 -0800)
committerGerrit Code Review <gerrit@opendaylight.org>
Thu, 7 Nov 2013 10:39:28 +0000 (10:39 +0000)
Change-Id: I11b58948005e3ecf7068ac5b70926cb3f1fce36d
Signed-off-by: Alessandro Boch <aboch@cisco.com>
opendaylight/switchmanager/api/src/main/java/org/opendaylight/controller/switchmanager/SubnetConfig.java

index 577c039..189476a 100644 (file)
@@ -127,10 +127,20 @@ public class SubnetConfig implements Cloneable, Serializable {
         return new Status(StatusCode.SUCCESS);
     }
 
+    private Status validateName() {
+        if (name == null || name.trim().isEmpty()) {
+            return new Status(StatusCode.BADREQUEST, "Invalid name");
+        }
+        return new Status(StatusCode.SUCCESS);
+    }
+
     public Status validate() {
-        Status status = validateSubnetAddress();
+        Status status = validateName();
         if (status.isSuccess()) {
-            status = validatePorts(this.nodeConnectors);
+            status = validateSubnetAddress();
+            if (status.isSuccess()) {
+                status = validatePorts(this.nodeConnectors);
+            }
         }
         return status;
     }