From e3e289a27c92e2821dd7bc5c3db2e85833a0764f Mon Sep 17 00:00:00 2001 From: Oliver Gorwits Date: Sat, 2 Nov 2013 19:19:26 +0000 Subject: [PATCH] set_i_untagged combines both set_i_vlan and set_i_pvid in one method --- ChangeLog | 1 + Info/CiscoVTP.pm | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/ChangeLog b/ChangeLog index a4b02c69..8f2c8fa6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,7 @@ version 3.09 () * [#45] IBM (Blade Network Technologies) Rackswitch support in new class L3::IBMGbTor + * [] set_i_untagged combines both set_i_vlan and set_i_pvid in one method version 3.08 (2013-10-22) diff --git a/Info/CiscoVTP.pm b/Info/CiscoVTP.pm index f24283b7..93525cee 100644 --- a/Info/CiscoVTP.pm +++ b/Info/CiscoVTP.pm @@ -143,6 +143,9 @@ sub v_index { return \%v_index; } +sub i_pvid { goto &i_vlan } +sub i_untagged { goto &i_vlan } + sub i_vlan { my $vtp = shift; my $partial = shift; @@ -306,6 +309,19 @@ sub set_i_vlan { return; } +sub set_i_untagged { + my $vtp = shift; + my ( $vlan_id, $ifindex ) = @_; + + my $trunking = eval { $vtp->vtp_trunk_dyn($ifindex)->{$ifindex} }; + if ($trunking and (($trunking eq 'on') or ($trunking eq 'onNoNegotiate'))) { + return $vtp->set_i_pvid(@_); + } + else { + return $vtp->set_i_vlan(@_); + } +} + sub set_add_i_vlan_tagged { my $vtp = shift; my ( $vlan_id, $ifindex ) = @_; @@ -540,6 +556,14 @@ Your device will only implement a subset of these methods. Returns a mapping between C and assigned VLAN ID for access ports and the default VLAN ID for trunk ports. +=item $vtp->i_pvid() + +An alias for C. + +=item $vtp->i_untagged() + +An alias for C. + =item $vtp->i_vlan_membership() Returns reference to hash of arrays: key = C, value = array of VLAN @@ -835,6 +859,12 @@ port C. This method should only be used on trunk ports. $vtp->set_i_pvid('2', $if_map{'FastEthernet0/1'}) or die "Couldn't change port default VLAN. ",$vtp->error(1); +=item $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 C. Otherwise, the +value of C is returned. + =item $vtp->set_add_i_vlan_tagged ( vlan, ifIndex ) Adds the VLAN to the enabled VLANs list of the port, must be supplied with the