From: Pramila Singh Date: Thu, 18 Jul 2013 21:10:41 +0000 (-0700) Subject: Fix for Switchmanager Save Configuration. X-Git-Tag: releasepom-0.1.0~271^2 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=f001617d840f59569631025f74271fd1bd0932d7 Fix for Switchmanager Save Configuration. Signed-off-by: Pramila Singh --- diff --git a/opendaylight/switchmanager/implementation/src/main/java/org/opendaylight/controller/switchmanager/internal/SwitchManagerImpl.java b/opendaylight/switchmanager/implementation/src/main/java/org/opendaylight/controller/switchmanager/internal/SwitchManagerImpl.java index 9ff3f91850..c24c93c65d 100644 --- a/opendaylight/switchmanager/implementation/src/main/java/org/opendaylight/controller/switchmanager/internal/SwitchManagerImpl.java +++ b/opendaylight/switchmanager/implementation/src/main/java/org/opendaylight/controller/switchmanager/internal/SwitchManagerImpl.java @@ -93,13 +93,15 @@ CommandProvider { private String subnetFileName = null, spanFileName = null, switchConfigFileName = null; private final List spanNodeConnectors = new CopyOnWriteArrayList(); - private ConcurrentMap subnets; // set of Subnets keyed by the InetAddress + // set of Subnets keyed by the InetAddress + private ConcurrentMap subnets; private ConcurrentMap subnetsConfigList; private ConcurrentMap spanConfigList; - private ConcurrentMap nodeConfigList; // manually configured parameters for the node like name and tier + // manually configured parameters for the node such as name, tier, mode + private ConcurrentMap nodeConfigList; private ConcurrentMap configSaveEvent; - private ConcurrentMap> nodeProps; // properties are maintained in global container only - private ConcurrentMap> nodeConnectorProps; // properties are maintained in global container only + private ConcurrentMap> nodeProps; + private ConcurrentMap> nodeConnectorProps; private ConcurrentMap> nodeConnectorNames; private IInventoryService inventoryService; private final Set switchManagerAware = Collections @@ -662,40 +664,30 @@ CommandProvider { modeChange = true; } - try { - String nodeId = cfgObject.getNodeId(); - Node node = Node.fromString(nodeId); - Map propMapCurr = nodeProps.get(node); - Map propMap = new HashMap(); - if (propMapCurr != null) { - for (String s : propMapCurr.keySet()) { - propMap.put(s, propMapCurr.get(s).clone()); - } - } - Property desc = new Description(cfgObject.getNodeDescription()); - propMap.put(desc.getName(), desc); - Property tier = new Tier(Integer.parseInt(cfgObject.getTier())); - propMap.put(tier.getName(), tier); + String nodeId = cfgObject.getNodeId(); + Node node = Node.fromString(nodeId); + Map propMapCurr = nodeProps.get(node); + if (propMapCurr == null) { + return; + } + Map propMap = new HashMap(); + for (String s : propMapCurr.keySet()) { + propMap.put(s, propMapCurr.get(s).clone()); + } + Property desc = new Description(cfgObject.getNodeDescription()); + propMap.put(desc.getName(), desc); + Property tier = new Tier(Integer.parseInt(cfgObject.getTier())); + propMap.put(tier.getName(), tier); - if (propMapCurr == null) { - if (nodeProps.putIfAbsent(node, propMap) != null) { - // TODO rollback using Transactionality - return; - } - } else { - if (!nodeProps.replace(node, propMapCurr, propMap)) { - // TODO rollback using Transactionality - return; - } - } + if (!nodeProps.replace(node, propMapCurr, propMap)) { + // TODO rollback using Transactionality + return; + } - log.info("Set Node {}'s Mode to {}", nodeId, cfgObject.getMode()); + log.info("Set Node {}'s Mode to {}", nodeId, cfgObject.getMode()); - if (modeChange) { - notifyModeChange(node, cfgObject.isProactive()); - } - } catch (Exception e) { - log.debug("updateSwitchConfig: {}", e.getMessage()); + if (modeChange) { + notifyModeChange(node, cfgObject.isProactive()); } }