-import soctet
+import socket
from sfa.rspecs.version_manager import VersionManager
from sfa.util.version import version_core
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
+
class AggregateManager:
# essentially a union of the core version, the generic version (this code) and
# whatever the driver needs to expose
- def _rspec_versions(self):
+ def rspec_versions(self):
version_manager = VersionManager()
ad_rspec_versions = []
request_rspec_versions = []
if rspec_version.content_type in ['*', 'request']:
request_rspec_versions.append(rspec_version.to_dict())
return {
- 'testbed':self.testbed_name(),
'geni_request_rspec_versions': request_rspec_versions,
'geni_ad_rspec_versions': ad_rspec_versions,
}
return version_string
def GetVersion(self, api, options):
- xrn=Xrn(api.hrn)
+ xrn=Xrn(api.hrn, type='authority')
version = version_core()
+ cred_types = [{'geni_type': 'geni_sfa', 'geni_version': str(i)} for i in range(4)[-2:]]
version_generic = {
'testbed': self.driver.testbed_name(),
'interface':'aggregate',
'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_best_effort': 'true',
- 'geni_credential_types': [{
- 'geni_type': 'geni_sfa',
- 'geni_version': 3,
- }],
+ 'geni_credential_types': cred_types,
}
version.update(version_generic)
+ version.update(self.rspec_versions())
testbed_version = self.driver.aggregate_version()
version.update(testbed_version)
return version
# look in cache first
cached_requested = options.get('cached', True)
- if cached_requested and self.driver.cache and not slice_hrn:
+ if cached_requested and self.driver.cache:
rspec = self.driver.cache.get(version_string)
if rspec:
logger.debug("%s.ListResources returning cached advertisement" % (self.driver.__module__))
return rspec
- rspec = self.driver.list_resources (version, options)
+ 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)
"""
call_id = options.get('call_id')
if Callids().already_handled(call_id): return ""
+
+ # make sure geni_rspec_version is specified in options
+ if 'geni_rspec_version' not in options:
+ msg = 'geni_rspec_version is required and must be set in options struct'
+ raise SfaInvalidArgument(msg, 'geni_rspec_version')
+ # make sure we support the requested rspec version
+ version_manager = VersionManager()
+ rspec_version = version_manager.get_version(options['geni_rspec_version'])
+ if not rspec_version:
+ raise InvalidRSpecVersion(options['geni_rspec_version'])
+
return self.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
- return self.driver.delete_sliver (xrns, options)
+ return self.driver.delete(xrns, options)
def Renew(self, api, xrns, creds, expiration_time, options):
call_id = options.get('call_id')
def PerformOperationalAction(self, api, xrns, creds, action, options={}):
call_id = options.get('call_id')
if Callids().already_handled(call_id): return True
- return self.driver.performOperationalAction(xrns, action, options)
+ return self.driver.perform_operational_action(xrns, action, options)
def Shutdown(self, api, xrn, creds, options={}):
call_id = options.get('call_id')