Change _lldp_addr_index to a method so it can be properly overridden in subclasses
This commit is contained in:
2
Changes
2
Changes
@@ -7,6 +7,8 @@ Version 3.59
|
|||||||
[ENHANCEMENTS]
|
[ENHANCEMENTS]
|
||||||
|
|
||||||
* Capture base MAC in L3::Huawei
|
* Capture base MAC in L3::Huawei
|
||||||
|
* Change _lldp_addr_index to a method so it can be properly overridden in
|
||||||
|
subclasses
|
||||||
|
|
||||||
[BUG FIXES]
|
[BUG FIXES]
|
||||||
|
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ sub lldp_ip {
|
|||||||
|
|
||||||
my %lldp_ip;
|
my %lldp_ip;
|
||||||
foreach my $key ( keys %$rman_addr ) {
|
foreach my $key ( keys %$rman_addr ) {
|
||||||
my ( $index, $proto, $addr ) = _lldp_addr_index($key);
|
my ( $index, $proto, $addr ) = $lldp->_lldp_addr_index($key);
|
||||||
next unless defined $index;
|
next unless defined $index;
|
||||||
next unless $proto == 1;
|
next unless $proto == 1;
|
||||||
$lldp_ip{$index} = $addr;
|
$lldp_ip{$index} = $addr;
|
||||||
@@ -181,7 +181,7 @@ sub lldp_ipv6 {
|
|||||||
|
|
||||||
my %lldp_ipv6;
|
my %lldp_ipv6;
|
||||||
foreach my $key ( keys %$rman_addr ) {
|
foreach my $key ( keys %$rman_addr ) {
|
||||||
my ( $index, $proto, $addr ) = _lldp_addr_index($key);
|
my ( $index, $proto, $addr ) = $lldp->_lldp_addr_index($key);
|
||||||
next unless defined $index;
|
next unless defined $index;
|
||||||
next unless $proto == 2;
|
next unless $proto == 2;
|
||||||
$lldp_ipv6{$index} = $addr;
|
$lldp_ipv6{$index} = $addr;
|
||||||
@@ -197,7 +197,7 @@ sub lldp_mac {
|
|||||||
|
|
||||||
my %lldp_ipv6;
|
my %lldp_ipv6;
|
||||||
foreach my $key ( keys %$rman_addr ) {
|
foreach my $key ( keys %$rman_addr ) {
|
||||||
my ( $index, $proto, $addr ) = _lldp_addr_index($key);
|
my ( $index, $proto, $addr ) = $lldp->_lldp_addr_index($key);
|
||||||
next unless defined $index;
|
next unless defined $index;
|
||||||
next unless $proto == 6;
|
next unless $proto == 6;
|
||||||
$lldp_ipv6{$index} = $addr;
|
$lldp_ipv6{$index} = $addr;
|
||||||
@@ -213,7 +213,7 @@ sub lldp_addr {
|
|||||||
|
|
||||||
my %lldp_ip;
|
my %lldp_ip;
|
||||||
foreach my $key ( keys %$rman_addr ) {
|
foreach my $key ( keys %$rman_addr ) {
|
||||||
my ( $index, $proto, $addr ) = _lldp_addr_index($key);
|
my ( $index, $proto, $addr ) = $lldp->_lldp_addr_index($key);
|
||||||
next unless defined $index;
|
next unless defined $index;
|
||||||
$lldp_ip{$index} = $addr;
|
$lldp_ip{$index} = $addr;
|
||||||
}
|
}
|
||||||
@@ -401,7 +401,9 @@ sub lldp_media_cap {
|
|||||||
# Break up the lldpRemManAddrTable INDEX into common index, protocol,
|
# Break up the lldpRemManAddrTable INDEX into common index, protocol,
|
||||||
# and address.
|
# and address.
|
||||||
sub _lldp_addr_index {
|
sub _lldp_addr_index {
|
||||||
|
my $lldp = shift;
|
||||||
my $idx = shift;
|
my $idx = shift;
|
||||||
|
|
||||||
my @oids = split( /\./, $idx );
|
my @oids = split( /\./, $idx );
|
||||||
my $index = join( '.', splice( @oids, 0, 3 ) );
|
my $index = join( '.', splice( @oids, 0, 3 ) );
|
||||||
my $proto = shift(@oids);
|
my $proto = shift(@oids);
|
||||||
|
|||||||
@@ -185,12 +185,11 @@ sub lldp_if {
|
|||||||
# The proprietary TIMETRA-LLDP-MIB tables are indexed differently than LLDP-MIB
|
# The proprietary TIMETRA-LLDP-MIB tables are indexed differently than LLDP-MIB
|
||||||
# We overwrite the private function so that the we don't have to replicate
|
# We overwrite the private function so that the we don't have to replicate
|
||||||
# the code in SNMP::Info::LLDP that uses it.
|
# the code in SNMP::Info::LLDP that uses it.
|
||||||
#
|
|
||||||
# We can't use inheritance to override since it is a function, not a method
|
|
||||||
# in SNMP::Info::LLDP. This brute force redefines the code in the symbol table.
|
|
||||||
|
|
||||||
*SNMP::Info::LLDP::_lldp_addr_index = sub {
|
sub _lldp_addr_index {
|
||||||
|
my $alu = shift;
|
||||||
my $idx = shift;
|
my $idx = shift;
|
||||||
|
|
||||||
my @oids = split( /\./, $idx );
|
my @oids = split( /\./, $idx );
|
||||||
|
|
||||||
# Index has extra field compared to LLDP-MIB
|
# Index has extra field compared to LLDP-MIB
|
||||||
|
|||||||
Reference in New Issue
Block a user