import subprocess
from datetime import datetime
-from time import gmtime
from sfa.util.faults import SliverDoesNotExist, UnknownSfaType
from sfa.util.sfalogging import logger
from sfa.rspecs.version_manager import VersionManager
from sfa.rspecs.rspec import RSpec
-from sfa.util.xrn import hrn_to_urn, get_leaf
+from sfa.util.xrn import hrn_to_urn
## thierry: everything that is API-related (i.e. handling incoming requests)
# GetNodes or GetSites sorts of calls directly
# and thus minimize the differences in the managers with the pl version
class SlabDriver(Driver):
-
+ """ Senslab Driver class inherited from Driver generic class.
+
+ Contains methods compliant with the SFA standard and the testbed
+ infrastructure (calls to LDAP and OAR).
+ """
def __init__(self, config):
Driver.__init__ (self, config)
self.config = config
self.hrn = config.SFA_INTERFACE_HRN
-
self.root_auth = config.SFA_REGISTRY_ROOT_AUTH
-
self.oar = OARrestapi()
self.ldap = LDAPapi()
self.time_format = "%Y-%m-%d %H:%M:%S"
- self.db = SlabDB(config,debug = True)
+ self.db = SlabDB(config, debug = True)
self.cache = None
record.update({'PI':[recuser.hrn],
'researcher': [recuser.hrn],
'name':record['hrn'],
- 'oar_job_id':[rec['oar_job_id'] for rec in recslice_list],
+ 'oar_job_id':[],
'node_ids': [],
'person_ids':[recslice_list[0]['record_id_user']],
'geni_urn':'', #For client_helper.py compatibility
'keys':'', #For client_helper.py compatibility
'key_ids':''}) #For client_helper.py compatibility
+
+ try:
+ for rec in recslice_list:
+ record['oar_job_id'].append(rec['oar_job_id'])
+ except KeyError:
+ pass
- #for rec in recslice_list:
- #record['oar_job_id'].append(rec['oar_job_id'])
logger.debug( "SLABDRIVER.PY \t fill_record_info SLICE \
recslice_list %s \r\n \t RECORD %s \r\n \r\n" %(recslice_list,record))
if str(record['type']) == 'user':
'researcher': [recuser.hrn],
'name':record['hrn'],
'node_ids': [],
- 'oar_job_id': [rec['oar_job_id'] for rec in recslice_list],
- 'person_ids':[recslice_list[0]['record_id_user']]})
+ 'oar_job_id': [],
+ 'person_ids':[recslice_list[0]['record_id_user']]})
+ try:
+ for rec in recslice_list:
+ recslice['oar_job_id'].append(rec['oar_job_id'])
+ except KeyError:
+ pass
+
recslice.update({'type':'slice', \
'hrn':recslice_list[0]['slice_hrn']})
- #for rec in recslice_list:
- #recslice['oar_job_id'].append(rec['oar_job_id'])
+
#GetPersons takes [] as filters
#user_slab = self.GetPersons([{'hrn':recuser.hrn}])