new SFA settings names (sfa_plc vs sfa_db)
[tests.git] / system / TestPlc.py
index e938ea8..c3acc6c 100644 (file)
@@ -92,7 +92,8 @@ class TestPlc:
         'initscripts', 'sites', 'nodes', 'slices', 'nodegroups', 'leases', SEP,
         'nodestate_reinstall', 'qemu_local_init','bootcd', 'qemu_local_config', SEP,
         'qemu_export', 'qemu_kill_mine', 'qemu_start', 'timestamp_qemu', SEP,
-       'sfa_install', 'sfa_configure', 'cross_sfa_configure', 'sfa_import', 'sfa_start', SEPSFA,
+       'sfa_install', 'sfa_tables_install', 'sfa_plc_install', 'sfa_client_install', SEPSFA,
+        'sfa_configure', 'cross_sfa_configure', 'sfa_start', 'sfa_import', SEPSFA,
         'sfi_configure@1', 'sfa_add_user@1', 'sfa_add_slice@1', 'sfa_discover@1', SEPSFA,
         'sfa_create_slice@1', 'sfa_check_slice_plc@1', SEPSFA, 
         'sfa_update_user@1', 'sfa_update_slice@1', 'sfa_view@1', 'sfa_utest@1',SEPSFA,
@@ -105,11 +106,8 @@ class TestPlc:
         'force_gather_logs', SEP,
         ]
     other_steps = [ 
-        'export',
-        'check_hooks',  
-        'free_all',
-        'show_boxes', 'local_list','local_rel','local_rel_plc','local_rel_qemu',SEP,
-        'plc_stop', 'vs_start', 'vs_stop', SEP,
+        'export', 'show_boxes', SEP,
+        'check_hooks', 'plc_stop', 'vs_start', 'vs_stop', SEP,
         'delete_initscripts', 'delete_nodegroups','delete_all_sites', SEP,
         'delete_sites', 'delete_nodes', 'delete_slices', 'keys_clean', SEP,
         'delete_leases', 'list_leases', SEP,
@@ -118,7 +116,7 @@ class TestPlc:
         'qemu_list_all', 'qemu_list_mine', 'qemu_kill_all', SEP,
         'sfa_plcclean', 'sfa_dbclean', 'sfa_stop','sfa_uninstall', 'sfi_clean', SEP,
         'plc_db_dump' , 'plc_db_restore', SEP,
-        'standby_1 through 20',SEP,
+        'standby_1_through_20',SEP,
         ]
 
     @staticmethod
@@ -200,6 +198,13 @@ class TestPlc:
     def run_in_guest_piped (self,local,remote):
         return utils.system(local+" | "+self.test_ssh.actual_command(self.host_to_guest(remote),keep_stdin=True))
 
