a missing part of the call_id on ListResources/get_rspec
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Wed, 6 Apr 2011 15:51:18 +0000 (17:51 +0200)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Wed, 6 Apr 2011 15:51:18 +0000 (17:51 +0200)
plus the other AMs should be OK except openflow that's outdated

sfa/managers/aggregate_manager_eucalyptus.py
sfa/managers/aggregate_manager_max.py
sfa/managers/aggregate_manager_openflow.py
sfa/managers/aggregate_manager_pl.py
sfa/managers/aggregate_manager_vini.py
sfa/methods/ListResources.py

index 021e7d5..a70d0b3 100644 (file)
@@ -18,6 +18,7 @@ from sfa.server.registry import Registries
 from sfa.trust.credential import Credential
 from sfa.plc.api import SfaAPI
 from sfa.util.plxrn import hrn_to_pl_slicename, slicename_to_hrn
+from sfa.util.callids import Callids
 
 ##
 # The data structure used to represent a cloud.
@@ -393,7 +394,8 @@ class ZoneResultParser(object):
 
         return clusterList
 
-def get_rspec(api, creds, options): 
+def get_rspec(api, creds, options, call_id): 
+    if not Callids().should_handle_call_id(call_id): return ""
     global cloud
     # get slice's hrn from options
     xrn = options.get('geni_slice_urn', '')
@@ -569,7 +571,7 @@ def main():
     #    theRSpec = xml.read()
     #create_slice(None, 'planetcloud.pc.test', theRSpec)
 
-    #rspec = get_rspec('euca', 'planetcloud.pc.test', 'planetcloud.pc.marcoy')
+    #rspec = get_rspec('euca', 'planetcloud.pc.test', 'planetcloud.pc.marcoy', 'test_euca')
     #print rspec
     print getKeysForSlice('gc.gc.test1')
 
index e586ffb..0b37bb3 100644 (file)
@@ -1,8 +1,10 @@
 #!/usr/bin/python
 
-from sfa.util.rspec import RSpec
 import sys
 import pdb
+import xml.dom.minidom
+
+from sfa.util.rspec import RSpec
 from sfa.util.xrn import urn_to_hrn, hrn_to_urn, get_authority
 from sfa.util.plxrn import hrn_to_pl_slicename
 from sfa.util.plxrn import hrn_to_pl_slicename
@@ -14,8 +16,8 @@ from sfa.util.policy import Policy
 from sfa.server.aggregate import Aggregates
 from sfa.server.registry import Registries
 from sfa.util.faults import *
+from sfa.util.callids import Callids
 
-import xml.dom.minidom
 
 SFA_MAX_CONF_FILE = '/etc/sfa/max_allocations'
 SFA_MAX_DEFAULT_RSPEC = '/etc/sfa/max_physical.xml'
@@ -252,7 +254,8 @@ def create_slice_max_aggregate(api, hrn, nodes):
     return 1
 
 
-def get_rspec(api, creds, options):
+def get_rspec(api, creds, options, call_id):
+    if not Callids().should_handle_call_id(call_id): return ""
     # get slice's hrn from options
     xrn = options.get('geni_slice_urn', '')
     hrn, type = urn_to_hrn(xrn)
index 9285897..5577c28 100755 (executable)
@@ -14,6 +14,7 @@ from sfa.util.rspec import RSpec
 from sfa.server.registry import Registries
 from sfa.util.config import Config
 from sfa.plc.nodes import *
+from sfa.util.callids import Callids
 
 # Message IDs for all the SFA light calls
 # This will be used by the aggrMgr controller
@@ -132,6 +133,7 @@ def create_slice(cred, xrn, rspec):
         print "IO error"
     return 0
 
+# Thierry : this would need to handle call_id like the other AMs but is outdated...
 def get_rspec(cred, xrn=None):
     hrn = urn_to_hrn(xrn)[0]
     if DEBUG: print "Received get_rspec call"
index 376f12c..0c52d9f 100644 (file)
@@ -383,9 +383,9 @@ def get_ticket(api, xrn, creds, rspec, users):
 def main():
     api = SfaAPI()
     """
-    rspec = get_rspec(api, "plc.princeton.sapan", None)
-    #rspec = get_rspec(api, "plc.princeton.coblitz", None)
-    #rspec = get_rspec(api, "plc.pl.sirius", None)
+    rspec = get_rspec(api, "plc.princeton.sapan", None, 'pl_test_sapan')
+    #rspec = get_rspec(api, "plc.princeton.coblitz", None, 'pl_test_coblitz')
+    #rspec = get_rspec(api, "plc.pl.sirius", None, 'pl_test_sirius')
     print rspec
     """
     f = open(sys.argv[1])
index 227281a..e16d201 100644 (file)
@@ -21,6 +21,7 @@ from sfa.plc.api import SfaAPI
 from sfa.plc.slices import *
 from sfa.managers.aggregate_manager_pl import __get_registry_objects, __get_hostnames
 from sfa.util.version import version_core
+from sfa.util.callids import Callids
 
 # VINI aggregate is almost identical to PLC aggregate for many operations, 
 # so lets just import the methods form the PLC manager
@@ -88,7 +89,8 @@ def create_slice(api, xrn, creds, xml, users):
 
     return True
 
-def get_rspec(api, creds, options):
+def get_rspec(api, creds, options,call_id):
+    if not Callids().should_handle_call_id(call_id): return ""
     # get slice's hrn from options
     xrn = options.get('geni_slice_urn', '')
     hrn, type = urn_to_hrn(xrn)
@@ -115,8 +117,8 @@ def get_rspec(api, creds, options):
 def main():
     api = SfaAPI()
     """
-    #rspec = get_rspec(api, None, None)
-    rspec = get_rspec(api, "plc.princeton.iias", None)
+    #rspec = get_rspec(api, None, None,)
+    rspec = get_rspec(api, "plc.princeton.iias", None, 'vini_test')
     print rspec
     """
     f = open(sys.argv[1])
index 6779303..905a060 100644 (file)
@@ -19,11 +19,12 @@ class ListResources(Method):
     accepts = [
         Mixed(Parameter(str, "Credential string"), 
               Parameter(type([str]), "List of credentials")),
-        Parameter(dict, "Options")
+        Parameter(dict, "Options"),
+        Parameter(str, "call_id"),
         ]
     returns = Parameter(str, "List of resources")
 
-    def call(self, creds, options):
+    def call(self, creds, options, call_id=""):
         self.api.logger.info("interface: %s\tmethod-name: %s" % (self.api.interface, self.name))
         
         # get slice's hrn from options    
@@ -39,7 +40,7 @@ class ListResources(Method):
             origin_hrn = Credential(string=valid_creds[0]).get_gid_caller().get_hrn()
         # get manager for this interface    
         manager = self.api.get_interface_manager()
-        rspec = manager.get_rspec(self.api, creds, options)
+        rspec = manager.get_rspec(self.api, creds, options, call_id)
 
         # filter rspec through sfatables 
         if self.api.interface in ['aggregate']: