Cleaning files and replacing slab stuff by iotlab.
authorSandrine Avakian <sandrine.avakian@inria.fr>
Mon, 8 Jul 2013 09:29:13 +0000 (11:29 +0200)
committerSandrine Avakian <sandrine.avakian@inria.fr>
Mon, 8 Jul 2013 09:29:13 +0000 (11:29 +0200)
sfa/importer/iotlabimporter.py
sfa/iotlab/iotlabaggregate.py
sfa/iotlab/iotlabapi.py
sfa/iotlab/iotlabdriver.py
sfa/iotlab/iotlabpostgres.py
sfa/iotlab/iotlabslices.py
sfa/rspecs/versions/iotlabv1.py

index f97cd3a..f9e3919 100644 (file)
@@ -362,7 +362,7 @@ class IotlabImporter:
                     self.auth_hierarchy.create_gid(person_urn, \
                     create_uuid(), pkey)
                     if person['email']:
-                        self.logger.debug( "SLAB IMPORTER \
+                        self.logger.debug( "IOTLAB IMPORTER \
                             PERSON EMAIL OK email %s " %(person['email']))
                         person_gid.set_email(person['email'])
                         user_record = RegUser(hrn=person_hrn, \
index 280b68f..8e34d0e 100644 (file)
@@ -25,7 +25,7 @@ def iotlab_xrn_object(root_auth, hostname):
     """Attributes are urn and hrn.
     Get the hostname using iotlab_xrn_to_hostname on the urn.
 
-    :return: the iotlab node's xrn
+    :returns: the iotlab node's xrn
     :rtype: Xrn
     """
     return Xrn('.'.join( [root_auth, Xrn.escape(hostname)]), type='node')
@@ -377,7 +377,7 @@ class IotlabAggregate:
                 tmp = ldap_username.split('.')
                 ldap_username = tmp[1].split('_')[0]
 
-                if version.type == "Slab":
+                if version.type == "Iotlab":
                     rspec.version.add_connection_information(ldap_username, \
                                                         sites_set)
 
index 0c0f798..d748ef3 100644 (file)
@@ -52,7 +52,7 @@ class IotlabTestbedAPI():
         if peer_filter is specified.
         :param peer_filter: name of the site authority looked for.
         :type peer_filter: string
-        :return: list of records.
+        :returns: list of records.
 
         """
 
@@ -77,7 +77,7 @@ class IotlabTestbedAPI():
         try:
             if peer_filter:
                 records_list.append(existing_records[(peer_filter,'authority')])
-            else :
+            else:
                 for hrn in existing_hrns_by_types['authority']:
                     records_list.append(existing_records[(hrn,'authority')])
 
@@ -105,7 +105,7 @@ class IotlabTestbedAPI():
         :param person_filter: Must be a list of dictionnaries
         with users properties when not set to None.
         :param person_filter: list of dict
-        :return:Returns a list of users whose accounts are enabled
+        :returns:Returns a list of users whose accounts are enabled
         found in ldap.
         :rtype: list of dicts
 
@@ -155,7 +155,7 @@ class IotlabTestbedAPI():
         :type job_id:integer
         :type username: string
 
-        :return: dictionary with the job id and if delete has been successful
+        :returns: dictionary with the job id and if delete has been successful
         (True) or no (False)
         :rtype: dict
         """
@@ -231,7 +231,7 @@ class IotlabTestbedAPI():
         :type username: string
         :type job_id: integer
 
-        :return: dicionary with nodes' hostnames belonging to the job.
+        :returns: dicionary with nodes' hostnames belonging to the job.
         :rtype: dict
         """
 
@@ -316,7 +316,7 @@ class IotlabTestbedAPI():
         OAR node identifier.
         :param username: user's LDAP login
         :type username: string
-        :return: list of reservations dict
+        :returns: list of reservations dict
         :rtype: dict list
         """
 
@@ -349,7 +349,7 @@ class IotlabTestbedAPI():
         :param return_fields_list: list of specific fields the user wants to be
         returned.
         :type return_fields_list: list
-        :return: list of dictionaries with node properties
+        :returns: list of dictionaries with node properties
         :rtype: list
 
         """
@@ -452,7 +452,7 @@ class IotlabTestbedAPI():
         ins can delete anyone.
         :param person_record: user's record
         :type person_record: dict
-        :return:  True if successful, False otherwise.
+        :returns:  True if successful, False otherwise.
         :rtype: boolean
 
         """
@@ -466,7 +466,7 @@ class IotlabTestbedAPI():
         """ Deletes the specified slice and kills the jobs associated with
          the slice if any,  using DeleteSliceFromNodes.
 
-         :return: True if all the jobs in the slice have been deleted,
+         :returns: True if all the jobs in the slice have been deleted,
          or the list of jobs that could not be deleted otherwise.
          :rtype: list or boolean
 
@@ -520,7 +520,7 @@ class IotlabTestbedAPI():
                                 pkey)
                 if user_dict['email']:
                     logger.debug("__add_person_to_db \r\n \r\n \
-                        SLAB IMPORTER PERSON EMAIL OK email %s "\
+                        IOTLAB IMPORTER PERSON EMAIL OK email %s "\
                         %(user_dict['email']))
                     person_gid.set_email(user_dict['email'])
 
@@ -539,7 +539,7 @@ class IotlabTestbedAPI():
         otherwise defaults are used. Creates an appropriate login by calling
         LdapAddUser.
         :param record: dictionary with the sfa user's properties.
-        :return: The uid of the added person if sucessful, otherwise returns
+        :returns: The uid of the added person if sucessful, otherwise returns
         the error message from LDAP.
         :rtype: interger or string
         """
@@ -569,7 +569,7 @@ class IotlabTestbedAPI():
 
 
         :rtype: Boolean
-        :return: True if the key has been modified, False otherwise.
+        :returns: True if the key has been modified, False otherwise.
 
         """
         ret = self.ldap.LdapModify(person_uid, old_attributes_dict, \
@@ -808,7 +808,7 @@ class IotlabTestbedAPI():
         :param slice_record: record of the slice
         :type slice_record: dict
 
-        :return: dict of the jobs'deletion status. Success= True, Failure=
+        :returns: dict of the jobs'deletion status. Success= True, Failure=
         False, for each job id.
         :rtype: dict
         """
@@ -873,7 +873,7 @@ class IotlabTestbedAPI():
         found in iotlab_xp table. If not available in the table,
         assume it is a iotlab slice.
         -Updates the iotlab table, deleting jobs when necessary.
-        :return: reservation_list, list of dictionaries with 'lease_id',
+        :returns: reservation_list, list of dictionaries with 'lease_id',
         'reserved_nodes','slice_id', 'state', 'user', 'component_id_list',
         'slice_hrn', 'resource_ids', 't_from', 't_until'
         :rtype: list
@@ -903,7 +903,7 @@ class IotlabTestbedAPI():
                                             %(resa['user']))
             #Construct list of jobs (runing, waiting..) in oar
             job_oar_list.append(resa['lease_id'])
-            #If there is information on the job in SLAB DB ]
+            #If there is information on the job in IOTLAB DB ]
             #(slice used and job id)
             if resa['lease_id'] in jobs_psql_dict:
                 job_info = jobs_psql_dict[resa['lease_id']]
@@ -1034,12 +1034,12 @@ class IotlabTestbedAPI():
         Admin may query all keys. Non-admins may only query their own keys.
         FROM PLC API DOC
 
-        :return: dict with ssh key as key and dicts as value.
+        :returns: dict with ssh key as key and dicts as value.
         :rtype: dict
         """
         if key_filter is None:
             keys = dbsession.query(RegKey).options(joinedload('reg_user')).all()
-        else :
+        else:
             keys = dbsession.query(RegKey).options(joinedload('reg_user')).filter(RegKey.key.in_(key_filter)).all()
 
         key_dict = {}
@@ -1063,7 +1063,7 @@ class IotlabTestbedAPI():
         :param user_record: User's record
         :type key_string: string
         :type user_record: dict
-        :return: True if sucessful, False if not.
+        :returns: True if sucessful, False if not.
         :rtype: Boolean
 
         """
@@ -1085,7 +1085,7 @@ class IotlabTestbedAPI():
         he reg_researcher relationship.
         :param slice_filter: the slice hrn we are looking for
         :type slice_filter: string
-        :return: the slice record enhanced with the user's information if the
+        :returns: the slice record enhanced with the user's information if the
         slice was found, None it wasn't.
         :rtype: dict or None.
         """
@@ -1109,7 +1109,7 @@ class IotlabTestbedAPI():
             #del slicerec['reg_researchers']['_sa_instance_state']
             return slicerec
 
-        else :
+        else:
             return None
 
     @staticmethod
@@ -1118,7 +1118,7 @@ class IotlabTestbedAPI():
         Get the slice record based on the user recordid by using a joinedload
         on the relationship reg_slices_as_researcher. Format the sql record
         into a dict with the mandatory fields for user and slice.
-        :return: dict with slice record and user record if the record was found
+        :returns: dict with slice record and user record if the record was found
         based on the user's id, None if not..
         :rtype:dict or None..
         """
@@ -1159,10 +1159,10 @@ class IotlabTestbedAPI():
         :param slice_filter_type: describes the slice filter type used, can be
         slice_hrn or record_id_user
         :type: string
-        :return: the slice record
+        :returns: the slice record
         :rtype:dict
-        ..seealso:_sql_get_slice_info_from_user
-        ..seealso: _sql_get_slice_info
+        .. seealso::_sql_get_slice_info_from_user
+        .. seealso:: _sql_get_slice_info
         """
 
         #Get list of slices based on the slice hrn
@@ -1206,7 +1206,7 @@ class IotlabTestbedAPI():
         either 'slice_hrn' or "record_id'.
         :type slice_filter: string
         :type slice_filter_type: string
-        :return: a slice dict if slice_filter  and slice_filter_type
+        :returns: a slice dict if slice_filter  and slice_filter_type
         are specified and a matching entry is found in the db. The result
         is put into a list.Or a list of slice dictionnaries if no filters are
         specified.
@@ -1346,7 +1346,7 @@ class IotlabTestbedAPI():
             #if not "instantiation" in iotlab_record:
                 #iotlab_record["instantiation"] = "iotlab-instantiated"
             ##iotlab_record["hrn"] = hrn_to_pl_slicename(hrn)
-            ##Unused hrn_to_pl_slicename because Slab's hrn already
+            ##Unused hrn_to_pl_slicename because Iotlab's hrn already
             ##in the appropriate form SA 23/07/12
             #iotlab_record["hrn"] = hrn
             #logger.debug("IOTLABDRIVER.PY sfa_fields_to_iotlab_fields \
index 84baa2b..98c1936 100644 (file)
@@ -3,8 +3,6 @@ from sfa.util.sfalogging import logger
 from sfa.storage.alchemy import dbsession
 from sfa.storage.model import RegRecord
 
-
-
 from sfa.managers.driver import Driver
 from sfa.rspecs.version_manager import VersionManager
 from sfa.rspecs.rspec import RSpec
@@ -14,9 +12,7 @@ from sfa.util.xrn import Xrn, hrn_to_urn, get_authority
 
 from sfa.iotlab.iotlabpostgres import IotlabDB
 
-
 from sfa.iotlab.iotlabaggregate import IotlabAggregate, iotlab_xrn_to_hostname
-
 from sfa.iotlab.iotlabslices import IotlabSlices
 
 
@@ -29,7 +25,7 @@ class IotlabDriver(Driver):
     Contains methods compliant with the SFA standard and the testbed
     infrastructure (calls to LDAP and OAR).
 
-    ..seealso:: Driver class
+    .. seealso::: Driver class
 
     """
     def __init__(self, config):
@@ -55,7 +51,7 @@ class IotlabDriver(Driver):
 
         :param record_list: list of sfa dictionaries records
         :type record_list: list
-        :return: list of records with extended information in each record
+        :returns: list of records with extended information in each record
         :rtype: list
         """
         return self.fill_record_info (record_list)
@@ -67,7 +63,7 @@ class IotlabDriver(Driver):
 
         :param record_list: list of sfa dictionaries records
         :type record_list: list
-        :return: list of records with extended information in each record
+        :returns: list of records with extended information in each record
         :rtype: list
 
         .. warnings:: Should not be modifying record_list directly because modi
@@ -344,7 +340,7 @@ class IotlabDriver(Driver):
 
         :param rspec: rspec request received.
         :type rspec: RSpec
-        :return: list of lease requests found in the rspec
+        :returns: list of lease requests found in the rspec
         :rtype: list
         """
         requested_lease_list = []
@@ -379,7 +375,7 @@ class IotlabDriver(Driver):
 
         :param requested_lease_list: list of leases
         :type requested_lease_list: list
-        :return: Dictionary with key = start time, value = list of leases
+        :returns: Dictionary with key = start time, value = list of leases
         with the same start time.
         :rtype: dictionary
         """
@@ -398,7 +394,7 @@ class IotlabDriver(Driver):
 
                 requested_job_dict[lease['start_time']] = lease
 
-            else :
+            else:
                 job_lease = requested_job_dict[lease['start_time']]
                 if lease['duration'] == job_lease['duration'] :
                     job_lease['hostname'].append(lease['hostname'])
@@ -440,7 +436,7 @@ class IotlabDriver(Driver):
         :param options:
         :type options:
 
-        :return: a valid Rspec for the slice which has just been
+        :returns: a valid Rspec for the slice which has just been
         modified.
         :rtype: RSpec
 
@@ -520,7 +516,7 @@ class IotlabDriver(Driver):
         Deletes the lease associated with the slice hrn and the credentials
         if the slice belongs to iotlab. Answer to DeleteSliver.
 
-        :return: 1 if the slice to delete was not found on iotlab,
+        :returns: 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
@@ -564,7 +560,7 @@ class IotlabDriver(Driver):
         Caching unused.
         :param options: options used when listing resources (list_leases, info,
         geni_available)
-        :return: rspec string in xml
+        :returns: rspec string in xml
         :rtype: string
         """
 
@@ -607,7 +603,7 @@ class IotlabDriver(Driver):
 
         # cache the result
         #if self.cache and not slice_hrn:
-            #logger.debug("Slab.ListResources: stores advertisement in cache")
+            #logger.debug("Iotlab.ListResources: stores advertisement in cache")
             #self.cache.add(version_string, rspec)
 
         return rspec
@@ -620,7 +616,7 @@ class IotlabDriver(Driver):
         No caching used. Options unused but are defined in the SFA method
         api prototype.
 
-        :return: slice urns list
+        :returns: slice urns list
         :rtype: list
 
         """
@@ -680,7 +676,7 @@ class IotlabDriver(Driver):
         :param old_sfa_record: what is in the db for this hrn
         :param new_sfa_record: what was passed to the Update call
 
-        ..seealso:: update in driver.py.
+        .. seealso::: update in driver.py.
         """
 
         pointer = old_sfa_record['pointer']
index 4e3c6df..9097fdf 100644 (file)
@@ -76,7 +76,7 @@ class IotlabDB:
         if debug == True :
             l_echo_pool = True
             l_echo = True
-        else :
+        else:
             l_echo_pool = False
             l_echo = False
 
@@ -119,6 +119,7 @@ class IotlabDB:
         self.iotlab_engine.execute ("select 1").scalar()
 
 
+
     def session (self):
         """
         Creates a SQLalchemy session. Once the session object is created
index e449b21..ad12b1d 100644 (file)
@@ -80,7 +80,7 @@ class IotlabSlices:
         :type sfa_slice: dict
         :type requested_jobs_dict: dict
         :type peer:
-        :return: leases list of dictionary
+        :returns: leases list of dictionary
         :rtype: list
 
         """
index a4a8300..cee1f90 100644 (file)
@@ -19,7 +19,7 @@ class Iotlabv1(RSpecVersion):
     valid Iotlab XML Rspec.
     """
     #enabled = True
-    type = 'Slab'
+    type = 'Iotlab'
     content_type = 'ad'
     version = '1'
     #template = '<RSpec type="%s"></RSpec>' % type