Change to update node properties 04/304/2
authorAlessandro Boch <aboch@cisco.com>
Mon, 6 May 2013 19:42:24 +0000 (12:42 -0700)
committerGerrit Code Review <gerrit@opendaylight.org>
Mon, 6 May 2013 20:16:39 +0000 (20:16 +0000)
- inventoryServiceShim to trigger node description update
- Inventory Service to accept node properties updates for known nodes only
- Inventory Service to publish only effective node properties update and on default container only
- Minor changes to the Property classes toString() methods
- Removed toString() overridden method in UpdateType as default toString() which prints the enum name is self explicative and serves better in logs
Signed-off-by: Alessandro Boch <aboch@cisco.com>
16 files changed:
opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/Activator.java
opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/InventoryService.java
opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/InventoryServiceShim.java
opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Actions.java
opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Buffers.java
opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Capabilities.java
opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Config.java
opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Latency.java
opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Name.java
opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Property.java
opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/State.java
opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Tables.java
opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/Tier.java
opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/TimeStamp.java
opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/core/UpdateType.java
opendaylight/switchmanager/implementation/src/main/java/org/opendaylight/controller/switchmanager/internal/SwitchManagerImpl.java

index 9b7d1e3bc20a07b2dc97760c08b41257dcfce4a6..30834cbe1371ca9f42f08e2160751dd51ac2079c 100644 (file)
@@ -121,7 +121,6 @@ public class Activator extends ComponentActivatorAbstractBase {
             // export the service
             c.setInterface(
                     new String[] { IPluginInInventoryService.class.getName(),
             // export the service
             c.setInterface(
                     new String[] { IPluginInInventoryService.class.getName(),
-                            IStatisticsListener.class.getName(),
                             IInventoryShimInternalListener.class.getName() },
                     null);
 
                             IInventoryShimInternalListener.class.getName() },
                     null);
 
@@ -336,8 +335,8 @@ public class Activator extends ComponentActivatorAbstractBase {
         }
 
         if (imp.equals(InventoryServiceShim.class)) {
         }
 
         if (imp.equals(InventoryServiceShim.class)) {
-            c.setInterface(new String[] { IContainerListener.class.getName() },
-                    null);
+            c.setInterface(new String[] { IContainerListener.class.getName(),
+                    IStatisticsListener.class.getName()}, null);
 
             c.add(createServiceDependency()
                     .setService(IController.class, "(name=Controller)")
 
             c.add(createServiceDependency()
                     .setService(IController.class, "(name=Controller)")
index 3a3eaad93ec5c8844e148dcdbfcdeeaa75bb6a7e..8af9b3ea058d894bf544c960bedf019256924721 100644 (file)
@@ -20,14 +20,12 @@ import java.util.concurrent.ConcurrentMap;
 
 import org.apache.felix.dm.Component;
 import org.opendaylight.controller.protocol_plugin.openflow.IInventoryShimInternalListener;
 
 import org.apache.felix.dm.Component;
 import org.opendaylight.controller.protocol_plugin.openflow.IInventoryShimInternalListener;
-import org.opendaylight.controller.protocol_plugin.openflow.IStatisticsListener;
 import org.opendaylight.controller.protocol_plugin.openflow.core.IController;
 import org.opendaylight.controller.protocol_plugin.openflow.core.ISwitch;
 import org.opendaylight.controller.sal.core.Actions;
 import org.opendaylight.controller.sal.core.Buffers;
 import org.opendaylight.controller.sal.core.Capabilities;
 import org.opendaylight.controller.sal.core.ConstructionException;
 import org.opendaylight.controller.protocol_plugin.openflow.core.IController;
 import org.opendaylight.controller.protocol_plugin.openflow.core.ISwitch;
 import org.opendaylight.controller.sal.core.Actions;
 import org.opendaylight.controller.sal.core.Buffers;
 import org.opendaylight.controller.sal.core.Capabilities;
 import org.opendaylight.controller.sal.core.ConstructionException;
-import org.opendaylight.controller.sal.core.Description;
 import org.opendaylight.controller.sal.core.Node;
 import org.opendaylight.controller.sal.core.Node.NodeIDType;
 import org.opendaylight.controller.sal.core.NodeConnector;
 import org.opendaylight.controller.sal.core.Node;
 import org.opendaylight.controller.sal.core.Node.NodeIDType;
 import org.opendaylight.controller.sal.core.NodeConnector;
@@ -38,7 +36,6 @@ import org.opendaylight.controller.sal.core.UpdateType;
 import org.opendaylight.controller.sal.inventory.IPluginInInventoryService;
 import org.opendaylight.controller.sal.inventory.IPluginOutInventoryService;
 import org.opendaylight.controller.sal.utils.GlobalConstants;
 import org.opendaylight.controller.sal.inventory.IPluginInInventoryService;
 import org.opendaylight.controller.sal.inventory.IPluginOutInventoryService;
 import org.opendaylight.controller.sal.utils.GlobalConstants;
-import org.openflow.protocol.statistics.OFDescriptionStatistics;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -51,7 +48,7 @@ import org.slf4j.LoggerFactory;
  * 
  */
 public class InventoryService implements IInventoryShimInternalListener,
  * 
  */
 public class InventoryService implements IInventoryShimInternalListener,
-        IPluginInInventoryService, IStatisticsListener {
+        IPluginInInventoryService {
     protected static final Logger logger = LoggerFactory
             .getLogger(InventoryService.class);
     private Set<IPluginOutInventoryService> pluginOutInventoryServices = Collections
     protected static final Logger logger = LoggerFactory
             .getLogger(InventoryService.class);
     private Set<IPluginOutInventoryService> pluginOutInventoryServices = Collections
@@ -142,7 +139,7 @@ public class InventoryService implements IInventoryShimInternalListener,
         try {
             node = new Node(NodeIDType.OPENFLOW, id);
         } catch (ConstructionException e) {
         try {
             node = new Node(NodeIDType.OPENFLOW, id);
         } catch (ConstructionException e) {
-            logger.error("",e);
+            logger.error("", e);
         }
 
         return node;
         }
 
         return node;
@@ -197,8 +194,9 @@ public class InventoryService implements IInventoryShimInternalListener,
     @Override
     public ConcurrentMap<NodeConnector, Map<String, Property>> getNodeConnectorProps(
             Boolean refresh) {
     @Override
     public ConcurrentMap<NodeConnector, Map<String, Property>> getNodeConnectorProps(
             Boolean refresh) {
-        if (nodeConnectorProps == null)
+        if (nodeConnectorProps == null) {
             return null;
             return null;
+        }
 
         if (isDefaultContainer && refresh) {
             Map<Long, ISwitch> switches = controller.getSwitches();
 
         if (isDefaultContainer && refresh) {
             Map<Long, ISwitch> switches = controller.getSwitches();
@@ -230,9 +228,9 @@ public class InventoryService implements IInventoryShimInternalListener,
         switch (type) {
         case ADDED:
         case CHANGED:
         switch (type) {
         case ADDED:
         case CHANGED:
-            if (propMap == null)
+            if (propMap == null) {
                 propMap = new HashMap<String, Property>();
                 propMap = new HashMap<String, Property>();
-
+            }
             if (props != null) {
                 for (Property prop : props) {
                     propMap.put(prop.getName(), prop);
             if (props != null) {
                 for (Property prop : props) {
                     propMap.put(prop.getName(), prop);
@@ -256,9 +254,10 @@ public class InventoryService implements IInventoryShimInternalListener,
     }
 
     private void addNode(Node node, Set<Property> props) {
     }
 
     private void addNode(Node node, Set<Property> props) {
-        logger.trace("{} added", node);
-        if (nodeProps == null)
+        logger.trace("{} added, props: {}", node, props);
+        if (nodeProps == null) {
             return;
             return;
+        }
 
         // update local cache
         Map<String, Property> propMap = new HashMap<String, Property>();
 
         // update local cache
         Map<String, Property> propMap = new HashMap<String, Property>();
@@ -300,31 +299,31 @@ public class InventoryService implements IInventoryShimInternalListener,
             }
         }
     }
             }
         }
     }
-
-    private void updateSwitchProperty(Long switchId, Set<Property> propSet) {
-        // update local cache
-        Node node = OFSwitchToNode(controller.getSwitch(switchId));
-        Map<String, Property> propMap = nodeProps.get(node);
-        if (propMap == null) {
-            propMap = new HashMap<String, Property>();
+    
+    private void updateNode(Node node, Set<Property> properties) {
+        logger.trace("{} updated, props: {}", node, properties);
+        if (nodeProps == null || !nodeProps.containsKey(node) ||
+                properties == null || properties.isEmpty()) {
+            return;
         }
 
         }
 
-        boolean change = false;
-        for (Property prop : propSet) {
-            String propertyName = prop.getName();
-            Property currentProp = propMap.get(propertyName);
-            if (!prop.equals(currentProp)) {
-                change = true;
-                propMap.put(propertyName, prop);
+        // Update local cache with new properties
+        Set<Property> newProperties = new HashSet<Property>(properties.size());
+        Map<String, Property> propertyMap = nodeProps.get(node);
+        for (Property property : properties) {
+            String name = property.getName();
+            Property currentProperty = propertyMap.get(name);
+            if (!property.equals(currentProperty)) {
+                propertyMap.put(name, property);
+                newProperties.add(property);                
             }
         }
             }
         }
-        nodeProps.put(node, propMap);
 
 
-        // Update sal if any of the properties has changed
-        if (change) {
+        // Update SAL if we got new properties
+        if (!newProperties.isEmpty()) {
             synchronized (pluginOutInventoryServices) {
                 for (IPluginOutInventoryService service : pluginOutInventoryServices) {
             synchronized (pluginOutInventoryServices) {
                 for (IPluginOutInventoryService service : pluginOutInventoryServices) {
-                    service.updateNode(node, UpdateType.CHANGED, propSet);
+                    service.updateNode(node, UpdateType.CHANGED, newProperties);
                 }
             }
         }
                 }
             }
         }
@@ -339,19 +338,12 @@ public class InventoryService implements IInventoryShimInternalListener,
         case REMOVED:
             removeNode(node);
             break;
         case REMOVED:
             removeNode(node);
             break;
+        case CHANGED:
+            updateNode(node, props);
+            break;
         default:
             break;
         }
     }
 
         default:
             break;
         }
     }
 
-    @Override
-    public void descriptionRefreshed(Long switchId,
-            OFDescriptionStatistics descriptionStats) {
-
-        Set<Property> propSet = new HashSet<Property>(1);
-        Description desc = new Description(
-                descriptionStats.getDatapathDescription());
-        propSet.add(desc);
-        this.updateSwitchProperty(switchId, propSet);
-    }
 }
 }
index b522063ad73fbc5bbf6239bfd829e0d26b065710..c472747a8e16eac2b421e17931f51a9d09f1b84f 100644 (file)
@@ -19,6 +19,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
 
 import org.opendaylight.controller.protocol_plugin.openflow.IInventoryShimExternalListener;
 import org.opendaylight.controller.protocol_plugin.openflow.IInventoryShimInternalListener;
 
 import org.opendaylight.controller.protocol_plugin.openflow.IInventoryShimExternalListener;
 import org.opendaylight.controller.protocol_plugin.openflow.IInventoryShimInternalListener;
+import org.opendaylight.controller.protocol_plugin.openflow.IStatisticsListener;
 import org.opendaylight.controller.protocol_plugin.openflow.core.IController;
 import org.opendaylight.controller.protocol_plugin.openflow.core.IMessageListener;
 import org.opendaylight.controller.protocol_plugin.openflow.core.ISwitch;
 import org.opendaylight.controller.protocol_plugin.openflow.core.IController;
 import org.opendaylight.controller.protocol_plugin.openflow.core.IMessageListener;
 import org.opendaylight.controller.protocol_plugin.openflow.core.ISwitch;
@@ -28,6 +29,7 @@ import org.opendaylight.controller.sal.core.Buffers;
 import org.opendaylight.controller.sal.core.Capabilities;
 import org.opendaylight.controller.sal.core.ConstructionException;
 import org.opendaylight.controller.sal.core.ContainerFlow;
 import org.opendaylight.controller.sal.core.Capabilities;
 import org.opendaylight.controller.sal.core.ConstructionException;
 import org.opendaylight.controller.sal.core.ContainerFlow;
+import org.opendaylight.controller.sal.core.Description;
 import org.opendaylight.controller.sal.core.IContainerListener;
 import org.opendaylight.controller.sal.core.Node;
 import org.opendaylight.controller.sal.core.Node.NodeIDType;
 import org.opendaylight.controller.sal.core.IContainerListener;
 import org.opendaylight.controller.sal.core.Node;
 import org.opendaylight.controller.sal.core.Node.NodeIDType;
@@ -41,6 +43,7 @@ import org.openflow.protocol.OFMessage;
 import org.openflow.protocol.OFPortStatus;
 import org.openflow.protocol.OFPortStatus.OFPortReason;
 import org.openflow.protocol.OFType;
 import org.openflow.protocol.OFPortStatus;
 import org.openflow.protocol.OFPortStatus.OFPortReason;
 import org.openflow.protocol.OFType;
+import org.openflow.protocol.statistics.OFDescriptionStatistics;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -52,7 +55,7 @@ import org.slf4j.LoggerFactory;
  * 
  */
 public class InventoryServiceShim implements IContainerListener,
  * 
  */
 public class InventoryServiceShim implements IContainerListener,
-        IMessageListener, ISwitchStateListener {
+        IMessageListener, ISwitchStateListener, IStatisticsListener {
     protected static final Logger logger = LoggerFactory
             .getLogger(InventoryServiceShim.class);
     private IController controller = null;
     protected static final Logger logger = LoggerFactory
             .getLogger(InventoryServiceShim.class);
     private IController controller = null;
@@ -351,6 +354,14 @@ public class InventoryServiceShim implements IContainerListener,
                 inventoryShimInternalListener.updateNode(node, type, null);
             }
             break;
                 inventoryShimInternalListener.updateNode(node, type, null);
             }
             break;
+        case CHANGED:
+            // Notify only the default Inventory Service
+            inventoryShimDefaultListener = inventoryShimInternalListeners
+                    .get(GlobalConstants.DEFAULT.toString());
+            if (inventoryShimDefaultListener != null) {
+                inventoryShimDefaultListener.updateNode(node, type, props);
+            }
+            break;
         default:
             break;
         }
         default:
             break;
         }
@@ -425,4 +436,26 @@ public class InventoryServiceShim implements IContainerListener,
             switchAdded(sw);
         }
     }
             switchAdded(sw);
         }
     }
