diff options
author | Lassulus <Lassulus@googlemail.com> | 2011-05-26 15:53:04 +0200 |
---|---|---|
committer | Lassulus <Lassulus@googlemail.com> | 2011-05-26 15:53:04 +0200 |
commit | 93874dd2a3d6daf7336b1b4df35fd00b1f394b1c (patch) | |
tree | f9149afcd75bf9ac0066086c9d1bffe63f631a0a /retiolum/hosts/.scripts/adv_graphgen/parse.py | |
parent | 8a656477d90699b66233e15e0a7b80e7dcc6d8b7 (diff) | |
parent | 6a4ca3d35b1739725bf18d9d77b2de474c39a20e (diff) |
Merge branch 'master' of github.com:miefda/retiolum
Diffstat (limited to 'retiolum/hosts/.scripts/adv_graphgen/parse.py')
-rwxr-xr-x | retiolum/hosts/.scripts/adv_graphgen/parse.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/retiolum/hosts/.scripts/adv_graphgen/parse.py b/retiolum/hosts/.scripts/adv_graphgen/parse.py index 27fe3a99..04b42c33 100755 --- a/retiolum/hosts/.scripts/adv_graphgen/parse.py +++ b/retiolum/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: |