Compare commits
	
		
			27 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					ea7eb9c71f | ||
| 
						 | 
					e4e039e2e1 | ||
| 
						 | 
					6dac5dffb3 | ||
| 
						 | 
					ddeb705f13 | ||
| 
						 | 
					b86cf86fa6 | ||
| 
						 | 
					0cd3ba27c0 | ||
| 
						 | 
					fe6157f900 | ||
| 
						 | 
					b4c1bf0900 | ||
| 
						 | 
					7f2e79c634 | ||
| 
						 | 
					947c8679c8 | ||
| 
						 | 
					919906516d | ||
| 
						 | 
					ad70c2345e | ||
| 
						 | 
					3035a9df7a | ||
| 
						 | 
					556441ba09 | ||
| 
						 | 
					97eeeb4ae4 | ||
| 
						 | 
					e0c1c79ce8 | ||
| 
						 | 
					c5fe50aa67 | ||
| 
						 | 
					7d29cf4c13 | ||
| 
						 | 
					7a8967d924 | ||
| 
						 | 
					c5b1b3c3d2 | ||
| 
						 | 
					95912047f7 | ||
| 
						 | 
					a1286a02f9 | ||
| 
						 | 
					543fc51d2f | ||
| 
						 | 
					e2b0f18b28 | ||
| 
						 | 
					2b56fdbb85 | ||
| 
						 | 
					3371ef7727 | ||
| 
						 | 
					fd7cf06a07 | 
@@ -1,4 +1,4 @@
 | 
				
			|||||||
Copyright (c) 2002, Regents of the University of California
 | 
					Copyright (c) 2002,2003 Regents of the University of California
 | 
				
			||||||
All rights reserved.
 | 
					All rights reserved.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Redistribution and use in source and binary forms, with or without 
 | 
					Redistribution and use in source and binary forms, with or without 
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										44
									
								
								ChangeLog
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								ChangeLog
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,44 @@
 | 
				
			|||||||
 | 
					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
 | 
				
			||||||
 | 
					    * Fixed HP Detection in device_type()
 | 
				
			||||||
 | 
					    * Added Spanning Tree Protocol (STP) methods to SNMP::Info::Bridge
 | 
				
			||||||
 | 
					    * Removed HP Specific MIBS in SNMP::Info::Layer2 and cleaned up model()
 | 
				
			||||||
 | 
					    * Added poke for Bay 450 Switches 
 | 
				
			||||||
 | 
					    * Mapped HP Part Numbers to model numbers J4812A => 2512 in SNMP::Info::Layer2::HP
 | 
				
			||||||
 | 
					     
 | 
				
			||||||
 | 
					version 0.1 (12/30/02)
 | 
				
			||||||
 | 
					    * Initial Release
 | 
				
			||||||
 | 
					    * SubClasses Included:
 | 
				
			||||||
 | 
					        * SNMP::Info::Bridge
 | 
				
			||||||
 | 
					        * SNMP::Info::CDP
 | 
				
			||||||
 | 
					        * SNMP::Info::EtherLike
 | 
				
			||||||
 | 
					        * SNMP::Info::MAU
 | 
				
			||||||
 | 
					        * SNMP::Info::Layer1
 | 
				
			||||||
 | 
					              o SNMP::Info::Layer1::Allied
 | 
				
			||||||
 | 
					              o SNMP::Info::Layer1::Asante 
 | 
				
			||||||
 | 
					        * SNMP::Info::Layer2
 | 
				
			||||||
 | 
					              o SNMP::Info::Layer2::Bay
 | 
				
			||||||
 | 
					              o SNMP::Info::Layer2::C1900
 | 
				
			||||||
 | 
					              o SNMP::Info::Layer2::C2900
 | 
				
			||||||
 | 
					              o SNMP::Info::Layer2::Catalyst
 | 
				
			||||||
 | 
					              o SNMP::Info::Layer2::HP 
 | 
				
			||||||
 | 
					        * SNMP::Info::Layer3
 | 
				
			||||||
 | 
					              o SNMP::Info::Layer3::Aironet
 | 
				
			||||||
 | 
					              o SNMP::Info::Layer3::Foundry
 | 
				
			||||||
							
								
								
									
										169
									
								
								Info.pm
									
									
									
									
									
								
							
							
						
						
									
										169
									
								
								Info.pm
									
									
									
									
									
								
							@@ -1,12 +1,13 @@
 | 
				
			|||||||
# SNMP::Info - Max Baker <max@warped.org>
 | 
					# SNMP::Info - Max Baker <max@warped.org>
 | 
				
			||||||
 | 
					# $Id$
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# Copyright (c) 2002, Regents of the University of California
 | 
					# Copyright (c) 2002-3, Regents of the University of California
 | 
				
			||||||
# All rights reserved.  
 | 
					# All rights reserved.  
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# See COPYRIGHT below 
 | 
					# See COPYRIGHT below 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
package SNMP::Info;
 | 
					package SNMP::Info;
 | 
				
			||||||
$VERSION = 0.1;
 | 
					$VERSION = 0.3;
 | 
				
			||||||
use strict;
 | 
					use strict;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use Exporter;
 | 
					use Exporter;
 | 
				
			||||||
@@ -26,7 +27,7 @@ SNMP::Info - Perl5 Interface to Network devices through SNMP.
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
=head1 VERSION
 | 
					=head1 VERSION
 | 
				
			||||||
 | 
					
 | 
				
			||||||
SNMP::Info - Version 0.1
 | 
					SNMP::Info - Version 0.3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=head1 AUTHOR
 | 
					=head1 AUTHOR
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -36,7 +37,7 @@ SNMP::Info was created for the Netdisco application at UCSC
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
=head1 COPYRIGHT AND LICENCE
 | 
					=head1 COPYRIGHT AND LICENCE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Copyright (c) 2002, Regents of the University of California
 | 
					Copyright (c) 2002-3, Regents of the University of California
 | 
				
			||||||
All rights reserved.
 | 
					All rights reserved.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Redistribution and use in source and binary forms, with or without 
 | 
					Redistribution and use in source and binary forms, with or without 
 | 
				
			||||||
