summaryrefslogtreecommitdiffstats
path: root/catalog-be/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-be/src/main')
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactTypeImportManager.java2
-rw-r--r--catalog-be/src/main/resources/import/tosca/artifact-types/artifactTypes.yml43
-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
4 files changed, 65 insertions, 50 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactTypeImportManager.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactTypeImportManager.java
index e6ff100fc1..441dfa741a 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactTypeImportManager.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ArtifactTypeImportManager.java
@@ -60,7 +60,7 @@ public class ArtifactTypeImportManager {
return Either.right(componentsUtils.getResponseFormat(artifactTypes.right().value()));
}
final List<ArtifactTypeDefinition> elementTypes = createArtifactTypesByDao(artifactTypes.left().value());
- if (includeToModelDefaultImports) {
+ if (includeToModelDefaultImports && StringUtils.isNotEmpty(modelName)) {
commonImportManager.addTypesToDefaultImports(ElementTypeEnum.ARTIFACT_TYPE, artifactTypesYml, modelName);
}
return Either.left(elementTypes);
diff --git a/catalog-be/src/main/resources/import/tosca/artifact-types/artifactTypes.yml b/catalog-be/src/main/resources/import/tosca/artifact-types/artifactTypes.yml
index bfd078923b..97d00e5b51 100644
--- a/catalog-be/src/main/resources/import/tosca/artifact-types/artifactTypes.yml
+++ b/catalog-be/src/main/resources/import/tosca/artifact-types/artifactTypes.yml
@@ -1,39 +1,40 @@
tosca.artifacts.Root:
- description: This is the default (root) TOSCA Artifact Type definition that all other TOSCA base Artifact Types derive from.
+ description: This is the default (root) TOSCA Artifact Type definition that all other TOSCA base Artifact Types derive from.
tosca.artifacts.Deployment.Image:
- derived_from: tosca.artifacts.Deployment
- description: This artifact type represents a parent type for any "image" which is an opaque packaging of a TOSCA Node's deployment (whether real or virtual) whose contents are typically already installed and pre-configured (i.e., "stateful") and prepared to be run on a known target container.
+ derived_from: tosca.artifacts.Deployment
+ description: This artifact type represents a parent type for any "image" which is an opaque packaging of a TOSCA Node's deployment (whether real or virtual) whose contents are typically already installed and pre-configured (i.e., "stateful") and prepared to be run on a known target container.
tosca.artifacts.Implementation.Bash:
- derived_from: tosca.artifacts.Implementation
- description: This artifact type represents a Bash script type that contains Bash commands that can be executed on the Unix Bash shell.
+ derived_from: tosca.artifacts.Implementation
+ description: This artifact type represents a Bash script type that contains Bash commands that can be executed on the Unix Bash shell.
tosca.artifacts.Deployment.Image.VM:
- derived_from: tosca.artifacts.Deployment
- description: This artifact represents the parent type for all Virtual Machine (VM) image and container formatted deployment artifacts. These images contain a stateful capture of a machine (e.g., server) including operating system and installed software along with any configurations and can be run on another machine using a hypervisor which virtualizes typical server (i.e., hardware) resources.
+ derived_from: tosca.artifacts.Deployment
+ description: This artifact represents the parent type for all Virtual Machine (VM) image and container formatted deployment artifacts. These images contain a stateful capture of a machine (e.g., server) including operating system and installed software along with any configurations and can be run on another machine using a hypervisor which virtualizes typical server (i.e., hardware) resources.
tosca.artifacts.Implementation.Python:
- derived_from: tosca.artifacts.Implementation
- description: This artifact type represents a Python file that contains Python language constructs that can be executed within a Python interpreter.
+ derived_from: tosca.artifacts.Implementation
+ description: This artifact type represents a Python file that contains Python language constructs that can be executed within a Python interpreter.
tosca.artifacts.Deployment:
- derived_from: tosca.artifacts.Root
- description: This artifact type represents the parent type for all deployment artifacts in TOSCA. This class of artifacts typically represents a binary packaging of an application or service that is used to install/create or deploy it as part of a node's lifecycle.
+ derived_from: tosca.artifacts.Root
+ description: This artifact type represents the parent type for all deployment artifacts in TOSCA. This class of artifacts typically represents a binary packaging of an application or service that is used to install/create or deploy it as part of a node's lifecycle.
tosca.artifacts.File:
- derived_from: tosca.artifacts.Root
- description: This artifact type is used when an artifact definition needs to have its associated file simply treated as a file and no special handling/handlers are invoked (i.e., it is not treated as either an implementation or deployment artifact type).
+ derived_from: tosca.artifacts.Root
+ description: This artifact type is used when an artifact definition needs to have its associated file simply treated as a file and no special handling/handlers are invoked (i.e., it is not treated as either an implementation or deployment artifact type).
tosca.artifacts.Implementation:
- derived_from: tosca.artifacts.Root
- description: This artifact type represents the parent type for all implementation artifacts in TOSCA. These artifacts are used to implement operations of TOSCA interfaces either directly (e.g., scripts) or indirectly (e.g., config. files).
+ derived_from: tosca.artifacts.Root
+ description: This artifact type represents the parent type for all implementation artifacts in TOSCA. These artifacts are used to implement operations of TOSCA interfaces either directly (e.g., scripts) or indirectly (e.g., config. files).
tosca.artifacts.nfv.SwImage:
- derived_from: tosca.artifacts.Deployment.Image
- description: describes the software image which is directly loaded on the virtualisation container realizing of the VDU or is to be loaded on a virtual
+ derived_from: tosca.artifacts.Deployment.Image
+ description: describes the software image which is directly loaded on the virtualisation container realizing of the VDU or is to be loaded on a virtual
+
tosca.artifacts.Implementation.nfv.Mistral:
- derived_from: tosca.artifacts.Implementation
- description: artifacts for Mistral workflows
- mime_type: application/x-yaml
- file_ext: [ yaml ]
+ derived_from: tosca.artifacts.Implementation
+ description: artifacts for Mistral workflows
+ mime_type: application/x-yaml
+ file_ext: [ yaml ]
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")