duplex support for ciscosb (#352)

This commit is contained in:
nick n
2019-08-18 01:50:34 +02:00
committed by GitHub
parent 6753b795b9
commit b6720a2b43
2 changed files with 35 additions and 0 deletions

View File

@@ -34,6 +34,7 @@
package SNMP::Info::Layer2::CiscoSB;
use strict;
use warnings;
use Exporter;
use SNMP::Info::Layer2;
use SNMP::Info::Entity;
@@ -137,6 +138,26 @@ sub model {
return $ciscosb->description();
}
# CISCOSBinterfaces.mib also contains duplex info if needed
sub i_duplex {
my $ciscosb = shift;
my $partial = shift;
my $el_duplex = $ciscosb->el_duplex($partial);
if ( defined $el_duplex and scalar( keys %$el_duplex ) ) {
my %i_duplex;
foreach my $el_port ( keys %$el_duplex ) {
my $duplex = $el_duplex->{$el_port};
next unless defined $duplex;
$i_duplex{$el_port} = 'half' if $duplex =~ /half/i;
$i_duplex{$el_port} = 'full' if $duplex =~ /full/i;
}
return \%i_duplex;
}
}
# ifDescr is the same for all interfaces in a class, but the ifName is
# unique, so let's use that for port name.
sub interfaces {
@@ -256,6 +277,14 @@ See documentation in L<SNMP::Info::EtherLike/"GLOBALS"> for details.
=head1 TABLE METHODS
=over
=item $ciscosb->i_duplex()
Return duplex based upon the result of EtherLike->el_duplex().
=back
=head2 Overrides
=over