From 2739ab3ba8152eea3d61d91aa29f01f9a4a27d07 Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Mon, 28 Apr 2014 20:29:59 +0000 Subject: [PATCH 1/5] add port skiplist and fix broken macbleed option --- Netdisco/lib/App/Netdisco/Core/Macsuck.pm | 27 ++++++++++++++--------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/Netdisco/lib/App/Netdisco/Core/Macsuck.pm b/Netdisco/lib/App/Netdisco/Core/Macsuck.pm index d9da31e5..34729817 100644 --- a/Netdisco/lib/App/Netdisco/Core/Macsuck.pm +++ b/Netdisco/lib/App/Netdisco/Core/Macsuck.pm @@ -88,13 +88,6 @@ sub do_macsuck { # reverse sort allows vlan 0 entries to be included only as fallback foreach my $vlan (reverse sort keys %$fwtable) { foreach my $port (keys %{ $fwtable->{$vlan} }) { - if ($device_ports->{$port}->is_uplink and not setting('macsuck_bleed')) { - debug sprintf - ' [%s] macsuck - port %s is uplink, topo broken - skipping.', - $ip, $port; - next; - } - debug sprintf ' [%s] macsuck - port %s vlan %s : %s nodes', $ip, $port, $vlan, scalar keys %{ $fwtable->{$vlan}->{$port} }; @@ -296,6 +289,7 @@ sub _get_vlan_list { # table of node entries. sub _walk_fwtable { my ($device, $snmp, $interfaces, $port_macs, $device_ports, $comm_vlan) = @_; + my $skiplist = {}; # ports through which we can see another device my $cache = {}; my $fw_mac = $snmp->fw_mac; @@ -308,7 +302,7 @@ sub _walk_fwtable { while (my ($idx, $mac) = each %$fw_mac) { my $bp_id = $fw_port->{$idx}; - next unless check_mac($device, $mac, $port_macs); + next unless check_mac($device, $mac); unless (defined $bp_id) { debug sprintf @@ -335,6 +329,13 @@ sub _walk_fwtable { next; } + if (exists $skiplist->{$port}) { + debug sprintf + ' [%s] macsuck %s - seen another device thru port %s - skipping.', + $device->ip, $mac, $port; + next; + } + # this uses the cached $ports resultset to limit hits on the db my $device_port = $device_ports->{$port}; @@ -374,6 +375,8 @@ sub _walk_fwtable { } } + my $vlan = $fw_vlan->{$idx} || $comm_vlan || '0'; + if (exists $port_macs->{$mac}) { my $switch_ip = $port_macs->{$mac}; if ($device->ip eq $switch_ip) { @@ -389,7 +392,12 @@ sub _walk_fwtable { # when there's no CDP/LLDP, we only want to gather macs at the # topology edge, hence skip ports with known device macs. - next unless setting('macsuck_bleed'); + if (not setting('macsuck_bleed')) { + debug sprintf ' [%s] macsuck %s - adding port %s to skiplist', + $device->ip, $mac, $port; + $skiplist->{$port} = delete $cache->{$vlan}->{$port}; + next; + } } # possibly move node to lag master @@ -399,7 +407,6 @@ sub _walk_fwtable { $device_ports->{$port}->update({is_uplink => \'true'}); } - my $vlan = $fw_vlan->{$idx} || $comm_vlan || '0'; ++$cache->{$vlan}->{$port}->{$mac}; } From 0413216f8418b375724d2db31e38428e9211a619 Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Mon, 28 Apr 2014 21:45:34 +0100 Subject: [PATCH 2/5] sort connected nodes by vlan --- Netdisco/lib/App/Netdisco/Web/Plugin/Device/Ports.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Netdisco/lib/App/Netdisco/Web/Plugin/Device/Ports.pm b/Netdisco/lib/App/Netdisco/Web/Plugin/Device/Ports.pm index 3d044f85..cd6636d4 100644 --- a/Netdisco/lib/App/Netdisco/Web/Plugin/Device/Ports.pm +++ b/Netdisco/lib/App/Netdisco/Web/Plugin/Device/Ports.pm @@ -130,7 +130,7 @@ get '/ajax/content/device/ports' => require_login sub { # what kind of nodes are we interested in? my $nodes_name = (param('n_archived') ? 'nodes' : 'active_nodes'); $nodes_name .= '_with_age' if param('c_nodes') and param('n_age'); - $set = $set->search_rs({}, { order_by => ["${nodes_name}.mac", "ips.ip"] }) + $set = $set->search_rs({}, { order_by => ["${nodes_name}.vlan", "${nodes_name}.mac", "ips.ip"] }) if param('c_nodes'); # retrieve active/all connected nodes, if asked for From a1ed854b73632298c4d2d60963da4d26b90b6393 Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Mon, 28 Apr 2014 22:01:17 +0100 Subject: [PATCH 3/5] release 2.026001_004 --- Netdisco/Changes | 4 +++- Netdisco/META.yml | 2 +- Netdisco/lib/App/Netdisco.pm | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Netdisco/Changes b/Netdisco/Changes index 5ef805a7..cd388784 100644 --- a/Netdisco/Changes +++ b/Netdisco/Changes @@ -1,9 +1,10 @@ -2.026001_003 - +2.026001_004 - [ENHANCEMENTS] * Add FRU filter option to Module Inventory Report * Display Phone and Wifi icon on nodes even when not discovered as neighbors + * Sort connected nodes first by VLAN [BUG FIXES] @@ -11,6 +12,7 @@ * Fixes to allow output of get_init_file to be used as init script * Legitimate for same MAC to be in two VLANs on same switchport * Fix for broken [#82] (/etc/hosts check during ARP IP resolv) + * Discover nodes on ports which have broken near-edge topology 2.025001 - 2014-04-08 diff --git a/Netdisco/META.yml b/Netdisco/META.yml index e43e5d35..8c44bd13 100644 --- a/Netdisco/META.yml +++ b/Netdisco/META.yml @@ -78,4 +78,4 @@ resources: homepage: http://netdisco.org/ license: http://opensource.org/licenses/bsd-license.php repository: git://git.code.sf.net/p/netdisco/netdisco-ng -version: 2.026001_003 +version: 2.026001_004 diff --git a/Netdisco/lib/App/Netdisco.pm b/Netdisco/lib/App/Netdisco.pm index 4d298a4b..839def03 100644 --- a/Netdisco/lib/App/Netdisco.pm +++ b/Netdisco/lib/App/Netdisco.pm @@ -4,7 +4,7 @@ use strict; use warnings; use 5.010_000; -our $VERSION = '2.026001_003'; +our $VERSION = '2.026001_004'; use App::Netdisco::Environment; use Dancer ':script'; From 2edbbaadb0fa0d9d7ca82b58f9c4e86afee361cd Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Mon, 28 Apr 2014 22:12:46 +0100 Subject: [PATCH 4/5] Add docs note about RC scripts --- Netdisco/Changes | 1 + Netdisco/lib/App/Netdisco/Manual/Deployment.pod | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/Netdisco/Changes b/Netdisco/Changes index cd388784..c23618fc 100644 --- a/Netdisco/Changes +++ b/Netdisco/Changes @@ -5,6 +5,7 @@ * Add FRU filter option to Module Inventory Report * Display Phone and Wifi icon on nodes even when not discovered as neighbors * Sort connected nodes first by VLAN + * Add docs note about RC scripts [BUG FIXES] diff --git a/Netdisco/lib/App/Netdisco/Manual/Deployment.pod b/Netdisco/lib/App/Netdisco/Manual/Deployment.pod index 3c5a68c9..9e6c959b 100644 --- a/Netdisco/lib/App/Netdisco/Manual/Deployment.pod +++ b/Netdisco/lib/App/Netdisco/Manual/Deployment.pod @@ -2,6 +2,16 @@ App::Netdisco::Manual::Deployment - Tips and Tricks for Deployment +=head1 Init and Run Control Scripts + +The Netdisco applications will emit RC scripts suitable for Linux systems: + + bin/netdisco-web get_init_file + bin/netdisco-daemon get_init_file + +If you'd like to send a patch for BSD, please submit it against the +L distribution. + =head1 Enable MD5 authentication to PostgreSQL Some installations of PostgreSQL don't have MD5 authentication enabled by From 5fc62090e21e5380c68d32cee2fc8d8485f98fa9 Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Mon, 28 Apr 2014 22:15:07 +0100 Subject: [PATCH 5/5] edge topology 17 * Use --- Netdisco/Changes | 1 + Netdisco/lib/App/Netdisco.pm | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Netdisco/Changes b/Netdisco/Changes index c23618fc..1d21b052 100644 --- a/Netdisco/Changes +++ b/Netdisco/Changes @@ -14,6 +14,7 @@ * Legitimate for same MAC to be in two VLANs on same switchport * Fix for broken [#82] (/etc/hosts check during ARP IP resolv) * Discover nodes on ports which have broken near-edge topology + * Use password instead of pass for Dancer::Plugin::DBIC 2.025001 - 2014-04-08 diff --git a/Netdisco/lib/App/Netdisco.pm b/Netdisco/lib/App/Netdisco.pm index 839def03..0aad30d8 100644 --- a/Netdisco/lib/App/Netdisco.pm +++ b/Netdisco/lib/App/Netdisco.pm @@ -24,7 +24,7 @@ if (ref {} eq ref setting('database')) { setting('plugins')->{DBIC}->{netdisco} ||= { dsn => $dsn, user => $user, - pass => $pass, + password => $pass, options => { AutoCommit => 1, RaiseError => 1,