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
Showing
5 changed files
with
59 additions
and
18 deletions
... | @@ -501,6 +501,21 @@ html[data-platform='iPad'] #topo-p-detail { | ... | @@ -501,6 +501,21 @@ html[data-platform='iPad'] #topo-p-detail { |
501 | } | 501 | } |
502 | 502 | ||
503 | 503 | ||
504 | +#ov-topo svg .link.animated { | ||
505 | + stroke-dasharray: 8 5; | ||
506 | + animation: ants 5s infinite linear; | ||
507 | + /* below line will be added via Javascript based on path */ | ||
508 | + /*animation-direction: reverse;*/ | ||
509 | +} | ||
510 | +@keyframes ants { | ||
511 | + from { | ||
512 | + stroke-dashoffset: 0; | ||
513 | + } | ||
514 | + to { | ||
515 | + stroke-dashoffset: 400; | ||
516 | + } | ||
517 | +} | ||
518 | + | ||
504 | #ov-topo svg .link.primary { | 519 | #ov-topo svg .link.primary { |
505 | stroke-width: 4px; | 520 | stroke-width: 4px; |
506 | } | 521 | } | ... | ... |
... | @@ -4,7 +4,7 @@ | ... | @@ -4,7 +4,7 @@ |
4 | "payload": { | 4 | "payload": { |
5 | "paths": [ | 5 | "paths": [ |
6 | { | 6 | { |
7 | - "class": "primary", | 7 | + "class": "primary animated", |
8 | "links": [ | 8 | "links": [ |
9 | "0E:2A:69:30:13:86/-1/0-of:0000ffffffff0003/101", | 9 | "0E:2A:69:30:13:86/-1/0-of:0000ffffffff0003/101", |
10 | "0E:2A:69:30:13:aa/-1/0-of:0000ffffffff0008/103", | 10 | "0E:2A:69:30:13:aa/-1/0-of:0000ffffffff0008/103", |
... | @@ -19,7 +19,7 @@ | ... | @@ -19,7 +19,7 @@ |
19 | ] | 19 | ] |
20 | }, | 20 | }, |
21 | { | 21 | { |
22 | - "class": "primary optical", | 22 | + "class": "primary optical animated", |
23 | "links": [ | 23 | "links": [ |
24 | "of:0000ffffffffff08/13-of:0000ffffffffff03/17", | 24 | "of:0000ffffffffff08/13-of:0000ffffffffff03/17", |
25 | "of:0000ffffffffff08/99-of:0000ffffffffff04/65535" | 25 | "of:0000ffffffffff08/99-of:0000ffffffffff04/65535" | ... | ... |
... | @@ -4,7 +4,7 @@ | ... | @@ -4,7 +4,7 @@ |
4 | "payload": { | 4 | "payload": { |
5 | "paths": [ | 5 | "paths": [ |
6 | { | 6 | { |
7 | - "class": "secondary", | 7 | + "class": "secondary animated", |
8 | "links": [ | 8 | "links": [ |
9 | "0E:2A:69:30:13:86/-1/0-of:0000ffffffff0003/101", | 9 | "0E:2A:69:30:13:86/-1/0-of:0000ffffffff0003/101", |
10 | "0E:2A:69:30:13:aa/-1/0-of:0000ffffffff0008/103", | 10 | "0E:2A:69:30:13:aa/-1/0-of:0000ffffffff0008/103", |
... | @@ -19,7 +19,7 @@ | ... | @@ -19,7 +19,7 @@ |
19 | ] | 19 | ] |
20 | }, | 20 | }, |
21 | { | 21 | { |
22 | - "class": "secondary optical", | 22 | + "class": "secondary optical animated", |
23 | "links": [ | 23 | "links": [ |
24 | "of:0000ffffffffff08/13-of:0000ffffffffff03/17", | 24 | "of:0000ffffffffff08/13-of:0000ffffffffff03/17", |
25 | "of:0000ffffffffff08/99-of:0000ffffffffff04/65535" | 25 | "of:0000ffffffffff08/99-of:0000ffffffffff04/65535" | ... | ... |
... | @@ -4,14 +4,14 @@ | ... | @@ -4,14 +4,14 @@ |
4 | "payload": { | 4 | "payload": { |
5 | "paths": [ | 5 | "paths": [ |
6 | { | 6 | { |
7 | - "class": "primary", | 7 | + "class": "primary animated", |
8 | "links": [ | 8 | "links": [ |
9 | "of:0000ffffffff0008/21-of:0000ffffffff0003/1" | 9 | "of:0000ffffffff0008/21-of:0000ffffffff0003/1" |
10 | ], | 10 | ], |
11 | "labels": ["primary"] | 11 | "labels": ["primary"] |
12 | }, | 12 | }, |
13 | { | 13 | { |
14 | - "class": "secondary", | 14 | + "class": "secondary animated", |
15 | "links": [ | 15 | "links": [ |
16 | "of:0000ffffffff0003/9-of:0000ffffffff0007/2", | 16 | "of:0000ffffffff0003/9-of:0000ffffffff0007/2", |
17 | "of:0000ffffffff0008/4-of:0000ffffffff0007/3", | 17 | "of:0000ffffffff0008/4-of:0000ffffffff0007/3", |
... | @@ -21,14 +21,14 @@ | ... | @@ -21,14 +21,14 @@ |
21 | "labels": ["secondary", "secondo", "deux", "zwei"] | 21 | "labels": ["secondary", "secondo", "deux", "zwei"] |
22 | }, | 22 | }, |
23 | { | 23 | { |
24 | - "class": "secondary optical", | 24 | + "class": "secondary optical animated", |
25 | "links": [ | 25 | "links": [ |
26 | "of:0000ffffffffff08/99-of:0000ffffffffff04/65535" | 26 | "of:0000ffffffffff08/99-of:0000ffffffffff04/65535" |
27 | ], | 27 | ], |
28 | "labels": ["secondary optical"] | 28 | "labels": ["secondary optical"] |
29 | }, | 29 | }, |
30 | { | 30 | { |
31 | - "class": "primary optical", | 31 | + "class": "primary optical animated", |
32 | "links": [ | 32 | "links": [ |
33 | "of:0000ffffffffff08/13-of:0000ffffffffff03/17" | 33 | "of:0000ffffffffff08/13-of:0000ffffffffff03/17" |
34 | ], | 34 | ], | ... | ... |
... | @@ -7,7 +7,9 @@ var fs = require('fs'), | ... | @@ -7,7 +7,9 @@ var fs = require('fs'), |
7 | http = require('http'), | 7 | http = require('http'), |
8 | WebSocketServer = require('websocket').server, | 8 | WebSocketServer = require('websocket').server, |
9 | port = 8123, | 9 | port = 8123, |
10 | - scenarioRoot = 'ev/'; | 10 | + scenarioRoot = 'ev/', |
11 | + verbose = false, // show received messages from client | ||
12 | + extraVerbose = false; // show ALL received messages from client | ||
11 | 13 | ||
12 | var lastcmd, // last command executed | 14 | var lastcmd, // last command executed |
13 | lastargs, // arguments to last command | 15 | lastargs, // arguments to last command |
... | @@ -23,8 +25,19 @@ var lastcmd, // last command executed | ... | @@ -23,8 +25,19 @@ var lastcmd, // last command executed |
23 | evdata; // event data | 25 | evdata; // event data |
24 | 26 | ||
25 | 27 | ||
28 | +process.argv.forEach(function (val) { | ||
29 | + switch (val) { | ||
30 | + case '-v': verbose = true; break; | ||
31 | + case '-v!': extraVerbose = true; break; | ||
32 | + } | ||
33 | +}); | ||
34 | + | ||
26 | var scFiles = fs.readdirSync(scenarioRoot); | 35 | var scFiles = fs.readdirSync(scenarioRoot); |
36 | +console.log(); | ||
27 | console.log('Mock Server v1.0'); | 37 | console.log('Mock Server v1.0'); |
38 | +if (verbose || extraVerbose) { | ||
39 | + console.log('Verbose=' + verbose, 'ExtraVerbose=' + extraVerbose); | ||
40 | +} | ||
28 | console.log('================'); | 41 | console.log('================'); |
29 | listScenarios(); | 42 | listScenarios(); |
30 | 43 | ||
... | @@ -62,6 +75,15 @@ function originIsAllowed(origin) { | ... | @@ -62,6 +75,15 @@ function originIsAllowed(origin) { |
62 | return true; | 75 | return true; |
63 | } | 76 | } |
64 | 77 | ||
78 | +// displays the message if our arguments say we should | ||
79 | +function displayMsg(msg) { | ||
80 | + var ev = JSON.parse(msg); | ||
81 | + switch (ev.event) { | ||
82 | + case 'topoHeartbeat': return extraVerbose; | ||
83 | + default: return true; | ||
84 | + } | ||
85 | +} | ||
86 | + | ||
65 | wsServer.on('request', function(request) { | 87 | wsServer.on('request', function(request) { |
66 | console.log(); // newline after prompt | 88 | console.log(); // newline after prompt |
67 | console.log("Origin: ", request.origin); | 89 | console.log("Origin: ", request.origin); |
... | @@ -81,15 +103,19 @@ wsServer.on('request', function(request) { | ... | @@ -81,15 +103,19 @@ wsServer.on('request', function(request) { |
81 | rl.prompt(); | 103 | rl.prompt(); |
82 | 104 | ||
83 | connection.on('message', function(message) { | 105 | connection.on('message', function(message) { |
84 | - if (message.type === 'utf8') { | 106 | + if (verbose || extraVerbose) { |
85 | - console.log(); // newline after prompt | 107 | + if (message.type === 'utf8') { |
86 | - console.log('Received Message: ' + message.utf8Data); | 108 | + if (displayMsg(message.utf8Data)) { |
87 | - //connection.sendUTF(message.utf8Data); | 109 | + console.log(); // newline after prompt |
88 | - rl.prompt(); | 110 | + console.log('Received Message: ' + message.utf8Data); |
89 | - } | 111 | + } |
90 | - else if (message.type === 'binary') { | 112 | + //connection.sendUTF(message.utf8Data); |
91 | - console.log('Received Binary Message of ' + message.binaryData.length + ' bytes'); | 113 | + rl.prompt(); |
92 | - //connection.sendBytes(message.binaryData); | 114 | + } |
115 | + else if (message.type === 'binary') { | ||
116 | + console.log('Received Binary Message of ' + message.binaryData.length + ' bytes'); | ||
117 | + //connection.sendBytes(message.binaryData); | ||
118 | + } | ||
93 | } | 119 | } |
94 | }); | 120 | }); |
95 | connection.on('close', function(reasonCode, description) { | 121 | connection.on('close', function(reasonCode, description) { | ... | ... |
-
Please register or login to post a comment