Commit 172abd53 authored by Leigh B Stoller's avatar Leigh B Stoller

More support for adding and deleting management interfaces.

parent 800b4644
...@@ -313,6 +313,9 @@ sub Create($$$) ...@@ -313,6 +313,9 @@ sub Create($$$)
my $iface = $argref->{'iface'}; my $iface = $argref->{'iface'};
my $logical = $argref->{'logical'}; my $logical = $argref->{'logical'};
if ($ifrole eq TBDB_IFACEROLE_MANAGEMENT()) {
$wire_type = "Management";
}
$iface = "eth$card" $iface = "eth$card"
if (!defined($iface)); if (!defined($iface));
$port = 1 $port = 1
...@@ -416,11 +419,12 @@ sub Create($$$) ...@@ -416,11 +419,12 @@ sub Create($$$)
# #
# Delete a logical interface. # Delete a logical interface.
# #
sub Delete($) sub Delete($;$)
{ {
my ($self) = @_; my ($self, $real) = @_;
my $logical = ($real ? 0 : 1);
if (! $self->logical()) { if ($logical && !$self->logical()) {
print STDERR "Refusing to delete real $self\n"; print STDERR "Refusing to delete real $self\n";
return -1; return -1;
} }
...@@ -434,12 +438,29 @@ sub Delete($) ...@@ -434,12 +438,29 @@ sub Delete($)
" port='$port'")); " port='$port'"));
return -1 return -1
if (!DBQueryWarn("delete from interfaces ". if (!DBQueryWarn("delete from interfaces ".
"where logical=1 and ". "where logical=$logical and ".
" node_id='$node_id' and card='$card' and ". " node_id='$node_id' and card='$card' and ".
" port='$port'")); " port='$port'"));
return 0; return 0;
} }
#
# Delete this interface's wire entry.
#
sub DeleteWire($)
{
my ($self) = @_;
my $node_id = $self->node_id();
my $card = $self->card();
my $port = $self->port();
return -1
if (!DBQueryWarn("delete from wires ".
"where node_id1='$node_id' and card1='$card' and ".
" port1='$port'"));
return 0;
}
# #
# Create a fake object, as for the mapper (assign_wrapper) during debugging. # Create a fake object, as for the mapper (assign_wrapper) during debugging.
# #
......
...@@ -3280,5 +3280,19 @@ sub AddOutlet($$$$) ...@@ -3280,5 +3280,19 @@ sub AddOutlet($$$$)
return 0; return 0;
} }
sub DeleteOutlet($)
{
my ($self) = @_;
my $node_id = $self->node_id();
DBQueryWarn("delete from outlets_remoteauth where node_id='$node_id'")
or return -1;
DBQueryWarn("delete from outlets where node_id='$node_id'")
or return -1;
return 0;
}
# _Always_ make sure that this 1 is at the end of the file... # _Always_ make sure that this 1 is at the end of the file...
1; 1;
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