X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Fplc%2Fpeers.py;h=c256c7b54cca3be68ded0c216ca693822556afe1;hb=b6de9285a970eccb9658a0078c49f76fb11af7cd;hp=a1cc6a24afe961c822079aaafec87ddb8ff0afff;hpb=16d2197289b87a2f290fe0ad887dc36de7866892;p=sfa.git diff --git a/sfa/plc/peers.py b/sfa/plc/peers.py index a1cc6a24..c256c7b5 100644 --- a/sfa/plc/peers.py +++ b/sfa/plc/peers.py @@ -1,8 +1,8 @@ -from sfa.util.misc import * +from sfa.util.xrn import get_authority from types import StringTypes -def get_peer(api, hrn): - # Becaues of myplc federation, we first need to determine if this +def get_peer(pldriver, hrn): + # Because of myplc native federation, we first need to determine if this # 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 @@ -13,8 +13,7 @@ def get_peer(api, hrn): # get this site's authority (sfa root authority or sub authority) site_authority = get_authority(slice_authority).lower() # check if we are already peered with this site_authority, if so - peers = api.plshell.GetPeers(api.plauth, {}, \ - ['peer_id', 'peername', 'shortname', 'hrn_root']) + peers = pldriver.GetPeers( {}, ['peer_id', 'peername', 'shortname', 'hrn_root']) for peer_record in peers: names = [name.lower() for name in peer_record.values() if isinstance(name, StringTypes)] if site_authority in names: @@ -23,14 +22,14 @@ def get_peer(api, hrn): return peer -def get_sfa_peer(api, hrn): - # return the authority for this hrn or None if we are the authority - sfa_peer = None - slice_authority = get_authority(hrn) - site_authority = get_authority(slice_authority) - - if site_authority != api.hrn: - sfa_peer = site_authority - - return sfa_peer +#def get_sfa_peer(pldriver, hrn): +# # return the authority for this hrn or None if we are the authority +# sfa_peer = None +# slice_authority = get_authority(hrn) +# site_authority = get_authority(slice_authority) +# +# if site_authority != pldriver.hrn: +# sfa_peer = site_authority +# +# return sfa_peer