Commit cc22200f authored by Leigh Stoller's avatar Leigh Stoller

Out with the vlans table, in with lans, lan_attributes, lan_members,

lan_member_attributes, and ifaces. Making the world safe for protogenis.
parent 96af2532
......@@ -25,7 +25,7 @@ WEB_BIN_SCRIPTS = webnfree
LIBEXEC_SCRIPTS = $(WEB_BIN_SCRIPTS) $(WEB_SBIN_SCRIPTS) xmlconvert
LIB_SCRIPTS = libdb.pm Node.pm libdb.py libadminctrl.pm Experiment.pm \
NodeType.pm Interface.pm User.pm Group.pm Project.pm \
Image.pm OSinfo.pm Archive.pm Logfile.pm
Image.pm OSinfo.pm Archive.pm Logfile.pm Lan.pm
# Stuff installed on plastic.
USERSBINS = genelists.proxy dumperrorlog.proxy
......
This diff is collapsed.
#!/usr/bin/perl
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2002 University of Utah and the Flux Group.
# Copyright (c) 2000-2007 University of Utah and the Flux Group.
# All rights reserved.
#
use strict;
use English;
#
# Turn off line buffering on output
#
$| = 1;
#
# Configure variables
# Set umask for start/swap. We want other members in the project to be
# able to swap/end experiments, so the log and intermediate files need
# to be 664 since some are opened for append.
#
umask(0002);
#
# Untaint the path
#
# un-taint path
$ENV{'PATH'} = '/bin:/usr/bin:/usr/local/bin';
delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
# Testbed Libraries.
use lib '@prefix@/lib';
use libdb;
use English;
use User;
use Lan;
if (!TBAdmin($UID)) {
#
# Verify user and get his DB uid and other info for later.
#
my $this_user = User->ThisUser();
if (! defined($this_user)) {
die("*** $0:\n".
" You ($UID) do not exist!\n");
}
if (!$this_user->IsAdmin()) {
die("*** $0:\n".
" You must be a TB administrator to use this program\n");
}
my ($virtual,$id,$pideid,$members);
my ($pid,$eid,$virtual,$id,$pideid,$members);
print << "END";
ID Project/Experiment Link/LAN Switches (number of members in parens)
--------------------------------------------------------------------------------
......@@ -35,34 +62,52 @@ $FORMAT_NAME = 'vlanlist';
#
# Get a list of all VLANs for swapped-in experiments
#
my $result = DBQueryFatal("SELECT eid, pid, virtual, members, id FROM vlans " .
"ORDER BY eid,pid,virtual");
my $eid,$pid;
while (($eid, $pid, $virtual, $members, $id) = $result->fetchrow()) {
my @vlans;
if (VLan->AllVLans(\@vlans) != 0) {
die("*** $0:\n".
" Unable to load VLANs for all experiments\n");
}
#
# Split apart the space-separated list of members
#
my @members = split /\s+/, $members;
foreach my $vlan (@vlans) {
my %switches = ();
my @members;
my $pid = $vlan->pid();
my $eid = $vlan->eid();
$id = $vlan->lanid();
$virtual = $vlan->vname();
if ($vlan->MemberList(\@members) != 0) {
die("*** $0:\n".
" Unable to load members for $vlan\n");
}
foreach my $member (@members) {
my ($node,$if) = split /:/, $member;
my $node;
my $iface;
if ($member->GetNodeIface(\$node, \$iface) != 0) {
die("*** $0:\n".
" Missing attributes for $member in $vlan\n");
}
my $nodeid = $node->node_id();
#
# Find out which switch this interface is connected to
#
my $result2 = DBQueryFatal("SELECT node_id2 FROM wires AS w LEFT JOIN ".
"interfaces AS i ON w.node_id1=i.node_id AND w.card1=i.card " .
"WHERE node_id='$node' and iface='$if'");
my $result2 =
DBQueryFatal("select node_id2 from wires as w ".
"left join interfaces as i on ".
" w.node_id1=i.node_id AND w.card1=i.card " .
"where node_id='$nodeid' and iface='$iface'");
# We assume only one response here!
my ($switch) = ($result2->fetchrow());
my ($switch) = $result2->fetchrow_array();
$switches{$switch}++;
}
#
# Report if more than one switch was found
#
if ((keys %switches) > 1) {
if (scalar(keys(%switches)) > 1) {
$pideid = "$pid/$eid";
$members = join(" ", map { "$_ ($switches{$_})" } sort keys %switches);
write;
......
......@@ -2,7 +2,7 @@
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2007 University of Utah and the Flux Group.
# Copyright (c) 2000-2008 University of Utah and the Flux Group.
# All rights reserved.
#
......@@ -247,6 +247,7 @@ require Group;
require Node;
require NodeType;
require Mysql;
require Lan;
use vars qw($DBQUERY_MAXTRIES $DBCONN_MAXTRIES
$DBCONN_EXITONERR $DBQUERY_RECONNECT $DBQUERY_DEBUG
@EXPORT_OK @virtualTables @physicalTables);
......@@ -2449,7 +2450,6 @@ sub TBExptContainsNodeCT($$$)
"ipsubnets");
@physicalTables = ("delays",
"vlans",
"tunnels",
"ipport_ranges",
"v2pmap",
......@@ -2647,6 +2647,13 @@ sub TBExptRemovePhysicalState($$)
my ($pid, $eid) = @_;
my $errors = 0;
my $experiment = Experiment->Lookup($pid, $eid);
return 1
if (!defined($experiment));
return 1
if (Lan->DestroyExperimentLans($experiment) != 0);
foreach my $table (@physicalTables) {
DBQueryWarn("DELETE FROM $table WHERE pid='$pid' AND eid='$eid'")
or $errors++;
......@@ -2697,6 +2704,13 @@ sub TBExptBackupPhysicalState($$)
or return 1;
}
my $experiment = Experiment->Lookup($pid, $eid);
return 1
if (!defined($experiment));
return 1
if (Lan->BackupExperimentLans($experiment, $pstateDir) != 0);
foreach my $table (@physicalTables) {
DBQueryWarn("SELECT * FROM $table WHERE pid='$pid' AND eid='$eid' ".
"INTO OUTFILE '$pstateDir/$table' ")
......
......@@ -521,7 +521,7 @@ CREATE TABLE `experiment_input_data` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Table structure for table `experiment_template_inputs`
-- Table structure for table `experiment_inputs`
--
DROP TABLE IF EXISTS `experiment_inputs`;
......@@ -1098,9 +1098,9 @@ CREATE TABLE `firewalls` (
`fwname` varchar(32) NOT NULL default '',
`vlan` int(11) default NULL,
`vlanid` int(11) default NULL,
PRIMARY KEY (`exptidx`,`fwname`),
KEY `pideid` (`pid`,`eid`,`fwname`),
KEY `vlan` (`vlan`)
PRIMARY KEY (`exptidx`,`fwname`),
KEY `vlan` (`vlan`),
KEY `pideid` (`pid`,`eid`,`fwname`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
......@@ -1292,6 +1292,28 @@ CREATE TABLE `iface_counters` (
KEY `node_idindex` (`node_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Table structure for table `ifaces`
--
DROP TABLE IF EXISTS `ifaces`;
CREATE TABLE `ifaces` (
`lanid` int(11) NOT NULL default '0',
`ifaceid` int(11) NOT NULL default '0',
`exptidx` int(11) NOT NULL default '0',
`pid` varchar(12) NOT NULL default '',
`eid` varchar(32) NOT NULL default '',
`node_id` varchar(32) NOT NULL default '',
`vnode` varchar(32) NOT NULL default '',
`vname` varchar(32) NOT NULL default '',
`vidx` int(11) NOT NULL default '0',
`vport` tinyint(3) NOT NULL default '0',
PRIMARY KEY (`lanid`,`ifaceid`),
KEY `pideid` (`pid`,`eid`),
KEY `exptidx` (`exptidx`),
KEY `lanid` (`lanid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Table structure for table `images`
--
......@@ -1458,6 +1480,64 @@ CREATE TABLE `knowledge_base_entries` (
PRIMARY KEY (`idx`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Table structure for table `lan_attributes`
--
DROP TABLE IF EXISTS `lan_attributes`;
CREATE TABLE `lan_attributes` (
`lanid` int(11) NOT NULL default '0',
`attrkey` varchar(32) NOT NULL default '',
`attrvalue` tinytext NOT NULL,
`attrtype` enum('integer','float','boolean','string') default 'string',
PRIMARY KEY (`lanid`,`attrkey`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Table structure for table `lan_member_attributes`
--
DROP TABLE IF EXISTS `lan_member_attributes`;
CREATE TABLE `lan_member_attributes` (
`lanid` int(11) NOT NULL default '0',
`memberid` int(11) NOT NULL default '0',
`attrkey` varchar(32) NOT NULL default '',
`attrvalue` tinytext NOT NULL,
`attrtype` enum('integer','float','boolean','string') default 'string',
PRIMARY KEY (`lanid`,`memberid`,`attrkey`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Table structure for table `lan_members`
--
DROP TABLE IF EXISTS `lan_members`;
CREATE TABLE `lan_members` (
`lanid` int(11) NOT NULL default '0',
`memberid` int(11) NOT NULL auto_increment,
PRIMARY KEY (`lanid`,`memberid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Table structure for table `lans`
--
DROP TABLE IF EXISTS `lans`;
CREATE TABLE `lans` (
`lanid` int(11) NOT NULL auto_increment,
`exptidx` int(11) NOT NULL default '0',
`pid` varchar(12) NOT NULL default '',
`eid` varchar(32) NOT NULL default '',
`vname` varchar(64) NOT NULL default '',
`vidx` int(11) NOT NULL default '0',
`type` varchar(32) NOT NULL default '',
`link` int(11) default NULL,
`ready` tinyint(1) default '0',
PRIMARY KEY (`lanid`),
KEY `pideid` (`pid`,`eid`),
KEY `exptidx` (`exptidx`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Table structure for table `last_reservation`
--
......@@ -3200,7 +3280,7 @@ CREATE TABLE `vinterfaces` (
`iface` varchar(10) default NULL,
`rtabid` smallint(5) unsigned NOT NULL default '0',
`vnode_id` varchar(32) default NULL,
`exptidx` int(11) NOT NULL default '0',
`exptidx` int(10) NOT NULL default '0',
`virtlanidx` int(11) NOT NULL default '0',
`vlanid` int(11) NOT NULL default '0',
PRIMARY KEY (`node_id`,`unit`),
......@@ -3333,7 +3413,7 @@ CREATE TABLE `virt_lans` (
`nobwshaping` tinyint(4) default '0',
`mustdelay` tinyint(1) default '0',
`usevethiface` tinyint(4) default '0',
`encap_style` enum('alias','veth','veth-ne','vlan','default') NOT NULL default 'default',
`encap_style` enum('alias','veth','veth-ne','vlan','tunnel','default') NOT NULL default 'default',
`trivial_ok` tinyint(4) default '1',
`protocol` varchar(30) NOT NULL default 'ethernet',
`is_accesspoint` tinyint(4) default '0',
......
......@@ -731,7 +731,7 @@ REPLACE INTO table_regex VALUES ('projects','num_pcs','int','redirect','default:
REPLACE INTO table_regex VALUES ('projects','num_pcplab','int','redirect','default:int',0,2048,NULL);
REPLACE INTO table_regex VALUES ('projects','num_ron','int','redirect','default:int',0,1024,NULL);
REPLACE INTO table_regex VALUES ('experiments','encap_style','text','regex','^(alias|veth|veth-ne|vlan|default)$',0,0,NULL);
REPLACE INTO table_regex VALUES ('experiments','encap_style','text','regex','^(alias|veth|veth-ne|vlan|tunnel|default)$',0,0,NULL);
REPLACE INTO table_regex VALUES ('experiments','veth_encapsulate','int','redirect','default:boolean',0,0,NULL);
REPLACE INTO table_regex VALUES ('experiments','allowfixnode','int','redirect','default:boolean',0,0,NULL);
REPLACE INTO table_regex VALUES ('experiments','jail_osname','text','redirect','os_info:osname',0,0,NULL);
......
......@@ -4228,3 +4228,66 @@ last_net_act,last_cpu_act,last_ext_act);
4.139: Change to previous revision; Skip to next entry.
4.140: Big changes to vlans table. That table is deprecated in favor of
these new tables. You want to make these changes while the
system is quiet (disable web interface to prevent swapping).
CREATE TABLE `lans` (
`lanid` int(11) NOT NULL auto_increment,
`exptidx` int(11) NOT NULL default '0',
`pid` varchar(12) NOT NULL default '',
`eid` varchar(32) NOT NULL default '',
`vname` varchar(64) NOT NULL default '',
`vidx` int(11) NOT NULL default 0,
`type` varchar(32) NOT NULL default '',
`link` int(11) default NULL,
`ready` tinyint(1) default '0',
PRIMARY KEY (`lanid`),
KEY `pideid` (`pid`,`eid`),
KEY `exptidx` (`exptidx`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TABLE `lan_attributes` (
`lanid` int(11) NOT NULL default '0',
`attrkey` varchar(32) NOT NULL default '',
`attrvalue` tinytext NOT NULL,
`attrtype` enum('integer','float','boolean','string') default 'string',
PRIMARY KEY (`lanid`,`attrkey`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TABLE `lan_members` (
`lanid` int(11) NOT NULL default '0',
`memberid` int(11) NOT NULL auto_increment,
PRIMARY KEY (`lanid`,`memberid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TABLE `lan_member_attributes` (
`lanid` int(11) NOT NULL default '0',
`memberid` int(11) NOT NULL default '0',
`attrkey` varchar(32) NOT NULL default '',
`attrvalue` tinytext NOT NULL,
`attrtype` enum('integer','float','boolean','string') default 'string',
PRIMARY KEY (`lanid`,`memberid`,`attrkey`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
CREATE TABLE `ifaces` (
`lanid` int(11) NOT NULL default '0',
`ifaceid` int(11) NOT NULL default '0',
`exptidx` int(11) NOT NULL default '0',
`pid` varchar(12) NOT NULL default '',
`eid` varchar(32) NOT NULL default '',
`node_id` varchar(32) NOT NULL default '',
`vnode` varchar(32) NOT NULL default '',
`vname` varchar(32) NOT NULL default '',
`vidx` int(11) NOT NULL default 0,
`vport` tinyint(3) NOT NULL default '0',
PRIMARY KEY (`lanid`,`ifaceid`),
KEY `pideid` (`pid`,`eid`),
KEY `exptidx` (`exptidx`),
KEY `lanid` (`lanid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
Run the following script. The testbed should be quiet (no swaps).
./newlans.pl
#!/usr/bin/perl -w
#
# EMULAB-COPYRIGHT
# Copyright (c) 2008 University of Utah and the Flux Group.
# All rights reserved.
#
use English;
use lib "/usr/testbed/lib";
use libdb;
use libtestbed;
use Lan;
#
# Untaint the path
#
$ENV{'PATH'} = '/bin:/usr/bin:/usr/sbin';
delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
exit(VLan->Initialize());
This diff is collapsed.
......@@ -16,6 +16,7 @@ use libdb;
use libtestbed;
use Experiment;
use User;
use Lan;
#
# Do things necessary for setting up inner elab experiment.
......@@ -1141,39 +1142,47 @@ sub RemoveNodes()
# Grab the vlans table. We need to find any ports used by the nodes
# getting deleted, and move them back to the default vlan.
#
my %newvlans = ();
my @todelete = ();
my @delmembers = ();
my @todelete = ();
my $query_result =
DBQueryWarn("select v.*,e.inner_id from vlans as v ".
"left join elabinelab_vlans as e on ".
" e.outer_id=v.id ".
"where v.pid='$pid' and v.eid='$eid'");
DBQueryWarn("select inner_id,outer_id from elabinelab_vlans ".
"where pid='$pid' and eid='$eid'");
return -1
if (!$query_result);
while (my (%row) = $query_result->fetchhash()) {
my $members = $row{"members"};
my $id = $row{"id"};
my $inner_id = $row{"inner_id"};
my @newports = ();
my $changed = 0;
while (my ($inner_id,$outer_id) = $query_result->fetchrow_array()) {
my $vlan = VLan->Lookup($outer_id);
if (!defined($vlan)) {
print STDERR "*** No such vlan $outer_id ($inner_id)\n";
return -1;
}
my @members;
if ($vlan->MemberList(\@members) != 0) {
print STDERR "*** Unable to load members for $vlan\n";
return -1;
}
my $id = $outer_id;
my $changed = 0;
foreach my $port (split(/\s+/, $members)) {
my ($node,$eth) = split(":", $port);
foreach my $member (@members) {
my $node;
my $iface;
# If this node is not in the list of nodes to be deleted,
# the node:port stays in the port list.
if (! grep {$_ eq $node} @nodes) {
push(@newports, $port);
if ($member->GetNodeIface(\$node, \$iface) != 0) {
print STDERR "Missing attributes for $member in $vlan\n";
return -1;
}
else {
push(@todelete, $port);
my $nodeid = $node->node_id();
# See if this node is in the list of nodes to be deleted,
if (grep {$_ eq $nodeid} @nodes) {
push(@todelete, "$nodeid:$iface");
push(@delmembers, $member);
$changed = 1;
}
}
$newvlans{$id} = [ @newports ]
if ($changed);
}
# Remove ports from the vlans.
......@@ -1184,13 +1193,9 @@ sub RemoveNodes()
return -1;
}
}
# Only if the above succeeds, do we update the vlans table.
foreach $id (keys(%newvlans)) {
my $members = join(" ", @{ $newvlans{$id} });
DBQueryWarn("update vlans set members='$members' ".
"where id=$id")
foreach my $member (@delmembers) {
$member->Delete() == 0
or return -1;
}
......
......@@ -2,7 +2,7 @@
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2006 University of Utah and the Flux Group.
# Copyright (c) 2000-2007 University of Utah and the Flux Group.
# All rights reserved.
#
......@@ -68,6 +68,7 @@ require exitonwarn;
use libdb;
use libtblog;
use NodeType;
use Lan;
tblog_stop_capture('stdout');
......@@ -863,18 +864,32 @@ if ($TRACK_INTERSWITCH_BANDWIDTH) {
#
# Get a list of all VLANs
#
my $result = DBQueryFatal("SELECT virtual, members FROM vlans");
while (my ($virtual, $members) = $result->fetchrow()) {
#
# Split apart the space-separated list of members
#
my @members = split /\s+/, $members;
my @vlans;
if (VLan->AllVLans(\@vlans) != 0) {
die("*** $0:\n".
" Unable to load VLANs for all experiments\n");
}
foreach my $vlan (@vlans) {
my @members;
if ($vlan->MemberList(\@members) != 0) {
die("*** $0:\n".
" Unable to load members for $vlan\n");
}
my %switches = ();
foreach my $member (@members) {
my ($node,$iface) = split /:/, $member;
my $switch = get_ifaceswitch($node,$iface);
my ($card, $port) = get_ifacecardport($node,$iface);
my $bw = get_ifacebw($node,$card,$port,"ethernet");
my $node;
my $iface;
if ($member->GetNodeIface(\$node, \$iface) != 0) {
die("*** $0:\n".
" Missing attributes for $member in $vlan\n");
}
my $nodeid = $node->node_id();
my $switch = get_ifaceswitch($nodeid,$iface);
my ($card, $port) = get_ifacecardport($nodeid,$iface);
my $bw = get_ifacebw($nodeid,$card,$port,"ethernet");
$switches{$switch} += $bw;
}
......
#!/usr/bin/perl -w
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2007 University of Utah and the Flux Group.
# Copyright (c) 2000-2008 University of Utah and the Flux Group.
# All rights reserved.
#
use English;
......@@ -22,9 +22,10 @@ my $debug = 0;
my $impotent = 0;
my $pid;
my $eid;
my @inner_ids = ();
my @outer_ids = ();
my %mapping = ();
my @inner_ids = ();
my @outer_ids = ();
my %outer_vlans = ();
my %mapping = ();
#
# Configure variables
......@@ -46,9 +47,7 @@ use lib "@prefix@/lib";
use libdb;
use libtestbed;
use Experiment;
# Be careful not to exit on transient error
$libdb::DBQUERY_MAXTRIES = 60;
use Lan;
# Locals
my $exptidx;
......@@ -306,43 +305,32 @@ sub SetupVlans()
"where pid='$pid' and eid='$eid' and inner_id='$id'");
if ($query_result->numrows == 1) {
($outer_id) = $query_result->fetchrow();
$query_result =
DBQueryFatal("select members from vlans where id='$outer_id'");
if ($query_result->numrows == 1) {
my ($oldstring) = $query_result->fetchrow();
my @mlist = split " ",$oldstring;
my %mhash = ();
foreach my $mem (@mlist) {
$mhash{$mem} = 1;
}
foreach my $mem (@members) {
$mhash{$mem} = 1;
}
@mlist = keys(%mhash);
$mstring = "@mlist";
}
my $query_result =
DBQueryWarn("update vlans set members='$mstring' where " .
"id='$outer_id'");
if (!$query_result) {
my $vlan = VLan->Lookup($outer_id);
if (!defined($vlan)) {
print STDERR "*** $0:\n".
" Could not update vlan table entry for $id\n";
" Could not lookup vlan for $outer_id\n";
$errors++;
next;
}
} else {
my $query_result =
DBQueryWarn("insert into vlans ".
" (exptidx,id,pid,eid,virtual,members) ".
"values ($exptidx, 0, '$pid', '$eid', '$vtag', ".
" '$mstring')");
if (!$query_result || !$query_result->numrows) {
foreach my $port (@members) {
my ($nodeid, $iface) = split(":", $port);
if (!$vlan->IsMember($nodeid, $iface) &&
$vlan->AddMember($nodeid, $iface) != 0) {
print STDERR "*** $0:\n".
" Could not $port to $vlan\n";
$errors++;
}
}
}
else {
my $newvlan = VLan->Create($experiment, $vtag);
if (!defined($newvlan)) {
print STDERR "*** $0:\n".
" Could not insert vlan table entry for $id\n";
$errors++;
next;
}
$outer_id = $query_result->insertid;
$outer_id = $newvlan->lanid();
# Insert mapping between inner and outer vlan entries.
$query_result = DBQueryWarn("insert into elabinelab_vlans ".
......@@ -356,7 +344,7 @@ sub SetupVlans()
" Could not insert elabinelab_vlans table entry ".
"for $id/$outer_id\n";
DBQueryFatal("delete from vlans where id='$outer_id'");
$newvlan->Destroy();
$errors++;
next;
}
......@@ -368,6 +356,8 @@ sub SetupVlans()
$vmaptable{$id} = $outer_id;
# Okay, save outer_id up for passing to snmpit below.
push(@outer_ids, $outer_id);
# And save vlan object for getting the tag.
$outer_vlans{$outer_id} = $newvlan;
}
# Now call snmpit to create the actual vlans.
if ($debug) {
......@@ -391,21 +381,26 @@ sub SetupVlans()
}
my @results = ();
foreach $id (keys %vmaptable) {
my $mapid = $vmaptable{$id};
$query_result = DBQuery("select tag from vlans where id='$mapid'");
if (!$query_result || $query_result->numrows != 1) {
print STDERR "couldn't retrive vlan 802.1Q number for $mapid \n";
$errors++;
} else {
my ($tagnum) = $query_result->fetchrow();
push (@results, "$id#$tagnum");
my $outer_vlan = $outer_vlans{$vmaptable{$id}};
if ($outer_vlan->Refresh() != 0) {
print STDERR "*** Could not refresh $outer_vlan\n";
$errors++;
next;
}
my $tagnum;
if (!$outer_vlan->GetTag(\$tagnum) != 0) {
print STDERR "*** Could not get vlan tag for $outer_vlan\n";
$errors++;
next;
}
push (@results, "$id#$tagnum");
}
print join(",", @results);
return $errors;
}
#
# This is common to list and destroy
# This is common to list and destroy and trunk.
#
sub Map()
{
......@@ -437,8 +432,16 @@ sub Map()
" No such elabinelab_vlans table entry: $id\n";
next;
}
my $vlan = VLan->Lookup($mapping{$id});
if (!defined($vlan)) {
print STDERR "*** $0:\n".
" Cannot find vlan object for vlan id: $id\n";
next;
}
push(@inner_ids, $id);
push(@outer_ids, $mapping{$id});
$outer_vlans{$mapping{$id}} = $vlan;
}
return 0;
}
......@@ -483,10 +486,13 @@ sub DestroyVlans()
if ($debug) {