added entity-mib to l2 and l3 classes. abstracted non cisco stuff from L3 to L3::Cisco and CiscoStats

This commit is contained in:
Max Baker
2005-01-18 01:59:19 +00:00
parent f9f4daea94
commit b6989e8ada
6 changed files with 119 additions and 83 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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