Only return distinct Port MAC's and skip '00:00:00:00:00:00' addresses in get_port_macs database query, to reduce the number of rows returned from the database to those we will be able to use

This commit is contained in:
Eric A. Miller
2013-12-16 10:59:27 -05:00
parent 982b8c3fd2
commit 8033620943
2 changed files with 4 additions and 2 deletions

View File

@@ -5,6 +5,7 @@
* Require SNMP::Info 3.10+, use new c_cap method to tag device remote_type
as 'IP Phone:' or 'AP:' when those capabilities are advertised by LLDP
or CDP
* Port MAC query now only returns distinct MAC's
[BUG FIXES]

View File

@@ -41,8 +41,9 @@ sub get_port_macs {
my $dp_macs
= schema('netdisco')->resultset('DevicePort')
->search( { mac => { '!=' => undef } },
{ select => [ 'mac', 'ip' ] } );
->search( { mac => { '!=', [ undef, '00:00:00:00:00:00' ] } },
{ select => [ 'mac', 'ip' ],
group_by => [ 'mac', 'ip' ] } );
my $dp_cursor = $dp_macs->cursor;
while ( my @vals = $dp_cursor->next ) {
$port_macs->{ $vals[0] } = $vals[1];