+ def complete_leases_info(self, unfiltered_reservation_list, db_xp_dict):
+
+ """Check that the leases list of dictionaries contains the appropriate
+ fields and piece of information here
+ :param unfiltered_reservation_list: list of leases to be completed.
+ :param db_xp_dict: leases information in the lease_sfa table
+ :returns local_unfiltered_reservation_list: list of leases completed.
+ list of dictionaries describing the leases, with all the needed
+ information (sfa,ldap,nodes)to identify one particular lease.
+ :returns testbed_xp_list: list of experiments'ids running or scheduled
+ on the testbed.
+ :rtype local_unfiltered_reservation_list: list of dict
+ :rtype testbed_xp_list: list
+
+ """
+ testbed_xp_list = []
+ local_unfiltered_reservation_list = list(unfiltered_reservation_list)
+ # slice_hrn and lease_id are in the lease_table,
+ # so they are in the db_xp_dict.
+ # component_id_list : list of nodes xrns
+ # reserved_nodes : list of nodes' hostnames
+ # slice_id : slice urn, can be made from the slice hrn using hrn_to_urn
+ for resa in local_unfiltered_reservation_list:
+
+ #Construct list of scheduled experiments (runing, waiting..)
+ testbed_xp_list.append(resa['lease_id'])
+ #If there is information on the experiment in the lease table
+ #(slice used and experiment id), meaning the experiment was created
+ # using sfa
+ if resa['lease_id'] in db_xp_dict:
+ xp_info = db_xp_dict[resa['lease_id']]
+ logger.debug("CORTEXLAB_API \tGetLeases xp_info %s"
+ % (xp_info))
+ resa['slice_hrn'] = xp_info['slice_hrn']
+ resa['slice_id'] = hrn_to_urn(resa['slice_hrn'], 'slice')
+
+ #otherwise, assume it is a cortexlab slice, created via the
+ # cortexlab portal
+ else:
+ resa['slice_id'] = hrn_to_urn(self.root_auth + '.' +
+ resa['user'] + "_slice", 'slice')
+ resa['slice_hrn'] = Xrn(resa['slice_id']).get_hrn()
+
+ resa['component_id_list'] = []
+ #Transform the hostnames into urns (component ids)
+ for node in resa['reserved_nodes']:
+
+ iotlab_xrn = iotlab_xrn_object(self.root_auth, node)
+ resa['component_id_list'].append(iotlab_xrn.urn)
+
+ return local_unfiltered_reservation_list, testbed_xp_list
+