Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
cd02ed24
Commit
cd02ed24
authored
Feb 14, 2011
by
Leigh B Stoller
Browse files
Continuing work on vlan stitching.
parent
7631f564
Changes
2
Hide whitespace changes
Inline
Side-by-side
protogeni/lib/GeniCM.pm.in
View file @
cd02ed24
...
...
@@ -1053,6 +1053,7 @@ sub GetTicketAuxAux($$$$$$$$$)
"n:interface_ref",
$linkref)->get_nodelist();
my %managers = ();
my %hops = ();
my $ifacenum = 1;
my $vindex = 0;
my $trivial_ok = 1;
...
...
@@ -1065,7 +1066,7 @@ sub GetTicketAuxAux($$$$$$$$$)
#
# Look for managers list; optional for now. If not specified then
# we assume the link is for thi
e
CM.
# we assume the link is for thi
s
CM.
#
if (GeniXML::FindNodes("n:component_manager", $linkref)) {
%managers = map { GetLinkManager($_) => $_ }
...
...
@@ -1080,6 +1081,16 @@ sub GetTicketAuxAux($$$$$$$$$)
if (!exists($managers{$ENV{'
MYURN
'}}));
}
#
# Look for hops list; optional.
#
if (GeniXML::FindNodes("n:component_hop", $linkref)) {
%hops = map { GeniXML::GetNodeId($_) => $_ }
GeniXML::FindNodes("n:component_hop",
$linkref)->get_nodelist();
}
#
# Ick. Before we create the virt_lan_lans entry, we have to check
# inside to see if one of the interfaces is connected to a lan
...
...
@@ -1150,34 +1161,58 @@ sub GetTicketAuxAux($$$$$$$$$)
if (!exists($namemap{$node_nickname}) &&
exists($external_nodemap{$node_nickname})) {
#
# I have completely punted on how we represent external
# links in the DB so that we know what to put into the
# virtual topology. For now, just hardwire the one test
# case.
# Find the hop that says how we get to the edge. For
# now I assume a single hop is all we ever have.
#
my $noderef = $external_nodemap{$node_nickname};
my $other_cm = GeniXML::GetManagerId($noderef);
if (! ($other_cm eq "urn:publicid:IDN+" .
"myelab.testbed.emulab.net+authority+cm" ||
$other_cm eq "urn:publicid:IDN+" .
"emulab.net+authority+cm")) {
my $hopref;
my $hop_urn;
foreach my $urn (keys(%hops)) {
my ($auth,undef,undef) = GeniHRN::Parse($urn);
if (defined($auth) and $auth eq $OURDOMAIN) {
$hopref = $hops{$urn};
$hop_urn= $urn;
last;
}
}
if (!defined($hopref)) {
$response =
GeniResponse->Create(GENIRESPONSE_ERROR, undef,
"$lanname:
links to external node
");
"$lanname:
no local component_hop
");
goto bad;
}
my (undef,undef,$hop_id) = GeniHRN::Parse($hop_urn);
#
# Look in the external networks table to get the hop
# details.
#
my $network = ExternalNetwork->Lookup($hop_id);
if (!defined($network)) {
$response =
GeniResponse->Create(GENIRESPONSE_ERROR, undef,
"$lanname: unknown component_hop");
goto bad;
}
my $network_node = Node->Lookup($network->node_id());
if (!defined($network_node)) {
$response =
GeniResponse->Create(GENIRESPONSE_ERROR, undef,
"$lanname: unknown component_hop node");
goto bad;
}
#
# Stick in a reference to the fake bbg node that
# corresponds to where the link comes in.
# Stick in a reference to the fake node.
#
my $virtnode =
$virtexperiment->NewTableRow("virt_nodes",
{"vname" => $node_nickname,
"type" =>
"bbgenivm"
,
"osname" => '
BBGENIVM
-
FAKE
',
"ips" => '', # deprecated
"cmd_line"=> '', # bogus
"fixed" =>
"bbg1"
});
{"vname" => $node_nickname,
"type" =>
$network->node_type()
,
"osname" => '',
"ips" => '', # deprecated
"cmd_line"=> '', # bogus
"fixed" =>
$network_node->node_id()
});
if (!defined($virtnode)) {
print STDERR "Error creating bbg node\n";
$response = GeniResponse->Create(GENIRESPONSE_ERROR);
...
...
@@ -1188,7 +1223,6 @@ sub GetTicketAuxAux($$$$$$$$$)
{"vname" => $node_nickname,
"desire" => "pcshared",
"weight" => 0.95});
$virtexperiment->multiplex_factor(1);
$virtexperiment->encap_style("vlan");
$iface_name = "";
$iface_vport = 0;
...
...
protogeni/lib/GeniCMV2.pm.in
View file @
cd02ed24
...
...
@@ -314,6 +314,8 @@ sub CreateSliver($)
my
$
impotent
=
$
argref
->{
'impotent'
}
||
0
;
require
Node
;
require
Experiment
;
require
libtestbed
;
require
libaudit
;
#
For
now
,
I
am
not
worrying
about
the
slice_urn
argument
.
if
(
! (defined($credentials) &&
...
...
@@ -426,26 +428,31 @@ sub CreateSliver($)
return
GeniResponse
->
Create
(
GENIRESPONSE_ERROR
,
undef
,
"Internal Error"
);
}
#
#
At
this
point
we
want
to
return
and
let
the
startsliver
proceed
#
in
the
background
#
my
$
mypid
=
fork
();
if
($
mypid
)
{
#
Let
the
child
get
going
.
sleep
(
1
);
return
GeniResponse
->
Create
(
GENIRESPONSE_SUCCESS
,
[$
sliver_credential
,
$
sliver_manifest
]);
}
#
This
switches
the
file
that
we
are
writing
to
.
libaudit
::
AuditFork
();
#
Make
sure
that
the
next
phase
sees
all
changes
.
Experiment
->
FlushAll
();
Node
->
FlushAll
();
if
($
aggregate
->
Start
($
API_VERSION
,
0
)
!= 0) {
$
slice
->
UnLock
();
return
GeniResponse
->
Create
(
GENIRESPONSE_ERROR
,
undef
,
"Could not start sliver"
);
}
#
GeniCM
::
UpdateManifest
($
slice
);
$
sliver_manifest
=
$
aggregate
->
GetManifest
(
1
);
if
(
!defined($sliver_manifest)) {
print
STDERR
"CreateSliver: Could not get manifest for $aggregate
\n
"
;
return
GeniResponse
->
Create
(
GENIRESPONSE_ERROR
,
undef
,
"Internal Error"
);
print
STDERR
"Could not start sliver
\n
"
;
return
-
1
;
}
$
slice
->
UnLock
();
return
GeniResponse
->
Create
(
GENIRESPONSE_SUCCESS
,
[$
sliver_credential
,
$
sliver_manifest
]);
return
0
;
}
#
...
...
@@ -1547,6 +1554,7 @@ sub ReserveVlanTags($)
my
$
taglist
=
$
argref
->{
'taglist'
};
my
$
response
;
my
$
actualtag
;
my
($
myauth
,
undef
,
undef
)
=
GeniHRN
::
Parse
($
ENV
{
'MYURN'
});
#
List
of
vlans
to
delete
after
getting
the
tags
.
my
@
delete
=
();
my
%
linkmap
=
();
...
...
@@ -1682,6 +1690,37 @@ sub ReserveVlanTags($)
"Could not find link in rspec"
);
goto
done
;
}
#
#
Go
through
the
component
hops
and
find
the
one
that
refers
to
us
.
#
This
is
our
external
network
point
.
#
my
$
hopref
;
foreach
my
$
ref
(
GeniXML
::
FindNodes
(
"n:component_hop"
,
$
linkref
)->
get_nodelist
())
{
my
$
component_urn
=
GeniXML
::
GetNodeId
($
ref
);
my
($
auth
,
undef
,
undef
)
=
GeniHRN
::
Parse
($
component_urn
);
if
(
defined
($
auth
)
and
$
auth
eq
$
myauth
)
{
$
hopref
=
$
ref
;
last
;
}
}
if
(
!defined($hopref)) {
$
response
=
GeniResponse
->
Create
(
GENIRESPONSE_BADARGS
,
undef
,
"Could not find hop in link"
);
goto
done
;
}
my
$
hop_urn
=
GeniXML
::
GetNodeId
($
hopref
);
my
(
undef
,
undef
,$
hop_id
)
=
GeniHRN
::
Parse
($
hop_urn
);
print
STDERR
"$hop_urn
\n
"
;
my
$
network
=
ExternalNetwork
->
Lookup
($
hop_id
);
if
(
!defined($network)) {
$
response
=
GeniResponse
->
Create
(
GENIRESPONSE_BADARGS
,
undef
,
"$hop_urn is not an external network"
);
goto
done
;
}
my
$
vlan
=
VLan
->
Lookup
($
slice_experiment
,
$
linkname
);
if
(
!defined($vlan)) {
#
...
...
@@ -1714,6 +1753,29 @@ sub ReserveVlanTags($)
$
actualtag
=
$
tag
;
}
else
{
#
#
Check
to
see
what
tags
are
valid
for
us
.
#
my
@
tags
=
();
foreach
my
$
tag
(@{
$
taglist
})
{
push
(@
tags
,
$
tag
)
if
($
network
->
VlanTagOkay
($
tag
));
}
if
(
!@tags) {
#
#
Return
a
list
of
okay
tags
.
#
my
@
okaytags
=
();
for
(
my
$
i
=
$
network
->
min_vlan
();
$
i
<
$
network
->
max_vlan
();
$
i
++)
{
push
(@
okaytags
,
$
i
);
}
$
response
=
GeniResponse
->
Create
(
GENIRESPONSE_SEARCHFAILED
,
\@
okaytags
,
"Could not find a suitable tag"
);
goto
done
;
}
#
#
This
is
a
debugging
hack
;
Inside
an
elabinelab
,
it
might
be
#
an
other
local
elabinelab
or
the
outer
boss
.
In
this
case
,
...
...
@@ -1722,7 +1784,6 @@ sub ReserveVlanTags($)
#
In
this
case
,
we
can
just
stipulate
that
one
of
the
tags
is
good
.
#
if
($
ELABINELAB
)
{
my
($
myauth
,
undef
,
undef
)
=
GeniHRN
::
Parse
($
ENV
{
'MYURN'
});
my
($
hisauth
,
undef
,
undef
)
=
GeniHRN
::
Parse
($
slice_urn
);
my
@
tmp
=
split
(
'\.'
,
$
OURDOMAIN
);
...
...
@@ -1732,7 +1793,7 @@ sub ReserveVlanTags($)
if
($
myauth
=~
/$
dom
$/
&&
$
hisauth
=~
/$
dom
$/)
{
print
STDERR
"ElabInElab clause is true: $myauth $hisauth
\n
"
;
my
$
tag
=
pop
(@
{
$
taglist
}
);
my
$
tag
=
pop
(@
tags
);
if
($
vlan
->
ReserveVlanTag
($
tag
))
{
$
actualtag
=
$
tag
;
goto
gottag
;
...
...
@@ -1751,7 +1812,7 @@ sub ReserveVlanTags($)
#
my
$
vlanid
=
$
vlan
->
lanid
();
my
$
tag
=
undef
;
my
@
tmp
=
@
{
$
taglist
}
;
my
@
tmp
=
@
tags
;
while
(@
tmp
)
{
$
tag
=
pop
(@
tmp
);
if
($
vlan
->
ReserveVlanTag
($
tag
,
1
))
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment