SNMP::...scoVTP(3pm)

πŸ’– SNMP::Info::CiscoVTP β€” the 3pm perl page πŸ’–

okay so bestie, welcome to the User Contributed Perl Documentation page for SNMP::Info::CiscoVTP, a little 3pm manpage moment. Go grab a strawberry drink, we're doing VLANs. πŸ“


✨ NAME ✨

SNMP::Info::CiscoVTP β€” SNMP Interface to Cisco's VLAN Management MIBs 🫢

πŸ‘‘ AUTHOR πŸ‘‘

Max Baker β€” icon behavior, honestly.

🌈 SYNOPSIS 🌈

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

literally just let it figure out which subclass it belongs to and print that out. she's self-aware πŸ’…

πŸ¦‹ DESCRIPTION πŸ¦‹

SNMP::Info::CiscoVTP is a subclass of SNMP::Info that hands you the tea on a Cisco device's VLAN and VTP Domain membership. no cap, that's the whole gig.

bestie, listen β€” use it or create it inside a subclass of SNMP::Info. Do not use it directly. that's a hard rule, not a suggestion πŸ™ˆ

🌸 Inherited Classes 🌸

None. she comes from nowhere, she's a self-made queen. πŸ’€

⭐ Required MIBs ⭐

  • CISCO-VTP-MIB
  • CISCO-VLAN-MEMBERSHIP-MIB
  • CISCO-VLAN-IFTABLE-RELATIONSHIP-MIB

πŸŽ€ GLOBALS πŸŽ€

  • $vtp->vtp_version() β€” maps to "vtpVersion"
  • $vtp->vtp_maxstore() β€” maps to "vtpMaxVlanStorage"
  • $vtp->vtp_notify() β€” maps to "vtpNotificationsEnabled"
  • $vtp->vtp_notify_create() β€” maps to "vtpVlanCreatedNotifEnabled"
  • $vtp->vtp_notify_delete() β€” maps to "vtpVlanDeletedNotifEnabled"
  • $vtp->vtp_trunk_set_serial() β€” maps to "vlanTrunkPortSetSerialNo"

πŸ’… TABLE METHODS πŸ’…

heads up bestie: your device is only gonna implement a subset of these methods. don't come for me if half of them vibe-check as empty.

  • $vtp->i_vlan() β€” hands you a mapping between "ifIndex" and the assigned VLAN ID for access ports, plus the default VLAN ID for trunk ports.
  • $vtp->i_untagged() β€” an alias for "i_vlan". same girl, different name. πŸ‘―
  • $vtp->i_vlan_membership() β€” returns a reference to a hash of arrays: key = "ifIndex", value = an array of VLAN IDs. these are the VLANs that are members of the 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 a reference to a hash of arrays: key = "ifIndex", value = an array of "ifIndex". these are the VLAN subinterfaces (the "l2vlan" type) belonging to 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 a reference to a hash of arrays: key = "ifIndex", value = an array of VLAN IDs. these are the VLANs that are members of the untagged egress list for the port.

🧚 VLAN Table ("CISCO-VTP-MIB::vtpVlanTable") 🧚

go read ftp://ftp.cisco.com/pub/mibs/supportlists/wsc5000/wsc5000-communityIndexing.html β€” it's a genuinely good treaty on how to connect to the VLANs. iykyk, this one's a classic.

  • $vtp->v_index() β€” maps to "vtpVlanIndex"
  • $vtp->v_state() β€” maps to "vtpVlanState"
  • $vtp->v_type() β€” maps to "vtpVlanType"
  • $vtp->v_name() β€” maps to "vtpVlanName"
  • $vtp->v_mtu() β€” maps to "vtpVlanMtu"
  • $vtp->v_said() β€” maps to "vtpVlanDot10Said"
  • $vtp->v_ring() β€” maps to "vtpVlanRingNumber"
  • $vtp->v_bridge() β€” maps to "vtpVlanBridgeNumber"
  • $vtp->v_stp() β€” maps to "vtpVlanStpType"
  • $vtp->v_parent() β€” maps to "vtpVlanParentVlan"
  • $vtp->v_trans1() β€” maps to "vtpVlanTranslationalVlan1"
  • $vtp->v_trans2() β€” maps to "vtpVlanTranslationalVlan2"
  • $vtp->v_btype() β€” maps to "vtpVlanBridgeType"
  • $vtp->v_hop_are() β€” maps to "vtpVlanAreHopCount"
  • $vtp->v_hop_ste() β€” maps to "vtpVlanSteHopCount"
  • $vtp->v_crf() β€” maps to "vtpVlanIsCRFBackup"
  • $vtp->v_type_ext() β€” maps to "vtpVlanTypeExt"
  • $vtp->v_if() β€” maps to "vtpVlanIfIndex"

