GUI -- ONOS-1172 - Added 'dash' keystroke to report on bad links.

Change-Id: Ie4226b25d4219001be17add8b501e1a77585334a
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 0a75652..6bec7e8 100644
--- a/web/gui/src/main/webapp/app/view/topo/topoModel.js
+++ b/web/gui/src/main/webapp/app/view/topo/topoModel.js
@@ -341,15 +341,37 @@
     }
 
     function findAttachedLinks(devId) {
-        var links = [];
+        var lnks = [];
         links.forEach(function (d) {
             if (d.source.id === devId || d.target.id === devId) {
-                links.push(d);
+                lnks.push(d);
             }
         });
-        return links;
+        return lnks;
     }
 
+    // returns one-way links or where the internal link types differ
+    function findBadLinks() {
+        var lnks = [],
+            src, tgt;
+        links.forEach(function (d) {
+            // NOTE: skip edge links, which are synthesized
+            if (d.type() !== 'hostLink') {
+                delete d.bad;
+                src = d.fromSource;
+                tgt = d.fromTarget;
+                if (src && !tgt) {
+                    d.bad = 'missing link';
+                } else if (src.type !== tgt.type) {
+                    d.bad = 'type mismatch';
+                }
+                if (d.bad) {
+                    lnks.push(d);
+                }
+            }
+        });
+        return lnks;
+    }
 
     // ==========================
     // Module definition
@@ -394,7 +416,8 @@
                 findLinkById: findLinkById,
                 findDevices: findDevices,
                 findAttachedHosts: findAttachedHosts,
-                findAttachedLinks: findAttachedLinks
+                findAttachedLinks: findAttachedLinks,
+                findBadLinks: findBadLinks
             }
         }]);
 }());