Skip to content

Commit 21e9004

Browse files
committed
[WIP] traceroute gui [webapp]
1 parent 8abb71b commit 21e9004

File tree

4 files changed

+98
-3
lines changed

4 files changed

+98
-3
lines changed

webapp/config/servers_default.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,5 +96,31 @@
9696
"addr": "203.230.60.98",
9797
"port": 40002
9898
}
99+
],
100+
"traceroute": [
101+
{
102+
"name": "17-ffaa:0:1107 Attachment Point",
103+
"isdas": "17-ffaa:0:1107",
104+
"addr": "192.33.93.195",
105+
"port": 40002
106+
},
107+
{
108+
"name": "18-ffaa:0:1202 Attachment Point",
109+
"isdas": "18-ffaa:0:1202",
110+
"addr": "128.105.21.208",
111+
"port": 40002
112+
},
113+
{
114+
"name": "19-ffaa:0:1303 Attachment Point",
115+
"isdas": "19-ffaa:0:1303",
116+
"addr": "141.44.25.144",
117+
"port": 40002
118+
},
119+
{
120+
"name": "20-ffaa:0:1404 Attachment Point",
121+
"isdas": "20-ffaa:0:1404",
122+
"addr": "203.230.60.98",
123+
"port": 40002
124+
}
99125
]
100126
}

webapp/lib/config.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ func GenServerNodeDefaults(srcpath string) {
101101
serIaDef + `", "addr":"` + serDefAddr + `","port":` + serPortDefSen + `}], `)
102102
jsonBuf = append(jsonBuf, json...)
103103
json = []byte(`"echo": [{"name":"localhost","isdas":"` +
104+
serIaDef + `", "addr":"` + serDefAddr + `","port":` + serPortDefSen + `}], `)
105+
jsonBuf = append(jsonBuf, json...)
106+
json = []byte(`"traceroute": [{"name":"localhost","isdas":"` +
104107
serIaDef + `", "addr":"` + serDefAddr + `","port":` + serPortDefSen + `}]`)
105108
jsonBuf = append(jsonBuf, json...)
106109

webapp/static/js/webapp.js

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,13 @@ function showOnlyConsoleGraphs(activeApp) {
119119
$('#echo-continuous').css("display",
120120
(activeApp == "echo") ? "block" : "none");
121121
var isConsole = (activeApp == "bwtester" || activeApp == "camerapp"
122-
|| activeApp == "sensorapp" || activeApp == "echo");
122+
|| activeApp == "sensorapp" || activeApp == "echo" || activeApp == "traceroute");
123123
$('.stdout').css("display", isConsole ? "block" : "none");
124124
}
125125

126126
function handleSwitchTabs() {
127127
var activeApp = $('.nav-tabs .active > a').attr('name');
128-
var isCont = (activeApp == "bwtester" || activeApp == "echo");
128+
var isCont = (activeApp == "bwtester" || activeApp == "echo" || activeApp == "traceroute");
129129
enableContControls(isCont);
130130
// show/hide graphs for bwtester
131131
showOnlyConsoleGraphs(activeApp);
@@ -364,6 +364,8 @@ function manageTestData() {
364364
requestBwTestByTime(form_data);
365365
} else if (activeApp == "echo") {
366366
requestEchoByTime(form_data);
367+
} else if (activeApp == "traceroute") {
368+
requestTraceRouteByTime(form_data);
367369
}
368370
lastTimeBwDb = now;
369371
}, dataIntervalMs);
@@ -467,6 +469,42 @@ function requestEchoByTime(form_data) {
467469
});
468470
}
469471

