SNMP::Info::CiscoVTP3pm
Snmp interface to cisco's vlan management mibs
Usage
# Let SNMP::Info determine the correct subclass for you.my $vtp = new SNMP::Info(AutoSpecify => 1,Debug => 1,DestHost => 'myswitch',Community => 'public',Version => 2)or die "Can't connect to DestHost.\n";my $class = $vtp->class();print "SNMP::Info determined this device to fall under subclass : $class\n";
Overview
SNMP::Info::CiscoVTP is a subclass of SNMP::Info that provides information about a Cisco device's VLAN and VTP Domain membership.
Use or create in a subclass of SNMP::Info. Do not use directly.
Inherited Classes
None.
Required MIBs
- CISCO-VTP-MIB
- CISCO-VLAN-MEMBERSHIP-MIB
- CISCO-VLAN-IFTABLE-RELATIONSHIP-MIB
Globals
$vtp->
|
( |
|---|---|
$vtp->
|
( |
$vtp->
|
( |
$vtp->
|
( |
$vtp->
|
( |
$vtp->
|
( |
Table methods
Your device will only implement a subset of these methods.
- $vtp->
i_vlan() -
Returns a mapping between
"ifIndex"and assigned VLAN ID for access ports and the default VLAN ID for trunk ports.
- $vtp->
i_untagged() -
An alias for
"i_vlan".
- $vtp->
i_vlan_membership() -
Returns reference to hash of arrays: key =
"ifIndex", value = array of VLAN IDs. These are the VLANs which are members of enabled VLAN list for the port.Example:my $interfaces = $vtp->interfaces();my $vlans = $vtp->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";}
- $vtp->
i_subinterfaces() -
Returns reference to hash of arrays: key =
"ifIndex", value = array of"ifIndex". These are the VLAN subinterfaces ("l2vlan"type) for the parent ("ethernetCsmacd"type) interface.Example:my $interfaces = $vtp->interfaces();my $i_subs = $vtp->i_subinterfaces();foreach my $iid (sort keys %$interfaces) {my $port = $interfaces->{$iid};my $subs = join(',', sort(map {$interfaces->{$_}} @{$i_subs->{$iid}}));print "Port: $port has subinterfaces: $subs\n";}
- $vtp->
i_vlan_membership_untagged() -
Returns reference to hash of arrays: key =
"ifIndex", value = array of VLAN IDs. These are the VLANs which are members of the untagged egress list for the port.
VLAN Table ("CISCO-VTP-MIB::vtpVlanTable")
See <ftp://ftp.cisco.com/pub/mibs/supportlists/wsc5000/wsc5000-communityIndexing.html> for a good treaty of how to connect to the VLANs
$vtp->
|
( |
|---|---|
$vtp->
|
( |
$vtp->
|
( |
$vtp->
|
( |
$vtp->
|
( |
$vtp->
|
( |
$vtp->
|
( |
$vtp->
|
( |
$vtp->
|
( |
$vtp->
|
( |
$vtp->
|
( |
$vtp->
|
( |
$vtp->
|
( |
$vtp->
|
( |
$vtp->
|
( |
$vtp->
|
( |
$vtp->
|
( |
$vtp->
|
( |
VLAN Membership Table ("CISCO-VLAN-MEMBERSHIP-MIB::vmMembershipTable")
- $vtp->
i_vlan_type() -
Static, Dynamic, or multiVlan.
(
"vmVlanType")
- $vtp->
i_vlan2() -
The VLAN that an access port is assigned to.
(
"vmVlan")
- $vtp->
i_vlan_stat() -
Inactive, active, shutdown.
(
"vmPortStatus")
- $vtp->
i_vlan_1() -
Each bit represents a VLAN. This is 0 through 1023
(
"vmVlans")
- $vtp->
i_vlan_2() -
Each bit represents a VLAN. This is 1024 through 2047
(
"vmVlans2k")
- $vtp->
i_vlan_3() -
Each bit represents a VLAN. This is 2048 through 3071
(
"vmVlans3k")
- $vtp->
i_vlan_4() -
Each bit represents a VLAN. This is 3072 through 4095
(
"vmVlans4k")
VLAN Membership Voice VLAN Table ("CISCO-VLAN-MEMBERSHIP-MIB::vmVoiceVlanTable")
- $vtp->
i_voice_vlan() -
(
"vmVoiceVlanId")
Management Domain Table ("CISCO-VTP-MIB::managementDomainTable")
$vtp->
|
( |
|---|---|
$vtp->
|
( |
$vtp->
|
( |
$vtp->
|
( |
$vtp->
|
( |
$vtp->
|
( |
$vtp->
|
( |
$vtp->
|
( |
$vtp->
|
( |
$vtp->
|
( |
VLAN Trunk Port Table ("CISCO-VTP-MIB::vlanTrunkPortTable")
$vtp->
|
( |
|---|---|
$vtp->
|
( |
$vtp->
|
( |
$vtp->
|
( |
$vtp->
|
( |
$vtp->
|
( |
$vtp->
|
( |
$vtp->
|
( |
$vtp->
|
( |
$vtp->
|
( |
$vtp->
|
( |
$vtp->
|
( |
$vtp->
|
( |
Set methods
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.
- $vtp->set_i_vlan ( vlan, ifIndex )
-
Changes an access (untagged) port VLAN, must be supplied with the numeric VLAN ID and port
"ifIndex". This method should only be used on end station (non-trunk) ports.Example:my %if_map = reverse %{$vtp->interfaces()};$vtp->set_i_vlan('2', $if_map{'FastEthernet0/1'})or die "Couldn't change port VLAN. ",$vtp->error(1);
- $vtp->set_i_pvid ( pvid, ifIndex )
-
Sets port default VLAN, must be supplied with the numeric VLAN ID and port
"ifIndex". This method should only be used on trunk ports.Example:my %if_map = reverse %{$vtp->interfaces()};$vtp->set_i_pvid('2', $if_map{'FastEthernet0/1'})or die "Couldn't change port default VLAN. ",$vtp->error(1);
- $vtp->set_i_untagged ( vlan, ifIndex )
-
This method attempts to work out whether the port referenced by ifIndex is trunking, and if so will return the value of
"set_i_pvid". Otherwise, the value of"set_i_vlan"is returned.
- $vtp->set_add_i_vlan_tagged ( vlan, ifIndex )
-
Adds the VLAN to the enabled VLANs list of the port, must be supplied with the numeric VLAN ID and port
"ifIndex".Example:my %if_map = reverse %{$vtp->interfaces()};$vtp->set_add_i_vlan_tagged('2', $if_map{'FastEthernet0/1'})or die "Couldn't add port to egress list. ",$vtp->error(1);
- $vtp->set_remove_i_vlan_tagged ( vlan, ifIndex )
-
Removes the VLAN from the enabled VLANs list of the port, must be supplied with the numeric VLAN ID and port
"ifIndex".Example:my %if_map = reverse %{$vtp->interfaces()};$vtp->set_remove_i_vlan_tagged('2', $if_map{'FastEthernet0/1'})or die "Couldn't add port to egress list. ",$vtp->error(1);
Releases
9 releases since Debian 5.0 (Lenny); the text changed 8 times.