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
status = updateConfig(conf, isAdding);
if(!status.isSuccess()) {
updateDatabase(conf, (!isAdding));
+ } else {
+ // update the listeners
+ Subnet subnetCurr = subnets.get(conf.getIPAddress());
+ Subnet subnet;
+ if (subnetCurr == null) {
+ subnet = new Subnet(conf);
+ } else {
+ subnet = subnetCurr.clone();
+ }
+ notifySubnetChange(subnet, isAdding);
}
}
@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");
return (desc == null /* || desc.getValue().equalsIgnoreCase("none") */) ? ""
: desc.getValue();
}
+
+ @Override
+ public Set<Switch> getConfiguredNotConnectedSwitches() {
+ Set<Switch> configuredNotConnectedSwitches = new HashSet<Switch>();
+ if (this.inventoryService == null) {
+ log.trace("inventory service not avaiable");
+ return configuredNotConnectedSwitches;
+ }
+
+ Set<Node> configuredNotConnectedNodes = this.inventoryService.getConfiguredNotConnectedNodes();
+ if (configuredNotConnectedNodes != null) {
+ for (Node node : configuredNotConnectedNodes) {
+ Switch sw = getSwitchByNode(node);
+ if (sw != null) {
+ configuredNotConnectedSwitches.add(sw);
+ }
+ }
+ }
+ return configuredNotConnectedSwitches;
+ }
+
}