Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions webapp/lib/echocont.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ func ExtractEchoRespData(resp string, d *model.EchoItem, start time.Time) {
// store current epoch in ms
d.Inserted = time.Now().UnixNano() / 1e6

log.Info("resp response", "content", resp)

var data = make(map[string]float32)
// -1 if no match for response time, indicating response timeout or packets out of order
data["response_time"] = -1
Expand Down
126 changes: 63 additions & 63 deletions webapp/models/traceroute.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,10 @@ func createTracerouteTable() error {
CAddr TEXT,
SIa TEXT,
SAddr TEXT,
Timeout REAL,
CmdOutput TEXT,
Error TEXT,
Path TEXT
Timeout REAL,
CmdOutput TEXT,
Error TEXT,
Path TEXT
);
`
_, err := db.Exec(sqlCreateTable)
Expand All @@ -153,13 +153,13 @@ func createTrHopTable() error {
CREATE TABLE IF NOT EXISTS trhops(
Inserted BIGINT NOT NULL PRIMARY KEY,
RunTimeKey BIGINT,
Ord INT,
HopIa TEXT,
HopAddr TEXT,
Ord INT,
HopIa TEXT,
HopAddr TEXT,
IntfID INT,
RespTime1 REAL,
RespTime2 REAL,
RespTime3 REAL
RespTime1 REAL,
RespTime2 REAL,
RespTime3 REAL
);
`
_, err := db.Exec(sqlCreateTable)
Expand All @@ -170,16 +170,16 @@ func createTrHopTable() error {
func StoreTracerouteItem(tr *TracerouteItem) error {
sqlInsert := `
INSERT INTO traceroute(
Inserted,
Inserted,
ActualDuration,
CIa,
CAddr,
SIa,
SAddr,
Timeout,
CmdOutput,
Error,
Path
Timeout,
CmdOutput,
Error,
Path
) values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
`
stmt, err := db.Prepare(sqlInsert)
Expand All @@ -206,15 +206,15 @@ func StoreTracerouteItem(tr *TracerouteItem) error {
func StoreTrHopItem(hop *TrHopItem) error {
sqlInsert := `
INSERT INTO trhops(
Inserted,
Inserted,
RunTimeKey,
Ord,
HopIa,
HopAddr,
HopIa,
HopAddr,
IntfID,
RespTime1,
RespTime2,
RespTime3
RespTime1,
RespTime2,
RespTime3
) values(?, ?, ?, ?, ?, ?, ?, ?, ?)
`
stmt, err := db.Prepare(sqlInsert)
Expand All @@ -239,18 +239,18 @@ func StoreTrHopItem(hop *TrHopItem) error {
// ReadTracerouteItemsAll operates on the DB to return all traceroute rows.
func ReadTracerouteItemsAll() ([]TracerouteItem, error) {
sqlReadAll := `
SELECT
Inserted,
ActualDuration,
CIa,
CAddr,
SIa,
SAddr,
Timeout,
CmdOutput,
Error,
Path
FROM traceroute
SELECT
Inserted,
ActualDuration,
CIa,
CAddr,
SIa,
SAddr,
Timeout,
CmdOutput,
Error,
Path
FROM traceroute
ORDER BY datetime(Inserted) DESC
`
rows, err := db.Query(sqlReadAll)
Expand Down Expand Up @@ -285,36 +285,36 @@ func ReadTracerouteItemsAll() ([]TracerouteItem, error) {
// which are more recent than the 'since' epoch in ms.
func ReadTracerouteItemsSince(since string) ([]TracerouteGraph, error) {
sqlReadSince := `
SELECT
a.Inserted,
a.ActualDuration,
h.Ord,
h.HopIa,
h.HopAddr,
h.IntfID,
h.RespTime1,
h.RespTime2,
h.RespTime3,
a.CmdOutput,
a.Error,
a.Path
FROM (
SELECT
Inserted,
ActualDuration,
CIa,
CAddr,
SIa,
SAddr,
Timeout,
CmdOutput,
Error,
Path
FROM traceroute
WHERE Inserted > ?
) AS a
INNER JOIN trhops AS h ON a.Inserted = h.RunTimeKey
ORDER BY datetime(a.Inserted) DESC
SELECT
a.Inserted,
a.ActualDuration,
h.Ord,
h.HopIa,
h.HopAddr,
h.IntfID,
h.RespTime1,
h.RespTime2,
h.RespTime3,
a.CmdOutput,
a.Error,
a.Path
FROM (
SELECT
Inserted,
ActualDuration,
CIa,
CAddr,
SIa,
SAddr,
Timeout,
CmdOutput,
Error,
Path
FROM traceroute
WHERE Inserted > ?
) AS a
INNER JOIN trhops AS h ON a.Inserted = h.RunTimeKey
ORDER BY datetime(a.Inserted) DESC
`
rows, err := db.Query(sqlReadSince, since)
if err != nil {
Expand Down
16 changes: 16 additions & 0 deletions webapp/tests/asviz/bwtester-d.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"graph": [
{
"Inserted": 1562683731800,
"ActualDuration": 5041,
"CSBandwidth": 80000,
"CSThroughput": 80000,
"SCBandwidth": 80000,
"SCThroughput": 80000,
"Error": "",
"Path": "Hops: [1-ff00:0:111 103>4094 1-ff00:0:112] Mtu: 1450",
"Log": "t=2019-07-09T10:48:46-0400 lvl=dbug msg=\"Path selection algorithm choice\" path=\"Hops: [1-ff00:0:111 103>4094 1-ff00:0:112] Mtu: 1450\" score=0.993\nt=2019-07-09T10:48:46-0400 lvl=dbug msg=\"Registered with dispatcher\" addr=\"1-ff00:0:111,[127.0.0.1]:30001 (UDP)\"\nClient DC \tNext Hop [127.0.0.74]:31070\tServer Host [127.0.0.2]:30101\nt=2019-07-09T10:48:46-0400 lvl=dbug msg=\"Registered with dispatcher\" addr=\"1-ff00:0:111,[127.0.0.1]:30002 (UDP)\"\n\nTest parameters:\nclientDCAddr -> serverDCAddr 1-ff00:0:111,[127.0.0.1]:30002 (UDP) -> 1-ff00:0:112,[127.0.0.2]:30101 (UDP)\nclient->server: 3 seconds, 1000 bytes, 30 packets\nserver->client: 3 seconds, 1000 bytes, 30 packets\n\nS->C results\nAttempted bandwidth: 80000 bps / 0.08 Mbps\nAchieved bandwidth: 80000 bps / 0.08 Mbps\nLoss rate: 0 %\nInterarrival time variance: 23ms, average interarrival time: 103ms\nInterarrival time min: 82ms, interarrival time max: 127ms\nWe need to sleep for 2 seconds before we can get the results\n\nC->S results\nAttempted bandwidth: 80000 bps / 0.08 Mbps\nAchieved bandwidth: 80000 bps / 0.08 Mbps\nLoss rate: 0 %\nInterarrival time variance: 23ms, average interarrival time: 103ms\nInterarrival time min: 82ms, interarrival time max: 126ms\n"
}
],
"active": false
}
15 changes: 15 additions & 0 deletions webapp/tests/asviz/echo-d.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"graph": [
{
"Inserted": 1562683883823,
"ActualDuration": 263,
"ResponseTime": 13.352,
"RunTime": 226.525,
"PktLoss": 0,
"CmdOutput": "Using path:\n Hops: [1-ff00:0:111 103>4094 1-ff00:0:112] Mtu: 1450\n104 bytes from 1-ff00:0:112,[127.0.0.2] scmp_seq=0 time=13.352ms\n\n--- 1-ff00:0:112,[[127.0.0.2]] statistics ---\n1 packets transmitted, 1 received, 0% packet loss, time 226.525ms\n",
"Path": "Hops: [1-ff00:0:111 103>4094 1-ff00:0:112] Mtu: 1450",
"Error": ""
}
],
"active": false
}
54 changes: 54 additions & 0 deletions webapp/tests/asviz/traceroute-d.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"graph": [
{
"Inserted": 1570192000394,
"ActualDuration": 35,
"TrHops": [
{
"HopIa": "1-ff00:0:111",
"HopAddr": "127.0.0.17",
"IntfID": 41,
"RespTime1": 0.558,
"RespTime2": 0.439,
"RespTime3": 0.41
},
{
"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: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.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.107,
"RespTime2": 0.899,
"RespTime3": 0.835
}
],
"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
}
22 changes: 19 additions & 3 deletions webapp/web/static/js/asviz.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ function setPaths(type, idx, open) {
} else if (type == 'UP') {
addSegments(resUp, idx, num, colorSegUp, type);
} else if (type == 'PATH') {
addPaths(resPath, idx, num, colorPaths, type);
var latencies = getPathLatencyMin(formatPathString(resPath, idx,
type));
addPaths(resPath, idx, num, colorPaths, type, latencies);
}
self.segType = type;
self.segNum = idx;
Expand Down Expand Up @@ -108,12 +110,26 @@ 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.
*/
function addPaths(res, idx, num, color, type) {
function addPaths(res, idx, num, color, type, latencies) {
if (graphPath) {
drawPath(res, idx, color);
drawPath(res, idx, color, latencies);
if (res.if_lists[idx].expTime) {
drawTitle(type + ' ' + num, color, res.if_lists[idx].expTime);
} else {
Expand Down
Loading