slice manager sets 'geni_compressed' option to False when calling ListResources at...
[sfa.git] / sfa / managers / slice_manager_pl.py
index e305e4d..1103bdc 100644 (file)
@@ -23,10 +23,12 @@ from sfa.util.threadmanager import ThreadManager
 import sfa.util.xmlrpcprotocol as xmlrpcprotocol     
 from sfa.util.debug import log
 import sfa.plc.peers as peers
+from copy import copy
 
 def get_version():
     version = {}
     version['geni_api'] = 1
+    version['sfa'] = 1
     return version
 
 def slice_status(api, slice_xrn, creds ):
@@ -69,8 +71,9 @@ def create_slice(api, xrn, creds, rspec, users):
             # Just send entire RSpec to each aggregate
             threads.run(server.CreateSliver, xrn, cred, rspec, users)
             
-    threads.get_results() 
-    return 1
+    results = threads.get_results() 
+    merged_rspec = merge_rspecs(results)
+    return merged_rspec
 
 def renew_slice(api, xrn, creds, expiration_time):
     # XX
@@ -84,7 +87,7 @@ def renew_slice(api, xrn, creds, expiration_time):
     threads.get_results()
     return 1
 
-def get_ticket(api, xrn, rspec, origin_hrn=None):
+def get_ticket(api, xrn, creds, rspec, users):
     slice_hrn, type = urn_to_hrn(xrn)
     # get the netspecs contained within the clients rspec
     aggregate_rspecs = {}
@@ -105,15 +108,18 @@ def get_ticket(api, xrn, rspec, origin_hrn=None):
             net_urn = hrn_to_urn(aggregate, 'authority')     
             # we may have a peer that knows about this aggregate
             for agg in api.aggregates:
-                agg_info = api.aggregates[agg].get_aggregates(credential, net_urn)
-                if agg_info:
-                    # send the request to this address 
-                    url = 'http://%s:%s' % (agg_info['addr'], agg_info['port'])
-                    server = xmlrpcprotocol.get_server(url, api.key_file, api.cert_file)
-                    break   
+                target_aggs = api.aggregates[agg].get_aggregates(credential, net_urn)
+                if not target_aggs or not 'hrn' in target_aggs[0]:
+                    continue
+                # send the request to this address 
+                url = target_aggs[0]['url']
+                server = xmlrpcprotocol.get_server(url, api.key_file, api.cert_file)
+                # aggregate found, no need to keep looping
+                break   
         if server is None:
             continue 
-        threads.run(server.get_ticket, credential, xrn, aggregate_rspec, origin_hrn)
+        threads.run(server.GetTicket, xrn, credential, aggregate_rspec, users)
+
     results = threads.get_results()
     
     # gather information from each ticket 
@@ -258,7 +264,9 @@ def get_rspec(api, creds, options):
         if aggregate not in [api.auth.client_cred.get_gid_caller().get_hrn()]:   
             # get the rspec from the aggregate
             server = api.aggregates[aggregate]
-            threads.run(server.ListResources, cred, options)
+            my_opts = copy(options)
+            my_opts['geni_compressed'] = False
+            threads.run(server.ListResources, cred, my_opts)
             #threads.run(server.get_resources, cred, xrn, origin_hrn)