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

This commit is contained in:
Eric A. Miller
2013-12-16 09:26:27 -05:00
parent 82a1889ed8
commit ec31a75dd4
3 changed files with 24 additions and 7 deletions

View File

@@ -1,3 +1,11 @@
2.030000 -
[ENHANCEMENTS]
* 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
2.020002 - 2013-12-11
[NEW FEATURES]

View File

@@ -35,7 +35,7 @@ requires 'Plack::Middleware::Expires' => 0.03;
requires 'Role::Tiny' => 1.002005;
requires 'Socket6' => 0.23;
requires 'Starman' => 0.4008;
requires 'SNMP::Info' => 3.08;
requires 'SNMP::Info' => 3.10;
requires 'SQL::Translator' => 0.11016;
requires 'Template' => 2.24;
requires 'Template::Plugin::CSV' => 0.04;

View File

@@ -617,7 +617,7 @@ sub store_neighbors {
my ($device, $snmp) = @_;
my @to_discover = ();
# first allow any manually configred topology to be set
# first allow any manually configured topology to be set
_set_manual_topology($device, $snmp);
my $c_ip = $snmp->c_ip;
@@ -631,6 +631,7 @@ sub store_neighbors {
my $c_port = $snmp->c_port;
my $c_id = $snmp->c_id;
my $c_platform = $snmp->c_platform;
my $c_cap = $snmp->c_cap;
foreach my $entry (keys %$c_ip) {
my $port = $interfaces->{ $c_if->{$entry} };
@@ -645,6 +646,7 @@ sub store_neighbors {
my $remote_port = undef;
my $remote_type = $c_platform->{$entry};
my $remote_id = Encode::decode('UTF-8', $c_id->{$entry});
my $remote_cap = $c_cap->{$entry} || [];
next unless $remote_ip;
@@ -684,14 +686,21 @@ sub store_neighbors {
}
}
# IP Phone detection type fixup
if (defined $remote_type and $remote_type =~ m/(mitel.5\d{3})/i) {
$remote_type = 'IP Phone - '. $remote_type
# IP Phone and WAP detection type fixup
if (defined $remote_type) {
my $phone_flag = grep {/phone/i} @$remote_cap;
my $ap_flag = grep {/wlanAccessPoint/} @$remote_cap;
if ($phone_flag or $remote_type =~ m/(mitel.5\d{3})/i) {
$remote_type = 'IP Phone: '. $remote_type
if $remote_type !~ /ip phone/i;
}
elsif ($ap_flag) {
$remote_type = 'AP: '. $remote_type;
}
else {
$remote_type ||= '';
}
}
# hack for devices seeing multiple neighbors on the port
if (ref [] eq ref $remote_ip) {