[AETHER-1212] Added means to configure host links to appear as 'wireless'

Setting the host "uiType" to 'cellphone' will make the links "wireless"
and appear as dashed lines.
Additionally, a new annotation "connectionType" was added for hosts,
which when set to "wireless" will make links change appearance for any
type of hosts.


Change-Id: Iad87eb5c180b0a9175108c1179d9d28ae906e924
diff --git a/web/gui/src/main/java/org/onosproject/ui/impl/TopologyViewMessageHandlerBase.java b/web/gui/src/main/java/org/onosproject/ui/impl/TopologyViewMessageHandlerBase.java
index 1709476..ff52584 100644
--- a/web/gui/src/main/java/org/onosproject/ui/impl/TopologyViewMessageHandlerBase.java
+++ b/web/gui/src/main/java/org/onosproject/ui/impl/TopologyViewMessageHandlerBase.java
@@ -337,11 +337,13 @@
         Host host = event.subject();
         Host prevHost = event.prevSubject();
         String hostType = host.annotations().value(AnnotationKeys.UI_TYPE);
+        String connectionType = host.annotations().value(AnnotationKeys.CONNECTION_TYPE);
         String ip = ip(host.ipAddresses());
 
         ObjectNode payload = objectNode()
                 .put("id", host.id().toString())
-                .put("type", isNullOrEmpty(hostType) ? "endstation" : hostType);
+                .put("type", isNullOrEmpty(hostType) ? "endstation" : hostType)
+                .put("connectionType", isNullOrEmpty(connectionType) ? "wired" : connectionType);
 
         // set most recent connect point (and previous if we know it)
         payload.set("cp", hostConnect(host.location()));
diff --git a/web/gui/src/main/webapp/app/view/topo/topoForce.js b/web/gui/src/main/webapp/app/view/topo/topoForce.js
index dacbda9..158a066 100644
--- a/web/gui/src/main/webapp/app/view/topo/topoForce.js
+++ b/web/gui/src/main/webapp/app/view/topo/topoForce.js
@@ -217,7 +217,9 @@
             };
             model.links.push(linkData);
 
-            var lnk = tms.createHostLink(model.id, cp.device, cp.port);
+            // Make cell-phone devices default to wireless; others have to be annotated explicitly
+            var cType = model.type === 'cellPhone' ? "wireless" : model.connectionType
+            var lnk = tms.createHostLink(model.id, cp.device, cp.port, cType);
             if (lnk) {
                 network.links.push(lnk);
                 lu[linkData.key] = lnk;
@@ -363,6 +365,7 @@
         var th = ts.theme(),
             el = ldata.el,
             type = ldata.type(),
+            connectionType = ldata.connectionType(),
             lw = ldata.linkWidth(),
             online = ldata.online(),
             modeCls = ldata.expected() ? 'inactive' : 'not-permitted',
@@ -382,10 +385,19 @@
             if (type) {
                 el.classed(type, true);
             }
-            el.transition()
-                .duration(delay)
-                .attr('stroke-width', linkScale(lw))
-                .attr('stroke', linkConfig[th].baseColor);
+
+            if (connectionType === 'wireless') {
+                el.transition()
+                    .duration(delay)
+                    .attr('stroke-width', linkScale(lw))
+                    .attr('stroke', linkConfig[th].baseColor)
+                    .attr('stroke-dasharray', '3 6');
+            } else {
+                el.transition()
+                    .duration(delay)
+                    .attr('stroke-width', linkScale(lw))
+                    .attr('stroke', linkConfig[th].baseColor);
+            }
         }
     }
 
diff --git a/web/gui/src/main/webapp/app/view/topo/topoModel.js b/web/gui/src/main/webapp/app/view/topo/topoModel.js
index 1084b52..6454f5a 100644
--- a/web/gui/src/main/webapp/app/view/topo/topoModel.js
+++ b/web/gui/src/main/webapp/app/view/topo/topoModel.js
@@ -178,7 +178,7 @@
         return node;
     }
 
-    function createHostLink(hostId, devId, devPort) {
+    function createHostLink(hostId, devId, devPort, connectionType) {
         var linkKey = hostId + '/0-' + devId + '/' + devPort,
             lnk = linkEndPoints(hostId, devId);
 
@@ -194,6 +194,7 @@
             tgtPort: devPort,
 
             type: function () { return 'hostLink'; },
+            connectionType: function () { return connectionType; },
             expected: function () { return true; },
             online: function () {
                 // hostlink target is edge switch