d3json: obscure client MACs

rewrite
Jan-Philipp Litza 2014-09-06 13:48:03 +02:00
parent 5fba69de7a
commit 6d452fc149
1 changed files with 13 additions and 12 deletions

View File

@ -50,10 +50,10 @@ class Output:
"type": "vpn" if neighbor["neighbor"]["vpn"] or node["vpn"] else None, "type": "vpn" if neighbor["neighbor"]["vpn"] or node["vpn"] else None,
"id": "-".join((node.id, neighbor["neighbor"].id)), "id": "-".join((node.id, neighbor["neighbor"].id)),
} }
clientcount = 0
for client in node.get("clients", []): for client in node.get("clients", []):
if not client in indexes:
nodes.append({ nodes.append({
"id": client, "id": "%s-%s" % (node.id, clientcount),
"flags": { "flags": {
"client": True, "client": True,
"online": True, "online": True,
@ -61,15 +61,16 @@ class Output:
} }
}) })
indexes[client] = count indexes[client] = count
count += 1
links[(node.id, client)] = { links[(node.id, client)] = {
"source": indexes[node.id], "source": indexes[node.id],
"target": indexes[client], "target": indexes[client],
"quality": "TT", "quality": "TT",
"type": "client", "type": "client",
"id": "-".join((node.id, client)), "id": "%s-%i" % (node.id, clientcount),
} }
count += 1
clientcount += 1
return { return {
"nodes": nodes, "nodes": nodes,