Commit 1b606cfc authored by Leigh B Stoller's avatar Leigh B Stoller
Browse files

Merge branch 'master' of git-public.flux.utah.edu:/flux/git/emulab-devel

parents 9963ad15 bfa0cf42
......@@ -2126,10 +2126,10 @@ sub SliverWorkAux($$$$$$$)
goto bad;
}
#
# Not quite sure how to deal with links into virtual containers
# yet. For now, the link section will hold the physical info,
# Not quite sure how to deal with virtual interfaces yet.
# For now, the link section will hold the physical info,
# but we have to return the VMAC so the caller knows which
# virtual interface inside the container.
# virtual interface.
#
if ($node->isvirtnode()) {
$vnode = $node;
......@@ -2142,7 +2142,11 @@ sub SliverWorkAux($$$$$$$)
Interface::VInterface->LookupByVirtLan($experiment,
$linkname, $node_id);
}
else {
$vinterface =
Interface::VInterface->LookupByVirtLan($experiment,
$linkname, $node_id);
}
#
# The interface was set above.
#
......@@ -4085,6 +4089,16 @@ sub UpdateManifest($)
print STDERR "UpdateManifest: No tag for $vlan\n";
}
$vlantags{$vlan->vname()} = $tag;
#
# Encapsulation vlan, so need to find the actual link name.
#
my $linklan;
if ($vlan->GetAttribute("link/lan", \$linklan) == 0 &&
defined($linklan)) {
$vlantags{$linklan} = $tag;
}
}
foreach my $linkref (GeniXML::FindNodes("n:link", $rspec)->get_nodelist()){
my $vname = GeniXML::GetVirtualId($linkref);
......
......@@ -587,6 +587,29 @@ sub SliverAction($$$$$)
# For now, only allow top level aggregate or the slice
#
my ($slice, $aggregate) = Credential2SliceAggregate($credential);
if ( (!defined($slice)) &&
($credential->target_urn() =~ /\+authority\+cm$/)) {
# administrative credentials are presented.
my $cm_urn = GeniHRN::Generate($OURDOMAIN, "authority", "cm");
if ($cm_urn != $credential->target_urn()) {
return GeniResponse->Create(GENIRESPONSE_FORBIDDEN(), undef,
"Credential target does not match CM URN");
}
if (!defined($slice_urn)) {
return GeniResponse->MalformedArgsResponse("Missing arguments");
}
$slice = GeniSlice->Lookup($slice_urn);
return GeniResponse->Create(GENIRESPONSE_ERROR, undef,
"No Slice with urn $slice_urn here")
if (!defined($slice));
$aggregate = GeniAggregate->SliceAggregate($slice);
return GeniResponse->Create(GENIRESPONSE_ERROR, undef,
"No Aggregate here")
if (!defined($aggregate));
}
if (! (defined($slice) && defined($aggregate))) {
return GeniResponse->Create(GENIRESPONSE_BADARGS, undef,
"No slice or aggregate here");
......@@ -680,7 +703,7 @@ sub SliverAction($$$$$)
goto bad
if (GeniResponse::IsResponse($response));
if ($action eq "start") {
if ($action eq "start" || $action eq "restart") {
GeniCM::UpdateManifest($slice);
}
$slice->UnLock();
......
......@@ -378,8 +378,6 @@ sub LookupBySlice($$)
my $sliver = GeniRegistry::ClientSliver->Lookup($idx);
if (defined($sliver)) {
push(@result, $sliver);
} else {
return undef;
}
}
}
......
......@@ -328,10 +328,6 @@ sub Resolve($)
return GeniResponse->BusyResponse("slice");
}
my @slivers = GeniRegistry::ClientSliver->LookupBySlice($slice);
if (! @slivers) {
return GeniResponse->Create(GENIRESPONSE_ERROR, undef,
"Failed to lookup sliver entries");
}
my @managers = ();
foreach my $sliver (@slivers) {
push(@managers, $sliver->manager_urn());
......
......@@ -64,7 +64,7 @@ sub CreateSpecialCredential
my $numArgs = $#ARGV + 1;
if($numArgs !=2) {
print "Please specify <user-urn> <cm-urn> as command lien arguments\n\n";
print "Please specify <user-urn> <ch-urn> as command line arguments\n\n";
}else{
my $val = CreateSpecialCredential @ARGV;
print STDERR $val->{"code"};
......
......@@ -53,23 +53,28 @@ print "Got my SA credential. Looking for slice ..."
myslice = resolve_slice( SLICENAME, mycredential )
print "Found the slice, asking for a credential ..."
#
# Get the slice credential.
#
slicecred = get_slice_credential( myslice, mycredential )
print "Got the slice credential, asking for a sliver credential ..."
if admincredentialfile:
f = open( admincredentialfile )
slivercred = f.read()
f.close()
else:
#
# Get the slice credential.
#
slicecred = get_slice_credential( myslice, mycredential )
print "Got the slice credential, asking for a sliver credential ..."
#
# Get the sliver credential.
#
params = {}
params["credentials"] = (slicecred,)
params["slice_urn"] = SLICEURN
rval,response = do_method("cm", "GetSliver", params, version="2.0")
if rval:
#
# Get the sliver credential.
#
params = {}
params["credentials"] = (slicecred,)
params["slice_urn"] = SLICEURN
rval,response = do_method("cm", "GetSliver", params, version="2.0")
if rval:
Fatal("Could not get Sliver credential")
pass
slivercred = response["value"]
slivercred = response["value"]
if action == "start":
method = "StartSliver"
......
......@@ -40,6 +40,7 @@ DELETE = 0
selfcredentialfile = None
slicecredentialfile = None
admincredentialfile = None
if "Usage" not in dir():
def Usage():
......@@ -61,14 +62,14 @@ if "Usage" not in dir():
[default: ~/.ssl/password]
-r file, --read-commands=file specify additional configuration file
-s file, --slicecredentials=file read slice credentials from file
[default: query from SA]"""
[default: query from SA]
-a file, --admincredentials=file read admin credentials from file"""
try:
opts, REQARGS = getopt.getopt( sys.argv[ 1: ], "c:df:hn:p:r:s:m:",
opts, REQARGS = getopt.getopt( sys.argv[ 1: ], "c:df:hn:p:r:s:m:a:",
[ "credentials=", "debug", "certificate=",
"help", "passphrase=", "read-commands=",
"slicecredentials=", "slicename=",
"cm=", "delete"] )
"slicecredentials=","admincredentials", "slicename=", "cm=", "delete"] )
except getopt.GetoptError, err:
print >> sys.stderr, str( err )
Usage()
......@@ -109,6 +110,8 @@ for opt, arg in opts:
EXTRACONF = arg
elif opt in ( "-s", "--slicecredentials" ):
slicecredentialfile = arg
elif opt in ( "-a", "--admincredentials" ):
admincredentialfile = arg
cert = X509.load_cert( CERTIFICATE )
......
......@@ -1078,43 +1078,69 @@ class Experiment
echo " </td>
</tr>\n";
}
if (!$short && ISADMIN()) {
if (!$short) {
if ($this->geniflags()) {
$slice = GeniSlice::Lookup("geni-cm", $uuid);
if ($slice) {
$slice_hrn = $slice->hrn();
$url = CreateURL("showslice", "slice_idx", $slice->idx(),
"showtype", "cm");
if (ISADMIN()) {
$url = CreateURL("showslice", "slice_idx",
$slice->idx(), "showtype", "cm");
echo "<tr>
<td>Geni Slice (CM): </td>
<td class=\"left\"><a href='$url'>$slice_hrn</a></td>
</tr>\n";
echo "<tr>
<td>Geni Slice (CM): </td>
<td class=\"left\">
<a href='$url'>$slice_hrn</a></td>
</tr>\n";
}
else {
echo "<tr>
<td>Geni Slice (CM): </td>
<td class=\"left\">$slice_hrn</td>
</tr>\n";
}
}
}
else {
$slice = GeniSlice::LookupByExperiment("geni-sa", $this);
if ($slice) {
$slice_hrn = $slice->hrn();
$url = CreateURL("showslice", "slice_idx", $slice->idx(),
"showtype", "sa");
echo "<tr>
<td>Geni Slice (SA): </td>
<td class=\"left\"><a href='$url'>$slice_hrn</a></td>
</tr>\n";
$slice = GeniSlice::Lookup("geni-cm", $slice_hrn);
if ($slice) {
$url = CreateURL("showslice", "slice_idx", $slice->idx(),
"showtype", "cm");
if (ISADMIN()) {
$url = CreateURL("showslice", "slice_idx",
$slice->idx(), "showtype", "sa");
echo "<tr>
<td>Geni Slice (CM): </td>
<td class=\"left\"><a href='$url'>$slice_hrn</a></td>
<td>Geni Slice (SA): </td>
<td class=\"left\">
<a href='$url'>$slice_hrn</a></td>
</tr>\n";
}
else {
echo "<tr>
<td>Geni Slice (SA): </td>
<td class=\"left\">$slice_hrn</td>
</tr>\n";
}
$slice = GeniSlice::Lookup("geni-cm", $slice_hrn);
if ($slice) {
if (ISADMIN()) {
$url = CreateURL("showslice", "slice_idx",
$slice->idx(), "showtype", "cm");
echo "<tr>
<td>Geni Slice (CM): </td>
<td class=\"left\">
<a href='$url'>$slice_hrn</a></td>
</tr>\n";
}
else {
echo "<tr>
<td>Geni Slice (SA): </td>
<td class=\"left\">$slice_hrn</td>
</tr>\n";
}
}
}
}
}
......
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