+    # does a yum install in the vs, ignore yum retcod, check with rpm
+    def yum_install (self, rpms):
+        if isinstance (rpms, list): 
+            rpms=" ".join(rpms)
+        self.run_in_guest("yum -y install %s"%rpms)
+        return  self.run_in_guest("rpm -q %s"%rpms)==0
+
     def auth_root (self):
        return {'Username':self.plc_spec['PLC_ROOT_USER'],
                'AuthMethod':'password',
@@ -352,7 +357,8 @@ class TestPlc:
         print "export PLCHOST=%s"%fqdn
         print "export GUEST=%s"%self.plc_spec['vservername']
         # find hostname of first node
-        (hostname,_) = self.all_node_infos()[0]
+        (hostname,qemubox) = self.all_node_infos()[0]
+        print "export KVMHOST=%s.%s"%(qemubox,domain)
         print "export NODE=%s"%(hostname)
         return True
 
@@ -465,36 +471,36 @@ class TestPlc:
         now=int(time.time())
         return utils.system(self.test_ssh.actual_command("echo %d > /vservers/%s.timestamp"%(now,self.vservername)))==0
         
-    def local_pre (self):
-        "run site-dependant pre-test script as defined in LocalTestResources"
-        from LocalTestResources import local_resources
-        return local_resources.step_pre(self)
-    def local_post (self):
-        "run site-dependant post-test script as defined in LocalTestResources"
-        from LocalTestResources import local_resources
-        return local_resources.step_post(self)
-    def local_list (self):
-        "run site-dependant list script as defined in LocalTestResources"
-        from LocalTestResources import local_resources
-        return local_resources.step_list(self)
-    def local_rel (self):
-        "run site-dependant release script as defined in LocalTestResources"
-        from LocalTestResources import local_resources
-        return local_resources.step_release(self)
-    def local_rel_plc (self):
-        "run site-dependant release script as defined in LocalTestResources"
-        from LocalTestResources import local_resources
-        return local_resources.step_release_plc(self)
-    def local_rel_qemu (self):
-        "run site-dependant release script as defined in LocalTestResources"
-        from LocalTestResources import local_resources
-        return local_resources.step_release_qemu(self)
+#    def local_pre (self):
+#        "run site-dependant pre-test script as defined in LocalTestResources"
+#        from LocalTestResources import local_resources
+#        return local_resources.step_pre(self)
+# 
+#    def local_post (self):
+#        "run site-dependant post-test script as defined in LocalTestResources"
+#        from LocalTestResources import local_resources
+#        return local_resources.step_post(self)
+# 
+#    def local_list (self):
+#        "run site-dependant list script as defined in LocalTestResources"
+#        from LocalTestResources import local_resources
+#        return local_resources.step_list(self)
+# 
+#    def local_rel (self):
+#        "run site-dependant release script as defined in LocalTestResources"
+#        from LocalTestResources import local_resources
+#        return local_resources.step_release(self)
+# 
+#    def local_rel_plc (self):
+#        "run site-dependant release script as defined in LocalTestResources"
+#        from LocalTestResources import local_resources
+#        return local_resources.step_release_plc(self)
+# 
+#    def local_rel_qemu (self):
+#        "run site-dependant release script as defined in LocalTestResources"
+#        from LocalTestResources import local_resources
+#        return local_resources.step_release_qemu(self)
+# 
     def vs_delete(self):
         "vserver delete the test myplc"
         self.run_in_host("vserver --silent %s delete"%self.vservername)
@@ -566,8 +572,7 @@ class TestPlc:
         pkgs_list.append ("noderepo-%s"%nodefamily)
         pkgs_list.append ("bootstrapfs-%s-plain"%nodefamily)
         pkgs_string=" ".join(pkgs_list)
-        self.run_in_guest("yum -y install %s"%pkgs_string)
-        return self.run_in_guest("rpm -q %s"%pkgs_string)==0
+        return self.yum_install (pkgs_list)
 
     ### 
     def plc_configure(self):
@@ -1122,11 +1127,23 @@ class TestPlc:
 
     ### sfa_install_rpm
     def sfa_install(self):
-        "yum install sfa, sfa-plc and sfa-client"
-        # ignore yum retcod
-        self.run_in_guest("yum -y install sfa sfa-client sfa-plc sfa-sfatables")
-        return  self.run_in_guest("rpm -q sfa sfa-client sfa-plc sfa-sfatables")==0
+        "yum install sfa"
+        return self.yum_install ("sfa")
+        
+    ### sfa_install_rpm
+    def sfa_plc_install(self):
+        "yum install sfa-plc"
+        return self.yum_install("sfa-plc")
+        
+    ### sfa_install_rpm
+    def sfa_client_install(self):
+        "yum install sfa-client"
+        return self.yum_install("sfa-client")
         
+    ### sfa_install_rpm
+    def sfa_tables_install(self):
+        "yum install sfa-client"
+        return self.yum_install ("sfa-sfatables")
 
     def sfa_dbclean(self):
         "thoroughly wipes off the SFA database"
@@ -1215,12 +1232,14 @@ class TestPlc:
                     'SFA_REGISTRY_HOST',
                     'SFA_AGGREGATE_HOST',
                      'SFA_SM_HOST',
+                    'SFA_PLC_URL',
                      'SFA_PLC_USER',
                      'SFA_PLC_PASSWORD',
-                     'SFA_PLC_DB_HOST',
-                     'SFA_PLC_DB_USER',
-                     'SFA_PLC_DB_PASSWORD',
-                    'SFA_PLC_URL',
+                     'SFA_DB_HOST',
+                     'SFA_DB_USER',
+                     'SFA_DB_PASSWORD',
+                     # should be tmp
+                     'SFA_DB_NAME',
                      ]:
             fileconf.write ('e %s\n%s\n'%(var,self.plc_spec['sfa'][var]))
         # the way plc_config handles booleans just sucks..
@@ -1470,6 +1489,9 @@ class TestPlc:
 
         utils.header('Database restored from ' + dump)
 
+    def standby_1_through_20(self):
+        """convenience function to wait for a specified number of minutes"""
+        pass
     @standby_generic 
     def standby_1(): pass
     @standby_generic