fix Allocate
authorTony Mack <tmack@paris.CS.Princeton.EDU>
Sat, 20 Oct 2012 02:05:23 +0000 (22:05 -0400)
committerTony Mack <tmack@paris.CS.Princeton.EDU>
Sat, 20 Oct 2012 02:05:23 +0000 (22:05 -0400)
sfa/client/sfi.py
sfa/methods/Allocate.py
sfa/planetlab/pldriver.py
sfa/rspecs/rspec.py
sfa/rspecs/versions/pgv2.py

index bb60be0..3f34ac6 100644 (file)
@@ -1234,7 +1234,9 @@ or with an slice hrn, shows currently provisioned resources
             if 'sfa' not in server_version:
                 users = pg_users_arg(user_records)
                 rspec = RSpec(rspec)
-                rspec.filter({'component_manager_id': server_version['urn']})
+                cm_hrn = Xrn(xrn=server_version['urn']).get_hrn()
+                cm_urn = Xrn(cm_hrn, type='authority+cm').get_urn()
+                rspec.filter({'component_manager_id': cm_urn})
                 rspec = RSpecConverter.to_pg_rspec(rspec.toxml(), content_type='request')
             else:
                 users = sfa_users_arg(user_records, slice_record)
index a1bb9e0..565d859 100644 (file)
@@ -1,10 +1,11 @@
 from sfa.util.faults import SfaInvalidArgument, InvalidRSpec, SfatablesRejected
-from sfa.util.xrn import urn_to_hrn
+from sfa.util.xrn import Xrn
 from sfa.util.method import Method
 from sfa.util.sfatablesRuntime import run_sfatables
 from sfa.trust.credential import Credential
 from sfa.storage.parameter import Parameter, Mixed
 from sfa.rspecs.rspec import RSpec
+from sfa.util.sfalogging import logger
 
 class Allocate(Method):
     """
@@ -26,7 +27,7 @@ class Allocate(Method):
     interfaces = ['aggregate', 'slicemgr']
     accepts = [
         Parameter(str, "Slice URN"),
-        Parameter(dict, "List of credentials"),
+        Parameter(type([dict]), "List of credentials"),
         Parameter(str, "RSpec"),
         Parameter(dict, "options"),
         ]
index 0179bb9..42da6ec 100644 (file)
@@ -5,7 +5,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
+from sfa.util.xrn import Xrn, 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..
@@ -700,7 +700,7 @@ class PlDriver (Driver):
         # only used by plc and ple.
         slices.handle_peer(site, slice, persons, peer)
         
-        return aggregate.describe(slice_xrn=xrn.get_urn(), version=rspec.version)
+        return aggregate.describe([xrn.get_urn()], version=rspec.version)
 
     def provision(self, urns, options={}):
         return self.describe(urns, None, options=options)
index b957e51..38865bb 100755 (executable)
@@ -91,12 +91,12 @@ class RSpec:
 
     def filter(self, filter):
         if 'component_manager_id' in filter:    
-            nodes = self.version.get_node_elements()
+            nodes = self.version.get_nodes()
             for node in nodes:
                 if 'component_manager_id' not in node.attrib or \
                   node.attrib['component_manager_id'] != filter['component_manager_id']:
                     parent = node.getparent()
-                    parent.remove(node) 
+                    parent.remove(node.element
         
 
     def toxml(self, header=True):
index 9506e5d..3d3e538 100644 (file)
@@ -175,10 +175,10 @@ class PGv2(RSpecVersion):
     # Leases
 
     def get_leases(self, filter=None):
-        pass
+        return []
 
     def add_leases(self, leases, network = None, no_dupes=False):
-        pass
+        return None
 
     # Utility