# % (error))
#raise ServerError("GET_OAR_SRVR : Could not reach OARserver")
if resp.status >= 400:
- raise ValueError ("Response Error %s, %s" %(resp.status,
+ raise ValueError ("Response Error %s, %s, %s" %(resp.status,
resp.reason, resp.read()))
try:
js_dict = json.loads(body)
conn.close()
if resp.status >= 400:
- raise ValueError ("Response Error %s, %s" %(resp.status,
+ raise ValueError ("Response Error %s, %s, %s" %(resp.status,
resp.reason, body))
# XXX JORDAN XXX slice_record devrait recevoir le caller_xrn...
# LOIC maintenant c'est fait au dessus
- logger.debug("LOIC - slice_record[user] = %s" % slice_record['user'])
+ logger.debug("IOTLABDRIVER.PY - LOIC - slice_record[user][hrn] = %s" % slice_record['user']['hrn'])
+ logger.debug("IOTLABDRIVER.PY - LOIC - slice_record[reg-researchers] = %s" % slice_record['reg-researchers'])
persons = slices.verify_persons(xrn.hrn, slice_record, users,
options=options)
logger.debug("IOTLABDRIVER.PY AFTER slices.verify_persons")
logger.debug("LOIC - slice_record[user] = %s" % slice_record['user'])
+ logger.debug("IOTLABDRIVER.PY - LOIC - slice_record[reg-researchers] = %s" % slice_record['reg-researchers'])
# ensure slice record exists
current_slice = slices.verify_slice(xrn.hrn, slice_record, sfa_peer)
logger.debug("LOIC - AFTER verify_slice - slice_record[user] = %s" % slice_record['user'])
+ logger.debug("IOTLABDRIVER.PY - LOIC - slice_record[reg-researchers] = %s" % slice_record['reg-researchers'])
logger.debug("IOTLABDRIVER.PY \t ===============allocate \t\
\r\n \r\n current_slice %s" % (current_slice))
sfa_slice = None
# check if slice belongs to Iotlab
- slices_list = self.driver.GetSlices(slice_filter=slicename,
- slice_filter_type='slice_hrn')
-
- if slices_list:
- for sl in slices_list:
-
- logger.debug("IOTLABSLICES \t verify_slice slicename %s \
- slices_list %s sl %s \r slice_record %s"
- % (slicename, slices_list, sl, slice_record))
- sfa_slice = sl
- sfa_slice.update(slice_record)
+ if slicename.startswith("iotlab"):
+ slices_list = self.driver.GetSlices(slice_filter=slicename,
+ slice_filter_type='slice_hrn')
+
+ if slices_list:
+ for sl in slices_list:
+
+ logger.debug("IOTLABSLICES \t verify_slice slicename %s \
+ slices_list %s sl %s \r slice_record %s"
+ % (slicename, slices_list, sl, slice_record))
+ sfa_slice = sl
+ sfa_slice.update(slice_record)
else:
#Search for user in ldap based on email SA 14/11/12
"""
- slice_user = slice_record['user']
+ slice_user = slice_record['user']['hrn']
if options is None: options={}
logger.debug("IOTLABSLICES \tverify_persons \tslice_hrn %s \
#users_dict : dict whose keys can either be the user's hrn or its id.
#Values contains only id and hrn
users_dict = {}
-
+
+ # XXX LOIC !!! Fix: Only 1 user per slice in iotlab
+ users = [slice_record['user']]
#First create dicts by hrn and id for each user in the user record list:
for info in users:
# if 'slice_record' in info:
users_by_email[info['email']] = info
users_dict[info['email']] = info
- logger.debug("IOTLABSLICES.PY \t verify_person \
- users_dict %s \r\n user_by_email %s \r\n "
- % (users_dict, users_by_email))
+ #logger.debug("IOTLABSLICES.PY \t verify_person \
+ # users_dict %s \r\n user_by_email %s \r\n "
+ # % (users_dict, users_by_email))
existing_user_ids = []
existing_user_emails = []
if existing_users:
for user in existing_users:
user['login'] = user['uid']
- users_dict[user['email']].update(user)
- existing_user_emails.append(
- users_dict[user['email']]['email'])
+ # XXX LOIC Fix we already have all informations comming from Allocate
+ #users_dict[user['email']].update(user)
+ #existing_user_emails.append(
+ # users_dict[user['email']]['email'])
logger.debug("User is in iotlab LDAP slice_record[user] = %s" % slice_user)
# User from another known trusted federated site. Check
# add new users
#requested_user_email is in existing_user_emails
if len(added_user_emails) == 0:
- slice_record['login'] = users_dict[requested_user_emails[0]]['uid']
+ slice_record['login'] = existing_users[0]['uid']
+ #slice_record['login'] = users_dict[requested_user_emails[0]]['uid']
logger.debug(" IOTLABSLICES \tverify_person QUICK DIRTY %s"
% (slice_record))
# XXX JORDAN uid == 'register'