Merge branch 'em-autoload-topo'

Conflicts:
	ChangeLog
This commit is contained in:
Eric A. Miller
2012-11-28 23:18:39 -05:00
25 changed files with 2368 additions and 2685 deletions

View File

@@ -1,5 +1,36 @@
SNMP::Info - Friendly OO-style interface to Network devices using SNMP. SNMP::Info - Friendly OO-style interface to Network devices using SNMP.
version 3.00
[API Changes]
* AUTOLOAD no longer tries to determine if a MIB leaf is a single
instance or part of a table. As a result all MIB leafs provided as a
method call to be resolved by AUTOLOAD return data as a reference to
a hash with the instance id as the key and the data as the value. If
you would rather a scalar be returned you must define within %GLOBALS.
* The methods c_ip(), c_if(), c_port(), c_id(), and c_platform() now
represent common topology methods and will try to return a combined
hash of data from all L2 topology protocols either running on the
device or specified in the method call. The topology specific methods
have been been prefixed with the protocol name in lowercase so that
they can be called directly, sonmp_ip(), cdp_ip(), etc.
[NEW FEATURES]
* [3160037] - Support _raw suffix on methods to skip munging
* Support for Avaya VSP 9000 series in L3::Passport
* Support for Avaya VSP 7000 series in L2::Baystack
* Support Avaya (Trapeze) Wireless Controllers in new class L2::NWSS2300
[ENHANCEMENTS]
* UNIVERSAL::can() now works with dynamic methods
* Dynamically generated methods to symbol table to avoid
AUTOLOAD on subsequent calls
[BUG FIXES]
version 2.09 (2012-11-28) version 2.09 (2012-11-28)
[NEW FEATURES] [NEW FEATURES]

846
Info.pm

File diff suppressed because it is too large Load Diff

View File

@@ -53,37 +53,37 @@ $VERSION = '2.09';
'cdp_run' => 'cdpGlobalRun', 'cdp_run' => 'cdpGlobalRun',
'cdp_interval' => 'cdpGlobalMessageInterval', 'cdp_interval' => 'cdpGlobalMessageInterval',
'cdp_holdtime' => 'cdpGlobalHoldTime', 'cdp_holdtime' => 'cdpGlobalHoldTime',
'cdp_id' => 'cdpGlobalDeviceId', 'cdp_gid' => 'cdpGlobalDeviceId',
); );
%FUNCS = ( %FUNCS = (
'c_index' => 'cdpCacheIfIndex', 'cdp_index' => 'cdpCacheIfIndex',
'c_proto' => 'cdpCacheAddressType', 'cdp_proto' => 'cdpCacheAddressType',
'c_addr' => 'cdpCacheAddress', 'cdp_addr' => 'cdpCacheAddress',
'c_ver' => 'cdpCacheVersion', 'cdp_ver' => 'cdpCacheVersion',
'c_id' => 'cdpCacheDeviceId', 'cdp_id' => 'cdpCacheDeviceId',
'c_port' => 'cdpCacheDevicePort', 'cdp_port' => 'cdpCacheDevicePort',
'c_platform' => 'cdpCachePlatform', 'cdp_platform' => 'cdpCachePlatform',
'c_capabilities' => 'cdpCacheCapabilities', 'cdp_capabilities' => 'cdpCacheCapabilities',
'c_domain' => 'cdpCacheVTPMgmtDomain', 'cdp_domain' => 'cdpCacheVTPMgmtDomain',
'c_vlan' => 'cdpCacheNativeVLAN', 'cdp_vlan' => 'cdpCacheNativeVLAN',
'c_duplex' => 'cdpCacheDuplex', 'cdp_duplex' => 'cdpCacheDuplex',
'c_power' => 'cdpCachePowerConsumption', 'cdp_power' => 'cdpCachePowerConsumption',
'c_pri_mgmt_type'=> 'cdpCachePrimaryMgmtAddrType', 'cdp_pri_mgmt_type'=> 'cdpCachePrimaryMgmtAddrType',
'c_pri_mgmt_addr'=> 'cdpCachePrimaryMgmtAddr', 'cdp_pri_mgmt_addr'=> 'cdpCachePrimaryMgmtAddr',
'c_sec_mgmt_type'=> 'cdpCacheSecondaryMgmtAddrType', 'cdp_sec_mgmt_type'=> 'cdpCacheSecondaryMgmtAddrType',
'c_sec_mgmt_addr'=> 'cdpCacheSecondaryMgmtAddr', 'cdp_sec_mgmt_addr'=> 'cdpCacheSecondaryMgmtAddr',
); );
%MUNGE = ( %MUNGE = (
'c_capabilities' => \&SNMP::Info::munge_caps, 'cdp_capabilities' => \&SNMP::Info::munge_caps,
'c_platform' => \&SNMP::Info::munge_null, 'cdp_platform' => \&SNMP::Info::munge_null,
'c_domain' => \&SNMP::Info::munge_null, 'cdp_domain' => \&SNMP::Info::munge_null,
'c_port' => \&SNMP::Info::munge_null, 'cdp_port' => \&SNMP::Info::munge_null,
'c_id' => \&SNMP::Info::munge_null, 'cdp_id' => \&SNMP::Info::munge_null,
'c_ver' => \&SNMP::Info::munge_null, 'cdp_ver' => \&SNMP::Info::munge_null,
'c_ip' => \&SNMP::Info::munge_ip, 'cdp_ip' => \&SNMP::Info::munge_ip,
'c_power' => \&munge_power, 'cdp_power' => \&munge_power,
); );
@@ -101,63 +101,63 @@ sub hasCDP {
# SNMP v1 clients dont have the globals # SNMP v1 clients dont have the globals
if ( defined $ver and $ver == 1 ) { if ( defined $ver and $ver == 1 ) {
my $c_ip = $cdp->c_ip(); my $cdp_ip = $cdp->cdp_ip();
# See if anything in cdp cache, if so we have cdp # See if anything in cdp cache, if so we have cdp
return 1 if ( defined $c_ip and scalar( keys %$c_ip ) ); return 1 if ( defined $cdp_ip and scalar( keys %$cdp_ip ) );
return; return;
} }
return $cdp->cdp_run(); return $cdp->cdp_run();
} }
sub c_if { sub cdp_if {
my $cdp = shift; my $cdp = shift;
# See if by some miracle Cisco implemented the cdpCacheIfIndex entry # See if by some miracle Cisco implemented the cdpCacheIfIndex entry
my $c_index = $cdp->c_index(); my $cdp_index = $cdp->cdp_index();
return $c_index if defined $c_index; return $cdp_index if defined $cdp_index;
# Nope, didn't think so. Now we fake it. # Nope, didn't think so. Now we fake it.
my $c_ip = $cdp->c_ip(); my $cdp_ip = $cdp->cdp_ip();
unless ( defined $c_ip ) { unless ( defined $cdp_ip ) {
$cdp->error_throw( $cdp->error_throw(
"SNMP::Info::CDP:c_if() - Device doesn't have cdp_ip() data. Can't fake cdp_index()" "SNMP::Info::CDP:cdp_if() - Device doesn't have cdp_ip() data. Can't fake cdp_index()"
); );
return; return;
} }
my %c_if; my %cdp_if;
foreach my $key ( keys %$c_ip ) { foreach my $key ( keys %$cdp_ip ) {
next unless defined $key; next unless defined $key;
my $iid = $key; my $iid = $key;
# Truncate .1 from cdp cache entry # Truncate .1 from cdp cache entry
$iid =~ s/\.\d+$//; $iid =~ s/\.\d+$//;
$c_if{$key} = $iid; $cdp_if{$key} = $iid;
} }
return \%c_if; return \%cdp_if;
} }
sub c_ip { sub cdp_ip {
my $cdp = shift; my $cdp = shift;
my $partial = shift; my $partial = shift;
my $c_addr = $cdp->c_addr($partial) || {}; my $cdp_addr = $cdp->cdp_addr($partial) || {};
my $c_proto = $cdp->c_proto($partial) || {}; my $cdp_proto = $cdp->cdp_proto($partial) || {};
my %c_ip; my %cdp_ip;
foreach my $key ( keys %$c_addr ) { foreach my $key ( keys %$cdp_addr ) {
my $addr = $c_addr->{$key}; my $addr = $cdp_addr->{$key};
my $proto = $c_proto->{$key}; my $proto = $cdp_proto->{$key};
next unless defined $addr; next unless defined $addr;
next if ( defined $proto and $proto ne 'ip' ); next if ( defined $proto and $proto ne 'ip' );
my $ip = join( '.', unpack( 'C4', $addr ) ); my $ip = join( '.', unpack( 'C4', $addr ) );
$c_ip{$key} = $ip; $cdp_ip{$key} = $ip;
} }
return \%c_ip; return \%cdp_ip;
} }
1; 1;
@@ -188,15 +188,15 @@ Max Baker
# Print out a map of device ports with CDP neighbors: # Print out a map of device ports with CDP neighbors:
my $interfaces = $cdp->interfaces(); my $interfaces = $cdp->interfaces();
my $c_if = $cdp->c_if(); my $cdp_if = $cdp->cdp_if();
my $c_ip = $cdp->c_ip(); my $cdp_ip = $cdp->cdp_ip();
my $c_port = $cdp->c_port(); my $cdp_port = $cdp->cdp_port();
foreach my $cdp_key (keys %$c_ip){ foreach my $cdp_key (keys %$cdp_ip){
my $iid = $c_if->{$cdp_key}; my $iid = $cdp_if->{$cdp_key};
my $port = $interfaces->{$iid}; my $port = $interfaces->{$iid};
my $neighbor = $c_ip->{$cdp_key}; my $neighbor = $cdp_ip->{$cdp_key};
my $neighbor_port = $c_port->{$cdp_key}; my $neighbor_port = $cdp_port->{$cdp_key};
print "Port : $port connected to $neighbor / $neighbor_port\n"; print "Port : $port connected to $neighbor / $neighbor_port\n";
} }
@@ -260,7 +260,7 @@ Time in seconds that CDP messages are kept.
(C<cdpGlobalHoldTime>) (C<cdpGlobalHoldTime>)
=item $cdp->cdp_id() =item $cdp->cdp_gid()
Returns CDP device ID. Returns CDP device ID.
@@ -280,7 +280,7 @@ to a hash.
=over =over
=item $cdp->c_capabilities() =item $cdp->cdp_capabilities()
Returns Device Functional Capabilities. Results are munged into an ascii Returns Device Functional Capabilities. Results are munged into an ascii
binary string, 7 digits long, MSB. Each digit represents a bit from the binary string, 7 digits long, MSB. Each digit represents a bit from the
@@ -319,108 +319,108 @@ information.
(C<cdpCacheCapabilities>) (C<cdpCacheCapabilities>)
=item $cdp->c_domain() =item $cdp->cdp_domain()
Returns remote VTP Management Domain as defined in Returns remote VTP Management Domain as defined in
C<CISCO-VTP-MIB::managementDomainName> C<CISCO-VTP-MIB::managementDomainName>
(C<cdpCacheVTPMgmtDomain>) (C<cdpCacheVTPMgmtDomain>)
=item $cdp->c_duplex() =item $cdp->cdp_duplex()
Returns the port duplex status from remote devices. Returns the port duplex status from remote devices.
(C<cdpCacheDuplex>) (C<cdpCacheDuplex>)
=item $cdp->c_id() =item $cdp->cdp_id()
Returns remote device id string Returns remote device id string
(C<cdpCacheDeviceId>) (C<cdpCacheDeviceId>)
=item $cdp->c_if() =item $cdp->cdp_if()
Returns the mapping to the SNMP Interface Table. Returns the mapping to the SNMP Interface Table.
Note that a lot devices don't implement $cdp->c_index(), So if it isn't Note that a lot devices don't implement $cdp->cdp_index(), So if it isn't
around, we fake it. around, we fake it.
In order to map the cdp table entry back to the interfaces() entry, we In order to map the cdp table entry back to the interfaces() entry, we
truncate the last number off of it : truncate the last number off of it :
# it exists, yay. # it exists, yay.
my $c_index = $device->c_index(); my $cdp_index = $device->cdp_index();
return $c_index if defined $c_index; return $cdp_index if defined $cdp_index;
# if not, let's fake it # if not, let's fake it
my $c_ip = $device->c_ip(); my $cdp_ip = $device->cdp_ip();
my %c_if my %cdp_if
foreach my $key (keys %$c_ip){ foreach my $key (keys %$cdp_ip){
$iid = $key; $iid = $key;
## Truncate off .1 from cdp response ## Truncate off .1 from cdp response
$iid =~ s/\.\d+$//; $iid =~ s/\.\d+$//;
$c_if{$key} = $iid; $cdp_if{$key} = $iid;
} }
return \%c_if; return \%cdp_if;
=item $cdp->c_index() =item $cdp->cdp_index()
Returns the mapping to the SNMP2 Interface table for CDP Cache Entries. Returns the mapping to the SNMP2 Interface table for CDP Cache Entries.
Most devices don't implement this, so you probably want to use $cdp->c_if() Most devices don't implement this, so you probably want to use $cdp->cdp_if()
instead. instead.
See c_if() entry. See cdp_if() entry.
(C<cdpCacheIfIndex>) (C<cdpCacheIfIndex>)
=item $cdp->c_ip() =item $cdp->cdp_ip()
If $cdp->c_proto() is supported, returns remote IPV4 address only. Otherwise If $cdp->cdp_proto() is supported, returns remote IPV4 address only. Otherwise
it will return all addresses. it will return all addresses.
(C<cdpCacheAddress>) (C<cdpCacheAddress>)
=item $cdp->c_addr() =item $cdp->cdp_addr()
Returns remote address Returns remote address
(C<cdpCacheAddress>) (C<cdpCacheAddress>)
=item $cdp->c_platform() =item $cdp->cdp_platform()
Returns remote platform id Returns remote platform id
(C<cdpCachePlatform>) (C<cdpCachePlatform>)
=item $cdp->c_port() =item $cdp->cdp_port()
Returns remote port ID Returns remote port ID
(C<cdpDevicePort>) (C<cdpDevicePort>)
=item $cdp->c_proto() =item $cdp->cdp_proto()
Returns remote address type received. Usually IP. Returns remote address type received. Usually IP.
(C<cdpCacheAddressType>) (C<cdpCacheAddressType>)
=item $cdp->c_ver() =item $cdp->cdp_ver()
Returns remote hardware version Returns remote hardware version
(C<cdpCacheVersion>) (C<cdpCacheVersion>)
=item $cdp->c_vlan() =item $cdp->cdp_vlan()
Returns the remote interface native VLAN. Returns the remote interface native VLAN.
(C<cdpCacheNativeVLAN>) (C<cdpCacheNativeVLAN>)
=item $cdp->c_power() =item $cdp->cdp_power()
Returns the amount of power consumed by remote device in milliwatts munged Returns the amount of power consumed by remote device in milliwatts munged
for decimal placement. for decimal placement.

