diff --git a/Info/CDP.pm b/Info/CDP.pm index 09ced19a..d252405c 100644 --- a/Info/CDP.pm +++ b/Info/CDP.pm @@ -138,16 +138,6 @@ __END__ SNMP::Info::CDP - Perl5 Interface to Cisco Discovery Protocol (CDP) using SNMP -=head1 DESCRIPTION - -SNMP::Info::CDP is a subclass of SNMP::Info that provides an object oriented -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. CDP is implemented in Cisco and some HP devices. - -Normally you do not use this module directly, but from inside SNMP::Info - =head1 AUTHOR Max Baker (C) @@ -161,12 +151,12 @@ Max Baker (C) Community => 'public', Version => 2 ); - + my $class = $cdp->class(); print " Using device sub class : $class\n"; - + $hascdp = $cdp->hasCDP() ? 'yes' : 'no'; - + # Print out a map of device ports with CDP neighbors: my $interfaces = $cdp->interfaces(); my $c_if = $cdp->c_if(); @@ -181,14 +171,36 @@ Max Baker (C) print "Port : $port connected to $neighbor / $neighbor_port\n"; } -See L for all other inherited methods. +=head1 DESCRIPTION -=head2 Your Device May Vary +SNMP::Info::CDP is a subclass of SNMP::Info that provides an object oriented +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. CDP is implemented in Cisco and some HP devices. + +Create or use a device subclass that inherits this class. Do not use directly. Each device implements a subset of the global and cache entries. Check the return value to see if that data is held by the device. -=head1 CDP GLOBAL VALUES +=head2 Inherited Classes + +None. + +=head2 Required MIBs + +=over + +=item CISCO-CDP-MIB + +=back + +MIBs can be found at ftp://ftp.cisco.com/pub/mibs/v2/v2.tar.gz + +=head1 GLOBAL METHODS + +These are methods that return scalar values from SNMP =over @@ -200,7 +212,8 @@ Accounts for SNMP version 1 devices which may have CDP but not cdp_run() =item $cdp->cdp_run() -Is CDP enabled on this device? +Is CDP enabled on this device? Note that a lot of Cisco devices that implement +CDP don't implement this value. @#%$! (B) @@ -226,7 +239,12 @@ This is the device id broadcast via CDP to other devices, and is what is retriev =back -=head1 CDP CACHE ENTRIES +=head1 TABLE METHODS + +These are methods that return tables of information in the form of a reference +to a hash. + +=head2 CDP CACHE ENTRIES =over diff --git a/Info/Layer1.pm b/Info/Layer1.pm index c9e9b766..4fdde966 100644 --- a/Info/Layer1.pm +++ b/Info/Layer1.pm @@ -28,7 +28,7 @@ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. package SNMP::Info::Layer1; -$VERSION = 0.3; +$VERSION = 0.4; # $Id$ use strict; @@ -163,22 +163,7 @@ __END__ =head1 NAME -SNMP::Info::Layer1 - Perl5 Interface to Layer1 network devices. - -=head1 DESCRIPTION - -Provides abstraction to the configuration information obtainable from a -Layer1 device through SNMP. Information is stored in a number of MIBs. - -Inherits from: - - SNMP::Info - -MIBS: - - MIBS listed in SNMP::Info - -Cisco MIBs can be found at ftp://ftp.cisco.com/pub/mibs/v2/v2.tar.gz +SNMP::Info::Layer1 - Perl5 Interface to network devices serving Layer1 only. =head1 AUTHOR @@ -186,34 +171,72 @@ Max Baker (C) =head1 SYNOPSIS - my $l1 = new SNMP::Info::Layer1(DestHost => 'mybridge' , - Community => 'public' ); + # Let SNMP::Info determine the correct subclass for you. + my $l1 = new SNMP::Info( + AutoSpecify => 1, + Debug => 1, + # These arguments are passed directly on to SNMP::Session + DestHost => 'myswitch', + Community => 'public', + Version => 1 + ) + or die "Can't connect to DestHost.\n"; -=head1 CREATING AN OBJECT + my $class = $l1->class(); + print "SNMP::Info determined this device to fall under subclass : $class\n"; + + # Let's get some basic Port information + my $interfaces = $l1->interfaces(); + my $i_up = $l1->i_up(); + my $i_speed = $l1->i_speed(); + + foreach my $iid (keys %$interfaces) { + my $port = $interfaces->{$iid}; + my $up = $i_up->{$iid}; + my $speed = $i_speed->{$iid} + print "Port $port is $up. Port runs at $speed.\n"; + } + +=head1 DESCRIPTION + +This class is usually used as a superclass for more specific device classes listed under +SNMP::Info::Layer1::* Please read all docs under SNMP::Info first. + +Provides abstraction to the configuration information obtainable from a +Layer1 device through SNMP. Information is stored in a number of MIBs. + +For speed or debugging purposes you can call the subclass directly, but not after determining +a more specific class using the method above. + + my $l1 = new SNMP::Info::Layer1(...); + +=head2 Inherited Classes =over -=item new SNMP::Info::Layer1() - -Arguments passed to new() are passed on to SNMP::Session::new() - - - my $l1 = new SNMP::Info::Layer1( - DestHost => $host, - Community => 'public', - Version => 3,... - ) - die "Couldn't connect.\n" unless defined $l1; +=item SNMP::Info =back -=head1 GLOBALS +=head2 Required MIBs =over -=item $l1->vendor() +=item SNMP-REPEATER-MIB -Trys to discover the vendor from $l1->model() and $l1->vendor() +=item Inherited Classes + +MIBs required for SNMP::Info + +=back + +SNMP-REPEATER-MIB needs to be extracted from ftp://ftp.cisco.com/pub/mibs/v1/v1.tar.gz + +=head1 GLOBALS + +These are methods that return scalar value from SNMP + +=over =item $l1->ports_managed() @@ -221,6 +244,16 @@ Gets the number of ports under the interface mib (B) +=back + +=head2 Overrides + +=over + +=item $l1->vendor() + +Trys to discover the vendor from $l1->model() and $l1->vendor() + =item $l1->ports() Adds the values from rptr_ports() and ports_managed() @@ -233,8 +266,15 @@ Number of 'groups' in the Repeater MIB =back +=head2 Globals imported from SNMP::Info + +See documentation in SNMP::Info for details. + =head1 TABLE ENTRIES +These are methods that return tables of information in the form of a reference +to a hash. + =head2 Overrides =over @@ -279,4 +319,8 @@ Group (slot) Number for given port. =back +=head2 Table Methods imported from SNMP::Info + +See documentation in SNMP::Info for details. + =cut