Commit 450e2d17 authored by Robert Ricci's avatar Robert Ricci

Belated checkin of some patches from Keith Sklower @Berkeley.

parent 78b94450
......@@ -1165,6 +1165,37 @@ sub UpdateField($$$@) {
$err;
}
#
# Determine if a VLAN has any ports on this switch
#
# usage: vlanHasPorts($self, $vlan_number)
# returns 1 if the vlan exists and has ports
#
sub vlanHasPorts($$) {
my ($self, $vlan_number)= @_;
if ($self->vlanNumberExists($vlan_number)) {
my $VlanPortVlan;
if ($self->{OSTYPE} eq "CatOS") {
$VlanPortVlan = ["vlanPortVlan"]; #index is ifIndex
} elsif ($self->{OSTYPE} eq "IOS") {
$VlanPortVlan = ["vmVlan"]; #index is ifIndex
}
#
# Walk the tree for the VLAN members
#
my ($rows) = snmpitBulkwalkFatal($self->{SESS},$VlanPortVlan);
$self->debug("Vlan members walk got " . scalar(@$rows) . " rows\n");
foreach my $rowref (@$rows) {
my ($name,$modport,$number) = @$rowref;
$self->debug("Got $name $modport $number\n",3);
if ($number == $vlan_number) { return 1; }
}
return 0;
}
}
#
# List all VLANs on the device
#
......
......@@ -1030,7 +1030,7 @@ sub resetVlanIfOnTrunk($$$) {
my $RetVal = $self->{SESS}->get($obj);
if ($self->{DEBUG} > 0) {
print $self->{NAME} . ":resetVlanIfOnTrunk got $RetVal for $obj\n";
print $self->{NAME} . "::resetVlanIfOnTrunk got $RetVal for $obj\n";
}
if (defined($RetVal) && ($RetVal eq "valid")) {
$self->setVlansOnTrunk($modport,0,$vlan);
......
......@@ -1190,7 +1190,7 @@ sub getStats ($) {
sub resetVlanIfOnTrunk($$$) {
my ($self, $modport, $vlan) = @_;
my ($ifIndex) = $self->convertPortFormat($PORT_FORMAT_IFINDEX,$modport);
$self->debug($self->{NAME} . ":resetVlansIfOnTrunk m $modport "
$self->debug($self->{NAME} . "::resetVlanIfOnTrunk m $modport "
. "vlan $vlan ifIndex $ifIndex\n",1);
my $vlans = $self->get1("rcVlanPortVlanIds", $ifIndex);
if (defined($vlans)) {
......@@ -1216,7 +1216,6 @@ sub getChannelIfIndex($@) {
my $self = shift;
my @ports = @_;
my @ifIndexes = $self->convertPortFormat($PORT_FORMAT_IFINDEX,@ports);
my $ifindex = undef;
#
......
......@@ -361,13 +361,13 @@ sub setPortVlan($$@) {
my $dev = $self->{DEVICES}{$devicename};
foreach my $neighbor (keys %{$trunks{$devicename}}) {
my $trunkIndex = $dev->getChannelIfIndex(
@{$trunks{$devicename}{neighbor}});
@{$trunks{$devicename}{$neighbor}});
if (!defined($trunkIndex)) {
warn "unable to find channel information on $devicename ".
"for $devicename-$neighbor EtherChannel\n";
$errors += 1;
} else {
$dev->resetVlansIfOnTrunk($trunkIndex,$vlan);
$dev->resetVlanIfOnTrunk($trunkIndex,$vlan);
}
}
}
......@@ -985,7 +985,7 @@ sub lock($) {
my $stackid = $self->{STACKID};
my $token = "snmpit_$stackid";
my $old_umask = umask(0);
die if (TBScriptLock($token) != TBSCRIPTLOCK_OKAY());
die if (TBScriptLock($token,0,1800) != TBSCRIPTLOCK_OKAY());
umask($old_umask);
}
......
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