Renaming variable holding a reference to the iotlab database.
[sfa.git] / sfa / importer / iotlabimporter.py
index 5bd0344..db8246e 100644 (file)
@@ -7,7 +7,7 @@ from sfa.util.config import Config
 from sfa.util.xrn import Xrn, get_authority, hrn_to_urn
 
 from sfa.iotlab.iotlabdriver import IotlabDriver
-from sfa.iotlab.iotlabpostgres import IotlabDB
+from sfa.iotlab.iotlabpostgres import TestbedAdditionalSfaDB
 from sfa.trust.certificate import Keypair, convert_public_key
 from sfa.trust.gid import create_uuid
 
@@ -181,7 +181,7 @@ class IotlabImporter:
                         - ignored" % (node_id))
                 continue
             escaped_hrn =  \
-                self.hostname_to_hrn_escaped(iotlabdriver.iotlab_api.root_auth,
+                self.hostname_to_hrn_escaped(iotlabdriver.testbed_shell.root_auth,
                                              node['hostname'])
             self.logger.info("IOTLABIMPORTER node %s " % (node))
             hrn = node['hrn']
@@ -238,8 +238,8 @@ class IotlabImporter:
         :type iotlabdriver: IotlabDriver
         """
 
-        sites_listdict = iotlabdriver.iotlab_api.GetSites()
-        nodes_listdict = iotlabdriver.iotlab_api.GetNodes()
+        sites_listdict = iotlabdriver.testbed_shell.GetSites()
+        nodes_listdict = iotlabdriver.testbed_shell.GetNodes()
         nodes_by_id = dict([(node['node_id'], node) for node in nodes_listdict])
         for site in sites_listdict:
             site_hrn = site['name']
@@ -332,7 +332,7 @@ class IotlabImporter:
             iotlabdriver attributes.
         :type iotlabdriver: IotlabDriver
         """
-        ldap_person_listdict = iotlabdriver.iotlab_api.GetPersons()
+        ldap_person_listdict = iotlabdriver.testbed_shell.GetPersons()
         self.logger.info("IOTLABIMPORT \t ldap_person_listdict %s \r\n"
                          % (ldap_person_listdict))
 
@@ -505,7 +505,7 @@ class IotlabImporter:
 
     def run(self, options):
         """
-        Create the special iotlab table, iotlab_xp, in the iotlab database.
+        Create the special iotlab table, testbed_xp, in the iotlab database.
         Import everything (users, slices, nodes and sites from OAR
         and LDAP) into the SFA database.
         Delete stale records that are no longer in OAR or LDAP.
@@ -515,12 +515,12 @@ class IotlabImporter:
         config = Config()
 
         iotlabdriver = IotlabDriver(config)
-        iotlab_db = IotlabDB(config)
+        leases_db = TestbedAdditionalSfaDB(config)
         #Create special slice table for iotlab
 
-        if not iotlab_db.exists('iotlab_xp'):
-            iotlab_db.createtable()
-            self.logger.info("IotlabImporter.run:  iotlab_xp table created ")
+        if not leases_db.exists('testbed_xp'):
+            leases_db.createtable()
+            self.logger.info("IotlabImporter.run:  testbed_xp table created ")
 
         # import site and node records in site into the SFA db.
         self.import_sites_and_nodes(iotlabdriver)
@@ -529,7 +529,7 @@ class IotlabImporter:
 
          ### remove stale records
         # special records must be preserved
-        system_hrns = [iotlabdriver.hrn, iotlabdriver.iotlab_api.root_auth,
+        system_hrns = [iotlabdriver.hrn, iotlabdriver.testbed_shell.root_auth,
                        iotlabdriver.hrn + '.slicemanager']
         for record in self.all_records:
             if record.hrn in system_hrns: