diff options
author | root <root@miefda901.localdomain> | 2011-05-26 15:52:03 +0200 |
---|---|---|
committer | root <root@miefda901.localdomain> | 2011-05-26 15:52:03 +0200 |
commit | 6197a76a6aee4b49afe951291f46fb3318188f30 (patch) | |
tree | 3b580f20124908742c8154f109f74a8a99a1ef65 /hosts/.scripts/adv_graphgen | |
parent | da1225c14e10fd94ed956a08c7bd5ddf99ee9a75 (diff) | |
parent | b3b1187e2d1cb615405851174f044882346a6815 (diff) |
Merge branch 'master' of github.com:miefda/retiolum
Diffstat (limited to 'hosts/.scripts/adv_graphgen')
-rwxr-xr-x | hosts/.scripts/adv_graphgen/parse.py | 12 |
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: |