renamed create_slice into CreateSliver on the managers side
[sfa.git] / sfa / methods / CreateSliver.py
index 6752c8d..96b535d 100644 (file)
@@ -1,11 +1,9 @@
 from sfa.util.faults import *
-from sfa.util.namespace import *
+from sfa.util.xrn import urn_to_hrn
 from sfa.util.method import Method
 from sfa.util.parameter import Parameter, Mixed
 from sfa.util.sfatablesRuntime import run_sfatables
-import sys
 from sfa.trust.credential import Credential
-from sfa.util.sfalogging import logger
 
 class CreateSliver(Method):
     """
@@ -19,19 +17,18 @@ class CreateSliver(Method):
     @param rspec (string) rspec to allocate
     
     """
-    interfaces = ['aggregate', 'slicemgr', 'geni_am']
+    interfaces = ['aggregate', 'slicemgr']
     accepts = [
         Parameter(str, "Slice URN"),
         Mixed(Parameter(str, "Credential string"),
               Parameter(type([str]), "List of credentials")),
         Parameter(str, "RSpec"),
-        Parameter(type([]), "List of user information")
+        Parameter(type([]), "List of user information"),
+        Parameter(str, "call_id"),
         ]
     returns = Parameter(str, "Allocated RSpec")
 
-
-
-    def call(self, slice_xrn, creds, rspec, users):
+    def call(self, slice_xrn, creds, rspec, users, call_id=""):
         hrn, type = urn_to_hrn(slice_xrn)
 
         self.api.logger.info("interface: %s\ttarget-hrn: %s\tmethod-name: %s"%(self.api.interface, hrn, self.name))
@@ -43,12 +40,14 @@ class CreateSliver(Method):
         manager = self.api.get_interface_manager()
         
         # flter rspec through sfatables
-        if self.api.interface in ['aggregate', 'geni_am']:
-            chain_name = 'OUTGOING'
+        if self.api.interface in ['aggregate']:
+            chain_name = 'INCOMING'
         elif self.api.interface in ['slicemgr']:
-            chain_name = 'FORWARD-OUTGOING'
+            chain_name = 'FORWARD-INCOMING'
+        self.api.logger.debug("CreateSliver: sfatables on chain %s"%chain_name)
         rspec = run_sfatables(chain_name, hrn, origin_hrn, rspec)
-        allocated = manager.create_slice(self.api, slice_xrn, valid_creds, rspec, users)
-
-        return rspec 
-    
+        # the aggregate's CreateSliver returns false if call_id was already handled
+        if manager.CreateSliver(self.api, slice_xrn, creds, rspec, users, call_id):
+            return rspec 
+        else:
+            return ""