summaryrefslogtreecommitdiffstats
path: root/retiolum/scripts/adv_graphgen/parse_tinc_stats.py
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2011-11-11 13:53:47 +0100
committermakefu <github@syntax-fehler.de>2011-11-11 13:53:47 +0100
commitf30a413f50cbf0f5fea2b2ec78897ff58fbe3f17 (patch)
treeaca8a22734c6a7b77544f2dd9c11a8507d76f99c /retiolum/scripts/adv_graphgen/parse_tinc_stats.py
parent0b99d25c863170e570cca2346966fa8f9a2797f4 (diff)
parentb37cb6566653a2b51dc1548c3056fa5969cd7f76 (diff)
Merge branch 'master' of github.com:krebscode/painload
Diffstat (limited to 'retiolum/scripts/adv_graphgen/parse_tinc_stats.py')
-rwxr-xr-xretiolum/scripts/adv_graphgen/parse_tinc_stats.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/retiolum/scripts/adv_graphgen/parse_tinc_stats.py b/retiolum/scripts/adv_graphgen/parse_tinc_stats.py
index 410e5229..b8054b0d 100755
--- a/retiolum/scripts/adv_graphgen/parse_tinc_stats.py
+++ b/retiolum/scripts/adv_graphgen/parse_tinc_stats.py
@@ -59,6 +59,9 @@ def generate_stats(nodes):
pass
for k,v in nodes.iteritems():
conns = v.get('to',[])
+ for c in conns: #sanitize weights
+ if float(c['weight']) > 9000: c['weight'] = str(9001)
+ elif float(c['weight']) < 0: c['weight'] = str(0)
v['num_conns'] = len(conns)
v['avg_weight'] = get_node_avg_weight(conns)
v['availability'] = get_node_availability(k,jlines)
@@ -132,7 +135,7 @@ def write_node(k,v):
node = " "+k+"[label=\""
node += k+"\\l"
node += "availability: %f\\l" % v['availability']
- node += "avg weight: %.2f\\l" % v['avg_weight']
+ #node += "avg weight: %.2f\\l" % v['avg_weight']
if v.has_key('num_conns'):
node += "Num Connects:"+str(v['num_conns'])+"\\l"
node += "external:"+v['external-ip']+":"+v['external-port']+"\\l"