set_i_untagged combines both set_i_vlan and set_i_pvid in one method

This commit is contained in:
Oliver Gorwits
2013-11-02 19:19:26 +00:00
parent 9540f6b9d3
commit e3e289a27c
2 changed files with 31 additions and 0 deletions

View File

@@ -6,6 +6,7 @@ version 3.09 ()
* [#45] IBM (Blade Network Technologies) Rackswitch support in new class * [#45] IBM (Blade Network Technologies) Rackswitch support in new class
L3::IBMGbTor L3::IBMGbTor
* [] set_i_untagged combines both set_i_vlan and set_i_pvid in one method
version 3.08 (2013-10-22) version 3.08 (2013-10-22)

View File

@@ -143,6 +143,9 @@ sub v_index {
return \%v_index; return \%v_index;
} }
sub i_pvid { goto &i_vlan }
sub i_untagged { goto &i_vlan }
sub i_vlan { sub i_vlan {
my $vtp = shift; my $vtp = shift;
my $partial = shift; my $partial = shift;
@@ -306,6 +309,19 @@ sub set_i_vlan {
return; 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 { sub set_add_i_vlan_tagged {
my $vtp = shift; my $vtp = shift;
my ( $vlan_id, $ifindex ) = @_; my ( $vlan_id, $ifindex ) = @_;
@@ -540,6 +556,14 @@ Your device will only implement a subset of these methods.
Returns a mapping between C<ifIndex> and assigned VLAN ID for access ports Returns a mapping between C<ifIndex> and assigned VLAN ID for access ports
and the default VLAN ID for trunk ports. and the default VLAN ID for trunk ports.
=item $vtp->i_pvid()
An alias for C<i_vlan>.
=item $vtp->i_untagged()
An alias for C<i_vlan>.
=item $vtp->i_vlan_membership() =item $vtp->i_vlan_membership()
Returns reference to hash of arrays: key = C<ifIndex>, value = array of VLAN Returns reference to hash of arrays: key = C<ifIndex>, value = array of VLAN
@@ -835,6 +859,12 @@ port C<ifIndex>. This method should only be used on trunk ports.
$vtp->set_i_pvid('2', $if_map{'FastEthernet0/1'}) $vtp->set_i_pvid('2', $if_map{'FastEthernet0/1'})
or die "Couldn't change port default VLAN. ",$vtp->error(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<set_i_pvid>. Otherwise, the
value of C<set_i_vlan> is returned.
=item $vtp->set_add_i_vlan_tagged ( vlan, ifIndex ) =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 Adds the VLAN to the enabled VLANs list of the port, must be supplied with the