+
+    @Override
+    public void descriptionRefreshed(Long switchId,
+            OFDescriptionStatistics descriptionStats) {
+        Node node;
+        try {
+            node = new Node(NodeIDType.OPENFLOW, switchId);
+        } catch (ConstructionException e) {
+            logger.error("{}", e.getMessage());
+            return;
+        }
+        
+        Set<Property> properties = new HashSet<Property>(1);
+        Description desc = new Description(
+                descriptionStats.getDatapathDescription());
+        properties.add(desc);
+        
+        // Notify all internal and external listeners
+        notifyInventoryShimListener(node, UpdateType.CHANGED, properties);
+    }  
+
+   
 }
 }
index 832c9565a5585356a5cab10029814d1ff1e5e4b2..6fb38a3a90279a898786e5c1ed1f088ad6cd5488 100644 (file)
@@ -14,7 +14,6 @@ import javax.xml.bind.annotation.XmlRootElement;
 
 import org.apache.commons.lang3.builder.EqualsBuilder;
 import org.apache.commons.lang3.builder.HashCodeBuilder;
 
 import org.apache.commons.lang3.builder.EqualsBuilder;
 import org.apache.commons.lang3.builder.HashCodeBuilder;
-import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
 
 /**
  * @file   Actions.java
 
 /**
  * @file   Actions.java
@@ -94,6 +93,6 @@ public class Actions extends Property {
 
     @Override
     public String toString() {
 
     @Override
     public String toString() {
-        return "Actions[" + ReflectionToStringBuilder.toString(this) + "]";
+        return "Actions[" + actionsValue + "]";
     }
 }
     }
 }
index 9324806ada10804a0984cae40cf6d60515a06831..91f647d45b2b1c7588355bd2880d7e58f4ce7330 100644 (file)
@@ -14,7 +14,6 @@ import javax.xml.bind.annotation.XmlRootElement;
 
 import org.apache.commons.lang3.builder.EqualsBuilder;
 import org.apache.commons.lang3.builder.HashCodeBuilder;
 
 import org.apache.commons.lang3.builder.EqualsBuilder;
 import org.apache.commons.lang3.builder.HashCodeBuilder;
-import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
 
 /**
  * @file   Buffers.java
 
 /**
  * @file   Buffers.java
@@ -70,6 +69,6 @@ public class Buffers extends Property {
 
     @Override
     public String toString() {
 
     @Override
     public String toString() {
-        return "Buffers[" + ReflectionToStringBuilder.toString(this) + "]";
+        return "Buffers[" + buffersValue + "]";
     }
 }
     }
 }
index b239ed4739cafce8d5137f641739f7c04e0adf85..d4c8cd1b56e71fd92a428db7a290f99dea1d5c00 100644 (file)
@@ -14,7 +14,6 @@ import javax.xml.bind.annotation.XmlRootElement;
 
 import org.apache.commons.lang3.builder.EqualsBuilder;
 import org.apache.commons.lang3.builder.HashCodeBuilder;
 
 import org.apache.commons.lang3.builder.EqualsBuilder;
 import org.apache.commons.lang3.builder.HashCodeBuilder;
-import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
 
 /**
  * @file   Capabilities.java
 
 /**
  * @file   Capabilities.java
@@ -87,6 +86,6 @@ public class Capabilities extends Property {
 
     @Override
     public String toString() {
 
     @Override
     public String toString() {
-        return "Capabilities[" + ReflectionToStringBuilder.toString(this) + "]";
+        return "Capabilities[" + capabilitiesValue + "]";
     }
 }
     }
 }
index 505cc61816c6895142cbc639834d2a740856782f..f8a48997f827e06a5e554344d8b3339e17b444c6 100644 (file)
@@ -8,12 +8,11 @@
 
 package org.opendaylight.controller.sal.core;
 
 
 package org.opendaylight.controller.sal.core;
 
-import org.apache.commons.lang3.builder.HashCodeBuilder;
-import org.apache.commons.lang3.builder.EqualsBuilder;
-import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
-
-import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
 
 /**
  * The class represents Admin Config status
 
 /**
  * The class represents Admin Config status
@@ -64,6 +63,6 @@ public class Config extends Property {
 
     @Override
     public String toString() {
 
     @Override
     public String toString() {
-        return "Config["+ReflectionToStringBuilder.toString(this)+"]";
+        return "Config["+ configValue +"]";
     }
 }
     }
 }
index a7fd580b010a54ef94741bdce3196b5890019393..395863591437d2bec527cd3144724abf5593f646 100644 (file)
@@ -9,13 +9,10 @@
 
 package org.opendaylight.controller.sal.core;
 
 
 package org.opendaylight.controller.sal.core;
 
-import org.apache.commons.lang3.builder.HashCodeBuilder;
-import org.apache.commons.lang3.builder.EqualsBuilder;
-
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
+
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
 
 /**
  * @file   Latency.java
 
 /**
  * @file   Latency.java
index bf67ed8861e07504690048b017376bb302cb8bc8..6ac89952b30fbb73e6b09d08a4d542eaf818bc34 100644 (file)
@@ -9,12 +9,11 @@
 
 package org.opendaylight.controller.sal.core;
 
 
 package org.opendaylight.controller.sal.core;
 
-import org.apache.commons.lang3.builder.HashCodeBuilder;
-import org.apache.commons.lang3.builder.EqualsBuilder;
-import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
-
-import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
 
 /**
  * The class represents the Name property of an element.
 
 /**
  * The class represents the Name property of an element.
@@ -59,6 +58,6 @@ public class Name extends Property {
 
     @Override
     public String toString() {
 
     @Override
     public String toString() {
-        return "Name[" + ReflectionToStringBuilder.toString(this) + "]";
+        return "Name[" + nameValue + "]";
     }
 }
     }
 }
index 9e4475e0710b44a7fd9799b82f326af2a0f3f02d..15d9976106f5df07c683ca37bd42d077ca970bfd 100644 (file)
 package org.opendaylight.controller.sal.core;
 
 import java.io.Serializable;
 package org.opendaylight.controller.sal.core;
 
 import java.io.Serializable;
-import org.apache.commons.lang3.builder.HashCodeBuilder;
-import org.apache.commons.lang3.builder.EqualsBuilder;
-import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
+
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlSeeAlso;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlSeeAlso;
-import javax.xml.bind.annotation.XmlElement;
+
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
 
 /**
  * @file   Property.java
 
 /**
  * @file   Property.java
@@ -45,6 +46,7 @@ abstract public class Property implements Serializable {
     /**
      * Private constructor used for JAXB mapping
      */
     /**
      * Private constructor used for JAXB mapping
      */
