Commit 1f74baac authored by Robert Ricci's avatar Robert Ricci
Browse files

Added some more support for debugging output, and fixed a bug that

was preventing VLANs from being cleared out before they were delted.
parent 00a4c348
......@@ -287,7 +287,8 @@ foreach my $stack_id (keys %stacks) {
# more database information to be able to distinguish stack types
#
use snmpit_cisco_stack;
my $stack = new snmpit_cisco_stack($stack_id,@{$stacks{$stack_id}});
my $stack = new snmpit_cisco_stack($stack_id,$debug,
@{$stacks{$stack_id}});
push @stacks, $stack;
}
......@@ -617,7 +618,7 @@ sub doDeleteVlan($) {
$exists = 1;
print "Deleting VLAN $vlan_name ...\n";
my $ok = $stack->removeVlan($vlan_name);
print "VLAN creation ";
print "VLAN deletion ";
print $ok? "succeeded":"failed",".\n";
if (!$ok) {
$errors++;
......
......@@ -591,16 +591,16 @@ sub removePortsFromVlan($$) {
# Get a list of the ports in the VLAN
#
#
my $VlanPortVlan = ["vlanPortVlan",0]; # index by module.port, gives vlan #
my $VlanPortVlan = ["vlanPortVlan"]; # index by module.port, gives vlan #
#
# Walk the tree to find VLAN membership
#
my ($rows) = $self->{SESS}->bulkwalk(0,32,$VlanPortVlan);
my ($rows) = $self->{SESS}->bulkwalk(0,32,$VlanPortVlan,3);
my @ports;
foreach my $rowref (@$rows) {
my ($name,$modport,$port_vlan_number) = @$rowref;
$self->debug("Got $name $modport $port_vlan_number\n",3);
$self->debug("Got $name $modport $port_vlan_number\n");
if ($port_vlan_number == $vlan_number) {
push @ports, $modport;
}
......
......@@ -28,13 +28,14 @@ use libdb;
# usage: new(string name, string stack_id, list of devicenames)
# returns a new object blessed into the snmpit_cisco_stack class
#
sub new($$@) {
sub new($$#@) {
# The next two lines are some voodoo taken from perltoot(1)
my $proto = shift;
my $class = ref($proto) || $proto;
my $stack_id = shift;
my $debuglevel = shift;
my @devicenames = @_;
#
......@@ -45,7 +46,11 @@ sub new($$@) {
#
# Set up some defaults
#
$self->{DEBUG} = 0;
if (defined $debuglevel) {
$self->{DEBUG} = $debuglevel;
} else {
$self->{DEBUG} = 0;
}
#
# The stackid just happens to also be leader of the stack
......
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