From: Mohamed Larabi Date: Fri, 28 Mar 2014 15:47:56 +0000 (+0100) Subject: pl: we need to distinguish between local pl sites/slices and foreign ones coming... X-Git-Tag: sfa-3.1-3~5 X-Git-Url: http://git.onelab.eu/?p=sfa.git;a=commitdiff_plain;h=5497dd362dfe88bb919ccceaf48841d31f84561c pl: we need to distinguish between local pl sites/slices and foreign ones coming from the federation --- diff --git a/sfa/planetlab/plslices.py b/sfa/planetlab/plslices.py index b39f92bd..b6cec880 100644 --- a/sfa/planetlab/plslices.py +++ b/sfa/planetlab/plslices.py @@ -323,20 +323,20 @@ class PlSlices: def verify_site(self, slice_xrn, slice_record={}, sfa_peer=None, options={}): - #(slice_hrn, type) = urn_to_hrn(slice_xrn) - #top_auth_hrn = top_auth(slice_hrn) - #site_hrn = '.'.join(slice_hrn.split('.')[:-1]) - #if top_auth_hrn == self.driver.hrn: - # login_base = slice_hrn.split('.')[-2][:12] - #else: - # login_base = hash_loginbase(site_hrn) - plxrn = PlXrn(xrn=slice_xrn) - slice_hrn = plxrn.get_hrn() - type = plxrn.get_type() - site_hrn = plxrn.get_authority_hrn() - authority_name = plxrn.pl_authname() - slicename = plxrn.pl_slicename() - login_base = plxrn.pl_login_base() + (slice_hrn, type) = urn_to_hrn(slice_xrn) + top_auth_hrn = top_auth(slice_hrn) + site_hrn = '.'.join(slice_hrn.split('.')[:-1]) + if top_auth_hrn == self.driver.hrn: + login_base = slice_hrn.split('.')[-2][:12] + else: + login_base = hash_loginbase(site_hrn) + #plxrn = PlXrn(xrn=slice_xrn) + #slice_hrn = plxrn.get_hrn() + #type = plxrn.get_type() + #site_hrn = plxrn.get_authority_hrn() + #authority_name = plxrn.pl_authname() + #slicename = plxrn.pl_slicename() + #login_base = plxrn.pl_login_base() sites = self.driver.shell.GetSites({'peer_id': None},['site_id','name','abbreviated_name','login_base','hrn']) @@ -368,21 +368,21 @@ class PlSlices: def verify_slice(self, slice_hrn, slice_record, sfa_peer, expiration, options={}): - #top_auth_hrn = top_auth(slice_hrn) - #site_hrn = '.'.join(slice_hrn.split('.')[:-1]) - #slice_part = slice_hrn.split('.')[-1] - #if top_auth_hrn == self.driver.hrn: - # login_base = slice_hrn.split('.')[-2][:12] - #else: - # login_base = hash_loginbase(site_hrn) - #slice_name = '_'.join([login_base, slice_part]) - plxrn = PlXrn(xrn=slice_hrn) - slice_hrn = plxrn.get_hrn() - type = plxrn.get_type() - site_hrn = plxrn.get_authority_hrn() - authority_name = plxrn.pl_authname() - slicename = plxrn.pl_slicename() - login_base = plxrn.pl_login_base() + top_auth_hrn = top_auth(slice_hrn) + site_hrn = '.'.join(slice_hrn.split('.')[:-1]) + slice_part = slice_hrn.split('.')[-1] + if top_auth_hrn == self.driver.hrn: + login_base = slice_hrn.split('.')[-2][:12] + else: + login_base = hash_loginbase(site_hrn) + slice_name = '_'.join([login_base, slice_part]) + #plxrn = PlXrn(xrn=slice_hrn) + #slice_hrn = plxrn.get_hrn() + #type = plxrn.get_type() + #site_hrn = plxrn.get_authority_hrn() + #authority_name = plxrn.pl_authname() + #slicename = plxrn.pl_slicename() + #login_base = plxrn.pl_login_base() slices = self.driver.shell.GetSlices({'peer_id': None},['slice_id','name','hrn']) # Filter slices by HRN