Bri Prebilic Cole
Committed by Gerrit Code Review

ONOS-2101 - GUI -- CSS for marching ants added. Node.js server now takes -v and …

…-v! command line arguments.

Change-Id: Ifbf1238e37cd19d96a8bd1560b7aa755e9c14808
......@@ -501,6 +501,21 @@ html[data-platform='iPad'] #topo-p-detail {
}
#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;
}
......
......@@ -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"
......
......@@ -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"
......
......@@ -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"
],
......
......@@ -7,7 +7,9 @@ var fs = require('fs'),
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 @@ var lastcmd, // last command executed
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 @@ function originIsAllowed(origin) {
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 @@ wsServer.on('request', function(request) {
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) {
......