From fd7da3898006ab8119d4b13b383cfa16c9403b18 Mon Sep 17 00:00:00 2001 From: Felix Richter Date: Sun, 29 May 2011 12:08:13 +0200 Subject: docu for cloudinstall,update graphgen doc/install_dotcloud : updated docu, now specified which file to patch doc/install_no.de : added docu for no.de cloud parse.py : nodes which are down will not be written auoupdate_cron.sh : contains what to do when the nodes should auto-update --- modules/retiolum/scripts/adv_graphgen/parse.py | 11 +++++++++-- modules/retiolum/scripts/adv_graphgen/sanitize.sh | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'modules/retiolum/scripts/adv_graphgen') diff --git a/modules/retiolum/scripts/adv_graphgen/parse.py b/modules/retiolum/scripts/adv_graphgen/parse.py index 04b42c33..16d3043b 100755 --- a/modules/retiolum/scripts/adv_graphgen/parse.py +++ b/modules/retiolum/scripts/adv_graphgen/parse.py @@ -12,6 +12,7 @@ def write_digraph(nodes): print ('digraph retiolum {') print (' node[shape=box,style=filled,fillcolor=grey]') generate_stats(nodes) + nodes = delete_unused_nodes(nodes) merge_edges(nodes) for k,v in nodes.iteritems(): write_node(k,v) @@ -21,7 +22,12 @@ def generate_stats(nodes): """ for k,v in nodes.iteritems(): v['num_conns'] = len(v.get('to',[])) - +def delete_unused_nodes(nodes): + new_nodes = {} + for k,v in nodes.iteritems(): + if v.get('to',[]): + new_nodes[k] = v + return new_nodes def merge_edges(nodes): """ merge back and forth edges into one DESTRUCTS the current structure by deleting "connections" in the nodes @@ -50,7 +56,8 @@ def write_node(k,v): if v['external-ip'] == "MYSELF": node += ",fillcolor=steelblue1" node += "]" - print (node) + print node + for con in v.get('to',[]): edge = " "+k+ " -> " +con['name'] + "[weight="+str(float(con['weight'])) if con.get('bidirectional',False): diff --git a/modules/retiolum/scripts/adv_graphgen/sanitize.sh b/modules/retiolum/scripts/adv_graphgen/sanitize.sh index 88591b67..0e12d207 100755 --- a/modules/retiolum/scripts/adv_graphgen/sanitize.sh +++ b/modules/retiolum/scripts/adv_graphgen/sanitize.sh @@ -10,4 +10,4 @@ sudo sed -n '/tinc.retiolum/{s/.*tinc.retiolum\[[0-9]*\]: //gp}' $LOG_FILE |\ $GRAPH_SETTER1 -Tpng -o $1retiolum_1.png retiolum.dot $GRAPH_SETTER2 -Tpng -o $1retiolum_2.png retiolum.dot $OPENER retiolum_1.png &>/dev/null -rm retiolum.dot +#rm retiolum.dot -- cgit v1.2.3