Compare commits

..

1 Commits

Author SHA1 Message Date
cvs2svn
a0a8b77f7a This commit was manufactured by cvs2svn to create tag 'ver_0_9'.
Sprout from master 2004-11-16 01:42:32 UTC Max Baker 'prep'
Cherrypick from master 2004-10-28 21:53:15 UTC Max Baker 'added RCS id tag and rev'd all version numbers to 0.9':
    Info/Layer2/Baystack.pm
2004-11-16 01:42:33 +00:00
58 changed files with 1373 additions and 6261 deletions

View File

@@ -1,73 +1,6 @@
SNMP::Info - Friendly OO-style interface to Network devices using SNMP.
ChangeLog $Id$
version 1.03 (04/14/06) - Beta/developer release
* Use ipNetToMedia table instead of atTable for ARP
* Remove CiscoStack from Layer3::C4000
* Fixed bug in MAU class when polling devices without MAU-MIB support
version 1.01 (04/08/06) - Beta/developer release
+ Change version numbers to X.XX format. Odd releases are beta
or developer only releases. Even are official releases.
version 1.0 (04/07/06) - CVS only. No official release
+ Added Interface FlowControl status to CiscoStack (Nicolai Petri)
+ Added CiscoImage class (Matthew Tuttle)
+ Added C1200 and C350 IOS devices to L2::Aironet (Matthew Tuttle)
+ Added support for Foundry IronWare and gave L3::Foundry CPR
+ Added support for Foundry EdgeIrons as new class L2::Foundry
+ Added BulkWalk and BulkRepeaters options to new()
+ Added DebugSNMP option to new()
+ Added CISCO-ENTITY-VENDORTYPE-OID-MIB,CISCO-PRODUCTS-MIB,CISCO-STACK-MIB
to CiscoStats.pm for model()
+ Check for bulkwalk_no() method
+ Added Entity.pm to L3 and L2 classes per N. Petri's suggestion.
+ Added support for Passport/Accelar 1100 and 1200 series in L3::Passport
+ Added support for Passport/Accelar 8100 series in L3::Passport
+ Added support for Passport 1600 series as new class, L3::N1600
+ Added support for Extreme Alpine and Summit switches as new class
L3:Extreme (Mike Hunter and Eric Miller)
+ Added support for Aruba wireless switches (Eric Miller and Brian Chow)
+ Added support for Nortel 2700 series (Airespace) wireless switches
+ Added support for Synoptics hubs as new class L1:S3000
+ Added Cisco QOS and RTT classes (Alexander Hartmaier)
+ Added BGP Peer Table to L3 class (Carlos Vicente)
+ Added ipforwarding status to Info base class (Carlos Vicente)
+ Added STP port state to Bridge class (Alexander Barthel)
+ Added L3 support (arpnip) to Baystack class for routing capable switches
+ Added set_i_duplex_admin() and set_i_speed_admin() to C2900 class (Justin Hunter)
+ Added set_i_duplex_admin() and set_i_speed_admin() to CiscoStack class
+ CDP added to Aironet class
+ Added Juniper class
+ Added support for Catalyst 4000 and 4500, get admin. duplex
and speed properly
+ Added i_speed_high(), which i_speed() uses if needed to support
interfaces >4Gbps
* More error checking in _load_attr() around bulkwalk code
* Minor warning fix in L3::Aironet::os_ver()
* Abstracted remaining Cisco stuff from L3 to L3::Cisco
* Removed all Cisco stuff from L2
* Expanded Entity.pm to cover the whole ENTITY-MIB and improved docs.
* changed all refs to $DEBUG to $self->debug() for reentrant code
* [ 1111284 ] Parameters not being set with AutoSpecify - fixed.
* Turned off BULKWALK for C1900 and C6500 classes.
* Added exception handling for V2 ENDOFMIBVIEW
* Fix in SONMP when topology not enabled
* Fix in L3::Passport root_ip()
* Fix in L3::Passport bp_index() some devices not returning complete index.
* Enable set_i_up_admin() in Bayhub
* Recognize new Nortel model names in Baystack and Passport classes
* Orinoco class should now recognize more models
* Cleanup model recognition in Baystack class, recognize more models
* Modify Catalyst class to use CISCO-STACK-MIB for brige port index mapping
some devices having problems returning complete index from BRIDGE-MIB
* Check root ip for reachability before assignment
* HP class should recognize more models
* Fix in HP class for models not returning full bp_index
* [ 1436103 ] L2::Aironet devices weren't getting their model
translated properly
verison 0.9 (11/15/04)
+ ** Added full Nortel/Bay/BayStack support
by new developer Eric Miller.
@@ -89,7 +22,7 @@ verison 0.9 (11/15/04)
* Changed so a failed _global() call is cached so it won't retry
an error over and over again if the same global is used.
* Added check in _set() to see if data came from sub or FUNCS/GLOBALS
Fails if came from sub.
Fails if came from sub.
version 0.8 (03/21/04)
+ Added Q-BRIDGE-MIB support to SNMP::Info::Bridge

View File

@@ -4,7 +4,7 @@
# This file is meant to detail the cababilities
# of network devices to supply data via SNMP.
# $Id$
# $Id: DeviceMatrix.txt,Modified by Eric Miller 10/17/2004
# Allied
device-vendor: Allied Telesyn
@@ -24,19 +24,6 @@ class: Layer2::Allied
ver: 2
macsuck: yes
# Aruba
device-vendor: Aruba
device-family: Aruba Wireless Controllers
arpnip: no
macsuck: yes
portmac: yes
duplex: no
class: Layer2::Aruba
note: Uses proprietary MIBs to provide MAC to port mapping. APs appear as switch ports.
device: 5000
# Asante
device-vendor: Asante
@@ -147,8 +134,6 @@ device-family: Catalyst 1900
note: !Upgrade older (pre 9.0) versions of CatOS
note: !CatOS ver 9.00.03 through 9.00.06 have problems when trunking. Upgrade to 9.00.07 or higher.
ver: 1
duplex: both
vlan: write
class: Layer2::C1900
device: wsc1900c
@@ -160,9 +145,7 @@ device-family: Catalyst 1900
device-family: Catalyst 2900
note: IOS
macsuck: vlan
duplex: write
vlan: write
class: Layer2::C2900
class: Layer3::C2900
portmac: yes
note: !Pre IOS 11.2 (8) SA3 - PortMAC shows up in CAM table.
@@ -173,35 +156,22 @@ device: 2912MfXL
device: 2924MXL
ver: 1
portmac: yes
device: 2924CXL
device: 2924CXLv
device-family: Catalyst 2940
note: IOS
macsuck: vlan
duplex: write
vlan: write
class: Layer2::C2900
portmac: yes
device-family: Catlayst 2940
device: 2940-8TT
device-family: Catalyst 2950
note: IOS
macsuck: vlan
duplex: write
vlan: write
class: Layer2::C2900
portmac: yes
device: 2950-t24
device-family: Catalyst 2970
macsuck:vlan
duplex: write
vlan: write
note: Acts just like IOS Catalyst 6500 series
class: Layer3::C6500
@@ -210,8 +180,6 @@ device: 2970G-24T-E
device-family: Catalyst 3500 XL
portmac: yes
macsuck: vlan
duplex: write
vlan: write
note: L2 only IOS devices - Just like Catalyst 2900 series from SNMP
note: IOS Version 12.0(5)XP is buggy and doesn't do VLAN Community indexing correctly.
class: Layer2::C2900
@@ -224,8 +192,7 @@ device: 3548XL
device-family: Catalyst 3550
macsuck: vlan
duplex: write
vlan: write
duplex: both
class: Layer3::C3550
note: Run IOS
note: Has VLANs that don't accept SNMP connections. Don't know if they are standard (by name or number).
@@ -244,41 +211,26 @@ macsuck: vlan
device-family: Catalyst 3750
class: Layer3::C6500
device: 3750
device-family: Catalyst 4000
duplex: write
duplex: both
macsuck: vlan
vlan: write
class: Layer2::Catalyst
class: Layer3::C6500
note: Comes in IOS and CatOS versions like the 6k series.
note: CatOS versions like L2::Catalyst just fine.
note: !Reported problems with SNMP taking up all the CPU. Requests take significantly longer.
note: !IOS Version 12.1.8a reported not to respond to BRIDGE-MIB calls.
device: wsc4003, wsc4006
device: wsc4006
device: wsc4503, wsc4506
device: 4507
class: Layer3::C6500
note: !Has serious slowdown/timeout problems with SNMP
device: wsc4912g
note: Dedicated 12 port gig-e switch
device: 4006
duplex: both
class: Layer3::C4000
note: !Has serious slowdown/timeout problems with SNMP
note: !IOS Software Release 12.2(20)EW or higher required for duplex support
device: 4503, 4506, 4507, 4510
duplex: both
class: Layer3::C4000
note: !Has serious slowdown/timeout problems with SNMP
note: !IOS Software Release 12.2(20)EW or higher required for duplex support
device-family: Catalyst 5000
duplex: write
vlan: write
duplex: both
class: Layer2::Catalyst
note: Port info in CISCO-STACK-MIB
@@ -306,14 +258,11 @@ note: Router blade that runs IOS
device-family: Catalyst 6500
macsuck:vlan
duplex: write
vlan: write
class: Layer3::C6500
note: Runs in two possible modes, native (IOS) and hybrid (IOS with CatOS on top).
note: Switch running Hybrid has WS-C in description field and loves L2::Catalyst class
note: Native Mode (IOS) versions seem to have SNMP problems with L2 data.
note: !Problem with IOS 12.2.17d-SXB ... upgrade to -SXB1 or higher.
note: !Sup720-3B and NativeIOS 12.2 (17d)SXB10 may report 127.0.0.51 as CDP neighbor address.
device: 6503
macsuck:no
@@ -327,20 +276,16 @@ note: Native mode (IOS) reports L2+L3
note: !Macsuck failing even under vlan mode
device: wsc6509
duplex: write
duplex: both
class: Layer2::Catalyst
note: Hybrid Mode (Catalyst) reports L2 only
device: 6kMsfc
class: Layer3
duplex: no
vlan: no
note: IOS portion of Hybrid mode. VLAN and other L3 Services.
device: 6kMsfc2
class: Layer3
duplex: no
vlan: no
note: IOS portion of Hybrid mode. VLAN and other L3 Services.
device-family: Voice Gateway
@@ -349,51 +294,12 @@ duplex: no
device: VG200
# Extreme
device-vendor: Extreme Networks
device-family: Alpine and Summit
arpnip: yes
macsuck: yes
duplex: both
vlan: yes
cdp: no
class: Layer3::Extreme
device: Alpine 3808
device: Summit 7i, 48si
# Foundry
device-vendor: Foundry Networks
note: CDP --> FDP.
class: Layer3::Foundry
device-family: FastIron
class: Layer3::Foundry
ver: 1
note: Support very limited
device: FastIron 4802
device-family: EdgeIron
ver: 2
class: Layer2::Foundry
cdp: yes
duplex: yes
macsuck: yes
device: EdgeIron 24G
note: Bug where spanning tree stuff loops forever when polled by SNMP.
device-family: IronWare
class: Layer3::Foundry
ver: 2
cdp: yes
note: FDP enabled.
duplex: yes
macsuck: yes
arpnip: yes
device:FWSX424
device:SI400 Router
# HP
device-vendor: HP
@@ -405,7 +311,6 @@ duplex: both
macsuck: yes
arpnip: no
cdp: yes
vlan: yes
note: CDP only available with newer ROM versions.
device: 2512
@@ -423,25 +328,8 @@ duplex: link
device: 4108GL,8000,2626,2650,8000
note: VLAN info in Q-BRIDGE-MIB
# Net-SNMP
device-vendor: Net-SNMP
class: Layer3
ver: 2
device-family: Linux
note: net-snmp 4.x agent and 5.x agent.
device-family: BSD
# Juniper
device-vendor: Juniper
device-family: M-series router
arpnip: yes
# NORTEL
device-vendor: Nortel
note: CDP --> SONMP.
device-vendor: Nortel Networks
device-family: BayStack Hub
macsuck: yes
@@ -449,18 +337,13 @@ duplex: both
cdp: proprietary
ver: 1
class: Layer1::Bayhub
note: Uses proprietary MIBs to provide MAC to port mapping.
note: !Requires Advanced or Advanced Analyzer NMM
note: !Uses proprietary MIBs to provide MAC to port mapping.
device: 102
device: System 5000
device-family: Ethernet Switch/Baystack Switch
arpnip: no
device-family: Baystack Switch
macsuck: yes
duplex: both
vlan: yes
cdp: proprietary
class: Layer2::Baystack
@@ -472,7 +355,7 @@ device: 380
device: 410
device: 420,425
device: 420
device: 450
note: !Some versions > 4.X in stacked configuration have SNMP timeout issues.
@@ -480,25 +363,14 @@ note: Labels full duplex as 20Mbit connection.
device: 460,470
device: 5510,5520
device: BPS
device-family: Ethernet Routing Switch/Baystack Switch
arpnip: yes
macsuck: yes
duplex: both
vlan: yes
cdp: proprietary
class: Layer2::Baystack
device: 3510
device: 5510,5520,5530
device-family: Centillion
macsuck: yes
duplex: both
cdp: proprietary
vlan: yes
class: Layer2::Centillion
note: !Must be on version 4.x or 5.x (VLAN based) software.
@@ -522,12 +394,13 @@ device: AP-2220
device: AP-2221
device: AP-2225
device-family: Alteon AD
arpnip: yes
macsuck: yes
duplex: both
cdp: no
vlan: yes
class: Layer3::AlteonAD
note: !Some versions have issues with continuous SNMP polling. Upgrade to 10.0.30.7 or higher.
@@ -543,13 +416,12 @@ device: 183
device: 184
device-family: Multiprotocol Router/BayRS
device-family: BayRS
arpnip: yes
macsuck: yes
portmac: yes
duplex: both
cdp: no
vlan: yes
class: Layer3::BayRS
device: AN
@@ -564,7 +436,7 @@ device: Passport 2430
device: Passport 5430
device-family: VPN Router/Contivity
device-family: Contivity
arpnip: yes
macsuck: no
portmac: yes
@@ -582,60 +454,21 @@ device: 2500,2600,2700
device: 4500,4600,5000
device-family: Ethernet Routing Switch/Passport/Accelar LAN
device-family: Passport LAN
arpnip: yes
macsuck: yes
portmac: yes
duplex: both
cdp: proprietary
vlan: yes
class: Layer3::Passport
note: !8600 Code versions < 3.2 vlan based mac-suck and are unsupported. Upgrade code.
note: !8600 3.2 code versions < 3.2.2.2 have Bridge MIB loop. Upgrade code.
note: !Code versions < 3.2 vlan based mac-suck and are unsupported. Upgrade code.
note: !3.2 code versions < 3.2.2.2 have Bridge MIB loop. Upgrade code.
device: 8603,8606,8610
device: 8610co
device: 8106,8110
device: 1050,1100,1150,1200
device-family: Ethernet Routing Switch/Passport 1600
arpnip: yes
macsuck: yes
portmac: yes
duplex: both
cdp: proprietary
vlan: yes
class: Layer3::N1600
device: 1612,1624,1648
device-family: Synoptics
macsuck: yes
duplex: both
cdp: proprietary
ver: 1
class: Layer1::S3000
note: Uses proprietary MIBs to provide MAC to port mapping.
note: !Requires Advanced or Advanced Analyzer NMM
device: 281X
device: System 3000
device-family: Wireless Switch 2270
arpnip: no
macsuck: yes
portmac: yes
duplex: both
cdp: proprietary
class: Layer2::N2270
note: Uses proprietary MIBs to provide MAC to port mapping. APs appear as switch ports.
device: 2270
# Proxim
device-vendor: Proxim
@@ -649,14 +482,8 @@ device: AP-1000
device: AP-2000
device: AP-4000
device: WavePOINT-II
# Synoptics
device-vendor: Synoptics
note: See Nortel
# Zyxel
device-vendor: Zyxel
class: Layer2::ZyXEL_DSLAM

657
Info.pm

File diff suppressed because it is too large Load Diff

View File

