[3297786] LLDP INDEX munged to ignore TimeMark component (David Baldwin)

This commit is contained in:
Oliver Gorwits
2012-04-12 10:10:51 +01:00
parent e79f031cb7
commit eb5a492eb9
2 changed files with 24 additions and 12 deletions

View File

@@ -9,6 +9,7 @@ version 2.07 ()
* [3085411] Activate L3 properties for Netgear GSM7224v2 (phishphreek) * [3085411] Activate L3 properties for Netgear GSM7224v2 (phishphreek)
* [3085413] SNMP OIDs for Netgear Serial and OS Ver (phishphreek) * [3085413] SNMP OIDs for Netgear Serial and OS Ver (phishphreek)
* [3286549] Dell LLDP Support (Nico Giefing) * [3286549] Dell LLDP Support (Nico Giefing)
* [3297786] LLDP INDEX munged to ignore TimeMark component (David Baldwin)
[BUG FIXES] [BUG FIXES]

View File

@@ -103,7 +103,7 @@ sub lldp_if {
foreach my $key ( keys %$addr ) { foreach my $key ( keys %$addr ) {
my @aOID = split( '\.', $key ); my @aOID = split( '\.', $key );
my $port = $aOID[1]; my $port = $aOID[1];
$lldp_if{$key} = $port; $lldp_if{_lldp_rem_index($key)} = $port;
} }
return \%lldp_if; return \%lldp_if;
} }
@@ -169,7 +169,7 @@ sub lldp_port {
$port = defined $1 ? "$2.$3" : "$3"; $port = defined $1 ? "$2.$3" : "$3";
} }
$lldp_port{$key} = $port; $lldp_port{_lldp_rem_index($key)} = $port;
} }
return \%lldp_port; return \%lldp_port;
} }
@@ -191,14 +191,15 @@ sub lldp_id {
# May need to format other types in the future # May need to format other types in the future
if ( $type =~ /mac/ ) { if ( $type =~ /mac/ ) {
$id = join( ':', map { sprintf "%02x", $_ } unpack( 'C*', $id ) ); $id = join( ':', map { sprintf "%02x", $_ } unpack( 'C*', $id ) );
}elsif ($type eq 'networkAddress'){ }
if ( length(unpack('H*', $id)) == 10 ){ elsif ($type eq 'networkAddress') {
# IP address (first octet is sign, I guess) if ( length(unpack('H*', $id)) == 10 ) {
my @octets = (map { sprintf "%02x",$_ } unpack('C*', $id))[1..4]; # IP address (first octet is sign, I guess)
$id = join '.', map { hex($_) } @octets; my @octets = (map { sprintf "%02x",$_ } unpack('C*', $id))[1..4];
} $id = join '.', map { hex($_) } @octets;
} }
$lldp_id{$key} = $id; }
$lldp_id{_lldp_rem_index( $key )} = $id;
} }
return \%lldp_id; return \%lldp_id;
} }
@@ -221,6 +222,16 @@ sub lldp_id {
# return; # return;
#} #}
# Break up the lldpRemTable INDEX into time mark and common index returning
# index
sub _lldp_rem_index {
my $idx = shift;
my @oids = split( /\./, $idx );
# print "DBGoids: $idx\n";
my $timemark = shift @oids;
return join( '.', @oids );
}
# 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 {
@@ -391,7 +402,7 @@ to a hash.
=item $lldp->lldp_id() =item $lldp->lldp_id()
Returns the string value used to identify the chassis component associated Returns the string value used to identify the chassis component associated
with the remote system. with the remote system.
(C<lldpRemChassisId>) (C<lldpRemChassisId>)
@@ -429,7 +440,7 @@ the remote system.
=item $lldp->lldp_rem_id() =item $lldp->lldp_rem_id()
Returns the string value used to identify the chassis component associated Returns the string value used to identify the chassis component associated
with the remote system. with the remote system.
(C<lldpRemChassisId>) (C<lldpRemChassisId>)