diff options
author | Kristian Lyngstol <kristian@bohemians.org> | 2016-02-26 11:32:15 +0100 |
---|---|---|
committer | Kristian Lyngstol <kristian@bohemians.org> | 2016-02-26 11:32:15 +0100 |
commit | 34aa9568d90c84296d1e1f631748e9aa44227802 (patch) | |
tree | 56648f9c95651ac7a6940c1f5ac0086e18a4176c /tools/draw-neighbors.pl | |
parent | e6fd0035555499fa186845f4c69b715e9ad246b9 (diff) |
tools: Make directory for lldp-misc
Cleaner this way
Diffstat (limited to 'tools/draw-neighbors.pl')
-rwxr-xr-x | tools/draw-neighbors.pl | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/tools/draw-neighbors.pl b/tools/draw-neighbors.pl deleted file mode 100755 index 323e676..0000000 --- a/tools/draw-neighbors.pl +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/perl - -use strict; -use JSON; - -my $in; -while (<STDIN>) { - $in .= $_; -} - -my %assets = %{JSON::XS::decode_json($in)}; - -print "strict graph network {\n"; -while (my ($key, $value) = each %assets) { - print_tree ($key,0,undef); -} -print "}\n"; - -sub print_tree -{ - my ($chassis_id,$indent,$parent,$max) = @_; - if (!defined($parent)) { - $parent = ""; - } - if ($indent > 50) { - die "Possible loop detected."; - } - print " \"$assets{$chassis_id}{sysName}\" -- {"; - my @n; - while (my ($key, $value) = each %{$assets{$chassis_id}{neighbors}}) { - push @n, "\"$assets{$key}{sysName}\""; - } - print join(",",@n) . "};\n"; -} - |