fix: successful run was wrongly reporting error - fix: trackers consistency
[tests.git] / system / TestResources.py
index f69c12d..741e3dc 100644 (file)
@@ -17,18 +17,23 @@ class TestResources:
     def localize (self,plcs,options):
         try:
             plcs = self.localize_qemus(plcs,options)
-        except:
-            print 'Could not localize qemus - exiting'
+        except Exception, e:
+            print '* Could not localize qemus','--',e,'--','exiting'
             sys.exit(1)
         try:
             plcs = self.localize_nodes(plcs,options)
-        except:
-            print 'Could not localize nodes - exiting'
+        except Exception,e:
+            print '* Could not localize nodes','--',e,'--','exiting'
             sys.exit(1)
         try:
             plcs = self.localize_plcs(plcs,options)
-        except:
-            print 'Could not localize plcs - exiting'
+        except Exception,e:
+            print '* Could not localize plcs','--',e,'--','exiting'
+            sys.exit(1)
+        try:
+            plcs = self.localize_rspec(plcs,options)
+        except Exception,e:
+            print '* Could not localize RSpec','--',e,'--','exiting'
             sys.exit(1)
         return plcs
 
@@ -67,7 +72,7 @@ class TestResources:
         
 
     def localize_nodes (self, plcs, options):
-        
+       
         ip_pool = TestPoolIP (self.nodes_ip_pool(),options)
         network_dict = self.network_dict()
 
@@ -100,7 +105,6 @@ class TestResources:
     def localize_plcs (self,plcs,options):
         
         utils.header ("Turning configuration into a vserver-based one for onelab")
-    
         ip_pool = TestPoolIP (self.plcs_ip_pool(),options)
     
         plc_counter=0
@@ -139,10 +143,11 @@ class TestResources:
 
     # as a plc step this should return a boolean
     def step_pre (self,plc):
-        return self.trqemu_record (plc) and self.trqemu_free(plc)
+        return self.trqemu_record (plc) and self.trqemu_free(plc) \
+           and self.trplc_record (plc) and self.trplc_free(plc)
 
     def step_post (self,plc):
-        return self.trplc_record (plc) and self.trplc_free(plc)
+        return True
 
     def step_cleanup (self,plc):
         return self.trqemu_cleanup(plc) and self.trplc_cleanup(plc)
@@ -202,3 +207,19 @@ class TestResources:
     def trplc_list (self,plc):
         TrackerPlc(plc.options,instances=self.max_plcs()).list()
         return True
+
+    def localize_rspec (self,plcs,options):
+       
+       utils.header ("Localize SFA Slice RSpec")
+
+       for plc in plcs:
+           for site in plc['sites']:
+               for node in site['nodes']:
+                   plc['sfa']['sfa_slice_rspec']['part4'] = node['node_fields']['hostname']
+            plc['sfa']['SFA_REGISTRY_HOST'] = plc['PLC_DB_HOST']
+            plc['sfa']['SFA_AGGREGATE_HOST'] = plc['PLC_DB_HOST']
+            plc['sfa']['SFA_SM_HOST'] = plc['PLC_DB_HOST']
+            plc['sfa']['SFA_PLC_DB_HOST'] = plc['PLC_DB_HOST']
+           plc['sfa']['SFA_PLC_URL'] = 'https://' + plc['PLC_API_HOST'] + ':443/PLCAPI/' 
+       
+       return plcs