+    @SuppressWarnings("unused")
     private Property() {
         this.name = null;
     }
     private Property() {
         this.name = null;
     }
index 693abd85d59c9f72e48d5ebc7a912160b2bc0a74..4edc1f1d232b54055b70f0db0bedba83f16b0d2c 100644 (file)
@@ -9,12 +9,11 @@
 
 package org.opendaylight.controller.sal.core;
 
 
 package org.opendaylight.controller.sal.core;
 
-import org.apache.commons.lang3.builder.HashCodeBuilder;
-import org.apache.commons.lang3.builder.EqualsBuilder;
-import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
-
-import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
 
 /**
  * The class represents the State property of an Edge
 
 /**
  * The class represents the State property of an Edge
@@ -65,6 +64,6 @@ public class State extends Property {
 
     @Override
     public String toString() {
 
     @Override
     public String toString() {
-        return "State[" + ReflectionToStringBuilder.toString(this) + "]";
+        return "State[" + stateValue + "]";
     }
 }
     }
 }
index 4775aa8712f856fb7969bdc1e340a2b9d5643658..4370c4c598aae44764bbc7d21bb356bf39bb68d9 100644 (file)
@@ -14,7 +14,6 @@ import javax.xml.bind.annotation.XmlRootElement;
 
 import org.apache.commons.lang3.builder.EqualsBuilder;
 import org.apache.commons.lang3.builder.HashCodeBuilder;
 
 import org.apache.commons.lang3.builder.EqualsBuilder;
 import org.apache.commons.lang3.builder.HashCodeBuilder;
-import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
 
 /**
  * @file   Tables.java
 
 /**
  * @file   Tables.java
@@ -69,6 +68,6 @@ public class Tables extends Property {
 
     @Override
     public String toString() {
 
     @Override
     public String toString() {
-        return "Tables[" + ReflectionToStringBuilder.toString(this) + "]";
+        return "Tables[" + tablesValue + "]";
     }
 }
     }
 }
index 89db9aab248e367a183b232f4bb936d66831acd3..f45599f6c80bd5b980aa0c488f1472a564f978f4 100644 (file)
@@ -12,9 +12,8 @@ package org.opendaylight.controller.sal.core;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
 
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
 
-import org.apache.commons.lang3.builder.HashCodeBuilder;
 import org.apache.commons.lang3.builder.EqualsBuilder;
 import org.apache.commons.lang3.builder.EqualsBuilder;
-import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
 
 /**
  * The class represents the Tier property of a node
 
 /**
  * The class represents the Tier property of a node
@@ -61,6 +60,6 @@ public class Tier extends Property {
 
     @Override
     public String toString() {
 
     @Override
     public String toString() {
-        return "Tier[" + ReflectionToStringBuilder.toString(this) + "]";
+        return "Tier[" + tierValue + "]";
     }
 }
     }
 }
index cfdceac82290de788caf94d44023f34090c6c402..6b2467ee5daa6f496787fcdfd3ac83e21df098ca 100644 (file)
@@ -9,12 +9,11 @@
 
 package org.opendaylight.controller.sal.core;
 
 
 package org.opendaylight.controller.sal.core;
 
-import org.apache.commons.lang3.builder.HashCodeBuilder;
-import org.apache.commons.lang3.builder.EqualsBuilder;
-import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
-
-import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
 
 /**
  * @file   TimeStamp.java
 
 /**
  * @file   TimeStamp.java
@@ -85,6 +84,6 @@ public class TimeStamp extends Property {
 
     @Override
     public String toString() {
 
     @Override
     public String toString() {
-        return "TimeStamp[" + ReflectionToStringBuilder.toString(this) + "]";
+        return "TimeStamp[" + timestampName + ": " + timestamp +"]";
     }
 }
     }
 }
index 84883c6adc66a06cb9058e6f503dbc70b16816ef..2e9058abe8c781cf57de9cd0ff51bf5d7de9b554 100644 (file)
@@ -9,7 +9,6 @@
 
 package org.opendaylight.controller.sal.core;
 
 
 package org.opendaylight.controller.sal.core;
 
-import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
 
 /**
  * @file   UpdateType.java
 
 /**
  * @file   UpdateType.java
@@ -29,9 +28,4 @@ public enum UpdateType {
     public String getName() {
         return this.name;
     }
     public String getName() {
         return this.name;
     }
-
-    @Override
-    public String toString() {
-        return "UpdateType[" + ReflectionToStringBuilder.toString(this) + "]";
-    }
 }
 }
index 8ed7e4627594195a783f9db236b713bb16c829d7..79159e5ff102270c0d2e094a732acd5fb77130a5 100644 (file)
@@ -715,7 +715,7 @@ public class SwitchManagerImpl implements ISwitchManager,
     }
 
     private void addNode(Node node, Set<Property> props) {
     }
 
     private void addNode(Node node, Set<Property> props) {
-        log.trace("{} added", node);
+        log.trace("{} added, props: {}", node, props);
         if (nodeProps == null) {
             return;
         }
         if (nodeProps == null) {
             return;
         }
@@ -766,8 +766,9 @@ public class SwitchManagerImpl implements ISwitchManager,
 
     private void removeNode(Node node) {
         log.trace("{} removed", node);
 
     private void removeNode(Node node) {
         log.trace("{} removed", node);
-        if (nodeProps == null)
+        if (nodeProps == null) {
             return;
             return;
+        }
         nodeProps.remove(node);
 
         // check if span ports need to be cleaned up
         nodeProps.remove(node);
 
         // check if span ports need to be cleaned up
@@ -778,8 +779,9 @@ public class SwitchManagerImpl implements ISwitchManager,
     }
 
     private void updateNode(Node node, Set<Property> props) {
     }
 
     private void updateNode(Node node, Set<Property> props) {
-        log.trace("{} updated", node);
-        if (nodeProps == null) {
+        log.trace("{} updated, props: {}", node, props);
+        if (nodeProps == null || !nodeProps.containsKey(node) ||
+                props == null || props.isEmpty()) {
             return;
         }
 
             return;
         }