Added application that adds a topology overlay displaying additional statistics of links.

Change-Id: Ie82ce67ead64b9b62d6ab55f3ef8ac0f62946d9f
diff --git a/apps/linkprops/src/main/resources/app/view/lpTopov/lpTopov.css b/apps/linkprops/src/main/resources/app/view/lpTopov/lpTopov.css
new file mode 100644
index 0000000..cbf460f
--- /dev/null
+++ b/apps/linkprops/src/main/resources/app/view/lpTopov/lpTopov.css
@@ -0,0 +1,2 @@
+/* css for sample app topology overlay  */
+
diff --git a/apps/linkprops/src/main/resources/app/view/lpTopov/lpTopov.html b/apps/linkprops/src/main/resources/app/view/lpTopov/lpTopov.html
new file mode 100644
index 0000000..b1c9acb
--- /dev/null
+++ b/apps/linkprops/src/main/resources/app/view/lpTopov/lpTopov.html
@@ -0,0 +1,4 @@
+<!-- partial HTML -->
+<div id="ov-sample-topov">
+    <p>This is a hidden view .. just a placeholder to house the javascript</p>
+</div>
diff --git a/apps/linkprops/src/main/resources/app/view/lpTopov/lpTopov.js b/apps/linkprops/src/main/resources/app/view/lpTopov/lpTopov.js
new file mode 100644
index 0000000..5596a82
--- /dev/null
+++ b/apps/linkprops/src/main/resources/app/view/lpTopov/lpTopov.js
@@ -0,0 +1,103 @@
+/*
+ * Copyright 2015-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ Module containing the "business logic" for the Link Props topology overlay.
+ */
+
+(function () {
+    'use strict';
+
+    // injected refs
+    var $log, fs, flash, wss;
+
+    // constants
+    var displayStart = 'linkPropsTopovDisplayStart',
+        displayUpdate = 'linkPropsTopovDisplayUpdate',
+        displayStop = 'linkPropsTopovDisplayStop';
+
+    // internal state
+    var currentMode = null;
+
+
+    // === ---------------------------
+    // === Helper functions
+
+    function sendDisplayStart(mode) {
+        wss.sendEvent(displayStart, {
+            mode: mode
+        });
+    }
+
+    function sendDisplayUpdate(what) {
+        wss.sendEvent(displayUpdate, {
+            id: what ? what.id : ''
+        });
+    }
+
+    function sendDisplayStop() {
+        wss.sendEvent(displayStop);
+    }
+
+    // === ---------------------------
+    // === Main API functions
+
+    function startDisplay(mode) {
+        if (currentMode === mode) {
+            $log.debug('(in mode', mode, 'already)');
+        } else {
+            currentMode = mode;
+            sendDisplayStart(mode);
+            flash.flash('Starting display mode: ' + mode);
+        }
+    }
+
+    function updateDisplay(m) {
+        if (currentMode) {
+            sendDisplayUpdate(m);
+        }
+    }
+
+    function stopDisplay() {
+        if (currentMode) {
+            currentMode = null;
+            sendDisplayStop();
+            flash.flash('Canceling display mode');
+            return true;
+        }
+        return false;
+    }
+
+    // === ---------------------------
+    // === Module Factory Definition
+
+    angular.module('ovLpTopov', [])
+        .factory('LinkPropsTopovService',
+        ['$log', 'FnService', 'FlashService', 'WebSocketService',
+
+        function (_$log_, _fs_, _flash_, _wss_) {
+            $log = _$log_;
+            fs = _fs_;
+            flash = _flash_;
+            wss = _wss_;
+
+            return {
+                startDisplay: startDisplay,
+                updateDisplay: updateDisplay,
+                stopDisplay: stopDisplay
+            };
+        }]);
+}());
diff --git a/apps/linkprops/src/main/resources/app/view/lpTopov/lpTopovOverlay.js b/apps/linkprops/src/main/resources/app/view/lpTopov/lpTopovOverlay.js
new file mode 100644
index 0000000..7cb966f
--- /dev/null
+++ b/apps/linkprops/src/main/resources/app/view/lpTopov/lpTopovOverlay.js
@@ -0,0 +1,110 @@
+// Link props topology overlay - client side
+//
+// This is the glue that binds our business logic (in lpTopov.js)
+// to the overlay framework.
+
+(function () {
+    'use strict';
+
+    // injected refs
+    var $log, tov, stds;
+
+    // internal state should be kept in the service module (not here)
+
+    // our overlay definition
+    var overlay = {
+        // NOTE: this must match the ID defined in AppUiTopovOverlay
+        overlayId: 'linkprops-overlay',
+        glyphId: 'topo',
+        tooltip: 'Link Properties',
+
+        activate: function () {
+            $log.debug("Link Props topology overlay ACTIVATED");
+        },
+        deactivate: function () {
+            stds.stopDisplay();
+            $log.debug("Link Props topology overlay DEACTIVATED");
+        },
+
+        // Key bindings for traffic overlay buttons
+        // NOTE: fully qual. button ID is derived from overlay-id and key-name
+        keyBindings: {
+            0: {
+                cb: function () { stds.stopDisplay(); },
+                tt: 'Cancel Display Mode',
+                gid: 'xMark'
+            },
+            V: {
+                cb: function () { stds.startDisplay('rate'); },
+                tt: 'Start Rate Mode',
+                gid: 'ports'
+            },
+            F: {
+                cb: function () { stds.startDisplay('byte'); },
+                tt: 'Start Total Byte Mode',
+                gid: 'allTraffic'
+            },
+            C: {
+                cb: function () { stds.startDisplay('band'); },
+                tt: 'Start Available Bandwidth Mode',
+                gid: 'triangleUp'
+            },
+            G: {
+                cb: buttonCallback,
+                tt: 'Uses the G key',
+                gid: 'crown'
+            },
+
+            _keyOrder: [
+                '0', 'V', 'F', 'C', 'G'
+            ]
+        },
+
+        hooks: {
+            // hook for handling escape key
+            // Must return true to consume ESC, false otherwise.
+            escape: function () {
+                // Must return true to consume ESC, false otherwise.
+                return stds.stopDisplay();
+            },
+
+            // hooks for when the selection changes...
+            empty: function () {
+                selectionCallback('empty');
+            },
+            single: function (data) {
+                selectionCallback('single', data);
+            },
+            mouseover: function (m) {
+                // m has id, class, and type properties
+                $log.debug('mouseover:', m);
+                stds.updateDisplay(m);
+            },
+            mouseout: function () {
+                $log.debug('mouseout');
+                stds.updateDisplay();
+            }
+        }
+    };
+
+
+    function buttonCallback(x) {
+        $log.debug('Toolbar-button callback', x);
+    }
+
+    function selectionCallback(x, d) {
+        $log.debug('Selection callback', x, d);
+    }
+
+    // invoke code to register with the overlay service
+    angular.module('ovLpTopov')
+        .run(['$log', 'TopoOverlayService', 'LinkPropsTopovService',
+
+        function (_$log_, _tov_, _stds_) {
+            $log = _$log_;
+            tov = _tov_;
+            stds = _stds_;
+            tov.register(overlay);
+        }]);
+
+}());
\ No newline at end of file