@@ -81,7 +82,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
				
			|||||||
 # Find out the Duplex status for the ports
 | 
					 # Find out the Duplex status for the ports
 | 
				
			||||||
 my $interfaces = $more_specific_device->interfaces();
 | 
					 my $interfaces = $more_specific_device->interfaces();
 | 
				
			||||||
 my $i_duplex   = $more_specific_device->i_duplex();
 | 
					 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){
 | 
					 foreach my $iid (keys %$interfaces){
 | 
				
			||||||
 
 | 
					 
 | 
				
			||||||
    my $duplex = $i_duplex->{$iid};
 | 
					    my $duplex = $i_duplex->{$iid};
 | 
				
			||||||
@@ -89,8 +94,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
				
			|||||||
    # Print out physical port name, not snmp iid
 | 
					    # Print out physical port name, not snmp iid
 | 
				
			||||||
    my $port  = $interfaces->{$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
 | 
					=head1 REQUIREMENTS
 | 
				
			||||||
@@ -208,6 +217,8 @@ back to the developers at snmp@warped.org for inclusion in the next version.
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
=item SNMP::Info::Layer3::Foundry
 | 
					=item SNMP::Info::Layer3::Foundry
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=item SNMP::Info::Layer3::C3550
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=back
 | 
					=back
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=head2 Details
 | 
					=head2 Details
 | 
				
			||||||
@@ -313,6 +324,9 @@ Required MIBs:
 | 
				
			|||||||
 AWCVX-MIB        - Aironet Specific MIB values
 | 
					 AWCVX-MIB        - Aironet Specific MIB values
 | 
				
			||||||
 IEEE802dot11-MIB - IEEE 802.11 Specific MIB (currently draft)
 | 
					 IEEE802dot11-MIB - IEEE 802.11 Specific MIB (currently draft)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=item * SNMP::Info::Layer3::C3550 - Cisco Catalyst 3550 Layer2/3 Switch
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=item * SNMP::Info::Layer3::Foundry - Older Foundry Networks Devices Support
 | 
					=item * SNMP::Info::Layer3::Foundry - Older Foundry Networks Devices Support
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Inherits SNMP::Info::Bridge
 | 
					Inherits SNMP::Info::Bridge
 | 
				
			||||||
@@ -376,6 +390,8 @@ sub new {
 | 
				
			|||||||
    unless (defined $sess){
 | 
					    unless (defined $sess){
 | 
				
			||||||
        # How do i get error messages back from SNMP?
 | 
					        # How do i get error messages back from SNMP?
 | 
				
			||||||
        #print $SNMP::ErrorStr;
 | 
					        #print $SNMP::ErrorStr;
 | 
				
			||||||
 | 
					        print "SNMP::Info::new() $sess->{ErrorStr}\n" 
 | 
				
			||||||
 | 
					            if ($DEBUG and $sess->{ErrorStr});
 | 
				
			||||||
        return undef;
 | 
					        return undef;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -422,14 +438,15 @@ SNMP::Info is returned.
 | 
				
			|||||||
Algorithm for SubClass Detection:
 | 
					Algorithm for SubClass Detection:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        Layer3 Support                     -> SNMP::Info::Layer3
 | 
					        Layer3 Support                     -> SNMP::Info::Layer3
 | 
				
			||||||
            Foundry                        -> SNMP::Info::Foundry
 | 
					            Aironet                        -> SNMP::Info::Layer3::Aironet
 | 
				
			||||||
            Aironet                        -> SNMP::Info::Aironet
 | 
					            Catalyst 3550                  -> SNMP::Info::Layer3::C3550
 | 
				
			||||||
 | 
					            Foundry                        -> SNMP::Info::Layer3::Foundry
 | 
				
			||||||
        Elsif Layer2 (no Layer3)           -> SNMP::Info::Layer2 
 | 
					        Elsif Layer2 (no Layer3)           -> SNMP::Info::Layer2 
 | 
				
			||||||
 | 
					            Bay Networks                   -> SNMP::Info::Layer2::Bay
 | 
				
			||||||
            Catalyst 1900                  -> SNMP::Info::Layer2::C1900
 | 
					            Catalyst 1900                  -> SNMP::Info::Layer2::C1900
 | 
				
			||||||
            Catalyst 2900XL (IOS)          -> SNMP::Info::Layer2::C2900
 | 
					            Catalyst 2900XL (IOS)          -> SNMP::Info::Layer2::C2900
 | 
				
			||||||
            Catalyst WS-C (2926,5xxx,6xxx) -> SNMP::Info::Layer2::Catalyst
 | 
					            Catalyst WS-C (2926,5xxx,6xxx) -> SNMP::Info::Layer2::Catalyst
 | 
				
			||||||
            HP Procurve                    -> SNMP::Info::Layer2::HP
 | 
					            HP Procurve                    -> SNMP::Info::Layer2::HP
 | 
				
			||||||
            Bay Networks                   -> SNMP::Info::Layer2::Bay
 | 
					 | 
				
			||||||
        Elsif Layer1 Support               -> SNMP::Info::Layer1
 | 
					        Elsif Layer1 Support               -> SNMP::Info::Layer1
 | 
				
			||||||
            Allied                         -> SNMP::Info::Layer1::Allied
 | 
					            Allied                         -> SNMP::Info::Layer1::Allied
 | 
				
			||||||
            Asante                         -> SNMP::Info::Layer1::Asante
 | 
					            Asante                         -> SNMP::Info::Layer1::Asante
 | 
				
			||||||
@@ -442,11 +459,11 @@ sub device_type {
 | 
				
			|||||||
    my $objtype = "SNMP::Info";
 | 
					    my $objtype = "SNMP::Info";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    my $layers = $info->layers();
 | 
					    my $layers = $info->layers();
 | 
				
			||||||
    my $desc   = $info->description();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # if we dont have sysServices, we dont have anything else either probably.
 | 
					    # if we dont have sysServices, we dont have anything else either probably.
 | 
				
			||||||
    return undef unless (defined $layers and length($layers));
 | 
					    return undef unless (defined $layers and length($layers));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    my $desc   = $info->description();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Layer 3 Supported 
 | 
					    # Layer 3 Supported 
 | 
				
			||||||
    #   (usually has layer2 as well, so we check for 3 first)
 | 
					    #   (usually has layer2 as well, so we check for 3 first)
 | 
				
			||||||
    if ($info->has_layer(3)) {
 | 
					    if ($info->has_layer(3)) {
 | 
				
			||||||
@@ -456,6 +473,7 @@ sub device_type {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        return $objtype unless (defined $desc and length($desc));
 | 
					        return $objtype unless (defined $desc and length($desc));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $objtype = 'SNMP::Info::Layer3::C3550'   if $desc =~ /C3550/ ;
 | 
				
			||||||
        $objtype = 'SNMP::Info::Layer3::Foundry' if $desc =~ /foundry/i ;
 | 
					        $objtype = 'SNMP::Info::Layer3::Foundry' if $desc =~ /foundry/i ;
 | 
				
			||||||
        $objtype = 'SNMP::Info::Layer3::Aironet' if ($desc =~ /cisco/i and $desc =~ /\D3[45]0\D/) ;
 | 
					        $objtype = 'SNMP::Info::Layer3::Aironet' if ($desc =~ /cisco/i and $desc =~ /\D3[45]0\D/) ;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -476,8 +494,8 @@ sub device_type {
 | 
				
			|||||||
        #   Catalyst WS-C series override (2926,5xxx,6xxx)
 | 
					        #   Catalyst WS-C series override (2926,5xxx,6xxx)
 | 
				
			||||||
        $objtype = 'SNMP::Info::Layer2::Catalyst' if ($desc =~ /WS-C\d{4}/);
 | 
					        $objtype = 'SNMP::Info::Layer2::Catalyst' if ($desc =~ /WS-C\d{4}/);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        #   HP ProCurve 
 | 
					        #   HP
 | 
				
			||||||
        $objtype = 'SNMP::Info::Layer2::HP' if ($desc =~ /procurve/i); 
 | 
					        $objtype = 'SNMP::Info::Layer2::HP' if ($desc =~ /hp/i); 
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
        #  Bay Switch
 | 
					        #  Bay Switch
 | 
				
			||||||
        $objtype = 'SNMP::Info::Layer2::Bay' if ($desc =~ /bay/i);
 | 
					        $objtype = 'SNMP::Info::Layer2::Bay' if ($desc =~ /bay/i);
 | 
				
			||||||
@@ -937,7 +955,7 @@ sub munge_ip {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
=item munge_mac()
 | 
					=item munge_mac()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Takes an octet stream and returns a colon separated ASCII hex string.
 | 
					Takes an octet stream (HEX-STRING) and returns a colon separated ASCII hex string.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=cut
 | 
					=cut
 | 
				
			||||||
sub munge_mac {
 | 
					sub munge_mac {
 | 
				
			||||||
@@ -1137,6 +1155,20 @@ sub _global{
 | 
				
			|||||||
    $DEBUG and print "SNMP::Info::_global $attr : $oid\n";
 | 
					    $DEBUG and print "SNMP::Info::_global $attr : $oid\n";
 | 
				
			||||||
    my $val = $sess->get($oid); 
 | 
					    my $val = $sess->get($oid); 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if ($sess->{ErrorStr} ){
 | 
				
			||||||
 | 
					        $DEBUG and print "SNMP::Info::_global($attr) $sess->{ErrorStr}\n";
 | 
				
			||||||
 | 
					        return undef;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if (defined $val and $val eq 'NOSUCHOBJECT'){
 | 
				
			||||||
 | 
					        $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
 | 
					    # Get the callback hash for data munging
 | 
				
			||||||
    my $munge = $self->munge();
 | 
					    my $munge = $self->munge();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1149,6 +1181,50 @@ sub _global{
 | 
				
			|||||||
    return $val;
 | 
					    return $val;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=item $info->_set(attr,val,iid)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Used internally by AUTOLOAD to run an SNMP set command for dynamic methods listed in 
 | 
				
			||||||
 | 
					either %GLOBALS or %FUNCS.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Example:  $info->set_name('dog',3) uses autoload to resolve to $info->_set('name','dog',3);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=cut
 | 
				
			||||||
 | 
					sub _set {
 | 
				
			||||||
 | 
					    my ($self,$attr,$val,$iid) = @_;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    $iid = defined $iid ? $iid : '.0';
 | 
				
			||||||
 | 
					    # prepend dot if necessary to $iid
 | 
				
			||||||
 | 
					    $iid = ".$iid" unless $iid =~ /^\./;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    my $sess = $self->{sess};
 | 
				
			||||||
 | 
					    return undef unless defined $sess;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    my $funcs = $self->funcs();
 | 
				
			||||||
 | 
					    my $globals = $self->globals(); 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    my $oid = undef;
 | 
				
			||||||
 | 
					    # Lookup oid
 | 
				
			||||||
 | 
					    $oid = $globals->{$attr} if defined $globals->{$attr};
 | 
				
			||||||
 | 
					    $oid = $funcs->{$attr} if defined $funcs->{$attr};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    unless (defined $oid) { 
 | 
				
			||||||
 | 
					        print "SNMP::Info::_set($attr,$val) - Failed to find $attr in \%GLOBALS or \%FUNCS \n";
 | 
				
			||||||
 | 
					        return undef;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    $oid .= $iid;
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    print "SNMP::Info::_set $attr$iid ($oid) = $val\n" if $DEBUG;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    my $rv = $sess->set($oid,$val);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    print "SNMP::Info::_set $attr$iid $sess->{ErrorStr}\n"
 | 
				
			||||||
 | 
					        if ($DEBUG and $sess->{ErrorStr});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return $rv;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=back
 | 
					=back
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=head3 Functions for SNMP Tables (%FUNCS)
 | 
					=head3 Functions for SNMP Tables (%FUNCS)
 | 
				
			||||||
@@ -1231,6 +1307,15 @@ sub _load_attr {
 | 
				
			|||||||
            next;
 | 
					            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
 | 
					        # Data Munging
 | 
				
			||||||
        #   Checks for an entry in %munge and runs the subroutine
 | 
					        #   Checks for an entry in %munge and runs the subroutine
 | 
				
			||||||
        if (defined $munge->{$attr}){
 | 
					        if (defined $munge->{$attr}){
 | 
				
			||||||
@@ -1297,6 +1382,7 @@ Example :
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
=cut
 | 
					=cut
 | 
				
			||||||
sub AUTOLOAD {
 | 
					sub AUTOLOAD {
 | 
				
			||||||
 | 
					    my $self = shift;
 | 
				
			||||||
    my $sub_name = $AUTOLOAD;
 | 
					    my $sub_name = $AUTOLOAD;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return if $sub_name =~ /DESTROY$/;
 | 
					    return if $sub_name =~ /DESTROY$/;
 | 
				
			||||||
@@ -1307,40 +1393,45 @@ sub AUTOLOAD {
 | 
				
			|||||||
    $sub_name =~ s/.*://;   
 | 
					    $sub_name =~ s/.*://;   
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    my $attr = $sub_name;
 | 
					    my $attr = $sub_name;
 | 
				
			||||||
    $attr =~ s/^load_//;
 | 
					    $attr =~ s/^(load|set)_//;
 | 
				
			||||||
 | 
					 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    # Let's use the %GLOBALS and %FUNCS from the class that 
 | 
					    # Let's use the %GLOBALS and %FUNCS from the class that 
 | 
				
			||||||
    #   inherited us.
 | 
					    #   inherited us.
 | 
				
			||||||
    no strict 'refs';
 | 
					    my (%funcs,%globals);
 | 
				
			||||||
    my %funcs = %{$package.'FUNCS'};
 | 
					    {
 | 
				
			||||||
    my %globals = %{$package.'GLOBALS'};
 | 
					        no strict 'refs';
 | 
				
			||||||
 | 
					        %funcs = %{$package.'FUNCS'};
 | 
				
			||||||
    return unless( defined $funcs{$attr} or
 | 
					        %globals = %{$package.'GLOBALS'};
 | 
				
			||||||
                   defined $globals{$attr} );
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    my $self = shift;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # First check %GLOBALS and return _scalar(global)
 | 
					 | 
				
			||||||
    if (defined $globals{$attr}) {
 | 
					 | 
				
			||||||
        return $self->_global( $attr );
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Next see if we're load_ ing.
 | 
					    unless( defined $funcs{$attr} or
 | 
				
			||||||
 | 
					            defined $globals{$attr} ) {
 | 
				
			||||||
 | 
					        #print "$attr not found in ",join(',',keys %funcs),"\n";
 | 
				
			||||||
 | 
					        return;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    # Check for load_ ing.
 | 
				
			||||||
    if ($sub_name =~ /^load_/){
 | 
					    if ($sub_name =~ /^load_/){
 | 
				
			||||||
        $self->_load_attr( $attr,$funcs{$attr} );
 | 
					        $self->_load_attr( $attr,$funcs{$attr} );
 | 
				
			||||||
        return $self->_show_attr( $attr ) if defined wantarray;
 | 
					        return $self->_show_attr( $attr ) if defined wantarray;
 | 
				
			||||||
    
 | 
					    } 
 | 
				
			||||||
    # Otherwise we must be listed in %FUNCS 
 | 
					 | 
				
			||||||
    } else {
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Load data if not already cached
 | 
					    if ($sub_name =~ /^set_/){
 | 
				
			||||||
        $self->_load_attr( $attr, $funcs{$attr} )
 | 
					        return $self->_set( $attr, @_);
 | 
				
			||||||
            unless defined $self->{"_${attr}"};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        return $self->_show_attr($attr);
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # First check %GLOBALS and return _scalar(global)
 | 
				
			||||||
 | 
					    if (defined $globals{$attr} ){
 | 
				
			||||||
 | 
					        return $self->_global( $attr );
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Otherwise we must be listed in %FUNCS 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Load data if not already cached
 | 
				
			||||||
 | 
					    $self->_load_attr( $attr, $funcs{$attr} )
 | 
				
			||||||
 | 
					        unless defined $self->{"_${attr}"};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return $self->_show_attr($attr);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
1;
 | 
					1;
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										132
									
								
								Info/Bridge.pm
									
									
									
									
									
								
							
							
						
						
									
										132
									
								
								Info/Bridge.pm
									
									
									
									
									
								
							@@ -1,7 +1,7 @@
 | 
				
			|||||||
# SNMP::Info::Bridge
 | 
					# SNMP::Info::Bridge
 | 
				
			||||||
# Max Baker <max@warped.org>
 | 
					# Max Baker <max@warped.org>
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# Copyright (c) 2002, Regents of the University of California
 | 
					# Copyright (c) 2002,2003 Regents of the University of California
 | 
				
			||||||
# All rights reserved.
 | 
					# All rights reserved.
 | 
				
			||||||
# 
 | 
					# 
 | 
				
			||||||
# Redistribution and use in source and binary forms, with or without 
 | 
					# Redistribution and use in source and binary forms, with or without 
 | 
				
			||||||
@@ -28,7 +28,8 @@
 | 
				
			|||||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
					# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
package SNMP::Info::Bridge;
 | 
					package SNMP::Info::Bridge;
 | 
				
			||||||
$VERSION = 0.1;
 | 
					$VERSION = 0.3;
 | 
				
			||||||
 | 
					# $Id$
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use strict;
 | 
					use strict;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -47,7 +48,11 @@ $INIT = 0;
 | 
				
			|||||||
%GLOBALS = (
 | 
					%GLOBALS = (
 | 
				
			||||||
            'b_mac'   => 'dot1dBaseBridgeAddress',
 | 
					            'b_mac'   => 'dot1dBaseBridgeAddress',
 | 
				
			||||||
            'b_ports' => 'dot1dBaseNumPorts',
 | 
					            'b_ports' => 'dot1dBaseNumPorts',
 | 
				
			||||||
            'b_type'  => 'dot1dBaseType'
 | 
					            'b_type'  => 'dot1dBaseType',
 | 
				
			||||||
 | 
					            # Spanning Tree Protocol
 | 
				
			||||||
 | 
					            'stp_ver' => 'dot1dStpProtocolSpecification',
 | 
				
			||||||
 | 
					            'stp_time' => 'dot1dStpTimeSinceTopologyChange',
 | 
				
			||||||
 | 
					            'stp_root' => 'dot1dStpDesignatedRoot',
 | 
				
			||||||
           );
 | 
					           );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
%FUNCS = (
 | 
					%FUNCS = (
 | 
				
			||||||
@@ -63,16 +68,47 @@ $INIT = 0;
 | 
				
			|||||||
          'bs_port'   => 'dot1dStaticReceivePort',
 | 
					          'bs_port'   => 'dot1dStaticReceivePort',
 | 
				
			||||||
          'bs_to'     => 'dot1dStaticAllowedToGoTo',
 | 
					          'bs_to'     => 'dot1dStaticAllowedToGoTo',
 | 
				
			||||||
          'bs_status' => 'dot1dStaticStatus',
 | 
					          'bs_status' => 'dot1dStaticStatus',
 | 
				
			||||||
 | 
					          # Spanning Tree Protocol Table : dot1dStpPortTable
 | 
				
			||||||
 | 
					          'stp_p_id'       => 'dot1dStpPort',
 | 
				
			||||||
 | 
					          'stp_p_priority' => 'dot1dStpPortPriority',
 | 
				
			||||||
 | 
					          'stp_p_state'    => 'dot1dStpPortState',
 | 
				
			||||||
 | 
					          'stp_p_cost'     => 'dot1dStpPortPathCost',
 | 
				
			||||||
 | 
					          'stp_p_root'     => 'dot1dStpPortDesignatedRoot',
 | 
				
			||||||
 | 
					          'stp_p_bridge'   => 'dot1dStpPortDesignatedBridge',
 | 
				
			||||||
 | 
					          'stp_p_port'     => 'dot1dStpPortDesignatedPort',
 | 
				
			||||||
          );
 | 
					          );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
%MUNGE = (
 | 
					%MUNGE = (
 | 
				
			||||||
          # Inherit all the built in munging
 | 
					          # Inherit all the built in munging
 | 
				
			||||||
          %SNMP::Info::MUNGE,
 | 
					          %SNMP::Info::MUNGE,
 | 
				
			||||||
          # Add ones for our class
 | 
					          # Add ones for our class
 | 
				
			||||||
          'fw_mac' => \&SNMP::Info::munge_mac,
 | 
					          'fw_mac'       => \&SNMP::Info::munge_mac,
 | 
				
			||||||
          'bs_mac' => \&SNMP::Info::munge_mac,
 | 
					          'bs_mac'       => \&SNMP::Info::munge_mac,
 | 
				
			||||||
 | 
					          'stp_root'     => \&SNMP::Info::munge_mac,
 | 
				
			||||||
 | 
					          'stp_p_root'   => \&SNMP::Info::munge_mac,
 | 
				
			||||||
 | 
					          'stp_p_bridge' => \&SNMP::Info::munge_mac,
 | 
				
			||||||
 | 
					          'stp_p_port'   => \&SNMP::Info::munge_mac
 | 
				
			||||||
         );
 | 
					         );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					sub i_stp_state {
 | 
				
			||||||
 | 
					    my $bridge = shift;
 | 
				
			||||||
 | 
					    my $bp_index = $bridge->bp_index();
 | 
				
			||||||
 | 
					    my $stp_p_state = $bridge->stp_p_state();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    my %i_stp_state;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    foreach my $index (keys %$stp_p_state){
 | 
				
			||||||
 | 
					        my $state = $stp_p_state->{$index};
 | 
				
			||||||
 | 
					        my $iid   = $bp_index->{$index};
 | 
				
			||||||
 | 
					        next unless defined $iid;
 | 
				
			||||||
 | 
					        next unless defined $state;
 | 
				
			||||||
 | 
					        $i_stp_state{$iid}=$state;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return \%i_stp_state;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
1;
 | 
					1;
 | 
				
			||||||
__END__
 | 
					__END__
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -148,6 +184,24 @@ Returns the type? of the device
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
(B<dot1dBaseType>)
 | 
					(B<dot1dBaseType>)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=item $bridge->stp_ver()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Returns what version of STP the device is running.  Either decLb100 or ieee8021d.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(B<dot1dStpProtocolSpecification>)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=item $bridge->stp_time()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Returns time since last topology change detected. (100ths/second)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(B<dot1dStpTimeSinceTopologyChange>)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=item $bridge->stp_root()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Returns root of STP.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(B<dot1dStpDesignatedRoot>)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=back
 | 
					=back
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=head1 TABLE ENTRIES
 | 
					=head1 TABLE ENTRIES
 | 
				
			||||||
@@ -193,4 +247,72 @@ Returns reference to hash of bridge port table entries physical port name.
 | 
				
			|||||||
(B<dot1dBasePortCircuit>)
 | 
					(B<dot1dBasePortCircuit>)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=back
 | 
					=back
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=head2 Spanning Tree Protocol Table (dot1dStpPortTable)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Descriptions are lifted straight from F<BRIDGE-MIB.my>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=over
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=item $bridge->stp_p_id()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					"The port number of the port for which this entry contains Spanning Tree Protocol management
 | 
				
			||||||
 | 
					information."
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(B<dot1dStpPort>)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=item $bridge->stp_p_priority()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					"The value of the priority field which is contained in the first (in network byte order)
 | 
				
			||||||
 | 
					octet of the (2 octet long) Port ID.  The other octet of the Port ID is given by the value of
 | 
				
			||||||
 | 
					dot1dStpPort."
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(B<dot1dStpPortPriority>)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=item $bridge->stp_p_state()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					"The port's current state as defined by application of the Spanning Tree Protocol.  This
 | 
				
			||||||
 | 
					state controls what action a port takes on reception of a frame.  If the bridge has detected
 | 
				
			||||||
 | 
					a port that is malfunctioning it will place that port into the broken(6) state.  For ports which
 | 
				
			||||||
 | 
					are disabled (see dot1dStpPortEnable), this object will have a value of disabled(1)."
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 disabled(1)
 | 
				
			||||||
 | 
					 blocking(2)
 | 
				
			||||||
 | 
					 listening(3)
 | 
				
			||||||
 | 
					 learning(4)
 | 
				
			||||||
 | 
					 forwarding(5)
 | 
				
			||||||
 | 
					 broken(6)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(B<dot1dStpPortState>)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=item $bridge->stp_p_cost()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					"The contribution of this port to the path cost of paths towards the spanning tree root which include
 | 
				
			||||||
 | 
					this port.  802.1D-1990 recommends that the default value of this parameter be in inverse
 | 
				
			||||||
 | 
					proportion to the speed of the attached LAN."
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(B<dot1dStpPortPathCost>)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=item $bridge->stp_p_root()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					"The unique Bridge Identifier of the Bridge recorded as the Root in the Configuration BPDUs
 | 
				
			||||||
 | 
					transmitted by the Designated Bridge for the segment to which the port is attached."
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(B<dot1dStpPortDesignatedRoot>)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=item $bridge->stp_p_bridge()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					"The Bridge Identifier of the bridge which this port considers to be the Designated Bridge for
 | 
				
			||||||
 | 
					this port's segment."
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(B<dot1dStpPortDesignatedBridge>)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=item $bridge->stp_p_port()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(B<dot1dStpPortDesignatedPort>)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					"The Port Identifier of the port on the Designated Bridge for this port's segment."
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=back
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=cut
 | 
					=cut
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										92
									
								
								Info/CDP.pm
									
									
									
									
									
								
							
							
						
						
									
										92
									
								
								Info/CDP.pm
									
									
									
									
									
								
							@@ -1,7 +1,7 @@
 | 
				
			|||||||
# SNMP::Info::CDP
 | 
					# SNMP::Info::CDP
 | 
				
			||||||
# Max Baker <max@warped.org>
 | 
					# Max Baker <max@warped.org>
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# Copyright (c) 2002, Regents of the University of California
 | 
					# Copyright (c) 2002,2003 Regents of the University of California
 | 
				
			||||||
# All rights reserved.
 | 
					# All rights reserved.
 | 
				
			||||||
# 
 | 
					# 
 | 
				
			||||||
# Redistribution and use in source and binary forms, with or without 
 | 
					# Redistribution and use in source and binary forms, with or without 
 | 
				
			||||||
@@ -28,7 +28,8 @@
 | 
				
			|||||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
					# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
package SNMP::Info::CDP;
 | 
					package SNMP::Info::CDP;
 | 
				
			||||||
$VERSION = 0.1;
 | 
					$VERSION = 0.3;
 | 
				
			||||||
 | 
					# $Id$
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use strict;
 | 
					use strict;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -72,11 +73,20 @@ $INIT = 0;
 | 
				
			|||||||
          );
 | 
					          );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
%MUNGE = (
 | 
					%MUNGE = (
 | 
				
			||||||
          'c_capabilities' => \&SNMP::Info::munge_octet2hex,
 | 
					          'c_capabilities' => \&munge_caps,
 | 
				
			||||||
          'c_ip'           => \&SNMP::Info::munge_ip
 | 
					          'c_ip'           => \&SNMP::Info::munge_ip
 | 
				
			||||||
         );
 | 
					         );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					sub munge_caps {
 | 
				
			||||||
 | 
					    my $caps = shift;
 | 
				
			||||||
 | 
					    return undef unless defined $caps;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    my $bits = substr(unpack("B*",$caps),-7);
 | 
				
			||||||
 | 
					    return $bits;
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
sub hasCDP {
 | 
					sub hasCDP {
 | 
				
			||||||
    my $cdp = shift;
 | 
					    my $cdp = shift;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -102,8 +112,11 @@ SNMP::Info::CDP - Perl5 Interface to Cisco Discovery Protocol (CDP) using SNMP
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
=head1 DESCRIPTION
 | 
					=head1 DESCRIPTION
 | 
				
			||||||
 | 
					
 | 
				
			||||||
CDP provides Layer 2 discovery of attached devices that also
 | 
					SNMP::Info::CDP is a subclass of SNMP::Info that provides an object oriented 
 | 
				
			||||||
speak CDP, including switches, routers and hubs.
 | 
					interface to CDP information through SNMP.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					CDP is a Layer 2 protocol that supplies topology information of devices that also speak CDP, 
 | 
				
			||||||
 | 
					mostly switches and routers.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=head1 AUTHOR
 | 
					=head1 AUTHOR
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -111,38 +124,19 @@ Max Baker (C<max@warped.org>)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
=head1 SYNOPSIS
 | 
					=head1 SYNOPSIS
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 my $cdp = new SNMP::Info::CDP( DestHost  => 'router' , 
 | 
					 my $info = new SNMP::Info ( DestHost  => 'router', 
 | 
				
			||||||
                          Community => 'public' );
 | 
					                             Community => 'public' 
 | 
				
			||||||
 | 
					                           );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 my $type = $info->device_type();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 my $cdp  = new $type ( DestHost => 'router',
 | 
				
			||||||
 | 
					                        Community => 'public);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 $hascdp = $cdp->hasCDP() ? 'yes' : 'no';
 | 
					 $hascdp = $cdp->hasCDP() ? 'yes' : 'no';
 | 
				
			||||||
 @neighbor_ips = values( %{$cdp->ip()} );
 | 
					 @neighbor_ips = values( %{$cdp->c_ip()} );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=head1 CREATING AN OBJECT
 | 
					See L<SNMP::Info> for all inherited methods.
 | 
				
			||||||
 | 
					 | 
				
			||||||
=over
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
=item new SNMP::Info::CDP()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Arguments passed to new() are passed on to SNMP::Session::new()
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    my $cdp = new SNMP::Info::CDP(
 | 
					 | 
				
			||||||
        DestHost => $host,
 | 
					 | 
				
			||||||
        Community => 'public'
 | 
					 | 
				
			||||||
        ) 
 | 
					 | 
				
			||||||
    die "Couldn't connect.\n" unless defined $cdp;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
=item  $cdp->session()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Sets or returns the SNMP::Session object
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # Get
 | 
					 | 
				
			||||||
    my $sess = $cdp->session();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # Set
 | 
					 | 
				
			||||||
    my $newsession = new SNMP::Session(...);
 | 
					 | 
				
			||||||
    $cdp->session($newsession);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
=back
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
=head2 Your Device May Vary
 | 
					=head2 Your Device May Vary
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -229,9 +223,33 @@ Returns remote platform id
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
=item $cdp->c_capabilities()
 | 
					=item $cdp->c_capabilities()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Returns Device Functional Capabilities bitmap.  
 | 
					Returns Device Functional Capabilities.  Results are munged into an ascii
 | 
				
			||||||
 | 
					binary string, 7 digits long, MSB.  Each digit represents a bit from the
 | 
				
			||||||
 | 
					table below.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Anyone know where I can get info on how to decode this?
 | 
					From L<http://www.cisco.com/univercd/cc/td/doc/product/lan/trsrb/frames.htm#18843>:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(Bit) - Description
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=over
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=item (0x40) - Provides level 1 functionality.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=item (0x20) - The bridge or switch does not forward IGMP Report packets on nonrouter ports.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=item (0x10) - Sends and receives packets for at least one network layer protocol. If the device is routing the protocol, this bit should not be set.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=item (0x08) - Performs level 2 switching. The difference between this bit and bit 0x02 is that a switch does not run the Spanning-Tree Protocol. This device is assumed to be deployed in a physical loop-free topology.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=item (0x04) - Performs level 2 source-route bridging. A source-route bridge would set both this bit and bit 0x02.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=item (0x02) - Performs level 2 transparent bridging.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=item (0x01) - Performs level 3 routing for at least one network layer protocol.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=back
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Thanks to Martin Lorensen C<martin -at- lorensen.dk> for a pointer to this information.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(B<cdpCacheCapabilities>)
 | 
					(B<cdpCacheCapabilities>)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,7 @@
 | 
				
			|||||||
# SNMP::Info::EtherLike
 | 
					# SNMP::Info::EtherLike
 | 
				
			||||||
# Max Baker <max@warped.org>
 | 
					# Max Baker <max@warped.org>
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# Copyright (c) 2002, Regents of the University of California
 | 
					# Copyright (c) 2002,2003 Regents of the University of California
 | 
				
			||||||
# All rights reserved.
 | 
					# All rights reserved.
 | 
				
			||||||
# 
 | 
					# 
 | 
				
			||||||
# Redistribution and use in source and binary forms, with or without 
 | 
					# Redistribution and use in source and binary forms, with or without 
 | 
				
			||||||
@@ -28,7 +28,8 @@
 | 
				
			|||||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
					# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
package SNMP::Info::EtherLike;
 | 
					package SNMP::Info::EtherLike;
 | 
				
			||||||
$VERSION = 0.1;
 | 
					$VERSION = 0.3;
 | 
				
			||||||
 | 
					# $Id$
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use strict;
 | 
					use strict;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -67,9 +68,10 @@ SNMP::Info::EtherLike - Perl5 Interface to SNMP ETHERLIKE-MIB
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
=head1 DESCRIPTION
 | 
					=head1 DESCRIPTION
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ETHERLIKE-MIB is used by some Layer 3 Devices such as Cisco routers.
 | 
					SNMP::Info::EtherLike is a subclass of SNMP::Info that supplies 
 | 
				
			||||||
 | 
					access to the ETHERLIKE-MIB used by some Layer 3 Devices such as Cisco routers.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Inherits all methods from SNMP::Info
 | 
					Use SNMP::Info directly, or create a subclass that inherits this one.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=head1 AUTHOR
 | 
					=head1 AUTHOR
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -99,17 +101,6 @@ Arguments passed to new() are passed on to SNMP::Session::new()
 | 
				
			|||||||
        ) 
 | 
					        ) 
 | 
				
			||||||
    die "Couldn't connect.\n" unless defined $el;
 | 
					    die "Couldn't connect.\n" unless defined $el;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=item  $el->session()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Sets or returns the SNMP::Session object
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # Get
 | 
					 | 
				
			||||||
    my $sess = $el->session();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # Set
 | 
					 | 
				
			||||||
    my $newsession = new SNMP::Session(...);
 | 
					 | 
				
			||||||
    $el->session($newsession);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
=back
 | 
					=back
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=head1 GLOBALS
 | 
					=head1 GLOBALS
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,7 @@
 | 
				
			|||||||
# SNMP::Info::Layer1 - SNMP Interface to Layer1 Devices 
 | 
					# SNMP::Info::Layer1 - SNMP Interface to Layer1 Devices 
 | 
				
			||||||
# Max Baker <max@warped.org>
 | 
					# Max Baker <max@warped.org>
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# Copyright (c) 2002, Regents of the University of California
 | 
					# Copyright (c) 2002,2003 Regents of the University of California
 | 
				
			||||||
# All rights reserved.
 | 
					# All rights reserved.
 | 
				
			||||||
# 
 | 
					# 
 | 
				
			||||||
# Redistribution and use in source and binary forms, with or without 
 | 
					# Redistribution and use in source and binary forms, with or without 
 | 
				
			||||||
@@ -28,7 +28,8 @@
 | 
				
			|||||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
					# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
package SNMP::Info::Layer1;
 | 
					package SNMP::Info::Layer1;
 | 
				
			||||||
$VERSION = 0.1;
 | 
					$VERSION = 0.3;
 | 
				
			||||||
 | 
					# $Id$
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use strict;
 | 
					use strict;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -169,8 +170,6 @@ SNMP::Info::Layer1 - Perl5 Interface to Layer1 network devices.
 | 
				
			|||||||
Provides abstraction to the configuration information obtainable from a 
 | 
					Provides abstraction to the configuration information obtainable from a 
 | 
				
			||||||
Layer1 device through SNMP.  Information is stored in a number of MIBs.
 | 
					Layer1 device through SNMP.  Information is stored in a number of MIBs.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
See super classes for descriptions of other available methods.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Inherits from: 
 | 
					Inherits from: 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 SNMP::Info
 | 
					 SNMP::Info
 | 
				
			||||||
@@ -206,17 +205,6 @@ Arguments passed to new() are passed on to SNMP::Session::new()
 | 
				
			|||||||
        ) 
 | 
					        ) 
 | 
				
			||||||
    die "Couldn't connect.\n" unless defined $l1;
 | 
					    die "Couldn't connect.\n" unless defined $l1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=item  $l1->session()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Sets or returns the SNMP::Session object
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # Get
 | 
					 | 
				
			||||||
    my $sess = $l1->session();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # Set
 | 
					 | 
				
			||||||
    my $newsession = new SNMP::Session(...);
 | 
					 | 
				
			||||||
    $l1->session($newsession);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
=back
 | 
					=back
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=head1 GLOBALS
 | 
					=head1 GLOBALS
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,7 @@
 | 
				
			|||||||
# SNMP::Info::Layer1::Allied
 | 
					# SNMP::Info::Layer1::Allied
 | 
				
			||||||
# Max Baker <max@warped.org>
 | 
					# Max Baker <max@warped.org>
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# Copyright (c) 2002, Regents of the University of California
 | 
					# Copyright (c) 2002,2003 Regents of the University of California
 | 
				
			||||||
# All rights reserved.
 | 
					# All rights reserved.
 | 
				
			||||||
# 
 | 
					# 
 | 
				
			||||||
# Redistribution and use in source and binary forms, with or without 
 | 
					# Redistribution and use in source and binary forms, with or without 
 | 
				
			||||||
@@ -28,7 +28,8 @@
 | 
				
			|||||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
					# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
package SNMP::Info::Layer1::Allied;
 | 
					package SNMP::Info::Layer1::Allied;
 | 
				
			||||||
$VERSION = 0.1;
 | 
					$VERSION = 0.3;
 | 
				
			||||||
 | 
					# $Id$
 | 
				
			||||||
use strict;
 | 
					use strict;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use Exporter;
 | 
					use Exporter;
 | 
				
			||||||
@@ -151,17 +152,6 @@ Arguments passed to new() are passed on to SNMP::Session::new()
 | 
				
			|||||||
        ) 
 | 
					        ) 
 | 
				
			||||||
    die "Couldn't connect.\n" unless defined $allied;
 | 
					    die "Couldn't connect.\n" unless defined $allied;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=item  $allied->session()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Sets or returns the SNMP::Session object
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # Get
 | 
					 | 
				
			||||||
    my $sess = $allied->session();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # Set
 | 
					 | 
				
			||||||
    my $newsession = new SNMP::Session(...);
 | 
					 | 
				
			||||||
    $allied->session($newsession);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
=back
 | 
					=back
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=head1 GLOBALS
 | 
					=head1 GLOBALS
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,7 @@
 | 
				
			|||||||
# SNMP::Info::Layer1::Asante
 | 
					# SNMP::Info::Layer1::Asante
 | 
				
			||||||
# Max Baker <max@warped.org>
 | 
					# Max Baker <max@warped.org>
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# Copyright (c) 2002, Regents of the University of California
 | 
					# Copyright (c) 2002,2003 Regents of the University of California
 | 
				
			||||||
# All rights reserved.
 | 
					# All rights reserved.
 | 
				
			||||||
# 
 | 
					# 
 | 
				
			||||||
# Redistribution and use in source and binary forms, with or without 
 | 
					# Redistribution and use in source and binary forms, with or without 
 | 
				
			||||||
@@ -28,7 +28,8 @@
 | 
				
			|||||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
					# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
package SNMP::Info::Layer1::Asante;
 | 
					package SNMP::Info::Layer1::Asante;
 | 
				
			||||||
$VERSION = 0.1;
 | 
					$VERSION = 0.3;
 | 
				
			||||||
 | 
					# $Id$
 | 
				
			||||||
use strict;
 | 
					use strict;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use Exporter;
 | 
					use Exporter;
 | 
				
			||||||
@@ -194,17 +195,6 @@ Arguments passed to new() are passed on to SNMP::Session::new()
 | 
				
			|||||||
        ) 
 | 
					        ) 
 | 
				
			||||||
    die "Couldn't connect.\n" unless defined $asante;
 | 
					    die "Couldn't connect.\n" unless defined $asante;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=item  $asante->session()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Sets or returns the SNMP::Session object
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # Get
 | 
					 | 
				
			||||||
    my $sess = $asante->session();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # Set
 | 
					 | 
				
			||||||
    my $newsession = new SNMP::Session(...);
 | 
					 | 
				
			||||||
    $asante->session($newsession);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
=back
 | 
					=back
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=head1 GLOBALS
 | 
					=head1 GLOBALS
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,7 @@
 | 
				
			|||||||
# SNMP::Info::Layer2 - SNMP Interface to Layer2 Devices 
 | 
					# SNMP::Info::Layer2 - SNMP Interface to Layer2 Devices 
 | 
				
			||||||
# Max Baker <max@warped.org>
 | 
					# Max Baker <max@warped.org>
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# Copyright (c) 2002, Regents of the University of California
 | 
					# Copyright (c) 2002,2003 Regents of the University of California
 | 
				
			||||||
# All rights reserved.
 | 
					# All rights reserved.
 | 
				
			||||||
# 
 | 
					# 
 | 
				
			||||||
# Redistribution and use in source and binary forms, with or without 
 | 
					# Redistribution and use in source and binary forms, with or without 
 | 
				
			||||||
@@ -28,7 +28,8 @@
 | 
				
			|||||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
					# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
package SNMP::Info::Layer2;
 | 
					package SNMP::Info::Layer2;
 | 
				
			||||||
$VERSION = 0.1;
 | 
					$VERSION = 0.3;
 | 
				
			||||||
 | 
					# $Id$
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use strict;
 | 
					use strict;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -54,7 +55,7 @@ $INIT = 0;
 | 
				
			|||||||
          %SNMP::Info::CDP::MIBS,
 | 
					          %SNMP::Info::CDP::MIBS,
 | 
				
			||||||
          'CISCO-PRODUCTS-MIB' => 'sysName',
 | 
					          'CISCO-PRODUCTS-MIB' => 'sysName',
 | 
				
			||||||
          'CISCO-STACK-MIB'    => 'wsc1900sysID',
 | 
					          'CISCO-STACK-MIB'    => 'wsc1900sysID',
 | 
				
			||||||
          'HP-ICF-OID'         => 'hpSwitch4000',
 | 
					#          'HP-ICF-OID'         => 'hpSwitch4000',
 | 
				
			||||||
        );
 | 
					        );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
%GLOBALS = (
 | 
					%GLOBALS = (
 | 
				
			||||||
@@ -90,6 +91,8 @@ sub model {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    # Cisco
 | 
					    # Cisco
 | 
				
			||||||
    $model =~ s/sysid$//i;
 | 
					    $model =~ s/sysid$//i;
 | 
				
			||||||
 | 
					    $model =~ s/^(cisco|catalyst)//i;
 | 
				
			||||||
 | 
					    $model =~ s/^cat//i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return $model;
 | 
					    return $model;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -176,7 +179,7 @@ MIBS:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 CISCO-PRODUCTS-MIB - Needed for ID of Cisco Products
 | 
					 CISCO-PRODUCTS-MIB - Needed for ID of Cisco Products
 | 
				
			||||||
 CISCO-STACK-MIB    - Needed for ID of Cisco Products
 | 
					 CISCO-STACK-MIB    - Needed for ID of Cisco Products
 | 
				
			||||||
 HP-ICF-OID         - Needed for ID of HP    Products
 | 
					 ##HP-ICF-OID         - Needed for ID of HP    Products
 | 
				
			||||||
 MIBS listed in SNMP::Info::Bridge and SNMP::Info::CDP
 | 
					 MIBS listed in SNMP::Info::Bridge and SNMP::Info::CDP
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Cisco MIBs can be found at ftp://ftp.cisco.com/pub/mibs/v2/v2.tar.gz
 | 
					Cisco MIBs can be found at ftp://ftp.cisco.com/pub/mibs/v2/v2.tar.gz
 | 
				
			||||||
@@ -208,17 +211,6 @@ Arguments passed to new() are passed on to SNMP::Session::new()
 | 
				
			|||||||
        ) 
 | 
					        ) 
 | 
				
			||||||
    die "Couldn't connect.\n" unless defined $l2;
 | 
					    die "Couldn't connect.\n" unless defined $l2;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=item  $l2->session()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Sets or returns the SNMP::Session object
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # Get
 | 
					 | 
				
			||||||
    my $sess = $l2->session();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # Set
 | 
					 | 
				
			||||||
    my $newsession = new SNMP::Session(...);
 | 
					 | 
				
			||||||
    $l2->session($newsession);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
=back
 | 
					=back
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=head1 GLOBALS
 | 
					=head1 GLOBALS
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,7 @@
 | 
				
			|||||||
 | 
					# SNMP::Info::Layer2::Bay
 | 
				
			||||||
 | 
					# Max Baker <max@warped.org>
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# Copyright (c) 2002, Regents of the University of California
 | 
					# Copyright (c) 2002,2003 Regents of the University of California
 | 
				
			||||||
# All rights reserved.
 | 
					# All rights reserved.
 | 
				
			||||||
# 
 | 
					# 
 | 
				
			||||||
# Redistribution and use in source and binary forms, with or without 
 | 
					# Redistribution and use in source and binary forms, with or without 
 | 
				
			||||||
@@ -24,11 +26,10 @@
 | 
				
			|||||||
# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
 | 
					# 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 
 | 
					# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
 | 
				
			||||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
					# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
				
			||||||
# SNMP::Info::Layer2::Bay
 | 
					 | 
				
			||||||
# Max Baker <max@warped.org>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
package SNMP::Info::Layer2::Bay;
 | 
					package SNMP::Info::Layer2::Bay;
 | 
				
			||||||
$VERSION = 0.1;
 | 
					$VERSION = 0.3;
 | 
				
			||||||
 | 
					# $Id$
 | 
				
			||||||
use strict;
 | 
					use strict;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use Exporter;
 | 
					use Exporter;
 | 
				
			||||||
@@ -122,6 +123,7 @@ sub model {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    return '303' if ($descr =~ /\D303\D/);
 | 
					    return '303' if ($descr =~ /\D303\D/);
 | 
				
			||||||
    return '304' if ($descr =~ /\D304\D/);
 | 
					    return '304' if ($descr =~ /\D304\D/);
 | 
				
			||||||
 | 
					    return '450' if ($model =~ /BayStack450/);
 | 
				
			||||||
    return $model;
 | 
					    return $model;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -274,17 +276,6 @@ Arguments passed to new() are passed on to SNMP::Session::new()
 | 
				
			|||||||
        ) 
 | 
					        ) 
 | 
				
			||||||
    die "Couldn't connect.\n" unless defined $bay;
 | 
					    die "Couldn't connect.\n" unless defined $bay;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=item  $bay->session()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Sets or returns the SNMP::Session object
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # Get
 | 
					 | 
				
			||||||
    my $sess = $bay->session();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # Set
 | 
					 | 
				
			||||||
    my $newsession = new SNMP::Session(...);
 | 
					 | 
				
			||||||
    $bay->session($newsession);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
=back
 | 
					=back
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=head1 GLOBALS
 | 
					=head1 GLOBALS
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,7 @@
 | 
				
			|||||||
# SNMP::Info::Layer2::C1900
 | 
					# SNMP::Info::Layer2::C1900
 | 
				
			||||||
# Max Baker <max@warped.org>
 | 
					# Max Baker <max@warped.org>
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# Copyright (c) 2002, Regents of the University of California
 | 
					# Copyright (c) 2002,2003 Regents of the University of California
 | 
				
			||||||
# All rights reserved.
 | 
					# All rights reserved.
 | 
				
			||||||
# 
 | 
					# 
 | 
				
			||||||
# Redistribution and use in source and binary forms, with or without 
 | 
					# Redistribution and use in source and binary forms, with or without 
 | 
				
			||||||
@@ -28,7 +28,8 @@
 | 
				
			|||||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
					# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
package SNMP::Info::Layer2::C1900;
 | 
					package SNMP::Info::Layer2::C1900;
 | 
				
			||||||
$VERSION = 0.1;
 | 
					$VERSION = 0.3;
 | 
				
			||||||
 | 
					# $Id$
 | 
				
			||||||
use strict;
 | 
					use strict;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use Exporter;
 | 
					use Exporter;
 | 
				
			||||||
@@ -191,17 +192,6 @@ Arguments passed to new() are passed on to SNMP::Session::new()
 | 
				
			|||||||
        ) 
 | 
					        ) 
 | 
				
			||||||
    die "Couldn't connect.\n" unless defined $c1900;
 | 
					    die "Couldn't connect.\n" unless defined $c1900;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=item  $c1900->session()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Sets or returns the SNMP::Session object
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # Get
 | 
					 | 
				
			||||||
    my $sess = $c1900->session();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # Set
 | 
					 | 
				
			||||||
    my $newsession = new SNMP::Session(...);
 | 
					 | 
				
			||||||
    $c1900->session($newsession);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
=back
 | 
					=back
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=head1 GLOBALS
 | 
					=head1 GLOBALS
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,7 @@
 | 
				
			|||||||
# SNMP::Info::Layer2::C2900
 | 
					# SNMP::Info::Layer2::C2900
 | 
				
			||||||
# Max Baker <max@warped.org>
 | 
					# Max Baker <max@warped.org>
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# Copyright (c) 2002, Regents of the University of California
 | 
					# Copyright (c) 2002,2003 Regents of the University of California
 | 
				
			||||||
# All rights reserved.
 | 
					# All rights reserved.
 | 
				
			||||||
# 
 | 
					# 
 | 
				
			||||||
# Redistribution and use in source and binary forms, with or without 
 | 
					# Redistribution and use in source and binary forms, with or without 
 | 
				
			||||||
@@ -28,7 +28,8 @@
 | 
				
			|||||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
					# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
package SNMP::Info::Layer2::C2900;
 | 
					package SNMP::Info::Layer2::C2900;
 | 
				
			||||||
$VERSION = 0.1;
 | 
					$VERSION = 0.3;
 | 
				
			||||||
 | 
					# $Id$
 | 
				
			||||||
use strict;
 | 
					use strict;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use Exporter;
 | 
					use Exporter;
 | 
				
			||||||
@@ -173,17 +174,6 @@ Arguments passed to new() are passed on to SNMP::Session::new()
 | 
				
			|||||||
        ) 
 | 
					        ) 
 | 
				
			||||||
    die "Couldn't connect.\n" unless defined $c2900;
 | 
					    die "Couldn't connect.\n" unless defined $c2900;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=item  $c2900->session()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Sets or returns the SNMP::Session object
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # Get
 | 
					 | 
				
			||||||
    my $sess = $c2900->session();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # Set
 | 
					 | 
				
			||||||
    my $newsession = new SNMP::Session(...);
 | 
					 | 
				
			||||||
    $c2900->session($newsession);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
=back
 | 
					=back
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=head1 GLOBALS
 | 
					=head1 GLOBALS
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,7 @@
 | 
				
			|||||||
# SNMP::Info::Layer2::Catalyst
 | 
					# SNMP::Info::Layer2::Catalyst
 | 
				
			||||||
# Max Baker <max@warped.org>
 | 
					# Max Baker <max@warped.org>
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# Copyright (c) 2002, Regents of the University of California
 | 
					# Copyright (c) 2002,2003 Regents of the University of California
 | 
				
			||||||
# All rights reserved.
 | 
					# All rights reserved.
 | 
				
			||||||
# 
 | 
					# 
 | 
				
			||||||
# Redistribution and use in source and binary forms, with or without 
 | 
					# Redistribution and use in source and binary forms, with or without 
 | 
				
			||||||
@@ -28,7 +28,8 @@
 | 
				
			|||||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
					# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
package SNMP::Info::Layer2::Catalyst;
 | 
					package SNMP::Info::Layer2::Catalyst;
 | 
				
			||||||
$VERSION = 0.1;
 | 
					$VERSION = 0.3;
 | 
				
			||||||
 | 
					# $Id$
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use strict;
 | 
					use strict;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -182,6 +183,7 @@ sub i_name {
 | 
				
			|||||||
    my %i_name;
 | 
					    my %i_name;
 | 
				
			||||||
    foreach my $port (keys %$p_name) {
 | 
					    foreach my $port (keys %$p_name) {
 | 
				
			||||||
        my $iid = $p_port->{$port};
 | 
					        my $iid = $p_port->{$port};
 | 
				
			||||||
 | 
					        next unless defined $iid;
 | 
				
			||||||
        $i_name{$iid} = $p_name->{$port};
 | 
					        $i_name{$iid} = $p_name->{$port};
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    return \%i_name; 
 | 
					    return \%i_name; 
 | 
				
			||||||
@@ -287,17 +289,6 @@ Arguments passed to new() are passed on to SNMP::Session::new()
 | 
				
			|||||||
        ) 
 | 
					        ) 
 | 
				
			||||||
    die "Couldn't connect.\n" unless defined $cat;
 | 
					    die "Couldn't connect.\n" unless defined $cat;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=item  $cat->session()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Sets or returns the SNMP::Session object
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # Get
 | 
					 | 
				
			||||||
    my $sess = $cat->session();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # Set
 | 
					 | 
				
			||||||
    my $newsession = new SNMP::Session(...);
 | 
					 | 
				
			||||||
    $cat->session($newsession);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
=back
 | 
					=back
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=head1 GLOBAL Values
 | 
					=head1 GLOBAL Values
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,7 @@
 | 
				
			|||||||
# SNMP::Info::Layer2::HP - SNMP Interface to HP ProCurve Switches
 | 
					# SNMP::Info::Layer2::HP - SNMP Interface to HP ProCurve Switches
 | 
				
			||||||
# Max Baker <max@warped.org>
 | 
					# Max Baker <max@warped.org>
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# Copyright (c) 2002, Regents of the University of California
 | 
					# Copyright (c) 2002,2003 Regents of the University of California
 | 
				
			||||||
# All rights reserved.
 | 
					# All rights reserved.
 | 
				
			||||||
# 
 | 
					# 
 | 
				
			||||||
# Redistribution and use in source and binary forms, with or without 
 | 
					# Redistribution and use in source and binary forms, with or without 
 | 
				
			||||||
@@ -28,7 +28,8 @@
 | 
				
			|||||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
					# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
package SNMP::Info::Layer2::HP;
 | 
					package SNMP::Info::Layer2::HP;
 | 
				
			||||||
$VERSION = 0.1;
 | 
					$VERSION = 0.3;
 | 
				
			||||||
 | 
					# $Id$
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use strict;
 | 
					use strict;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -36,7 +37,7 @@ use Exporter;
 | 
				
			|||||||
use SNMP::Info::Layer2;
 | 
					use SNMP::Info::Layer2;
 | 
				
			||||||
use SNMP::Info::MAU;
 | 
					use SNMP::Info::MAU;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %PORTSTAT 
 | 
					use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %PORTSTAT %MODEL_MAP 
 | 
				
			||||||
            %MYGLOBALS %MYMIBS %MYFUNCS %MYMUNGE %MUNGE $INIT/ ;
 | 
					            %MYGLOBALS %MYMIBS %MYFUNCS %MYMUNGE %MUNGE $INIT/ ;
 | 
				
			||||||
@SNMP::Info::Layer2::HP::ISA = qw/SNMP::Info::Layer2 SNMP::Info::MAU Exporter/;
 | 
					@SNMP::Info::Layer2::HP::ISA = qw/SNMP::Info::Layer2 SNMP::Info::MAU Exporter/;
 | 
				
			||||||
@SNMP::Info::Layer2::HP::EXPORT_OK = qw//;
 | 
					@SNMP::Info::Layer2::HP::EXPORT_OK = qw//;
 | 
				
			||||||
@@ -68,17 +69,17 @@ $INIT = 0;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
%MYFUNCS = (
 | 
					%MYFUNCS = (
 | 
				
			||||||
            'i_type2'   => 'ifType',
 | 
					            'i_type2'   => 'ifType',
 | 
				
			||||||
            'e_map'     => 'entAliasMappingIdentifier',
 | 
					 | 
				
			||||||
            'e_name'    => 'entPhysicalName',
 | 
					 | 
				
			||||||
            'e_class'   => 'entPhysicalClass',
 | 
					            'e_class'   => 'entPhysicalClass',
 | 
				
			||||||
            'e_parent'  => 'entPhysicalContainedIn',
 | 
					 | 
				
			||||||
            'e_descr'   => 'entPhysicalDescr',
 | 
					            'e_descr'   => 'entPhysicalDescr',
 | 
				
			||||||
            'e_type'    => 'entPhysicalVendorType',
 | 
					 | 
				
			||||||
            'e_model'   => 'entPhysicalModelName',
 | 
					 | 
				
			||||||
            'e_hwver'   => 'entPhysicalHardwareRev',
 | 
					 | 
				
			||||||
            'e_swver'   => 'entPhysicalSoftwareRev',
 | 
					 | 
				
			||||||
            'e_fwver'   => 'entPhysicalFirmwareRev',
 | 
					            'e_fwver'   => 'entPhysicalFirmwareRev',
 | 
				
			||||||
 | 
					            'e_hwver'   => 'entPhysicalHardwareRev',
 | 
				
			||||||
 | 
					            'e_map'     => 'entAliasMappingIdentifier',
 | 
				
			||||||
 | 
					            'e_model'   => 'entPhysicalModelName',
 | 
				
			||||||
 | 
					            'e_name'    => 'entPhysicalName',
 | 
				
			||||||
 | 
					            'e_parent'  => 'entPhysicalContainedIn',
 | 
				
			||||||
            'e_serial'  => 'entPhysicalSerialNum',
 | 
					            'e_serial'  => 'entPhysicalSerialNum',
 | 
				
			||||||
 | 
					            'e_swver'   => 'entPhysicalSoftwareRev',
 | 
				
			||||||
 | 
					            'e_type'    => 'entPhysicalVendorType',
 | 
				
			||||||
            # RFC1271
 | 
					            # RFC1271
 | 
				
			||||||
            'l_descr'   => 'logDescription'
 | 
					            'l_descr'   => 'logDescription'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -99,9 +100,30 @@ $INIT = 0;
 | 
				
			|||||||
            %MYMUNGE
 | 
					            %MYMUNGE
 | 
				
			||||||
         );
 | 
					         );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					%MODEL_MAP = ( 
 | 
				
			||||||
 | 
					               'J4812A' => '2512',
 | 
				
			||||||
 | 
					               'J4819A' => '5308XL',
 | 
				
			||||||
 | 
					               'J4813A' => '2524',
 | 
				
			||||||
 | 
					               'J4805A' => '5304XL',
 | 
				
			||||||
 | 
					               'J4815A' => '3324XL',
 | 
				
			||||||
 | 
					               'J4865A' => '4108GL',
 | 
				
			||||||
 | 
					               'J4887A' => '4104GL',
 | 
				
			||||||
 | 
					               'J4874A' => '9315',
 | 
				
			||||||
 | 
					             );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Method Overrides
 | 
					# Method Overrides
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Lookup model number, and translate the part number to the common number
 | 
				
			||||||
 | 
					sub model {
 | 
				
			||||||
 | 
					    my $hp = shift;
 | 
				
			||||||
 | 
					    my $id = $hp->id();
 | 
				
			||||||
 | 
					    my $model = &SNMP::translateObj($id);
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    $model =~ s/^hpswitch//i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return defined $MODEL_MAP{$model} ? $MODEL_MAP{$model} : $model;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Some have the serial num in entity mib, some dont.
 | 
					# Some have the serial num in entity mib, some dont.
 | 
				
			||||||
sub serial {
 | 
					sub serial {
 | 
				
			||||||
    my $hp = shift;
 | 
					    my $hp = shift;
 | 
				
			||||||
@@ -109,6 +131,7 @@ sub serial {
 | 
				
			|||||||
    # procurve 2xxx have this
 | 
					    # procurve 2xxx have this
 | 
				
			||||||
    my $serial = $hp->serial1();
 | 
					    my $serial = $hp->serial1();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return undef unless defined $serial;
 | 
				
			||||||
    # 4xxx dont
 | 
					    # 4xxx dont
 | 
				
			||||||
    return undef if $serial =~ /nosuchobject/i;
 | 
					    return undef if $serial =~ /nosuchobject/i;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -314,26 +337,6 @@ sub i_duplex_admin {
 | 
				
			|||||||
    return \%i_duplex_admin;
 | 
					    return \%i_duplex_admin;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#sub i_up_admin {
 | 
					 | 
				
			||||||
#    my $hp = shift;
 | 
					 | 
				
			||||||
#    
 | 
					 | 
				
			||||||
#    my $mau_index    = $hp->mau_index();
 | 
					 | 
				
			||||||
#    my $mau_status = $hp->mau_status();
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
#    my %i_up_admin;
 | 
					 | 
				
			||||||
#    foreach my $mau_port (keys %$mau_status){
 | 
					 | 
				
			||||||
#        my $iid = $mau_index->{$mau_port};
 | 
					 | 
				
			||||||
#        next unless defined $iid;
 | 
					 | 
				
			||||||
#        my $status = $mau_status->{$mau_port};
 | 
					 | 
				
			||||||
#        
 | 
					 | 
				
			||||||
#        $i_up_admin{$iid} = ($status =~ /shutdown/i) ? 
 | 
					 | 
				
			||||||
#                            'down' : 'up';
 | 
					 | 
				
			||||||
#    }
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
#    return \%i_up_admin;  
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
#}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
1;
 | 
					1;
 | 
				
			||||||
__END__
 | 
					__END__
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -347,6 +350,18 @@ Provides abstraction to the configuration information obtainable from a
 | 
				
			|||||||
HP device through SNMP.  Information is stored in a number of 
 | 
					HP device through SNMP.  Information is stored in a number of 
 | 
				
			||||||
MIB's such as IF-MIB, ENTITY-MIB, RFC1271-MIB, HP-ICF-OID, MAU-MIB
 | 
					MIB's such as IF-MIB, ENTITY-MIB, RFC1271-MIB, HP-ICF-OID, MAU-MIB
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					MIBs required:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=over
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=item RFC1271-MIB
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=item HP-ICF-OID
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=back
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					HP MIBs can be found at http://www.hp.com/rnd/software
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=head1 AUTHOR
 | 
					=head1 AUTHOR
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Max Baker (C<max@warped.org>)
 | 
					Max Baker (C<max@warped.org>)
 | 
				
			||||||
@@ -356,6 +371,8 @@ Max Baker (C<max@warped.org>)
 | 
				
			|||||||
 my $hp = new SNMP::Info::Layer2::HP(DestHost  => 'router' , 
 | 
					 my $hp = new SNMP::Info::Layer2::HP(DestHost  => 'router' , 
 | 
				
			||||||
                              Community => 'public' ); 
 | 
					                              Community => 'public' ); 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 See SNMP::Info and SNMP::Info::Layer2 for all the inherited methods.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=head1 CREATING AN OBJECT
 | 
					=head1 CREATING AN OBJECT
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=over
 | 
					=over
 | 
				
			||||||
@@ -372,176 +389,126 @@ Arguments passed to new() are passed on to SNMP::Session::new()
 | 
				
			|||||||
        ) 
 | 
					        ) 
 | 
				
			||||||
    die "Couldn't connect.\n" unless defined $hp;
 | 
					    die "Couldn't connect.\n" unless defined $hp;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=item  $hp->session()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Sets or returns the SNMP::Session object
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # Get
 | 
					 | 
				
			||||||
    my $sess = $hp->session();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # Set
 | 
					 | 
				
			||||||
    my $newsession = new SNMP::Session(...);
 | 
					 | 
				
			||||||
    $hp->session($newsession);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
=item  $hp->all(), $hp->load_all()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Runs each of the HP List methods and returns a hash reference.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
$hp->all() will call $hp->load_all() once and then return cahced valued.  
 | 
					 | 
				
			||||||
Use $hp->load_all() to reload from the device.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
=back
 | 
					=back
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=head1 HP Global Configuration Values
 | 
					=head1 HP Global Configuration Values
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=over
 | 
					=over
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=item $hp->name()
 | 
					=item $hp->log()
 | 
				
			||||||
(B<sysName>)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
=item $hp->ip()
 | 
					Returns all the log entries from the switch's log that are not Link up or down messages.
 | 
				
			||||||
(B<sysIpAddr>)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
=item $hp->netmask()
 | 
					 | 
				
			||||||
(B<sysNetMask>)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
=item $hp->broadcast()
 | 
					 | 
				
			||||||
(B<sysBroadcast>)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
=item $hp->location()
 | 
					 | 
				
			||||||
(B<sysLocation>)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
=item $hp->contact()
 | 
					 | 
				
			||||||
(B<sysContact>)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
=item $hp->description()
 | 
					 | 
				
			||||||
(B<sysDescr>)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
=item $hp->layers()
 | 
					 | 
				
			||||||
(B<sysServices>)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
=item $hp->serial()
 | 
					 | 
				
			||||||
(B<chassisSerialNumberString>)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
=item $hp->model()
 | 
					=item $hp->model()
 | 
				
			||||||
(B<chassisModel>)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
=item $hp->ps1_type()
 | 
					Returns the model number of the HP Switch.  Will translate between the HP Part number and 
 | 
				
			||||||
(B<chassisPs1Type>)
 | 
					the common model number with this map :
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=item $hp->ps2_type()
 | 
					 %MODEL_MAP = ( 
 | 
				
			||||||
(B<chassisPs2Type>)
 | 
					               'J4812A' => '2512',
 | 
				
			||||||
 | 
					               'J4819A' => '5308XL',
 | 
				
			||||||
 | 
					               'J4813A' => '2524',
 | 
				
			||||||
 | 
					               'J4805A' => '5304XL',
 | 
				
			||||||
 | 
					               'J4815A' => '3324XL',
 | 
				
			||||||
 | 
					               'J4865A' => '4108GL',
 | 
				
			||||||
 | 
					               'J4887A' => '4104GL',
 | 
				
			||||||
 | 
					               'J4874A' => '9315',
 | 
				
			||||||
 | 
					              );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=item $hp->ps1_status()
 | 
					=item $hp->serial()
 | 
				
			||||||
(B<chassisPs1Status>)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
=item $hp->ps2_status()
 | 
					Returns serial number if available through SNMP
 | 
				
			||||||
(B<chassisPs2Status>)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
=item $hp->slots()
 | 
					=item $hp->slots()
 | 
				
			||||||
(B<chassisNumSlots>)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
=item $hp->fan()
 | 
					Returns number of entries in $hp->e_name that have 'slot' in them.
 | 
				
			||||||
(B<chassisFanStatus>)
 | 
					
 | 
				
			||||||
 | 
					=item $hp->vendor()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					hp
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=back
 | 
					=back
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=head1 CATALYST TABLE ENTRIES
 | 
					=head1 HP Table Values
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=head2 Module table
 | 
					=head2 Entity Table
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=over
 | 
					=over
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=item $hp->m_type(), $hp->load_m_type()
 | 
					=item $hp->e_class()
 | 
				
			||||||
(B<moduleType>)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
=item $hp->m_model(), $hp->load_m_model()
 | 
					(C<entPhysicalClass>)
 | 
				
			||||||
(B<moduleModel>)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
=item $hp->m_serial(), $hp->load_m_serial()
 | 
					=item $hp->e_descr()
 | 
				
			||||||
(B<moduleSerialNumber>)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
=item $hp->m_status(), $hp->load_m_status()
 | 
					(C<entPhysicalClass>)
 | 
				
			||||||
(B<moduleStatus>)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
=item $hp->m_name(), $hp->load_m_name()
 | 
					=item $hp->e_fwver()
 | 
				
			||||||
(B<moduleName>)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
=item $hp->m_ports(), $hp->load_m_ports()
 | 
					(C<entPhysicalFirmwareRev>)
 | 
				
			||||||
(B<moduleNumPorts>)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
=item $hp->m_ports_status(), $hp->load_m_ports_status()
 | 
					=item $hp->e_hwver()
 | 
				
			||||||
 Returns a list of space separated status strings for the ports.
 | 
					 | 
				
			||||||
   To see the status of port 4 :
 | 
					 | 
				
			||||||
        @ports_status = split(' ', $hp->m_ports_status() );
 | 
					 | 
				
			||||||
        $port4 = $ports_status[3];
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
(B<modulePortStatus>)
 | 
					(C<entPhysicalHardwareRev>)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=item $hp->m_ports_hwver(), $hp->load_m_ports_hwver()
 | 
					=item $hp->e_map()
 | 
				
			||||||
(B<moduleHwVersion>)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
=item $hp->m_ports_fwver(), $hp->load_m_ports_fwver()
 | 
					(C<entAliasMappingIdentifier>)
 | 
				
			||||||
(B<moduleFwVersion>)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
=item $hp->m_ports_swver(), $hp->load_m_ports_swver()
 | 
					=item $hp->e_model()
 | 
				
			||||||
(B<moduleSwVersion>)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
=item $hp->m_ports_ip(), $hp->load_m_ports_ip()
 | 
					(C<entPhysicalModelName>)
 | 
				
			||||||
(B<moduleIPAddress>)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
=item $hp->m_ports_sub1(), $hp->load_m_ports_sub1()
 | 
					=item $hp->e_name()
 | 
				
			||||||
(B<moduleSubType>)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
=item $hp->m_ports_sub2(), $hp->load_m_ports_sub2()
 | 
					(C<entPhysicalName>)
 | 
				
			||||||
(B<moduleSubType2>)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=item $hp->e_parent()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(C<entPhysicalContainedIn>)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=item $hp->e_port()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Maps EntityTable entries to the Interface Table (IfTable) using
 | 
				
			||||||
 | 
					$hp->e_map()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=item $hp->e_serial()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(C<entPhysicalSerialNum>)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=item $hp->e_swver()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(C<entPhysicalSoftwareRev>)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=item $hp->e_type()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(C<entPhysicalVendorType>)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=back
 | 
					=back
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=head2 Port Entry Table
 | 
					=head2 Overriden Methods from SNMP::Info::Layer2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=over
 | 
					=over
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=item $hp->p_name(), $hp->load_p_name()
 | 
					=item $hp->interfaces() 
 | 
				
			||||||
(B<portName>)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
=item $hp->p_type(), $hp->load_p_type()
 | 
					=item $hp->i_duplex()
 | 
				
			||||||
(B<portType>)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
=item $hp->p_status(), $hp->load_p_status()
 | 
					Maps $hp->mau_index() with $hp->mau_link().  Methods inherited from
 | 
				
			||||||
(B<portOperStatus>)
 | 
					SNMP::Info::MAU.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=item $hp->p_status2(), $hp->load_p_status2()
 | 
					=item $hp->i_duplex_admin()
 | 
				
			||||||
(B<portAdditionalStatus>)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
=item $hp->p_speed(), $hp->load_p_speed()
 | 
					Maps $hp->mau_index() with $hp->mau_auto(), $hp->mau_autostat(),
 | 
				
			||||||
(B<portAdminSpeed>)
 | 
					$hp->typeadmin(), and $mau_autosent().  Methods inherited from
 | 
				
			||||||
 | 
					SNMP::Info::MAU.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=item $hp->p_duplex(), $hp->load_p_duplex()
 | 
					=item $hp->i_name()
 | 
				
			||||||
(B<portDuplex>)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
=item $hp->p_port(), $hp->load_p_port()
 | 
					Crosses i_name() with $hp->e_name() using $hp->e_port() and i_alias()
 | 
				
			||||||
(B<portIfIndex>)
 | 
					
 | 
				
			||||||
 | 
					=item $hp->i_type()
 | 
				
			||||||
=back
 | 
					
 | 
				
			||||||
 | 
					Crosses i_type() with $hp->e_descr() using $hp->e_port()
 | 
				
			||||||
=head2 VLAN Entry Table
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
ftp://ftp.cisco.com/pub/mibs/supportlists/wsc5000/wsc5000-communityIndexing.html
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
=over
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
=item $hp->v_state(), $hp->load_v_state()
 | 
					 | 
				
			||||||
(B<vtpVlanState>)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
=item $hp->v_type(), $hp->load_v_type()
 | 
					 | 
				
			||||||
(B<vtpVlanType>)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
=item $hp->v_name(), $hp->load_v_name()
 | 
					 | 
				
			||||||
(B<vtpVlanName>)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
=item $hp->v_mtu(), $hp->load_v_mtu()
 | 
					 | 
				
			||||||
(B<vtpVlanMtu>)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
=back
 | 
					=back
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,7 @@
 | 
				
			|||||||
# SNMP::Info::Layer3 - SNMP Interface to Layer3 devices
 | 
					# SNMP::Info::Layer3 - SNMP Interface to Layer3 devices
 | 
				
			||||||
# Max Baker <max@warped.org>
 | 
					# Max Baker <max@warped.org>
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# Copyright (c) 2002, Regents of the University of California
 | 
					# Copyright (c) 2002,2003 Regents of the University of California
 | 
				
			||||||
# All rights reserved.
 | 
					# All rights reserved.
 | 
				
			||||||
# 
 | 
					# 
 | 
				
			||||||
# Redistribution and use in source and binary forms, with or without 
 | 
					# Redistribution and use in source and binary forms, with or without 
 | 
				
			||||||
@@ -28,7 +28,8 @@
 | 
				
			|||||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
					# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
package SNMP::Info::Layer3;
 | 
					package SNMP::Info::Layer3;
 | 
				
			||||||
$VERSION = 0.1;
 | 
					$VERSION = 0.3;
 | 
				
			||||||
 | 
					# $Id$
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use strict;
 | 
					use strict;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -146,6 +147,8 @@ sub model {
 | 
				
			|||||||
    my $model = &SNMP::translateObj($id);
 | 
					    my $model = &SNMP::translateObj($id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $model =~ s/^cisco//i;
 | 
					    $model =~ s/^cisco//i;
 | 
				
			||||||
 | 
					    $model =~ s/^catalyst//;
 | 
				
			||||||
 | 
					    $model =~ s/^cat//;
 | 
				
			||||||
    return $model;
 | 
					    return $model;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -270,17 +273,6 @@ Arguments passed to new() are passed on to SNMP::Session::new()
 | 
				
			|||||||
        ) 
 | 
					        ) 
 | 
				
			||||||
    die "Couldn't connect.\n" unless defined $l3;
 | 
					    die "Couldn't connect.\n" unless defined $l3;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=item  $l3->session()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Sets or returns the SNMP::Session object
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # Get
 | 
					 | 
				
			||||||
    my $sess = $l3->session();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # Set
 | 
					 | 
				
			||||||
    my $newsession = new SNMP::Session(...);
 | 
					 | 
				
			||||||
    $l3->session($newsession);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
=back
 | 
					=back
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=head1 GLOBALS
 | 
					=head1 GLOBALS
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,7 @@
 | 
				
			|||||||
# SNMP::Info::Layer3::Aironet
 | 
					# SNMP::Info::Layer3::Aironet
 | 
				
			||||||
# Max Baker <max@warped.org>
 | 
					# Max Baker <max@warped.org>
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# Copyright (c) 2002, Regents of the University of California
 | 
					# Copyright (c) 2002,2003 Regents of the University of California
 | 
				
			||||||
# All rights reserved.
 | 
					# All rights reserved.
 | 
				
			||||||
# 
 | 
					# 
 | 
				
			||||||
# Redistribution and use in source and binary forms, with or without 
 | 
					# Redistribution and use in source and binary forms, with or without 
 | 
				
			||||||
@@ -28,7 +28,8 @@
 | 
				
			|||||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
					# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
package SNMP::Info::Layer3::Aironet;
 | 
					package SNMP::Info::Layer3::Aironet;
 | 
				
			||||||
$VERSION = 0.1;
 | 
					$VERSION = 0.3;
 | 
				
			||||||
 | 
					# $Id$
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use strict;
 | 
					use strict;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -220,17 +221,6 @@ Arguments passed to new() are passed on to SNMP::Session::new()
 | 
				
			|||||||
        ) 
 | 
					        ) 
 | 
				
			||||||
    die "Couldn't connect.\n" unless defined $aironet;
 | 
					    die "Couldn't connect.\n" unless defined $aironet;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=item  $aironet->session()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Sets or returns the SNMP::Session object
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # Get
 | 
					 | 
				
			||||||
    my $sess = $aironet->session();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # Set
 | 
					 | 
				
			||||||
    my $newsession = new SNMP::Session(...);
 | 
					 | 
				
			||||||
    $aironet->session($newsession);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
=back
 | 
					=back
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=head1 Globals
 | 
					=head1 Globals
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										365
									
								
								Info/Layer3/C3550.pm
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										365
									
								
								Info/Layer3/C3550.pm
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,365 @@
 | 
				
			|||||||
 | 
					# SNMP::Info::Layer3::C3550
 | 
				
			||||||
 | 
					# Max Baker <max@warped.org>
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# Copyright (c) 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:
 | 
				
			||||||
 | 
					# 
 | 
				
			||||||
 | 
					#     * 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 the University of California, Santa Cruz 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::Layer3::C3550;
 | 
				
			||||||
 | 
					$VERSION = 0.3;
 | 
				
			||||||
 | 
					# $Id$
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use strict;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use Exporter;
 | 
				
			||||||
 | 
					use SNMP::Info::Layer3;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					use vars qw/$VERSION $DEBUG %GLOBALS %MIBS %FUNCS %PORTSTAT %MUNGE $INIT/ ;
 | 
				
			||||||
 | 
					@SNMP::Info::Layer3::C3550::ISA = qw/SNMP::Info::Layer3 Exporter/;
 | 
				
			||||||
 | 
					@SNMP::Info::Layer3::C3550::EXPORT_OK = qw//;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					$DEBUG=0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# See SNMP::Info for the details of these data structures and 
 | 
				
			||||||
 | 
					#       the interworkings.
 | 
				
			||||||
 | 
					$INIT = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					%MIBS = (
 | 
				
			||||||
 | 
					         %SNMP::Info::Layer3::MIBS,  
 | 
				
			||||||
 | 
					         'CISCO-STACK-MIB' => 'moduleType',
 | 
				
			||||||
 | 
					         'CISCO-VTP-MIB'   => 'vtpVlanIndex'
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					%GLOBALS = (
 | 
				
			||||||
 | 
					            %SNMP::Info::Layer3::GLOBALS,
 | 
				
			||||||
 | 
					            'ports2'      => 'ifNumber',
 | 
				
			||||||
 | 
					            # these are in CISCO-STACK-MIB
 | 
				
			||||||
 | 
					            'serial'      => 'chassisSerialNumberString',    
 | 
				
			||||||
 | 
					            'ps1_type'    => 'chassisPs1Type',    
 | 
				
			||||||
 | 
					            'ps1_status'  => 'chassisPs1Status',    
 | 
				
			||||||
 | 
					            'ps2_type'    => 'chassisPs2Type',    
 | 
				
			||||||
 | 
					            'ps2_status'  => 'chassisPs2Status',    
 | 
				
			||||||
 | 
					            'fan'         => 'chassisFanStatus'
 | 
				
			||||||
 | 
					             );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					%FUNCS = (
 | 
				
			||||||
 | 
					            %SNMP::Info::Layer3::FUNCS,
 | 
				
			||||||
 | 
					            'i_type2'        => 'ifType',
 | 
				
			||||||
 | 
					            # CISCO-STACK-MIB::portEntry 
 | 
				
			||||||
 | 
					            'p_name'    => 'portName',
 | 
				
			||||||
 | 
					            'p_type'    => 'portType',
 | 
				
			||||||
 | 
					            'p_status'  => 'portOperStatus',
 | 
				
			||||||
 | 
					            'p_status2' => 'portAdditionalStatus',
 | 
				
			||||||
 | 
					            'p_speed'   => 'portAdminSpeed',
 | 
				
			||||||
 | 
					            'p_duplex'  => 'portDuplex',
 | 
				
			||||||
 | 
					            'p_port'    => 'portIfIndex',
 | 
				
			||||||
 | 
					            # CISCO-STACK-MIB::PortCpbEntry
 | 
				
			||||||
 | 
					            'p_speed_admin'  => 'portCpbSpeed',
 | 
				
			||||||
 | 
					            'p_duplex_admin' => 'portCpbDuplex',
 | 
				
			||||||
 | 
					            # CISCO-VTP-MIB::VtpVlanEntry 
 | 
				
			||||||
 | 
					            'v_state'   => 'vtpVlanState',
 | 
				
			||||||
 | 
					            'v_type'    => 'vtpVlanType',
 | 
				
			||||||
 | 
					            'v_name'    => 'vtpVlanName',
 | 
				
			||||||
 | 
					            'v_mtu'     => 'vtpVlanMtu',
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					%MUNGE = (
 | 
				
			||||||
 | 
					            # Inherit all the built in munging
 | 
				
			||||||
 | 
					            %SNMP::Info::Layer3::MUNGE,
 | 
				
			||||||
 | 
					            'm_ports_status' => \&munge_port_status,
 | 
				
			||||||
 | 
					            'p_duplex_admin' => \&SNMP::Info::munge_bits,
 | 
				
			||||||
 | 
					         );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					%PORTSTAT = (1 => 'other',
 | 
				
			||||||
 | 
					             2 => 'ok',
 | 
				
			||||||
 | 
					             3 => 'minorFault',
 | 
				
			||||||
 | 
					             4 => 'majorFault');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Changes binary byte describing each port into ascii, and returns
 | 
				
			||||||
 | 
					# an ascii list separated by spaces.
 | 
				
			||||||
 | 
					sub munge_port_status {
 | 
				
			||||||
 | 
					    my $status = shift;
 | 
				
			||||||
 | 
					    my @vals = map($PORTSTAT{$_},unpack('C*',$status));
 | 
				
			||||||
 | 
					    return join(' ',@vals);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Overidden Methods
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					sub i_type {
 | 
				
			||||||
 | 
					    my $c3550 = shift;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    my $p_port = $c3550->p_port();
 | 
				
			||||||
 | 
					    my $p_type  = $c3550->p_type();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Get more generic port types from IF-MIB
 | 
				
			||||||
 | 
					    my $i_type  = $c3550->i_type2();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Now Override w/ port entries
 | 
				
			||||||
 | 
					    foreach my $port (keys %$p_type) {
 | 
				
			||||||
 | 
					        my $iid = $p_port->{$port};
 | 
				
			||||||
 | 
					        $i_type->{$iid} = $p_type->{$port};  
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return $i_type;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					sub i_duplex {
 | 
				
			||||||
 | 
					    my $c3550 = shift;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    my $p_port = $c3550->p_port();
 | 
				
			||||||
 | 
					    my $p_duplex  = $c3550->p_duplex();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    my %i_duplex;
 | 
				
			||||||
 | 
					    foreach my $port (keys %$p_duplex) {
 | 
				
			||||||
 | 
					        my $iid = $p_port->{$port};
 | 
				
			||||||
 | 
					        $i_duplex{$iid} = $p_duplex->{$port};
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    return \%i_duplex; 
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					sub i_duplex_admin {
 | 
				
			||||||
 | 
					    my $c3550 = shift;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    my $p_port          = $c3550->p_port();
 | 
				
			||||||
 | 
					    my $p_duplex_admin  = $c3550->p_duplex_admin();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    my %i_duplex_admin;
 | 
				
			||||||
 | 
					    foreach my $port (keys %$p_duplex_admin) {
 | 
				
			||||||
 | 
					        my $iid = $p_port->{$port};
 | 
				
			||||||
 | 
					        next unless defined $iid;
 | 
				
			||||||
 | 
					        my $duplex = $p_duplex_admin->{$port};
 | 
				
			||||||
 | 
					        next unless defined $duplex;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        my $string = 'other';
 | 
				
			||||||
 | 
					        # see CISCO-STACK-MIB for a description of the bits
 | 
				
			||||||
 | 
					        $string = 'half' if ($duplex =~ /001$/ or $duplex =~ /0100.$/);
 | 
				
			||||||
 | 
					        $string = 'full' if ($duplex =~ /010$/ or $duplex =~ /100.0$/);
 | 
				
			||||||
 | 
					        # we'll call it auto if both full and half are turned on, or if the
 | 
				
			||||||
 | 
					        #   specifically 'auto' flag bit is set.
 | 
				
			||||||
 | 
					        $string = 'auto' 
 | 
				
			||||||
 | 
					            if ($duplex =~ /1..$/ or $duplex =~ /110..$/ or $duplex =~ /..011$/);
 | 
				
			||||||
 | 
					       
 | 
				
			||||||
 | 
					        $i_duplex_admin{$iid} = $string;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    return \%i_duplex_admin; 
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					sub vendor {
 | 
				
			||||||
 | 
					    return 'cisco';
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					sub model {
 | 
				
			||||||
 | 
					    my $c3550 = shift;
 | 
				
			||||||
 | 
					    my $id = $c3550->id();
 | 
				
			||||||
 | 
					    my $model = &SNMP::translateObj($id);
 | 
				
			||||||
 | 
					    $model =~ s/^catalyst//;
 | 
				
			||||||
 | 
					    $model =~ s/(24|48)$//;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    return $model;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Ports is encoded into the model number
 | 
				
			||||||
 | 
					sub ports {
 | 
				
			||||||
 | 
					    my $c3550 = shift;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    my $ports2 = $c3550->ports2();    
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    my $id = $c3550->id();
 | 
				
			||||||
 | 
					    my $model = &SNMP::translateObj($id);
 | 
				
			||||||
 | 
					    if ($model =~ /(24|48)$/) {
 | 
				
			||||||
 | 
					        return $1;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    return $ports2;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					1;
 | 
				
			||||||
 | 
					__END__
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=head1 NAME
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					SNMP::Info::Layer3::C3550 - Perl5 Interface to Cisco Catalyst 3550 Layer 2/3 Switches running IOS
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=head1 DESCRIPTION
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Abstraction subclass for Cisco Catalyst 3550 Layer 2/3 Switches.  These devices run
 | 
				
			||||||
 | 
					IOS but have some of the same charactersitics as the Catalyst WS-C family (5xxx,6xxx). 
 | 
				
			||||||
 | 
					For example, forwarding tables are held in VLANs, and extened interface information
 | 
				
			||||||
 | 
					is gleened from CISCO-SWITCH-MIB.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=head1 AUTHOR
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Max Baker (C<max@warped.org>)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=head1 SYNOPSIS
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 my $c3550 = new SNMP::Info::Layer3::C3550(DestHost  => 'router' , 
 | 
				
			||||||
 | 
					                              Community => 'public' ); 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					See L<SNMP::Info> and L<SNMP::Info::Layer3> for all the inherited methods.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=head1 CREATING AN OBJECT
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=over
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=item  new SNMP::Info::Layer3::C3550()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Arguments passed to new() are passed on to SNMP::Session::new()
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    my $c3550 = new SNMP::Info::Layer3::C3550(
 | 
				
			||||||
 | 
					        DestHost => $host,
 | 
				
			||||||
 | 
					        Community => 'public',
 | 
				
			||||||
 | 
					        Version => 3,...
 | 
				
			||||||
 | 
					        ) 
 | 
				
			||||||
 | 
					    die "Couldn't connect.\n" unless defined $c3550;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=back
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=head1 GLOBAL Values
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=over
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=item $c3550->serial()
 | 
				
			||||||
 | 
					(B<chassisSerialNumberString>)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=item $c3550->model()
 | 
				
			||||||
 | 
					(B<chassisModel>)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=item $c3550->ps1_type()
 | 
				
			||||||
 | 
					(B<chassisPs1Type>)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=item $c3550->ps2_type()
 | 
				
			||||||
 | 
					(B<chassisPs2Type>)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=item $c3550->ps1_status()
 | 
				
			||||||
 | 
					(B<chassisPs1Status>)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=item $c3550->ps2_status()
 | 
				
			||||||
 | 
					(B<chassisPs2Status>)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=item $c3550->slots()
 | 
				
			||||||
 | 
					(B<chassisNumSlots>)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=item $c3550->fan()
 | 
				
			||||||
 | 
					(B<chassisFanStatus>)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=item $c3550->vendor()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Returns 'cisco'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=back
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=head1 TABLE ENTRIES
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=head2 Overrides
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=over
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=item $c3550->i_type()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Crosses p_port() with p_type() and returns the results. 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Overrides with ifType if p_type() isn't available.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=item $c3550->i_name()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Crosses p_name with p_port and returns results.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=item $c3550->i_duplex()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Crosses p_duplex with p_port and returns results.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=item $c3550->i_duplex_admin()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Crosses p_duplex_admin with p_port.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Munges bit_string returned from p_duplex_admin to get duplex settings.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=back
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=head2 Port Entry Table (CISCO-STACK-MIB::portTable)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=over
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=item $c3550->p_name()
 | 
				
			||||||
 | 
					(B<portName>)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=item $c3550->p_type()
 | 
				
			||||||
 | 
					(B<portType>)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=item $c3550->p_status()
 | 
				
			||||||
 | 
					(B<portOperStatus>)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=item $c3550->p_status2()
 | 
				
			||||||
 | 
					(B<portAdditionalStatus>)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=item $c3550->p_speed()
 | 
				
			||||||
 | 
					(B<portAdminSpeed>)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=item $c3550->p_duplex()
 | 
				
			||||||
 | 
					(B<portDuplex>)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=item $c3550->p_port()
 | 
				
			||||||
 | 
					(B<portIfIndex>)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=back
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=head2 Port Capability Table (CISCO-STACK-MIB::portCpbTable)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=over
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=item $c3550->p_speed_admin()
 | 
				
			||||||
 | 
					(B<portCpbSpeed>)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=item $c3550->p_duplex_admin()
 | 
				
			||||||
 | 
					(B<portCpbDuplex>)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=back
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=head2 VLAN Entry Table
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					See ftp://ftp.cisco.com/pub/mibs/supportlists/wsc5000/wsc5000-communityIndexing.html
 | 
				
			||||||
 | 
					for a good treaty of how to connect to the VLANs
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=over
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=item $c3550->v_state()
 | 
				
			||||||
 | 
					(B<vtpVlanState>)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=item $c3550->v_type()
 | 
				
			||||||
 | 
					(B<vtpVlanType>)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=item $c3550->v_name()
 | 
				
			||||||
 | 
					(B<vtpVlanName>)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=item $c3550->v_mtu()
 | 
				
			||||||
 | 
					(B<vtpVlanMtu>)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=back
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					=cut
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1,7 +1,7 @@
 | 
				
			|||||||
# SNMP::Info::Layer3::Foundry - SNMP Interface to Foundry devices
 | 
					# SNMP::Info::Layer3::Foundry - SNMP Interface to Foundry devices
 | 
				
			||||||
# Max Baker <max@warped.org>
 | 
					# Max Baker <max@warped.org>
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# Copyright (c) 2002, Regents of the University of California
 | 
					# Copyright (c) 2002,2003 Regents of the University of California
 | 
				
			||||||
# All rights reserved.
 | 
					# All rights reserved.
 | 
				
			||||||
# 
 | 
					# 
 | 
				
			||||||
# Redistribution and use in source and binary forms, with or without 
 | 
					# Redistribution and use in source and binary forms, with or without 
 | 
				
			||||||
@@ -28,7 +28,8 @@
 | 
				
			|||||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
					# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
package SNMP::Info::Layer3::Foundry;
 | 
					package SNMP::Info::Layer3::Foundry;
 | 
				
			||||||
$VERSION = 0.1;
 | 
					$VERSION = 0.3;
 | 
				
			||||||
 | 
					# $Id$
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use strict;
 | 
					use strict;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -241,6 +242,8 @@ Max Baker (C<max@warped.org>)
 | 
				
			|||||||
 my $foundry = new SNMP::Info::Layer3::Foundry(DestHost  => 'switch' , 
 | 
					 my $foundry = new SNMP::Info::Layer3::Foundry(DestHost  => 'switch' , 
 | 
				
			||||||
                              Community => 'public' ); 
 | 
					                              Community => 'public' ); 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					See L<SNMP::Info> and L<SNMP::Info::Layer3> for all inherited methods.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=head1 CREATING AN OBJECT
 | 
					=head1 CREATING AN OBJECT
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=over
 | 
					=over
 | 
				
			||||||
@@ -257,17 +260,6 @@ Arguments passed to new() are passed on to SNMP::Session::new()
 | 
				
			|||||||
        ) 
 | 
					        ) 
 | 
				
			||||||
    die "Couldn't connect.\n" unless defined $foundry;
 | 
					    die "Couldn't connect.\n" unless defined $foundry;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=item  $foundry->session()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Sets or returns the SNMP::Session object
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # Get
 | 
					 | 
				
			||||||
    my $sess = $foundry->session();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # Set
 | 
					 | 
				
			||||||
    my $newsession = new SNMP::Session(...);
 | 
					 | 
				
			||||||
    $foundry->session($newsession);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
=back
 | 
					=back
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=head1 GLOBAL VALUES
 | 
					=head1 GLOBAL VALUES
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										23
									
								
								Info/MAU.pm
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								Info/MAU.pm
									
									
									
									
									
								
							@@ -1,7 +1,7 @@
 | 
				
			|||||||
# SNMP::Info::MAU - Media Access Unit - RFC2668
 | 
					# SNMP::Info::MAU - Media Access Unit - RFC2668
 | 
				
			||||||
# Max Baker <max@warped.org>
 | 
					# Max Baker <max@warped.org>
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# Copyright (c) 2002, Regents of the University of California
 | 
					# Copyright (c) 2002,2003 Regents of the University of California
 | 
				
			||||||
# All rights reserved.
 | 
					# All rights reserved.
 | 
				
			||||||
# 
 | 
					# 
 | 
				
			||||||
# Redistribution and use in source and binary forms, with or without 
 | 
					# Redistribution and use in source and binary forms, with or without 
 | 
				
			||||||
@@ -28,7 +28,8 @@
 | 
				
			|||||||
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
					# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
package SNMP::Info::MAU;
 | 
					package SNMP::Info::MAU;
 | 
				
			||||||
$VERSION = 0.1;
 | 
					$VERSION = 0.3;
 | 
				
			||||||
 | 
					# $Id$
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use strict;
 | 
					use strict;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -143,24 +144,6 @@ Arguments passed to new() are passed on to SNMP::Session::new()
 | 
				
			|||||||
        ) 
 | 
					        ) 
 | 
				
			||||||
    die "Couldn't connect.\n" unless defined $mau;
 | 
					    die "Couldn't connect.\n" unless defined $mau;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=item  $mau->session()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Sets or returns the SNMP::Session object
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # Get
 | 
					 | 
				
			||||||
    my $sess = $mau->session();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # Set
 | 
					 | 
				
			||||||
    my $newsession = new SNMP::Session(...);
 | 
					 | 
				
			||||||
    $mau->session($newsession);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
=item  $mau->all(), $mau->load_all()
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Queries each of the methods listed in %FUNCS and returns a hash reference.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
$mau->all() will call $mau->load_all() once and then return cahced valued.  
 | 
					 | 
				
			||||||
Use $mau->load_all() to reload from the device.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
=back
 | 
					=back
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=head1 MAU Global Configuration Values
 | 
					=head1 MAU Global Configuration Values
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										2
									
								
								MANIFEST
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								MANIFEST
									
									
									
									
									
								
							@@ -1,3 +1,4 @@
 | 
				
			|||||||
 | 
					ChangeLog
 | 
				
			||||||
COPYRIGHT
 | 
					COPYRIGHT
 | 
				
			||||||
Info.pm
 | 
					Info.pm
 | 
				
			||||||
Info/Bridge.pm
 | 
					Info/Bridge.pm
 | 
				
			||||||
@@ -15,6 +16,7 @@ Info/Layer2/HP.pm
 | 
				
			|||||||
Info/Layer3.pm
 | 
					Info/Layer3.pm
 | 
				
			||||||
Info/Layer3/Aironet.pm
 | 
					Info/Layer3/Aironet.pm
 | 
				
			||||||
Info/Layer3/Foundry.pm
 | 
					Info/Layer3/Foundry.pm
 | 
				
			||||||
 | 
					Info/Layer3/C3550.pm
 | 
				
			||||||
Info/MAU.pm
 | 
					Info/MAU.pm
 | 
				
			||||||
MANIFEST
 | 
					MANIFEST
 | 
				
			||||||
Makefile.PL
 | 
					Makefile.PL
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,9 +1,12 @@
 | 
				
			|||||||
# SNMP::Info -  Makefile.PL
 | 
					# SNMP::Info -  Makefile.PL
 | 
				
			||||||
 | 
					# $Id$
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use ExtUtils::MakeMaker;
 | 
					use ExtUtils::MakeMaker;
 | 
				
			||||||
WriteMakefile(
 | 
					WriteMakefile(
 | 
				
			||||||
    'NAME'               => 'SNMP::Info',
 | 
					    'NAME'               => 'SNMP::Info',
 | 
				
			||||||
    'VERSION_FROM'       => 'Info.pm',
 | 
					    'VERSION_FROM'       => 'Info.pm',
 | 
				
			||||||
    'PREREQ_PM'          => {'SNMP' => '4'},
 | 
					# SNMP not available on CPAN -- not installable by CPAN
 | 
				
			||||||
 | 
					#    'PREREQ_PM'          => {'SNMP' => '4'},
 | 
				
			||||||
    ($] >= 5.005 ?    
 | 
					    ($] >= 5.005 ?    
 | 
				
			||||||
          (ABSTRACT_FROM => 'Info.pm', 
 | 
					          (ABSTRACT_FROM => 'Info.pm', 
 | 
				
			||||||
           AUTHOR        => 'Max Baker <max@warped.org>')
 | 
					           AUTHOR        => 'Max Baker <max@warped.org>')
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										38
									
								
								README
									
									
									
									
									
								
							
							
						
						
									
										38
									
								
								README
									
									
									
									
									
								
							@@ -4,7 +4,7 @@ NAME
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
VERSION
 | 
					VERSION
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    SNMP::Info - Version 0.1
 | 
					    SNMP::Info - Version 0.3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
AUTHOR
 | 
					AUTHOR
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -14,7 +14,7 @@ AUTHOR
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
COPYRIGHT AND LICENCE
 | 
					COPYRIGHT AND LICENCE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Copyright (c) 2002, Regents of the University of California All rights
 | 
					    Copyright (c) 2002-3, Regents of the University of California All rights
 | 
				
			||||||
    reserved.
 | 
					    reserved.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Redistribution and use in source and binary forms, with or without
 | 
					    Redistribution and use in source and binary forms, with or without
 | 
				
			||||||
@@ -61,7 +61,11 @@ SYNOPSIS
 | 
				
			|||||||
     # Find out the Duplex status for the ports
 | 
					     # Find out the Duplex status for the ports
 | 
				
			||||||
     my $interfaces = $more_specific_device->interfaces();
 | 
					     my $interfaces = $more_specific_device->interfaces();
 | 
				
			||||||
     my $i_duplex   = $more_specific_device->i_duplex();
 | 
					     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){
 | 
					     foreach my $iid (keys %$interfaces){
 | 
				
			||||||
 
 | 
					 
 | 
				
			||||||
        my $duplex = $i_duplex->{$iid};
 | 
					        my $duplex = $i_duplex->{$iid};
 | 
				
			||||||
@@ -69,8 +73,12 @@ SYNOPSIS
 | 
				
			|||||||
        # Print out physical port name, not snmp iid
 | 
					        # Print out physical port name, not snmp iid
 | 
				
			||||||
        my $port  = $interfaces->{$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
 | 
					REQUIREMENTS
 | 
				
			||||||
@@ -162,6 +170,7 @@ Sub Classes
 | 
				
			|||||||
    SNMP::Info::Layer2::HP
 | 
					    SNMP::Info::Layer2::HP
 | 
				
			||||||
    SNMP::Info::Layer3::Aironet
 | 
					    SNMP::Info::Layer3::Aironet
 | 
				
			||||||
    SNMP::Info::Layer3::Foundry
 | 
					    SNMP::Info::Layer3::Foundry
 | 
				
			||||||
 | 
					    SNMP::Info::Layer3::C3550
 | 
				
			||||||
  Details
 | 
					  Details
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    * SNMP::Info::Bridge - BRIDGE-MIB - RFC1286 Support
 | 
					    * SNMP::Info::Bridge - BRIDGE-MIB - RFC1286 Support
 | 
				
			||||||
@@ -250,6 +259,7 @@ Sub Classes
 | 
				
			|||||||
         AWCVX-MIB        - Aironet Specific MIB values
 | 
					         AWCVX-MIB        - Aironet Specific MIB values
 | 
				
			||||||
         IEEE802dot11-MIB - IEEE 802.11 Specific MIB (currently draft)
 | 
					         IEEE802dot11-MIB - IEEE 802.11 Specific MIB (currently draft)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    * SNMP::Info::Layer3::C3550 - Cisco Catalyst 3550 Layer2/3 Switch
 | 
				
			||||||
    * SNMP::Info::Layer3::Foundry - Older Foundry Networks Devices Support
 | 
					    * SNMP::Info::Layer3::Foundry - Older Foundry Networks Devices Support
 | 
				
			||||||
        Inherits SNMP::Info::Bridge
 | 
					        Inherits SNMP::Info::Bridge
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -299,14 +309,15 @@ METHODS
 | 
				
			|||||||
        Algorithm for SubClass Detection:
 | 
					        Algorithm for SubClass Detection:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                Layer3 Support                     -> SNMP::Info::Layer3
 | 
					                Layer3 Support                     -> SNMP::Info::Layer3
 | 
				
			||||||
                    Foundry                        -> SNMP::Info::Foundry
 | 
					                    Aironet                        -> SNMP::Info::Layer3::Aironet
 | 
				
			||||||
                    Aironet                        -> SNMP::Info::Aironet
 | 
					                    Catalyst 3550                  -> SNMP::Info::Layer3::C3550
 | 
				
			||||||
 | 
					                    Foundry                        -> SNMP::Info::Layer3::Foundry
 | 
				
			||||||
                Elsif Layer2 (no Layer3)           -> SNMP::Info::Layer2 
 | 
					                Elsif Layer2 (no Layer3)           -> SNMP::Info::Layer2 
 | 
				
			||||||
 | 
					                    Bay Networks                   -> SNMP::Info::Layer2::Bay
 | 
				
			||||||
                    Catalyst 1900                  -> SNMP::Info::Layer2::C1900
 | 
					                    Catalyst 1900                  -> SNMP::Info::Layer2::C1900
 | 
				
			||||||
                    Catalyst 2900XL (IOS)          -> SNMP::Info::Layer2::C2900
 | 
					                    Catalyst 2900XL (IOS)          -> SNMP::Info::Layer2::C2900
 | 
				
			||||||
                    Catalyst WS-C (2926,5xxx,6xxx) -> SNMP::Info::Layer2::Catalyst
 | 
					                    Catalyst WS-C (2926,5xxx,6xxx) -> SNMP::Info::Layer2::Catalyst
 | 
				
			||||||
                    HP Procurve                    -> SNMP::Info::Layer2::HP
 | 
					                    HP Procurve                    -> SNMP::Info::Layer2::HP
 | 
				
			||||||
                    Bay Networks                   -> SNMP::Info::Layer2::Bay
 | 
					 | 
				
			||||||
                Elsif Layer1 Support               -> SNMP::Info::Layer1
 | 
					                Elsif Layer1 Support               -> SNMP::Info::Layer1
 | 
				
			||||||
                    Allied                         -> SNMP::Info::Layer1::Allied
 | 
					                    Allied                         -> SNMP::Info::Layer1::Allied
 | 
				
			||||||
                    Asante                         -> SNMP::Info::Layer1::Asante
 | 
					                    Asante                         -> SNMP::Info::Layer1::Asante
 | 
				
			||||||
@@ -611,8 +622,8 @@ CREATING SUBCLASSES
 | 
				
			|||||||
        Takes a binary IP and makes it dotted ASCII
 | 
					        Takes a binary IP and makes it dotted ASCII
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    munge_mac()
 | 
					    munge_mac()
 | 
				
			||||||
        Takes an octet stream and returns a colon separated ASCII hex
 | 
					        Takes an octet stream (HEX-STRING) and returns a colon separated
 | 
				
			||||||
        string.
 | 
					        ASCII hex string.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    munge_octet2hex()
 | 
					    munge_octet2hex()
 | 
				
			||||||
        Takes a binary octet stream and returns an ASCII hex string
 | 
					        Takes a binary octet stream and returns an ASCII hex string
 | 
				
			||||||
@@ -657,6 +668,13 @@ CREATING SUBCLASSES
 | 
				
			|||||||
        Example: $info->name() calls autoload which calls
 | 
					        Example: $info->name() calls autoload which calls
 | 
				
			||||||
        $info->_global('name').
 | 
					        $info->_global('name').
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    $info->_set(attr,val,iid)
 | 
				
			||||||
 | 
					        Used internally by AUTOLOAD to run an SNMP set command for dynamic
 | 
				
			||||||
 | 
					        methods listed in either %GLOBALS or %FUNCS.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        Example: $info->set_name('dog',3) uses autoload to resolve to
 | 
				
			||||||
 | 
					        $info->_set('name','dog',3);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   Functions for SNMP Tables (%FUNCS)
 | 
					   Functions for SNMP Tables (%FUNCS)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    $info->load_all()
 | 
					    $info->load_all()
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										17
									
								
								test.pl
									
									
									
									
									
								
							
							
						
						
									
										17
									
								
								test.pl
									
									
									
									
									
								
							@@ -1,17 +0,0 @@
 | 
				
			|||||||
# SNMP::Info - test.pl
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
# Before `make install' is performed this script should be runnable with
 | 
					 | 
				
			||||||
# `make test'. After `make install' it should work as `perl test.pl'
 | 
					 | 
				
			||||||
#
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
use Test;
 | 
					 | 
				
			||||||
BEGIN { plan tests => 1 };
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
use SNMP::Info;
 | 
					 | 
				
			||||||
ok(1); 
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# If we made it this far, we're ok.
 | 
					 | 
				
			||||||
#########################
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# No tests yet.
 | 
					 | 
				
			||||||
print "No test's implemented yet. \n";
 | 
					 | 
				
			||||||
		Reference in New Issue
	
	Block a user