from sfa.util.faults import SliverDoesNotExist, UnknownSfaType
from sfa.util.sfalogging import logger
from sfa.storage.alchemy import dbsession
from sfa.util.faults import SliverDoesNotExist, UnknownSfaType
from sfa.util.sfalogging import logger
from sfa.storage.alchemy import dbsession
-from sfa.storage.model import RegRecord, RegUser, RegSlice, RegKey
-from sqlalchemy.orm import joinedload
+from sfa.storage.model import RegRecord
+
Contains methods compliant with the SFA standard and the testbed
infrastructure (calls to LDAP and OAR).
Contains methods compliant with the SFA standard and the testbed
infrastructure (calls to LDAP and OAR).
+ """
+
+ Sets the senslab SFA config parameters ,
+ instanciates the testbed api and the senslab database.
+
+ :param config: senslab SFA configuration object
+ :type config: Config object
+ """
self.db = SlabDB(config, debug = False)
self.slab_api = SlabTestbedAPI(config)
self.cache = None
def augment_records_with_testbed_info (self, record_list ):
self.db = SlabDB(config, debug = False)
self.slab_api = SlabTestbedAPI(config)
self.cache = None
def augment_records_with_testbed_info (self, record_list ):
- """ Adds specific testbed info to the records. """
+ """
+
+ Adds specific testbed info to the records.
+
+ :param record_list: list of sfa dictionaries records
+ :type record_list: list
+ :return: list of records with extended information in each record
+ :rtype: list
+ """
return self.fill_record_info (record_list)
def fill_record_info(self, record_list):
"""
return self.fill_record_info (record_list)
def fill_record_info(self, record_list):
"""
+
+ :param record_list: list of sfa dictionaries records
+ :type record_list: list
+ :return: list of records with extended information in each record
+ :rtype: list
+
+ .. warnings:: Should not be modifying record_list directly because modi
+ fication are kept outside the method's scope. Howerver, there is no
+ other way to do it given the way it's called in registry manager.
"""
logger.debug("SLABDRIVER \tfill_record_info records %s " %(record_list))
if not isinstance(record_list, list):
"""
logger.debug("SLABDRIVER \tfill_record_info records %s " %(record_list))
if not isinstance(record_list, list):
if str(record['type']) == 'slice':
if 'reg_researchers' in record and \
isinstance(record['reg_researchers'], list) :
if str(record['type']) == 'slice':
if 'reg_researchers' in record and \
isinstance(record['reg_researchers'], list) :
- 'researcher': [record['reg_researchers']['hrn']],
- 'name':record['hrn'],
- 'oar_job_id':[],
- 'node_ids': [],
- 'person_ids':[record['reg_researchers']['record_id']],
- 'geni_urn':'', #For client_helper.py compatibility
- 'keys':'', #For client_helper.py compatibility
- 'key_ids':''}) #For client_helper.py compatibility
+ 'researcher': [record['reg_researchers']['hrn']],
+ 'name':record['hrn'],
+ 'oar_job_id':[],
+ 'node_ids': [],
+ 'person_ids':[record['reg_researchers']['record_id']],
+ 'geni_urn':'', #For client_helper.py compatibility
+ 'keys':'', #For client_helper.py compatibility
+ 'key_ids':''}) #For client_helper.py compatibility
#Append slice record in records list,
#therefore fetches user and slice info again(one more loop)
#Will update PIs and researcher for the slice
recuser = recslice_list[0]['reg_researchers']
logger.debug( "SLABDRIVER.PY \t fill_record_info USER \
#Append slice record in records list,
#therefore fetches user and slice info again(one more loop)
#Will update PIs and researcher for the slice
recuser = recslice_list[0]['reg_researchers']
logger.debug( "SLABDRIVER.PY \t fill_record_info USER \
recslice = {}
recslice = recslice_list[0]
recslice.update({'PI':[recuser['hrn']],
recslice = {}
recslice = recslice_list[0]
recslice.update({'PI':[recuser['hrn']],
urn:publicid:IDN+senslab+nturro_slice hrn senslab.nturro_slice
shall return a structure as described in
http://groups.geni.net/geni/wiki/GAPI_AM_API_V2#SliverStatus
NT : not sure if we should implement this or not, but used by sface.
urn:publicid:IDN+senslab+nturro_slice hrn senslab.nturro_slice
shall return a structure as described in
http://groups.geni.net/geni/wiki/GAPI_AM_API_V2#SliverStatus
NT : not sure if we should implement this or not, but used by sface.
+ :param slice_urn: slice urn
+ :type slice_urn: string
+ :param slice_hrn: slice hrn
+ :type slice_hrn: string
+
+ .. note:: UNUSED. sface deprecated. SA May 7th 2013
+
#First get the slice with the slice hrn
slice_list = self.slab_api.GetSlices(slice_filter = slice_hrn, \
slice_filter_type = 'slice_hrn')
#First get the slice with the slice hrn
slice_list = self.slab_api.GetSlices(slice_filter = slice_hrn, \
slice_filter_type = 'slice_hrn')
- def get_user_record( hrn):
- """ Returns the user record based on the hrn from the SFA DB """
+ def get_user_record(hrn):
+ """
+
+ Returns the user record based on the hrn from the SFA DB .
+
+ :param hrn: user's hrn
+ :type hrn: string
+ :return : user record from SFA database
+ :rtype: RegUser
+
+ """
return self.hrn
# 'geni_request_rspec_versions' and 'geni_ad_rspec_versions' are mandatory
def aggregate_version (self):
return self.hrn
# 'geni_request_rspec_versions' and 'geni_ad_rspec_versions' are mandatory
def aggregate_version (self):
def create_sliver (self, slice_urn, slice_hrn, creds, rspec_string, \
users, options):
def create_sliver (self, slice_urn, slice_hrn, creds, rspec_string, \
users, options):