...
 
Commits (2)
......@@ -2832,6 +2832,22 @@ sub GetTicketAuxAux($)
$isshared = 1;
$encap = "vlan";
}
elsif (my $shared_vlan = GeniXML::CreateSharedLan($linkref)) {
if ($shared_vlan !~ /^[-\w]*$/) {
$response =
GeniResponse->Create(GENIRESPONSE_BADARGS, undef,
"Invalid shared lan name: $shared_vlan");
goto bad;
}
my $lanref = Lan->LookupSharedVLanByToken($shared_vlan);
if (defined($lanref)) {
$response =
GeniResponse->Create(GENIRESPONSE_BADARGS, undef,
"Shared lan already exists: $shared_vlan");
goto bad;
}
$encap = "vlan";
}
#
# Allow user to specify vlan encap, which might override that we
# just set it above. Experts only please.
......@@ -5580,6 +5596,37 @@ sub SliverWorkAux($)
goto bad;
}
}
if (my $sharename = GeniXML::CreateSharedLan($linkref)) {
my $vlan = VLan->Lookup($experiment, $linkname);
if (!defined($vlan)) {
print STDERR "*** Could lookup vlan $linkname for sharing\n";
}
else {
#
# This operation has to be done as an admin person.
# Use force option to override not ACTIVE experiment.
#
GeniUtil::FlipToElabMan();
my $output = GeniUtil::ExecQuiet("$WAP ".
" $SHAREVLAN -o -f $pid,$eid ".
" $linkname $sharename");
my $ecode = $?;
FlipToUser($slice, $owner);
if ($ecode) {
print STDERR "Failed to share vlan:\n";
print STDERR $output;
}
else {
libtestbed::SENDMAIL($TBOPS, "$linkname has been shared",
"$linkname has been shared.\n\n".
"Slice: $slice\n".
"Experiment: $experiment\n",
$TBOPS);
print STDERR "$linkname has been shared using name: ".
"$sharename\n";
}
}
}
manifest:
# And store into the new manifest.
my $oldlink = GeniXML::GetLinkByVirtualId($linkname, $manifest);
......
......@@ -1604,6 +1604,28 @@ sub GetSharedLanName($)
return undef;
}
sub CreateSharedLan($)
{
my ($linkref) = @_;
return undef
if (IsVersion0($linkref));
my $ref = FindNodesNS("n:create_shared_vlan",
$linkref, $SHAREDVLAN_NS)->pop();
if (!defined($ref)) {
$ref = FindNodesNS("n:link_shared_vlan", $linkref,
$SHAREDVLAN_PG_NS)->pop();
}
if (defined($ref)) {
my $name = GetText("name", $ref);
if (defined($name) and $name ne "") {
return $name;
}
}
return undef;
}
# Takes an attribute/element name, *NOT AN XPATH* and a node and sets
# the text of that node to a particular value. If the node is an
# attribute, the value is set. If it is an element with just a text
......
......@@ -3764,7 +3764,7 @@ sub GenVirtLans($)
}
}
}
elsif ($#members != 0) {
elsif (@members != 0) {
my $desires = {};
$self->exptstats()->{"lans"} += 1;
my $lannode = ($vlan->_geninodes() ? "lan-$vname" : "lan/$vname");
......