From db4089e1fd532cc63305f06b04d05287136a645b Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Thu, 24 Nov 2011 19:03:43 +0100 Subject: [PATCH] simplified macros - single file --- system/TestMain.py | 10 ++--- system/TestPlc.py | 14 +++---- system/macro_free_all.py | 10 ----- system/macro_sfa.py | 17 --------- system/macro_sfa_restart.py | 10 ----- system/macro_sfa_scratch.py | 13 ------- system/macro_sfa_standalone.py | 11 ------ system/macros.py | 68 ++++++++++++++++++++++++++++++++++ 8 files changed, 77 insertions(+), 76 deletions(-) delete mode 100644 system/macro_free_all.py delete mode 100644 system/macro_sfa.py delete mode 100644 system/macro_sfa_restart.py delete mode 100644 system/macro_sfa_scratch.py delete mode 100644 system/macro_sfa_standalone.py create mode 100644 system/macros.py diff --git a/system/TestMain.py b/system/TestMain.py index 1f0945f..6806f9c 100755 --- a/system/TestMain.py +++ b/system/TestMain.py @@ -14,6 +14,7 @@ import utils from TestPlc import TestPlc from TestSite import TestSite from TestNode import TestNode +from macros import sequences # add $HOME in PYTHONPATH so we can import LocalSubstrate.py sys.path.append(os.environ['HOME']) @@ -30,13 +31,10 @@ class Step: if self.native: self.method=Step.natives[self.name] else: - # non-native steps (macros) are implemented as a 'Step' try: - modulename = 'macro_' + self.name - module = __import__ (modulename) - self.substeps = module.sequence + self.substeps=sequences[self.name] except Exception,e: - print "Cannot load macro step %s (%s) - exiting"%(self.name,e) + print "macro step %s not found in macros.py (%s) - exiting"%(self.name,e) raise def norm_name (self): return self.name.replace('_','-') @@ -67,7 +65,7 @@ class Step: # just do a listdir, hoping we're in the right directory... @staticmethod def list_macros (): - names= [ filename.replace('macro_','').replace('.py','') for filename in glob.glob ('macro_*.py')] + names= sequences.keys() names.sort() return names diff --git a/system/TestPlc.py b/system/TestPlc.py index 599abfb..f702b98 100644 --- a/system/TestPlc.py +++ b/system/TestPlc.py @@ -113,7 +113,7 @@ class TestPlc: 'populate' , SEP, 'nodestate_show','nodestate_safeboot','nodestate_boot', SEP, 'qemu_list_all', 'qemu_list_mine', 'qemu_kill_all', SEP, - 'sfa_install', 'sfa_tables_install', 'sfa_plc_install', 'sfa_client_install', SEPSFA, + 'sfa_install_core', 'sfa_install_sfatables', 'sfa_install_plc', 'sfa_install_client', SEPSFA, 'sfa_plcclean', 'sfa_dbclean', 'sfa_stop','sfa_uninstall', 'sfi_clean', SEPSFA, 'plc_db_dump' , 'plc_db_restore', SEP, 'standby_1_through_20',SEP, @@ -1130,23 +1130,19 @@ class TestPlc: "yum install sfa sfa-plc sfa-sfatables sfa-client" return self.yum_install ("sfa sfa-plc sfa-sfatables sfa-client") - ### sfa_install_rpm - def sfa_install(self): + def sfa_install_core(self): "yum install sfa" return self.yum_install ("sfa") - ### sfa_install_rpm - def sfa_plc_install(self): + def sfa_install_plc(self): "yum install sfa-plc" return self.yum_install("sfa-plc") - ### sfa_install_rpm - def sfa_client_install(self): + def sfa_install_client(self): "yum install sfa-client" return self.yum_install("sfa-client") - ### sfa_install_rpm - def sfa_tables_install(self): + def sfa_install_sfatables(self): "yum install sfa-sfatables" return self.yum_install ("sfa-sfatables") diff --git a/system/macro_free_all.py b/system/macro_free_all.py deleted file mode 100644 index 0c28937..0000000 --- a/system/macro_free_all.py +++ /dev/null @@ -1,10 +0,0 @@ -# Thierry Parmentelat -# Copyright (C) 2010 INRIA -# -# a macro for releasing all local resources and cleanup trackers - -"release local resources (stop vs, kill qemus, clean trackers)" - -# no trackers anymore -sequence = [ 'vs_stop', 'qemu_kill_mine', ] - diff --git a/system/macro_sfa.py b/system/macro_sfa.py deleted file mode 100644 index f3182cb..0000000 --- a/system/macro_sfa.py +++ /dev/null @@ -1,17 +0,0 @@ -sequence = [ -'sfa_plcclean', -'sfa_dbclean', -'sfa_import', -'sfi_configure', -'sfa_add_user', -'sfa_add_slice', -'sfa_discover', -'sfa_create_slice', -'sfa_check_slice_plc', -'sfa_update_user', -'sfa_update_slice', -'sfa_view', -'sfa_utest', -'sfa_delete_slice', -'sfa_delete_user', -] diff --git a/system/macro_sfa_restart.py b/system/macro_sfa_restart.py deleted file mode 100644 index 0c7ee8e..0000000 --- a/system/macro_sfa_restart.py +++ /dev/null @@ -1,10 +0,0 @@ -sequence = [ -'sfa_plcclean', -'sfa_dbclean', -'sfa_stop', -'sfi_clean', -'sfa_configure', -'sfa_import', -'sfa_start', -'sfi_configure', -] diff --git a/system/macro_sfa_scratch.py b/system/macro_sfa_scratch.py deleted file mode 100644 index 83b7b97..0000000 --- a/system/macro_sfa_scratch.py +++ /dev/null @@ -1,13 +0,0 @@ -sequence=[ - 'show', SEP, - 'vs_delete','timestamp_vs','vs_create', SEP, - 'plc_install', 'plc_configure', 'plc_start', SEP, - 'keys_fetch', 'keys_store', 'keys_clear_known_hosts', SEP, - '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_all', '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, -] diff --git a/system/macro_sfa_standalone.py b/system/macro_sfa_standalone.py deleted file mode 100644 index d55cc3a..0000000 --- a/system/macro_sfa_standalone.py +++ /dev/null @@ -1,11 +0,0 @@ -sequence=[ -'show', -'vs_delete', -'timestamp_vs', -'vs_create', -'sfa_install', -'sfa_tables_install', -'sfa_configure', -'cross_sfa_configure', -'sfa_start', -] diff --git a/system/macros.py b/system/macros.py new file mode 100644 index 0000000..47ecd0d --- /dev/null +++ b/system/macros.py @@ -0,0 +1,68 @@ +# Thierry Parmentelat +# Copyright (C) 2010 INRIA + +sequences={} + +"release local resources (stop vs, kill qemus, clean trackers)" +sequences['free_all'] = [ 'vs_stop', 'qemu_kill_mine', ] + +"re-run a complete sfa cycle from a nightly test" +sequences['sfa'] = [ + 'sfa_plcclean', + 'sfa_dbclean', + 'sfa_import', + 'sfi_configure', + 'sfa_add_user', + 'sfa_add_slice', + 'sfa_discover', + 'sfa_create_slice', + 'sfa_check_slice_plc', + 'sfa_update_user', + 'sfa_update_slice', + 'sfa_view', + 'sfa_utest', + 'sfa_delete_slice', + 'sfa_delete_user', + ] + +sequences['sfa_restart'] = [ + 'sfa_plcclean', + 'sfa_dbclean', + 'sfa_stop', + 'sfi_clean', + 'sfa_configure', + 'sfa_import', + 'sfa_start', + 'sfi_configure', + ] + +# run the whole SFA stuff but from scratch, new vs all reinstalled and all +sequences['sfa_scratch'] = [ + 'show', + 'vs_delete','timestamp_vs','vs_create', + 'plc_install', 'plc_configure', 'plc_start', + 'keys_fetch', 'keys_store', 'keys_clear_known_hosts', + 'initscripts', 'sites', 'nodes', 'slices', 'nodegroups', 'leases', + 'nodestate_reinstall', 'qemu_local_init','bootcd', 'qemu_local_config', + 'qemu_export', 'qemu_kill_mine', 'qemu_start', 'timestamp_qemu', + 'sfa_install_all', 'sfa_configure', 'cross_sfa_configure', 'sfa_start', 'sfa_import', + 'sfi_configure', 'sfa_add_user', 'sfa_add_slice', 'sfa_discover', + 'sfa_create_slice', 'sfa_check_slice_plc', + 'sfa_update_user', 'sfa_update_slice', 'sfa_view', 'sfa_utest', +] + +# something that can given to the nightly to prepare a standalone sfa setup +# after what you'll want to tweak the config to point to a myplc some place else +sequences['sfa_standalone'] = [ + 'show', + 'vs_delete', + 'timestamp_vs', + 'vs_create', + 'sfa_install_core', + 'sfa_install_client', + 'sfa_configure', + 'cross_sfa_configure', + 'sfa_start', + 'sfi_configure', +] + -- 2.43.0