version 0.5 prep

This commit is contained in:
Max Baker
2003-06-10 16:50:44 +00:00
parent d2f67b2db2
commit f988cecc4d
23 changed files with 182 additions and 26 deletions

View File

@@ -1,11 +1,12 @@
SNMP::Info - Perl5 OO Interface to Network Devices and SNMP MIBs SNMP::Info - Perl5 OO Interface to Network Devices and SNMP MIBs
ChangeLog $Id$ ChangeLog $Id$
version 0.5 () version 0.5 (06/10/03)
* Added ability to get paritial tables. For example to get the * Added ability to get paritial tables. For example to get the
IP routing table for 128.114.* you can do IP routing table for 128.114.* you can do
$ipr = $dev->ipr_dest('128.114'); $ipr = $dev->ipr_dest('128.114');
* Added IP Routing Table entries from RFC1213 to SNMP::Info * Added IP Routing Table entries from RFC1213 to SNMP::Info
* minor bug fixes
version 0.4 (04/29/03) version 0.4 (04/29/03)
* BIG CHANGE ! Internal Data structure has changed. * BIG CHANGE ! Internal Data structure has changed.

19
Info.pm
View File

@@ -7,7 +7,7 @@
# See COPYRIGHT at bottom # See COPYRIGHT at bottom
package SNMP::Info; package SNMP::Info;
$VERSION = 0.4; $VERSION = 0.5;
use strict; use strict;
use Exporter; use Exporter;
@@ -27,7 +27,7 @@ SNMP::Info - Object Oriented Perl5 Interface to Network devices and MIBs through
=head1 VERSION =head1 VERSION
SNMP::Info - Version 0.4 SNMP::Info - Version 0.5
=head1 AUTHOR =head1 AUTHOR
@@ -804,6 +804,7 @@ correspond with the number of physical ports
Each of these methods returns a hash_reference to a hash keyed on the interface index in SNMP. Each of these methods returns a hash_reference to a hash keyed on the interface index in SNMP.
Example : $info->interfaces() might return Example : $info->interfaces() might return
{ '1.12' => 'FastEthernet/0', { '1.12' => 'FastEthernet/0',
'2.15' => 'FastEthernet/1', '2.15' => 'FastEthernet/1',
'9.99' => 'FastEthernet/2' '9.99' => 'FastEthernet/2'
@@ -812,6 +813,20 @@ Example : $info->interfaces() might return
The key is what you would see if you were to do an snmpwalk, and in some cases changes between reboots of The key is what you would see if you were to do an snmpwalk, and in some cases changes between reboots of
the network device. the network device.
=head2 Partial Table Fetches
If you want to get only a part of an SNMP table and you know the IID for the part of the table that you
want, you can specify it in the call:
$local_routes = $info->ipr_route('192.168.0');
This will only fetch entries in the table that start with C<192.168.0>, which in this case are routes on the local
network.
Remember that you must supply the partial IID (a numeric OID).
Partial table results are not cached.
=head3 Interface Information =head3 Interface Information
=over =over

View File

@@ -28,7 +28,7 @@
# 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.4; $VERSION = 0.5;
# $Id$ # $Id$
use strict; use strict;

View File

@@ -28,7 +28,7 @@
# 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.4; $VERSION = 0.5;
# $Id$ # $Id$
use strict; use strict;

View File

@@ -28,7 +28,7 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::CiscoStats; package SNMP::Info::CiscoStats;
$VERSION = 0.4; $VERSION = 0.5;
# $Id$ # $Id$
use strict; use strict;

View File

@@ -28,7 +28,7 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Entity; package SNMP::Info::Entity;
$VERSION = 0.4; $VERSION = 0.5;
# $Id$ # $Id$
use strict; use strict;

View File

@@ -28,7 +28,7 @@
# 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.4; $VERSION = 0.5;
# $Id$ # $Id$
use strict; use strict;

View File

@@ -28,7 +28,7 @@
# 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.4; $VERSION = 0.5;
# $Id$ # $Id$
use strict; use strict;

View File

@@ -28,7 +28,7 @@
# 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.4; $VERSION = 0.5;
# $Id$ # $Id$
use strict; use strict;

View File

@@ -28,7 +28,7 @@
# 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.4; $VERSION = 0.5;
# $Id$ # $Id$
use strict; use strict;

View File

@@ -28,7 +28,7 @@
# 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.4; $VERSION = 0.5;
# $Id$ # $Id$
use strict; use strict;

View File

@@ -28,7 +28,7 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer2::Aironet; package SNMP::Info::Layer2::Aironet;
$VERSION = 0.4; $VERSION = 0.5;
# $Id$ # $Id$
use strict; use strict;

View File

@@ -28,7 +28,7 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer2::Bay; package SNMP::Info::Layer2::Bay;
$VERSION = 0.4; $VERSION = 0.5;
# $Id$ # $Id$
use strict; use strict;

View File

@@ -28,7 +28,7 @@
# 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.4; $VERSION = 0.5;
# $Id$ # $Id$
use strict; use strict;

View File

@@ -28,7 +28,7 @@
# 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.4; $VERSION = 0.5;
# $Id$ # $Id$
use strict; use strict;

View File

@@ -28,7 +28,7 @@
# 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.4; $VERSION = 0.5;
# $Id$ # $Id$
use strict; use strict;

View File

@@ -28,7 +28,7 @@
# 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.4; $VERSION = 0.5;
# $Id$ # $Id$
use strict; use strict;

View File

@@ -28,7 +28,7 @@
# 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.4; $VERSION = 0.5;
# $Id$ # $Id$
use strict; use strict;

View File

@@ -28,7 +28,7 @@
# 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.4; $VERSION = 0.5;
# $Id$ # $Id$
use strict; use strict;

View File

@@ -28,7 +28,7 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package SNMP::Info::Layer3::C3550; package SNMP::Info::Layer3::C3550;
$VERSION = 0.4; $VERSION = 0.5;
# $Id$ # $Id$
use strict; use strict;

View File

@@ -28,7 +28,7 @@
# 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.4; $VERSION = 0.5;
# $Id$ # $Id$
use strict; use strict;

View File

@@ -28,7 +28,7 @@
# 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.4; $VERSION = 0.5;
# $Id$ # $Id$
use strict; use strict;

146
README
View File

@@ -5,7 +5,7 @@ NAME
VERSION VERSION
SNMP::Info - Version 0.4 SNMP::Info - Version 0.5
AUTHOR AUTHOR
@@ -64,6 +64,12 @@ SYNOPSIS
} }
SUPPORT
Please direct all support, help, and bug requests to the snmp-info-users
Mailing List at
http://lists.sourceforge.net/lists/listinfo/snmp-info-users
DESCRIPTION DESCRIPTION
SNMP::Info gives an object oriented interface to information obtained SNMP::Info gives an object oriented interface to information obtained
@@ -477,12 +483,30 @@ USAGE
Each of these methods returns a hash_reference to a hash keyed on the Each of these methods returns a hash_reference to a hash keyed on the
interface index in SNMP. interface index in SNMP.
Example : $info->interfaces() might return { '1.12' => 'FastEthernet/0', Example : $info->interfaces() might return
'2.15' => 'FastEthernet/1', '9.99' => 'FastEthernet/2' }
{ '1.12' => 'FastEthernet/0',
'2.15' => 'FastEthernet/1',
'9.99' => 'FastEthernet/2'
}
The key is what you would see if you were to do an snmpwalk, and in some The key is what you would see if you were to do an snmpwalk, and in some
cases changes between reboots of the network device. cases changes between reboots of the network device.
Partial Table Fetches
If you want to get only a part of an SNMP table and you know the IID for
the part of the table that you want, you can specify it in the call:
$local_routes = $info->ipr_route('192.168.0');
This will only fetch entries in the table that start with "192.168.0",
which in this case are routes on the local network.
Remember that you must supply the partial IID (a numeric OID).
Partial table results are not cached.
Interface Information Interface Information
$info->interfaces() $info->interfaces()
@@ -638,6 +662,122 @@ USAGE
(ipAdEntBcastAddr) (ipAdEntBcastAddr)
IP Routing Table
$info->ipr_route()
The route in question. A value of 0.0.0.0 is the default gateway
route.
("ipRouteDest")
$info->ipr_if()
The interface (IID) that the route is on. Use interfaces() to map.
("ipRouteIfIndex")
$info->ipr_1()
Primary routing metric for this route.
("ipRouteMetric1")
$info->ipr_2()
If metrics are not used, they should be set to -1
("ipRouteMetric2")
$info->ipr_3()
("ipRouteMetric3")
$info->ipr_4()
("ipRouteMetric4")
$info->ipr_5()
("ipRouteMetric5")
$info->ipr_dest()
From RFC1213:
"The IP address of the next hop of this route.
(In the case of a route bound to an interface
which is realized via a broadcast media, the value
of this field is the agent's IP address on that
interface.)"
("ipRouteNextHop")
$info->ipr_type()
From RFC1213:
other(1), -- none of the following
invalid(2), -- an invalidated route
-- route to directly
direct(3), -- connected (sub-)network
-- route to a non-local
indirect(4) -- host/network/sub-network
"The type of route. Note that the values
direct(3) and indirect(4) refer to the notion of
direct and indirect routing in the IP
architecture.
Setting this object to the value invalid(2) has
the effect of invalidating the corresponding entry
in the ipRouteTable object. That is, it
effectively disassociates the destination
identified with said entry from the route
identified with said entry. It is an
implementation-specific matter as to whether the
agent removes an invalidated entry from the table.
Accordingly, management stations must be prepared
to receive tabular information from agents that
corresponds to entries not currently in use.
Proper interpretation of such entries requires
examination of the relevant ipRouteType object."
("ipRouteType")
$info->ipr_proto()
From RFC1213:
other(1), -- none of the following
-- non-protocol information,
-- e.g., manually configured
local(2), -- entries
-- set via a network
netmgmt(3), -- management protocol
-- obtained via ICMP,
icmp(4), -- e.g., Redirect
-- the remaining values are
-- all gateway routing
-- protocols
egp(5),
ggp(6),
hello(7),
rip(8),
is-is(9),
es-is(10),
ciscoIgrp(11),
bbnSpfIgp(12),
ospf(13),
bgp(14)
("ipRouteProto")
$info->ipr_age()
Seconds since route was last updated or validated.
("ipRouteAge")
$info->ipr_mask()
Subnet Mask of route. 0.0.0.0 for default gateway.
("ipRouteMask")
$info->ipr_info()
Reference to MIB definition specific to routing protocol.
("ipRouteInfo")
Setting data via SNMP Setting data via SNMP
This section explains how to use SNMP::Info to do SNMP Set operations. This section explains how to use SNMP::Info to do SNMP Set operations.