Merge remote-tracking branch 'origin/geni-v3' into geni-v3
[sfa.git] / sfa / planetlab / pldriver.py
index cfbb697..f73410e 100644 (file)
@@ -6,7 +6,7 @@ from sfa.util.faults import MissingSfaInfo, UnknownSfaType, \
 from sfa.util.sfalogging import logger
 from sfa.util.defaultdict import defaultdict
 from sfa.util.sfatime import utcparse, datetime_to_string, datetime_to_epoch
-from sfa.util.xrn import hrn_to_urn, get_leaf, urn_to_sliver_id
+from sfa.util.xrn import hrn_to_urn, get_leaf
 from sfa.util.cache import Cache
 
 # one would think the driver should not need to mess with the SFA db, but..
@@ -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 sliver_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)
         
@@ -627,8 +632,10 @@ class PlDriver (Driver):
             if node['last_contact'] is not None:
                 
                 res['pl_last_contact'] = datetime_to_string(utcparse(node['last_contact']))
-            sliver_id = urn_to_sliver_id(slice_urn, slice['slice_id'], node['node_id'], authority=self.hrn) 
-            res['geni_urn'] = sliver_id
+            sliver_id = "%s:%s" % (slice['slice_id'], node['node_id'])
+            sliver_xrn = Xrn(slice_urn, id = sliver_id)
+            sliver_xrn.set_authority(self.hrn)
+            res['geni_urn'] = sliver_xrn.get_urn()
             if node['boot_state'] == 'boot':
                 res['geni_status'] = 'ready'
             else: