Skip to content

Commit

Permalink
adding survey with continuous switch
Browse files Browse the repository at this point in the history
  • Loading branch information
mwfarb committed Oct 23, 2019
1 parent ccbd0c1 commit d645ac2
Show file tree
Hide file tree
Showing 7 changed files with 117 additions and 81 deletions.
3 changes: 1 addition & 2 deletions webapp/lib/traceroutecont.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func GetTracerouteByTimeHandler(w http.ResponseWriter, r *http.Request, active b
returnError(w, err)
return
}
// log.Debug("Requested data:", "tracerouteResults", tracerouteResults)
log.Debug("Requested data:", "tracerouteResults", tracerouteResults)

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

//log.Debug(string(jsonBuf))
// ensure % if any, is escaped correctly before writing to printf formatter
fmt.Fprintf(w, strings.Replace(string(jsonBuf), "%", "%%", -1))
}
77 changes: 30 additions & 47 deletions webapp/tests/asviz/traceroute-d.json
Original file line number Diff line number Diff line change
@@ -1,70 +1,53 @@
{
"graph": [
{
"Inserted": 1562179946689,
"ActualDuration": 50,
"Inserted": 1570192000394,
"ActualDuration": 35,
"TrHops": [
{
"HopIa": "1-ff00:0:111",
"HopAddr": "127.0.0.74",
"IntfID": 103,
"RespTime1": 0.896,
"RespTime2": 1.482,
"RespTime3": 1.915
"HopAddr": "127.0.0.17",
"IntfID": 41,
"RespTime1": 0.558,
"RespTime2": 0.439,
"RespTime3": 0.41
},
{
"HopIa": "1-ff00:0:112",
"HopAddr": "127.0.0.82",
"IntfID": 4094,
"RespTime1": 1.39,
"RespTime2": 0.772,
"RespTime3": 0.856
"HopIa": "1-ff00:0:110",
"HopAddr": "127.0.0.9",
"IntfID": 1,
"RespTime1": 0.577,
"RespTime2": 0.597,
"RespTime3": 0.601
},
{
"HopIa": "1-ff00:0:112",
"HopAddr": "127.0.0.2",
"IntfID": -1,
"RespTime1": 1.057,
"RespTime2": 0.85,
"RespTime3": 0.866
}
],
"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",
"Path": "Hops: [1-ff00:0:111 103>4094 1-ff00:0:112] Mtu: 1450",
"Error": ""
},
{
"Inserted": 1562179946298,
"ActualDuration": 73,
"TrHops": [
{
"HopIa": "1-ff00:0:111",
"HopAddr": "127.0.0.74",
"IntfID": 103,
"RespTime1": 1.189,
"RespTime2": 0.847,
"RespTime3": 0.707
"HopIa": "1-ff00:0:110",
"HopAddr": "127.0.0.10",
"IntfID": 2,
"RespTime1": 0.797,
"RespTime2": 0.666,
"RespTime3": 0.771
},
{
"HopIa": "1-ff00:0:112",
"HopAddr": "127.0.0.82",
"IntfID": 4094,
"RespTime1": 5.503,
"RespTime2": 1.127,
"RespTime3": 1.486
"HopAddr": "127.0.0.25",
"IntfID": 1,
"RespTime1": 1.18,
"RespTime2": 1.922,
"RespTime3": 1.322
},
{
"HopIa": "1-ff00:0:112",
"HopAddr": "127.0.0.2",
"IntfID": -1,
"RespTime1": 1.051,
"RespTime2": 1.331,
"RespTime3": 3.499
"RespTime1": 1.107,
"RespTime2": 0.899,
"RespTime3": 0.835
}
],
"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",
"Path": "Hops: [1-ff00:0:111 103>4094 1-ff00:0:112] Mtu: 1450",
"Error": ""
"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",
"Error": "",
"Path": "Hops: [1-ff00:0:111 41>1 1-ff00:0:110 2>1 1-ff00:0:112] Mtu: 1280"
}
],
"active": false
Expand Down
17 changes: 16 additions & 1 deletion webapp/web/static/js/asviz.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ function setPaths(type, idx, open) {
} else if (type == 'UP') {
addSegments(resUp, idx, num, colorSegUp, type);
} else if (type == 'PATH') {
var latencies = getPathLatencyAvg(formatPathString(resPath, idx, type));
var latencies = getPathLatencyAvg(formatPathString(resPath, idx,
type));
addPaths(resPath, idx, num, colorPaths, type, latencies);
}
self.segType = type;
Expand Down Expand Up @@ -109,6 +110,20 @@ function formatPathString(res, idx, type) {
return path;
}

function formatPathStringAll(res, type) {
var paths = "";
for (var i = 0; i < res.if_lists.length; i++) {
var path = formatPathString(res, i, type);
if (path != "") {
if (i > 0) {
paths += ",";
}
paths += formatPathString(res, i, type);
}
}
return paths;
}

/*
* Adds D3 forwarding path links with arrows and a title to paths graph.
*/
Expand Down
6 changes: 4 additions & 2 deletions webapp/web/static/js/tab-paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,8 @@ function setEchoLatency(hops, latency) {
path = jPathsAvailable[hops];
}
path.latency = updateStats(latency, path.latency);
var latStr = parseFloat(path.latency.Last).toFixed(1);
$('#path-lat-' + path.listIdx).html(latStr);
jPathsAvailable[hops] = path;
return path;
}

