NAME
SNMP::Info::Layer2 - Perl5 Interface to network devices serving Layer2 only.
AUTHOR
Max Baker (max@warped.org
)
SYNOPSIS
# Let SNMP::Info determine the correct subclass for you.
my $l2 = new SNMP::Info(
AutoSpecify => 1,
Debug => 1,
# These arguments are passed directly on to SNMP::Session
DestHost => 'myswitch',
Community => 'public',
Version => 2
)
or die "Can't connect to DestHost.\n";
my $class = $l2->class();
print "SNMP::Info determined this device to fall under subclass : $class\n";
# Let's get some basic Port information
my $interfaces = $l2->interfaces();
my $i_up = $l2->i_up();
my $i_speed = $l2->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";
}
DESCRIPTION
This class is usually used as a superclass for more specific device classes listed under SNMP::Info::Layer2::* Please read all docs under SNMP::Info first.
Provides abstraction to the configuration information obtainable from a Layer2 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 $l2 = new SNMP::Info::Layer2(...);
Inherited Classes
Required MIBs
- CISCO-PRODUCTS-MIB
-
Needed for ID of Cisco Products
- CISCO-STACK-MIB
-
Needed for ID of Cisco Products
- Inherited Classes
-
MIBs required by the inherited classes listed above.
MIBs can be found at ftp://ftp.cisco.com/pub/mibs/v2/v2.tar.gz
GLOBALS
These are methods that return scalar value from SNMP
Overrides
- $l2->model()
-
Cross references $l2->id() with product IDs in the Cisco MIBs.
For HP devices, removes 'hpswitch' from the name
For Cisco devices, removes 'sysid' from the name
- $l2->vendor()
-
Trys to discover the vendor from $l2->model() and $l2->description()
Globals imported from SNMP::Info
See documentation in SNMP::Info for details.
Globals imported from SNMP::Info::Bridge
See documentation in SNMP::Info::Bridge for details.
Globals imported from SNMP::Info::CDP
See documentation in SNMP::Info::CDP for details.
Globals imported from SNMP::Info::CiscoStats
See documentation in SNMP::Info::CiscoStats for details.
TABLE METHODS
These are methods that return tables of information in the form of a reference to a hash.
Overrides
- $l2->interfaces()
-
Creates a map between the interface identifier (iid) and the physical port name.
Defaults to ifDescr but checks and overrides with ifName
- $l2->i_ignore()
-
Returns reference to hash. Increments value of IID if port is to be ignored.
Ignores ports with ifType of loopback,propvirtual,other, and cpu
Table Methods imported from SNMP::Info
See documentation in SNMP::Info for details.
Table Methods imported from SNMP::Info::Bridge
See documentation in SNMP::Info::Bridge for details.
Table Methods imported from SNMP::Info::CDP
See documentation in SNMP::Info::CDP for details.
Table Methods imported from SNMP::Info::CiscoStats
See documentation in SNMP::Info::CiscoStats for details.