ONOS-2101 - GUI -- CSS for marching ants added. Node.js server now takes -v and -v! command line arguments.

Change-Id: Ifbf1238e37cd19d96a8bd1560b7aa755e9c14808
diff --git a/web/gui/src/main/webapp/app/view/topo/topo.css b/web/gui/src/main/webapp/app/view/topo/topo.css
index bbbea31..24bee24 100644
--- a/web/gui/src/main/webapp/app/view/topo/topo.css
+++ b/web/gui/src/main/webapp/app/view/topo/topo.css
@@ -501,6 +501,21 @@
 }
 
 
+#ov-topo svg .link.animated {
+    stroke-dasharray: 8 5;
+    animation: ants 5s infinite linear;
+    /* below line will be added via Javascript based on path */
+    /*animation-direction: reverse;*/
+}
+@keyframes ants {
+    from {
+        stroke-dashoffset: 0;
+    }
+    to {
+        stroke-dashoffset: 400;
+    }
+}
+
 #ov-topo svg .link.primary {
     stroke-width: 4px;
 }
diff --git a/web/gui/src/test/_karma/ev/traffic/ev_18_showTraffic_primary.json b/web/gui/src/test/_karma/ev/traffic/ev_18_showTraffic_primary.json
index a252d51..7eafcf1 100644
--- a/web/gui/src/test/_karma/ev/traffic/ev_18_showTraffic_primary.json
+++ b/web/gui/src/test/_karma/ev/traffic/ev_18_showTraffic_primary.json
@@ -4,7 +4,7 @@
   "payload": {
     "paths": [
       {
-        "class": "primary",
+        "class": "primary animated",
         "links": [
           "0E:2A:69:30:13:86/-1/0-of:0000ffffffff0003/101",
           "0E:2A:69:30:13:aa/-1/0-of:0000ffffffff0008/103",
@@ -19,7 +19,7 @@
         ]
       },
       {
-        "class": "primary optical",
+        "class": "primary optical animated",
         "links": [
           "of:0000ffffffffff08/13-of:0000ffffffffff03/17",
           "of:0000ffffffffff08/99-of:0000ffffffffff04/65535"
diff --git a/web/gui/src/test/_karma/ev/traffic/ev_19_showTraffic_secondary.json b/web/gui/src/test/_karma/ev/traffic/ev_19_showTraffic_secondary.json
index 4483f50..1f60c72 100644
--- a/web/gui/src/test/_karma/ev/traffic/ev_19_showTraffic_secondary.json
+++ b/web/gui/src/test/_karma/ev/traffic/ev_19_showTraffic_secondary.json
@@ -4,7 +4,7 @@
   "payload": {
     "paths": [
       {
-        "class": "secondary",
+        "class": "secondary animated",
         "links": [
           "0E:2A:69:30:13:86/-1/0-of:0000ffffffff0003/101",
           "0E:2A:69:30:13:aa/-1/0-of:0000ffffffff0008/103",
@@ -19,7 +19,7 @@
         ]
       },
       {
-        "class": "secondary optical",
+        "class": "secondary optical animated",
         "links": [
           "of:0000ffffffffff08/13-of:0000ffffffffff03/17",
           "of:0000ffffffffff08/99-of:0000ffffffffff04/65535"
diff --git a/web/gui/src/test/_karma/ev/traffic/ev_20_showTraffic_allMix.json b/web/gui/src/test/_karma/ev/traffic/ev_20_showTraffic_allMix.json
index d6fb9b5..0526274 100644
--- a/web/gui/src/test/_karma/ev/traffic/ev_20_showTraffic_allMix.json
+++ b/web/gui/src/test/_karma/ev/traffic/ev_20_showTraffic_allMix.json
@@ -4,14 +4,14 @@
   "payload": {
     "paths": [
       {
-        "class": "primary",
+        "class": "primary animated",
         "links": [
           "of:0000ffffffff0008/21-of:0000ffffffff0003/1"
         ],
         "labels": ["primary"]
       },
       {
-        "class": "secondary",
+        "class": "secondary animated",
         "links": [
           "of:0000ffffffff0003/9-of:0000ffffffff0007/2",
           "of:0000ffffffff0008/4-of:0000ffffffff0007/3",
@@ -21,14 +21,14 @@
         "labels": ["secondary", "secondo", "deux", "zwei"]
       },
       {
-        "class": "secondary optical",
+        "class": "secondary optical animated",
         "links": [
           "of:0000ffffffffff08/99-of:0000ffffffffff04/65535"
         ],
         "labels": ["secondary optical"]
       },
       {
-        "class": "primary optical",
+        "class": "primary optical animated",
         "links": [
           "of:0000ffffffffff08/13-of:0000ffffffffff03/17"
         ],
diff --git a/web/gui/src/test/_karma/mockserver.js b/web/gui/src/test/_karma/mockserver.js
index e861e83..23b468b 100644
--- a/web/gui/src/test/_karma/mockserver.js
+++ b/web/gui/src/test/_karma/mockserver.js
@@ -7,7 +7,9 @@
     http = require('http'),
     WebSocketServer = require('websocket').server,
     port = 8123,
-    scenarioRoot = 'ev/';
+    scenarioRoot = 'ev/',
+    verbose = false,         // show received messages from client
+    extraVerbose = false;    // show ALL received messages from client
 
 var lastcmd,        // last command executed
     lastargs,       // arguments to last command
@@ -23,8 +25,19 @@
     evdata;         // event data
 
 
+process.argv.forEach(function (val) {
+    switch (val) {
+        case '-v': verbose = true; break;
+        case '-v!': extraVerbose = true; break;
+    }
+});
+
 var scFiles = fs.readdirSync(scenarioRoot);
+console.log();
 console.log('Mock Server v1.0');
+if (verbose || extraVerbose) {
+    console.log('Verbose=' + verbose, 'ExtraVerbose=' + extraVerbose);
+}
 console.log('================');
 listScenarios();
 
@@ -62,6 +75,15 @@
     return true;
 }
 
+// displays the message if our arguments say we should
+function displayMsg(msg) {
+    var ev = JSON.parse(msg);
+    switch (ev.event) {
+        case 'topoHeartbeat': return extraVerbose;
+        default: return true;
+    }
+}
+
 wsServer.on('request', function(request) {
     console.log(); // newline after prompt
     console.log("Origin: ", request.origin);
@@ -81,15 +103,19 @@
     rl.prompt();
 
     connection.on('message', function(message) {
-        if (message.type === 'utf8') {
-            console.log(); // newline after prompt
-            console.log('Received Message: ' + message.utf8Data);
-            //connection.sendUTF(message.utf8Data);
-            rl.prompt();
-        }
-        else if (message.type === 'binary') {
-            console.log('Received Binary Message of ' + message.binaryData.length + ' bytes');
-            //connection.sendBytes(message.binaryData);
+        if (verbose || extraVerbose) {
+            if (message.type === 'utf8') {
+                if (displayMsg(message.utf8Data)) {
+                    console.log(); // newline after prompt
+                    console.log('Received Message: ' + message.utf8Data);
+                }
+                //connection.sendUTF(message.utf8Data);
+                rl.prompt();
+            }
+            else if (message.type === 'binary') {
+                console.log('Received Binary Message of ' + message.binaryData.length + ' bytes');
+                //connection.sendBytes(message.binaryData);
+            }
         }
     });
     connection.on('close', function(reasonCode, description) {