summaryrefslogtreecommitdiffstats
path: root/hosts/.scripts/adv_graphgen
diff options
context:
space:
mode:
authorLassulus <Lassulus@googlemail.com>2011-05-26 15:53:04 +0200
committerLassulus <Lassulus@googlemail.com>2011-05-26 15:53:04 +0200
commitf56613952b89729e8b7d4d17fb0816e649a0ecd0 (patch)
tree72371f92870fd39e8410fc073fc548560c6d3d69 /hosts/.scripts/adv_graphgen
parentc7b41b910f5b876bac7a82366a6c1b27fd52bd72 (diff)
parent6197a76a6aee4b49afe951291f46fb3318188f30 (diff)
Merge branch 'master' of github.com:miefda/retiolum
Diffstat (limited to 'hosts/.scripts/adv_graphgen')
-rwxr-xr-xhosts/.scripts/adv_graphgen/parse.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/hosts/.scripts/adv_graphgen/parse.py b/hosts/.scripts/adv_graphgen/parse.py
index 27fe3a99..04b42c33 100755
--- a/hosts/.scripts/adv_graphgen/parse.py
+++ b/hosts/.scripts/adv_graphgen/parse.py
@@ -1,4 +1,5 @@
#!/usr/bin/python2
+# -*- coding: utf8 -*-
import sys
""" TODO: Refactoring needed to pull the edges out of the node structures again,
@@ -35,23 +36,28 @@ def merge_edges(nodes):
def write_node(k,v):
- """ writes a single node and its edges """
+ """ writes a single node and its edges
+ edges are weightet with the informations inside the nodes provided by
+ tinc
+ """
node = " "+k+"[label=\""
node += k+"\\l"
node += "external:"+v['external-ip']+":"+v['external-port']+"\\l"
if v.has_key('num_conns'):
node += "Num Connects:"+str(v['num_conns'])+"\\l"
- node += "internal:"+v['internal-ip']+"\\l\""
+
+ node += "internal:"+v.get('internal-ip','¯\\\\(°_o)/¯')+"\\l\""
if v['external-ip'] == "MYSELF":
node += ",fillcolor=steelblue1"
node += "]"
print (node)
for con in v.get('to',[]):
- edge = " "+k+ " -> " +con['name'] + "[weight="+str(10/float(con['weight']))
+ edge = " "+k+ " -> " +con['name'] + "[weight="+str(float(con['weight']))
if con.get('bidirectional',False):
edge += ",dir=both"
edge += "]"
print edge
+
def parse_input():
nodes={}
for line in sys.stdin: