Deleting the Default subnet gateway returns success 79/3479/6
authorAlessandro Boch <aboch@cisco.com>
Thu, 5 Dec 2013 06:15:53 +0000 (22:15 -0800)
committerGerrit Code Review <gerrit@opendaylight.org>
Tue, 10 Dec 2013 00:03:19 +0000 (00:03 +0000)
- Need to let caller know this operation is not allowed

Change-Id: I7ad0f9e4874491bd15fa558248e5742f7aa466d5
Signed-off-by: Alessandro Boch <aboch@cisco.com>
opendaylight/switchmanager/implementation/src/main/java/org/opendaylight/controller/switchmanager/internal/SwitchManager.java

index 4950cae33a9fc37813afb963250e31a5ff71e824..217b8d46904aad44eee3ed399b2651d77826da0e 100644 (file)
@@ -461,6 +461,10 @@ public class SwitchManager implements ISwitchManager, IConfigurationContainerAwa
             if (!status.isSuccess()) {
                 return status;
             }
+        } else {
+            if (conf.getName().equals(DEFAULT_SUBNET_NAME)) {
+                return new Status(StatusCode.NOTALLOWED, "The specified subnet gateway cannot be removed");
+            }
         }
 
         // Update Database
@@ -492,6 +496,9 @@ public class SwitchManager implements ISwitchManager, IConfigurationContainerAwa
 
     @Override
     public Status removeSubnet(String name) {
+        if (name.equals(DEFAULT_SUBNET_NAME)) {
+            return new Status(StatusCode.NOTALLOWED, "The specified subnet gateway cannot be removed");
+        }
         SubnetConfig conf = subnetsConfigList.get(name);
         if (conf == null) {
             return new Status(StatusCode.SUCCESS, "Subnet not present");