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.
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)
[NEW FEATURES]

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

View File

@@ -47,13 +47,6 @@ $VERSION = '2.09';
%MIBS = ( 'FOUNDRY-SN-SWITCH-GROUP-MIB' => 'snFdpGlobalRun' );
%GLOBALS = (
# CDP-Compatibility
'cdp_interval' => 'snFdpGlobalMessageInterval',
'cdp_holdtime' => 'snFdpGlobalHoldTime',
'cdp_id' => 'snFdpGlobalDeviceId',
#
'fdp_run' => 'snFdpGlobalRun',
'fdp_interval' => 'snFdpGlobalMessageInterval',
'fdp_holdtime' => 'snFdpGlobalHoldTime',
@@ -61,27 +54,27 @@ $VERSION = '2.09';
);
%FUNCS = (
'c_index' => 'snFdpCacheIfIndex',
'c_proto' => 'snFdpCacheAddressType',
'c_ip' => 'snFdpCacheAddress',
'c_ver' => 'snFdpCacheVersion',
'c_id' => 'snFdpCacheDeviceId',
'c_port' => 'snFdpCacheDevicePort',
'c_platform' => 'snFdpCachePlatform',
'c_capabilities' => 'snFdpCacheCapabilities',
'c_domain' => 'snFdpCacheVTPMgmtDomain',
'c_vlan' => 'snFdpCacheNativeVLAN',
'c_duplex' => 'snFdpCacheDuplex',
'fdp_index' => 'snFdpCacheIfIndex',
'fdp_proto' => 'snFdpCacheAddressType',
'fdp_ip' => 'snFdpCacheAddress',
'fdp_ver' => 'snFdpCacheVersion',
'fdp_id' => 'snFdpCacheDeviceId',
'fdp_port' => 'snFdpCacheDevicePort',
'fdp_platform' => 'snFdpCachePlatform',
'fdp_capabilities' => 'snFdpCacheCapabilities',
'fdp_domain' => 'snFdpCacheVTPMgmtDomain',
'fdp_vlan' => 'snFdpCacheNativeVLAN',
'fdp_duplex' => 'snFdpCacheDuplex',
);
%MUNGE = (
'c_capabilities' => \&SNMP::Info::munge_caps,
'c_ip' => \&SNMP::Info::munge_ip
'fdp_capabilities' => \&SNMP::Info::munge_caps,
'fdp_ip' => \&SNMP::Info::munge_ip
);
sub cdp_run {
sub fdp_run {
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
return $fdp_run if defined $fdp_run;
@@ -107,7 +100,7 @@ sub hasFDP {
return $fdp->fdp_run();
}
sub c_if {
sub fdp_if {
my $fdp = shift;
# See if by some miracle Cisco implemented the fdpCacheIfIndex entry
@@ -115,7 +108,7 @@ sub c_if {
return $fdp_index if defined $fdp_index;
# 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 ) {
$fdp->error_throw(
"SNMP::Info::FDP:fdp_if() - Device doesn't have fdp_ip() data. Can't fake fdp_index()"
@@ -256,19 +249,19 @@ CDP compatibility
=over
=item $fdp->c_interval()
=item $fdp->fdp_interval()
Interval in seconds at which FDP messages are generated.
(C<fdpGlobalMessageInterval>)
=item $fdp->c_holdtime()
=item $fdp->fdp_holdtime()
Time in seconds that FDP messages are kept.
(C<fdpGlobalHoldTime>)
=item $fdp->c_id()
=item $fdp->fdp_id()
Returns FDP device ID.
@@ -277,7 +270,7 @@ retrieved from remote devices with $fdp->id().
(C<fdpGlobalDeviceId>)
=item $cdp->cdp_run()
=item $fdp->fdp_run()
Is FDP enabled on this device?
@@ -294,7 +287,7 @@ CDP compatibility
=over
=item $fdp->c_capabilities()
=item $fdp->fdp_capabilities()
Returns Device Functional Capabilities. Results are munged into an ascii
binary string, 7 digits long, MSB. Each digit represents a bit from the
@@ -333,26 +326,26 @@ this information.
(C<fdpCacheCapabilities>)
=item $fdp->c_domain()
=item $fdp->fdp_domain()
The CDP version of this returns remote VTP Management Domain as defined
in C<CISCO-VTP-MIB::managementDomainName>
(C<fdpCacheVTPMgmtDomain>)
=item $fdp->c_duplex()
=item $fdp->fdp_duplex()
Returns the port duplex status from remote devices.
(C<fdpCacheDuplex>)
=item $fdp->c_id()
=item $fdp->fdp_id()
Returns remote device id string
(C<fdpCacheDeviceId>)
=item $fdp->c_if()
=item $fdp->fdp_if()
Returns the mapping to the SNMP Interface Table.
@@ -380,7 +373,7 @@ truncate the last number off of it :
return \%fdp_if;
=item $fdp->c_index()
=item $fdp->fdp_index()
Returns the mapping to the SNMP2 Interface table for FDP Cache Entries.
@@ -391,37 +384,37 @@ See fdp_if() entry.
(C<fdpCacheIfIndex>)
=item $fdp->c_ip()
=item $fdp->fdp_ip()
Returns remote IP address
(C<fdpCacheAddress>)
=item $fdp->c_platform()
=item $fdp->fdp_platform()
Returns remote platform id
(C<fdpCachePlatform>)
=item $fdp->c_port()
=item $fdp->fdp_port()
Returns remote port ID
(C<fdpDevicePort>)
=item $fdp->c_proto()
=item $fdp->fdp_proto()
Returns remote address type received. Usually IP.
(C<fdpCacheAddressType>)
=item $fdp->c_ver()
=item $fdp->fdp_ver()
Returns remote hardware version
(C<fdpCacheVersion>)
=item $fdp->c_vlan()
=item $fdp->fdp_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 {
my $baystack = shift;
my $descr = $baystack->description();
my $model = $baystack->model();
my $descr = $baystack->description() || "";
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';
}
if (
(
(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)/ )
)
)
if ( ( ( $model =~ /(420|425|BPS)/ ) and ( $descr =~ m/SW:v[1-2]/i ) )
or ( ( $model =~ /(410|450|380)/ ) ) )
{
return 'baystack';
}
if ( $model =~ /VSP/ ) {
return 'vsp';
}
return 'boss';
}
@@ -126,7 +119,7 @@ sub os_bin {
}
sub vendor {
return 'nortel';
return 'avaya';
}
sub model {
@@ -141,9 +134,11 @@ sub model {
return '303' if ( defined $descr and $descr =~ /\D303\D/ );
return '304' if ( defined $descr and $descr =~ /\D304\D/ );
return 'BPS' if ( $model =~ /BPS2000/i );
return $2
if ( $model
=~ /(ES|ERS|BayStack|EthernetRoutingSwitch|EthernetSwitch)-?(\d+)/ );
# Pull sreg- from all
$model =~ s/^sreg-//;
# Strip ES/ERS/BayStack etc. from those families
$model =~ s/^(E(R)?S|BayStack|Ethernet(Routing)?Switch)-?//;
return $model;
}
@@ -214,7 +209,7 @@ sub i_name {
sub index_factor {
my $baystack = shift;
my $model = $baystack->model();
my $model = $baystack->model() || "";
my $os = $baystack->os();
my $os_ver = $baystack->os_ver();
my $op_mode = $baystack->ns_op_mode();
@@ -228,142 +223,16 @@ sub index_factor {
my $index_factor = 32;
$index_factor = 64
if ( ( defined $model and $model =~ /(470)/ )
if ( ( $model =~ /(470)/ )
or ( $os =~ m/(boss|bes)/ ) and ( $op_mode eq 'pure' ) );
$index_factor = 128
if ( ( defined $model and $model =~ /(5[56]\d\d)/ )
if ( ( $model =~ /(5[56]\d\d)|VSP/ )
and ( $os_ver >= 6 ) );
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
# methods.
@@ -475,8 +344,8 @@ __END__
=head1 NAME
SNMP::Info::Layer2::Baystack - SNMP Interface to Nortel Ethernet (Baystack)
Switches
SNMP::Info::Layer2::Baystack - SNMP Interface to Avaya Ethernet (Baystack)
and VSP 7000 series switches
=head1 AUTHOR
@@ -499,8 +368,8 @@ Eric Miller
=head1 DESCRIPTION
Provides abstraction to the configuration information obtainable from a Nortel
Ethernet Switch (Baystack) through SNMP.
Provides abstraction to the configuration information obtainable from an
Avaya Ethernet Switch (Baystack) and VSP 7000 series through SNMP.
For speed or debugging purposes you can call the subclass directly, but not
after determining a more specific class using the method above.
@@ -523,12 +392,6 @@ my $baystack = new SNMP::Info::Layer2::Baystack(...);
=back
=head2 Required MIBs
=over
=back
=head2 Inherited MIBs
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()
Returns 'nortel'
Returns 'avaya'
=item $baystack->model()
@@ -719,54 +582,6 @@ ns_e_vendor().
=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
See L<SNMP::Info::SONMP/"TABLE METHODS"> for details.

View File

@@ -413,108 +413,6 @@ sub _sensor {
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 {
my ($v) = @_;
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
# "module"/"port" index to ifIndex. Different vendors
# do this in different ways.
@@ -959,53 +833,6 @@ interface index (c<ifIndex>)
=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
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();
}
# 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;
__END__
@@ -271,51 +228,12 @@ C<Q-BRIDGE-MIB> doesn't return anything.
=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
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

View File

@@ -34,6 +34,12 @@ use strict;
use Exporter;
use SNMP::Info::Layer3;
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;
@SNMP::Info::Layer3::AlcatelLucent::ISA = qw/SNMP::Info::LLDP SNMP::Info::MAU
@@ -285,53 +291,6 @@ sub bp_index {
# 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
# fixed-config single-module system, so this is only a plausible
# 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'
=item $alu->hasCDP()
Returns whether LLDP is enabled.
=item $alu->model()
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
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()
Returns info from F<MAU-MIB>

View File

@@ -152,10 +152,6 @@ sub os {
return 'altiga';
}
sub hasCDP {
return 0;
}
# $altiga->interfaces() - Map the Interfaces to their physical names
# Add interface number to interface name to prevent duplicate ifDescr
# 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.
=item $altiga->hasCDP()
No.
=item $altiga->ps1_status()
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);
}
# 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;
__END__
@@ -232,10 +189,6 @@ These are methods that return scalar values from SNMP
Returns 'Arista Networks, Inc.'
=item $arista->hasCDP()
Returns whether LLDP is enabled.
=item $arista->model()
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>
=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()
Returns info from F<MAU-MIB>

View File

@@ -236,141 +236,6 @@ sub cisco_comm_indexing {
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;
__END__
@@ -494,23 +359,6 @@ Returns 1. Use vlan indexing.
=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
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
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
=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;
__END__
@@ -531,53 +404,6 @@ Crosses $c6500->p_port() with $c6500->p_duplex() to utilize port C<ifIndex>.
=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
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;
__END__
@@ -368,10 +327,6 @@ id(). Defaults to 'dlink'.
Returns 'dell', 'dlink', or 'ibm' based upon the IANA enterprise number in
id(). Defaults to 'dlink'.
=item $dell->hasCDP()
Returns whether LLDP is enabled.
=back
=head2 Overrides
@@ -389,6 +344,10 @@ otherwise uses the Layer3 serial method.
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
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
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
=head2 Table Methods imported from SNMP::Info::Layer3
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

View File

@@ -165,138 +165,45 @@ sub fw_port {
return $enterasys->qb_fw_port($partial);
}
# Use CDP and/or LLDP
#
# LLDP table timefilter implementation continuously increments when walked
# and we may never reach the end of the table. This behavior can be
# modified with the "set snmp timefilter break disable" command,
# unfortunately it is not the default. Query with a partial value of zero
# which means no time filter.
sub hasCDP {
sub lldp_ip {
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 $partial = shift;
my $partial = shift || 0;
my $cdp = $enterasys->SUPER::c_ip($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 ) {
my $ip = $lldp->{$iid};
next unless defined $ip;
$c_ip{$iid} = $ip;
}
return \%c_ip;
return $enterasys->SUPER::lldp_if($partial);
}
sub c_if {
sub lldp_port {
my $enterasys = shift;
my $partial = shift;
my $partial = shift || 0;
my $lldp = $enterasys->lldp_if(0) || {};
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 ) {
my $if = $lldp->{$iid};
next unless defined $if;
$c_if{$iid} = $if;
}
return \%c_if;
return $enterasys->SUPER::lldp_port($partial);
}
sub c_port {
sub lldp_id {
my $enterasys = shift;
my $partial = shift;
my $partial = shift || 0;
my $lldp = $enterasys->lldp_port(0) || {};
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 ) {
my $port = $lldp->{$iid};
next unless defined $port;
$c_port{$iid} = $port;
}
return \%c_port;
return $enterasys->SUPER::lldp_id($partial);
}
sub c_id {
sub lldp_platform {
my $enterasys = shift;
my $partial = shift;
my $partial = shift || 0;
my $lldp = $enterasys->lldp_id(0) || {};
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;
return $enterasys->SUPER::lldp_rem_sysdesc($partial);
}
1;
@@ -399,12 +306,6 @@ Returns base mac
=back
=head2 Overrides
=over
=back
=head2 Globals imported from SNMP::Info::MAU
See documentation in L<SNMP::Info::MAU/"GLOBALS"> for details.
@@ -463,52 +364,25 @@ identifier (iid).
=back
=head2 Topology information
=head2 Link Layer Discovery Protocol (LLDP) Overrides
Based upon the firmware version Enterasys devices may support Cabletron
Discovery Protocol (CTRON CDP), Cisco Discovery Protocol (CDP), Link Layer
Discovery Protocol (LLDP), or all. This module currently supports CDP and
LLDP, but not CTRON CDP. These methods will query both CDP and LLDP 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.
The LLDP table timefilter implementation continuously increments when
walked and we may never reach the end of the table. This behavior can be
modified with the "set snmp timefilter break disable" command,
unfortunately it is not the default. These methods are overriden to
supply a partial value of zero which means no time filter.
=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()
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
=item $enterasys->lldp_platform()
=back

View File

@@ -80,19 +80,18 @@ $VERSION = '2.09';
%SNMP::Info::LLDP::FUNCS,
%SNMP::Info::EDP::FUNCS,
'fan_state' => 'extremeFanOperational',
# EXTREME-FDB-MIB:extremeFdbMacFdbTable
'ex_fw_mac' => 'extremeFdbMacFdbMacAddress',
'ex_fw_port' => 'extremeFdbMacFdbPortIfIndex',
'ex_fw_status' => 'extremeFdbMacFdbStatus',
# EXTREME-VLAN-MIB:extremeVlanIfTable
'ex_vlan_descr' => 'extremeVlanIfDescr',
'ex_vlan_global_id' => 'extremeVlanIfGlobalIdentifier',
# EXTREME-VLAN-MIB:extremeVlanEncapsIfTable
'ex_vlan_encap_tag' => 'extremeVlanEncapsIfTag',
# EXTREME-POE-MIB::extremePethPseSlotTable
'peth_power_watts' => 'extremePethSlotPowerLimit',
# EXTREME-POE-MIB::extremePethPsePortTable
'peth_port_power' => 'extremePethPortMeasuredPower',
);
@@ -549,125 +548,6 @@ sub set_add_i_vlan_tagged {
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;
__END__
@@ -900,59 +780,14 @@ F<EXTREME-FDB-MIB> rather than F<BRIDGE-MIB>.
=item $extreme->peth_port_power()
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
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.
The configured maximum amount of inline power available to the slot.
=over
=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.
(C<extremePethSlotPowerLimit>)
=back

View File

@@ -65,6 +65,8 @@ $VERSION = '2.09';
'ps1_type' => 'snChasPwrSupplyDescription.1',
'ps1_status' => 'snChasPwrSupplyOperStatus.1',
'fan' => 'snChasFanOperStatus.1',
'img_ver' => 'snAgImgVer',
'ch_serial' => 'snChasSerNum',
);
@@ -165,7 +167,7 @@ sub vendor {
sub os_ver {
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
my $descr = $foundry->description();
@@ -204,10 +206,10 @@ sub serial {
my $foundry = shift;
# 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
my $mod_serials = $foundry->snAgentConfigModuleSerialNumber();
my $mod_serials = $foundry->snAgentConfigModuleSerialNumber() || {};
foreach my $mod ( sort keys %$mod_serials ) {
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;
__END__
@@ -527,6 +401,18 @@ Returns the status of the chassis fan.
(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
=head2 Global Methods imported from SNMP::Info::Layer3
@@ -607,54 +493,6 @@ Returns reference to hash. Current Port Speed.
=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
See documentation in L<SNMP::Info::Layer3/"TABLE METHODS"> for details.

View File

@@ -196,134 +196,6 @@ sub interfaces {
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;
__END__
@@ -527,54 +399,6 @@ Returns reference to hash. Current Port Speed.
=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
See documentation in L<SNMP::Info::Layer3/"TABLE METHODS"> for details.

View File

@@ -53,8 +53,9 @@ $VERSION = '2.09';
%GLOBALS = ( %SNMP::Info::Layer3::GLOBALS,
%SNMP::Info::LLDP::GLOBALS,
'serial' => 'jnxBoxSerialNo.0',
'mac' => 'dot1dBaseBridgeAddress',
'serial' => 'jnxBoxSerialNo.0',
'mac' => 'dot1dBaseBridgeAddress',
'box_descr' => 'jnxBoxDescr'
);
%FUNCS = ( %SNMP::Info::Layer3::FUNCS,
@@ -248,49 +249,6 @@ sub fw_port {
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
# This class supports both virtual chassis (stackable) and physical chassis
@@ -406,7 +364,7 @@ sub e_descr {
my $juniper = shift;
my $e_index = $juniper->e_index() || {};
my $box_descr = $juniper->jnxBoxDescr || 0;
my $box_descr = $juniper->box_descr;
my $contents = $juniper->jnxContentsDescr() || {};
my $containers = $juniper->jnxContainersDescr() || {};
@@ -663,16 +621,18 @@ Returns serial number
(C<jnxBoxSerialNo.0>)
=item $juniper->serial()
=item $juniper->mac()
Returns the MAC address used by this bridge when it must be referred
to in a unique fashion.
(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
@@ -718,35 +678,6 @@ IDs. These are the VLANs which are members of the egress list for the port.
=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>)
=over

View File

@@ -130,42 +130,6 @@ sub 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;
__END__
@@ -278,46 +242,6 @@ Ignores loopback
=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
See documentation in L<SNMP::Info::Layer3> for details.

View File

@@ -174,132 +174,6 @@ sub 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;
__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
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
See documentation in L<SNMP::Info::Layer3/"TABLE METHODS"> for details.

View File

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

View File

@@ -118,42 +118,6 @@ sub 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;
__END__
@@ -230,10 +194,6 @@ These are methods that return scalar values from SNMP
Returns 'FreeBSD'
=item $pf->hasCDP()
Returns whether LLDP is enabled.
=item $pf->model()
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
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
See documentation in L<SNMP::Info::Layer3/"TABLE METHODS"> for details.

View File

@@ -55,10 +55,14 @@ $VERSION = '2.09';
%GLOBALS = (
%SNMP::Info::Layer3::GLOBALS,
%SNMP::Info::MAU::GLOBALS,
'ps1_type' => 'nnenvPwrsupType.1',
'ps1_status' => 'nnenvPwrsupStatus.1',
'ps2_type' => 'nnenvPwrsupType.2',
'ps2_status' => 'nnenvPwrsupStatus.2',
'ps1_type' => 'nnenvPwrsupType.1',
'ps1_status' => 'nnenvPwrsupStatus.1',
'ps2_type' => 'nnenvPwrsupType.2',
'ps2_status' => 'nnenvPwrsupStatus.2',
'nn_sys_ver' => 'nnsysVersion',
'nn_ch_model' => 'nnchassisModel',
'nn_ch_op_stat' => 'nnchassisOperStatus',
'nn_ch_serial' => 'nnchassisSerialNumber',
);
%FUNCS = (
@@ -87,7 +91,7 @@ sub os {
sub os_ver {
my $tasman = shift;
my $version = $tasman->nnsysVersion() || "";
my $version = $tasman->nn_sys_ver() || "";
my $descr = $tasman->description() || "";
# Newer versions
@@ -102,7 +106,7 @@ sub model {
my $tasman = shift;
my $id = $tasman->id();
my $ch_model = $tasman->nnchassisModel();
my $ch_model = $tasman->nn_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
# 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
return $serial if ($serial !~ /^\D+$/);
# Unfortunately newer versions don't seem to populate the newer OID.
return $tasman->nnchassisSerialNumber();
return $tasman->nn_ch_serial();
}
1;
@@ -225,9 +229,25 @@ Grabs the os version from C<nnsysVersion>
(C<nnenvPwrsupType.2>)
=item $tasman->ps2_status()
(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()
Tries both (C<nnchassisOperStatus>) and (C<nnchassisSerialNumber>) as OID's

View File

@@ -1,7 +1,6 @@
# SNMP::Info::SONMP
# $Id$
#
# Copyright (c) 2008 Eric Miller
# Copyright (c) 2012 Eric Miller
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -30,6 +29,7 @@
package SNMP::Info::SONMP;
use warnings;
use strict;
use Exporter;
use SNMP::Info;
@@ -47,8 +47,8 @@ $VERSION = '2.09';
);
%GLOBALS = (
'cdp_id' => 's5EnMsTopIpAddr',
'cdp_run' => 's5EnMsTopStatus',
'sonmp_gid' => 's5EnMsTopIpAddr',
'sonmp_run' => 's5EnMsTopStatus',
);
%FUNCS = (
@@ -77,12 +77,14 @@ sub port_offset {
return 0;
}
sub hasCDP {
sub hasSONMP {
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 $partial = shift;
@@ -93,7 +95,7 @@ sub c_if {
my $port_offset = $sonmp->port_offset();
my $model = $sonmp->model();
my %c_if;
my %sonmp_if;
foreach my $entry ( keys %$sonmp_topo_port ) {
my $port = $sonmp_topo_port->{$entry};
next unless defined $port;
@@ -118,31 +120,31 @@ sub c_if {
my $index = ( ( $slot - $slot_offset ) * $index_factor )
+ ( $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 $partial = shift;
my $sonmp_topo_port = $sonmp->sonmp_topo_port($partial) || {};
my $sonmp_topo_ip = $sonmp->sonmp_topo_ip($partial) || {};
my %c_ip;
my %sonmp_ip;
foreach my $entry ( keys %$sonmp_topo_ip ) {
my $port = $sonmp_topo_port->{$entry};
next unless defined $port;
next if $port == 0;
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 $partial = shift;
@@ -150,7 +152,7 @@ sub c_port {
my $sonmp_topo_seg = $sonmp->sonmp_topo_seg($partial) || {};
my $sonmp_topo_platform = $sonmp->sonmp_topo_platform($partial) || {};
my %c_port;
my %sonmp_port;
foreach my $entry ( keys %$sonmp_topo_seg ) {
my $port = $sonmp_topo_port->{$entry};
next unless defined $port;
@@ -161,12 +163,12 @@ sub c_port {
# AP-222x Series does not adhere to port numbering
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
elsif ( $seg > 4000 ) {
$c_port{$entry} = 'unknown';
$sonmp_port{$entry} = 'unknown';
}
else {
@@ -174,20 +176,20 @@ sub c_port {
my $remote_port = $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 $partial = shift;
my $sonmp_topo_port = $sonmp->sonmp_topo_port($partial) || {};
my $sonmp_topo_platform = $sonmp->sonmp_topo_platform($partial) || {};
my %c_platform;
my %sonmp_platform;
foreach my $entry ( keys %$sonmp_topo_platform ) {
my $port = $sonmp_topo_port->{$entry};
next unless defined $port;
@@ -195,9 +197,9 @@ sub c_platform {
my $platform = $sonmp_topo_platform->{$entry};
$c_platform{$entry} = $platform;
$sonmp_platform{$entry} = $platform;
}
return \%c_platform;
return \%sonmp_platform;
}
sub mac {
@@ -242,19 +244,19 @@ Eric Miller
my $class = $sonmp->class();
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:
my $interfaces = $sonmp->interfaces();
my $c_if = $sonmp->c_if();
my $c_ip = $sonmp->c_ip();
my $c_port = $sonmp->c_port();
my $sonmp_if = $sonmp->sonmp_if();
my $sonmp_ip = $sonmp->sonmp_ip();
my $sonmp_port = $sonmp->sonmp_port();
foreach my $cdp_key (keys %$c_ip){
my $iid = $c_if->{$cdp_key};
foreach my $sonmp_key (keys %$sonmp_ip){
my $iid = $sonmp_if->{$sonmp_key};
my $port = $interfaces->{$iid};
my $neighbor = $c_ip->{$cdp_key};
my $neighbor_port = $c_port->{$cdp_key};
my $neighbor = $sonmp_ip->{$sonmp_key};
my $neighbor_port = $sonmp_port->{$sonmp_key};
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
also speak SONMP, mostly switches and hubs. SONMP is implemented in
SynOptics, Bay, and Nortel devices. SONMP has been rebranded by Bay then
Nortel and is know by several different names, most recently Nortel
SynOptics, Bay, Nortel, and Avaya devices. SONMP has been rebranded by Bay
then Nortel and may be referred to by several different names, including Nortel
Discovery Protocol (NDP).
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.
=item $cdp->hasCDP()
=item $sonmp->hasSONMP()
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.
(C<s5EnMsTopIpAddr>)
=item $sonmp->cdp_run()
=item $sonmp->sonmp_run()
Returns true if SONMP is on for this device.
@@ -386,31 +388,31 @@ bay_topo_seg() is local.
=back
=head2 Pseudo CDP information
=head2 Common topology information
All entries with port=0 are local and ignored.
=over
=item $sonmp->c_if()
=item $sonmp->sonmp_if()
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
If multiple entries exist with the same local port, c_if(), with different
IPv4 addresses, c_ip(), there is either a non SONMP device in between two or
If multiple entries exist with the same local port, sonmp_if(), with different
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.
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)
=item $sonmp->c_platform()
=item $sonmp->sonmp_platform()
Returns reference to hash. Key: IID, Value: Remote device type