From e4e039e2e11599730b3adbc559582f98b04821ca Mon Sep 17 00:00:00 2001 From: Max Baker <> Date: Thu, 6 Mar 2003 21:56:22 +0000 Subject: [PATCH] ver_03 --- ChangeLog | 13 +++++++++++++ Info.pm | 32 +++++++++++++++++++++++++++----- README | 16 ++++++++++++---- 3 files changed, 52 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 58855833..6671f4dc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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 + * 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 + * 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 diff --git a/Info.pm b/Info.pm index 16eb6fa3..26b95c29 100644 --- a/Info.pm +++ b/Info.pm @@ -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 @@ -82,7 +82,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # Find out the Duplex status for the ports 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,8 +94,12 @@ 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"; + } =head1 REQUIREMENTS @@ -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}){ diff --git a/README b/README index 02b3e57d..3c96f3a4 100644 --- a/README +++ b/README @@ -4,7 +4,7 @@ NAME VERSION - SNMP::Info - Version 0.2 + SNMP::Info - Version 0.3 AUTHOR @@ -61,7 +61,11 @@ SYNOPSIS # Find out the Duplex status for the ports 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,8 +73,12 @@ 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"; + } REQUIREMENTS