rename
[sfa.git] / sfa / managers / aggregate_manager.py
index eda3007..91a5c21 100644 (file)
@@ -12,21 +12,22 @@ from sfa.util.callids import Callids
 
 from sfa.trust.sfaticket import SfaTicket
 from sfa.trust.credential import Credential
+
 from sfa.rspecs.version_manager import VersionManager
 from sfa.rspecs.rspec import RSpec
 
 from sfa.server.sfaapi import SfaApi
 
 import sfa.plc.peers as peers
-from sfa.plc.aggregate import Aggregate
-from sfa.plc.slices import Slices
+from sfa.plc.plaggregate import PlAggregate
+from sfa.plc.plslices import PlSlices
 
 class AggregateManager:
 
     def __init__ (self):
         # xxx Thierry : caching at the aggregate level sounds wrong...
-        #self.caching=True
-        self.caching=False
+        self.caching=True
+        #self.caching=False
     
     def GetVersion(self, api, options={}):
     
@@ -40,7 +41,7 @@ class AggregateManager:
                 request_rspec_versions.append(rspec_version.to_dict()) 
         xrn=Xrn(api.hrn)
         version_more = {'interface':'aggregate',
-                        'sfa': 1,
+                        'sfa': 2,
                         'geni_api': api.config.SFA_AGGREGATE_API_VERSION,
                         'testbed':'myplc',
                         'hrn':xrn.get_hrn(),
@@ -55,7 +56,7 @@ class AggregateManager:
         """
         hrn, _ = urn_to_hrn(slice_xrn)
     
-        hrn_auth = get_authority(hrn)
+        #hrn_auth = get_authority(hrn)
     
         # Build up objects that an SFA registry would return if SFA
         # could contact the slice's registry directly
@@ -167,8 +168,8 @@ class AggregateManager:
         call_id = options.get('call_id')
         if Callids().already_handled(call_id): return ""
     
-        aggregate = Aggregate(api)
-        slices = Slices(api)
+        aggregate = PlAggregate(self.driver)
+        slices = PlSlices(api)
         (hrn, _) = urn_to_hrn(slice_xrn)
         peer = slices.get_peer(hrn)
         sfa_peer = slices.get_sfa_peer(hrn)
@@ -299,19 +300,20 @@ class AggregateManager:
         if Callids().already_handled(call_id): return ""
         # get slice's hrn from options
         xrn = options.get('geni_slice_urn', None)
+        cached = options.get('cached', True) 
         (hrn, _) = urn_to_hrn(xrn)
     
         version_manager = VersionManager()
         # get the rspec's return format from options
-        rspec_version = version_manager.get_version(options.get('rspec_version'))
-        version_string = "rspec_%s" % (rspec_version.to_string())
+        rspec_version = version_manager.get_version(options.get('geni_rspec_version'))
+        version_string = "rspec_%s" % (rspec_version)
     
         #panos adding the info option to the caching key (can be improved)
         if options.get('info'):
             version_string = version_string + "_"+options.get('info', 'default')
     
         # look in cache first
-        if self.caching and api.cache and not xrn:
+        if self.caching and api.cache and not xrn and cached:
             rspec = api.cache.get(version_string)
             if rspec:
                 api.logger.info("aggregate.ListResources: returning cached value for hrn %s"%hrn)
@@ -319,8 +321,8 @@ class AggregateManager:
     
         #panos: passing user-defined options
         #print "manager options = ",options
-        aggregate = Aggregate(api, options)
-        rspec =  aggregate.get_rspec(slice_xrn=xrn, version=rspec_version)
+        aggregate = PlAggregate(self.driver)
+        rspec =  aggregate.get_rspec(slice_xrn=xrn, version=rspec_version, options=options)
     
         # cache the result
         if self.caching and api.cache and not xrn:
@@ -332,7 +334,7 @@ class AggregateManager:
     def GetTicket(self, api, xrn, creds, rspec, users, options={}):
     
         (slice_hrn, _) = urn_to_hrn(xrn)
-        slices = Slices(api)
+        slices = PlSlices(api)
         peer = slices.get_peer(slice_hrn)
         sfa_peer = slices.get_sfa_peer(slice_hrn)