SNMP::Info::Layer2::C1900 - SNMP Interface to data from Cisco Catalyst 1900 Network Switches running CatOS
Max Baker
# Let SNMP::Info determine the correct subclass for you. my $c1900 = new SNMP::Info( AutoSpecify => 1, Debug => 1, DestHost => 'myswitch', Community => 'public', Version => 1 ) or die "Can't connect to DestHost.\n"; my $class = $c1900->class(); print "SNMP::Info determined this device to fall under subclass : $class\n";
Provides abstraction to the configuration information obtainable from a Catalyst 1900 device through SNMP. See SNMP::Info for full documentation
Note that most of these devices only talk SNMP version 1, but not all.
For speed or debugging purposes you can call the subclass directly, but not after determining a more specific class using the method above.
my $c1900 = new SNMP::Info::Layer2::C1900(...);
ESSWITCH-MIB is included in the Version 1 MIBs from Cisco.
They can be found at ftp://ftp.cisco.com/pub/mibs/v1/v1.tar.gz
See "Required MIBs" in SNMP::Info::CDP for its MIB requirements.
See "Required MIBs" in SNMP::Info::CiscoStats for its MIB requirements.
See "Required MIBs" in SNMP::Info::CiscoConfig for its MIB requirements.
See "Required MIBs" in SNMP::Info::CiscoStpExtensions for its MIB requirements.
See "Required MIBs" in SNMP::Info::CiscoAgg for its MIB requirements.
See "Required MIBs" in SNMP::Info::Layer2 for its MIB requirements.
These are methods that return scalar value from SNMP
Usually contains the version of the software loaded in flash. Used by os_ver()
STAND-ALONE-ETHERNET-SWITCH-MIB::upgradeFlashBankStatus
Returns 'catalyst'
Returns CatOS version if obtainable. First tries to use SNMP::Info::CiscoStats->os_ver() . If that fails then it checks for the presence of $c1900->c1900_flash_status() and culls the version from there.
Returns 'cisco' :)
Returns 1. Use vlan indexing.
Return 1. Bulkwalk is turned off for this class.
1
See "GLOBALS" in SNMP::Info::CDP for details.
See "GLOBALS" in SNMP::Info::CiscoStats for details.
See "GLOBALS" in SNMP::Info::CiscoConfig for details.
See "GLOBALS" in SNMP::Info::CiscoStpExtensions for details.
See "GLOBALS" in SNMP::Info::CiscoAgg for details.
See "GLOBALS" in SNMP::Info::Layer2 for details.
These are methods that return tables of information in the form of a reference to a hash.
Returns reference to the map between IID and physical Port.
Returns reference to map of IIDs to current link duplex
Returns reference to hash of IIDs to admin duplex setting
Crosses ifName with $c1900->c1900_p_name() and returns the human set port name if exists.
ifName
Returns a mapping between the interface and the VLAN / bridge group if overlap is not enabled.
Returns reference to hash of arrays: key = interface, value = array of VLAN / bridge group IDs.
Example: my $interfaces = $c1900->interfaces(); my $vlans = $c1900->i_vlan_membership(); foreach my $iid (sort keys %$interfaces) { my $port = $interfaces->{$iid}; my $vlan = join(',', sort(@{$vlans->{$iid}})); print "Port: $port VLAN: $vlan\n"; }
Unsupported, returns nothing.
Returns a bp_index that contains the original bp_index entries and extra entries for those interfaces listed in if_index, as some C1900 devices do not return complete bp_indexes.
Maps the Switch Port Table to the IID
swPortIfIndex
Gives Port Duplex Info
(swPortDuplexStatus)
swPortDuplexStatus
Gives admin setting for Duplex Info
(swPortFullDuplex)
swPortFullDuplex
Gives human set name for port
(swPortName)
swPortName
Gives Admin status of port enabled.
(swPortAdminStatus)
swPortAdminStatus
Gives Type of port, i.e. "general-ethernet"
"general-ethernet"
(swPortMediaCapability)
swPortMediaCapability
Gives the media of the port , i.e. "fiber-sc"
fiber-sc
(swPortConnectorType)
swPortConnectorType
See "TABLE METHODS" in SNMP::Info::CDP for details.
See "TABLE METHODS" in SNMP::Info::CiscoStats for details.
See "TABLE METHODS" in SNMP::Info::CiscoConfig for details.
See "TABLE METHODS" in SNMP::Info::CiscoStpExtensions for details.
See "TABLE METHODS" in SNMP::Info::CiscoAgg for details.
See "TABLE METHODS" in SNMP::Info::Layer2 for details.
These are methods that provide SNMP set functionality for overridden methods or provide a simpler interface to complex set operations. See "SETTING DATA VIA SNMP" in SNMP::Info for general information on set operations.
Sets port duplex, must be supplied with duplex and port ifIndex. Speed choices are 'auto', 'half', 'full'.
ifIndex
Example: my %if_map = reverse %{$c1900->interfaces()}; $c1900->set_i_duplex_admin('auto', $if_map{'1'}) or die "Couldn't change port duplex. ",$c1900->error(1);
To install SNMP::Info, copy and paste the appropriate command in to your terminal.
cpanm
cpanm SNMP::Info
CPAN shell
perl -MCPAN -e shell install SNMP::Info
For more information on module installation, please visit the detailed CPAN module installation guide.