++ed by:

3 PAUSE users
1 non-PAUSE user.

Author image Oliver Gorwits
and 1 contributors


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(...);

Inherited classes


Required MIBs


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

Inherited MIBs

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::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()



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.

Globals imported from SNMP::Info::CDP

See "GLOBALS" in SNMP::Info::CDP for details.

Globals imported from SNMP::Info::CiscoStats

See "GLOBALS" in SNMP::Info::CiscoStats for details.

Globals imported from SNMP::Info::CiscoConfig

See "GLOBALS" in SNMP::Info::CiscoConfig for details.

Globals imported from SNMP::Info::Layer2

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.


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.

  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";

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



Gives Port Duplex Info



Gives admin setting for Duplex Info



Gives human set name for port



Gives Admin status of port enabled.



Gives Type of port, i.e. "general-ethernet"



Gives the media of the port , i.e. "fiber-sc"


Table Methods imported from SNMP::Info::CDP

See "TABLE METHODS" in SNMP::Info::CDP for details.

Table Methods imported from SNMP::Info::CiscoStats

See "TABLE METHODS" in SNMP::Info::CiscoStats for details.

Table Methods imported from SNMP::Info::CiscoConfig

See "TABLE METHODS" in SNMP::Info::CiscoConfig for details.

Table Methods imported from SNMP::Info::Layer2

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.

$c1900->set_i_duplex_admin(duplex, ifIndex)

Sets port duplex, must be supplied with duplex and port ifIndex. Speed choices are 'auto', 'half', 'full'.

  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);