Fixing visuals for the SDN-IP demo.

Change-Id: I1d3020ab3787c1b560438e32fe4254edf6a640bd
diff --git a/web/gui/src/main/java/org/onlab/onos/gui/TopologyViewMessages.java b/web/gui/src/main/java/org/onlab/onos/gui/TopologyViewMessages.java
index 3a64f28..e99749e 100644
--- a/web/gui/src/main/java/org/onlab/onos/gui/TopologyViewMessages.java
+++ b/web/gui/src/main/java/org/onlab/onos/gui/TopologyViewMessages.java
@@ -56,6 +56,7 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.text.DecimalFormat;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
@@ -85,6 +86,15 @@
     private static final ProviderId PID = new ProviderId("core", "org.onlab.onos.core", true);
     private static final String COMPACT = "%s/%s-%s/%s";
 
+    private static final double KB = 1024;
+    private static final double MB = 1024 * KB;
+    private static final double GB = 1024 * MB;
+
+    private static final String GB_UNIT = "GB";
+    private static final String MB_UNIT = "MB";
+    private static final String KB_UNIT = "KB";
+    private static final String B_UNIT = "B";
+
     protected final ServiceDirectory directory;
     protected final ClusterService clusterService;
     protected final DeviceService deviceService;
@@ -424,14 +434,16 @@
             ArrayNode labels = mapper.createArrayNode();
             boolean hasTraffic = false;
             for (Link link : links) {
-                linksNode.add(compactLinkString(link));
-                Load load = statService.load(link);
-                String label = "";
-                if (load.rate() > 0) {
-                    hasTraffic = true;
-                    label = load.latest() + " bytes";
+                if (isInfrastructureEgress(link)) {
+                    linksNode.add(compactLinkString(link));
+                    Load load = statService.load(link);
+                    String label = "";
+                    if (load.rate() > 0) {
+                        hasTraffic = true;
+                        label = format(load);
+                    }
+                    labels.add(label);
                 }
-                labels.add(label);
             }
             pathNode.put("class", hasTraffic ? type + " animated" : type);
             pathNode.put("traffic", hasTraffic);
@@ -441,6 +453,32 @@
         }
     }
 
+    // Poor-mans formatting to get the labels with byte counts looking nice.
+    private String format(Load load) {
+        long bytes = load.latest();
+        String unit;
+        double value;
+        if (bytes > GB) {
+            value = bytes / GB;
+            unit = GB_UNIT;
+        } else if (bytes > MB) {
+            value = bytes / MB;
+            unit = MB_UNIT;
+        } else if (bytes > KB) {
+            value = bytes / KB;
+            unit = KB_UNIT;
+        } else {
+            value = bytes;
+            unit = B_UNIT;
+        }
+        DecimalFormat format = new DecimalFormat("#,###.##");
+        return format.format(value) +  " " + unit;
+    }
+
+    private boolean isInfrastructureEgress(Link link) {
+        return link.src().elementId() instanceof DeviceId;
+    }
+
     // Produces compact string representation of a link.
     private static String compactLinkString(Link link) {
         return String.format(COMPACT, link.src().elementId(), link.src().port(),
diff --git a/web/gui/src/main/webapp/topo2.css b/web/gui/src/main/webapp/topo2.css
index 94af382..3f87d47 100644
--- a/web/gui/src/main/webapp/topo2.css
+++ b/web/gui/src/main/webapp/topo2.css
@@ -143,7 +143,7 @@
 }
 #topo svg .link.animated {
     stroke: #f11;
-    stroke-width: 8px;
+    stroke-width: 6px;
     stroke-dasharray: 8 8
 }
 
@@ -162,15 +162,16 @@
 }
 
 #topo svg .linkLabel rect {
-    fill: #eef;
-    stroke: blue;
-    stroke-width: 0.3;
+    stroke: #999;
+    stroke-width: 1.2px;
+    fill: #eee;
+    stroke: none;
 }
 #topo svg .linkLabel text {
     text-anchor: middle;
-    fill: #a13d11;
-    stroke: none;
-    font-size: 8pt;
+    stroke: #777;
+    stroke-width: 0.1px;
+    font-size: 9pt;
 }
 
 /* Fly-in details pane */