From 654be5e0ad926fdf70fc62400c42f3870617e8f5 Mon Sep 17 00:00:00 2001 From: Nikolay Stanchev <ns17@it-innovation.soton.ac.uk> Date: Tue, 21 Aug 2018 16:27:25 +0100 Subject: [PATCH] CLMC service resources structure refactoring --- scripts/clmc-service/install-tick-stack.sh | 2 +- src/service/MANIFEST.in | 9 ++++++--- src/service/{clmcservice => }/VERSION | 0 src/service/clmcservice/alertsapi/tests.py | 8 ++++---- src/service/clmcservice/alertsapi/utilities.py | 2 +- .../tosca => }/flame_clmc_alerts_definitions.yaml | 0 .../resources/TICKscript/deadman-template.tick | 0 .../resources/TICKscript/relative-template.tick | 0 .../resources/TICKscript/threshold-template.tick | 0 .../clmc-validator/invalid/alerts_test_config-1.yaml | 0 .../clmc-validator/invalid/alerts_test_config-10.yaml | 0 .../clmc-validator/invalid/alerts_test_config-2.yaml | 0 .../clmc-validator/invalid/alerts_test_config-3.yaml | 0 .../clmc-validator/invalid/alerts_test_config-4.yaml | 0 .../clmc-validator/invalid/alerts_test_config-5.yaml | 0 .../clmc-validator/invalid/alerts_test_config-6.yaml | 0 .../clmc-validator/invalid/alerts_test_config-7.yaml | 0 .../clmc-validator/invalid/alerts_test_config-8.yaml | 0 .../clmc-validator/invalid/alerts_test_config-9.yaml | 0 .../clmc-validator/valid/alerts_test_config-1.yaml | 0 .../clmc-validator/valid/alerts_test_config-2.yaml | 0 .../clmc-validator/valid/alerts_test_config-3.yaml | 0 .../clmc-validator/valid/alerts_test_config-4.yaml | 0 .../clmc-validator/valid/alerts_test_config-5.yaml | 0 .../tosca-parser/invalid/alerts_test_config-1.yaml | 0 .../tosca-parser/invalid/alerts_test_config-2.yaml | 0 .../tosca-parser/invalid/alerts_test_config-3.yaml | 0 .../tosca-parser/invalid/alerts_test_config-4.yaml | 0 .../tosca-parser/valid/alerts_test_config-1.yaml | 0 .../tosca-parser/valid/alerts_test_config-2.yaml | 0 .../tosca-parser/valid/alerts_test_config-3.yaml | 0 .../tosca-parser/valid/alerts_test_config-4.yaml | 0 src/service/setup.py | 4 ++-- 33 files changed, 14 insertions(+), 11 deletions(-) rename src/service/{clmcservice => }/VERSION (100%) rename src/service/clmcservice/{resources/tosca => }/flame_clmc_alerts_definitions.yaml (100%) rename src/service/{clmcservice => }/resources/TICKscript/deadman-template.tick (100%) rename src/service/{clmcservice => }/resources/TICKscript/relative-template.tick (100%) rename src/service/{clmcservice => }/resources/TICKscript/threshold-template.tick (100%) rename src/service/{clmcservice => }/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-1.yaml (100%) rename src/service/{clmcservice => }/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-10.yaml (100%) rename src/service/{clmcservice => }/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-2.yaml (100%) rename src/service/{clmcservice => }/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-3.yaml (100%) rename src/service/{clmcservice => }/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-4.yaml (100%) rename src/service/{clmcservice => }/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-5.yaml (100%) rename src/service/{clmcservice => }/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-6.yaml (100%) rename src/service/{clmcservice => }/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-7.yaml (100%) rename src/service/{clmcservice => }/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-8.yaml (100%) rename src/service/{clmcservice => }/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-9.yaml (100%) rename src/service/{clmcservice => }/resources/tosca/test-data/clmc-validator/valid/alerts_test_config-1.yaml (100%) rename src/service/{clmcservice => }/resources/tosca/test-data/clmc-validator/valid/alerts_test_config-2.yaml (100%) rename src/service/{clmcservice => }/resources/tosca/test-data/clmc-validator/valid/alerts_test_config-3.yaml (100%) rename src/service/{clmcservice => }/resources/tosca/test-data/clmc-validator/valid/alerts_test_config-4.yaml (100%) rename src/service/{clmcservice => }/resources/tosca/test-data/clmc-validator/valid/alerts_test_config-5.yaml (100%) rename src/service/{clmcservice => }/resources/tosca/test-data/tosca-parser/invalid/alerts_test_config-1.yaml (100%) rename src/service/{clmcservice => }/resources/tosca/test-data/tosca-parser/invalid/alerts_test_config-2.yaml (100%) rename src/service/{clmcservice => }/resources/tosca/test-data/tosca-parser/invalid/alerts_test_config-3.yaml (100%) rename src/service/{clmcservice => }/resources/tosca/test-data/tosca-parser/invalid/alerts_test_config-4.yaml (100%) rename src/service/{clmcservice => }/resources/tosca/test-data/tosca-parser/valid/alerts_test_config-1.yaml (100%) rename src/service/{clmcservice => }/resources/tosca/test-data/tosca-parser/valid/alerts_test_config-2.yaml (100%) rename src/service/{clmcservice => }/resources/tosca/test-data/tosca-parser/valid/alerts_test_config-3.yaml (100%) rename src/service/{clmcservice => }/resources/tosca/test-data/tosca-parser/valid/alerts_test_config-4.yaml (100%) diff --git a/scripts/clmc-service/install-tick-stack.sh b/scripts/clmc-service/install-tick-stack.sh index 74de385..0f60ae3 100755 --- a/scripts/clmc-service/install-tick-stack.sh +++ b/scripts/clmc-service/install-tick-stack.sh @@ -58,7 +58,7 @@ done # define the TICK script templates within Kapacitor echo "----> Creating alert templates in Kapacitor" -cd ${REPO_ROOT}/src/service/clmcservice/resources/TICKscript +cd ${REPO_ROOT}/src/service/resources/TICKscript for template_file in *.tick; do template_id=$(basename ${template_file} .tick) echo ${template_id} ${template_file} diff --git a/src/service/MANIFEST.in b/src/service/MANIFEST.in index 2d2b4a8..250b3a9 100644 --- a/src/service/MANIFEST.in +++ b/src/service/MANIFEST.in @@ -1,3 +1,6 @@ -include clmcservice/resources/tosca/flame_clmc_alerts_definitions.yaml -include clmcservice/VERSION -recursive-include clmcservice/resources/TICKscript *_template.tick \ No newline at end of file +include VERSION +include .coveragerc +include network_config.json +include *.ini +include clmcservice/flame_clmc_alerts_definitions.yaml +recursive-include resources/TICKscript *_template.tick \ No newline at end of file diff --git a/src/service/clmcservice/VERSION b/src/service/VERSION similarity index 100% rename from src/service/clmcservice/VERSION rename to src/service/VERSION diff --git a/src/service/clmcservice/alertsapi/tests.py b/src/service/clmcservice/alertsapi/tests.py index 556120f..e5bf014 100644 --- a/src/service/clmcservice/alertsapi/tests.py +++ b/src/service/clmcservice/alertsapi/tests.py @@ -25,7 +25,7 @@ # Python standard libs from os import listdir -from os.path import isfile, join +from os.path import isfile, join, dirname from urllib.parse import urlparse # PIP installed libs @@ -74,7 +74,7 @@ class TestAlertsConfigurationAPI(object): """ for path_suffix, valid_expected in (("valid", True), ("invalid", False)): - test_data_path = join(ROOT_DIR, *["resources", "tosca", "test-data", "tosca-parser", path_suffix]) + test_data_path = join(dirname(ROOT_DIR), *["resources", "tosca", "test-data", "tosca-parser", path_suffix]) for test_file_path in listdir(test_data_path): alert_config_abs_path = join(test_data_path, test_file_path) @@ -105,7 +105,7 @@ class TestAlertsConfigurationAPI(object): """ for path_suffix, valid_expected in (("valid", True), ("invalid", False)): - test_data_path = join(ROOT_DIR, *["resources", "tosca", "test-data", "clmc-validator", path_suffix]) + test_data_path = join(dirname(ROOT_DIR), *["resources", "tosca", "test-data", "clmc-validator", path_suffix]) for test_file_path in listdir(test_data_path): alert_config_abs_path = join(test_data_path, test_file_path) @@ -141,7 +141,7 @@ class TestAlertsConfigurationAPI(object): """ for test_folder in ("clmc-validator", "tosca-parser"): - test_data_path = join(ROOT_DIR, *["resources", "tosca", "test-data", test_folder, "valid"]) + test_data_path = join(dirname(ROOT_DIR), *["resources", "tosca", "test-data", test_folder, "valid"]) for test_file_path in listdir(test_data_path): alert_spec_abs_path = join(test_data_path, test_file_path) diff --git a/src/service/clmcservice/alertsapi/utilities.py b/src/service/clmcservice/alertsapi/utilities.py index 4bb0d2f..f741e5a 100644 --- a/src/service/clmcservice/alertsapi/utilities.py +++ b/src/service/clmcservice/alertsapi/utilities.py @@ -30,7 +30,7 @@ from os.path import join from clmcservice import ROOT_DIR -CLMC_ALERTS_TOSCA_DEFINITIONS_REL_PATH = ["resources", "tosca", "flame_clmc_alerts_definitions.yaml"] +CLMC_ALERTS_TOSCA_DEFINITIONS_REL_PATH = ["flame_clmc_alerts_definitions.yaml"] CLMC_ALERTS_TOSCA_DEFINITIONS_ABS_PATH = join(ROOT_DIR, *CLMC_ALERTS_TOSCA_DEFINITIONS_REL_PATH) diff --git a/src/service/clmcservice/resources/tosca/flame_clmc_alerts_definitions.yaml b/src/service/clmcservice/flame_clmc_alerts_definitions.yaml similarity index 100% rename from src/service/clmcservice/resources/tosca/flame_clmc_alerts_definitions.yaml rename to src/service/clmcservice/flame_clmc_alerts_definitions.yaml diff --git a/src/service/clmcservice/resources/TICKscript/deadman-template.tick b/src/service/resources/TICKscript/deadman-template.tick similarity index 100% rename from src/service/clmcservice/resources/TICKscript/deadman-template.tick rename to src/service/resources/TICKscript/deadman-template.tick diff --git a/src/service/clmcservice/resources/TICKscript/relative-template.tick b/src/service/resources/TICKscript/relative-template.tick similarity index 100% rename from src/service/clmcservice/resources/TICKscript/relative-template.tick rename to src/service/resources/TICKscript/relative-template.tick diff --git a/src/service/clmcservice/resources/TICKscript/threshold-template.tick b/src/service/resources/TICKscript/threshold-template.tick similarity index 100% rename from src/service/clmcservice/resources/TICKscript/threshold-template.tick rename to src/service/resources/TICKscript/threshold-template.tick diff --git a/src/service/clmcservice/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-1.yaml b/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-1.yaml similarity index 100% rename from src/service/clmcservice/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-1.yaml rename to src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-1.yaml diff --git a/src/service/clmcservice/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-10.yaml b/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-10.yaml similarity index 100% rename from src/service/clmcservice/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-10.yaml rename to src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-10.yaml diff --git a/src/service/clmcservice/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-2.yaml b/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-2.yaml similarity index 100% rename from src/service/clmcservice/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-2.yaml rename to src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-2.yaml diff --git a/src/service/clmcservice/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-3.yaml b/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-3.yaml similarity index 100% rename from src/service/clmcservice/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-3.yaml rename to src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-3.yaml diff --git a/src/service/clmcservice/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-4.yaml b/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-4.yaml similarity index 100% rename from src/service/clmcservice/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-4.yaml rename to src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-4.yaml diff --git a/src/service/clmcservice/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-5.yaml b/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-5.yaml similarity index 100% rename from src/service/clmcservice/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-5.yaml rename to src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-5.yaml diff --git a/src/service/clmcservice/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-6.yaml b/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-6.yaml similarity index 100% rename from src/service/clmcservice/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-6.yaml rename to src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-6.yaml diff --git a/src/service/clmcservice/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-7.yaml b/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-7.yaml similarity index 100% rename from src/service/clmcservice/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-7.yaml rename to src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-7.yaml diff --git a/src/service/clmcservice/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-8.yaml b/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-8.yaml similarity index 100% rename from src/service/clmcservice/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-8.yaml rename to src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-8.yaml diff --git a/src/service/clmcservice/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-9.yaml b/src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-9.yaml similarity index 100% rename from src/service/clmcservice/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-9.yaml rename to src/service/resources/tosca/test-data/clmc-validator/invalid/alerts_test_config-9.yaml diff --git a/src/service/clmcservice/resources/tosca/test-data/clmc-validator/valid/alerts_test_config-1.yaml b/src/service/resources/tosca/test-data/clmc-validator/valid/alerts_test_config-1.yaml similarity index 100% rename from src/service/clmcservice/resources/tosca/test-data/clmc-validator/valid/alerts_test_config-1.yaml rename to src/service/resources/tosca/test-data/clmc-validator/valid/alerts_test_config-1.yaml diff --git a/src/service/clmcservice/resources/tosca/test-data/clmc-validator/valid/alerts_test_config-2.yaml b/src/service/resources/tosca/test-data/clmc-validator/valid/alerts_test_config-2.yaml similarity index 100% rename from src/service/clmcservice/resources/tosca/test-data/clmc-validator/valid/alerts_test_config-2.yaml rename to src/service/resources/tosca/test-data/clmc-validator/valid/alerts_test_config-2.yaml diff --git a/src/service/clmcservice/resources/tosca/test-data/clmc-validator/valid/alerts_test_config-3.yaml b/src/service/resources/tosca/test-data/clmc-validator/valid/alerts_test_config-3.yaml similarity index 100% rename from src/service/clmcservice/resources/tosca/test-data/clmc-validator/valid/alerts_test_config-3.yaml rename to src/service/resources/tosca/test-data/clmc-validator/valid/alerts_test_config-3.yaml diff --git a/src/service/clmcservice/resources/tosca/test-data/clmc-validator/valid/alerts_test_config-4.yaml b/src/service/resources/tosca/test-data/clmc-validator/valid/alerts_test_config-4.yaml similarity index 100% rename from src/service/clmcservice/resources/tosca/test-data/clmc-validator/valid/alerts_test_config-4.yaml rename to src/service/resources/tosca/test-data/clmc-validator/valid/alerts_test_config-4.yaml diff --git a/src/service/clmcservice/resources/tosca/test-data/clmc-validator/valid/alerts_test_config-5.yaml b/src/service/resources/tosca/test-data/clmc-validator/valid/alerts_test_config-5.yaml similarity index 100% rename from src/service/clmcservice/resources/tosca/test-data/clmc-validator/valid/alerts_test_config-5.yaml rename to src/service/resources/tosca/test-data/clmc-validator/valid/alerts_test_config-5.yaml diff --git a/src/service/clmcservice/resources/tosca/test-data/tosca-parser/invalid/alerts_test_config-1.yaml b/src/service/resources/tosca/test-data/tosca-parser/invalid/alerts_test_config-1.yaml similarity index 100% rename from src/service/clmcservice/resources/tosca/test-data/tosca-parser/invalid/alerts_test_config-1.yaml rename to src/service/resources/tosca/test-data/tosca-parser/invalid/alerts_test_config-1.yaml diff --git a/src/service/clmcservice/resources/tosca/test-data/tosca-parser/invalid/alerts_test_config-2.yaml b/src/service/resources/tosca/test-data/tosca-parser/invalid/alerts_test_config-2.yaml similarity index 100% rename from src/service/clmcservice/resources/tosca/test-data/tosca-parser/invalid/alerts_test_config-2.yaml rename to src/service/resources/tosca/test-data/tosca-parser/invalid/alerts_test_config-2.yaml diff --git a/src/service/clmcservice/resources/tosca/test-data/tosca-parser/invalid/alerts_test_config-3.yaml b/src/service/resources/tosca/test-data/tosca-parser/invalid/alerts_test_config-3.yaml similarity index 100% rename from src/service/clmcservice/resources/tosca/test-data/tosca-parser/invalid/alerts_test_config-3.yaml rename to src/service/resources/tosca/test-data/tosca-parser/invalid/alerts_test_config-3.yaml diff --git a/src/service/clmcservice/resources/tosca/test-data/tosca-parser/invalid/alerts_test_config-4.yaml b/src/service/resources/tosca/test-data/tosca-parser/invalid/alerts_test_config-4.yaml similarity index 100% rename from src/service/clmcservice/resources/tosca/test-data/tosca-parser/invalid/alerts_test_config-4.yaml rename to src/service/resources/tosca/test-data/tosca-parser/invalid/alerts_test_config-4.yaml diff --git a/src/service/clmcservice/resources/tosca/test-data/tosca-parser/valid/alerts_test_config-1.yaml b/src/service/resources/tosca/test-data/tosca-parser/valid/alerts_test_config-1.yaml similarity index 100% rename from src/service/clmcservice/resources/tosca/test-data/tosca-parser/valid/alerts_test_config-1.yaml rename to src/service/resources/tosca/test-data/tosca-parser/valid/alerts_test_config-1.yaml diff --git a/src/service/clmcservice/resources/tosca/test-data/tosca-parser/valid/alerts_test_config-2.yaml b/src/service/resources/tosca/test-data/tosca-parser/valid/alerts_test_config-2.yaml similarity index 100% rename from src/service/clmcservice/resources/tosca/test-data/tosca-parser/valid/alerts_test_config-2.yaml rename to src/service/resources/tosca/test-data/tosca-parser/valid/alerts_test_config-2.yaml diff --git a/src/service/clmcservice/resources/tosca/test-data/tosca-parser/valid/alerts_test_config-3.yaml b/src/service/resources/tosca/test-data/tosca-parser/valid/alerts_test_config-3.yaml similarity index 100% rename from src/service/clmcservice/resources/tosca/test-data/tosca-parser/valid/alerts_test_config-3.yaml rename to src/service/resources/tosca/test-data/tosca-parser/valid/alerts_test_config-3.yaml diff --git a/src/service/clmcservice/resources/tosca/test-data/tosca-parser/valid/alerts_test_config-4.yaml b/src/service/resources/tosca/test-data/tosca-parser/valid/alerts_test_config-4.yaml similarity index 100% rename from src/service/clmcservice/resources/tosca/test-data/tosca-parser/valid/alerts_test_config-4.yaml rename to src/service/resources/tosca/test-data/tosca-parser/valid/alerts_test_config-4.yaml diff --git a/src/service/setup.py b/src/service/setup.py index c020a6e..5d966f5 100644 --- a/src/service/setup.py +++ b/src/service/setup.py @@ -32,7 +32,7 @@ def get_version(*relative_path): """ Reads and parses a version file. - :param relative_path: iterable representing the relative path to the version file, e.g. ["clmcservice", "VERSION"] + :param relative_path: iterable representing the relative path to the version file :return: """ @@ -76,7 +76,7 @@ tests_require = [ setup( name="clmcservice", - version=get_version("clmcservice", "VERSION"), + version=get_version("VERSION"), author="Michael Boniface", author_email="mjb@it-innovation.soton.ac.uk", description="FLAME CLMC Service Module", -- GitLab