diff --git a/Netdisco/Changes b/Netdisco/Changes index 5ef805a7..1d21b052 100644 --- a/Netdisco/Changes +++ b/Netdisco/Changes @@ -1,9 +1,11 @@ -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 + * Add docs note about RC scripts [BUG FIXES] @@ -11,6 +13,8 @@ * 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 + * Use password instead of pass for Dancer::Plugin::DBIC 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 2bb86c15..b8cd0a47 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'; @@ -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, 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}; } 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 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