pl: we need to distinguish between local pl sites/slices and foreign ones coming...
authorMohamed Larabi <mohamed.larabi@inria.fr>
Fri, 28 Mar 2014 15:47:56 +0000 (16:47 +0100)
committerMohamed Larabi <mohamed.larabi@inria.fr>
Fri, 28 Mar 2014 15:47:56 +0000 (16:47 +0100)
sfa/planetlab/plslices.py

index b39f92b..b6cec88 100644 (file)
@@ -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