472+
function requestTraceRouteByTime(form_data) {
473+
$.post("/gettraceroutebytime", form_data, function(json) {
474+
var d = JSON.parse(json);
475+
console.info('resp:', JSON.stringify(d));
476+
if (d != null) {
477+
if (d.active != null) {
478+
$('#switch_cont').prop("checked", d.active);
479+
if (d.active) {
480+
enableTestControls(false);
481+
lockTab("traceroute");
482+
} else {
483+
enableTestControls(true);
484+
releaseTabs();
485+
clearInterval(intervalGraphData);
486+
}
487+
}
488+
if (d.graph != null) {
489+
// write data on graph
490+
for (var i = 0; i < d.graph.length; i++) {
491+
if (d.graph[i].CmdOutput != null
492+
&& d.graph[i].CmdOutput != "") {
493+
// result returned, display it and reset progress
494+
handleEndCmdDisplay(d.graph[i].CmdOutput);
495+
}
496+
497+
console.info(JSON.stringify(data));
498+
console.info('continous traceroute', 'duration:',
499+
d.graph[i].ActualDuration, 'ms');
500+
501+
// TODO (mwfarb): implement traceroute graph
502+
}
503+
}
504+
}
505+
});
506+
}
507+
470508
function refreshTickData(chart, newTime) {
471509
var x = newTime, y = null;
472510
var series0 = chart.series[0];
@@ -587,7 +625,8 @@ function command(continuous) {
587625
name : "apps",
588626
value : activeApp
589627
});
590-
if (activeApp == "bwtester" || activeApp == "echo") {
628+
if (activeApp == "bwtester" || activeApp == "echo"
629+
|| activeApp == "traceroute") {
591630
// add extra bwtester options required
592631
form_data.push({
593632
name : "continuous",
@@ -639,6 +678,8 @@ function command(continuous) {
639678
} else if (activeApp == "echo") {
640679
// check for usable data for graphing
641680
handleContResponse(resp, continuous, startTime);
681+
} else if (activeApp == "traceroute") {
682+
handleContResponse(resp, continuous, startTime);
642683
} else {
643684
handleGeneralResponse();
644685
}
@@ -685,13 +726,15 @@ function lockTab(href) {
685726
enableTab("camerapp", "camerapp" == href);
686727
enableTab("sensorapp", "sensorapp" == href);
687728
enableTab("echo", "echo" == href);
729+
enableTab("traceroute", "traceroute" == href);
688730
}
689731

690732
function releaseTabs() {
691733
enableTab("bwtester", true);
692734
enableTab("camerapp", true);
693735
enableTab("sensorapp", true);
694736
enableTab("echo", true);
737+
enableTab("traceroute", true);
695738
}
696739

697740
function enableTab(href, enable) {

webapp/template/index.html

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ <h2>SCIONLab Apps</h2>
6969
<li><a data-toggle="tab" name="camerapp" href="#camerapp">camerapp</a></li>
7070
<li><a data-toggle="tab" name="sensorapp" href="#sensorapp">sensorapp</a></li>
7171
<li><a data-toggle="tab" name="echo" href="#echo">echo</a></li>
72+
<li><a data-toggle="tab" name="traceroute" href="#traceroute">traceroute</a></li>
7273
</ul>
7374
<div id="tab-content-apps" class="tab-content">
7475

@@ -265,6 +266,28 @@ <h2>SCIONLab Apps</h2>
265266

266267
</div>
267268

269+
270+
<!-- SCMP TRACEROUTE APP CONTENT -->
271+
<div id="traceroute" class="tab-pane fade">
272+
273+
<div id="svg-sc" class="bwtest-svg">
274+
<svg class="svg-dials" viewBox="0 0 300 150">
275+
<line x1="290" y1="42" x2="21" y2="42" stroke-width="70"
276+
marker-end="url(#sc-arrowhead)" />
277+
</svg>
278+
</div>
279+
280+
<span id="traceroute_text"></span><br> Interval: <input
281+
name="traceroute_sec" id="traceroute_sec" type="number"
282+
style="width: 45px;" min="1" max="10" value="1"> sec.
283+
Additional Argument: <span
284+
tooltip="Use the equal sign, '=', between argument and parameter."><input
285+
type="text" id="addl_opttr" name="addl_opttr"
286+
style="width: 200px;"> </span>
287+
288+
</div>
289+
290+
268291
</div>
269292

270293
</div>

0 commit comments

Comments
 (0)