This commit is contained in:
Max Baker
2003-03-06 21:56:22 +00:00
parent 6dac5dffb3
commit e4e039e2e1
3 changed files with 52 additions and 9 deletions

View File

@@ -1,6 +1,19 @@
SNMP::Info - Perl5 OO Interface to Network Devices and SNMP MIBs
ChangeLog $Id$
version 0.3 (03/06/03)
* Fixed HP model() warning
* Added error checking for responses of NOSUCHOBJECT and NOSUCHINSTANCE in _global
and _load_attr
* Added more debugging
* Added info and munging for c_capabilities in SNMP::Info::CD
Thanks to Martin Lorensen <martin@lorensen.dk>
* Removed requirement for SNMP in the Makefile.PL and moved it to t/prereq.t
so that the Module will install via CPAN without trying to install the old
4.2.0 version of SNMP on CPAN. Will now fail in the test phase.
Thanks again to Martin Lorensen <martin@lorensen.dk>
* Moved tests from test.pl to t/*
version 0.2 (02/19/03)
* Added put_() methods and support for SNMP put commands
* Added SNMP::Info::Layer3::C3550 class for Cisco Catalyst 3550

28
Info.pm
View File

@@ -7,7 +7,7 @@
# See COPYRIGHT below
package SNMP::Info;
$VERSION = 0.2;
$VERSION = 0.3;
use strict;
use Exporter;
@@ -27,7 +27,7 @@ SNMP::Info - Perl5 Interface to Network devices through SNMP.
=head1 VERSION
SNMP::Info - Version 0.2
SNMP::Info - Version 0.3
=head1 AUTHOR
@@ -83,6 +83,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
my $interfaces = $more_specific_device->interfaces();
my $i_duplex = $more_specific_device->i_duplex();
# Get CDP Neighbor info
my $c_ip = $more_specific_device->c_ip();
my $c_port = $more_specific_device->c_port();
foreach my $iid (keys %$interfaces){
my $duplex = $i_duplex->{$iid};
@@ -90,7 +94,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# Print out physical port name, not snmp iid
my $port = $interfaces->{$iid};
print "$port : $duplex\n";
my $neighbor_ip = $c_ip->{$iid};
my $neighbor_port = $c_port->{$iid};
print "$port: Duplex $duplex\n";
print " Neighbor : $neighbor_ip \@ $neighbor_port\n";
}
@@ -1156,6 +1164,11 @@ sub _global{
$DEBUG and print "SNMP::Info::_global($attr) NOSUCHOBJECT\n";
return undef;
}
if (defined $val and $val eq 'NOSUCHINSTANCE'){
$DEBUG and print "SNMP::Info::_global($attr) NOSUCHINSTANCE\n";
return undef;
}
# Get the callback hash for data munging
my $munge = $self->munge();
@@ -1294,6 +1307,15 @@ sub _load_attr {
next;
}
if ($val eq 'NOSUCHOBJECT'){
$DEBUG and print "SNMP::Info::_load_atr: $attr : NOSUCHOBJECT\n" ;
next;
}
if ($val eq 'NOSUCHINSTANCE'){
$DEBUG and print "SNMP::Info::_load_atr: $attr : NOSUCHINSTANCE\n" ;
next;
}
# Data Munging
# Checks for an entry in %munge and runs the subroutine
if (defined $munge->{$attr}){

12
README
View File

@@ -4,7 +4,7 @@ NAME
VERSION
SNMP::Info - Version 0.2
SNMP::Info - Version 0.3
AUTHOR
@@ -62,6 +62,10 @@ SYNOPSIS
my $interfaces = $more_specific_device->interfaces();
my $i_duplex = $more_specific_device->i_duplex();
# Get CDP Neighbor info
my $c_ip = $more_specific_device->c_ip();
my $c_port = $more_specific_device->c_port();
foreach my $iid (keys %$interfaces){
my $duplex = $i_duplex->{$iid};
@@ -69,7 +73,11 @@ SYNOPSIS
# Print out physical port name, not snmp iid
my $port = $interfaces->{$iid};
print "$port : $duplex\n";
my $neighbor_ip = $c_ip->{$iid};
my $neighbor_port = $c_port->{$iid};
print "$port: Duplex $duplex\n";
print " Neighbor : $neighbor_ip \@ $neighbor_port\n";
}