Commit 1093eaa2 authored by Robert Ricci's avatar Robert Ricci

Added a retry in findVlan - with many switches, it may take a while for VLAN

creation to propogate. So, we retry up to 10 times with 1-second sleeps in
between.
parent b113cef4
......@@ -379,27 +379,40 @@ sub vlanUnlock($;$) {
sub findVlan($$) {
my $self = shift;
my $vlan_id = shift;
my $max_tries = 10;
my $VlanName = "vtpVlanName"; # index by 1.vlan #
#
# Walk the tree to find the VLAN names
# We try this a few time, with 1 second sleeps, since it can take
# a while for VLAN information to propagate
#
my ($rows) = $self->{SESS}->bulkwalk(0,32,[$VlanName]);
foreach my $rowref (@$rows) {
my ($name,$vlan_number,$vlan_name) = @$rowref;
foreach my $try (1 .. $max_tries) {
#
# We get the VLAN number in the form 1.number - we need to strip
# off the '1.' to make it useful
# Walk the tree to find the VLAN names
#
$vlan_number =~ s/^1\.//;
my ($rows) = $self->{SESS}->bulkwalk(0,32,[$VlanName]);
foreach my $rowref (@$rows) {
my ($name,$vlan_number,$vlan_name) = @$rowref;
#
# We get the VLAN number in the form 1.number - we need to strip
# off the '1.' to make it useful
#
$vlan_number =~ s/^1\.//;
$self->debug("Got $name $vlan_number $vlan_name\n",2);
if ($vlan_name eq $vlan_id) {
return $vlan_number;
$self->debug("Got $name $vlan_number $vlan_name\n",2);
if ($vlan_name eq $vlan_id) {
return $vlan_number;
}
}
}
#
# Wait before we try again
#
$self->debug("VLAN find failed, trying again\n");
sleep 1;
}
#
# Didn't find it
#
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment