Skip to content

Commit d645ac2

Browse files
committed
adding survey with continuous switch
1 parent ccbd0c1 commit d645ac2

File tree

7 files changed

+117
-81
lines changed

7 files changed

+117
-81
lines changed

webapp/lib/traceroutecont.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ func GetTracerouteByTimeHandler(w http.ResponseWriter, r *http.Request, active b
144144
returnError(w, err)
145145
return
146146
}
147-
// log.Debug("Requested data:", "tracerouteResults", tracerouteResults)
147+
log.Debug("Requested data:", "tracerouteResults", tracerouteResults)
148148

149149
tracerouteJSON, err := json.Marshal(tracerouteResults)
150150
if CheckError(err) {
@@ -156,7 +156,6 @@ func GetTracerouteByTimeHandler(w http.ResponseWriter, r *http.Request, active b
156156
jsonBuf = append(jsonBuf, json...)
157157
jsonBuf = append(jsonBuf, []byte(`}`)...)
158158

159-
//log.Debug(string(jsonBuf))
160159
// ensure % if any, is escaped correctly before writing to printf formatter
161160
fmt.Fprintf(w, strings.Replace(string(jsonBuf), "%", "%%", -1))
162161
}

webapp/tests/asviz/traceroute-d.json

Lines changed: 30 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,53 @@
11
{
22
"graph": [
33
{
4-
"Inserted": 1562179946689,
5-
"ActualDuration": 50,
4+
"Inserted": 1570192000394,
5+
"ActualDuration": 35,
66
"TrHops": [
77
{
88
"HopIa": "1-ff00:0:111",
9-
"HopAddr": "127.0.0.74",
10-
"IntfID": 103,
11-
"RespTime1": 0.896,
12-
"RespTime2": 1.482,
13-
"RespTime3": 1.915
9+
"HopAddr": "127.0.0.17",
10+
"IntfID": 41,
11+
"RespTime1": 0.558,
12+
"RespTime2": 0.439,
13+
"RespTime3": 0.41
1414
},
1515
{
16-
"HopIa": "1-ff00:0:112",
17-
"HopAddr": "127.0.0.82",
18-
"IntfID": 4094,
19-
"RespTime1": 1.39,
20-
"RespTime2": 0.772,
21-
"RespTime3": 0.856
16+
"HopIa": "1-ff00:0:110",
17+
"HopAddr": "127.0.0.9",
18+
"IntfID": 1,
19+
"RespTime1": 0.577,
20+
"RespTime2": 0.597,
21+
"RespTime3": 0.601
2222
},
2323
{
24-
"HopIa": "1-ff00:0:112",
25-
"HopAddr": "127.0.0.2",
26-
"IntfID": -1,
27-
"RespTime1": 1.057,
28-
"RespTime2": 0.85,
29-
"RespTime3": 0.866
30-
}
31-
],
32-
"CmdOutput": "Using path:\n Hops: [1-ff00:0:111 103>4094 1-ff00:0:112] Mtu: 1450\n0 1-ff00:0:111,[127.0.0.74] IfID=103 896µs 1.482ms 1.915ms\n1 1-ff00:0:112,[127.0.0.82] IfID=4094 1.39ms 772µs 856µs\n2 1-ff00:0:112,[127.0.0.2] 1.057ms 850µs 866µs\n",
33-
"Path": "Hops: [1-ff00:0:111 103>4094 1-ff00:0:112] Mtu: 1450",
34-
"Error": ""
35-
},
36-
{
37-
"Inserted": 1562179946298,
38-
"ActualDuration": 73,
39-
"TrHops": [
40-
{
41-
"HopIa": "1-ff00:0:111",
42-
"HopAddr": "127.0.0.74",
43-
"IntfID": 103,
44-
"RespTime1": 1.189,
45-
"RespTime2": 0.847,
46-
"RespTime3": 0.707
24+
"HopIa": "1-ff00:0:110",
25+
"HopAddr": "127.0.0.10",
26+
"IntfID": 2,
27+
"RespTime1": 0.797,
28+
"RespTime2": 0.666,
29+
"RespTime3": 0.771
4730
},
4831
{
4932
"HopIa": "1-ff00:0:112",
50-
"HopAddr": "127.0.0.82",
51-
"IntfID": 4094,
52-
"RespTime1": 5.503,
53-
"RespTime2": 1.127,
54-
"RespTime3": 1.486
33+
"HopAddr": "127.0.0.25",
34+
"IntfID": 1,
35+
"RespTime1": 1.18,
36+
"RespTime2": 1.922,
37+
"RespTime3": 1.322
5538
},
5639
{
5740
"HopIa": "1-ff00:0:112",
5841
"HopAddr": "127.0.0.2",
5942
"IntfID": -1,
60-
"RespTime1": 1.051,
61-
"RespTime2": 1.331,
62-
"RespTime3": 3.499
43+
"RespTime1": 1.107,
44+
"RespTime2": 0.899,
45+
"RespTime3": 0.835
6346
}
6447
],
65-
"CmdOutput": "Using path:\n Hops: [1-ff00:0:111 103>4094 1-ff00:0:112] Mtu: 1450\n0 1-ff00:0:111,[127.0.0.74] IfID=103 1.189ms 847µs 707µs\n1 1-ff00:0:112,[127.0.0.82] IfID=4094 5.503ms 1.127ms 1.486ms\n2 1-ff00:0:112,[127.0.0.2] 1.051ms 1.331ms 3.499ms\n",
66-
"Path": "Hops: [1-ff00:0:111 103>4094 1-ff00:0:112] Mtu: 1450",
67-
"Error": ""
48+
"CmdOutput": "Available paths to 1-ff00:0:112\n[ 0] Hops: [1-ff00:0:111 41>1 1-ff00:0:110 2>1 1-ff00:0:112] Mtu: 1280\nChoose path: Using path:\n Hops: [1-ff00:0:111 41>1 1-ff00:0:110 2>1 1-ff00:0:112] Mtu: 1280\n0 1-ff00:0:111,[127.0.0.17] IfID=41 558µs 439µs 410µs\n1 1-ff00:0:110,[127.0.0.9] IfID=1 577µs 597µs 601µs\n2 1-ff00:0:110,[127.0.0.10] IfID=2 797µs 666µs 771µs\n3 1-ff00:0:112,[127.0.0.25] IfID=1 1.18ms 1.922ms 1.322ms\n4 1-ff00:0:112,[127.0.0.2] 1.107ms 899µs 835µs\n",
49+
"Error": "",
50+
"Path": "Hops: [1-ff00:0:111 41>1 1-ff00:0:110 2>1 1-ff00:0:112] Mtu: 1280"
6851
}
6952
],
7053
"active": false

webapp/web/static/js/asviz.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ function setPaths(type, idx, open) {
6868
} else if (type == 'UP') {
6969
addSegments(resUp, idx, num, colorSegUp, type);
7070
} else if (type == 'PATH') {
71-
var latencies = getPathLatencyAvg(formatPathString(resPath, idx, type));
71+
var latencies = getPathLatencyAvg(formatPathString(resPath, idx,
72+
type));
7273
addPaths(resPath, idx, num, colorPaths, type, latencies);
7374
}
7475
self.segType = type;
@@ -109,6 +110,20 @@ function formatPathString(res, idx, type) {
109110
return path;
110111
}
111112

113+
function formatPathStringAll(res, type) {
114+
var paths = "";
115+
for (var i = 0; i < res.if_lists.length; i++) {
116+
var path = formatPathString(res, i, type);
117+
if (path != "") {
118+
if (i > 0) {
119+
paths += ",";
120+
}
121+
paths += formatPathString(res, i, type);
122+
}
123+
}
124+
return paths;
125+
}
126+
112127
/*
113128
* Adds D3 forwarding path links with arrows and a title to paths graph.
114129
*/

webapp/web/static/js/tab-paths.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,8 @@ function setEchoLatency(hops, latency) {
100100
path = jPathsAvailable[hops];
101101
}
102102
path.latency = updateStats(latency, path.latency);
103-
var latStr = parseFloat(path.latency.Last).toFixed(1);
104-
$('#path-lat-' + path.listIdx).html(latStr);
105103
jPathsAvailable[hops] = path;
104+
return path;
106105
}
107106

108107
function setTracerouteLatency(hops, interfaces) {
@@ -775,6 +774,9 @@ function addAvailablePaths(paths) {
775774
Object.keys(jPathsAvailable).forEach(function(key) {
776775
jPathsAvailable[key].listIdx = undefined; // reset
777776
});
777+
if (!paths) {
778+
return;
779+
}
778780
for (var idx = 0; idx < paths.length; idx++) {
779781
var hops = formatPathJson(paths, idx, 'PATH');
780782
if (!jPathsAvailable[hops]) {

webapp/web/static/js/tab-topocola.js

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,9 @@ function update() {
333333
"middle").style("font-size", "12px").style("fill", "purple").attr(
334334
"class", function(d) {
335335
return "latency " + d.type;
336-
}).text(function(d) {
336+
}).attr("id", function(d) {
337+
return d.id;
338+
}).text(function(d) {
337339
return d.latency ? parseFloat(d.latency).toFixed(1) : '';
338340
});
339341
markerText.exit().remove();
@@ -609,7 +611,7 @@ function addFixedLabel(label, x, y, lastLabel) {
609611
/*
610612
* Post-rendering method to draw path arcs for the given path and color.
611613
*/
612-
function drawPath(res, path, color, latencies) {
614+
function drawPath(res, path, color, lats) {
613615
// get the index of the routes to render
614616
var routes = [];
615617
if (path < 0) {
@@ -642,25 +644,44 @@ function drawPath(res, path, color, latencies) {
642644
graphPath.links = graphPath.links.filter(function(link) {
643645
return !link.path;
644646
});
647+
var fullLat = fullPathLatencies(lats);
645648
for (var i = 0; i < path_ids.length - 1; i++) {
646649
// prevent src == dst links from being formed
647650
if (path_ids[i] != path_ids[i + 1]) {
648-
console.warn(latencies)
649-
var latInterIntra = latencies ? (latencies[(i * 2) + 1] + latencies[(i * 2) + 2])
650-
: undefined;
651+
var linkLat = undefined;
652+
if (fullLat) {
653+
// report latency from target AS
654+
linkLat = lats ? (lats[i + 2]) : undefined;
655+
}
651656
graphPath.links.push({
652657
"color" : color,
653658
"path" : true,
654659
"source" : graphPath["ids"][path_ids[i]],
655660
"target" : graphPath["ids"][path_ids[i + 1]],
656661
"type" : "PARENT",
657-
"latency" : latInterIntra,
662+
"latency" : linkLat,
663+
"id" : "path-lat-" + path + "-" + i, // TODO
658664
});
659665
}
660666
}
661667
update();
662668
}
663669

670+
/**
671+
* Interrogate latencies for missing values.
672+
*/
673+
function fullPathLatencies(lats) {
674+
if (!lats) {
675+
return false;
676+
}
677+
for (var i = 0; i < lats.length; i++) {
678+
if (!lats[i]) {
679+
return false;
680+
}
681+
}
682+
return true;
683+
}
684+
664685
/*
665686
* Removes all path arcs from the graph.
666687
*/

webapp/web/static/js/webapp.js

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -483,10 +483,12 @@ function requestEchoByTime(form_data) {
483483
var time = d.graph[i].Inserted - d.graph[i].ActualDuration;
484484
updatePingGraph(chartSE, data, time)
485485

486-
// update latency stats, when valid
486+
// update latency stats, when valid, use average
487487
if (d.graph[i].ResponseTime > 0) {
488-
setEchoLatency(d.graph[i].Path.match("\\[.*]"),
489-
d.graph[i].ResponseTime);
488+
var path = setEchoLatency(d.graph[i].Path
489+
.match("\\[.*]"), d.graph[i].ResponseTime);
490+
var latStr = parseFloat(path.latency.Avg).toFixed(1);
491+
$('#path-lat-' + path.listIdx).html(latStr);
490492
}
491493
}
492494
}
@@ -507,7 +509,11 @@ function requestTraceRouteByTime(form_data) {
507509
} else {
508510
enableTestControls(true);
509511
releaseTabs();
510-
clearInterval(intervalGraphData);
512+
if (d.graph != null) {
513+
clearInterval(intervalGraphData);
514+
} else {
515+
lastTimeBwDb = form_data.since;
516+
}
511517
}
512518
}
513519
if (d.graph != null) {
@@ -683,6 +689,11 @@ function command(continuous) {
683689
name : "pathStr",
684690
value : formatPathString(resPath, self.segNum, self.segType)
685691
});
692+
} else if (continuous) { // all paths in survey
693+
form_data.push({
694+
name : "pathStr",
695+
value : formatPathStringAll(resPath, 'PATH')
696+
});
686697
}
687698
}
688699
if (activeApp == "bwtester") {
@@ -827,7 +838,7 @@ function handleContResponse(resp, continuous, startTime) {
827838
clearInterval(intervalGraphData);
828839
}
829840
if (!continuous) {
830-
manageTestData();
841+
manageTestData(startTime);
831842
}
832843
}
833844

0 commit comments

Comments
 (0)