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 the SNMP::Info::CDP manpage for its MIB requirements.
See Required MIBs in the SNMP::Info::CiscoStats manpage for its MIB requirements.
See Required MIBs in the SNMP::Info::CiscoConfig manpage for its MIB requirements.
See Required MIBs in the SNMP::Info::Layer2 manpage for its MIB requirements.
These are methods that return scalar value from SNMP
c1900_flash_status()
Usually contains the version of the software loaded in flash.
Used by os_ver()
STAND-ALONE-ETHERNET-SWITCH-MIB::upgradeFlashBankStatus
os()
Returns 'catalyst'
os_ver()
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.
vendor()
Returns 'cisco' :)
cisco_comm_indexing()
Returns 1. Use vlan indexing.
Return 1
. Bulkwalk is turned off for this class.
See GLOBALS in the SNMP::Info::CDP manpage for details.
See GLOBALS in the SNMP::Info::CiscoStats manpage for details.
See GLOBALS in the SNMP::Info::CiscoConfig manpage for details.
See GLOBALS in the SNMP::Info::Layer2 manpage for details.
These are methods that return tables of information in the form of a reference to a hash.
interfaces()
Returns reference to the map between IID and physical Port.
i_duplex()
Returns reference to map of IIDs to current link duplex
i_duplex_admin()
Returns reference to hash of IIDs to admin duplex setting
i_name()
Crosses ifName
with $c1900->c1900_p_name()
and returns the human set port
name if exists.
i_vlan()
Returns a mapping between the interface and the VLAN / bridge group if overlap is not enabled.
i_vlan_membership()
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"; }
c1900_p_index()
Maps the Switch Port Table to the IID
swPortIfIndex
c1900_p_duplex()
Gives Port Duplex Info
(swPortDuplexStatus
)
c1900_p_duplex_admin()
Gives admin setting for Duplex Info
(swPortFullDuplex
)
c1900_p_name()
Gives human set name for port
(swPortName
)
c1900_p_up_admin()
Gives Admin status of port enabled.
(swPortAdminStatus
)
c1900_p_type()
Gives Type of port, i.e. "general-ethernet"
(swPortMediaCapability
)
c1900_p_media()
Gives the media of the port , i.e. ``fiber-sc
''
(swPortConnectorType
)
See TABLE METHODS in the SNMP::Info::CDP manpage for details.
See TABLE METHODS in the SNMP::Info::CiscoStats manpage for details.
See TABLE METHODS in the SNMP::Info::CiscoConfig manpage for details.
See TABLE METHODS in the SNMP::Info::Layer2 manpage 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 the SNMP::Info manpage for general information on set operations.
Sets port duplex, must be supplied with duplex and port ifIndex
. Speed
choices are 'auto', 'half', 'full'.
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);