X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Fmanagers%2Faggregate_manager.py;h=0b97c63877b2a8c382cabeeaa400eb60945e4711;hb=8bf2388afc7410f17bc0c2b716aef89b3e52ab94;hp=f8948fd3b6d6a9f297b3fdd6e3bc137b2359939f;hpb=c15c2b3202c7a796dc3bd583996b2d7ebb8995af;p=sfa.git diff --git a/sfa/managers/aggregate_manager.py b/sfa/managers/aggregate_manager.py index f8948fd3..0b97c638 100644 --- a/sfa/managers/aggregate_manager.py +++ b/sfa/managers/aggregate_manager.py @@ -1,4 +1,4 @@ -import soctet +import socket from sfa.rspecs.version_manager import VersionManager from sfa.util.version import version_core from sfa.util.xrn import Xrn @@ -12,7 +12,7 @@ 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 = [] @@ -22,7 +22,6 @@ class AggregateManager: 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, } @@ -45,8 +44,9 @@ class AggregateManager: 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', @@ -57,37 +57,14 @@ class AggregateManager: '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 - def ListSlices(self, api, creds, options): - call_id = options.get('call_id') - if Callids().already_handled(call_id): return [] - - # look in cache first - if self.driver.cache: - slices = self.driver.cache.get('slices') - if slices: - logger.debug("%s.list_slices returns from cache" % (self.driver.__module__)) - return slices - - # call driver - slices = self.driver.list_slices(creds, options) - - # cache the result - if self.driver.cache: - logger.debug ("%s.list_slices stores value in cache" % (self.driver.__module__)) - self.driver.cache.add('slices', instance_urns) - - return self.driver.list_slices (creds, options) - def ListResources(self, api, creds, options): call_id = options.get('call_id') if Callids().already_handled(call_id): return "" @@ -99,13 +76,13 @@ class AggregateManager: # 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) @@ -120,7 +97,7 @@ class AggregateManager: return self.driver.describe(urns, rspec_version, options) - def Status (self, api, urns, options): + 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) @@ -133,32 +110,34 @@ class AggregateManager: """ call_id = options.get('call_id') if Callids().already_handled(call_id): return "" - return self.driver.allocate(xrn, creds, rspec_string, options) + return self.driver.allocate(xrn, rspec_string, options) - def Provision(self, api, xrns, options): + def Provision(self, api, xrns, creds, options): """ Create the sliver[s] (slice) at this aggregate. Verify HRN and initialize the slice record in PLC if necessary. """ call_id = options.get('call_id') if Callids().already_handled(call_id): return "" - return self.driver.provision(xrns, creds, options) + return self.driver.provision(xrns, options) - def Delete(self, api, 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, expiration_time, options): + 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 GetTicket(self, api, xrn, creds, rspec, users, options): - - xrn = Xrn(xrn) - slice_urn=xrn.get_urn() - slice_hrn=xrn.get_hrn() - return self.driver.get_ticket (slice_urn, slice_hrn, creds, rspec, options) + 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) + def Shutdown(self, api, xrn, creds, options={}): + call_id = options.get('call_id') + if Callids().already_handled(call_id): return True + return self.driver.shutdown(xrn, options) +