working around flaky ruckus kit
This commit is contained in:
@@ -296,22 +296,62 @@ sub interfaces {
|
|||||||
|
|
||||||
sub set_i_vlan {
|
sub set_i_vlan {
|
||||||
my ($foundry, $vlan, $iid) = @_;
|
my ($foundry, $vlan, $iid) = @_;
|
||||||
my %if_map = reverse %{ $foundry->snSwPortIfIndex || {} };
|
|
||||||
my $target = $if_map{$iid};
|
|
||||||
my $i_vlan = $foundry->i_vlan($iid);
|
my $i_vlan = $foundry->i_vlan($iid);
|
||||||
|
|
||||||
if ( defined $i_vlan and defined $target ) {
|
if ( defined $i_vlan ) {
|
||||||
print
|
print
|
||||||
"Changing VLAN from $i_vlan->{$iid} to $vlan on IfIndex: $iid ($target)\n"
|
"Changing VLAN from $i_vlan->{$iid} to $vlan on IfIndex: $iid\n"
|
||||||
if $foundry->debug();
|
if $foundry->debug();
|
||||||
|
|
||||||
my $rv = $foundry->set_snSwPortVlanId( $vlan, $target );
|
# quietly try to remove new vlan association
|
||||||
unless ($rv) {
|
$foundry->set_snVLanByPortMemberRowStatus( 3, "${vlan}.${iid}" );
|
||||||
|
sleep 1;
|
||||||
|
# try to remove old vlan association
|
||||||
|
my $rv_rem = $foundry->set_snVLanByPortMemberRowStatus( 3, "$i_vlan->{$iid}.$iid" );
|
||||||
|
sleep 1;
|
||||||
|
|
||||||
|
unless ($rv_rem) {
|
||||||
|
print "Unable to remove untagged(?) VLAN $i_vlan->{$iid} from IfIndex: $iid\n"
|
||||||
|
if $foundry->debug();
|
||||||
|
# $foundry->error_throw(
|
||||||
|
# "Unable to remove VLAN $i_vlan->{$iid} from interface: $iid");
|
||||||
|
# return;
|
||||||
|
}
|
||||||
|
|
||||||
|
# try to add new one untagged
|
||||||
|
my $rv_add = $foundry->set_multi(
|
||||||
|
['snVLanByPortMemberRowStatus', "${vlan}.${iid}", 4],
|
||||||
|
['snVLanByPortMemberTagMode', "${vlan}.${iid}", 2],
|
||||||
|
);
|
||||||
|
sleep 1;
|
||||||
|
|
||||||
|
unless ($rv_add) {
|
||||||
|
print "Unable to add untagged VLAN $vlan to IfIndex: $iid\n"
|
||||||
|
if $foundry->debug();
|
||||||
|
|
||||||
|
# did not work to add new untagged so add tagged
|
||||||
|
my $rv_add_tagged = $foundry->set_multi([
|
||||||
|
['snVLanByPortMemberRowStatus', "${vlan}.${iid}", 4],
|
||||||
|
['snVLanByPortMemberTagMode', "${vlan}.${iid}", 1],
|
||||||
|
]);
|
||||||
|
sleep 1;
|
||||||
|
|
||||||
|
if ($rv_add_tagged) {
|
||||||
|
my $rv_change_untagged = $foundry->set_snVLanByPortMemberTagMode( 2, "${vlan}.${iid}" );
|
||||||
|
sleep 1;
|
||||||
|
return $rv_change_untagged if $rv_change_untagged;
|
||||||
|
}
|
||||||
|
|
||||||
|
# try to remove old vlan association
|
||||||
|
# $foundry->set_snVLanByPortMemberRowStatus( 3, "${vlan}.${iid}" );
|
||||||
|
|
||||||
|
# then change to untagged
|
||||||
$foundry->error_throw(
|
$foundry->error_throw(
|
||||||
"Unable to change VLAN to $vlan on IfIndex: $iid");
|
"Unable to add VLAN $vlan to interface: $iid");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
return $rv;
|
|
||||||
|
return $rv_add;
|
||||||
}
|
}
|
||||||
$foundry->error_throw("Can't find ifIndex: $iid - Is it an access port?");
|
$foundry->error_throw("Can't find ifIndex: $iid - Is it an access port?");
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user