summaryrefslogtreecommitdiffstats
path: root/catalog-be/src/main/resources/scripts
diff options
context:
space:
mode:
authorvasraz <vasyl.razinkov@est.tech>2022-01-17 14:29:03 +0000
committerVasyl Razinkov <vasyl.razinkov@est.tech>2022-01-17 14:33:08 +0000
commit129f40e169a572b9dd5cfe6ad66bc0ee74b922d9 (patch)
treeae2e3ac19368ccb1808a035c57e6dc6fa7f0fb5b /catalog-be/src/main/resources/scripts
parentd80ae5529f51d6ad10759c07cb4960762700faef (diff)
Add sdc-be-init support for artifact types
Change-Id: Id9fdaf7b7bf0cd5d583434fbe97741dd9836df9d Signed-off-by: Vasyl Razinkov <vasyl.razinkov@est.tech> Issue-ID: SDC-3845
Diffstat (limited to 'catalog-be/src/main/resources/scripts')
-rw-r--r--catalog-be/src/main/resources/scripts/sdcBePy/tosca/imports/run.py3
-rw-r--r--catalog-be/src/main/resources/scripts/sdcBePy/tosca/models/normativeElementsList.py67
2 files changed, 42 insertions, 28 deletions
diff --git a/catalog-be/src/main/resources/scripts/sdcBePy/tosca/imports/run.py b/catalog-be/src/main/resources/scripts/sdcBePy/tosca/imports/run.py
index db6e91481c..9ba770d895 100644
--- a/catalog-be/src/main/resources/scripts/sdcBePy/tosca/imports/run.py
+++ b/catalog-be/src/main/resources/scripts/sdcBePy/tosca/imports/run.py
@@ -24,7 +24,7 @@ def main(sdc_be_proxy, update_version):
process_element_list(normativeElementsList.get_normative_element_candidate_list(base_file_location), sdc_be_proxy)
process_type_list(normativeTypesList.get_normative_type_candidate_list(base_file_location), sdc_be_proxy, update_version)
process_element_list(normativeElementsList.get_normative_element_with_metadata_list(base_file_location), sdc_be_proxy)
- #Add model based normatives
+ # Add model based normatives
model_import_manager = ModelImportManager(Path(base_file_location) / 'models', ModelClient(sdc_be_proxy),
NodeTypeClient(sdc_be_proxy))
model_import_manager.deploy_models()
@@ -37,6 +37,7 @@ def main(sdc_be_proxy, update_version):
logger.log("Script end ->", "All normatives imported successfully!")
logger.print_and_exit(0, None)
+
def run():
sdc_be_proxy, update_version = parse_and_create_proxy()
main(sdc_be_proxy, update_version)
diff --git a/catalog-be/src/main/resources/scripts/sdcBePy/tosca/models/normativeElementsList.py b/catalog-be/src/main/resources/scripts/sdcBePy/tosca/models/normativeElementsList.py
index ffd412f38f..6d00bb08ed 100644
--- a/catalog-be/src/main/resources/scripts/sdcBePy/tosca/models/normativeElementsList.py
+++ b/catalog-be/src/main/resources/scripts/sdcBePy/tosca/models/normativeElementsList.py
@@ -1,78 +1,91 @@
from os import path
+
from sdcBePy.tosca.models.normativeElementCandidate import NormativeElementCandidate
+
def get_normative_element_candidate_list(base_file_location):
return [
get_data(base_file_location),
get_capability(base_file_location),
get_relationship(base_file_location),
get_interface_lifecycle(base_file_location),
- get_categories(base_file_location)
+ get_categories(base_file_location),
+ get_artifacts(base_file_location)
]
+
def get_normative_element_with_metadata_list(base_file_location):
return [
get_group(base_file_location),
get_policy(base_file_location)
]
+
def get_normative_candidate(base_file_location, url, filename, zip_name, with_metadata=False):
if path.isdir(base_file_location):
return NormativeElementCandidate(base_file_location, url, filename, zip_name, with_metadata=with_metadata)
+
def get_data(base_file_location="/"):
return get_normative_candidate(base_file_location + "data-types/",
- "/sdc2/rest/v1/catalog/uploadType/datatypes",
- "dataTypes",
- "dataTypesZip")
+ "/sdc2/rest/v1/catalog/uploadType/datatypes",
+ "dataTypes",
+ "dataTypesZip")
def get_capability(base_file_location="/"):
return get_normative_candidate(base_file_location + "capability-types/",
- "/sdc2/rest/v1/catalog/uploadType/capability",
- "capabilityTypes",
- "capabilityTypeZip")
+ "/sdc2/rest/v1/catalog/uploadType/capability",
+ "capabilityTypes",
+ "capabilityTypeZip")
def get_relationship(base_file_location="/"):
return get_normative_candidate(base_file_location + "relationship-types/",
- "/sdc2/rest/v1/catalog/uploadType/relationship",
- "relationshipTypes",
- "relationshipTypeZip")
+ "/sdc2/rest/v1/catalog/uploadType/relationship",
+ "relationshipTypes",
+ "relationshipTypeZip")
def get_interface_lifecycle(base_file_location="../../../import/tosca/"):
return get_normative_candidate(base_file_location + "interface-lifecycle-types/",
- "/sdc2/rest/v1/catalog/uploadType/interfaceLifecycle",
- "interfaceLifecycleTypes",
- "interfaceLifecycleTypeZip")
+ "/sdc2/rest/v1/catalog/uploadType/interfaceLifecycle",
+ "interfaceLifecycleTypes",
+ "interfaceLifecycleTypeZip")
def get_categories(base_file_location="/"):
return get_normative_candidate(base_file_location + "categories/",
- "/sdc2/rest/v1/catalog/uploadType/categories",
- "categoryTypes",
- "categoriesZip")
+ "/sdc2/rest/v1/catalog/uploadType/categories",
+ "categoryTypes",
+ "categoriesZip")
+
+
+def get_artifacts(base_file_location="/"):
+ return get_normative_candidate(base_file_location + "artifact-types/",
+ "/sdc2/rest/v1/catalog/uploadType/artifactTypes",
+ "artifactTypes",
+ "artifactsZip")
def get_group(base_file_location="/"):
return get_normative_candidate(base_file_location + "group-types/",
- "/sdc2/rest/v1/catalog/uploadType/grouptypes",
- "groupTypes",
- "groupTypesZip",
- with_metadata=True)
+ "/sdc2/rest/v1/catalog/uploadType/grouptypes",
+ "groupTypes",
+ "groupTypesZip",
+ with_metadata=True)
def get_policy(base_file_location="/"):
return get_normative_candidate(base_file_location + "policy-types/",
- "/sdc2/rest/v1/catalog/uploadType/policytypes",
- "policyTypes",
- "policyTypesZip",
- with_metadata=True)
+ "/sdc2/rest/v1/catalog/uploadType/policytypes",
+ "policyTypes",
+ "policyTypesZip",
+ with_metadata=True)
def get_annotation(base_file_location="/"):
return get_normative_candidate(base_file_location + "annotation-types/",
- "/sdc2/rest/v1/catalog/uploadType/annotationtypes",
- "annotationTypes",
- "annotationTypesZip")
+ "/sdc2/rest/v1/catalog/uploadType/annotationtypes",
+ "annotationTypes",
+ "annotationTypesZip")