new steps slice-fs-present and slice-fs-deleted - call slice-fs-deleted before re...
Thierry Parmentelat [Tue, 13 May 2014 17:07:15 +0000 (19:07 +0200)]
system/TestPlc.py
system/TestSlice.py
system/macros.py

index 6584f70..dc465a7 100644 (file)
@@ -162,7 +162,7 @@ class TestPlc:
         'ssh_slice_sfa@1', 'sfa_delete_slice@1', 'sfa_delete_user@1', SEPSFA,
         'cross_check_tcp@1', 'check_system_slice', SEP,
         # check slices are turned off properly
-        'empty_slices', 'ssh_slice_off', SEP,
+        'empty_slices', 'ssh_slice_off', 'slice_fs_deleted', SEP,
         # check they are properly re-created with the same name
         'fill_slices', 'ssh_slice_again_ignore', SEP,
         'gather_logs_force', SEP,
@@ -180,7 +180,7 @@ class TestPlc:
         'sfa_plcclean', 'sfa_dbclean', 'sfa_stop','sfa_uninstall', 'sfi_clean', SEPSFA,
         'plc_db_dump' , 'plc_db_restore', SEP,
         'check_netflow','check_drl', SEP,
-        'debug_nodemanager', SEP,
+        'debug_nodemanager', 'slice_fs_present', SEP,
         'standby_1_through_20','yes','no',SEP,
         ]
 
@@ -1250,7 +1250,10 @@ class TestPlc:
 
     @slice_mapper
     def ssh_slice_basics(self): pass
-
+    @slice_mapper
+    def slice_fs_present(self): pass
+    @slice_mapper
+    def slice_fs_deleted(self): pass
     @slice_mapper
     def check_vsys_defaults(self): pass
 
index 6aee812..0b61e7e 100644 (file)
@@ -113,7 +113,7 @@ class TestSlice:
         hostnames=[]
         for nodename in self.slice_spec['nodenames']:
             node_spec=self.test_site.locate_node(nodename)
-            test_node=TestNode(self,self.test_site,node_spec)
+            test_node=TestNode(self.test_plc,self.test_site,node_spec)
             hostnames += [test_node.name()]
         utils.header("Adding %r in %s"%(hostnames,slice_name))
         self.test_plc.apiserver.AddSliceToNodes(auth, slice_name, hostnames)
@@ -221,3 +221,25 @@ class TestSlice:
         else:           success = retcod!=0
         if not success: utils.header ("WRONG RESULT for %s"%msg)
         return success
+
+    def check_rootfs (self, expected):
+        overall=True
+        for nodename in self.slice_spec['nodenames']:
+            node_spec=self.test_site.locate_node(nodename)
+            test_node=TestNode(self.test_plc,self.test_site,node_spec)
+            test_node_ssh=test_node.create_test_ssh()
+            command="ls /vservers/%s"%self.name()
+            full_command = test_node_ssh.actual_command(command)
+            retcod=utils.system(full_command,silent=True)
+            # we expect the fs to be present, retcod should be 0
+            if expected:        fine=(retcod==0)
+            else:               fine=(retcod!=0)
+            if not fine: overall=False
+        return overall
+
+    def slice_fs_present (self, options): 
+        "check that /vservers/<slicename> can be found"
+        return self.check_rootfs (expected=True)
+    def slice_fs_deleted (self, options): 
+        "check that /vservers/<slicename> has been properly wiped off on all nodes"
+        return self.check_rootfs (expected=False)
index ff7b492..7446f0b 100644 (file)
@@ -39,7 +39,7 @@ sequences['sfa_populate'] = [
     'sfa_utest', 
     ]
 
-sequences['sfa-delete'] = [
+sequences['sfa_delete'] = [
     'sfa_delete_slice', 
     'sfa_delete_user',
 ]
@@ -72,8 +72,8 @@ sequences['sfa_user_slice'] = [
 ]
 
 sequences['sfa_provision'] = [ 
-    'sfa-discover',
-    'sfa-create_slice',
+    'sfa_discover',
+    'sfa_create_slice',
     'sfa_check_slice_plc',
     'sfi_view_all',
 ]
@@ -140,11 +140,11 @@ sequences['sfa_standalone'] = [
 # run qemu-again2
 
 sequences['qemu_again1'] = [
-    'qemu-kill-mine',
+    'qemu_kill_mine',
 ]
 
 sequences['qemu_again2']=[
-    'qemu-clean-mine',
+    'qemu_clean_mine',
     'nodestate_reinstall', 'qemu_local_init','bootcd', 'qemu_local_config', 
     'qemu_clean_mine', 'qemu_export', 'qemu_start', 'qemu_timestamp', 
     'ping_node', 'ssh_node_debug',
@@ -153,9 +153,22 @@ sequences['qemu_again2']=[
 
 # same but only up to ping 
 sequences['qemu_again2_ping']=[
-    'qemu-clean-mine',
+    'qemu_clean_mine',
     'nodestate_reinstall', 'qemu_local_init','bootcd', 'qemu_local_config', 
     'qemu_clean_mine', 'qemu_export', 'qemu_start', 'qemu_timestamp', 
     'ping_node',
 ]
     
+sequences['slice_up']=[
+    'fill_slices',
+    'ssh_slice',
+]
+sequences['slice_down']=[
+    'empty_slices',
+    'ssh_slice_off',
+]
+sequences['slice_up_down']=[
+    'slice_up',
+    'slice_down',
+]
+