from sfa.util.prefixTree import prefixTree
from sfa.util.record import SfaRecord
from sfa.senslab.table_slab import SfaTable
- from sfa.util.record import SfaRecord
- from sfa.trust.gid import GID
from sfa.util.xrn import Xrn, get_leaf, get_authority, hrn_to_urn, urn_to_hrn
- from sfa.util.plxrn import hrn_to_pl_login_base
+ from sfa.util.version import version_core
+
+ from sfa.trust.gid import GID
from sfa.trust.credential import Credential
- from sfa.trust.certificate import Certificate, Keypair
+ from sfa.trust.certificate import Certificate, Keypair, convert_public_key
from sfa.trust.gid import create_uuid
- from sfa.util.version import version_core
- from sfa.senslab.api import *
+#myapi=SfaAPI()
# The GENI GetVersion call
def GetVersion(api):
- peers =dict ([ (peername,v._ServerProxy__host) for (peername,v) in api.registries.iteritems()
- if peername != api.hrn])
+
+ # Bugfix TP 09/11/2011
+ #peers =dict ([ (peername,v._ServerProxy__host) for (peername,v) in api.registries.iteritems()
+ peers =dict ([ (peername,v.get_url()) for (peername,v) in api.registries.iteritems()
+ if peername != api.hrn])
xrn=Xrn(api.hrn)
return version_core({'interface':'registry',
'hrn':xrn.get_hrn(),
if full:
print >>sys.stderr, '\r\n \r\n REGISTRY:_FULL', api
- api.fill_record_info(local_records)
-
+
+ api.driver.fill_record_info(local_records)
+
# convert local record objects to dicts
records.extend([dict(record) for record in local_records])
print >>sys.stderr, "\r\n \t\t records extends %s" %(records)
def register(api, record):
- #hrn = str(record['hrn']).strip("['']")
- #type_of_rec = str( record['type']).strip("['']")
- hrn = record['hrn']
- type_of_rec =record['type']
+
- urn = hrn_to_urn(hrn,type_of_rec)
+ #hrn, type = record['hrn'], record['type']
+ hrn = str(record['hrn']).strip("['']")
+ type = str( record['type']).strip("['']")
+ urn = hrn_to_urn(hrn,type)
# validate the type
-
- if type_of_rec not in ['authority', 'slice', 'node', 'user']:
- raise UnknownSfaType(type_of_rec)
+ if type not in ['authority', 'slice', 'node', 'user']:
+ raise UnknownSfaType(type)
# check if record already exists
table = SfaTable()
#record['authority'] = get_authority(record['hrn'])
record['authority'] = get_authority(hrn)
- type_of_rec = record['type']
- hrn = record['hrn']
+ #type_of_rec = record['type']
+ #hrn = record['hrn']
- api.auth.verify_object_permission(hrn)
- #myapi.auth.verify_object_permission( record['hrn'])
+ #api.auth.verify_object_permission(hrn)
+ api.auth.verify_object_permission( record['hrn'])
auth_info = api.auth.get_auth_info(record['authority'])
+
+
+
pub_key = None
# make sure record has a gid
if 'gid' not in record:
# time by sfa and doesont already exist in plc
if not persons or not persons[0]['site_ids']:
login_base = get_leaf(record['authority'])
- api.users.AddPersonToSite( pointer, login_base)
++
+ api.driver.AddPersonToSite(pointer, login_base)
# What roles should this user have?
- api.users.AddRoleToPerson( 'user', pointer)
+ api.driver.AddRoleToPerson('user', pointer)
# Add the user's key
if pub_key:
- api.users.AddPersonKey( pointer, {'key_type' : 'ssh', 'key' : pub_key})
+ api.driver.AddPersonKey(pointer, {'key_type' : 'ssh', 'key' : pub_key})
#elif (type == "node"):
- #pl_record = api.sfa_fields_to_pl_fields(type, hrn, record)
+ #pl_record = api.driver.sfa_fields_to_pl_fields(type, hrn, record)
#login_base = hrn_to_pl_login_base(record['authority'])
- #nodes = api.oar.GetNodes( [pl_record['hostname']])
+ #nodes = api.driver.GetNodes([pl_record['hostname']])
#if not nodes:
- #pointer = api.oar.AddNode(login_base, pl_record)
+ #pointer = api.driver.AddNode(login_base, pl_record)
#else:
#pointer = nodes[0]['node_id']