From: Tony Mack Date: Mon, 2 Aug 2010 21:28:19 +0000 (+0000) Subject: Deprecated. Request is now forwarded to ListResources. This method just prepares... X-Git-Tag: sfa-1.0-0~116 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=815cb3705b77b1855ad32f1e6e92ae94925ba66c;p=sfa.git Deprecated. Request is now forwarded to ListResources. This method just prepares the arguments and hands the request to ListResources --- diff --git a/sfa/methods/get_resources.py b/sfa/methods/get_resources.py index 1fefac25..d7767007 100644 --- a/sfa/methods/get_resources.py +++ b/sfa/methods/get_resources.py @@ -2,18 +2,15 @@ ### $URL$ 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.methods.ListResources import ListResources # RSpecManager_pl is not used. This line is a check that ensures that everything is in place for the import to work. import sfa.rspecs.aggregates.rspec_manager_pl -from sfa.trust.credential import Credential -from sfatables.runtime import SFATablesRules -class get_resources(Method): +class get_resources(ListResources): """ + This Method has been deprecated. Use ListResources instead. Get an resource specification (rspec). The rspec may describe the resources available at an authority or the resources being used by a slice. @@ -35,36 +32,8 @@ class get_resources(Method): returns = Parameter(str, "String representatin of an rspec") def call(self, cred, xrn=None, 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, 'listnodes', hrn) - - # send the call to the right manager - manager_base = 'sfa.managers' - if self.api.interface in ['aggregate']: - mgr_type = self.api.config.SFA_AGGREGATE_TYPE - manager_module = manager_base + ".aggregate_manager_%s" % mgr_type - manager = __import__(manager_module, fromlist=[manager_base]) - rspec = manager.get_rspec(self.api, xrn, origin_hrn) - outgoing_rules = SFATablesRules('OUTGOING') - elif self.api.interface in ['slicemgr']: - mgr_type = self.api.config.SFA_SM_TYPE - manager_module = manager_base + ".slice_manager_%s" % mgr_type - manager = __import__(manager_module, fromlist=[manager_base]) - rspec = manager.get_rspec(self.api, xrn, origin_hrn) - outgoing_rules = SFATablesRules('FORWARD-OUTGOING') - - filtered_rspec = rspec - if outgoing_rules.sorted_rule_list: - request_context = manager.fetch_context(hrn, origin_hrn, outgoing_rules.contexts) - outgoing_rules.set_context(request_context) - filtered_rspec = outgoing_rules.apply(rspec) - - return filtered_rspec + options = {'geni_slice_urn': xrn, + 'origin_hrn': origin_hrn + } + + return ListResources.call(self, cred, options)