View File

@@ -47,13 +47,6 @@ $VERSION = '2.09';
%MIBS = ( 'FOUNDRY-SN-SWITCH-GROUP-MIB' => 'snFdpGlobalRun' ); %MIBS = ( 'FOUNDRY-SN-SWITCH-GROUP-MIB' => 'snFdpGlobalRun' );
%GLOBALS = ( %GLOBALS = (
# CDP-Compatibility
'cdp_interval' => 'snFdpGlobalMessageInterval',
'cdp_holdtime' => 'snFdpGlobalHoldTime',
'cdp_id' => 'snFdpGlobalDeviceId',
#
'fdp_run' => 'snFdpGlobalRun', 'fdp_run' => 'snFdpGlobalRun',
'fdp_interval' => 'snFdpGlobalMessageInterval', 'fdp_interval' => 'snFdpGlobalMessageInterval',
'fdp_holdtime' => 'snFdpGlobalHoldTime', 'fdp_holdtime' => 'snFdpGlobalHoldTime',
@@ -61,27 +54,27 @@ $VERSION = '2.09';
); );
%FUNCS = ( %FUNCS = (
'c_index' => 'snFdpCacheIfIndex', 'fdp_index' => 'snFdpCacheIfIndex',
'c_proto' => 'snFdpCacheAddressType', 'fdp_proto' => 'snFdpCacheAddressType',
'c_ip' => 'snFdpCacheAddress', 'fdp_ip' => 'snFdpCacheAddress',
'c_ver' => 'snFdpCacheVersion', 'fdp_ver' => 'snFdpCacheVersion',
'c_id' => 'snFdpCacheDeviceId', 'fdp_id' => 'snFdpCacheDeviceId',
'c_port' => 'snFdpCacheDevicePort', 'fdp_port' => 'snFdpCacheDevicePort',
'c_platform' => 'snFdpCachePlatform', 'fdp_platform' => 'snFdpCachePlatform',
'c_capabilities' => 'snFdpCacheCapabilities', 'fdp_capabilities' => 'snFdpCacheCapabilities',
'c_domain' => 'snFdpCacheVTPMgmtDomain', 'fdp_domain' => 'snFdpCacheVTPMgmtDomain',
'c_vlan' => 'snFdpCacheNativeVLAN', 'fdp_vlan' => 'snFdpCacheNativeVLAN',
'c_duplex' => 'snFdpCacheDuplex', 'fdp_duplex' => 'snFdpCacheDuplex',
); );
%MUNGE = ( %MUNGE = (
'c_capabilities' => \&SNMP::Info::munge_caps, 'fdp_capabilities' => \&SNMP::Info::munge_caps,
'c_ip' => \&SNMP::Info::munge_ip 'fdp_ip' => \&SNMP::Info::munge_ip
); );
sub cdp_run { sub fdp_run {
my $fdp = shift; my $fdp = shift;
my $fdp_run = $fdp->fdp_run(); my $fdp_run = $fdp->orig_fdp_run();
# if fdp_run isn't implemented on device, assume FDP is on # if fdp_run isn't implemented on device, assume FDP is on
return $fdp_run if defined $fdp_run; return $fdp_run if defined $fdp_run;
@@ -107,7 +100,7 @@ sub hasFDP {
return $fdp->fdp_run(); return $fdp->fdp_run();
} }
sub c_if { sub fdp_if {
my $fdp = shift; my $fdp = shift;
# See if by some miracle Cisco implemented the fdpCacheIfIndex entry # See if by some miracle Cisco implemented the fdpCacheIfIndex entry
@@ -115,7 +108,7 @@ sub c_if {
return $fdp_index if defined $fdp_index; return $fdp_index if defined $fdp_index;
# Nope, didn't think so. Now we fake it. # Nope, didn't think so. Now we fake it.
my $fdp_ip = $fdp->c_ip(); my $fdp_ip = $fdp->fdp_ip();
unless ( defined $fdp_ip ) { unless ( defined $fdp_ip ) {
$fdp->error_throw( $fdp->error_throw(
"SNMP::Info::FDP:fdp_if() - Device doesn't have fdp_ip() data. Can't fake fdp_index()" "SNMP::Info::FDP:fdp_if() - Device doesn't have fdp_ip() data. Can't fake fdp_index()"
@@ -256,19 +249,19 @@ CDP compatibility
=over =over
=item $fdp->c_interval() =item $fdp->fdp_interval()
Interval in seconds at which FDP messages are generated. Interval in seconds at which FDP messages are generated.
(C<fdpGlobalMessageInterval>) (C<fdpGlobalMessageInterval>)
=item $fdp->c_holdtime() =item $fdp->fdp_holdtime()
Time in seconds that FDP messages are kept. Time in seconds that FDP messages are kept.
(C<fdpGlobalHoldTime>) (C<fdpGlobalHoldTime>)
=item $fdp->c_id() =item $fdp->fdp_id()
Returns FDP device ID. Returns FDP device ID.
@@ -277,7 +270,7 @@ retrieved from remote devices with $fdp->id().
(C<fdpGlobalDeviceId>) (C<fdpGlobalDeviceId>)
=item $cdp->cdp_run() =item $fdp->fdp_run()
Is FDP enabled on this device? Is FDP enabled on this device?
@@ -294,7 +287,7 @@ CDP compatibility
=over =over
=item $fdp->c_capabilities() =item $fdp->fdp_capabilities()
Returns Device Functional Capabilities. Results are munged into an ascii Returns Device Functional Capabilities. Results are munged into an ascii
binary string, 7 digits long, MSB. Each digit represents a bit from the binary string, 7 digits long, MSB. Each digit represents a bit from the
@@ -333,26 +326,26 @@ this information.
(C<fdpCacheCapabilities>) (C<fdpCacheCapabilities>)
=item $fdp->c_domain() =item $fdp->fdp_domain()
The CDP version of this returns remote VTP Management Domain as defined The CDP version of this returns remote VTP Management Domain as defined
in C<CISCO-VTP-MIB::managementDomainName> in C<CISCO-VTP-MIB::managementDomainName>
(C<fdpCacheVTPMgmtDomain>) (C<fdpCacheVTPMgmtDomain>)
=item $fdp->c_duplex() =item $fdp->fdp_duplex()
Returns the port duplex status from remote devices. Returns the port duplex status from remote devices.
(C<fdpCacheDuplex>) (C<fdpCacheDuplex>)
=item $fdp->c_id() =item $fdp->fdp_id()
Returns remote device id string Returns remote device id string
(C<fdpCacheDeviceId>) (C<fdpCacheDeviceId>)
=item $fdp->c_if() =item $fdp->fdp_if()
Returns the mapping to the SNMP Interface Table. Returns the mapping to the SNMP Interface Table.
@@ -380,7 +373,7 @@ truncate the last number off of it :
return \%fdp_if; return \%fdp_if;
=item $fdp->c_index() =item $fdp->fdp_index()
Returns the mapping to the SNMP2 Interface table for FDP Cache Entries. Returns the mapping to the SNMP2 Interface table for FDP Cache Entries.
@@ -391,37 +384,37 @@ See fdp_if() entry.
(C<fdpCacheIfIndex>) (C<fdpCacheIfIndex>)
=item $fdp->c_ip() =item $fdp->fdp_ip()
Returns remote IP address Returns remote IP address
(C<fdpCacheAddress>) (C<fdpCacheAddress>)
=item $fdp->c_platform() =item $fdp->fdp_platform()
Returns remote platform id Returns remote platform id
(C<fdpCachePlatform>) (C<fdpCachePlatform>)
=item $fdp->c_port() =item $fdp->fdp_port()
Returns remote port ID Returns remote port ID
(C<fdpDevicePort>) (C<fdpDevicePort>)
=item $fdp->c_proto() =item $fdp->fdp_proto()
Returns remote address type received. Usually IP. Returns remote address type received. Usually IP.
(C<fdpCacheAddressType>) (C<fdpCacheAddressType>)
=item $fdp->c_ver() =item $fdp->fdp_ver()
Returns remote hardware version Returns remote hardware version
(C<fdpCacheVersion>) (C<fdpCacheVersion>)
=item $fdp->c_vlan() =item $fdp->fdp_vlan()
Returns the remote interface native VLAN. Returns the remote interface native VLAN.

View File

@@ -79,27 +79,20 @@ $SNMP::Info::SPEED_MAP{2_000_000_000} = '1.0 Gbps';
sub os { sub os {
my $baystack = shift; my $baystack = shift;
my $descr = $baystack->description(); my $descr = $baystack->description() || "";
my $model = $baystack->model(); my $model = $baystack->model() || "";
if ( ( defined $descr and $descr =~ /Business Ethernet Switch.*SW:v/i ) ) if ( $descr =~ /Business Ethernet Switch.*SW:v/i ) {
{
return 'bes'; return 'bes';
} }
if ( if ( ( ( $model =~ /(420|425|BPS)/ ) and ( $descr =~ m/SW:v[1-2]/i ) )
( or ( ( $model =~ /(410|450|380)/ ) ) )
(defined $model and $model =~ /(420|425|BPS)/ )
and
(defined $descr and $descr =~ m/SW:v[1-2]/i )
)
or
(
(defined $model and $model =~ /(410|450|380)/ )
)
)
{ {
return 'baystack'; return 'baystack';
} }
if ( $model =~ /VSP/ ) {
return 'vsp';
}
return 'boss'; return 'boss';
} }
@@ -126,7 +119,7 @@ sub os_bin {
} }
sub vendor { sub vendor {
return 'nortel'; return 'avaya';
} }
sub model { sub model {
@@ -141,9 +134,11 @@ sub model {
return '303' if ( defined $descr and $descr =~ /\D303\D/ ); return '303' if ( defined $descr and $descr =~ /\D303\D/ );
return '304' if ( defined $descr and $descr =~ /\D304\D/ ); return '304' if ( defined $descr and $descr =~ /\D304\D/ );
return 'BPS' if ( $model =~ /BPS2000/i ); return 'BPS' if ( $model =~ /BPS2000/i );
return $2
if ( $model # Pull sreg- from all
=~ /(ES|ERS|BayStack|EthernetRoutingSwitch|EthernetSwitch)-?(\d+)/ ); $model =~ s/^sreg-//;
# Strip ES/ERS/BayStack etc. from those families
$model =~ s/^(E(R)?S|BayStack|Ethernet(Routing)?Switch)-?//;
return $model; return $model;
} }
@@ -214,7 +209,7 @@ sub i_name {
sub index_factor { sub index_factor {
my $baystack = shift; my $baystack = shift;
my $model = $baystack->model(); my $model = $baystack->model() || "";
my $os = $baystack->os(); my $os = $baystack->os();
my $os_ver = $baystack->os_ver(); my $os_ver = $baystack->os_ver();
my $op_mode = $baystack->ns_op_mode(); my $op_mode = $baystack->ns_op_mode();
@@ -228,142 +223,16 @@ sub index_factor {
my $index_factor = 32; my $index_factor = 32;
$index_factor = 64 $index_factor = 64
if ( ( defined $model and $model =~ /(470)/ ) if ( ( $model =~ /(470)/ )
or ( $os =~ m/(boss|bes)/ ) and ( $op_mode eq 'pure' ) ); or ( $os =~ m/(boss|bes)/ ) and ( $op_mode eq 'pure' ) );
$index_factor = 128 $index_factor = 128
if ( ( defined $model and $model =~ /(5[56]\d\d)/ ) if ( ( $model =~ /(5[56]\d\d)|VSP/ )
and ( $os_ver >= 6 ) ); and ( $os_ver >= 6 ) );
return $index_factor; return $index_factor;
} }
# Use SONMP and/or LLDP
sub hasCDP {
my $baystack = shift;
return $baystack->hasLLDP() || $baystack->SUPER::hasCDP();
}
sub c_ip {
my $baystack = shift;
my $partial = shift;
my $cdp = $baystack->SUPER::c_ip($partial) || {};
my $lldp = $baystack->lldp_ip($partial) || {};
my %c_ip;
foreach my $iid ( keys %$cdp ) {
my $ip = $cdp->{$iid};
next unless defined $ip;
$c_ip{$iid} = $ip;
}
foreach my $iid ( keys %$lldp ) {
my $ip = $lldp->{$iid};
next unless defined $ip;
$c_ip{$iid} = $ip;
}
return \%c_ip;
}
sub c_if {
my $baystack = shift;
my $partial = shift;
my $lldp = $baystack->lldp_if($partial) || {};
my $cdp = $baystack->SUPER::c_if($partial) || {};
my %c_if;
foreach my $iid ( keys %$cdp ) {
my $if = $cdp->{$iid};
next unless defined $if;
$c_if{$iid} = $if;
}
foreach my $iid ( keys %$lldp ) {
my $if = $lldp->{$iid};
next unless defined $if;
$c_if{$iid} = $if;
}
return \%c_if;
}
sub c_port {
my $baystack = shift;
my $partial = shift;
my $lldp = $baystack->lldp_port($partial) || {};
my $cdp = $baystack->SUPER::c_port($partial) || {};
my %c_port;
foreach my $iid ( keys %$cdp ) {
my $port = $cdp->{$iid};
next unless defined $port;
$c_port{$iid} = $port;
}
foreach my $iid ( keys %$lldp ) {
my $port = $lldp->{$iid};
next unless defined $port;
$c_port{$iid} = $port;
}
return \%c_port;
}
sub c_id {
my $baystack = shift;
my $partial = shift;
my $lldp = $baystack->lldp_id($partial) || {};
my $cdp = $baystack->SUPER::c_id($partial) || {};
my %c_id;
foreach my $iid ( keys %$cdp ) {
my $id = $cdp->{$iid};
next unless defined $id;
$c_id{$iid} = $id;
}
foreach my $iid ( keys %$lldp ) {
my $id = $lldp->{$iid};
next unless defined $id;
$c_id{$iid} = $id;
}
return \%c_id;
}
sub c_platform {
my $baystack = shift;
my $partial = shift;
my $lldp = $baystack->lldp_rem_sysdesc($partial) || {};
my $cdp = $baystack->SUPER::c_platform($partial) || {};
my %c_platform;
foreach my $iid ( keys %$cdp ) {
my $platform = $cdp->{$iid};
next unless defined $platform;
$c_platform{$iid} = $platform;
}
foreach my $iid ( keys %$lldp ) {
my $platform = $lldp->{$iid};
next unless defined $platform;
$c_platform{$iid} = $platform;
}
return \%c_platform;
}
# Newer devices support ENTITY-MIB, use if available otherwise use proprietary # Newer devices support ENTITY-MIB, use if available otherwise use proprietary
# methods. # methods.
@@ -475,8 +344,8 @@ __END__
=head1 NAME =head1 NAME
SNMP::Info::Layer2::Baystack - SNMP Interface to Nortel Ethernet (Baystack) SNMP::Info::Layer2::Baystack - SNMP Interface to Avaya Ethernet (Baystack)
Switches and VSP 7000 series switches
=head1 AUTHOR =head1 AUTHOR
@@ -499,8 +368,8 @@ Eric Miller
=head1 DESCRIPTION =head1 DESCRIPTION
Provides abstraction to the configuration information obtainable from a Nortel Provides abstraction to the configuration information obtainable from an
Ethernet Switch (Baystack) through SNMP. Avaya Ethernet Switch (Baystack) and VSP 7000 series through SNMP.
For speed or debugging purposes you can call the subclass directly, but not For speed or debugging purposes you can call the subclass directly, but not
after determining a more specific class using the method above. after determining a more specific class using the method above.
@@ -523,12 +392,6 @@ my $baystack = new SNMP::Info::Layer2::Baystack(...);
=back =back
=head2 Required MIBs
=over
=back
=head2 Inherited MIBs =head2 Inherited MIBs
See L<SNMP::Info::SONMP/"Required MIBs"> for its MIB requirements. See L<SNMP::Info::SONMP/"Required MIBs"> for its MIB requirements.
@@ -549,7 +412,7 @@ These are methods that return scalar value from SNMP
=item $baystack->vendor() =item $baystack->vendor()
Returns 'nortel' Returns 'avaya'
=item $baystack->model() =item $baystack->model()
@@ -719,54 +582,6 @@ ns_e_vendor().
=back =back
=head2 Topology information
Based upon the software version devices may support SynOptics Network
Management Protocol (SONMP) and Link Layer Discovery Protocol (LLDP). These
methods will query both and return the combination of all information. As a
result, there may be identical topology information returned from the two
protocols causing duplicate entries. It is the calling program's
responsibility to identify any duplicate entries and remove duplicates if
necessary.
=over
=item $baystack->hasCDP()
Returns true if the device is running either SONMP or LLDP.
=item $baystack->c_if()
Returns reference to hash. Key: iid Value: local device port (interfaces)
=item $baystack->c_ip()
Returns reference to hash. Key: iid Value: remote IPv4 address
If multiple entries exist with the same local port, c_if(), with the same IPv4
address, c_ip(), it may be a duplicate entry.
If multiple entries exist with the same local port, c_if(), with different
IPv4 addresses, c_ip(), there is either a non-SONMP/LLDP device in between two or
more devices or multiple devices which are not directly connected.
Use the data from the Layer2 Topology Table below to dig deeper.
=item $baystack->c_port()
Returns reference to hash. Key: iid Value: remote port (interfaces)
=item $baystack->c_id()
Returns reference to hash. Key: iid Value: string value used to identify the
chassis component associated with the remote system.
=item $baystack->c_platform()
Returns reference to hash. Key: iid Value: Remote Device Type
=back
=head2 Table Methods imported from SNMP::Info::SONMP =head2 Table Methods imported from SNMP::Info::SONMP
See L<SNMP::Info::SONMP/"TABLE METHODS"> for details. See L<SNMP::Info::SONMP/"TABLE METHODS"> for details.

View File

@@ -413,108 +413,6 @@ sub _sensor {
return $result; return $result;
} }
# Use CDP and/or LLDP
sub hasCDP {
my $hp = shift;
return $hp->hasLLDP() || $hp->SUPER::hasCDP();
}
sub c_ip {
my $hp = shift;
my $partial = shift;
my $cdp = $hp->SUPER::c_ip($partial) || {};
my $lldp = $hp->lldp_ip($partial) || {};
my %c_ip;
foreach my $iid ( keys %$cdp ) {
my $ip = $cdp->{$iid};
next unless defined $ip;
$c_ip{$iid} = $ip;
}
foreach my $iid ( keys %$lldp ) {
my $ip = $lldp->{$iid};
next unless defined $ip;
$c_ip{$iid} = $ip;
}
return \%c_ip;
}
sub c_if {
my $hp = shift;
my $partial = shift;
my $lldp = $hp->lldp_if($partial) || {};
my $cdp = $hp->SUPER::c_if($partial) || {};
my %c_if;
foreach my $iid ( keys %$cdp ) {
my $if = $cdp->{$iid};
next unless defined $if;
$c_if{$iid} = $if;
}
foreach my $iid ( keys %$lldp ) {
my $if = $lldp->{$iid};
next unless defined $if;
$c_if{$iid} = $if;
}
return \%c_if;
}
sub c_port {
my $hp = shift;
my $partial = shift;
my $lldp = $hp->lldp_port($partial) || {};
my $cdp = $hp->SUPER::c_port($partial) || {};
my %c_port;
foreach my $iid ( keys %$cdp ) {
my $port = $cdp->{$iid};
next unless defined $port;
$c_port{$iid} = $port;
}
foreach my $iid ( keys %$lldp ) {
my $port = $lldp->{$iid};
next unless defined $port;
$c_port{$iid} = $port;
}
return \%c_port;
}
sub c_id {
my $hp = shift;
my $partial = shift;
my $lldp = $hp->lldp_id($partial) || {};
my $cdp = $hp->SUPER::c_id($partial) || {};
my %c_id;
foreach my $iid ( keys %$cdp ) {
my $id = $cdp->{$iid};
next unless defined $id;
$c_id{$iid} = $id;
}
foreach my $iid ( keys %$lldp ) {
my $id = $lldp->{$iid};
next unless defined $id;
$c_id{$iid} = $id;
}
return \%c_id;
}
sub munge_hp_c_id { sub munge_hp_c_id {
my ($v) = @_; my ($v) = @_;
if ( length(unpack('H*', $v)) == 12 ){ if ( length(unpack('H*', $v)) == 12 ){
@@ -528,30 +426,6 @@ sub munge_hp_c_id {
} }
} }
sub c_platform {
my $hp = shift;
my $partial = shift;
my $lldp = $hp->lldp_rem_sysdesc($partial) || {};
my $cdp = $hp->SUPER::c_platform($partial) || {};
my %c_platform;
foreach my $iid ( keys %$cdp ) {
my $platform = $cdp->{$iid};
next unless defined $platform;
$c_platform{$iid} = $platform;
}
foreach my $iid ( keys %$lldp ) {
my $platform = $lldp->{$iid};
next unless defined $platform;
$c_platform{$iid} = $platform;
}
return \%c_platform;
}
# POWER-ETHERNET-MIB doesn't define a mapping of its # POWER-ETHERNET-MIB doesn't define a mapping of its
# "module"/"port" index to ifIndex. Different vendors # "module"/"port" index to ifIndex. Different vendors
# do this in different ways. # do this in different ways.
@@ -959,53 +833,6 @@ interface index (c<ifIndex>)
=back =back
=head2 Topology information
Based upon the firmware version HP devices may support Cisco Discovery
Protocol (CDP), Link Layer Discovery Protocol (LLDP), or both. These methods
will query both and return the combination of all information. As a result,
there may be identical topology information returned from the two protocols
causing duplicate entries. It is the calling program's responsibility to
identify any duplicate entries and remove duplicates if necessary.
=over
=item $hp->hasCDP()
Returns true if the device is running either CDP or LLDP.
=item $hp->c_if()
Returns reference to hash. Key: iid Value: local device port (interfaces)
=item $hp->c_ip()
Returns reference to hash. Key: iid Value: remote IPv4 address
If multiple entries exist with the same local port, c_if(), with the same IPv4
address, c_ip(), it may be a duplicate entry.
If multiple entries exist with the same local port, c_if(), with different
IPv4 addresses, c_ip(), there is either a non-CDP/LLDP device in between two
or more devices or multiple devices which are not directly connected.
Use the data from the Layer2 Topology Table below to dig deeper.
=item $hp->c_port()
Returns reference to hash. Key: iid Value: remote port (interfaces)
=item $hp->c_id()
Returns reference to hash. Key: iid Value: string value used to identify the
chassis component associated with the remote system.
=item $hp->c_platform()
Returns reference to hash. Key: iid Value: Remote Device Type
=back
=head2 Table Methods imported from SNMP::Info::Layer2 =head2 Table Methods imported from SNMP::Info::Layer2
See documentation in L<SNMP::Info::Layer2/"TABLE METHODS"> for details. See documentation in L<SNMP::Info::Layer2/"TABLE METHODS"> for details.

1291
Info/Layer2/NWSS2300.pm Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -105,49 +105,6 @@ sub serial {
return $self->ng_serial(); return $self->ng_serial();
} }
# Use LLDP
sub hasCDP {
my $netgear = shift;
return $netgear->hasLLDP();
}
sub c_ip {
my $netgear = shift;
my $partial = shift;
return $netgear->lldp_ip($partial);
}
sub c_if {
my $netgear = shift;
my $partial = shift;
return $netgear->lldp_if($partial);
}
sub c_port {
my $netgear = shift;
my $partial = shift;
return $netgear->lldp_port($partial);
}
sub c_id {
my $netgear = shift;
my $partial = shift;
return $netgear->lldp_id($partial);
}
sub c_platform {
my $netgear = shift;
my $partial = shift;
return $netgear->lldp_rem_sysdesc($partial);
}
1; 1;
__END__ __END__
@@ -271,51 +228,12 @@ C<Q-BRIDGE-MIB> doesn't return anything.
=back =back
=head2 Topology information
Based upon the software version devices may support Link Layer Discovery
Protocol (LLDP).
=over
=item $netgear->hasCDP()
Returns true if the device is running LLDP.
=item $netgear->c_if()
Returns reference to hash. Key: iid Value: local device port (interfaces)
=item $netgear->c_ip()
Returns reference to hash. Key: iid Value: remote IPv4 address
If multiple entries exist with the same local port, c_if(), with the same IPv4
address, c_ip(), it may be a duplicate entry.
If multiple entries exist with the same local port, c_if(), with different
IPv4 addresses, c_ip(), there is either a non-LLDP device in between two or
more devices or multiple devices which are not directly connected.
Use the data from the Layer2 Topology Table below to dig deeper.
=item $netgear->c_port()
Returns reference to hash. Key: iid Value: remote port (interfaces)
=item $netgear->c_id()
Returns reference to hash. Key: iid Value: string value used to identify the
chassis component associated with the remote system.
=item $netgear->c_platform()
Returns reference to hash. Key: iid Value: Remote Device Type
=back
=head2 Table Methods imported from SNMP::Info::Layer2 =head2 Table Methods imported from SNMP::Info::Layer2
See documentation in L<SNMP::Info::Layer2/"TABLE METHODS"> for details. See documentation in L<SNMP::Info::Layer2/"TABLE METHODS"> for details.
=head2 Table Methods imported from SNMP::Info::LLDP
See documentation in L<SNMP::Info::LLDP/"TABLE METHODS"> for details.
=cut =cut

View File

@@ -34,6 +34,12 @@ use strict;
use Exporter; use Exporter;
use SNMP::Info::Layer3; use SNMP::Info::Layer3;
use SNMP::Info::MAU; use SNMP::Info::MAU;
# Use LLDP
# (or at least try. The versions I've seen have two problems:
# 1. they report ifIndex values as 'local'; we don't support ifIndex
# but *could*
# 2. They report 0.0.0.0 as the management address
# )
use SNMP::Info::LLDP; use SNMP::Info::LLDP;
@SNMP::Info::Layer3::AlcatelLucent::ISA = qw/SNMP::Info::LLDP SNMP::Info::MAU @SNMP::Info::Layer3::AlcatelLucent::ISA = qw/SNMP::Info::LLDP SNMP::Info::MAU
@@ -285,53 +291,6 @@ sub bp_index {
# return $i_vlan; # return $i_vlan;
#} #}
# Use LLDP
# (or at least try. The versions I've seen have two problems:
# 1. they report ifIndex values as 'local'; we don't support ifIndex
# but *could*
# 2. They report 0.0.0.0 as the management address
# )
sub hasCDP {
my $alu = shift;
return $alu->hasLLDP();
}
sub c_ip {
my $alu = shift;
my $partial = shift;
return $alu->lldp_ip($partial);
}
sub c_if {
my $alu = shift;
my $partial = shift;
return $alu->lldp_if($partial);
}
sub c_port {
my $alu = shift;
my $partial = shift;
return $alu->lldp_port($partial);
}
sub c_id {
my $alu = shift;
my $partial = shift;
return $alu->lldp_id($partial);
}
sub c_platform {
my $alu = shift;
my $partial = shift;
return $alu->lldp_rem_sysdesc($partial);
}
# Power-Ethernet ifIndex mapping. I've only seen this from a # Power-Ethernet ifIndex mapping. I've only seen this from a
# fixed-config single-module system, so this is only a plausible # fixed-config single-module system, so this is only a plausible
# guess as to the mapping on a stack or modular system. # guess as to the mapping on a stack or modular system.
@@ -428,10 +387,6 @@ These are methods that return scalar value from SNMP
Returns 'alcatel-lucent' Returns 'alcatel-lucent'
=item $alu->hasCDP()
Returns whether LLDP is enabled.
=item $alu->model() =item $alu->model()
Tries to reference $alu->id() to one of the product MIBs listed above Tries to reference $alu->id() to one of the product MIBs listed above
@@ -502,26 +457,6 @@ Work around various bugs in the F<BRIDGE-MIB> and
F<Q-BRIDGE-MIB> implementations, by returning both F<Q-BRIDGE-MIB> implementations, by returning both
C<ifIndex> and C<dot1dBasePort> mappings to C<ifIndex> values. C<ifIndex> and C<dot1dBasePort> mappings to C<ifIndex> values.
=item $alu->c_id()
Returns LLDP information.
=item $alu->c_if()
Returns LLDP information.
=item $alu->c_ip()
Returns LLDP information.
=item $alu->c_platform()
Returns LLDP information.
=item $alu->c_port()
Returns LLDP information.
=item $alu->i_duplex_admin() =item $alu->i_duplex_admin()
Returns info from F<MAU-MIB> Returns info from F<MAU-MIB>

View File

@@ -152,10 +152,6 @@ sub os {
return 'altiga'; return 'altiga';
} }
sub hasCDP {
return 0;
}
# $altiga->interfaces() - Map the Interfaces to their physical names # $altiga->interfaces() - Map the Interfaces to their physical names
# Add interface number to interface name to prevent duplicate ifDescr # Add interface number to interface name to prevent duplicate ifDescr
# Included statically configured VPN tunnels if ($int_include_vpn) # Included statically configured VPN tunnels if ($int_include_vpn)
@@ -350,10 +346,6 @@ Tries to determine OS version from the C<sysDescr.0> field. Returns version or C
Combines results from C<fan1_alarm>, C<fan2_alarm>, and C<fam3_alarm> methods. Combines results from C<fan1_alarm>, C<fan2_alarm>, and C<fam3_alarm> methods.
=item $altiga->hasCDP()
No.
=item $altiga->ps1_status() =item $altiga->ps1_status()
Combines C<ps1_3v_alarm> and C<ps1_5v_alarm> methods. Combines C<ps1_3v_alarm> and C<ps1_5v_alarm> methods.

View File

@@ -120,49 +120,6 @@ sub fw_port {
return $arista->qb_fw_port($partial); return $arista->qb_fw_port($partial);
} }
# Use LLDP
sub hasCDP {
my $arista = shift;
return $arista->hasLLDP();
}
sub c_ip {
my $arista = shift;
my $partial = shift;
return $arista->lldp_ip($partial);
}
sub c_if {
my $arista = shift;
my $partial = shift;
return $arista->lldp_if($partial);
}
sub c_port {
my $arista = shift;
my $partial = shift;
return $arista->lldp_port($partial);
}
sub c_id {
my $arista = shift;
my $partial = shift;
return $arista->lldp_id($partial);
}
sub c_platform {
my $arista = shift;
my $partial = shift;
return $arista->lldp_rem_sysdesc($partial);
}
1; 1;
__END__ __END__
@@ -232,10 +189,6 @@ These are methods that return scalar values from SNMP
Returns 'Arista Networks, Inc.' Returns 'Arista Networks, Inc.'
=item $arista->hasCDP()
Returns whether LLDP is enabled.
=item $arista->model() =item $arista->model()
Tries to reference $arista->id() to one of the product MIBs listed above Tries to reference $arista->id() to one of the product MIBs listed above
@@ -279,26 +232,6 @@ Use the F<Q-BRIDGE-MIB> instead of F<BRIDGE-MIB>
Use the F<Q-BRIDGE-MIB> instead of F<BRIDGE-MIB> Use the F<Q-BRIDGE-MIB> instead of F<BRIDGE-MIB>
=item $arista->c_id()
Returns LLDP information.
=item $arista->c_if()
Returns LLDP information.
=item $arista->c_ip()
Returns LLDP information.
=item $arista->c_platform()
Returns LLDP information.
=item $arista->c_port()
Returns LLDP information.
=item $arista->i_duplex_admin() =item $arista->i_duplex_admin()
Returns info from F<MAU-MIB> Returns info from F<MAU-MIB>

View File

@@ -236,141 +236,6 @@ sub cisco_comm_indexing {
return 1; return 1;
} }
# Use CDP and/or LLDP
sub hasCDP {
my $c3550 = shift;
return $c3550->hasLLDP() || $c3550->SUPER::hasCDP();
}
sub c_ip {
my $c3550 = shift;
my $partial = shift;
my $cdp = $c3550->SUPER::c_ip($partial) || {};
my $lldp = $c3550->lldp_ip($partial) || {};
my %c_ip;
foreach my $iid ( keys %$cdp ) {
my $ip = $cdp->{$iid};
next unless defined $ip;
$c_ip{$iid} = $ip;
}
foreach my $iid ( keys %$lldp ) {
my $ip = $lldp->{$iid};
next unless defined $ip;
$c_ip{$iid} = $ip;
}
return \%c_ip;
}
sub c_if {
my $c3550 = shift;
my $partial = shift;
my $cdp = $c3550->SUPER::c_if($partial) || {};
my %c_if;
foreach my $iid ( keys %$cdp ) {
my $if = $cdp->{$iid};
next unless defined $if;
$c_if{$iid} = $if;
}
# We need to match the lldp key with the ifIndex
# via lldpLocPortId and ifName
my $i_name = $c3550->ifName($partial) || {};
my $i_name_rev = {};
while ( my($key,$val) = each %$i_name ){
$i_name_rev->{$val} = $key;
}
my $loc_port_id = $c3550->lldpLocPortId($partial) || {};
my $lldp = $c3550->lldp_if($partial) || {};
foreach my $iid ( keys %$lldp ) {
my $if = $lldp->{$iid} || next;
my $name = $loc_port_id->{$if} || next;
my $i_index = $i_name_rev->{$name} || next;
$c_if{$iid} = $i_index;
}
return \%c_if;
}
sub c_port {
my $c3550 = shift;
my $partial = shift;
my $lldp = $c3550->lldp_port($partial) || {};
my $cdp = $c3550->SUPER::c_port($partial) || {};
my %c_port;
foreach my $iid ( keys %$cdp ) {
my $port = $cdp->{$iid};
next unless defined $port;
$c_port{$iid} = $port;
}
foreach my $iid ( keys %$lldp ) {
my $port = $lldp->{$iid};
next unless defined $port;
$c_port{$iid} = $port;
}
return \%c_port;
}
sub c_id {
my $c3550 = shift;
my $partial = shift;
my $lldp = $c3550->lldp_id($partial) || {};
my $cdp = $c3550->SUPER::c_id($partial) || {};
my %c_id;
foreach my $iid ( keys %$cdp ) {
my $id = $cdp->{$iid};
next unless defined $id;
$c_id{$iid} = $id;
}
foreach my $iid ( keys %$lldp ) {
my $id = $lldp->{$iid};
next unless defined $id;
$c_id{$iid} = $id;
}
return \%c_id;
}
sub c_platform {
my $c3550 = shift;
my $partial = shift;
my $lldp = $c3550->lldp_rem_sysdesc($partial) || {};
my $cdp = $c3550->SUPER::c_platform($partial) || {};
my %c_platform;
foreach my $iid ( keys %$cdp ) {
my $platform = $cdp->{$iid};
next unless defined $platform;
$c_platform{$iid} = $platform;
}
foreach my $iid ( keys %$lldp ) {
my $platform = $lldp->{$iid};
next unless defined $platform;
$c_platform{$iid} = $platform;
}
return \%c_platform;
}
1; 1;
__END__ __END__
@@ -494,23 +359,6 @@ Returns 1. Use vlan indexing.
=back =back
=head2 Topology information
Based upon the firmware version Cisco devices may support Link Layer Discovery
Protocol (LLDP) in addition to Cisco Discovery Protocol (CDP). These methods
will query both and return the combination of all information. As a result,
there may be identical topology information returned from the two protocols
causing duplicate entries. It is the calling program's responsibility to
identify any duplicate entries and remove duplicates if necessary.
=over
=item $c3550->hasCDP()
Returns true if the device is running either CDP or LLDP.
=back
=head2 Globals imported from SNMP::Info::Layer3 =head2 Globals imported from SNMP::Info::Layer3
See documentation in L<SNMP::Info::Layer3/"GLOBALS"> for details. See documentation in L<SNMP::Info::Layer3/"GLOBALS"> for details.
@@ -556,40 +404,6 @@ See documentation in L<SNMP::Info::CiscoImage/"GLOBALS"> for details.
These are methods that return tables of information in the form of a reference These are methods that return tables of information in the form of a reference
to a hash. to a hash.
=over
=item $c3550->c_if()
Returns reference to hash. Key: iid Value: local device port (interfaces)
=item $c3550->c_ip()
Returns reference to hash. Key: iid Value: remote IPv4 address
If multiple entries exist with the same local port, c_if(), with the same IPv4
address, c_ip(), it may be a duplicate entry.
If multiple entries exist with the same local port, c_if(), with different
IPv4 addresses, c_ip(), there is either a non-CDP/LLDP device in between two
or more devices or multiple devices which are not directly connected.
Use the data from the Layer2 Topology Table below to dig deeper.
=item $c3550->c_port()
Returns reference to hash. Key: iid Value: remote port (interfaces)
=item $c3550->c_id()
Returns reference to hash. Key: iid Value: string value used to identify the
chassis component associated with the remote system.
=item $c3550->c_platform()
Returns reference to hash. Key: iid Value: Remote Device Type
=back
=head2 Overrides =head2 Overrides
=over =over

View File

@@ -207,133 +207,6 @@ sub set_i_duplex_admin {
} }
} }
# Use CDP and/or LLDP
sub hasCDP {
my $c6500 = shift;
return $c6500->hasLLDP() || $c6500->SUPER::hasCDP();
}
sub c_ip {
my $c6500 = shift;
my $partial = shift;
my $cdp = $c6500->SUPER::c_ip($partial) || {};
my $lldp = $c6500->lldp_ip($partial) || {};
my %c_ip;
foreach my $iid ( keys %$cdp ) {
my $ip = $cdp->{$iid};
next unless defined $ip;
$c_ip{$iid} = $ip;
}
foreach my $iid ( keys %$lldp ) {
my $ip = $lldp->{$iid};
next unless defined $ip;
$c_ip{$iid} = $ip;
}
return \%c_ip;
}
sub c_if {
my $c6500 = shift;
my $partial = shift;
my $lldp = $c6500->lldp_if($partial) || {};
my $cdp = $c6500->SUPER::c_if($partial) || {};
my %c_if;
foreach my $iid ( keys %$cdp ) {
my $if = $cdp->{$iid};
next unless defined $if;
$c_if{$iid} = $if;
}
foreach my $iid ( keys %$lldp ) {
my $if = $lldp->{$iid};
next unless defined $if;
$c_if{$iid} = $if;
}
return \%c_if;
}
sub c_port {
my $c6500 = shift;
my $partial = shift;
my $lldp = $c6500->lldp_port($partial) || {};
my $cdp = $c6500->SUPER::c_port($partial) || {};
my %c_port;
foreach my $iid ( keys %$cdp ) {
my $port = $cdp->{$iid};
next unless defined $port;
$c_port{$iid} = $port;
}
foreach my $iid ( keys %$lldp ) {
my $port = $lldp->{$iid};
next unless defined $port;
$c_port{$iid} = $port;
}
return \%c_port;
}
sub c_id {
my $c6500 = shift;
my $partial = shift;
my $lldp = $c6500->lldp_id($partial) || {};
my $cdp = $c6500->SUPER::c_id($partial) || {};
my %c_id;
foreach my $iid ( keys %$cdp ) {
my $id = $cdp->{$iid};
next unless defined $id;
$c_id{$iid} = $id;
}
foreach my $iid ( keys %$lldp ) {
my $id = $lldp->{$iid};
next unless defined $id;
$c_id{$iid} = $id;
}
return \%c_id;
}
sub c_platform {
my $c6500 = shift;
my $partial = shift;
my $lldp = $c6500->lldp_rem_sysdesc($partial) || {};
my $cdp = $c6500->SUPER::c_platform($partial) || {};
my %c_platform;
foreach my $iid ( keys %$cdp ) {
my $platform = $cdp->{$iid};
next unless defined $platform;
$c_platform{$iid} = $platform;
}
foreach my $iid ( keys %$lldp ) {
my $platform = $lldp->{$iid};
next unless defined $platform;
$c_platform{$iid} = $platform;
}
return \%c_platform;
}
1; 1;
__END__ __END__
@@ -531,53 +404,6 @@ Crosses $c6500->p_port() with $c6500->p_duplex() to utilize port C<ifIndex>.
=back =back
=head2 Topology information
Based upon the firmware version Cisco devices may support Link Layer Discover
Protocol (LLDP) in addition to the Cisco-proprietary CDP. These methods
will query both and return the combination of all information. As a result,
there may be identical topology information returned from the two protocols
causing duplicate entries. It is the calling program's responsibility to
identify any duplicate entries and remove duplicates if necessary.
=over
=item $c6500->hasCDP()
Returns true if the device is running either CDP or LLDP.
=item $c6500->c_if()
Returns reference to hash. Key: iid Value: local device port (interfaces)
=item $c6500->c_ip()
Returns reference to hash. Key: iid Value: remote IPv4 address
If multiple entries exist with the same local port, c_if(), with the same IPv4
address, c_ip(), it may be a duplicate entry.
If multiple entries exist with the same local port, c_if(), with different
IPv4 addresses, c_ip(), there is either a non-CDP/LLDP device in between two
or more devices or multiple devices which are not directly connected.
Use the data from the Layer2 Topology Table below to dig deeper.
=item $c6500->c_port()
Returns reference to hash. Key: iid Value: remote port (interfaces)
=item $c6500->c_id()
Returns reference to hash. Key: iid Value: string value used to identify the
chassis component associated with the remote system.
=item $c6500->c_platform()
Returns reference to hash. Key: iid Value: Remote Device Type
=back
=head2 Table Methods imported from SNMP::Info::CiscoVTP =head2 Table Methods imported from SNMP::Info::CiscoVTP
See documentation in L<SNMP::Info::CiscoVTP/"TABLE METHODS"> for details. See documentation in L<SNMP::Info::CiscoVTP/"TABLE METHODS"> for details.

View File

@@ -232,47 +232,6 @@ sub _vendor {
} }
} }
# lldp support
sub hasCDP {
my $dell = shift;
return $dell->hasLLDP();
}
sub c_ip {
my $dell = shift;
my $partial = shift;
return $dell->lldp_ip($partial);
}
sub c_if {
my $dell = shift;
my $partial = shift;
return $dell->lldp_if($partial);
}
sub c_port {
my $dell = shift;
my $partial = shift;
return $dell->lldp_port($partial);
}
sub c_id {
my $dell = shift;
my $partial = shift;
return $dell->lldp_id($partial);
}
sub c_platform {
my $dell = shift;
my $partial = shift;
return $dell->lldp_rem_sysdesc($partial);
}
1; 1;
__END__ __END__
@@ -368,10 +327,6 @@ id(). Defaults to 'dlink'.
Returns 'dell', 'dlink', or 'ibm' based upon the IANA enterprise number in Returns 'dell', 'dlink', or 'ibm' based upon the IANA enterprise number in
id(). Defaults to 'dlink'. id(). Defaults to 'dlink'.
=item $dell->hasCDP()
Returns whether LLDP is enabled.
=back =back
=head2 Overrides =head2 Overrides
@@ -389,6 +344,10 @@ otherwise uses the Layer3 serial method.
See documentation in L<SNMP::Info::Layer3/"GLOBALS"> for details. See documentation in L<SNMP::Info::Layer3/"GLOBALS"> for details.
=head2 Globals imported from SNMP::Info::LLDP
See documentation in L<SNMP::Info::LLDP/"GLOBALS"> for details.
=head1 TABLE METHODS =head1 TABLE METHODS
These are methods that return tables of information in the form of a reference These are methods that return tables of information in the form of a reference
@@ -464,30 +423,14 @@ Some devices don't implement the C<BRIDGE-MIB> forwarding table, so we use
the C<Q-BRIDGE-MIB> forwarding table. Fall back to the C<BRIDGE-MIB> if the C<Q-BRIDGE-MIB> forwarding table. Fall back to the C<BRIDGE-MIB> if
C<Q-BRIDGE-MIB> doesn't return anything. C<Q-BRIDGE-MIB> doesn't return anything.
=item $dell->c_id()
Returns LLDP information.
=item $dell->c_if()
Returns LLDP information.
=item $dell->c_ip()
Returns LLDP information.
=item $dell->c_platform()
Returns LLDP information.
=item $dell->c_port()
Returns LLDP information.
=back =back
=head2 Table Methods imported from SNMP::Info::Layer3 =head2 Table Methods imported from SNMP::Info::Layer3
See documentation in L<SNMP::Info::Layer3/"TABLE METHODS"> for details. See documentation in L<SNMP::Info::Layer3/"TABLE METHODS"> for details.
=head2 Table Methods imported from SNMP::Info::LLDP
See documentation in L<SNMP::Info::LLDP/"TABLE METHODS"> for details.
=cut =cut

View File

@@ -165,138 +165,45 @@ sub fw_port {
return $enterasys->qb_fw_port($partial); return $enterasys->qb_fw_port($partial);
} }
# Use CDP and/or LLDP
#
# LLDP table timefilter implementation continuously increments when walked # LLDP table timefilter implementation continuously increments when walked
# and we may never reach the end of the table. This behavior can be # and we may never reach the end of the table. This behavior can be
# modified with the "set snmp timefilter break disable" command, # modified with the "set snmp timefilter break disable" command,
# unfortunately it is not the default. Query with a partial value of zero # unfortunately it is not the default. Query with a partial value of zero
# which means no time filter. # which means no time filter.
sub hasCDP { sub lldp_ip {
my $enterasys = shift; my $enterasys = shift;
my $partial = shift || 0;
return $enterasys->hasLLDP() || $enterasys->SUPER::hasCDP(); return $enterasys->SUPER::lldp_ip($partial);
} }
sub c_ip { sub lldp_if {
my $enterasys = shift; my $enterasys = shift;
my $partial = shift; my $partial = shift || 0;
my $cdp = $enterasys->SUPER::c_ip($partial) || {}; return $enterasys->SUPER::lldp_if($partial);
my $lldp = $enterasys->lldp_ip(0) || {};
my %c_ip;
foreach my $iid ( keys %$cdp ) {
my $ip = $cdp->{$iid};
next unless defined $ip;
$c_ip{$iid} = $ip;
} }
foreach my $iid ( keys %$lldp ) { sub lldp_port {
my $ip = $lldp->{$iid};
next unless defined $ip;
$c_ip{$iid} = $ip;
}
return \%c_ip;
}
sub c_if {
my $enterasys = shift; my $enterasys = shift;
my $partial = shift; my $partial = shift || 0;
my $lldp = $enterasys->lldp_if(0) || {}; return $enterasys->SUPER::lldp_port($partial);
my $cdp = $enterasys->SUPER::c_if($partial) || {};
my %c_if;
foreach my $iid ( keys %$cdp ) {
my $if = $cdp->{$iid};
next unless defined $if;
$c_if{$iid} = $if;
} }
foreach my $iid ( keys %$lldp ) { sub lldp_id {
my $if = $lldp->{$iid};
next unless defined $if;
$c_if{$iid} = $if;
}
return \%c_if;
}
sub c_port {
my $enterasys = shift; my $enterasys = shift;
my $partial = shift; my $partial = shift || 0;
my $lldp = $enterasys->lldp_port(0) || {}; return $enterasys->SUPER::lldp_id($partial);
my $cdp = $enterasys->SUPER::c_port($partial) || {};
my %c_port;
foreach my $iid ( keys %$cdp ) {
my $port = $cdp->{$iid};
next unless defined $port;
$c_port{$iid} = $port;
} }
foreach my $iid ( keys %$lldp ) { sub lldp_platform {
my $port = $lldp->{$iid};
next unless defined $port;
$c_port{$iid} = $port;
}
return \%c_port;
}
sub c_id {
my $enterasys = shift; my $enterasys = shift;
my $partial = shift; my $partial = shift || 0;
my $lldp = $enterasys->lldp_id(0) || {}; return $enterasys->SUPER::lldp_rem_sysdesc($partial);
my $cdp = $enterasys->SUPER::c_id($partial) || {};
my %c_id;
foreach my $iid ( keys %$cdp ) {
my $id = $cdp->{$iid};
next unless defined $id;
$c_id{$iid} = $id;
}
foreach my $iid ( keys %$lldp ) {
my $id = $lldp->{$iid};
next unless defined $id;
$c_id{$iid} = $id;
}
return \%c_id;
}
sub c_platform {
my $enterasys = shift;
my $partial = shift;
my $lldp = $enterasys->lldp_rem_sysdesc(0) || {};
my $cdp = $enterasys->SUPER::c_platform($partial) || {};
my %c_platform;
foreach my $iid ( keys %$cdp ) {
my $platform = $cdp->{$iid};
next unless defined $platform;
$c_platform{$iid} = $platform;
}
foreach my $iid ( keys %$lldp ) {
my $platform = $lldp->{$iid};
next unless defined $platform;
$c_platform{$iid} = $platform;
}
return \%c_platform;
} }
1; 1;
@@ -399,12 +306,6 @@ Returns base mac
=back =back
=head2 Overrides
=over
=back
=head2 Globals imported from SNMP::Info::MAU =head2 Globals imported from SNMP::Info::MAU
See documentation in L<SNMP::Info::MAU/"GLOBALS"> for details. See documentation in L<SNMP::Info::MAU/"GLOBALS"> for details.
@@ -463,52 +364,25 @@ identifier (iid).
=back =back
=head2 Topology information =head2 Link Layer Discovery Protocol (LLDP) Overrides
Based upon the firmware version Enterasys devices may support Cabletron The LLDP table timefilter implementation continuously increments when
Discovery Protocol (CTRON CDP), Cisco Discovery Protocol (CDP), Link Layer walked and we may never reach the end of the table. This behavior can be
Discovery Protocol (LLDP), or all. This module currently supports CDP and modified with the "set snmp timefilter break disable" command,
LLDP, but not CTRON CDP. These methods will query both CDP and LLDP and unfortunately it is not the default. These methods are overriden to
return the combination of all information. As a result, there may be supply a partial value of zero which means no time filter.
identical topology information returned from the two protocols
causing duplicate entries. It is the calling program's responsibility to
identify any duplicate entries and remove duplicates if necessary.
=over =over
=item $enterasys->hasCDP() =item $enterasys->lldp_if()
Returns true if the device is running either CDP or LLDP. =item $enterasys->lldp_ip()
=item $enterasys->c_if() =item $enterasys->lldp_port()
Returns reference to hash. Key: iid Value: local device port (interfaces) =item $enterasys->lldp_id()
=item $enterasys->c_ip() =item $enterasys->lldp_platform()
Returns reference to hash. Key: iid Value: remote IPv4 address
If multiple entries exist with the same local port, c_if(), with the same IPv4
address, c_ip(), it may be a duplicate entry.
If multiple entries exist with the same local port, c_if(), with different
IPv4 addresses, c_ip(), there is either a non-CDP/LLDP device in between two
or more devices or multiple devices which are not directly connected.
Use the data from the Layer2 Topology Table below to dig deeper.
=item $enterasys->c_port()
Returns reference to hash. Key: iid Value: remote port (interfaces)
=item $enterasys->c_id()
Returns reference to hash. Key: iid Value: string value used to identify the
chassis component associated with the remote system.
=item $enterasys->c_platform()
Returns reference to hash. Key: iid Value: Remote Device Type
=back =back

