From 3fd50980be09880ffbb6c6d321375a321a4cf167 Mon Sep 17 00:00:00 2001 From: Sandrine Avakian Date: Thu, 1 Dec 2011 15:32:19 +0100 Subject: [PATCH] Added prints for debugging purposes. --- sfa/methods/ListResources.py | 7 +++++-- sfa/senslab/OARrestapi.py | 2 +- sfa/senslab/OARrspec.py | 2 +- sfa/senslab/slab-import.py | 4 ++-- sfa/util/sfatablesRuntime.py | 5 +++-- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/sfa/methods/ListResources.py b/sfa/methods/ListResources.py index 6b1e7850..522c131d 100644 --- a/sfa/methods/ListResources.py +++ b/sfa/methods/ListResources.py @@ -1,5 +1,5 @@ import zlib - +import sys from sfa.util.xrn import urn_to_hrn from sfa.util.method import Method from sfa.util.parameter import Parameter, Mixed @@ -33,8 +33,10 @@ class ListResources(Method): # get hrn of the original caller origin_hrn = options.get('origin_hrn', None) + if not origin_hrn: origin_hrn = Credential(string=valid_creds[0]).get_gid_caller().get_hrn() + print >>sys.stderr, " \r\n \r\n \t Lsitresources.py call :self.api.interface %s origin_hrn %s options %s \r\n \t creds %s " %(self.api.interface,origin_hrn,options, creds) rspec = self.api.manager.ListResources(self.api, creds, options) # filter rspec through sfatables @@ -42,7 +44,8 @@ class ListResources(Method): chain_name = 'OUTGOING' elif self.api.interface in ['slicemgr']: chain_name = 'FORWARD-OUTGOING' - self.api.logger.debug("ListResources: sfatables on chain %s"%chain_name) + self.api.logger.debug("ListResources: sfatables on chain %s"%chain_name) + print >>sys.stderr, " \r\n \r\n \t Listresources.py call : chain_name %s hrn %s origine_hrn %s " %(chain_name, hrn, origin_hrn) filtered_rspec = run_sfatables(chain_name, hrn, origin_hrn, rspec) if options.has_key('geni_compressed') and options['geni_compressed'] == True: diff --git a/sfa/senslab/OARrestapi.py b/sfa/senslab/OARrestapi.py index 79ec3435..0ec528c9 100644 --- a/sfa/senslab/OARrestapi.py +++ b/sfa/senslab/OARrestapi.py @@ -119,7 +119,7 @@ class OARGETParser: tuplelist.append(('boot_state',str(value))) def ParseVersion(self) : - print self.raw_json + #print self.raw_json #print >>sys.stderr, self.raw_json if 'oar_version' in self.raw_json : self.version_json_dict.update(api_version=self.raw_json['api_version'] , diff --git a/sfa/senslab/OARrspec.py b/sfa/senslab/OARrspec.py index 2aa8c030..3d503469 100644 --- a/sfa/senslab/OARrspec.py +++ b/sfa/senslab/OARrspec.py @@ -107,7 +107,7 @@ class OARrspec: #node['tags'] = tags self.prepared = True - print >>sys.stderr, "\r\n OARrspec prepare node 10",self.nodes[10] + #print >>sys.stderr, "\r\n OARrspec prepare node 10",self.nodes[10] #print >>sys.stderr, " \r\n \t\t prepare prepare_nodes \r\n %s " %(self.nodes) def get_nodes(self): diff --git a/sfa/senslab/slab-import.py b/sfa/senslab/slab-import.py index ec99668e..432c284a 100644 --- a/sfa/senslab/slab-import.py +++ b/sfa/senslab/slab-import.py @@ -102,7 +102,7 @@ def import_node(hrn, node): node_record = table.find({'type': 'node', 'hrn': hrn}) pkey = Keypair(create=True) - print>>sys.stderr, " \r\n \t slab-import : hrn %s" %(hrn ) + urn = hrn_to_urn(hrn, 'node') node_gid = AuthHierarchy.create_gid(urn, create_uuid(), pkey) node_record = SfaRecord(hrn=hrn, gid=node_gid, type="node", pointer=node['node_id']) @@ -184,7 +184,7 @@ def main(): sys.exit(0) root_auth = config.SFA_REGISTRY_ROOT_AUTH interface_hrn = config.SFA_INTERFACE_HRN - print interface_hrn, root_auth + #Get all records in the sfa table # create dict of all existing sfa records diff --git a/sfa/util/sfatablesRuntime.py b/sfa/util/sfatablesRuntime.py index 24437772..6f3668fb 100644 --- a/sfa/util/sfatablesRuntime.py +++ b/sfa/util/sfatablesRuntime.py @@ -1,6 +1,6 @@ # sfa should not depend on sfatables # if the sfatables.runtime import fails, just define run_sfatables as identity - +import sys try: from sfatables.runtime import SFATablesRules @@ -27,9 +27,10 @@ try: """ if not context_callback: context_callback = fetch_context - + chain = chain.upper() rules = SFATablesRules(chain) + print>>sys.stderr, " \r\n \r\n \t\t \t sfaTablesRuntime.py run_sfatables context_callback %s chain %s rules %s " %(context_callback,chain, rules ) if rules.sorted_rule_list: contexts = rules.contexts request_context = context_callback(hrn, origin_hrn, contexts) -- 2.47.0