SA bug hunt
authorSandrine Avakian <sandrine.avakian@inria.fr>
Mon, 24 Jun 2013 12:58:34 +0000 (14:58 +0200)
committerMohamed Larabi <mohamed.larabi@inria.fr>
Fri, 26 Jul 2013 15:55:55 +0000 (17:55 +0200)
sfa/importer/iotlabimporter.py
sfa/iotlab/LDAPapi.py
sfa/iotlab/iotlabaggregate.py
sfa/iotlab/iotlabapi.py
sfa/iotlab/iotlabdriver.py

index f97cd3a..6200435 100644 (file)
@@ -15,10 +15,17 @@ from sqlalchemy.exc import SQLAlchemyError
 
 
 
+<<<<<<< HEAD:sfa/importer/iotlabimporter.py
 class IotlabImporter:
     """
     IotlabImporter class, generic importer_class. Used to populate the SFA DB
     with iotlab resources' records.
+=======
+class SlabImporter:
+    """
+    SlabImporter class, generic importer_class. Used to populate the SFA DB
+    with senslab resources' records.
+>>>>>>> 3fe7429... SA:sfa/importer/slabimporter.py
     Used to update records when new resources, users or nodes, are added
     or deleted.
     """
@@ -144,7 +151,11 @@ class IotlabImporter:
             return
         self.records_by_type_hrn [ rec_tuple ] = record
 
+<<<<<<< HEAD:sfa/importer/iotlabimporter.py
     def import_sites_and_nodes(self, iotlabdriver):
+=======
+    def import_sites_and_nodes(self, slabdriver):
+>>>>>>> 3fe7429... SA:sfa/importer/slabimporter.py
         """
 
         Gets all the sites and nodes from OAR, process the information,
@@ -152,6 +163,7 @@ class IotlabImporter:
         For each site, import the site's nodes to the DB by calling
         import_nodes.
 
+<<<<<<< HEAD:sfa/importer/iotlabimporter.py
         :param iotlabdriver: IotlabDriver object, used to have access to iotlabdriver
         methods and fetching info on sites and nodes.
         :type iotlabdriver: IotlabDriver
@@ -159,6 +171,15 @@ class IotlabImporter:
 
         sites_listdict  = iotlabdriver.iotlab_api.GetSites()
         nodes_listdict  = iotlabdriver.iotlab_api.GetNodes()
+=======
+        :param slabdriver: SlabDriver object, used to have access to slabdriver
+        methods and fetching info on sites and nodes.
+        :type slabdriver: SlabDriver
+        """
+
+        sites_listdict  = slabdriver.slab_api.GetSites()
+        nodes_listdict  = slabdriver.slab_api.GetNodes()
+>>>>>>> 3fe7429... SA:sfa/importer/slabimporter.py
         nodes_by_id = dict([(node['node_id'], node) for node in nodes_listdict])
         for site in sites_listdict:
             site_hrn = site['name']
@@ -177,14 +198,22 @@ class IotlabImporter:
                     site_record.just_created()
                     dbsession.add(site_record)
                     dbsession.commit()
+<<<<<<< HEAD:sfa/importer/iotlabimporter.py
                     self.logger.info("IotlabImporter: imported authority (site) \
+=======
+                    self.logger.info("SlabImporter: imported authority (site) \
+>>>>>>> 3fe7429... SA:sfa/importer/slabimporter.py
                          %s" % site_record)
                     self.update_just_added_records_dict(site_record)
                 except SQLAlchemyError:
                     # if the site import fails then there is no point in
                     # trying to import the
                     # site's child records(node, slices, persons), so skip them.
+<<<<<<< HEAD:sfa/importer/iotlabimporter.py
                     self.logger.log_exc("IotlabImporter: failed to import site. \
+=======
+                    self.logger.log_exc("SlabImporter: failed to import site. \
+>>>>>>> 3fe7429... SA:sfa/importer/slabimporter.py
                         Skipping child records")
                     continue
             else:
@@ -193,11 +222,19 @@ class IotlabImporter:
 
 
             site_record.stale = False
+<<<<<<< HEAD:sfa/importer/iotlabimporter.py
             self.import_nodes(site['node_ids'], nodes_by_id, iotlabdriver)
 
             return
 
     def import_nodes(self, site_node_ids, nodes_by_id, iotlabdriver):
+=======
+            self.import_nodes(site['node_ids'], nodes_by_id, slabdriver)
+
+            return
+
+    def import_nodes(self, site_node_ids, nodes_by_id, slabdriver):
+>>>>>>> 3fe7429... SA:sfa/importer/slabimporter.py
         """
 
         Creates appropriate hostnames and RegNode records for
@@ -212,7 +249,11 @@ class IotlabImporter:
         :type nodes_by_id: dictionary
         :param iotlabdriver:IotlabDriver object, used to have access to iotlabdriver
         attributes.
+<<<<<<< HEAD:sfa/importer/iotlabimporter.py
         :type iotlabdriver:IotlabDriver
+=======
+        :type slabdriver:SlabDriver
+>>>>>>> 3fe7429... SA:sfa/importer/slabimporter.py
 
         """
 
@@ -226,7 +267,11 @@ class IotlabImporter:
             escaped_hrn =  \
             self.hostname_to_hrn_escaped(iotlabdriver.iotlab_api.root_auth, \
             node['hostname'])
+<<<<<<< HEAD:sfa/importer/iotlabimporter.py
             self.logger.info("IOTLABIMPORTER node %s " %(node))
+=======
+            self.logger.info("SLABIMPORTER node %s " %(node))
+>>>>>>> 3fe7429... SA:sfa/importer/slabimporter.py
             hrn =  node['hrn']
 
 
@@ -241,7 +286,11 @@ class IotlabImporter:
                     self.auth_hierarchy.create_gid(urn, \
                     create_uuid(), pkey)
 
+<<<<<<< HEAD:sfa/importer/iotlabimporter.py
                 def iotlab_get_authority(hrn):
+=======
+                def slab_get_authority(hrn):
+>>>>>>> 3fe7429... SA:sfa/importer/slabimporter.py
                     return hrn.split(".")[0]
 
                 node_record = RegNode(hrn=hrn, gid=node_gid,
@@ -252,26 +301,44 @@ class IotlabImporter:
                     node_record.just_created()
                     dbsession.add(node_record)
                     dbsession.commit()
+<<<<<<< HEAD:sfa/importer/iotlabimporter.py
                     self.logger.info("IotlabImporter: imported node: %s" \
                                 % node_record)
                     self.update_just_added_records_dict(node_record)
                 except SQLAlchemyError:
                     self.logger.log_exc("IotlabImporter: \
+=======
+                    self.logger.info("SlabImporter: imported node: %s" \
+                                % node_record)
+                    self.update_just_added_records_dict(node_record)
+                except SQLAlchemyError:
+                    self.logger.log_exc("SlabImporter: \
+>>>>>>> 3fe7429... SA:sfa/importer/slabimporter.py
                                     failed to import node")
             else:
                 #TODO:  xxx update the record ...
                 pass
             node_record.stale = False
+<<<<<<< HEAD:sfa/importer/iotlabimporter.py
 
 
     def init_person_key (self, person, iotlab_key):
+=======
+
+
+    def init_person_key (self, person, slab_key):
+>>>>>>> 3fe7429... SA:sfa/importer/slabimporter.py
         """
 
         Returns a tuple pubkey and pkey.
 
         :param person Person's data.
         :type person: dict
+<<<<<<< HEAD:sfa/importer/iotlabimporter.py
         :param iotlab_key: SSH public key, from LDAP user's data.
+=======
+        :param slab_key: SSH public key, from LDAP user's data.
+>>>>>>> 3fe7429... SA:sfa/importer/slabimporter.py
         RSA type supported.
         :type iotlab_key: string
         :rtype (string, Keypair)
@@ -279,7 +346,11 @@ class IotlabImporter:
         pubkey = None
         if  person['pkey']:
             # randomly pick first key in set
+<<<<<<< HEAD:sfa/importer/iotlabimporter.py
             pubkey = iotlab_key
+=======
+            pubkey = slab_key
+>>>>>>> 3fe7429... SA:sfa/importer/slabimporter.py
 
             try:
                 pkey = convert_public_key(pubkey)
@@ -299,7 +370,11 @@ class IotlabImporter:
         return (pubkey, pkey)
 
 
+<<<<<<< HEAD:sfa/importer/iotlabimporter.py
     def import_persons_and_slices(self, iotlabdriver):
+=======
+    def import_persons_and_slices(self, slabdriver):
+>>>>>>> 3fe7429... SA:sfa/importer/slabimporter.py
         """
 
         Gets user data from LDAP, process the information.
@@ -310,18 +385,31 @@ class IotlabImporter:
         import the user's slice onto the database as well by calling
         import_slice.
 
+<<<<<<< HEAD:sfa/importer/iotlabimporter.py
         :param iotlabdriver:IotlabDriver object, used to have access to iotlabdriver
+=======
+        :param slabdriver:SlabDriver object, used to have access to slabdriver
+>>>>>>> 3fe7429... SA:sfa/importer/slabimporter.py
         attributes.
         :type iotlabdriver:IotlabDriver
         """
