From bb1a64b9181b790bdabc4a0861e8e49d8d9a8e1e Mon Sep 17 00:00:00 2001 From: Alessandro Boch Date: Wed, 4 Dec 2013 22:15:53 -0800 Subject: [PATCH] Deleting the Default subnet gateway returns success - Need to let caller know this operation is not allowed Change-Id: I7ad0f9e4874491bd15fa558248e5742f7aa466d5 Signed-off-by: Alessandro Boch --- .../controller/switchmanager/internal/SwitchManager.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/opendaylight/switchmanager/implementation/src/main/java/org/opendaylight/controller/switchmanager/internal/SwitchManager.java b/opendaylight/switchmanager/implementation/src/main/java/org/opendaylight/controller/switchmanager/internal/SwitchManager.java index 4950cae33a..217b8d4690 100644 --- a/opendaylight/switchmanager/implementation/src/main/java/org/opendaylight/controller/switchmanager/internal/SwitchManager.java +++ b/opendaylight/switchmanager/implementation/src/main/java/org/opendaylight/controller/switchmanager/internal/SwitchManager.java @@ -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"); -- 2.36.6