Commit fead0db4 authored by Leigh B. Stoller's avatar Leigh B. Stoller

Crude first cut at slice update. This is way harder then I thought.

Lots of corner cases that I am ignoring and recovery from errors is
just as crude. See xmlrpc/client.py ...
parent 1e4039cb
......@@ -7,7 +7,7 @@
package GeniAggregate;
#
# Some simple ticket stuff.
# Some simple aggregate stuff.
#
use strict;
use Exporter;
......@@ -125,9 +125,9 @@ sub Stringify($)
# for now. The client side does not actually know its an aggregate, at
# least not yet.
#
sub Create($$$$)
sub Create($$$$$)
{
my ($class, $ticket, $aggregate_type, $hrn) = @_;
my ($class, $slice, $owner, $aggregate_type, $hrn) = @_;
my @insert_data = ();
# Every aggregate gets a new unique index.
......@@ -140,8 +140,8 @@ sub Create($$$$)
return undef;
}
my $uuid = $certificate->uuid();
my $slice_uuid = $ticket->slice_uuid();
my $owner_uuid = $ticket->owner_uuid();
my $slice_uuid = $slice->uuid();
my $owner_uuid = $owner->uuid();
# Now tack on other stuff we need.
push(@insert_data, "created=now()");
......@@ -170,7 +170,6 @@ sub slice_uuid($) { return field($_[0], "slice_uuid"); }
sub creator_uuid($) { return field($_[0], "creator_uuid"); }
sub created($) { return field($_[0], "created"); }
sub credential_idx($) { return field($_[0], "credential_idx"); }
sub ticket_idx($) { return field($_[0], "ticket_idx"); }
sub aggregate_idx($) { return field($_[0], "aggregate_idx"); }
sub status($) { return field($_[0], "status"); }
sub cert($) { return $_[0]->{'CERTIFICATE'}->cert(); }
......@@ -360,6 +359,24 @@ sub GetAggregate($)
return $aggregate;
}
#
# Is object in the aggregate.
#
sub IsMember($$)
{
my ($self, $object) = @_;
return -1
if (! (ref($self) && ref($object)));
my $aggregate = $object->GetAggregate();
return 0
if (!$aggregate);
return -1
if ($self->idx() != $aggregate->idx());
return 1;
}
#
# Set the status for the aggregate
#
......@@ -540,9 +557,9 @@ use Interface;
sub Create($$$)
{
my ($class, $ticket, $hrn) = @_;
my ($class, $slice, $owner, $hrn) = @_;
return GeniAggregate->Create($ticket, "Link", $hrn);
return GeniAggregate->Create($slice, $owner, "Link", $hrn);
}
#
......
This diff is collapsed.
......@@ -135,6 +135,7 @@ sub target($) { return field($_[0], "target"); }
sub owner($) { return field($_[0], "owner"); }
sub this_uuid($) { return field($_[0], "target_uuid"); }
sub target_uuid($) { return field($_[0], "target_uuid"); }
sub slice_uuid($) { return field($_[0], "target_uuid"); }
sub target_cert($) { return field($_[0], "target_cert"); }
sub owner_uuid($) { return field($_[0], "owner_uuid"); }
sub asString($) { return field($_[0], "string"); }
......
......@@ -128,6 +128,7 @@ sub seqno($) { return field($_[0], "seqno"); }
sub rspec($) { return field($_[0], "rspec"); }
sub uuid($) { return field($_[0], "slice_uuid"); }
sub slice_uuid($) { return field($_[0], "slice_uuid"); }
sub target_uuid($) { return field($_[0], "slice_uuid"); }
sub owner_uuid($) { return field($_[0], "owner_uuid"); }
sub slice_cert($) { return field($_[0], "slice_cert"); }
sub owner_cert($) { return field($_[0], "owner_cert"); }
......
......@@ -123,7 +123,6 @@ if rval:
mycredential = response["value"]
print "Got my SA credential"
#print str(mycredential);
#sys.exit(0);
#
# Look me up just for the hell of it. I can see why the hrn is "useful"
......@@ -153,6 +152,7 @@ if rval:
pass
print "Found leebee's record at the SA"
leebee = response["value"]
#print str(leebee);
#
# Lookup a node at the component.
......@@ -228,24 +228,12 @@ print "Bogus DiscoverResources returned"
#
# Okay, we do not actually have anything like resource discovery yet,
# so lets fake it.
#
rspec = "<rspec xmlns=\"http://protogeni.net/resources/rspec/0.1\"> " +\
" <node uuid=\"de9803c2-773e-102b-8eb4-001143e453fe\" " +\
" hrn=\"geni1\" "+\
" virtualization_type=\"emulab-vnode\"> " +\
" </node>" +\
" <node uuid=\"de995217-773e-102b-8eb4-001143e453fe\" " +\
" virtualization_type=\"emulab-vnode\"> " +\
" </node>" +\
" <link name=\"link0\" link_name=\"link0\"> " +\
" <LinkEndPoints name=\"destination_interface\" " +\
" iface_name=\"eth0\" " +\
" node_uuid=\"de9803c2-773e-102b-8eb4-001143e453fe\" /> " +\
" <LinkEndPoints name=\"source_interface\" " +\
" iface_name=\"eth0\" " +\
" node_uuid=\"de995217-773e-102b-8eb4-001143e453fe\" /> " +\
" </link> " +\
"</rspec>"
params = {}
params["credential"] = myslice
......@@ -273,7 +261,38 @@ if rval:
pass
sliver = response["value"]
print "Created a sliver"
print str(sliver)
#print str(sliver)
#
# Add resources to the sliver.
#
rspec = "<rspec xmlns=\"http://protogeni.net/resources/rspec/0.1\"> " +\
" <node uuid=\"de9803c2-773e-102b-8eb4-001143e453fe\" " +\
" hrn=\"geni1\" "+\
" virtualization_type=\"emulab-vnode\"> " +\
" </node>" +\
" <node uuid=\"de995217-773e-102b-8eb4-001143e453fe\" " +\
" virtualization_type=\"emulab-vnode\"> " +\
" </node>" +\
" <link name=\"link0\" link_name=\"link0\"> " +\
" <LinkEndPoints name=\"destination_interface\" " +\
" iface_name=\"eth0\" " +\
" node_uuid=\"de9803c2-773e-102b-8eb4-001143e453fe\" /> " +\
" <LinkEndPoints name=\"source_interface\" " +\
" iface_name=\"eth0\" " +\
" node_uuid=\"de995217-773e-102b-8eb4-001143e453fe\" /> " +\
" </link> " +\
"</rspec>"
params = {}
params["credential"] = sliver
params["rspec"] = rspec
params["impotent"] = impotent
rval,response = do_method("cm", "UpdateSliver", params,
URI="https://myboss.myelab.testbed.emulab.net:443/protogeni/xmlrpc")
if rval:
Fatal("Could not update sliver with new rspec")
pass
print "Added resources to sliver."
#
# Split the sliver since its an aggregate of resources
......@@ -286,7 +305,7 @@ if rval:
Fatal("Could not split sliver")
pass
slivers = response["value"]
print "Split a sliver"
print "Split the sliver"
print str(slivers)
#
......
......@@ -107,8 +107,10 @@ if (!defined($request)) {
#
LogStart(0);
#print STDERR time() . "\n";
# Add stuff for log message if sent.
AddAuditInfo("message", $request . "\n\n" . Dumper(%ENV));
AddAuditInfo("message", $request . "\n");
my $responder = Frontier::Responder->new( "methods" => {
"GetCredential" => \&GeniCH::GetCredential,
......@@ -128,7 +130,8 @@ my $response = $responder->{'_decode'}->serve($request,
# Terminate the log capture so that we can print the response to STDOUT
# for the web server.
#
print STDERR "\n\n" . $response;
#print STDERR "\n\n" . $response;
#print STDERR time() . "\n";
LogEnd();
......
......@@ -113,7 +113,7 @@ LogStart(0);
Genixmlrpc->SetContext(Genixmlrpc->Context($EMULAB_PEMFILE));
# Add stuff for log message if sent.
AddAuditInfo("message", $request . "\n\n" . Dumper(%ENV));
AddAuditInfo("message", $request . "\n");
my $responder = Frontier::Responder->new( "methods" => {
"Resolve" => \&GeniCM::Resolve,
......@@ -125,6 +125,7 @@ my $responder = Frontier::Responder->new( "methods" => {
"DeleteSliver" => \&GeniCM::DeleteSliver,
"DeleteSlice" => \&GeniCM::DeleteSlice,
"SplitSliver" => \&GeniCM::SplitSliver,
"UpdateSliver" => \&GeniCM::UpdateSliver,
},
);
......@@ -135,7 +136,7 @@ my $response = $responder->{'_decode'}->serve($request,
# Terminate the log capture so that we can print the response to STDOUT
# for the web server.
#
print STDERR "\n\n" . $response;
#print STDERR "\n\n" . $response;
LogEnd();
......
......@@ -112,8 +112,10 @@ LogStart(0);
#
Genixmlrpc->SetContext(Genixmlrpc->Context($EMULAB_PEMFILE));
#print STDERR time() . "\n";
# Add stuff for log message if sent.
AddAuditInfo("message", $request . "\n\n" . Dumper(%ENV));
AddAuditInfo("message", $request . "\n");
my $responder = Frontier::Responder->new( "methods" => {
"GetCredential" => \&GeniSA::GetCredential,
......@@ -132,6 +134,7 @@ my $response = $responder->{'_decode'}->serve($request,
# for the web server.
#
#print STDERR "\n\n" . $response;
#print STDERR time() . "\n";
LogEnd();
......
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