πŸ”₯ VLAN Membership Table ("CISCO-VLAN-MEMBERSHIP-MIB::vmMembershipTable") πŸ”₯

  • $vtp->i_vlan_type() β€” Static, Dynamic, or multiVlan, your pick bestie. maps to ("vmVlanType")
  • $vtp->i_vlan2() β€” the VLAN that an access port is assigned to. maps to ("vmVlan")
  • $vtp->i_vlan_stat() β€” Inactive, active, or shutdown. maps to ("vmPortStatus")
  • $vtp->i_vlan_1() β€” each bit represents a VLAN. this one covers 0 through 1023. maps to ("vmVlans")
  • $vtp->i_vlan_2() β€” each bit represents a VLAN. this one covers 1024 through 2047. maps to ("vmVlans2k")
  • $vtp->i_vlan_3() β€” each bit represents a VLAN. this one covers 2048 through 3071. maps to ("vmVlans3k")
  • $vtp->i_vlan_4() β€” each bit represents a VLAN. this one covers 3072 through 4095. maps to ("vmVlans4k")

🌈 VLAN Membership Voice VLAN Table 🌈

this one lives at ("CISCO-VLAN-MEMBERSHIP-MIB::vmVoiceVlanTable")

  • $vtp->i_voice_vlan() β€” maps to "vmVoiceVlanId"

πŸ’œ Management Domain Table ("CISCO-VTP-MIB::managementDomainTable") πŸ’œ

  • $vtp->vtp_d_name() β€” maps to "managementDomainName"
  • $vtp->vtp_d_mode() β€” maps to "managementDomainLocalMode"
  • $vtp->vtp_d_rev() β€” maps to "managementDomainConfigRevNumber"
  • $vtp->vtp_d_updater() β€” maps to "managementDomainLastUpdater"
  • $vtp->vtp_d_last() β€” maps to "managementDomainLastChange"
  • $vtp->vtp_d_status() β€” maps to "managementDomainRowStatus"
  • $vtp->vtp_d_tftp() β€” maps to "managementDomainTftpServer"
  • $vtp->vtp_d_tftp_path() β€” maps to "managementDomainTftpPathname"
  • $vtp->vtp_d_pruning() β€” maps to "managementDomainPruningState"
  • $vtp->vtp_d_ver() β€” maps to "managementDomainVersionInUse"

🩷 VLAN Trunk Port Table ("CISCO-VTP-MIB::vlanTrunkPortTable") 🩷

  • $vtp->vtp_trunk_mgmt_dom() β€” maps to "vlanTrunkPortManagementDomain"
  • $vtp->vtp_trunk_encaps_t() β€” maps to "vlanTrunkPortEncapsulationType"
  • $vtp->vtp_trunk_vlans() β€” maps to "vlanTrunkPortVlansEnabled"
  • $vtp->vtp_trunk_vlans_2k() β€” maps to "vlanTrunkPortVlansEnabled2k"
  • $vtp->vtp_trunk_vlans_3k() β€” maps to "vlanTrunkPortVlansEnabled3k"
  • $vtp->vtp_trunk_vlans_4k() β€” maps to "vlanTrunkPortVlansEnabled4k"
  • $vtp->vtp_trunk_native() β€” maps to "vlanTrunkPortNativeVlan"
  • $vtp->i_pvid() β€” maps to "vlanTrunkPortNativeVlan"
  • $vtp->vtp_trunk_rstat() β€” maps to "vlanTrunkPortRowStatus"
  • $vtp->vtp_trunk_dyn() β€” maps to "vlanTrunkPortDynamicState"
  • $vtp->vtp_trunk_dyn_stat() β€” maps to "vlanTrunkPortDynamicStatus"
  • $vtp->vtp_trunk_vtp() β€” maps to "vlanTrunkPortVtpEnabled"
  • $vtp->vtp_trunk_encaps() β€” maps to "vlanTrunkPortEncapsulationOperType"

πŸ’€ SET METHODS πŸ’€

these are the methods that give you SNMP set functionality for methods that got overridden, or that give you a simpler interface to complex set operations. for the general tea on set operations, go read "SETTING DATA VIA SNMP" in SNMP::Info. πŸ“š

  • $vtp->set_i_vlan ( vlan, ifIndex ) β€” changes an access (untagged) port VLAN. you must supply the numeric VLAN ID and the port "ifIndex". only use this one on end station (non-trunk) ports, okay? 🫢

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 the port default VLAN. again, you must supply the numeric VLAN ID and the port "ifIndex". this one is only for trunk ports, periodt.

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 one tries to work out whether the port referenced by ifIndex is trunking, and if it is, it returns the value of "set_i_pvid". otherwise you get the value of "set_i_vlan". she's doing the thinking so you don't have to. 😌
  • $vtp->set_add_i_vlan_tagged ( vlan, ifIndex ) β€” adds the VLAN to the enabled VLANs list of the port. yes, you must supply 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. and yeah, you must supply 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);

okay that's the whole page, no notes. this one's from perl v5.40.1, dated 2026-02-28, and it's filed under SNMP::...scoVTP(3pm) in the User Contributed Perl Documentation. love that for her. mwah, go configure some VLANs responsibly bestie πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from