Merge "Fix for bug #343 Have made changes in HostTracker.java Submitting again"
authorGiovanni Meo <gmeo@cisco.com>
Wed, 29 Jan 2014 05:39:33 +0000 (05:39 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Wed, 29 Jan 2014 05:39:33 +0000 (05:39 +0000)
opendaylight/configuration/implementation/src/main/java/org/opendaylight/controller/configuration/internal/ConfigurationService.java
opendaylight/configuration/implementation/src/main/java/org/opendaylight/controller/configuration/internal/ContainerConfigurationService.java
opendaylight/switchmanager/implementation/src/main/java/org/opendaylight/controller/switchmanager/internal/SwitchManager.java
opendaylight/web/root/src/main/resources/js/lib.js
opendaylight/web/troubleshoot/src/main/resources/js/page.js

index 03acfa88eb04e1737650af810c11b1afe809ad88..e4d55d11fb39e126d2dbb99f0ceb0cb6672d7069 100644 (file)
@@ -9,6 +9,7 @@
 
 package org.opendaylight.controller.configuration.internal;
 
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.EnumSet;
 import java.util.HashSet;
@@ -189,7 +190,12 @@ public class ConfigurationService implements IConfigurationService, ICacheUpdate
         }
         String source = String.format("%s%s", ROOT, fileName);
         Object obj = objReader.read(reader, source);
-        return (obj == null || !(obj instanceof List)) ? Collections.<ConfigurationObject> emptyList()
-                : (List<ConfigurationObject>) obj;
+        if (obj == null) {
+            return Collections.<ConfigurationObject> emptyList();
+        }
+        if (obj instanceof ConcurrentMap) {
+            return new ArrayList<ConfigurationObject>(((ConcurrentMap)obj).values());
+        }
+        return (List<ConfigurationObject>) obj;
     }
 }
index c33fdefd7b4a87b9da85548054e7936cbfdccb9f..9c1d391daa7b8e80eec73ce454e30a6b768efe4d 100644 (file)
@@ -10,6 +10,7 @@
 package org.opendaylight.controller.configuration.internal;
 
 import java.io.File;
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Dictionary;
 import java.util.EnumSet;
@@ -219,7 +220,12 @@ public class ContainerConfigurationService implements IConfigurationContainerSer
         }
         String source = String.format("%s%s", root, fileName);
         Object obj = objReader.read(reader, source);
-        return (obj == null || !(obj instanceof List)) ? Collections.<ConfigurationObject> emptyList()
-                : (List<ConfigurationObject>) obj;
+        if (obj == null) {
+            return Collections.<ConfigurationObject> emptyList();
+        }
+        if (obj instanceof ConcurrentMap) {
+            return new ArrayList<ConfigurationObject>(((ConcurrentMap)obj).values());
+        }
+        return (List<ConfigurationObject>) obj;
     }
 }
index 770180c04e7ae754e91d12659ae43ea2577a3d4b..ca6987ad6cf23cb3fa142b8d6747da0cc3fa0a8e 100644 (file)
@@ -1397,7 +1397,7 @@ public class SwitchManager implements ISwitchManager, IConfigurationContainerAwa
             } catch (SocketException e) {
                 log.error("Failed to acquire controller MAC: ", e);
             }
-            if (macAddress != null) {
+            if (macAddress != null && macAddress.length != 0) {
                 break;
             }
         }
index d32f60e68b46e6764e2cccb4555dda62c9d0c9e2..00eacdfce6b9eba6fed4b472a95f4a265748877b 100644 (file)
@@ -27,15 +27,15 @@ one.lib.dashlet = {
         return $h4;
     },
     label : function(name, type) {
-       var $span = $(document.createElement('span'));
-       $span.addClass('label');
-       if (type !== undefined) {
-               $span.addClass(type);
-       } else if (type !== null) {
-               $span.addClass('label-info');
-       }
-       $span.append(name);
-       return $span;
+        var $span = $(document.createElement('span'));
+        $span.addClass('label');
+        if (type !== undefined) {
+            $span.addClass(type);
+        } else if (type !== null) {
+            $span.addClass('label-info');
+        }
+        $span.append(name);
+        return $span;
     },
     list : function(list) {
         var $ul = $(document.createElement('ul'));
@@ -371,6 +371,18 @@ one.lib.nav = {
     }
 }
 
+one.lib.helper = {
+    parseInt : function(value) {
+        return (value !== null && value !== '') ?
+            parseInt(value) : ''
+    },
+    parseFloat : function(value) {
+        return (value !== null && value !== '') ?
+            parseFloat(value) : ''
+    }
+}
+
+
 /** ALERT */
 one.lib.alert = function(alert) {
     $("#alert p").text(alert);
index 3ccec224ee90246b5a9e6d6563362b3dab4682b1..a8673b0031d7246bedcfb3285a90519694b48efb 100644 (file)
@@ -207,13 +207,26 @@ one.f.troubleshooting.existingNodes = {
                             item["statistics"] = "<a href=\"javascript:one.f.troubleshooting.existingNodes.load.flows('" + item["nodeId"] + "');\">Flows</a>" + 
                             " <a href=\"javascript:one.f.troubleshooting.existingNodes.load.ports('" + item["nodeId"] + "');\">Ports</a>";
                         });
-
                     },
                     delay: 0
                 });
                 return source;
             },
             portsGrid: function(data) {
+                $.each(data.nodeData, function(index, item) {
+                    item.rxPkts = one.lib.helper.parseInt(item.rxPkts);
+                    item.txPkts = one.lib.helper.parseInt(item.txPkts);
+                    item.rxBytes = one.lib.helper.parseInt(item.rxBytes);
+                    item.txBytes = one.lib.helper.parseInt(item.txBytes);
+                    item.rxDrops = one.lib.helper.parseInt(item.rxDrops);
+                    item.txDrops = one.lib.helper.parseInt(item.txDrops);
+                    item.rxErrors = one.lib.helper.parseInt(item.rxErrors);
+                    item.txErrors = one.lib.helper.parseInt(item.txErrors);
+                    item.rxFrameErrors = one.lib.helper.parseInt(item.rxFrameErrors);
+                    item.rxOverRunErrors = one.lib.helper.parseInt(item.rxOverRunErrors);
+                    item.rxCRCErrors = one.lib.helper.parseInt(item.rxCRCErrors);
+                    item.collisions = one.lib.helper.parseInt(item.collisions);
+                });
                 var source = new StaticDataSource({
                     columns: [
                         {
@@ -311,6 +324,13 @@ one.f.troubleshooting.existingNodes = {
                 return result;
             },
             flowsGrid: function(data) {
+                $.each(data.nodeData, function(index, item) {
+                    item.byteCount = one.lib.helper.parseInt(item.byteCount);
+                    item.packetCount = one.lib.helper.parseInt(item.packetCount);
+                    item.durationSeconds = one.lib.helper.parseInt(item.durationSeconds);
+                    item.idleTimeout = one.lib.helper.parseInt(item.idleTimeout);
+                    item.priority = one.lib.helper.parseInt(item.priority);
+                });
                 var source = new StaticDataSource({
                     columns: [
                         {