View File

@@ -80,19 +80,18 @@ $VERSION = '2.09';
%SNMP::Info::LLDP::FUNCS, %SNMP::Info::LLDP::FUNCS,
%SNMP::Info::EDP::FUNCS, %SNMP::Info::EDP::FUNCS,
'fan_state' => 'extremeFanOperational', 'fan_state' => 'extremeFanOperational',
# EXTREME-FDB-MIB:extremeFdbMacFdbTable # EXTREME-FDB-MIB:extremeFdbMacFdbTable
'ex_fw_mac' => 'extremeFdbMacFdbMacAddress', 'ex_fw_mac' => 'extremeFdbMacFdbMacAddress',
'ex_fw_port' => 'extremeFdbMacFdbPortIfIndex', 'ex_fw_port' => 'extremeFdbMacFdbPortIfIndex',
'ex_fw_status' => 'extremeFdbMacFdbStatus', 'ex_fw_status' => 'extremeFdbMacFdbStatus',
# EXTREME-VLAN-MIB:extremeVlanIfTable # EXTREME-VLAN-MIB:extremeVlanIfTable
'ex_vlan_descr' => 'extremeVlanIfDescr', 'ex_vlan_descr' => 'extremeVlanIfDescr',
'ex_vlan_global_id' => 'extremeVlanIfGlobalIdentifier', 'ex_vlan_global_id' => 'extremeVlanIfGlobalIdentifier',
# EXTREME-VLAN-MIB:extremeVlanEncapsIfTable # EXTREME-VLAN-MIB:extremeVlanEncapsIfTable
'ex_vlan_encap_tag' => 'extremeVlanEncapsIfTag', 'ex_vlan_encap_tag' => 'extremeVlanEncapsIfTag',
# EXTREME-POE-MIB::extremePethPseSlotTable
'peth_power_watts' => 'extremePethSlotPowerLimit',
# EXTREME-POE-MIB::extremePethPsePortTable
'peth_port_power' => 'extremePethPortMeasuredPower', 'peth_port_power' => 'extremePethPortMeasuredPower',
); );
@@ -549,125 +548,6 @@ sub set_add_i_vlan_tagged {
return $rv; return $rv;
} }
# Use EDP and/or LLDP
sub hasCDP {
my $extreme = shift;
return $extreme->hasLLDP() || $extreme->hasEDP();
}
sub c_ip {
my $extreme = shift;
my $partial = shift;
my $edp = $extreme->edp_ip() || {};
my $lldp = $extreme->lldp_ip($partial) || {};
my %c_ip;
foreach my $iid ( keys %$edp ) {
my $ip = $edp->{$iid};
next unless defined $ip;
$c_ip{$iid} = $ip;
}
foreach my $iid ( keys %$lldp ) {
my $ip = $lldp->{$iid};
next unless defined $ip;
$c_ip{$iid} = $ip;
}
return \%c_ip;
}
sub c_if {
my $extreme = shift;
my $partial = shift;
my $lldp = $extreme->lldp_if($partial) || {};
my $edp = $extreme->edp_if() || {};
my %c_if;
foreach my $iid ( keys %$edp ) {
my $if = $edp->{$iid};
next unless defined $if;
$c_if{$iid} = $if;
}
foreach my $iid ( keys %$lldp ) {
my $if = $lldp->{$iid};
next unless defined $if;
$c_if{$iid} = $if;
}
return \%c_if;
}
sub c_port {
my $extreme = shift;
my $partial = shift;
my $lldp = $extreme->lldp_port($partial) || {};
my $edp = $extreme->edp_port() || {};
my %c_port;
foreach my $iid ( keys %$edp ) {
my $port = $edp->{$iid};
next unless defined $port;
$c_port{$iid} = $port;
}
foreach my $iid ( keys %$lldp ) {
my $port = $lldp->{$iid};
next unless defined $port;
$c_port{$iid} = $port;
}
return \%c_port;
}
sub c_id {
my $extreme = shift;
my $partial = shift;
my $lldp = $extreme->lldp_id($partial) || {};
my $edp = $extreme->edp_id() || {};
my %c_id;
foreach my $iid ( keys %$edp ) {
my $id = $edp->{$iid};
next unless defined $id;
$c_id{$iid} = $id;
}
foreach my $iid ( keys %$lldp ) {
my $id = $lldp->{$iid};
next unless defined $id;
$c_id{$iid} = $id;
}
return \%c_id;
}
sub c_platform {
my $extreme = shift;
my $partial = shift;
my $lldp = $extreme->lldp_rem_sysdesc($partial) || {};
my %c_platform;
foreach my $iid ( keys %$lldp ) {
my $platform = $lldp->{$iid};
next unless defined $platform;
$c_platform{$iid} = $platform;
}
return \%c_platform;
}
1; 1;
__END__ __END__
@@ -900,59 +780,14 @@ F<EXTREME-FDB-MIB> rather than F<BRIDGE-MIB>.
=item $extreme->peth_port_power() =item $extreme->peth_port_power()
Power supplied by PoE ports, in milliwatts Power supplied by PoE ports, in milliwatts
("extremePethPortMeasuredPower")
=back (C<extremePethPortMeasuredPower>)
=head2 Topology information =item $extreme->peth_power_watts()
Based upon the firmware version Extreme devices may support Extreme Discovery The configured maximum amount of inline power available to the slot.
Protocol (EDP), Link Layer Discovery Protocol (LLDP), or both. These methods
will query both and return the combination of all information. As a result,
there may be identical topology information returned from the two protocols
causing duplicate entries. It is the calling program's responsibility to
identify any duplicate entries and remove duplicates if necessary.
=over (C<extremePethSlotPowerLimit>)
=item $extreme->hasCDP()
Returns true if the device is running either EDP or LLDP.
=item $extreme->c_if()
Returns reference to hash. Key: iid Value: local device port (interfaces)
=item $extreme->c_ip()
Returns reference to hash. Key: iid Value: remote IPv4 address
If multiple entries exist with the same local port, c_if(), with the same IPv4
address, c_ip(), it may be a duplicate entry.
With EDP multiple entries may exist with the same local port, c_if(), and
different IPv4 addresses, c_ip(), as EDP reports addresses for each VLAN
transported across the trunk. In the case of LLDP with multiple addresses
there is either a non-LLDP device in between two or more devices or multiple
devices which are not directly connected.
Use the data from the Layer2 Topology Table below to dig deeper.
=item $extreme->c_port()
Returns reference to hash. Key: iid Value: remote port (interfaces)
=item $extreme->c_id()
Returns reference to hash. Key: iid Value: string value used to identify the
chassis component associated with the remote system.
=item $extreme->c_platform()
Returns reference to hash. Key: iid Value: Remote Device Type
This information is only available from LLDP. EDP does not provide an
equivalent.
=back =back

