From f947ffc3bb7509783faee76185ec082c6311ab9f Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Wed, 6 Apr 2011 17:51:18 +0200 Subject: [PATCH] a missing part of the call_id on ListResources/get_rspec plus the other AMs should be OK except openflow that's outdated --- sfa/managers/aggregate_manager_eucalyptus.py | 6 ++++-- sfa/managers/aggregate_manager_max.py | 9 ++++++--- sfa/managers/aggregate_manager_openflow.py | 2 ++ sfa/managers/aggregate_manager_pl.py | 6 +++--- sfa/managers/aggregate_manager_vini.py | 8 +++++--- sfa/methods/ListResources.py | 7 ++++--- 6 files changed, 24 insertions(+), 14 deletions(-) diff --git a/sfa/managers/aggregate_manager_eucalyptus.py b/sfa/managers/aggregate_manager_eucalyptus.py index 021e7d53..a70d0b3a 100644 --- a/sfa/managers/aggregate_manager_eucalyptus.py +++ b/sfa/managers/aggregate_manager_eucalyptus.py @@ -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') diff --git a/sfa/managers/aggregate_manager_max.py b/sfa/managers/aggregate_manager_max.py index e586ffb9..0b37bb32 100644 --- a/sfa/managers/aggregate_manager_max.py +++ b/sfa/managers/aggregate_manager_max.py @@ -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) diff --git a/sfa/managers/aggregate_manager_openflow.py b/sfa/managers/aggregate_manager_openflow.py index 92858977..5577c289 100755 --- a/sfa/managers/aggregate_manager_openflow.py +++ b/sfa/managers/aggregate_manager_openflow.py @@ -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" diff --git a/sfa/managers/aggregate_manager_pl.py b/sfa/managers/aggregate_manager_pl.py index 376f12c8..0c52d9f3 100644 --- a/sfa/managers/aggregate_manager_pl.py +++ b/sfa/managers/aggregate_manager_pl.py @@ -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]) diff --git a/sfa/managers/aggregate_manager_vini.py b/sfa/managers/aggregate_manager_vini.py index 227281a6..e16d2010 100644 --- a/sfa/managers/aggregate_manager_vini.py +++ b/sfa/managers/aggregate_manager_vini.py @@ -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]) diff --git a/sfa/methods/ListResources.py b/sfa/methods/ListResources.py index 67793033..905a0601 100644 --- a/sfa/methods/ListResources.py +++ b/sfa/methods/ListResources.py @@ -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']: -- 2.43.0