Merge branch 'master' into senslab2
[sfa.git] / sfa / plc / plslices.py
index 9d99887..2937d72 100644 (file)
@@ -1,11 +1,12 @@
 from types import StringTypes
 from collections import defaultdict
+import sys
 
 from sfa.util.sfatime import utcparse, datetime_to_epoch
 from sfa.util.sfalogging import logger
 from sfa.util.xrn import Xrn, get_leaf, get_authority, urn_to_hrn
 #from sfa.util.policy import Policy
-from sfa.util.xrn import Xrn
+from sfa.util.plxrn import PlXrn
 from sfa.rspecs.rspec import RSpec
 from sfa.plc.vlink import VLink
 from sfa.util.plxrn import hrn_to_pl_slicename
@@ -130,13 +131,13 @@ class PlSlices:
         # slice belongs to out local plc or a myplc peer. We will assume it 
         # is a local site, unless we find out otherwise  
         peer = None
-
+        print>>sys.stderr, " \r\n \r\n \tplslices.py get_peer slice_authority  "
         # get this slice's authority (site)
         slice_authority = get_authority(hrn)
 
         # get this site's authority (sfa root authority or sub authority)
         site_authority = get_authority(slice_authority).lower()
-
+        print>>sys.stderr, " \r\n \r\n \tplslices.py get_peer slice_authority  %s site_authority %s" %(slice_authority,site_authority) 
         # check if we are already peered with this site_authority, if so
         peers = self.driver.shell.GetPeers({}, ['peer_id', 'peername', 'shortname', 'hrn_root'])
         for peer_record in peers:
@@ -357,7 +358,7 @@ class PlSlices:
         for user in users:
             hrn, type = urn_to_hrn(user['urn'])
             username = get_leaf(hrn)
-            login_base = get_leaf(get_authority(user['urn']))
+            login_base = PlXrn(xrn=user['urn']).pl_login_base()
             user['username'] = username
             user['site'] = login_base