View File

@@ -65,6 +65,8 @@ $VERSION = '2.09';
'ps1_type' => 'snChasPwrSupplyDescription.1', 'ps1_type' => 'snChasPwrSupplyDescription.1',
'ps1_status' => 'snChasPwrSupplyOperStatus.1', 'ps1_status' => 'snChasPwrSupplyOperStatus.1',
'fan' => 'snChasFanOperStatus.1', 'fan' => 'snChasFanOperStatus.1',
'img_ver' => 'snAgImgVer',
'ch_serial' => 'snChasSerNum',
); );
@@ -165,7 +167,7 @@ sub vendor {
sub os_ver { sub os_ver {
my $foundry = shift; my $foundry = shift;
return $foundry->snAgImgVer() if ( defined $foundry->snAgImgVer() ); return $foundry->img_ver() if ( defined $foundry->img_ver() );
# Some older ones don't have this value,so we cull it from the description # Some older ones don't have this value,so we cull it from the description
my $descr = $foundry->description(); my $descr = $foundry->description();
@@ -204,10 +206,10 @@ sub serial {
my $foundry = shift; my $foundry = shift;
# Return chassis serial number if available # Return chassis serial number if available
return $foundry->snChasSerNum() if ( $foundry->snChasSerNum() ); return $foundry->ch_serial() if ( $foundry->ch_serial() );
# If no chassis serial use first module serial # If no chassis serial use first module serial
my $mod_serials = $foundry->snAgentConfigModuleSerialNumber(); my $mod_serials = $foundry->snAgentConfigModuleSerialNumber() || {};
foreach my $mod ( sort keys %$mod_serials ) { foreach my $mod ( sort keys %$mod_serials ) {
my $serial = $mod_serials->{$mod} || ''; my $serial = $mod_serials->{$mod} || '';
@@ -268,134 +270,6 @@ sub stp_p_state {
} }
# Use FDP and/or LLDP
sub hasCDP {
my $foundry = shift;
return $foundry->hasLLDP() || $foundry->hasFDP();
}
sub c_ip {
my $foundry = shift;
my $partial = shift;
my $cdp = $foundry->SUPER::c_ip($partial) || {};
my $lldp = $foundry->lldp_ip($partial) || {};
my %c_ip;
foreach my $iid ( keys %$cdp ) {
my $ip = $cdp->{$iid};
next unless defined $ip;
$c_ip{$iid} = $ip;
}
foreach my $iid ( keys %$lldp ) {
my $ip = $lldp->{$iid};
next unless defined $ip;
$c_ip{$iid} = $ip;
}
return \%c_ip;
}
sub c_if {
my $foundry = shift;
my $partial = shift;
my $lldp = $foundry->lldp_if($partial) || {};
my $cdp = $foundry->SUPER::c_if($partial) || {};
my %c_if;
foreach my $iid ( keys %$cdp ) {
my $if = $cdp->{$iid};
next unless defined $if;
$c_if{$iid} = $if;
}
foreach my $iid ( keys %$lldp ) {
my $if = $lldp->{$iid};
next unless defined $if;
$c_if{$iid} = $if;
}
return \%c_if;
}
sub c_port {
my $foundry = shift;
my $partial = shift;
my $lldp = $foundry->lldp_port($partial) || {};
my $cdp = $foundry->SUPER::c_port($partial) || {};
my %c_port;
foreach my $iid ( keys %$cdp ) {
my $port = $cdp->{$iid};
next unless defined $port;
$c_port{$iid} = $port;
}
foreach my $iid ( keys %$lldp ) {
my $port = $lldp->{$iid};
next unless defined $port;
$c_port{$iid} = $port;
}
return \%c_port;
}
sub c_id {
my $foundry = shift;
my $partial = shift;
my $lldp = $foundry->lldp_id($partial) || {};
my $cdp = $foundry->SUPER::c_id($partial) || {};
my %c_id;
foreach my $iid ( keys %$cdp ) {
my $id = $cdp->{$iid};
next unless defined $id;
$c_id{$iid} = $id;
}
foreach my $iid ( keys %$lldp ) {
my $id = $lldp->{$iid};
next unless defined $id;
$c_id{$iid} = $id;
}
return \%c_id;
}
sub c_platform {
my $foundry = shift;
my $partial = shift;
my $lldp = $foundry->lldp_rem_sysdesc($partial) || {};
my $cdp = $foundry->SUPER::c_platform($partial) || {};
my %c_platform;
foreach my $iid ( keys %$cdp ) {
my $platform = $cdp->{$iid};
next unless defined $platform;
$c_platform{$iid} = $platform;
}
foreach my $iid ( keys %$lldp ) {
my $platform = $lldp->{$iid};
next unless defined $platform;
$c_platform{$iid} = $platform;
}
return \%c_platform;
}
1; 1;
__END__ __END__
@@ -527,6 +401,18 @@ Returns the status of the chassis fan.
(C<snChasFanOperStatus.1>) (C<snChasFanOperStatus.1>)
=item $foundry->img_ver()
Returns device image version.
(C<snAgImgVer.0>)
=item $foundry->ch_serial()
Returns chassis serial number.
(C<snChasSerNum.0>)
=back =back
=head2 Global Methods imported from SNMP::Info::Layer3 =head2 Global Methods imported from SNMP::Info::Layer3
@@ -607,54 +493,6 @@ Returns reference to hash. Current Port Speed.
=back =back
=head2 Topology information
Based upon the software version devices may support Foundry Discovery
Protocol (FDP) and Link Layer Discovery Protocol (LLDP). These
methods will query both and return the combination of all information. As a
result, there may be identical topology information returned from the two
protocols causing duplicate entries. It is the calling program's
responsibility to identify any duplicate entries and remove duplicates if
necessary.
=over
=item $foundry->hasCDP()
Returns true if the device is running either FDP or LLDP.
=item $foundry->c_if()
Returns reference to hash. Key: iid Value: local device port (interfaces)
=item $foundry->c_ip()
Returns reference to hash. Key: iid Value: remote IPv4 address
If multiple entries exist with the same local port, c_if(), with the same IPv4
address, c_ip(), it may be a duplicate entry.
If multiple entries exist with the same local port, c_if(), with different
IPv4 addresses, c_ip(), there is either a non-FDP/LLDP device in between two
or more devices or multiple devices which are not directly connected.
Use the data from the Layer2 Topology Table below to dig deeper.
=item $foundry->c_port()
Returns reference to hash. Key: iid Value: remote port (interfaces)
=item $foundry->c_id()
Returns reference to hash. Key: iid Value: string value used to identify the
chassis component associated with the remote system.
=item $foundry->c_platform()
Returns reference to hash. Key: iid Value: Remote Device Type
=back
=head2 Table Methods imported from SNMP::Info::Layer3 =head2 Table Methods imported from SNMP::Info::Layer3
See documentation in L<SNMP::Info::Layer3/"TABLE METHODS"> for details. See documentation in L<SNMP::Info::Layer3/"TABLE METHODS"> for details.

View File

@@ -196,134 +196,6 @@ sub interfaces {
return $i_descr; return $i_descr;
} }
# Use FDP and/or LLDP
sub hasCDP {
my $hp9300 = shift;
return $hp9300->hasLLDP() || $hp9300->SUPER::hasCDP();
}
sub c_ip {
my $hp9300 = shift;
my $partial = shift;
my $cdp = $hp9300->SUPER::c_ip($partial) || {};
my $lldp = $hp9300->lldp_ip($partial) || {};
my %c_ip;
foreach my $iid ( keys %$cdp ) {
my $ip = $cdp->{$iid};
next unless defined $ip;
$c_ip{$iid} = $ip;
}
foreach my $iid ( keys %$lldp ) {
my $ip = $lldp->{$iid};
next unless defined $ip;
$c_ip{$iid} = $ip;
}
return \%c_ip;
}
sub c_if {
my $hp9300 = shift;
my $partial = shift;
my $lldp = $hp9300->lldp_if($partial) || {};
my $cdp = $hp9300->SUPER::c_if($partial) || {};
my %c_if;
foreach my $iid ( keys %$cdp ) {
my $if = $cdp->{$iid};
next unless defined $if;
$c_if{$iid} = $if;
}
foreach my $iid ( keys %$lldp ) {
my $if = $lldp->{$iid};
next unless defined $if;
$c_if{$iid} = $if;
}
return \%c_if;
}
sub c_port {
my $hp9300 = shift;
my $partial = shift;
my $lldp = $hp9300->lldp_port($partial) || {};
my $cdp = $hp9300->SUPER::c_port($partial) || {};
my %c_port;
foreach my $iid ( keys %$cdp ) {
my $port = $cdp->{$iid};
next unless defined $port;
$c_port{$iid} = $port;
}
foreach my $iid ( keys %$lldp ) {
my $port = $lldp->{$iid};
next unless defined $port;
$c_port{$iid} = $port;
}
return \%c_port;
}
sub c_id {
my $hp9300 = shift;
my $partial = shift;
my $lldp = $hp9300->lldp_id($partial) || {};
my $cdp = $hp9300->SUPER::c_id($partial) || {};
my %c_id;
foreach my $iid ( keys %$cdp ) {
my $id = $cdp->{$iid};
next unless defined $id;
$c_id{$iid} = $id;
}
foreach my $iid ( keys %$lldp ) {
my $id = $lldp->{$iid};
next unless defined $id;
$c_id{$iid} = $id;
}
return \%c_id;
}
sub c_platform {
my $hp9300 = shift;
my $partial = shift;
my $lldp = $hp9300->lldp_rem_sysdesc($partial) || {};
my $cdp = $hp9300->SUPER::c_platform($partial) || {};
my %c_platform;
foreach my $iid ( keys %$cdp ) {
my $platform = $cdp->{$iid};
next unless defined $platform;
$c_platform{$iid} = $platform;
}
foreach my $iid ( keys %$lldp ) {
my $platform = $lldp->{$iid};
next unless defined $platform;
$c_platform{$iid} = $platform;
}
return \%c_platform;
}
1; 1;
__END__ __END__
@@ -527,54 +399,6 @@ Returns reference to hash. Current Port Speed.
=back =back
=head2 Topology information
Based upon the software version devices may support Foundry Discovery
Protocol (FDP) and Link Layer Discovery Protocol (LLDP). These
methods will query both and return the combination of all information. As a
result, there may be identical topology information returned from the two
protocols causing duplicate entries. It is the calling program's
responsibility to identify any duplicate entries and remove duplicates
if necessary.
=over
=item $hp9300->hasCDP()
Returns true if the device is running either FDP or LLDP.
=item $hp9300->c_if()
Returns reference to hash. Key: iid Value: local device port (interfaces)
=item $hp9300->c_ip()
Returns reference to hash. Key: iid Value: remote IPv4 address
If multiple entries exist with the same local port, c_if(), with the same IPv4
address, c_ip(), it may be a duplicate entry.
If multiple entries exist with the same local port, c_if(), with different
IPv4 addresses, c_ip(), there is either a non-FDP/LLDP device in between two
or more devices or multiple devices which are not directly connected.
Use the data from the Layer2 Topology Table below to dig deeper.
=item $hp9300->c_port()
Returns reference to hash. Key: iid Value: remote port (interfaces)
=item $hp9300->c_id()
Returns reference to hash. Key: iid Value: string value used to identify the
chassis component associated with the remote system.
=item $hp9300->c_platform()
Returns reference to hash. Key: iid Value: Remote Device Type
=back
=head2 Table Methods imported from SNMP::Info::Layer3 =head2 Table Methods imported from SNMP::Info::Layer3
See documentation in L<SNMP::Info::Layer3/"TABLE METHODS"> for details. See documentation in L<SNMP::Info::Layer3/"TABLE METHODS"> for details.

View File

@@ -55,6 +55,7 @@ $VERSION = '2.09';
%SNMP::Info::LLDP::GLOBALS, %SNMP::Info::LLDP::GLOBALS,
'serial' => 'jnxBoxSerialNo.0', 'serial' => 'jnxBoxSerialNo.0',
'mac' => 'dot1dBaseBridgeAddress', 'mac' => 'dot1dBaseBridgeAddress',
'box_descr' => 'jnxBoxDescr'
); );
%FUNCS = ( %SNMP::Info::Layer3::FUNCS, %FUNCS = ( %SNMP::Info::Layer3::FUNCS,
@@ -248,49 +249,6 @@ sub fw_port {
return $juniper->qb_fw_port($partial); return $juniper->qb_fw_port($partial);
} }
# Use LLDP
sub hasCDP {
my $juniper = shift;
return $juniper->hasLLDP();
}
sub c_ip {
my $juniper = shift;
my $partial = shift;
return $juniper->lldp_ip($partial);
}
sub c_if {
my $juniper = shift;
my $partial = shift;
return $juniper->lldp_if($partial);
}
sub c_port {
my $juniper = shift;
my $partial = shift;
return $juniper->lldp_port($partial);
}
sub c_id {
my $juniper = shift;
my $partial = shift;
return $juniper->lldp_id($partial);
}
sub c_platform {
my $juniper = shift;
my $partial = shift;
return $juniper->lldp_rem_sysdesc($partial);
}
# Pseudo ENTITY-MIB methods # Pseudo ENTITY-MIB methods
# This class supports both virtual chassis (stackable) and physical chassis # This class supports both virtual chassis (stackable) and physical chassis
@@ -406,7 +364,7 @@ sub e_descr {
my $juniper = shift; my $juniper = shift;
my $e_index = $juniper->e_index() || {}; my $e_index = $juniper->e_index() || {};
my $box_descr = $juniper->jnxBoxDescr || 0; my $box_descr = $juniper->box_descr;
my $contents = $juniper->jnxContentsDescr() || {}; my $contents = $juniper->jnxContentsDescr() || {};
my $containers = $juniper->jnxContainersDescr() || {}; my $containers = $juniper->jnxContainersDescr() || {};
@@ -663,16 +621,18 @@ Returns serial number
(C<jnxBoxSerialNo.0>) (C<jnxBoxSerialNo.0>)
=item $juniper->serial() =item $juniper->mac()
Returns the MAC address used by this bridge when it must be referred Returns the MAC address used by this bridge when it must be referred
to in a unique fashion. to in a unique fashion.
(C<dot1dBaseBridgeAddress>) (C<dot1dBaseBridgeAddress>)
=item $juniper->hasCDP() =item $juniper->box_descr()
Returns whether LLDP is enabled. The name, model, or detailed description of the device.
(C<jnxBoxDescr.0>)
=back =back
@@ -718,35 +678,6 @@ IDs. These are the VLANs which are members of the egress list for the port.
=back =back
=head2 Topology information
These methods return Link Layer Discovery Protocol (LLDP) information. See
documentation in L<SNMP::Info::LLDP/"TABLE METHODS"> for details.
=over
=item $juniper->c_id()
Returns C<lldp_id>
=item $juniper->c_if()
Returns C<lldp_if>
=item $juniper->c_ip()
Returns C<lldp_ip>
=item $juniper->c_platform()
Returns C<lldp_rem_sysdesc>
=item $juniper->c_port()
Returns C<lldp_port>
=back
=head2 Forwarding Table (C<dot1dTpFdbEntry>) =head2 Forwarding Table (C<dot1dTpFdbEntry>)
=over =over

View File

@@ -130,42 +130,6 @@ sub i_ignore {
return \%i_ignore; return \%i_ignore;
} }
# Use LLDP
sub hasCDP {
my $netsnmp = shift;
return $netsnmp->hasLLDP();
}
sub c_ip {
my $netsnmp = shift;
my $partial = shift;
return $netsnmp->lldp_ip($partial);
}
sub c_if {
my $netsnmp = shift;
my $partial = shift;
return $netsnmp->lldp_if($partial);
}
sub c_port {
my $netsnmp = shift;
my $partial = shift;
return $netsnmp->lldp_port($partial);
}
sub c_id {
my $netsnmp = shift;
my $partial = shift;
return $netsnmp->lldp_id($partial);
}
sub c_platform {
my $netsnmp = shift;
my $partial = shift;
return $netsnmp->lldp_rem_sysdesc($partial);
}
1; 1;
__END__ __END__
@@ -278,46 +242,6 @@ Ignores loopback
=back =back
=head2 Topology information
Link Layer Discovery Protocol (LLDP) support. The device must be running
an optional LLDP agent, such as lldpd, which can integrate with the SNMP agent.
=over
=item $netsnmp->hasCDP()
Returns true if the device is running LLDP.
=item $netsnmp->c_if()
Returns reference to hash. Key: iid Value: local device port (interfaces)
=item $netsnmp->c_ip()
Returns reference to hash. Key: iid Value: remote IPv4 address
If multiple entries exist with the same local port, c_if(), with different
IPv4 addresses, c_ip(), there is either a non-LLDP device in between two
or more devices or multiple devices which are not directly connected.
Use the data from the Layer2 Topology Table below to dig deeper.
=item $netsnmp->c_port()
Returns reference to hash. Key: iid Value: remote port (interfaces)
=item $netsnmp->c_id()
Returns reference to hash. Key: iid Value: string value used to identify the
chassis component associated with the remote system.
=item $netsnmp->c_platform()
Returns reference to hash. Key: iid Value: Remote Device Type
=back
=head2 Table Methods imported from SNMP::Info::Layer3 =head2 Table Methods imported from SNMP::Info::Layer3
See documentation in L<SNMP::Info::Layer3> for details. See documentation in L<SNMP::Info::Layer3> for details.

View File

@@ -174,132 +174,6 @@ sub model {
return $model; return $model;
} }
# Use CDP and/or LLDP
sub hasCDP {
my $nexus = shift;
return $nexus->hasLLDP() || $nexus->SUPER::hasCDP();
}
sub c_ip {
my $nexus = shift;
my $partial = shift;
my $cdp = $nexus->SUPER::c_ip($partial) || {};
my $lldp = $nexus->lldp_ip($partial) || {};
my %c_ip;
foreach my $iid ( keys %$cdp ) {
my $ip = $cdp->{$iid};
next unless defined $ip;
$c_ip{$iid} = $ip;
}
foreach my $iid ( keys %$lldp ) {
my $ip = $lldp->{$iid};
next unless defined $ip;
$c_ip{$iid} = $ip;
}
return \%c_ip;
}
sub c_if {
my $nexus = shift;
my $partial = shift;
my $lldp = $nexus->lldp_if($partial) || {};
my $cdp = $nexus->SUPER::c_if($partial) || {};
my %c_if;
foreach my $iid ( keys %$cdp ) {
my $if = $cdp->{$iid};
next unless defined $if;
$c_if{$iid} = $if;
}
foreach my $iid ( keys %$lldp ) {
my $if = $lldp->{$iid};
next unless defined $if;
$c_if{$iid} = $if;
}
return \%c_if;
}
sub c_port {
my $nexus = shift;
my $partial = shift;
my $lldp = $nexus->lldp_port($partial) || {};
my $cdp = $nexus->SUPER::c_port($partial) || {};
my %c_port;
foreach my $iid ( keys %$cdp ) {
my $port = $cdp->{$iid};
next unless defined $port;
$c_port{$iid} = $port;
}
foreach my $iid ( keys %$lldp ) {
my $port = $lldp->{$iid};
next unless defined $port;
$c_port{$iid} = $port;
}
return \%c_port;
}
sub c_id {
my $nexus = shift;
my $partial = shift;
my $lldp = $nexus->lldp_id($partial) || {};
my $cdp = $nexus->SUPER::c_id($partial) || {};
my %c_id;
foreach my $iid ( keys %$cdp ) {
my $id = $cdp->{$iid};
next unless defined $id;
$c_id{$iid} = $id;
}
foreach my $iid ( keys %$lldp ) {
my $id = $lldp->{$iid};
next unless defined $id;
$c_id{$iid} = $id;
}
return \%c_id;
}
sub c_platform {
my $nexus = shift;
my $partial = shift;
my $lldp = $nexus->lldp_rem_sysdesc($partial) || {};
my $cdp = $nexus->SUPER::c_platform($partial) || {};
my %c_platform;
foreach my $iid ( keys %$cdp ) {
my $platform = $cdp->{$iid};
next unless defined $platform;
$c_platform{$iid} = $platform;
}
foreach my $iid ( keys %$lldp ) {
my $platform = $lldp->{$iid};
next unless defined $platform;
$c_platform{$iid} = $platform;
}
return \%c_platform;
}
1; 1;
__END__ __END__
@@ -473,53 +347,6 @@ See documentation in L<SNMP::Info::LLDP/"GLOBALS"> for details.
These are methods that return tables of information in the form of a reference These are methods that return tables of information in the form of a reference
to a hash. to a hash.
=head2 Topology information
Based upon the firmware version Cisco devices may support Link Layer Discover
Protocol (LLDP) in addition to the Cisco-proprietary CDP. These methods
will query both and return the combination of all information. As a result,
there may be identical topology information returned from the two protocols
causing duplicate entries. It is the calling program's responsibility to
identify any duplicate entries and remove duplicates if necessary.
=over
=item $nexus->hasCDP()
Returns true if the device is running either CDP or LLDP.
=item $nexus->c_if()
Returns reference to hash. Key: iid Value: local device port (interfaces)
=item $nexus->c_ip()
Returns reference to hash. Key: iid Value: remote IPv4 address
If multiple entries exist with the same local port, c_if(), with the same IPv4
address, c_ip(), it may be a duplicate entry.
If multiple entries exist with the same local port, c_if(), with different
IPv4 addresses, c_ip(), there is either a non-CDP/LLDP device in between two
or more devices or multiple devices which are not directly connected.
Use the data from the Layer2 Topology Table below to dig deeper.
=item $nexus->c_port()
Returns reference to hash. Key: iid Value: remote port (interfaces)
=item $nexus->c_id()
Returns reference to hash. Key: iid Value: string value used to identify the
chassis component associated with the remote system.
=item $nexus->c_platform()
Returns reference to hash. Key: iid Value: Remote Device Type
=back
=head2 Table Methods imported from SNMP::Info::Layer3 =head2 Table Methods imported from SNMP::Info::Layer3
See documentation in L<SNMP::Info::Layer3/"TABLE METHODS"> for details. See documentation in L<SNMP::Info::Layer3/"TABLE METHODS"> for details.

View File

@@ -1,7 +1,6 @@
# SNMP::Info::Layer3::Passport # SNMP::Info::Layer3::Passport
# $Id$
# #
# Copyright (c) 2008 Eric Miller # Copyright (c) 2012 Eric Miller
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@@ -30,6 +29,7 @@
package SNMP::Info::Layer3::Passport; package SNMP::Info::Layer3::Passport;
use warnings;
use strict; use strict;
use Exporter; use Exporter;
use SNMP::Info::SONMP; use SNMP::Info::SONMP;
@@ -80,7 +80,7 @@ sub model {
return $id unless defined $model; return $id unless defined $model;
$model =~ s/^rcA//i; $model =~ s/^rc(A)?//i;
return $model; return $model;
} }
@@ -126,9 +126,9 @@ sub i_index {
# Get VLAN Virtual Router Interfaces # Get VLAN Virtual Router Interfaces
if (!defined $partial if (!defined $partial
or (defined $model || (defined $model
and ( ( $partial > 2000 and $model =~ /(86|83|81|16)/ ) && ( ( $partial > 2000 && $model =~ /(86|83|81|16|VSP)/ )
or ( $partial > 256 and $model =~ /(105|11[05]0|12[05])/ ) ) || ( $partial > 256 && $model =~ /(105|11[05]0|12[05])/ ) )
) )
) )
{ {
@@ -182,9 +182,9 @@ sub interfaces {
my $vlan_id = {}; my $vlan_id = {};
if (!defined $partial if (!defined $partial
or (defined $model || (defined $model
and ( ( $partial > 2000 and $model =~ /(86|83|81|16)/ ) && ( ( $partial > 2000 && $model =~ /(86|83|81|16|VSP)/ )
or ( $partial > 256 and $model =~ /(105|11[05]0|12[05])/ ) ) || ( $partial > 256 && $model =~ /(105|11[05]0|12[05])/ ) )
) )
) )
{ {
@@ -214,7 +214,7 @@ sub interfaces {
$if{$index} = 'Cpu.6'; $if{$index} = 'Cpu.6';
} }
elsif (( $index > 2000 and $model =~ /(86|83|81|16)/ ) elsif (( $index > 2000 and $model =~ /(86|83|81|16|VSP)/ )
or ( $index > 256 and $model =~ /(105|11[05]0|12[05])/ ) ) or ( $index > 256 and $model =~ /(105|11[05]0|12[05])/ ) )
{ {
@@ -255,9 +255,9 @@ sub i_mac {
# Get VLAN Virtual Router Interfaces # Get VLAN Virtual Router Interfaces
if (!defined $partial if (!defined $partial
or (defined $model || (defined $model
and ( ( $partial > 2000 and $model =~ /(86|83|81|16)/ ) && ( ( $partial > 2000 && $model =~ /(86|83|81|16|VSP)/ )
or ( $partial > 256 and $model =~ /(105|11[05]0|12[05])/ ) ) || ( $partial > 256 && $model =~ /(105|11[05]0|12[05])/ ) )
) )
) )
{ {
@@ -329,9 +329,9 @@ sub i_description {
# Get VLAN Virtual Router Interfaces # Get VLAN Virtual Router Interfaces
if (!defined $partial if (!defined $partial
or (defined $model || (defined $model
and ( ( $partial > 2000 and $model =~ /(86|83|81|16)/ ) && ( ( $partial > 2000 && $model =~ /(86|83|81|16|VSP)/ )
or ( $partial > 256 and $model =~ /(105|11[05]0|12[05])/ ) ) || ( $partial > 256 && $model =~ /(105|11[05]0|12[05])/ ) )
) )
) )
{ {
@@ -365,9 +365,9 @@ sub i_name {
my %reverse_vlan; my %reverse_vlan;
if (!defined $partial if (!defined $partial
or (defined $model || (defined $model
and ( ( $partial > 2000 and $model =~ /(86|83|81|16)/ ) && ( ( $partial > 2000 && $model =~ /(86|83|81|16|VSP)/ )
or ( $partial > 256 and $model =~ /(105|11[05]0|12[05])/ ) ) || ( $partial > 256 && $model =~ /(105|11[05]0|12[05])/ ) )
) )
) )
{ {
@@ -402,8 +402,8 @@ sub i_name {
and $model =~ /(105|11[05]0|12[05])/ ) and $model =~ /(105|11[05]0|12[05])/ )
) )
{ {
my $vlan_index = $reverse_vlan{$iid}; my $vlan_idx = $reverse_vlan{$iid};
my $vlan_name = $v_name->{$vlan_index}; my $vlan_name = $v_name->{$vlan_idx};
next unless defined $vlan_name; next unless defined $vlan_name;
$i_name{$iid} = $vlan_name; $i_name{$iid} = $vlan_name;
@@ -510,7 +510,7 @@ sub root_ip {
my $sonmp_topo_ip = $passport->sonmp_topo_ip(); my $sonmp_topo_ip = $passport->sonmp_topo_ip();
# Only 8600 and 1600 have CLIP or Management Virtual IP # Only 8600 and 1600 have CLIP or Management Virtual IP
if ( defined $model and $model =~ /(86|16)/ ) { if ( defined $model and $model =~ /(86|16|VSP)/ ) {
# Return CLIP (CircuitLess IP) # Return CLIP (CircuitLess IP)
foreach my $iid ( keys %$rc_ip_type ) { foreach my $iid ( keys %$rc_ip_type ) {
@@ -683,7 +683,7 @@ sub e_descr {
my $model = $passport->model(); my $model = $passport->model();
my $rc_ps = $passport->rc_ps_detail() || {}; my $rc_ps = $passport->rc_ps_detail() || {};
my $rc_ch = $passport->rcChasType(); my $rc_ch = $passport->chassis();
$rc_ch =~ s/a//; $rc_ch =~ s/a//;
my %rc_e_descr; my %rc_e_descr;
@@ -752,7 +752,7 @@ sub e_type {
my $model = $passport->model(); my $model = $passport->model();
my $rc_ps = $passport->rc_ps_type() || {}; my $rc_ps = $passport->rc_ps_type() || {};
my $rc_ch = $passport->rcChasType(); my $rc_ch = $passport->chassis();
my %rc_e_type; my %rc_e_type;

View File

@@ -118,42 +118,6 @@ sub os_ver {
return $os_ver; return $os_ver;
} }
# Use LLDP
sub hasCDP {
my $pf = shift;
return $pf->hasLLDP();
}
sub c_ip {
my $pf = shift;
my $partial = shift;
return $pf->lldp_ip($partial);
}
sub c_if {
my $pf = shift;
my $partial = shift;
return $pf->lldp_if($partial);
}
sub c_port {
my $pf = shift;
my $partial = shift;
return $pf->lldp_port($partial);
}
sub c_id {
my $pf = shift;
my $partial = shift;
return $pf->lldp_id($partial);
}
sub c_platform {
my $pf = shift;
my $partial = shift;
return $pf->lldp_rem_sysdesc($partial);
}
1; 1;
__END__ __END__
@@ -230,10 +194,6 @@ These are methods that return scalar values from SNMP
Returns 'FreeBSD' Returns 'FreeBSD'
=item $pf->hasCDP()
Returns whether LLDP is enabled.
=item $pf->model() =item $pf->model()
Grabs the os version from C<sysDescr> Grabs the os version from C<sysDescr>
@@ -259,30 +219,6 @@ See documentation in L<SNMP::Info::Layer3/"GLOBALS"> for details.
These are methods that return tables of information in the form of a reference These are methods that return tables of information in the form of a reference
to a hash. to a hash.
=over
=item $pf->c_id()
Returns LLDP information.
=item $pf->c_if()
Returns LLDP information.
=item $pf->c_ip()
Returns LLDP information.
=item $pf->c_platform()
Returns LLDP information.
=item $pf->c_port()
Returns LLDP information.
=back
=head2 Table Methods imported from SNMP::Info::Layer3 =head2 Table Methods imported from SNMP::Info::Layer3
See documentation in L<SNMP::Info::Layer3/"TABLE METHODS"> for details. See documentation in L<SNMP::Info::Layer3/"TABLE METHODS"> for details.

View File

@@ -59,6 +59,10 @@ $VERSION = '2.09';
'ps1_status' => 'nnenvPwrsupStatus.1', 'ps1_status' => 'nnenvPwrsupStatus.1',
'ps2_type' => 'nnenvPwrsupType.2', 'ps2_type' => 'nnenvPwrsupType.2',
'ps2_status' => 'nnenvPwrsupStatus.2', 'ps2_status' => 'nnenvPwrsupStatus.2',
'nn_sys_ver' => 'nnsysVersion',
'nn_ch_model' => 'nnchassisModel',
'nn_ch_op_stat' => 'nnchassisOperStatus',
'nn_ch_serial' => 'nnchassisSerialNumber',
); );
%FUNCS = ( %FUNCS = (
@@ -87,7 +91,7 @@ sub os {
sub os_ver { sub os_ver {
my $tasman = shift; my $tasman = shift;
my $version = $tasman->nnsysVersion() || ""; my $version = $tasman->nn_sys_ver() || "";
my $descr = $tasman->description() || ""; my $descr = $tasman->description() || "";
# Newer versions # Newer versions
@@ -102,7 +106,7 @@ sub model {
my $tasman = shift; my $tasman = shift;
my $id = $tasman->id(); my $id = $tasman->id();
my $ch_model = $tasman->nnchassisModel(); my $ch_model = $tasman->nn_ch_model();
return $ch_model if $ch_model; return $ch_model if $ch_model;
@@ -118,12 +122,12 @@ sub serial {
# Newer versions of the software redefined the MIB in a non-backwards # Newer versions of the software redefined the MIB in a non-backwards
# compatible manner. Try the old OID first. # compatible manner. Try the old OID first.
my $serial = $tasman->nnchassisOperStatus(); my $serial = $tasman->nn_ch_op_stat();
# Newer versions populate status, serial should contain some numbers # Newer versions populate status, serial should contain some numbers
return $serial if ($serial !~ /^\D+$/); return $serial if ($serial !~ /^\D+$/);
# Unfortunately newer versions don't seem to populate the newer OID. # Unfortunately newer versions don't seem to populate the newer OID.
return $tasman->nnchassisSerialNumber(); return $tasman->nn_ch_serial();
} }
1; 1;
@@ -228,6 +232,22 @@ Grabs the os version from C<nnsysVersion>
(C<nnenvPwrsupStatus.2>) (C<nnenvPwrsupStatus.2>)
=item $tasman->nn_sys_ver()
(C<nnsysVersion.0>)
=item $tasman->nn_ch_model()
(C<nnchassisModel.0>)
=item $tasman->nn_ch_op_stat()
(C<nnchassisOperStatus.0>)
=item $tasman->nn_ch_serial()
(C<nnchassisSerialNumber.0>)
=item $tasman->serial() =item $tasman->serial()
Tries both (C<nnchassisOperStatus>) and (C<nnchassisSerialNumber>) as OID's Tries both (C<nnchassisOperStatus>) and (C<nnchassisSerialNumber>) as OID's

View File

@@ -1,7 +1,6 @@
# SNMP::Info::SONMP # SNMP::Info::SONMP
# $Id$
# #
# Copyright (c) 2008 Eric Miller # Copyright (c) 2012 Eric Miller
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
@@ -30,6 +29,7 @@
package SNMP::Info::SONMP; package SNMP::Info::SONMP;
use warnings;
use strict; use strict;
use Exporter; use Exporter;
use SNMP::Info; use SNMP::Info;
@@ -47,8 +47,8 @@ $VERSION = '2.09';
); );
%GLOBALS = ( %GLOBALS = (
'cdp_id' => 's5EnMsTopIpAddr', 'sonmp_gid' => 's5EnMsTopIpAddr',
'cdp_run' => 's5EnMsTopStatus', 'sonmp_run' => 's5EnMsTopStatus',
); );
%FUNCS = ( %FUNCS = (
@@ -77,12 +77,14 @@ sub port_offset {
return 0; return 0;
} }
sub hasCDP { sub hasSONMP {
my $sonmp = shift; my $sonmp = shift;
return $sonmp->cdp_run();
return 1 if defined $sonmp->sonmp_run();
return;
} }
sub c_if { sub sonmp_if {
my $sonmp = shift; my $sonmp = shift;
my $partial = shift; my $partial = shift;
@@ -93,7 +95,7 @@ sub c_if {
my $port_offset = $sonmp->port_offset(); my $port_offset = $sonmp->port_offset();
my $model = $sonmp->model(); my $model = $sonmp->model();
my %c_if; my %sonmp_if;
foreach my $entry ( keys %$sonmp_topo_port ) { foreach my $entry ( keys %$sonmp_topo_port ) {
my $port = $sonmp_topo_port->{$entry}; my $port = $sonmp_topo_port->{$entry};
next unless defined $port; next unless defined $port;
@@ -118,31 +120,31 @@ sub c_if {
my $index = ( ( $slot - $slot_offset ) * $index_factor ) my $index = ( ( $slot - $slot_offset ) * $index_factor )
+ ( $port - $port_offset ); + ( $port - $port_offset );
$c_if{$entry} = $index; $sonmp_if{$entry} = $index;
} }
return \%c_if; return \%sonmp_if;
} }
sub c_ip { sub sonmp_ip {
my $sonmp = shift; my $sonmp = shift;
my $partial = shift; my $partial = shift;
my $sonmp_topo_port = $sonmp->sonmp_topo_port($partial) || {}; my $sonmp_topo_port = $sonmp->sonmp_topo_port($partial) || {};
my $sonmp_topo_ip = $sonmp->sonmp_topo_ip($partial) || {}; my $sonmp_topo_ip = $sonmp->sonmp_topo_ip($partial) || {};
my %c_ip; my %sonmp_ip;
foreach my $entry ( keys %$sonmp_topo_ip ) { foreach my $entry ( keys %$sonmp_topo_ip ) {
my $port = $sonmp_topo_port->{$entry}; my $port = $sonmp_topo_port->{$entry};
next unless defined $port; next unless defined $port;
next if $port == 0; next if $port == 0;
my $ip = $sonmp_topo_ip->{$entry}; my $ip = $sonmp_topo_ip->{$entry};
$c_ip{$entry} = $ip; $sonmp_ip{$entry} = $ip;
} }
return \%c_ip; return \%sonmp_ip;
} }
sub c_port { sub sonmp_port {
my $sonmp = shift; my $sonmp = shift;
my $partial = shift; my $partial = shift;
@@ -150,7 +152,7 @@ sub c_port {
my $sonmp_topo_seg = $sonmp->sonmp_topo_seg($partial) || {}; my $sonmp_topo_seg = $sonmp->sonmp_topo_seg($partial) || {};
my $sonmp_topo_platform = $sonmp->sonmp_topo_platform($partial) || {}; my $sonmp_topo_platform = $sonmp->sonmp_topo_platform($partial) || {};
my %c_port; my %sonmp_port;
foreach my $entry ( keys %$sonmp_topo_seg ) { foreach my $entry ( keys %$sonmp_topo_seg ) {
my $port = $sonmp_topo_port->{$entry}; my $port = $sonmp_topo_port->{$entry};
next unless defined $port; next unless defined $port;
@@ -161,12 +163,12 @@ sub c_port {
# AP-222x Series does not adhere to port numbering # AP-222x Series does not adhere to port numbering
if ( $platform =~ /AccessPoint/i ) { if ( $platform =~ /AccessPoint/i ) {
$c_port{$entry} = 'dp0'; $sonmp_port{$entry} = 'dp0';
} }
# BayHubs send the lower three bytes of the MAC not the slot/port # BayHubs send the lower three bytes of the MAC not the slot/port
elsif ( $seg > 4000 ) { elsif ( $seg > 4000 ) {
$c_port{$entry} = 'unknown'; $sonmp_port{$entry} = 'unknown';
} }
else { else {
@@ -174,20 +176,20 @@ sub c_port {
my $remote_port = $seg % 256; my $remote_port = $seg % 256;
my $remote_slot = int( $seg / 256 ); my $remote_slot = int( $seg / 256 );
$c_port{$entry} = "$remote_slot.$remote_port"; $sonmp_port{$entry} = "$remote_slot.$remote_port";
} }
} }
return \%c_port; return \%sonmp_port;
} }
sub c_platform { sub sonmp_platform {
my $sonmp = shift; my $sonmp = shift;
my $partial = shift; my $partial = shift;
my $sonmp_topo_port = $sonmp->sonmp_topo_port($partial) || {}; my $sonmp_topo_port = $sonmp->sonmp_topo_port($partial) || {};
my $sonmp_topo_platform = $sonmp->sonmp_topo_platform($partial) || {}; my $sonmp_topo_platform = $sonmp->sonmp_topo_platform($partial) || {};
my %c_platform; my %sonmp_platform;
foreach my $entry ( keys %$sonmp_topo_platform ) { foreach my $entry ( keys %$sonmp_topo_platform ) {
my $port = $sonmp_topo_port->{$entry}; my $port = $sonmp_topo_port->{$entry};
next unless defined $port; next unless defined $port;
@@ -195,9 +197,9 @@ sub c_platform {
my $platform = $sonmp_topo_platform->{$entry}; my $platform = $sonmp_topo_platform->{$entry};
$c_platform{$entry} = $platform; $sonmp_platform{$entry} = $platform;
} }
return \%c_platform; return \%sonmp_platform;
} }
sub mac { sub mac {
@@ -242,19 +244,19 @@ Eric Miller
my $class = $sonmp->class(); my $class = $sonmp->class();
print " Using device sub class : $class\n"; print " Using device sub class : $class\n";
$hascdp = $sonmp->hasCDP() ? 'yes' : 'no'; $hassonmp = $sonmp->hasSONMP() ? 'yes' : 'no';
# Print out a map of device ports with CDP neighbors: # Print out a map of device ports with CDP neighbors:
my $interfaces = $sonmp->interfaces(); my $interfaces = $sonmp->interfaces();
my $c_if = $sonmp->c_if(); my $sonmp_if = $sonmp->sonmp_if();
my $c_ip = $sonmp->c_ip(); my $sonmp_ip = $sonmp->sonmp_ip();
my $c_port = $sonmp->c_port(); my $sonmp_port = $sonmp->sonmp_port();
foreach my $cdp_key (keys %$c_ip){ foreach my $sonmp_key (keys %$sonmp_ip){
my $iid = $c_if->{$cdp_key}; my $iid = $sonmp_if->{$sonmp_key};
my $port = $interfaces->{$iid}; my $port = $interfaces->{$iid};
my $neighbor = $c_ip->{$cdp_key}; my $neighbor = $sonmp_ip->{$sonmp_key};
my $neighbor_port = $c_port->{$cdp_key}; my $neighbor_port = $sonmp_port->{$sonmp_key};
print "Port : $port connected to $neighbor / $neighbor_port\n"; print "Port : $port connected to $neighbor / $neighbor_port\n";
} }
@@ -266,8 +268,8 @@ through SNMP.
SONMP is a Layer 2 protocol that supplies topology information of devices that SONMP is a Layer 2 protocol that supplies topology information of devices that
also speak SONMP, mostly switches and hubs. SONMP is implemented in also speak SONMP, mostly switches and hubs. SONMP is implemented in
SynOptics, Bay, and Nortel devices. SONMP has been rebranded by Bay then SynOptics, Bay, Nortel, and Avaya devices. SONMP has been rebranded by Bay
Nortel and is know by several different names, most recently Nortel then Nortel and may be referred to by several different names, including Nortel
Discovery Protocol (NDP). Discovery Protocol (NDP).
Create or use a device subclass that inherits this class. Do not use Create or use a device subclass that inherits this class. Do not use
@@ -309,17 +311,17 @@ Returns the offset if slot numbering does not start at 0. Defaults to 1.
Returns the offset if port numbering does not start at 0. Defaults to 0. Returns the offset if port numbering does not start at 0. Defaults to 0.
=item $cdp->hasCDP() =item $sonmp->hasSONMP()
Is SONMP is active in this device? Is SONMP is active in this device?
=item $sonmp->cdp_id() =item $sonmp->sonmp_gid()
Returns the IP that the device is sending out for its Nmm topology info. Returns the IP that the device is sending out for its Nmm topology info.
(C<s5EnMsTopIpAddr>) (C<s5EnMsTopIpAddr>)
=item $sonmp->cdp_run() =item $sonmp->sonmp_run()
Returns true if SONMP is on for this device. Returns true if SONMP is on for this device.
@@ -386,31 +388,31 @@ bay_topo_seg() is local.
=back =back
=head2 Pseudo CDP information =head2 Common topology information
All entries with port=0 are local and ignored. All entries with port=0 are local and ignored.
=over =over
=item $sonmp->c_if() =item $sonmp->sonmp_if()
Returns reference to hash. Key: IID, Value: Local port (interfaces) Returns reference to hash. Key: IID, Value: Local port (interfaces)
=item $sonmp->c_ip() =item $sonmp->sonmp_ip()
Returns reference to hash. Key: IID, Value: Remote IP address Returns reference to hash. Key: IID, Value: Remote IP address
If multiple entries exist with the same local port, c_if(), with different If multiple entries exist with the same local port, sonmp_if(), with different
IPv4 addresses, c_ip(), there is either a non SONMP device in between two or IPv4 addresses, sonmp_ip(), there is either a non SONMP device in between two or
more devices or multiple devices which are not directly connected. more devices or multiple devices which are not directly connected.
Use the data from the Layer2 Topology Table below to dig deeper. Use the data from the Layer2 Topology Table below to dig deeper.
=item $sonmp->c_port() =item $sonmp->sonmp_port()
Returns reference to hash. Key: IID, Value: Remote port (interfaces) Returns reference to hash. Key: IID, Value: Remote port (interfaces)
=item $sonmp->c_platform() =item $sonmp->sonmp_platform()
Returns reference to hash. Key: IID, Value: Remote device type Returns reference to hash. Key: IID, Value: Remote device type