set_i_vlan support for Ruckus/Brocade/Foundry

This commit is contained in:
Oliver Gorwits
2021-09-02 19:04:33 +01:00
parent 5a895a09ca
commit 765a6417b2
2 changed files with 51 additions and 0 deletions

View File

@@ -1,3 +1,9 @@
Version 3.75 (2021-09-02)
[ENHANCEMENTS]
* set_i_vlan support for Ruckus/Brocade/Foundry
Version 3.74 (2021-08-24)
[NEW FEATURES]

View File

@@ -294,6 +294,29 @@ sub interfaces {
return $i_descr;
}
sub set_i_vlan {
my ($foundry, $vlan, $iid) = @_;
my %if_map = reverse %{ $foundry->snSwPortIfIndex || {} };
my $target = $if_map{$iid};
my $i_vlan = $foundry->i_vlan($iid);
if ( defined $i_vlan and defined $target ) {
print
"Changing VLAN from $i_vlan->{$iid} to $vlan on IfIndex: $iid ($target)\n"
if $foundry->debug();
my $rv = $foundry->set_snSwPortVlanId( $vlan, $target );
unless ($rv) {
$foundry->error_throw(
"Unable to change VLAN to $vlan on IfIndex: $iid");
return;
}
return $rv;
}
$foundry->error_throw("Can't find ifIndex: $iid - Is it an access port?");
return;
}
# Entity MIB is supported on the Brocade NetIron XMR, NetIron MLX, MLXe,
# NetIron CES, NetIron CER, and older EdgeIron series devices.
# Try Entity MIB methods first and fall back to Pseudo ENTITY-MIB methods for
@@ -1257,4 +1280,26 @@ See documentation in L<SNMP::Info::Layer3/"TABLE METHODS"> for details.
See documentation in L<SNMP::Info::FDP/"TABLE METHODS"> for details.
=head1 SET METHODS
These are methods that provide SNMP set functionality for overridden methods
or provide a simpler interface to complex set operations. See
L<SNMP::Info/"SETTING DATA VIA SNMP"> for general information on set
operations.
=over
=item $foundry->set_i_vlan ( vlan, ifIndex )
Changes an access (untagged) port VLAN, must be supplied with the numeric
VLAN ID and port C<ifIndex>. This method should only be used on end station
(non-trunk) ports.
# Example:
my %if_map = reverse %{$foundry->interfaces()};
$foundry->set_i_vlan('2', $if_map{'FastEthernet0/1'})
or die "Couldn't change port VLAN. ",$foundry->error(1);
=back
=cut