git://git.onelab.eu
/
sfa.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix broken sfi config
[sfa.git]
/
sfa
/
managers
/
aggregate_manager.py
diff --git
a/sfa/managers/aggregate_manager.py
b/sfa/managers/aggregate_manager.py
index
cb8b2a6
..
8b73644
100644
(file)
--- a/
sfa/managers/aggregate_manager.py
+++ b/
sfa/managers/aggregate_manager.py
@@
-5,6
+5,7
@@
from sfa.util.xrn import Xrn
from sfa.util.callids import Callids
from sfa.util.sfalogging import logger
from sfa.util.faults import SfaInvalidArgument, InvalidRSpecVersion
from sfa.util.callids import Callids
from sfa.util.sfalogging import logger
from sfa.util.faults import SfaInvalidArgument, InvalidRSpecVersion
+from sfa.server.api_versions import ApiVersions
class AggregateManager:
class AggregateManager:
@@
-28,7
+29,8
@@
class AggregateManager:
'geni_ad_rspec_versions': ad_rspec_versions,
}
'geni_ad_rspec_versions': ad_rspec_versions,
}
- def get_rspec_version_string(self, rspec_version, options={}):
+ def get_rspec_version_string(self, rspec_version, options=None):
+ if options is None: options={}
version_string = "rspec_%s" % (rspec_version)
#panos adding the info option to the caching key (can be improved)
version_string = "rspec_%s" % (rspec_version)
#panos adding the info option to the caching key (can be improved)
@@
-46,23
+48,27
@@
class AggregateManager:
return version_string
def GetVersion(self, api, options):
return version_string
def GetVersion(self, api, options):
- xrn=Xrn(api.hrn, type='authority')
+ xrn=Xrn(api.hrn, type='authority
+am
')
version = version_core()
cred_types = [{'geni_type': 'geni_sfa', 'geni_version': str(i)} for i in range(4)[-2:]]
version = version_core()
cred_types = [{'geni_type': 'geni_sfa', 'geni_version': str(i)} for i in range(4)[-2:]]
+ geni_api_versions = ApiVersions().get_versions()
+ geni_api_versions['3'] = 'http://%s:%s' % (api.config.sfa_aggregate_host, api.config.sfa_aggregate_port)
version_generic = {
version_generic = {
- 'testbed':
self
.driver.testbed_name(),
+ 'testbed':
api
.driver.testbed_name(),
'interface':'aggregate',
'interface':'aggregate',
+ 'sfa': 3,
'hrn':xrn.get_hrn(),
'urn':xrn.get_urn(),
'geni_api': 3,
'hrn':xrn.get_hrn(),
'urn':xrn.get_urn(),
'geni_api': 3,
- 'geni_api_versions':
{'3': 'http://%s:%s' % (socket.gethostname(), api.config.sfa_aggregate_port)}
,
+ 'geni_api_versions':
geni_api_versions
,
'geni_single_allocation': 0, # Accept operations that act on as subset of slivers in a given state.
'geni_allocate': 'geni_many',# Multiple slivers can exist and be incrementally added, including those which connect or overlap in some way.
'geni_credential_types': cred_types,
'geni_single_allocation': 0, # Accept operations that act on as subset of slivers in a given state.
'geni_allocate': 'geni_many',# Multiple slivers can exist and be incrementally added, including those which connect or overlap in some way.
'geni_credential_types': cred_types,
+ 'geni_handles_speaksfor': True, # supports 'speaks for' credentials
}
version.update(version_generic)
version.update(self.rspec_versions())
}
version.update(version_generic)
version.update(self.rspec_versions())
- testbed_version =
self
.driver.aggregate_version()
+ testbed_version =
api
.driver.aggregate_version()
version.update(testbed_version)
return version
version.update(testbed_version)
return version
@@
-77,16
+83,16
@@
class AggregateManager:
# look in cache first
cached_requested = options.get('cached', True)
# look in cache first
cached_requested = options.get('cached', True)
- if cached_requested and
self
.driver.cache:
- rspec =
self
.driver.cache.get(version_string)
+ if cached_requested and
api
.driver.cache:
+ rspec =
api
.driver.cache.get(version_string)
if rspec:
if rspec:
- logger.debug("%s.ListResources returning cached advertisement" % (
self
.driver.__module__))
+ logger.debug("%s.ListResources returning cached advertisement" % (
api
.driver.__module__))
return rspec
return rspec
- rspec =
self
.driver.list_resources (rspec_version, options)
- if
self
.driver.cache:
- logger.debug("%s.ListResources stores advertisement in cache" % (
self
.driver.__module__))
-
self
.driver.cache.add(version_string, rspec)
+ rspec =
api
.driver.list_resources (rspec_version, options)
+ if
api
.driver.cache:
+ logger.debug("%s.ListResources stores advertisement in cache" % (
api
.driver.__module__))
+
api
.driver.cache.add(version_string, rspec)
return rspec
def Describe(self, api, creds, urns, options):
return rspec
def Describe(self, api, creds, urns, options):
@@
-95,13
+101,13
@@
class AggregateManager:
version_manager = VersionManager()
rspec_version = version_manager.get_version(options.get('geni_rspec_version'))
version_manager = VersionManager()
rspec_version = version_manager.get_version(options.get('geni_rspec_version'))
- return
self
.driver.describe(urns, rspec_version, options)
+ return
api
.driver.describe(urns, rspec_version, options)
def Status (self, api, urns, creds, options):
call_id = options.get('call_id')
if Callids().already_handled(call_id): return {}
def Status (self, api, urns, creds, options):
call_id = options.get('call_id')
if Callids().already_handled(call_id): return {}
- return
self
.driver.status (urns, options=options)
+ return
api
.driver.status (urns, options=options)
def Allocate(self, api, xrn, creds, rspec_string, expiration, options):
def Allocate(self, api, xrn, creds, rspec_string, expiration, options):
@@
-111,7
+117,7
@@
class AggregateManager:
"""
call_id = options.get('call_id')
if Callids().already_handled(call_id): return ""
"""
call_id = options.get('call_id')
if Callids().already_handled(call_id): return ""
- return
self
.driver.allocate(xrn, rspec_string, expiration, options)
+ return
api
.driver.allocate(xrn, rspec_string, expiration, options)
def Provision(self, api, xrns, creds, options):
"""
def Provision(self, api, xrns, creds, options):
"""
@@
-131,25
+137,28
@@
class AggregateManager:
if not rspec_version:
raise InvalidRSpecVersion(options['geni_rspec_version'])
if not rspec_version:
raise InvalidRSpecVersion(options['geni_rspec_version'])
- return
self
.driver.provision(xrns, options)
+ return
api
.driver.provision(xrns, options)
def Delete(self, api, xrns, creds, options):
call_id = options.get('call_id')
if Callids().already_handled(call_id): return True
def Delete(self, api, xrns, creds, options):
call_id = options.get('call_id')
if Callids().already_handled(call_id): return True
- return
self
.driver.delete(xrns, options)
+ return
api
.driver.delete(xrns, options)
def Renew(self, api, xrns, creds, expiration_time, options):
call_id = options.get('call_id')
if Callids().already_handled(call_id): return True
def Renew(self, api, xrns, creds, expiration_time, options):
call_id = options.get('call_id')
if Callids().already_handled(call_id): return True
- return self.driver.renew(xrns, expiration_time, options)
- def PerformOperationalAction(self, api, xrns, creds, action, options={}):
+ return api.driver.renew(xrns, expiration_time, options)
+
+ def PerformOperationalAction(self, api, xrns, creds, action, options=None):
+ if options is None: options={}
call_id = options.get('call_id')
if Callids().already_handled(call_id): return True
call_id = options.get('call_id')
if Callids().already_handled(call_id): return True
- return
self
.driver.perform_operational_action(xrns, action, options)
+ return
api
.driver.perform_operational_action(xrns, action, options)
- def Shutdown(self, api, xrn, creds, options={}):
+ def Shutdown(self, api, xrn, creds, options=None):
+ if options is None: options={}
call_id = options.get('call_id')
if Callids().already_handled(call_id): return True
call_id = options.get('call_id')
if Callids().already_handled(call_id): return True
- return
self
.driver.shutdown(xrn, options)
+ return
api
.driver.shutdown(xrn, options)