diff options
author | EUcancER <root@euer.krebsco.de> | 2011-09-15 02:02:11 +0200 |
---|---|---|
committer | EUcancER <root@euer.krebsco.de> | 2011-09-15 02:02:11 +0200 |
commit | 88517b3edfc7b633d210422afb8579e5d0d3d1e0 (patch) | |
tree | a6250ae3a3b0f00d212da249c736acf9eface714 /retiolum | |
parent | a07326f6c57a7e8f49b9bef96ded427275a16e2e (diff) |
retiolum/adv_graphgen: fix bug with stale hosts,remove unused
stale hosts will be ignored and will not be drawn in the final graphs.
Every node without an 'external' ip is stale, as well as every node ONLY
connected to a node without an external ip (stale derivates)
Diffstat (limited to 'retiolum')
-rwxr-xr-x | retiolum/scripts/adv_graphgen/parse.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/retiolum/scripts/adv_graphgen/parse.py b/retiolum/scripts/adv_graphgen/parse.py index 0bcf42a0..aae69f0f 100755 --- a/retiolum/scripts/adv_graphgen/parse.py +++ b/retiolum/scripts/adv_graphgen/parse.py @@ -26,8 +26,14 @@ def generate_stats(nodes): def delete_unused_nodes(nodes): new_nodes = {} for k,v in nodes.iteritems(): + if v['external-ip'] == "(null)": + continue if v.get('to',[]): new_nodes[k] = v + for k,v in new_nodes.iteritems(): + if not [ i for i in v['to'] if i['name'] in new_nodes]: + #del(new_nodes[k]) + del(k) return new_nodes def merge_edges(nodes): """ merge back and forth edges into one @@ -36,7 +42,7 @@ def merge_edges(nodes): """ for k,v in nodes.iteritems(): for con in v.get('to',[]): - for i,secon in enumerate(nodes[con['name']].get('to',[])): + for i,secon in enumerate(nodes.get(con['name'],{}).get('to',[])): if k == secon['name']: del (nodes[con['name']]['to'][i]) con['bidirectional'] = True |