Commit 639c27b7 authored by Leigh Stoller's avatar Leigh Stoller

Add toplevel site_info element to both advertisements and manifests:

  <rs:site_info
      xmlns:rs="http://www.protogeni.net/resources/rspec/ext/site-info/1">
    <rs:location
        country="US" latitude="40.768652" longitude="-111.84581"/>
  </rs:site_info>

Eventually replace per-node info if its just duplicate, but for now leave
the old location in place.
parent 22fe1c8c
#!/usr/bin/perl -wT
#
# Copyright (c) 2008-2014 University of Utah and the Flux Group.
# Copyright (c) 2008-2015 University of Utah and the Flux Group.
#
# {{{GENIPUBLIC-LICENSE
#
......@@ -45,6 +45,7 @@ use GeniCMV2;
use GeniResponse;
use GeniCredential;
use GeniRegistry;
use GeniXML;
use emutil;
use Compress::Zlib;
......@@ -152,14 +153,14 @@ sub GetVersion()
"version" => $coder->string("2"),
"schema" => "http://www.protogeni.net/resources/rspec/2/request.xsd",
"namespace" => "http://www.protogeni.net/resources/rspec/2",
"extensions" => ["http://www.protogeni.net/resources/rspec/ext/emulab/1"]
"extensions" => [$GeniXML::EMULAB_NS],
};
my $request_3 = {
"type" => "GENI",
"version" => $coder->string("3"),
"schema" => "http://www.geni.net/resources/rspec/3/request.xsd",
"namespace" => "http://www.geni.net/resources/rspec/3",
"extensions" => ["http://www.protogeni.net/resources/rspec/ext/emulab/1"]
"extensions" => [$GeniXML::EMULAB_NS],
};
my $ad_0_1 = {
"type" => "ProtoGENI",
......@@ -180,14 +181,14 @@ sub GetVersion()
"version" => $coder->string("2"),
"schema" => "http://www.protogeni.net/resources/rspec/2/ad.xsd",
"namespace" => "http://www.protogeni.net/resources/rspec/2",
"extensions" => ["http://www.protogeni.net/resources/rspec/ext/emulab/1"]
"extensions" => [$GeniXML::EMULAB_NS, $GeniXML::SITEINFO_NS],
};
my $ad_3 = {
"type" => "GENI",
"version" => $coder->string("3"),
"schema" => "http://www.geni.net/resources/rspec/3/ad.xsd",
"namespace" => "http://www.geni.net/resources/rspec/3",
"extensions" => ["http://www.protogeni.net/resources/rspec/ext/emulab/1"]
"extensions" => [$GeniXML::EMULAB_NS, $GeniXML::SITEINFO_NS],
};
my $request_name = "request_rspec_versions";
......@@ -416,6 +417,12 @@ sub DeleteSliver()
'slice_urn' => $slice_urn,
'credentials' => $credentials
};
# Optional blocking.
if (defined($options) &&
exists($options->{'blocking'}) && $options->{'blocking'}) {
$delete_args->{'blocking'} = 1;
}
my $response = GeniCMV2::DeleteSlice($delete_args);
if (!ref($response)) {
# This is cause GeniCMV2::DeleteSlice does a fork, and the child
......
......@@ -125,6 +125,11 @@ my $FWNAME = "fw";
my $API_VERSION = 1;
my $PROTOGENI_LOCALUSER= @PROTOGENI_LOCALUSER@;
# For location info.
my $default_longitude = undef;
my $default_latitude = undef;
my $default_country = undef;
#
# Tell the client what API revision we support. The correspondence
# between revision numbers and API features is to be specified elsewhere.
......@@ -3717,7 +3722,8 @@ sub SliverWorkAux($$$$$$$$)
$tunnel = $linkmap{$linkname};
}
else {
$tunnel = GeniAggregate::Tunnel->Create($slice,
$tunnel = GeniAggregate::Tunnel->Create(\$message,
$slice,
$owner,
$node1sliver,
$node2sliver,
......@@ -3725,7 +3731,8 @@ sub SliverWorkAux($$$$$$$$)
$node1rspec,
$node2rspec);
if (!defined($tunnel)) {
$message = "Could not create aggregate for $linkname";
$message = "Could not create aggregate for $linkname" .
(defined($message) ? ": $message" : "");
goto bad;
}
$slivers{$tunnel->uuid()} = $tunnel;
......@@ -4141,6 +4148,27 @@ sub SliverWorkAux($$$$$$$$)
goto bad;
}
my $siteinfo = GeniXML::FindFirst("n:site_info", $manifest);
if (defined($siteinfo)) {
# Clean old location.
$manifest->removeChild($siteinfo);
}
$siteinfo = GeniXML::AddElement("site_info", $manifest,
$GeniXML::SITEINFO_NS);
my $location = GeniXML::AddElement("location", $siteinfo);
GetSiteVar('general/default_longitude', \$default_longitude)
if (!defined($default_longitude));
GetSiteVar('general/default_latitude', \$default_latitude)
if (!defined($default_latitude));
GetSiteVar('general/default_country', \$default_country)
if (!defined($default_country));
if (defined($default_country) &&
defined($default_latitude) && defined($default_longitude)) {
GeniXML::SetText("country", $location, $default_country);
GeniXML::SetText("latitude", $location, $default_latitude);
GeniXML::SetText("longitude", $location, $default_longitude);
}
#
# Record all manifests (including updates) in the history.
#
......
#!/usr/bin/perl -w
#
# Copyright (c) 2010-2014 University of Utah and the Flux Group.
# Copyright (c) 2010-2015 University of Utah and the Flux Group.
#
# {{{GENIPUBLIC-LICENSE
#
......@@ -58,7 +58,7 @@ use Scalar::Util qw(looks_like_number);
use vars qw($RSPEC_0_1 $RSPEC_0_2 $RSPEC_2 $RSPEC_3
$RSPEC_0_1_NS $RSPEC_0_2_NS $RSPEC_2_NS
$EMULAB_NS $XSI_NS $STITCH_NS $SHAREDVLAN_NS
$EMULAB_NS $XSI_NS $STITCH_NS $SHAREDVLAN_NS $SITEINFO_NS
$REQUEST_2_URL $MANIFEST_2_URL
$REQUEST_3_URL $MANIFEST_3_URL);
$RSPEC_0_1 = "0.1";
......@@ -71,6 +71,7 @@ our $RSPEC_0_2_NS = "http://www.protogeni.net/resources/rspec/0.2";
our $RSPEC_2_NS = "http://www.protogeni.net/resources/rspec/2";
our $RSPEC_3_NS = "http://www.geni.net/resources/rspec/3";
our $EMULAB_NS = "http://www.protogeni.net/resources/rspec/ext/emulab/1";
our $SITEINFO_NS = "http://www.protogeni.net/resources/rspec/ext/site-info/1";
our $XSI_NS = "http://www.w3.org/2001/XMLSchema-instance";
our $STITCH_NS = "http://hpn.east.isi.edu/rspec/ext/stitch/0.1/";
our $SHAREDVLAN_NS = "http://www.geni.net/resources/rspec/ext/shared-vlan/1";
......
#!/usr/bin/perl -w
#
# Copyright (c) 2000-2014 University of Utah and the Flux Group.
# Copyright (c) 2000-2015 University of Utah and the Flux Group.
#
# {{{EMULAB-LICENSE
#
......@@ -2299,6 +2299,11 @@ sub print_header {
"configured='$configured' available='$available' />\n";
}
print $opstate . "\n";
print "<site_info xmlns='http://www.protogeni.net/resources".
"/rspec/ext/site-info/1'>\n";
print "<location country='$default_country' ".
"longitude='$default_long' latitude='$default_lat'/>\n";
print "</site_info>\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