Remove depreciated L2::Bay and L2::Foundry for 3.0 release. Functionality is available through L2::Baystack and L3::Foundry respectively and they are no longer referenced by other classes.
This commit is contained in:
@@ -3,12 +3,16 @@ SNMP::Info - Friendly OO-style interface to Network devices using SNMP.
|
|||||||
version 3.00
|
version 3.00
|
||||||
|
|
||||||
[API Changes]
|
[API Changes]
|
||||||
|
|
||||||
* The methods c_ip(), c_if(), c_port(), c_id(), and c_platform() now
|
* 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
|
represent common topology methods and will try to return a combined
|
||||||
hash of data from all L2 topology protocols either running on the
|
hash of data from all L2 topology protocols either running on the
|
||||||
device or specified in the method call. The topology specific methods
|
device or specified in the method call. The topology specific methods
|
||||||
have been been prefixed with the protocol name in lowercase so that
|
have been been prefixed with the protocol name in lowercase so that
|
||||||
they can be called directly, sonmp_ip(), cdp_ip(), etc.
|
they can be called directly, sonmp_ip(), cdp_ip(), etc.
|
||||||
|
* L2::Bay and L2::Foundry have been removed from the distribution. Both
|
||||||
|
classes were depreciated and all functionality is available through
|
||||||
|
L2::Baystack and L3::Foundry.
|
||||||
|
|
||||||
[NEW FEATURES]
|
[NEW FEATURES]
|
||||||
|
|
||||||
|
|||||||
8
Info.pm
8
Info.pm
@@ -487,10 +487,6 @@ Allied Telesis switches.
|
|||||||
|
|
||||||
See documentation in L<SNMP::Info::Layer2::Allied> for details.
|
See documentation in L<SNMP::Info::Layer2::Allied> for details.
|
||||||
|
|
||||||
=item SNMP::Info::Layer2::Bay
|
|
||||||
|
|
||||||
Depreciated. Use BayStack.
|
|
||||||
|
|
||||||
=item SNMP::Info::Layer2::Baystack
|
=item SNMP::Info::Layer2::Baystack
|
||||||
|
|
||||||
Subclass for Avaya/Nortel/Bay Ethernet Switch/Baystack switches. This
|
Subclass for Avaya/Nortel/Bay Ethernet Switch/Baystack switches. This
|
||||||
@@ -537,10 +533,6 @@ in more specific subclasses.
|
|||||||
|
|
||||||
See documentation in L<SNMP::Info::Layer2::Cisco> for details.
|
See documentation in L<SNMP::Info::Layer2::Cisco> for details.
|
||||||
|
|
||||||
=item SNMP::Info::Layer2::Foundry
|
|
||||||
|
|
||||||
Depreciated. Use SNMP::Info::Layer3::Foundry.
|
|
||||||
|
|
||||||
=item SNMP::Info::Layer2::HP
|
=item SNMP::Info::Layer2::HP
|
||||||
|
|
||||||
Subclass for more recent HP Procurve Switches
|
Subclass for more recent HP Procurve Switches
|
||||||
|
|||||||
@@ -1,492 +0,0 @@
|
|||||||
# SNMP::Info::Layer2::Bay
|
|
||||||
# $Id$
|
|
||||||
# This module depricated. See Layer2::BayStack
|
|
||||||
#
|
|
||||||
# Copyright (c) 2008 Max Baker changes from version 0.8 and beyond.
|
|
||||||
#
|
|
||||||
# Copyright (c) 2002,2003 Regents of the University of California
|
|
||||||
# All rights reserved.
|
|
||||||
#
|
|
||||||
# Redistribution and use in source and binary forms, with or without
|
|
||||||
# modification, are permitted provided that the following conditions are met:
|
|
||||||
#
|
|
||||||
# * Redistributions of source code must retain the above copyright notice,
|
|
||||||
# this list of conditions and the following disclaimer.
|
|
||||||
# * Redistributions in binary form must reproduce the above copyright
|
|
||||||
# notice, this list of conditions and the following disclaimer in the
|
|
||||||
# documentation and/or other materials provided with the distribution.
|
|
||||||
# * Neither the name of the University of California, Santa Cruz nor the
|
|
||||||
# names of its contributors may be used to endorse or promote products
|
|
||||||
# derived from this software without specific prior written permission.
|
|
||||||
#
|
|
||||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
||||||
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
# POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
package SNMP::Info::Layer2::Bay;
|
|
||||||
|
|
||||||
use strict;
|
|
||||||
use Exporter;
|
|
||||||
use SNMP::Info::Layer2;
|
|
||||||
|
|
||||||
@SNMP::Info::Layer2::Bay::ISA = qw/SNMP::Info::Layer2 Exporter/;
|
|
||||||
@SNMP::Info::Layer2::Bay::EXPORT_OK = qw//;
|
|
||||||
|
|
||||||
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE/;
|
|
||||||
|
|
||||||
$VERSION = '2.11';
|
|
||||||
|
|
||||||
# Set for No CDP
|
|
||||||
%GLOBALS = (
|
|
||||||
%SNMP::Info::Layer2::GLOBALS,
|
|
||||||
'cdp_id' => 's5EnMsTopIpAddr',
|
|
||||||
'cdp_run' => 's5EnMsTopStatus',
|
|
||||||
);
|
|
||||||
|
|
||||||
%FUNCS = (
|
|
||||||
%SNMP::Info::Layer2::FUNCS,
|
|
||||||
'imac2' => 'ifPhysAddress',
|
|
||||||
|
|
||||||
# S5-ETH-MULTISEG-TOPOLOGY-MIB::s5EnMsTopNmmTable
|
|
||||||
'bay_topo_slot' => 's5EnMsTopNmmSlot',
|
|
||||||
'bay_topo_port' => 's5EnMsTopNmmPort',
|
|
||||||
'bay_topo_ip' => 's5EnMsTopNmmIpAddr',
|
|
||||||
'bay_topo_seg' => 's5EnMsTopNmmSegId',
|
|
||||||
'bay_topo_mac' => 's5EnMsTopNmmMacAddr',
|
|
||||||
'bay_topo_platform' => 's5EnMsTopNmmChassisType',
|
|
||||||
'bay_topo_localseg' => 's5EnMsTopNmmLocalSeg',
|
|
||||||
);
|
|
||||||
|
|
||||||
%MIBS = (
|
|
||||||
%SNMP::Info::Layer2::MIBS,
|
|
||||||
'SYNOPTICS-ROOT-MIB' => 'synoptics',
|
|
||||||
'S5-ETH-MULTISEG-TOPOLOGY-MIB' => 's5EnMsTop'
|
|
||||||
);
|
|
||||||
|
|
||||||
delete $MIBS{'CISCO-CDP-MIB'};
|
|
||||||
|
|
||||||
# 450's report full duplex as speed = 20mbps?!
|
|
||||||
$SNMP::Info::SPEED_MAP{20_000_000} = '10 Mbps';
|
|
||||||
$SNMP::Info::SPEED_MAP{200_000_000} = '100 Mbps';
|
|
||||||
|
|
||||||
%MUNGE = ( %SNMP::Info::Layer2::MUNGE, 'i_mac2' => \&SNMP::Info::munge_mac, );
|
|
||||||
|
|
||||||
sub os {
|
|
||||||
return 'bay';
|
|
||||||
}
|
|
||||||
|
|
||||||
sub os_ver {
|
|
||||||
my $bay = shift;
|
|
||||||
my $descr = $bay->description();
|
|
||||||
return unless defined $descr;
|
|
||||||
|
|
||||||
# 303 / 304
|
|
||||||
if ( $descr =~ m/Rev: \d+\.\d+\.\d+\.\d+-(\d+\.\d+\.\d+\.\d+)/ ) {
|
|
||||||
return $1;
|
|
||||||
}
|
|
||||||
|
|
||||||
# 450
|
|
||||||
if ( $descr =~ m/SW:v(\d+\.\d+\.\d+\.\d+)/ ) {
|
|
||||||
return $1;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub os_bin {
|
|
||||||
my $bay = shift;
|
|
||||||
my $descr = $bay->description();
|
|
||||||
return unless defined $descr;
|
|
||||||
|
|
||||||
# 303 / 304
|
|
||||||
if ( $descr =~ m/Rev: \d+\.(\d+\.\d+\.\d+)-\d+\.\d+\.\d+\.\d+/ ) {
|
|
||||||
return $1;
|
|
||||||
}
|
|
||||||
|
|
||||||
# 450
|
|
||||||
if ( $descr =~ m/FW:v(\d+\.\d+\.\d+\.\d+)/ ) {
|
|
||||||
return $1;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub vendor {
|
|
||||||
|
|
||||||
# or nortel, or synopsis?
|
|
||||||
return 'bay';
|
|
||||||
}
|
|
||||||
|
|
||||||
sub i_ignore {
|
|
||||||
my $bay = shift;
|
|
||||||
my $descr = $bay->description();
|
|
||||||
|
|
||||||
my $i_type = $bay->i_type();
|
|
||||||
|
|
||||||
my %i_ignore;
|
|
||||||
foreach my $if ( keys %$i_type ) {
|
|
||||||
my $type = $i_type->{$if};
|
|
||||||
$i_ignore{$if}++ if $type =~ /(loopback|propvirtual|cpu)/i;
|
|
||||||
}
|
|
||||||
|
|
||||||
return \%i_ignore;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub interfaces {
|
|
||||||
my $bay = shift;
|
|
||||||
my $i_index = $bay->i_index();
|
|
||||||
|
|
||||||
return $i_index;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub i_mac {
|
|
||||||
my $bay = shift;
|
|
||||||
my $i_mac = $bay->i_mac2();
|
|
||||||
|
|
||||||
# Bay 303's with a hw rev < 2.11.4.5 report the mac as all zeros
|
|
||||||
foreach my $iid ( keys %$i_mac ) {
|
|
||||||
my $mac = $i_mac->{$iid};
|
|
||||||
delete $i_mac->{$iid} if $mac eq '00:00:00:00:00:00';
|
|
||||||
}
|
|
||||||
return $i_mac;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub model {
|
|
||||||
my $bay = shift;
|
|
||||||
my $id = $bay->id();
|
|
||||||
return unless defined $id;
|
|
||||||
my $model = &SNMP::translateObj($id);
|
|
||||||
return $id unless defined $model;
|
|
||||||
$model =~ s/^sreg-//i;
|
|
||||||
|
|
||||||
my $descr = $bay->description();
|
|
||||||
|
|
||||||
return '303' if ( $descr =~ /\D303\D/ );
|
|
||||||
return '304' if ( $descr =~ /\D304\D/ );
|
|
||||||
return '450' if ( $model =~ /BayStack450/ );
|
|
||||||
return $model;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Hack in some CDP type stuff
|
|
||||||
|
|
||||||
sub c_if {
|
|
||||||
my $bay = shift;
|
|
||||||
my $bay_topo_port = $bay->bay_topo_port();
|
|
||||||
|
|
||||||
my %c_if;
|
|
||||||
foreach my $entry ( keys %$bay_topo_port ) {
|
|
||||||
my $port = $bay_topo_port->{$entry};
|
|
||||||
next unless defined $port;
|
|
||||||
next if $port == 0;
|
|
||||||
$c_if{"$port.1"} = $port;
|
|
||||||
}
|
|
||||||
return \%c_if;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub c_ip {
|
|
||||||
my $bay = shift;
|
|
||||||
my $bay_topo_ip = $bay->bay_topo_ip();
|
|
||||||
my $bay_topo_port = $bay->bay_topo_port();
|
|
||||||
my $ip = $bay->cdp_ip();
|
|
||||||
|
|
||||||
# Count the number of devices seen on each port.
|
|
||||||
# more than one device seen means connected to a non-bay
|
|
||||||
# device, but other bay devices are squawking further away.
|
|
||||||
my %ip_port;
|
|
||||||
foreach my $entry ( keys %$bay_topo_ip ) {
|
|
||||||
my $port = $bay_topo_port->{$entry};
|
|
||||||
next unless defined $port;
|
|
||||||
next if ( $port =~ /^[\d\.]+$/ and $port == 0 );
|
|
||||||
my $ip = $bay_topo_ip->{$entry};
|
|
||||||
push( @{ $ip_port{$port} }, $ip );
|
|
||||||
}
|
|
||||||
|
|
||||||
my %c_ip;
|
|
||||||
foreach my $port ( keys %ip_port ) {
|
|
||||||
my $ips = $ip_port{$port};
|
|
||||||
if ( scalar @$ips == 1 ) {
|
|
||||||
$c_ip{"$port.1"} = $ips->[0];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$c_ip{"$port.1"} = $ips;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return \%c_ip;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub c_port {
|
|
||||||
my $bay = shift;
|
|
||||||
my $bay_topo_port = $bay->bay_topo_port();
|
|
||||||
my $bay_topo_seg = $bay->bay_topo_seg();
|
|
||||||
|
|
||||||
my %c_port;
|
|
||||||
foreach my $entry ( keys %$bay_topo_seg ) {
|
|
||||||
my $port = $bay_topo_port->{$entry};
|
|
||||||
next unless defined $port;
|
|
||||||
next if $port == 0;
|
|
||||||
|
|
||||||
# For fake remotes (multiple IPs for a c_ip), use first found
|
|
||||||
next if defined $c_port{"$port.1"};
|
|
||||||
|
|
||||||
my $seg = $bay_topo_seg->{$entry};
|
|
||||||
|
|
||||||
# Segment id is (256 * remote slot_num) + (remote_port)
|
|
||||||
my $remote_port = $seg % 256;
|
|
||||||
|
|
||||||
$c_port{"$port.1"} = $remote_port;
|
|
||||||
}
|
|
||||||
|
|
||||||
return \%c_port;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub c_platform {
|
|
||||||
my $bay = shift;
|
|
||||||
my $bay_topo_port = $bay->bay_topo_port();
|
|
||||||
my $bay_topo_platform = $bay->bay_topo_platform();
|
|
||||||
|
|
||||||
my %c_platform;
|
|
||||||
foreach my $entry ( keys %$bay_topo_platform ) {
|
|
||||||
my $port = $bay_topo_port->{$entry} || 0;
|
|
||||||
next if $port == 0;
|
|
||||||
|
|
||||||
# For fake remotes (multiple IPs for a c_ip), use first found
|
|
||||||
next if defined $c_platform{"$port.1"};
|
|
||||||
|
|
||||||
my $platform = $bay_topo_platform->{$entry};
|
|
||||||
|
|
||||||
$c_platform{"$port.1"} = $platform;
|
|
||||||
}
|
|
||||||
|
|
||||||
return \%c_platform;
|
|
||||||
}
|
|
||||||
|
|
||||||
1;
|
|
||||||
__END__
|
|
||||||
|
|
||||||
=head1 NAME
|
|
||||||
|
|
||||||
SNMP::Info::Layer2::Bay - SNMP Interface to old Bay Network BayStack Switches
|
|
||||||
|
|
||||||
=head1 AUTHOR
|
|
||||||
|
|
||||||
Max Baker
|
|
||||||
|
|
||||||
=head1 SYNOPSIS
|
|
||||||
|
|
||||||
This module is Deprecated. Please use Layer2::BayStack instead.
|
|
||||||
|
|
||||||
=head1 DESCRIPTION
|
|
||||||
|
|
||||||
Provides abstraction to the configuration information obtainable from a
|
|
||||||
Bay device 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.
|
|
||||||
|
|
||||||
my $bay = new SNMP::Info::Layer2::Bay(...);
|
|
||||||
|
|
||||||
=head2 Inherited Classes
|
|
||||||
|
|
||||||
=over
|
|
||||||
|
|
||||||
=item SNMP::Info::Layer2
|
|
||||||
|
|
||||||
=back
|
|
||||||
|
|
||||||
=head2 Required MIBs
|
|
||||||
|
|
||||||
=over
|
|
||||||
|
|
||||||
=item F<SYNOPTICS-ROOT-MIB>
|
|
||||||
|
|
||||||
=item F<S5-ETH-MULTISEG-TOPOLOGY-MIB>
|
|
||||||
|
|
||||||
=item Inherited classes
|
|
||||||
|
|
||||||
MIBs required by L<SNMP::Info::Layer2/"Required MIBs"> and its superclasses.
|
|
||||||
|
|
||||||
=back
|
|
||||||
|
|
||||||
=head1 GLOBALS
|
|
||||||
|
|
||||||
These are methods that return scalar value from SNMP
|
|
||||||
|
|
||||||
=over
|
|
||||||
|
|
||||||
=item $bay->vendor()
|
|
||||||
|
|
||||||
Returns 'bay' :)
|
|
||||||
|
|
||||||
=item $bay->model()
|
|
||||||
|
|
||||||
Cross references $bay->id() to the F<SYNOPTICS-MIB> and returns
|
|
||||||
the results. 303s and 304s have the same ID, so we have a hack
|
|
||||||
to return depending on which it is.
|
|
||||||
|
|
||||||
Removes C<sreg-> from the model name
|
|
||||||
|
|
||||||
=item $baystack->os()
|
|
||||||
|
|
||||||
Returns 'bay'.
|
|
||||||
|
|
||||||
=item $bay->os_ver()
|
|
||||||
|
|
||||||
Returns the os version extracted from C<sysDescr>.
|
|
||||||
|
|
||||||
=item $bay->os_bin()
|
|
||||||
|
|
||||||
Returns the firmware version extracted from C<sysDescr>.
|
|
||||||
|
|
||||||
=item $bay->cdp_id()
|
|
||||||
|
|
||||||
Returns the IP that the device is sending out for its Nmm topology info.
|
|
||||||
|
|
||||||
(C<s5EnMsTopIpAddr>)
|
|
||||||
|
|
||||||
=item $bay->cdp_run()
|
|
||||||
|
|
||||||
Returns if the F<S5-ETH-MULTISEG-TOPOLOGY> info is on for this device.
|
|
||||||
|
|
||||||
(C<s5EnMsTopStatus>)
|
|
||||||
|
|
||||||
=back
|
|
||||||
|
|
||||||
=head2 Globals imported from SNMP::Info::Layer2
|
|
||||||
|
|
||||||
See documentation in L<SNMP::Info::Layer2/"GLOBALS"> for details.
|
|
||||||
|
|
||||||
=head1 TABLE METHODS
|
|
||||||
|
|
||||||
These are methods that return tables of information in the form of a reference
|
|
||||||
to a hash.
|
|
||||||
|
|
||||||
=head2 Overrides
|
|
||||||
|
|
||||||
=over
|
|
||||||
|
|
||||||
=item $bay->interfaces()
|
|
||||||
|
|
||||||
Returns reference to map of IIDs to physical ports.
|
|
||||||
|
|
||||||
Currently simply returns the C<ifIndex>
|
|
||||||
|
|
||||||
=item $bay->i_ignore()
|
|
||||||
|
|
||||||
Returns reference to hash of IIDs to ignore.
|
|
||||||
|
|
||||||
Simply calls the SNMP::Info::Layer2::i_ignore() for this.
|
|
||||||
|
|
||||||
=item $bay->i_mac()
|
|
||||||
|
|
||||||
Returns the C<ifPhysAddress> table entries.
|
|
||||||
|
|
||||||
Removes all entries matching '00:00:00:00:00:00' -- Certain
|
|
||||||
older revisions of Bay 303 and 304 firmware report all zeros
|
|
||||||
for each port mac.
|
|
||||||
|
|
||||||
=back
|
|
||||||
|
|
||||||
=head2 Pseudo CDP information
|
|
||||||
|
|
||||||
All entries with port=0 are local and ignored.
|
|
||||||
|
|
||||||
=over
|
|
||||||
|
|
||||||
=item $bay->c_if()
|
|
||||||
|
|
||||||
Returns reference to hash. Key: port.1 Value: port (iid)
|
|
||||||
|
|
||||||
=item $bay->c_ip()
|
|
||||||
|
|
||||||
Returns reference to hash. Key: port.1
|
|
||||||
|
|
||||||
The value of each hash entry can either be a scalar or an array.
|
|
||||||
A scalar value is most likely a direct neighbor to that port.
|
|
||||||
It is possible that there is a non-bay device in between this device and the
|
|
||||||
remote device.
|
|
||||||
|
|
||||||
An array value represents a list of seen devices. The only time you will get
|
|
||||||
an array of neighbors, is if there is a non-bay device in between two or more
|
|
||||||
devices.
|
|
||||||
|
|
||||||
Use the data from the Layer2 Topology Table below to dig deeper.
|
|
||||||
|
|
||||||
=item $bay->c_port()
|
|
||||||
|
|
||||||
Returns reference to hash. Key: IID, Value: Remote port (interfaces)
|
|
||||||
|
|
||||||
=item $bay->c_platform()
|
|
||||||
|
|
||||||
Returns reference to hash. Key: IID, Value: Remote device type
|
|
||||||
|
|
||||||
=item $bay->port()
|
|
||||||
|
|
||||||
Returns reference to hash. Key: port.1 Value: port
|
|
||||||
|
|
||||||
=item $bay->platform()
|
|
||||||
|
|
||||||
Returns reference to hash. Key: port.1 Value: Remote Device Type
|
|
||||||
|
|
||||||
=back
|
|
||||||
|
|
||||||
=head2 Layer2 Topology info (C<s5EnMsTopNmmTable>)
|
|
||||||
|
|
||||||
=over
|
|
||||||
|
|
||||||
=item $bay->bay_topo_slot()
|
|
||||||
|
|
||||||
Returns reference to hash. Key: Table entry, Value:slot number
|
|
||||||
|
|
||||||
(C<s5EnMsTopNmmSlot>)
|
|
||||||
|
|
||||||
=item $bay->bay_topo_port()
|
|
||||||
|
|
||||||
Returns reference to hash. Key: Table entry, Value:Port Number
|
|
||||||
(interface iid)
|
|
||||||
|
|
||||||
(C<s5EnMsTopNmmPort>)
|
|
||||||
|
|
||||||
=item $bay->bay_topo_ip()
|
|
||||||
|
|
||||||
Returns reference to hash. Key: Table entry, Value:Remote IP address of entry
|
|
||||||
|
|
||||||
(C<s5EnMsTopNmmIpAddr>)
|
|
||||||
|
|
||||||
=item $bay->bay_topo_seg()
|
|
||||||
|
|
||||||
Returns reference to hash. Key: Table entry, Value:Remote Segment ID
|
|
||||||
|
|
||||||
(C<s5EnMsTopNmmSegId>)
|
|
||||||
|
|
||||||
=item $bay->bay_topo_mac
|
|
||||||
(C<s5EnMsTopNmmMacAddr>)
|
|
||||||
|
|
||||||
Returns reference to hash. Key: Table entry, Value:Remote MAC address
|
|
||||||
|
|
||||||
=item $bay->bay_topo_platform
|
|
||||||
|
|
||||||
Returns reference to hash. Key: Table entry, Value:Remote Device Type
|
|
||||||
|
|
||||||
(C<s5EnMsTopNmmChassisType>)
|
|
||||||
|
|
||||||
=item $bay->bay_topo_localseg
|
|
||||||
|
|
||||||
Returns reference to hash. Key: Table entry, Value:Boolean, if bay_topo_seg()
|
|
||||||
is local
|
|
||||||
|
|
||||||
(C<s5EnMsTopNmmLocalSeg>)
|
|
||||||
|
|
||||||
=back
|
|
||||||
|
|
||||||
=head2 Table Methods imported from SNMP::Info::Layer2
|
|
||||||
|
|
||||||
See documentation in L<SNMP::Info::Layer2/"TABLE METHODS"> for details.
|
|
||||||
|
|
||||||
=cut
|
|
||||||
@@ -1,349 +0,0 @@
|
|||||||
# SNMP::Info::Layer2::Foundry - SNMP Interface to Foundry Switches
|
|
||||||
# $Id$
|
|
||||||
#
|
|
||||||
# Copyright (c) 2008 Max Baker
|
|
||||||
# All rights reserved.
|
|
||||||
#
|
|
||||||
# Redistribution and use in source and binary forms, with or without
|
|
||||||
# modification, are permitted provided that the following conditions are met:
|
|
||||||
#
|
|
||||||
# * Redistributions of source code must retain the above copyright notice,
|
|
||||||
# this list of conditions and the following disclaimer.
|
|
||||||
# * Redistributions in binary form must reproduce the above copyright
|
|
||||||
# notice, this list of conditions and the following disclaimer in the
|
|
||||||
# documentation and/or other materials provided with the distribution.
|
|
||||||
# * Neither the name of the University of California, Santa Cruz nor the
|
|
||||||
# names of its contributors may be used to endorse or promote products
|
|
||||||
# derived from this software without specific prior written permission.
|
|
||||||
#
|
|
||||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
||||||
# LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
# POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
package SNMP::Info::Layer2::Foundry;
|
|
||||||
|
|
||||||
use strict;
|
|
||||||
use Exporter;
|
|
||||||
use SNMP::Info::Layer2;
|
|
||||||
use SNMP::Info::FDP;
|
|
||||||
use SNMP::Info::EtherLike;
|
|
||||||
use SNMP::Info::MAU;
|
|
||||||
|
|
||||||
@SNMP::Info::Layer2::Foundry::ISA
|
|
||||||
= qw/SNMP::Info::Layer2 SNMP::Info::FDP SNMP::Info::EtherLike
|
|
||||||
SNMP::Info::MAU Exporter/;
|
|
||||||
@SNMP::Info::Layer2::Foundry::EXPORT_OK = qw//;
|
|
||||||
|
|
||||||
use vars qw/$VERSION %GLOBALS %FUNCS %MIBS %MUNGE/;
|
|
||||||
|
|
||||||
$VERSION = '2.11';
|
|
||||||
|
|
||||||
%MIBS = (
|
|
||||||
%SNMP::Info::Layer2::MIBS, %SNMP::Info::FDP::MIBS,
|
|
||||||
%SNMP::Info::EtherLike::MIBS, %SNMP::Info::MAU::MIBS,
|
|
||||||
'FOUNDRY-SN-ROOT-MIB' => 'foundry',
|
|
||||||
);
|
|
||||||
|
|
||||||
%GLOBALS = (
|
|
||||||
%SNMP::Info::Layer2::GLOBALS, %SNMP::Info::FDP::GLOBALS,
|
|
||||||
%SNMP::Info::EtherLike::GLOBALS, %SNMP::Info::MAU::GLOBALS,
|
|
||||||
);
|
|
||||||
|
|
||||||
%FUNCS = (
|
|
||||||
%SNMP::Info::Layer2::FUNCS, %SNMP::Info::FDP::FUNCS,
|
|
||||||
%SNMP::Info::EtherLike::FUNCS, %SNMP::Info::MAU::FUNCS,
|
|
||||||
'test' => 'dot1dStpPortState',
|
|
||||||
);
|
|
||||||
|
|
||||||
%MUNGE = (
|
|
||||||
%SNMP::Info::Layer2::MUNGE, %SNMP::Info::FDP::MUNGE,
|
|
||||||
%SNMP::Info::EtherLike::MUNGE, %SNMP::Info::MAU::MUNGE,
|
|
||||||
);
|
|
||||||
|
|
||||||
# Method OverRides
|
|
||||||
|
|
||||||
#sub bulkwalk_no { 1;}
|
|
||||||
|
|
||||||
*SNMP::Info::Layer2::Foundry::i_duplex = \&SNMP::Info::MAU::mau_i_duplex;
|
|
||||||
*SNMP::Info::Layer2::Foundry::i_duplex_admin
|
|
||||||
= \&SNMP::Info::MAU::mau_i_duplex_admin;
|
|
||||||
*SNMP::Info::Layer2::Foundry::i_vlan = \&SNMP::Info::Bridge::qb_i_vlan_t;
|
|
||||||
|
|
||||||
# todo doc these
|
|
||||||
|
|
||||||
sub os_ver {
|
|
||||||
my $foundry = shift;
|
|
||||||
|
|
||||||
my $e_name = $foundry->e_name();
|
|
||||||
|
|
||||||
# find entity table entry for "stackmanaget.1"
|
|
||||||
my $unit_iid = undef;
|
|
||||||
foreach my $e ( keys %$e_name ) {
|
|
||||||
my $name = $e_name->{$e} || '';
|
|
||||||
$unit_iid = $e if $name eq 'stackmanaget.1';
|
|
||||||
}
|
|
||||||
|
|
||||||
# Default to OID method if no dice.
|
|
||||||
unless ( defined $unit_iid ) {
|
|
||||||
return $foundry->SUPER::model();
|
|
||||||
}
|
|
||||||
|
|
||||||
# Find Model Name
|
|
||||||
my $e_fwver = $foundry->e_fwver();
|
|
||||||
if ( defined $e_fwver->{$unit_iid} ) {
|
|
||||||
return $e_fwver->{$unit_iid};
|
|
||||||
}
|
|
||||||
|
|
||||||
# Not found in ENTITY-MIB, go up a level.
|
|
||||||
return $foundry->SUPER::os_ver();
|
|
||||||
}
|
|
||||||
|
|
||||||
sub model {
|
|
||||||
my $foundry = shift;
|
|
||||||
|
|
||||||
my $e_name = $foundry->e_name();
|
|
||||||
|
|
||||||
# find entity table entry for "unit.1"
|
|
||||||
my $unit_iid = undef;
|
|
||||||
foreach my $e ( keys %$e_name ) {
|
|
||||||
my $name = $e_name->{$e} || '';
|
|
||||||
$unit_iid = $e if $name eq 'unit.1';
|
|
||||||
}
|
|
||||||
|
|
||||||
# Default to OID method if no dice.
|
|
||||||
unless ( defined $unit_iid ) {
|
|
||||||
return $foundry->SUPER::model();
|
|
||||||
}
|
|
||||||
|
|
||||||
# Find Model Name
|
|
||||||
my $e_model = $foundry->e_model();
|
|
||||||
if ( defined $e_model->{$unit_iid} ) {
|
|
||||||
return $e_model->{$unit_iid};
|
|
||||||
}
|
|
||||||
|
|
||||||
# Not found in ENTITY-MIB, go up a level.
|
|
||||||
return $foundry->SUPER::model();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
sub serial {
|
|
||||||
my $foundry = shift;
|
|
||||||
|
|
||||||
my $e_name = $foundry->e_name();
|
|
||||||
|
|
||||||
# find entity table entry for "unit.1"
|
|
||||||
my $unit_iid = undef;
|
|
||||||
foreach my $e ( keys %$e_name ) {
|
|
||||||
my $name = $e_name->{$e} || '';
|
|
||||||
$unit_iid = $e if $name eq 'unit.1';
|
|
||||||
}
|
|
||||||
return unless defined $unit_iid;
|
|
||||||
|
|
||||||
# Look up serial of found entry.
|
|
||||||
my $e_serial = $foundry->e_serial();
|
|
||||||
return $e_serial->{$unit_iid} if defined $e_serial->{$unit_iid};
|
|
||||||
|
|
||||||
return $foundry->SUPER::serial();
|
|
||||||
}
|
|
||||||
|
|
||||||
sub interfaces {
|
|
||||||
my $foundry = shift;
|
|
||||||
my $i_descr = $foundry->i_description;
|
|
||||||
my $i_name = $foundry->i_name;
|
|
||||||
|
|
||||||
# use ifName only if it is in portn
|
|
||||||
# format. For EdgeIrons
|
|
||||||
# else use ifDescr
|
|
||||||
foreach my $iid ( keys %$i_name ) {
|
|
||||||
my $name = $i_name->{$iid};
|
|
||||||
next unless defined $name;
|
|
||||||
$i_descr->{$iid} = $name
|
|
||||||
if $name =~ /^port\d+/i;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $i_descr;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub i_ignore {
|
|
||||||
my $foundry = shift;
|
|
||||||
my $i_type = $foundry->i_type();
|
|
||||||
|
|
||||||
my %i_ignore = ();
|
|
||||||
|
|
||||||
foreach my $iid ( keys %$i_type ) {
|
|
||||||
my $type = $i_type->{$iid} || '';
|
|
||||||
$i_ignore{$iid}++
|
|
||||||
|
|
||||||
# 33 is the console port
|
|
||||||
if $type =~ /(loopback|propvirtual|other|cpu|33)/i;
|
|
||||||
}
|
|
||||||
return \%i_ignore;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub os {
|
|
||||||
return 'foundry';
|
|
||||||
}
|
|
||||||
|
|
||||||
sub vendor {
|
|
||||||
return 'foundry';
|
|
||||||
}
|
|
||||||
|
|
||||||
# this hangs on a edgeiron24g
|
|
||||||
# TODO: check by devicetype and deferr to SUPER if not bad device
|
|
||||||
sub stp_p_state { return; }
|
|
||||||
|
|
||||||
1;
|
|
||||||
__END__
|
|
||||||
|
|
||||||
=head1 NAME
|
|
||||||
|
|
||||||
SNMP::Info::Layer2::Foundry - SNMP Interface to Foundry FastIron Network
|
|
||||||
Devices
|
|
||||||
|
|
||||||
=head1 AUTHOR
|
|
||||||
|
|
||||||
Max Baker
|
|
||||||
|
|
||||||
=head1 SYNOPSIS
|
|
||||||
|
|
||||||
This module is Deprecated. Please use Layer3::Foundry instead.
|
|
||||||
|
|
||||||
# Let SNMP::Info determine the correct subclass for you.
|
|
||||||
my $foundry = new SNMP::Info(
|
|
||||||
AutoSpecify => 1,
|
|
||||||
Debug => 1,
|
|
||||||
DestHost => 'myswitch',
|
|
||||||
Community => 'public',
|
|
||||||
Version => 1
|
|
||||||
)
|
|
||||||
or die "Can't connect to DestHost.\n";
|
|
||||||
|
|
||||||
my $class = $foundry->class();
|
|
||||||
|
|
||||||
print "SNMP::Info determined this device to fall under subclass : $class\n";
|
|
||||||
|
|
||||||
=head1 DESCRIPTION
|
|
||||||
|
|
||||||
This module is Deprecated. Please use Layer3::Foundry instead.
|
|
||||||
|
|
||||||
This module provides support for Foundry EdgeIron Switches
|
|
||||||
|
|
||||||
=head2 Inherited Classes
|
|
||||||
|
|
||||||
=over
|
|
||||||
|
|
||||||
=item SNMP::Info::Layer2
|
|
||||||
|
|
||||||
=item SNMP::Info::FDP
|
|
||||||
|
|
||||||
=back
|
|
||||||
|
|
||||||
=head2 Required MIBs
|
|
||||||
|
|
||||||
=over
|
|
||||||
|
|
||||||
=item F<FOUNDRY-SN-ROOT-MIB>
|
|
||||||
|
|
||||||
=item Inherited Classes' MIBs
|
|
||||||
|
|
||||||
See classes listed above for their required MIBs.
|
|
||||||
|
|
||||||
=back
|
|
||||||
|
|
||||||
=head1 GLOBALS
|
|
||||||
|
|
||||||
These are methods that return scalar value from SNMP
|
|
||||||
|
|
||||||
=over
|
|
||||||
|
|
||||||
=item $foundry->model()
|
|
||||||
|
|
||||||
Returns model type.
|
|
||||||
|
|
||||||
=item $foundry->vendor()
|
|
||||||
|
|
||||||
Returns 'foundry'
|
|
||||||
|
|
||||||
=item $foundry->os()
|
|
||||||
|
|
||||||
Returns 'foundry'
|
|
||||||
|
|
||||||
=item $foundry->os_ver()
|
|
||||||
|
|
||||||
Returns the software version
|
|
||||||
|
|
||||||
=item $foundry->serial()
|
|
||||||
|
|
||||||
Returns the serial number
|
|
||||||
|
|
||||||
=back
|
|
||||||
|
|
||||||
=head2 Globals imported from SNMP::Info::Layer2
|
|
||||||
|
|
||||||
See documentation in L<SNMP::Info::Layer2/"GLOBALS"> for details.
|
|
||||||
|
|
||||||
=head2 Globals imported from SNMP::Info::FDP
|
|
||||||
|
|
||||||
See documentation in L<SNMP::Info::FDP/"GLOBALS"> for details.
|
|
||||||
|
|
||||||
=head1 TABLE METHODS
|
|
||||||
|
|
||||||
These are methods that return tables of information in the form of a reference
|
|
||||||
to a hash.
|
|
||||||
|
|
||||||
=head2 Overrides
|
|
||||||
|
|
||||||
=over
|
|
||||||
|
|
||||||
=item $foundry->interfaces()
|
|
||||||
|
|
||||||
Returns reference to hash of interface names to iids.
|
|
||||||
|
|
||||||
=item $foundry->i_ignore()
|
|
||||||
|
|
||||||
Returns reference to hash of interfaces to be ignored.
|
|
||||||
|
|
||||||
Ignores interfaces with descriptions of tunnel,loopback,null
|
|
||||||
|
|
||||||
=item $foundry->i_duplex()
|
|
||||||
|
|
||||||
Returns reference to hash of interface link duplex status.
|
|
||||||
|
|
||||||
Crosses $foundry->sw_duplex() with $foundry->sw_index()
|
|
||||||
|
|
||||||
=item $foundry->i_duplex_admin()
|
|
||||||
|
|
||||||
Returns reference to hash of interface administrative duplex status.
|
|
||||||
|
|
||||||
=item $foundry->stp_p_state()
|
|
||||||
|
|
||||||
"The port's current state as defined by application of the Spanning Tree
|
|
||||||
Protocol.
|
|
||||||
|
|
||||||
Skipped if device is an EdgeIron 24G due to reports of hangs.
|
|
||||||
|
|
||||||
(C<dot1dStpPortState>)
|
|
||||||
|
|
||||||
=item $foundry->i_vlan()
|
|
||||||
|
|
||||||
Returns a mapping between C<ifIndex> and the PVID or default VLAN.
|
|
||||||
|
|
||||||
=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::FDP
|
|
||||||
|
|
||||||
See documentation in L<SNMP::Info::FDP/"TABLE METHODS"> for details.
|
|
||||||
|
|
||||||
=cut
|
|
||||||
Reference in New Issue
Block a user