function setTracerouteLatency(hops, interfaces) {
Expand Down Expand Up @@ -775,6 +774,9 @@ function addAvailablePaths(paths) {
Object.keys(jPathsAvailable).forEach(function(key) {
jPathsAvailable[key].listIdx = undefined; // reset
});
if (!paths) {
return;
}
for (var idx = 0; idx < paths.length; idx++) {
var hops = formatPathJson(paths, idx, 'PATH');
if (!jPathsAvailable[hops]) {
Expand Down
33 changes: 27 additions & 6 deletions webapp/web/static/js/tab-topocola.js
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,9 @@ function update() {
"middle").style("font-size", "12px").style("fill", "purple").attr(
"class", function(d) {
return "latency " + d.type;
}).text(function(d) {
}).attr("id", function(d) {
return d.id;
}).text(function(d) {
return d.latency ? parseFloat(d.latency).toFixed(1) : '';
});
markerText.exit().remove();
Expand Down Expand Up @@ -609,7 +611,7 @@ function addFixedLabel(label, x, y, lastLabel) {
/*
* Post-rendering method to draw path arcs for the given path and color.
*/
function drawPath(res, path, color, latencies) {
function drawPath(res, path, color, lats) {
// get the index of the routes to render
var routes = [];
if (path < 0) {
Expand Down Expand Up @@ -642,25 +644,44 @@ function drawPath(res, path, color, latencies) {
graphPath.links = graphPath.links.filter(function(link) {
return !link.path;
});
var fullLat = fullPathLatencies(lats);
for (var i = 0; i < path_ids.length - 1; i++) {
// prevent src == dst links from being formed
if (path_ids[i] != path_ids[i + 1]) {
console.warn(latencies)
var latInterIntra = latencies ? (latencies[(i * 2) + 1] + latencies[(i * 2) + 2])
: undefined;
var linkLat = undefined;
if (fullLat) {
// report latency from target AS
linkLat = lats ? (lats[i + 2]) : undefined;
}
graphPath.links.push({
"color" : color,
"path" : true,
"source" : graphPath["ids"][path_ids[i]],
"target" : graphPath["ids"][path_ids[i + 1]],
"type" : "PARENT",
"latency" : latInterIntra,
"latency" : linkLat,
"id" : "path-lat-" + path + "-" + i, // TODO
});
}
}
update();
}

/**
* Interrogate latencies for missing values.
*/
function fullPathLatencies(lats) {
if (!lats) {
return false;
}
for (var i = 0; i < lats.length; i++) {
if (!lats[i]) {
return false;
}
}
return true;
}

/*
* Removes all path arcs from the graph.
*/
Expand Down
21 changes: 16 additions & 5 deletions webapp/web/static/js/webapp.js
Original file line number Diff line number Diff line change
Expand Up @@ -483,10 +483,12 @@ function requestEchoByTime(form_data) {
var time = d.graph[i].Inserted - d.graph[i].ActualDuration;
updatePingGraph(chartSE, data, time)

// update latency stats, when valid
// update latency stats, when valid, use average
if (d.graph[i].ResponseTime > 0) {
setEchoLatency(d.graph[i].Path.match("\\[.*]"),
d.graph[i].ResponseTime);
var path = setEchoLatency(d.graph[i].Path
.match("\\[.*]"), d.graph[i].ResponseTime);
var latStr = parseFloat(path.latency.Avg).toFixed(1);
$('#path-lat-' + path.listIdx).html(latStr);
}
}
}
Expand All @@ -507,7 +509,11 @@ function requestTraceRouteByTime(form_data) {
} else {
enableTestControls(true);
releaseTabs();
clearInterval(intervalGraphData);
if (d.graph != null) {
clearInterval(intervalGraphData);
} else {
lastTimeBwDb = form_data.since;
}
}
}
if (d.graph != null) {
Expand Down Expand Up @@ -683,6 +689,11 @@ function command(continuous) {
name : "pathStr",
value : formatPathString(resPath, self.segNum, self.segType)
});
} else if (continuous) { // all paths in survey
form_data.push({
name : "pathStr",
value : formatPathStringAll(resPath, 'PATH')
});
}
}
if (activeApp == "bwtester") {
Expand Down Expand Up @@ -827,7 +838,7 @@ function handleContResponse(resp, continuous, startTime) {
clearInterval(intervalGraphData);
}
if (!continuous) {
manageTestData();
manageTestData(startTime);
}
}

Expand Down
Loading

0 comments on commit d645ac2

Please sign in to comment.