+jeneric's massive Nortel functionality patch. L2::Bay depricated
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
# SNMP::Info::Layer2::Bay
|
||||
# Max Baker <max@warped.org>
|
||||
# This module depricated. See Layer2::BayStack
|
||||
#
|
||||
# Copyright (c) 2004 Max Baker changes from version 0.8 and beyond.
|
||||
#
|
||||
@@ -276,19 +277,7 @@ Max Baker (C<max@warped.org>)
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
# Let SNMP::Info determine the correct subclass for you.
|
||||
my $bay = new SNMP::Info(
|
||||
AutoSpecify => 1,
|
||||
Debug => 1,
|
||||
# These arguments are passed directly on to SNMP::Session
|
||||
DestHost => 'myswitch',
|
||||
Community => 'public',
|
||||
Version => 2
|
||||
)
|
||||
or die "Can't connect to DestHost.\n";
|
||||
|
||||
my $class = $bay->class();
|
||||
print "SNMP::Info determined this device to fall under subclass : $class\n";
|
||||
This module is Depricated. Please use Layer2::BayStack instead.
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
|
||||
425
Info/Layer2/Baystack.pm
Normal file
425
Info/Layer2/Baystack.pm
Normal file
@@ -0,0 +1,425 @@
|
||||
# SNMP::Info::Layer2::Baystack
|
||||
# Eric Miller <eric@jeneric.org>
|
||||
#
|
||||
# Copyright (c) 2004 Max Baker changes from version 0.8 and beyond.
|
||||
# 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::Baystack;
|
||||
$VERSION = 0.9;
|
||||
use strict;
|
||||
|
||||
use Exporter;
|
||||
use SNMP::Info;
|
||||
use SNMP::Info::Bridge;
|
||||
use SNMP::Info::NortelStack;
|
||||
use SNMP::Info::SONMP;
|
||||
use SNMP::Info::RapidCity;
|
||||
|
||||
@SNMP::Info::Layer2::Baystack::ISA = qw/SNMP::Info SNMP::Info::Bridge SNMP::Info::NortelStack SNMP::Info::SONMP SNMP::Info::RapidCity Exporter/;
|
||||
@SNMP::Info::Layer2::Baystack::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::MIBS,
|
||||
%SNMP::Info::Bridge::MIBS,
|
||||
%SNMP::Info::NortelStack::MIBS,
|
||||
%SNMP::Info::SONMP::MIBS,
|
||||
%SNMP::Info::RapidCity::MIBS,
|
||||
);
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::GLOBALS,
|
||||
%SNMP::Info::Bridge::GLOBALS,
|
||||
%SNMP::Info::NortelStack::GLOBALS,
|
||||
%SNMP::Info::SONMP::GLOBALS,
|
||||
%SNMP::Info::RapidCity::GLOBALS,
|
||||
);
|
||||
|
||||
%FUNCS = (
|
||||
%SNMP::Info::FUNCS,
|
||||
%SNMP::Info::Bridge::FUNCS,
|
||||
%SNMP::Info::NortelStack::FUNCS,
|
||||
%SNMP::Info::SONMP::FUNCS,
|
||||
%SNMP::Info::RapidCity::FUNCS,
|
||||
'i_name2' => 'ifName',
|
||||
'i_mac2' => 'ifPhysAddress',
|
||||
);
|
||||
|
||||
# 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';
|
||||
$SNMP::Info::SPEED_MAP{2_000_000_000} = '1.0 Gbps';
|
||||
|
||||
%MUNGE = (
|
||||
%SNMP::Info::MUNGE,
|
||||
%SNMP::Info::Bridge::MUNGE,
|
||||
%SNMP::Info::NortelStack::MUNGE,
|
||||
%SNMP::Info::SONMP::MUNGE,
|
||||
%SNMP::Info::RapidCity::MUNGE,
|
||||
'i_mac2' => \&SNMP::Info::munge_mac,
|
||||
);
|
||||
|
||||
sub os {
|
||||
my $baystack = shift;
|
||||
my $descr = $baystack->description();
|
||||
my $model = $baystack->model();
|
||||
|
||||
if ((defined $model and $model =~ /(470|460|BPS|5510|5520)/) and (defined $descr and $descr =~ m/SW:v[3-5]/i)) {
|
||||
return 'boss';
|
||||
}
|
||||
return 'baystack';
|
||||
}
|
||||
|
||||
sub os_bin {
|
||||
my $baystack = shift;
|
||||
my $descr = $baystack->description();
|
||||
return undef 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+)/){
|
||||
return $1;
|
||||
}
|
||||
|
||||
if ($descr =~ m/FW:(\d+\.\d+\.\d+\.\d+)/i){
|
||||
return $1;
|
||||
}
|
||||
return undef;
|
||||
}
|
||||
|
||||
sub vendor {
|
||||
return 'nortel';
|
||||
}
|
||||
|
||||
sub model {
|
||||
my $baystack = shift;
|
||||
my $id = $baystack->id();
|
||||
return undef unless defined $id;
|
||||
my $model = &SNMP::translateObj($id);
|
||||
return $id unless defined $model;
|
||||
$model =~ s/^sreg-//i;
|
||||
|
||||
my $descr = $baystack->description();
|
||||
|
||||
return '303' if (defined $descr and $descr =~ /\D303\D/);
|
||||
return '304' if (defined $descr and $descr =~ /\D304\D/);
|
||||
return '350' if ($model =~ /BayStack350/);
|
||||
return '380' if ($model =~ /BayStack380/);
|
||||
return '410' if ($model =~ /BayStack410/);
|
||||
return '420' if ($model =~ /BayStack420/);
|
||||
return '425' if ($model =~ /BayStack425/);
|
||||
return '450' if ($model =~ /BayStack450/);
|
||||
return '470' if ($model =~ /BayStack470/i);
|
||||
return '460' if ($model =~ /BayStack460/i);
|
||||
return 'BPS' if ($model =~ /BPS2000/i);
|
||||
return '5510' if ($model =~ /BayStack5510/i);
|
||||
return '5520' if ($model =~ /BayStack5520/i);
|
||||
|
||||
return $model;
|
||||
}
|
||||
|
||||
sub i_ignore {
|
||||
my $baystack = shift;
|
||||
my $i_type = $baystack->i_type();
|
||||
|
||||
my %i_ignore;
|
||||
foreach my $if (keys %$i_type){
|
||||
my $type = $i_type->{$if};
|
||||
next unless defined $type;
|
||||
$i_ignore{$if}++ if $type =~ /(54|loopback|propvirtual|cpu)/i;
|
||||
}
|
||||
return \%i_ignore;
|
||||
}
|
||||
|
||||
sub interfaces {
|
||||
my $baystack = shift;
|
||||
my $i_index = $baystack->i_index();
|
||||
my $index_factor = $baystack->index_factor();
|
||||
my $slot_offset = $baystack->slot_offset();
|
||||
|
||||
my %if;
|
||||
foreach my $iid (keys %$i_index){
|
||||
my $index = $i_index->{$iid};
|
||||
next unless defined $index;
|
||||
# Ignore cascade ports
|
||||
next if $index > 513;
|
||||
|
||||
my $port = ($index % $index_factor);
|
||||
my $slot = (int($index / $index_factor)) + $slot_offset;
|
||||
|
||||
my $slotport = "$slot.$port";
|
||||
$if{$iid} = $slotport;
|
||||
}
|
||||
return \%if;
|
||||
}
|
||||
|
||||
sub i_mac {
|
||||
my $baystack = shift;
|
||||
my $i_mac = $baystack->i_mac2();
|
||||
|
||||
my %i_mac;
|
||||
# Baystack 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};
|
||||
next unless defined $mac;
|
||||
next if $mac eq '00:00:00:00:00:00';
|
||||
$i_mac{$iid}=$mac;
|
||||
}
|
||||
return \%i_mac;
|
||||
}
|
||||
|
||||
sub i_name {
|
||||
my $baystack = shift;
|
||||
my $i_index = $baystack->i_index();
|
||||
my $i_alias = $baystack->i_alias();
|
||||
my $i_name2 = $baystack->i_name2();
|
||||
|
||||
my %i_name;
|
||||
foreach my $iid (keys %$i_name2){
|
||||
my $name = $i_name2->{$iid};
|
||||
my $alias = $i_alias->{$iid};
|
||||
$i_name{$iid} = (defined $alias and $alias !~ /^\s*$/) ?
|
||||
$alias :
|
||||
$name;
|
||||
}
|
||||
|
||||
return \%i_name;
|
||||
}
|
||||
|
||||
sub index_factor {
|
||||
my $baystack = shift;
|
||||
my $model = $baystack->model();
|
||||
my $os = $baystack->os();
|
||||
my $op_mode = $baystack->ns_op_mode();
|
||||
|
||||
$op_mode = 'pure' unless defined $op_mode;
|
||||
|
||||
my $index_factor = 32;
|
||||
$index_factor = 64 if ((defined $model and $model =~ /(470)/) or ($os eq 'BoSS') and ($op_mode eq 'pure'));
|
||||
|
||||
return $index_factor;
|
||||
}
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
SNMP::Info::Layer2::Baystack - SNMP Interface to Nortel Networks' Baystack Switches
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Max Baker (C<max@warped.org>),
|
||||
Eric Miller (C<eric@jeneric.org>)
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
# Let SNMP::Info determine the correct subclass for you.
|
||||
my $baystack = new SNMP::Info(
|
||||
AutoSpecify => 1,
|
||||
Debug => 1,
|
||||
# These arguments are passed directly on to SNMP::Session
|
||||
DestHost => 'myswitch',
|
||||
Community => 'public',
|
||||
Version => 2
|
||||
)
|
||||
or die "Can't connect to DestHost.\n";
|
||||
|
||||
my $class = $baystack->class();
|
||||
print "SNMP::Info determined this device to fall under subclass : $class\n";
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Provides abstraction to the configuration information obtainable from a Nortel Networks'
|
||||
Baystack 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 $baystack = new SNMP::Info::Layer2::Baystack(...);
|
||||
|
||||
=head2 Inherited Classes
|
||||
|
||||
=over
|
||||
|
||||
=item SNMP::Info
|
||||
|
||||
=item SNMP::Info::Bridge
|
||||
|
||||
=item SNMP::Info::NortelStack
|
||||
|
||||
=item SNMP::Info::SONMP
|
||||
|
||||
=item SNMP::Info::RapidCity
|
||||
|
||||
=back
|
||||
|
||||
=head2 Required MIBs
|
||||
|
||||
=over
|
||||
|
||||
=item Inherited Classes' MIBs
|
||||
|
||||
See SNMP::Info for its own MIB requirements.
|
||||
|
||||
See SNMP::Info::Bridge for its own MIB requirements.
|
||||
|
||||
See SNMP::Info::NortelStack for its own MIB requirements.
|
||||
|
||||
See SNMP::Info::SONMP for its own MIB requirements.
|
||||
|
||||
See SNMP::Info::RapidCity for its own MIB requirements.
|
||||
|
||||
=back
|
||||
|
||||
=head1 GLOBALS
|
||||
|
||||
These are methods that return scalar value from SNMP
|
||||
|
||||
=over
|
||||
|
||||
=item $baystack->vendor()
|
||||
|
||||
Returns 'Nortel'
|
||||
|
||||
=item $baystack->model()
|
||||
|
||||
Cross references $baystack->id() to the 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 sreg- from the model name
|
||||
|
||||
=item $baystack->os()
|
||||
|
||||
Returns 'Baystack' or 'BoSS' depending on software version.
|
||||
|
||||
=item $baystack->os_bin()
|
||||
|
||||
Returns the firmware version extracted from B<sysDescr>.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Overrides
|
||||
|
||||
=over
|
||||
|
||||
=item $baystack->index_factor()
|
||||
|
||||
Required by SNMP::Info::SONMP. Number representing the number of ports
|
||||
reserved per slot within the device MIB.
|
||||
|
||||
Index factor on the Baystack switches are determined by the formula: Index
|
||||
Factor = 64 if (model = 470 or (os eq 'BoSS' and operating in pure mode))
|
||||
or else Index factor = 32.
|
||||
|
||||
Returns either 32 or 64 based upon the formula.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Globals imported from SNMP::Info
|
||||
|
||||
See documentation in SNMP::Info for details.
|
||||
|
||||
=head2 Globals imported from SNMP::Info::Bridge
|
||||
|
||||
See documentation in SNMP::Info::Bridge for details.
|
||||
|
||||
=head2 Globals imported from SNMP::Info::NortelStack
|
||||
|
||||
See documentation in SNMP::Info::NortelStack for details.
|
||||
|
||||
=head2 Global Methods imported from SNMP::Info::SONMP
|
||||
|
||||
See documentation in SNMP::Info::SONMP for details.
|
||||
|
||||
=head2 Global Methods imported from SNMP::Info::RapidCity
|
||||
|
||||
See documentation in SNMP::Info::RapidCity for details.
|
||||
|
||||
=head1 TABLE ENTRIES
|
||||
|
||||
These are methods that return tables of information in the form of a reference
|
||||
to a hash.
|
||||
|
||||
=head2 Overrides
|
||||
|
||||
=over
|
||||
|
||||
=item $baystack->interfaces()
|
||||
|
||||
Returns reference to the map between IID and physical Port.
|
||||
|
||||
Slot and port numbers on the Baystack switches are determined by the formula:
|
||||
|
||||
port = (Interface index % Index factor)
|
||||
slot = (int(Interface index / Index factor)) + Slot offset
|
||||
|
||||
The physical port name is returned as slot.port.
|
||||
|
||||
=item $baystack->i_ignore()
|
||||
|
||||
Returns reference to hash of IIDs to ignore.
|
||||
|
||||
=item $baystack->i_mac()
|
||||
|
||||
Returns the B<ifPhysAddress> table entries.
|
||||
|
||||
Removes all entries matching '00:00:00:00:00:00' -- Certain
|
||||
revisions of Baystack firmware report all zeros for each port mac.
|
||||
|
||||
=item $baystack->i_name()
|
||||
|
||||
Crosses ifName with ifAlias and returns the human set port name if exists.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info
|
||||
|
||||
See documentation in SNMP::Info for details.
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::Bridge
|
||||
|
||||
See documentation in SNMP::Info::Bridge for details.
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::NortelStack
|
||||
|
||||
See documentation in SNMP::Info::NortelStack for details.
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::SONMP
|
||||
|
||||
See documentation in SNMP::Info::SONMP for details.
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::RapidCity
|
||||
|
||||
See documentation in SNMP::Info::RapidCity for details.
|
||||
|
||||
=cut
|
||||
523
Info/Layer2/Centillion.pm
Normal file
523
Info/Layer2/Centillion.pm
Normal file
@@ -0,0 +1,523 @@
|
||||
# SNMP::Info::Layer2::Centillion
|
||||
# Eric Miller <eric@jeneric.org>
|
||||
#
|
||||
# Copyright (c) 2004 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::Centillion;
|
||||
$VERSION = 0.9;
|
||||
|
||||
use strict;
|
||||
|
||||
use Exporter;
|
||||
use SNMP::Info;
|
||||
use SNMP::Info::Bridge;
|
||||
use SNMP::Info::NortelStack;
|
||||
use SNMP::Info::SONMP;
|
||||
|
||||
@SNMP::Info::Layer2::Centillion::ISA = qw/SNMP::Info SNMP::Info::Bridge SNMP::Info::NortelStack SNMP::Info::SONMP Exporter/;
|
||||
@SNMP::Info::Layer2::Centillion::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::MIBS,
|
||||
%SNMP::Info::Bridge::MIBS,
|
||||
%SNMP::Info::NortelStack::MIBS,
|
||||
%SNMP::Info::SONMP::MIBS,
|
||||
'CENTILLION-DOT3-EXTENSIONS-MIB' => 'cnDot3ExtnTable',
|
||||
'S5-COMMON-STATS-MIB' => 's5CmStat',
|
||||
'CENTILLION-VLAN-MIB' => 'cnVlanENETMgt',
|
||||
'CENTILLION-CONFIG-MIB' => 'sysTFTPStart',
|
||||
);
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::GLOBALS,
|
||||
%SNMP::Info::Bridge::GLOBALS,
|
||||
%SNMP::Info::NortelStack::GLOBALS,
|
||||
%SNMP::Info::SONMP::GLOBALS,
|
||||
'tftp_action' => 'sysTFTPStart',
|
||||
'tftp_host' => 'sysTFTPIpAddress',
|
||||
'tftp_file' => 'sysTFTPFileName',
|
||||
'tftp_type' => 'sysTFTPFileType',
|
||||
'tftp_result' => 'sysTFTPResult',
|
||||
);
|
||||
|
||||
%FUNCS = (
|
||||
%SNMP::Info::FUNCS,
|
||||
%SNMP::Info::Bridge::FUNCS,
|
||||
%SNMP::Info::NortelStack::FUNCS,
|
||||
%SNMP::Info::SONMP::FUNCS,
|
||||
# CENTILLION-DOT3-EXTENSIONS-MIB::cnDot3ExtnTable
|
||||
'centillion_p_index' => 'cnDot3ExtnIfIndex',
|
||||
'centillion_p_duplex' => 'cnDot3ExtnIfOperConnectionType',
|
||||
'centillion_p_duplex_admin' => 'cnDot3ExtnIfAdminConnectionType',
|
||||
# S5-COMMON-STATS-MIB::s5CmSNodeTable
|
||||
'fw_mac' => 's5CmSNodeMacAddr',
|
||||
'fw_port' => 's5CmSNodeIfIndx',
|
||||
# CENTILLION-VLAN-MIB::cnVlanPortMemberTable
|
||||
'centillion_i_vlan_index' => 'cnVlanPortMemberIfIndex',
|
||||
'centillion_i_vlan' => 'cnVlanPortMemberVID',
|
||||
'centillion_i_vlan_type' => 'cnVlanPortMemberIngressType',
|
||||
);
|
||||
|
||||
%MUNGE = (
|
||||
# Inherit all the built in munging
|
||||
%SNMP::Info::MUNGE,
|
||||
%SNMP::Info::Bridge::MUNGE,
|
||||
%SNMP::Info::NortelStack::MUNGE,
|
||||
%SNMP::Info::SONMP::MUNGE,
|
||||
);
|
||||
|
||||
sub os {
|
||||
return 'centillion';
|
||||
}
|
||||
|
||||
sub vendor {
|
||||
return 'nortel';
|
||||
}
|
||||
|
||||
sub i_ignore {
|
||||
my $centillion = shift;
|
||||
my $descr = $centillion->i_description();
|
||||
|
||||
my %i_ignore;
|
||||
foreach my $if (keys %$descr){
|
||||
my $type = $descr->{$if};
|
||||
# Skip virtual interfaces
|
||||
$i_ignore{$if}++ if $type =~ /(VE|VID|vc|lp)/i;
|
||||
}
|
||||
return \%i_ignore;
|
||||
}
|
||||
|
||||
sub interfaces {
|
||||
my $centillion = shift;
|
||||
my $i_index = $centillion->i_index();
|
||||
my $i_descr = $centillion->i_description();
|
||||
|
||||
my %if;
|
||||
foreach my $iid (keys %$i_index){
|
||||
my $index = $i_index->{$iid};
|
||||
next unless defined $index;
|
||||
my $descr = $i_descr->{$iid};
|
||||
# Skip ATM and virtual interfaces
|
||||
next if $descr =~ /(VE|VID|vc|lp)/i;
|
||||
|
||||
# Index numbers are deterministic slot * 256 + port
|
||||
my $port = $index % 256;
|
||||
my $slot = int($index / 256);
|
||||
my $slotport = "$slot.$port";
|
||||
|
||||
$slotport = "$descr" if $descr =~ /(mcp)/i;
|
||||
|
||||
$if{$index} = $slotport;
|
||||
}
|
||||
|
||||
return \%if;
|
||||
}
|
||||
|
||||
sub i_duplex {
|
||||
my $centillion = shift;
|
||||
|
||||
my $port_index = $centillion->centillion_p_index();
|
||||
my $port_duplex = $centillion->centillion_p_duplex();
|
||||
|
||||
my %i_duplex;
|
||||
foreach my $iid (keys %$port_index){
|
||||
my $index = $port_index->{$iid};
|
||||
next unless defined $index;
|
||||
my $duplex = $port_duplex->{$iid};
|
||||
next unless defined $duplex;
|
||||
|
||||
$duplex = 'half' if $duplex =~ /half/i;
|
||||
$duplex = 'full' if $duplex =~ /full/i;
|
||||
$i_duplex{$index}=$duplex;
|
||||
}
|
||||
return \%i_duplex;
|
||||
}
|
||||
|
||||
sub i_duplex_admin {
|
||||
my $centillion = shift;
|
||||
|
||||
my $port_index = $centillion->centillion_p_index();
|
||||
my $port_admin = $centillion->centillion_p_duplex_admin();
|
||||
|
||||
my %i_duplex_admin;
|
||||
foreach my $iid (keys %$port_index){
|
||||
my $index = $port_index->{$iid};
|
||||
next unless defined $index;
|
||||
my $duplex = $port_admin->{$iid};
|
||||
next unless defined $duplex;
|
||||
|
||||
$duplex = 'half' if $duplex =~ /half/i;
|
||||
$duplex = 'full' if $duplex =~ /full/i;
|
||||
$duplex = 'auto' if $duplex =~ /auto/i;
|
||||
$i_duplex_admin{$index}=$duplex;
|
||||
}
|
||||
return \%i_duplex_admin;
|
||||
}
|
||||
|
||||
sub i_vlan {
|
||||
my $centillion = shift;
|
||||
|
||||
my $cn_vlan_index = $centillion->centillion_i_vlan_index();
|
||||
my $cn_vlan = $centillion->centillion_i_vlan();
|
||||
|
||||
my %i_vlan;
|
||||
foreach my $iid (keys %$cn_vlan_index){
|
||||
my $index = $cn_vlan_index->{$iid};
|
||||
next unless defined $index;
|
||||
my $vlan = $cn_vlan->{$iid};
|
||||
next unless defined $vlan;
|
||||
|
||||
$i_vlan{$index}=$vlan;
|
||||
}
|
||||
return \%i_vlan;
|
||||
}
|
||||
|
||||
sub model {
|
||||
my $centillion = shift;
|
||||
my $id = $centillion->id();
|
||||
return undef unless defined $id;
|
||||
my $model = &SNMP::translateObj($id);
|
||||
return $id unless defined $model;
|
||||
$model =~ s/^sreg-//i;
|
||||
|
||||
return '5000BH' if ($model =~ /5000BH/);
|
||||
return '5005BH' if ($model =~ /5005BH/);
|
||||
return 'C100' if ($model =~ /Centillion100/);
|
||||
return 'C50N' if ($model =~ /Centillion50N/);
|
||||
return 'C50T' if ($model =~ /Centillion50T/);
|
||||
return $model;
|
||||
}
|
||||
|
||||
sub bp_index {
|
||||
my $centillion = shift;
|
||||
my $index = $centillion->fw_port();
|
||||
|
||||
my %bp_index;
|
||||
foreach my $iid (keys %$index){
|
||||
my $b_index = $index->{$iid};
|
||||
next unless defined $b_index;
|
||||
|
||||
#Index value is the same as ifIndex
|
||||
$bp_index{$b_index} = $b_index;
|
||||
}
|
||||
|
||||
return \%bp_index;
|
||||
}
|
||||
|
||||
sub index_factor {
|
||||
return 256;
|
||||
}
|
||||
|
||||
sub slot_offset {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
SNMP::Info::Layer2::Centillion - SNMP Interface to Nortel Centillion based ATM Switches
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Eric Miller (C<eric@jeneric.org>)
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
# Let SNMP::Info determine the correct subclass for you.
|
||||
my $centillion = new SNMP::Info(
|
||||
AutoSpecify => 1,
|
||||
Debug => 1,
|
||||
# These arguments are passed directly on to SNMP::Session
|
||||
DestHost => 'myswitch',
|
||||
Community => 'public',
|
||||
Version => 2
|
||||
)
|
||||
or die "Can't connect to DestHost.\n";
|
||||
|
||||
my $class = $centillion->class();
|
||||
print "SNMP::Info determined this device to fall under subclass : $class\n";
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Provides abstraction to the configuration information obtainable from a
|
||||
Centillion 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 $centillion = new SNMP::Info::Layer2::centillion(...);
|
||||
|
||||
Note: This class supports version 4.X and 5.X which are VLAN based rather
|
||||
than bridge group based.
|
||||
|
||||
=head2 Inherited Classes
|
||||
|
||||
=over
|
||||
|
||||
=item SNMP::Info
|
||||
|
||||
=item SNMP::Info::Bridge
|
||||
|
||||
=item SNMP::Info::NortelStack
|
||||
|
||||
=item SNMP::Info::SONMP
|
||||
|
||||
=back
|
||||
|
||||
=head2 Required MIBs
|
||||
|
||||
=over
|
||||
|
||||
=item CENTILLION-DOT3-EXTENSIONS-MIB
|
||||
|
||||
=item S5-COMMON-STATS-MIB
|
||||
|
||||
=item CENTILLION-VLAN-MIB
|
||||
|
||||
=item CENTILLION-CONFIG-MIB
|
||||
|
||||
=item Inherited Classes' MIBs
|
||||
|
||||
See SNMP::Info for its own MIB requirements.
|
||||
|
||||
See SNMP::Info::Bridge for its own MIB requirements.
|
||||
|
||||
See SNMP::Info::NortelStack for its own MIB requirements.
|
||||
|
||||
See SNMP::Info::SONMP for its own MIB requirements.
|
||||
|
||||
=back
|
||||
|
||||
MIBs can be found on the CD that came with your product.
|
||||
|
||||
Or, they can be downloaded directly from Nortel Networks regardless of support
|
||||
contract status.
|
||||
|
||||
Go to http://www.nortelnetworks.com Techninal Support, Browse Technical Support,
|
||||
Select by Product Families, Centillion, Centillion C100-C50 ATM Speed Modules,
|
||||
Software. Filter on mibs and download the latest version's archive.
|
||||
|
||||
=head1 GLOBALS
|
||||
|
||||
These are methods that return scalar value from SNMP
|
||||
|
||||
=over
|
||||
|
||||
=item $centillion->vendor()
|
||||
|
||||
Returns 'Nortel'
|
||||
|
||||
=item $centillion->model()
|
||||
|
||||
Cross references $centillion->id() to the SYNOPTICS-MIB and returns
|
||||
the results.
|
||||
|
||||
Removes sreg- from the model name
|
||||
|
||||
=item $centillion->os()
|
||||
|
||||
Returns 'Centillion'
|
||||
|
||||
=item $centillion->tftp_action()
|
||||
|
||||
(B<sysTFTPStart>)
|
||||
|
||||
=item $centillion->tftp_host()
|
||||
|
||||
(B<sysTFTPIpAddress>)
|
||||
|
||||
=item $centillion->tftp_file()
|
||||
|
||||
(B<sysTFTPFileName>)
|
||||
|
||||
=item $centillion->tftp_type()
|
||||
|
||||
(B<sysTFTPFileType>)
|
||||
|
||||
=item $centillion->tftp_result()
|
||||
|
||||
(B<sysTFTPResult>)
|
||||
|
||||
=back
|
||||
|
||||
=head2 Overrides
|
||||
|
||||
=over
|
||||
|
||||
=item $centillion->layers()
|
||||
|
||||
Returns 00000011. Class emulates Layer 2 functionality through proprietary MIBs.
|
||||
|
||||
=item $centillion->index_factor()
|
||||
|
||||
Required by SNMP::Info::SONMP. Number representing the number of ports
|
||||
reserved per slot within the device MIB. Returns 256.
|
||||
|
||||
=item $centillion->slot_offset()
|
||||
|
||||
Required by SNMP::Info::SONMP. Offset if slot numbering does not
|
||||
start at 0. Returns 0.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Globals imported from SNMP::Info
|
||||
|
||||
See documentation in SNMP::Info for details.
|
||||
|
||||
=head2 Globals imported from SNMP::Info::Bridge
|
||||
|
||||
See documentation in SNMP::Info::Bridge for details.
|
||||
|
||||
=head2 Globals imported from SNMP::Info::NortelStack
|
||||
|
||||
See documentation in SNMP::Info::NortelStack for details.
|
||||
|
||||
=head2 Global Methods imported from SNMP::Info::SONMP
|
||||
|
||||
See documentation in SNMP::Info::SONMP for details.
|
||||
|
||||
=head1 TABLE ENTRIES
|
||||
|
||||
These are methods that return tables of information in the form of a reference
|
||||
to a hash.
|
||||
|
||||
=head2 Overrides
|
||||
|
||||
=over
|
||||
|
||||
=item $centillion->interfaces()
|
||||
|
||||
Returns reference to the map between IID and physical Port.
|
||||
|
||||
Slot and port numbers on the Passport switches are determined by the formula:
|
||||
port = index % 256
|
||||
slot = int(index / 256)
|
||||
|
||||
The physical port name is returned as slot.port.
|
||||
|
||||
=item $centillion->i_duplex()
|
||||
|
||||
Returns reference to map of IIDs to current link duplex
|
||||
|
||||
=item $centillion->i_duplex_admin()
|
||||
|
||||
Returns reference to hash of IIDs to admin duplex setting
|
||||
|
||||
=item $centillion->i_ignore()
|
||||
|
||||
Returns reference to hash of IIDs to ignore.
|
||||
|
||||
=item $centillion->fw_mac()
|
||||
|
||||
(B<s5CmSNodeMacAddr>)
|
||||
|
||||
=item $centillion->fw_port()
|
||||
|
||||
(B<s5CmSNodeIfIndx>)
|
||||
|
||||
=item $centillion->bp_index()
|
||||
|
||||
Returns a mapping between ifIndex and the Bridge Table.
|
||||
|
||||
=item $centillion->i_vlan()
|
||||
|
||||
Returns a mapping between ifIndex and the VLAN.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Centillion 802.3 Extension Table (B<cnDot3ExtnTable>)
|
||||
|
||||
=over
|
||||
|
||||
=item $centillion->centillion_p_index()
|
||||
|
||||
Returns reference to hash. Maps table IIDs to Interface IIDs
|
||||
|
||||
(B<cnDot3ExtnIfIndex>)
|
||||
|
||||
=item $centillion->centillion_p_duplex()
|
||||
|
||||
Returns reference to hash. Maps port operational duplexes to IIDs
|
||||
|
||||
(B<cnDot3ExtnIfOperConnectionType>)
|
||||
|
||||
=item $centillion->rc_centillion_p_duplex_admin()
|
||||
|
||||
Returns reference to hash. Maps port admin duplexes to IIDs
|
||||
|
||||
(B<cnDot3ExtnIfAdminConnectionType>)
|
||||
|
||||
=back
|
||||
|
||||
=head2 Centillion VLAN Table (B<cnVlanPortMemberTable>)
|
||||
|
||||
=over
|
||||
|
||||
=item $centillion->centillion_i_vlan_index()
|
||||
|
||||
Returns reference to hash. Key: Table entry, Value: Index
|
||||
|
||||
(B<cnVlanPortMemberIfIndex>)
|
||||
|
||||
=item $centillion->centillion_i_vlan()
|
||||
|
||||
Returns reference to hash. Key: Table entry, Value: VLAN ID
|
||||
|
||||
(B<cnVlanPortMemberVID>)
|
||||
|
||||
=item $centillion->centillion_i_vlan_type()
|
||||
|
||||
Returns reference to hash. Key: Table entry, Value: VLAN Type
|
||||
|
||||
(B<cnVlanPortMemberIngressType>)
|
||||
|
||||
=back
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info
|
||||
|
||||
See documentation in SNMP::Info for details.
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::Bridge
|
||||
|
||||
See documentation in SNMP::Info::Bridge for details.
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::NortelStack
|
||||
|
||||
See documentation in SNMP::Info::NortelStack for details.
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::SONMP
|
||||
|
||||
See documentation in SNMP::Info::SONMP for details.
|
||||
|
||||
=cut
|
||||
502
Info/Layer2/NAP222x.pm
Normal file
502
Info/Layer2/NAP222x.pm
Normal file
@@ -0,0 +1,502 @@
|
||||
# SNMP::Info::Layer2::NAP222x
|
||||
# Eric Miller <eric@jeneric.org>
|
||||
#
|
||||
# Copyright (c) 2004 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::NAP222x;
|
||||
$VERSION = 0.9;
|
||||
use strict;
|
||||
|
||||
use Exporter;
|
||||
use SNMP::Info;
|
||||
use SNMP::Info::Bridge;
|
||||
use SNMP::Info::SONMP;
|
||||
|
||||
@SNMP::Info::Layer2::NAP222x::ISA = qw/SNMP::Info SNMP::Info::Bridge SNMP::Info::SONMP Exporter/;
|
||||
@SNMP::Info::Layer2::NAP222x::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::MIBS,
|
||||
%SNMP::Info::Bridge::MIBS,
|
||||
%SNMP::Info::SONMP::MIBS,
|
||||
'NORTEL-WLAN-AP-MIB' => 'ntWlanSwHardwareVer',
|
||||
);
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::GLOBALS,
|
||||
%SNMP::Info::Bridge::GLOBALS,
|
||||
%SNMP::Info::SONMP::GLOBALS,
|
||||
'nt_hw_ver' => 'ntWlanSwHardwareVer',
|
||||
'nt_fw_ver' => 'ntWlanSwBootRomVer',
|
||||
'nt_sw_ver' => 'ntWlanSwOpCodeVer',
|
||||
'nt_cc' => 'ntWlanSwCountryCode',
|
||||
'tftp_action' => 'ntWlanTransferStart',
|
||||
'tftp_host' => 'ntWlanFileServer',
|
||||
'tftp_file' => 'ntWlanDestFile',
|
||||
'tftp_type' => 'ntWlanFileType',
|
||||
'tftp_result' => 'ntWlanFileTransferStatus',
|
||||
'tftp_xtype' => 'ntWlanTransferType',
|
||||
'tftp_src_file' => 'ntWlanSrcFile',
|
||||
'ftp_user' => 'ntWlanUserName',
|
||||
'ftp_pass' => 'ntWlanPassword',
|
||||
);
|
||||
|
||||
%FUNCS = (
|
||||
%SNMP::Info::FUNCS,
|
||||
%SNMP::Info::Bridge::FUNCS,
|
||||
%SNMP::Info::SONMP::FUNCS,
|
||||
'i_name2' => 'ifName',
|
||||
'bp_index_2' => 'dot1dTpFdbPort',
|
||||
# From ntWlanPortTable
|
||||
'nt_prt_name' => 'ntWlanPortName',
|
||||
'nt_dpx_admin' => 'ntWlanPortCapabilities',
|
||||
'nt_auto' => 'ntWlanPortAutonegotiation',
|
||||
'nt_dpx' => 'ntWlanPortSpeedDpxStatus',
|
||||
);
|
||||
|
||||
%MUNGE = (
|
||||
%SNMP::Info::MUNGE,
|
||||
%SNMP::Info::Bridge::MUNGE,
|
||||
%SNMP::Info::SONMP::MUNGE,
|
||||
);
|
||||
|
||||
sub os {
|
||||
return 'nortel';
|
||||
}
|
||||
|
||||
sub os_ver {
|
||||
my $nap222x = shift;
|
||||
my $ver = $nap222x->nt_sw_ver();
|
||||
return undef unless defined $ver;
|
||||
|
||||
if ($ver =~ m/(\d+\.\d+\.\d+\.\d+)/){
|
||||
return $1;
|
||||
}
|
||||
return undef;
|
||||
}
|
||||
|
||||
sub os_bin {
|
||||
my $nap222x = shift;
|
||||
my $bin = $nap222x->nt_fw_ver();
|
||||
return undef unless defined $bin;
|
||||
|
||||
if ($bin =~ m/(\d+\.\d+\.\d+)/){
|
||||
return $1;
|
||||
}
|
||||
return undef;
|
||||
}
|
||||
|
||||
sub vendor {
|
||||
return 'nortel';
|
||||
}
|
||||
|
||||
sub model {
|
||||
my $nap222x = shift;
|
||||
my $descr = $nap222x->description();
|
||||
return undef unless defined $descr;
|
||||
|
||||
return 'AP-2220' if ($descr =~ /2220/);
|
||||
return 'AP-2221' if ($descr =~ /2221/);
|
||||
return 'AP-2225' if ($descr =~ /2225/);
|
||||
return undef;
|
||||
}
|
||||
|
||||
sub mac {
|
||||
my $nap222x = shift;
|
||||
my $i_mac = $nap222x->i_mac();
|
||||
|
||||
# Return Interface MAC
|
||||
foreach my $entry (keys %$i_mac){
|
||||
my $sn = $i_mac->{$entry};
|
||||
next unless $sn;
|
||||
return $sn;
|
||||
}
|
||||
return undef;
|
||||
}
|
||||
|
||||
sub serial {
|
||||
my $nap222x = shift;
|
||||
my $i_mac = $nap222x->i_mac();
|
||||
|
||||
# Return Interface MAC
|
||||
foreach my $entry (keys %$i_mac){
|
||||
my $sn = $i_mac->{$entry};
|
||||
next unless $sn;
|
||||
return $sn;
|
||||
}
|
||||
return undef;
|
||||
}
|
||||
|
||||
sub i_ignore {
|
||||
my $nap222x = shift;
|
||||
my $descr = $nap222x->i_description();
|
||||
|
||||
my %i_ignore;
|
||||
foreach my $if (keys %$descr){
|
||||
my $type = $descr->{$if};
|
||||
# Skip virtual interfaces
|
||||
$i_ignore{$if}++ if $type =~ /(loopback|lo|other)/i;
|
||||
}
|
||||
return \%i_ignore;
|
||||
}
|
||||
|
||||
sub interfaces {
|
||||
my $nap222x = shift;
|
||||
my $interfaces = $nap222x->i_index();
|
||||
my $description = $nap222x->i_description();
|
||||
|
||||
my %interfaces = ();
|
||||
foreach my $iid (keys %$interfaces){
|
||||
my $desc = $description->{$iid};
|
||||
next unless defined $desc;
|
||||
next if $desc =~ /lo/i;
|
||||
|
||||
$interfaces{$iid} = $desc;
|
||||
}
|
||||
return \%interfaces;
|
||||
}
|
||||
|
||||
sub i_duplex {
|
||||
my $nap222x = shift;
|
||||
|
||||
my $mode = $nap222x->nt_dpx();
|
||||
my $port_name = $nap222x->nt_prt_name();
|
||||
my $interfaces = $nap222x->interfaces();
|
||||
|
||||
my %i_duplex;
|
||||
foreach my $if (keys %$interfaces){
|
||||
my $port = $interfaces->{$if};
|
||||
next unless $port =~ /dp/i;
|
||||
foreach my $idx (keys %$mode) {
|
||||
my $name = $port_name->{$idx}||'unknown';
|
||||
next unless $name eq $port;
|
||||
my $duplex = $mode->{$idx};
|
||||
|
||||
$duplex = 'other' unless defined $duplex;
|
||||
$duplex = 'half' if $duplex =~ /half/i;
|
||||
$duplex = 'full' if $duplex =~ /full/i;
|
||||
|
||||
$i_duplex{$if}=$duplex;
|
||||
}
|
||||
}
|
||||
return \%i_duplex;
|
||||
}
|
||||
|
||||
sub i_duplex_admin {
|
||||
my $nap222x = shift;
|
||||
|
||||
my $dpx_admin = $nap222x->nt_dpx_admin();
|
||||
my $nt_auto = $nap222x->nt_auto();
|
||||
my $interfaces = $nap222x->interfaces();
|
||||
my $port_name = $nap222x->nt_prt_name();
|
||||
|
||||
my %i_duplex_admin;
|
||||
foreach my $if (keys %$interfaces){
|
||||
my $port = $interfaces->{$if};
|
||||
next unless $port =~ /dp/i;
|
||||
foreach my $idx (keys %$dpx_admin) {
|
||||
my $name = $port_name->{$idx}||'unknown';
|
||||
next unless $name eq $port;
|
||||
my $duplex = $dpx_admin->{$idx};
|
||||
my $auto = $nt_auto->{$idx};
|
||||
|
||||
$duplex = 'other' unless defined $duplex;
|
||||
$duplex = 'half' if ($duplex =~ /half/i and $auto =~ /disabled/i);
|
||||
$duplex = 'full' if ($duplex =~ /full/i and $auto =~ /disabled/i);
|
||||
$duplex = 'auto' if $auto =~ /enabled/i;
|
||||
|
||||
$i_duplex_admin{$if}=$duplex;
|
||||
}
|
||||
}
|
||||
return \%i_duplex_admin;
|
||||
}
|
||||
|
||||
sub i_name {
|
||||
my $nap222x = shift;
|
||||
my $interfaces = $nap222x->interfaces();
|
||||
|
||||
my %i_name;
|
||||
foreach my $if (keys %$interfaces){
|
||||
my $desc = $interfaces->{$if};
|
||||
next unless defined $desc;
|
||||
|
||||
my $name = 'unknown';
|
||||
$name = 'Ethernet Interface' if $desc =~ /dp/i;
|
||||
$name = 'Wireless Interface B' if $desc =~ /ndc/i;
|
||||
$name = 'Wireless Interface A' if $desc =~ /ar/i;
|
||||
|
||||
$i_name{$if} = $name;
|
||||
}
|
||||
return \%i_name;
|
||||
}
|
||||
|
||||
# dot1dBasePortTable does not exist and dot1dTpFdbPort does not map to ifIndex
|
||||
sub bp_index {
|
||||
my $nap222x = shift;
|
||||
my $interfaces = $nap222x->interfaces();
|
||||
|
||||
my %bp_index;
|
||||
foreach my $iid (keys %$interfaces){
|
||||
my $desc = $interfaces->{$iid};
|
||||
next unless defined $desc;
|
||||
next unless $desc =~ /(ndc|ar)/i;
|
||||
|
||||
my $port = 1;
|
||||
$port = 2 if $desc =~ /ndc/i;
|
||||
|
||||
$bp_index{$port} = $iid;
|
||||
}
|
||||
return \%bp_index;
|
||||
}
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
SNMP::Info::Layer2::nap222x - SNMP Interface to Nortel 2220 Series Access Points
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Eric Miller (C<eric@jeneric.org>)
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
# Let SNMP::Info determine the correct subclass for you.
|
||||
my $nap222x = new SNMP::Info(
|
||||
AutoSpecify => 1,
|
||||
Debug => 1,
|
||||
# These arguments are passed directly on to SNMP::Session
|
||||
DestHost => 'myswitch',
|
||||
Community => 'public',
|
||||
Version => 2
|
||||
)
|
||||
or die "Can't connect to DestHost.\n";
|
||||
|
||||
my $class = $nap222x->class();
|
||||
print "SNMP::Info determined this device to fall under subclass : $class\n";
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Provides abstraction to the configuration information obtainable from a Nortel
|
||||
2220 series wireless Access Points 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 $nap222x = new SNMP::Info::Layer2::nap222x(...);
|
||||
|
||||
=head2 Inherited Classes
|
||||
|
||||
=over
|
||||
|
||||
=item SNMP::Info
|
||||
|
||||
=item SNMP::Info::Bridge
|
||||
|
||||
=item SNMP::Info::SONMP
|
||||
|
||||
=back
|
||||
|
||||
=head2 Required MIBs
|
||||
|
||||
=over
|
||||
|
||||
=item NORTEL-WLAN-AP-MIB
|
||||
|
||||
=item Inherited classes
|
||||
|
||||
See SNMP::Info for its own MIB requirements.
|
||||
|
||||
See SNMP::Info::Bridge for its own MIB requirements.
|
||||
|
||||
See SNMP::Info::SONMP for its own MIB requirements.
|
||||
|
||||
=back
|
||||
|
||||
MIBs can be found on the CD that came with your product.
|
||||
|
||||
Or, they can be downloaded directly from Nortel Networks regardless of support
|
||||
contract status.
|
||||
|
||||
Go to http://www.nortelnetworks.com Techninal Support, Browse Technical Support,
|
||||
Select by Product Families, Wireless LAN, WLAN - Access Point 2220, Software.
|
||||
Filter on mibs and download the latest version's archive.
|
||||
|
||||
=head1 GLOBALS
|
||||
|
||||
These are methods that return scalar value from SNMP
|
||||
|
||||
=over
|
||||
|
||||
=item $nap222x->vendor()
|
||||
|
||||
Returns 'Nortel'
|
||||
|
||||
=item $nap222x->model()
|
||||
|
||||
Returns the model extracted from B<sysDescr>.
|
||||
|
||||
=item $nap222x->os()
|
||||
|
||||
Returns 'Nortel'
|
||||
|
||||
=item $nap222x->os_ver()
|
||||
|
||||
Returns the software version extracted from B<ntWlanSwOpCodeVer>.
|
||||
|
||||
=item $nap222x->os_bin()
|
||||
|
||||
Returns the firmware version extracted from B<ntWlanSwBootRomVer>.
|
||||
|
||||
=item $nap222x->mac()
|
||||
|
||||
Returns the MAC address of the first Ethernet Interface.
|
||||
|
||||
=item $nap222x->serial()
|
||||
|
||||
Returns the MAC address of the first Ethernet Interface.
|
||||
|
||||
=item $nap222x->nt_hw_ver()
|
||||
|
||||
Returns the hardware version.
|
||||
|
||||
B<ntWlanSwHardwareVer>
|
||||
|
||||
=item $nap222x->nt_cc()
|
||||
|
||||
Returns the country code of the AP.
|
||||
|
||||
B<ntWlanSwHardwareVer>
|
||||
|
||||
=item $nap222x->tftp_action()
|
||||
|
||||
B<ntWlanTransferStart>
|
||||
|
||||
=item $nap222x->tftp_host()
|
||||
|
||||
B<ntWlanFileServer>
|
||||
|
||||
=item $nap222x->tftp_file()
|
||||
|
||||
B<ntWlanDestFile>
|
||||
|
||||
=item $nap222x->tftp_type()
|
||||
|
||||
B<ntWlanFileType>
|
||||
|
||||
=item $nap222x->tftp_result()
|
||||
|
||||
B<ntWlanFileTransferStatus>
|
||||
|
||||
=item $nap222x->tftp_xtype()
|
||||
|
||||
B<ntWlanTransferType>
|
||||
|
||||
=item $nap222x->tftp_src_file()
|
||||
|
||||
B<ntWlanSrcFile>
|
||||
|
||||
=item $nap222x->ftp_user()
|
||||
|
||||
B<ntWlanUserName>
|
||||
|
||||
=item $nap222x->ftp_pass()
|
||||
|
||||
B<ntWlanPassword>
|
||||
|
||||
=back
|
||||
|
||||
=head2 Globals imported from SNMP::Info
|
||||
|
||||
See documentation in SNMP::Info for details.
|
||||
|
||||
=head2 Globals imported from SNMP::Info::Bridge
|
||||
|
||||
See documentation in SNMP::Info::Bridge for details.
|
||||
|
||||
=head2 Global Methods imported from SNMP::Info::SONMP
|
||||
|
||||
See documentation in SNMP::Info::SONMP for details.
|
||||
|
||||
=head1 TABLE ENTRIES
|
||||
|
||||
These are methods that return tables of information in the form of a reference
|
||||
to a hash.
|
||||
|
||||
=head2 Overrides
|
||||
|
||||
=over
|
||||
|
||||
=item $nap222x->interfaces()
|
||||
|
||||
Returns reference to map of IIDs to physical ports.
|
||||
|
||||
=item $nap222x->i_ignore()
|
||||
|
||||
Returns reference to hash of IIDs to ignore.
|
||||
|
||||
=item $nap222x->i_duplex()
|
||||
|
||||
Returns reference to hash. Maps port operational duplexes to IIDs.
|
||||
|
||||
B<ntWlanPortSpeedDpxStatus>
|
||||
|
||||
=item $nap222x->i_duplex_admin()
|
||||
|
||||
Returns reference to hash. Maps port admin duplexes to IIDs.
|
||||
|
||||
B<ntWlanPortCapabilities>
|
||||
|
||||
=item $nap222x->i_name()
|
||||
|
||||
Returns a human name based upon port description.
|
||||
|
||||
=item $nap222x->bp_index()
|
||||
|
||||
Returns a mapping between ifIndex and the Bridge Table. This does not exist in
|
||||
the MIB and bridge port index is not the same as ifIndex so it is created.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info
|
||||
|
||||
See documentation in SNMP::Info for details.
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::Bridge
|
||||
|
||||
See documentation in SNMP::Info::Bridge for details.
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::SONMP
|
||||
|
||||
See documentation in SNMP::Info::SONMP for details.
|
||||
|
||||
=cut
|
||||
280
Info/Layer2/Orinoco.pm
Normal file
280
Info/Layer2/Orinoco.pm
Normal file
@@ -0,0 +1,280 @@
|
||||
# SNMP::Info::Layer2::Orinoco
|
||||
# Eric Miller <eric@jeneric.org>
|
||||
#
|
||||
# Copyright (c) 2004 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::Orinoco;
|
||||
$VERSION = 0.9;
|
||||
use strict;
|
||||
|
||||
use Exporter;
|
||||
use SNMP::Info;
|
||||
use SNMP::Info::Bridge;
|
||||
|
||||
@SNMP::Info::Layer2::Orinoco::ISA = qw/SNMP::Info SNMP::Info::Bridge Exporter/;
|
||||
@SNMP::Info::Layer2::Orinoco::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::MIBS,
|
||||
%SNMP::Info::Bridge::MIBS,
|
||||
);
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::GLOBALS,
|
||||
%SNMP::Info::Bridge::GLOBALS,
|
||||
);
|
||||
|
||||
%FUNCS = (
|
||||
%SNMP::Info::FUNCS,
|
||||
%SNMP::Info::Bridge::FUNCS,
|
||||
);
|
||||
|
||||
%MUNGE = (
|
||||
%SNMP::Info::MUNGE,
|
||||
%SNMP::Info::Bridge::MUNGE,
|
||||
);
|
||||
|
||||
sub os {
|
||||
return 'orinoco';
|
||||
}
|
||||
|
||||
sub os_ver {
|
||||
my $orinoco = shift;
|
||||
my $descr = $orinoco->description();
|
||||
return undef unless defined $descr;
|
||||
|
||||
if ($descr =~ m/V(\d+\.\d+)/){
|
||||
return $1;
|
||||
}
|
||||
if ($descr =~ m/v(\d+\.\d+\.\d+)/){
|
||||
return $1;
|
||||
}
|
||||
|
||||
return undef;
|
||||
}
|
||||
|
||||
sub os_bin {
|
||||
my $orinoco = shift;
|
||||
my $descr = $orinoco->description();
|
||||
return undef unless defined $descr;
|
||||
|
||||
if ($descr =~ m/V(\d+\.\d+)$/){
|
||||
return $1;
|
||||
}
|
||||
if ($descr =~ m/v(\d+\.\d+\.\d+)$/){
|
||||
return $1;
|
||||
}
|
||||
|
||||
return undef;
|
||||
}
|
||||
|
||||
sub vendor {
|
||||
return 'Proxim';
|
||||
}
|
||||
|
||||
sub model {
|
||||
my $orinoco = shift;
|
||||
my $descr = $orinoco->description();
|
||||
return undef unless defined $descr;
|
||||
|
||||
return 'AP-1000' if ($descr =~ /AP-1000/);
|
||||
return 'AP-2000' if ($descr =~ /AP-2000/);
|
||||
return 'WavePOINT-II' if ($descr =~ /WavePOINT-II/);
|
||||
return undef;
|
||||
}
|
||||
|
||||
sub serial {
|
||||
my $orinoco = shift;
|
||||
my $descr = $orinoco->description();
|
||||
return undef unless defined $descr;
|
||||
|
||||
$descr = $1 if $descr =~ /SN-(\S+)/;
|
||||
return $descr;
|
||||
}
|
||||
|
||||
sub i_ignore {
|
||||
my $orinoco = shift;
|
||||
my $descr = $orinoco->i_description();
|
||||
|
||||
my %i_ignore;
|
||||
foreach my $if (keys %$descr){
|
||||
my $type = $descr->{$if};
|
||||
# Skip virtual interfaces
|
||||
$i_ignore{$if}++ if $type =~ /(lo|empty|PCMCIA)/i;
|
||||
}
|
||||
return \%i_ignore;
|
||||
}
|
||||
|
||||
sub interfaces {
|
||||
my $orinoco = shift;
|
||||
my $interfaces = $orinoco->i_index();
|
||||
my $descriptions = $orinoco->i_description();
|
||||
|
||||
my %interfaces = ();
|
||||
foreach my $iid (keys %$interfaces){
|
||||
my $desc = $descriptions->{$iid};
|
||||
next unless defined $desc;
|
||||
next if $desc =~ /(lo|empty|PCMCIA)/i;
|
||||
|
||||
$desc = 'AMD' if $desc =~ /AMD/;
|
||||
|
||||
$interfaces{$iid} = $desc;
|
||||
}
|
||||
return \%interfaces;
|
||||
}
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
SNMP::Info::Layer2::Orinoco - SNMP Interface to Orinoco Series Access Points
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Eric Miller (C<eric@jeneric.org>)
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
# Let SNMP::Info determine the correct subclass for you.
|
||||
my $orinoco = new SNMP::Info(
|
||||
AutoSpecify => 1,
|
||||
Debug => 1,
|
||||
# These arguments are passed directly on to SNMP::Session
|
||||
DestHost => 'myswitch',
|
||||
Community => 'public',
|
||||
Version => 2
|
||||
)
|
||||
or die "Can't connect to DestHost.\n";
|
||||
|
||||
my $class = $orinoco->class();
|
||||
print "SNMP::Info determined this device to fall under subclass : $class\n";
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Provides abstraction to the configuration information obtainable from a Orinoco
|
||||
Access Point 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 $orinoco = new SNMP::Info::Layer2::Orinoco(...);
|
||||
|
||||
=head2 Inherited Classes
|
||||
|
||||
=over
|
||||
|
||||
=item SNMP::Info
|
||||
|
||||
=item SNMP::Info::Bridge
|
||||
|
||||
=back
|
||||
|
||||
=head2 Required MIBs
|
||||
|
||||
=over
|
||||
|
||||
=item Inherited classes
|
||||
|
||||
See SNMP::Info for its own MIB requirements.
|
||||
|
||||
See SNMP::Info::Bridge for its own MIB requirements.
|
||||
|
||||
=back
|
||||
|
||||
=head1 GLOBALS
|
||||
|
||||
These are methods that return scalar value from SNMP
|
||||
|
||||
=over
|
||||
|
||||
=item $orinoco->vendor()
|
||||
|
||||
Returns 'Proxim' :)
|
||||
|
||||
=item $orinoco->model()
|
||||
|
||||
Returns the model extracted from B<sysDescr>.
|
||||
|
||||
=item $orinoco->os()
|
||||
|
||||
Returns 'Orinoco'
|
||||
|
||||
=item $orinoco->os_ver()
|
||||
|
||||
Returns the software version extracted from B<sysDescr>.
|
||||
|
||||
=item $orinoco->os_bin()
|
||||
|
||||
Returns the firmware version extracted from B<sysDescr>.
|
||||
|
||||
=item $orinoco->serial()
|
||||
|
||||
Returns the serial number extracted from B<sysDescr>.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Globals imported from SNMP::Info
|
||||
|
||||
See documentation in SNMP::Info for details.
|
||||
|
||||
=head2 Globals imported from SNMP::Info::Bridge
|
||||
|
||||
See documentation in SNMP::Info::Bridge for details.
|
||||
|
||||
=head1 TABLE ENTRIES
|
||||
|
||||
These are methods that return tables of information in the form of a reference
|
||||
to a hash.
|
||||
|
||||
=head2 Overrides
|
||||
|
||||
=over
|
||||
|
||||
=item $orinoco->interfaces()
|
||||
|
||||
Returns reference to map of IIDs to physical ports.
|
||||
|
||||
=item $orinoco->i_ignore()
|
||||
|
||||
Returns reference to hash of IIDs to ignore.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info
|
||||
|
||||
See documentation in SNMP::Info for details.
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::Bridge
|
||||
|
||||
See documentation in SNMP::Info::Bridge for details.
|
||||
|
||||
=cut
|
||||
Reference in New Issue
Block a user