+import socket
+import datetime
from sfa.util.version import version_core
-from sfa.util.xrn import Xrn
+from sfa.util.xrn import Xrni
+from sfa.util.sfatime import utcpase, adjust_datetime
from sfa.util.callids import Callids
+from sfa.server.api_versions import ApiVersions
class AggregateManager:
# essentially a union of the core version, the generic version (this code) and
# whatever the driver needs to expose
def GetVersion(self, api, options):
-
- xrn=Xrn(api.hrn)
+ xrn=Xrn(api.hrn, type='authority+am')
version = version_core()
+ geni_api_versions = ApiVersions().get_versions()
+ geni_api_versions['2'] = 'http://%s:%s' % (api.config.SFA_AGGREGATE_HOST, api.config.SFA_AGGREGATE_PORT)
version_generic = {
'interface':'aggregate',
'sfa': 2,
'geni_api': 2,
- 'geni_api_versions': {'2': 'http://%s:%s' % (api.config.SFA_AGGREGATE_HOST, api.config.SFA_AGGREGATE_PORT)},
+ 'geni_api_versions': geni_api_versions,
'hrn':xrn.get_hrn(),
'urn':xrn.get_urn(),
+ 'geni_handles_speaksfor': True, # supports 'speaks for' credentials
}
version.update(version_generic)
testbed_version = self.driver.aggregate_version()
xrn = Xrn(slice_xrn)
slice_urn=xrn.get_urn()
slice_hrn=xrn.get_hrn()
-
return self.driver.list_resources (slice_urn, slice_hrn, creds, options)
def SliverStatus (self, api, xrn, creds, options):
call_id = options.get('call_id')
if Callids().already_handled(call_id): return {}
- xrn = Xrn(xrn)
+ xrn = Xrn(xrn,'slice')
slice_urn=xrn.get_urn()
slice_hrn=xrn.get_hrn()
return self.driver.sliver_status (slice_urn, slice_hrn)
call_id = options.get('call_id')
if Callids().already_handled(call_id): return ""
- xrn = Xrn(xrn)
+ xrn = Xrn(xrn, 'slice')
slice_urn=xrn.get_urn()
slice_hrn=xrn.get_hrn()
call_id = options.get('call_id')
if Callids().already_handled(call_id): return True
- xrn = Xrn(xrn)
+ xrn = Xrn(xrn, 'slice')
slice_urn=xrn.get_urn()
slice_hrn=xrn.get_hrn()
return self.driver.delete_sliver (slice_urn, slice_hrn, creds, options)
call_id = options.get('call_id')
if Callids().already_handled(call_id): return True
- xrn = Xrn(xrn)
+ xrn = Xrn(xrn, 'slice')
slice_urn=xrn.get_urn()
slice_hrn=xrn.get_hrn()
+
+ if options.get('geni_extend_alap'):
+ now = datetime.datetime.now()
+ requested = utcparse(expiration_time)
+ max = adjust_datetime(now, days=30)
+ if requested > max:
+ expiration_time = max
+
return self.driver.renew_sliver (slice_urn, slice_hrn, creds, expiration_time, options)
### these methods could use an options extension for at least call_id
slice_urn=xrn.get_urn()
slice_hrn=xrn.get_hrn()
+ # xxx sounds like GetTicket is dead, but if that gets resurrected we might wish
+ # to pass 'users' over to the driver as well
return self.driver.get_ticket (slice_urn, slice_hrn, creds, rspec, options)