@@ -1,448 +0,0 @@
# SNMP::Info::Airespace
# Eric Miller
# $Id$
#
# Copyright (c) 2005 Eric Miller
#
# 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::Airespace;
$VERSION = '1.03';
use strict;
use Exporter;
use SNMP::Info;
@SNMP::Info::Airespace::ISA = qw/SNMP::Info Exporter/;
@SNMP::Info::Airespace::EXPORT_OK = qw//;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
%MIBS = (
%SNMP::Info::MIBS,
'AIRESPACE-WIRELESS-MIB' => 'bsnAPName',
'AIRESPACE-SWITCHING-MIB' => 'agentInventorySerialNumber',
);
%GLOBALS = (
%SNMP::Info::GLOBALS,
'serial' => 'agentInventorySerialNumber',
'os_ver' => 'agentInventoryProductVersion',
);
%FUNCS = (
%SNMP::Info::FUNCS,
'i_index2' => 'ifIndex',
'i_name2' => 'ifName',
'i_description2' => 'ifDescr',
# AIRESPACE-WIRELESS-MIB::bsnAPTable
'airespace_ap_mac' => 'bsnAPDot3MacAddress',
'airespace_ap_name' => 'bsnAPName',
'airespace_ap_ip' => 'bsnApIpAddress',
'airespace_ap_loc' => 'bsnAPLocation',
'airespace_ap_model' => 'bsnAPModel',
'airespace_ap_serial' => 'bsnAPSerialNumber',
# AIRESPACE-WIRELESS-MIB::bsnMobileStationTable
'fw_port' => 'bsnMobileStationAPMacAddr',
'fw_mac' => 'bsnMobileStationMacAddress',
# AIRESPACE-SWITCHING-MIB::agentPortConfigTable
'airespace_duplex_admin' => 'agentPortPhysicalMode',
'airespace_duplex' => 'agentPortPhysicalStatus',
);
%MUNGE = (
%SNMP::Info::MUNGE,
# Add ones for our class
'airespace_ap_mac' => \&SNMP::Info::munge_mac,
'fw_port' => \&SNMP::Info::munge_mac,
);
sub layers {
return '00000011';
}
# Wirless switches do not support ifMIB requirements for get MAC
# and port status
sub i_index {
my $airespace = shift;
my $i_index = $airespace->i_index2();
my $ap_index = $airespace->airespace_ap_mac();
my %if_index;
foreach my $iid (keys %$i_index){
my $index = $i_index->{$iid};
next unless defined $index;
$if_index{$iid} = $index;
}
# Get Attached APs as Interfaces
foreach my $ap_id (keys %$ap_index){
my $ap_index = $ap_index->{$ap_id};
next unless defined $ap_index;
$if_index{$ap_id} = $ap_index;
}
return \%if_index;
}
sub interfaces {
my $airespace = shift;
my $i_index = $airespace->i_index();
my $ap_index = $airespace->airespace_ap_mac();
my %if;
foreach my $iid (keys %$i_index){
my $index = $i_index->{$iid};
next unless defined $index;
if ($index =~ /^\d+$/ ) {
$if{$index} = "1.$index";
}
elsif ($index =~ /(?:[0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}/) {
my $ap = $ap_index->{$iid};
next unless defined $ap;
$if{$index} = $ap;
}
else {
next;
}
}
return \%if;
}
sub i_name {
my $airespace = shift;
my $i_index = $airespace->i_index();
my $i_name2 = $airespace->i_name2();
my $ap_name = $airespace->airespace_ap_name();
my %i_name;
foreach my $iid (keys %$i_index){
my $index = $i_index->{$iid};
next unless defined $index;
if ($index =~ /^\d+$/ ) {
my $name = $i_name2->{$iid};
next unless defined $name;
$i_name{$index} = $name;
}
elsif ($index =~ /(?:[0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}/) {
my $name = $ap_name->{$iid};
next unless defined $name;
$i_name{$index} = $name;
}
else {
next;
}
}
return \%i_name;
}
sub i_description {
my $airespace = shift;
my $i_index = $airespace->i_index();
my $i_descr = $airespace->i_description2();
my $ap_loc = $airespace->airespace_ap_loc();
my %descr;
foreach my $iid (keys %$i_index){
my $index = $i_index->{$iid};
next unless defined $index;
if ($index =~ /^\d+$/ ) {
my $descr = $i_descr->{$iid};
next unless defined $descr;
$descr{$index} = $descr;
}
elsif ($index =~ /(?:[0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}/) {
my $name = $ap_loc->{$iid};
next unless defined $name;
$descr{$index} = $name;
}
else {
next;
}
}
return \%descr;
}
sub i_duplex {
my $airespace = shift;
my $interfaces = $airespace->interfaces();
my $ap_duplex = $airespace->airespace_duplex();
my %i_duplex;
foreach my $if (keys %$interfaces){
my $duplex = $ap_duplex->{$if};
next unless defined $duplex;
$duplex = 'half' if $duplex =~ /half/i;
$duplex = 'full' if $duplex =~ /full/i;
$duplex = 'auto' if $duplex =~ /auto/i;
$i_duplex{$if}=$duplex;
}
return \%i_duplex;
}
sub i_duplex_admin {
my $airespace = shift;
my $interfaces = $airespace->interfaces();
my $ap_duplex_admin = $airespace->airespace_duplex_admin();
my %i_duplex_admin;
foreach my $if (keys %$interfaces){
my $duplex = $ap_duplex_admin->{$if};
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{$if}=$duplex;
}
return \%i_duplex_admin;
}
# Wireless switches do not support the standard Bridge MIB
sub bp_index {
my $airespace = shift;
my $i_index = $airespace->i_index2();
my $ap_index = $airespace->airespace_ap_mac();
my %bp_index;
foreach my $iid (keys %$i_index){
my $index = $i_index->{$iid};
next unless defined $index;
$bp_index{$iid} = $index;
}
# Get Attached APs as Interfaces
foreach my $ap_id (keys %$ap_index){
my $ap_index = $ap_index->{$ap_id};
next unless defined $ap_index;
$bp_index{$ap_index} = $ap_index;
}
return \%bp_index;
}
1;
__END__
=head1 NAME
SNMP::Info::Airespace - SNMP Interface to Airespace wireless switches
=head1 AUTHOR
Eric Miller
=head1 SYNOPSIS
my $airespace = new SNMP::Info(
AutoSpecify => 1,
Debug => 1,
DestHost => 'myswitch',
Community => 'public',
Version => 2
)
or die "Can't connect to DestHost.\n";
my $class = $airespace->class();
print " Using device sub class : $class\n";
=head1 DESCRIPTION
SNMP::Info::Airespace is a subclass of SNMP::Info that provides an interface
to C<AIRESPACE-WIRELESS-MIB> and C<AIRESPACE-SWITCHING-MIB>. These MIBs are
used in Airespace wireless switches, as well as, products from Cisco, Nortel,
and Alcatel which are based upon the Airespace platform.
The Airespace platform utilizes intelligent wireless switches which control
thin access points. The thin access points themselves are unable to be polled
for end station information.
This class emulates bridge functionality for the wireless switch. This enables
end station MAC addresses collection and correlation to the thin access point
the end station is using for communication.
Normally you use or create a subclass of SNMP::Info that inherits this one. Do not use directly.
For debugging purposes call the class directly as you would SNMP::Info
my $airespace = new SNMP::Info::Airespace(...);
=head2 Inherited Classes
=over
=item SNMP::Info
=back
=head2 Required MIBs
=over
=item AIRESPACE-WIRELESS-MIB
=item AIRESPACE-SWITCHING-MIB
=back
=head1 GLOBALS
These are methods that return scalar value from SNMP
=over
=item $airespace->serial()
(B<agentInventorySerialNumber>)
=item $airespace->os_ver()
(B<agentInventoryProductVersion>)
=back
=head2 Overrides
=over
=item $airespace->layers()
Returns 00000011. Class emulates Layer 2 functionality for Thin APs through
proprietary MIBs.
=back
=head1 TABLE ENTRIES
These are methods that return tables of information in the form of a reference
to a hash.
=head2 Overrides
=over
=item $airespace->i_index()
Returns reference to map of IIDs to Interface index.
Extends ifIndex to support thin APs as device interfaces.
=item $airespace->interfaces()
Returns reference to map of IIDs to ports. Thin APs are implemented as device
interfaces. The thin AP MAC address is used as the port identifier.
=item $airespace->i_name()
Interface name. Returns (B<ifName>) for Ethernet interfaces and (B<bsnAPName>)
for thin AP interfaces.
=item $airespace->i_description()
Description of the interface. Returns (B<ifDescr>) for Ethernet interfaces and
(B<bsnAPLocation>) for thin AP interfaces.
=item $airespace->i_duplex()
Returns reference to map of IIDs to current link duplex. Ethernet interfaces only.
=item $airespace->i_duplex_admin()
Returns reference to hash of IIDs to admin duplex setting. Ethernet interfaces
only.
=item $airespace->bp_index()
Simulates bridge MIB by returning reference to a hash containing the index for
both the keys and values.
=item $airespace->fw_port()
(B<bsnMobileStationAPMacAddr>)
=item $airespace->fw_mac()
(B<bsnMobileStationMacAddress>)
=back
=head2 AIRESPACE AP Table (B<bsnAPTable>)
=over
=item $airespace->airespace_ap_mac()
(B<bsnAPDot3MacAddress>)
=item $airespace->airespace_ap_name()
(B<bsnAPName>)
=item $airespace->airespace_ap_ip()
(B<bsnApIpAddress>)
=item $airespace->airespace_ap_loc()
(B<bsnAPLocation>)
=item $airespace->airespace_ap_model()
(B<bsnAPModel>)
=item $airespace->airespace_ap_serial()
(B<bsnAPSerialNumber>)
=back
=head2 AIRESPACE Agent Port Config Table (B<agentPortConfigTable>)
=over
=item $airespace->airespace_duplex_admin()
(B<agentPortPhysicalMode>)
=item $airespace->airespace_duplex()
(B<agentPortPhysicalStatus>)
=cut

View File

@@ -1,5 +1,5 @@
# SNMP::Info::Bridge
# Max Baker
# Max Baker <max@warped.org>
#
# Changes since Version 0.7 Copyright (c) 2004 Max Baker
# All rights reserved.
@@ -32,7 +32,7 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Bridge;
$VERSION = '1.03';
$VERSION = 0.9;
# $Id$
use strict;
@@ -44,6 +44,11 @@ use vars qw/$VERSION $DEBUG %MIBS %FUNCS %GLOBALS %MUNGE $INIT/;
@SNMP::Info::Bridge::ISA = qw/SNMP::Info Exporter/;
@SNMP::Info::Bridge::EXPORT_OK = qw//;
$DEBUG=0;
$SNMP::debugging=$DEBUG;
$INIT = 0;
%MIBS = ('BRIDGE-MIB' => 'dot1dBaseBridgeAddress',
'Q-BRIDGE-MIB' => 'dot1qPvid',
);
@@ -102,22 +107,6 @@ use vars qw/$VERSION $DEBUG %MIBS %FUNCS %GLOBALS %MUNGE $INIT/;
'stp_p_port' => \&SNMP::Info::munge_mac
);
sub qb_i_vlan_t {
my $bridge = shift;
my $qb_i_vlan = $bridge->qb_i_vlan();
my $qb_i_vlan_type = $bridge->qb_i_vlan_type();
my $i_vlan = {};
foreach my $if (keys %$qb_i_vlan){
my $vlan = $qb_i_vlan->{$if};
my $tagged = $qb_i_vlan_type->{$if} || '';
next unless defined $vlan;
$i_vlan->{$if} = $tagged eq 'admitOnlyVlanTagged' ? 'trunk' : $vlan;
}
return $i_vlan;
}
sub i_stp_state {
my $bridge = shift;
@@ -137,60 +126,7 @@ sub i_stp_state {
return \%i_stp_state;
}
sub i_stp_port {
my $bridge = shift;
my $bp_index = $bridge->bp_index();
my $stp_p_port = $bridge->stp_p_port();
my %i_stp_port;
foreach my $index (keys %$stp_p_port){
my $bridge = $stp_p_port->{$index};
my $iid = $bp_index->{$index};
next unless defined $iid;
next unless defined $bridge;
$i_stp_port{$iid}=$bridge;
}
return \%i_stp_port;
}
sub i_stp_id {
my $bridge = shift;
my $bp_index = $bridge->bp_index();
my $stp_p_id = $bridge->stp_p_id();
my %i_stp_id;
foreach my $index (keys %$stp_p_id){
my $bridge = $stp_p_id->{$index};
my $iid = $bp_index->{$index};
next unless defined $iid;
next unless defined $bridge;
$i_stp_id{$iid}=$bridge;
}
return \%i_stp_id;
}
sub i_stp_bridge {
my $bridge = shift;
my $bp_index = $bridge->bp_index();
my $stp_p_bridge = $bridge->stp_p_bridge();
my %i_stp_bridge;
foreach my $index (keys %$stp_p_bridge){
my $bridge = $stp_p_bridge->{$index};
my $iid = $bp_index->{$index};
next unless defined $iid;
next unless defined $bridge;
$i_stp_bridge{$iid}=$bridge;
}
return \%i_stp_bridge;
}
1;
__END__
@@ -200,7 +136,7 @@ SNMP::Info::Bridge - Perl5 Interface to SNMP data available through the BRIDGE-M
=head1 AUTHOR
Max Baker
Max Baker (C<max@warped.org>)
=head1 SYNOPSIS
@@ -255,7 +191,7 @@ None.
=item Q-BRIDGE-MIB
F<rfc2674_q.mib>
f<rfc2674_q.mib>
=back
@@ -427,18 +363,6 @@ this port's segment."
"The Port Identifier of the port on the Designated Bridge for this port's segment."
=item $bridge->i_stp_port()
Returns the mapping of (B<dot1dStpPortDesignatedPort>) to the interface index (iid).
=item $bridge->i_stp_id()
Returns the mapping of (B<dot1dStpPort>) to the interface index (iid).
=item $bridge->i_stp_bridge()
Returns the mapping of (B<dot1dStpPortDesignatedBridge>) to the interface index (iid).
=back
=head2 Q-BRIDGE Data

View File

@@ -1,5 +1,5 @@
# SNMP::Info::CDP
# Max Baker
# Max Baker <max@warped.org>
#
# Changes since Version 0.7 Copyright (c) 2004 Max Baker
# All rights reserved.
@@ -31,22 +31,27 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::CDP;
$VERSION = '1.03';
$VERSION = 0.9;
# $Id$
use strict;
use Exporter;
use SNMP::Info;
use Carp;
@SNMP::Info::CDP::ISA = qw/SNMP::Info Exporter/;
@SNMP::Info::CDP::EXPORT_OK = qw//;
use vars qw/$VERSION $DEBUG %FUNCS %GLOBALS %MIBS %MUNGE $INIT/;
use vars qw/$VERSION $DEBUG %FUNCS %GLOBALS %MIBS %MIBS_V1 %MUNGE $INIT/;
# Debug
$DEBUG=0;
$SNMP::debugging=$DEBUG;
# Five data structures required by SNMP::Info
$INIT = 0;
%MIBS = ( 'CISCO-CDP-MIB' => 'cdpGlobalRun' );
%MIBS_V1 = ( 'CISCO-CDP-MIB-V1SMI' => 'cdpGlobalRun' );
# Notice we dont inherit the default GLOBALS and FUNCS
# only the default MUNGE.
%GLOBALS = (
@@ -124,7 +129,8 @@ sub c_if {
# Nope, didn't think so. Now we fake it.
my $c_ip = $cdp->c_ip();
unless (defined $c_ip){
$cdp->error_throw("SNMP::Info::CDP:c_if() - Device doesn't have cdp_ip() data. Can't fake cdp_index()");
$cdp->{error} = "SNMP::Info::CDP::c_if() - Device doesn't have c_ip() data. Can't fake c_index()";
$DEBUG and carp($cdp->error(1));
return undef;
}
@@ -149,7 +155,7 @@ SNMP::Info::CDP - Perl5 Interface to Cisco Discovery Protocol (CDP) using SNMP
=head1 AUTHOR
Max Baker
Max Baker (C<max@warped.org>)
=head1 SYNOPSIS

View File

@@ -1,118 +0,0 @@
package SNMP::Info::CiscoImage;
#$Id$
# Copyright (c) 2005 Matt Tuttle
#
# 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.
use strict;
use Exporter;
use SNMP::Info;
use vars qw/$VERSION $DEBUG %MIBS %FUNCS %GLOBALS %MUNGE $INIT/;
$VERSION = '1.03';
@SNMP::Info::CiscoImage::ISA = qw/SNMP::Info Exporter/;
@SNMP::Info::CiscoImage::EXPORT_OK = qw//;
%MIBS = (
'CISCO-IMAGE-MIB' => 'ciscoImageString',
);
%GLOBALS = (
);
%FUNCS = (
'ci_images' => 'ciscoImageString',
);
%MUNGE = (
);
1;
__END__
=head1 NAME
SNMP::Info::CiscoImage - Perl5 Interface to image strings for Cisco Devices
=head1 AUTHOR
Matt Tuttle (C<mtuttle@americanhebrewacademy.org>)
=head1 SYNOPSIS
# Let SNMP::Info determine the correct subclass for you.
my $ci = 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 = $ci->class();
print "SNMP::Info determined this device to fall under subclass : $class\n";
=head1 DESCRIPTION
SNMP::Info::CiscoImage is a subclass of SNMP::Info that provides access to
image strings embedded in an image running on Cisco Devices.
Use or create in a subclass of SNMP::Info. Do not use directly.
=head2 Inherited Classes
none.
=head2 Required MIBs
=over
=item CISCO-IMAGE-MIB
=back
MIBs can be found at ftp://ftp.cisco.com/pub/mibs/v2/v2.tar.gz
=head1 GLOBALS
None.
=head1 TABLE METHODS
=over
=item $ci->ci_images()
Returns the table of image strings.
B<ciscoImageString>
=back
=cut

View File

@@ -1,151 +0,0 @@
# SNMP::Info::CiscoQOS
# Alexander Hartmaier <alexander.hartmaier@t-systems.at>
# $Id$
#
# Copyright (c) 2005 Alexander Hartmaier
#
# 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::CiscoQOS;
$VERSION = '1.03';
use strict;
use Exporter;
use SNMP::Info;
@SNMP::Info::CiscoQOS::ISA = qw/SNMP::Info Exporter/;
@SNMP::Info::CiscoQOS::EXPORT_OK = qw//;
use vars qw/$VERSION $DEBUG %MIBS %FUNCS %GLOBALS %MUNGE $INIT/;
%MIBS = (
'CISCO-CLASS-BASED-QOS-MIB' => 'cbQosIfIndex',
);
%GLOBALS = (
);
%FUNCS = (
# CISCO-CLASS-BASED-QOS-MIB
'qos_i_index' => 'cbQosIfIndex',
'qos_i_type' => 'cbQosIfType',
'qos_pol_direction' => 'cbQosPolicyDirection',
'qos_obj_index' => 'cbQosConfigIndex',
'qos_obj_type' => 'cbQosObjectsType',
'qos_obj_parent' => 'cbQosParentObjectsIndex',
'qos_cm_name' => 'cbQosCMName',
'qos_cm_desc' => 'cbQosCMDesc',
'qos_cm_info' => 'cbQosCMInfo',
'qos_octet_pre' => 'cbQosCMPrePolicyByte',
'qos_octet_post' => 'cbQosCMPostPolicyByte',
);
%MUNGE = (
);
1;
__END__
=head1 NAME
SNMP::Info::CiscoQOS - Perl5 Interface to Cisco's Quality of Service MIBs
=head1 AUTHOR
Alexander Hartmaier (C<alexander.hartmaier@t-systems.at>)
=head1 SYNOPSIS
# Let SNMP::Info determine the correct subclass for you.
my $qos = 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 = $qos->class();
print "SNMP::Info determined this device to fall under subclass : $class\n";
=head1 DESCRIPTION
SNMP::Info::CiscoQOS is a subclass of SNMP::Info that provides
information about a cisco device's QoS config.
Use or create in a subclass of SNMP::Info. Do not use directly.
=head2 Inherited Classes
none.
=head2 Required MIBs
=over
=item CISCO-CLASS-BASED-QOS-MIB
=back
MIBs can be found at ftp://ftp.cisco.com/pub/mibs/v2/v2.tar.gz
=head1 GLOBALS
=over
none
=back
=head1 TABLE METHODS
=head2 ServicePolicy Table
This table is from CISCO-CLASS-BASED-QOS-MIB::cbQosServicePolicyTable
This table describes the interfaces/media types and the policymap that are attached to it.
=over
=item $qos->qos_i_index()
(B<cbQosIfIndex>)
=item $qos->qos_i_type()
(B<cbQosIfType>)
=head2 ClassMap configuration Table
This table is from CISCO-CLASS-BASED-QOS-MIB::cbQosCMCfgTable
=over
=back
=cut

View File

@@ -1,143 +0,0 @@
# SNMP::Info::CiscoRTT
# Alexander Hartmaier <alexander.hartmaier@t-systems.at>
# $Id$
#
# Copyright (c) 2005 Alexander Hartmaier
#
# 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::CiscoRTT;
$VERSION = '1.03';
use strict;
use Exporter;
use SNMP::Info;
@SNMP::Info::CiscoRTT::ISA = qw/SNMP::Info Exporter/;
@SNMP::Info::CiscoRTT::EXPORT_OK = qw//;
use vars qw/$VERSION $DEBUG %MIBS %FUNCS %GLOBALS %MUNGE $INIT/;
%MIBS = (
'CISCO-RTTMON-MIB' => 'rttMonCtrlAdminOwner',
);
%GLOBALS = (
);
%FUNCS = (
# CISCO-RTTMON-MIB
'rtt_desc' => 'rttMonCtrlAdminOwner',
'rtt_last' => 'rttMonLatestRttOperCompletionTime',
);
%MUNGE = (
);
1;
__END__
=head1 NAME
SNMP::Info::CiscoRTT - Perl5 Interface to Cisco's Round Trip Time MIBs
=head1 AUTHOR
Alexander Hartmaier (C<alexander.hartmaier@t-systems.at>)
=head1 SYNOPSIS
# Let SNMP::Info determine the correct subclass for you.
my $rtt = 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 = $rtt->class();
print "SNMP::Info determined this device to fall under subclass : $class\n";
=head1 DESCRIPTION
SNMP::Info::CiscoRTT is a subclass of SNMP::Info that provides
information about a cisco device's RTT values.
Use or create in a subclass of SNMP::Info. Do not use directly.
=head2 Inherited Classes
none.
=head2 Required MIBs
=over
=item CISCO-RTTMON-MIB
=back
MIBs can be found at ftp://ftp.cisco.com/pub/mibs/v2/v2.tar.gz
=head1 GLOBALS
=over
none
=back
=head1 TABLE METHODS
=head2 Overall Control Group Table
This table is from CISCO-RTTMAN-MIB::rttMonCtrlAdminTable
=over
=item $rtt->rtt_desc()
(B<rttMonCtrlAdminOwner>)
=back
=head2 Overall Control Group Table
This table is from CISCO-RTTMON-MIB::rttMonCtrl
=over
=item $rtt->rtt_last()
(B<rttMonLatestRttOperCompletionTime>)
=back
=cut

View File

@@ -1,5 +1,5 @@
# SNMP::Info::CiscoStack
# Max Baker
# Max Baker <max@warped.org>
#
# Copyright (c)2003,2004 Max Baker
# All rights reserved.
@@ -28,7 +28,7 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::CiscoStack;
$VERSION = '1.03';
$VERSION = 0.9;
# $Id$
use strict;
@@ -40,6 +40,10 @@ use vars qw/$VERSION $DEBUG %MIBS %FUNCS %GLOBALS %MUNGE %PORTSTAT $INIT/;
@SNMP::Info::CiscoStack::ISA = qw/SNMP::Info Exporter/;
@SNMP::Info::CiscoStack::EXPORT_OK = qw//;
$DEBUG=0;
$SNMP::debugging=$DEBUG;
$INIT = 0;
%MIBS = (
'CISCO-STACK-MIB' => 'ciscoStackMIB',
'CISCO-PORT-SECURITY-MIB' => 'ciscoPortSecurityMIB',
@@ -93,11 +97,6 @@ use vars qw/$VERSION $DEBUG %MIBS %FUNCS %GLOBALS %MUNGE %PORTSTAT $INIT/;
'p_speed' => 'portAdminSpeed',
'p_duplex' => 'portDuplex',
'p_port' => 'portIfIndex',
'p_rx_flow_control' => 'portOperRxFlowControl',
'p_tx_flow_control' => 'portOperTxFlowControl',
'p_rx_flow_control_admin' => 'portAdminRxFlowControl',
'p_tx_flow_control_admin' => 'portAdminTxFlowControl',
'p_oidx' => 'portCrossIndex',
# CISCO-STACK-MIB::PortCpbEntry
'p_speed_admin' => 'portCpbSpeed',
'p_duplex_admin' => 'portCpbDuplex',
@@ -244,43 +243,6 @@ sub i_duplex_admin {
return \%i_duplex_admin;
}
sub set_i_speed_admin {
# map speeds to those the switch will understand
my %speeds = qw/auto 1 10 10000000 100 100000000 1000 1000000000/;
my $stack = shift;
my ($speed, $iid) = @_;
my $p_port = $stack->p_port();
my %reverse_p_port = reverse %$p_port;
$speed = lc($speed);
return 0 unless defined $speeds{$speed};
$iid = $reverse_p_port{$iid};
return $stack->set_p_speed($speeds{$speed}, $iid);
}
sub set_i_duplex_admin {
# map a textual duplex to an integer one the switch understands
my %duplexes = qw/half 1 full 2 auto 4/;
my $stack = shift;
my ($duplex, $iid) = @_;
my $p_port = $stack->p_port();
my %reverse_p_port = reverse %$p_port;
$duplex = lc($duplex);
return 0 unless defined $duplexes{$duplex};
$iid = $reverse_p_port{$iid};
return $stack->set_p_duplex($duplexes{$duplex}, $iid);
}
# $stack->interfaces() - Maps the ifIndex table to a physical port
sub interfaces {
my $self = shift;
@@ -307,7 +269,7 @@ SNMP::Info::CiscoStack - Intefaces to data from CISCO-STACK-MIB and CISCO-PORT-S
=head1 AUTHOR
Max Baker
Max Baker (C<max@warped.org>)
=head1 SYNOPSIS
@@ -462,34 +424,6 @@ Crosses p_duplex_admin with p_port.
Munges bit_string returned from p_duplex_admin to get duplex settings.
=item $stack->set_i_speed_admin(speed, ifIndex)
Sets port speed, must be supplied with speed and port ifIndex
Speed choices are 'auto', '10', '100', '1000'
Crosses $stack->p_port() with $stack->p_duplex() to
utilize port ifIndex.
Example:
my %if_map = reverse %{$stack->interfaces()};
$stack->set_i_speed_admin('auto', $if_map{'FastEthernet0/1'})
or die "Couldn't change port speed. ",$stack->error(1);
=item $stack->set_i_duplex_admin(duplex, ifIndex)
Sets port duplex, must be supplied with duplex and port ifIndex
Speed choices are 'auto', 'half', 'full'
Crosses $stack->p_port() with $stack->p_duplex() to
utilize port ifIndex.
Example:
my %if_map = reverse %{$stack->interfaces()};
$stack->set_i_duplex_admin('auto', $if_map{'FastEthernet0/1'})
or die "Couldn't change port duplex. ",$stack->error(1);
=back
=head2 Module table
@@ -610,50 +544,6 @@ To see the status of port 4 :
(B<portIfIndex>)
=item $stack->p_rx_flow_control()
Can be either C<on> C<off> or C<disagree>
"Indicates the receive flow control operational status of the port. If the port
could not agree with the far end on a link protocol, its operational status
will be disagree(3)."
B<portOperRxFlowControl>
=item $stack->p_tx_flow_control()
Can be either C<on> C<off> or C<disagree>
"Indicates the transmit flow control operational status of the port. If the
port could not agree with the far end on a link protocol, its operational
status will be disagree(3)."
B<portOperTxFlowControl>
=item $stack->p_rx_flow_control_admin()
Can be either C<on> C<off> or C<desired>
"Indicates the receive flow control administrative status set on the port. If
the status is set to on(1), the port will require the far end to send flow
control. If the status is set to off(2), the port will not allow far end to
send flow control. If the status is set to desired(3), the port will allow the
far end to send the flow control."
B<portAdminRxFlowControl>
=item $stack->p_tx_flow_control_admin()
Can be either C<on> C<off> or C<desired>
"Indicates the transmit flow control administrative status set on the port. If
the status is set to on(1), the port will send flow control to the far end. If
the status is set to off(2), the port will not send flow control to the far
end. If the status is set to desired(3), the port will send flow control to the
far end if the far end supports it."
B<portAdminTxFlowControl>
=back
=head2 Port Capability Table (CISCO-STACK-MIB::portCpbTable)

View File

@@ -1,5 +1,5 @@
# SNMP::Info::CiscoStats
# Max Baker
# Max Baker <max@warped.org>
#
# Changes since Version 0.7 Copyright (c) 2004 Max Baker
# All rights reserved.
@@ -31,7 +31,7 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::CiscoStats;
$VERSION = '1.03';
$VERSION = 0.9;
# $Id$
use strict;
@@ -43,14 +43,14 @@ use vars qw/$VERSION $DEBUG %MIBS %FUNCS %GLOBALS %MUNGE $INIT/;
@SNMP::Info::CiscoStats::ISA = qw/SNMP::Info Exporter/;
@SNMP::Info::CiscoStats::EXPORT_OK = qw//;
$DEBUG=0;
$SNMP::debugging=$DEBUG;
$INIT = 0;
%MIBS = (
'SNMPv2-MIB' => 'sysDescr',
'RFC1213-MIB' => 'sysDescr',
'CISCO-PROCESS-MIB' => 'cpmCPUTotal5sec',
'CISCO-MEMORY-POOL-MIB' => 'ciscoMemoryPoolUsed',
'OLD-CISCO-SYSTEM-MIB' => 'writeMem',
'CISCO-PRODUCTS-MIB' => 'sysName',
'CISCO-STACK-MIB' => 'wsc1900sysID', # some older catalysts live here
'CISCO-ENTITY-VENDORTYPE-OID-MIB' => 'cevChassis',
'CISCO-MEMORY-POOL-MIB' => 'ciscoMemoryPoolUsed'
);
%GLOBALS = (
@@ -68,8 +68,6 @@ use vars qw/$VERSION $DEBUG %MIBS %FUNCS %GLOBALS %MUNGE $INIT/;
# CISCO-MEMORY-POOL-MIB
'mem_free' => 'ciscoMemoryPoolFree.1',
'mem_used' => 'ciscoMemoryPoolUsed.1',
# OLD-CISCO-SYSTEM-MIB
'write_mem' => 'writeMem',
);
%FUNCS = (
@@ -80,7 +78,7 @@ use vars qw/$VERSION $DEBUG %MIBS %FUNCS %GLOBALS %MUNGE $INIT/;
sub os {
my $l2 = shift;
my $descr = $l2->description() || '';
my $descr = $l2->description();
# order here matters - there are Catalysts that run IOS and have catalyst in their description field.
return 'ios' if ($descr =~ /IOS/);
@@ -146,7 +144,7 @@ SNMP::Info::CiscoStats - Perl5 Interface to CPU and Memory stats for Cisco Devic
=head1 AUTHOR
Max Baker
Max Baker (C<max@warped.org>)
=head1 SYNOPSIS
@@ -179,19 +177,11 @@ none.
=over
=item CISCO-PRODUCTS-MIB
=item CISCO-PROCESS-MIB
=item CISCO-MEMORY-POOL-MIB
=item SNMPv2-MIB
=item OLD-CISCO-SYSTEM-MIB
=item CISCO-STACK-MIB
=item CISCO-ENTITY-VENDORTYPE-OID-MIB
=item RFC1213-MIB
=back

View File

@@ -1,5 +1,5 @@
# SNMP::Info::CiscoVTP
# Max Baker
# Max Baker <max@warped.org>
#
# Copyright (c) 2004 Max Baker changes from version 0.8 and beyond.
#
@@ -30,7 +30,7 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::CiscoVTP;
$VERSION = '1.03';
$VERSION = 0.9;
# $Id$
use strict;
@@ -42,6 +42,10 @@ use vars qw/$VERSION $DEBUG %MIBS %FUNCS %GLOBALS %MUNGE $INIT/;
@SNMP::Info::CiscoVTP::ISA = qw/SNMP::Info Exporter/;
@SNMP::Info::CiscoVTP::EXPORT_OK = qw//;
$DEBUG=0;
$SNMP::debugging=$DEBUG;
$INIT = 0;
%MIBS = (
'CISCO-VTP-MIB' => 'vtpVlanName',
'CISCO-VLAN-MEMBERSHIP-MIB' => 'vmMembershipEntry',
@@ -102,12 +106,11 @@ use vars qw/$VERSION $DEBUG %MIBS %FUNCS %GLOBALS %MUNGE $INIT/;
# CISCO-VLAN-IFTABLE-RELATIONSHIP-MIB
'v_cvi_if' => 'cviRoutedVlanIfIndex',
# vlanTrunkPortTable
# TODO Add these tables if someone wants them..
# vtpEditControlTable
# vtpVlanEditTable
# vtpStatsTable
# vlanTrunkPortTable
);
%MUNGE = (
@@ -138,18 +141,6 @@ sub i_vlan {
return $i_vlan;
}
sub set_i_vlan {
my $vtp = shift;
# Check for CISCO-VLAN-MIB
my $i_vlan = $vtp->i_vlan2();
if (defined $i_vlan) {
return $vtp->set_i_vlan2(@_);
}
# only support the first case for now.
return undef;
}
1;
__END__
@@ -159,7 +150,7 @@ SNMP::Info::CiscoVTP - Perl5 Interface to Cisco's VLAN Management MIBs
=head1 AUTHOR
Max Baker
Max Baker (C<max@warped.org>)
=head1 SYNOPSIS

View File

@@ -1,5 +1,5 @@
# SNMP::Info::Entity
# Max Baker
# Max Baker <max@warped.org>
#
# Copyright (c) 2004 Max Baker changes from version 0.8 and beyond.
#
@@ -30,7 +30,7 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Entity;
$VERSION = '1.03';
$VERSION = 0.9;
# $Id$
use strict;
@@ -42,29 +42,24 @@ use vars qw/$VERSION $DEBUG %MIBS %FUNCS %GLOBALS %MUNGE $INIT/;
@SNMP::Info::Entity::ISA = qw/SNMP::Info Exporter/;
@SNMP::Info::Entity::EXPORT_OK = qw//;
$INIT = 0;
%MIBS = ('ENTITY-MIB' => 'entPhysicalSerialNum');
%GLOBALS = (
);
%FUNCS = (
'e_index' => 'entPhysicalIndex',
'e_alias' => 'entPhysicalAlias',
'e_class' => 'entPhysicalClass',
'e_descr' => 'entPhysicalDescr',
'e_fwver' => 'entPhysicalFirmwareRev',
'e_fru' => 'entPhysicalIsFRU',
'e_hwver' => 'entPhysicalHardwareRev',
'e_id' => 'entPhysicalAssetID',
'e_map' => 'entAliasMappingIdentifier',
'e_model' => 'entPhysicalModelName',
'e_name' => 'entPhysicalName',
'e_parent' => 'entPhysicalContainedIn',
'e_pos' => 'entParentRelPos',
'e_serial' => 'entPhysicalSerialNum',
'e_swver' => 'entPhysicalSoftwareRev',
'e_type' => 'entPhysicalVendorType',
'e_vendor' => 'entPhysicalMfgName',
);
%MUNGE = (
@@ -92,11 +87,11 @@ sub e_port {
=head1 NAME
SNMP::Info::Entity - Perl5 Interface to SNMP data stored in ENTITY-MIB. RFC 2737
SNMP::Info::Entity - Perl5 Interface to SNMP data stored in ENTITY-MIB.
=head1 AUTHOR
Max Baker
Max Baker (C<max@warped.org>)
=head1 SYNOPSIS
@@ -116,9 +111,7 @@ Max Baker
=head1 DESCRIPTION
ENTITY-MIB is used by Layer 2 devices from HP,Aironet,Foundry,Cisco and more.
See RFC 2737 for full details.
ENTITY-MIB is used by some Layer 2 devices like HP Switches and Aironet Access Points
Create or use a device subclass that inherit this class. Do not use directly.
@@ -153,72 +146,36 @@ to a hash.
=over
=item $entity->e_index()
Not normally implemented
(C<entPhysicalIndex>)
=item $entity->e_alias()
Human entered, not usually used.
(C<entPhysicalAlias>)
=item $entity->e_class()
Stack, Module, Container, Port ...
(C<entPhysicalClass>)
=item $entity->e_descr()
Human Friendly
(C<entPhysicalClass>)
=item $entity->e_fwver()
(C<entPhysicalFirmwareRev>)
=item $entity->e_fru()
BOOLEAN. Field Replaceable unit?
(C<entPhysicalFRU>)
=item $entity->e_hwver()
(C<entPhysicalHardwareRev>)
=item $entity->e_id()
This is human entered and not normally used.
(C<entPhysicalAssetID>)
=item $entity->e_map()
See MIB.
(C<entAliasMappingIdentifier>)
=item $entity->e_model()
Model Name of Entity.
(C<entPhysicalModelName>)
=item $entity->e_name()
More computer friendly name of entity. Parse me.
(C<entPhysicalName>)
=item $entity->e_parent()
0 if root.
(C<entPhysicalContainedIn>)
=item $entity->e_port()
@@ -236,16 +193,8 @@ $entity->e_map()
=item $entity->e_type()
This is an OID.
(C<entPhysicalVendorType>)
=item $entity->e_vendor()
Vendor of Module.
(C<entPhysicalMfgName>)
=back
=cut

View File

@@ -1,5 +1,5 @@
# SNMP::Info::EtherLike
# Max Baker
# Max Baker <max@warped.org>
#
# Copyright (c) 2004 Max Baker changes from version 0.8 and beyond.
#
@@ -30,7 +30,7 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::EtherLike;
$VERSION = '1.03';
$VERSION = 0.9;
# $Id$
use strict;
@@ -42,6 +42,12 @@ use vars qw/$VERSION $DEBUG %MIBS %FUNCS %GLOBALS %MUNGE $INIT/;
@SNMP::Info::EtherLike::ISA = qw/SNMP::Info Exporter/;
@SNMP::Info::EtherLike::EXPORT_OK = qw//;
$DEBUG=0;
$SNMP::debugging=$DEBUG;
$INIT = 0;
# Same info in both rfc1398 and this?
%MIBS = ('ETHERLIKE-MIB' => 'etherMIB' );
%GLOBALS = ();
@@ -69,18 +75,7 @@ use vars qw/$VERSION $DEBUG %MIBS %FUNCS %GLOBALS %MUNGE $INIT/;
'el_coll_freq' => 'dot3CollFrequencies'
);
%MUNGE = ( %SNMP::Info::MUNGE,
'el_duplex' => \&munge_el_duplex,
);
sub munge_el_duplex {
my $duplex = shift;
return unless defined $duplex;
$duplex =~ s/Duplex$//;
return $duplex;
}
%MUNGE = ( %SNMP::Info::MUNGE );
1;
__END__
@@ -88,11 +83,11 @@ __END__
=head1 NAME
SNMP::Info::EtherLike - Perl5 Interface to SNMP ETHERLIKE-MIB RFC 1398
SNMP::Info::EtherLike - Perl5 Interface to SNMP ETHERLIKE-MIB
=head1 AUTHOR
Max Baker
Max Baker (C<max@warped.org>)
=head1 SYNOPSIS
@@ -117,6 +112,10 @@ Max Baker
my $iid = $el_index->{$el_port};
my $port = $interfaces->{$iid};
$duplex = 'half' if $duplex =~/half/i;
$duplex = 'full' if $duplex =~/full/i;
$duplex = 'auto' if $duplex =~/auto/i;
print "PORT:$port set to duplex:$duplex\n";
}
@@ -125,8 +124,6 @@ Max Baker
SNMP::Info::EtherLike is a subclass of SNMP::Info that supplies
access to the ETHERLIKE-MIB used by some Layer 3 Devices such as Cisco routers.
See RFC 1398 for more details.
Use or create a subclass of SNMP::Info that inherits this one. Do not use directly.
=head2 Inherited Classes

View File

@@ -32,22 +32,31 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::FDP;
$VERSION = 0.9;
use strict;
use Exporter;
use SNMP::Info;
use Carp;
@SNMP::Info::FDP::ISA = qw/SNMP::Info Exporter/;
@SNMP::Info::FDP::EXPORT_OK = qw//;
use vars qw/$VERSION $DEBUG %FUNCS %GLOBALS %MIBS %MUNGE $INIT/;
$VERSION = '1.03';
# Debug
$DEBUG=1;
$SNMP::debugging=$DEBUG;
# Five data structures required by SNMP::Info
$INIT = 0;
%MIBS = ( 'FOUNDRY-SN-SWITCH-GROUP-MIB' => 'snFdpGlobalRun' );
# Notice we dont inherit the default GLOBALS and FUNCS
# only the default MUNGE.
%GLOBALS = (
# CDP-Compatibility
'cdp_run' => 'snFdpGlobalRun',
'cdp_interval' => 'snFdpGlobalMessageInterval',
'cdp_holdtime' => 'snFdpGlobalHoldTime',
'cdp_id' => 'snFdpGlobalDeviceId',
@@ -69,7 +78,7 @@ $VERSION = '1.03';
'c_capabilities' => 'snFdpCacheCapabilities',
'c_domain' => 'snFdpCacheVTPMgmtDomain',
'c_vlan' => 'snFdpCacheNativeVLAN',
'c_duplex' => 'snFdpCacheDuplex',
'c_duplex' => 'snFdpCacheDuplex'
);
%MUNGE = (
@@ -87,16 +96,6 @@ sub munge_caps {
}
sub cdp_run {
my $fdp = shift;
my $fdp_run = $fdp->fdp_run();
# if fdp_run isn't implemented on device, assume FDP is on
return $fdp_run if defined $fdp_run;
return 1;
}
sub hasFDP {
my $fdp = shift;
@@ -119,6 +118,8 @@ sub hasFDP {
sub c_if {
my $fdp = shift;
# See if by some miracle Cisco implemented the fdpCacheIfIndex entry
my $fdp_index = $fdp->fdp_index();
return $fdp_index if defined $fdp_index;
@@ -126,7 +127,8 @@ sub c_if {
# Nope, didn't think so. Now we fake it.
my $fdp_ip = $fdp->c_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()");
$fdp->{error} = "SNMP::Info::FDP:fdp_if() - Device doesn't have fdp_ip() data. Can't fake fdp_index()";
$DEBUG and carp($fdp->error(1));
return undef;
}
@@ -151,7 +153,7 @@ SNMP::Info::FDP - Perl5 Interface to Foundry Discovery Protocol (FDP) using SNMP
=head1 AUTHOR
Bruce Rodger, Max Baker
Max Baker (C<max@warped.org>)
=head1 SYNOPSIS

View File

@@ -1,5 +1,5 @@
# SNMP::Info::Layer1 - SNMP Interface to Layer1 Devices
# Max Baker
# Max Baker <max@warped.org>
#
# Copyright (c) 2004 Max Baker changes from version 0.8 and beyond.
#
@@ -30,7 +30,7 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer1;
$VERSION = '1.03';
$VERSION = 0.9;
# $Id$
use strict;
@@ -43,6 +43,13 @@ use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %PORTSTAT %MUNGE $INIT/;
@SNMP::Info::Layer1::ISA = qw/SNMP::Info Exporter/;
@SNMP::Info::Layer1::EXPORT_OK = qw//;
$DEBUG=0;
$SNMP::debugging=$DEBUG;
# See SNMP::Info for the details of these data structures and
# the interworkings.
$INIT = 0;
%MIBS = ( %SNMP::Info::MIBS,
'SNMP-REPEATER-MIB' => 'rptrPortGroupIndex'
);
@@ -162,7 +169,7 @@ SNMP::Info::Layer1 - Perl5 Interface to network devices serving Layer1 only.
=head1 AUTHOR
Max Baker
Max Baker (C<max@warped.org>)
=head1 SYNOPSIS

View File

@@ -1,5 +1,5 @@
# SNMP::Info::Layer1::Allied
# Max Baker
# Max Baker <max@warped.org>
#
# Copyright (c) 2004 Max Baker changes from version 0.8 and beyond.
#
@@ -30,7 +30,7 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer1::Allied;
$VERSION = '1.03';
$VERSION = 0.9;
# $Id$
use strict;
@@ -128,7 +128,7 @@ SNMP::Info::Layer1::Allied - SNMP Interface to old Allied Hubs
=head1 AUTHOR
Max Baker
Max Baker (C<max@warped.org>)
=head1 SYNOPSIS

View File

@@ -1,5 +1,5 @@
# SNMP::Info::Layer1::Asante
# Max Baker
# Max Baker <max@warped.org>
#
# Copyright (c) 2004 Max Baker changes from version 0.8 and beyond.
#
@@ -30,7 +30,7 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer1::Asante;
$VERSION = '1.03';
$VERSION = 0.9;
# $Id$
use strict;
@@ -171,7 +171,7 @@ SNMP::Info::Layer1::Asante - SNMP Interface to old Asante 1012 Hubs
=head1 AUTHOR
Max Baker
Max Baker (C<max@warped.org>)
=head1 SYNOPSIS
@@ -232,6 +232,12 @@ Culls software version from description()
Returns 'asante' :)
=item $asante->root_ip()
Returns IP Address of Managed Hub.
(B<actualIpAddr>)
=item $asante->model()
Trys to cull out AT-nnnnX out of the description field.

View File

@@ -1,9 +1,12 @@
# SNMP::Info::Layer1::Bayhub
# Eric Miller
# Eric Miller <eric@jeneric.org>
# $Id$
#
# Copyright (c) 2004-6 Eric Miller, Max Baker
# 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:
#
@@ -28,7 +31,7 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer1::Bayhub;
$VERSION = '1.03';
$VERSION = 0.9;
use strict;
use Exporter;
@@ -43,12 +46,12 @@ use SNMP::Info::SONMP;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
%MIBS = (
%SNMP::Info::MIBS,
%SNMP::Info::MIBS,
%SNMP::Info::Bridge::MIBS,
%SNMP::Info::NortelStack::MIBS,
%SNMP::Info::NortelStack::MIBS,
%SNMP::Info::SONMP::MIBS,
'S5-ETHERNET-COMMON-MIB' => 's5EnPortTable',
'S5-COMMON-STATS-MIB' => 's5CmStat',
'S5-ETHERNET-COMMON-MIB' => 's5EnPortTable',
'S5-COMMON-STATS-MIB' => 's5CmStat',
);
%GLOBALS = (
@@ -56,7 +59,7 @@ use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
%SNMP::Info::Bridge::GLOBALS,
%SNMP::Info::NortelStack::GLOBALS,
%SNMP::Info::SONMP::GLOBALS,
);
);
%FUNCS = (
%SNMP::Info::FUNCS,
@@ -64,14 +67,14 @@ use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
%SNMP::Info::NortelStack::FUNCS,
%SNMP::Info::SONMP::FUNCS,
# S5-ETHERNET-COMMON-MIB::s5EnPortTable
'bayhub_pb_index' => 's5EnPortBrdIndx',
'bayhub_pp_index' => 's5EnPortIndx',
'bayhub_up_admin' => 's5EnPortPartStatus',
'bayhub_up' => 's5EnPortLinkStatus',
# S5-COMMON-STATS-MIB::s5CmSNodeTable
'bayhub_nb_index' => 's5CmSNodeBrdIndx',
'bayhub_np_index' => 's5CmSNodePortIndx',
'fw_mac' => 's5CmSNodeMacAddr',
'bayhub_pb_index' => 's5EnPortBrdIndx',
'bayhub_pp_index' => 's5EnPortIndx',
'bayhub_up_admin' => 's5EnPortPartStatus',
'bayhub_up' => 's5EnPortLinkStatus',
# S5-COMMON-STATS-MIB::s5CmSNodeTable
'bayhub_nb_index' => 's5CmSNodeBrdIndx',
'bayhub_np_index' => 's5CmSNodePortIndx',
'fw_mac' => 's5CmSNodeMacAddr',
);
%MUNGE = (
@@ -134,9 +137,9 @@ sub i_index {
}
}
my $index = ($board*256)+$port;
my $index = ($board*256)+$port;
$i_index{$iid} = $index;
$i_index{$iid} = $index;
}
return \%i_index;
}
@@ -150,8 +153,8 @@ sub interfaces {
my $index = $i_index->{$iid};
next unless defined $index;
# Index numbers are deterministic slot * 256 + port
my $port = $index % 256;
# Index numbers are deterministic slot * 256 + port
my $port = $index % 256;
my $slot = int($index / 256);
my $slotport = "$slot.$port";
@@ -217,8 +220,8 @@ sub i_up {
my $index = $port_index->{$iid};
next unless defined $index;
my $link_stat = $link_stat->{$iid};
next unless defined $link_stat;
next unless defined $link_stat;
$link_stat = 'up' if $link_stat =~ /on/i;
$link_stat = 'down' if $link_stat =~ /off/i;
@@ -234,35 +237,15 @@ sub i_up_admin {
my %i_up_admin;
foreach my $iid (keys %$i_index){
my $index = $i_index->{$iid};
next unless defined $index;
my $index = $i_index->{$iid};
next unless defined $index;
my $link_stat = $link_stat->{$iid};
next unless defined $link_stat;
next unless defined $link_stat;
$i_up_admin{$index}=$link_stat;
}
return \%i_up_admin;
}
sub set_i_up_admin {
# map setting to those the hub will understand
my %setting = qw/up 2 down 3/;
my $bayhub = shift;
my ($setting, $iid) = @_;
my $i_index = $bayhub->i_index();
my %reverse_i_index = reverse %$i_index;
$setting = lc($setting);
return 0 unless defined $setting{$setting};
$iid = $reverse_i_index{$iid};
return $bayhub->set_bayhub_up_admin($setting{$setting}, $iid);
}
# Hubs do not support the standard Bridge MIB
sub bp_index {
my $bayhub = shift;
@@ -275,7 +258,7 @@ sub bp_index {
my $board = $b_index->{$iid};
next unless defined $board;
my $port = $p_index->{$iid}||0;
if ($model eq 'Baystack Hub') {
my $comidx = $board;
if (! ($comidx % 5)) {
@@ -289,9 +272,9 @@ sub bp_index {
}
}
my $index = ($board*256)+$port;
my $index = ($board*256)+$port;
$bp_index{$index} = $index;
$bp_index{$index} = $index;
}
return \%bp_index;
}
@@ -320,8 +303,8 @@ sub fw_port {
$port = 26;
}
}
my $index = ($board*256)+$port;
my $index = ($board*256)+$port;
$fw_port{$iid} = $index;
}
@@ -345,7 +328,7 @@ SNMP::Info::Layer1::Bayhub - SNMP Interface to Bay / Nortel Hubs
=head1 AUTHOR
Eric Miller
Eric Miller (C<eric@jeneric.org>)
=head1 SYNOPSIS
@@ -409,6 +392,13 @@ 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 Technical Support, Browse Technical Support,
Select by Product Families, BayStack, BayStack: Hubs - 150 Series, 10BASE-T,
Software. Filter on mibs and download the latest version's archive.
=head1 GLOBALS
These are methods that return scalar value from SNMP
@@ -417,11 +407,11 @@ These are methods that return scalar value from SNMP
=item $bayhub->vendor()
Returns 'nortel'
Returns 'Nortel'
=item $bayhub->os()
Returns 'bay_hub'
Returns 'Bay Hub'
=item $bayhub->model()
@@ -508,17 +498,6 @@ Returns (B<s5EnPortLinkStatus>) for each port. Translates on/off to up/down.
Returns (B<s5EnPortPartStatus>) for each port.
=item $bayhub->set_i_up_admin(state, ifIndex)
Sets port state, must be supplied with state and port ifIndex
State choices are 'up'or 'down'
Example:
my %if_map = reverse %{$bayhub->interfaces()};
$bayhub->set_i_up_admin('down', $if_map{'1.1'})
or die "Couldn't change port state. ",$bayhub->error(1);
=item $bayhub->bp_index()
Simulates bridge MIB by returning reference to a hash containing the index for

View File

@@ -1,524 +0,0 @@
# SNMP::Info::Layer1::S3000
# Eric Miller
# $Id$
#
# Copyright (c) 2006 Eric Miller
#
# 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::Layer1::S3000;
$VERSION = '1.03';
use strict;
use Exporter;
use SNMP::Info::Layer1;
use SNMP::Info::Bridge;
@SNMP::Info::Layer1::S3000::ISA = qw/SNMP::Info::Layer1 SNMP::Info::Bridge/;
@SNMP::Info::Layer1::S3000::EXPORT_OK = qw//;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
%MIBS = (
%SNMP::Info::Layer1::MIBS,
%SNMP::Info::Bridge::MIBS,
'SYNOPTICS-ETHERNET-MIB' => 's3EnetPortTable',
'SYNOPTICS-COMMON-MIB' => 's3AgentType',
);
%GLOBALS = (
%SNMP::Info::Layer1::GLOBALS,
%SNMP::Info::Bridge::GLOBALS,
# From SYNOPTICS-COMMON-MIB
'os_bin' => 's3AgentFwVer',
's3000_major_ver' => 's3AgentSwMajorVer',
's3000_minor_ver' => 's3AgentSwMinorVer',
's3000_maint_ver' => 's3AgentSwMaintVer',
);
%FUNCS = (
%SNMP::Info::Layer1::FUNCS,
%SNMP::Info::Bridge::FUNCS,
# SYNOPTICS-ETHERNET-MIB::s3EnetPortTable
's3000_pb_index' => 's3EnetPortBoardIndex',
's3000_pp_index' => 's3EnetPortIndex',
's3000_up_admin' => 's3EnetPortPartStatus',
's3000_up' => 's3EnetPortLinkStatus',
# SYNOPTICS-ETHERNET-MIB::s3EnetShowNodesTable
's3000_nb_index' => 's3EnetShowNodesSlotIndex',
's3000_np_index' => 's3EnetShowNodesPortIndex',
'fw_mac' => 's3EnetShowNodesMacAddress',
# SYNOPTICS-ETHERNET-MIB::s3EnetTopNmmTable
's3000_topo_port' => 's3EnetTopNmmPort',
's3000_topo_mac' => 's3EnetTopNmmMacAddr',
);
%MUNGE = (
%SNMP::Info::Layer1::MUNGE,
%SNMP::Info::Bridge::MUNGE,
's3000_topo_mac' => \&SNMP::Info::munge_mac
);
sub layers {
return '00000011';
}
sub os {
return 'synoptics';
}
sub vendor {
return 'nortel';
}
sub model {
my $s3000 = shift;
my $id = $s3000->id();
return undef unless defined $id;
my $model = &SNMP::translateObj($id);
return $id unless defined $model;
$model =~ s/^s3reg-//i;
return $1 if ($model =~ /((\d+){3}[\dX])/);
return $model;
}
sub os_ver {
my $s3000 = shift;
my $major_ver = $s3000->s3000_major_ver() || 0;
my $minor_ver = $s3000->s3000_minor_ver() || 0;
my $maint_ver = $s3000->s3000_maint_ver() || 0;
my $ver = "$major_ver.$minor_ver.$maint_ver";
return $ver;
}
sub mac {
my $s3000 = shift;
my $topo_port = $s3000->s3000_topo_port();
my $topo_mac = $s3000->s3000_topo_mac();
foreach my $entry (keys %$topo_port){
my $port = $topo_port->{$entry};
next unless $port == 0;
my $mac = $topo_mac->{$entry};
return $mac;
}
# Topology turned off, not supported.
return undef;
}
# Hubs do not support ifMIB requirements for get MAC
# and port status
sub i_index {
my $s3000 = shift;
my $b_index = $s3000->s3000_pb_index();
my $p_index = $s3000->s3000_pp_index();
my %i_index;
foreach my $iid (keys %$b_index){
my $board = $b_index->{$iid};
next unless defined $board;
my $port = $p_index->{$iid}||0;
# We need to make up an index for multiple board instances.
my $index = ($board*256)+$port;
$i_index{$iid} = $index;
}
return \%i_index;
}
sub interfaces {
my $s3000 = shift;
my $i_index = $s3000->i_index();
my %if;
foreach my $iid (keys %$i_index){
my $index = $i_index->{$iid};
next unless defined $index;
# Index numbers are deterministic slot * 256 + port - see i_index()
my $port = $index % 256;
my $slot = int($index / 256);
my $slotport = "$slot.$port";
$if{$index} = $slotport;
}
return \%if;
}
sub i_duplex {
my $s3000 = shift;
my $port_index = $s3000->i_index();
my %i_duplex;
foreach my $iid (keys %$port_index){
my $index = $port_index->{$iid};
next unless defined $index;
# Hubs only function half duplex
my $duplex = 'half';
$i_duplex{$index}=$duplex;
}
return \%i_duplex;
}
sub i_duplex_admin {
my $s3000 = shift;
my $port_index = $s3000->i_index();
my %i_duplex_admin;
foreach my $iid (keys %$port_index){
my $index = $port_index->{$iid};
next unless defined $index;
# Hubs only function half duplex
my $duplex = 'half';
$i_duplex_admin{$index}=$duplex;
}
return \%i_duplex_admin;
}
sub i_speed {
my $s3000 = shift;
my $port_index = $s3000->i_index();
my %i_speed;
foreach my $iid (keys %$port_index){
my $index = $port_index->{$iid};
next unless defined $index;
# These hubs only support 10Mbs
my $speed = '10000000';
$i_speed{$index}=$speed;
}
return \%i_speed;
}
sub i_up {
my $s3000 = shift;
my $port_index = $s3000->i_index();
my $link_stat = $s3000->s3000_up();
my %i_up;
foreach my $iid (keys %$port_index){
my $index = $port_index->{$iid};
next unless defined $index;
my $link_stat = $link_stat->{$iid};
next unless defined $link_stat;
$link_stat = 'up' if $link_stat =~ /on/i;
$link_stat = 'down' if $link_stat =~ /off/i;
$i_up{$index}=$link_stat;
}
return \%i_up;
}
sub i_up_admin {
my $s3000 = shift;
my $i_index = $s3000->i_index();
my $link_stat = $s3000->s3000_up_admin();
my %i_up_admin;
foreach my $iid (keys %$i_index){
my $index = $i_index->{$iid};
next unless defined $index;
my $link_stat = $link_stat->{$iid};
next unless defined $link_stat;
$i_up_admin{$index}=$link_stat;
}
return \%i_up_admin;
}
sub set_i_up_admin {
# map setting to those the hub will understand
my %setting = qw/up 2 down 3/;
my $s3000 = shift;
my ($setting, $iid) = @_;
my $i_index = $s3000->i_index();
my %reverse_i_index = reverse %$i_index;
$setting = lc($setting);
return 0 unless defined $setting{$setting};
$iid = $reverse_i_index{$iid};
return $s3000->set_s3000_up_admin($setting{$setting}, $iid);
}
# Hubs do not support the standard Bridge MIB
sub bp_index {
my $s3000 = shift;
my $b_index = $s3000->s3000_nb_index();
my $p_index = $s3000->s3000_np_index();
my $model = $s3000->model();
my %bp_index;
foreach my $iid (keys %$b_index){
my $board = $b_index->{$iid};
next unless defined $board;
my $port = $p_index->{$iid}||0;
my $index = ($board*256)+$port;
$bp_index{$index} = $index;
}
return \%bp_index;
}
sub fw_port {
my $s3000 = shift;
my $b_index = $s3000->s3000_nb_index();
my $p_index = $s3000->s3000_np_index();
my $model = $s3000->model();
my %fw_port;
foreach my $iid (keys %$b_index){
my $board = $b_index->{$iid};
next unless defined $board;
my $port = $p_index->{$iid}||0;
my $index = ($board*256)+$port;
$fw_port{$iid} = $index;
}
return \%fw_port;
}
1;
__END__
=head1 NAME
SNMP::Info::Layer1::S3000 - SNMP Interface to Synoptics / Nortel Hubs
=head1 AUTHOR
Eric Miller
=head1 SYNOPSIS
#Let SNMP::Info determine the correct subclass for you.
my $s3000 = 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 = $s3000->class();
print "SNMP::Info determined this device to fall under subclass : $class\n";
=head1 DESCRIPTION
Provides abstraction to the configuration information obtainable from a
Bayhub device through SNMP. Also provides device MAC to port mapping through the propietary MIB.
For speed or debugging purposes you can call the subclass directly, but not after determining
a more specific class using the method above.
my $s3000 = new SNMP::Info::Layer1::S3000(...);
=head2 Inherited Classes
=over
=item SNMP::Info::Layer1
=item SNMP::Info::Bridge
=back
=head2 Required MIBs
=over
=item SYNOPTICS-COMMON-MIB
=item SYNOPTICS-ETHERNET-MIB
=item Inherited Classes' MIBs
See SNMP::Info::Layer1 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 $s3000->vendor()
Returns 'nortel'
=item $s3000->os()
Returns 'synoptics'
=item $s3000->model()
Cross references $s3000->id() to the SYNOPTICS-MIB and returns
the results.
Removes sreg- from the model name and returns only the numeric model identifier.
=item $stack->os_ver()
Returns the software version specified as major.minor.maint.
(B<s3AgentSwMajorVer>).(B<s3AgentSwMinorVer>).(B<s3AgentSwMaintVer>)
=item $stack->os_bin()
Returns the firmware version. (B<s3AgentFwVer>)
=item $s3000->mac()
Returns MAC of the advertised IP address of the device.
=back
=head2 Overrides
=over
=item $s3000->layers()
Returns 00000011. Class emulates Layer 2 functionality through proprietary MIBs.
=back
=head2 Globals imported from SNMP::Info::Layer1
See documentation in SNMP::Info::Layer1 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 $s3000->i_index()
Returns reference to map of IIDs to Interface index.
Since hubs do not support ifIndex, the interface index is created using the
formula (board * 256 + port). This is required to support devices with more than one module.
=item $s3000->interfaces()
Returns reference to map of IIDs to physical ports.
=item $s3000->i_duplex()
Returns half, hubs do not support full duplex.
=item $s3000->i_duplex_admin()
Returns half, hubs do not support full duplex.
=item $s3000->i_speed()
Returns 10000000. The hubs only support 10Mbs Ethernet.
=item $s3000->i_up()
Returns (B<s3EnetPortLinkStatus>) for each port. Translates on/off to up/down.
=item $s3000->i_up_admin()
Returns (B<s3EnetPortPartStatus>) for each port.
=item $s3000->set_i_up_admin(state, ifIndex)
Sets port state, must be supplied with state and port ifIndex
State choices are 'up'or 'down'
Example:
my %if_map = reverse %{$s3000->interfaces()};
$s3000->set_i_up_admin('down', $if_map{'1.1'})
or die "Couldn't change port state. ",$s3000->error(1);
=item $s3000->bp_index()
Simulates bridge MIB by returning reference to a hash containing the index for
both the keys and values.
=item $s3000->fw_port()
Returns reference to map of IIDs of the SYNOPTICS-ETHERNET-MIB::s3EnetShowNodesTable
to the Interface index.
=item $s3000->fw_mac()
(B<s3EnetShowNodesMacAddress>)
=item $s3000->s3000_topo_port()
Returns reference to hash. Key: Table entry, Value:Port Number (interface iid)
(B<s3EnetTopNmmPort>)
=item $s3000->s3000_topo_mac()
(B<s3EnetTopNmmMacAddr>)
Returns reference to hash. Key: Table entry, Value:Remote MAC address
=back
=head2 Table Methods imported from SNMP::Info::Layer1
See documentation in SNMP::Info::Layer1 for details.
=head2 Table Methods imported from SNMP::Info::Bridge
See documentation in SNMP::Info::Bridge for details.
=cut

View File

@@ -1,7 +1,7 @@
# SNMP::Info::Layer2 - SNMP Interface to Layer2 Devices
# Max Baker
# Max Baker <max@warped.org>
#
# Copyright (c) 2004,2005 Max Baker -- All changes from Version 0.7 on
# Copyright (c) 2004 Max Baker -- All changes from Version 0.7 on
#
# Copyright (c) 2002,2003 Regents of the University of California
# All rights reserved.
@@ -30,7 +30,7 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer2;
$VERSION = '1.03';
$VERSION = 0.9;
# $Id$
use strict;
@@ -38,36 +38,53 @@ use strict;
use Exporter;
use SNMP::Info;
use SNMP::Info::Bridge;
use SNMP::Info::Entity;
use SNMP::Info::CDP;
use SNMP::Info::CiscoStats;
use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %PORTSTAT %MUNGE $INIT/;
@SNMP::Info::Layer2::ISA = qw/SNMP::Info SNMP::Info::Bridge SNMP::Info::Entity Exporter/;
@SNMP::Info::Layer2::ISA = qw/SNMP::Info SNMP::Info::Bridge SNMP::Info::CDP SNMP::Info::CiscoStats Exporter/;
@SNMP::Info::Layer2::EXPORT_OK = qw//;
%MIBS = ( %SNMP::Info::MIBS,
%SNMP::Info::Bridge::MIBS,
%SNMP::Info::Entity::MIBS,
$DEBUG=0;
$SNMP::debugging=$DEBUG;
# See SNMP::Info for the details of these data structures and
# the interworkings.
$INIT = 0;
%MIBS = ( %SNMP::Info::MIBS,
%SNMP::Info::Bridge::MIBS,
%SNMP::Info::CDP::MIBS,
%SNMP::Info::CiscoStats::MIBS,
'CISCO-PRODUCTS-MIB' => 'sysName', # for model()
'CISCO-STACK-MIB' => 'wsc1900sysID', # some older catalysts live here
'ENTITY-MIB' => 'entPhysicalName', # for serial stuff
);
%GLOBALS = (
%SNMP::Info::GLOBALS,
%SNMP::Info::Bridge::GLOBALS,
%SNMP::Info::Entity::GLOBALS,
%SNMP::Info::CDP::GLOBALS,
%SNMP::Info::CiscoStats::GLOBALS,
'serial1' => '.1.3.6.1.4.1.9.3.6.3.0', # OLD-CISCO-CHASSIS-MIB::chassisId.0
);
%FUNCS = (
%SNMP::Info::FUNCS,
%SNMP::Info::Bridge::FUNCS,
%SNMP::Info::Entity::FUNCS,
%SNMP::Info::CDP::FUNCS,
%SNMP::Info::CiscoStats::FUNCS,
'ent_serial' => 'entPhysicalSerialNum',
'ent_chassis'=> 'entPhysicalDescr',
);
%MUNGE = (
# Inherit all the built in munging
%SNMP::Info::MUNGE,
%SNMP::Info::Bridge::MUNGE,
%SNMP::Info::Entity::MUNGE,
%SNMP::Info::CDP::MUNGE,
%SNMP::Info::CiscoStats::MUNGE,
);
# Method OverRides
@@ -95,7 +112,7 @@ sub vendor {
my $model = $l2->model();
my $descr = $l2->description();
if ($model =~ /hp/i or $descr =~ /\bhp\b/i) {
if ($model =~ /hp/i or $descr =~ /hp/i) {
return 'hp';
}
@@ -108,12 +125,12 @@ sub vendor {
sub serial {
my $l2 = shift;
my $serial1 = $l2->serial1();
my $e_descr = $l2->e_descr() || {};
my $e_serial = $l2->e_serial() || {};
my $serial1 = $l2->serial1();
my $ent_chassis = $l2->ent_chassis() || {};
my $ent_serial = $l2->ent_serial() || {};
my $serial2 = $e_serial->{1} || undef;
my $chassis = $e_descr->{1} || undef;
my $serial2 = $ent_serial->{1} || undef;
my $chassis = $ent_chassis->{1} || undef;
# precedence
# serial2,chassis parse,serial1
@@ -140,18 +157,31 @@ sub i_ignore {
return \%i_ignore;
}
# By Default we'll use the description field
sub interfaces {
my $l2 = shift;
my $interfaces = $l2->i_index();
my $i_descr = $l2->i_description();
my $i_name = $l2->i_name();
# Replace the Index with the ifDescr field.
foreach my $iid (keys %$i_descr){
my %if;
foreach my $iid (keys %$interfaces){
my $port = $i_descr->{$iid};
my $name = $i_name->{$iid};
$port = $name if (defined $name and $name !~ /^\s*$/);
next unless defined $port;
$interfaces->{$iid} = $port;
# Cisco 1900 has a space in some of its port descr.
# get rid of any weird characters
$port =~ s/[^\d\/,()\w]+//gi;
# Translate Cisco 2926,etc. from 1/5 to 1.5
$port =~ s/\//\./ if ($port =~ /^\d+\/\d+$/);
$if{$iid} = $port;
}
return $interfaces;
return \%if
}
1;
@@ -163,7 +193,7 @@ SNMP::Info::Layer2 - Perl5 Interface to network devices serving Layer2 only.
=head1 AUTHOR
Max Baker
Max Baker (C<max@warped.org>)
=head1 SYNOPSIS
@@ -213,7 +243,9 @@ a more specific class using the method above.
=item SNMP::Info::Bridge
=item SNMP::Info::Entity
=item SNMP::Info::CDP
=item SNMP::Info::CiscoStats
=back
@@ -221,13 +253,21 @@ a more specific class using the method above.
=over
=item CISCO-PRODUCTS-MIB
Needed for ID of Cisco Products
=item CISCO-STACK-MIB
Needed for ID of Cisco Products
=item Inherited Classes
MIBs required by the inherited classes listed above.
=back
MIBs can be found in netdisco-mibs package.
MIBs can be found at ftp://ftp.cisco.com/pub/mibs/v2/v2.tar.gz
=head1 GLOBALS
@@ -260,9 +300,13 @@ See documentation in SNMP::Info for details.
See documentation in SNMP::Info::Bridge for details.
=head2 Globals imported from SNMP::Info::Entity
=head2 Globals imported from SNMP::Info::CDP
See documentation in SNMP::Info::Entity for details.
See documentation in SNMP::Info::CDP for details.
=head2 Globals imported from SNMP::Info::CiscoStats
See documentation in SNMP::Info::CiscoStats for details.
=head1 TABLE METHODS
@@ -295,8 +339,12 @@ See documentation in SNMP::Info for details.
See documentation in SNMP::Info::Bridge for details.
=head2 Table Methods imported from SNMP::Info::Entity
=head2 Table Methods imported from SNMP::Info::CDP
See documentation in SNMP::Info::Entity for details.
See documentation in SNMP::Info::CDP for details.
=head2 Table Methods imported from SNMP::Info::CiscoStats
See documentation in SNMP::Info::CiscoStats for details.
=cut

View File

@@ -1,5 +1,5 @@
# SNMP::Info::Layer2::Aironet
# Max Baker
# Max Baker <max@warped.org>
#
# Copyright (c) 2004 Max Baker changes from version 0.8 and beyond.
#
@@ -30,7 +30,7 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer2::Aironet;
$VERSION = '1.03';
$VERSION = 0.9;
# $Id$
use strict;
@@ -38,23 +38,20 @@ use Exporter;
use SNMP::Info::Layer2;
use SNMP::Info::Entity;
use SNMP::Info::EtherLike;
use SNMP::Info::CiscoStats;
use SNMP::Info::CiscoVTP;
use SNMP::Info::CDP;
@SNMP::Info::Layer2::Aironet::ISA = qw/SNMP::Info::Layer2 SNMP::Info::Entity SNMP::Info::EtherLike
SNMP::Info::CiscoStats SNMP::Info::CiscoVTP SNMP::Info::CDP Exporter/;
SNMP::Info::CiscoVTP Exporter/;
@SNMP::Info::Layer2::Aironet::EXPORT_OK = qw//;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
# Set for No CDP
%GLOBALS = (
%SNMP::Info::Layer2::GLOBALS,
%SNMP::Info::Entity::GLOBALS,
%SNMP::Info::EtherLike::GLOBALS,
%SNMP::Info::CiscoStats::GLOBALS,
%SNMP::Info::CiscoVTP::GLOBALS,
%SNMP::Info::CDP::GLOBALS,
'serial' => 'entPhysicalSerialNum.1',
'descr' => 'sysDescr'
);
@@ -62,30 +59,20 @@ use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
%FUNCS = (%SNMP::Info::Layer2::FUNCS,
%SNMP::Info::Entity::FUNCS,
%SNMP::Info::EtherLike::FUNCS,
%SNMP::Info::CiscoStats::FUNCS,
%SNMP::Info::CiscoVTP::FUNCS,
%SNMP::Info::CDP::FUNCS,
'i_ssidlist' => 'cd11IfAuxSsid',
'i_ssidbcast' => 'cd11IfAuxSsidBroadcastSsid',
'i_80211channel' => 'cd11IfPhyDsssCurrentChannel',
);
%MIBS = (
%SNMP::Info::Layer2::MIBS,
%SNMP::Info::Entity::MIBS,
%SNMP::Info::EtherLike::MIBS,
%SNMP::Info::CiscoStats::MIBS,
%SNMP::Info::CiscoVTP::MIBS,
%SNMP::Info::CDP::MIBS,
'CISCO-DOT11-IF-MIB' => 'cd11IfAuxSsid',
);
%MUNGE = (%SNMP::Info::Layer2::MUNGE,
%SNMP::Info::Entity::MUNGE,
%SNMP::Info::EtherLike::MUNGE,
%SNMP::Info::CiscoStats::MUNGE,
%SNMP::Info::CiscoVTP::MUNGE,
%SNMP::Info::CDP::MUNGE,
);
@@ -137,7 +124,7 @@ SNMP::Info::Layer2::Aironet - SNMP Interface to Cisco Aironet devices running IO
=head1 AUTHOR
Max Baker
Max Baker (C<max@warped.org>)
=head1 SYNOPSIS

View File

@@ -1,5 +1,5 @@
# SNMP::Info::Layer2::Allied
# Max Baker, Dmitry Sergienko <dmitry@trifle.net>
# Max Baker <max@warped.org>, Dmitry Sergienko <dmitry@trifle.net>
#
# Copyright (c) 2004 Max Baker
# All rights reserved.
@@ -28,7 +28,7 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer2::Allied;
$VERSION = '1.03';
$VERSION = 0.9;
# $Id$
use strict;
@@ -119,10 +119,10 @@ sub i_up {
my $allied = shift;
my $i_up = SNMP::Info::Layer1::i_up($allied);
#my $i_up2 = $allied->i_up2() || {};
my $i_up2 = $allied->i_up2();
foreach my $port (keys %$i_up){
my $up = $i_up->{$port};
foreach my $port (keys %$ati_up){
my $up = $ati_up->{$port};
$i_up->{$port} = 'down' if $up eq 'linktesterror';
$i_up->{$port} = 'up' if $up eq 'nolinktesterror';
}
@@ -138,7 +138,7 @@ SNMP::Info::Layer2::Allied - SNMP Interface to Allied Telesyn switches
=head1 AUTHOR
Max Baker, Dmitry Sergienko <dmitry@trifle.net>
Max Baker (C<max@warped.org>)
=head1 SYNOPSIS

View File

@@ -1,420 +0,0 @@
# SNMP::Info::Layer2::Aruba
# Eric Miller
# $Id$
#
# Copyright (c) 2005 Eric Miller
#
# 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::Aruba;
$VERSION = '1.03';
use strict;
use Exporter;
use SNMP::Info;
use SNMP::Info::Bridge;
@SNMP::Info::Layer2::Aruba::ISA = qw/SNMP::Info SNMP::Info::Bridge Exporter/;
@SNMP::Info::Layer2::Aruba::EXPORT_OK = qw//;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
%MIBS = (
%SNMP::Info::MIBS,
%SNMP::Info::Bridge::MIBS,
'WLSX-SWITCH-MIB' => 'wlsxHostname',
);
%GLOBALS = (
%SNMP::Info::GLOBALS,
%SNMP::Info::Bridge::GLOBALS,
);
%FUNCS = (
%SNMP::Info::FUNCS,
%SNMP::Info::Bridge::FUNCS,
'i_index2' => 'ifIndex',
'i_name2' => 'ifName',
# WLSX-SWITCH-MIB::wlsxSwitchAccessPointTable
# Table index leafs do not return information
# therefore unable to use apESSID. We extract
# the information from the IID instead.
#'aruba_ap_essid' => 'apESSID',
'aruba_ap_name' => 'apLocation',
'aruba_ap_ip' => 'apIpAddress',
# WLSX-SWITCH-MIB::wlsxSwitchStationMgmtTable
# Table index leafs do not return information
# therefore unable to use staAccessPointBSSID
# or staPhyAddress. We extract the information from
# the IID instead.
#'fw_port' => 'staAccessPointBSSID',
#'fw_mac' => 'staPhyAddress',
'fw_user' => 'staUserName',
);
%MUNGE = (
%SNMP::Info::MUNGE,
%SNMP::Info::Bridge::MUNGE,
);
sub layers {
return '00000011';
}
sub os {
return 'airos';
}
sub vendor {
return 'aruba';
}
sub os_ver {
my $aruba = shift;
my $descr = $aruba->description();
return undef unless defined $descr;
if ($descr =~ m/Version\s+(\d+\.\d+\.\d+\.\d+)/){
return $1;
}
return undef;
}
sub model {
my $aruba = shift;
my $id = $aruba->id();
return undef unless defined $id;
my $model = &SNMP::translateObj($id);
return $id unless defined $model;
return $model;
}
# Thin APs do not support ifMIB requirement
sub i_index {
my $aruba = shift;
my $i_index = $aruba->i_index2();
my $ap_index = $aruba->aruba_ap_name();
my %if_index;
foreach my $iid (keys %$i_index){
my $index = $i_index->{$iid};
next unless defined $index;
$if_index{$iid} = $index;
}
# Get Attached APs as Interfaces
foreach my $ap_id (keys %$ap_index){
# Convert the 0.254.123.456 index entry to a MAC address.
my $mac = join(':',map {sprintf("%02x",$_)} split(/\./,$ap_id));
$if_index{$ap_id} = $mac;
}
return \%if_index;
}
sub interfaces {
my $aruba = shift;
my $i_index = $aruba->i_index();
my $i_descr = $aruba->i_description();
my %if;
foreach my $iid (keys %$i_index){
my $index = $i_index->{$iid};
next unless defined $index;
if ($index =~ /^\d+$/ ) {
# Replace the Index with the ifDescr field.
my $port = $i_descr->{$iid};
next unless defined $port;
$if{$iid} = $port;
}
elsif ($index =~ /(?:[0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}/) {
$if{$index} = $index;
}
else {
next;
}
}
return \%if;
}
sub i_name {
my $aruba = shift;
my $i_index = $aruba->i_index();
my $i_name2 = $aruba->i_name2();
my $ap_name = $aruba->aruba_ap_name();
my %i_name;
foreach my $iid (keys %$i_index){
my $index = $i_index->{$iid};
next unless defined $index;
if ($index =~ /^\d+$/ ) {
my $name = $i_name2->{$iid};
next unless defined $name;
$i_name{$index} = $name;
}
elsif ($index =~ /(?:[0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}/) {
my $name = $ap_name->{$iid};
next unless defined $name;
$i_name{$index} = $name;
}
else {
next;
}
}
return \%i_name;
}
# Wireless switches do not support the standard Bridge MIB
sub bp_index {
my $aruba = shift;
my $i_index = $aruba->i_index2();
my $ap_index = $aruba->aruba_ap_name();
my %bp_index;
foreach my $iid (keys %$i_index){
my $index = $i_index->{$iid};
next unless defined $index;
$bp_index{$iid} = $index;
}
# Get Attached APs as Interfaces
foreach my $ap_id (keys %$ap_index){
# Convert the 0.254.123.456 index entry to a MAC address.
my $mac = join(':',map {sprintf("%02x",$_)} split(/\./,$ap_id));
$bp_index{$mac} = $mac;
}
return \%bp_index;
}
sub fw_port {
my $aruba = shift;
my $fw_idx = $aruba->fw_user();
my %fw_port;
foreach my $iid (keys %$fw_idx){
if ($iid =~ /(\d+\.\d+\.\d+\.\d+\.\d+\.\d+).(\d+\.\d+\.\d+\.\d+\.\d+\.\d+)/) {
my $port = join(':',map {sprintf("%02x",$_)} split(/\./,$2));
$fw_port{$iid} = $port;
}
else {
next;
}
}
return \%fw_port;
}
sub fw_mac {
my $aruba = shift;
my $fw_idx = $aruba->fw_user();
my %fw_mac;
foreach my $iid (keys %$fw_idx){
if ($iid =~ /(\d+\.\d+\.\d+\.\d+\.\d+\.\d+).(\d+\.\d+\.\d+\.\d+\.\d+\.\d+)/) {
my $mac = join(':',map {sprintf("%02x",$_)} split(/\./,$1));
$fw_mac{$iid} = $mac;
}
else {
next;
}
}
return \%fw_mac;
}
1;
__END__
=head1 NAME
SNMP::Info::Layer2::Aruba - SNMP Interface to Aruba wireless switches
=head1 AUTHOR
Eric Miller
=head1 SYNOPSIS
my $aruba = new SNMP::Info(
AutoSpecify => 1,
Debug => 1,
DestHost => 'myswitch',
Community => 'public',
Version => 2
)
or die "Can't connect to DestHost.\n";
my $class = $aruba->class();
print " Using device sub class : $class\n";
=head1 DESCRIPTION
SNMP::Info::Layer2::Aruba is a subclass of SNMP::Info that provides an interface
to Aruba wireless switches. The Aruba platform utilizes intelligent wireless
switches which control thin access points. The thin access points themselves
are unable to be polled for end station information.
This class emulates bridge functionality for the wireless switch. This enables
end station MAC addresses collection and correlation to the thin access point
the end station is using for communication.
For speed or debugging purposes you can call the subclass directly, but not after
determining a more specific class using the method above.
my $aruba = new SNMP::Info::Layer2::Aruba(...);
=head2 Inherited Classes
=over
=item SNMP::Info
=item SNMP::Info::Bridge
=back
=head2 Required MIBs
=over
=item WLSX-SWITCH-MIB
=item Inherited Classes' MIBs
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 $aruba->model()
Returns model type. Cross references $aruba->id() with product IDs in the
Aruba MIB.
=item $aruba->vendor()
Returns 'aruba'
=item $aruba->os()
Returns 'airos'
=item $aruba->os_ver()
Returns the software version extracted from B<sysDescr>
=back
=head2 Overrides
=over
=item $aruba->layers()
Returns 00000011. Class emulates Layer 2 functionality for Thin APs through
proprietary MIBs.
=back
=head1 TABLE ENTRIES
These are methods that return tables of information in the form of a reference
to a hash.
=head2 Overrides
=over
=item $aruba->i_index()
Returns reference to map of IIDs to Interface index.
Extends ifIndex to support thin APs as device interfaces.
=item $aruba->interfaces()
Returns reference to map of IIDs to ports. Thin APs are implemented as device
interfaces. The thin AP MAC address is used as the port identifier.
=item $aruba->i_name()
Interface name. Returns (B<ifName>) for Ethernet interfaces and (B<apLocation>)
for thin AP interfaces.
=item $aruba->bp_index()
Simulates bridge MIB by returning reference to a hash containing the index for
both the keys and values.
=item $aruba->fw_port()
(B<staAccessPointBSSID>) as extracted from the IID.
=item $aruba->fw_mac()
(B<staPhyAddress>) as extracted from the IID.
=back
=head2 Aruba Switch AP Table (B<wlsxSwitchAccessPointTable>)
=over
=item $aruba->aruba_ap_name()
(B<apLocation>)
=item $aruba->aruba_ap_ip()
(B<apIpAddress>)
=back
=head2 Aruba Switch Station Management Table (B<wlsxSwitchStationMgmtTable>)
=over
=item $aruba->fw_user()
(B<staUserName>)
=cut

View File

@@ -1,5 +1,5 @@
# SNMP::Info::Layer2::Bay
# Max Baker
# Max Baker <max@warped.org>
# This module depricated. See Layer2::BayStack
#
# Copyright (c) 2004 Max Baker changes from version 0.8 and beyond.
@@ -31,7 +31,7 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer2::Bay;
$VERSION = '1.03';
$VERSION = 0.9;
# $Id$
use strict;
@@ -273,7 +273,7 @@ SNMP::Info::Layer2::Bay - SNMP Interface to old Bay Network BayStack Switches
=head1 AUTHOR
Max Baker
Max Baker (C<max@warped.org>)
=head1 SYNOPSIS

View File

@@ -1,8 +1,8 @@
# SNMP::Info::Layer2::Baystack
# Eric Miller
# Eric Miller <eric@jeneric.org>
# $Id$
#
# Copyright (c) 2004-6 Max Baker changes from version 0.8 and beyond.
# 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
@@ -29,17 +29,17 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer2::Baystack;
$VERSION = '1.03';
$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;
use SNMP::Info::NortelStack;
@SNMP::Info::Layer2::Baystack::ISA = qw/SNMP::Info SNMP::Info::Bridge SNMP::Info::SONMP SNMP::Info::RapidCity SNMP::Info::NortelStack Exporter/;
@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/;
@@ -47,31 +47,27 @@ 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,
%SNMP::Info::NortelStack::MIBS,
);
%GLOBALS = (
%SNMP::Info::GLOBALS,
%SNMP::Info::Bridge::GLOBALS,
%SNMP::Info::NortelStack::GLOBALS,
%SNMP::Info::SONMP::GLOBALS,
%SNMP::Info::RapidCity::GLOBALS,
%SNMP::Info::NortelStack::GLOBALS,
);
%FUNCS = (
%SNMP::Info::FUNCS,
%SNMP::Info::Bridge::FUNCS,
%SNMP::Info::NortelStack::FUNCS,
%SNMP::Info::SONMP::FUNCS,
%SNMP::Info::RapidCity::FUNCS,
%SNMP::Info::NortelStack::FUNCS,
'i_name2' => 'ifName',
'i_mac2' => 'ifPhysAddress',
# From RFC1213-MIB
'at_index' => 'ipNetToMediaIfIndex',
'at_paddr' => 'ipNetToMediaPhysAddress',
'at_netaddr' => 'ipNetToMediaNetAddress',
);
# 450's report full duplex as speed = 20mbps?!
@@ -82,11 +78,10 @@ $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,
%SNMP::Info::NortelStack::MUNGE,
'i_mac2' => \&SNMP::Info::munge_mac,
'at_paddr' => \&SNMP::Info::munge_mac,
);
sub os {
@@ -94,7 +89,7 @@ sub os {
my $descr = $baystack->description();
my $model = $baystack->model();
if ((defined $model and $model =~ /(470|460|BPS|5510|5520|5530)/) and (defined $descr and $descr =~ m/SW:v[3-5]/i)) {
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';
@@ -131,13 +126,23 @@ sub model {
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 $2 if ($model =~ /(ES|ERS|BayStack|EthernetRoutingSwitch|EthernetSwitch)(\d+)/);
return '5510' if ($model =~ /BayStack5510/i);
return '5520' if ($model =~ /BayStack5520/i);
return $model;
}
@@ -168,8 +173,8 @@ sub interfaces {
# Ignore cascade ports
next if $index > 513;
my $port = ($index % $index_factor);
my $slot = (int($index / $index_factor)) + $slot_offset;
my $port = ($index % $index_factor);
my $slot = (int($index / $index_factor)) + $slot_offset;
my $slotport = "$slot.$port";
$if{$iid} = $slotport;
@@ -219,7 +224,7 @@ sub index_factor {
$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'));
$index_factor = 64 if ((defined $model and $model =~ /(470)/) or ($os eq 'BoSS') and ($op_mode eq 'pure'));
return $index_factor;
}
@@ -229,11 +234,12 @@ __END__
=head1 NAME
SNMP::Info::Layer2::Baystack - SNMP Interface to Nortel Ethernet (Baystack) Switches
SNMP::Info::Layer2::Baystack - SNMP Interface to Nortel Networks' Baystack Switches
=head1 AUTHOR
Eric Miller
Max Baker (C<max@warped.org>),
Eric Miller (C<eric@jeneric.org>)
=head1 SYNOPSIS
@@ -253,8 +259,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 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.
@@ -303,22 +309,19 @@ These are methods that return scalar value from SNMP
=item $baystack->vendor()
Returns 'nortel'
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.
to return depending on which it is.
Returns BPS for Business Policy Switch
For BayStack, EthernetRoutingSwitch, or EthernetSwitch extracts and returns
the switch numeric designation.
Removes sreg- from the model name
=item $baystack->os()
Returns 'baystack' or 'boss' depending on software version.
Returns 'Baystack' or 'BoSS' depending on software version.
=item $baystack->os_bin()
@@ -336,7 +339,7 @@ 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))
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.
@@ -400,30 +403,6 @@ Crosses ifName with ifAlias and returns the human set port name if exists.
=back
=head2 RFC1213 Arp Cache Table (B<ipNetToMediaTable>)
=over
=item $baystack->at_index()
Returns reference to hash. Maps ARP table entries to Interface IIDs
(B<ipNetToMediaIfIndex>)
=item $baystack->at_paddr()
Returns reference to hash. Maps ARP table entries to MAC addresses.
(B<ipNetToMediaPhysAddress>)
=item $baystack->at_netaddr()
Returns reference to hash. Maps ARP table entries to IPs
(B<ipNetToMediaNetAddress>)
=back
=head2 Table Methods imported from SNMP::Info
See documentation in SNMP::Info for details.

View File

@@ -1,5 +1,5 @@
# SNMP::Info::Layer2::C1900
# Max Baker
# Max Baker <max@warped.org>
#
# Copyright (c) 2004 Max Baker changes from version 0.8 and beyond.
#
@@ -30,18 +30,15 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer2::C1900;
$VERSION = '1.03';
$VERSION = 0.9;
# $Id$
use strict;
use Exporter;
use SNMP::Info::Layer2;
use SNMP::Info::CiscoVTP;
use SNMP::Info::CDP;
use SNMP::Info::CiscoStats;
@SNMP::Info::Layer2::C1900::ISA = qw/SNMP::Info::Layer2 SNMP::Info::CiscoVTP
SNMP::Info::CDP SNMP::Info::CiscoStats Exporter/;
@SNMP::Info::Layer2::C1900::ISA = qw/SNMP::Info::Layer2 SNMP::Info::CiscoVTP Exporter/;
@SNMP::Info::Layer2::C1900::EXPORT_OK = qw//;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
@@ -50,15 +47,11 @@ use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
%GLOBALS = (
%SNMP::Info::Layer2::GLOBALS,
%SNMP::Info::CiscoVTP::GLOBALS,
%SNMP::Info::CiscoStats::GLOBALS,
%SNMP::Info::CDP::GLOBALS,
'c1900_flash_status' => 'upgradeFlashBankStatus',
);
%FUNCS = (%SNMP::Info::Layer2::FUNCS,
%SNMP::Info::CiscoVTP::FUNCS,
%SNMP::Info::CiscoStats::FUNCS,
%SNMP::Info::CDP::FUNCS,
'i_type2' => 'ifType',
'i_name2' => 'ifName',
# ESSWITCH-MIB
@@ -75,16 +68,12 @@ use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
%MIBS = (
%SNMP::Info::Layer2::MIBS,
%SNMP::Info::CiscoVTP::MIBS,
%SNMP::Info::CiscoStats::MIBS,
%SNMP::Info::CDP::MIBS,
# Also known as the ESSWITCH-MIB
'STAND-ALONE-ETHERNET-SWITCH-MIB' => 'series2000'
);
%MUNGE = (%SNMP::Info::Layer2::MUNGE,
%SNMP::Info::CiscoVTP::MUNGE,
%SNMP::Info::CDP::MUNGE,
%SNMP::Info::CiscoStats::MUNGE,
);
sub vendor {
@@ -110,8 +99,9 @@ sub os_ver {
return undef;
}
sub bulkwalk_no { 1; }
sub cisco_comm_indexing { 1; }
sub cisco_comm_indexing {
1;
}
sub interfaces {
my $c1900 = shift;
@@ -220,7 +210,7 @@ SNMP::Info::Layer2::C1900 - Perl5 Interface to SNMP data from Cisco Catlyst 1900
=head1 AUTHOR
Max Baker
Max Baker (C<max@warped.org>)
=head1 SYNOPSIS
@@ -280,10 +270,6 @@ These are methods that return scalar value from SNMP
=over
=item $c1900->bulkwalk_no
Return C<1>. Bulkwalk is turned off for this class.
=item $c1900->c1900_flash_status()
Usually contains the version of the software loaded in flash.

View File

@@ -1,5 +1,5 @@
# SNMP::Info::Layer2::C2900
# Max Baker
# Max Baker <max@warped.org>
#
# Copyright (c) 2004 Max Baker changes from version 0.8 and beyond.
#
@@ -30,18 +30,15 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer2::C2900;
$VERSION = '1.03';
$VERSION = 0.9;
# $Id$
use strict;
use Exporter;
use SNMP::Info::Layer2;
use SNMP::Info::CiscoVTP;
use SNMP::Info::CDP;
use SNMP::Info::CiscoStats;
@SNMP::Info::Layer2::C2900::ISA = qw/SNMP::Info::Layer2 SNMP::Info::CiscoVTP
SNMP::Info::CDP SNMP::Info::CiscoStats Exporter/;
@SNMP::Info::Layer2::C2900::ISA = qw/SNMP::Info::Layer2 SNMP::Info::CiscoVTP Exporter/;
@SNMP::Info::Layer2::C2900::EXPORT_OK = qw//;
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
@@ -50,14 +47,10 @@ use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
%GLOBALS = (
%SNMP::Info::Layer2::GLOBALS,
%SNMP::Info::CiscoVTP::GLOBALS,
%SNMP::Info::CiscoStats::GLOBALS,
%SNMP::Info::CDP::GLOBALS,
);
%FUNCS = (%SNMP::Info::Layer2::FUNCS,
%SNMP::Info::CiscoVTP::FUNCS,
%SNMP::Info::CiscoStats::FUNCS,
%SNMP::Info::CDP::FUNCS,
'i_name' => 'ifAlias',
# C2900PortEntry
'c2900_p_index' => 'c2900PortIfIndex',
@@ -68,15 +61,11 @@ use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
%MIBS = ( %SNMP::Info::Layer2::MIBS,
%SNMP::Info::CiscoVTP::MIBS,
%SNMP::Info::CiscoStats::MIBS,
%SNMP::Info::CDP::MIBS,
'CISCO-C2900-MIB' => 'ciscoC2900MIB',
);
%MUNGE = (%SNMP::Info::Layer2::MUNGE,
%SNMP::Info::CiscoVTP::MUNGE,
%SNMP::Info::CDP::MUNGE,
%SNMP::Info::CiscoStats::MUNGE,
);
sub vendor {
@@ -136,54 +125,6 @@ sub i_duplex_admin {
return \%i_duplex_admin;
}
### we want to be able to set speed on 2900 class switches
###
### $info->set_i_speed_admin("100", ifIndex);
### speed choices are 'auto', '10', '100'
###
sub set_i_speed_admin {
# map speeds to those the switch will understand
my %speeds = qw/auto 1 10 10000000 100 100000000/;
my $c2900 = shift;
my ($speed, $iid) = @_;
my $c2900_p_index = $c2900->c2900_p_index();
my %reverse_2900 = reverse %$c2900_p_index;
$speed = lc($speed);
return 0 unless defined $speeds{$speed};
# account for weirdness of c2900 mib
$iid = $reverse_2900{$iid};
return $c2900->set_c2900_p_speed_admin($speeds{$speed}, $iid);
}
### we want to be able to set duplex on 2900 class switches
###
### $info->set_i_duplex_admin("half", ifIndex);
### duplex choices are 'auto', 'half', 'full'
###
sub set_i_duplex_admin {
# map a textual duplex to an integer one the switch understands
my %duplexes = qw/full 1 half 2 auto 3/;
my $c2900 = shift;
my ($duplex, $iid) = @_;
my $c2900_p_index = $c2900->c2900_p_index();
my %reverse_2900 = reverse %$c2900_p_index;
$duplex = lc($duplex);
return 0 unless defined $duplexes{$duplex};
# account for weirdness of c2900 mib
$iid = $reverse_2900{$iid};
return $c2900->set_c2900_p_duplex_admin($duplexes{$duplex}, $iid);
}
# Use i_descritption for port key, cuz i_name can be manually entered.
sub interfaces {
my $c2900 = shift;
@@ -213,7 +154,7 @@ SNMP::Info::Layer2::C2900 - SNMP Interface to Cisco Catalyst 2900 Switches runni
=head1 AUTHOR
Max Baker
Max Baker (C<max@warped.org>)
=head1 SYNOPSIS
@@ -321,34 +262,7 @@ to a hash.
Returns reference to hash of IIDs to admin duplex setting
Crosses $c2900->c2900_p_index() with $c2900->c2900_p_duplex_admin;
=item $c2900->set_i_speed_admin(speed, ifIndex)
Sets port speed, must be supplied with speed and port ifIndex
Speed choices are 'auto', '10', '100'
Crosses $c2900->c2900_p_index() with $c2900->c2900_p_duplex_admin to
utilize port ifIndex.
Example:
my %if_map = reverse %{$c2900->interfaces()};
$c2900->set_i_speed_admin('auto', $if_map{'FastEthernet0/1'})
or die "Couldn't change port speed. ",$c2900->error(1);
=item $c2900->set_i_duplex_admin(duplex, ifIndex)
Sets port duplex, must be supplied with duplex and port ifIndex
Speed choices are 'auto', 'half', 'full'
Crosses $c2900->c2900_p_index() with $c2900->c2900_p_duplex_admin to
utilize port ifIndex.
Example:
my %if_map = reverse %{$c2900->interfaces()};
$c2900->set_i_duplex_admin('auto', $if_map{'FastEthernet0/1'})
or die "Couldn't change port duplex. ",$c2900->error(1);
=back

View File

@@ -1,5 +1,5 @@
# SNMP::Info::Layer2::Catalyst
# Max Baker
# Max Baker <max@warped.org>
#
# Copyright (c) 2002,2003 Regents of the University of California
# Copyright (c) 2003,2004 Max Baker changes from version 0.8 and beyond
@@ -29,7 +29,7 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer2::Catalyst;
$VERSION = '1.03';
$VERSION = 0.9;
# $Id$
use strict;
@@ -38,53 +38,41 @@ use Exporter;
use SNMP::Info::Layer2;
use SNMP::Info::CiscoVTP;
use SNMP::Info::CiscoStack;
use SNMP::Info::CDP;
use SNMP::Info::CiscoStats;
use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %MUNGE $INIT/ ;
@SNMP::Info::Layer2::Catalyst::ISA = qw/SNMP::Info::Layer2 SNMP::Info::CiscoStack
SNMP::Info::CiscoVTP SNMP::Info::CDP SNMP::Info::CiscoStats Exporter/;
@SNMP::Info::Layer2::Catalyst::ISA = qw/SNMP::Info::CiscoStack SNMP::Info::Layer2
SNMP::Info::CiscoVTP Exporter/;
@SNMP::Info::Layer2::Catalyst::EXPORT_OK = qw//;
$DEBUG=0;
# See SNMP::Info for the details of these data structures and
# the interworkings.
$INIT = 0;
%MIBS = ( %SNMP::Info::Layer2::MIBS,
%SNMP::Info::CiscoVTP::MIBS,
%SNMP::Info::CiscoStack::MIBS,
%SNMP::Info::CiscoStats::MIBS,
%SNMP::Info::CDP::MIBS,
);
%GLOBALS = (
%SNMP::Info::Layer2::GLOBALS,
%SNMP::Info::CiscoVTP::GLOBALS,
%SNMP::Info::CiscoStack::GLOBALS,
%SNMP::Info::CiscoStats::GLOBALS,
%SNMP::Info::CDP::GLOBALS,
);
%FUNCS = (
%SNMP::Info::Layer2::FUNCS,
%SNMP::Info::CiscoVTP::FUNCS,
%SNMP::Info::CiscoStack::FUNCS,
%SNMP::Info::CiscoStats::FUNCS,
%SNMP::Info::CDP::FUNCS,
);
%MUNGE = (
%SNMP::Info::Layer2::MUNGE,
%SNMP::Info::CiscoVTP::MUNGE,
%SNMP::Info::CiscoStack::MUNGE,
%SNMP::Info::CDP::MUNGE,
%SNMP::Info::CiscoStats::MUNGE,
);
# Need to specify this or it might grab the ones out of L2 instead of CiscoStack
*SNMP::Info::Layer2::Catalyst::serial = \&SNMP::Info::CiscoStack::serial;
*SNMP::Info::Layer2::Catalyst::interfaces = \&SNMP::Info::CiscoStack::interfaces;
*SNMP::Info::Layer2::Catalyst::i_duplex = \&SNMP::Info::CiscoStack::i_duplex;
*SNMP::Info::Layer2::Catalyst::i_type = \&SNMP::Info::CiscoStack::i_type;
*SNMP::Info::Layer2::Catalyst::i_name = \&SNMP::Info::CiscoStack::i_name;
*SNMP::Info::Layer2::Catalyst::i_duplex_admin = \&SNMP::Info::CiscoStack::i_duplex_admin;
# Overidden Methods
# i_physical sets a hash entry as true if the iid is a physical port
@@ -122,23 +110,6 @@ sub os_ver {
return undef;
}
# Workaround for incomplete bp_index
sub bp_index {
my $cat = shift;
my $p_index = $cat->p_port();
my $b_index = $cat->p_oidx();
my %bp_index;
foreach my $iid (keys %$p_index){
my $ifidx = $p_index->{$iid};
next unless defined $ifidx;
my $bpidx = $b_index->{$iid}||0;
$bp_index{$bpidx} = $ifidx;
}
return \%bp_index;
}
sub cisco_comm_indexing {
1;
}
@@ -148,11 +119,11 @@ __END__
=head1 NAME
SNMP::Info::Layer2::Catalyst - Perl5 Interface to Cisco Catalyst devices running Catalyst OS.
SNMP::Info::Layer2::Catalyst - Perl5 Interface to Cisco Catalyst 5000 series devices.
=head1 AUTHOR
Max Baker
Max Baker (C<max@warped.org>)
=head1 SYNOPSIS
@@ -172,16 +143,15 @@ Max Baker
=head1 DESCRIPTION
SNMP::Info subclass to provide information for Cisco Catalyst series switches running CatOS.
This class includes the Catalyst 2920, 4000, 5000, 6000 (hybrid mode) families.
SNMP::Info subclass to provide information for Cisco Catalyst 5000 series switches running CatOS.
This subclass is not for all devices that have the name Catalyst. Note that some Catalyst
switches run IOS, like the 2900 and 3550 families. Cisco Catalyst 1900 switches use their
own MIB and have a separate subclass. Use the method above to have SNMP::Info determine the
appropriate subclass before using this class directly.
See SNMP::Info::device_type() for specifics.
This class includes the Catalyst 2950 series devices, which fall under the
Catalyst 5000 family.
Note: Some older Catalyst switches will only talk SNMP version 1. Some newer ones will not
return all their data if connected via Version 1.
@@ -257,19 +227,6 @@ See documentation in SNMP::Info::CiscoStack for details.
These are methods that return tables of information in the form of a reference
to a hash.
=head2 Overrides
=over
=item $cat->bp_index()
Returns reference to hash of bridge port table entries map back to interface identifier (iid)
Crosses (B<portCrossIndex>) to (B<portIfIndex>) since some devices seem to have
problems with BRIDGE-MIB
=back
=head2 Table Methods imported from SNMP::Info::CiscoVTP
See documentation in SNMP::Info::CiscoVTP for details.
@@ -278,7 +235,7 @@ See documentation in SNMP::Info::CiscoVTP for details.
See documentation in SNMP::Info::Layer2 for details.
=head2 Table Methods imported from SNMP::Info::Layer2::CiscoStack
=head2 Table Methods imported from SNMP::Info::Layer2::CiscoSTack
See documentation in SNMP::Info::Layer2::CiscoStack for details.

View File

@@ -1,8 +1,8 @@
# SNMP::Info::Layer2::Centillion
# Eric Miller
# Eric Miller <eric@jeneric.org>
# $Id$
#
# Copyright (c) 2004 Eric Miller
# Copyright (c) 2004 Max Baker
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -28,7 +28,7 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer2::Centillion;
$VERSION = '1.03';
$VERSION = 0.9;
use strict;
@@ -248,7 +248,7 @@ SNMP::Info::Layer2::Centillion - SNMP Interface to Nortel Centillion based ATM S
=head1 AUTHOR
Eric Miller
Eric Miller (C<eric@jeneric.org>)
=head1 SYNOPSIS

View File

@@ -1,299 +0,0 @@
# SNMP::Info::Layer2::Foundry - SNMP Interface to Foundry Switches
#
# Copyright (c) 2005 Max Baker
#
# 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;
$VERSION = '1.03';
# $Id$
use strict;
use Exporter;
use SNMP::Info::Layer2;
use SNMP::Info::FDP;
use SNMP::Info::EtherLike;
use SNMP::Info::MAU;
use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE/;
@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//;
%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 undef 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 { undef; }
1;
__END__
=head1 NAME
SNMP::Info::Layer2::Foundry - Perl5 Interface to Foundry FastIron Network Devices
=head1 AUTHOR
Max Baker
=head1 SYNOPSIS
# Let SNMP::Info determine the correct subclass for you.
my $foundry = new SNMP::Info(
AutoSpecify => 1,
Debug => 1,
# These arguments are passed directly on to SNMP::Session
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 provides support for Foundry EdgeIron Switches
=head2 Inherited Classes
=over
=item SNMP::Info::Layer2
=item SNMP::Info::FDP
=back
=head2 Required MIBs
=over
=item 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 todo
=back
=head2 Globals imported from SNMP::Info::Layer2
See documentation in SNMP::Info::Layer2 for details.
=head2 Globals imported from SNMP::Info::FDP
See documentation in SNMP::Info::FDP 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 todo2
=back
=head2 Table Methods imported from SNMP::Info::Layer2
See documentation in SNMP::Info::Layer2 for details.
=head2 Table Methods imported from SNMP::Info::FDP
See documentation in SNMP::Info::FDP for details.
=cut

View File

@@ -1,7 +1,7 @@
# SNMP::Info::Layer2::HP - SNMP Interface to HP ProCurve Switches
# Max Baker
# Max Baker <max@warped.org>
#
# Copyright (c) 2004,2005 Max Baker changes from version 0.8 and beyond.
# 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.
@@ -30,7 +30,7 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer2::HP;
$VERSION = '1.03';
$VERSION = 0.9;
# $Id$
use strict;
@@ -39,18 +39,18 @@ use Exporter;
use SNMP::Info::Layer2;
use SNMP::Info::MAU;
use SNMP::Info::Entity;
use SNMP::Info::CDP;
use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %PORTSTAT %MODEL_MAP %MUNGE $INIT/ ;
@SNMP::Info::Layer2::HP::ISA = qw/SNMP::Info::Layer2 SNMP::Info::MAU SNMP::Info::Entity
SNMP::Info::CDP Exporter/;
@SNMP::Info::Layer2::HP::ISA = qw/SNMP::Info::Layer2 SNMP::Info::MAU SNMP::Info::Entity Exporter/;
@SNMP::Info::Layer2::HP::EXPORT_OK = qw//;
# See SNMP::Info for the details of these data structures and interworkings.
$INIT = 0;
%MIBS = ( %SNMP::Info::Layer2::MIBS,
%SNMP::Info::MAU::MIBS,
%SNMP::Info::Entity::MIBS,
%SNMP::Info::CDP::MIBS,
'RFC1271-MIB' => 'logDescription',
'HP-ICF-OID' => 'hpSwitch4000',
'HP-VLAN' => 'hpVlanMemberIndex',
@@ -62,7 +62,6 @@ use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %PORTSTAT %MODEL_MAP %MUNGE $I
%SNMP::Info::Layer2::GLOBALS,
%SNMP::Info::MAU::GLOBALS,
%SNMP::Info::Entity::GLOBALS,
%SNMP::Info::CDP::GLOBALS,
'serial1' => 'entPhysicalSerialNum.1',
'hp_cpu' => 'hpSwitchCpuStat.0',
'hp_mem_total' => 'hpGlobalMemTotalBytes.1',
@@ -78,8 +77,6 @@ use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %PORTSTAT %MODEL_MAP %MUNGE $I
%SNMP::Info::Layer2::FUNCS,
%SNMP::Info::MAU::FUNCS,
%SNMP::Info::Entity::FUNCS,
%SNMP::Info::CDP::FUNCS,
'bp_index2' => 'dot1dBasePortIfIndex',
'i_type2' => 'ifType',
# RFC1271
'l_descr' => 'logDescription',
@@ -98,8 +95,7 @@ use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %PORTSTAT %MODEL_MAP %MUNGE $I
# Inherit all the built in munging
%SNMP::Info::Layer2::MUNGE,
%SNMP::Info::MAU::MUNGE,
%SNMP::Info::Entity::MUNGE,
%SNMP::Info::CDP::MUNGE
%SNMP::Info::Entity::MUNGE
);
%MODEL_MAP = (
@@ -112,40 +108,26 @@ use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %PORTSTAT %MODEL_MAP %MUNGE $I
'J4139A' => '9304M',
'J4812A' => '2512',
'J4813A' => '2524',
'J4815A' => '3324XL',
'J4819A' => '5308XL',
'J4840A' => '6308M-SX',
'J4841A' => '6208M-SX',
'J4850A' => '5304XL',
'J4851A' => '3124',
'J4865A' => '4108GL',
'J4874A' => '9315M',
'J4887A' => '4104GL',
'J4899A' => '2650',
'J4899B' => '2650-CR',
'J4900A' => '2626',
'J4900B' => '2626-CR',
'J4902A' => '6108',
'J4903A' => '2824',
'J4904A' => '2848',
'J4905A' => '3400cl-24G',
'J4906A' => '3400cl-48G',
'J8130A' => 'WAP-420-NA',
'J8131A' => 'WAP-420-WW',
'J8133A' => 'AP520WL',
'J8164A' => '2626-PWR',
'J8165A' => '2650-PWR',
'J8433A' => 'CX4-6400cl-6XG',
'J8474A' => 'MF-6400cl-6XG',
'J8718A' => '5404yl',
'J8719A' => '5408yl',
);
# Method Overrides
*SNMP::Info::Layer2::HP::i_duplex = \&SNMP::Info::MAU::mau_i_duplex;
*SNMP::Info::Layer2::HP::i_duplex_admin = \&SNMP::Info::MAU::mau_i_duplex_admin;
sub cpu {
my $hp = shift;
return $hp->hp_cpu();
@@ -300,57 +282,125 @@ sub slots {
#
#}
sub i_duplex {
my $hp = shift;
my $mau_index = $hp->mau_index();
my $mau_link = $hp->mau_link();
my %i_duplex;
foreach my $mau_port (keys %$mau_link){
my $iid = $mau_index->{$mau_port};
next unless defined $iid;
my $linkoid = $mau_link->{$mau_port};
my $link = &SNMP::translateObj($linkoid);
next unless defined $link;
my $duplex = undef;
if ($link =~ /fd$/i) {
$duplex = 'full';
} elsif ($link =~ /hd$/i){
$duplex = 'half';
}
$i_duplex{$iid} = $duplex if defined $duplex;
}
return \%i_duplex;
}
sub i_duplex_admin {
my $hp = shift;
my $interfaces = $hp->interfaces();
my $mau_index = $hp->mau_index();
my $mau_auto = $hp->mau_auto();
my $mau_autostat = $hp->mau_autostat();
my $mau_typeadmin = $hp->mau_type_admin();
my $mau_autosent = $hp->mau_autosent();
my %mau_reverse = reverse %$mau_index;
my %i_duplex_admin;
foreach my $iid (keys %$interfaces){
my $mau_index = $mau_reverse{$iid};
next unless defined $mau_index;
my $autostat = $mau_autostat->{$mau_index};
# HP25xx has this value
if (defined $autostat and $autostat =~ /enabled/i){
$i_duplex_admin{$iid} = 'auto';
next;
}
my $type = $mau_autosent->{$mau_index};
next unless defined $type;
if ($type == 0) {
$i_duplex_admin{$iid} = 'none';
next;
}
my $full = $hp->_isfullduplex($type);
my $half = $hp->_ishalfduplex($type);
if ($full and !$half){
$i_duplex_admin{$iid} = 'full';
} elsif ($half) {
$i_duplex_admin{$iid} = 'half';
}
}
return \%i_duplex_admin;
}
sub i_vlan {
my $hp = shift;
my $interfaces = $hp->interfaces();
# Newer devices use Q-BRIDGE-MIB
my $qb_i_vlan = $hp->qb_i_vlan_t();
if (defined $qb_i_vlan and scalar(keys %$qb_i_vlan)){
return $qb_i_vlan;
my $qb_i_vlan = $hp->qb_i_vlan();
my $qb_i_vlan_type = $hp->qb_i_vlan_type();
my $i_vlan = {};
foreach my $if (keys %$qb_i_vlan){
my $vlan = $qb_i_vlan->{$if};
my $tagged = $qb_i_vlan_type->{$if};
$tagged = (defined $tagged and $tagged eq 'admitOnlyVlanTagged') ? 1 : 0;
next unless defined $vlan;
$i_vlan->{$if}= $tagged ? 'trunk' : $vlan;
}
# HP4000 ... get it from HP-VLAN
# the hpvlanmembertagged2 table has an entry in the form of
# vlan.interface = /untagged/no/tagged/auto
my $i_vlan = {};
my $hp_v_index = $hp->hp_v_index();
my $hp_v_if_tag = $hp->hp_v_if_tag();
foreach my $row (keys %$hp_v_if_tag){
my ($index,$if) = split(/\./,$row);
unless (defined $qb_i_vlan and scalar(keys %$qb_i_vlan)){
my $hp_v_index = $hp->hp_v_index();
my $hp_v_if_tag = $hp->hp_v_if_tag();
foreach my $row (keys %$hp_v_if_tag){
my ($index,$if) = split(/\./,$row);
my $tag = $hp_v_if_tag->{$row};
my $vlan = $hp_v_index->{$index};
next unless defined $tag;
$vlan = 'Trunk' if $tag eq 'tagged';
$vlan = 'Auto' if $tag eq 'auto';
undef $vlan if $tag eq 'no';
my $tag = $hp_v_if_tag->{$row};
my $vlan = $hp_v_index->{$index};
next unless defined $tag;
$vlan = 'Trunk' if $tag eq 'tagged';
$vlan = 'Auto' if $tag eq 'auto';
undef $vlan if $tag eq 'no';
$i_vlan->{$if} = $vlan if defined $vlan;
$i_vlan->{$if} = $vlan if defined $vlan;
}
}
return $i_vlan;
}
# Bridge MIB does not map Bridge Port to ifIndex correctly on all models
sub bp_index {
my $hp = shift;
my $if_index = $hp->i_index();
my $model = $hp->model();
my $bp_index = $hp->bp_index2();
unless (defined $model and $model =~ /(1600|2424|4000|8000)/) {
return $bp_index;
}
my %mod_bp_index;
foreach my $iid (keys %$if_index){
$mod_bp_index{$iid} = $iid;
}
return \%mod_bp_index;
}
1;
__END__
@@ -360,7 +410,7 @@ SNMP::Info::Layer2::HP - SNMP Interface to HP Procurve Switches
=head1 AUTHOR
Max Baker
Max Baker (C<max@warped.org>)
=head1 SYNOPSIS
@@ -463,43 +513,14 @@ Returns the model number of the HP Switch. Will translate between the HP Part n
the common model number with this map :
%MODEL_MAP = (
'J4093A' => '2424M',
'J4110A' => '8000M',
'J4120A' => '1600M',
'J4121A' => '4000M',
'J4122A' => '2400M',
'J4138A' => '9308M',
'J4139A' => '9304M',
'J4812A' => '2512',
'J4813A' => '2524',
'J4815A' => '3324XL',
'J4819A' => '5308XL',
'J4840A' => '6308M-SX',
'J4841A' => '6208M-SX',
'J4850A' => '5304XL',
'J4851A' => '3124',
'J4865A' => '4108GL',
'J4874A' => '9315M',
'J4887A' => '4104GL',
'J4899A' => '2650',
'J4899B' => '2650-CR',
'J4900A' => '2626',
'J4900B' => '2626-CR',
'J4902A' => '6108',
'J4903A' => '2824',
'J4904A' => '2848',
'J4905A' => '3400cl-24G',
'J4906A' => '3400cl-48G',
'J8130A' => 'WAP-420-NA',
'J8131A' => 'WAP-420-WW',
'J8133A' => 'AP520WL',
'J8164A' => '2626-PWR',
'J8165A' => '2650-PWR',
'J8433A' => 'CX4-6400cl-6XG',
'J8474A' => 'MF-6400cl-6XG',
'J8718A' => '5404yl',
'J8719A' => '5408yl',
'J4812A' => '2512',
'J4819A' => '5308XL',
'J4813A' => '2524',
'J4805A' => '5304XL',
'J4815A' => '3324XL',
'J4865A' => '4108GL',
'J4887A' => '4104GL',
'J4874A' => '9315',
);
=item $hp->os()
@@ -583,13 +604,6 @@ Looks in Q-BRIDGE-MIB -- see SNMP::Info::Bridge
and for older devices looks in HP-VLAN.
=item $hp->bp_index()
Returns reference to hash of bridge port table entries map back to interface identifier (iid)
Returns (B<ifIndex>) for both key and value for 1600, 2424, 4000, and 8000 models
since they seem to have problems with BRIDGE-MIB
=back
=head2 Table Methods imported from SNMP::Info::Layer2

View File

@@ -1,253 +0,0 @@
# SNMP::Info::Layer2::N2270
# Eric Miller
# $Id$
#
# Copyright (c) 2005 Eric Miller
#
# 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::N2270;
$VERSION = '1.03';
use strict;
use Exporter;
use SNMP::Info;
use SNMP::Info::Bridge;
use SNMP::Info::SONMP;
use SNMP::Info::Airespace;
@SNMP::Info::Layer2::N2270::ISA = qw/SNMP::Info SNMP::Info::Bridge SNMP::Info::SONMP SNMP::Info::Airespace Exporter/;
@SNMP::Info::Layer2::N2270::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,
%SNMP::Info::Airespace::MIBS,
);
%GLOBALS = (
%SNMP::Info::GLOBALS,
%SNMP::Info::Bridge::GLOBALS,
%SNMP::Info::SONMP::GLOBALS,
%SNMP::Info::Airespace::GLOBALS,
);
%FUNCS = (
%SNMP::Info::FUNCS,
%SNMP::Info::Bridge::FUNCS,
%SNMP::Info::SONMP::FUNCS,
%SNMP::Info::Airespace::FUNCS,
);
%MUNGE = (
%SNMP::Info::MUNGE,
%SNMP::Info::Bridge::MUNGE,
%SNMP::Info::SONMP::MUNGE,
%SNMP::Info::Airespace::MUNGE,
);
sub os {
return 'nortel';
}
sub vendor {
return 'nortel';
}
sub model {
my $n2270 = shift;
my $id = $n2270->id();
return undef unless defined $id;
my $model = &SNMP::translateObj($id);
return $id unless defined $model;
$model =~ s/^sreg-WLANSecuritySwitch//i;
return $model;
}
sub index_factor {
return 256;
}
sub slot_offset {
return 0;
}
1;
__END__
=head1 NAME
SNMP::Info::Layer2::N2270 - SNMP Interface to Nortel 2270 Series Wireless Switch
=head1 AUTHOR
Eric Miller
=head1 SYNOPSIS
#Let SNMP::Info determine the correct subclass for you.
my $n2270 = 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 = $n2270->class();
print " Using device sub class : $class\n";
=head1 DESCRIPTION
Provides abstraction to the configuration information obtainable from a
Nortel 2270 Series Wireless Switch 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 $n2270 = new SNMP::Info::Layer2::N2270(...);
=head2 Inherited Classes
=over
=item SNMP::Info
=item SNMP::Info::Bridge
=item SNMP::Info::SONMP
=item SNMP::Info::Airespace
=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::SONMP for its own MIB requirements.
See SNMP::Info::Airespace for its own MIB requirements.
=back
=head1 GLOBALS
These are methods that return scalar value from SNMP
=over
=item $n2270->vendor()
Returns 'nortel'
=item $n2270->os()
Returns 'nortel'
=item $n2270->model()
Cross references $bayhub->id() to the SYNOPTICS-ROOT-MIB and returns
the results.
Removes sreg-WLANSecuritySwitch from the model name
=back
=head2 Overrides
=over
=item $bayhub->index_factor()
Required by SNMP::Info::SONMP. Number representing the number of ports
reserved per slot within the device MIB. Returns 256.
=item $bayhub->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 Global Methods imported from SNMP::Info::SONMP
See documentation in SNMP::Info::SONMP for details.
=head2 Global Methods imported from SNMP::Info::Airespace
See documentation in SNMP::Info::Airespace 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 None
=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.
=head2 Table Methods imported from SNMP::Info::Airespace
See documentation in SNMP::Info::Airespace for details.
=cut

View File

@@ -1,8 +1,8 @@
# SNMP::Info::Layer2::NAP222x
# Eric Miller
# Eric Miller <eric@jeneric.org>
# $Id$
#
# Copyright (c) 2004 Eric Miller
# Copyright (c) 2004 Max Baker
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -28,7 +28,7 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer2::NAP222x;
$VERSION = '1.03';
$VERSION = 0.9;
use strict;
use Exporter;
@@ -284,7 +284,7 @@ SNMP::Info::Layer2::nap222x - SNMP Interface to Nortel 2220 Series Access Points
=head1 AUTHOR
Eric Miller
Eric Miller (C<eric@jeneric.org>)
=head1 SYNOPSIS

View File

@@ -1,8 +1,8 @@
# SNMP::Info::Layer2::Orinoco
# Eric Miller
# Eric Miller <eric@jeneric.org>
# $Id$
#
# Copyright (c) 2004-6 Eric Miller
# Copyright (c) 2004 Max Baker
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -28,7 +28,7 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer2::Orinoco;
$VERSION = '1.03';
$VERSION = 0.9;
use strict;
use Exporter;
@@ -95,7 +95,7 @@ sub os_bin {
}
sub vendor {
return 'proxim';
return 'Proxim';
}
sub model {
@@ -103,7 +103,8 @@ sub model {
my $descr = $orinoco->description();
return undef unless defined $descr;
return $1 if ($descr =~ /(AP-\d+)/);
return 'AP-1000' if ($descr =~ /AP-1000/);
return 'AP-2000' if ($descr =~ /AP-2000/);
return 'WavePOINT-II' if ($descr =~ /WavePOINT-II/);
return undef;
}
@@ -157,7 +158,7 @@ SNMP::Info::Layer2::Orinoco - SNMP Interface to Orinoco Series Access Points
=head1 AUTHOR
Eric Miller
Eric Miller (C<eric@jeneric.org>)
=head1 SYNOPSIS

View File

@@ -1,7 +1,7 @@
# SNMP::Info::Layer2::ZyXEL_DSLAM
# Dmitry Sergienko <dmitry@trifle.net>
#
# Copyright (c) 2004 Max Baker
# Copyright (c) 2004 Max Baker <max@warped.org>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -28,7 +28,7 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer2::ZyXEL_DSLAM;
$VERSION = '1.03';
$VERSION = 0.9;
# $Id$
use strict;

View File

@@ -1,5 +1,5 @@
# SNMP::Info::Layer3 - SNMP Interface to Layer3 devices
# Max Baker
# Max Baker <max@warped.org>
#
# Copyright (c) 2004 Max Baker -- All changes from Version 0.7 on
#
@@ -30,83 +30,75 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer3;
$VERSION = '1.03';
$VERSION = 0.9;
# $Id$
use strict;
use Exporter;
use SNMP::Info;
use SNMP::Info::CDP;
use SNMP::Info::CiscoStats;
use SNMP::Info::Bridge;
use SNMP::Info::EtherLike;
use SNMP::Info::Entity;
use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE/;
@SNMP::Info::Layer3::ISA = qw/SNMP::Info SNMP::Info::Bridge SNMP::Info::EtherLike
SNMP::Info::Entity Exporter/;
@SNMP::Info::Layer3::ISA = qw/SNMP::Info SNMP::Info::CDP SNMP::Info::Bridge
SNMP::Info::EtherLike SNMP::Info::CiscoStats Exporter/;
@SNMP::Info::Layer3::EXPORT_OK = qw//;
$DEBUG=0;
$SNMP::debugging=$DEBUG;
$INIT = 0;
%MIBS = ( %SNMP::Info::MIBS,
%SNMP::Info::Bridge::MIBS,
%SNMP::Info::CDP::MIBS,
%SNMP::Info::CiscoStats::MIBS,
%SNMP::Info::EtherLike::MIBS,
%SNMP::Info::Entity::MIBS,
'IP-MIB' => 'ipNetToMediaIfIndex',
'OSPF-MIB' => 'ospfRouterId',
'BGP4-MIB' => 'bgpIdentifier',
'ENTITY-MIB' => 'entPhysicalName',
'CISCO-PRODUCTS-MIB' => 'sysName',
'OSPF-MIB' => 'ospfRouterId',
);
%GLOBALS = (
# Inherit the super class ones
%SNMP::Info::GLOBALS,
%SNMP::Info::CDP::GLOBALS,
%SNMP::Info::CiscoStats::GLOBALS,
%SNMP::Info::Bridge::GLOBALS,
%SNMP::Info::EtherLike::GLOBALS,
%SNMP::Info::Entity::GLOBALS,
'mac' => 'ifPhysAddress.1',
'serial1' => '.1.3.6.1.4.1.9.3.6.3.0', # OLD-CISCO-CHASSIS-MIB::chassisId.0
'router_ip' => 'ospfRouterId.0',
'bgp_id' => 'bgpIdentifier.0',
'bgp_local_as' => 'bgpLocalAs.0',
'mac' => 'ifPhysAddress.1',
'serial1' => '.1.3.6.1.4.1.9.3.6.3.0', # OLD-CISCO-CHASSIS-MIB::chassisId.0
'router_ip' => 'ospfRouterId.0',
);
%FUNCS = (
%SNMP::Info::FUNCS,
%SNMP::Info::CDP::FUNCS,
%SNMP::Info::CiscoStats::FUNCS,
%SNMP::Info::Bridge::FUNCS,
%SNMP::Info::EtherLike::FUNCS,
%SNMP::Info::Entity::FUNCS,
# IFMIB
'i_name2' => 'ifName',
# Obsolete Address Translation Table (ARP Cache)
'old_at_index' => 'atIfIndex',
'old_at_paddr' => 'atPhysAddress',
'old_at_netaddr' => 'atNetAddress',
# IP-MIB IP Net to Media Table (ARP Cache)
'at_index' => 'ipNetToMediaIfIndex',
'at_paddr' => 'ipNetToMediaPhysAddress',
'at_netaddr' => 'ipNetToMediaNetAddress',
# OSPF
# Address Translation Table (ARP Cache)
'at_index' => 'atIfIndex',
'at_paddr' => 'atPhysAddress',
'at_netaddr' => 'atNetAddress',
'ospf_ip' => 'ospfHostIpAddress',
# BGP Peer Table
'bgp_peers' => 'bgpPeerLocalAddr',
'bgp_peer_id' => 'bgpPeerIdentifier',
'bgp_peer_state' => 'bgpPeerState',
'bgp_peer_as' => 'bgpPeerRemoteAs',
'bgp_peer_addr' => 'bgpPeerRemoteAddr',
'bgp_peer_fsm_est_trans' => 'bgpPeerFsmEstablishedTransitions',
'bgp_peer_in_tot_msgs' => 'bgpPeerInTotalMessages',
'bgp_peer_in_upd_el_time' => 'bgpPeerInUpdateElapsedTime',
'bgp_peer_in_upd' => 'bgpPeerInUpdates',
'bgp_peer_out_tot_msgs' => 'bgpPeerOutTotalMessages',
'bgp_peer_out_upd' => 'bgpPeerOutUpdates',
'ent_serial' => 'entPhysicalSerialNum',
'ent_chassis'=> 'entPhysicalDescr',
);
%MUNGE = (
# Inherit all the built in munging
%SNMP::Info::MUNGE,
%SNMP::Info::CDP::MUNGE,
%SNMP::Info::CiscoStats::MUNGE,
%SNMP::Info::Bridge::MUNGE,
%SNMP::Info::EtherLike::MUNGE,
%SNMP::Info::Entity::MUNGE,
'old_at_paddr' => \&SNMP::Info::munge_mac,
'at_paddr' => \&SNMP::Info::munge_mac,
);
@@ -119,18 +111,17 @@ sub root_ip {
my $router_ip = $l3->router_ip();
my $ospf_ip = $l3->ospf_ip();
# return the first one found here (should be only one)
# return the first one found here (should be only)
if (defined $ospf_ip and scalar(keys %$ospf_ip)){
foreach my $key (keys %$ospf_ip){
my $ip = $ospf_ip->{$key};
next if $ip eq '0.0.0.0';
next unless $l3->snmp_connect_ip($ip);
print " SNMP::Layer3::root_ip() using $ip\n" if $l3->debug();
print " SNMP::Layer3::root_ip() using $ip\n" if $DEBUG;
return $ip;
}
}
return $router_ip if ( (defined $router_ip) and ($router_ip ne '0.0.0.0') and ($l3->snmp_connect_ip($router_ip)) );
return $router_ip if (defined $router_ip and $router_ip ne '0.0.0.0');
return undef;
}
@@ -142,7 +133,7 @@ sub i_ignore {
my %i_ignore;
foreach my $if (keys %$interfaces) {
# lo -> cisco aironet 350 loopback
if ($interfaces->{$if} =~ /(tunnel|loopback|\blo\b|null)/i){
if ($interfaces->{$if} =~ /(tunnel|loopback|lo|null)/i){
$i_ignore{$if}++;
}
}
@@ -153,11 +144,11 @@ sub serial {
my $l3 = shift;
my $serial1 = $l3->serial1();
my $e_descr = $l3->e_descr() || {};
my $e_serial = $l3->e_serial() || {};
my $ent_chassis = $l3->ent_chassis() || {};
my $ent_serial = $l3->ent_serial() || {};
my $serial2 = $e_serial->{1} || undef;
my $chassis = $e_descr->{1} || undef;
my $serial2 = $ent_serial->{1} || undef;
my $chassis = $ent_chassis->{1} || undef;
# precedence
# serial2,chassis parse,serial1
@@ -175,7 +166,7 @@ sub model {
my $id = $l3->id();
unless (defined $id){
print " SNMP::Info::Layer3::model() - Device does not support sysObjectID\n" if $l3->debug();
print " SNMP::Info::Layer3::model() - Device does not support sysObjectID\n" if $DEBUG;
return undef;
}
@@ -250,32 +241,11 @@ sub vendor {
my $descr = $l3->description();
return 'cisco' if ($descr =~ /(cisco|\bios\b)/i);
return 'cisco' if ($descr =~ /(cisco|ios)/i);
return 'foundry' if ($descr =~ /foundry/i);
}
sub at_index {
my $l3 = shift;
return $l3->orig_at_index() || $l3->old_at_index();
}
sub at_paddr {
my $l3 = shift;
return $l3->orig_at_paddr() || $l3->old_at_paddr();
}
sub at_netaddr {
my $l3 = shift;
return $l3->orig_at_netaddr() || $l3->old_at_netaddr();
}
1;
__END__
=head1 NAME
@@ -284,7 +254,7 @@ SNMP::Info::Layer3 - Perl5 Interface to network devices serving Layer3 or Layers
=head1 AUTHOR
Max Baker
Max Baker (C<max@warped.org>)
=head1 SYNOPSIS
@@ -334,7 +304,9 @@ a more specific class using the method above.
=item SNMP::Info::Bridge
For L2/L3 devices.
=item SNMP::Info::CDP
=item SNMP::Info::CiscoStats
=item SNMP::Info::EtherLike
@@ -344,9 +316,11 @@ For L2/L3 devices.
=over
=item OSPF-MIB
=item CISCO-PRODUCTS-MIB
=item BGP4-MIB
=item ENTITY-MIB
=item OSPF-MIB
=item Inherited Classes
@@ -354,7 +328,7 @@ MIBs required by the inherited classes listed above.
=back
MIBs can be found in the netdisco-mibs package.
MIBs can be found at ftp://ftp.cisco.com/pub/mibs/v2/v2.tar.gz
=head1 GLOBALS
@@ -362,6 +336,12 @@ These are methods that return scalar value from SNMP
=over
=item $l3->chassis()
Returns Chassis type (model).
(B<entPhysicalDescr.1>)
=item $l3->mac()
Returns root port mac address
@@ -372,18 +352,6 @@ Returns root port mac address
(B<ospfRouterId.0>)
=item $l3->bgp_id()
(B<bgpIdentifier.0>)
Returns the BGP identifier of the local system
=item $l3->bgp_local_as()
Returns the local autonomous system number
(B<bgpLocalAs.0>)
=back
=head2 Overrides
@@ -398,7 +366,7 @@ Removes 'cisco' from cisco devices for readability.
=item $l3->serial()
Trys to cull a serial number from ENTITY-MIB, description, and OLD-CISCO-... mib
Trys to cull a serial number from $l3->chassis()
=item $l3->vendor()
@@ -414,14 +382,18 @@ See documentation in SNMP::Info for details.
See documentation in SNMP::Info::Bridge for details.
=head2 Globals imported from SNMP::Info::CDP
See documentation in SNMP::Info::CDP for details.
=head2 Globals imported from SNMP::Info::CiscoStats
See documentation in SNMP::Info::CiscoStats for details.
=head2 Globals imported from SNMP::Info::EtherLike
See documentation in SNMP::Info::EtherLike for details.
=head2 Globals imported from SNMP::Info::Entity
See documentation in SNMP::Info::Entity for details.
=head1 TABLE ENTRIES
These are methods that return tables of information in the form of a reference
@@ -460,59 +432,23 @@ see SNMP::Info::Etherlike for the el_index() and el_duplex() methods.
=back
=head2 IP-MIB Arp Cache Table (B<ipNetToMediaTable>)
=head2 ARP Cache Entries
=over
=item $l3->at_index()
Returns reference to hash. Maps ARP table entries to Interface IIDs
(B<ipNetToMediaIfIndex>)
If the device doesn't support B<ipNetToMediaIfIndex>, this will try
the deprecated B<atIfIndex>.
=item $l3->at_paddr()
Returns reference to hash. Maps ARP table entries to MAC addresses.
(B<ipNetToMediaPhysAddress>)
If the device doesn't support B<ipNetToMediaPhysAddress>, this will try
the deprecated B<atPhysAddress>.
=item $l3->at_netaddr()
Returns reference to hash. Maps ARP table entries to IPs
(B<ipNetToMediaNetAddress>)
If the device doesn't support B<ipNetToMediaNetAddress>, this will try
the deprecated B<atNetAddress>.
=back
=head2 ARP Cache Entries
The B<atTable> has been deprecated since 1991. You should never need
to use these methods. See B<ipNetToMediaTable> above.
=over
=item $l3->old_at_index()
Returns reference to map of IID to Arp Cache Entry
(B<atIfIndex>)
=item $l3->old_at_paddr()
=item $l3->at_paddr()
Returns reference to hash of Arp Cache Entries to MAC address
(B<atPhysAddress>)
=item $l3->old_at_netaddr()
=item $l3->at_netaddr()
Returns reference to hash of Arp Cache Entries to IP Address
@@ -520,84 +456,6 @@ Returns reference to hash of Arp Cache Entries to IP Address
=back
=head2 BGP Peer Table
=over
=item $l3->bgp_peers()
Returns reference to hash of BGP peer to local IP address
(B<bgpPeerLocalAddr>)
=item $l3->bgp_peer_id()
Returns reference to hash of BGP peer to BGP peer identifier
(B<bgpPeerIdentifier>)
=item $l3->bgp_peer_state()
Returns reference to hash of BGP peer to BGP peer state
(B<bgpPeerState>)
=item $l3->bgp_peer_as()
Returns reference to hash of BGP peer to BGP peer autonomous system number
(B<bgpPeerRemoteAs>)
=item $l3->bgp_peer_addr()
Returns reference to hash of BGP peer to BGP peer IP address
(B<bgpPeerRemoteAddr>)
=item $l3->bgp_peer_fsm_est_trans()
Returns reference to hash of BGP peer to the total number of times the BGP FSM
transitioned into the established state
(B<bgpPeerFsmEstablishedTransitions>)
=item $l3->bgp_peer_in_tot_msgs()
Returns reference to hash of BGP peer to the total number of messages received
from the remote peer on this connection
(B<bgpPeerInTotalMessages>)
=item $l3->bgp_peer_in_upd_el_time()
Returns reference to hash of BGP peer to the elapsed time in seconds since
the last BGP UPDATE message was received from the peer.
(B<bgpPeerInUpdateElapsedTime>)
=item $l3->bgp_peer_in_upd()
Returns reference to hash of BGP peer to the number of BGP UPDATE messages
received on this connection
(B<bgpPeerInUpdates>)
=item $l3->bgp_peer_out_tot_msgs()
Returns reference to hash of BGP peer to the total number of messages transmitted
to the remote peer on this connection
(B<bgpPeerOutTotalMessages>)
=item $l3->bgp_peer_out_upd()
Returns reference to hash of BGP peer to the number of BGP UPDATE messages
transmitted on this connection
(B<bgpPeerOutUpdates>)
=back
=head2 Table Methods imported from SNMP::Info
See documentation in SNMP::Info for details.
@@ -606,12 +464,16 @@ See documentation in SNMP::Info for details.
See documentation in SNMP::Info::Bridge for details.
=head2 Table Methods imported from SNMP::Info::CDP
See documentation in SNMP::Info::CDP for details.
=head2 Table Methods imported from SNMP::Info::CiscoStats
See documentation in SNMP::Info::CiscoStats for details.
=head2 Table Methods imported from SNMP::Info::EtherLike
See documentation in SNMP::Info::EtherLike for details.
=head2 Table Methods imported from SNMP::Info::Entity
See documentation in SNMP::Info::Entity for details.
=cut

View File

@@ -1,5 +1,5 @@
# SNMP::Info::Layer3::Aironet
# Max Baker
# Max Baker <max@warped.org>
#
# Copyright (c) 2004 Max Baker changes from version 0.8 and beyond.
#
@@ -30,7 +30,7 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer3::Aironet;
$VERSION = '1.03';
$VERSION = 0.9;
# $Id$
use strict;
@@ -42,6 +42,10 @@ use vars qw/$VERSION $DEBUG %MIBS %FUNCS %GLOBALS %MUNGE $INIT/;
@SNMP::Info::Layer3::Aironet::ISA = qw/SNMP::Info::Layer3 Exporter/;
@SNMP::Info::Layer3::Aironet::EXPORT_OK = qw//;
$DEBUG=0;
$SNMP::debugging=$DEBUG;
$INIT = 0;
%MIBS = (
%SNMP::Info::Layer3::MIBS,
'AWCVX-MIB' => 'awcIfTable',
@@ -86,7 +90,7 @@ sub os {
sub os_ver {
my $aironet = shift;
my $descr = $aironet->description() || '';
my $descr = $aironet->description();
# CAP340 11.21, AP4800-E 11.21
if ($descr =~ /AP\d{3,4}(-\D+)?\s+(\d{2}\.\d{2})/){
@@ -216,7 +220,7 @@ SNMP::Info::Layer3::Aironet - Perl5 Interface to Cisco Aironet Wireless Devices
=head1 AUTHOR
Max Baker
Max Baker (C<max@warped.org>)
=head1 SYNOPSIS

View File

@@ -1,8 +1,8 @@
# SNMP::Info::Layer3::AlteonAD
# Eric Miller
# Eric Miller <eric@jeneric.org>
# $Id$
#
# Copyright (c) 2004 Eric Miller
# Copyright (c) 2004 Max Baker
# All Rights Reserved
#
# Redistribution and use in source and binary forms, with or without
@@ -29,7 +29,7 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer3::AlteonAD;
$VERSION = '1.03';
$VERSION = 0.9;
use strict;
@@ -42,20 +42,26 @@ use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE /;
@SNMP::Info::Layer3::AlteonAD::ISA = qw/SNMP::Info SNMP::Info::Bridge Exporter/;
@SNMP::Info::Layer3::AlteonAD::EXPORT_OK = qw//;
$DEBUG=0;
# See SNMP::Info for the details of these data structures and
# the interworkings.
$INIT = 0;
%MIBS = (
%SNMP::Info::MIBS,
%SNMP::Info::Bridge::MIBS,
'ALTEON-TIGON-SWITCH-MIB' => 'agSoftwareVersion',
'ALTEON-TS-PHYSICAL-MIB' => 'agPortTableMaxEnt',
'ALTEON-TS-NETWORK-MIB' => 'agPortTableMaxEnt',
'ALTEON-TIGON-SWITCH-MIB' => 'agSoftwareVersion',
'ALTEON-TS-PHYSICAL-MIB' => 'agPortTableMaxEnt',
'ALTEON-TS-NETWORK-MIB' => 'agPortTableMaxEnt',
);
%GLOBALS = (
%SNMP::Info::GLOBALS,
%SNMP::Info::Bridge::GLOBALS,
'sw_ver' => 'agSoftwareVersion',
'tftp_action' => 'agTftpAction',
'tftp_host' => 'agTftpServer',
'sw_ver' => 'agSoftwareVersion',
'tftp_action' => 'agTftpAction',
'tftp_host' => 'agTftpServer',
'tftp_file' => 'agTftpCfgFileName',
'tftp_result' => 'agTftpLastActionStatus',
);
@@ -63,8 +69,8 @@ use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE /;
%FUNCS = (
%SNMP::Info::FUNCS,
%SNMP::Info::Bridge::FUNCS,
'bp_index_2' => 'dot1dBasePortIfIndex',
'i_name2' => 'ifName',
'bp_index_2' => 'dot1dBasePortIfIndex',
'i_name2' => 'ifName',
# From RFC1213-MIB
'at_index' => 'ipNetToMediaIfIndex',
'at_paddr' => 'ipNetToMediaPhysAddress',
@@ -131,12 +137,12 @@ sub interfaces {
my $desc = $descriptions->{$iid};
next unless defined $desc;
if ($desc =~ /(^net\d+)/) {
$desc = $1;
}
elsif (($iid > 256) and ($iid < 266)) {
$desc = ($iid % 256);
}
if ($desc =~ /(^net\d+)/) {
$desc = $1;
}
elsif (($iid > 256) and ($iid < 266)) {
$desc = ($iid % 256);
}
$interfaces{$iid} = $desc;
}
return \%interfaces;
@@ -154,9 +160,9 @@ sub i_duplex {
$duplex = 'half' if $duplex =~ /half/i;
$duplex = 'full' if $duplex =~ /full/i;
my $idx = $if + 256;
my $idx = $if + 256;
$i_duplex{$idx}=$duplex;
}
return \%i_duplex;
@@ -174,22 +180,22 @@ sub i_duplex_admin {
foreach my $if (keys %$ag_pref){
my $pref = $ag_pref->{$if};
next unless defined $pref;
my $string = 'other';
if ($pref =~ /gigabit/i) {
my $ge_auto = $ag_ge_auto->{$if};
$string = 'full' if ($ge_auto =~ /off/i);
$string = 'auto' if ($ge_auto =~ /on/i);
}
elsif ($pref =~ /fast/i) {
my $fe_auto = $ag_fe_auto->{$if};
my $fe_mode = $ag_fe_mode->{$if};
$string = 'half' if ($fe_mode =~ /half/i and $fe_auto =~ /off/i);
my $string = 'other';
if ($pref =~ /gigabit/i) {
my $ge_auto = $ag_ge_auto->{$if};
$string = 'full' if ($ge_auto =~ /off/i);
$string = 'auto' if ($ge_auto =~ /on/i);
}
elsif ($pref =~ /fast/i) {
my $fe_auto = $ag_fe_auto->{$if};
my $fe_mode = $ag_fe_mode->{$if};
$string = 'half' if ($fe_mode =~ /half/i and $fe_auto =~ /off/i);
$string = 'full' if ($fe_mode =~ /full/i and $fe_auto =~ /off/i);
$string = 'auto' if $fe_auto =~ /on/i;
}
my $idx = $if + 256;
}
my $idx = $if + 256;
$i_duplex_admin{$idx}=$string;
}
return \%i_duplex_admin;
@@ -205,15 +211,15 @@ sub i_vlan {
my %i_vlan;
foreach my $if (keys %$ip_vlans){
my $ip_vlanid = $ip_vlans->{$if};
next unless defined $ip_vlanid;
next unless defined $ip_vlanid;
$i_vlan{$if}=$ip_vlanid;
}
foreach my $if (keys %$ag_vlans){
my $ag_vlanid = $ag_vlans->{$if};
next unless defined $ag_vlanid;
next unless defined $ag_vlanid;
my $idx = $if + 256;
my $idx = $if + 256;
$i_vlan{$idx}=$ag_vlanid;
}
return \%i_vlan;
@@ -226,7 +232,7 @@ sub i_name {
my %i_name;
foreach my $iid (keys %$p_name){
my $name = $p_name->{$iid};
next unless defined $name;
next unless defined $name;
my $idx = $iid + 256;
$i_name{$idx} = $name;
}
@@ -244,11 +250,26 @@ sub bp_index {
next unless defined $port;
$port = $port + 256;
$bp_index{$iid} = $port;
$bp_index{$iid} = $port;
}
return \%bp_index;
}
sub root_ip {
my $alteon = shift;
my $ip_table = $alteon->ip_table();
# Return First IP Address
foreach my $entry (keys %$ip_table){
my $router_ip = $ip_table->{$entry};
print " SNMP::Layer3::AlteonAD::root_ip() using $router_ip\n" if $DEBUG;
next unless $router_ip;
return $router_ip if ($router_ip ne '0.0.0.0');
}
return undef;
}
1;
__END__
@@ -259,7 +280,7 @@ Director Series Layer 2-7 Switches.
=head1 AUTHOR
Eric Miller
Eric Miller (C<eric@jeneric.org>)
=head1 SYNOPSIS
@@ -335,16 +356,21 @@ Returns the model extracted from B<sysDescr>
=item $alteon->vendor()
Returns 'nortel'
Returns 'Nortel'
=item $alteon->os()
Returns 'webos'
Returns 'WebOS'
=item $alteon->os_ver()
Returns the software version reported by B<agSoftwareVersion>
=item $alteon->root_ip()
Returns the primary IP used to communicate with the device. Currently returns
the first interfaces IP.
=item $alteon->tftp_action()
(B<agTftpAction>)

View File

@@ -1,8 +1,8 @@
# SNMP::Info::Layer3::BayRS
# Eric Miller
# Eric Miller <eric@jeneric.org>
# $Id$
#
# Copyright (c) 2004 Eric Miller, Max Baker
# Copyright (c) 2004 Max Baker
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -29,7 +29,7 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer3::BayRS;
$VERSION = '1.03';
$VERSION = 0.9;
use strict;
@@ -42,13 +42,19 @@ use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE %MODEL_MAP/;
@SNMP::Info::Layer3::BayRS::ISA = qw/SNMP::Info SNMP::Info::Bridge Exporter/;
@SNMP::Info::Layer3::BayRS::EXPORT_OK = qw//;
$DEBUG=0;
# See SNMP::Info for the details of these data structures and
# the interworkings.
$INIT = 0;
%MIBS = (
%SNMP::Info::MIBS,
%SNMP::Info::Bridge::MIBS,
'Wellfleet-HARDWARE-MIB' => 'wfHwBpIdOpt',
'Wellfleet-OSPF-MIB' => 'wfOspfRouterId',
'Wellfleet-DOT1QTAG-CONFIG-MIB' => 'wfDot1qTagCfgVlanName',
'Wellfleet-CSMACD-MIB' => 'wfCSMACDCct',
'Wellfleet-HARDWARE-MIB' => 'wfHwBpIdOpt',
'Wellfleet-OSPF-MIB' => 'wfOspfRouterId',
'Wellfleet-DOT1QTAG-CONFIG-MIB' => 'wfDot1qTagCfgVlanName',
'Wellfleet-CSMACD-MIB' => 'wfCSMACDCct',
);
%GLOBALS = (
@@ -62,37 +68,37 @@ use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE %MODEL_MAP/;
%FUNCS = (
%SNMP::Info::FUNCS,
%SNMP::Info::Bridge::FUNCS,
'i_name2' => 'ifName',
'i_name2' => 'ifName',
# From RFC1213-MIB
'at_index' => 'ipNetToMediaIfIndex',
'at_paddr' => 'ipNetToMediaPhysAddress',
'at_netaddr' => 'ipNetToMediaNetAddress',
# From Wellfleet-CSMACD-MIB::wfCSMACDTable
'wf_csmacd_cct' => 'wfCSMACDCct',
'wf_csmacd_cct' => 'wfCSMACDCct',
'wf_csmacd_slot' => 'wfCSMACDSlot',
'wf_csmacd_conn' => 'wfCSMACDConnector',
'wf_csmacd_mtu' => 'wfCSMACDMtu',
'wf_duplex' => 'wfCSMACDLineCapability',
'wf_csmacd_line' => 'wfCSMACDLineNumber',
'wf_csmacd_mtu' => 'wfCSMACDMtu',
'wf_duplex' => 'wfCSMACDLineCapability',
'wf_csmacd_line' => 'wfCSMACDLineNumber',
# From Wellfleet-CSMACD-MIB::wfCSMACDAutoNegTable
'wf_auto' => 'wfCSMACDAutoNegSpeedSelect',
'wf_auto' => 'wfCSMACDAutoNegSpeedSelect',
# From Wellfleet-DOT1QTAG-CONFIG-MIB::wfDot1qTagConfigTable
'wf_vlan_name' => 'wfDot1qTagCfgVlanName',
'wf_local_vlan_id' => 'wfDot1qTagCfgLocalVlanId',
'wf_global_vlan_id' => 'wfDot1qTagCfgGlobalVlanId',
'wf_vlan_port' => 'wfDot1qTagCfgPhysicalPortId',
# From Wellfleet-HARDWARE-MIB::wfHwTable
'wf_vlan_port' => 'wfDot1qTagCfgPhysicalPortId',
# From Wellfleet-HARDWARE-MIB::wfHwTable
'wf_hw_slot' => 'wfHwSlot',
'wf_hw_mod_id' => 'wfHwModIdOpt',
'wf_hw_mod_rev' => 'wfHwModRev',
'wf_hw_mod_ser' => 'wfHwModSerialNumber',
'wf_hw_mod_id' => 'wfHwModIdOpt',
'wf_hw_mod_rev' => 'wfHwModRev',
'wf_hw_mod_ser' => 'wfHwModSerialNumber',
'wf_hw_mobo_id' => 'wfHwMotherBdIdOpt ',
'wf_hw_mobo_rev' => 'wfHwMotherBdRev',
'wf_hw_mobo_ser' => 'wfHwMotherBdSerialNumber',
'wf_hw_diag' => 'wfHwDiagPromRev',
'wf_hw_boot' => 'wfHwBootPromRev',
'wf_hw_mobo_mem' => 'wfHwMotherBdMemorySize',
'wf_hw_cfg_time' => 'wfHwConfigDateAndTime ',
'wf_hw_mobo_ser' => 'wfHwMotherBdSerialNumber',
'wf_hw_diag' => 'wfHwDiagPromRev',
'wf_hw_boot' => 'wfHwBootPromRev',
'wf_hw_mobo_mem' => 'wfHwMotherBdMemorySize',
'wf_hw_cfg_time' => 'wfHwConfigDateAndTime ',
);
%MUNGE = (
@@ -102,20 +108,20 @@ use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE %MODEL_MAP/;
);
%MODEL_MAP = (
'acefn' => 'FN',
'aceln' => 'LN',
'acecn' => 'CN',
'afn' => 'AFN',
'in' => 'IN',
'an' => 'AN',
'arn' => 'ARN',
'sys5000' => '5000',
'freln' => 'BLN',
'frecn' => 'BCN',
'frerbln' => 'BLN-2',
'asn' => 'ASN',
'asnzcable' => 'ASN-Z',
'asnbcable' => 'ASN-B',
'acefn' => 'FN',
'aceln' => 'LN',
'acecn' => 'CN',
'afn' => 'AFN',
'in' => 'IN',
'an' => 'AN',
'arn' => 'ARN',
'sys5000' => '5000',
'freln' => 'BLN',
'frecn' => 'BCN',
'frerbln' => 'BLN-2',
'asn' => 'ASN',
'asnzcable' => 'ASN-Z',
'asnbcable' => 'ASN-B',
);
sub model {
@@ -164,7 +170,7 @@ sub interfaces {
my $desc = $description->{$iid};
next unless defined $desc;
$desc = $1 if $desc =~ /(^[A-Z]\d+)/;
$desc = $1 if $desc =~ /(^[A-Z]\d+)/;
$interfaces{$iid} = $desc;
}
@@ -173,8 +179,8 @@ sub interfaces {
next unless defined $vlan;
my $vlan_if = $vlan_idx->{$iid};
next unless defined $vlan_if;
my $desc = 'Vlan' . $vlan;
my $desc = 'V' . $vlan;
$interfaces{$vlan_if} = $desc;
}
@@ -197,7 +203,7 @@ sub i_name {
# Get VLAN Virtual Router Interfaces
foreach my $vid (keys %$v_name){
my $v_name = $v_name->{$vid};
next unless defined $v_name;
next unless defined $v_name;
my $vlan_if = $vlan_idx->{$vid};
next unless defined $vlan_if;
@@ -221,7 +227,7 @@ sub i_duplex {
my $string = 'half';
$string = 'full' if $duplex =~ /duplex/i;
$i_duplex{$idx}=$string;
}
return \%i_duplex;
@@ -242,22 +248,22 @@ sub i_duplex_admin {
next unless defined $idx;
my $duplex = $wf_duplex->{$if};
next unless defined $duplex;
my $slot = $wf_slot->{$if};
my $conn = $wf_conn->{$if};
my $auto_idx = "$slot.$conn";
my $auto = $wf_auto->{$auto_idx};
my $string = 'other';
if ($auto) {
$string = 'half';
$string = 'full' if $auto =~ /duplex/i;
$string = 'auto' if $auto =~ /nway/i;
}
elsif ($duplex) {
$string = 'half';
$string = 'full' if $duplex =~ /duplex/i;
}
my $slot = $wf_slot->{$if};
my $conn = $wf_conn->{$if};
my $auto_idx = "$slot.$conn";
my $auto = $wf_auto->{$auto_idx};
my $string = 'other';
if ($auto) {
$string = 'half';
$string = 'full' if $auto =~ /duplex/i;
$string = 'auto' if $auto =~ /nway/i;
}
elsif ($duplex) {
$string = 'half';
$string = 'full' if $duplex =~ /duplex/i;
}
$i_duplex_admin{$idx}=$string;
}
return \%i_duplex_admin;
@@ -266,41 +272,41 @@ sub i_duplex_admin {
sub i_vlan {
my $bayrs = shift;
my $wf_cct = $bayrs->wf_csmacd_cct();
my $wf_mtu = $bayrs->wf_csmacd_mtu();
my $wf_line = $bayrs->wf_csmacd_line();
my $wf_local_vid = $bayrs->wf_local_vlan_id();
my $wf_global_vid = $bayrs->wf_global_vlan_id();
my $wf_vport = $bayrs->wf_vlan_port();
my $wf_cct = $bayrs->wf_csmacd_cct();
my $wf_mtu = $bayrs->wf_csmacd_mtu();
my $wf_line = $bayrs->wf_csmacd_line();
my $wf_local_vid = $bayrs->wf_local_vlan_id();
my $wf_global_vid = $bayrs->wf_global_vlan_id();
my $wf_vport = $bayrs->wf_vlan_port();
my %i_vlan;
# Look for VLANs on Ethernet Interfaces
foreach my $if (keys %$wf_cct){
my $idx = $wf_cct->{$if};
next unless defined $idx;
# Check MTU size, if unable to carry VLAN tag skip.
my $mtu = $wf_mtu->{$if};
next unless defined $idx;
# Check MTU size, if unable to carry VLAN tag skip.
my $mtu = $wf_mtu->{$if};
next if (($mtu =~ /default/i) or ($mtu < 1522));
my $line = $wf_line->{$if};
my @vlans = ();
foreach my $v_idx (keys %$wf_vport){
my $port = $wf_vport->{$v_idx};
next unless defined $port;
next if ($port != $line);
my $vlan = $wf_global_vid->{$v_idx};
push(@vlans, $vlan);
}
my $vlans = join (',', @vlans);
$i_vlan{$idx}=$vlans;
my $line = $wf_line->{$if};
my @vlans = ();
foreach my $v_idx (keys %$wf_vport){
my $port = $wf_vport->{$v_idx};
next unless defined $port;
next if ($port != $line);
my $vlan = $wf_global_vid->{$v_idx};
push(@vlans, $vlan);
}
my $vlans = join (',', @vlans);
$i_vlan{$idx}=$vlans;
}
# Add VLAN on VLAN Interfaces
foreach my $idx (keys %$wf_global_vid){
my $v_if = $wf_local_vid->{$idx};
next unless defined $v_if;
next unless defined $v_if;
my $vlan = $wf_global_vid->{$idx};
next unless defined $vlan;
next unless defined $vlan;
$i_vlan{$v_if}=$vlan;
}
return \%i_vlan;
@@ -309,25 +315,31 @@ sub i_vlan {
sub root_ip {
my $bayrs = shift;
my $ip_index = $bayrs->ip_index();
my $ip_table = $bayrs->ip_table();
my $ip_index = $bayrs->ip_index();
my $ip_table = $bayrs->ip_table();
# Check for CLIP
foreach my $entry (keys %$ip_index){
my $idx = $ip_index->{$entry};
next unless $idx == 0;
my $clip = $ip_table->{$entry};
next unless ( (defined $clip) and ($clip ne '0.0.0.0') and ($bayrs->snmp_connect_ip($clip)) );
print " SNMP::Layer3::BayRS::root_ip() using $clip\n" if $bayrs->debug();
return $clip;
next unless $idx == 0;
my $clip = $ip_table->{$entry};
next unless ((defined $clip) and ($clip eq '0.0.0.0'));
print " SNMP::Layer3::BayRS::root_ip() using $clip\n" if $DEBUG;
return $clip;
}
# Check for OSPF Router ID
my $ospf_ip = $bayrs->ospf_rtr_id();
if ((defined $ospf_ip) and ($ospf_ip ne '0.0.0.0') and ($bayrs->snmp_connect_ip($ospf_ip)) ) {
print " SNMP::Layer3::BayRS::root_ip() using $ospf_ip\n" if $bayrs->debug();
return $ospf_ip;
if ((defined $ospf_ip) and ($ospf_ip ne '0.0.0.0')) {
print " SNMP::Layer3::BayRS::root_ip() using $ospf_ip\n" if $DEBUG;
return $ospf_ip;
}
# Else Return First IP Address
foreach my $entry (keys %$ip_table){
my $ip = $ip_table->{$entry};
print " SNMP::Layer3::BayRS::root_ip() using $ip\n" if $DEBUG;
next unless $ip;
return $ip if ($ip ne '0.0.0.0');
}
return undef;
}
@@ -336,11 +348,11 @@ __END__
=head1 NAME
SNMP::Info::Layer3::BayRS - Perl5 Interface to Nortel routers running BayRS.
SNMP::Info::Layer3::BayRS - Perl5 Interface to Nortel Networks' routers running BayRS.
=head1 AUTHOR
Eric Miller
Eric Miller (C<eric@jeneric.org>)
=head1 SYNOPSIS
@@ -360,7 +372,7 @@ Eric Miller
=head1 DESCRIPTION
Abstraction subclass for routers running Nortel BayRS.
Abstraction subclass for routers running Nortel Networks' BayRS.
For speed or debugging purposes you can call the subclass directly, but not after determining
a more specific class using the method above.
@@ -395,6 +407,14 @@ See SNMP::Info for its own MIB requirements.
See SNMP::Info::Bridge for its own MIB requirements.
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, BayRS Router Software,
Router Software v 15.x, Software. Filter on mibs and download the latest
version's archive.
=back
=head1 GLOBALS
@@ -409,29 +429,29 @@ Returns the model of the BayRS router. Will translate between the MIB model and
the common model with this map :
%MODEL_MAP = (
'acefn' => 'FN',
'aceln' => 'LN',
'acecn' => 'CN',
'afn' => 'AFN',
'in' => 'IN',
'an' => 'AN',
'arn' => 'ARN',
'sys5000' => '5000',
'freln' => 'BLN',
'frecn' => 'BCN',
'frerbln' => 'BLN-2',
'asn' => 'ASN',
'asnzcable' => 'ASN-Z',
'asnbcable' => 'ASN-B',
'acefn' => 'FN',
'aceln' => 'LN',
'acecn' => 'CN',
'afn' => 'AFN',
'in' => 'IN',
'an' => 'AN',
'arn' => 'ARN',
'sys5000' => '5000',
'freln' => 'BLN',
'frecn' => 'BCN',
'frerbln' => 'BLN-2',
'asn' => 'ASN',
'asnzcable' => 'ASN-Z',
'asnbcable' => 'ASN-B',
);
=item $bayrs->vendor()
Returns 'nortel'
Returns 'Nortel'
=item $bayrs->os()
Returns 'bayrs'
Returns 'BayRS'
=item $bayrs->os_ver()
@@ -445,7 +465,8 @@ Returns (B<wfHwBpSerialNumber>) after conversion to ASCII decimal
Returns the primary IP used to communicate with the router.
Returns the first found: CLIP (CircuitLess IP), (B<wfOspfRouterId>), or undefined.
Returns the first found: CLIP (CircuitLess IP), (B<wfOspfRouterId>), or the first
IP interface.
=back

View File

@@ -1,5 +1,5 @@
# SNMP::Info::Layer3::C3550
# Max Baker
# Max Baker <max@warped.org>
#
# Copyright (c) 2004 Max Baker changes from version 0.8 and beyond.
# Copyright (c) 2003, Regents of the University of California
@@ -29,7 +29,7 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer3::C3550;
$VERSION = '1.03';
$VERSION = 0.9;
# $Id$
use strict;
@@ -38,32 +38,27 @@ use Exporter;
use SNMP::Info::Layer3;
use SNMP::Info::CiscoVTP;
use SNMP::Info::CiscoStack;
use SNMP::Info::CDP;
use SNMP::Info::CiscoStats;
use SNMP::Info::CiscoImage;
use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %MUNGE $INIT/ ;
@SNMP::Info::Layer3::C3550::ISA = qw/SNMP::Info::Layer3 SNMP::Info::CiscoStack SNMP::Info::CiscoVTP
SNMP::Info::CiscoStats SNMP::Info::CDP Exporter
SNMP::Info::CiscoImage/;
@SNMP::Info::Layer3::C3550::ISA = qw/ SNMP::Info::Layer3 SNMP::Info::CiscoStack SNMP::Info::CiscoVTP Exporter/;
@SNMP::Info::Layer3::C3550::EXPORT_OK = qw//;
%MIBS = (
%SNMP::Info::Layer3::MIBS,
%SNMP::Info::CiscoVTP::MIBS,
%SNMP::Info::CiscoStack::MIBS,
%SNMP::Info::CDP::MIBS,
%SNMP::Info::CiscoStats::MIBS,
%SNMP::Info::CiscoImage::MIBS,
);
$DEBUG=0;
# See SNMP::Info for the details of these data structures and
# the interworkings.
$INIT = 0;
%MIBS = (
%SNMP::Info::Layer3::MIBS,
%SNMP::Info::CiscoVTP::MIBS,
%SNMP::Info::CiscoStack::MIBS,
);
%GLOBALS = (
%SNMP::Info::Layer3::GLOBALS,
%SNMP::Info::CiscoVTP::GLOBALS,
%SNMP::Info::CiscoStack::GLOBALS,
%SNMP::Info::CDP::GLOBALS,
%SNMP::Info::CiscoStats::GLOBALS,
%SNMP::Info::CiscoImage::GLOBALS,
'ports2' => 'ifNumber',
);
@@ -71,9 +66,6 @@ use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %MUNGE $INIT/ ;
%SNMP::Info::Layer3::FUNCS,
%SNMP::Info::CiscoVTP::FUNCS,
%SNMP::Info::CiscoStack::FUNCS,
%SNMP::Info::CDP::FUNCS,
%SNMP::Info::CiscoStats::FUNCS,
%SNMP::Info::CiscoImage::FUNCS,
);
%MUNGE = (
@@ -81,9 +73,6 @@ use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %MUNGE $INIT/ ;
%SNMP::Info::Layer3::MUNGE,
%SNMP::Info::CiscoVTP::MUNGE,
%SNMP::Info::CiscoStack::MUNGE,
%SNMP::Info::CDP::MUNGE,
%SNMP::Info::CiscoStats::MUNGE,
%SNMP::Info::CiscoImage::MUNGE,
);
# Pick and choose
@@ -106,7 +95,7 @@ sub model {
$model =~ s/^catalyst//;
# turn 355048 into 3550-48
if ($model =~ /^(35\d\d)(\d\d(T|G)?)$/) {
if ($model =~ /^(35\d\d)(\d\d[T]?)$/) {
$model = "$1-$2";
}
return $model;
@@ -120,7 +109,7 @@ sub ports {
my $id = $c3550->id();
my $model = &SNMP::translateObj($id);
if ($model =~ /(12|24|48)(C|T|TS|G|TS-E|TS-S|T-E)?$/) {
if ($model =~ /(12|24|48)[T]?$/) {
return $1;
}
return $ports2;
@@ -140,7 +129,7 @@ SNMP::Info::Layer3::C3550 - Perl5 Interface to Cisco Catalyst 3550 Layer 2/3 Swi
=head1 AUTHOR
Max Baker
Max Baker (C<max@warped.org>)
=head1 SYNOPSIS
@@ -181,12 +170,6 @@ a more specific class using the method above.
=item SNMP::Info::CiscoStack
=item SNMP::Info::CDP
=item SNMP::Info::CiscoStats
=item SNMP::Info::CiscoImage
=back
=head2 Required MIBs
@@ -201,12 +184,6 @@ See SNMP::Info::CiscoVTP for its own MIB requirements.
See SNMP::Info::CiscoStack for its own MIB requirements.
See SNMP::Info::CiscoStats for its own MIB requirements.
See SNMP::Info::CiscoImage for its own MIB requirements.
See SNMP::Info::CDP for its own MIB requirements.
=back
=head1 GLOBALS
@@ -219,17 +196,6 @@ These are methods that return scalar value from SNMP
Returns 'cisco'
=item $c3550->model()
Will take the translated model number and try to format it better.
355048 -> 3550-48
355012G -> 3550-12G
=item $c3550->ports()
Trys to cull the number of ports from the model number.
=back
=head2 Globals imported from SNMP::Info::Layer3
@@ -244,18 +210,6 @@ See documentation in SNMP::Info::CiscoVTP for details.
See documentation in SNMP::Info::CiscoStack for details.
=head2 Globals imported from SNMP::Info::CDP
See documentation in SNMP::Info::CDP for details.
=head2 Globals imported from SNMP::Info::CiscoStats
See documentation in SNMP::Info::CiscoStats for details.
=head2 Globals imported from SNMP::Info::CiscoImage
See documentation in SNMP::Info::CiscoImage for details.
=head1 TABLE ENTRIES
These are methods that return tables of information in the form of a reference
@@ -273,16 +227,4 @@ See documentation in SNMP::Info::CiscoVTP for details.
See documentation in SNMP::Info::CiscoStack for details.
=head2 Table Methods imported from SNMP::Info::CDP
See documentation in SNMP::Info::CDP for details.
=head2 Table Methods imported from SNMP::Info::CiscoStats
See documentation in SNMP::Info::CiscoStats for details.
=head2 Table Methods imported from SNMP::Info::CiscoImage
See documentation in SNMP::Info::CiscoImage for details.
=cut

View File

@@ -1,245 +0,0 @@
# SNMP::Info::Layer3::C4000
# Bill Fenner
#
# Copyright (c) 2006 Bill Fenner
# 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 Author, nor
# 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::Layer3::C4000;
# $Id$
use strict;
use Exporter;
use SNMP::Info::Layer3;
use SNMP::Info::CiscoVTP;
use SNMP::Info::CDP;
use SNMP::Info::CiscoStats;
use SNMP::Info::CiscoImage;
use SNMP::Info::MAU;
use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %MUNGE $INIT/ ;
$VERSION = '1.03';
@SNMP::Info::Layer3::C4000::ISA = qw/ SNMP::Info::Layer3 SNMP::Info::CiscoStack SNMP::Info::CiscoVTP
SNMP::Info::CiscoStats SNMP::Info::CDP
SNMP::Info::CiscoImage SNMP::Info::MAU Exporter/;
@SNMP::Info::Layer3::C4000::EXPORT_OK = qw//;
%MIBS = (
%SNMP::Info::Layer3::MIBS,
%SNMP::Info::CiscoVTP::MIBS,
%SNMP::Info::CDP::MIBS,
%SNMP::Info::CiscoStats::MIBS,
%SNMP::Info::CiscoImage::MIBS,
%SNMP::Info::MAU::MIBS,
'CISCO-ENVMON-MIB' => 'ciscoEnvMonMIB',
);
%GLOBALS = (
%SNMP::Info::Layer3::GLOBALS,
%SNMP::Info::CiscoVTP::GLOBALS,
%SNMP::Info::CDP::GLOBALS,
%SNMP::Info::CiscoStats::GLOBALS,
%SNMP::Info::CiscoImage::GLOBALS,
%SNMP::Info::MAU::GLOBALS,
'ps1_type' => 'ciscoEnvMonSupplyStatusDescr.1',
'ps1_status' => 'ciscoEnvMonSupplyState.1',
'ps2_type' => 'ciscoEnvMonSupplyStatusDescr.2',
'ps2_status' => 'ciscoEnvMonSupplyState.2',
);
%FUNCS = (
%SNMP::Info::Layer3::FUNCS,
%SNMP::Info::CiscoVTP::FUNCS,
%SNMP::Info::CDP::FUNCS,
%SNMP::Info::CiscoStats::FUNCS,
%SNMP::Info::CiscoImage::FUNCS,
%SNMP::Info::MAU::FUNCS,
'fan_state' => 'ciscoEnvMonFanState',
'fan_descr' => 'ciscoEnvMonFanStatusDescr',
);
%MUNGE = (
%SNMP::Info::Layer3::MUNGE,
%SNMP::Info::CiscoVTP::MUNGE,
%SNMP::Info::CDP::MUNGE,
%SNMP::Info::CiscoStats::MUNGE,
%SNMP::Info::CiscoImage::MUNGE,
%SNMP::Info::MAU::MUNGE,
);
# use MAU-MIB for admin. duplex and admin. speed
*SNMP::Info::Layer3::C4000::i_duplex_admin = \&SNMP::Info::MAU::mau_i_duplex_admin;
*SNMP::Info::Layer3::C4000::i_speed_admin = \&SNMP::Info::MAU::mau_i_speed_admin;
sub fan {
my $c4000 = shift;
my $fan_state = $c4000->fan_state();
my $fan_descr = $c4000->fan_descr();
my $ret = "";
my $s = "";
foreach my $i (sort {$a <=> $b} keys %$fan_state) {
$ret .= $s . $fan_descr->{$i} . ": " . $fan_state->{$i};
$s = ", ";
}
return undef if ($s eq "");
$ret;
}
sub cisco_comm_indexing { 1; }
1;
__END__
=head1 NAME
SNMP::Info::Layer3::C4000 - Perl5 Interface to Cisco Catalyst 4000 Layer 2/3 Switches running IOS
=head1 AUTHOR
Bill Fenner
=head1 SYNOPSIS
# Let SNMP::Info determine the correct subclass for you.
my $c4000 = 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 = $c4000->class();
print "SNMP::Info determined this device to fall under subclass : $class\n";
=head1 DESCRIPTION
Abstraction subclass for Cisco Catalyst 4000 Layer 2/3 Switches.
For speed or debugging purposes you can call the subclass directly, but not after determining
a more specific class using the method above.
my $c4000 = new SNMP::Info::Layer3::C4000(...);
=head2 Inherited Classes
=over
=item SNMP::Info::Layer3
=item SNMP::Info::CiscoVTP
=item SNMP::Info::CiscoStats
=item SNMP::Info::CDP
=item SNMP::Info::CiscoImage
=item SNMP::Info::MAU
=back
=head2 Required MIBs
=over
=item Inherited Classes' MIBs
See SNMP::Info::Layer3 for its own MIB requirements.
See SNMP::Info::CiscoVTP for its own MIB requirements.
See SNMP::Info::CiscoStats for its own MIB requirements.
See SNMP::Info::CDP for its own MIB requirements.
See SNMP::Info::CiscoImage for its own MIB requirements.
See SNMP::Info::MAU for its own MIB requirements.
=back
=head1 GLOBALS
These are methods that return scalar value from SNMP
=head2 Globals imported from SNMP::Info::Layer3
See documentation in SNMP::Info::Layer3 for details.
=head2 Global Methods imported from SNMP::Info::CiscoVTP
See documentation in SNMP::Info::CiscoVTP for details.
=head2 Globals imported from SNMP::Info::CDP
See documentation in SNMP::Info::CDP for details.
=head2 Globals imported from SNMP::Info::CiscoStats
See documentation in SNMP::Info::CiscoStats for details.
=head2 Globals imported from SNMP::Info::CiscoImage
See documentation in SNMP::Info::CiscoImage for details.
=head2 Globals imported from SNMP::Info::MAU
See documentation in SNMP::Info::MAU for details.
=head1 TABLE ENTRIES
These are methods that return tables of information in the form of a reference
to a hash.
=head2 Table Methods imported from SNMP::Info::Layer3
See documentation in SNMP::Info::Layer3 for details.
=head2 Table Methods imported from SNMP::Info::CiscoVTP
See documentation in SNMP::Info::CiscoVTP for details.
=head2 Table Methods imported from SNMP::Info::CDP
See documentation in SNMP::Info::CDP for details.
=head2 Table Methods imported from SNMP::Info::CiscoStats
See documentation in SNMP::Info::CiscoStats for details.
=head2 Table Methods imported from SNMP::Info::CiscoImage
See documentation in SNMP::Info::CiscoImage for details.
=head2 Table Methods imported from SNMP::Info::MAU
See documentation in SNMP::Info::MAU for details.
=cut

View File

@@ -1,7 +1,7 @@
# SNMP::Info::Layer3::C6500
# Max Baker
# Max Baker <max@warped.org>
#
# Copyright (c) 2003,2004,2005 Max Baker
# Copyright (c) 2003,2004 Max Baker
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -28,6 +28,7 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer3::C6500;
$VERSION = 0.9;
# $Id$
use strict;
@@ -36,51 +37,40 @@ use Exporter;
use SNMP::Info::Layer3;
use SNMP::Info::CiscoVTP;
use SNMP::Info::CiscoStack;
use SNMP::Info::CDP;
use SNMP::Info::CiscoStats;
use SNMP::Info::CiscoImage;
use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %MUNGE $INIT/ ;
$VERSION = '1.03';
@SNMP::Info::Layer3::C6500::ISA = qw/ SNMP::Info::Layer3 SNMP::Info::CiscoStack SNMP::Info::CiscoVTP
SNMP::Info::CiscoStats SNMP::Info::CDP Exporter
SNMP::Info::CiscoImage/;
@SNMP::Info::Layer3::C6500::ISA = qw/ SNMP::Info::Layer3 SNMP::Info::CiscoStack SNMP::Info::CiscoVTP Exporter/;
@SNMP::Info::Layer3::C6500::EXPORT_OK = qw//;
%MIBS = (
%SNMP::Info::Layer3::MIBS,
%SNMP::Info::CiscoVTP::MIBS,
%SNMP::Info::CiscoStack::MIBS,
%SNMP::Info::CDP::MIBS,
%SNMP::Info::CiscoStats::MIBS,
%SNMP::Info::CiscoImage::MIBS,
);
$DEBUG=0;
# See SNMP::Info for the details of these data structures and
# the interworkings.
$INIT = 0;
%MIBS = (
%SNMP::Info::Layer3::MIBS,
%SNMP::Info::CiscoVTP::MIBS,
%SNMP::Info::CiscoStack::MIBS,
);
%GLOBALS = (
%SNMP::Info::Layer3::GLOBALS,
%SNMP::Info::CiscoVTP::GLOBALS,
%SNMP::Info::CiscoStack::GLOBALS,
%SNMP::Info::CDP::GLOBALS,
%SNMP::Info::CiscoStats::GLOBALS,
%SNMP::Info::CiscoImage::GLOBALS,
);
%FUNCS = (
%SNMP::Info::Layer3::FUNCS,
%SNMP::Info::CiscoVTP::FUNCS,
%SNMP::Info::CiscoStack::FUNCS,
%SNMP::Info::CDP::FUNCS,
%SNMP::Info::CiscoStats::FUNCS,
%SNMP::Info::CiscoImage::FUNCS,
);
%MUNGE = (
# Inherit all the built in munging
%SNMP::Info::Layer3::MUNGE,
%SNMP::Info::CiscoVTP::MUNGE,
%SNMP::Info::CiscoStack::MUNGE,
%SNMP::Info::CDP::MUNGE,
%SNMP::Info::CiscoStats::MUNGE,
%SNMP::Info::CiscoImage::MUNGE,
);
# Pick and choose
@@ -92,13 +82,21 @@ $VERSION = '1.03';
*SNMP::Info::Layer3::C6500::i_name = \&SNMP::Info::Layer3::i_name;
*SNMP::Info::Layer3::C6500::i_type = \&SNMP::Info::CiscoStack::i_type;
sub model {
my $c6500 = shift;
my $model1 = $c6500->model1();
return $model1 if defined $model1;
return $c6500->SUPER::model();
}
sub vendor {
return 'cisco';
}
# There are some buggy 6509's out there.
sub bulkwalk_no { 1; }
sub cisco_comm_indexing { 1; }
sub cisco_comm_indexing {
1;
}
1;
__END__
@@ -109,7 +107,7 @@ SNMP::Info::Layer3::C6500 - Perl5 Interface to Cisco Catalyst 6500 Layer 2/3 Swi
=head1 AUTHOR
Max Baker
Max Baker (C<max@warped.org>)
=head1 SYNOPSIS
@@ -150,12 +148,6 @@ a more specific class using the method above.
=item SNMP::Info::CiscoStack
=item SNMP::Info::CiscoStats
=item SNMP::Info::CDP
=item SNMP::Info::CiscoImage
=back
=head2 Required MIBs
@@ -170,12 +162,6 @@ See SNMP::Info::CiscoVTP for its own MIB requirements.
See SNMP::Info::CiscoStack for its own MIB requirements.
See SNMP::Info::CiscoStats for its own MIB requirements.
See SNMP::Info::CDP for its own MIB requirements.
See SNMP::Info::CiscoImage for its own MIB requirements.
=back
=head1 GLOBALS
@@ -184,11 +170,6 @@ These are methods that return scalar value from SNMP
=over
=item $c6500->bulkwalk_no
Return C<1>. There are some buggy 6509's out there, so bulkwalk
is turned off for this class.
=item $c6500->vendor()
Returns 'cisco'
@@ -207,18 +188,6 @@ See documentation in SNMP::Info::CiscoVTP for details.
See documentation in SNMP::Info::CiscoStack for details.
=head2 Globals imported from SNMP::Info::CDP
See documentation in SNMP::Info::CDP for details.
=head2 Globals imported from SNMP::Info::CiscoStats
See documentation in SNMP::Info::CiscoStats for details.
=head2 Globals imported from SNMP::Info::CiscoImage
See documentation in SNMP::Info::CiscoImage for details.
=head1 TABLE ENTRIES
These are methods that return tables of information in the form of a reference
@@ -236,17 +205,5 @@ See documentation in SNMP::Info::CiscoVTP for details.
See documentation in SNMP::Info::CiscoStack for details.
=head2 Table Methods imported from SNMP::Info::CDP
See documentation in SNMP::Info::CDP for details.
=head2 Table Methods imported from SNMP::Info::CiscoStats
See documentation in SNMP::Info::CiscoStats for details.
=head2 Table Methods imported from SNMP::Info::CiscoImage
See documentation in SNMP::Info::CiscoImage for details.
=cut

View File

@@ -1,7 +1,7 @@
# SNMP::Info::Layer3::Cisco
# Max Baker
# Max Baker <max@warped.org>
#
# Copyright (c) 2004-6 Max Baker
# Copyright (c) 2004 Max Baker
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -27,6 +27,7 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer3::Cisco;
$VERSION = 0.9;
# $Id$
use strict;
@@ -34,71 +35,49 @@ use strict;
use Exporter;
use SNMP::Info::Layer3;
use SNMP::Info::CiscoVTP;
use SNMP::Info::CDP;
use SNMP::Info::CiscoStats;
use SNMP::Info::CiscoImage;
use SNMP::Info::CiscoRTT;
use SNMP::Info::CiscoQOS;
use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %MUNGE $INIT/ ;
$VERSION = '1.03';
@SNMP::Info::Layer3::Cisco::ISA = qw/SNMP::Info::Layer3 SNMP::Info::CiscoVTP
SNMP::Info::CDP SNMP::Info::CiscoStats
SNMP::Info::CiscoImage SNMP::Info::CiscoRTT
SNMP::Info::CiscoQOS Exporter/;
@SNMP::Info::Layer3::Cisco::ISA = qw/SNMP::Info::Layer3 SNMP::Info::CiscoVTP Exporter/;
@SNMP::Info::Layer3::Cisco::EXPORT_OK = qw//;
$DEBUG=0;
# See SNMP::Info for the details of these data structures and
# the interworkings.
$INIT = 0;
%MIBS = (
%SNMP::Info::Layer3::MIBS,
%SNMP::Info::CiscoVTP::MIBS,
%SNMP::Info::CDP::MIBS,
%SNMP::Info::CiscoStats::MIBS,
%SNMP::Info::CiscoImage::MIBS,
%SNMP::Info::CiscoRTT::MIBS,
%SNMP::Info::CiscoQOS::MIBS,
%SNMP::Info::Layer3::MIBS,
%SNMP::Info::CiscoVTP::MIBS,
);
%GLOBALS = (
%SNMP::Info::Layer3::GLOBALS,
%SNMP::Info::CiscoVTP::GLOBALS,
%SNMP::Info::CDP::GLOBALS,
%SNMP::Info::CiscoStats::GLOBALS,
%SNMP::Info::CiscoImage::GLOBALS,
%SNMP::Info::CiscoRTT::GLOBALS,
%SNMP::Info::CiscoQOS::GLOBALS,
);
%FUNCS = (
%SNMP::Info::Layer3::FUNCS,
%SNMP::Info::CiscoVTP::FUNCS,
%SNMP::Info::CDP::FUNCS,
%SNMP::Info::CiscoStats::FUNCS,
%SNMP::Info::CiscoImage::FUNCS,
%SNMP::Info::CiscoRTT::FUNCS,
%SNMP::Info::CiscoQOS::FUNCS,
);
%MUNGE = (
# Inherit all the built in munging
%SNMP::Info::Layer3::MUNGE,
%SNMP::Info::CiscoVTP::MUNGE,
%SNMP::Info::CDP::MUNGE,
%SNMP::Info::CiscoStats::MUNGE,
%SNMP::Info::CiscoImage::MUNGE,
%SNMP::Info::CiscoRTT::MUNGE,
%SNMP::Info::CiscoQOS::MUNGE,
);
1;
__END__
=head1 NAME
SNMP::Info::Layer3::Cisco - Perl5 Interface to L3 and L2+L3 IOS Cisco Device
that are not covered in other classes.
SNMP::Info::Layer3::Cisco - Perl5 Interface to Generic L3 Cisco Device
=head1 AUTHOR
Max Baker
Max Baker (C<max@warped.org>)
=head1 SYNOPSIS
@@ -128,12 +107,6 @@ Subclass for Generic Cisco Routers running IOS
=item SNMP::Info::CiscoVTP
=item SNMP::Info::CDP
=item SNMP::Info::CiscoStats
=item SNMP::Info::CiscoImage
=back
=head2 Required MIBs
@@ -146,12 +119,6 @@ See SNMP::Info::Layer3 for its own MIB requirements.
See SNMP::Info::CiscoVTP for its own MIB requirements.
See SNMP::Info::CiscoStats for its own MIB requirements.
See SNMP::Info::CDP for its own MIB requirements.
See SNMP::Info::CiscoImage for its own MIB requirements.
=back
=head1 GLOBALS
@@ -174,17 +141,6 @@ See documentation in SNMP::Info::Layer3 for details.
See documentation in SNMP::Info::CiscoVTP for details.
=head2 Globals imported from SNMP::Info::CDP
See documentation in SNMP::Info::CDP for details.
=head2 Globals imported from SNMP::Info::CiscoStats
See documentation in SNMP::Info::CiscoStats for details.
=head2 Globals imported from SNMP::Info::CiscoImage
See documentation in SNMP::Info::CiscoImage for details.
=head1 TABLE ENTRIES
@@ -199,16 +155,4 @@ See documentation in SNMP::Info::Layer3 for details.
See documentation in SNMP::Info::CiscoVTP for details.
=head2 Table Methods imported from SNMP::Info::CDP
See documentation in SNMP::Info::CDP for details.
=head2 Table Methods imported from SNMP::Info::CiscoStats
See documentation in SNMP::Info::CiscoStats for details.
=head2 Table Methods imported from SNMP::Info::CiscoImage
See documentation in SNMP::Info::CiscoImage for details.
=cut

View File

@@ -1,8 +1,8 @@
# SNMP::Info::Layer3::Contivity
# Eric Miller
# Eric Miller <eric@jeneric.org>
# $Id$
#
# Copyright (c) 2004 Eric Miller, Max Baker
# Copyright (c) 2004 Max Baker
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -29,7 +29,7 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer3::Contivity;
$VERSION = '1.03';
$VERSION = 0.9;
use strict;
@@ -42,6 +42,12 @@ use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE/;
@SNMP::Info::Layer3::Contivity::ISA = qw/SNMP::Info SNMP::Info::Entity Exporter/;
@SNMP::Info::Layer3::Contivity::EXPORT_OK = qw//;
$DEBUG=0;
# See SNMP::Info for the details of these data structures and
# the interworkings.
$INIT = 0;
%MIBS = (
%SNMP::Info::MIBS,
%SNMP::Info::Entity::MIBS,
@@ -146,17 +152,31 @@ sub i_name {
my %i_name;
foreach my $iid (keys %$i_name2){
my $name = $i_name2->{$iid};
#Skip everything except Ethernet interfaces
next unless (defined $name and $name =~ /fe/i);
$name = $1 if $name =~ /(fei\.\d+\.\d+)/;
$i_name{$iid} = $name;
my $name = $i_name2->{$iid};
#Skip everything except Ethernet interfaces
next unless (defined $name and $name =~ /fe/i);
$name = $1 if $name =~ /(fei\.\d+\.\d+)/;
$i_name{$iid} = $name;
}
return \%i_name;
}
sub root_ip {
my $contivity = shift;
my $ip_table = $contivity->ip_table();
# Return First IP Address
foreach my $entry (keys %$ip_table){
my $router_ip = $ip_table->{$entry};
print " SNMP::Layer3::Contivity::root_ip() using $router_ip\n" if $DEBUG;
next unless $router_ip;
return $router_ip if ($router_ip ne '0.0.0.0');
}
return undef;
}
1;
__END__
@@ -167,7 +187,7 @@ Extranet Switches (CES).
=head1 AUTHOR
Eric Miller
Eric Miller (C<eric@jeneric.org>)
=head1 SYNOPSIS
@@ -250,6 +270,11 @@ Returns the chassis serial number.
Returns the MAC address of the first Ethernet Interface.
=item $contivity->root_ip()
Returns the primary IP used to communicate with the router. Returns the first
IP interface.
=back
=head2 Overrides

View File

@@ -1,331 +0,0 @@
# SNMP::Info::Layer3::Extreme - SNMP Interface to Extreme devices
# Eric Miller
#
# Copyright (c) 2005 Eric Miller
#
# 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::Layer3::Extreme;
# $Id$
use strict;
use Exporter;
use SNMP::Info::Layer3;
use SNMP::Info::MAU;
use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE/;
$VERSION = '1.03';
@SNMP::Info::Layer3::Extreme::ISA = qw/SNMP::Info::Layer3 SNMP::Info::MAU Exporter/;
@SNMP::Info::Layer3::Extreme::EXPORT_OK = qw//;
%MIBS = ( %SNMP::Info::Layer3::MIBS,
%SNMP::Info::MAU::MIBS,
'EXTREME-BASE-MIB' => 'extremeAgent',
'EXTREME-SYSTEM-MIB' => 'extremeSystem',
'EXTREME-FDB-MIB' => 'extremeSystem',
);
%GLOBALS = (
%SNMP::Info::Layer3::GLOBALS,
%SNMP::Info::MAU::GLOBALS,
'serial' => 'extremeSystemID',
'temp' => 'extremeCurrentTemperature',
'ps1_status' => 'extremePowerSupplyStatus.1',
'fan' => 'extremeFanOperational.1',
'mac' => 'dot1dBaseBridgeAddress',
);
%FUNCS = (
%SNMP::Info::Layer3::FUNCS,
%SNMP::Info::MAU::FUNCS,
# EXTREME-FDB-MIB:extremeFdbMacFdbTable
'fw_mac' => 'extremeFdbMacFdbMacAddress',
'fw_port' => 'extremeFdbMacFdbPortIfIndex',
'fw_status' => 'extremeFdbMacFdbStatus',
);
%MUNGE = (
# Inherit all the built in munging
%SNMP::Info::Layer3::MUNGE,
%SNMP::Info::MAU::MUNGE,
);
# Method OverRides
sub bulkwalk_no { 1; }
*SNMP::Info::Layer3::Extreme::i_duplex = \&SNMP::Info::MAU::mau_i_duplex;
*SNMP::Info::Layer3::Extreme::i_duplex_admin = \&SNMP::Info::MAU::mau_i_duplex_admin;
sub model {
my $extreme = shift;
my $id = $extreme->id();
unless (defined $id){
print " SNMP::Info::Layer3::Extreme::model() - Device does not support sysObjectID\n" if $extreme->debug();
return undef;
}
my $model = &SNMP::translateObj($id);
return $id unless defined $model;
return $model;
}
sub vendor {
return 'extreme';
}
sub os {
return 'extreme';
}
sub os_ver {
my $extreme = shift;
my $descr = $extreme->description();
return undef unless defined $descr;
if ($descr =~ m/Version ([\d.]*)/){
return $1;
}
return undef;
}
# We're not using BRIDGE-MIB
sub bp_index {
my $extreme = shift;
my $if_index = $extreme->i_index();
my %bp_index;
foreach my $iid (keys %$if_index){
$bp_index{$iid} = $iid;
}
return \%bp_index;
}
# Index values in the Q-BRIDGE-MIB are the same
# as in the BRIDGE-MIB and do not match ifIndex.
sub i_vlan {
my $extreme = shift;
my $qb_i_vlan = $extreme->qb_i_vlan();
my $bp_index = $extreme->bp_index();
my %i_vlan;
foreach my $v_index (keys %$qb_i_vlan){
my $vlan = $qb_i_vlan->{$v_index};
my $iid = $bp_index->{$v_index};
unless (defined $iid) {
print " Port $v_index has no bp_index mapping. Skipping\n"
if $DEBUG;
next;
}
$i_vlan{$iid}=$vlan;
}
return \%i_vlan;
}
1;
__END__
=head1 NAME
SNMP::Info::Layer3::Extreme - Perl5 Interface to Extreme Network Devices
=head1 AUTHOR
Eric Miller
=head1 SYNOPSIS
# Let SNMP::Info determine the correct subclass for you.
my $extreme = new SNMP::Info(
AutoSpecify => 1,
Debug => 1,
# These arguments are passed directly on to SNMP::Session
DestHost => 'myswitch',
Community => 'public',
Version => 1
)
or die "Can't connect to DestHost.\n";
my $class = $extreme->class();
print "SNMP::Info determined this device to fall under subclass : $class\n";
=head1 DESCRIPTION
Provides abstraction to the configuration information obtainable from an
Extreme 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 $extreme = new SNMP::Info::Layer3::Extreme(...);
=head2 Inherited Classes
=over
=item SNMP::Info::Layer3
=item SNMP::Info::MAU
=back
=head2 Required MIBs
=over
=item EXTREME-BASE-MIB
=item EXTREME-SYSTEM-MIB
=item EXTREME-FDB-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 $extreme->bulkwalk_no
Return C<1>. Bulkwalk is currently turned off for this class.
=item $extreme->model()
Returns model type. Checks $extreme->id() against the EXTREME-BASE-MIB.
=item $extreme->vendor()
Returns extreme
=item $extreme->os()
Returns extreme
=item $extreme->serial()
Returns serial number
(B<extremeSystemID>)
=item $extreme->temp()
Returns system temperature
(B<extremeCurrentTemperature>)
=item $extreme->ps1_status()
Returns status of power supply 1
(B<extremePowerSupplyStatus.1>)
=item $extreme->fan()
Returns fan status
(B<extremeFanOperational.1>)
=item $extreme->mac()
Returns base mac
(B<dot1dBaseBridgeAddress>)
=back
=head2 Overrides
=over
=back
=head2 Globals imported from SNMP::Info::Layer3
See documentation in SNMP::Info::Layer3 for details.
=head2 Globals imported from SNMP::Info::MAU
See documentation in SNMP::Info::MAU 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 $extreme->fw_mac()
(B<extremeFdbMacFdbMacAddress>)
=item $extreme->fw_port()
(B<extremeFdbMacFdbPortIfIndex>)
=item $extreme->fw_status()
(B<extremeFdbMacFdbStatus>)
=item $extreme->i_vlan()
Returns a mapping between ifIndex and the VLAN.
=item $stack->bp_index()
Returns reference to hash of bridge port table entries map back to interface identifier (iid)
Returns (B<ifIndex>) for both key and value since we're using EXTREME-FDB-MIB
rather than BRIDGE-MIB.
=back
=head2 Table Methods imported from SNMP::Info::Layer3
See documentation in SNMP::Info::Layer3 for details.
=head2 Table Methods imported from SNMP::Info::MAU
See documentation in SNMP::Info::MAU for details.
=cut

View File

@@ -1,7 +1,7 @@
# SNMP::Info::Layer3::Foundry - SNMP Interface to Foundry devices
# Max Baker
# Max Baker <max@warped.org>
#
# Copyright (c) 2004,2005 Max Baker changes from version 0.8 and beyond.
# 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.
@@ -30,25 +30,30 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer3::Foundry;
$VERSION = 0.9;
# $Id$
use strict;
use Exporter;
use SNMP::Info::Layer3;
use SNMP::Info;
use SNMP::Info::Bridge;
use SNMP::Info::FDP;
use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE/;
$VERSION = '1.03';
@SNMP::Info::Layer3::Foundry::ISA = qw/SNMP::Info::Layer3 SNMP::Info::FDP Exporter/;
@SNMP::Info::Layer3::Foundry::ISA = qw/SNMP::Info SNMP::Info::Bridge SNMP::Info::FDP Exporter/;
@SNMP::Info::Layer3::Foundry::EXPORT_OK = qw//;
%MIBS = ( %SNMP::Info::Layer3::MIBS,
$DEBUG=0;
$SNMP::debugging=$DEBUG;
$INIT = 0;
%MIBS = ( %SNMP::Info::MIBS,
%SNMP::Info::Bridge::MIBS,
%SNMP::Info::FDP::MIBS,
'FOUNDRY-SN-ROOT-MIB' => 'foundry',
'FOUNDRY-SN-AGENT-MIB' => 'snChasPwrSupplyDescription',
# IP-FORWARD-MIB
# ETHERLIKE-MIB
# RFC1398-MIB
@@ -57,7 +62,9 @@ $VERSION = '1.03';
);
%GLOBALS = (
%SNMP::Info::Layer3::GLOBALS,
# Inherit the super class ones
%SNMP::Info::GLOBALS,
%SNMP::Info::Bridge::GLOBALS,
%SNMP::Info::FDP::GLOBALS,
'mac' => 'ifPhysAddress.1',
'chassis' => 'entPhysicalDescr.1',
@@ -74,9 +81,14 @@ $VERSION = '1.03';
);
%FUNCS = (
%SNMP::Info::Layer3::FUNCS,
%SNMP::Info::FUNCS,
%SNMP::Info::Bridge::FUNCS,
%SNMP::Info::FDP::FUNCS,
'i_name2' => 'ifName',
# From RFC1213-MIB
'at_index' => 'ipNetToMediaIfIndex',
'at_paddr' => 'ipNetToMediaPhysAddress',
'at_netaddr' => 'ipNetToMediaNetAddress',
# FOUNDRY-MIB
# snSwPortInfoTable - Switch Port Information Group
'sw_index' => 'snSwPortIfIndex',
@@ -87,7 +99,8 @@ $VERSION = '1.03';
%MUNGE = (
# Inherit all the built in munging
%SNMP::Info::Layer3::MUNGE,
%SNMP::Info::MUNGE,
%SNMP::Info::Bridge::MUNGE,
%SNMP::Info::FDP::MUNGE,
'at_paddr' => \&SNMP::Info::munge_mac,
);
@@ -95,8 +108,6 @@ $VERSION = '1.03';
# Method OverRides
sub bulkwalk_no { 1; }
# Add our i_aliases if they are set (manually)
sub i_name {
my $foundry = shift;
@@ -134,10 +145,6 @@ sub i_duplex {
my $foundry = shift;
my $sw_index = $foundry->sw_index();
my $sw_duplex= $foundry->sw_duplex();
unless (defined $sw_index and defined $sw_duplex){
return $foundry->SUPER::i_duplex();
}
my %i_duplex;
foreach my $sw_port (keys %$sw_duplex){
@@ -154,10 +161,6 @@ sub i_type {
my $foundry = shift;
my $sw_index = $foundry->sw_index();
my $sw_type= $foundry->sw_type();
unless (defined $sw_index and defined $sw_type){
return $foundry->SUPER::i_type();
}
my %i_type;
foreach my $sw_port (keys %$sw_type){
@@ -173,10 +176,6 @@ sub i_speed {
my $foundry = shift;
my $sw_index = $foundry->sw_index();
my $sw_speed= $foundry->sw_speed();
unless (defined $sw_index and defined $sw_speed){
return $foundry->SUPER::i_speed();
}
my %i_speed;
foreach my $sw_port (keys %$sw_speed){
@@ -202,9 +201,7 @@ sub model {
my $model = &SNMP::translateObj($id);
$model = $1 if $desc =~ /\s+([a-z]{2}\d{4})\D/i;
$model = $1 if $desc =~ /\b(FW[A-Z\d]+)/;
$model =~ s/^sn//;
return $model;
}
@@ -249,7 +246,6 @@ sub interfaces {
sub vendor {
return 'foundry';
}
1;
__END__
@@ -259,7 +255,7 @@ SNMP::Info::Layer3::Foundry - Perl5 Interface to Foundry FastIron Network Device
=head1 AUTHOR
Max Baker
Max Baker (C<max@warped.org>)
=head1 SYNOPSIS
@@ -275,14 +271,15 @@ Max Baker
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 provides limited functionality from some L2+L3 and L3 Foundry devices.
This subclass no longer supported.
Specifically designed for a FI4802. Works on a FWSX424.
This module provides limited functionality from older Foundry devices.
Specifically designed for a FI4802.
For speed or debugging purposes you can call the subclass directly, but not after determining
a more specific class using the method above. Turn off the AutoSpecify flag.
@@ -295,6 +292,7 @@ a more specific class using the method above. Turn off the AutoSpecify flag.
=item SNMP::Info
=item SNMP::Info::Bridge
=back
@@ -375,6 +373,10 @@ Returns the status of the chassis fan.
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
@@ -480,4 +482,8 @@ Returns reference to hash. Current Port Speed.
See documentation in SNMP::Info for details.
=head2 Table Methods imported from SNMP::Info::Bridge
See documentation in SNMP::Info::Bridge for details.
=cut

View File

@@ -1,181 +0,0 @@
# SNMP::Info::Layer3::Juniper
# Bill Fenner
#
#
# 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::Layer3::Juniper;
# $Id$
use Exporter;
use SNMP::Info::Layer3;
use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %MUNGE $INIT/ ;
$VERSION = '1.03';
@SNMP::Info::Layer3::Juniper::ISA = qw/SNMP::Info::Layer3 Exporter/;
@SNMP::Info::Layer3::Juniper::EXPORT_OK = qw//;
%MIBS = (
%SNMP::Info::Layer3::MIBS,
'JUNIPER-CHASSIS-DEFINES-MIB' => 'jnxChassisDefines',
'JUNIPER-MIB' => 'jnxBoxAnatomy',
);
%GLOBALS = (
%SNMP::Info::Layer3::GLOBALS,
'serial' => 'jnxBoxSerialNo.0',
);
%FUNCS = (
%SNMP::Info::Layer3::FUNCS,
);
%MUNGE = (
%SNMP::Info::Layer3::MUNGE,
);
sub vendor {
return 'juniper';
}
sub os {
return 'junos';
}
sub os_ver {
my $juniper = shift;
my $descr = $juniper->description();
return undef unless defined $descr;
if ($descr =~ m/kernel JUNOS (\S+)/) {
return $1;
}
return undef;
}
sub model {
my $l3 = shift;
my $id = $l3->id();
unless (defined $id){
print " SNMP::Info::Layer3::Juniper::model() - Device does not support sysObjectID\n" if $l3->debug();
return undef;
}
my $model = &SNMP::translateObj($id);
return $id unless defined $model;
$model =~ s/^jnxProductName//i;
return $model;
}
1;
__END__
=head1 NAME
SNMP::Info::Layer3::Juniper - Perl5 Interface to L3 Juniper Devices
=head1 AUTHOR
Bill Fenner
=head1 SYNOPSIS
# Let SNMP::Info determine the correct subclass for you.
my $juniper = new SNMP::Info(
AutoSpecify => 1,
Debug => 1,
# These arguments are passed directly on to SNMP::Session
DestHost => 'myrouter',
Community => 'public',
Version => 2
)
or die "Can't connect to DestHost.\n";
my $class = $juniper->class();
print "SNMP::Info determined this device to fall under subclass : $class\n";
=head1 DESCRIPTION
Subclass for Generic Juniper Routers running JUNOS
=head2 Inherited Classes
=over
=item SNMP::Info::Layer3
=back
=head2 Required MIBs
=over
=item Inherited Classes' MIBs
See L<SNMP::Info::Layer3> for its own MIB requirements.
=back
=head1 GLOBALS
These are methods that return scalar value from SNMP
=over
=item $juniper->vendor()
Returns 'juniper'
=item $juniper->os()
Returns 'junos'
=item $juniper->os_ver()
Returns the software version extracted from sysDescr.
=item $juniper->model()
Returns the model from sysObjectID, with jnxProductName
removed from the beginning.
=back
=head2 Globals imported from SNMP::Info::Layer3
See documentation in L<SNMP::Info::Layer3> for details.
=head1 TABLE ENTRIES
These are methods that return tables of information in the form of a reference
to a hash.
=head2 Table Methods imported from SNMP::Info::Layer3
See documentation in L<SNMP::Info::Layer3> for details.
=cut

View File

@@ -1,320 +0,0 @@
# SNMP::Info::Layer3::N1600 - SNMP Interface to Nortel N16XX devices
# Eric Miller
#
# Copyright (c) 2004,2005 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::Layer3::N1600;
# $Id$
use strict;
use Exporter;
use SNMP::Info::Layer3;
use SNMP::Info::SONMP;
use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE/;
$VERSION = '1.03';
@SNMP::Info::Layer3::N1600::ISA = qw/SNMP::Info::Layer3 SNMP::Info::SONMP Exporter/;
@SNMP::Info::Layer3::N1600::EXPORT_OK = qw//;
%MIBS = ( %SNMP::Info::Layer3::MIBS,
%SNMP::Info::SONMP::MIBS,
'SWL2MGMT-MIB' => 'swL2MgmtMIB',
'RAPID-CITY' => 'rapidCity',
);
%GLOBALS = (
%SNMP::Info::Layer3::GLOBALS,
%SNMP::Info::SONMP::GLOBALS,
);
%FUNCS = (
%SNMP::Info::Layer3::FUNCS,
%SNMP::Info::SONMP::FUNCS,
# SWL2MGMT-MIB
# swL2PortInfoTable
'n1600_nway_status' => 'swL2PortInfoNwayStatus',
# swL2PortCtrlTable
'n1600_nway_state' => 'swL2PortCtrlNwayState',
);
%MUNGE = (
# Inherit all the built in munging
%SNMP::Info::Layer3::MUNGE,
%SNMP::Info::SONMP::MUNGE,
);
# Method OverRides
sub bulkwalk_no { 1; }
sub model {
my $n1600 = shift;
my $id = $n1600->id();
unless (defined $id){
print " SNMP::Info::Layer3::N1600::model() - Device does not support sysObjectID\n" if $n1600->debug();
return undef;
}
my $model = &SNMP::translateObj($id);
return $id unless defined $model;
$model =~ s/^rcA//i;
return $model;
}
sub vendor {
return 'nortel';
}
sub os {
return 'passport';
}
sub os_ver {
my $n1600 = shift;
my $descr = $n1600->description();
return undef unless defined $descr;
if ($descr =~ m/(\d+\.\d+\.\d+\.\d+)/){
return $1;
}
return undef;
}
sub interfaces {
my $n1600 = shift;
my $i_index = $n1600->i_index();
my %if;
foreach my $iid (keys %$i_index){
my $index = $i_index->{$iid};
next unless defined $index;
my $slotport = "1.$index";
$if{$iid} = $slotport;
}
return \%if;
}
sub i_duplex {
my $n1600 = shift;
my $nway_status = $n1600->n1600_nway_status();
my %i_duplex;
foreach my $iid (keys %$nway_status){
my $duplex = $nway_status->{$iid};
next unless defined $duplex;
next if $duplex =~ /other/i;
$i_duplex{$iid} = 'half' if $duplex =~ /half/i;
$i_duplex{$iid} = 'full' if $duplex =~ /full/i;
}
return \%i_duplex;
}
sub i_duplex_admin {
my $n1600 = shift;
my $nway_state = $n1600->n1600_nway_state();
my %i_duplex;
foreach my $iid (keys %$nway_state){
my $duplex = $nway_state->{$iid};
next unless defined $duplex;
next if $duplex =~ /other/i;
$i_duplex{$iid} = 'half' if $duplex =~ /half/i;
$i_duplex{$iid} = 'full' if $duplex =~ /full/i;
$i_duplex{$iid} = 'auto' if $duplex =~ /nway-enabled/i;
}
return \%i_duplex;
}
# Required for SNMP::Info::SONMP
sub index_factor {
return 64;
}
1;
__END__
=head1 NAME
SNMP::Info::Layer3::N1600 - Perl5 Interface to Nortel 16XX Network Devices
=head1 AUTHOR
Eric Miller
=head1 SYNOPSIS
# Let SNMP::Info determine the correct subclass for you.
my $n1600 = new SNMP::Info(
AutoSpecify => 1,
Debug => 1,
# These arguments are passed directly on to SNMP::Session
DestHost => 'myswitch',
Community => 'public',
Version => 1
)
or die "Can't connect to DestHost.\n";
my $class = $n1600->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
N16XX 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 $n1600 = new SNMP::Info::Layer3::N1600(...);
=head2 Inherited Classes
=over
=item SNMP::Info::Layer3
=item SNMP::Info::SONMP
=back
=head2 Required MIBs
=over
=item SWL2MGMT-MIB
=item RAPID-CITY
=item Inherited Classes' MIBs
See classes listed above for their required MIBs.
=back
MIBs can be found on the CD that came with your product.
Or, they can be downloaded directly from Nortel regardless of support
contract status.
Go to http://www.nortel.com Techninal Support, Browse Technical Support,
Select by product, Java Device Manager, Software. Download the latest version.
After installation, all mibs are located under the install directory under mibs
and the repspective product line.
=head1 GLOBALS
These are methods that return scalar value from SNMP
=over
=item $n1600->bulkwalk_no
Return C<1>. Bulkwalk is currently turned off for this class.
=item $n1600->model()
Returns model type. Checks $n1600->id() against the
RAPID-CITY-MIB and then parses out rcA.
=item $n1600->vendor()
Returns 'nortel'
=item $n1600->os()
Returns 'passport'
=back
=head2 Overrides
=over
=item $n1600->index_factor()
Required by SNMP::Info::SONMP. Number representing the number of ports
reserved per slot within the device MIB.
Returns 64 since largest switch has 48 ports. Since these switches can
not stack, the only requirment to reserve more than the max number of ports.
=back
=head2 Globals imported from SNMP::Info::Layer3
See documentation in SNMP::Info::Layer3 for details.
=head2 Globals imported from SNMP::Info::SONMP
See documentation in SNMP::SONMP::Layer3 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 $n1600->interfaces()
Returns reference to hash of interface names to iids.
Places a 1 in front of index number. This is required for compatibilty with
SNMP::Info::SONMP.
=item $n1600->i_duplex()
Returns reference to hash of interface operational link duplex status.
=item $n1600->i_duplex_admin()
Returns reference to hash of interface administrative link duplex status.
=back
=head2 Table Methods imported from SNMP::Info::Layer3
See documentation in SNMP::Info::Layer3 for details.
=head2 Table Methods imported from SNMP::Info::SONMP
See documentation in SNMP::Info::SONMP for details.
=cut

View File

@@ -1,8 +1,8 @@
# SNMP::Info::Layer3::Passport
# Eric Miller
# Eric Miller <eric@jeneric.org>
# $Id$
#
# Copyright (c) 2004 Eric Miller, Max Baker
# Copyright (c) 2004 Max Baker
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -29,7 +29,7 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer3::Passport;
$VERSION = '1.03';
$VERSION = 0.9;
use strict;
@@ -44,6 +44,13 @@ use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE/;
@SNMP::Info::Layer3::Passport::ISA = qw/SNMP::Info SNMP::Info::Bridge SNMP::Info::SONMP SNMP::Info::RapidCity Exporter/;
@SNMP::Info::Layer3::Passport::EXPORT_OK = qw//;
$DEBUG=0;
# See SNMP::Info for the details of these data structures and
# the interworkings.
$INIT = 0;
%MIBS = (
%SNMP::Info::MIBS,
%SNMP::Info::Bridge::MIBS,
@@ -56,7 +63,7 @@ use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE/;
%SNMP::Info::GLOBALS,
%SNMP::Info::Bridge::GLOBALS,
%SNMP::Info::SONMP::GLOBALS,
%SNMP::Info::RapidCity::GLOBALS,
%SNMP::Info::RapidCity::GLOBALS,
'router_ip' => 'ospfRouterId'
);
@@ -67,14 +74,14 @@ use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE/;
%SNMP::Info::RapidCity::FUNCS,
'i_index2' => 'ifIndex',
'i_mac2' => 'ifPhysAddress',
'i_description2' => 'ifDescr',
'i_description2' => 'ifDescr',
'i_name2' => 'ifName',
'ip_index2' => 'ipAdEntIfIndex',
# From RFC1213-MIB
'at_index' => 'ipNetToMediaIfIndex',
'at_paddr' => 'ipNetToMediaPhysAddress',
'at_netaddr' => 'ipNetToMediaNetAddress',
'i_name2' => 'ifName'
'i_name2' => 'ifName'
);
%MUNGE = (
@@ -88,19 +95,15 @@ use vars qw/$VERSION $DEBUG %GLOBALS %FUNCS $INIT %MIBS %MUNGE/;
sub model {
my $passport = shift;
my $id = $passport->id();
unless (defined $id){
print " SNMP::Info::Layer3::Passport::model() - Device does not support sysObjectID\n" if $passport->debug();
return undef;
}
my $model = &SNMP::translateObj($id);
my $desc = $passport->description();
return undef unless defined $desc;
return $id unless defined $model;
$model =~ s/^rcA//i;
return $model;
return '8603' if ($desc =~ /8603/);
return '8606' if ($desc =~ /8606/);
return '8610co' if ($desc =~ /8610co/);
return '8610' if ($desc =~ /8610/);
return $desc;
}
sub vendor {
@@ -116,21 +119,14 @@ sub os_ver {
my $descr = $passport->description();
return undef unless defined $descr;
#Passport
if ($descr =~ m/(\d+\.\d+\.\d+\.\d+)/){
return $1;
}
#Accelar
if ($descr =~ m/(\d+\.\d+\.\d+)/){
return $1;
}
return undef;
}
sub i_index {
my $passport = shift;
my $model = $passport->model();
my $i_index = $passport->i_index2();
my $vlan_index = $passport->rc_vlan_if();
my $cpu_index = $passport->rc_cpu_ifindex();
@@ -140,8 +136,8 @@ sub i_index {
foreach my $iid (keys %$i_index){
my $index = $i_index->{$iid};
next unless defined $index;
$if_index{$iid} = $index;
$if_index{$iid} = $index;
}
# Get VLAN Virtual Router Interfaces
@@ -153,22 +149,19 @@ sub i_index {
$if_index{$v_index} = $v_index;
}
if (defined $model and $model =~ /(86)/) {
# Get CPU Ethernet Interfaces
foreach my $cid (keys %$cpu_index){
my $c_index = $cpu_index->{$cid};
next unless defined $c_index;
next if $c_index == 0;
# Get CPU Ethernet Interfaces
foreach my $cid (keys %$cpu_index){
my $c_index = $cpu_index->{$cid};
next unless defined $c_index;
next if $c_index == 0;
$if_index{$c_index} = $c_index;
}
$if_index{$c_index} = $c_index;
}
# Check for Virtual Mgmt Interface
unless ($virt_ip eq '0.0.0.0') {
# Make up an index number, 1 is not reserved AFAIK
$if_index{1} = 1;
}
# Check for Virtual Mgmt Interface
unless ($virt_ip eq '0.0.0.0') {
# Make up an index number, 1 is not reserved AFAIK
$if_index{1} = 1;
}
return \%if_index;
@@ -176,12 +169,10 @@ sub i_index {
sub interfaces {
my $passport = shift;
my $model = $passport->model();
my $index_factor = $passport->index_factor();
my $port_offset = $passport->port_offset();
my $i_index = $passport->i_index();
my $vlan_id = $passport->rc_vlan_id();
my $vlan_index = $passport->rc_vlan_if();
my $model = $passport->model();
my %reverse_vlan = reverse %$vlan_index;
@@ -190,37 +181,37 @@ sub interfaces {
my $index = $i_index->{$iid};
next unless defined $index;
if (($index == 1) and ($model =~ /(86)/)) {
$if{$index} = 'Cpu.Virtual';
if ($index == 1) {
$if{$index} = 'CPU.Virtual';
}
elsif (($index == 192) and ($model eq '8603')) {
$if{$index} = 'Cpu.3';
$if{$index} = 'CPU3';
}
elsif (($index == 320) and ($model =~ /(8606|8610|8610co)/)) {
$if{$index} = 'Cpu.5';
elsif ($index == 320) {
$if{$index} = 'CPU5';
}
elsif (($index == 384) and ($model =~ /(8606|8610|8610co)/)) {
$if{$index} = 'Cpu.6';
elsif ($index == 384) {
$if{$index} = 'CPU6';
}
elsif (($index > 2000 and $model =~ /(86|81)/) or
($index > 256 and $model =~ /(105|11|12)/)) {
my $vlan_index = $reverse_vlan{$iid};
my $v_id = $vlan_id->{$vlan_index};
next unless defined $v_id;
my $v_port = 'Vlan'."$v_id";
$if{$index} = $v_port;
elsif ($index > 2000) {
my $vlan_index = $reverse_vlan{$iid};
my $v_id = $vlan_id->{$vlan_index};
next unless defined $v_id;
my $v_port = 'V'."$v_id";
$if{$index} = $v_port;
}
else {
my $port = ($index % $index_factor) + $port_offset;
my $slot = int($index / $index_factor);
my $port = ($index % 64) + 1;
my $slot = int($index / 64);
my $slotport = "$slot.$port";
$if{$iid} = $slotport;
my $slotport = "$slot.$port";
$if{$iid} = $slotport;
}
}
@@ -229,7 +220,6 @@ sub interfaces {
sub i_mac {
my $passport = shift;
my $model = $passport->model();
my $i_mac = $passport->i_mac2();
my $vlan_mac = $passport->rc_vlan_mac();
my $vlan_index = $passport->rc_vlan_if();
@@ -242,7 +232,7 @@ sub i_mac {
my $mac = $i_mac->{$iid};
next unless defined $mac;
$if_mac{$iid} = $mac;
$if_mac{$iid} = $mac;
}
# Get VLAN Virtual Router Interfaces
@@ -253,30 +243,28 @@ sub i_mac {
$if_mac{$v_id} = $v_mac;
}
if (defined $model and $model =~ /(86)/) {
# Get CPU Ethernet Interfaces
foreach my $iid (keys %$cpu_mac){
my $mac = $cpu_mac->{$iid};
next unless defined $mac;
$if_mac{$iid} = $mac;
}
# Get CPU Ethernet Interfaces
foreach my $iid (keys %$cpu_mac){
my $mac = $cpu_mac->{$iid};
next unless defined $mac;
# Check for Virtual Mgmt Interface
unless ($virt_ip eq '0.0.0.0'){
my @virt_mac = split /:/, $chassis_base_mac;
$virt_mac[0] = hex($virt_mac[0]);
$virt_mac[1] = hex($virt_mac[1]);
$virt_mac[2] = hex($virt_mac[2]);
$virt_mac[3] = hex($virt_mac[3]);
$virt_mac[4] = hex($virt_mac[4]) + 0x03;
$virt_mac[5] = hex($virt_mac[5]) + 0xF8;
$if_mac{$iid} = $mac;
}
my $mac = join(':',map { sprintf "%02x",$_ } @virt_mac);
# Check for Virtual Mgmt Interface
unless ($virt_ip eq '0.0.0.0'){
my @virt_mac = split /:/, $chassis_base_mac;
$virt_mac[0] = hex($virt_mac[0]);
$virt_mac[1] = hex($virt_mac[1]);
$virt_mac[2] = hex($virt_mac[2]);
$virt_mac[3] = hex($virt_mac[3]);
$virt_mac[4] = hex($virt_mac[4]) + 0x03;
$virt_mac[5] = hex($virt_mac[5]) + 0xF8;
$if_mac{1} = $mac;
}
my $mac = join(':',map { sprintf "%02x",$_ } @virt_mac);
$if_mac{1} = $mac;
}
return \%if_mac;
@@ -293,7 +281,7 @@ sub i_description {
my $if_descr = $i_descr->{$iid};
next unless defined $if_descr;
$descr{$iid} = $if_descr;
$descr{$iid} = $if_descr;
}
# Get VLAN Virtual Router Interfaces
@@ -309,51 +297,49 @@ sub i_description {
sub i_name {
my $passport = shift;
my $model = $passport->model();
my $i_index = $passport->i_index();
my $rc_alias = $passport->rc_alias();
my $i_name2 = $passport->i_name2();
my $v_name = $passport->rc_vlan_name();
my $vlan_index = $passport->rc_vlan_if();
my $model = $passport->model();
my %reverse_vlan = reverse %$vlan_index;
my %i_name;
foreach my $iid (keys %$i_index){
if (($iid == 1) and ($model =~ /(86)/)) {
$i_name{$iid} = 'CPU Virtual Management IP';
if ($iid == 1) {
$i_name{$iid} = 'CPU Virtual Management IP';
}
elsif (($iid == 192) and ($model eq '8603')) {
$i_name{$iid} = 'CPU 3 Ethernet Port';
}
elsif (($iid == 320) and ($model =~ /(8606|8610|8610co)/)) {
$i_name{$iid} = 'CPU 5 Ethernet Port';
elsif ($iid == 320) {
$i_name{$iid} = 'CPU 5 Ethernet Port';
}
elsif (($iid == 384) and ($model =~ /(8606|8610|8610co)/)) {
$i_name{$iid} = 'CPU 6 Ethernet Port';
elsif ($iid == 384) {
$i_name{$iid} = 'CPU 5 Ethernet Port';
}
elsif (($iid > 2000 and defined $model and $model =~ /(86|81)/) or
($iid > 256 and defined $model and $model =~ /(105|11|12)/)) {
my $vlan_index = $reverse_vlan{$iid};
my $vlan_name = $v_name->{$vlan_index};
next unless defined $vlan_name;
elsif ($iid > 2000) {
my $vlan_index = $reverse_vlan{$iid};
my $vlan_name = $v_name->{$vlan_index};
next unless defined $vlan_name;
$i_name{$iid} = $vlan_name;
}
$i_name{$iid} = $vlan_name;
}
else {
my $name = $i_name2->{$iid};
my $alias = $rc_alias->{$iid};
$i_name{$iid} = (defined $alias and $alias !~ /^\s*$/) ?
my $name = $i_name2->{$iid};
my $alias = $rc_alias->{$iid};
$i_name{$iid} = (defined $alias and $alias !~ /^\s*$/) ?
$alias :
$name;
}
}
}
return \%i_name;
@@ -361,7 +347,6 @@ sub i_name {
sub ip_index {
my $passport = shift;
my $model = $passport->model();
my $ip_index = $passport->ip_index2();
my $cpu_ip = $passport->rc_cpu_ip();
my $virt_ip = $passport->rc_virt_ip();
@@ -371,29 +356,25 @@ sub ip_index {
my $iid = $ip_index->{$ip};
next unless defined $iid;
$ip_index{$ip} = $iid;
$ip_index{$ip} = $iid;
}
# Only 8600 has CPU and Virtual Management IP
if (defined $model and $model =~ /(86)/) {
# Get CPU Ethernet IP
foreach my $cid (keys %$cpu_ip){
my $c_ip = $cpu_ip->{$cid};
next unless defined $c_ip;
# Get CPU Ethernet IP
foreach my $cid (keys %$cpu_ip){
my $c_ip = $cpu_ip->{$cid};
next unless defined $c_ip;
$ip_index{$c_ip} = $cid;
}
# Get Virtual Mgmt IP
$ip_index{$virt_ip} = 1;
$ip_index{$c_ip} = $cid;
}
# Get Virtual Mgmt IP
$ip_index{$virt_ip} = 1;
return \%ip_index;
}
sub root_ip {
my $passport = shift;
my $model = $passport->model();
my $rc_ip_addr = $passport->rc_ip_addr();
my $rc_ip_type = $passport->rc_ip_type();
my $virt_ip = $passport->rc_virt_ip();
@@ -401,51 +382,35 @@ sub root_ip {
my $sonmp_topo_port = $passport->sonmp_topo_port();
my $sonmp_topo_ip = $passport->sonmp_topo_ip();
# Only 8600 has CLIP or Management Virtual IP
if (defined $model and $model =~ /(86)/) {
# Return CLIP (CircuitLess IP)
foreach my $iid (keys %$rc_ip_type){
my $ip_type = $rc_ip_type->{$iid};
next unless ((defined $ip_type) and ($ip_type =~ /circuitLess/i));
my $ip = $rc_ip_addr->{$iid};
next unless defined $ip;
return $ip if $passport->snmp_connect_ip($ip);
}
# Return Management Virtual IP address
if ( (defined $virt_ip) and ($virt_ip ne '0.0.0.0') ) {
return $virt_ip if $passport->snmp_connect_ip($virt_ip);
}
# Return CLIP (CircuitLess IP)
foreach my $iid (keys %$rc_ip_type){
my $ip_type = $rc_ip_type->{$iid};
next unless ((defined $ip_type) and ($ip_type =~ /circuitLess/i));
my $ip = $rc_ip_addr->{$iid};
next unless defined $ip;
return $ip;
}
# Return Management Virtual IP address
return $virt_ip if ((defined $virt_ip) and ($virt_ip ne '0.0.0.0'));
# Return OSPF Router ID
if ((defined $router_ip) and ($router_ip ne '0.0.0.0')) {
foreach my $iid (keys %$rc_ip_addr){
my $ip = $rc_ip_addr->{$iid};
next unless $router_ip eq $ip;
return $router_ip if $passport->snmp_connect_ip($router_ip);
}
}
return $router_ip if ((defined $router_ip) and ($router_ip ne '0.0.0.0'));
# Otherwise Return SONMP Advertised IP Address
foreach my $entry (keys %$sonmp_topo_port){
my $port = $sonmp_topo_port->{$entry};
next unless $port == 0;
my $ip = $sonmp_topo_ip->{$entry};
return $ip if ( (defined $ip) and ($ip ne '0.0.0.0') and ($passport->snmp_connect_ip($ip)) );
return $ip if ((defined $ip) and ($ip ne '0.0.0.0'));
}
return undef;
}
# Required for SNMP::Info::SONMP
sub index_factor {
my $passport = shift;
my $model = $passport->model();
my $index_factor = 64;
# Older Accelar models use base 16 instead of 64
$index_factor = 16 if (defined $model and $model =~ /(105|11|12)/);
return $index_factor;
return 64;
}
sub slot_offset {
@@ -456,29 +421,17 @@ sub port_offset {
return 1;
}
# Bridge MIB does not map Bridge Port to ifIndex correctly
sub bp_index {
my $passport = shift;
my $if_index = $passport->i_index();
my %bp_index;
foreach my $iid (keys %$if_index){
$bp_index{$iid} = $iid;
}
return \%bp_index;
}
1;
__END__
=head1 NAME
SNMP::Info::Layer3::Passport - Perl5 Interface to modular Nortel Ethernet Routing
Switches (formerly Passport / Accelar)
SNMP::Info::Layer3::Passport - Perl5 Interface to Nortel Networks' Passport
8600 Series Switches
=head1 AUTHOR
Eric Miller
Eric Miller (C<eric@jeneric.org>)
=head1 SYNOPSIS
@@ -493,20 +446,18 @@ Eric Miller
)
or die "Can't connect to DestHost.\n";
my $class = $passport->class();
my $class = $passport->class();
print "SNMP::Info determined this device to fall under subclass : $class\n";
=head1 DESCRIPTION
Abstraction subclass for modular Nortel Ethernet Routing Switches (formerly
Passport and Accelar Series Switches).
Abstraction subclass for Nortel Networks' Passport 8600 Series Switches.
These devices have some of the same charactersitics as the stackable Nortel
Ethernet Switches (Baystack). For example, extended interface information is
gleened from RAPID-CITY.
These devices run Passport OS but have some of the same charactersitics as the Baystack family.
For example, extended interface information is gleened from RAPID-CITY.
For speed or debugging purposes you can call the subclass directly, but not after
determining a more specific class using the method above.
For speed or debugging purposes you can call the subclass directly, but not after determining
a more specific class using the method above.
my $passport = new SNMP::Info::Layer3::Passport(...);
@@ -552,16 +503,15 @@ These are methods that return scalar value from SNMP
=item $passport->model()
Returns model type. Checks $passport->id() against the
RAPID-CITY-MIB and then parses out rcA.
Returns the model extracted from B<sysDescr>
=item $passport->vendor()
Returns 'nortel'
Returns 'Nortel'
=item $passport->os()
Returns 'passport'
Returns 'Passport'
=item $passport->os_ver()
@@ -585,7 +535,7 @@ OSPF Router ID (B<ospfRouterId>), SONMP Advertised IP Address.
=item $passport->index_factor()
Required by SNMP::Info::SONMP. Returns 64 for 8600, 16 for Accelar.
Required by SNMP::Info::SONMP. Returns 64.
=item $passport->port_offset()
@@ -633,10 +583,10 @@ to ensure the virtual router ports are captured.
Returns reference to the map between IID and physical Port.
Slot and port numbers on the Passport switches are determined by the formula:
port = (ifIndex % index_factor) + port_offset, slot = int(ifIndex / index_factor).
port = (ifIndex % 64) + 1, slot = int(ifIndex / 64).
The physical port name is returned as slot.port. CPU Ethernet ports are prefixed
with CPU and VLAN interfaces are returned as the VLAN ID prefixed with Vlan.
with CPU and VLAN interfaces are returned as the VLAN ID prefixed with V.
=item $passport->i_mac()
@@ -658,13 +608,6 @@ name if exists.
Maps the IP Table to the IID. Extends (B<ipAdEntIfIndex>) by adding the index of
the CPU virtual management IP (if present) and each CPU Ethernet port.
=item $passport->bp_index()
Returns reference to hash of bridge port table entries map back to interface identifier (iid)
Returns (B<ifIndex>) for both key and value since some devices seem to have
problems with BRIDGE-MIB
=back
=head2 RFC1213 Arp Cache Table (B<ipNetToMediaTable>)

View File

@@ -1,7 +1,7 @@
# SNMP::Info::MAU - Media Access Unit - RFC 2668
# Max Baker
# SNMP::Info::MAU - Media Access Unit - RFC2668
# Max Baker <max@warped.org>
#
# Copyright (c) 2004,2005 Max Baker changes from version 0.8 and beyond.
# 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.
@@ -30,7 +30,7 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::MAU;
$VERSION = '1.03';
$VERSION = 0.9;
# $Id$
use strict;
@@ -42,6 +42,11 @@ use vars qw/$VERSION $DEBUG %MIBS %FUNCS %GLOBALS %MUNGE $INIT/;
@SNMP::Info::MAU::ISA = qw/SNMP::Info Exporter/;
@SNMP::Info::MAU::EXPORT_OK = qw//;
$DEBUG=0;
$SNMP::debugging=$DEBUG;
$INIT = 0;
%MIBS = ('MAU-MIB' => 'mauMod');
%GLOBALS = (
@@ -100,166 +105,17 @@ sub _ishalfduplex{
return 0;
}
my %_mau_i_speed_map = (
'10' => '10 Mbps',
'100' => '100 Mbps',
'1000' => '1.0 Gbps',
'10Gig' => '10 Gbps',
);
sub mau_i_speed_admin {
my $mau = shift;
my $mau_index = $mau->mau_index();
my $mau_type_admin = $mau->mau_type_admin();
my %i_speed_admin;
foreach my $mau_port (keys %$mau_type_admin){
my $iid = $mau_index->{$mau_port};
next unless defined $iid;
my $type_adminoid = $mau_type_admin->{$mau_port};
my $type_admin = &SNMP::translateObj($type_adminoid);
next unless defined $type_admin;
if ($type_adminoid eq '.0.0') {
$i_speed_admin{$iid} = 'auto';
} elsif ($type_admin =~ /^dot3MauType(.*)Base/ && $_mau_i_speed_map{$1}) {
$i_speed_admin{$iid} = $_mau_i_speed_map{$1};
}
}
return \%i_speed_admin;
}
sub mau_i_duplex {
my $mau = shift;
my $mau_index = $mau->mau_index();
my $mau_link = $mau->mau_link();
my %i_duplex;
foreach my $mau_port (keys %$mau_link){
my $iid = $mau_index->{$mau_port};
next unless defined $iid;
my $linkoid = $mau_link->{$mau_port};
my $link = &SNMP::translateObj($linkoid);
next unless defined $link;
my $duplex = undef;
if ($link =~ /fd$/i) {
$duplex = 'full';
} elsif ($link =~ /hd$/i){
$duplex = 'half';
}
$i_duplex{$iid} = $duplex if defined $duplex;
}
return \%i_duplex;
}
sub mau_i_duplex_admin {
my $mau = shift;
my $mau_index = $mau->mau_index();
my $mau_autostat = $mau->mau_autostat();
my $mau_type_admin = $mau->mau_type_admin();
# Older HP4000's don't implement ifMauDefaultType, but we can
# figure out from ifMauAutoNegCapAdvertised what we'd like.
if (!defined($mau_type_admin)) {
if (defined($mau_index)) {
return mau_i_duplex_admin_old($mau,$mau_index,$mau_autostat);
} else {
return undef;
}
}
my %i_duplex_admin;
foreach my $mau_port (keys %$mau_type_admin){
my $iid = $mau_index->{$mau_port};
next unless defined $iid;
my $autostat = $mau_autostat->{$mau_port};
if (defined $autostat and $autostat =~ /enabled/i){
$i_duplex_admin{$iid} = 'auto';
next;
}
my $type_adminoid = $mau_type_admin->{$mau_port};
my $type_admin = &SNMP::translateObj($type_adminoid);
next unless defined $type_admin;
my $duplex = undef;
if ($type_admin =~ /fd$/i) {
$duplex = 'full';
} elsif ($type_admin =~ /hd$/i){
$duplex = 'half';
}
$i_duplex_admin{$iid} = $duplex if defined $duplex;
}
return \%i_duplex_admin;
}
sub mau_i_duplex_admin_old {
my $mau = shift;
my $mau_index = shift;
my $mau_autostat = shift;
my $interfaces = $mau->interfaces();
my $mau_autosent = $mau->mau_autosent();
my %mau_reverse = reverse %$mau_index;
my %i_duplex_admin;
foreach my $iid (keys %$interfaces){
my $mau_index = $mau_reverse{$iid};
next unless defined $mau_index;
my $autostat = $mau_autostat->{$mau_index};
# HP25xx has this value
if (defined $autostat and $autostat =~ /enabled/i){
$i_duplex_admin{$iid} = 'auto';
next;
}
my $type = $mau_autosent->{$mau_index};
next unless defined $type;
if ($type == 0) {
$i_duplex_admin{$iid} = 'none';
next;
}
my $full = $mau->_isfullduplex($type);
my $half = $mau->_ishalfduplex($type);
if ($full and !$half){
$i_duplex_admin{$iid} = 'full';
} elsif ($half) {
$i_duplex_admin{$iid} = 'half';
}
}
return \%i_duplex_admin;
}
1;
__END__
=head1 NAME
SNMP::Info::MAU - Perl5 Interface to Medium Access Unit (MAU) MIB (RFC 2668) via SNMP
SNMP::Info::MAU - Perl5 Interface to Medium Access Unit (MAU) MIB (RFC2668) via SNMP
=head1 AUTHOR
Max Baker
Max Baker (C<max@warped.org>)
=head1 SYNOPSIS
@@ -277,7 +133,7 @@ Max Baker
=head1 DESCRIPTION
SNMP::Info::MAU is a sublcass of SNMP::Info that supplies access to the
MAU-MIB (RFC 2668). This MIB is sometimes implemented on Layer 2 network devices like HP Switches.
MAU-MIB (RFC2668). This MIB is sometimes implemented on Layer 2 network devices like HP Switches.
MAU = Media Access Unit.
The MAU table contains link and duplex info for the port itself and the device
@@ -316,31 +172,6 @@ These are methods that return scalar value from SNMP
These are methods that return tables of information in the form of a reference
to a hash.
=over
=item $mau->mau_i_duplex()
Parses mau_index and mau_link to return the duplex information for
interfaces.
=item $mau->mau_i_duplex_admin()
Parses C<mac_index>,C<mau_autostat>,C<mau_type_admin> in
order to find the admin duplex setting for all the interfaces.
Returns either (auto,full,half).
=item $mau->mau_i_duplex_admin_old()
Called by mau_i_duplex_admin() if C<mau_type_admin> is empty.
Parses C<mau_index>,C<mau_autostat>,C<mau_autosent> in
order to find the admin duplex setting for all the interfaces.
Returns either (auto,none,full,half).
=back
=head2 MAU INTERFACE TABLE ENTRIES
=over
@@ -403,18 +234,10 @@ of the port from a MAU POV.
(B<ifMauTypeList>)
=item $mau->mau_type_admin()
(C<ifMauDefaultType>)
=item $mau->mau_auto() - Returns status of auto-negotiation mode for ports.
(B<ifMauAutoNegAdminStatus>)
=item $mau->mau_autostat()
(C<ifMauAutoNegAdminStatus>)
=item $mau->mau_autosent() - Returns a 32 bit bit-string representing the
capabilities we are broadcasting on that port

View File

@@ -1,8 +1,8 @@
# SNMP::Info::NortelStack
# Eric Miller
# Eric Miller <eric@jeneric.org>
# $Id$
#
# Copyright (c) 2004-6 Eric Miller, Max Baker
# Copyright (c) 2004 Max Baker
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -28,7 +28,7 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::NortelStack;
$VERSION = '1.03';
$VERSION = 0.9;
use strict;
@@ -39,6 +39,12 @@ use SNMP::Info;
@SNMP::Info::NortelStack::EXPORT_OK = qw//;
use vars qw/$VERSION $DEBUG %FUNCS %GLOBALS %MIBS %MUNGE $INIT/;
# Debug
$DEBUG=0;
$SNMP::debugging=$DEBUG;
# Five data structures required by SNMP::Info
$INIT = 0;
%MIBS = (
# S5-ROOT-MIB and S5-TCS-MIB required by the MIBs below
@@ -125,7 +131,7 @@ SNMP::Info::NortelStack - Perl5 Interface to Nortel Stack information using SNMP
=head1 AUTHOR
Eric Miller
Eric Miller (C<eric@jeneric.org>)
=head1 SYNOPSIS
@@ -140,15 +146,15 @@ Eric Miller
)
or die "Can't connect to DestHost.\n";
my $class = $stack->class();
my $class = $stack->class();
print "SNMP::Info determined this device to fall under subclass : $class\n";
=head1 DESCRIPTION
SNMP::Info::NortelStack is a subclass of SNMP::Info that provides an interface
to C<S5-AGENT-MIB> and C<S5-CHASSIS-MIB>. These MIBs are used across the
Nortel Stackable Ethernet Switches (BayStack), as well as, older Nortel devices
such as the Centillion family of ATM switches.
Nortel BayStack family, as well as, older Nortel devices such as the Centillion
family of ATM switches.
Use or create in a subclass of SNMP::Info. Do not use directly.
@@ -168,6 +174,20 @@ None.
=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, Java Device Manager, Software. Download the latest version.
After installation, all mibs are located under the install directory under mibs
and the repspective product line.
Note: Recommend versions (located in JDM\mibs\bps2000\v3100.zip)
S5-AGENT-MIB s5age154.mib
S5-CHASSIS-MIB s5cha135.mib
=head1 GLOBAL METHODS
These are methods that return scalar values from SNMP

View File

@@ -1,7 +1,8 @@
# SNMP::Info::RapidCity
# Eric Miller <eric@jeneric.org>
# $Id$
#
# Copyright (c) 2004-6 Eric Miller, Max Baker
# Copyright (c) 2004 Max Baker
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -27,7 +28,7 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::RapidCity;
$VERSION = '1.03';
$VERSION = 0.9;
use strict;
use Exporter;
@@ -38,6 +39,12 @@ use Carp;
@SNMP::Info::RapidCity::EXPORT_OK = qw//;
use vars qw/$VERSION $DEBUG %FUNCS %GLOBALS %MIBS %MUNGE $INIT/;
# Debug
$DEBUG=0;
$SNMP::debugging=$DEBUG;
# Five data structures required by SNMP::Info
$INIT = 0;
%MIBS = (
'RAPID-CITY' => 'rapidCity',
@@ -63,7 +70,7 @@ use vars qw/$VERSION $DEBUG %FUNCS %GLOBALS %MIBS %MUNGE $INIT/;
'rc_duplex_admin' => 'rcPortAdminDuplex',
'rc_speed_admin' => 'rcPortAdminSpeed',
'rc_auto' => 'rcPortAutoNegotiate',
'rc_alias' => 'rcPortName',
'rc_alias' => 'rcPortName',
# From RAPID-CITY::rc2kCpuEthernetPortTable
'rc_cpu_ifindex' => 'rc2kCpuEthernetPortIfIndex',
'rc_cpu_admin' => 'rc2kCpuEthernetPortAdminStatus',
@@ -187,7 +194,7 @@ sub i_duplex_admin {
next unless defined $duplex;
my $auto = $rc_auto->{$if}||'false';
my $string = 'other';
my $string = 'other';
$string = 'half' if ($duplex =~ /half/i and $auto =~ /false/i);
$string = 'full' if ($duplex =~ /full/i and $auto =~ /false/i);
$string = 'auto' if $auto =~ /true/i;
@@ -250,11 +257,11 @@ __END__
=head1 NAME
SNMP::Info::Layer2::RapidCity - SNMP Interface to the Nortel RapidCity MIB
SNMP::Info::Layer2::RapidCity - SNMP Interface to Nortel Networks' RapidCity MIB
=head1 AUTHOR
Eric Miller
Eric Miller (C<eric@jeneric.org>)
=head1 SYNOPSIS
@@ -275,9 +282,8 @@ Eric Miller
=head1 DESCRIPTION
SNMP::Info::RapidCity is a subclass of SNMP::Info that provides an interface
to the C<RAPID-CITY> MIB. This MIB is used across the Nortel Ethernet Routing
Switch and Ethernet Switch product lines (Formerly known as Passport,
BayStack, and Acclear).
to the C<RAPID-CITY> MIB. This MIB is used across the Nortel Networks' Passport
LAN, as well as, the BayStack and Acclear families.
Use or create in a subclass of SNMP::Info. Do not use directly.
@@ -293,6 +299,19 @@ None.
=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, Java Device Manager, Software. Download the latest version.
After installation, all mibs are located under the install directory under mibs
and the repspective product line.
Note: Required version of RAPID-CITY, rapid_city.mib, must be from the Passport
8600 version 3.3 or higher (located in JDM\mibs\passport8k\).
=head1 GLOBAL METHODS
These are methods that return scalar values from SNMP

View File

@@ -1,8 +1,8 @@
# SNMP::Info::SONMP
# Eric Miller
# Eric Miller <eric@jeneric.org>
# $Id$
#
# Copyright (c) 2004 Eric Miller, Max Baker
# Copyright (c) 2004 Max Baker
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -28,7 +28,7 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::SONMP;
$VERSION = '1.03';
$VERSION = 0.9;
use strict;
@@ -40,6 +40,12 @@ use Carp;
@SNMP::Info::SONMP::EXPORT_OK = qw//;
use vars qw/$VERSION $DEBUG %FUNCS %GLOBALS %MIBS %MUNGE $INIT/;
# Debug
$DEBUG=0;
$SNMP::debugging=$DEBUG;
# Five data structures required by SNMP::Info
$INIT = 0;
%MIBS = (
'SYNOPTICS-ROOT-MIB' => 'synoptics',
@@ -223,7 +229,7 @@ sub c_port {
else {
# Segment id is (256 * remote slot_num) + (remote_port)
my $remote_port = $seg % 256;
my $remote_slot = int($seg / 256);
my $remote_slot = int($seg / 256);
$c_port{"$index.1"} = "$remote_slot.$remote_port";
}
@@ -282,10 +288,8 @@ sub mac {
my $port = $sonmp_topo_port->{$entry};
next unless $port == 0;
my $mac = $sonmp_topo_mac->{$entry};
return $mac;
return $mac;
}
# Topology turned off, not supported.
return undef;
}
1;
@@ -297,7 +301,8 @@ SNMP::Info::SONMP - Perl5 Interface to SynOptics Network Management Protocol (SO
=head1 AUTHOR
Eric Miller
Max Baker (C<max@warped.org>),
Eric Miller (C<eric@jeneric.org>)
=head1 SYNOPSIS

View File

@@ -1,13 +1,9 @@
ChangeLog
COPYRIGHT
ChangeLog
DeviceMatrix.txt
Info.pm
Info/Airespace.pm
Info/Bridge.pm
Info/CDP.pm
Info/CiscoImage.pm
Info/CiscoQOS.pm
Info/CiscoRTT.pm
Info/CiscoStack.pm
Info/CiscoStats.pm
Info/CiscoVTP.pm
@@ -18,20 +14,16 @@ Info/Layer1.pm
Info/Layer1/Allied.pm
Info/Layer1/Asante.pm
Info/Layer1/Bayhub.pm
Info/Layer1/S3000.pm
Info/Layer2.pm
Info/Layer2/Aironet.pm
Info/Layer2/Allied.pm
Info/Layer2/Aruba.pm
Info/Layer2/Bay.pm
Info/Layer2/Baystack.pm
Info/Layer2/C1900.pm
Info/Layer2/C2900.pm
Info/Layer2/Catalyst.pm
Info/Layer2/Centillion.pm
Info/Layer2/Foundry.pm
Info/Layer2/HP.pm
Info/Layer2/N2270.pm
Info/Layer2/NAP222x.pm
Info/Layer2/Orinoco.pm
Info/Layer2/ZyXEL_DSLAM.pm
@@ -40,22 +32,21 @@ Info/Layer3/Aironet.pm
Info/Layer3/AlteonAD.pm
Info/Layer3/BayRS.pm
Info/Layer3/C3550.pm
Info/Layer3/C4000.pm
Info/Layer3/C6500.pm
Info/Layer3/Cisco.pm
Info/Layer3/Contivity.pm
Info/Layer3/Extreme.pm
Info/Layer3/Foundry.pm
Info/Layer3/Juniper.pm
Info/Layer3/N1600.pm
Info/Layer3/Passport.pm
Info/MAU.pm
Info/NortelStack.pm
Info/RapidCity.pm
Info/SONMP.pm
MANIFEST
Makefile.PL
MANIFEST This list of files
README
t/DeviceMatrix.html
t/DeviceMatrix.png
t/lucon.ttf
t/make_dev_matrix.pl
t/prereq.t
t/test_class.pl

290
README
View File

@@ -5,15 +5,12 @@ NAME
VERSION
SNMP::Info - Version 1.01
SNMP::Info - Version 0.9
AUTHOR
SNMP::Info was created at UCSC for the netdisco project
(www.netdisco.org) and was orginally written by Max Baker.
Currently being maintained by team of Open Source authors headed by Eric
Miller and Bill Fenner.
(www.netdisco.org) and is written and maintained by Max Baker.
SYNOPSIS
@@ -51,22 +48,16 @@ SYNOPSIS
# Print out physical port name, not snmp iid
my $port = $interfaces->{$iid};
print "$port: ";
print "$duplex duplex" if defined $duplex;
# The CDP Table has table entries different than the interface tables.
# So we use c_if to get the map from cdp table to interface table.
my %c_map = reverse %$c_if;
my $c_key = $c_map{$iid};
unless (defined $c_key) {
print "\n\n";
next;
}
my $neighbor_ip = $c_ip->{$c_key};
my $neighbor_port = $c_port->{$c_key};
print " connected to $neighbor_ip / $neighbor_port\n" if defined $neighbor_ip;
print "$port: $duplex duplex";
print " connected to $neighbor_ip / $neighbor_port\n" if defined $remote_ip;
print "\n";
}
@@ -145,6 +136,46 @@ REQUIREMENTS
Make sure that your snmp.conf is updated to point to your MIB
directory and that the MIBs are world-readable.
To do it by hand:
Then run "snmpconf" and setup that directory as default. Move
snmp.conf into /usr/local/share/snmp when you are done.
Basic MIBs
A minimum amount of MIBs to have are the Version 2 MIBs from
Cisco, found at
ftp://ftp.cisco.com/pub/mibs/v2/v2.tar.gz
To install them :
mkdir -p /usr/local/share/snmp/mibs && cd /usr/local/share/snmp/mibs && tar xvfz /path/to/v2.tar.gz
Version 1 MIBs
You will also need to install some of the version one MIBs from
Cisco :
ftp://ftp.cisco.com/pub/mibs/v1/v1.tar.gz
Extract
BRIDGE-MIB
SNMP-REPEATER-MIB
STAND-ALONE-ETHERNET-SWITCH-MIB (ESSWITCH-MIB)
TOKEN-RING-RMON-MIB
by running
mkdir -p /usr/local/share/snmp/mibs
cd /usr/local/share/snmp/mibs
tar xvfz /path/to/v1.tar.gz BRIDGE-MIB.my SNMP-REPEATER-MIB.my ESSWITCH-MIB.my TOKEN-RING-RMON-MIB.my
More Specific MIBs
Some non-cisco subclasses will need MIBs other than the basic
one available from Cisco.
Check below under each subclass for requirements.
DESIGN GOALS
1. Use of textual MIB leaf identifier and enumerated values
@@ -187,29 +218,13 @@ SUBCLASSES
For more info run "perldoc" on any of the following module names.
SNMP::Info::Airespace
AIRESPACE-WIRELESS-MIB and AIRESPACE-SWITCHING-MIB. Inherited by
devices based on the Airespace wireless platform.
SNMP::Info::Bridge
BRIDGE-MIB (RFC1286). QBRIDGE-MIB. Inherited by devices with Layer2
support.
SNMP::Info::CDP
CISCO-CDP-MIB. Cisco Discovery Protocol (CDP) Support. Inherited by
Cisco and HP devices.
SNMP::Info::CiscoImage
CISCO-IMAGE-MIB. A collection of OIDs providing IOS image
characteristics.
SNMP::Info::CiscoQOS
CISCO-CLASS-BASED-QOS-MIB. A collection of OIDs providing
information about a Cisco device's QOS config.
SNMP::Info::CiscoRTT
CISCO-RTTMON-MIB. A collection of OIDs providing information about a
Cisco device's RTT values.
devices serving Layer2 or Layer3.
SNMP::Info::CiscoStack
CISCO-STACK-MIB and CISCO-PORT-SECURITY-MIB
@@ -241,13 +256,13 @@ SUBCLASSES
S5-AGENT-MIB, S5-CHASSIS-MIB.
SNMP::Info::RapidCity
RAPID-CITY. Inhertited by Nortel switches for duplex and VLAN
information.
RAPID-CITY. Inhertited by Nortel Networks switches for duplex and
VLAN information.
SNMP::Info::SONMP
SYNOPTICS-ROOT-MIB, S5-ETH-MULTISEG-TOPOLOGY-MIB. Provides
translation from Nortel Topology Table information to CDP. Inherited
by Nortel/Bay/Synoptics switches and hubs.
translation from Nortel Networks Topology Table information to CDP.
Inherited by Nortel/Bay switches and hubs.
Device Subclasses
@@ -265,18 +280,20 @@ SUBCLASSES
Requires ATI-MIB
See SNMP::Info::Layer1::Allied for where to get MIBs required.
SNMP::Info::Layer1::Asante
Subclass for Asante 1012 Hubs.
Requires ASANTE-HUB1012-MIB
See SNMP::Info::Layer1::Asante for where to get MIBs required.
SNMP::Info::Layer1::Bayhub
Subclass for Nortel/Bay hubs. This includes System 5000, 100
series, 200 series, and probably more.
SNMP::Info::Layer1::S3000
Subclass for Bay/Synoptics hubs. This includes System 3000,
281X, and probably more.
See SNMP::Info::Layer1::Bayhub for where to get MIBs required.
SNMP::Info::Layer2
Generic Layer2 Device subclass.
@@ -288,16 +305,15 @@ SUBCLASSES
SNMP::Info::Layer2::Allied
Allied Telesys switches.
SNMP::Info::Layer2::Aruba
Subclass for Aruba wireless switches.
SNMP::Info::Layer2::Bay
Depreciated. Use BayStack.
Depricated. Use BayStack.
SNMP::Info::Layer2::Baystack
Subclass for Nortel/Bay Ethernet Switch/Baystack switches. This
includes 303, 304, 350, 380, 410, 420, 425, 450, 460, 470, 5510,
5520, 5530, Business Policy Switch (BPS) and probably others.
Subclass for Nortel/Bay Baystack switches. This includes 303,
304, 350, 380, 410, 420, 425, 450, 460, 470, 5510, 5520,
Business Policy Switch (BPS) and probably others.
See SNMP::Info::Layer2::Baystack for where to get MIBs required.
SNMP::Info::Layer2::C1900
Subclass for Cisco Catalyst 1900 and 1900c Devices running
@@ -316,8 +332,8 @@ SUBCLASSES
SNMP::Info::Layer2::Centillion
Subclass for Nortel/Bay Centillion and 5000BH ATM switches.
SNMP::Info::Layer2::Foundry
Subclass for Foundry Switches. Tested on EdgeIron 24G.
See SNMP::Info::Layer2::Centillion for where to get MIBs
required.
SNMP::Info::Layer2::HP
Subclass for HP Procurve Switches
@@ -326,14 +342,14 @@ SUBCLASSES
See SNMP::Info::Layer2::HP for more info.
SNMP::Info::Layer2::N2270
Subclass for Nortel 2270 wireless switches.
SNMP::Info::Layer2::NAP222x
Subclass for Nortel 222x series wireless access points.
Subclass for Nortel Networks' 222x series wireless access
points.
See SNMP::Info::Layer2::NAP222x for where to get MIBs required.
SNMP::Info::Layer2::Orinoco
Subclass for Orinoco/Proxim wireless access points.
Subclass for Orinoco wireless access points.
SNMP::Info::Layer2::ZyXEL_DSLAM
Zyxel DSLAMs. Need I say more?
@@ -351,19 +367,21 @@ SUBCLASSES
Note Layer2::Aironet
SNMP::Info::Layer3::AlteonAD
Subclass for Nortel Alteon Ace Director series L2-7 switches.
Subclass for Nortel Networks' Alteon Ace Director series L2-7
switches.
See SNMP::Info::Layer3::AlteonAD for where to get MIBs required.
SNMP::Info::Layer3::BayRS
Subclass for Nortel Multiprotocol/BayRS routers. This includes
BCN, BLN, ASN, ARN, AN, 2430, and 5430 routers.
Subclass for Nortel Networks' BayRS routers. This includes BCN,
BLN, ASN, ARN, and AN routers.
See SNMP::Info::Layer3::BayRS for where to get MIBs required.
SNMP::Info::Layer3::C3550
Subclass for Cisco Catalyst 3550,3540,3560 2/3 switches running
IOS.
SNMP::Info::Layer3::C4000
This class covers Catalyst 4000s and 4500s.
SNMP::Info::Layer3::C6500
This class covers Catalyst 6500s in native mode, hybrid mode.
Catalyst 4000's, 3750's, 2970's and probably others.
@@ -373,12 +391,10 @@ SUBCLASSES
on CiscoVTP.
SNMP::Info::Layer3::Contivity
Subclass for Nortel Contivity/VPN Routers.
Subclass for Nortel Networks' Contivity VPN concentrators.
SNMP::Info::Layer3::Extreme
Subclass for Extreme Networks switches.
See SNMP::Info::Layer3::Extreme for more info.
See SNMP::Info::Layer3::Contivity for where to get MIBs
required.
SNMP::Info::Layer3::Foundry
Subclass for older Foundry Network devices. Outdated, but being
@@ -388,22 +404,16 @@ SUBCLASSES
See SNMP::Info::Layer3::Foundry for more info.
SNMP::Info::Layer3::Juniper
Subclass for Juniper devices.
SNMP::Info::Layer3::N1600
Subclass for Nortel Ethernet Routing Switch 1600 series.
SNMP::Info::Layer3::Passport
Subclass for Nortel Ethernet Routing Switch/Passport 8000 series
and Accelar series switches.
Subclass for Nortel Networks' Passport 8600 series switches.
See SNMP::Info::Layer3::Passport for where to get MIBs required.
Thanks
Thanks for testing and coding help (in no particular order) to : Andy
Ford, Brian Wilson, Jean-Philippe Luiggi, D<>na Watanabe, Bradley Baetz,
Mike Hunter, Justin Hunter, Brian Chow and people listed on the Netdisco
README!
Eric Miller, and people listed on the Netdisco README!
USAGE
@@ -414,9 +424,7 @@ USAGE
my $info = new SNMP::Info( 'Debug' => 1,
'AutoSpecify' => 1,
'BigInt' => 1,
'BulkWalk' => 1,
'BulkRepeaters'=> 20,
'BigInt' => 1
'DestHost' => 'myrouter',
'Community' => 'public',
'Version' => 2,
@@ -425,67 +433,23 @@ USAGE
SNMP::Info Specific Arguments :
AutoSpecify
Returns an object of a more specific device class
AutoSpecify = Returns an object of a more specific device class
*See specify() entry*
BigInt = Return Math::BigInt objects for 64 bit counters. Sets on a global scope, not object.
Debug = Prints Lots of debugging messages
MibDirs = Array ref to list of directories in which to look for MIBs. Note this will
be in addition to the ones setup in snmp.conf at the system level.
RetryNoSuch = When using SNMP Version 1, try reading values even if they come back
as "no such variable in this MIB". Defaults to true, set to false if
so desired. This feature lets you read SNMPv2 data from an SNMP version
1 connection, and should probably be left on.
Session = SNMP::Session object to use instead of connecting on own.
(default on)
All other arguments are passed to SNMP::Session.
BigInt
Return Math::BigInt objects for 64 bit counters. Sets on a
global scope, not object.
See SNMP::Session for a list of other possible arguments.
(default off)
BulkWalk
Set to 0 to turn off BULKWALK commands for SNMPv2 connections.
Note that BULKWALK is turned off for Net-SNMP versions 5.1.x
because of a bug.
(default on)
BulkRepeaters
Set number of MaxRepeaters for BULKWALK operation. See "perldoc
SNMP" -> bulkwalk() for more info.
(default 20)
Debug
Prints Lots of debugging messages
(default off)
DebugSNMP
Set $SNMP::debugging level for Net-SNMP.
See SNMP for more details.
MibDirs
Array ref to list of directories in which to look for MIBs. Note
this will be in addition to the ones setup in snmp.conf at the
system level.
(default use net-snmp settings only)
RetryNoSuch
When using SNMP Version 1, try reading values even if they come
back as "no such variable in this MIB". Set to false if so
desired. This feature lets you read SNMPv2 data from an SNMP
version 1 connection, and should probably be left on.
(default true)
Session
SNMP::Session object to use instead of connecting on own.
(default creates session automatically)
OTHER
All other arguments are passed to SNMP::Session.
See SNMP::Session for a list of other possible arguments.
A Note about the wrong Community string or wrong SNMP Version:
A Note about the wrong Community string or wrong SNMP Version :
If a connection is using the wrong community string or the wrong
SNMP version, the creation of the object will not fail. The device
@@ -527,11 +491,6 @@ USAGE
Returns current debug status, and optionally toggles debugging info
for this object.
$info->bulkwalk([1|0])
Returns if bulkwalk is currently turned on for this object.
Optionally sets the bulkwalk parameter.
$info->device_type()
Returns the Subclass name for this device. "SNMP::Info" is returned
if no more specific class is available.
@@ -551,41 +510,31 @@ USAGE
Aironet (BR500,AP340,350,1200) -> SNMP::Info::Layer3::Aironet
AP4800... All Non IOS
Catalyst 3550,3548,3560 -> SNMP::Info::Layer3::C3550
Catalyst 4000,4500 -> SNMP::Info::Layer3::C4000
Catalyst 6500, 3750 -> SNMP::Info::Layer3::C6500
Catalyst 6500, 4000, 3750 -> SNMP::Info::Layer3::C6500
Cisco Generic L3 IOS device -> SNMP::Info::Layer3::Cisco
Extreme -> SNMP::Info::Layer3::Extreme
Foundry -> SNMP::Info::Layer3::Foundry
Juniper -> SNMP::Info::Layer3::Juniper
Nortel Passport/Accelar LAN -> SNMP::Info::Layer3::Passport
Nortel/Bay Baystack -> SNMP::Info::Layer2::Baystack
Nortel Passport LAN -> SNMP::Info::Layer3::Passport
Alteon Ace Director -> SNMP::Info::Layer3::AlteonAD
Nortel Contivity -> SNMP::Info::Layer3::Contivity
Nortel BayRS Router -> SNMP::Info::Layer3::BayRS
Elsif Layer2 (no Layer3) -> SNMP::Info::Layer2
Elsif Layer2 (no Layer3) -> SNMP::Info::Layer2
Aironet - IOS Devices -> SNMP::Info::Layer2::Aironet
Catalyst 1900 -> SNMP::Info::Layer2::C1900
Catalyst 2900XL,2950,3500XL -> SNMP::Info::Layer2::C2900
Catalyst 2970 -> SNMP::Info::Layer3::C6500
Catalyst 3550/3548 -> SNMP::Info::Layer3::C3550
Catalyst WS-C 2926,5xxx -> SNMP::Info::Layer2::Catalyst
Extreme -> SNMP::Info::Layer3::Extreme
Foundry (EdgeIron,????) -> SNMP::Info::Layer2::Foundry
HP Procurve -> SNMP::Info::Layer2::HP
Nortel/Bay Centillion ATM -> SNMP::Info::Layer2::Centillion
Nortel/Bay Baystack -> SNMP::Info::Layer2::Baystack
Nortel Passport/Accelar 8100 -> SNMP::Info::Layer3::Passport
Nortel AP 222x -> SNMP::Info::Layer2::NAP222x
Orinco AP -> SNMP::Info::Layer2::Orinoco
Nortel 2270 WSS -> SNMP::Info::Layer2::N2270
Elsif Layer1 Support -> SNMP::Info::Layer1
Allied -> SNMP::Info::Layer1::Allied
Asante -> SNMP::Info::Layer1::Asante
Nortel/Bay Hub -> SNMP::Info::Layer1::Bayhub
Bay/Synoptics Hub -> SNMP::Info::Layer1::S3000
Else -> SNMP::Info
ZyXEL_DSLAM -> SNMP::Info::Layer2::ZyXEL_DSLAM
Aruba wireless -> SNMP::Info::Layer2::Aruba
$info->error(no_clear)
Returns Error message if there is an error, or undef if there is
@@ -667,13 +616,6 @@ USAGE
(ifNumber)
$info->ipforwarding()
The indication of whether the entity is acting as an IP gateway
Returns either forwarding or not-forwarding
(ipForwarding)
Table Methods
Each of these methods returns a hash_reference to a hash keyed on the
@@ -742,14 +684,7 @@ USAGE
Speed of the link, human format. See munge_speed() later in document
for details.
(ifSpeed, ifHighSpeed if necessary)
$info->i_speed_high()
Speed of a high-speed link, human format. See munge_highspeed()
later in document for details. You should not need to call this
directly, as i_speed() will call it if it needs to.
(ifHighSpeed)
(ifSpeed)
$info->i_mac()
MAC address of the interface. Note this is just the MAC of the port,
@@ -771,7 +706,7 @@ USAGE
$info->i_lastchange()
The value of sysUpTime when this port last changed states (up,down).
(ifLastChange)
(IfLastChange)
$info->i_name()
Interface Name field. Supported by a smaller subset of devices, this
@@ -1198,10 +1133,6 @@ SNMP::INFO INTERNALS
Default 1. Set to false to disable RetryNoSuch option for
SNMP::Session. Or see method in new() to do it on an object scope.
$REPEATERS
Default 20. MaxRepeaters for BULKWALK operations. See "perldoc SNMP"
for more info. Can change by passing BulkRepeaters option in new()
Data Munging Callback Subroutines
munge_speed()
@@ -1210,7 +1141,6 @@ SNMP::INFO INTERNALS
%SPEED_MAP = (
'56000' => '56 kbps',
'64000' => '64 kbps',
'115000' => '115 kpbs',
'1500000' => '1.5 Mbps',
'1536000' => 'T1',
'1544000' => 'T1',
@@ -1229,8 +1159,6 @@ SNMP::INFO INTERNALS
'45000000' => '45 Mbps',
'45045000' => 'DS3',
'46359642' => 'DS3',
'51850000' => 'OC-1',
'54000000' => '54 Mbps',
'64000000' => '64 Mbps',
'100000000' => '100 Mbps',
'149760000' => 'ATM on OC-3',
@@ -1244,9 +1172,6 @@ SNMP::INFO INTERNALS
'1000000000' => '1.0 Gbps',
)
munge_highspeed()
Makes human friendly speed ratings for ifHighSpeed
munge_ip()
Takes a binary IP and makes it dotted ASCII
@@ -1267,14 +1192,6 @@ SNMP::INFO INTERNALS
If $BIGINT is set to true, then a Math::BigInt object is returned.
See Math::BigInt for details.
munge_i_up
There is a collision between data in IF-MIB and RFC-1213. For
devices that fully implement IF-MIB it might return 7 for a port
that is down. This munges the data against the IF-MIB by hand.
TODO: Get the precidence of MIBs and overriding of MIB data in
Net-SNMP figured out. Heirarchy/precendence of MIBS in SNMP::Info.
Internaly Used Functions
$info->init()
@@ -1362,9 +1279,6 @@ SNMP::INFO INTERNALS
The first time ran, it will call $info->load_METHOD(). Every time
after it will return cached data.
$info->snmp_connect_ip()
Returns true or false based upon snmp connectivity to an IP.
AUTOLOAD
Each entry in either %FUNCS or %GLOBALS is used by AUTOLOAD() to create

View File

@@ -280,7 +280,6 @@ be assumed working.
<LI><tt>no</tt> - Can't recover current or admin setting.
<LI><tt>link</tt> - Can get current setting only.
<LI><tt>both</tt> - Can get admin and link setting.
<LI><tt>write</tt> - Can get admin and link setting and perform sets.
</UL>
</TD>
</TR>
@@ -305,16 +304,6 @@ be assumed working.
<TD>Ver</TD>
<TD>SNMP Protocol Version the device has to use.</TD>
</TR>
<TR>
<TD>Vlan</TD>
<TD>Ability to get VLAN port assignments.<BR>
<UL>
<LI><TT>no</TT> - Have not found an SNMP method to get data yet.
<LI><TT>yes</TT> - Can read information.
<LI><TT>write</TT> - Can read and write (set).
</UL>
</TD>
</TR>
</TABLE>
</BODY>
</HTML>

View File

@@ -4,7 +4,7 @@
#
# Test a device class in SNMP::Info against a device.
#
# Max Baker
# Max Baker <max@warped.org>
#
# $Id$
#
@@ -13,7 +13,7 @@ use lib '/usr/local/netdisco';
use SNMP::Info;
use Getopt::Long;
use strict;
use vars qw/$Class $Dev $Comm $Ver @Dump %Dumped/;
use vars qw/$Class $Dev $Comm $Ver @Dump/;
# Default Values
$Class = '';
@@ -51,7 +51,6 @@ my $dev = new $Class( 'AutoSpecify' => 0,
) or die "\n";
print "Connected to $Dev.\n";
print "It's a ", $dev->device_type(), ".\n";
my $layers = $dev->layers();
@@ -84,10 +83,6 @@ foreach my $fn (@misc){
test_fn($dev,$fn);
}
foreach my $fn (@Dump) {
test_fn($dev,$fn) unless $Dumped{$fn};
}
#--------------------------------
sub test_global {
my $dev = shift;
@@ -142,7 +137,6 @@ sub test_fn {
printf "%-20s %d rows.\n",$method, scalar(keys %$results);
if (grep(/^$method$/,@Dump)) {
$Dumped{$method} = 1;
foreach my $iid (keys %$results){
print " $iid : $results->{$iid}\n";
}