get_ticket has been replaced by GetTicket
authorTony Mack <tmack@cs.princeton.edu>
Thu, 5 Aug 2010 22:46:52 +0000 (22:46 +0000)
committerTony Mack <tmack@cs.princeton.edu>
Thu, 5 Aug 2010 22:46:52 +0000 (22:46 +0000)
sfa/managers/aggregate_manager_pl.py
sfa/managers/slice_manager_pl.py
sfa/methods/CreateSliver.py
sfa/methods/__init__.py
sfa/methods/get_ticket.py

index c0bdb5c..c1a6d0c 100644 (file)
@@ -254,7 +254,9 @@ def get_rspec(api, creds, options):
     return rspec
 
 
-def get_ticket(api, xrn, rspec, origin_hrn=None, reg_objects=None):
+def get_ticket(api, xrn, creds, rspec, users):
+
+    reg_objects = __get_registry_objects(xrn, creds, users)
 
     slice_hrn, type = urn_to_hrn(xrn)
     slices = Slices(api)
index 88e2f5a..1d2f695 100644 (file)
@@ -85,7 +85,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 = {}
@@ -114,7 +114,8 @@ def get_ticket(api, xrn, rspec, origin_hrn=None):
                     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 
index 6752c8d..93c6b19 100644 (file)
@@ -29,8 +29,6 @@ class CreateSliver(Method):
         ]
     returns = Parameter(str, "Allocated RSpec")
 
-
-
     def call(self, slice_xrn, creds, rspec, users):
         hrn, type = urn_to_hrn(slice_xrn)
 
index 070d38e..33b2290 100644 (file)
@@ -23,7 +23,9 @@ start_slice
 stop_slice
 update
 remove_peer_object
+GetTicket
 GetVersion
+RedeemTicket
 ListResources
 ListSlices
 CreateSliver
index bbcfdf6..1a215ea 100644 (file)
@@ -5,17 +5,12 @@ from sfa.util.faults import *
 from sfa.util.namespace import *
 from sfa.util.method import Method
 from sfa.util.parameter import Parameter, Mixed
-from sfa.trust.auth import Auth
-from sfa.util.config import Config
-from sfa.trust.credential import Credential
-from sfa.util.table import SfaTable
-from sfa.util.sfaticket import SfaTicket
-from sfa.plc.slices import Slices
-from sfatables.runtime import SFATablesRules
-from sfa.util.rspec import *
+from sfa.methods.GetTicket import GetTicket
 
-class get_ticket(Method):
+class get_ticket(GetTicket):
     """
+    Deprecated. Use GetTicket instead.
+
     Retrieve a ticket. This operation is currently implemented on PLC
     only (see SFA, engineering decisions); it is not implemented on
     components.
@@ -44,46 +39,5 @@ class get_ticket(Method):
     returns = Parameter(str, "String represeneation of a ticket object")
     
     def call(self, cred, xrn, rspec, origin_hrn=None):
-        hrn, type = urn_to_hrn(xrn)
-        user_cred = Credential(string=cred)
-
-        #log the call
-        if not origin_hrn:
-            origin_hrn = user_cred.get_gid_caller().get_hrn()
-        self.api.logger.info("interface: %s\tcaller-hrn: %s\ttarget-hrn: %s\tmethod-name: %s"%(self.api.interface, origin_hrn, hrn, self.name))
-
-        # validate the cred
-        self.api.auth.check(cred, "getticket", hrn)
-       
-        # set the right outgoing rules
-        manager_base = 'sfa.managers'
-        if self.api.interface in ['aggregate']:
-            outgoing_rules = SFATablesRules('OUTGOING')
-            mgr_type = self.api.config.SFA_AGGREGATE_TYPE
-            manager_module = manager_base + ".aggregate_manager_%s" % mgr_type
-            manager = __import__(manager_module, fromlist=[manager_base])
-        elif self.api.interface in ['slicemgr']:
-            outgoing_rules = SFATablesRules('FORWARD-OUTGOING')
-            mgr_type = self.api.config.SFA_SM_TYPE
-            manager_module = manager_base + ".slice_manager_%s" % mgr_type
-            manager = __import__(manager_module, fromlist=[manager_base])
-
-        # Filter the incoming rspec using sfatables
-        incoming_rules = SFATablesRules('INCOMING')
-        #incoming_rules.set_slice(hrn) # This is a temporary kludge. Eventually, we'd like to fetch the context requested by the match/target
-        contexts = incoming_rules.contexts
-        caller_hrn = Credential(string=cred).get_gid_caller().get_hrn()
-        request_context = manager.fetch_context(hrn, caller_hrn, contexts)
-        incoming_rules.set_context(request_context)
-        rspec = incoming_rules.apply(rspec)
-        # remove nodes that are not available at this interface from the rspec
-        valid_rspec = RSpec(xml=manager.get_rspec(self.api, None, origin_hrn))
-        valid_nodes = valid_rspec.getDictsByTagName('NodeSpec')
-        valid_hostnames = [node['name'] for node in valid_nodes]
-        rspec_object = RSpec(xml=rspec)
-        rspec_object.filter(tagname='NodeSpec', attribute='name', whitelist=valid_hostnames)
-        rspec = rspec_object.toxml() 
-        ticket = manager.get_ticket(self.api, xrn, rspec, origin_hrn)
-        
-        return ticket
         
+        return GetTicket.call(self, xrn, cred, rspec, None)