fix Describe
authorTony Mack <tmack@paris.CS.Princeton.EDU>
Mon, 20 Aug 2012 19:42:47 +0000 (15:42 -0400)
committerTony Mack <tmack@paris.CS.Princeton.EDU>
Mon, 20 Aug 2012 19:42:47 +0000 (15:42 -0400)
sfa/managers/aggregate_manager.py
sfa/methods/Describe.py
sfa/openstack/nova_driver.py
sfa/planetlab/pldriver.py

index d328c1b..20c3d73 100644 (file)
@@ -115,20 +115,15 @@ class AggregateManager:
         call_id = options.get('call_id')
         if Callids().already_handled(call_id): return ""
 
-        # get the rspec's return format from options
         version_manager = VersionManager()
         rspec_version = version_manager.get_version(options.get('geni_rspec_version'))
-        return self.driver.describe(creds, urns, rspec, options)
+        return self.driver.describe(creds, urns, rspec_version, options)
         
     
-    def SliverStatus (self, api, xrn, creds, options):
+    def Status (self, api, urns, creds, options):
         call_id = options.get('call_id')
         if Callids().already_handled(call_id): return {}
-    
-        xrn = Xrn(xrn,'slice')
-        slice_urn=xrn.get_urn()
-        slice_hrn=xrn.get_hrn()
-        return self.driver.sliver_status (slice_urn, slice_hrn)
+        return self.driver.status (urns, options=options)
     
     def CreateSliver(self, api, xrn, creds, rspec_string, users, options):
         """
index 7a03085..546be22 100644 (file)
@@ -43,7 +43,7 @@ class Describe(Method):
         origin_hrn = options.get('origin_hrn', None)
         if not origin_hrn:
             origin_hrn = Credential(string=valid_creds[0]).get_gid_caller().get_hrn()
-        rspec = self.api.manager.ListResources(self.api, creds, options)
+        desc = self.api.manager.Describe(self.api, creds, urns, options)
 
         # filter rspec through sfatables 
         if self.api.interface in ['aggregate']:
@@ -51,11 +51,11 @@ class Describe(Method):
         elif self.api.interface in ['slicemgr']: 
             chain_name = 'FORWARD-OUTGOING'
         self.api.logger.debug("ListResources: sfatables on chain %s"%chain_name)
-        filtered_rspec = run_sfatables(chain_name, '', origin_hrn, rspec
+        desc['geni_rspec'] = run_sfatables(chain_name, '', origin_hrn, desc['geni_rspec']
  
         if options.has_key('geni_compressed') and options['geni_compressed'] == True:
-            filtered_rspec = zlib.compress(filtered_rspec).encode('base64')
+            desc['geni_rspec'] = zlib.compress(desc['geni_rspec']).encode('base64')
 
-        return filtered_rspec  
+        return desc  
     
     
index 275e4bb..af9ce4d 100644 (file)
@@ -337,9 +337,9 @@ class NovaDriver(Driver):
         aggregate = OSAggregate(self)
         return aggregate.describe(urns, version=version, options=options)
     
-    def status (self, urns):
+    def status (self, urns, options={}):
         aggregate = OSAggregate(self)
-        desc =  aggregate.describe(urns, version=version, options=options)
+        desc =  aggregate.describe(urns)
         return desc['geni_slivers']
 
     def create_sliver (self, slice_urn, slice_hrn, creds, rspec_string, users, options):
index 8388ea2..f73410e 100644 (file)
@@ -576,10 +576,15 @@ class PlDriver (Driver):
         rspec =  aggregate.list_resources(version=rspec_version, options=options)
         return rspec
 
-    def describe(self, creds, urns, options):
-        return {}
+    def describe(self, creds, urns, version, options):
+        aggregate = PlAggregate(self)
+        return aggregate.describe(urns, version=version, options=options)
     
-    def status (self, slice_urn, slice_hrn):
+    def status (self, urns, options={}):
+        aggregate = PlAggregate(self)
+        desc =  aggregate.describe(urns)
+        return desc['geni_slivers']
+
         # find out where this slice is currently running
         slicename = hrn_to_pl_slicename(slice_hrn)