diff --git a/ChangeLog b/ChangeLog index 3d5bc570..3e2b7f1f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,11 @@ version 0.10 () + Added BulkWalk and BulkRepeaters options to new() * Added check for bulkwalk_no() method * Added 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 + * Added CISCO-ENTITY-VENDORTYPE-OID-MIB,CISCO-PRODUCTS-MIB,CISCO-STACK-MIB to CiscoStats.pm for model() + * Added Entity.pm to L3 and L2 classes per N. Petri's suggestion. + verison 0.9 (11/15/04) + ** Added full Nortel/Bay/BayStack support diff --git a/Info.pm b/Info.pm index d1e3bdfb..9e088db9 100644 --- a/Info.pm +++ b/Info.pm @@ -29,7 +29,7 @@ SNMP::Info - Object Oriented Perl5 Interface to Network devices and MIBs through =head1 VERSION -SNMP::Info - Version 0.9 +SNMP::Info - Version 0.10 =head1 AUTHOR @@ -534,6 +534,8 @@ Return Math::BigInt objects for 64 bit counters. Sets on a global scope, not ob Set to C<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) =item BulkRepeaters @@ -617,6 +619,13 @@ sub new { } # SNMP::Info specific args : + if (defined $args{Debug}){ + $new_obj->debug($args{Debug}); + delete $args{Debug}; + } else { + $new_obj->debug($DEBUG); + } + my $auto_specific = 0; if (defined $args{AutoSpecify}){ $auto_specific = $args{AutoSpecify} || 0; @@ -628,17 +637,17 @@ sub new { delete $args{BulkRepeaters}; } - if (defined $args{BulkWalk}){ + # Net-SNMP 5.1.x has a bug in BULKWALK. + if ($SNMP::VERSION =~ /^5\.1\.\d/) { + $new_obj->{BulkWalk} = 0; + print "SNMP::Info::new() BULKWALK disabled because of bug in Net-SNMP 5.1.x. Upgrade Net-SNMP.\n" + if $new_obj->debug(); + delete $args{BulkWalk} if exists $args{BulkWalk}; + } elsif (defined $args{BulkWalk}){ $new_obj->{BulkWalk} = $args{BulkWalk}; delete $args{BulkWalk}; } - if (defined $args{Debug}){ - $new_obj->debug($args{Debug}); - delete $args{Debug}; - } else { - $new_obj->debug($DEBUG); - } my $sess = undef; if (defined $args{Session}){ $sess = $args{Session}; @@ -2302,7 +2311,8 @@ sub _load_attr { my $vars = []; my $bulkwalk_no = $self->can('bulkwalk_no') ? $self->bulkwalk_no() : 0; - my $can_bulkwalk = (!$bulkwalk_no || 0) && ($self->{BulkWalk} || 1); + my $bulkwalk_on = defined $self->{BulkWalk} ? $self->{BulkWalk} : 1; + my $can_bulkwalk = $bulkwalk_on && !$bulkwalk_no; my $repeaters = $self->{BulkRepeaters} || $REPEATERS; my $bulkwalk = $can_bulkwalk && $ver != 1; diff --git a/Info/CiscoStats.pm b/Info/CiscoStats.pm index 9ee8bdc6..e1bdd7be 100644 --- a/Info/CiscoStats.pm +++ b/Info/CiscoStats.pm @@ -50,7 +50,11 @@ $INIT = 0; %MIBS = ( 'RFC1213-MIB' => 'sysDescr', 'CISCO-PROCESS-MIB' => 'cpmCPUTotal5sec', - 'CISCO-MEMORY-POOL-MIB' => 'ciscoMemoryPoolUsed' + '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', ); %GLOBALS = ( @@ -68,6 +72,8 @@ $INIT = 0; # CISCO-MEMORY-POOL-MIB 'mem_free' => 'ciscoMemoryPoolFree.1', 'mem_used' => 'ciscoMemoryPoolUsed.1', + # OLD-CISCO-SYSTEM-MIB + 'write_mem' => 'writeMem', ); %FUNCS = ( @@ -177,6 +183,8 @@ none. =over +=item CISCO-PRODUCTS-MIB + =item CISCO-PROCESS-MIB =item CISCO-MEMORY-POOL-MIB diff --git a/Info/Layer2.pm b/Info/Layer2.pm index 565df277..38359a01 100644 --- a/Info/Layer2.pm +++ b/Info/Layer2.pm @@ -40,10 +40,12 @@ use SNMP::Info; use SNMP::Info::Bridge; use SNMP::Info::CDP; use SNMP::Info::CiscoStats; +use SNMP::Info::Entity; use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %PORTSTAT %MUNGE $INIT/; -@SNMP::Info::Layer2::ISA = qw/SNMP::Info SNMP::Info::Bridge SNMP::Info::CDP SNMP::Info::CiscoStats Exporter/; +@SNMP::Info::Layer2::ISA = qw/SNMP::Info SNMP::Info::Bridge SNMP::Info::CDP + SNMP::Info::Entity SNMP::Info::CiscoStats Exporter/; @SNMP::Info::Layer2::EXPORT_OK = qw//; $DEBUG=0; @@ -53,13 +55,11 @@ $SNMP::debugging=$DEBUG; # 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 +%MIBS = ( %SNMP::Info::MIBS, + %SNMP::Info::Bridge::MIBS, + %SNMP::Info::CDP::MIBS, + %SNMP::Info::CiscoStats::MIBS, + %SNMP::Info::Entity::MIBS, ); %GLOBALS = ( @@ -67,6 +67,7 @@ $INIT = 0; %SNMP::Info::Bridge::GLOBALS, %SNMP::Info::CDP::GLOBALS, %SNMP::Info::CiscoStats::GLOBALS, + %SNMP::Info::Entity::GLOBALS, 'serial1' => '.1.3.6.1.4.1.9.3.6.3.0', # OLD-CISCO-CHASSIS-MIB::chassisId.0 ); @@ -75,8 +76,7 @@ $INIT = 0; %SNMP::Info::Bridge::FUNCS, %SNMP::Info::CDP::FUNCS, %SNMP::Info::CiscoStats::FUNCS, - 'ent_serial' => 'entPhysicalSerialNum', - 'ent_chassis'=> 'entPhysicalDescr', + %SNMP::Info::Entity::FUNCS, ); %MUNGE = ( @@ -85,6 +85,7 @@ $INIT = 0; %SNMP::Info::Bridge::MUNGE, %SNMP::Info::CDP::MUNGE, %SNMP::Info::CiscoStats::MUNGE, + %SNMP::Info::Entity::MUNGE, ); # Method OverRides @@ -125,12 +126,12 @@ sub vendor { sub serial { my $l2 = shift; - my $serial1 = $l2->serial1(); - my $ent_chassis = $l2->ent_chassis() || {}; - my $ent_serial = $l2->ent_serial() || {}; + my $serial1 = $l2->serial1(); + my $e_descr = $l2->e_descr() || {}; + my $e_serial = $l2->e_serial() || {}; - my $serial2 = $ent_serial->{1} || undef; - my $chassis = $ent_chassis->{1} || undef; + my $serial2 = $e_serial->{1} || undef; + my $chassis = $e_descr->{1} || undef; # precedence # serial2,chassis parse,serial1 @@ -247,27 +248,21 @@ a more specific class using the method above. =item SNMP::Info::CiscoStats +=item SNMP::Info::Entity + =back =head2 Required MIBs =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 at ftp://ftp.cisco.com/pub/mibs/v2/v2.tar.gz +MIBs can be found in netdisco-mibs package. =head1 GLOBALS @@ -308,6 +303,10 @@ See documentation in SNMP::Info::CDP for details. See documentation in SNMP::Info::CiscoStats for details. +=head2 Globals imported from SNMP::Info::Entity + +See documentation in SNMP::Info::Entity for details. + =head1 TABLE METHODS These are methods that return tables of information in the form of a reference @@ -347,4 +346,8 @@ See documentation in SNMP::Info::CDP for details. See documentation in SNMP::Info::CiscoStats for details. +=head2 Table Methods imported from SNMP::Info::Entity + +See documentation in SNMP::Info::Entity for details. + =cut diff --git a/Info/Layer3.pm b/Info/Layer3.pm index bd7f72cf..1f9ae2d9 100644 --- a/Info/Layer3.pm +++ b/Info/Layer3.pm @@ -37,15 +37,14 @@ 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::CDP SNMP::Info::Bridge - SNMP::Info::EtherLike SNMP::Info::CiscoStats Exporter/; +@SNMP::Info::Layer3::ISA = qw/SNMP::Info SNMP::Info::Bridge SNMP::Info::EtherLike + SNMP::Info::Entity Exporter/; @SNMP::Info::Layer3::EXPORT_OK = qw//; $DEBUG=0; @@ -55,21 +54,18 @@ $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, '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', @@ -77,10 +73,9 @@ $INIT = 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', # Address Translation Table (ARP Cache) @@ -88,17 +83,14 @@ $INIT = 0; 'at_paddr' => 'atPhysAddress', 'at_netaddr' => 'atNetAddress', 'ospf_ip' => 'ospfHostIpAddress', - '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, 'at_paddr' => \&SNMP::Info::munge_mac, ); @@ -133,7 +125,7 @@ sub i_ignore { my %i_ignore; foreach my $if (keys %$interfaces) { # lo -> cisco aironet 350 loopback - if ($interfaces->{$if} =~ /(tunnel|loopback|lo|null)/i){ + if ($interfaces->{$if} =~ /(tunnel|loopback|\blo\b|null)/i){ $i_ignore{$if}++; } } @@ -144,11 +136,11 @@ sub serial { my $l3 = shift; my $serial1 = $l3->serial1(); - my $ent_chassis = $l3->ent_chassis() || {}; - my $ent_serial = $l3->ent_serial() || {}; + my $e_descr = $l3->e_descr() || {}; + my $e_serial = $l3->e_serial() || {}; - my $serial2 = $ent_serial->{1} || undef; - my $chassis = $ent_chassis->{1} || undef; + my $serial2 = $e_serial->{1} || undef; + my $chassis = $e_descr->{1} || undef; # precedence # serial2,chassis parse,serial1 @@ -241,7 +233,7 @@ sub vendor { my $descr = $l3->description(); - return 'cisco' if ($descr =~ /(cisco|ios)/i); + return 'cisco' if ($descr =~ /(cisco|\bios\b)/i); return 'foundry' if ($descr =~ /foundry/i); } @@ -304,9 +296,7 @@ a more specific class using the method above. =item SNMP::Info::Bridge -=item SNMP::Info::CDP - -=item SNMP::Info::CiscoStats +For L2/L3 devices. =item SNMP::Info::EtherLike @@ -316,8 +306,6 @@ a more specific class using the method above. =over -=item CISCO-PRODUCTS-MIB - =item ENTITY-MIB =item OSPF-MIB @@ -328,7 +316,7 @@ MIBs required by the inherited classes listed above. =back -MIBs can be found at ftp://ftp.cisco.com/pub/mibs/v2/v2.tar.gz +MIBs can be found in the netdisco-mibs package. =head1 GLOBALS @@ -382,18 +370,14 @@ 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 @@ -464,16 +448,12 @@ 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 diff --git a/Info/Layer3/Cisco.pm b/Info/Layer3/Cisco.pm index edfb4efb..dd5e4226 100644 --- a/Info/Layer3/Cisco.pm +++ b/Info/Layer3/Cisco.pm @@ -35,9 +35,13 @@ use strict; use Exporter; use SNMP::Info::Layer3; use SNMP::Info::CiscoVTP; +use SNMP::Info::CDP; +use SNMP::Info::CiscoStats; use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %MUNGE $INIT/ ; -@SNMP::Info::Layer3::Cisco::ISA = qw/SNMP::Info::Layer3 SNMP::Info::CiscoVTP Exporter/; +@SNMP::Info::Layer3::Cisco::ISA = qw/SNMP::Info::Layer3 SNMP::Info::CiscoVTP + SNMP::Info::CDP SNMP::Info::CiscoStats + Exporter/; @SNMP::Info::Layer3::Cisco::EXPORT_OK = qw//; $DEBUG=0; @@ -47,33 +51,40 @@ $DEBUG=0; $INIT = 0; %MIBS = ( - %SNMP::Info::Layer3::MIBS, - %SNMP::Info::CiscoVTP::MIBS, + %SNMP::Info::Layer3::MIBS, + %SNMP::Info::CiscoVTP::MIBS, + %SNMP::Info::CDP::MIBS, + %SNMP::Info::CiscoStats::MIBS, ); %GLOBALS = ( %SNMP::Info::Layer3::GLOBALS, %SNMP::Info::CiscoVTP::GLOBALS, + %SNMP::Info::CDP::GLOBALS, + %SNMP::Info::CiscoStats::GLOBALS, ); %FUNCS = ( %SNMP::Info::Layer3::FUNCS, %SNMP::Info::CiscoVTP::FUNCS, + %SNMP::Info::CDP::FUNCS, + %SNMP::Info::CiscoStats::FUNCS, ); %MUNGE = ( - # Inherit all the built in munging %SNMP::Info::Layer3::MUNGE, %SNMP::Info::CiscoVTP::MUNGE, + %SNMP::Info::CDP::MUNGE, + %SNMP::Info::CiscoStats::MUNGE, ); - 1; __END__ =head1 NAME -SNMP::Info::Layer3::Cisco - Perl5 Interface to Generic L3 Cisco Device +SNMP::Info::Layer3::Cisco - Perl5 Interface to L3 and L2+L3 IOS Cisco Device +that are not covered in other classes. =head1 AUTHOR @@ -107,6 +118,10 @@ Subclass for Generic Cisco Routers running IOS =item SNMP::Info::CiscoVTP +=item SNMP::Info::CDP + +=item SNMP::Info::CiscoStats + =back =head2 Required MIBs @@ -141,6 +156,13 @@ 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. =head1 TABLE ENTRIES @@ -155,4 +177,12 @@ 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. + =cut