Compare commits
37 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
440bb002b6 | ||
|
|
6dd3f4b21a | ||
|
|
1278117b05 | ||
|
|
5c6c75b42e | ||
|
|
d78e5d6656 | ||
|
|
094c2d548d | ||
|
|
4913ac6cdd | ||
|
|
ac9efcf8ba | ||
|
|
6b4444d97a | ||
|
|
607d5f04bd | ||
|
|
b46aa416a0 | ||
|
|
800aa0b4f0 | ||
|
|
a0e0be2d68 | ||
|
|
3fa47dc2e6 | ||
|
|
25141d3c8e | ||
|
|
1f02aeaec4 | ||
|
|
5d4aada8f5 | ||
|
|
3bd7f78277 | ||
|
|
3994706465 | ||
|
|
12bf18ac02 | ||
|
|
5c6a8f3c45 | ||
|
|
ddddb703aa | ||
|
|
5ef4c78f8a | ||
|
|
05a7f104a4 | ||
|
|
da1183b4fa | ||
|
|
a51ad7ee88 | ||
|
|
df3e0e3b3a | ||
|
|
c156584417 | ||
|
|
74e649a033 | ||
|
|
342a45a424 | ||
|
|
7076c236ea | ||
|
|
0d90383ea3 | ||
|
|
fe59f88dd3 | ||
|
|
2f4704b18d | ||
|
|
c8c94bbd8b | ||
|
|
054e27e827 | ||
|
|
766f14d2bf |
@@ -1,3 +1,8 @@
|
||||
All code from version 0.7 on
|
||||
Copyright (c) 2003,2004 Max Baker
|
||||
All rights reserved.
|
||||
|
||||
Original Code
|
||||
Copyright (c) 2002,2003 Regents of the University of California
|
||||
All rights reserved.
|
||||
|
||||
|
||||
21
ChangeLog
21
ChangeLog
@@ -1,7 +1,24 @@
|
||||
SNMP::Info - Perl5 OO Interface to Network Devices and SNMP MIBs
|
||||
SNMP::Info - Friendly OO-style interface to Network devices using SNMP.
|
||||
ChangeLog $Id$
|
||||
|
||||
version 0.7 ()
|
||||
version 0.8 (03/21/04)
|
||||
+ Added Q-BRIDGE-MIB support to SNMP::Info::Bridge
|
||||
+ Added Aironet AP4800 to Layer3::Aironet class
|
||||
+ Added C3500XL devices to the Layer2::C2900 class
|
||||
+ Added Cisco 3750 (37xxstack) to Layer3::C6500 class
|
||||
+ Added Cisco Catalyst 4000 to Layer3::C6500 class
|
||||
+ Added Cisco Catalyst 2970 to Layer3::C6500 Class
|
||||
* Made Cisco Commuinty string indexing a boolean method for clarification
|
||||
* Added VLAN info for HP devices using Q-BRIDGE-MIB
|
||||
* Fixed warning about uninitialized value in CiscoStats line 92
|
||||
* Added for more serial# checking for L2 and L3
|
||||
* Fixed warning in Layer2::Bay about non numeric port line 199
|
||||
Contributions from Dmitry Sergienko:
|
||||
+ Added Cisco Aironet BR500 and AP1200 to L2::Aironet Class
|
||||
* Fixed the Port name alias for Catalyst 2900 devices
|
||||
+ Added Support For ZiLEX DSLAMs and Allied Telesys Switches
|
||||
|
||||
version 0.7 (08/14/03)
|
||||
* Added Class for Catalyst 6500 Series - Layer3::C6500
|
||||
* Added CiscoVTP support to 3550,2900, and Catalyst classes
|
||||
* Extracted VLAN stuff from Layer2::Catalyst to SNMP::Info::CiscoVTP
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# SNMP Device Compatibility Matrix
|
||||
# SNMP::Info - Max Baker
|
||||
# SNMP::Info - (C) 2004 Max Baker
|
||||
|
||||
# This file is meant to detail the cababilities
|
||||
# of network devices to supply data via SNMP.
|
||||
@@ -8,8 +8,9 @@
|
||||
|
||||
# Allied
|
||||
device-vendor: Allied Telesyn
|
||||
cdp:no
|
||||
|
||||
device-family: Hubs
|
||||
device-family: Allied Hubs
|
||||
class: Layer1::Allied
|
||||
ver: 1
|
||||
arpnip: no
|
||||
@@ -18,10 +19,15 @@ duplex: no
|
||||
|
||||
device: AT-3624T
|
||||
|
||||
device-family: AT-8000 Switches
|
||||
class: Layer2::Allied
|
||||
ver: 2
|
||||
macsuck: yes
|
||||
|
||||
# Asante
|
||||
device-vendor: Asante
|
||||
|
||||
device-family: Hubs
|
||||
device-family: Asante Hubs
|
||||
class: Layer1::Asante
|
||||
ver: 1
|
||||
arpnip: no
|
||||
@@ -55,14 +61,14 @@ device-family: Aironet
|
||||
note: IOS and Aironet OS versions
|
||||
class: Layer3::Aironet
|
||||
|
||||
device: AIRAP1100
|
||||
device: AIRAP1100, AP1200, C1100
|
||||
note: IOS based device
|
||||
class: Layer2::Aironet
|
||||
|
||||
device: AP1200
|
||||
device: BR500
|
||||
note: Aironet based device
|
||||
|
||||
device: AP350, AP340
|
||||
device: AP350, AP340, CAP350, CAP340, 1200, AP4800
|
||||
note: Aironet based device
|
||||
|
||||
device-family: 1000
|
||||
@@ -103,20 +109,14 @@ arpnip: yes
|
||||
macsuck: yes
|
||||
class: Layer3
|
||||
|
||||
device:2610
|
||||
|
||||
device:2611
|
||||
|
||||
device:2620
|
||||
|
||||
device:2620XM
|
||||
|
||||
device:2621
|
||||
device:2610,2610XM,2611,2620,2620XM,2621
|
||||
|
||||
device:2621XM
|
||||
|
||||
device:2651XM
|
||||
|
||||
device:2691
|
||||
|
||||
device-family: 3600
|
||||
class: Layer3
|
||||
|
||||
@@ -172,17 +172,33 @@ device: 2924CXL
|
||||
|
||||
device: 2924CXLv
|
||||
|
||||
device-family: Catlayst 2940
|
||||
|
||||
device: 2940-8TT
|
||||
|
||||
device-family: Catalyst 2950
|
||||
|
||||
device: 2950-t24
|
||||
|
||||
device-family: Catalyst 2970
|
||||
macsuck:vlan
|
||||
note: Acts just like IOS Catalyst 6500 series
|
||||
class: Layer3::C6500
|
||||
|
||||
device: 2970G-24T-E
|
||||
|
||||
device-family: Catalyst 3500 XL
|
||||
portmac: yes
|
||||
note: L2 only IOS devices
|
||||
class: Layer2
|
||||
macsuck: vlan
|
||||
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
|
||||
|
||||
device: 3508GXL
|
||||
|
||||
device: 3524XL
|
||||
|
||||
device: 3548XL
|
||||
macsuck: no
|
||||
|
||||
device-family: Catalyst 3550
|
||||
macsuck: vlan
|
||||
@@ -200,14 +216,15 @@ note: L2/L3 Switch
|
||||
arpnip: yes
|
||||
|
||||
device: 3550-24, 3550-48
|
||||
note: L2 only switch
|
||||
macsuck: no
|
||||
note: !BRIDGE-MIB not implemented.
|
||||
macsuck: vlan
|
||||
|
||||
device-family: Catalyst 3750
|
||||
class: Layer3::C6500
|
||||
|
||||
device-family: Catalyst 4000
|
||||
duplex: both
|
||||
macsuck: vlan
|
||||
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.
|
||||
@@ -297,7 +314,7 @@ device-vendor: HP
|
||||
class: Layer2::HP
|
||||
ver: 2
|
||||
|
||||
device-family: ProCurve
|
||||
device-family: HP ProCurve
|
||||
duplex: both
|
||||
macsuck: yes
|
||||
arpnip: no
|
||||
@@ -311,10 +328,18 @@ device: 2524
|
||||
ver: 1
|
||||
|
||||
device: 4000
|
||||
note: duplex issues?
|
||||
|
||||
device: 4104GL
|
||||
duplex: link
|
||||
|
||||
device: 4108GL
|
||||
device: 4108GL,8000,2626,2650,8000
|
||||
note: VLAN info in Q-BRIDGE-MIB
|
||||
|
||||
device: 8000
|
||||
device-vendor: Zyxel
|
||||
class: Layer2::ZyXEL_DSLAM
|
||||
note: Doesn't report sysServices (layers)
|
||||
|
||||
device-family: Zyxel DSLAM
|
||||
|
||||
device:AAM10008-61, AAM1008-63
|
||||
|
||||
176
Info.pm
176
Info.pm
@@ -1,13 +1,15 @@
|
||||
# SNMP::Info - Max Baker <max@warped.org>
|
||||
# SNMP::Info - Max Baker
|
||||
# $Id$
|
||||
#
|
||||
# Portions Copyright (c) 2003,2004 Max Baker
|
||||
# All rights reserved.
|
||||
# Copyright (c) 2002-3, Regents of the University of California
|
||||
# All rights reserved.
|
||||
#
|
||||
# See COPYRIGHT at bottom
|
||||
|
||||
package SNMP::Info;
|
||||
$VERSION = 0.7;
|
||||
$VERSION = 0.8;
|
||||
use strict;
|
||||
|
||||
use Exporter;
|
||||
@@ -27,13 +29,14 @@ SNMP::Info - Object Oriented Perl5 Interface to Network devices and MIBs through
|
||||
|
||||
=head1 VERSION
|
||||
|
||||
SNMP::Info - Version 0.6
|
||||
SNMP::Info - Version 0.8
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Max Baker (C<max@warped.org>)
|
||||
Max Baker
|
||||
|
||||
SNMP::Info was created at UCSC for the netdisco project (www.netdisco.org)
|
||||
and is written and maintained by Max Baker.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
@@ -47,13 +50,13 @@ SNMP::Info was created at UCSC for the netdisco project (www.netdisco.org)
|
||||
DestHost => 'router',
|
||||
Community => 'public',
|
||||
Version => 2
|
||||
) or die "Can't connect to device.\n"
|
||||
) or die "Can't connect to device.\n";
|
||||
|
||||
my $err = $info->error();
|
||||
die "SNMP Community or Version probably wrong connecting to device. $err\n" if defined $err;
|
||||
|
||||
$name = $info->name();
|
||||
$class = $info->class()
|
||||
$class = $info->class();
|
||||
print "SNMP::Info is using this device class : $class\n";
|
||||
|
||||
# Find out the Duplex status for the ports
|
||||
@@ -135,9 +138,7 @@ of the net-snmp distribution.
|
||||
Net-SNMP can be found at http://net-snmp.sourceforge.net
|
||||
|
||||
Version 5.0.2 or greater is recommended. Various version 4's will work, and 5.0.1 is kinda flaky
|
||||
on the Perl side.
|
||||
|
||||
Note: Net-SNMP was previously called ucd-snmp.
|
||||
on the Perl side. 5.1.x isn't tested but should work fine.
|
||||
|
||||
=item 2. MIBS
|
||||
|
||||
@@ -145,7 +146,7 @@ SNMP::Info operates on textual descriptors found in MIBs. MIBs are text database
|
||||
are freely and easily obtainable on the Net.
|
||||
|
||||
Make sure that your snmp.conf is updated to point to your MIB directory
|
||||
and that the MIBs are world-readable.
|
||||
and that the MIBs are world-readable.
|
||||
|
||||
Then run C<snmpconf> and setup that directory as default. Move F<snmp.conf>
|
||||
into F</usr/local/share/snmp> when you are done.
|
||||
@@ -178,13 +179,37 @@ Extract
|
||||
|
||||
=item STAND-ALONE-ETHERNET-SWITCH-MIB (ESSWITCH-MIB)
|
||||
|
||||
=item TOKEN-RING-RMON-MIB
|
||||
|
||||
=back
|
||||
|
||||
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
|
||||
tar xvfz /path/to/v1.tar.gz BRIDGE-MIB.my SNMP-REPEATER-MIB.my ESSWITCH-MIB.my TOKEN-RING-RMON-MIB.my
|
||||
|
||||
=item Fix CISCO-TC-MIB
|
||||
|
||||
There is a problem with the Cisco file F<CISCO-TC.my> which
|
||||
is included from lots of other MIBs. Make the following changes
|
||||
if you run into errors about C<Unsigned32> in this file.
|
||||
|
||||
Edit F</usr/local/share/snmp/mibs/CISCO-TC.my>
|
||||
|
||||
Comment out line 192 that says C<SMI Unsigned32> with two dashes.
|
||||
|
||||
-- SMI Unsigned32
|
||||
|
||||
Add C<Unsigned32> to the imports after line 19:
|
||||
|
||||
IMPORTS
|
||||
MODULE-IDENTITY,
|
||||
Gauge32,
|
||||
Integer32,
|
||||
Counter64,
|
||||
Unsigned32,
|
||||
FROM SNMPv2-SMI
|
||||
|
||||
=item More Specific MIBs
|
||||
|
||||
@@ -226,8 +251,9 @@ Or you can override any existing methods from a parent class by making a short s
|
||||
|
||||
See the section EXTENDING SNMP::INFO for more details.
|
||||
|
||||
When you make a new subclass for a device, please be sure to send it
|
||||
back to the developers at snmp@warped.org for inclusion in the next version.
|
||||
When you make a new subclass for a device, please be sure to send it back to
|
||||
the developers (via Source Forge or the mailing list) for inclusion in the next
|
||||
version.
|
||||
|
||||
=back
|
||||
|
||||
@@ -246,12 +272,16 @@ used directly, but rather inherited from device subclasses.
|
||||
|
||||
=item SNMP::Info::Bridge
|
||||
|
||||
BRIDGE-MIB (RFC1286). Inherited by devices with Layer2 service.
|
||||
BRIDGE-MIB (RFC1286). QBRIDGE-MIB. Inherited by devices with Layer2 support.
|
||||
|
||||
=item SNMP::Info::CDP
|
||||
|
||||
CISCO-CDP-MIB. Cisco Discovery Protocol (CDP) Support. Inherited by devices serving Layer2 or Layer3.
|
||||
|
||||
=item SNMP::Info::CiscoStack
|
||||
|
||||
CISCO-STACK-MIB.
|
||||
|
||||
=item SNMP::Info::CiscoStats
|
||||
|
||||
Provides common interfaces for memory, cpu, and os statistics for Cisco devices. Provides methods for
|
||||
@@ -308,6 +338,15 @@ Generic Layer2 Device subclass.
|
||||
|
||||
=over
|
||||
|
||||
=item SNMP::Info::Layer2::Aironet
|
||||
|
||||
Class for Cisco Aironet wireless devices that run IOS. See also
|
||||
Layer3::Aironet for Aironet devices that don't run IOS.
|
||||
|
||||
=item SNMP::Info::Layer2::Allied
|
||||
|
||||
Allied Telesys switches.
|
||||
|
||||
=item SNMP::Info::Layer2::Bay
|
||||
|
||||
Bay Networks BayStack switch Support. Provides translation from Bay Network Topology Table
|
||||
@@ -323,12 +362,12 @@ Subclass for Cisco Catalyst 1900 and 1900c Devices running CatOS.
|
||||
|
||||
=item SNMP::Info::Layer2::C2900
|
||||
|
||||
Subclass for Cisco Catalyst 2900 devices running IOS.
|
||||
Subclass for Cisco Catalyst 2900, 2950, 3500XL, and 3548 devices running IOS.
|
||||
|
||||
=item SNMP::Info::Layer2::Catalyst
|
||||
|
||||
Subclass for Cisco Catalyst switches running CatOS. These switches usually
|
||||
report a model number that starts with ''wsc''. Note that this class
|
||||
report a model number that starts with C<wsc>. Note that this class
|
||||
does not support everything that has the name Catalyst.
|
||||
|
||||
=item SNMP::Info::Layer2::HP
|
||||
@@ -339,6 +378,10 @@ Requires HP-ICF-OID and ENTITY-MIB downloaded from HP.
|
||||
|
||||
See SNMP::Info::Layer2::HP for more info.
|
||||
|
||||
=item SNMP::Info::Layer2::ZyXEL_DSLAM
|
||||
|
||||
Zyxel DSLAMs. Need I say more?
|
||||
|
||||
=back
|
||||
|
||||
=item SNMP::Info::Layer3
|
||||
@@ -349,15 +392,16 @@ Generic Layer3 and Layer2+3 Device subclass.
|
||||
|
||||
=item SNMP::Info::Layer3::Aironet
|
||||
|
||||
Subclass for Cisco Aironet wireless access points (AP).
|
||||
Subclass for Cisco Aironet wireless access points (AP) not running IOS. These are usually older
|
||||
devices.
|
||||
|
||||
MIBs for these devices now included in v2.tar.gz available from ftp.cisco.com.
|
||||
|
||||
Note Layer2::Aironet
|
||||
|
||||
=item SNMP::Info::Layer3::Foundry
|
||||
|
||||
No longer supported.
|
||||
|
||||
Subclass for older Foundry Network devices.
|
||||
Subclass for older Foundry Network devices. Outdated, but being updated for newer devices.
|
||||
|
||||
Requires FOUNDRY-SN-ROOT-MIB.
|
||||
|
||||
@@ -365,7 +409,12 @@ See SNMP::Info::Layer3::Foundry for more info.
|
||||
|
||||
=item SNMP::Info::Layer3::C3550
|
||||
|
||||
Subclass for Cisco Catalyst 3550 2/3 switches running IOS.
|
||||
Subclass for Cisco Catalyst 3550,354 2/3 switches running IOS.
|
||||
|
||||
=item SNMP::Info::Layer3::C6500
|
||||
|
||||
This class covers Catalyst 6500s in native mode, hybrid mode. Catalyst 4000's, 3750's, 2970's
|
||||
and probably others.
|
||||
|
||||
=back
|
||||
|
||||
@@ -374,7 +423,8 @@ Subclass for Cisco Catalyst 3550 2/3 switches running IOS.
|
||||
=head2 Thanks
|
||||
|
||||
Thanks for testing and coding help (in no particular order) to :
|
||||
Andy Ford, Brian Wilson, Jean-Philippe Luiggi, D<>na Watanabe
|
||||
Andy Ford, Brian Wilson, Jean-Philippe Luiggi, D<>na Watanabe, Bradley Baetz, and
|
||||
people listed on the Netdisco README!
|
||||
|
||||
=head1 USAGE
|
||||
|
||||
@@ -577,15 +627,17 @@ SNMP::Info is returned.
|
||||
Algorithm for Subclass Detection:
|
||||
|
||||
Layer3 Support -> SNMP::Info::Layer3
|
||||
Aironet (non IOS) -> SNMP::Info::Layer3::Aironet
|
||||
Catalyst 3550 -> SNMP::Info::Layer3::C3550
|
||||
Catalyst 6500 -> SNMP::Info::Layer3::C6500
|
||||
Aironet (BR500,AP340,350,1200) -> SNMP::Info::Layer3::Aironet
|
||||
AP4800... All Non IOS
|
||||
Catalyst 3550,3548 -> SNMP::Info::Layer3::C3550
|
||||
Catalyst 6500, 4000, 3750 -> SNMP::Info::Layer3::C6500
|
||||
Foundry -> SNMP::Info::Layer3::Foundry
|
||||
Elsif Layer2 (no Layer3) -> SNMP::Info::Layer2
|
||||
Aironet (Cisco) AP1100 -> SNMP::Info::Layer2::Aironet
|
||||
Aironet - IOS Devices -> SNMP::Info::Layer2::Aironet
|
||||
Bay Networks -> SNMP::Info::Layer2::Bay
|
||||
Catalyst 1900 -> SNMP::Info::Layer2::C1900
|
||||
Catalyst 2900XL/2950(IOS) -> SNMP::Info::Layer2::C2900
|
||||
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
|
||||
HP Procurve -> SNMP::Info::Layer2::HP
|
||||
@@ -593,6 +645,7 @@ Algorithm for Subclass Detection:
|
||||
Allied -> SNMP::Info::Layer1::Allied
|
||||
Asante -> SNMP::Info::Layer1::Asante
|
||||
Else -> SNMP::Info
|
||||
ZyXEL_DSLAM -> SNMP::Info::Layer2::ZyXEL_DSLAM
|
||||
|
||||
=cut
|
||||
sub device_type {
|
||||
@@ -604,7 +657,9 @@ sub device_type {
|
||||
# if we dont have sysServices, we dont have anything else either probably.
|
||||
return undef unless (defined $layers and length($layers));
|
||||
|
||||
my $desc = $info->description();
|
||||
my $desc = $info->description() || 'undef';
|
||||
$desc =~ s/[\r\n\l]+/ /g;
|
||||
$info->debug() and print "SNMP::Info::device_type() layers:$layers sysDescr: \"$desc\".\n";
|
||||
|
||||
# Layer 3 Supported
|
||||
# (usually has layer2 as well, so we check for 3 first)
|
||||
@@ -619,7 +674,15 @@ sub device_type {
|
||||
$objtype = 'SNMP::Info::Layer3::Foundry' if $desc =~ /foundry/i ;
|
||||
# Aironet - older non-IOS
|
||||
$objtype = 'SNMP::Info::Layer3::Aironet' if ($desc =~ /Cisco/ and $desc =~ /\D(CAP340|AP340|CAP350|350|1200)\D/) ;
|
||||
$objtype = 'SNMP::Info::Layer3::C6500' if $desc =~ /c6sup2/;
|
||||
$objtype = 'SNMP::Info::Layer3::Aironet' if ($desc =~ /Aironet/ and $desc =~ /\D(AP4800)\D/) ;
|
||||
$objtype = 'SNMP::Info::Layer3::C6500' if $desc =~ /(c6sup2|c6sup1)/;
|
||||
# Next two untested. Reported working by DA
|
||||
$objtype = 'SNMP::Info::Layer3::C6500' if ($desc =~ /cisco/i and $desc =~ /3750/);
|
||||
$objtype = 'SNMP::Info::Layer3::C6500' if $desc =~ /Catalyst 4000/;
|
||||
$objtype = 'SNMP::Info::Layer3::C6500' if $desc =~ /s72033_rp/;
|
||||
|
||||
# Allied Telesyn Layer2 managed switches. They report they have L3 support
|
||||
$objtype = 'SNMP::Info::Layer2::Allied' if ($desc =~ /Allied.*AT-80\d{2}\S*/i);
|
||||
|
||||
# Layer 2 Supported
|
||||
} elsif ($info->has_layer(2)) {
|
||||
@@ -632,8 +695,8 @@ sub device_type {
|
||||
# Catalyst 1900 series override
|
||||
$objtype = 'SNMP::Info::Layer2::C1900' if ($desc =~ /catalyst/i and $desc =~ /\D19\d{2}/);
|
||||
|
||||
# Catalyst 2900 (IOS) series override
|
||||
$objtype = 'SNMP::Info::Layer2::C2900' if ($desc =~ /(C2900XL|C2950)/ );
|
||||
# Catalyst 2900 and 3500XL (IOS) series override
|
||||
$objtype = 'SNMP::Info::Layer2::C2900' if ($desc =~ /(C2900XL|C2950|C3500XL)/i );
|
||||
|
||||
# Catalyst WS-C series override 2926,4k,5k,6k in Hybrid
|
||||
$objtype = 'SNMP::Info::Layer2::Catalyst' if ($desc =~ /WS-C\d{4}/);
|
||||
@@ -641,6 +704,9 @@ sub device_type {
|
||||
# Catalyst 3550 / 3548 Layer2 only switches
|
||||
$objtype = 'SNMP::Info::Layer3::C3550' if ($desc =~ /C3550/);
|
||||
|
||||
# Cisco 2970
|
||||
$objtype = 'SNMP::Info::Layer3::C6500' if ($desc =~ /C2970/);
|
||||
|
||||
# HP
|
||||
$objtype = 'SNMP::Info::Layer2::HP' if ($desc =~ /HP.*ProCurve/);
|
||||
|
||||
@@ -648,14 +714,21 @@ sub device_type {
|
||||
$objtype = 'SNMP::Info::Layer2::Bay' if ($desc =~ /BayStack/);
|
||||
|
||||
# Aironet - IOS
|
||||
$objtype = 'SNMP::Info::Layer2::Aironet' if ($desc =~ /C1100/);
|
||||
|
||||
$objtype = 'SNMP::Info::Layer2::Aironet' if ($desc =~ /(C1100|AP1200)/);
|
||||
|
||||
# Aironet - non IOS
|
||||
$objtype = 'SNMP::Info::Layer3::Aironet' if ($desc =~ /Cisco/ and $desc =~ /\D(BR500)\D/) ;
|
||||
|
||||
} elsif ($info->has_layer(1)) {
|
||||
$objtype = 'SNMP::Info::Layer1';
|
||||
# Allied crap-o-hub
|
||||
$objtype = 'SNMP::Info::Layer1::Allied' if ($desc =~ /allied/i);
|
||||
$objtype = 'SNMP::Info::Layer1::Asante' if ($desc =~ /asante/i);
|
||||
}
|
||||
|
||||
# These devices don't claim to have Layer1-3 but we like em anyways.
|
||||
} else {
|
||||
$objtype = 'SNMP::Info::Layer2::ZyXEL_DSLAM' if ($desc =~ /8-port .DSL Module\(Annex .\)/i);
|
||||
}
|
||||
|
||||
return $objtype;
|
||||
}
|
||||
@@ -695,7 +768,7 @@ sub has_layer {
|
||||
|
||||
=item $info->snmp_comm()
|
||||
|
||||
Returns SNMP Community string used in conncetion
|
||||
Returns SNMP Community string used in connection.
|
||||
|
||||
=cut
|
||||
sub snmp_comm {
|
||||
@@ -725,7 +798,6 @@ Usually this method is called internally from new(AutoSpecify => 1)
|
||||
|
||||
See device_type() entry for how a subclass is chosen.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
sub specify {
|
||||
@@ -759,6 +831,20 @@ sub specify {
|
||||
return $sub_obj;
|
||||
}
|
||||
|
||||
=item $info->cisco_comm_indexing()
|
||||
|
||||
Returns 0. Is an overridable method used for vlan indexing for
|
||||
snmp calls on certain Cisco devices.
|
||||
|
||||
See L<ftp://ftp.cisco.com/pub/mibs/supportlists/wsc5000/wsc5000-communityIndexing.html>
|
||||
|
||||
=cut
|
||||
sub cisco_comm_indexing{
|
||||
0;
|
||||
}
|
||||
|
||||
=back
|
||||
|
||||
=head2 Globals (Scalar Methods)
|
||||
|
||||
These are methods to return scalar data from RFC1213.
|
||||
@@ -769,7 +855,7 @@ Some subset of these is probably available for any network device that speaks SN
|
||||
|
||||
=item $info->uptime()
|
||||
|
||||
Uptime in hundreths of seconds since device became available.
|
||||
Uptime in hundredths of seconds since device became available.
|
||||
|
||||
(B<sysUpTime>)
|
||||
|
||||
@@ -1181,17 +1267,17 @@ Table Methods. Set iid of method to value.
|
||||
|
||||
Returns undef if failed, or the return value from SNMP::Session::set() (snmp_errno)
|
||||
|
||||
# Disable a port administratvely
|
||||
# Disable a port administratively
|
||||
my %if_map = reverse %{$info->interfaces()}
|
||||
$info->set_i_up_admin('down', $if_map{'FastEthernet0/0')
|
||||
or die "Couldn't disable the port. ",$info->error(1);
|
||||
|
||||
=back
|
||||
|
||||
NOTE: You must be connected to your device with a ReadWrite community string in order
|
||||
NOTE: You must be connected to your device with a C<ReadWrite> community string in order
|
||||
for set operations to work.
|
||||
|
||||
NOTE: This will only set data listed in %FUNCS and %GLOBALS. For data aquired from
|
||||
NOTE: This will only set data listed in %FUNCS and %GLOBALS. For data acquired from
|
||||
overriden methods (subroutines) specific set_METHOD() subroutines will need to be
|
||||
added.
|
||||
|
||||
@@ -1435,7 +1521,7 @@ Let's make a sample Layer 2 Device subclass :
|
||||
1; # don't forget this line
|
||||
----------------------- snip --------------------------------
|
||||
|
||||
Be sure and send the debugged version to snmp@warped.org to be
|
||||
Be sure and send the debugged version to snmp-info-users@lists.sourceforge.net to be
|
||||
included in the next version of SNMP::Info.
|
||||
|
||||
=head1 SNMP::INFO INTERNALS
|
||||
@@ -1505,6 +1591,7 @@ Makes human friendly speed ratings using %SPEED_MAP
|
||||
'11000000' => '11 Mbps',
|
||||
'20000000' => '20 Mbps',
|
||||
'16000000' => '16 Mbps',
|
||||
'44210000' => 'T3',
|
||||
'44736000' => 'T3',
|
||||
'45000000' => '45 Mbps',
|
||||
'45045000' => 'DS3',
|
||||
@@ -1538,6 +1625,7 @@ Makes human friendly speed ratings using %SPEED_MAP
|
||||
'11000000' => '11 Mbps',
|
||||
'20000000' => '20 Mbps',
|
||||
'16000000' => '16 Mbps',
|
||||
'44210000' => 'T3',
|
||||
'44736000' => 'T3',
|
||||
'45000000' => '45 Mbps',
|
||||
'45045000' => 'DS3',
|
||||
@@ -1797,7 +1885,7 @@ sub store {
|
||||
|
||||
=item $info->_global()
|
||||
|
||||
Used internally by AUTOLOAD to load dynmaic methods from %GLOBALS.
|
||||
Used internally by AUTOLOAD to load dynamic methods from %GLOBALS.
|
||||
|
||||
Example: $info->name() calls autoload which calls $info->_global('name').
|
||||
|
||||
@@ -2151,6 +2239,10 @@ sub AUTOLOAD {
|
||||
|
||||
=head1 COPYRIGHT AND LICENCE
|
||||
|
||||
Changes from SNMP::Info Version 0.7 and on are:
|
||||
Copyright (c)2003, 2004 Max Baker - All rights reserved.
|
||||
|
||||
Original Code is:
|
||||
Copyright (c) 2002-3, Regents of the University of California
|
||||
All rights reserved.
|
||||
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
# SNMP::Info::Bridge
|
||||
# Max Baker <max@warped.org>
|
||||
#
|
||||
# Changes since Version 0.7 Copyright (c) 2004 Max Baker
|
||||
# All rights reserved.
|
||||
#
|
||||
# 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 +32,7 @@
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::Bridge;
|
||||
$VERSION = 0.6;
|
||||
$VERSION = 0.8;
|
||||
# $Id$
|
||||
|
||||
use strict;
|
||||
@@ -45,16 +49,21 @@ $SNMP::debugging=$DEBUG;
|
||||
|
||||
$INIT = 0;
|
||||
|
||||
%MIBS = ('BRIDGE-MIB' => 'dot1dBaseBridgeAddress');
|
||||
%MIBS = ('BRIDGE-MIB' => 'dot1dBaseBridgeAddress',
|
||||
'Q-BRIDGE-MIB' => 'dot1qPvid',
|
||||
);
|
||||
|
||||
%GLOBALS = (
|
||||
'b_mac' => 'dot1dBaseBridgeAddress',
|
||||
'b_ports' => 'dot1dBaseNumPorts',
|
||||
'b_type' => 'dot1dBaseType',
|
||||
'b_mac' => 'dot1dBaseBridgeAddress',
|
||||
'b_ports' => 'dot1dBaseNumPorts',
|
||||
'b_type' => 'dot1dBaseType',
|
||||
# Spanning Tree Protocol
|
||||
'stp_ver' => 'dot1dStpProtocolSpecification',
|
||||
'stp_ver' => 'dot1dStpProtocolSpecification',
|
||||
'stp_time' => 'dot1dStpTimeSinceTopologyChange',
|
||||
'stp_root' => 'dot1dStpDesignatedRoot',
|
||||
# Q-BRIDGE-MIB
|
||||
'qb_vlans_max' => 'dot1qMaxSupportedVlans',
|
||||
'qb_vlans' => 'dot1qNumVlans',
|
||||
);
|
||||
|
||||
%FUNCS = (
|
||||
@@ -78,6 +87,11 @@ $INIT = 0;
|
||||
'stp_p_root' => 'dot1dStpPortDesignatedRoot',
|
||||
'stp_p_bridge' => 'dot1dStpPortDesignatedBridge',
|
||||
'stp_p_port' => 'dot1dStpPortDesignatedPort',
|
||||
# Q-BRIDGE-MIB :
|
||||
'qb_i_vlan' => 'dot1qPvid',
|
||||
'qb_i_vlan_type' => 'dot1qPortAcceptableFrameTypes',
|
||||
'qb_v_name' => 'dot1qVlanStaticName',
|
||||
'qb_v_stat' => 'dot1qVlanStaticRowStatus',
|
||||
);
|
||||
|
||||
%MUNGE = (
|
||||
@@ -156,6 +170,9 @@ Max Baker (C<max@warped.org>)
|
||||
|
||||
BRIDGE-MIB is used by most Layer 2 devices, and holds information like the MAC Forwarding Table and Spanning Tree Protocol info.
|
||||
|
||||
Q-BRIDGE-MIB holds 802.11q information -- VLANs and Trunking. Cisco tends not to use this MIB, but some
|
||||
proprietary ones. HP and some nicer vendors use this. This is from C<RFC2674_q>.
|
||||
|
||||
Create or use a subclass of SNMP::Info that inherits this class. Do not use directly.
|
||||
|
||||
For debugging you can call new() directly as you would in SNMP::Info
|
||||
@@ -172,6 +189,10 @@ None.
|
||||
|
||||
=item BRIDGE-MIB
|
||||
|
||||
=item Q-BRIDGE-MIB
|
||||
|
||||
f<rfc2674_q.mib>
|
||||
|
||||
=back
|
||||
|
||||
BRIDGE-MIB needs to be extracted from ftp://ftp.cisco.com/pub/mibs/v1/v1.tar.gz
|
||||
@@ -218,6 +239,16 @@ Returns root of STP.
|
||||
|
||||
(B<dot1dStpDesignatedRoot>)
|
||||
|
||||
=item $bridge->qb_vlans_max()
|
||||
|
||||
(B<dot1qMaxSupportedVlans>)
|
||||
|
||||
=item $bridge->qb_vlans()
|
||||
|
||||
Number of VLANS on this device.
|
||||
|
||||
(B<dot1qNumVlans>)
|
||||
|
||||
=back
|
||||
|
||||
=head1 TABLE METHODS
|
||||
@@ -334,4 +365,35 @@ this port's segment."
|
||||
|
||||
=back
|
||||
|
||||
=head2 Q-BRIDGE Data
|
||||
|
||||
=over
|
||||
|
||||
=item $bridge->qb_i_vlan()
|
||||
|
||||
Gives the vlan used by interfaces
|
||||
|
||||
(B<dot1qPvid>)
|
||||
|
||||
=item $bridge->qb_i_vlan_type()
|
||||
|
||||
Either C<admitAll> or C<admitOnlyVlanTagged>. This is a good spot to find
|
||||
trunk ports.
|
||||
|
||||
(B<dot1qPortAcceptableFrameTypes>)
|
||||
|
||||
=item $bridge->qb_v_name()
|
||||
|
||||
Human-entered name for vlans.
|
||||
|
||||
(B<dot1qVlanStaticName>)
|
||||
|
||||
=item $bridge->qb_v_stat()
|
||||
|
||||
uhh. C<active> !
|
||||
|
||||
(B<dot1qVlanStaticRowStatus>)
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
# SNMP::Info::CDP
|
||||
# Max Baker <max@warped.org>
|
||||
#
|
||||
# Changes since Version 0.7 Copyright (c) 2004 Max Baker
|
||||
# All rights reserved.
|
||||
#
|
||||
# Copyright (c) 2002,2003 Regents of the University of California
|
||||
# All rights reserved.
|
||||
#
|
||||
@@ -28,7 +31,7 @@
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::CDP;
|
||||
$VERSION = 0.6;
|
||||
$VERSION = 0.8;
|
||||
# $Id$
|
||||
|
||||
use strict;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
# SNMP::Info::CiscoStack
|
||||
# Max Baker <max@warped.org>
|
||||
#
|
||||
# Copyright (c) 2003 Max Baker
|
||||
# All rights reserved.
|
||||
#
|
||||
# Copyright (c)2003,2004 Max Baker
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
@@ -28,7 +28,7 @@
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::CiscoStack;
|
||||
$VERSION = 0.7;
|
||||
$VERSION = 0.8;
|
||||
# $Id$
|
||||
|
||||
use strict;
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
# SNMP::Info::CiscoStats
|
||||
# Max Baker <max@warped.org>
|
||||
#
|
||||
# Changes since Version 0.7 Copyright (c) 2004 Max Baker
|
||||
# All rights reserved.
|
||||
#
|
||||
# Copyright (c) 2003 Regents of the University of California
|
||||
# All rights reserved.
|
||||
#
|
||||
@@ -28,7 +31,7 @@
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::CiscoStats;
|
||||
$VERSION = 0.6;
|
||||
$VERSION = 0.8;
|
||||
# $Id$
|
||||
|
||||
use strict;
|
||||
@@ -89,12 +92,12 @@ sub os_ver {
|
||||
my $descr = $l2->description();
|
||||
|
||||
# Older Catalysts
|
||||
if ($os eq 'catalyst' and $descr =~ m/V(\d{1}\.\d{2}\.\d{2})/){
|
||||
if (defined $os and $os eq 'catalyst' and defined $descr and $descr =~ m/V(\d{1}\.\d{2}\.\d{2})/){
|
||||
return $1;
|
||||
}
|
||||
|
||||
|
||||
# Newer Catalysts and IOS devices
|
||||
if ($descr =~ m/Version (\d+\.\d+\([^)]+\)[^,\s]*)(,|\s)+/ ){
|
||||
if (defined $descr and $descr =~ m/Version (\d+\.\d+\([^)]+\)[^,\s]*)(,|\s)+/ ){
|
||||
return $1;
|
||||
}
|
||||
return undef;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
# SNMP::Info::CiscoVTP
|
||||
# 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
|
||||
# All rights reserved.
|
||||
#
|
||||
@@ -28,7 +30,7 @@
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::CiscoVTP;
|
||||
$VERSION = 0.7;
|
||||
$VERSION = 0.8;
|
||||
# $Id$
|
||||
|
||||
use strict;
|
||||
@@ -45,7 +47,8 @@ $SNMP::debugging=$DEBUG;
|
||||
|
||||
$INIT = 0;
|
||||
%MIBS = (
|
||||
'CISCO-VTP-MIB' => 'vtpVlanName',
|
||||
'CISCO-VTP-MIB' => 'vtpVlanName',
|
||||
'CISCO-VLAN-MEMBERSHIP-MIB' => 'vmMembershipEntry',
|
||||
);
|
||||
|
||||
%GLOBALS = (
|
||||
@@ -88,6 +91,16 @@ $INIT = 0;
|
||||
'v_crf' => 'vtpVlanIsCRFBackup',
|
||||
'v_type_ext' => 'vtpVlanTypeExt',
|
||||
'v_if' => 'vtpVlanIfIndex',
|
||||
|
||||
# CISCO-VLAN-MEMBERSHIP-MIB
|
||||
# VmMembershipTable
|
||||
'i_vlan_type' => 'vmVlanType',
|
||||
'i_vlan' => 'vmVlan',
|
||||
'i_vlan_stat' => 'vmPortStatus',
|
||||
'i_vlan_1' => 'vmVlans',
|
||||
'i_vlan_2' => 'vmVlans2k',
|
||||
'i_vlan_3' => 'vmVlans3k',
|
||||
'i_vlan_4' => 'vmVlans4k',
|
||||
# TODO Add these tables if someone wants them..
|
||||
# vtpEditControlTable
|
||||
# vtpVlanEditTable
|
||||
@@ -181,6 +194,8 @@ You device will only implement a subset of these methods.
|
||||
See ftp://ftp.cisco.com/pub/mibs/supportlists/wsc5000/wsc5000-communityIndexing.html
|
||||
for a good treaty of how to connect to the VLANs
|
||||
|
||||
This table is from CISCO-VTP-MIB::vtpVlanTable
|
||||
|
||||
=over
|
||||
|
||||
=item $vtp->v_index()
|
||||
@@ -257,6 +272,58 @@ C<vtpVlanIfIndex>
|
||||
|
||||
=back
|
||||
|
||||
=head2 VLAN Interface Table
|
||||
|
||||
This table is from CISCO-VLAN-MEMBERSHIP-MIB::VmMembershipTable
|
||||
|
||||
=over
|
||||
|
||||
=item $vtp->i_vlan_type()
|
||||
|
||||
Static, Dynamic, or multiVlan.
|
||||
|
||||
C<vmVlanType>
|
||||
|
||||
=item $vtp->i_vlan()
|
||||
|
||||
The VLAN that a port is assigned to.
|
||||
|
||||
0 for no VLAN assigned.
|
||||
|
||||
C<vmVlan>
|
||||
|
||||
=item $vtp->i_vlan_stat()
|
||||
|
||||
Inactive, active, shutdown.
|
||||
|
||||
C<vmPortStatus>
|
||||
|
||||
=item $vtp->i_vlan_1()
|
||||
|
||||
Each bit represents a VLAN. This is 0 through 1023
|
||||
|
||||
C<vmVlans>
|
||||
|
||||
=item $vtp->i_vlan_2()
|
||||
|
||||
Each bit represents a VLAN. This is 1024 through 2047
|
||||
|
||||
C<vmVlans2k>
|
||||
|
||||
=item $vtp->i_vlan_3()
|
||||
|
||||
Each bit represents a VLAN. This is 2048 through 3071
|
||||
|
||||
C<vmVlans3k>
|
||||
|
||||
=item $vtp->i_vlan_4()
|
||||
|
||||
Each bit represents a VLAN. This is 3072 through 4095
|
||||
|
||||
C<vmVlans4k>
|
||||
|
||||
=back
|
||||
|
||||
=head2 Managment Domain Table
|
||||
|
||||
=over
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
# SNMP::Info::Entity
|
||||
# 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
|
||||
# All rights reserved.
|
||||
#
|
||||
@@ -28,7 +30,7 @@
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::Entity;
|
||||
$VERSION = 0.6;
|
||||
$VERSION = 0.8;
|
||||
# $Id$
|
||||
|
||||
use strict;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
# SNMP::Info::EtherLike
|
||||
# Max Baker <max@warped.org>
|
||||
#
|
||||
# Copyright (c) 2004 Max Baker changes from version 0.8 and beyond.
|
||||
#
|
||||
# Copyright (c) 2002,2003 Regents of the University of California
|
||||
# All rights reserved.
|
||||
#
|
||||
@@ -28,7 +30,7 @@
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::EtherLike;
|
||||
$VERSION = 0.6;
|
||||
$VERSION = 0.8;
|
||||
# $Id$
|
||||
|
||||
use strict;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
# SNMP::Info::Layer1 - SNMP Interface to Layer1 Devices
|
||||
# Max Baker <max@warped.org>
|
||||
#
|
||||
# Copyright (c) 2004 Max Baker changes from version 0.8 and beyond.
|
||||
#
|
||||
# Copyright (c) 2002,2003 Regents of the University of California
|
||||
# All rights reserved.
|
||||
#
|
||||
@@ -28,7 +30,7 @@
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::Layer1;
|
||||
$VERSION = 0.6;
|
||||
$VERSION = 0.8;
|
||||
# $Id$
|
||||
|
||||
use strict;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
# SNMP::Info::Layer1::Allied
|
||||
# Max Baker <max@warped.org>
|
||||
#
|
||||
# Copyright (c) 2004 Max Baker changes from version 0.8 and beyond.
|
||||
#
|
||||
# Copyright (c) 2002,2003 Regents of the University of California
|
||||
# All rights reserved.
|
||||
#
|
||||
@@ -28,7 +30,7 @@
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::Layer1::Allied;
|
||||
$VERSION = 0.6;
|
||||
$VERSION = 0.8;
|
||||
# $Id$
|
||||
use strict;
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
# SNMP::Info::Layer1::Asante
|
||||
# Max Baker <max@warped.org>
|
||||
#
|
||||
# Copyright (c) 2004 Max Baker changes from version 0.8 and beyond.
|
||||
#
|
||||
# Copyright (c) 2002,2003 Regents of the University of California
|
||||
# All rights reserved.
|
||||
#
|
||||
@@ -28,7 +30,7 @@
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::Layer1::Asante;
|
||||
$VERSION = 0.6;
|
||||
$VERSION = 0.8;
|
||||
# $Id$
|
||||
use strict;
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
# SNMP::Info::Layer2 - SNMP Interface to Layer2 Devices
|
||||
# Max Baker <max@warped.org>
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
@@ -28,7 +30,7 @@
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::Layer2;
|
||||
$VERSION = 0.7;
|
||||
$VERSION = 0.8;
|
||||
# $Id$
|
||||
|
||||
use strict;
|
||||
@@ -57,6 +59,7 @@ $INIT = 0;
|
||||
%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 = (
|
||||
@@ -64,6 +67,7 @@ $INIT = 0;
|
||||
%SNMP::Info::Bridge::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 = (
|
||||
@@ -71,6 +75,8 @@ $INIT = 0;
|
||||
%SNMP::Info::Bridge::FUNCS,
|
||||
%SNMP::Info::CDP::FUNCS,
|
||||
%SNMP::Info::CiscoStats::FUNCS,
|
||||
'ent_serial' => 'entPhysicalSerialNum',
|
||||
'ent_chassis'=> 'entPhysicalDescr',
|
||||
);
|
||||
|
||||
%MUNGE = (
|
||||
@@ -116,6 +122,25 @@ sub vendor {
|
||||
|
||||
}
|
||||
|
||||
sub serial {
|
||||
my $l2 = shift;
|
||||
|
||||
my $serial1 = $l2->serial1();
|
||||
my $ent_chassis = $l2->ent_chassis() || {};
|
||||
my $ent_serial = $l2->ent_serial() || {};
|
||||
|
||||
my $serial2 = $ent_serial->{1} || undef;
|
||||
my $chassis = $ent_chassis->{1} || undef;
|
||||
|
||||
# precedence
|
||||
# serial2,chassis parse,serial1
|
||||
return $serial2 if (defined $serial2 and $serial2 !~ /^\s*$/);
|
||||
return $1 if (defined $chassis and $chassis =~ /serial#?:\s*([a-z0-9]+)/i);
|
||||
return $serial1 if (defined $serial1 and $serial1 !~ /^\s*$/);
|
||||
|
||||
return undef;
|
||||
}
|
||||
|
||||
sub i_ignore {
|
||||
my $l2 = shift;
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
# SNMP::Info::Layer2::Aironet
|
||||
# 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
|
||||
# All rights reserved.
|
||||
#
|
||||
@@ -28,7 +30,7 @@
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::Layer2::Aironet;
|
||||
$VERSION = 0.6;
|
||||
$VERSION = 0.8;
|
||||
# $Id$
|
||||
use strict;
|
||||
|
||||
|
||||
246
Info/Layer2/Allied.pm
Normal file
246
Info/Layer2/Allied.pm
Normal file
@@ -0,0 +1,246 @@
|
||||
# SNMP::Info::Layer2::Allied
|
||||
# Max Baker <max@warped.org>, Dmitry Sergienko <dmitry@trifle.net>
|
||||
#
|
||||
# Copyright (c) 2004 Max Baker
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
# * Neither the name of Netdisco 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::Allied;
|
||||
$VERSION = 0.8;
|
||||
# $Id$
|
||||
use strict;
|
||||
|
||||
use Exporter;
|
||||
use SNMP::Info::Layer2;
|
||||
use SNMP::Info::Layer1;
|
||||
|
||||
@SNMP::Info::Layer2::Allied::ISA = qw/SNMP::Info::Layer2 Exporter/;
|
||||
@SNMP::Info::Layer2::Allied::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::Layer2::GLOBALS
|
||||
);
|
||||
|
||||
%FUNCS = (%SNMP::Info::Layer2::FUNCS,
|
||||
'ip_adresses'=> 'atNetAddress',
|
||||
'ip_mac' => 'atPhysAddress',
|
||||
'i_name' => 'ifName',
|
||||
'i_up2' => 'ifOperStatus',
|
||||
);
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer2::MIBS,
|
||||
'AtiSwitch-MIB' => 'atiswitchProductType',
|
||||
'AtiStackInfo-MIB' => 'atiswitchEnhancedStacking',
|
||||
);
|
||||
|
||||
%MUNGE = (%SNMP::Info::Layer2::MUNGE,
|
||||
);
|
||||
|
||||
sub vendor {
|
||||
return 'allied';
|
||||
}
|
||||
|
||||
sub os {
|
||||
return 'allied';
|
||||
}
|
||||
|
||||
sub os_ver {
|
||||
my $allied = shift;
|
||||
my $descr = $allied->description();
|
||||
|
||||
if ($descr =~ m/version (\d+\.\d+)/){
|
||||
return $1;
|
||||
}
|
||||
}
|
||||
|
||||
sub model {
|
||||
my $allied = shift;
|
||||
|
||||
my $desc = $allied->description();
|
||||
|
||||
if ($desc =~ /(AT-80\d{2}\S*)/){
|
||||
return $1;
|
||||
}
|
||||
return undef;
|
||||
}
|
||||
|
||||
sub ip {
|
||||
my $allied = shift;
|
||||
my $ip_hash = $allied->ip_addresses();
|
||||
my $ip;
|
||||
my $found_ip;
|
||||
|
||||
foreach $ip (values %{$ip_hash}) {
|
||||
my $found_ip = SNMP::Info::munge_ip($ip) if (defined $ip);
|
||||
last; # this is only one IP address
|
||||
}
|
||||
return $found_ip;
|
||||
}
|
||||
|
||||
sub mac{
|
||||
my $allied = shift;
|
||||
my $mac_hash = $allied->ip_mac();
|
||||
my $mac;
|
||||
my $found_mac;
|
||||
|
||||
foreach $mac (values %{$mac_hash}) {
|
||||
$found_mac = SNMP::Info::munge_mac($mac);
|
||||
last; # this is only one MAC address
|
||||
}
|
||||
return $found_mac;
|
||||
}
|
||||
|
||||
sub i_up {
|
||||
my $allied = shift;
|
||||
|
||||
my $i_up = SNMP::Info::Layer1::i_up($allied);
|
||||
my $i_up2 = $allied->i_up2();
|
||||
|
||||
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';
|
||||
}
|
||||
|
||||
return $i_up;
|
||||
}
|
||||
1;
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
SNMP::Info::Layer2::Allied - SNMP Interface to Allied Telesyn switches
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Max Baker (C<max@warped.org>)
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
# Let SNMP::Info determine the correct subclass for you.
|
||||
my $allied = new SNMP::Info(
|
||||
AutoSpecify => 1,
|
||||
Debug => 1,
|
||||
# These arguments are passed directly on to SNMP::Session
|
||||
DestHost => 'myhub',
|
||||
Community => 'public',
|
||||
Version => 1
|
||||
)
|
||||
or die "Can't connect to DestHost.\n";
|
||||
|
||||
my $class = $l1->class();
|
||||
print "SNMP::Info determined this device to fall under subclass : $class\n";
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Provides abstraction to the configuration information obtainable from a
|
||||
Allied device through SNMP. See inherited classes' documentation for
|
||||
inherited methods.
|
||||
|
||||
=head2 Inherited Classes
|
||||
|
||||
=over
|
||||
|
||||
=item SNMP::Info::Layer1
|
||||
|
||||
=back
|
||||
|
||||
=head2 Required MIBs
|
||||
|
||||
=over
|
||||
|
||||
=item ATI-MIB
|
||||
|
||||
Download for your device from http://www.allied-telesyn.com/allied/support/
|
||||
|
||||
=item Inherited Classes
|
||||
|
||||
MIBs listed in SNMP::Info::Layer1 and its inherited classes.
|
||||
|
||||
=back
|
||||
|
||||
=head1 GLOBALS
|
||||
|
||||
These are methods that return scalar value from SNMP
|
||||
|
||||
=head2 Overrides
|
||||
|
||||
=over
|
||||
|
||||
=item $allied->vendor()
|
||||
|
||||
Returns 'allied' :)
|
||||
|
||||
=item $allied->os()
|
||||
|
||||
Returns 'allied'
|
||||
|
||||
=item $allied->os_ver()
|
||||
|
||||
Culls Version from description()
|
||||
|
||||
=item $allied->root_ip()
|
||||
|
||||
Returns IP Address of Managed Hub.
|
||||
|
||||
(B<actualIpAddr>)
|
||||
|
||||
=item $allied->model()
|
||||
|
||||
Trys to cull out AT-nnnnX out of the description field.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Global Methods imported from SNMP::Info::Layer1
|
||||
|
||||
See documentation in SNMP::Info::Layer1 for details.
|
||||
|
||||
=head1 TABLE ENTRIES
|
||||
|
||||
=head2 Overrides
|
||||
|
||||
=over
|
||||
|
||||
=item $allied->i_name()
|
||||
|
||||
Returns reference to map of IIDs to human-set port name.
|
||||
|
||||
=item $allied->i_up()
|
||||
|
||||
Returns reference to map of IIDs to link status. Changes
|
||||
the values of ati_up() to 'up' and 'down'.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Allied MIB
|
||||
|
||||
=over
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
||||
@@ -1,6 +1,8 @@
|
||||
# SNMP::Info::Layer2::Bay
|
||||
# Max Baker <max@warped.org>
|
||||
#
|
||||
# Copyright (c) 2004 Max Baker changes from version 0.8 and beyond.
|
||||
#
|
||||
# Copyright (c) 2002,2003 Regents of the University of California
|
||||
# All rights reserved.
|
||||
#
|
||||
@@ -28,7 +30,7 @@
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::Layer2::Bay;
|
||||
$VERSION = 0.6;
|
||||
$VERSION = 0.8;
|
||||
# $Id$
|
||||
use strict;
|
||||
|
||||
@@ -196,7 +198,7 @@ sub c_ip {
|
||||
foreach my $entry (keys %$bay_topo_ip){
|
||||
my $port = $bay_topo_port->{$entry};
|
||||
next unless defined $port;
|
||||
next if $port == 0;
|
||||
next if ($port =~ /^[\d\.]+$/ and $port == 0);
|
||||
my $ip = $bay_topo_ip->{$entry};
|
||||
push(@{$ip_port{$port}},$ip);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
# SNMP::Info::Layer2::C1900
|
||||
# Max Baker <max@warped.org>
|
||||
#
|
||||
# Copyright (c) 2004 Max Baker changes from version 0.8 and beyond.
|
||||
#
|
||||
# Copyright (c) 2002,2003 Regents of the University of California
|
||||
# All rights reserved.
|
||||
#
|
||||
@@ -28,14 +30,15 @@
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::Layer2::C1900;
|
||||
$VERSION = 0.6;
|
||||
$VERSION = 0.8;
|
||||
# $Id$
|
||||
use strict;
|
||||
|
||||
use Exporter;
|
||||
use SNMP::Info::Layer2;
|
||||
use SNMP::Info::CiscoVTP;
|
||||
|
||||
@SNMP::Info::Layer2::C1900::ISA = qw/SNMP::Info::Layer2 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/;
|
||||
@@ -43,10 +46,12 @@ use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
|
||||
# Set for No CDP
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::Layer2::GLOBALS,
|
||||
%SNMP::Info::CiscoVTP::GLOBALS,
|
||||
'c1900_flash_status' => 'upgradeFlashBankStatus',
|
||||
);
|
||||
|
||||
%FUNCS = (%SNMP::Info::Layer2::FUNCS,
|
||||
%SNMP::Info::CiscoVTP::FUNCS,
|
||||
'i_type2' => 'ifType',
|
||||
'i_name2' => 'ifName',
|
||||
# ESSWITCH-MIB
|
||||
@@ -62,11 +67,13 @@ use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer2::MIBS,
|
||||
%SNMP::Info::CiscoVTP::MIBS,
|
||||
# Also known as the ESSWITCH-MIB
|
||||
'STAND-ALONE-ETHERNET-SWITCH-MIB' => 'series2000'
|
||||
);
|
||||
|
||||
%MUNGE = (%SNMP::Info::Layer2::MUNGE,
|
||||
%SNMP::Info::CiscoVTP::MUNGE,
|
||||
);
|
||||
|
||||
sub vendor {
|
||||
@@ -92,6 +99,10 @@ sub os_ver {
|
||||
return undef;
|
||||
}
|
||||
|
||||
sub cisco_comm_indexing {
|
||||
1;
|
||||
}
|
||||
|
||||
sub interfaces {
|
||||
my $c1900 = shift;
|
||||
my $i_descr = $c1900->i_description();
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
# SNMP::Info::Layer2::C2900
|
||||
# Max Baker <max@warped.org>
|
||||
#
|
||||
# Copyright (c) 2004 Max Baker changes from version 0.8 and beyond.
|
||||
#
|
||||
# Copyright (c) 2002,2003 Regents of the University of California
|
||||
# All rights reserved.
|
||||
#
|
||||
@@ -28,7 +30,7 @@
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::Layer2::C2900;
|
||||
$VERSION = 0.7;
|
||||
$VERSION = 0.8;
|
||||
# $Id$
|
||||
use strict;
|
||||
|
||||
@@ -49,6 +51,7 @@ use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
|
||||
|
||||
%FUNCS = (%SNMP::Info::Layer2::FUNCS,
|
||||
%SNMP::Info::CiscoVTP::FUNCS,
|
||||
'i_name' => 'ifAlias',
|
||||
# C2900PortEntry
|
||||
'c2900_p_index' => 'c2900PortIfIndex',
|
||||
'c2900_p_duplex' => 'c2900PortDuplexStatus',
|
||||
@@ -69,6 +72,10 @@ sub vendor {
|
||||
return 'cisco';
|
||||
}
|
||||
|
||||
sub cisco_comm_indexing {
|
||||
1;
|
||||
}
|
||||
|
||||
sub i_duplex {
|
||||
my $c2900 = shift;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# Max Baker <max@warped.org>
|
||||
#
|
||||
# Copyright (c) 2002,2003 Regents of the University of California
|
||||
# Copyright (c) 2003 Max Baker
|
||||
# Copyright (c) 2003,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,7 +29,7 @@
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::Layer2::Catalyst;
|
||||
$VERSION = 0.7;
|
||||
$VERSION = 0.8;
|
||||
# $Id$
|
||||
|
||||
use strict;
|
||||
@@ -110,6 +110,10 @@ sub os_ver {
|
||||
return undef;
|
||||
}
|
||||
|
||||
sub cisco_comm_indexing {
|
||||
1;
|
||||
}
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
# SNMP::Info::Layer2::HP - SNMP Interface to HP ProCurve Switches
|
||||
# Max Baker <max@warped.org>
|
||||
#
|
||||
# Copyright (c) 2004 Max Baker changes from version 0.8 and beyond.
|
||||
#
|
||||
# Copyright (c) 2002,2003 Regents of the University of California
|
||||
# All rights reserved.
|
||||
#
|
||||
@@ -28,7 +30,7 @@
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::Layer2::HP;
|
||||
$VERSION = 0.6;
|
||||
$VERSION = 0.8;
|
||||
# $Id$
|
||||
|
||||
use strict;
|
||||
@@ -51,22 +53,24 @@ $INIT = 0;
|
||||
%SNMP::Info::Entity::MIBS,
|
||||
'RFC1271-MIB' => 'logDescription',
|
||||
'HP-ICF-OID' => 'hpSwitch4000',
|
||||
'HP-VLAN' => 'hpVlanMemberIndex',
|
||||
'STATISTICS-MIB' => 'hpSwitchCpuStat',
|
||||
'NETSWITCH-MIB' => 'hpMsgBufFree'
|
||||
'NETSWITCH-MIB' => 'hpMsgBufFree',
|
||||
);
|
||||
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::Layer2::GLOBALS,
|
||||
%SNMP::Info::MAU::GLOBALS,
|
||||
%SNMP::Info::Entity::GLOBALS,
|
||||
'serial1' => 'entPhysicalSerialNum.1',
|
||||
'hp_cpu' => 'hpSwitchCpuStat.0',
|
||||
'serial1' => 'entPhysicalSerialNum.1',
|
||||
'hp_cpu' => 'hpSwitchCpuStat.0',
|
||||
'hp_mem_total' => 'hpGlobalMemTotalBytes.1',
|
||||
'mem_free' => 'hpGlobalMemFreeBytes.1',
|
||||
'mem_used' => 'hpGlobalMemAllocBytes.1',
|
||||
'os_version' => 'hpSwitchOsVersion.0',
|
||||
'os_bin' => 'hpSwitchRomVersion.0',
|
||||
'mac' => 'hpSwitchBaseMACAddress.0'
|
||||
'mem_free' => 'hpGlobalMemFreeBytes.1',
|
||||
'mem_used' => 'hpGlobalMemAllocBytes.1',
|
||||
'os_version' => 'hpSwitchOsVersion.0',
|
||||
'os_bin' => 'hpSwitchRomVersion.0',
|
||||
'mac' => 'hpSwitchBaseMACAddress.0',
|
||||
'hp_vlans' => 'hpVlanNumber',
|
||||
);
|
||||
|
||||
%FUNCS = (
|
||||
@@ -75,7 +79,16 @@ $INIT = 0;
|
||||
%SNMP::Info::Entity::FUNCS,
|
||||
'i_type2' => 'ifType',
|
||||
# RFC1271
|
||||
'l_descr' => 'logDescription'
|
||||
'l_descr' => 'logDescription',
|
||||
# HP-VLAN-MIB
|
||||
'hp_v_index' => 'hpVlanDot1QID',
|
||||
'hp_v_name' => 'hpVlanIdentName',
|
||||
'hp_v_state' => 'hpVlanIdentState',
|
||||
'hp_v_type' => 'hpVlanIdentType',
|
||||
'hp_v_status' => 'hpVlanIdentStatus',
|
||||
'hp_v_mac' => 'hpVlanAddrPhysAddress',
|
||||
'hp_v_if_index'=> 'hpVlanMemberIndex',
|
||||
'hp_v_if_tag' => 'hpVlanMemberTagged2',
|
||||
);
|
||||
|
||||
%MUNGE = (
|
||||
@@ -86,15 +99,32 @@ $INIT = 0;
|
||||
);
|
||||
|
||||
%MODEL_MAP = (
|
||||
'J4812A' => '2512',
|
||||
'J4819A' => '5308XL',
|
||||
'J4813A' => '2524',
|
||||
'J4805A' => '5304XL',
|
||||
'J4815A' => '3324XL',
|
||||
'J4865A' => '4108GL',
|
||||
'J4887A' => '4104GL',
|
||||
'J4874A' => '9315',
|
||||
);
|
||||
'J4093A' => '2424M',
|
||||
'J4110A' => '8000M',
|
||||
'J4120A' => '1600M',
|
||||
'J4121A' => '4000M',
|
||||
'J4122A' => '2400M',
|
||||
'J4138A' => '9308M',
|
||||
'J4139A' => '9304M',
|
||||
'J4812A' => '2512',
|
||||
'J4813A' => '2524',
|
||||
'J4819A' => '5308XL',
|
||||
'J4840A' => '6308M-SX',
|
||||
'J4841A' => '6208M-SX',
|
||||
'J4850A' => '5304XL',
|
||||
'J4865A' => '4108GL',
|
||||
'J4874A' => '9315M',
|
||||
'J4887A' => '4104GL',
|
||||
'J4899A' => '2650',
|
||||
'J4900A' => '2626',
|
||||
'J4902A' => '6108',
|
||||
'J4903A' => '2824',
|
||||
'J4904A' => '2848',
|
||||
'J8130A' => 'WAP-420-NA',
|
||||
'J8131A' => 'WAP-420-WW',
|
||||
'J8164A' => '2626-PWR',
|
||||
'J8165A' => '2650-PWR',
|
||||
);
|
||||
|
||||
# Method Overrides
|
||||
|
||||
@@ -326,6 +356,57 @@ sub i_duplex_admin {
|
||||
return \%i_duplex_admin;
|
||||
}
|
||||
|
||||
|
||||
=item $hp->i_vlan()
|
||||
|
||||
Looks in Q-BRIDGE-MIB -- see SNMP::Info::Bridge
|
||||
|
||||
and for older devices looks in HP-VLAN.
|
||||
|
||||
=cut
|
||||
sub i_vlan {
|
||||
my $hp = shift;
|
||||
|
||||
my $interfaces = $hp->interfaces();
|
||||
|
||||
# Newer devices use Q-BRIDGE-MIB
|
||||
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
|
||||
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';
|
||||
|
||||
|
||||
$i_vlan->{$if} = $vlan if defined $vlan;
|
||||
}
|
||||
}
|
||||
|
||||
return $i_vlan;
|
||||
}
|
||||
1;
|
||||
__END__
|
||||
|
||||
@@ -389,13 +470,18 @@ Included in V2 mibs from Cisco
|
||||
|
||||
=item HP-ICF-OID
|
||||
|
||||
=item HP-VLAN
|
||||
|
||||
(this MIB new with SNMP::Info 0.8)
|
||||
|
||||
=item STATISTICS-MIB
|
||||
|
||||
=item NETSWITCH-MIB
|
||||
|
||||
=back
|
||||
|
||||
The last three MIBs listed are from HP and can be found at http://www.hp.com/rnd/software
|
||||
The last three MIBs listed are from HP and can be found at L<http://www.hp.com/rnd/software>
|
||||
or L<http://www.hp.com/rnd/software/MIBs.htm>
|
||||
|
||||
=head1 ChangeLog
|
||||
|
||||
|
||||
224
Info/Layer2/ZyXEL_DSLAM.pm
Normal file
224
Info/Layer2/ZyXEL_DSLAM.pm
Normal file
@@ -0,0 +1,224 @@
|
||||
# SNMP::Info::Layer2::ZyXEL_DSLAM
|
||||
# Dmitry Sergienko <dmitry@trifle.net>
|
||||
#
|
||||
# Copyright (c) 2004 Max Baker <max@warped.org>
|
||||
# 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 Netdisco 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::ZyXEL_DSLAM;
|
||||
$VERSION = 0.8;
|
||||
# $Id$
|
||||
use strict;
|
||||
|
||||
use Exporter;
|
||||
use SNMP::Info::Layer2;
|
||||
|
||||
@SNMP::Info::Layer2::ZyXEL_DSLAM::ISA = qw/SNMP::Info::Layer2 Exporter/;
|
||||
@SNMP::Info::Layer2::ZyXEL_DSLAM::EXPORT_OK = qw//;
|
||||
|
||||
use vars qw/$VERSION %FUNCS %GLOBALS %MIBS %MUNGE $AUTOLOAD $INIT $DEBUG/;
|
||||
|
||||
# Set for No CDP
|
||||
%GLOBALS = (
|
||||
%SNMP::Info::Layer2::GLOBALS
|
||||
);
|
||||
|
||||
%FUNCS = (%SNMP::Info::Layer2::FUNCS,
|
||||
'ip_adresses' => 'ipAdEntAddr',
|
||||
'i_name' => 'ifDescr',
|
||||
'i_description' => 'adslLineConfProfile',
|
||||
);
|
||||
|
||||
%MIBS = (
|
||||
%SNMP::Info::Layer2::MIBS,
|
||||
'ADSL-LINE-MIB' => 'adslLineConfProfile'
|
||||
);
|
||||
|
||||
%MUNGE = (%SNMP::Info::Layer2::MUNGE
|
||||
);
|
||||
|
||||
|
||||
sub layers {
|
||||
my $zyxel = shift;
|
||||
my $layers = $zyxel->layers();
|
||||
return $layers if defined $layers;
|
||||
|
||||
# If these don't claim to have any layers, so we'll give them 1+2
|
||||
return '00000011';
|
||||
}
|
||||
|
||||
sub vendor {
|
||||
return 'zyxel';
|
||||
}
|
||||
|
||||
sub os {
|
||||
return 'zyxel';
|
||||
}
|
||||
|
||||
sub os_ver {
|
||||
my $zyxel = shift;
|
||||
my $descr = $zyxel->description();
|
||||
|
||||
if ($descr =~ m/version (\S+) /){
|
||||
return $1;
|
||||
}
|
||||
return undef;
|
||||
}
|
||||
|
||||
sub model {
|
||||
my $zyxel = shift;
|
||||
|
||||
my $desc = $zyxel->description();
|
||||
|
||||
if ($desc =~ /8-port ADSL Module\(Annex A\)/){
|
||||
return "AAM1008-61";
|
||||
} elsif ($desc =~ /8-port ADSL Module\(Annex B\)/){
|
||||
return "AAM1008-63";
|
||||
}
|
||||
return undef;
|
||||
}
|
||||
|
||||
sub ip{
|
||||
my $zyxel = shift;
|
||||
my $ip_hash = $zyxel->ip_addresses();
|
||||
my $ip;
|
||||
|
||||
foreach $ip (keys %{$ip_hash}) {
|
||||
my $found_ip = $ip if (defined $ip and $ip =~ /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/);
|
||||
}
|
||||
return $ip;
|
||||
}
|
||||
1;
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
SNMP::Info::Layer2::ZyXEL_DSLAM - SNMP Interface to ZyXEL DSLAM
|
||||
|
||||
=head1 AUTHOR
|
||||
|
||||
Dmitry Sergienko (C<dmitry@trifle.net>)
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
# Let SNMP::Info determine the correct subclass for you.
|
||||
my $zyxel = new SNMP::Info(
|
||||
AutoSpecify => 1,
|
||||
Debug => 1,
|
||||
# These arguments are passed directly on to SNMP::Session
|
||||
DestHost => 'myhub',
|
||||
Community => 'public',
|
||||
Version => 1
|
||||
)
|
||||
or die "Can't connect to DestHost.\n";
|
||||
|
||||
my $class = $l2->class();
|
||||
print "SNMP::Info determined this device to fall under subclass : $class\n";
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Provides abstraction to the configuration information obtainable from a
|
||||
ZyXEL device through SNMP. See inherited classes' documentation for
|
||||
inherited methods.
|
||||
|
||||
=head2 Inherited Classes
|
||||
|
||||
=over
|
||||
|
||||
=item SNMP::Info::Layer2
|
||||
|
||||
=back
|
||||
|
||||
=head2 Required MIBs
|
||||
|
||||
=over
|
||||
|
||||
=item ADSL-LINE-MIB
|
||||
|
||||
This MIB assumedly obtainable through ZyXEL or possibly included with your device.
|
||||
|
||||
=item Inherited Classes
|
||||
|
||||
MIBs listed in SNMP::Info::Layer2 and their inherited classes.
|
||||
|
||||
=back
|
||||
|
||||
=head1 GLOBALS
|
||||
|
||||
These are methods that return scalar value from SNMP
|
||||
|
||||
=head2 Overrides
|
||||
|
||||
=over
|
||||
|
||||
=item $zyxel->vendor()
|
||||
|
||||
Returns 'ZyXEL' :)
|
||||
|
||||
=item $zyxel->os()
|
||||
|
||||
Returns 'ZyXEL'
|
||||
|
||||
=item $zyxel->os_ver()
|
||||
|
||||
Culls Version from description()
|
||||
|
||||
=item $zyxel->ip()
|
||||
|
||||
Returns IP Address of DSLAM.
|
||||
|
||||
(B<ipAdEntAddr>)
|
||||
|
||||
=item $zyxel->model()
|
||||
|
||||
Trys to cull out model out of the description field.
|
||||
|
||||
=back
|
||||
|
||||
=head2 Global Methods imported from SNMP::Info::Layer2
|
||||
|
||||
See documentation in SNMP::Info::Layer2 for details.
|
||||
|
||||
=head1 TABLE ENTRIES
|
||||
|
||||
=head2 Overrides
|
||||
|
||||
=over
|
||||
|
||||
=item $zyxel->i_name()
|
||||
|
||||
Returns reference to map of IIDs to port name (B<ifDescr>).
|
||||
|
||||
=item $zyxel->i_description()
|
||||
|
||||
Returns reference to map of IIDs to human-set port description (profile name).
|
||||
|
||||
=back
|
||||
|
||||
=head2 Table Methods imported from SNMP::Info::Layer2
|
||||
|
||||
See documentation in SNMP::Info::Layer2 for details.
|
||||
|
||||
=cut
|
||||
@@ -1,6 +1,8 @@
|
||||
# SNMP::Info::Layer3 - SNMP Interface to Layer3 devices
|
||||
# Max Baker <max@warped.org>
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
@@ -28,7 +30,7 @@
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::Layer3;
|
||||
$VERSION = 0.6;
|
||||
$VERSION = 0.8;
|
||||
# $Id$
|
||||
|
||||
use strict;
|
||||
@@ -69,7 +71,7 @@ $INIT = 0;
|
||||
%SNMP::Info::Bridge::GLOBALS,
|
||||
%SNMP::Info::EtherLike::GLOBALS,
|
||||
'mac' => 'ifPhysAddress.1',
|
||||
'chassis' => 'entPhysicalDescr.1',
|
||||
'serial1' => '.1.3.6.1.4.1.9.3.6.3.0', # OLD-CISCO-CHASSIS-MIB::chassisId.0
|
||||
'router_ip' => 'ospfRouterId.0',
|
||||
);
|
||||
|
||||
@@ -85,7 +87,9 @@ $INIT = 0;
|
||||
'at_index' => 'atIfIndex',
|
||||
'at_paddr' => 'atPhysAddress',
|
||||
'at_netaddr' => 'atNetAddress',
|
||||
'ospf_ip' => 'ospfHostIpAddress'
|
||||
'ospf_ip' => 'ospfHostIpAddress',
|
||||
'ent_serial' => 'entPhysicalSerialNum',
|
||||
'ent_chassis'=> 'entPhysicalDescr',
|
||||
);
|
||||
|
||||
%MUNGE = (
|
||||
@@ -138,10 +142,20 @@ sub i_ignore {
|
||||
sub serial {
|
||||
my $l3 = shift;
|
||||
|
||||
my $chassis = $l3->chassis();
|
||||
my $serial1 = $l3->serial1();
|
||||
my $ent_chassis = $l3->ent_chassis() || {};
|
||||
my $ent_serial = $l3->ent_serial() || {};
|
||||
|
||||
my $serial2 = $ent_serial->{1} || undef;
|
||||
my $chassis = $ent_chassis->{1} || undef;
|
||||
|
||||
# precedence
|
||||
# serial2,chassis parse,serial1
|
||||
return $serial2 if (defined $serial2 and $serial2 !~ /^\s*$/);
|
||||
return $1 if (defined $chassis and $chassis =~ /serial#?:\s*([a-z0-9]+)/i);
|
||||
return $serial1 if (defined $serial1 and $serial1 !~ /^\s*$/);
|
||||
|
||||
return undef;
|
||||
}
|
||||
|
||||
# $l3->model() - the sysObjectID returns an IID to an entry in
|
||||
@@ -149,8 +163,16 @@ sub serial {
|
||||
sub model {
|
||||
my $l3 = shift;
|
||||
my $id = $l3->id();
|
||||
|
||||
unless (defined $id){
|
||||
print " SNMP::Info::Layer3::model() - Device does not support sysObjectID\n" if $DEBUG;
|
||||
return undef;
|
||||
}
|
||||
|
||||
my $model = &SNMP::translateObj($id);
|
||||
|
||||
return $id unless defined $model;
|
||||
|
||||
$model =~ s/^cisco//i;
|
||||
$model =~ s/^catalyst//;
|
||||
$model =~ s/^cat//;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
# SNMP::Info::Layer3::Aironet
|
||||
# Max Baker <max@warped.org>
|
||||
#
|
||||
# Copyright (c) 2004 Max Baker changes from version 0.8 and beyond.
|
||||
#
|
||||
# Copyright (c) 2002,2003 Regents of the University of California
|
||||
# All rights reserved.
|
||||
#
|
||||
@@ -28,7 +30,7 @@
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::Layer3::Aironet;
|
||||
$VERSION = 0.6;
|
||||
$VERSION = 0.8;
|
||||
# $Id$
|
||||
|
||||
use strict;
|
||||
@@ -90,9 +92,9 @@ sub os_ver {
|
||||
my $aironet = shift;
|
||||
my $descr = $aironet->description();
|
||||
|
||||
# CAP340 11.21
|
||||
if ($descr =~ /AP\d{3}\s+(\d{2}\.\d{2})/){
|
||||
return $1;
|
||||
# CAP340 11.21, AP4800-E 11.21
|
||||
if ($descr =~ /AP\d{3,4}(-\D+)?\s+(\d{2}\.\d{2})/){
|
||||
return $2;
|
||||
}
|
||||
|
||||
if ($descr =~ /Series\s*AP\s+(\d{2}\.\d{2})/){
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# SNMP::Info::Layer3::C3550
|
||||
# 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
|
||||
# Copyright (c) 2003 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::C3550;
|
||||
$VERSION = 0.7;
|
||||
$VERSION = 0.8;
|
||||
# $Id$
|
||||
|
||||
use strict;
|
||||
@@ -115,6 +115,10 @@ sub ports {
|
||||
return $ports2;
|
||||
}
|
||||
|
||||
sub cisco_comm_indexing {
|
||||
1;
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# SNMP::Info::Layer3::C6500
|
||||
# Max Baker <max@warped.org>
|
||||
#
|
||||
# Copyright (c) 2003 Max Baker
|
||||
# Copyright (c) 2003,2004 Max Baker
|
||||
# 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::Layer3::C6500;
|
||||
$VERSION = 0.7;
|
||||
$VERSION = 0.8;
|
||||
# $Id$
|
||||
|
||||
use strict;
|
||||
@@ -93,6 +93,11 @@ sub vendor {
|
||||
return 'cisco';
|
||||
}
|
||||
|
||||
sub cisco_comm_indexing {
|
||||
1;
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
# SNMP::Info::Layer3::Foundry - SNMP Interface to Foundry devices
|
||||
# Max Baker <max@warped.org>
|
||||
#
|
||||
# Copyright (c) 2004 Max Baker changes from version 0.8 and beyond.
|
||||
#
|
||||
# Copyright (c) 2002,2003 Regents of the University of California
|
||||
# All rights reserved.
|
||||
#
|
||||
@@ -28,7 +30,7 @@
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::Layer3::Foundry;
|
||||
$VERSION = 0.6;
|
||||
$VERSION = 0.8;
|
||||
# $Id$
|
||||
|
||||
use strict;
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
# SNMP::Info::MAU - Media Access Unit - RFC2668
|
||||
# Max Baker <max@warped.org>
|
||||
#
|
||||
# Copyright (c) 2004 Max Baker changes from version 0.8 and beyond.
|
||||
#
|
||||
# Copyright (c) 2002,2003 Regents of the University of California
|
||||
# All rights reserved.
|
||||
#
|
||||
@@ -28,7 +30,7 @@
|
||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
package SNMP::Info::MAU;
|
||||
$VERSION = 0.6;
|
||||
$VERSION = 0.8;
|
||||
# $Id$
|
||||
|
||||
use strict;
|
||||
|
||||
6
MANIFEST
6
MANIFEST
@@ -4,12 +4,15 @@ Info.pm
|
||||
Info/Bridge.pm
|
||||
Info/CDP.pm
|
||||
Info/CiscoStats.pm
|
||||
Info/CiscoStack.pm
|
||||
Info/CiscoVTP.pm
|
||||
Info/Entity.pm
|
||||
Info/EtherLike.pm
|
||||
Info/Layer1.pm
|
||||
Info/Layer1/Allied.pm
|
||||
Info/Layer1/Asante.pm
|
||||
Info/Layer2.pm
|
||||
Info/Layer2/Aironet.pm
|
||||
Info/Layer2/Bay.pm
|
||||
Info/Layer2/C1900.pm
|
||||
Info/Layer2/C2900.pm
|
||||
@@ -18,6 +21,7 @@ Info/Layer2/HP.pm
|
||||
Info/Layer3.pm
|
||||
Info/Layer3/Aironet.pm
|
||||
Info/Layer3/C3550.pm
|
||||
Info/Layer3/C6500.pm
|
||||
Info/Layer3/Foundry.pm
|
||||
Info/MAU.pm
|
||||
MANIFEST
|
||||
@@ -25,3 +29,5 @@ Makefile.PL
|
||||
README
|
||||
t/prereq.t
|
||||
t/test_class.pl
|
||||
t/make_dev_matrix.pl
|
||||
DeviceMatrix.txt
|
||||
|
||||
@@ -21,5 +21,6 @@ WriteMakefile(
|
||||
|
||||
sub MY::postamble { "
|
||||
.PHONY: readme
|
||||
readme:
|
||||
readme: README
|
||||
README: Info.pm
|
||||
pod2text -l Info.pm > README" }
|
||||
|
||||
76
README
76
README
@@ -5,14 +5,14 @@ NAME
|
||||
|
||||
VERSION
|
||||
|
||||
SNMP::Info - Version 0.6
|
||||
SNMP::Info - Version 0.8
|
||||
|
||||
AUTHOR
|
||||
|
||||
Max Baker ("max@warped.org")
|
||||
Max Baker
|
||||
|
||||
SNMP::Info was created at UCSC for the netdisco project
|
||||
(www.netdisco.org)
|
||||
(www.netdisco.org) and is now maintained by Max Baker.
|
||||
|
||||
SYNOPSIS
|
||||
|
||||
@@ -68,7 +68,7 @@ SUPPORT
|
||||
|
||||
Please direct all support, help, and bug requests to the snmp-info-users
|
||||
Mailing List at
|
||||
http://lists.sourceforge.net/lists/listinfo/snmp-info-users
|
||||
<http://lists.sourceforge.net/lists/listinfo/snmp-info-users>
|
||||
|
||||
DESCRIPTION
|
||||
|
||||
@@ -154,12 +154,34 @@ DESCRIPTION
|
||||
BRIDGE-MIB
|
||||
SNMP-REPEATER-MIB
|
||||
STAND-ALONE-ETHERNET-SWITCH-MIB (ESSWITCH-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
|
||||
|
||||
Fix CISCO-TC-MIB
|
||||
There is a problem with the Cisco file CISCO-TC.my which is
|
||||
included from lots of other MIBs. Make the following changes if
|
||||
you run into errors about "Unsigned32" in this file.
|
||||
|
||||
Edit /usr/local/share/snmp/mibs/CISCO-TC.my
|
||||
|
||||
Comment out line 192 that says "SMI Unsigned32" with two dashes.
|
||||
|
||||
-- SMI Unsigned32
|
||||
|
||||
Add "Unsigned32" to the imports after line 19:
|
||||
|
||||
IMPORTS
|
||||
MODULE-IDENTITY,
|
||||
Gauge32,
|
||||
Integer32,
|
||||
Counter64,
|
||||
Unsigned32,
|
||||
FROM SNMPv2-SMI
|
||||
|
||||
More Specific MIBs
|
||||
Some non-cisco subclasses will need MIBs other than the basic
|
||||
one available from Cisco.
|
||||
@@ -169,13 +191,14 @@ DESCRIPTION
|
||||
Design Goals
|
||||
|
||||
1. Use of textual MIB leaf identifier and enumerated values
|
||||
|
||||
* All values are retrieved via MIB Leaf node names
|
||||
For example SNMP::Info has an entry in its %GLOBALS hash for
|
||||
``sysName'' instead of 1.3.6.1.2.1.1.5.
|
||||
|
||||
* Data returned is in the enumerated value form.
|
||||
For Example instead of looking up 1.3.6.1.2.1.2.2.1.3 and
|
||||
getting back "23"
|
||||
getting back 23
|
||||
|
||||
SNMP::Info will ask for "RFC1213-MIB::ifType" and will get back
|
||||
"ppp".
|
||||
@@ -266,7 +289,7 @@ DESCRIPTION
|
||||
CatOS.
|
||||
|
||||
SNMP::Info::Layer2::C2900
|
||||
Subclass for Cisco Catalyst 2900 devices running IOS.
|
||||
Subclass for Cisco Catalyst 2900 and 3500XL devices running IOS.
|
||||
|
||||
SNMP::Info::Layer2::Catalyst
|
||||
Subclass for Cisco Catalyst switches running CatOS. These
|
||||
@@ -302,6 +325,11 @@ DESCRIPTION
|
||||
SNMP::Info::Layer3::C3550
|
||||
Subclass for Cisco Catalyst 3550 2/3 switches running IOS.
|
||||
|
||||
Thanks
|
||||
|
||||
Thanks for testing and coding help (in no particular order) to : Andy
|
||||
Ford, Brian Wilson, Jean-Philippe Luiggi, D<>na Watanabe
|
||||
|
||||
USAGE
|
||||
|
||||
Constructor
|
||||
@@ -393,13 +421,16 @@ USAGE
|
||||
Layer3 Support -> SNMP::Info::Layer3
|
||||
Aironet (non IOS) -> SNMP::Info::Layer3::Aironet
|
||||
Catalyst 3550 -> SNMP::Info::Layer3::C3550
|
||||
Catalyst 6500 -> SNMP::Info::Layer3::C6500
|
||||
Foundry -> SNMP::Info::Layer3::Foundry
|
||||
Elsif Layer2 (no Layer3) -> SNMP::Info::Layer2
|
||||
Aironet (Cisco) AP1100 -> SNMP::Info::Layer2::Aironet
|
||||
Bay Networks -> SNMP::Info::Layer2::Bay
|
||||
Catalyst 1900 -> SNMP::Info::Layer2::C1900
|
||||
Catalyst 2900XL (IOS) -> SNMP::Info::Layer2::C2900
|
||||
Catalyst WS-C (2926,5xxx,6xxx) -> SNMP::Info::Layer2::Catalyst
|
||||
Catalyst 2900XL/2950(IOS) -> SNMP::Info::Layer2::C2900
|
||||
Catalyst 3500XL (3548) IOS -> SNMP::Info::Layer2::C2900
|
||||
Catalyst 3550/3548 -> SNMP::Info::Layer3::C3550
|
||||
Catalyst WS-C 2926,5xxx -> SNMP::Info::Layer2::Catalyst
|
||||
HP Procurve -> SNMP::Info::Layer2::HP
|
||||
Elsif Layer1 Support -> SNMP::Info::Layer1
|
||||
Allied -> SNMP::Info::Layer1::Allied
|
||||
@@ -500,7 +531,7 @@ USAGE
|
||||
|
||||
$local_routes = $info->ipr_route('192.168.0');
|
||||
|
||||
This will only fetch entries in the table that start with "192.168.0",
|
||||
This will only fetch entries in the table that start with 192.168.0,
|
||||
which in this case are routes on the local network.
|
||||
|
||||
Remember that you must supply the partial IID (a numeric OID).
|
||||
@@ -988,27 +1019,36 @@ SNMP::INFO INTERNALS
|
||||
Makes human friendly speed ratings using %SPEED_MAP
|
||||
|
||||
%SPEED_MAP = (
|
||||
'56000' => '56 kbps',
|
||||
'64000' => '64 kbps',
|
||||
'1500000' => '1.5 Mbps',
|
||||
'1536000' => 'T1',
|
||||
'1544000' => 'T1',
|
||||
'2000000' => '2.0 Mbps',
|
||||
'2048000' => '2.048 Mbps',
|
||||
'3072000' => 'Dual T1',
|
||||
'3088000' => 'Dual T1',
|
||||
'4000000' => '4.0 Mbps',
|
||||
'10000000' => '10 Mbps',
|
||||
'11000000' => '11 Mbps',
|
||||
'20000000' => '20 Mbps',
|
||||
'16000000' => '16 Mbps',
|
||||
'45000000' => 'DS3',
|
||||
'44210000' => 'T3',
|
||||
'44736000' => 'T3',
|
||||
'45000000' => '45 Mbps',
|
||||
'45045000' => 'DS3',
|
||||
'64000000' => '64 Mbps',
|
||||
'100000000' => '100 Mbps',
|
||||
'149760000' => 'OC-1'
|
||||
'155000000' => 'OC-1'
|
||||
'149760000' => 'ATM on OC-3',
|
||||
'155000000' => 'OC-3',
|
||||
'155519000' => 'OC-3',
|
||||
'155520000' => 'OC-3',
|
||||
'400000000' => '400 Mbps',
|
||||
'599040000' => 'ATM on OC-12',
|
||||
'622000000' => 'OC-12',
|
||||
'599040000' => 'OC-12',
|
||||
'622080000' => 'OC-12',
|
||||
'1000000000' => '1.0 Gbps',
|
||||
);
|
||||
)
|
||||
|
||||
munge_ip()
|
||||
Takes a binary IP and makes it dotted ASCII
|
||||
@@ -1133,6 +1173,7 @@ SNMP::INFO INTERNALS
|
||||
3. Method is in %FUNCS
|
||||
4. Run $info->_load_attr(method) if not cached
|
||||
5. Return $info->_show_attr(method).
|
||||
|
||||
Override any dynamic method listed in one of these hashes by creating a
|
||||
subroutine with the same name.
|
||||
|
||||
@@ -1141,8 +1182,11 @@ SNMP::INFO INTERNALS
|
||||
|
||||
COPYRIGHT AND LICENCE
|
||||
|
||||
Copyright (c) 2002-3, Regents of the University of California All rights
|
||||
reserved.
|
||||
Changes from SNMP::Info Version 0.7 and on are: Copyright (c)2003, 2004
|
||||
Max Baker - All rights reserved.
|
||||
|
||||
Original Code is: Copyright (c) 2002-3, 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
|
||||
|
||||
@@ -12,10 +12,31 @@ $matrix = parse_data($DevMatrix);
|
||||
|
||||
# Graph it for fun
|
||||
eval "use GraphViz::Data::Structure;";
|
||||
if ($@ or 1) {
|
||||
print "GraphViz::Data::Structure not installed.\n";
|
||||
if ($@) {
|
||||
print "GraphViz::Data::Structure not installed. $@\n";
|
||||
} else {
|
||||
my $gvds = GraphViz::Data::Structure->new($matrix);
|
||||
my %graph = ();
|
||||
foreach my $vendor (sort sort_nocase keys %$matrix){
|
||||
$graph{$vendor} = {};
|
||||
foreach my $family (sort sort_nocase keys %{$matrix->{$vendor}->{families}} ){
|
||||
my @models;
|
||||
foreach my $mod (keys %{$matrix->{$vendor}->{families}->{$family}->{models}}){
|
||||
push(@models,split(/\s*,\s*/,$mod));
|
||||
}
|
||||
if (scalar @models){
|
||||
$graph{$vendor}->{$family}=\@models;
|
||||
} else {
|
||||
$graph{$vendor}->{$family}=[];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
my $now = scalar localtime;
|
||||
my $gvds = GraphViz::Data::Structure->new(\%graph,Orientation=>'vertical',
|
||||
Colors=> 'Deep',
|
||||
graph => {label=>"SNMP::Info and Netdisco Supported Devices \n $now",'fontpath'=>'/usr/local/netdisco','fontname'=>'lucon',concentrate=>'true','overlap'=>'false',spline=>'true',bgcolor=>'wheat'},
|
||||
node => {fontname=>'lucon'},
|
||||
);
|
||||
$gvds->graph()->as_png($DevPNG);
|
||||
}
|
||||
|
||||
@@ -94,6 +115,7 @@ close (HTML) or die "Can't write $DevHTML. $!\n";
|
||||
# ( defaults => { cmd => [values] } )
|
||||
sub parse_data {
|
||||
my $file = shift;
|
||||
my %ignore = map { $_ => 1 } @_;
|
||||
my $Matrix;
|
||||
|
||||
my @Lines;
|
||||
@@ -124,6 +146,9 @@ sub parse_data {
|
||||
next;
|
||||
}
|
||||
|
||||
if (exists $ignore{$cmd}){
|
||||
print "Ignoring $cmd\n";
|
||||
}
|
||||
# Set Class {vendor,family,device}
|
||||
if ($cmd eq 'device-vendor'){
|
||||
$vendor = $value;
|
||||
@@ -225,6 +250,8 @@ sub html_tail {
|
||||
[<SPAN CLASS="family">Family Attribute</SPAN>]
|
||||
[<SPAN CLASS="vendor">Vendor Attribute</SPAN>]
|
||||
<h1>Attribute Key</h1>
|
||||
A value of <B>-</B> signifies the information is not specified and can
|
||||
be assumed working.
|
||||
<TABLE BORDER=1>
|
||||
<TR>
|
||||
<TD>Arpnip</TD>
|
||||
|
||||
Reference in New Issue
Block a user