DOKK / manpages / debian 10 / libsnmp-info-perl / SNMP::Info::Layer2::C1900.3pm.en
SNMP::Info::Layer2::C1900(3pm) User Contributed Perl Documentation SNMP::Info::Layer2::C1900(3pm)

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

$c1900->c1900_flash_status()
Usually contains the version of the software loaded in flash. Used by os_ver()

"STAND-ALONE-ETHERNET-SWITCH-MIB::upgradeFlashBankStatus"

$c1900->os()
Returns 'catalyst'
$c1900->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.
$c1900->vendor()
Returns 'cisco' :)

$c1900->cisco_comm_indexing()
Returns 1. Use vlan indexing.
$c1900->bulkwalk_no
Return 1. Bulkwalk is turned off for this class.

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.

$c1900->interfaces()
Returns reference to the map between IID and physical Port.
$c1900->i_duplex()
Returns reference to map of IIDs to current link duplex
$c1900->i_duplex_admin()
Returns reference to hash of IIDs to admin duplex setting
$c1900->i_name()
Crosses "ifName" with $c1900->c1900_p_name() and returns the human set port name if exists.
$c1900->i_vlan()
Returns a mapping between the interface and the VLAN / bridge group if overlap is not enabled.
$c1900->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->i_vlan_membership_untagged()
Unsupported, returns nothing.
$c1900->bp_index()
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.

STAND-ALONE-ETHERNET-SWITCH-MIB Switch Port Table Entries:

$c1900->c1900_p_index()
Maps the Switch Port Table to the IID

"swPortIfIndex"

$c1900->c1900_p_duplex()
Gives Port Duplex Info

("swPortDuplexStatus")

$c1900->c1900_p_duplex_admin()
Gives admin setting for Duplex Info

("swPortFullDuplex")

$c1900->c1900_p_name()
Gives human set name for port

("swPortName")

$c1900->c1900_p_up_admin()
Gives Admin status of port enabled.

("swPortAdminStatus")

$c1900->c1900_p_type()
Gives Type of port, i.e. "general-ethernet"

("swPortMediaCapability")

$c1900->c1900_p_media()
Gives the media of the port , i.e. ""fiber-sc""

("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.

$c1900->set_i_duplex_admin(duplex, ifIndex)
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);
    
2019-02-25 perl v5.28.1