+<<<<<<< HEAD:sfa/importer/iotlabimporter.py
         ldap_person_listdict = iotlabdriver.iotlab_api.GetPersons()
         self.logger.info("IOTLABIMPORT \t ldap_person_listdict %s \r\n" \
+=======
+        ldap_person_listdict = slabdriver.slab_api.GetPersons()
+        self.logger.info("SLABIMPORT \t ldap_person_listdict %s \r\n" \
+>>>>>>> 3fe7429... SA:sfa/importer/slabimporter.py
                 %(ldap_person_listdict))
 
          # import persons
         for person in ldap_person_listdict :
 
+<<<<<<< HEAD:sfa/importer/iotlabimporter.py
             self.logger.info("IotlabImporter: person :" %(person))
+=======
+            self.logger.info("SlabImporter: person :" %(person))
+>>>>>>> 3fe7429... SA:sfa/importer/slabimporter.py
             if 'ssh-rsa' not in person['pkey']:
                 #people with invalid ssh key (ssh-dss, empty, bullshit keys...)
                 #won't be imported
@@ -335,13 +423,21 @@ class IotlabImporter:
             person_urn = hrn_to_urn(person_hrn, 'user')
 
 
+<<<<<<< HEAD:sfa/importer/iotlabimporter.py
             self.logger.info("IotlabImporter: users_rec_by_email %s " \
+=======
+            self.logger.info("SlabImporter: users_rec_by_email %s " \
+>>>>>>> 3fe7429... SA:sfa/importer/slabimporter.py
                                             %(self.users_rec_by_email))
 
             #Check if user using person['email'] from LDAP is already registered
             #in SFA. One email = one person. In this case, do not create another
             #record for this person
+<<<<<<< HEAD:sfa/importer/iotlabimporter.py
             #person_hrn returned by GetPerson based on iotlab root auth +
+=======
+            #person_hrn returned by GetPerson based on senslab root auth +
+>>>>>>> 3fe7429... SA:sfa/importer/slabimporter.py
             #uid ldap
             user_record = self.find_record_by_type_hrn('user', person_hrn)
 
@@ -353,7 +449,11 @@ class IotlabImporter:
 
             slice_record = self.find_record_by_type_hrn ('slice', slice_hrn)
 
+<<<<<<< HEAD:sfa/importer/iotlabimporter.py
             iotlab_key = person['pkey']
+=======
+            slab_key = person['pkey']
+>>>>>>> 3fe7429... SA:sfa/importer/slabimporter.py
             # new person
             if not user_record:
                 (pubkey, pkey) = self.init_person_key(person, iotlab_key)
@@ -391,7 +491,11 @@ class IotlabImporter:
                             self.update_just_added_records_dict( user_record )
 
                         except SQLAlchemyError:
+<<<<<<< HEAD:sfa/importer/iotlabimporter.py
                             self.logger.log_exc("IotlabImporter: \
+=======
+                            self.logger.log_exc("SlabImporter: \
+>>>>>>> 3fe7429... SA:sfa/importer/slabimporter.py
                                 failed to import person  %s"%(person))
             else:
                 # update the record ?
@@ -400,7 +504,11 @@ class IotlabImporter:
                 sfa_keys = user_record.reg_keys
 
                 new_key = False
+<<<<<<< HEAD:sfa/importer/iotlabimporter.py
                 if iotlab_key is not sfa_keys :
+=======
+                if slab_key is not sfa_keys :
+>>>>>>> 3fe7429... SA:sfa/importer/slabimporter.py
                     new_key = True
                 if new_key:
                     self.logger.info("IotlabImporter: \t \t USER UPDATE \
@@ -423,7 +531,11 @@ class IotlabImporter:
                 dbsession.commit()
                 user_record.stale = False
             except SQLAlchemyError:
+<<<<<<< HEAD:sfa/importer/iotlabimporter.py
                 self.logger.log_exc("IotlabImporter: \
+=======
+                self.logger.log_exc("SlabImporter: \
+>>>>>>> 3fe7429... SA:sfa/importer/slabimporter.py
                 failed to update person  %s"%(person))
 
             self.import_slice(slice_hrn, slice_record, user_record)
@@ -465,9 +577,15 @@ class IotlabImporter:
                 self.update_just_added_records_dict ( slice_record )
 
             except SQLAlchemyError:
+<<<<<<< HEAD:sfa/importer/iotlabimporter.py
                 self.logger.log_exc("IotlabImporter: failed to import slice")
 
         #No slice update upon import in iotlab
+=======
+                self.logger.log_exc("SlabImporter: failed to import slice")
+
+        #No slice update upon import in senslab
+>>>>>>> 3fe7429... SA:sfa/importer/slabimporter.py
         else:
             # xxx update the record ...
             self.logger.warning ("Slice update not yet implemented")
@@ -480,7 +598,11 @@ class IotlabImporter:
             dbsession.commit()
             slice_record.stale = False
         except SQLAlchemyError:
+<<<<<<< HEAD:sfa/importer/iotlabimporter.py
             self.logger.log_exc("IotlabImporter: failed to update slice")
+=======
+            self.logger.log_exc("SlabImporter: failed to update slice")
+>>>>>>> 3fe7429... SA:sfa/importer/slabimporter.py
 
 
     def run (self, options):
@@ -494,6 +616,7 @@ class IotlabImporter:
         """
         config = Config()
 
+<<<<<<< HEAD:sfa/importer/iotlabimporter.py
         iotlabdriver = IotlabDriver(config)
 
         #Create special slice table for iotlab
@@ -512,6 +635,26 @@ class IotlabImporter:
         # special records must be preserved
         system_hrns = [iotlabdriver.hrn, iotlabdriver.iotlab_api.root_auth,  \
                                         iotlabdriver.hrn+ '.slicemanager']
+=======
+        slabdriver = SlabDriver(config)
+
+        #Create special slice table for senslab
+
+        if not slabdriver.db.exists('slab_xp'):
+            slabdriver.db.createtable()
+            self.logger.info ("SlabImporter.run:  slab_xp table created ")
+
+
+        # import site and node records in site into the SFA db.
+        self.import_sites_and_nodes(slabdriver)
+        #import users and slice into the SFA DB.
+        self.import_persons_and_slices(slabdriver)
+
+         ### remove stale records
+        # special records must be preserved
+        system_hrns = [slabdriver.hrn, slabdriver.slab_api.root_auth,  \
+                                        slabdriver.hrn+ '.slicemanager']
+>>>>>>> 3fe7429... SA:sfa/importer/slabimporter.py
         for record in self.all_records:
             if record.hrn in system_hrns:
                 record.stale = False
index 75649e3..8b1503a 100644 (file)
@@ -62,7 +62,11 @@ class ldap_co:
         try:
             self.ldapserv = ldap.open(self.ldapHost)
         except ldap.LDAPError, error:
+<<<<<<< HEAD:sfa/iotlab/LDAPapi.py
             return {'bool': False, 'message': error}
+=======
+            return {'bool' : False, 'message' : error }
+>>>>>>> 3fe7429... SA:sfa/senslab/LDAPapi.py
 
         # Bind with authentification
         if(bind):
@@ -73,7 +77,10 @@ class ldap_co:
 
     def bind(self):
         """ Binding method.
+<<<<<<< HEAD:sfa/iotlab/LDAPapi.py
 
+=======
+>>>>>>> 3fe7429... SA:sfa/senslab/LDAPapi.py
         :return: dictionary with the bind status. True if Successful,
         False if not and in this case the error message( {'bool', 'message'} )
         :rtype: dict
@@ -102,8 +109,12 @@ class ldap_co:
         try:
             self.ldapserv.unbind_s()
         except ldap.LDAPError, error:
+<<<<<<< HEAD:sfa/iotlab/LDAPapi.py
             return {'bool': False, 'message': error}
 
+=======
+            return {'bool' : False, 'message' : error }
+>>>>>>> 3fe7429... SA:sfa/senslab/LDAPapi.py
 
 class LoginPassword():
     """
@@ -117,10 +128,14 @@ class LoginPassword():
 
         Sets password  and login maximum length, and defines the characters
         that can be found in a random generated password.
+<<<<<<< HEAD:sfa/iotlab/LDAPapi.py
 
+=======
+>>>>>>> 3fe7429... SA:sfa/senslab/LDAPapi.py
         """
         self.login_max_length = 8
         self.length_password = 8
+<<<<<<< HEAD:sfa/iotlab/LDAPapi.py
         self.chars_password = ['!', '$', '(',')', '*', '+', ',', '-', '.',
                                '0', '1', '2', '3', '4', '5', '6', '7', '8',
                                '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
@@ -130,6 +145,20 @@ class LoginPassword():
                                'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q',
                                'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
                                '\'']
+=======
+        self.chars_password = [ '!', '$', '(',')', '*', '+', ',', '-', '.', \
+                                '0', '1', '2', '3', '4', '5', '6', '7', '8', \
+                                '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', \
+                                'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', \
+                                'R', 'S', 'T',  'U', 'V', 'W', 'X', 'Y', 'Z', \
+                                '_', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', \
+                                'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p' ,'q', \
+                                'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', \
+                                '\'']
+
+
+
+>>>>>>> 3fe7429... SA:sfa/senslab/LDAPapi.py
 
     @staticmethod
     def clean_user_names(record):
@@ -147,6 +176,7 @@ class LoginPassword():
         """
         if 'first_name' in record and 'last_name' in record:
             #Remove all special characters from first_name/last name
+<<<<<<< HEAD:sfa/iotlab/LDAPapi.py
             lower_first_name = record['first_name'].replace('-', '')\
                 .replace('_', '').replace('[', '')\
                 .replace(']', '').replace(' ', '')\
@@ -155,6 +185,16 @@ class LoginPassword():
                 .replace('_', '').replace('[', '')\
                 .replace(']', '').replace(' ', '')\
                 .lower()
+=======
+            lower_first_name = record['first_name'].replace('-','')\
+                                            .replace('_','').replace('[','')\
+                                            .replace(']','').replace(' ','')\
+                                            .lower()
+            lower_last_name = record['last_name'].replace('-','')\
+                                            .replace('_','').replace('[','')\
+                                            .replace(']','').replace(' ','')\
+                                            .lower()
+>>>>>>> 3fe7429... SA:sfa/senslab/LDAPapi.py
             return lower_first_name, lower_last_name
         else:
             return None, None
@@ -288,7 +328,11 @@ class LoginPassword():
         :return: Returns encrypted password.
         :rtype:string
         """
+<<<<<<< HEAD:sfa/iotlab/LDAPapi.py
         #Keep consistency with Java Iotlab's LDAP API
+=======
+        #Keep consistency with Java Senslab's LDAP API
+>>>>>>> 3fe7429... SA:sfa/senslab/LDAPapi.py
         #RFC2307SSHAPasswordEncryptor so set the salt size to 8 bytes
         return lssha.encrypt(password, salt_size = 8)
 
@@ -320,17 +364,26 @@ class LDAPapi :
 
     def LdapGenerateUniqueLogin(self, record):
         """
+<<<<<<< HEAD:sfa/iotlab/LDAPapi.py
 
         Generate login for adding a new user in LDAP Directory
         (four characters minimum length). Get proper last name and
         first name so that the user's login can be generated.
 
+=======
+        Generate login for adding a new user in LDAP Directory
+        (four characters minimum length). Get proper last name and
+        first name so that the user's login can be generated.
+>>>>>>> 3fe7429... SA:sfa/senslab/LDAPapi.py
         :param record: Record must contain first_name and last_name.
         :param record: dict
         :return: the generated login for the user described with record if the
         login generation is successful, None if it fails.
         :rtype: string or None
+<<<<<<< HEAD:sfa/iotlab/LDAPapi.py
 
+=======
+>>>>>>> 3fe7429... SA:sfa/senslab/LDAPapi.py
         """
         #For compatibility with other ldap func
         if 'mail' in record and 'email' not in record:
@@ -436,8 +489,13 @@ class LDAPapi :
 
             #Hrn should not be part of the filter because the hrn
             #presented by a certificate of a SFA user not imported in
+<<<<<<< HEAD:sfa/iotlab/LDAPapi.py
             #Iotlab  does not include the iotlab login in it
             #Plus, the SFA user may already have an account with iotlab
+=======
+            #Senslab  does not include the senslab login in it
+            #Plus, the SFA user may already have an account with senslab
+>>>>>>> 3fe7429... SA:sfa/senslab/LDAPapi.py
             #using another login.
 
 
@@ -458,7 +516,11 @@ class LDAPapi :
         return req_ldap
 
     def make_ldap_attributes_from_record(self, record):
+<<<<<<< HEAD:sfa/iotlab/LDAPapi.py
         """When adding a new user to Iotlab's LDAP, creates an attributes
+=======
+        """When adding a new user to Senslab's LDAP, creates an attributes
+>>>>>>> 3fe7429... SA:sfa/senslab/LDAPapi.py
         dictionnary from the SFA record understandable by LDAP.
         Generates the user's LDAP login.
         User is automatically validated (account enabled) and described
@@ -507,10 +569,17 @@ class LDAPapi :
 
 
         #Password is automatically generated because SFA user don't go
+<<<<<<< HEAD:sfa/iotlab/LDAPapi.py
         #through the Iotlab website  used to register new users,
         #There is no place in SFA where users can enter such information
         #yet.
         #If the user wants to set his own password , he must go to the Iotlab
+=======
+        #through the Senslab website  used to register new users,
+        #There is no place in SFA where users can enter such information
+        #yet.
+        #If the user wants to set his own password , he must go to the Senslab
+>>>>>>> 3fe7429... SA:sfa/senslab/LDAPapi.py
         #website.
         password = self.login_pwd.generate_password()
         attrs['userPassword'] = self.login_pwd.encrypt_password(password)
@@ -581,7 +650,11 @@ class LDAPapi :
 
             except ldap.LDAPError, error:
                 logger.log_exc("LDAP Add Error %s" %error)
+<<<<<<< HEAD:sfa/iotlab/LDAPapi.py
                 return {'bool': False, 'message': error}
+=======
+                return {'bool' : False, 'message' : error }
+>>>>>>> 3fe7429... SA:sfa/senslab/LDAPapi.py
 
             self.conn.close()
             return {'bool': True, 'uid':user_ldap_attrs['uid']}
@@ -850,7 +923,11 @@ class LDAPapi :
                                             %(error))
                 return
 
+<<<<<<< HEAD:sfa/iotlab/LDAPapi.py
         return results
+=======
+            return results
+>>>>>>> 3fe7429... SA:sfa/senslab/LDAPapi.py
 
     def _process_ldap_info_for_one_user(self, record, result_data):
         """
@@ -882,9 +959,15 @@ class LDAPapi :
             parent_hrn = get_authority(hrn)
             if parent_hrn != self.authname:
                 peer_authority = parent_hrn
+<<<<<<< HEAD:sfa/iotlab/LDAPapi.py
             #In case the user was not imported from Iotlab LDAP
             #but from another federated site, has an account in
             #iotlab but currently using his hrn from federated site
+=======
+            #In case the user was not imported from Senslab LDAP
+            #but from another federated site, has an account in
+            #senslab but currently using his hrn from federated site
+>>>>>>> 3fe7429... SA:sfa/senslab/LDAPapi.py
             #then the login is different from the one found in its hrn
             if tmpname != hrn.split('.')[1]:
                 hrn = None
@@ -916,12 +999,20 @@ class LDAPapi :
                      expected_fields=None):
         """
         Search a SFA user with a hrn. User should be already registered
+<<<<<<< HEAD:sfa/iotlab/LDAPapi.py
         in Iotlab LDAP.
+=======
+        in Senslab LDAP.
+>>>>>>> 3fe7429... SA:sfa/senslab/LDAPapi.py
         :param record: sfa user's record. Should contain first_name,last_name,
         email or mail. If no record is provided, returns all the users found
         in LDAP.
         :type record: dict
+<<<<<<< HEAD:sfa/iotlab/LDAPapi.py
         :param is_user_enabled: is the user's iotlab account already valid.
+=======
+        :param is_user_enabled: is the user's senslab account already valid.
+>>>>>>> 3fe7429... SA:sfa/senslab/LDAPapi.py
         :type is_user_enabled: Boolean.
         :return: LDAP entries from ldap matching the filter provided. Returns
         a single entry if one filter has been given and a list of
index 26c6764..73fca1b 100644 (file)
@@ -23,9 +23,15 @@ def iotlab_xrn_to_hostname(xrn):
 
 def iotlab_xrn_object(root_auth, hostname):
     """Attributes are urn and hrn.
+<<<<<<< HEAD:sfa/iotlab/iotlabaggregate.py
     Get the hostname using iotlab_xrn_to_hostname on the urn.
 
     :return: the iotlab node's xrn
+=======
+    Get the hostname using slab_xrn_to_hostname on the urn.
+
+    :return: the senslab node's xrn
+>>>>>>> 3fe7429... SA:sfa/senslab/slabaggregate.py
     :rtype: Xrn
     """
     return Xrn('.'.join( [root_auth, Xrn.escape(hostname)]), type='node')
@@ -57,14 +63,22 @@ class IotlabAggregate:
 
 
         :param slice_xrn: xrn of the slice
+<<<<<<< HEAD:sfa/iotlab/iotlabaggregate.py
         :param login: user's login on iotlab ldap
+=======
+        :param login: user's login on senslab ldap
+>>>>>>> 3fe7429... SA:sfa/senslab/slabaggregate.py
 
         :type slice_xrn: string
         :type login: string
         :reutnr : a list of slices dict and a dictionary of Sliver object
         :rtype: (list, dict)
 
+<<<<<<< HEAD:sfa/iotlab/iotlabaggregate.py
         ..note: There is no slivers in iotlab, only leases.
+=======
+        ..note: There is no slivers in senslab, only leases.
+>>>>>>> 3fe7429... SA:sfa/senslab/slabaggregate.py
 
         """
         slivers = {}
@@ -101,15 +115,24 @@ class IotlabAggregate:
                 sliver_xrn.set_authority(self.driver.hrn)
                 sliver = Sliver({'sliver_id':sliver_xrn.urn,
                                 'name': sfa_slice['hrn'],
+<<<<<<< HEAD:sfa/iotlab/iotlabaggregate.py
                                 'type': 'iotlab-node',
+=======
+                                'type': 'slab-node',
+>>>>>>> 3fe7429... SA:sfa/senslab/slabaggregate.py
                                 'tags': []})
 
                 slivers[node] = sliver
 
 
         #Add default sliver attribute :
+<<<<<<< HEAD:sfa/iotlab/iotlabaggregate.py
         #connection information for iotlab
         if get_authority (sfa_slice['hrn']) == self.driver.iotlab_api.root_auth:
+=======
+        #connection information for senslab
+        if get_authority (sfa_slice['hrn']) == self.driver.slab_api.root_auth:
+>>>>>>> 3fe7429... SA:sfa/senslab/slabaggregate.py
             tmp = sfa_slice['hrn'].split('.')
             ldap_username = tmp[1].split('_')[0]
             ssh_access = None
@@ -138,16 +161,27 @@ class IotlabAggregate:
         #tags_filter = {}
 
         # get the granularity in second for the reservation system
+<<<<<<< HEAD:sfa/iotlab/iotlabaggregate.py
         grain = self.driver.iotlab_api.GetLeaseGranularity()
 
 
         nodes = self.driver.iotlab_api.GetNodes()
+=======
+        grain = self.driver.slab_api.GetLeaseGranularity()
+
+
+        nodes = self.driver.slab_api.GetNodes()
+>>>>>>> 3fe7429... SA:sfa/senslab/slabaggregate.py
         #geni_available = options.get('geni_available')
         #if geni_available:
             #filter['boot_state'] = 'boot'
 
         #filter.update({'peer_id': None})
+<<<<<<< HEAD:sfa/iotlab/iotlabaggregate.py
         #nodes = self.driver.iotlab_api.GetNodes(filter['hostname'])
+=======
+        #nodes = self.driver.slab_api.GetNodes(filter['hostname'])
+>>>>>>> 3fe7429... SA:sfa/senslab/slabaggregate.py
 
         #site_ids = []
         #interface_ids = []
@@ -182,14 +216,22 @@ class IotlabAggregate:
                 #for node in one_slice['node_ids']:
                     #slice_nodes_list.append(node)
 
+<<<<<<< HEAD:sfa/iotlab/iotlabaggregate.py
         reserved_nodes = self.driver.iotlab_api.GetNodesCurrentlyInUse()
+=======
+        reserved_nodes = self.driver.slab_api.GetNodesCurrentlyInUse()
+>>>>>>> 3fe7429... SA:sfa/senslab/slabaggregate.py
         logger.debug("SLABAGGREGATE api get_nodes slice_nodes_list  %s "\
                                                         %(slice_nodes_list))
         for node in nodes:
             nodes_dict[node['node_id']] = node
             if slice_nodes_list == [] or node['hostname'] in slice_nodes_list:
 
+<<<<<<< HEAD:sfa/iotlab/iotlabaggregate.py
                 rspec_node = IotlabNode()
+=======
+                rspec_node = SlabNode()
+>>>>>>> 3fe7429... SA:sfa/senslab/slabaggregate.py
                 # xxx how to retrieve site['login_base']
                 #site_id=node['site_id']
                 #site=sites_dict[site_id]
@@ -198,16 +240,27 @@ class IotlabAggregate:
                 rspec_node['archi'] = node['archi']
                 rspec_node['radio'] = node['radio']
 
+<<<<<<< HEAD:sfa/iotlab/iotlabaggregate.py
                 iotlab_xrn = iotlab_xrn_object(self.driver.iotlab_api.root_auth, \
                                                     node['hostname'])
                 rspec_node['component_id'] = iotlab_xrn.urn
+=======
+                slab_xrn = slab_xrn_object(self.driver.slab_api.root_auth, \
+                                                    node['hostname'])
+                rspec_node['component_id'] = slab_xrn.urn
+>>>>>>> 3fe7429... SA:sfa/senslab/slabaggregate.py
                 rspec_node['component_name'] = node['hostname']
                 rspec_node['component_manager_id'] = \
                                 hrn_to_urn(self.driver.iotlab_api.root_auth, \
                                 'authority+sa')
 
+<<<<<<< HEAD:sfa/iotlab/iotlabaggregate.py
                 # Iotlab's nodes are federated : there is only one authority
                 # for all Iotlab sites, registered in SFA.
+=======
+                # Senslab's nodes are federated : there is only one authority
+                # for all Senslab sites, registered in SFA.
+>>>>>>> 3fe7429... SA:sfa/senslab/slabaggregate.py
                 # Removing the part including the site
                 # in authority_id SA 27/07/12
                 rspec_node['authority_id'] = rspec_node['component_manager_id']
@@ -229,7 +282,11 @@ class IotlabAggregate:
                 rspec_node['location'] = location
 
 
+<<<<<<< HEAD:sfa/iotlab/iotlabaggregate.py
                 position = IotlabPosition()
+=======
+                position = SlabPosition()
+>>>>>>> 3fe7429... SA:sfa/senslab/slabaggregate.py
                 for field in position :
                     try:
                         position[field] = node[field]
@@ -329,7 +386,11 @@ class IotlabAggregate:
                                                 version.version, 'manifest')
 
         slices, slivers = self.get_slice_and_slivers(slice_xrn, login)
+<<<<<<< HEAD:sfa/iotlab/iotlabaggregate.py
         #at this point sliver may be empty if no iotlab job
+=======
+        #at this point sliver may be empty if no senslab job
+>>>>>>> 3fe7429... SA:sfa/senslab/slabaggregate.py
         #is running for this user/slice.
         rspec = RSpec(version=rspec_version, user_options=options)
 
@@ -356,7 +417,11 @@ class IotlabAggregate:
         #if not options.get('list_leases') or options.get('list_leases')
         #and options['list_leases'] != 'leases':
             nodes = self.get_nodes(slices, slivers)
+<<<<<<< HEAD:sfa/iotlab/iotlabaggregate.py
             logger.debug("\r\n \r\n IotlabAggregate \ lease_option %s \
+=======
+            logger.debug("\r\n \r\n SlabAggregate \ lease_option %s \
+>>>>>>> 3fe7429... SA:sfa/senslab/slabaggregate.py
                                         get rspec  ******* nodes %s"\
                                             %(lease_option, nodes[0]))
 
@@ -394,6 +459,10 @@ class IotlabAggregate:
             leases = self.get_all_leases()
             rspec.version.add_leases(leases)
 
+<<<<<<< HEAD:sfa/iotlab/iotlabaggregate.py
         #logger.debug("IotlabAggregate \tget_rspec ******* rspec_toxml %s \r\n"\
+=======
+        #logger.debug("SlabAggregate \tget_rspec ******* rspec_toxml %s \r\n"\
+>>>>>>> 3fe7429... SA:sfa/senslab/slabaggregate.py
                                             #%(rspec.toxml()))
         return rspec.toxml()
index 0c0f798..66ffec9 100644 (file)
@@ -15,6 +15,11 @@ from sfa.util.xrn import Xrn, hrn_to_urn, get_authority
 from sfa.trust.certificate import Keypair, convert_public_key
 from sfa.trust.gid import create_uuid
 from sfa.trust.hierarchy import Hierarchy
+<<<<<<< HEAD:sfa/iotlab/iotlabapi.py
+=======
+
+from sfa.senslab.slabaggregate import slab_xrn_object
+>>>>>>> 3fe7429... SA:sfa/senslab/slabapi.py
 
 from sfa.iotlab.iotlabaggregate import iotlab_xrn_object
 
@@ -70,7 +75,11 @@ class IotlabTestbedAPI():
                 existing_hrns_by_types[record.type].append(record.hrn)
 
 
+<<<<<<< HEAD:sfa/iotlab/iotlabapi.py
         logger.debug("IOTLABDRIVER \tGetPeer\texisting_hrns_by_types %s "\
+=======
+        logger.debug("SLABDRIVER \tGetPeer\texisting_hrns_by_types %s "\
+>>>>>>> 3fe7429... SA:sfa/senslab/slabapi.py
                                              %( existing_hrns_by_types))
         records_list = []
 
@@ -81,7 +90,11 @@ class IotlabTestbedAPI():
                 for hrn in existing_hrns_by_types['authority']:
                     records_list.append(existing_records[(hrn,'authority')])
 
+<<<<<<< HEAD:sfa/iotlab/iotlabapi.py
             logger.debug("IOTLABDRIVER \tGetPeer \trecords_list  %s " \
+=======
+            logger.debug("SLABDRIVER \tGetPeer \trecords_list  %s " \
+>>>>>>> 3fe7429... SA:sfa/senslab/slabapi.py
                                             %(records_list))
 
         except KeyError:
@@ -99,7 +112,11 @@ class IotlabTestbedAPI():
     #over the records' list
     def GetPersons(self, person_filter=None):
         """
+<<<<<<< HEAD:sfa/iotlab/iotlabapi.py
         Get the enabled users and their properties from Iotlab LDAP.
+=======
+        Get the enabled users and their properties from Senslab LDAP.
+>>>>>>> 3fe7429... SA:sfa/senslab/slabapi.py
         If a filter is specified, looks for the user whose properties match
         the filter, otherwise returns the whole enabled users'list.
         :param person_filter: Must be a list of dictionnaries
@@ -118,7 +135,11 @@ class IotlabTestbedAPI():
         #Usually the list contains only one user record
             for searched_attributes in person_filter:
 
+<<<<<<< HEAD:sfa/iotlab/iotlabapi.py
                 #Get only enabled user accounts in iotlab LDAP :
+=======
+                #Get only enabled user accounts in senslab LDAP :
+>>>>>>> 3fe7429... SA:sfa/senslab/slabapi.py
                 #add a filter for make_ldap_filters_from_record
                 person = self.ldap.LdapFindUser(searched_attributes, \
                                 is_user_enabled=True)
@@ -131,7 +152,11 @@ class IotlabTestbedAPI():
                 person_list = None
 
         else:
+<<<<<<< HEAD:sfa/iotlab/iotlabapi.py
             #Get only enabled user accounts in iotlab LDAP :
+=======
+            #Get only enabled user accounts in senslab LDAP :
+>>>>>>> 3fe7429... SA:sfa/senslab/slabapi.py
             #add a filter for make_ldap_filters_from_record
             person_list  = self.ldap.LdapFindUser(is_user_enabled=True)
 
@@ -151,7 +176,11 @@ class IotlabTestbedAPI():
         posting a delete request to OAR.
 
         :param job_id: job id in OAR.
+<<<<<<< HEAD:sfa/iotlab/iotlabapi.py
         :param username: user's iotlab login in LDAP.
+=======
+        :param username: user's senslab login in LDAP.
+>>>>>>> 3fe7429... SA:sfa/senslab/slabapi.py
         :type job_id:integer
         :type username: string
 
@@ -159,7 +188,11 @@ class IotlabTestbedAPI():
         (True) or no (False)
         :rtype: dict
         """
+<<<<<<< HEAD:sfa/iotlab/iotlabapi.py
         logger.debug("IOTLABDRIVER \tDeleteJobs jobid  %s username %s "\
+=======
+        logger.debug("SLABDRIVER \tDeleteJobs jobid  %s username %s "\
+>>>>>>> 3fe7429... SA:sfa/senslab/slabapi.py
                                  %(job_id, username))
         if not job_id or job_id is -1:
             return
@@ -206,7 +239,11 @@ class IotlabTestbedAPI():
                 #return None
 
         #except KeyError:
+<<<<<<< HEAD:sfa/iotlab/iotlabapi.py
             #logger.error("IOTLABDRIVER \tGetJobsId KeyError")
+=======
+            #logger.error("SLABDRIVER \tGetJobsId KeyError")
+>>>>>>> 3fe7429... SA:sfa/senslab/slabapi.py
             #return None
 
         #parsed_job_info  = self.get_info_on_reserved_nodes(job_info, \
@@ -223,7 +260,11 @@ class IotlabTestbedAPI():
     def GetJobsResources(self, job_id, username = None):
         """ Gets the list of nodes associated with the job_id and username
         if provided.
+<<<<<<< HEAD:sfa/iotlab/iotlabapi.py
         Transforms the iotlab hostnames to the corresponding
+=======
+        Transforms the senslab hostnames to the corresponding
+>>>>>>> 3fe7429... SA:sfa/senslab/slabapi.py
         SFA nodes hrns.
         Rertuns dict key :'node_ids' , value : hostnames list
         :param username: user's LDAP login
@@ -240,7 +281,11 @@ class IotlabTestbedAPI():
 
         #Get job resources list from OAR
         node_id_list = self.oar.parser.SendRequest(req, job_id, username)
+<<<<<<< HEAD:sfa/iotlab/iotlabapi.py
         logger.debug("IOTLABDRIVER \t GetJobsResources  %s " %(node_id_list))
+=======
+        logger.debug("SLABDRIVER \t GetJobsResources  %s " %(node_id_list))
+>>>>>>> 3fe7429... SA:sfa/senslab/slabapi.py
 
         hostname_list = \
             self.__get_hostnames_from_oar_node_ids(node_id_list)
@@ -272,11 +317,19 @@ class IotlabTestbedAPI():
                 #reserved_node_hostname_list[index] = \
                         #node_dict[job_info[node_list_name][index]]['hostname']
 
+<<<<<<< HEAD:sfa/iotlab/iotlabapi.py
             #logger.debug("IOTLABDRIVER \t get_info_on_reserved_nodes \
                         #reserved_node_hostname_list %s" \
                         #%(reserved_node_hostname_list))
         #except KeyError:
             #logger.error("IOTLABDRIVER \t get_info_on_reserved_nodes KEYERROR " )
+=======
+            #logger.debug("SLABDRIVER \t get_info_on_reserved_nodes \
+                        #reserved_node_hostname_list %s" \
+                        #%(reserved_node_hostname_list))
+        #except KeyError:
+            #logger.error("SLABDRIVER \t get_info_on_reserved_nodes KEYERROR " )
+>>>>>>> 3fe7429... SA:sfa/senslab/slabapi.py
 
         #return reserved_node_hostname_list
 
@@ -338,7 +391,11 @@ class IotlabTestbedAPI():
     def GetNodes(self, node_filter_dict = None, return_fields_list = None):
         """
 
+<<<<<<< HEAD:sfa/iotlab/iotlabapi.py
         Make a list of iotlab nodes and their properties from information
+=======
+        Make a list of senslab nodes and their properties from information
+>>>>>>> 3fe7429... SA:sfa/senslab/slabapi.py
         given by OAR. Search for specific nodes if some filters are specified.
         Nodes properties returned if no return_fields_list given:
         'hrn','archi','mobile','hostname','site','boot_state','node_id',
@@ -403,7 +460,11 @@ class IotlabTestbedAPI():
                               gid=slice_record['gid'],
                               pointer=slice_record['slice_id'],
                               authority=slice_record['authority'])
+<<<<<<< HEAD:sfa/iotlab/iotlabapi.py
         logger.debug("IOTLABDRIVER.PY AddSlice  sfa_record %s user_record %s"
+=======
+        logger.debug("SLABDRIVER.PY AddSlice  sfa_record %s user_record %s"
+>>>>>>> 3fe7429... SA:sfa/senslab/slabapi.py
                      % (sfa_record, user_record))
         sfa_record.just_created()
         dbsession.add(sfa_record)
@@ -446,7 +507,11 @@ class IotlabTestbedAPI():
 
     #TODO : Check rights to delete person
     def DeletePerson(self, person_record):
+<<<<<<< HEAD:sfa/iotlab/iotlabapi.py
         """ Disable an existing account in iotlab LDAP.
+=======
+        """ Disable an existing account in senslab LDAP.
+>>>>>>> 3fe7429... SA:sfa/senslab/slabapi.py
         Users and techs can only delete themselves. PIs can only
         delete themselves and other non-PIs at their sites.
         ins can delete anyone.
@@ -479,7 +544,11 @@ class IotlabTestbedAPI():
                     delete_failed = []
                 delete_failed.append(job_id)
 
+<<<<<<< HEAD:sfa/iotlab/iotlabapi.py
         logger.info("IOTLABDRIVER DeleteSlice %s  answer %s"%(slice_record, \
+=======
+        logger.info("SLABDRIVER DeleteSlice %s  answer %s"%(slice_record, \
+>>>>>>> 3fe7429... SA:sfa/senslab/slabapi.py
                     delete_failed))
         return delete_failed or True
 
@@ -487,7 +556,11 @@ class IotlabTestbedAPI():
     def __add_person_to_db(user_dict):
         """
         Add a federated user straight to db when the user issues a lease
+<<<<<<< HEAD:sfa/iotlab/iotlabapi.py
         request with iotlab nodes and that he has not registered with iotlab
+=======
+        request with senslab nodes and that he has not registered with senslab
+>>>>>>> 3fe7429... SA:sfa/senslab/slabapi.py
         yet (that is he does not have a LDAP entry yet).
         Uses parts of the routines in SlabImport when importing user from LDAP.
         Called by AddPerson, right after LdapAddUser.
@@ -562,7 +635,11 @@ class IotlabTestbedAPI():
         iotlab ldap, provided that the person_uid is valid.
         Non-admins can only modify their own keys.
 
+<<<<<<< HEAD:sfa/iotlab/iotlabapi.py
         :param person_uid: user's iotlab login in LDAP
+=======
+        :param person_uid: user's senslab login in LDAP
+>>>>>>> 3fe7429... SA:sfa/senslab/slabapi.py
         :param old_attributes_dict: dict with the user's old sshPublicKey
         :param new_key_dict:dict with the user's new sshPublicKey
         :type person_uid: string
@@ -591,7 +668,11 @@ class IotlabTestbedAPI():
         way to handle failure when dealing with multiple job delete. Plus,
         there was no easy way to report it to the user.
         """
+<<<<<<< HEAD:sfa/iotlab/iotlabapi.py
         logger.debug("IOTLABDRIVER DeleteLeases leases_id_list %s slice_hrn %s \
+=======
+        logger.debug("SLABDRIVER DeleteLeases leases_id_list %s slice_hrn %s \
+>>>>>>> 3fe7429... SA:sfa/senslab/slabapi.py
                 \r\n " %(leases_id_list, slice_hrn))
         for job_id in leases_id_list:
             self.DeleteJobs(job_id, slice_hrn)
@@ -714,17 +795,29 @@ class IotlabTestbedAPI():
         lease_dict['time_format'] = self.time_format
 
 
+<<<<<<< HEAD:sfa/iotlab/iotlabapi.py
         logger.debug("IOTLABDRIVER.PY \tLaunchExperimentOnOAR slice_user %s\
+=======
+        logger.debug("SLABDRIVER.PY \tLaunchExperimentOnOAR slice_user %s\
+>>>>>>> 3fe7429... SA:sfa/senslab/slabapi.py
                              \r\n "  %(slice_user))
         #Create the request for OAR
         reqdict = self._create_job_structure_request_for_OAR(lease_dict)
          # first step : start the OAR job and update the job
+<<<<<<< HEAD:sfa/iotlab/iotlabapi.py
         logger.debug("IOTLABDRIVER.PY \tLaunchExperimentOnOAR reqdict %s\
+=======
+        logger.debug("SLABDRIVER.PY \tLaunchExperimentOnOAR reqdict %s\
+>>>>>>> 3fe7429... SA:sfa/senslab/slabapi.py
                              \r\n "  %(reqdict))
 
         answer = self.oar.POSTRequestToOARRestAPI('POST_job', \
                                                 reqdict, slice_user)
+<<<<<<< HEAD:sfa/iotlab/iotlabapi.py
         logger.debug("IOTLABDRIVER \tLaunchExperimentOnOAR jobid  %s " %(answer))
+=======
+        logger.debug("SLABDRIVER \tLaunchExperimentOnOAR jobid  %s " %(answer))
+>>>>>>> 3fe7429... SA:sfa/senslab/slabapi.py
         try:
             jobid = answer['id']
         except KeyError:
@@ -748,7 +841,11 @@ class IotlabTestbedAPI():
                                         lease_start_time, lease_duration):
 
         """Creates a job in OAR corresponding to the information provided
+<<<<<<< HEAD:sfa/iotlab/iotlabapi.py
         as parameters. Adds the job id and the slice hrn in the iotlab
+=======
+        as parameters. Adds the job id and the slice hrn in the senslab
+>>>>>>> 3fe7429... SA:sfa/senslab/slabapi.py
         database so that we are able to know which slice has which nodes.
 
         :param hostname_list: list of nodes' OAR hostnames.
@@ -780,6 +877,7 @@ class IotlabTestbedAPI():
         end_time = lease_start_time + lease_duration
 
 
+<<<<<<< HEAD:sfa/iotlab/iotlabapi.py
         logger.debug("IOTLABDRIVER \r\n \r\n \t AddLeases TURN ON LOGGING SQL \
                         %s %s %s "%(slice_record['hrn'], job_id, end_time))
 
@@ -796,12 +894,34 @@ class IotlabTestbedAPI():
         iotlab_dbsession.commit()
 
         logger.debug("IOTLABDRIVER \t AddLeases hostname_list start_time %s " \
+=======
+        logger.debug("SLABDRIVER \r\n \r\n \t AddLeases TURN ON LOGGING SQL \
+                        %s %s %s "%(slice_record['hrn'], job_id, end_time))
+
+
+        logger.debug("SLABDRIVER \r\n \r\n \t AddLeases %s %s %s " \
+                %(type(slice_record['hrn']), type(job_id), type(end_time)))
+
+        slab_ex_row = SenslabXP(slice_hrn = slice_record['hrn'], \
+                job_id = job_id, end_time= end_time)
+
+        logger.debug("SLABDRIVER \r\n \r\n \t AddLeases slab_ex_row %s" \
+                %(slab_ex_row))
+        slab_dbsession.add(slab_ex_row)
+        slab_dbsession.commit()
+
+        logger.debug("SLABDRIVER \t AddLeases hostname_list start_time %s " \
+>>>>>>> 3fe7429... SA:sfa/senslab/slabapi.py
                 %(start_time))
 
         return
 
 
+<<<<<<< HEAD:sfa/iotlab/iotlabapi.py
     #Delete the jobs from job_iotlab table
+=======
+    #Delete the jobs from job_senslab table
+>>>>>>> 3fe7429... SA:sfa/senslab/slabapi.py
     def DeleteSliceFromNodes(self, slice_record):
         """ Deletes all the running or scheduled jobs of a given slice
         given its record.
@@ -812,7 +932,11 @@ class IotlabTestbedAPI():
         False, for each job id.
         :rtype: dict
         """
+<<<<<<< HEAD:sfa/iotlab/iotlabapi.py
         logger.debug("IOTLABDRIVER \t  DeleteSliceFromNodese %s " %(slice_record))
+=======
+        logger.debug("SLABDRIVER \t  DeleteSliceFromNodese %s " %(slice_record))
+>>>>>>> 3fe7429... SA:sfa/senslab/slabapi.py
 
         if isinstance(slice_record['oar_job_id'], list):
             oar_bool_answer = {}
@@ -830,7 +954,11 @@ class IotlabTestbedAPI():
 
 
     def GetLeaseGranularity(self):
+<<<<<<< HEAD:sfa/iotlab/iotlabapi.py
         """ Returns the granularity of an experiment in the Iotlab testbed.
+=======
+        """ Returns the granularity of an experiment in the Senslab testbed.
+>>>>>>> 3fe7429... SA:sfa/senslab/slabapi.py
         OAR uses seconds for experiments duration , the granulaity is also
         defined in seconds.
         Experiments which last less than 10 min (600 sec) are invalid"""
@@ -857,8 +985,13 @@ class IotlabTestbedAPI():
         deleted_jobs = set_jobs_psql.difference(kept_jobs)
         deleted_jobs = list(deleted_jobs)
         if len(deleted_jobs) > 0:
+<<<<<<< HEAD:sfa/iotlab/iotlabapi.py
             iotlab_dbsession.query(IotlabXP).filter(IotlabXP.job_id.in_(deleted_jobs)).delete(synchronize_session='fetch')
             iotlab_dbsession.commit()
+=======
+            slab_dbsession.query(SenslabXP).filter(SenslabXP.job_id.in_(deleted_jobs)).delete(synchronize_session='fetch')
+            slab_dbsession.commit()
+>>>>>>> 3fe7429... SA:sfa/senslab/slabapi.py
 
         return
 
@@ -889,7 +1022,11 @@ class IotlabTestbedAPI():
         #the same user in LDAP SA 27/07/12
         job_oar_list = []
 
+<<<<<<< HEAD:sfa/iotlab/iotlabapi.py
         jobs_psql_query = iotlab_dbsession.query(IotlabXP).all()
+=======
+        jobs_psql_query = slab_dbsession.query(SenslabXP).all()
+>>>>>>> 3fe7429... SA:sfa/senslab/slabapi.py
         jobs_psql_dict = dict([(row.job_id, row.__dict__ ) for row in jobs_psql_query ])
         #jobs_psql_dict = jobs_psql_dict)
         logger.debug("IOTLABDRIVER \tGetLeases jobs_psql_dict %s"\
@@ -899,7 +1036,11 @@ class IotlabTestbedAPI():
 
 
         for resa in unfiltered_reservation_list:
+<<<<<<< HEAD:sfa/iotlab/iotlabapi.py
             logger.debug("IOTLABDRIVER \tGetLeases USER %s"\
+=======
+            logger.debug("SLABDRIVER \tGetLeases USER %s"\
+>>>>>>> 3fe7429... SA:sfa/senslab/slabapi.py
                                             %(resa['user']))
             #Construct list of jobs (runing, waiting..) in oar
             job_oar_list.append(resa['lease_id'])
@@ -907,12 +1048,20 @@ class IotlabTestbedAPI():
             #(slice used and job id)
             if resa['lease_id'] in jobs_psql_dict:
                 job_info = jobs_psql_dict[resa['lease_id']]
+<<<<<<< HEAD:sfa/iotlab/iotlabapi.py
                 logger.debug("IOTLABDRIVER \tGetLeases job_info %s"\
+=======
+                logger.debug("SLABDRIVER \tGetLeases job_info %s"\
+>>>>>>> 3fe7429... SA:sfa/senslab/slabapi.py
                                             %(job_info))
                 resa['slice_hrn'] = job_info['slice_hrn']
                 resa['slice_id'] = hrn_to_urn(resa['slice_hrn'], 'slice')
 
+<<<<<<< HEAD:sfa/iotlab/iotlabapi.py
             #otherwise, assume it is a iotlab slice:
+=======
+            #otherwise, assume it is a senslab slice:
+>>>>>>> 3fe7429... SA:sfa/senslab/slabapi.py
             else:
                 resa['slice_id'] =  hrn_to_urn(self.root_auth+'.'+ \
                                          resa['user'] +"_slice"  , 'slice')
@@ -922,11 +1071,19 @@ class IotlabTestbedAPI():
             #Transform the hostnames into urns (component ids)
             for node in resa['reserved_nodes']:
 
+<<<<<<< HEAD:sfa/iotlab/iotlabapi.py
                 iotlab_xrn = iotlab_xrn_object(self.root_auth, node)
                 resa['component_id_list'].append(iotlab_xrn.urn)
 
             if lease_filter_dict:
                 logger.debug("IOTLABDRIVER \tGetLeases resa_ %s \
+=======
+                slab_xrn = slab_xrn_object(self.root_auth, node)
+                resa['component_id_list'].append(slab_xrn.urn)
+
+            if lease_filter_dict:
+                logger.debug("SLABDRIVER \tGetLeases resa_ %s \
+>>>>>>> 3fe7429... SA:sfa/senslab/slabapi.py
                         \r\n leasefilter %s" %(resa, lease_filter_dict))
 
                 if lease_filter_dict['name'] == resa['slice_hrn']:
@@ -936,9 +1093,15 @@ class IotlabTestbedAPI():
             reservation_list = unfiltered_reservation_list
 
 
+<<<<<<< HEAD:sfa/iotlab/iotlabapi.py
         self.update_jobs_in_iotlabdb(job_oar_list, jobs_psql_id_list)
 
         logger.debug(" IOTLABDRIVER.PY \tGetLeases reservation_list %s"\
+=======
+        self.update_jobs_in_slabdb(job_oar_list, jobs_psql_id_list)
+
+        logger.debug(" SLABDRIVER.PY \tGetLeases reservation_list %s"\
+>>>>>>> 3fe7429... SA:sfa/senslab/slabapi.py
                                                     %(reservation_list))
         return reservation_list
 
@@ -989,7 +1152,11 @@ class IotlabTestbedAPI():
         #return
 
     ##TODO UpdateSlice 04/07/2012 SA || Commented out 28/05/13 SA
+<<<<<<< HEAD:sfa/iotlab/iotlabapi.py
     ##Funciton should delete and create another job since oin iotlab slice=job
+=======
+    ##Funciton should delete and create another job since oin senslab slice=job
+>>>>>>> 3fe7429... SA:sfa/senslab/slabapi.py
     #def UpdateSlice(self, auth, slice_id_or_name, slice_fields=None):
         #"""Updates the parameters of an existing slice with the values in
         #slice_fields.
@@ -1002,12 +1169,20 @@ class IotlabTestbedAPI():
         #FROM PLC API DOC
 
         #"""
+<<<<<<< HEAD:sfa/iotlab/iotlabapi.py
         #logger.warning("IOTLABDRIVER UpdateSlice EMPTY - DO NOTHING \r\n ")
+=======
+        #logger.warning("SLABDRIVER UpdateSlice EMPTY - DO NOTHING \r\n ")
+>>>>>>> 3fe7429... SA:sfa/senslab/slabapi.py
         #return
 
     #Unused SA 30/05/13, we only update the user's key or we delete it.
     ##TODO UpdatePerson 04/07/2012 SA
+<<<<<<< HEAD:sfa/iotlab/iotlabapi.py
     #def UpdatePerson(self, iotlab_hrn, federated_hrn, person_fields=None):
+=======
+    #def UpdatePerson(self, slab_hrn, federated_hrn, person_fields=None):
+>>>>>>> 3fe7429... SA:sfa/senslab/slabapi.py
         #"""Updates a person. Only the fields specified in person_fields
         #are updated, all other fields are left untouched.
         #Users and techs can only update themselves. PIs can only update
@@ -1016,11 +1191,19 @@ class IotlabTestbedAPI():
         #FROM PLC API DOC
 
         #"""
+<<<<<<< HEAD:sfa/iotlab/iotlabapi.py
         ##new_row = FederatedToIotlab(iotlab_hrn, federated_hrn)
         ##iotlab_dbsession.add(new_row)
         ##iotlab_dbsession.commit()
 
         #logger.debug("IOTLABDRIVER UpdatePerson EMPTY - DO NOTHING \r\n ")
+=======
+        ##new_row = FederatedToSenslab(slab_hrn, federated_hrn)
+        ##slab_dbsession.add(new_row)
+        ##slab_dbsession.commit()
+
+        #logger.debug("SLABDRIVER UpdatePerson EMPTY - DO NOTHING \r\n ")
+>>>>>>> 3fe7429... SA:sfa/senslab/slabapi.py
         #return
 
     @staticmethod
@@ -1051,7 +1234,11 @@ class IotlabTestbedAPI():
         #user_by_email = dict((user[1]['mail'][0], user[1]['sshPublicKey']) \
                                         #for user in ldap_rslt)
 
+<<<<<<< HEAD:sfa/iotlab/iotlabapi.py
         logger.debug("IOTLABDRIVER  GetKeys  -key_dict %s \r\n " %(key_dict))
+=======
+        logger.debug("SLABDRIVER  GetKeys  -key_dict %s \r\n " %(key_dict))
+>>>>>>> 3fe7429... SA:sfa/senslab/slabapi.py
         return key_dict
 
     #TODO : test
@@ -1093,7 +1280,11 @@ class IotlabTestbedAPI():
         #of the user otherwise will mess up the RegRecord in
         #Resolve, don't know why - SA 08/08/2012
 
+<<<<<<< HEAD:sfa/iotlab/iotlabapi.py
         #Only one entry for one user  = one slice in iotlab_xp table
+=======
+        #Only one entry for one user  = one slice in slab_xp table
+>>>>>>> 3fe7429... SA:sfa/senslab/slabapi.py
         #slicerec = dbsession.query(RegRecord).filter_by(hrn = slice_filter).first()
         raw_slicerec = dbsession.query(RegSlice).options(joinedload('reg_researchers')).filter_by(hrn = slice_filter).first()
         #raw_slicerec = dbsession.query(RegRecord).filter_by(hrn = slice_filter).first()
@@ -1197,7 +1388,11 @@ class IotlabTestbedAPI():
 
     def GetSlices(self, slice_filter = None, slice_filter_type = None, \
                                                                     login=None):
+<<<<<<< HEAD:sfa/iotlab/iotlabapi.py
         """ Get the slice records from the iotlab db and add lease information
+=======
+        """ Get the slice records from the slab db and add lease information
+>>>>>>> 3fe7429... SA:sfa/senslab/slabapi.py
         if any.
 
         :param slice_filter: can be the slice hrn or slice record id in the db
@@ -1223,7 +1418,11 @@ class IotlabTestbedAPI():
                             self._get_slice_records(slice_filter, slice_filter_type)
             slice_hrn = fixed_slicerec_dict['hrn']
 
+<<<<<<< HEAD:sfa/iotlab/iotlabapi.py
             logger.debug(" IOTLABDRIVER \tGetSlices login %s \
+=======
+            logger.debug(" SLABDRIVER \tGetSlices login %s \
+>>>>>>> 3fe7429... SA:sfa/senslab/slabapi.py
                             slice record %s slice_filter %s \
                             slice_filter_type %s " %(login, \
                             fixed_slicerec_dict, slice_filter, \
@@ -1246,7 +1445,11 @@ class IotlabTestbedAPI():
 
             for lease in leases_list :
                 slicerec_dict = {}
+<<<<<<< HEAD:sfa/iotlab/iotlabapi.py
                 logger.debug("IOTLABDRIVER.PY  \tGetSlices slice_filter %s   \
+=======
+                logger.debug("SLABDRIVER.PY  \tGetSlices slice_filter %s   \
+>>>>>>> 3fe7429... SA:sfa/senslab/slabapi.py
                         \ lease['slice_hrn'] %s" \
                         %(slice_filter, lease['slice_hrn']))
                 if  lease['slice_hrn'] == slice_hrn:
@@ -1266,16 +1469,27 @@ class IotlabTestbedAPI():
                                         #str(fixed_slicerec_dict['slice_hrn'])})
 
                     return_slicerec_dictlist.append(slicerec_dict)
+<<<<<<< HEAD:sfa/iotlab/iotlabapi.py
                     logger.debug("IOTLABDRIVER.PY  \tGetSlices  \
                         OHOHOHOH %s" %(return_slicerec_dictlist ))
 
                 logger.debug("IOTLABDRIVER.PY  \tGetSlices  \
+=======
+                    logger.debug("SLABDRIVER.PY  \tGetSlices  \
+                        OHOHOHOH %s" %(return_slicerec_dictlist ))
+
+                logger.debug("SLABDRIVER.PY  \tGetSlices  \
+>>>>>>> 3fe7429... SA:sfa/senslab/slabapi.py
                         slicerec_dict %s return_slicerec_dictlist %s \
                         lease['reserved_nodes'] \
                         %s" %(slicerec_dict, return_slicerec_dictlist, \
                         lease['reserved_nodes'] ))
 
+<<<<<<< HEAD:sfa/iotlab/iotlabapi.py
             logger.debug("IOTLABDRIVER.PY  \tGetSlices  RETURN \
+=======
+            logger.debug("SLABDRIVER.PY  \tGetSlices  RETURN \
+>>>>>>> 3fe7429... SA:sfa/senslab/slabapi.py
                         return_slicerec_dictlist  %s" \
                         %(return_slicerec_dictlist))
 
@@ -1283,7 +1497,11 @@ class IotlabTestbedAPI():
 
 
         else:
+<<<<<<< HEAD:sfa/iotlab/iotlabapi.py
             #Get all slices from the iotlab sfa database ,
+=======
+            #Get all slices from the senslab sfa database ,
+>>>>>>> 3fe7429... SA:sfa/senslab/slabapi.py
             #put them in dict format
             #query_slice_list = dbsession.query(RegRecord).all()
             query_slice_list = dbsession.query(RegSlice).options(joinedload('reg_researchers')).all()
@@ -1301,7 +1519,11 @@ class IotlabTestbedAPI():
 
             for fixed_slicerec_dict in return_slicerec_dictlist:
                 slicerec_dict = {}
+<<<<<<< HEAD:sfa/iotlab/iotlabapi.py
                 #Check if the slice belongs to a iotlab user
+=======
+                #Check if the slice belongs to a senslab user
+>>>>>>> 3fe7429... SA:sfa/senslab/slabapi.py
                 if fixed_slicerec_dict['peer_authority'] is None:
                     owner = fixed_slicerec_dict['hrn'].split(".")[1].split("_")[0]
                 else:
@@ -1322,11 +1544,19 @@ class IotlabTestbedAPI():
                         #return_slicerec_dictlist.append(slicerec_dict)
                         fixed_slicerec_dict.update(slicerec_dict)
 
+<<<<<<< HEAD:sfa/iotlab/iotlabapi.py
             logger.debug("IOTLABDRIVER.PY  \tGetSlices RETURN \
+=======
+            logger.debug("SLABDRIVER.PY  \tGetSlices RETURN \
+>>>>>>> 3fe7429... SA:sfa/senslab/slabapi.py
                         return_slicerec_dictlist %s \slice_filter %s " \
                         %(return_slicerec_dictlist, slice_filter))
 
         return return_slicerec_dictlist
+<<<<<<< HEAD:sfa/iotlab/iotlabapi.py
+=======
+
+>>>>>>> 3fe7429... SA:sfa/senslab/slabapi.py
 
 
 
@@ -1339,6 +1569,7 @@ class IotlabTestbedAPI():
 
         #iotlab_record = {}
         ##for field in record:
+<<<<<<< HEAD:sfa/iotlab/iotlabapi.py
         ##    iotlab_record[field] = record[field]
 
         #if sfa_type == "slice":
@@ -1351,21 +1582,45 @@ class IotlabTestbedAPI():
             #iotlab_record["hrn"] = hrn
             #logger.debug("IOTLABDRIVER.PY sfa_fields_to_iotlab_fields \
                         #iotlab_record %s  " %(iotlab_record['hrn']))
+=======
+        ##    slab_record[field] = record[field]
+
+        #if sfa_type == "slice":
+            ##instantion used in get_slivers ?
+            #if not "instantiation" in slab_record:
+                #slab_record["instantiation"] = "senslab-instantiated"
+            ##slab_record["hrn"] = hrn_to_pl_slicename(hrn)
+            ##Unused hrn_to_pl_slicename because Slab's hrn already
+            ##in the appropriate form SA 23/07/12
+            #slab_record["hrn"] = hrn
+            #logger.debug("SLABDRIVER.PY sfa_fields_to_slab_fields \
+                        #slab_record %s  " %(slab_record['hrn']))
+>>>>>>> 3fe7429... SA:sfa/senslab/slabapi.py
             #if "url" in record:
                 #iotlab_record["url"] = record["url"]
             #if "description" in record:
                 #iotlab_record["description"] = record["description"]
             #if "expires" in record:
+<<<<<<< HEAD:sfa/iotlab/iotlabapi.py
                 #iotlab_record["expires"] = int(record["expires"])
+=======
+                #slab_record["expires"] = int(record["expires"])
+>>>>>>> 3fe7429... SA:sfa/senslab/slabapi.py
 
         ##nodes added by OAR only and then imported to SFA
         ##elif type == "node":
             ##if not "hostname" in iotlab_record:
                 ##if not "hostname" in record:
                     ##raise MissingSfaInfo("hostname")
+<<<<<<< HEAD:sfa/iotlab/iotlabapi.py
                 ##iotlab_record["hostname"] = record["hostname"]
             ##if not "model" in iotlab_record:
                 ##iotlab_record["model"] = "geni"
+=======
+                ##slab_record["hostname"] = record["hostname"]
+            ##if not "model" in slab_record:
+                ##slab_record["model"] = "geni"
+>>>>>>> 3fe7429... SA:sfa/senslab/slabapi.py
 
         ##One authority only
         ##elif type == "authority":
@@ -1394,3 +1649,13 @@ class IotlabTestbedAPI():
 
 
 
+<<<<<<< HEAD:sfa/iotlab/iotlabapi.py
+=======
+
+
+
+
+
+
+
+>>>>>>> 3fe7429... SA:sfa/senslab/slabapi.py
index 84baa2b..4f05e81 100644 (file)
@@ -12,7 +12,16 @@ from sfa.rspecs.rspec import RSpec
 from sfa.util.xrn import Xrn, hrn_to_urn, get_authority
 
 
+<<<<<<< HEAD:sfa/iotlab/iotlabdriver.py
 from sfa.iotlab.iotlabpostgres import IotlabDB
+=======
+from sfa.senslab.slabpostgres import SlabDB
+
+
+from sfa.senslab.slabaggregate import SlabAggregate, slab_xrn_to_hostname
+
+from sfa.senslab.slabslices import SlabSlices
+>>>>>>> 3fe7429... SA:sfa/senslab/slabdriver.py
 
 
 from sfa.iotlab.iotlabaggregate import IotlabAggregate, iotlab_xrn_to_hostname
@@ -26,6 +35,12 @@ from sfa.iotlab.iotlabapi import IotlabTestbedAPI
 class IotlabDriver(Driver):
     """ Iotlab Driver class inherited from Driver generic class.
 
+<<<<<<< HEAD:sfa/iotlab/iotlabdriver.py
+=======
+class SlabDriver(Driver):
+    """ Senslab Driver class inherited from Driver generic class.
+
+>>>>>>> 3fe7429... SA:sfa/senslab/slabdriver.py
     Contains methods compliant with the SFA standard and the testbed
     infrastructure (calls to LDAP and OAR).
 
@@ -35,10 +50,17 @@ class IotlabDriver(Driver):
     def __init__(self, config):
         """
 
+<<<<<<< HEAD:sfa/iotlab/iotlabdriver.py
         Sets the iotlab SFA config parameters ,
         instanciates the testbed api and the iotlab database.
 
         :param config: iotlab SFA configuration object
+=======
+        Sets the senslab SFA config parameters ,
+        instanciates the testbed api and the senslab database.
+
+        :param config: senslab SFA configuration object
+>>>>>>> 3fe7429... SA:sfa/senslab/slabdriver.py
         :type config: Config object
         """
         Driver.__init__ (self, config)
@@ -62,7 +84,11 @@ class IotlabDriver(Driver):
 
     def fill_record_info(self, record_list):
         """
+<<<<<<< HEAD:sfa/iotlab/iotlabdriver.py
         For each SFA record, fill in the iotlab specific and SFA specific
+=======
+        For each SFA record, fill in the senslab specific and SFA specific
+>>>>>>> 3fe7429... SA:sfa/senslab/slabdriver.py
         fields in the record.
 
         :param record_list: list of sfa dictionaries records
@@ -75,7 +101,11 @@ class IotlabDriver(Driver):
         other way to do it given the way it's called in registry manager.
         """
 
+<<<<<<< HEAD:sfa/iotlab/iotlabdriver.py
         logger.debug("IOTLABDRIVER \tfill_record_info records %s " %(record_list))
+=======
+        logger.debug("SLABDRIVER \tfill_record_info records %s " %(record_list))
+>>>>>>> 3fe7429... SA:sfa/senslab/slabdriver.py
         if not isinstance(record_list, list):
             record_list = [record_list]
 
@@ -84,7 +114,11 @@ class IotlabDriver(Driver):
             for record in record_list:
                 #If the record is a SFA slice record, then add information
                 #about the user of this slice. This kind of
+<<<<<<< HEAD:sfa/iotlab/iotlabdriver.py
                 #information is in the Iotlab's DB.
+=======
+                #information is in the Senslab's DB.
+>>>>>>> 3fe7429... SA:sfa/senslab/slabdriver.py
                 if str(record['type']) == 'slice':
                     if 'reg_researchers' in record and \
                     isinstance(record['reg_researchers'], list) :
@@ -101,29 +135,50 @@ class IotlabDriver(Driver):
                             'key_ids':''})  #For client_helper.py compatibility
 
 
+<<<<<<< HEAD:sfa/iotlab/iotlabdriver.py
                     #Get iotlab slice record and oar job id if any.
                     recslice_list = self.iotlab_api.GetSlices(slice_filter = \
+=======
+                    #Get slab slice record and oar job id if any.
+                    recslice_list = self.slab_api.GetSlices(slice_filter = \
+>>>>>>> 3fe7429... SA:sfa/senslab/slabdriver.py
                                                 str(record['hrn']),\
                                                 slice_filter_type = 'slice_hrn')
 
 
+<<<<<<< HEAD:sfa/iotlab/iotlabdriver.py
                     logger.debug("IOTLABDRIVER \tfill_record_info \
+=======
+                    logger.debug("SLABDRIVER \tfill_record_info \
+>>>>>>> 3fe7429... SA:sfa/senslab/slabdriver.py
                         TYPE SLICE RECUSER record['hrn'] %s ecord['oar_job_id']\
                          %s " %(record['hrn'], record['oar_job_id']))
                     del record['reg_researchers']
                     try:
                         for rec in recslice_list:
+<<<<<<< HEAD:sfa/iotlab/iotlabdriver.py
                             logger.debug("IOTLABDRIVER\r\n  \t  \
                             fill_record_info oar_job_id %s " \
                             %(rec['oar_job_id']))
 
                             record['node_ids'] = [ self.iotlab_api.root_auth + \
+=======
+                            logger.debug("SLABDRIVER\r\n  \t  \
+                            fill_record_info oar_job_id %s " \
+                            %(rec['oar_job_id']))
+
+                            record['node_ids'] = [ self.slab_api.root_auth + \
+>>>>>>> 3fe7429... SA:sfa/senslab/slabdriver.py
                                     hostname for hostname in rec['node_ids']]
                     except KeyError:
                         pass
 
 
+<<<<<<< HEAD:sfa/iotlab/iotlabdriver.py
                     logger.debug( "IOTLABDRIVER.PY \t fill_record_info SLICE \
+=======
+                    logger.debug( "SLABDRIVER.PY \t fill_record_info SLICE \
+>>>>>>> 3fe7429... SA:sfa/senslab/slabdriver.py
                                     recslice_list  %s \r\n \t RECORD %s \r\n \
                                     \r\n" %(recslice_list, record))
 
@@ -135,7 +190,11 @@ class IotlabDriver(Driver):
                             slice_filter = record['record_id'],\
                             slice_filter_type = 'record_id_user')
 
+<<<<<<< HEAD:sfa/iotlab/iotlabdriver.py
                     logger.debug( "IOTLABDRIVER.PY \t fill_record_info TYPE USER \
+=======
+                    logger.debug( "SLABDRIVER.PY \t fill_record_info TYPE USER \
+>>>>>>> 3fe7429... SA:sfa/senslab/slabdriver.py
                                 recslice_list %s \r\n \t RECORD %s \r\n" \
                                 %(recslice_list , record))
                     #Append slice record in records list,
@@ -143,7 +202,11 @@ class IotlabDriver(Driver):
                     #Will update PIs and researcher for the slice
 
                     recuser = recslice_list[0]['reg_researchers']
+<<<<<<< HEAD:sfa/iotlab/iotlabdriver.py
                     logger.debug( "IOTLABDRIVER.PY \t fill_record_info USER  \
+=======
+                    logger.debug( "SLABDRIVER.PY \t fill_record_info USER  \
+>>>>>>> 3fe7429... SA:sfa/senslab/slabdriver.py
                                             recuser %s \r\n \r\n" %(recuser))
                     recslice = {}
                     recslice = recslice_list[0]
@@ -164,17 +227,28 @@ class IotlabDriver(Driver):
 
 
                     #GetPersons takes [] as filters
+<<<<<<< HEAD:sfa/iotlab/iotlabdriver.py
                     user_iotlab = self.iotlab_api.GetPersons([record])
 
 
                     record.update(user_iotlab[0])
+=======
+                    user_slab = self.slab_api.GetPersons([record])
+
+
+                    record.update(user_slab[0])
+>>>>>>> 3fe7429... SA:sfa/senslab/slabdriver.py
                     #For client_helper.py compatibility
                     record.update( { 'geni_urn':'',
                     'keys':'',
                     'key_ids':'' })
                     record_list.append(recslice)
 
+<<<<<<< HEAD:sfa/iotlab/iotlabdriver.py
                     logger.debug("IOTLABDRIVER.PY \tfill_record_info ADDING SLICE\
+=======
+                    logger.debug("SLABDRIVER.PY \tfill_record_info ADDING SLICE\
+>>>>>>> 3fe7429... SA:sfa/senslab/slabdriver.py
                                 INFO TO USER records %s" %(record_list))
 
 
@@ -188,7 +262,11 @@ class IotlabDriver(Driver):
     def sliver_status(self, slice_urn, slice_hrn):
         """
         Receive a status request for slice named urn/hrn
+<<<<<<< HEAD:sfa/iotlab/iotlabdriver.py
         urn:publicid:IDN+iotlab+nturro_slice hrn iotlab.nturro_slice
+=======
+        urn:publicid:IDN+senslab+nturro_slice hrn senslab.nturro_slice
+>>>>>>> 3fe7429... SA:sfa/senslab/slabdriver.py
         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.
@@ -221,7 +299,11 @@ class IotlabDriver(Driver):
             #slice_nodes_list.append(node['hostname'])
         slice_nodes_list = one_slice['node_ids']
         #Get all the corresponding nodes details
+<<<<<<< HEAD:sfa/iotlab/iotlabdriver.py
         nodes_all = self.iotlab_api.GetNodes({'hostname':slice_nodes_list},
+=======
+        nodes_all = self.slab_api.GetNodes({'hostname':slice_nodes_list},
+>>>>>>> 3fe7429... SA:sfa/senslab/slabdriver.py
                                 ['node_id', 'hostname','site','boot_state'])
         nodeall_byhostname = dict([(one_node['hostname'], one_node) \
                                             for one_node in nodes_all])
@@ -245,6 +327,11 @@ class IotlabDriver(Driver):
                 result['geni_status'] = top_level_status
                 result['geni_resources'] = []
                 return result
+<<<<<<< HEAD:sfa/iotlab/iotlabdriver.py
+=======
+
+            top_level_status = 'ready'
+>>>>>>> 3fe7429... SA:sfa/senslab/slabdriver.py
 
             top_level_status = 'ready'
 
@@ -256,8 +343,13 @@ class IotlabDriver(Driver):
             resources = []
             for node_hostname in single_slice['node_ids']:
                 res = {}
+<<<<<<< HEAD:sfa/iotlab/iotlabdriver.py
                 res['iotlab_hostname'] = node_hostname
                 res['iotlab_boot_state'] = nodeall_byhostname[node_hostname]['boot_state']
+=======
+                res['slab_hostname'] = node_hostname
+                res['slab_boot_state'] = nodeall_byhostname[node_hostname]['boot_state']
+>>>>>>> 3fe7429... SA:sfa/senslab/slabdriver.py
 
                 #res['pl_hostname'] = node['hostname']
                 #res['pl_boot_state'] = \
@@ -283,7 +375,11 @@ class IotlabDriver(Driver):
 
             result['geni_status'] = top_level_status
             result['geni_resources'] = resources
+<<<<<<< HEAD:sfa/iotlab/iotlabdriver.py
             logger.debug("IOTLABDRIVER \tsliver_statusresources %s res %s "\
+=======
+            logger.debug("SLABDRIVER \tsliver_statusresources %s res %s "\
+>>>>>>> 3fe7429... SA:sfa/senslab/slabdriver.py
                                                     %(resources,res))
             return result
 
@@ -340,7 +436,11 @@ class IotlabDriver(Driver):
         type. Find the lease requests in the rspec and creates
         a lease request list with the mandatory information ( nodes,
         start time and duration) of the valid leases (duration above or equal
+<<<<<<< HEAD:sfa/iotlab/iotlabdriver.py
         to the iotlab experiment minimum duration).
+=======
+        to the senslab experiment minimum duration).
+>>>>>>> 3fe7429... SA:sfa/senslab/slabdriver.py
 
         :param rspec: rspec request received.
         :type rspec: RSpec
@@ -350,7 +450,11 @@ class IotlabDriver(Driver):
         requested_lease_list = []
         for lease in rspec.version.get_leases():
             single_requested_lease = {}
+<<<<<<< HEAD:sfa/iotlab/iotlabdriver.py
             logger.debug("IOTLABDRIVER.PY \t_get_requested_leases_list lease %s " %(lease))
+=======
+            logger.debug("SLABDRIVER.PY \t_get_requested_leases_list lease %s " %(lease))
+>>>>>>> 3fe7429... SA:sfa/senslab/slabdriver.py
 
             if not lease.get('lease_id'):
                 if get_authority(lease['component_id']) == \
@@ -365,7 +469,11 @@ class IotlabDriver(Driver):
                     #the lease to the requested leases list
                     duration_in_seconds = \
                             int(single_requested_lease['duration'])
+<<<<<<< HEAD:sfa/iotlab/iotlabdriver.py
                     if duration_in_seconds >= self.iotlab_api.GetMinExperimentDurationInSec() :
+=======
+                    if duration_in_seconds >= self.slab_api.GetMinExperimentDurationInSec() :
+>>>>>>> 3fe7429... SA:sfa/senslab/slabdriver.py
                         requested_lease_list.append(single_requested_lease)
 
         return requested_lease_list
@@ -418,7 +526,11 @@ class IotlabDriver(Driver):
         logger.debug("IOTLABDRIVER _process_requested_jobs requested_lease_list \
         %s"%(requested_lease_list))
         job_dict =  self._group_leases_by_start_time(requested_lease_list)
+<<<<<<< HEAD:sfa/iotlab/iotlabdriver.py
         logger.debug("IOTLABDRIVER _process_requested_jobs  job_dict\
+=======
+        logger.debug("SLABDRIVER _process_requested_jobs  job_dict\
+>>>>>>> 3fe7429... SA:sfa/senslab/slabdriver.py
         %s"%(job_dict))
 
         return job_dict
@@ -446,9 +558,15 @@ class IotlabDriver(Driver):
 
 
         """
+<<<<<<< HEAD:sfa/iotlab/iotlabdriver.py
         aggregate = IotlabAggregate(self)
 
         slices = IotlabSlices(self)
+=======
+        aggregate = SlabAggregate(self)
+
+        slices = SlabSlices(self)
+>>>>>>> 3fe7429... SA:sfa/senslab/slabdriver.py
         peer = slices.get_peer(slice_hrn)
         sfa_peer = slices.get_sfa_peer(slice_hrn)
         slice_record = None
@@ -458,7 +576,11 @@ class IotlabDriver(Driver):
 
         if users:
             slice_record = users[0].get('slice_record', {})
+<<<<<<< HEAD:sfa/iotlab/iotlabdriver.py
             logger.debug("IOTLABDRIVER.PY \t ===============create_sliver \t\
+=======
+            logger.debug("SLABDRIVER.PY \t ===============create_sliver \t\
+>>>>>>> 3fe7429... SA:sfa/senslab/slabdriver.py
                                         creds %s \r\n \r\n users %s" \
                                         %(creds, users))
             slice_record['user'] = {'keys':users[0]['keys'], \
@@ -490,6 +612,11 @@ class IotlabDriver(Driver):
 
         # add/remove slice from nodes
 
+<<<<<<< HEAD:sfa/iotlab/iotlabdriver.py
+=======
+        # add/remove slice from nodes
+
+>>>>>>> 3fe7429... SA:sfa/senslab/slabdriver.py
         #requested_slivers = [node.get('component_id') \
                             #for node in rspec.version.get_nodes_with_slivers()\
                             #if node.get('authority_id') is self.iotlab_api.root_auth]
@@ -504,7 +631,11 @@ class IotlabDriver(Driver):
         requested_job_dict = self._process_requested_jobs(rspec)
 
 
+<<<<<<< HEAD:sfa/iotlab/iotlabdriver.py
         logger.debug("IOTLABDRIVER.PY \tcreate_sliver  requested_job_dict %s "\
+=======
+        logger.debug("SLABDRIVER.PY \tcreate_sliver  requested_job_dict %s "\
+>>>>>>> 3fe7429... SA:sfa/senslab/slabdriver.py
                                                      %(requested_job_dict))
         #verify_slice_leases returns the leases , but the return value is unused
         #here. Removed SA 13/08/12
@@ -518,17 +649,30 @@ class IotlabDriver(Driver):
     def delete_sliver (self, slice_urn, slice_hrn, creds, options):
         """
         Deletes the lease associated with the slice hrn and the credentials
+<<<<<<< HEAD:sfa/iotlab/iotlabdriver.py
         if the slice belongs to iotlab. Answer to DeleteSliver.
 
         :return: 1 if the slice to delete was not found on iotlab,
         True if the deletion was successful, False otherwise otherwise.
 
         .. note:: Should really be named delete_leases because iotlab does
+=======
+        if the slice belongs to senslab. Answer to DeleteSliver.
+
+        :return: 1 if the slice to delete was not found on senslab,
+        True if the deletion was successful, False otherwise otherwise.
+
+        .. note:: Should really be named delete_leases because senslab does
+>>>>>>> 3fe7429... SA:sfa/senslab/slabdriver.py
         not have any slivers, but only deals with leases. However, SFA api only
         have delete_sliver define so far. SA 13.05/2013
         """
 
+<<<<<<< HEAD:sfa/iotlab/iotlabdriver.py
         sfa_slice_list  = self.iotlab_api.GetSlices(slice_filter = slice_hrn, \
+=======
+        sfa_slice_list  = self.slab_api.GetSlices(slice_filter = slice_hrn, \
+>>>>>>> 3fe7429... SA:sfa/senslab/slabdriver.py
                                             slice_filter_type = 'slice_hrn')
 
         if not sfa_slice_list:
@@ -538,9 +682,17 @@ class IotlabDriver(Driver):
         for sfa_slice in sfa_slice_list:
 
 
+<<<<<<< HEAD:sfa/iotlab/iotlabdriver.py
             logger.debug("IOTLABDRIVER.PY delete_sliver slice %s" %(sfa_slice))
             slices = IotlabSlices(self)
             # determine if this is a peer slice
+=======
+            logger.debug("SLABDRIVER.PY delete_sliver slice %s" %(sfa_slice))
+            slices = SlabSlices(self)
+            # determine if this is a peer slice
+
+            peer = slices.get_peer(slice_hrn)
+>>>>>>> 3fe7429... SA:sfa/senslab/slabdriver.py
 
             peer = slices.get_peer(slice_hrn)
 
@@ -548,7 +700,11 @@ class IotlabDriver(Driver):
             \r\n \t sfa_slice %s " %(peer, sfa_slice))
             try:
 
+<<<<<<< HEAD:sfa/iotlab/iotlabdriver.py
                 self.iotlab_api.DeleteSliceFromNodes(sfa_slice)
+=======
+                self.slab_api.DeleteSliceFromNodes(sfa_slice)
+>>>>>>> 3fe7429... SA:sfa/senslab/slabdriver.py
                 return True
             except :
                 return False
@@ -556,7 +712,11 @@ class IotlabDriver(Driver):
 
     def list_resources (self, slice_urn, slice_hrn, creds, options):
         """
+<<<<<<< HEAD:sfa/iotlab/iotlabdriver.py
         List resources from the iotlab aggregate and returns a Rspec
+=======
+        List resources from the senslab aggregate and returns a Rspec
+>>>>>>> 3fe7429... SA:sfa/senslab/slabdriver.py
         advertisement with resources found when slice_urn and slice_hrn are None
         (in case of resource discovery).
         If a slice hrn and urn are provided, list experiment's slice
@@ -600,7 +760,11 @@ class IotlabDriver(Driver):
                 #return rspec
 
         #panos: passing user-defined options
+<<<<<<< HEAD:sfa/iotlab/iotlabdriver.py
         aggregate = IotlabAggregate(self)
+=======
+        aggregate = SlabAggregate(self)
+>>>>>>> 3fe7429... SA:sfa/senslab/slabdriver.py
 
         rspec =  aggregate.get_rspec(slice_xrn=slice_urn, \
                                         version=rspec_version, options=options)
@@ -616,7 +780,11 @@ class IotlabDriver(Driver):
     def list_slices (self, creds, options):
         """
         Answer to ListSlices.
+<<<<<<< HEAD:sfa/iotlab/iotlabdriver.py
         List slices belonging to iotlab, returns slice urns list.
+=======
+        List slices belonging to senslab, returns slice urns list.
+>>>>>>> 3fe7429... SA:sfa/senslab/slabdriver.py
         No caching used. Options unused but are defined in the SFA method
         api prototype.
 
@@ -633,16 +801,26 @@ class IotlabDriver(Driver):
 
         # get data from db
 
+<<<<<<< HEAD:sfa/iotlab/iotlabdriver.py
         slices = self.iotlab_api.GetSlices()
         logger.debug("IOTLABDRIVER.PY \tlist_slices hrn %s \r\n \r\n" %(slices))
         slice_hrns = [iotlab_slice['hrn'] for iotlab_slice in slices]
+=======
+        slices = self.slab_api.GetSlices()
+        logger.debug("SLABDRIVER.PY \tlist_slices hrn %s \r\n \r\n" %(slices))
+        slice_hrns = [slab_slice['hrn'] for slab_slice in slices]
+>>>>>>> 3fe7429... SA:sfa/senslab/slabdriver.py
 
         slice_urns = [hrn_to_urn(slice_hrn, 'slice') \
                                                 for slice_hrn in slice_hrns]
 
         # cache the result
         #if self.cache:
+<<<<<<< HEAD:sfa/iotlab/iotlabdriver.py
             #logger.debug ("IotlabDriver.list_slices stores value in cache")
+=======
+            #logger.debug ("SlabDriver.list_slices stores value in cache")
+>>>>>>> 3fe7429... SA:sfa/senslab/slabdriver.py
             #self.cache.add('slices', slice_urns)
 
         return slice_urns
@@ -667,7 +845,11 @@ class IotlabDriver(Driver):
 
 
     def update (self, old_sfa_record, new_sfa_record, hrn, new_key):
+<<<<<<< HEAD:sfa/iotlab/iotlabdriver.py
         """No site or node record update allowed in Iotlab.
+=======
+        """No site or node record update allowed in Senslab.
+>>>>>>> 3fe7429... SA:sfa/senslab/slabdriver.py
         The only modifications authorized here are key deletion/addition
         on an existing user and password change.
         On an existing user, CAN NOT BE MODIFIED:
@@ -705,7 +887,11 @@ class IotlabDriver(Driver):
                 person = persons[0]
                 keys = [person['pkey']]
                 #Get all the person's keys
+<<<<<<< HEAD:sfa/iotlab/iotlabdriver.py
                 keys_dict = self.iotlab_api.GetKeys(keys)
+=======
+                keys_dict = self.slab_api.GetKeys(keys)
+>>>>>>> 3fe7429... SA:sfa/senslab/slabdriver.py
 
                 # Delete all stale keys, meaning the user has only one key
                 #at a time
@@ -748,10 +934,17 @@ class IotlabDriver(Driver):
         hrn = sfa_record['hrn']
         if sfa_record_type == 'user':
 
+<<<<<<< HEAD:sfa/iotlab/iotlabdriver.py
             #get user from iotlab ldap
             person = self.iotlab_api.GetPersons(sfa_record)
             #No registering at a given site in Iotlab.
             #Once registered to the LDAP, all iotlab sites are
+=======
+            #get user from senslab ldap
+            person = self.slab_api.GetPersons(sfa_record)
+            #No registering at a given site in Senslab.
+            #Once registered to the LDAP, all senslab sites are
+>>>>>>> 3fe7429... SA:sfa/senslab/slabdriver.py
             #accesible.
             if person :
                 #Mark account as disabled in ldap