summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-tosca-lib
diff options
context:
space:
mode:
authorMichael Lando <ml636r@att.com>2017-02-19 12:35:04 +0200
committerMichael Lando <ml636r@att.com>2017-02-19 12:35:04 +0200
commitf5f13c4f6b6fe3b4d98e349dfd7db59339803436 (patch)
tree72caffc93fab394ffa3b761505775331f1c559b9 /openecomp-be/lib/openecomp-tosca-lib
parent451a3400b76511393c62a444f588a4ed15f4a549 (diff)
push addional code
Change-Id: Ia427bb3460cda3a896f8faced2de69eaf3807b74 Signed-off-by: Michael Lando <ml636r@att.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-tosca-lib')
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/pom.xml66
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaArtifactType.java39
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaCapabilityType.java52
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaDataType.java84
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaElementTypes.java25
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaFunctions.java43
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaGroupType.java40
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaNodeType.java162
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaPolicyType.java43
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaRelationshipType.java44
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaServiceModel.java72
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/ArtifactDefinition.java69
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/ArtifactType.java83
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/AttributeDefinition.java85
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/CapabilityAssignment.java45
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/CapabilityDefinition.java113
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/CapabilityFilterDefinition.java35
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/CapabilityType.java82
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/Constraint.java181
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/DataType.java73
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/Directive.java40
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/EntrySchema.java65
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/GroupDefinition.java64
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/GroupType.java82
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/Import.java61
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/InterfaceDefinition.java24
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/InterfaceType.java24
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/Metadata.java55
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/NodeFilter.java47
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/NodeTemplate.java127
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/NodeType.java125
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/ParameterDefinition.java99
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/PolicyDefinition.java63
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/PolicyType.java73
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/PropertyDefinition.java112
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/PropertyType.java117
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/RelationshipTemplate.java99
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/RelationshipType.java93
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/RequirementAssignment.java70
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/RequirementDefinition.java82
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/Scalar.java34
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/ServiceTemplate.java144
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/Status.java42
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/SubstitutionMapping.java54
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/Template.java24
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/TopologyTemplate.java114
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/heatextend/ParameterDefinitionExt.java55
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/heatextend/PropertyTypeExt.java85
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/errors/InvalidAddActionNullEntityErrorBuilder.java58
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/errors/InvalidRequirementAssignmentErrorBuilder.java57
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/errors/ToscaErrorCodes.java36
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/errors/ToscaInvalidEntryNotFoundErrorBuilder.java55
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/errors/ToscaInvalidSubstituteNodeTemplateErrorBuilder.java55
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/errors/ToscaInvalidSubstituteNodeTemplatePropertiesErrorBuilder.java59
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/errors/ToscaInvalidSubstitutionServiceTemplateErrorBuilder.java57
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/errors/ToscaMissingSubstitutionMappingForReqCapErrorBuilder.java88
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/errors/ToscaNodeTypeNotFoundErrorBuilder.java46
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/exceptions/CsarCreationErrorBuilder.java43
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/exceptions/CsarMissingEntryPointErrorBuilder.java44
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/DataModelUtil.java588
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/ToscaAnalyzerService.java66
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/ToscaConstants.java65
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/ToscaFileOutputService.java34
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/ToscaNativeTypesServiceTemplate.java309
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/ToscaUtil.java151
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/impl/ToscaAnalyzerServiceImpl.java467
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/impl/ToscaFileOutputServiceCsarImpl.java158
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/yamlutil/ToscaExtensionYamlUtil.java93
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/TestUtil.java71
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/datatypes/PropertyTypeTest.java20
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/datatypes/ToscaModelTest.java282
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/datatypes/model/CapabilityDefinitionTest.java101
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/datatypes/model/RequirementDefinitionTest.java40
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/services/DataModelUtilTest.java104
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/services/impl/ToscaAnalyzerServiceImplTest.java472
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/services/impl/ToscaFileOutputServiceCsarImplTest.java150
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/analyzerService/NestedServiceTemplateReqTest.yaml176
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/analyzerService/ServiceTemplateSubstituteTest.yaml89
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/analyzerService/toscasubstitution/MainServiceTemplate.yaml75
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/analyzerService/toscasubstitution/nestedServiceTemplate.yaml130
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/globalServiceTemplates/AbstractSubstituteGlobalTypesServiceTemplate.yaml47
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/globalServiceTemplates/CinderVolumeGlobalTypesServiceTemplate.yaml176
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/globalServiceTemplates/CommonGlobalTypesServiceTemplate.yaml210
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/globalServiceTemplates/ContrailNetworkRuleGlobalTypeServiceTemplate.yaml117
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/globalServiceTemplates/ContrailVirtualNetworkGlobalTypeServiceTemplate.yaml71
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/globalServiceTemplates/GlobalSubstitutionTypesServiceTemplate.yaml93
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/globalServiceTemplates/NativeTypesServiceTemplateServiceTemplate.yaml194
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/globalServiceTemplates/NeutronNetGlobalTypesServiceTemplate.yaml97
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/globalServiceTemplates/NeutronPortGlobalTypesServiceTemplate.yaml151
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/globalServiceTemplates/NeutronSecurityRulesGlobalTypesServiceTemplate.yaml116
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/globalServiceTemplates/NovaServerGlobalTypesServiceTemplate.yaml249
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/model/serviceTemplate.yaml116
-rw-r--r--openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/model/serviceTemplateHeatExtend.yaml117
93 files changed, 9503 insertions, 0 deletions
diff --git a/openecomp-be/lib/openecomp-tosca-lib/pom.xml b/openecomp-be/lib/openecomp-tosca-lib/pom.xml
new file mode 100644
index 0000000000..eb67349896
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/pom.xml
@@ -0,0 +1,66 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+
+
+ <parent>
+ <artifactId>openecomp-sdc-lib</artifactId>
+ <groupId>org.openecomp.sdc</groupId>
+ <version>1.0.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.openecomp.core</groupId>
+ <artifactId>openecomp-tosca-lib</artifactId>
+ <name>openecomp-tosca-lib</name>
+
+
+ <dependencies>
+ <dependency>
+ <groupId>org.openecomp.core</groupId>
+ <artifactId>openecomp-utilities-lib</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.sdc</groupId>
+ <artifactId>openecomp-sdc-datatypes-lib</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.openecomp.core</groupId>
+ <artifactId>openecomp-common-lib</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>ch.qos.logback</groupId>
+ <artifactId>logback-classic</artifactId>
+ <version>1.1.2</version>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>RELEASE</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-all</artifactId>
+ <version>1.10.19</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ <version>19.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.yaml</groupId>
+ <artifactId>snakeyaml</artifactId>
+ </dependency>
+ </dependencies>
+
+
+
+
+
+</project> \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaArtifactType.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaArtifactType.java
new file mode 100644
index 0000000000..2da60c0b79
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaArtifactType.java
@@ -0,0 +1,39 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.datatypes;
+
+
+public enum ToscaArtifactType {
+
+ DEPLOYMENT("tosca.artifacts.Deployment"),;
+
+ private String displayName;
+
+ ToscaArtifactType(String displayName) {
+ this.displayName = displayName;
+ }
+
+ public String getDisplayName() {
+ return displayName;
+ }
+
+
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaCapabilityType.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaCapabilityType.java
new file mode 100644
index 0000000000..d26eb3a83a
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaCapabilityType.java
@@ -0,0 +1,52 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.datatypes;
+
+
+public enum ToscaCapabilityType {
+
+ ROOT("tosca.capabilities.Root"),
+ NODE("tosca.capabilities.Node"),
+ CONTAINER("tosca.capabilities.Container"),
+ NETWORK_BINDABLE("tosca.capabilities.network.Bindable"),
+ SCALABLE("tosca.capabilities.Scalable"),
+ OPERATING_SYSTEM("tosca.capabilities.OperatingSystem"),
+ ENDPOINT_ADMIN("tosca.capabilities.Endpoint.Admin"),
+ ATTACHMENT("tosca.capabilities.Attachment"),
+ NETWORK_LINKABLE("tosca.capabilities.network.Linkable"),
+ METRIC("org.openecomp.capabilities.Metric"),
+ NFV_METRIC("tosca.capabilities.nfv.Metric"),
+ METRIC_CEILOMETER("org.openecomp.capabilities.metric.Ceilometer"),
+ METRIC_SNMP_TRAP("org.openecomp.capabilities.metric.SnmpTrap"),
+ METRIC_SNMP_POLLING("org.openecomp.capabilities.metric.SnmpPolling"),;
+
+ private String displayName;
+
+ ToscaCapabilityType(String displayName) {
+ this.displayName = displayName;
+ }
+
+ public String getDisplayName() {
+ return displayName;
+ }
+
+
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaDataType.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaDataType.java
new file mode 100644
index 0000000000..2a9df65b17
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaDataType.java
@@ -0,0 +1,84 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.datatypes;
+
+
+public enum ToscaDataType {
+
+ ROOT("tosca.datatypes.Root"),
+ NETWORK_NETWORK_INFO("tosca.datatypes.network.NetworkInfo"),
+ NETWORK_PORT_INFO("tosca.datatypes.network.PortInfo"),
+ NOVA_SERVER_PORT_EXTRA_PROPERTIES(
+ "org.openecomp.datatypes.heat.novaServer.network.PortExtraProperties"),
+ NETWORK_ADDRESS_PAIR("org.openecomp.datatypes.heat.network.AddressPair"),
+ NEUTRON_PORT_FIXED_IPS("org.openecomp.datatypes.heat.neutron.port.FixedIps"),
+ CONTRAIL_NETWORK_RULE("org.openecomp.datatypes.heat.contrail.network.rule.Rule"),
+ CONTRAIL_NETWORK_RULE_LIST("org.openecomp.datatypes.heat.contrail.network.rule.RuleList"),
+ CONTRAIL_NETWORK_RULE_PORT_PAIRS("org.openecomp.datatypes.heat.contrail.network.rule.PortPairs"),
+ CONTRAIL_NETWORK_RULE_VIRTUAL_NETWORK(
+ "org.openecomp.datatypes.heat.contrail.network.rule.VirtualNetwork"),
+ CONTRAILV2_NETWORK_RULE("org.openecomp.datatypes.heat.contrailV2.network.rule.Rule"),
+ CONTRAILV2_NETWORK_RULE_LIST("org.openecomp.datatypes.heat.contrailV2.network.rule.RuleList"),
+ CONTRAILV2_NETWORK_RULE_SRC_PORT_PAIRS(
+ "org.openecomp.datatypes.heat.contrailV2.network.rule.SrcPortPairs"),
+ CONTRAILV2_NETWORK_RULE_DST_PORT_PAIRS(
+ "org.openecomp.datatypes.heat.contrailV2.network.rule.DstPortPairs"),
+ CONTRAILV2_NETWORK_RULE_DST_VIRTUAL_NETWORK(
+ "org.openecomp.datatypes.heat.contrailV2.network.rule.DstVirtualNetwork"),
+ CONTRAILV2_NETWORK_RULE_SRC_VIRTUAL_NETWORK(
+ "org.openecomp.datatypes.heat.contrailV2.network.rule.SrcVirtualNetwork"),
+ CONTRAILV2_VIRTUAL_MACHINE_INTERFACE_PROPERTIES(
+ "org.openecomp.datatypes.heat.contrailV2.virtual.machine.interface.Properties"),
+ CONTRAILV2_NETWORK_RULE_ACTION_LIST(
+ "org.openecomp.datatypes.heat.contrailV2.network.rule.ActionList"),
+ CONTRAILV2_VIRTUAL_NETWORK_IPAM_REF_DATA(
+ "org.openecomp.datatypes.heat.contrailV2.virtual.network.rule.IpamRefData"),
+ CONTRAILV2_VIRTUAL_NETWORK_IPAM_REF_DATA_IPAM_SUBNET_LIST(
+ "org.openecomp.datatypes.heat.contrailV2.virtual.network.rule.ref.data.IpamSubnetList"),
+ CONTRAILV2_VIRTUAL_NETWORK_IPAM_REF_DATA_IPAM_SUBNET(
+ "org.openecomp.datatypes.heat.contrailV2.virtual.network.rule.ref.data.IpamSubnet"),
+ CONTRAILV2_VIRTUAL_NETWORK_POLICY_REF_DATA(
+ "org.openecomp.datatypes.heat.contrailV2.virtual.network.rule.RefData"),
+ CONTRAILV2_VIRTUAL_NETWORK_POLICY_REF_DATA_SEQUENCE(
+ "org.openecomp.datatypes.heat.contrailV2.virtual.network.rule.RefDataSequence"),
+ NOVA_SERVER_NETWORK_ADDRESS_INFO("org.openecomp.datatypes.heat.novaServer.network.AddressInfo"),
+ NEUTRON_SUBNET("org.openecomp.datatypes.heat.network.neutron.Subnet"),
+ NETWORK_ALLOCATION_POOL("org.openecomp.datatypes.heat.network.AllocationPool"),
+ NETWORK_HOST_ROUTE("org.openecomp.datatypes.heat.network.subnet.HostRoute"),
+ SUBSTITUTION_FILTER("org.openecomp.datatypes.heat.substitution.SubstitutionFilter"),
+ SUBSTITUTION_FILTERING("org.openecomp.datatypes.heat.substitution.SubstitutionFiltering"),
+ NEUTRON_SECURITY_RULES_RULE("org.openecomp.datatypes.heat.network.neutron.SecurityRules.Rule"),
+ CONTRAIL_STATIC_ROUTE("org.openecomp.datatypes.heat.network.contrail.port.StaticRoute"),
+ CONTRAIL_ADDRESS_PAIR("org.openecomp.datatypes.heat.network.contrail.AddressPair"),
+ CONTRAIL_INTERFACE_DATA("org.openecomp.datatypes.heat.network.contrail.InterfaceData");
+
+ private String displayName;
+
+ ToscaDataType(String displayName) {
+ this.displayName = displayName;
+ }
+
+ public String getDisplayName() {
+ return displayName;
+ }
+
+
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaElementTypes.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaElementTypes.java
new file mode 100644
index 0000000000..97fec7ae7d
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaElementTypes.java
@@ -0,0 +1,25 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.datatypes;
+
+public enum ToscaElementTypes {
+ CAPABILITY_TYPE
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaFunctions.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaFunctions.java
new file mode 100644
index 0000000000..989a1c6178
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaFunctions.java
@@ -0,0 +1,43 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.datatypes;
+
+public enum ToscaFunctions {
+
+ TOKEN("token"),
+ GET_PROPERTY("get_property"),
+ GET_ATTRIBUTE("get_attribute"),
+ GET_ARTIFACT("get_artifact"),
+ GET_INPUT("get_input"),
+ CONCAT("concat");
+
+ private String displayName;
+
+ ToscaFunctions(String displayName) {
+ this.displayName = displayName;
+ }
+
+ public String getDisplayName() {
+ return displayName;
+ }
+
+
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaGroupType.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaGroupType.java
new file mode 100644
index 0000000000..5422fa6dc9
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaGroupType.java
@@ -0,0 +1,40 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.datatypes;
+
+
+public enum ToscaGroupType {
+
+ ROOT("tosca.groups.Root"),
+ HEAT_STACK("org.openecomp.groups.heat.HeatStack"),;
+
+ private String displayName;
+
+ ToscaGroupType(String displayName) {
+ this.displayName = displayName;
+ }
+
+ public String getDisplayName() {
+ return displayName;
+ }
+
+
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaNodeType.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaNodeType.java
new file mode 100644
index 0000000000..c7c5a6e64e
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaNodeType.java
@@ -0,0 +1,162 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.datatypes;
+
+import org.openecomp.sdc.tosca.services.ToscaConstants;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+
+/**
+ * The enum Tosca node type.
+ */
+public enum ToscaNodeType {
+
+ /**
+ * Compute tosca node type.
+ */
+ COMPUTE("tosca.nodes.Compute"),
+ /**
+ * Root tosca node type.
+ */
+ ROOT("tosca.nodes.Root"),
+ /**
+ * Block storage tosca node type.
+ */
+ BLOCK_STORAGE("tosca.nodes.BlockStorage"),
+ /**
+ * Network tosca node type.
+ */
+ NETWORK("tosca.nodes.network.Network"),
+ /**
+ * Network port tosca node type.
+ */
+ NETWORK_PORT("tosca.nodes.network.Port"),
+ /**
+ * Nova server tosca node type.
+ */
+ NOVA_SERVER(ToscaConstants.NODES_PREFIX + "nova.Server"),
+ /**
+ * Cinder volume tosca node type.
+ */
+ CINDER_VOLUME(ToscaConstants.NODES_PREFIX + "cinder.Volume"),
+ /**
+ * Neutron net tosca node type.
+ */
+ NEUTRON_NET("org.openecomp.resource.vl.nodes.heat.network.neutron.Net"),
+ /**
+ * Neutron port tosca node type.
+ */
+ NEUTRON_PORT("org.openecomp.resource.cp.nodes.heat.network.neutron.Port"),
+ /**
+ * Neutron security rules tosca node type.
+ */
+ NEUTRON_SECURITY_RULES("org.openecomp.resource.vfc.rules.nodes"
+ + ".heat.network.neutron.SecurityRules"),
+ /**
+ * Contrail virtual network tosca node type.
+ */
+ CONTRAIL_VIRTUAL_NETWORK("org.openecomp.resource.vl.nodes.heat.network.contrail.VirtualNetwork"),
+ /**
+ * Contrail network rule tosca node type.
+ */
+ CONTRAIL_NETWORK_RULE("org.openecomp.resource.vfc."
+ + "rules.nodes.heat.network.contrail.NetworkRules"),
+ /**
+ * Contrailv 2 virtual network tosca node type.
+ */
+ CONTRAILV2_VIRTUAL_NETWORK("org.openecomp.resource.vl.nodes."
+ + "heat.network.contrailV2.VirtualNetwork"),
+ /**
+ * Contrailv 2 network rule tosca node type.
+ */
+ CONTRAILV2_NETWORK_RULE(
+ "org.openecomp.resource.vfc.rules.nodes.heat.network.contrailV2.NetworkRules"),
+ /**
+ * Contrailv 2 virtual machine interface tosca node type.
+ */
+ CONTRAILV2_VIRTUAL_MACHINE_INTERFACE(
+ "org.openecomp.resource.cp.nodes.heat.contrailV2.VirtualMachineInterface"),
+ /**
+ * Abstract substitute tosca node type.
+ */
+ ABSTRACT_SUBSTITUTE("org.openecomp.resource.abstract.nodes.AbstractSubstitute"),
+ /**
+ * Contrail compute tosca node type.
+ */
+ CONTRAIL_COMPUTE(ToscaConstants.NODES_PREFIX + "contrail.Compute"),
+ /**
+ * Contrail port tosca node type.
+ */
+ CONTRAIL_PORT("org.openecomp.resource.cp.nodes.heat.network.contrail.Port"),
+ /**
+ * Contrail abstract substitute tosca node type.
+ */
+ CONTRAIL_ABSTRACT_SUBSTITUTE("org.openecomp.resource.abstract."
+ + "nodes.contrail.AbstractSubstitute"),;
+
+ private static final Map<String, ToscaNodeType> mMap =
+ Collections.unmodifiableMap(initializeMapping());
+ private String displayName;
+
+ ToscaNodeType(String displayName) {
+ this.displayName = displayName;
+ }
+
+ /**
+ * Initialize mapping map.
+ *
+ * @return the map
+ */
+ public static Map<String, ToscaNodeType> initializeMapping() {
+ Map<String, ToscaNodeType> toscaMap = new HashMap<>();
+ for (ToscaNodeType v : ToscaNodeType.values()) {
+ toscaMap.put(v.displayName, v);
+ }
+ return toscaMap;
+ }
+
+ /**
+ * Gets tosca node type by display name.
+ *
+ * @param displayName the display name
+ * @return the tosca node type by display name
+ */
+ public static ToscaNodeType getToscaNodeTypeByDisplayName(String displayName) {
+ if (mMap.containsKey(displayName)) {
+ return mMap.get(displayName);
+ }
+ return null;
+ }
+
+ /**
+ * Gets display name.
+ *
+ * @return the display name
+ */
+ public String getDisplayName() {
+ return displayName;
+ }
+
+
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaPolicyType.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaPolicyType.java
new file mode 100644
index 0000000000..38195782d2
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaPolicyType.java
@@ -0,0 +1,43 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.datatypes;
+
+public enum ToscaPolicyType {
+
+ PLACEMENT("tosca.policy.placement"),
+ PLACEMENT_ANTILOCATE("org.openecomp.policies.placement.Antilocate"),
+ PLACEMENT_COLOCATE("org.openecomp.policies.placement.Colocate"),
+ PLACEMENT_VALET_AFFINITY("org.openecomp.policies.placement.valet.Affinity"),
+ PLACEMENT_VALET_EXCLUSIVITY("org.openecomp.policies.placement.valet.Exclusivity"),
+ PLACEMENT_VALET_DIVERSITY("org.openecomp.policies.placement.valet.Diversity");
+
+ private String displayName;
+
+ ToscaPolicyType(String displayName) {
+ this.displayName = displayName;
+ }
+
+ public String getDisplayName() {
+ return displayName;
+ }
+
+
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaRelationshipType.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaRelationshipType.java
new file mode 100644
index 0000000000..03a35bd4d0
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaRelationshipType.java
@@ -0,0 +1,44 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.datatypes;
+
+public enum ToscaRelationshipType {
+
+ ROOT("tosca.relationships.Root"),
+ NATIVE_ATTACHES_TO("tosca.relationships.AttachesTo"),
+ DEPENDS_ON("tosca.relationships.DependsOn"),
+ NETWORK_LINK_TO("tosca.relationships.network.LinksTo"),
+ NETWORK_BINDS_TO("tosca.relationships.network.BindsTo"),
+ CINDER_VOLUME_ATTACHES_TO("org.openecomp.relationships.heat.cinder.VolumeAttachesTo"),
+ ATTACHES_TO("org.openecomp.relationships.AttachesTo"),;
+
+ private String displayName;
+
+ ToscaRelationshipType(String displayName) {
+ this.displayName = displayName;
+ }
+
+ public String getDisplayName() {
+ return displayName;
+ }
+
+
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaServiceModel.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaServiceModel.java
new file mode 100644
index 0000000000..70b23ae3f6
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaServiceModel.java
@@ -0,0 +1,72 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.datatypes;
+
+import org.openecomp.core.utilities.file.FileContentHandler;
+import org.openecomp.sdc.datatypes.model.AsdcModel;
+import org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate;
+
+import java.util.Collections;
+import java.util.Map;
+
+public class ToscaServiceModel implements AsdcModel {
+ private FileContentHandler artifactFiles;
+ private Map<String, ServiceTemplate> serviceTemplates;
+ private String entryDefinitionServiceTemplate;
+
+ /**
+ * Instantiates a new Tosca service model.
+ *
+ * @param artifactFiles the artifact files
+ * @param serviceTemplates the service templates
+ * @param entryDefinitionServiceTemplate the entry definition service template
+ */
+ public ToscaServiceModel(FileContentHandler artifactFiles,
+ Map<String, ServiceTemplate> serviceTemplates,
+ String entryDefinitionServiceTemplate) {
+ this.artifactFiles = artifactFiles;
+ this.serviceTemplates = serviceTemplates;
+ this.entryDefinitionServiceTemplate = entryDefinitionServiceTemplate;
+ }
+
+
+ public FileContentHandler getArtifactFiles() {
+ return artifactFiles;//MapUtils.isEmpty(artifactFiles) ? Collections.EMPTY_MAP
+ // : Collections.unmodifiableMap(artifactFiles);
+ }
+
+
+ public Map<String, ServiceTemplate> getServiceTemplates() {
+ return Collections.unmodifiableMap(serviceTemplates);
+ }
+
+ public void setServiceTemplates(Map<String, ServiceTemplate> serviceTemplates) {
+ this.serviceTemplates = serviceTemplates;
+ }
+
+ public String getEntryDefinitionServiceTemplate() {
+ return entryDefinitionServiceTemplate;
+ }
+
+ public void setEntryDefinitionServiceTemplate(String entryDefinitionServiceTemplate) {
+ this.entryDefinitionServiceTemplate = entryDefinitionServiceTemplate;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/ArtifactDefinition.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/ArtifactDefinition.java
new file mode 100644
index 0000000000..8461fef85f
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/ArtifactDefinition.java
@@ -0,0 +1,69 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.datatypes.model;
+
+public class ArtifactDefinition {
+ private String type;
+ private String file;
+ private String repository;
+ private String description;
+ private String deploy_path;
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getFile() {
+ return file;
+ }
+
+ public void setFile(String file) {
+ this.file = file;
+ }
+
+ public String getRepository() {
+ return repository;
+ }
+
+ public void setRepository(String repository) {
+ this.repository = repository;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getDeploy_path() {
+ return deploy_path;
+ }
+
+ public void setDeploy_path(String deployPath) {
+ this.deploy_path = deployPath;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/ArtifactType.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/ArtifactType.java
new file mode 100644
index 0000000000..80580e97f3
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/ArtifactType.java
@@ -0,0 +1,83 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.datatypes.model;
+
+import java.util.List;
+import java.util.Map;
+
+public class ArtifactType {
+
+ private String derived_from;
+ private String version;
+ private String description;
+ private String mime_type;
+ private List<String> file_ext;
+ private Map<String, PropertyDefinition> properties;
+
+
+ public String getDerived_from() {
+ return derived_from;
+ }
+
+ public void setDerived_from(String derivedFrom) {
+ this.derived_from = derivedFrom;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getMime_type() {
+ return mime_type;
+ }
+
+ public void setMime_type(String mimeType) {
+ this.mime_type = mimeType;
+ }
+
+ public List<String> getFile_ext() {
+ return file_ext;
+ }
+
+ public void setFile_ext(List<String> fileExt) {
+ this.file_ext = fileExt;
+ }
+
+ public Map<String, PropertyDefinition> getProperties() {
+ return properties;
+ }
+
+ public void setProperties(Map<String, PropertyDefinition> properties) {
+ this.properties = properties;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/AttributeDefinition.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/AttributeDefinition.java
new file mode 100644
index 0000000000..13c93a283d
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/AttributeDefinition.java
@@ -0,0 +1,85 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.datatypes.model;
+
+public class AttributeDefinition {
+
+ private String type;
+ private String description;
+ private Object _default;
+ private Status status;
+ private EntrySchema entry_schema;
+
+ public AttributeDefinition() {
+ status = Status.SUPPORTED;
+ }
+
+ public EntrySchema getEntry_schema() {
+ return entry_schema;
+ }
+
+ public void setEntry_schema(EntrySchema entrySchema) {
+ this.entry_schema = entrySchema;
+ }
+
+ public Status getStatus() {
+ return status;
+ }
+
+ public void setStatus(Status status) {
+ this.status = status;
+ }
+
+ public Object get_default() {
+ return _default;
+ }
+
+ public void set_default(Object defaultValue) {
+ this._default = defaultValue;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ @Override
+ public AttributeDefinition clone() {
+ AttributeDefinition attributeDefinition = new AttributeDefinition();
+ attributeDefinition.setType(this.getType());
+ attributeDefinition.setDescription(this.getDescription());
+ attributeDefinition.set_default(this.get_default());
+ attributeDefinition.setStatus(this.getStatus());
+ attributeDefinition.setEntry_schema(this.getEntry_schema().clone());
+ return attributeDefinition;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/CapabilityAssignment.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/CapabilityAssignment.java
new file mode 100644
index 0000000000..b548f7855c
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/CapabilityAssignment.java
@@ -0,0 +1,45 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.datatypes.model;
+
+import java.util.Map;
+
+public class CapabilityAssignment {
+
+ private Map<String, Object> properties;
+ private Map<String, Object> attributes;
+
+ public Map<String, Object> getProperties() {
+ return properties;
+ }
+
+ public void setProperties(Map<String, Object> properties) {
+ this.properties = properties;
+ }
+
+ public Map<String, Object> getAttributes() {
+ return attributes;
+ }
+
+ public void setAttributes(Map<String, Object> attributes) {
+ this.attributes = attributes;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/CapabilityDefinition.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/CapabilityDefinition.java
new file mode 100644
index 0000000000..36dccad6eb
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/CapabilityDefinition.java
@@ -0,0 +1,113 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.datatypes.model;
+
+import org.openecomp.sdc.tosca.services.DataModelUtil;
+import org.openecomp.sdc.tosca.services.ToscaConstants;
+
+import java.util.List;
+import java.util.Map;
+
+public class CapabilityDefinition {
+
+ private String type;
+ private String description;
+ private Map<String, PropertyDefinition> properties;
+ private Map<String, AttributeDefinition> attributes;
+ private List<String> valid_source_types;
+ private Object[] occurrences;
+
+
+ /**
+ * Instantiates a new Capability definition.
+ */
+ public CapabilityDefinition() {
+ occurrences = new Object[2];
+ occurrences[0] = 1;
+ occurrences[1] = ToscaConstants.UNBOUNDED;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public Map<String, PropertyDefinition> getProperties() {
+ return properties;
+ }
+
+ public void setProperties(Map<String, PropertyDefinition> properties) {
+ this.properties = properties;
+ }
+
+ public Map<String, AttributeDefinition> getAttributes() {
+ return attributes;
+ }
+
+ public void setAttributes(Map<String, AttributeDefinition> attributes) {
+ this.attributes = attributes;
+ }
+
+ public List<String> getValid_source_types() {
+ return valid_source_types;
+ }
+
+ public void setValid_source_types(List<String> validSourceTypes) {
+ this.valid_source_types = validSourceTypes;
+ }
+
+ public Object[] getOccurrences() {
+ return occurrences;
+ }
+
+ public void setOccurrences(Object[] occurrences) {
+ this.occurrences = occurrences;
+ }
+
+ @Override
+ public CapabilityDefinition clone() {
+ CapabilityDefinition capabilityDefinition = new CapabilityDefinition();
+ capabilityDefinition
+ .setOccurrences(new Object[]{this.getOccurrences()[0], this.getOccurrences()[1]});
+ capabilityDefinition
+ .setProperties(DataModelUtil.clonePropertyDefinitions(this.getProperties()));
+ capabilityDefinition.setType(this.getType());
+ capabilityDefinition
+ .setAttributes(DataModelUtil.cloneAttributeDefinitions(this.getAttributes()));
+ capabilityDefinition.setDescription(this.getDescription());
+ capabilityDefinition
+ .setValid_source_types(DataModelUtil.cloneValidSourceTypes(this.getValid_source_types()));
+ return capabilityDefinition;
+
+ }
+
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/CapabilityFilterDefinition.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/CapabilityFilterDefinition.java
new file mode 100644
index 0000000000..3678583384
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/CapabilityFilterDefinition.java
@@ -0,0 +1,35 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.datatypes.model;
+
+import java.util.List;
+
+public class CapabilityFilterDefinition {
+ List<Constraint> properties;
+
+ public List<Constraint> getProperties() {
+ return properties;
+ }
+
+ public void setProperties(List<Constraint> properties) {
+ this.properties = properties;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/CapabilityType.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/CapabilityType.java
new file mode 100644
index 0000000000..b0281b4ca0
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/CapabilityType.java
@@ -0,0 +1,82 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.datatypes.model;
+
+import java.util.List;
+import java.util.Map;
+
+public class CapabilityType {
+
+ private String derived_from;
+ private String version;
+ private String description;
+ private Map<String, PropertyDefinition> properties;
+ private Map<String, AttributeDefinition> attributes;
+ private List<String> valid_source_types;
+
+ public String getDerived_from() {
+ return derived_from;
+ }
+
+ public void setDerived_from(String derivedFrom) {
+ this.derived_from = derivedFrom;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public Map<String, PropertyDefinition> getProperties() {
+ return properties;
+ }
+
+ public void setProperties(Map<String, PropertyDefinition> properties) {
+ this.properties = properties;
+ }
+
+ public Map<String, AttributeDefinition> getAttributes() {
+ return attributes;
+ }
+
+ public void setAttributes(Map<String, AttributeDefinition> attributes) {
+ this.attributes = attributes;
+ }
+
+ public List<String> getValid_source_types() {
+ return valid_source_types;
+ }
+
+ public void setValid_source_types(List<String> validSourceTypes) {
+ this.valid_source_types = validSourceTypes;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/Constraint.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/Constraint.java
new file mode 100644
index 0000000000..2c39ce3902
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/Constraint.java
@@ -0,0 +1,181 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.datatypes.model;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class Constraint {
+ private Object equal;
+ private Object greater_or_equal;
+ private Object greater_than;
+ private Object less_than;
+ private Object less_or_equal;
+ private Object[] in_range;
+ private List<Object> valid_values;
+ private Integer length;
+ private Integer min_length;
+ private Integer max_length;
+ private Object pattern;
+
+ public Constraint() {
+ }
+
+ public Object getGreater_or_equal() {
+ return greater_or_equal;
+ }
+
+ public void setGreater_or_equal(Object greaterOrEqual) {
+ this.greater_or_equal = greaterOrEqual;
+ }
+
+ public Object getEqual() {
+ return equal;
+ }
+
+ public void setEqual(Object equal) {
+ this.equal = equal;
+ }
+
+ public Object getGreater_than() {
+ return greater_than;
+ }
+
+ public void setGreater_than(Object greaterThan) {
+ this.greater_than = greaterThan;
+ }
+
+ public Object getLess_than() {
+ return less_than;
+ }
+
+ public void setLess_than(Object lessThan) {
+ this.less_than = lessThan;
+ }
+
+ public Object getLess_or_equal() {
+ return less_or_equal;
+ }
+
+ public void setLess_or_equal(Object lessOrEqual) {
+ this.less_or_equal = lessOrEqual;
+ }
+
+ public Object[] getIn_range() {
+ return in_range;
+ }
+
+ /**
+ * Sets in range.
+ *
+ * @param inRange the in range
+ */
+ public void setIn_range(Object[] inRange) {
+ this.in_range = new Object[2];
+ this.in_range[0] = inRange[0];
+ this.in_range[1] = inRange[1];
+ }
+
+ public List<Object> getValid_values() {
+ return valid_values;
+ }
+
+ public void setValid_values(List<Object> validValues) {
+ this.valid_values = validValues;
+ }
+
+ /**
+ * Add valid value.
+ *
+ * @param validValue the valid value
+ */
+ public void addValidValue(Object validValue) {
+ if (this.valid_values == null) {
+ this.valid_values = new ArrayList<>();
+ }
+ valid_values.add(validValue);
+ }
+
+ public Integer getLength() {
+ return length;
+ }
+
+ public void setLength(Integer length) {
+ this.length = length;
+ }
+
+ public Integer getMin_length() {
+ return min_length;
+ }
+
+ public void setMin_length(Integer minLength) {
+ this.min_length = minLength;
+ }
+
+ public Integer getMax_length() {
+ return max_length;
+ }
+
+ public void setMax_length(Integer maxLength) {
+ this.max_length = maxLength;
+ }
+
+ public Object getPattern() {
+ return pattern;
+ }
+
+ public void setPattern(Object pattern) {
+ this.pattern = pattern;
+ }
+
+ @Override
+ public Constraint clone() {
+ Constraint constraint = new Constraint();
+ constraint.setEqual(this.getEqual());
+ constraint.setGreater_or_equal(this.getGreater_or_equal());
+ constraint.setGreater_than(this.getGreater_than());
+ cloneInRange(constraint);
+ constraint.setLength(this.getLength());
+ constraint.setLess_or_equal(this.getLess_or_equal());
+ constraint.setLess_than(this.getLess_than());
+ constraint.setMax_length(this.getMax_length());
+ constraint.setMin_length(this.getMin_length());
+ constraint.setPattern(this.getPattern());
+ cloneValidValues(constraint);
+
+ return constraint;
+ }
+
+ private void cloneInRange(Constraint constraint) {
+ if (this.getIn_range() != null) {
+ constraint.setIn_range(new Object[]{this.getIn_range()[0], this.getIn_range()[1]});
+ }
+ }
+
+ private void cloneValidValues(Constraint constraint) {
+ if (this.getValid_values() != null) {
+ constraint.setValid_values(new ArrayList<>());
+ for (Object entry : this.getValid_values()) {
+ constraint.getValid_values().add(entry);
+ }
+ }
+ }
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/DataType.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/DataType.java
new file mode 100644
index 0000000000..866c5774d8
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/DataType.java
@@ -0,0 +1,73 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.datatypes.model;
+
+import java.util.List;
+import java.util.Map;
+
+public class DataType {
+
+ private String derived_from;
+ private String version;
+ private String description;
+ private List<Constraint> constraints;
+ private Map<String, PropertyDefinition> properties;
+
+ public String getDerived_from() {
+ return derived_from;
+ }
+
+ public void setDerived_from(String derivedFrom) {
+ this.derived_from = derivedFrom;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public List<Constraint> getConstraints() {
+ return constraints;
+ }
+
+ public void setConstraints(List<Constraint> constraints) {
+ this.constraints = constraints;
+ }
+
+ public Map<String, PropertyDefinition> getProperties() {
+ return properties;
+ }
+
+ public void setProperties(Map<String, PropertyDefinition> properties) {
+ this.properties = properties;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/Directive.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/Directive.java
new file mode 100644
index 0000000000..078a6449ea
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/Directive.java
@@ -0,0 +1,40 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.datatypes.model;
+
+public enum Directive {
+
+
+ SELECTABLE("selectable"),
+ SUBSTITUTABLE("substitutable");
+
+ private String displayName;
+
+ Directive(String displayName) {
+ this.displayName = displayName;
+ }
+
+ public String getDisplayName() {
+ return displayName;
+ }
+
+
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/EntrySchema.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/EntrySchema.java
new file mode 100644
index 0000000000..8b08e54c01
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/EntrySchema.java
@@ -0,0 +1,65 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.datatypes.model;
+
+import org.openecomp.sdc.tosca.services.DataModelUtil;
+
+import java.util.List;
+
+public class EntrySchema {
+
+ private String description;
+ private String type;
+ private List<Constraint> constraints;
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public List<Constraint> getConstraints() {
+ return constraints;
+ }
+
+ public void setConstraints(List<Constraint> constraints) {
+ this.constraints = constraints;
+ }
+
+ @Override
+ public EntrySchema clone() {
+ EntrySchema entrySchema = new EntrySchema();
+ entrySchema.setDescription(this.getDescription());
+ entrySchema.setType(this.getType());
+ entrySchema.setConstraints(DataModelUtil.cloneConstraints(this.getConstraints()));
+ return entrySchema;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/GroupDefinition.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/GroupDefinition.java
new file mode 100644
index 0000000000..807bf260c3
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/GroupDefinition.java
@@ -0,0 +1,64 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.datatypes.model;
+
+import java.util.List;
+import java.util.Map;
+
+public class GroupDefinition {
+
+ private String type;
+ private String description;
+ private Map<String, Object> properties;
+ private List<String> members;
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public Map<String, Object> getProperties() {
+ return properties;
+ }
+
+ public void setProperties(Map<String, Object> properties) {
+ this.properties = properties;
+ }
+
+ public List<String> getMembers() {
+ return members;
+ }
+
+ public void setMembers(List<String> members) {
+ this.members = members;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/GroupType.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/GroupType.java
new file mode 100644
index 0000000000..4bbb861286
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/GroupType.java
@@ -0,0 +1,82 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.datatypes.model;
+
+import java.util.List;
+import java.util.Map;
+
+public class GroupType {
+
+ private String derived_from;
+ private String version;
+ private String description;
+ private Map<String, PropertyDefinition> properties;
+ private List<String> members;
+ private Map<String, InterfaceDefinition> interfaces;
+
+ public String getDerived_from() {
+ return derived_from;
+ }
+
+ public void setDerived_from(String derivedFrom) {
+ this.derived_from = derivedFrom;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public Map<String, PropertyDefinition> getProperties() {
+ return properties;
+ }
+
+ public void setProperties(Map<String, PropertyDefinition> properties) {
+ this.properties = properties;
+ }
+
+ public List<String> getMembers() {
+ return members;
+ }
+
+ public void setMembers(List<String> members) {
+ this.members = members;
+ }
+
+ public Map<String, InterfaceDefinition> getInterfaces() {
+ return interfaces;
+ }
+
+ public void setInterfaces(Map<String, InterfaceDefinition> interfaces) {
+ this.interfaces = interfaces;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/Import.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/Import.java
new file mode 100644
index 0000000000..207a1b520a
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/Import.java
@@ -0,0 +1,61 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.datatypes.model;
+
+public class Import {
+
+ private String file;
+ private String repository;
+ private String namespace_uri;
+ private String namespace_prefix;
+
+ public String getFile() {
+ return file;
+ }
+
+ public void setFile(String file) {
+ this.file = file;
+ }
+
+ public String getRepository() {
+ return repository;
+ }
+
+ public void setRepository(String repository) {
+ this.repository = repository;
+ }
+
+ public String getNamespace_uri() {
+ return namespace_uri;
+ }
+
+ public void setNamespace_uri(String namespaceUri) {
+ this.namespace_uri = namespaceUri;
+ }
+
+ public String getNamespace_prefix() {
+ return namespace_prefix;
+ }
+
+ public void setNamespace_prefix(String namespacePrefix) {
+ this.namespace_prefix = namespacePrefix;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/InterfaceDefinition.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/InterfaceDefinition.java
new file mode 100644
index 0000000000..cf09510083
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/InterfaceDefinition.java
@@ -0,0 +1,24 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.datatypes.model;
+
+public class InterfaceDefinition {
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/InterfaceType.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/InterfaceType.java
new file mode 100644
index 0000000000..b177b0660a
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/InterfaceType.java
@@ -0,0 +1,24 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.datatypes.model;
+
+public class InterfaceType {
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/Metadata.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/Metadata.java
new file mode 100644
index 0000000000..162e693dba
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/Metadata.java
@@ -0,0 +1,55 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.datatypes.model;
+
+import java.util.Map;
+
+public class Metadata {
+
+ private String template_name;
+ private String template_author;
+ private String template_version;
+
+
+ public String getTemplate_name() {
+ return template_name;
+ }
+
+ public void setTemplate_name(String templateName) {
+ this.template_name = templateName;
+ }
+
+ public String getTemplate_author() {
+ return template_author;
+ }
+
+ public void setTemplate_author(String templateAuthor) {
+ this.template_author = templateAuthor;
+ }
+
+ public String getTemplate_version() {
+ return template_version;
+ }
+
+ public void setTemplate_version(String templateVersion) {
+ this.template_version = templateVersion;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/NodeFilter.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/NodeFilter.java
new file mode 100644
index 0000000000..d87dcd7b1d
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/NodeFilter.java
@@ -0,0 +1,47 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.datatypes.model;
+
+import java.util.List;
+import java.util.Map;
+
+public class NodeFilter {
+
+ Map<String, List<Constraint>> properties;
+ Map<String, CapabilityFilterDefinition> capabilities;
+
+ public Map<String, List<Constraint>> getProperties() {
+
+ return properties;
+ }
+
+ public void setProperties(Map<String, List<Constraint>> properties) {
+ this.properties = properties;
+ }
+
+ public Map<String, CapabilityFilterDefinition> getCapabilities() {
+ return capabilities;
+ }
+
+ public void setCapabilities(Map<String, CapabilityFilterDefinition> capabilities) {
+ this.capabilities = capabilities;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/NodeTemplate.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/NodeTemplate.java
new file mode 100644
index 0000000000..41ac232605
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/NodeTemplate.java
@@ -0,0 +1,127 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.datatypes.model;
+
+import java.util.List;
+import java.util.Map;
+
+public class NodeTemplate implements Template {
+
+ private String type;
+ private String description;
+ private List<String> directives;
+ private Map<String, Object> properties;
+ private Map<String, Object> attributes;
+ private List<Map<String, RequirementAssignment>> requirements;
+ private List<Map<String, CapabilityAssignment>> capabilities;
+ private Map<String, InterfaceDefinition> interfaces;
+ private Map<String, ArtifactDefinition> artifacts;
+ private NodeFilter node_filter;
+ private String copy;
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public List<String> getDirectives() {
+ return directives;
+ }
+
+ public void setDirectives(List<String> directives) {
+ this.directives = directives;
+ }
+
+ public Map<String, Object> getProperties() {
+ return properties;
+ }
+
+ public void setProperties(Map<String, Object> properties) {
+ this.properties = properties;
+ }
+
+ public Map<String, Object> getAttributes() {
+ return attributes;
+ }
+
+ public void setAttributes(Map<String, Object> attributes) {
+ this.attributes = attributes;
+ }
+
+ public List<Map<String, RequirementAssignment>> getRequirements() {
+ return requirements;
+ }
+
+ public void setRequirements(List<Map<String, RequirementAssignment>> requirements) {
+ this.requirements = requirements;
+ }
+
+ public List<Map<String, CapabilityAssignment>> getCapabilities() {
+ return capabilities;
+ }
+
+ public void setCapabilities(List<Map<String, CapabilityAssignment>> capabilities) {
+ this.capabilities = capabilities;
+ }
+
+ public Map<String, InterfaceDefinition> getInterfaces() {
+ return interfaces;
+ }
+
+ public void setInterfaces(Map<String, InterfaceDefinition> interfaces) {
+ this.interfaces = interfaces;
+ }
+
+ public Map<String, ArtifactDefinition> getArtifacts() {
+ return artifacts;
+ }
+
+ public void setArtifacts(Map<String, ArtifactDefinition> artifacts) {
+ this.artifacts = artifacts;
+ }
+
+ public NodeFilter getNode_filter() {
+ return node_filter;
+ }
+
+ public void setNode_filter(NodeFilter nodeFilter) {
+ this.node_filter = nodeFilter;
+ }
+
+ public String getCopy() {
+ return copy;
+ }
+
+ public void setCopy(String copy) {
+ this.copy = copy;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/NodeType.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/NodeType.java
new file mode 100644
index 0000000000..d477f286ee
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/NodeType.java
@@ -0,0 +1,125 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.datatypes.model;
+
+import java.util.List;
+import java.util.Map;
+
+public class NodeType {
+
+ private String derived_from;
+ private String version;
+ private String description;
+ private Map<String, PropertyDefinition> properties;
+ private Map<String, AttributeDefinition> attributes;
+ private List<Map<String, RequirementDefinition>> requirements;
+ private Map<String, CapabilityDefinition> capabilities;
+ private Map<String, InterfaceDefinition> interfaces;
+ private Map<String, ArtifactDefinition> artifacts;
+
+
+ public String getDerived_from() {
+ return derived_from;
+ }
+
+ public void setDerived_from(String derivedFrom) {
+ this.derived_from = derivedFrom;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public Map<String, PropertyDefinition> getProperties() {
+ return properties;
+ }
+
+ public void setProperties(Map<String, PropertyDefinition> properties) {
+ this.properties = properties;
+ }
+
+ public Map<String, AttributeDefinition> getAttributes() {
+ return attributes;
+ }
+
+ public void setAttributes(Map<String, AttributeDefinition> attributes) {
+ this.attributes = attributes;
+ }
+
+ public List<Map<String, RequirementDefinition>> getRequirements() {
+ return requirements;
+ }
+
+ public void setRequirements(List<Map<String, RequirementDefinition>> requirements) {
+ this.requirements = requirements;
+ }
+
+ public Map<String, CapabilityDefinition> getCapabilities() {
+ return capabilities;
+ }
+
+ public void setCapabilities(Map<String, CapabilityDefinition> capabilities) {
+ this.capabilities = capabilities;
+ }
+
+ public Map<String, InterfaceDefinition> getInterfaces() {
+ return interfaces;
+ }
+
+ public void setInterfaces(Map<String, InterfaceDefinition> interfaces) {
+ this.interfaces = interfaces;
+ }
+
+ public Map<String, ArtifactDefinition> getArtifacts() {
+ return artifacts;
+ }
+
+ public void setArtifacts(Map<String, ArtifactDefinition> artifacts) {
+ this.artifacts = artifacts;
+ }
+
+ @Override
+ public NodeType clone() {
+ NodeType clone = new NodeType();
+ clone.setCapabilities(this.getCapabilities());
+ clone.setDerived_from(this.getDerived_from());
+ clone.setProperties(this.getProperties());
+ clone.setRequirements(this.getRequirements());
+ clone.setDescription(this.getDescription());
+ clone.setAttributes(this.getAttributes());
+ clone.setInterfaces(this.getInterfaces());
+ clone.setVersion(this.getVersion());
+ clone.setArtifacts(this.getArtifacts());
+ return clone;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/ParameterDefinition.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/ParameterDefinition.java
new file mode 100644
index 0000000000..6ef4c782f5
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/ParameterDefinition.java
@@ -0,0 +1,99 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.datatypes.model;
+
+import java.util.List;
+
+public class ParameterDefinition {
+
+ private String type;
+ private String description;
+ private Object value;
+ private Boolean required;
+ private Object _default;
+ private Status status;
+ private List<Constraint> constraints;
+ private EntrySchema entry_schema;
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public Object getValue() {
+ return value;
+ }
+
+ public void setValue(Object value) {
+ this.value = value;
+ }
+
+ public Boolean getRequired() {
+ return required;
+ }
+
+ public void setRequired(Boolean required) {
+ this.required = required;
+ }
+
+ public Object get_default() {
+ return _default;
+ }
+
+ public void set_default(Object defaultValue) {
+ this._default = defaultValue;
+ }
+
+ public Status getStatus() {
+ return status;
+ }
+
+ public void setStatus(Status status) {
+ this.status = status;
+ }
+
+ public List<Constraint> getConstraints() {
+ return constraints;
+ }
+
+ public void setConstraints(List<Constraint> constraints) {
+ this.constraints = constraints;
+ }
+
+ public EntrySchema getEntry_schema() {
+ return entry_schema;
+ }
+
+ public void setEntry_schema(EntrySchema entrySchema) {
+ this.entry_schema = entrySchema;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/PolicyDefinition.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/PolicyDefinition.java
new file mode 100644
index 0000000000..90f44ae36a
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/PolicyDefinition.java
@@ -0,0 +1,63 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.datatypes.model;
+
+import java.util.List;
+import java.util.Map;
+
+public class PolicyDefinition implements Template {
+ private String type;
+ private String description;
+ private Map<String, Object> properties;
+ private List<String> targets;
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public Map<String, Object> getProperties() {
+ return properties;
+ }
+
+ public void setProperties(Map<String, Object> properties) {
+ this.properties = properties;
+ }
+
+ public List<String> getTargets() {
+ return targets;
+ }
+
+ public void setTargets(List<String> targets) {
+ this.targets = targets;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/PolicyType.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/PolicyType.java
new file mode 100644
index 0000000000..07412cda59
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/PolicyType.java
@@ -0,0 +1,73 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.datatypes.model;
+
+import java.util.List;
+import java.util.Map;
+
+public class PolicyType {
+
+ private String derived_from;
+ private String version;
+ private String description;
+ private Map<String, PropertyDefinition> properties;
+ private List<String> targets;
+
+ public String getDerived_from() {
+ return derived_from;
+ }
+
+ public void setDerived_from(String derivedFrom) {
+ this.derived_from = derivedFrom;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public Map<String, PropertyDefinition> getProperties() {
+ return properties;
+ }
+
+ public void setProperties(Map<String, PropertyDefinition> properties) {
+ this.properties = properties;
+ }
+
+ public List<String> getTargets() {
+ return targets;
+ }
+
+ public void setTargets(List<String> targets) {
+ this.targets = targets;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/PropertyDefinition.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/PropertyDefinition.java
new file mode 100644
index 0000000000..cf47d0b113
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/PropertyDefinition.java
@@ -0,0 +1,112 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.datatypes.model;
+
+import org.openecomp.sdc.tosca.services.DataModelUtil;
+
+import java.util.List;
+
+public class PropertyDefinition {
+
+ private String type;
+ private String description;
+ private Boolean required;
+ private Object _default;
+ private Status status;
+ private List<Constraint> constraints;
+ private EntrySchema entry_schema;
+
+ public PropertyDefinition() {
+ status = Status.SUPPORTED;
+ required = true;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public Boolean getRequired() {
+ return required;
+ }
+
+ public void setRequired(Boolean required) {
+ this.required = required;
+ }
+
+ public Object get_default() {
+ return _default;
+ }
+
+ public void set_default(Object defaultValue) {
+ this._default = defaultValue;
+ }
+
+ public Status getStatus() {
+ return status;
+ }
+
+ public void setStatus(Status status) {
+ this.status = status;
+ }
+
+ public List<Constraint> getConstraints() {
+ return constraints;
+ }
+
+ public void setConstraints(List<Constraint> constraints) {
+ this.constraints = constraints;
+ }
+
+ public EntrySchema getEntry_schema() {
+ return entry_schema;
+ }
+
+ public void setEntry_schema(EntrySchema entrySchema) {
+ this.entry_schema = entrySchema;
+ }
+
+ @Override
+ public PropertyDefinition clone() {
+ PropertyDefinition propertyDefinition = new PropertyDefinition();
+ propertyDefinition.setType(this.getType());
+ propertyDefinition.setDescription(this.getDescription());
+ propertyDefinition.setRequired(this.getRequired());
+ propertyDefinition.set_default(this.get_default());
+ propertyDefinition.setStatus(this.getStatus());
+ propertyDefinition.setEntry_schema(this.getEntry_schema().clone());
+ propertyDefinition.setConstraints(DataModelUtil.cloneConstraints(this.getConstraints()));
+ return propertyDefinition;
+ }
+
+
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/PropertyType.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/PropertyType.java
new file mode 100644
index 0000000000..3fdd9bba0e
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/PropertyType.java
@@ -0,0 +1,117 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.datatypes.model;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * The enum Property type.
+ */
+public enum PropertyType {
+
+ /**
+ * String property type.
+ */
+ STRING("string"),
+ /**
+ * Integer property type.
+ */
+ INTEGER("integer"),
+ /**
+ * Float property type.
+ */
+ FLOAT("float"),
+ /**
+ * Boolean property type.
+ */
+ BOOLEAN("boolean"),
+ /**
+ * Timestamp property type.
+ */
+ TIMESTAMP("timestamp"),
+ /**
+ * Null property type.
+ */
+ NULL("null"),
+ /**
+ * Map property type.
+ */
+ MAP("map"),
+ /**
+ * List property type.
+ */
+ LIST("list"),
+ /**
+ * Scalar unit size property type.
+ */
+ SCALAR_UNIT_SIZE("scalar-unit.size");
+
+ private static final Map<String, PropertyType> mMap =
+ Collections.unmodifiableMap(initializeMapping());
+ private String displayName;
+
+ PropertyType(String displayName) {
+
+ this.displayName = displayName;
+ }
+
+ /**
+ * Initialize mapping map.
+ *
+ * @return the map
+ */
+ public static Map<String, PropertyType> initializeMapping() {
+ Map<String, PropertyType> typeMap = new HashMap<String, PropertyType>();
+ for (PropertyType v : PropertyType.values()) {
+ typeMap.put(v.displayName, v);
+ }
+ return typeMap;
+ }
+
+ /**
+ * Gets property type by display name.
+ *
+ * @param displayName the display name
+ * @return the property type by display name
+ */
+ public static PropertyType getPropertyTypeByDisplayName(String displayName) {
+ if (mMap == null) {
+ initializeMapping();
+ }
+ if (mMap.containsKey(displayName)) {
+ return mMap.get(displayName);
+ }
+ return null;
+ }
+
+ /**
+ * Gets display name.
+ *
+ * @return the display name
+ */
+ public String getDisplayName() {
+ return displayName;
+ }
+
+
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/RelationshipTemplate.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/RelationshipTemplate.java
new file mode 100644
index 0000000000..c3a1195565
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/RelationshipTemplate.java
@@ -0,0 +1,99 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.datatypes.model;
+
+import java.util.Map;
+
+public class RelationshipTemplate implements Template {
+
+ private String type;
+ private String description;
+ private Map<String, Object> properties;
+ private Map<String, Object> attributes;
+ private Map<String, RequirementAssignment> requirements;
+ private Map<String, CapabilityAssignment> capabilities;
+ private Map<String, InterfaceDefinition> interfaces;
+ private String copy;
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public Map<String, Object> getProperties() {
+ return properties;
+ }
+
+ public void setProperties(Map<String, Object> properties) {
+ this.properties = properties;
+ }
+
+ public Map<String, Object> getAttributes() {
+ return attributes;
+ }
+
+ public void setAttributes(Map<String, Object> attributes) {
+ this.attributes = attributes;
+ }
+
+ public Map<String, RequirementAssignment> getRequirements() {
+ return requirements;
+ }
+
+ public void setRequirements(Map<String, RequirementAssignment> requirements) {
+ this.requirements = requirements;
+ }
+
+ public Map<String, CapabilityAssignment> getCapabilities() {
+ return capabilities;
+ }
+
+ public void setCapabilities(Map<String, CapabilityAssignment> capabilities) {
+ this.capabilities = capabilities;
+ }
+
+ public Map<String, InterfaceDefinition> getInterfaces() {
+ return interfaces;
+ }
+
+ public void setInterfaces(Map<String, InterfaceDefinition> interfaces) {
+ this.interfaces = interfaces;
+ }
+
+ public String getCopy() {
+ return copy;
+ }
+
+ public void setCopy(String copy) {
+ this.copy = copy;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/RelationshipType.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/RelationshipType.java
new file mode 100644
index 0000000000..173a8a0f64
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/RelationshipType.java
@@ -0,0 +1,93 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.datatypes.model;
+
+import java.util.List;
+import java.util.Map;
+
+public class RelationshipType {
+
+ private String derived_from;
+ private String version;
+ private String description;
+ private Map<String, PropertyDefinition> properties;
+ private Map<String, AttributeDefinition> attributes;
+ private Map<String, InterfaceDefinition> interfaces;
+ private List<String> valid_target_types;
+ //An optional list of one or more names of Capability Types that are valid targets
+ //for this relationship
+
+ public String getDerived_from() {
+ return derived_from;
+ }
+
+ public void setDerived_from(String derivedFrom) {
+ this.derived_from = derivedFrom;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public Map<String, PropertyDefinition> getProperties() {
+ return properties;
+ }
+
+ public void setProperties(Map<String, PropertyDefinition> properties) {
+ this.properties = properties;
+ }
+
+ public Map<String, AttributeDefinition> getAttributes() {
+ return attributes;
+ }
+
+ public void setAttributes(Map<String, AttributeDefinition> attributes) {
+ this.attributes = attributes;
+ }
+
+ public Map<String, InterfaceDefinition> getInterfaces() {
+ return interfaces;
+ }
+
+ public void setInterfaces(Map<String, InterfaceDefinition> interfaces) {
+ this.interfaces = interfaces;
+ }
+
+ public List<String> getValid_target_types() {
+ return valid_target_types;
+ }
+
+ public void setValid_target_types(List<String> validTargetTypes) {
+ this.valid_target_types = validTargetTypes;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/RequirementAssignment.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/RequirementAssignment.java
new file mode 100644
index 0000000000..445063a3ed
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/RequirementAssignment.java
@@ -0,0 +1,70 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.datatypes.model;
+
+public class RequirementAssignment {
+
+ private String capability;
+ private String node;
+ private String relationship;
+ private NodeFilter node_filter;
+ private Object[] occurrences;
+
+ public String getCapability() {
+ return capability;
+ }
+
+ public void setCapability(String capability) {
+ this.capability = capability;
+ }
+
+ public String getNode() {
+ return node;
+ }
+
+ public void setNode(String node) {
+ this.node = node;
+ }
+
+ public String getRelationship() {
+ return relationship;
+ }
+
+ public void setRelationship(String relationship) {
+ this.relationship = relationship;
+ }
+
+ public NodeFilter getNode_filter() {
+ return node_filter;
+ }
+
+ public void setNode_filter(NodeFilter nodeFilter) {
+ this.node_filter = nodeFilter;
+ }
+
+ public Object[] getOccurrences() {
+ return occurrences;
+ }
+
+ public void setOccurrences(Object[] occurrences) {
+ this.occurrences = occurrences;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/RequirementDefinition.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/RequirementDefinition.java
new file mode 100644
index 0000000000..fe3238f1b5
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/RequirementDefinition.java
@@ -0,0 +1,82 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.datatypes.model;
+
+public class RequirementDefinition {
+
+ private String capability;
+ private String node;
+ private String relationship;
+ private Object[] occurrences;
+
+ /**
+ * Instantiates a new Requirement definition.
+ */
+ public RequirementDefinition() {
+ occurrences = new Object[2];
+ occurrences[0] = 1;
+ occurrences[1] = 1;
+ }
+
+ public String getCapability() {
+ return capability;
+ }
+
+ public void setCapability(String capability) {
+ this.capability = capability;
+ }
+
+ public String getNode() {
+ return node;
+ }
+
+ public void setNode(String node) {
+ this.node = node;
+ }
+
+ public String getRelationship() {
+ return relationship;
+ }
+
+ public void setRelationship(String relationship) {
+ this.relationship = relationship;
+ }
+
+ public Object[] getOccurrences() {
+ return occurrences;
+ }
+
+ public void setOccurrences(Object[] occurrences) {
+ this.occurrences = occurrences;
+ }
+
+ @Override
+ public RequirementDefinition clone() {
+ RequirementDefinition requirementDefinition = new RequirementDefinition();
+ requirementDefinition.setNode(this.getNode());
+ requirementDefinition.setRelationship(this.getRelationship());
+ requirementDefinition.setCapability(this.getCapability());
+ requirementDefinition
+ .setOccurrences(new Object[]{this.getOccurrences()[0], this.getOccurrences()[1]});
+ return requirementDefinition;
+ }
+
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/Scalar.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/Scalar.java
new file mode 100644
index 0000000000..619ac510b0
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/Scalar.java
@@ -0,0 +1,34 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.datatypes.model;
+
+public class Scalar {
+
+ private Float value;
+
+ public Float getValue() {
+ return value;
+ }
+
+ public void setValue(Float value) {
+ this.value = value;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/ServiceTemplate.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/ServiceTemplate.java
new file mode 100644
index 0000000000..98da0104b8
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/ServiceTemplate.java
@@ -0,0 +1,144 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.datatypes.model;
+
+import java.util.Map;
+
+public class ServiceTemplate implements Template {
+
+ private String tosca_definitions_version;
+ private Metadata metadata;
+ private String description;
+ private Map<String, Import> imports;
+ private Map<String, ArtifactType> artifact_types;
+ private Map<String, DataType> data_types;
+ private Map<String, CapabilityType> capability_types;
+ private Map<String, InterfaceType> interface_types;
+ private Map<String, RelationshipType> relationship_types;
+ private Map<String, NodeType> node_types;
+ private Map<String, GroupType> group_types;
+ private Map<String, PolicyType> policy_types;
+ private TopologyTemplate topology_template;
+
+ public String getTosca_definitions_version() {
+ return tosca_definitions_version;
+ }
+
+ public void setTosca_definitions_version(String toscaDefinitionsVersion) {
+ this.tosca_definitions_version = toscaDefinitionsVersion;
+ }
+
+ public Metadata getMetadata() {
+ return metadata;
+ }
+
+ public void setMetadata(Metadata metadata) {
+ this.metadata = metadata;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public Map<String, Import> getImports() {
+ return imports;
+ }
+
+ public void setImports(Map<String, Import> imports) {
+ this.imports = imports;
+ }
+
+ public Map<String, ArtifactType> getArtifact_types() {
+ return artifact_types;
+ }
+
+ public void setArtifact_types(Map<String, ArtifactType> artifactTypes) {
+ this.artifact_types = artifactTypes;
+ }
+
+ public Map<String, DataType> getData_types() {
+ return data_types;
+ }
+
+ public void setData_types(Map<String, DataType> dataTypes) {
+ this.data_types = dataTypes;
+ }
+
+ public Map<String, CapabilityType> getCapability_types() {
+ return capability_types;
+ }
+
+ public void setCapability_types(Map<String, CapabilityType> capabilityTypes) {
+ this.capability_types = capabilityTypes;
+ }
+
+ public Map<String, RelationshipType> getRelationship_types() {
+ return relationship_types;
+ }
+
+ public void setRelationship_types(Map<String, RelationshipType> relationshipTypes) {
+ this.relationship_types = relationshipTypes;
+ }
+
+ public Map<String, NodeType> getNode_types() {
+ return node_types;
+ }
+
+ public void setNode_types(Map<String, NodeType> nodeTypes) {
+ this.node_types = nodeTypes;
+ }
+
+ public Map<String, GroupType> getGroup_types() {
+ return group_types;
+ }
+
+ public void setGroup_types(Map<String, GroupType> groupTypes) {
+ this.group_types = groupTypes;
+ }
+
+ public Map<String, InterfaceType> getInterface_types() {
+ return interface_types;
+ }
+
+ public void setInterface_types(Map<String, InterfaceType> interfaceTypes) {
+ this.interface_types = interfaceTypes;
+ }
+
+ public Map<String, PolicyType> getPolicy_types() {
+ return policy_types;
+ }
+
+ public void setPolicy_types(Map<String, PolicyType> policyTypes) {
+ this.policy_types = policyTypes;
+ }
+
+ public TopologyTemplate getTopology_template() {
+ return topology_template;
+ }
+
+ public void setTopology_template(TopologyTemplate topologyTemplate) {
+ this.topology_template = topologyTemplate;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/Status.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/Status.java
new file mode 100644
index 0000000000..0805982a54
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/Status.java
@@ -0,0 +1,42 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.datatypes.model;
+
+import java.util.Map;
+
+public enum Status {
+
+ SUPPORTED("supported"),
+ UNSUPPORTED("unsupported"),
+ EXPERIMENTAL("experimental"),
+ DEPRECATED("deprecated"),;
+ private String displayName;
+
+ Status(String displayName) {
+ this.displayName = displayName;
+ }
+
+ public String getDisplayName() {
+ return displayName;
+ }
+
+
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/SubstitutionMapping.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/SubstitutionMapping.java
new file mode 100644
index 0000000000..50c262dc42
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/SubstitutionMapping.java
@@ -0,0 +1,54 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.datatypes.model;
+
+import java.util.List;
+import java.util.Map;
+
+public class SubstitutionMapping {
+ private String node_type;
+ private Map<String, List<String>> capabilities;
+ private Map<String, List<String>> requirements;
+
+ public String getNode_type() {
+ return node_type;
+ }
+
+ public void setNode_type(String nodeType) {
+ this.node_type = nodeType;
+ }
+
+ public Map<String, List<String>> getRequirements() {
+ return requirements;
+ }
+
+ public void setRequirements(Map<String, List<String>> requirements) {
+ this.requirements = requirements;
+ }
+
+ public Map<String, List<String>> getCapabilities() {
+ return capabilities;
+ }
+
+ public void setCapabilities(Map<String, List<String>> capabilities) {
+ this.capabilities = capabilities;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/Template.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/Template.java
new file mode 100644
index 0000000000..128bb3c0a9
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/Template.java
@@ -0,0 +1,24 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.datatypes.model;
+
+public interface Template {
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/TopologyTemplate.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/TopologyTemplate.java
new file mode 100644
index 0000000000..288242946a
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/TopologyTemplate.java
@@ -0,0 +1,114 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.datatypes.model;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+
+public class TopologyTemplate {
+
+ private String description;
+ private Map<String, ParameterDefinition> inputs;
+ private Map<String, NodeTemplate> node_templates;
+ private Map<String, RelationshipTemplate> relationship_templates;
+ private Map<String, GroupDefinition> groups;
+ private Map<String, ParameterDefinition> outputs;
+ private SubstitutionMapping substitution_mappings;
+ private Map<String, PolicyDefinition> policies;
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public Map<String, ParameterDefinition> getInputs() {
+ return inputs;
+ }
+
+ public void setInputs(Map<String, ParameterDefinition> inputs) {
+ this.inputs = inputs;
+ }
+
+ public Map<String, NodeTemplate> getNode_templates() {
+ return node_templates;
+ }
+
+ public void setNode_templates(Map<String, NodeTemplate> nodeTemplates) {
+ this.node_templates = nodeTemplates;
+ }
+
+ public Map<String, RelationshipTemplate> getRelationship_templates() {
+ return relationship_templates;
+ }
+
+ public void setRelationship_templates(Map<String, RelationshipTemplate> relationshipTemplates) {
+ this.relationship_templates = relationshipTemplates;
+ }
+
+ public Map<String, GroupDefinition> getGroups() {
+ return groups;
+ }
+
+ public void setGroups(Map<String, GroupDefinition> groups) {
+ this.groups = groups;
+ }
+
+ /**
+ * Add group.
+ *
+ * @param groupKey the group key
+ * @param groupDefinition the group definition
+ */
+ public void addGroup(String groupKey, GroupDefinition groupDefinition) {
+ if (Objects.isNull(this.groups)) {
+ this.groups = new HashMap<>();
+ }
+ this.groups.put(groupKey, groupDefinition);
+ }
+
+ public Map<String, ParameterDefinition> getOutputs() {
+ return outputs;
+ }
+
+ public void setOutputs(Map<String, ParameterDefinition> outputs) {
+ this.outputs = outputs;
+ }
+
+ public SubstitutionMapping getSubstitution_mappings() {
+ return substitution_mappings;
+ }
+
+ public void setSubstitution_mappings(SubstitutionMapping substitutionMapping) {
+ this.substitution_mappings = substitutionMapping;
+ }
+
+ public Map<String, PolicyDefinition> getPolicies() {
+ return policies;
+ }
+
+ public void setPolicies(Map<String, PolicyDefinition> policies) {
+ this.policies = policies;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/heatextend/ParameterDefinitionExt.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/heatextend/ParameterDefinitionExt.java
new file mode 100644
index 0000000000..bde81108de
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/heatextend/ParameterDefinitionExt.java
@@ -0,0 +1,55 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.datatypes.model.heatextend;
+
+
+import org.openecomp.sdc.tosca.datatypes.model.ParameterDefinition;
+
+public class ParameterDefinitionExt extends ParameterDefinition {
+
+ String label;
+ Boolean hidden;
+ Boolean immutable;
+
+ public String getLabel() {
+ return label;
+ }
+
+ public void setLabel(String label) {
+ this.label = label;
+ }
+
+ public Boolean getHidden() {
+ return hidden;
+ }
+
+ public void setHidden(Boolean hidden) {
+ this.hidden = hidden;
+ }
+
+ public Boolean getImmutable() {
+ return immutable;
+ }
+
+ public void setImmutable(Boolean immutable) {
+ this.immutable = immutable;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/heatextend/PropertyTypeExt.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/heatextend/PropertyTypeExt.java
new file mode 100644
index 0000000000..f92d674070
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/model/heatextend/PropertyTypeExt.java
@@ -0,0 +1,85 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.datatypes.model.heatextend;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * The enum Property type ext.
+ */
+public enum PropertyTypeExt {
+
+ /**
+ * Json property type ext.
+ */
+ JSON("json");
+
+ private static final Map<String, PropertyTypeExt> mMap =
+ Collections.unmodifiableMap(initializeMapping());
+ private String displayName;
+
+ PropertyTypeExt(String displayName) {
+
+ this.displayName = displayName;
+ }
+
+ /**
+ * Initialize mapping map.
+ *
+ * @return the map
+ */
+ public static Map<String, PropertyTypeExt> initializeMapping() {
+ Map<String, PropertyTypeExt> typeMap = new HashMap<String, PropertyTypeExt>();
+ for (PropertyTypeExt v : PropertyTypeExt.values()) {
+ typeMap.put(v.displayName, v);
+ }
+ return typeMap;
+ }
+
+ /**
+ * Gets property type by display name.
+ *
+ * @param displayName the display name
+ * @return the property type by display name
+ */
+ public static PropertyTypeExt getPropertyTypeByDisplayName(String displayName) {
+ if (mMap == null) {
+ initializeMapping();
+ }
+ if (mMap.containsKey(displayName)) {
+ return mMap.get(displayName);
+ }
+ return null;
+ }
+
+ /**
+ * Gets display name.
+ *
+ * @return the display name
+ */
+ public String getDisplayName() {
+ return displayName;
+ }
+
+
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/errors/InvalidAddActionNullEntityErrorBuilder.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/errors/InvalidAddActionNullEntityErrorBuilder.java
new file mode 100644
index 0000000000..02bee69251
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/errors/InvalidAddActionNullEntityErrorBuilder.java
@@ -0,0 +1,58 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.errors;
+
+import org.openecomp.sdc.common.errors.ErrorCategory;
+import org.openecomp.sdc.common.errors.ErrorCode;
+
+/**
+ * The type Invalid add action null entity error builder.
+ */
+public class InvalidAddActionNullEntityErrorBuilder {
+
+ private static final String INVALID_ACTION_NULL_ENTITY_ERR_MSG =
+ "Invalid action, can't add '%s' to '%s', '%s' entity is NULL.";
+
+ private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+
+ /**
+ * Instantiates a new Invalid add action null entity error builder.
+ *
+ * @param addedData the added data
+ * @param updatedEntity the updated entity
+ */
+ public InvalidAddActionNullEntityErrorBuilder(String addedData, String updatedEntity) {
+ builder.withId(ToscaErrorCodes.TOSCA_INVALID_ADD_ACTION_NULL_ENTITY);
+ builder.withCategory(ErrorCategory.APPLICATION);
+ builder.withMessage(
+ String.format(INVALID_ACTION_NULL_ENTITY_ERR_MSG, addedData, updatedEntity, updatedEntity));
+ }
+
+ /**
+ * Build error code.
+ *
+ * @return the error code
+ */
+ public ErrorCode build() {
+ return builder.build();
+ }
+
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/errors/InvalidRequirementAssignmentErrorBuilder.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/errors/InvalidRequirementAssignmentErrorBuilder.java
new file mode 100644
index 0000000000..cc0b821748
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/errors/InvalidRequirementAssignmentErrorBuilder.java
@@ -0,0 +1,57 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.errors;
+
+import org.openecomp.sdc.common.errors.ErrorCategory;
+import org.openecomp.sdc.common.errors.ErrorCode;
+
+/**
+ * The type Invalid requirement assignment error builder.
+ */
+public class InvalidRequirementAssignmentErrorBuilder {
+
+ private static final String INVALID_REQ_ASSIGNMENT_ERR_ID = "INVALID_REQ_ASSIGNMENT_ERR_ID";
+ private static final String INVALID_REQ_ASSIGNMENT_ERR_MSG =
+ "Invalid Requirement Assignment, Node value is NULL, Requirement ID '%s'.";
+
+ private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+
+ /**
+ * Instantiates a new Invalid requirement assignment error builder.
+ *
+ * @param requirementId the requirement id
+ */
+ public InvalidRequirementAssignmentErrorBuilder(String requirementId) {
+ builder.withId(INVALID_REQ_ASSIGNMENT_ERR_ID);
+ builder.withCategory(ErrorCategory.APPLICATION);
+ builder.withMessage(String.format(INVALID_REQ_ASSIGNMENT_ERR_MSG, requirementId));
+ }
+
+ /**
+ * Build error code.
+ *
+ * @return the error code
+ */
+ public ErrorCode build() {
+ return builder.build();
+ }
+
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/errors/ToscaErrorCodes.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/errors/ToscaErrorCodes.java
new file mode 100644
index 0000000000..099f0771f2
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/errors/ToscaErrorCodes.java
@@ -0,0 +1,36 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.errors;
+
+public class ToscaErrorCodes {
+
+ static final String INVALID_SUBSTITUTE_NODE_TEMPLATE = "INVALID_SUBSTITUTE_NODE_TEMPLATE";
+ static final String INVALID_SUBSTITUTION_SERVICE_TEMPLATE =
+ "INVALID_SUBSTITUTION_SERVICE_TEMPLATE";
+ static final String TOSCA_ENTRY_NOT_FOUND = "TOSCA_ENTRY_NOT_FOUND";
+ static final String MISSING_SUBSTITUTION_MAPPING_FOR_REQ_CAP =
+ "MISSING_SUBSTITUTION_MAPPING_FOR_REQ_CAP";
+ static final String TOSCA_INVALID_SUBSTITUTE_NODE_TEMPLATE =
+ "TOSCA_INVALID_SUBSTITUTE_NODE_TEMPLATE";
+ static final String TOSCA_INVALID_ADD_ACTION_NULL_ENTITY = "TOSCA_INVALID_ADD_ACTION_NULL_ENTITY";
+
+
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/errors/ToscaInvalidEntryNotFoundErrorBuilder.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/errors/ToscaInvalidEntryNotFoundErrorBuilder.java
new file mode 100644
index 0000000000..7e05d18755
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/errors/ToscaInvalidEntryNotFoundErrorBuilder.java
@@ -0,0 +1,55 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.errors;
+
+import org.openecomp.sdc.common.errors.ErrorCategory;
+import org.openecomp.sdc.common.errors.ErrorCode;
+
+/**
+ * The type Tosca invalid entry not found error builder.
+ */
+public class ToscaInvalidEntryNotFoundErrorBuilder {
+ //
+ private static final String ENTRY_NOT_FOUND_MSG =
+ "Invalid Tosca model data, missing '%s' entry for '%s' id %s";
+ private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+
+ /**
+ * Instantiates a new Tosca invalid entry not found error builder.
+ *
+ * @param entryName the entry name
+ * @param entryId the entry id
+ */
+ public ToscaInvalidEntryNotFoundErrorBuilder(String entryName, String entryId) {
+ builder.withId(ToscaErrorCodes.TOSCA_ENTRY_NOT_FOUND);
+ builder.withCategory(ErrorCategory.APPLICATION);
+ builder.withMessage(String.format(ENTRY_NOT_FOUND_MSG, entryName, entryName, entryId));
+ }
+
+ /**
+ * Build error code.
+ *
+ * @return the error code
+ */
+ public ErrorCode build() {
+ return builder.build();
+ }
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/errors/ToscaInvalidSubstituteNodeTemplateErrorBuilder.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/errors/ToscaInvalidSubstituteNodeTemplateErrorBuilder.java
new file mode 100644
index 0000000000..5913e5ffba
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/errors/ToscaInvalidSubstituteNodeTemplateErrorBuilder.java
@@ -0,0 +1,55 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.errors;
+
+import org.openecomp.sdc.common.errors.ErrorCategory;
+import org.openecomp.sdc.common.errors.ErrorCode;
+
+
+/**
+ * The type Tosca invalid substitute node template error builder.
+ */
+public class ToscaInvalidSubstituteNodeTemplateErrorBuilder {
+ private static final String INVALID_SUBSTITUTE_NODE_TEMPLATE_MSG =
+ "Invalid substitute node template, directives with substitutable value must be defined. "
+ + "node template id %s";
+ private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+
+ /**
+ * Instantiates a new Tosca invalid substitute node template error builder.
+ *
+ * @param nodeTemplateId the node template id
+ */
+ public ToscaInvalidSubstituteNodeTemplateErrorBuilder(String nodeTemplateId) {
+ builder.withId(ToscaErrorCodes.TOSCA_INVALID_SUBSTITUTE_NODE_TEMPLATE);
+ builder.withCategory(ErrorCategory.APPLICATION);
+ builder.withMessage(String.format(INVALID_SUBSTITUTE_NODE_TEMPLATE_MSG, nodeTemplateId));
+ }
+
+ /**
+ * Build error code.
+ *
+ * @return the error code
+ */
+ public ErrorCode build() {
+ return builder.build();
+ }
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/errors/ToscaInvalidSubstituteNodeTemplatePropertiesErrorBuilder.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/errors/ToscaInvalidSubstituteNodeTemplatePropertiesErrorBuilder.java
new file mode 100644
index 0000000000..90c681efc9
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/errors/ToscaInvalidSubstituteNodeTemplatePropertiesErrorBuilder.java
@@ -0,0 +1,59 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.errors;
+
+import org.openecomp.sdc.common.errors.ErrorCategory;
+import org.openecomp.sdc.common.errors.ErrorCode;
+import org.openecomp.sdc.tosca.services.ToscaConstants;
+
+
+/**
+ * The type Tosca invalid substitute node template properties error builder.
+ */
+public class ToscaInvalidSubstituteNodeTemplatePropertiesErrorBuilder {
+
+ private static final String INVALID_SUBSTITUTE_NODE_TEMPLATE_MSG =
+ "Invalid Substitute Node Template %s, mandatory map property %s with mandatory "
+ + "key %s must be defined.";
+ private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+
+ /**
+ * Instantiates a new Tosca invalid substitute node template properties error builder.
+ *
+ * @param nodeTemplateId the node template id
+ */
+ public ToscaInvalidSubstituteNodeTemplatePropertiesErrorBuilder(String nodeTemplateId) {
+ builder.withId(ToscaErrorCodes.INVALID_SUBSTITUTE_NODE_TEMPLATE);
+ builder.withCategory(ErrorCategory.APPLICATION);
+ builder.withMessage(String.format(INVALID_SUBSTITUTE_NODE_TEMPLATE_MSG, nodeTemplateId,
+ ToscaConstants.SERVICE_TEMPLATE_FILTER_PROPERTY_NAME,
+ ToscaConstants.SUBSTITUTE_SERVICE_TEMPLATE_PROPERTY_NAME));
+ }
+
+ /**
+ * Build error code.
+ *
+ * @return the error code
+ */
+ public ErrorCode build() {
+ return builder.build();
+ }
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/errors/ToscaInvalidSubstitutionServiceTemplateErrorBuilder.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/errors/ToscaInvalidSubstitutionServiceTemplateErrorBuilder.java
new file mode 100644
index 0000000000..c240992597
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/errors/ToscaInvalidSubstitutionServiceTemplateErrorBuilder.java
@@ -0,0 +1,57 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.errors;
+
+import org.openecomp.sdc.common.errors.ErrorCategory;
+import org.openecomp.sdc.common.errors.ErrorCode;
+
+
+/**
+ * The type Tosca invalid substitution service template error builder.
+ */
+public class ToscaInvalidSubstitutionServiceTemplateErrorBuilder {
+
+ private static final String INVALID_SUBSTITUTION_SERVICE_TEMPLATE_MSG =
+ "Invalid Substitution Service Template %s, missing mandatory file 'Node type' "
+ + "in substitution mapping.";
+ private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+
+ /**
+ * Instantiates a new Tosca invalid substitution service template error builder.
+ *
+ * @param serviceTemplateFileName the service template file name
+ */
+ public ToscaInvalidSubstitutionServiceTemplateErrorBuilder(String serviceTemplateFileName) {
+ builder.withId(ToscaErrorCodes.INVALID_SUBSTITUTION_SERVICE_TEMPLATE);
+ builder.withCategory(ErrorCategory.APPLICATION);
+ builder.withMessage(
+ String.format(INVALID_SUBSTITUTION_SERVICE_TEMPLATE_MSG, serviceTemplateFileName));
+ }
+
+ /**
+ * Build error code.
+ *
+ * @return the error code
+ */
+ public ErrorCode build() {
+ return builder.build();
+ }
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/errors/ToscaMissingSubstitutionMappingForReqCapErrorBuilder.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/errors/ToscaMissingSubstitutionMappingForReqCapErrorBuilder.java
new file mode 100644
index 0000000000..74392cdcdb
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/errors/ToscaMissingSubstitutionMappingForReqCapErrorBuilder.java
@@ -0,0 +1,88 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.errors;
+
+import org.openecomp.sdc.common.errors.ErrorCategory;
+import org.openecomp.sdc.common.errors.ErrorCode;
+
+/**
+ * The type Tosca missing substitution mapping for req cap error builder.
+ */
+public class ToscaMissingSubstitutionMappingForReqCapErrorBuilder {
+
+ private static final String MISSING_SUBSTITUTION_MAPPING_FOR_REQ_CAP_MSG =
+ "Invalid Substitution, Missing Substitution Mapping for %s with Id %s.";
+ private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+
+ /**
+ * Instantiates a new Tosca missing substitution mapping for req cap error builder.
+ *
+ * @param exposedEntry the exposed entry
+ * @param id the id
+ */
+ public ToscaMissingSubstitutionMappingForReqCapErrorBuilder(MappingExposedEntry exposedEntry,
+ String id) {
+ builder.withId(ToscaErrorCodes.MISSING_SUBSTITUTION_MAPPING_FOR_REQ_CAP);
+ builder.withCategory(ErrorCategory.APPLICATION);
+ builder.withMessage(String
+ .format(MISSING_SUBSTITUTION_MAPPING_FOR_REQ_CAP_MSG, exposedEntry.getDisplayName(), id));
+ }
+
+ /**
+ * Build error code.
+ *
+ * @return the error code
+ */
+ public ErrorCode build() {
+ return builder.build();
+ }
+
+ /**
+ * The enum Mapping exposed entry.
+ */
+ public enum MappingExposedEntry {
+
+ /**
+ * Capability mapping exposed entry.
+ */
+ CAPABILITY("Capability"),
+ /**
+ * Requirement mapping exposed entry.
+ */
+ REQUIREMENT("Requirement"),;
+
+ private String displayName;
+
+ MappingExposedEntry(String displayName) {
+ this.displayName = displayName;
+ }
+
+ /**
+ * Gets display name.
+ *
+ * @return the display name
+ */
+ public String getDisplayName() {
+ return displayName;
+ }
+
+ }
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/errors/ToscaNodeTypeNotFoundErrorBuilder.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/errors/ToscaNodeTypeNotFoundErrorBuilder.java
new file mode 100644
index 0000000000..3d51970d50
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/errors/ToscaNodeTypeNotFoundErrorBuilder.java
@@ -0,0 +1,46 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.errors;
+
+import org.openecomp.sdc.common.errors.ErrorCategory;
+import org.openecomp.sdc.common.errors.ErrorCode;
+
+public class ToscaNodeTypeNotFoundErrorBuilder {
+ private static final String ENTRY_NOT_FOUND_MSG =
+ "NodeType '%s' or one of its derivedFrom node type hierarchy, "
+ + "is not defined in tosca service model";
+ private final ErrorCode.ErrorCodeBuilder builder = new ErrorCode.ErrorCodeBuilder();
+
+ /**
+ * Instantiates a new Tosca node type not found error builder.
+ *
+ * @param nodeType the node type
+ */
+ public ToscaNodeTypeNotFoundErrorBuilder(String nodeType) {
+ builder.withId(ToscaErrorCodes.TOSCA_ENTRY_NOT_FOUND);
+ builder.withCategory(ErrorCategory.APPLICATION);
+ builder.withMessage(String.format(ENTRY_NOT_FOUND_MSG, nodeType));
+ }
+
+ public ErrorCode build() {
+ return builder.build();
+ }
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/exceptions/CsarCreationErrorBuilder.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/exceptions/CsarCreationErrorBuilder.java
new file mode 100644
index 0000000000..c7b9bc2da4
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/exceptions/CsarCreationErrorBuilder.java
@@ -0,0 +1,43 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.exceptions;
+
+import org.openecomp.sdc.common.errors.BaseErrorBuilder;
+import org.openecomp.sdc.common.errors.ErrorCategory;
+
+/**
+ * The type Csar creation error builder.
+ */
+public class CsarCreationErrorBuilder extends BaseErrorBuilder {
+
+ private static final String MANDATORY_PROPERTY_IS_MISSING_MSG =
+ "Failed to create CSAR file from ToscaServiceModel";
+ private static final String ZIP_FILE_CREATION = "ZIP_FILE_CREATION";
+
+ /**
+ * Instantiates a new Csar creation error builder.
+ */
+ public CsarCreationErrorBuilder() {
+ getErrorCodeBuilder().withId(ZIP_FILE_CREATION);
+ getErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION);
+ getErrorCodeBuilder().withMessage(MANDATORY_PROPERTY_IS_MISSING_MSG);
+ }
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/exceptions/CsarMissingEntryPointErrorBuilder.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/exceptions/CsarMissingEntryPointErrorBuilder.java
new file mode 100644
index 0000000000..9b9257ad33
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/exceptions/CsarMissingEntryPointErrorBuilder.java
@@ -0,0 +1,44 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.exceptions;
+
+import org.openecomp.sdc.common.errors.BaseErrorBuilder;
+import org.openecomp.sdc.common.errors.ErrorCategory;
+
+/**
+ * The type Csar missing entry point error builder.
+ */
+public class CsarMissingEntryPointErrorBuilder extends BaseErrorBuilder {
+
+ private static final String MANDATORY_PROPERTY_IS_MISSING_MSG =
+ "Failed to create CSAR file from ToscaServiceModel,missing mandatory "
+ + "EntryDefinitionServiceTemplate ";
+ private static final String ZIP_FILE_CREATION = "ZIP_FILE_CREATION__MISSING_ENTRY_DEFINITION";
+
+ /**
+ * Instantiates a new Csar missing entry point error builder.
+ */
+ public CsarMissingEntryPointErrorBuilder() {
+ getErrorCodeBuilder().withId(ZIP_FILE_CREATION);
+ getErrorCodeBuilder().withCategory(ErrorCategory.APPLICATION);
+ getErrorCodeBuilder().withMessage(MANDATORY_PROPERTY_IS_MISSING_MSG);
+ }
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/DataModelUtil.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/DataModelUtil.java
new file mode 100644
index 0000000000..d0d7ccf621
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/DataModelUtil.java
@@ -0,0 +1,588 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.services;
+
+import org.openecomp.sdc.common.errors.CoreException;
+import org.openecomp.sdc.tosca.datatypes.ToscaFunctions;
+import org.openecomp.sdc.tosca.datatypes.model.AttributeDefinition;
+import org.openecomp.sdc.tosca.datatypes.model.Constraint;
+import org.openecomp.sdc.tosca.datatypes.model.EntrySchema;
+import org.openecomp.sdc.tosca.datatypes.model.GroupDefinition;
+import org.openecomp.sdc.tosca.datatypes.model.Metadata;
+import org.openecomp.sdc.tosca.datatypes.model.NodeTemplate;
+import org.openecomp.sdc.tosca.datatypes.model.NodeType;
+import org.openecomp.sdc.tosca.datatypes.model.PolicyDefinition;
+import org.openecomp.sdc.tosca.datatypes.model.PropertyDefinition;
+import org.openecomp.sdc.tosca.datatypes.model.RelationshipTemplate;
+import org.openecomp.sdc.tosca.datatypes.model.RequirementAssignment;
+import org.openecomp.sdc.tosca.datatypes.model.RequirementDefinition;
+import org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate;
+import org.openecomp.sdc.tosca.datatypes.model.Status;
+import org.openecomp.sdc.tosca.datatypes.model.SubstitutionMapping;
+import org.openecomp.sdc.tosca.datatypes.model.TopologyTemplate;
+import org.openecomp.sdc.tosca.datatypes.model.heatextend.ParameterDefinitionExt;
+import org.openecomp.sdc.tosca.errors.InvalidAddActionNullEntityErrorBuilder;
+import org.openecomp.sdc.tosca.errors.InvalidRequirementAssignmentErrorBuilder;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
+/**
+ * The type Data model util.
+ */
+public class DataModelUtil {
+
+ /**
+ * Add substitution mapping.
+ *
+ * @param serviceTemplate the service template
+ * @param substitutionMapping the substitution mapping
+ */
+ public static void addSubstitutionMapping(ServiceTemplate serviceTemplate,
+ SubstitutionMapping substitutionMapping) {
+ if (serviceTemplate == null) {
+ throw new CoreException(
+ new InvalidAddActionNullEntityErrorBuilder("Substitution Mapping", "Service Template")
+ .build());
+ }
+
+ if (serviceTemplate.getTopology_template() == null) {
+ serviceTemplate.setTopology_template(new TopologyTemplate());
+ }
+ serviceTemplate.getTopology_template().setSubstitution_mappings(substitutionMapping);
+ }
+
+ /**
+ * Add substitution mapping req.
+ *
+ * @param serviceTemplate the service template
+ * @param substitutionMappingRequirementId the substitution mapping requirement id
+ * @param substitutionMappingRequirementList the substitution mapping requirement list
+ */
+ public static void addSubstitutionMappingReq(ServiceTemplate serviceTemplate,
+ String substitutionMappingRequirementId,
+ List<String> substitutionMappingRequirementList) {
+ if (serviceTemplate == null) {
+ throw new CoreException(
+ new InvalidAddActionNullEntityErrorBuilder("Substitution Mapping Requirements",
+ "Service Template").build());
+ }
+
+ if (serviceTemplate.getTopology_template() == null) {
+ serviceTemplate.setTopology_template(new TopologyTemplate());
+ }
+ if (serviceTemplate.getTopology_template().getSubstitution_mappings() == null) {
+ serviceTemplate.getTopology_template().setSubstitution_mappings(new SubstitutionMapping());
+ }
+ if (serviceTemplate.getTopology_template().getSubstitution_mappings().getRequirements()
+ == null) {
+ serviceTemplate.getTopology_template().getSubstitution_mappings()
+ .setRequirements(new HashMap<>());
+ }
+
+ serviceTemplate.getTopology_template().getSubstitution_mappings().getRequirements()
+ .put(substitutionMappingRequirementId, substitutionMappingRequirementList);
+ }
+
+ /**
+ * Add node template.
+ *
+ * @param serviceTemplate the service template
+ * @param nodeTemplateId the node template id
+ * @param nodeTemplate the node template
+ */
+ public static void addNodeTemplate(ServiceTemplate serviceTemplate, String nodeTemplateId,
+ NodeTemplate nodeTemplate) {
+ if (serviceTemplate == null) {
+ throw new CoreException(
+ new InvalidAddActionNullEntityErrorBuilder("Node Template", "Service Template").build());
+ }
+ TopologyTemplate topologyTemplate = serviceTemplate.getTopology_template();
+ if (Objects.isNull(topologyTemplate)) {
+ topologyTemplate = new TopologyTemplate();
+ serviceTemplate.setTopology_template(topologyTemplate);
+ }
+ if (topologyTemplate.getNode_templates() == null) {
+ topologyTemplate.setNode_templates(new HashMap<>());
+ }
+ topologyTemplate.getNode_templates().put(nodeTemplateId, nodeTemplate);
+ }
+
+ /**
+ * Add policy definition.
+ *
+ * @param serviceTemplate the service template
+ * @param policyId the policy id
+ * @param policyDefinition the policy definition
+ */
+ public static void addPolicyDefinition(ServiceTemplate serviceTemplate, String policyId,
+ PolicyDefinition policyDefinition) {
+ if (serviceTemplate == null) {
+ throw new CoreException(
+ new InvalidAddActionNullEntityErrorBuilder("Policy Definition", "Service Template")
+ .build());
+ }
+ TopologyTemplate topologyTemplate = serviceTemplate.getTopology_template();
+ if (Objects.isNull(topologyTemplate)) {
+ topologyTemplate = new TopologyTemplate();
+ serviceTemplate.setTopology_template(topologyTemplate);
+ }
+ if (topologyTemplate.getPolicies() == null) {
+ topologyTemplate.setPolicies(new HashMap<>());
+ }
+ topologyTemplate.getPolicies().put(policyId, policyDefinition);
+ }
+
+ /**
+ * Add node type.
+ *
+ * @param serviceTemplate the service template
+ * @param nodeTypeId the node type id
+ * @param nodeType the node type
+ */
+ public static void addNodeType(ServiceTemplate serviceTemplate, String nodeTypeId,
+ NodeType nodeType) {
+ if (serviceTemplate == null) {
+ throw new CoreException(
+ new InvalidAddActionNullEntityErrorBuilder("Node Type", "Service Template").build());
+ }
+ if (serviceTemplate.getNode_types() == null) {
+ serviceTemplate.setNode_types(new HashMap<>());
+ }
+ serviceTemplate.getNode_types().put(nodeTypeId, nodeType);
+ }
+
+ /**
+ * Add relationship template.
+ *
+ * @param serviceTemplate the service template
+ * @param relationshipTemplateId the relationship template id
+ * @param relationshipTemplate the relationship template
+ */
+ public static void addRelationshipTemplate(ServiceTemplate serviceTemplate,
+ String relationshipTemplateId,
+ RelationshipTemplate relationshipTemplate) {
+ if (serviceTemplate == null) {
+ throw new CoreException(
+ new InvalidAddActionNullEntityErrorBuilder("Relationship Template", "Service Template")
+ .build());
+ }
+ if (serviceTemplate.getTopology_template() == null) {
+ serviceTemplate.setTopology_template(new TopologyTemplate());
+ }
+ if (serviceTemplate.getTopology_template().getRelationship_templates() == null) {
+ serviceTemplate.getTopology_template().setRelationship_templates(new HashMap<>());
+ }
+ serviceTemplate.getTopology_template().getRelationship_templates()
+ .put(relationshipTemplateId, relationshipTemplate);
+ }
+
+ /**
+ * Add requirement assignment.
+ *
+ * @param nodeTemplate the node template
+ * @param requirementId the requirement id
+ * @param requirementAssignment the requirement assignment
+ */
+ public static void addRequirementAssignment(NodeTemplate nodeTemplate, String requirementId,
+ RequirementAssignment requirementAssignment) {
+ if (nodeTemplate == null) {
+ throw new CoreException(
+ new InvalidAddActionNullEntityErrorBuilder("Requirement Assignment", "Node Template")
+ .build());
+ }
+ if (requirementAssignment.getNode() == null) {
+ throw new CoreException(new InvalidRequirementAssignmentErrorBuilder(requirementId).build());
+ }
+
+ if (nodeTemplate.getRequirements() == null) {
+ nodeTemplate.setRequirements(new ArrayList<>());
+ }
+ Map<String, RequirementAssignment> requirement = new HashMap<>();
+ requirement.put(requirementId, requirementAssignment);
+ nodeTemplate.getRequirements().add(requirement);
+ }
+
+ /**
+ * Gets node template.
+ *
+ * @param serviceTemplate the service template
+ * @param nodeTemplateId the node template id
+ * @return the node template
+ */
+ public static NodeTemplate getNodeTemplate(ServiceTemplate serviceTemplate,
+ String nodeTemplateId) {
+ if (serviceTemplate == null
+ || serviceTemplate.getTopology_template() == null
+ || serviceTemplate.getTopology_template().getNode_templates() == null) {
+ return null;
+ }
+ return serviceTemplate.getTopology_template().getNode_templates().get(nodeTemplateId);
+ }
+
+ /**
+ * Gets node type.
+ *
+ * @param serviceTemplate the service template
+ * @param nodeTypeId the node type id
+ * @return the node type
+ */
+ public static NodeType getNodeType(ServiceTemplate serviceTemplate, String nodeTypeId) {
+ if (serviceTemplate == null || serviceTemplate.getNode_types() == null) {
+ return null;
+ }
+ return serviceTemplate.getNode_types().get(nodeTypeId);
+ }
+
+ /**
+ * Add group definition to topology template.
+ *
+ * @param serviceTemplate the service template
+ * @param groupName the group name
+ * @param group the group
+ */
+ public static void addGroupDefinitionToTopologyTemplate(ServiceTemplate serviceTemplate,
+ String groupName, GroupDefinition group) {
+ if (serviceTemplate == null) {
+ throw new CoreException(
+ new InvalidAddActionNullEntityErrorBuilder("Group Definition", "Service Template")
+ .build());
+ }
+
+ TopologyTemplate topologyTemplate = serviceTemplate.getTopology_template();
+ if (Objects.isNull(topologyTemplate)) {
+ topologyTemplate = new TopologyTemplate();
+ serviceTemplate.setTopology_template(topologyTemplate);
+ }
+ if (topologyTemplate.getGroups() == null) {
+ topologyTemplate.setGroups(new HashMap<>());
+ }
+ if (serviceTemplate.getTopology_template().getGroups() == null) {
+ Map<String, GroupDefinition> groups = new HashMap<>();
+ serviceTemplate.getTopology_template().setGroups(groups);
+ }
+ serviceTemplate.getTopology_template().getGroups().put(groupName, group);
+ }
+
+ /**
+ * Create property definition property definition.
+ *
+ * @param type the type
+ * @param description the description
+ * @param required the required
+ * @param constraints the constraints
+ * @param status the status
+ * @param entrySchema the entry schema
+ * @param defaultVal the default val
+ * @return the property definition
+ */
+ public static PropertyDefinition createPropertyDefinition(String type, String description,
+ boolean required,
+ List<Constraint> constraints,
+ Status status,
+ EntrySchema entrySchema,
+ Object defaultVal) {
+ PropertyDefinition propDef = new PropertyDefinition();
+ propDef.setType(type);
+ propDef.setDescription(description);
+ propDef.setRequired(required);
+ propDef.setConstraints(constraints);
+ if (status != null) {
+ propDef.setStatus(status);
+ }
+ propDef.setEntry_schema(entrySchema);
+ propDef.set_default(defaultVal);
+
+ return propDef;
+ }
+
+ /**
+ * Create requirement requirement definition.
+ *
+ * @param capability the capability
+ * @param node the node
+ * @param relationship the relationship
+ * @param occurrences the occurrences
+ * @return the requirement definition
+ */
+ public static RequirementDefinition createRequirement(String capability, String node,
+ String relationship, Object[] occurrences) {
+ RequirementDefinition requirementDefinition = new RequirementDefinition();
+ requirementDefinition.setCapability(capability);
+ requirementDefinition.setNode(node);
+ requirementDefinition.setRelationship(relationship);
+ if (occurrences != null) {
+ requirementDefinition.setOccurrences(occurrences);
+ }
+ return requirementDefinition;
+ }
+
+ /**
+ * Create attribute definition attribute definition.
+ *
+ * @param type the type
+ * @param description the description
+ * @param status the status
+ * @param entrySchema the entry schema
+ * @param defaultVal the default val
+ * @return the attribute definition
+ */
+ public static AttributeDefinition createAttributeDefinition(String type, String description,
+ Status status,
+ EntrySchema entrySchema,
+ Object defaultVal) {
+ AttributeDefinition attributeDef = new AttributeDefinition();
+ attributeDef.setType(type);
+
+ if (description != null) {
+ attributeDef.setDescription(description);
+ }
+ if (status != null) {
+ attributeDef.setStatus(status);
+ }
+ attributeDef.setEntry_schema(entrySchema);
+ attributeDef.set_default(defaultVal);
+
+ return attributeDef;
+ }
+
+ /**
+ * Create valid values constraint constraint.
+ *
+ * @param values the values
+ * @return the constraint
+ */
+ public static Constraint createValidValuesConstraint(Object... values) {
+ Constraint validValues = new Constraint();
+ for (Object value : values) {
+ validValues.addValidValue(value);
+ }
+ return validValues;
+ }
+
+ /**
+ * Create metadata metadata.
+ *
+ * @param templateName the template name
+ * @param templateVersion the template version
+ * @param templateAuthor the template author
+ * @return the metadata
+ */
+ public static Metadata createMetadata(String templateName, String templateVersion,
+ String templateAuthor) {
+ Metadata metadata = new Metadata();
+ metadata.setTemplate_name(templateName);
+ metadata.setTemplate_version(templateVersion);
+ metadata.setTemplate_author(templateAuthor);
+
+ return metadata;
+ }
+
+ /**
+ * Create entry schema entry schema.
+ *
+ * @param type the type
+ * @param description the description
+ * @param constraints the constraints
+ * @return the entry schema
+ */
+ public static EntrySchema createEntrySchema(String type, String description,
+ List<Constraint> constraints) {
+ EntrySchema entrySchema = new EntrySchema();
+ entrySchema.setType(type);
+ entrySchema.setDescription(description);
+ entrySchema.setConstraints(constraints);
+ return entrySchema;
+ }
+
+ /**
+ * Create valid values constraints list list.
+ *
+ * @param values the values
+ * @return the list
+ */
+ public static List<Constraint> createValidValuesConstraintsList(String... values) {
+ List<Constraint> constraints;
+ Constraint validValues;
+ constraints = new ArrayList<>();
+ validValues = DataModelUtil.createValidValuesConstraint(values);
+ constraints.add(validValues);
+ return constraints;
+ }
+
+ /**
+ * Create greater or equal constrain constraint.
+ *
+ * @param value the value
+ * @return the constraint
+ */
+ public static Constraint createGreaterOrEqualConstrain(Object value) {
+
+ Constraint constraint = new Constraint();
+ constraint.setGreater_or_equal(value);
+ return constraint;
+ }
+
+ /**
+ * Gets constrain list.
+ *
+ * @param constrains the constrains
+ * @return the constrain list
+ */
+ public static List<Constraint> getConstrainList(Constraint... constrains) {
+ return Arrays.asList(constrains);
+
+ }
+
+ /**
+ * Create get input property value from list parameter map.
+ *
+ * @param inputPropertyListName the input property list name
+ * @param indexInTheList the index in the list
+ * @param nestedPropertyName the nested property name
+ * @return the map
+ */
+ public static Map createGetInputPropertyValueFromListParameter(String inputPropertyListName,
+ int indexInTheList,
+ String... nestedPropertyName) {
+ List propertyList = new ArrayList<>();
+ propertyList.add(inputPropertyListName);
+ propertyList.add(indexInTheList);
+ if (nestedPropertyName != null) {
+ Collections.addAll(propertyList, nestedPropertyName);
+ }
+ Map getInputProperty = new HashMap<>();
+ getInputProperty.put(ToscaFunctions.GET_INPUT.getDisplayName(), propertyList);
+ return getInputProperty;
+ }
+
+ /**
+ * Convert property def to parameter def parameter definition ext.
+ *
+ * @param propertyDefinition the property definition
+ * @return the parameter definition ext
+ */
+ public static ParameterDefinitionExt convertPropertyDefToParameterDef(
+ PropertyDefinition propertyDefinition) {
+ if (propertyDefinition == null) {
+ return null;
+ }
+
+ ParameterDefinitionExt parameterDefinition = new ParameterDefinitionExt();
+ parameterDefinition.setType(propertyDefinition.getType());
+ parameterDefinition.setDescription(propertyDefinition.getDescription());
+ parameterDefinition.setRequired(propertyDefinition.getRequired());
+ parameterDefinition.set_default(propertyDefinition.get_default());
+ parameterDefinition.setStatus(propertyDefinition.getStatus());
+ parameterDefinition.setConstraints(propertyDefinition.getConstraints());
+ parameterDefinition.setEntry_schema(propertyDefinition.getEntry_schema());
+ parameterDefinition.setHidden(false);
+ parameterDefinition.setImmutable(false);
+
+ return parameterDefinition;
+ }
+
+ /**
+ * Convert attribute def to parameter def parameter definition ext.
+ *
+ * @param attributeDefinition the attribute definition
+ * @param outputValue the output value
+ * @return the parameter definition ext
+ */
+ public static ParameterDefinitionExt convertAttributeDefToParameterDef(
+ AttributeDefinition attributeDefinition, Map<String, List> outputValue) {
+ if (attributeDefinition == null) {
+ return null;
+ }
+ ParameterDefinitionExt parameterDefinition = new ParameterDefinitionExt();
+ parameterDefinition.setDescription(attributeDefinition.getDescription());
+ parameterDefinition.setValue(outputValue);
+ return parameterDefinition;
+ }
+
+ /**
+ * Clone constraints list.
+ *
+ * @param constraints the constraints
+ * @return the list
+ */
+ public static List<Constraint> cloneConstraints(List<Constraint> constraints) {
+ if (constraints == null) {
+ return null;
+ }
+ return constraints.stream().map(Constraint::clone).collect(Collectors.toList());
+ }
+
+ /**
+ * Clone valid source types list.
+ *
+ * @param validSourceTypes the valid source types
+ * @return the list
+ */
+ public static List<String> cloneValidSourceTypes(List<String> validSourceTypes) {
+ if (validSourceTypes == null) {
+ return null;
+ }
+ return validSourceTypes.stream().collect(Collectors.toList());
+ }
+
+ /**
+ * Clone property definitions map.
+ *
+ * @param propertyDefinitions the property definitions
+ * @return the map
+ */
+ public static Map<String, PropertyDefinition> clonePropertyDefinitions(
+ Map<String, PropertyDefinition> propertyDefinitions) {
+ if (propertyDefinitions == null) {
+ return null;
+ }
+ Map<String, PropertyDefinition> clonedProperties = new HashMap<>();
+ for (String propertyKey : propertyDefinitions.keySet()) {
+ clonedProperties.put(propertyKey, propertyDefinitions.get(propertyKey).clone());
+ }
+ return clonedProperties;
+ }
+
+ /**
+ * Clone attribute definitions map.
+ *
+ * @param attributeDefinitions the attribute definitions
+ * @return the map
+ */
+ public static Map<String, AttributeDefinition> cloneAttributeDefinitions(
+ Map<String, AttributeDefinition> attributeDefinitions) {
+ if (attributeDefinitions == null) {
+ return null;
+ }
+ Map<String, AttributeDefinition> clonedAttributeDefinitions = new HashMap<>();
+ for (String attributeKey : attributeDefinitions.keySet()) {
+ clonedAttributeDefinitions.put(attributeKey, attributeDefinitions.get(attributeKey).clone());
+ }
+ return clonedAttributeDefinitions;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/ToscaAnalyzerService.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/ToscaAnalyzerService.java
new file mode 100644
index 0000000000..271c471922
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/ToscaAnalyzerService.java
@@ -0,0 +1,66 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.services;
+
+import org.openecomp.sdc.tosca.datatypes.ToscaElementTypes;
+import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
+import org.openecomp.sdc.tosca.datatypes.model.NodeTemplate;
+import org.openecomp.sdc.tosca.datatypes.model.RequirementAssignment;
+import org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+
+public interface ToscaAnalyzerService {
+
+ /*
+ node template with type equal to node type or derived from node type
+ */
+ Map<String, NodeTemplate> getNodeTemplatesByType(ServiceTemplate serviceTemplate, String nodeType,
+ ToscaServiceModel toscaServiceModel);
+
+ boolean isTypeOf(NodeTemplate nodeTemplate, String nodeType, ServiceTemplate serviceTemplate,
+ ToscaServiceModel toscaServiceModel);
+
+ List<RequirementAssignment> getRequirements(NodeTemplate nodeTemplate, String requirementId);
+
+ Optional<NodeTemplate> getNodeTemplateById(ServiceTemplate serviceTemplate,
+ String nodeTemplateId);
+
+ Optional<String> getSubstituteServiceTemplateName(String substituteNodeTemplateId,
+ NodeTemplate substitutableNodeTemplate);
+
+ Map<String, NodeTemplate> getSubstitutableNodeTemplates(ServiceTemplate serviceTemplate);
+
+ Optional<Map.Entry<String, NodeTemplate>> getSubstitutionMappedNodeTemplateByExposedReq(
+ String substituteServiceTemplateFileName, ServiceTemplate substituteServiceTemplate,
+ String requirementId);
+
+ /*
+ match only for the input which is not null
+ */
+ boolean isDesiredRequirementAssignment(RequirementAssignment requirementAssignment,
+ String capability, String node, String relationship);
+
+ Object getFlatEntity(ToscaElementTypes elementType, String type, ServiceTemplate serviceTemplate,
+ ToscaServiceModel toscaModel);
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/ToscaConstants.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/ToscaConstants.java
new file mode 100644
index 0000000000..27cf07e166
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/ToscaConstants.java
@@ -0,0 +1,65 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.services;
+
+
+public class ToscaConstants {
+
+ //TOSCA Node Types prefix
+ public static final String NODES_PREFIX = "org.openecomp.resource.vfc.nodes.heat.";
+ public static final String NODES_SUBSTITUTION_PREFIX
+ = "org.openecomp.resource.abstract.nodes.heat.";
+
+ //TOSCA Requirement Ids
+ public static final String DEPENDS_ON_REQUIREMENT_ID = "dependency";
+ public static final String BINDING_REQUIREMENT_ID = "binding";
+ public static final String LINK_REQUIREMENT_ID = "link";
+ public static final String LOCAL_STORAGE_REQUIREMENT_ID = "local_storage";
+ public static final String NETWORK_REQUIREMENT_ID = "network";
+ public static final String PORT_REQUIREMENT_ID = "port";
+
+ //TOSCA Capability Ids
+ public static final String BINDING_CAPABILITY_ID = "binding";
+ public static final String LINK_CAPABILITY_ID = "link";
+ public static final String HOST_CAPABILITY_ID = "host";
+ public static final String ENDPOINT_CAPABILITY_ID = "endpoint";
+ public static final String OS_CAPABILITY_ID = "os";
+ public static final String SCALABLE_CAPABILITY_ID = "scalable";
+
+ //General
+ public static final String TOSCA_DEFINITIONS_VERSION = "tosca_simple_yaml_1_0_0";
+ public static final String MODELABLE_ENTITY_NAME_SELF = "SELF";
+ public static final String NODE_TEMPLATE_DIRECTIVE_SUBSTITUTABLE = "substitutable";
+ public static final String NATIVE_TYPES_SERVICE_TEMPLATE_NAME = "NativeTypesServiceTemplate";
+ public static final String UNBOUNDED = "UNBOUNDED";
+
+ //properties
+ public static final String SERVICE_TEMPLATE_FILTER_PROPERTY_NAME = "service_template_filter";
+ public static final String SUBSTITUTE_SERVICE_TEMPLATE_PROPERTY_NAME =
+ "substitute_service_template";
+ public static final String COUNT_PROPERTY_NAME = "count";
+ public static final String INDEX_VALUE_PROPERTY_NAME = "index_value";
+ public static final String SCALING_ENABLED_PROPERTY_NAME = "scaling_enabled";
+
+ public static final String DHCP_ENABLED_PROPERTY_NAME = "dhcp_enabled";
+
+
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/ToscaFileOutputService.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/ToscaFileOutputService.java
new file mode 100644
index 0000000000..7ec2fffa2b
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/ToscaFileOutputService.java
@@ -0,0 +1,34 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.services;
+
+import org.openecomp.core.utilities.file.FileContentHandler;
+import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
+
+public interface ToscaFileOutputService {
+ byte[] createOutputFile(ToscaServiceModel toscaServiceModel,
+ FileContentHandler externalArtifacts);
+
+ String createMetaFile(String entryDefinitionsFileName);
+
+ String getArtifactsFolderName();
+
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/ToscaNativeTypesServiceTemplate.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/ToscaNativeTypesServiceTemplate.java
new file mode 100644
index 0000000000..013d761168
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/ToscaNativeTypesServiceTemplate.java
@@ -0,0 +1,309 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.services;
+
+import org.openecomp.sdc.tosca.datatypes.ToscaCapabilityType;
+import org.openecomp.sdc.tosca.datatypes.ToscaDataType;
+import org.openecomp.sdc.tosca.datatypes.ToscaNodeType;
+import org.openecomp.sdc.tosca.datatypes.ToscaRelationshipType;
+
+import org.openecomp.sdc.tosca.datatypes.model.AttributeDefinition;
+import org.openecomp.sdc.tosca.datatypes.model.CapabilityDefinition;
+import org.openecomp.sdc.tosca.datatypes.model.InterfaceDefinition;
+import org.openecomp.sdc.tosca.datatypes.model.NodeType;
+import org.openecomp.sdc.tosca.datatypes.model.PropertyDefinition;
+import org.openecomp.sdc.tosca.datatypes.model.PropertyType;
+import org.openecomp.sdc.tosca.datatypes.model.RequirementDefinition;
+import org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * The type Tosca native types service template.
+ */
+public class ToscaNativeTypesServiceTemplate {
+ /**
+ * Create service template service template.
+ *
+ * @return the service template
+ */
+ public static ServiceTemplate createServiceTemplate() {
+ ServiceTemplate nativeNodeTypesServiceTemplate = new ServiceTemplate();
+ nativeNodeTypesServiceTemplate
+ .setTosca_definitions_version(ToscaConstants.TOSCA_DEFINITIONS_VERSION);
+ nativeNodeTypesServiceTemplate.setMetadata(DataModelUtil
+ .createMetadata(ToscaConstants.NATIVE_TYPES_SERVICE_TEMPLATE_NAME, "1.0.0", null));
+ nativeNodeTypesServiceTemplate.setDescription("TOSCA Native Node Types");
+ nativeNodeTypesServiceTemplate.setNode_types(createNativeNodeTypes());
+ return nativeNodeTypesServiceTemplate;
+ }
+
+ private static Map<String, NodeType> createNativeNodeTypes() {
+ Map<String, NodeType> nativeNodeTypes = new HashMap<>();
+ nativeNodeTypes.put(ToscaNodeType.COMPUTE.getDisplayName(), createToscaNodesComputeNodeType());
+ nativeNodeTypes.put(ToscaNodeType.ROOT.getDisplayName(), createToscaNodesRootNodeType());
+ nativeNodeTypes
+ .put(ToscaNodeType.NETWORK_PORT.getDisplayName(), createToscaNodesPortsNodeType());
+ nativeNodeTypes
+ .put(ToscaNodeType.BLOCK_STORAGE.getDisplayName(), createToscaNodesBlockStorageNodeType());
+ nativeNodeTypes.put(ToscaNodeType.NETWORK.getDisplayName(), createToscaNodesNetworkNodeType());
+ return nativeNodeTypes;
+ }
+
+ private static NodeType createToscaNodesComputeNodeType() {
+ NodeType computeNodeType = new NodeType();
+ computeNodeType.setDerived_from(ToscaNodeType.ROOT.getDisplayName());
+ computeNodeType.setAttributes(createComputeAttributes());
+ computeNodeType.setRequirements(createComputeRequirements());
+ computeNodeType.setCapabilities(createComputeCapabilities());
+ return computeNodeType;
+ }
+
+ private static NodeType createToscaNodesRootNodeType() {
+ NodeType computeNodeType = new NodeType();
+ computeNodeType.setAttributes(createRootAttributes());
+ computeNodeType.setInterfaces(createRootInterfaces());
+ return computeNodeType;
+ }
+
+ private static NodeType createToscaNodesPortsNodeType() {
+ NodeType computeNodeType = new NodeType();
+ computeNodeType.setDerived_from(ToscaNodeType.ROOT.getDisplayName());
+ computeNodeType.setProperties(createToscaNodesPortProperties());
+ computeNodeType.setRequirements(createToscaNodesPortRequirements());
+ return computeNodeType;
+ }
+
+ private static NodeType createToscaNodesBlockStorageNodeType() {
+ NodeType computeNodeType = new NodeType();
+ computeNodeType.setDerived_from(ToscaNodeType.ROOT.getDisplayName());
+ computeNodeType.setProperties(createToscaNodesBlockStorageProperties());
+ computeNodeType.setCapabilities(createToscaNodesBlockStorageCapabilities());
+ return computeNodeType;
+ }
+
+ private static NodeType createToscaNodesNetworkNodeType() {
+ NodeType computeNodeType = new NodeType();
+ computeNodeType.setDerived_from(ToscaNodeType.ROOT.getDisplayName());
+ computeNodeType.setProperties(createToscaNodesNetworkProperties());
+ computeNodeType.setCapabilities(createToscaNodesNetworkCapabilities());
+ return computeNodeType;
+ }
+
+ private static Map<String, PropertyDefinition> createToscaNodesPortProperties() {
+ Map<String, PropertyDefinition> propertyDefinitionMap = new HashMap<>();
+ propertyDefinitionMap.put("ip_address", DataModelUtil
+ .createPropertyDefinition(PropertyType.STRING.getDisplayName(), null, false, null, null,
+ null, null));
+ propertyDefinitionMap.put("order", DataModelUtil
+ .createPropertyDefinition(PropertyType.INTEGER.getDisplayName(), null, true,
+ DataModelUtil.getConstrainList(DataModelUtil.createGreaterOrEqualConstrain(0)), null,
+ null, 0));
+ propertyDefinitionMap.put("is_default", DataModelUtil
+ .createPropertyDefinition(PropertyType.BOOLEAN.getDisplayName(), null, false, null, null,
+ null, false));
+ propertyDefinitionMap.put("ip_range_start", DataModelUtil
+ .createPropertyDefinition(PropertyType.STRING.getDisplayName(), null, false, null, null,
+ null, null));
+ propertyDefinitionMap.put("ip_range_end", DataModelUtil
+ .createPropertyDefinition(PropertyType.STRING.getDisplayName(), null, false, null, null,
+ null, null));
+ return propertyDefinitionMap;
+ }
+
+ private static Map<String, PropertyDefinition> createToscaNodesBlockStorageProperties() {
+ Map<String, PropertyDefinition> propertyDefinitionMap = new HashMap<>();
+ propertyDefinitionMap.put("size", DataModelUtil
+ .createPropertyDefinition(PropertyType.SCALAR_UNIT_SIZE.getDisplayName(), null, false,
+ DataModelUtil.getConstrainList(DataModelUtil.createGreaterOrEqualConstrain("1 MB")),
+ null, null, null));
+ propertyDefinitionMap.put("volume_id", DataModelUtil
+ .createPropertyDefinition(PropertyType.STRING.getDisplayName(), null, false, null, null,
+ null, null));
+ propertyDefinitionMap.put("snapshot_id", DataModelUtil
+ .createPropertyDefinition(PropertyType.STRING.getDisplayName(), null, false, null, null,
+ null, null));
+ return propertyDefinitionMap;
+ }
+
+ private static Map<String, PropertyDefinition> createToscaNodesNetworkProperties() {
+ Map<String, PropertyDefinition> propertyDefinitionMap = new HashMap<>();
+ propertyDefinitionMap.put("ip_version", DataModelUtil
+ .createPropertyDefinition(PropertyType.INTEGER.getDisplayName(), null, false,
+ DataModelUtil.getConstrainList(DataModelUtil.createValidValuesConstraint(4, 6)), null,
+ null, 4));
+ propertyDefinitionMap.put("cidr", DataModelUtil
+ .createPropertyDefinition(PropertyType.STRING.getDisplayName(), null, false, null, null,
+ null, null));
+ propertyDefinitionMap.put("start_ip", DataModelUtil
+ .createPropertyDefinition(PropertyType.STRING.getDisplayName(), null, false, null, null,
+ null, null));
+ propertyDefinitionMap.put("end_ip", DataModelUtil
+ .createPropertyDefinition(PropertyType.STRING.getDisplayName(), null, false, null, null,
+ null, null));
+ propertyDefinitionMap.put("gateway_ip", DataModelUtil
+ .createPropertyDefinition(PropertyType.STRING.getDisplayName(), null, false, null, null,
+ null, null));
+ propertyDefinitionMap.put("network_name", DataModelUtil
+ .createPropertyDefinition(PropertyType.STRING.getDisplayName(), null, false, null, null,
+ null, null));
+ propertyDefinitionMap.put("network_id", DataModelUtil
+ .createPropertyDefinition(PropertyType.STRING.getDisplayName(), null, false, null, null,
+ null, null));
+ propertyDefinitionMap.put("segmentation_id", DataModelUtil
+ .createPropertyDefinition(PropertyType.STRING.getDisplayName(), null, false, null, null,
+ null, null));
+ propertyDefinitionMap.put("network_type", DataModelUtil
+ .createPropertyDefinition(PropertyType.STRING.getDisplayName(), null, false, null, null,
+ null, null));
+ propertyDefinitionMap.put("physical_network", DataModelUtil
+ .createPropertyDefinition(PropertyType.STRING.getDisplayName(), null, false, null, null,
+ null, null));
+ propertyDefinitionMap.put("dhcp_enabled", DataModelUtil
+ .createPropertyDefinition(PropertyType.BOOLEAN.getDisplayName(), null, false, null, null,
+ null, true));
+
+ return propertyDefinitionMap;
+ }
+
+ private static Map<String, InterfaceDefinition> createRootInterfaces() {
+ return new HashMap<>();
+ }
+
+ private static Map<String, CapabilityDefinition> createComputeCapabilities() {
+ Map<String, CapabilityDefinition> computeCapabilities = new HashMap<>();
+ computeCapabilities.put(ToscaConstants.HOST_CAPABILITY_ID,
+ createCapabilityDefinition(ToscaCapabilityType.CONTAINER.getDisplayName(),
+ createValidSourceTypes("tosca.nodes.SoftwareComponent")));
+ computeCapabilities.put(ToscaConstants.ENDPOINT_CAPABILITY_ID,
+ createCapabilityDefinition(ToscaCapabilityType.ENDPOINT_ADMIN.getDisplayName(), null));
+ computeCapabilities.put(ToscaConstants.OS_CAPABILITY_ID,
+ createCapabilityDefinition(ToscaCapabilityType.OPERATING_SYSTEM.getDisplayName(), null));
+ computeCapabilities.put(ToscaConstants.SCALABLE_CAPABILITY_ID,
+ createCapabilityDefinition(ToscaCapabilityType.SCALABLE.getDisplayName(), null));
+ computeCapabilities.put(ToscaConstants.BINDING_CAPABILITY_ID,
+ createCapabilityDefinition(ToscaCapabilityType.NETWORK_BINDABLE.getDisplayName(), null));
+ return computeCapabilities;
+ }
+
+ private static Map<String, CapabilityDefinition> createToscaNodesBlockStorageCapabilities() {
+ Map<String, CapabilityDefinition> computeCapabilities = new HashMap<>();
+ computeCapabilities.put("attachment",
+ createCapabilityDefinition(ToscaCapabilityType.ATTACHMENT.getDisplayName(), null));
+ return computeCapabilities;
+ }
+
+ private static Map<String, CapabilityDefinition> createToscaNodesNetworkCapabilities() {
+ Map<String, CapabilityDefinition> computeCapabilities = new HashMap<>();
+ computeCapabilities.put(ToscaConstants.LINK_CAPABILITY_ID,
+ createCapabilityDefinition(ToscaCapabilityType.NETWORK_LINKABLE.getDisplayName(), null));
+ return computeCapabilities;
+ }
+
+ private static List<String> createValidSourceTypes(String... validSourceTypes) {
+ return Arrays.asList(validSourceTypes);
+ }
+
+ private static CapabilityDefinition createCapabilityDefinition(String type,
+ List<String> validSourceTypes) {
+ CapabilityDefinition capabilityDefinition = new CapabilityDefinition();
+ capabilityDefinition.setType(type);
+ capabilityDefinition.setValid_source_types(validSourceTypes);
+ return capabilityDefinition;
+ }
+
+ private static List<Map<String, RequirementDefinition>> createComputeRequirements() {
+ List<Map<String, RequirementDefinition>> computeRequirementList = new ArrayList<>();
+ Map<String, RequirementDefinition> localStorageRequirement = new HashMap<>();
+ localStorageRequirement.put("local_storage", DataModelUtil
+ .createRequirement(ToscaCapabilityType.ATTACHMENT.getDisplayName(),
+ ToscaNodeType.BLOCK_STORAGE.getDisplayName(),
+ ToscaRelationshipType.NATIVE_ATTACHES_TO.getDisplayName(),
+ createOccurrences(0, ToscaConstants.UNBOUNDED)));
+ computeRequirementList.add(localStorageRequirement);
+ return computeRequirementList;
+ }
+
+ private static List<Map<String, RequirementDefinition>> createToscaNodesPortRequirements() {
+ List<Map<String, RequirementDefinition>> requirements = new ArrayList<>();
+
+ Map<String, RequirementDefinition> linkRequirement = new HashMap<>();
+ linkRequirement.put(ToscaConstants.LINK_REQUIREMENT_ID, DataModelUtil
+ .createRequirement(ToscaCapabilityType.NETWORK_LINKABLE.getDisplayName(),
+ ToscaNodeType.ROOT.getDisplayName(),
+ ToscaRelationshipType.NETWORK_LINK_TO.getDisplayName(), null));
+ requirements.add(linkRequirement);
+
+ Map<String, RequirementDefinition> bindingRequirement = new HashMap<>();
+ bindingRequirement.put(ToscaConstants.BINDING_REQUIREMENT_ID, DataModelUtil
+ .createRequirement(ToscaCapabilityType.NETWORK_BINDABLE.getDisplayName(),
+ ToscaNodeType.ROOT.getDisplayName(),
+ ToscaRelationshipType.NETWORK_BINDS_TO.getDisplayName(), null));
+ requirements.add(bindingRequirement);
+
+ return requirements;
+ }
+
+
+ private static Object[] createOccurrences(Object min, Object max) {
+ return new Object[]{min, max};
+
+ }
+
+ private static Map<String, AttributeDefinition> createComputeAttributes() {
+ Map<String, AttributeDefinition> computeAttributesDefMap = new HashMap<>();
+ computeAttributesDefMap.put("private_address", DataModelUtil
+ .createAttributeDefinition(PropertyType.STRING.getDisplayName(), "private address", null,
+ null, null));
+ computeAttributesDefMap.put("public_address", DataModelUtil
+ .createAttributeDefinition(PropertyType.STRING.getDisplayName(), "public_address", null,
+ null, null));
+ computeAttributesDefMap.put("networks", DataModelUtil
+ .createAttributeDefinition(PropertyType.MAP.getDisplayName(), "networks", null,
+ DataModelUtil
+ .createEntrySchema(ToscaDataType.NETWORK_NETWORK_INFO.getDisplayName(), null, null),
+ null));
+ computeAttributesDefMap.put("ports", DataModelUtil
+ .createAttributeDefinition(PropertyType.MAP.getDisplayName(), "ports", null, DataModelUtil
+ .createEntrySchema(ToscaDataType.NETWORK_PORT_INFO.getDisplayName(), null, null),
+ null));
+ return computeAttributesDefMap;
+ }
+
+ private static Map<String, AttributeDefinition> createRootAttributes() {
+ Map<String, AttributeDefinition> attributesDefMap = new HashMap<>();
+ attributesDefMap.put("tosca_id", DataModelUtil
+ .createAttributeDefinition(PropertyType.STRING.getDisplayName(), "tosca id", null, null,
+ null));
+ attributesDefMap.put("tosca_name", DataModelUtil
+ .createAttributeDefinition(PropertyType.STRING.getDisplayName(), "tosca name", null, null,
+ null));
+ attributesDefMap.put("state", DataModelUtil
+ .createAttributeDefinition(PropertyType.STRING.getDisplayName(), "state", null, null,
+ null));
+ return attributesDefMap;
+ }
+
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/ToscaUtil.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/ToscaUtil.java
new file mode 100644
index 0000000000..4f9c70267d
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/ToscaUtil.java
@@ -0,0 +1,151 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.services;
+
+import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
+import org.openecomp.sdc.tosca.datatypes.model.CapabilityDefinition;
+import org.openecomp.sdc.tosca.datatypes.model.CapabilityType;
+import org.openecomp.sdc.tosca.datatypes.model.NodeType;
+import org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+import java.util.UUID;
+
+/**
+ * The type Tosca util.
+ */
+public class ToscaUtil {
+
+ /**
+ * Gets service template file name.
+ *
+ * @param serviceTemplate the service template
+ * @return the service template file name
+ */
+ public static String getServiceTemplateFileName(ServiceTemplate serviceTemplate) {
+ if (serviceTemplate == null) {
+ return null;
+ }
+ if (serviceTemplate.getMetadata() == null) {
+ return UUID.randomUUID().toString() + "ServiceTemplate.yaml";
+ }
+ return getServiceTemplateFileName(serviceTemplate.getMetadata().getTemplate_name());
+ }
+
+ /**
+ * Gets service template file name.
+ *
+ * @param templateName the template name
+ * @return the service template file name
+ */
+ public static String getServiceTemplateFileName(String templateName) {
+ return (Objects.isNull(templateName) ? UUID.randomUUID().toString() : templateName)
+ + "ServiceTemplate.yaml";
+ }
+
+ /**
+ * Add service template to map with key file name.
+ *
+ * @param serviceTemplates the service templates
+ * @param commonServiceTemplate the common service template
+ */
+ public static void addServiceTemplateToMapWithKeyFileName(
+ Map<String, ServiceTemplate> serviceTemplates, ServiceTemplate commonServiceTemplate) {
+ serviceTemplates
+ .put(ToscaUtil.getServiceTemplateFileName(commonServiceTemplate), commonServiceTemplate);
+ }
+
+ /**
+ * Convert type to definition capability definition.
+ *
+ * @param type the type
+ * @param capabilityType the capability type
+ * @param properties the properties
+ * @param description the description
+ * @return the capability definition
+ */
+ public static CapabilityDefinition convertTypeToDefinition(String type,
+ CapabilityType capabilityType,
+ Map<String, Object> properties,
+ String description) {
+ CapabilityDefinition capabilityDefinition = new CapabilityDefinition();
+ capabilityDefinition.setAttributes(capabilityType.getAttributes());
+ capabilityDefinition.setProperties(capabilityType.getProperties());
+ if (description == null) {
+ capabilityDefinition.setDescription(capabilityType.getDescription());
+ } else {
+ capabilityDefinition.setDescription(description);
+ }
+ capabilityDefinition.setType(type);
+
+ capabilityDefinition.getProperties()
+ .entrySet()
+ .stream()
+ .filter(entry -> properties.containsKey(entry.getKey()))
+ .forEach(entry -> entry.getValue()
+ .set_default(properties.get(entry.getKey())));
+
+
+ return capabilityDefinition;
+
+ }
+
+ /**
+ * Normalize component name node type map.
+ *
+ * @param toscaModel the tosca model
+ * @param components the components
+ * @return the map
+ */
+ public static Map<String, List<NodeType>> normalizeComponentNameNodeType(
+ ToscaServiceModel toscaModel, Set<String> components) {
+
+ Map<String, List<NodeType>> normalizedData = new HashMap<>();
+ toscaModel
+ .getServiceTemplates()
+ .entrySet().stream().filter(entry -> entry
+ .getValue()
+ .getNode_types() != null)
+ .forEach(entry -> entry
+ .getValue()
+ .getNode_types()
+ .entrySet().stream()
+ .filter(nodeTypeEntry -> components
+ .contains(nodeTypeEntry
+ .getKey()))
+ .forEach(nodeTypeEntry -> addNodeType(nodeTypeEntry.getKey(), nodeTypeEntry.getValue(),
+ normalizedData)));
+ return normalizedData;
+ }
+
+ private static void addNodeType(String key, NodeType value,
+ Map<String, List<NodeType>> normalizedData) {
+ if (!normalizedData.containsKey(key)) {
+ normalizedData.put(key, new ArrayList<>());
+ }
+ normalizedData.get(key).add(value);
+ }
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/impl/ToscaAnalyzerServiceImpl.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/impl/ToscaAnalyzerServiceImpl.java
new file mode 100644
index 0000000000..a11bff4b6a
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/impl/ToscaAnalyzerServiceImpl.java
@@ -0,0 +1,467 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.services.impl;
+
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.MapUtils;
+import org.openecomp.core.utilities.CommonMethods;
+import org.openecomp.sdc.common.errors.CoreException;
+import org.openecomp.sdc.tosca.datatypes.ToscaCapabilityType;
+import org.openecomp.sdc.tosca.datatypes.ToscaElementTypes;
+import org.openecomp.sdc.tosca.datatypes.ToscaNodeType;
+import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
+import org.openecomp.sdc.tosca.datatypes.model.CapabilityType;
+import org.openecomp.sdc.tosca.datatypes.model.Import;
+import org.openecomp.sdc.tosca.datatypes.model.NodeTemplate;
+import org.openecomp.sdc.tosca.datatypes.model.NodeType;
+import org.openecomp.sdc.tosca.datatypes.model.RequirementAssignment;
+import org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate;
+import org.openecomp.sdc.tosca.errors.ToscaInvalidEntryNotFoundErrorBuilder;
+import org.openecomp.sdc.tosca.errors.ToscaInvalidSubstituteNodeTemplatePropertiesErrorBuilder;
+import org.openecomp.sdc.tosca.errors.ToscaInvalidSubstitutionServiceTemplateErrorBuilder;
+import org.openecomp.sdc.tosca.errors.ToscaNodeTypeNotFoundErrorBuilder;
+import org.openecomp.sdc.tosca.services.ToscaAnalyzerService;
+import org.openecomp.sdc.tosca.services.ToscaConstants;
+import org.openecomp.sdc.tosca.services.yamlutil.ToscaExtensionYamlUtil;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.Set;
+
+public class ToscaAnalyzerServiceImpl implements ToscaAnalyzerService {
+ /*
+ node template with type equal to node type or derived from node type.
+ */
+ @Override
+ public Map<String, NodeTemplate> getNodeTemplatesByType(ServiceTemplate serviceTemplate,
+ String nodeType,
+ ToscaServiceModel toscaServiceModel) {
+ Map<String, NodeTemplate> nodeTemplates = new HashMap<>();
+
+ if (Objects.nonNull(serviceTemplate.getTopology_template())
+ && MapUtils.isNotEmpty(serviceTemplate.getTopology_template().getNode_templates())) {
+ for (Map.Entry<String, NodeTemplate> nodeTemplateEntry : serviceTemplate
+ .getTopology_template().getNode_templates().entrySet()) {
+ if (isTypeOf(nodeTemplateEntry.getValue(), nodeType, serviceTemplate, toscaServiceModel)) {
+ nodeTemplates.put(nodeTemplateEntry.getKey(), nodeTemplateEntry.getValue());
+ }
+
+ }
+ }
+ return nodeTemplates;
+ }
+
+ @Override
+ public boolean isTypeOf(NodeTemplate nodeTemplate, String nodeType,
+ ServiceTemplate serviceTemplate, ToscaServiceModel toscaServiceModel) {
+ if (nodeTemplate == null) {
+ return false;
+ }
+
+ if (isNodeTemplateOfTypeNodeType(nodeTemplate, nodeType)) {
+ return true;
+ }
+
+ Optional<Boolean> nodeTypeExistInServiceTemplateHierarchy =
+ isNodeTypeExistInServiceTemplateHierarchy(nodeType, nodeTemplate.getType(), serviceTemplate,
+ toscaServiceModel, null);
+ return nodeTypeExistInServiceTemplateHierarchy.orElseThrow(() -> new CoreException(
+ new ToscaNodeTypeNotFoundErrorBuilder(nodeTemplate.getType()).build()));
+ }
+
+
+ private Optional<Boolean> isNodeTypeExistInServiceTemplateHierarchy(String nodeTypeToMatch,
+ String nodeTypeToSearch,
+ ServiceTemplate serviceTemplate,
+ ToscaServiceModel toscaServiceModel,
+ Set<String> analyzedImportFiles) {
+ Map<String, NodeType> searchableNodeTypes = serviceTemplate.getNode_types();
+ if (!MapUtils.isEmpty(searchableNodeTypes)) {
+ NodeType nodeType = searchableNodeTypes.get(nodeTypeToSearch);
+ if (Objects.nonNull(nodeType)) {
+ if (Objects.equals(nodeType.getDerived_from(), nodeTypeToMatch)) {
+ return Optional.of(true);
+ } else if (isNodeTypeIsToscaRoot(nodeType)) {
+ return Optional.of(false);
+ } else {
+ return isNodeTypeExistInServiceTemplateHierarchy(nodeTypeToMatch,
+ nodeType.getDerived_from(), serviceTemplate, toscaServiceModel, null);
+ }
+ } else {
+ return isNodeTypeExistInImports(nodeTypeToMatch, nodeTypeToSearch, serviceTemplate,
+ toscaServiceModel, analyzedImportFiles);
+ }
+ }
+ return isNodeTypeExistInImports(nodeTypeToMatch, nodeTypeToSearch, serviceTemplate,
+ toscaServiceModel, analyzedImportFiles);
+
+ }
+
+ private Optional<Boolean> isNodeTypeExistInImports(String nodeTypeToMatch,
+ String nodeTypeToSearch,
+ ServiceTemplate serviceTemplate,
+ ToscaServiceModel toscaServiceModel,
+ Set<String> analyzedImportFiles) {
+ Map<String, Import> imports = serviceTemplate.getImports();
+ if (imports == null) {
+ return Optional.empty();
+ }
+
+ analyzedImportFiles = createAnalyzedImportFilesSet(analyzedImportFiles);
+ for (Import anImport : imports.values()) {
+ if (Objects.isNull(anImport) || Objects.isNull(anImport.getFile())) {
+ throw new RuntimeException("import without file entry");
+ }
+ String importFile = anImport.getFile();
+ if (analyzedImportFiles.contains(importFile)) {
+ continue;
+ }
+ addImportFileToAnalyzedImportFilesSet(analyzedImportFiles, importFile);
+ ServiceTemplate template = toscaServiceModel.getServiceTemplates().get(importFile);
+ Optional<Boolean> nodeTypeExistInServiceTemplateHierarchy =
+ isNodeTypeExistInServiceTemplateHierarchy(nodeTypeToMatch, nodeTypeToSearch, template,
+ toscaServiceModel, analyzedImportFiles);
+ if (nodeTypeExistInServiceTemplateHierarchy.isPresent()) {
+ if (nodeTypeExistInServiceTemplateHierarchy.get()) {
+ return Optional.of(true);
+ }
+ }
+ }
+ return Optional.of(false);
+ }
+
+ private Set<String> addImportFileToAnalyzedImportFilesSet(Set<String> analyzedImportFiles,
+ String importFile) {
+ analyzedImportFiles.add(importFile);
+ return analyzedImportFiles;
+ }
+
+ private Set<String> createAnalyzedImportFilesSet(Set<String> analyzedImportFiles) {
+ if (Objects.isNull(analyzedImportFiles)) {
+ analyzedImportFiles = new HashSet<>();
+ }
+ return analyzedImportFiles;
+ }
+
+ private boolean isNodeTypeIsToscaRoot(NodeType stNodeType) {
+ return Objects.equals(stNodeType.getDerived_from(), ToscaNodeType.ROOT.getDisplayName());
+ }
+
+ private boolean isNodeTemplateOfTypeNodeType(NodeTemplate nodeTemplate, String nodeType) {
+ return Objects.equals(nodeTemplate.getType(), nodeType);
+ }
+
+ @Override
+ public List<RequirementAssignment> getRequirements(NodeTemplate nodeTemplate,
+ String requirementId) {
+ List<RequirementAssignment> requirements = new ArrayList<>();
+ List<Map<String, RequirementAssignment>> requirementList = nodeTemplate.getRequirements();
+ if (requirementList != null) {
+ requirementList.stream().filter(reqMap -> reqMap.get(requirementId) != null)
+ .forEach(reqMap -> {
+ ToscaExtensionYamlUtil toscaExtensionYamlUtil = new ToscaExtensionYamlUtil();
+ RequirementAssignment reqAssignment = toscaExtensionYamlUtil
+ .yamlToObject(toscaExtensionYamlUtil.objectToYaml(reqMap.get(requirementId)),
+ RequirementAssignment.class);
+ requirements.add(reqAssignment);
+ });
+ }
+ return requirements;
+ }
+
+ @Override
+ public Optional<NodeTemplate> getNodeTemplateById(ServiceTemplate serviceTemplate,
+ String nodeTemplateId) {
+ if ((serviceTemplate.getTopology_template() != null)
+ && (serviceTemplate.getTopology_template().getNode_templates() != null)
+ && (serviceTemplate.getTopology_template().getNode_templates()
+ .get(nodeTemplateId) != null)) {
+ return Optional
+ .of(serviceTemplate.getTopology_template().getNode_templates().get(nodeTemplateId));
+ }
+ return Optional.empty();
+ }
+
+ @Override
+ public Optional<String> getSubstituteServiceTemplateName(String substituteNodeTemplateId,
+ NodeTemplate substitutableNodeTemplate) {
+ if (!isSubstitutableNodeTemplate(substitutableNodeTemplate)) {
+ return Optional.empty();
+ }
+
+ if (substitutableNodeTemplate.getProperties() != null
+ && substitutableNodeTemplate.getProperties()
+ .get(ToscaConstants.SERVICE_TEMPLATE_FILTER_PROPERTY_NAME) != null) {
+ Object serviceTemplateFilter = substitutableNodeTemplate.getProperties()
+ .get(ToscaConstants.SERVICE_TEMPLATE_FILTER_PROPERTY_NAME);
+ if (serviceTemplateFilter != null && serviceTemplateFilter instanceof Map) {
+ Object substituteServiceTemplate = ((Map) serviceTemplateFilter)
+ .get(ToscaConstants.SUBSTITUTE_SERVICE_TEMPLATE_PROPERTY_NAME);
+ if (substituteServiceTemplate == null) {
+ throw new CoreException(
+ new ToscaInvalidSubstituteNodeTemplatePropertiesErrorBuilder(substituteNodeTemplateId)
+ .build());
+ }
+ return Optional.of(substituteServiceTemplate.toString());
+ }
+ }
+ throw new CoreException(
+ new ToscaInvalidSubstituteNodeTemplatePropertiesErrorBuilder(substituteNodeTemplateId)
+ .build());
+ }
+
+ @Override
+ public Map<String, NodeTemplate> getSubstitutableNodeTemplates(ServiceTemplate serviceTemplate) {
+ Map<String, NodeTemplate> substitutableNodeTemplates = new HashMap<>();
+
+ if (serviceTemplate == null
+ || serviceTemplate.getTopology_template() == null
+ || serviceTemplate.getTopology_template().getNode_templates() == null) {
+ return substitutableNodeTemplates;
+ }
+
+ Map<String, NodeTemplate> nodeTemplates =
+ serviceTemplate.getTopology_template().getNode_templates();
+ for (String nodeTemplateId : nodeTemplates.keySet()) {
+ NodeTemplate nodeTemplate = nodeTemplates.get(nodeTemplateId);
+ if (isSubstitutableNodeTemplate(nodeTemplate)) {
+ substitutableNodeTemplates.put(nodeTemplateId, nodeTemplate);
+ }
+ }
+
+ return substitutableNodeTemplates;
+ }
+
+ private boolean isSubstitutableNodeTemplate(NodeTemplate nodeTemplate) {
+ return nodeTemplate.getDirectives() != null
+ && nodeTemplate.getDirectives().contains(ToscaConstants
+ .NODE_TEMPLATE_DIRECTIVE_SUBSTITUTABLE);
+ }
+
+ private boolean isSubstitutionServiceTemplate(String substituteServiceTemplateFileName,
+ ServiceTemplate substituteServiceTemplate) {
+ if (substituteServiceTemplate != null
+ && substituteServiceTemplate.getTopology_template() != null
+ && substituteServiceTemplate.getTopology_template().getSubstitution_mappings() != null) {
+ if (substituteServiceTemplate.getTopology_template().getSubstitution_mappings()
+ .getNode_type() == null) {
+ throw new CoreException(new ToscaInvalidSubstitutionServiceTemplateErrorBuilder(
+ substituteServiceTemplateFileName).build());
+ }
+ return true;
+ }
+ return false;
+
+ }
+
+ @Override
+ public Optional<Map.Entry<String, NodeTemplate>> getSubstitutionMappedNodeTemplateByExposedReq(
+ String substituteServiceTemplateFileName, ServiceTemplate substituteServiceTemplate,
+ String requirementId) {
+ if (isSubstitutionServiceTemplate(substituteServiceTemplateFileName,
+ substituteServiceTemplate)) {
+ Map<String, List<String>> substitutionMappingRequirements =
+ substituteServiceTemplate.getTopology_template().getSubstitution_mappings()
+ .getRequirements();
+ if (substitutionMappingRequirements != null) {
+ List<String> requirementMapping = substitutionMappingRequirements.get(requirementId);
+ if (requirementMapping != null && !requirementMapping.isEmpty()) {
+ String mappedNodeTemplateId = requirementMapping.get(0);
+ Optional<NodeTemplate> mappedNodeTemplate =
+ getNodeTemplateById(substituteServiceTemplate, mappedNodeTemplateId);
+ mappedNodeTemplate.orElseThrow(() -> new CoreException(
+ new ToscaInvalidEntryNotFoundErrorBuilder("Node Template", mappedNodeTemplateId)
+ .build()));
+ Map.Entry<String, NodeTemplate> mappedNodeTemplateEntry =
+ new Map.Entry<String, NodeTemplate>() {
+ @Override
+ public String getKey() {
+ return mappedNodeTemplateId;
+ }
+
+ @Override
+ public NodeTemplate getValue() {
+ return mappedNodeTemplate.get();
+ }
+
+ @Override
+ public NodeTemplate setValue(NodeTemplate value) {
+ return null;
+ }
+ };
+ return Optional.of(mappedNodeTemplateEntry);
+ }
+ }
+ }
+ return Optional.empty();
+ }
+
+
+ /*
+ match only for the input which is not null
+ */
+ @Override
+ public boolean isDesiredRequirementAssignment(RequirementAssignment requirementAssignment,
+ String capability, String node,
+ String relationship) {
+ if (capability != null) {
+ if (requirementAssignment.getCapability() == null
+ || !requirementAssignment.getCapability().equals(capability)) {
+ return false;
+ }
+ }
+
+ if (node != null) {
+ if (requirementAssignment.getNode() == null
+ || !requirementAssignment.getNode().equals(node)) {
+ return false;
+ }
+ }
+
+ if (relationship != null) {
+ if (requirementAssignment.getRelationship() == null
+ || !requirementAssignment.getRelationship().equals(relationship)) {
+ return false;
+ }
+ }
+
+ return !(capability == null && node == null && relationship == null);
+
+ }
+
+ @Override
+ public Object getFlatEntity(ToscaElementTypes elementType, String typeId,
+ ServiceTemplate serviceTemplate, ToscaServiceModel toscaModel) {
+ Object returnEntity;
+
+ switch (elementType) {
+ case CAPABILITY_TYPE:
+ returnEntity = new CapabilityType();
+ break;
+ default:
+ throw new RuntimeException(
+ "Entity[" + elementType + "] id[" + typeId + "] flat not supported");
+ }
+
+ scanAnFlatEntity(elementType, typeId, returnEntity, serviceTemplate, toscaModel);
+
+
+ return returnEntity;
+ }
+
+ private void scanAnFlatEntity(ToscaElementTypes elementType, String typeId, Object entity,
+ ServiceTemplate serviceTemplate, ToscaServiceModel toscaModel) {
+
+
+ boolean entityFound =
+ enrichEntityFromCurrentServiceTemplate(elementType, typeId, entity, serviceTemplate,
+ toscaModel);
+ if (!entityFound) {
+ Map<String, Import> imports = serviceTemplate.getImports();
+ if (MapUtils.isEmpty(imports)) {
+ return;
+ }
+ for (Import importServiceTemplate : imports.values()) {
+ ServiceTemplate template =
+ toscaModel.getServiceTemplates().get(importServiceTemplate.getFile());
+ scanAnFlatEntity(elementType, typeId, entity, template, toscaModel);
+ }
+ }
+
+
+ }
+
+ private boolean enrichEntityFromCurrentServiceTemplate(ToscaElementTypes elementType,
+ String typeId, Object entity,
+ ServiceTemplate serviceTemplate,
+ ToscaServiceModel toscaModel) {
+ String derivedFrom;
+ switch (elementType) {
+ case CAPABILITY_TYPE:
+ if (serviceTemplate.getCapability_types() != null
+ && serviceTemplate.getCapability_types().containsKey(typeId)) {
+
+ CapabilityType targetCapabilityType = ((CapabilityType) entity);
+ CapabilityType sourceCapabilityType = serviceTemplate.getCapability_types().get(typeId);
+ derivedFrom = sourceCapabilityType.getDerived_from();
+ if (derivedFrom != null
+ && !ToscaCapabilityType.NFV_METRIC.getDisplayName().equals(derivedFrom)) {
+ scanAnFlatEntity(elementType, derivedFrom, entity, serviceTemplate, toscaModel);
+ }
+ combineCapabilityTypeInfo(sourceCapabilityType, targetCapabilityType);
+ } else {
+ return false;
+ }
+ break;
+ default:
+ throw new RuntimeException(
+ "Entity[" + elementType + "] id[" + typeId + "] flat not supported");
+ }
+
+ return true;
+
+
+ }
+
+ private void combineCapabilityTypeInfo(CapabilityType sourceCapabilityType,
+ CapabilityType targetCapabilityType) {
+ if (MapUtils.isNotEmpty(sourceCapabilityType.getAttributes())) {
+ if (targetCapabilityType.getAttributes() == null) {
+ targetCapabilityType.setAttributes(new HashMap<>());
+ }
+ targetCapabilityType.getAttributes().putAll(sourceCapabilityType.getAttributes());
+ }
+
+ if (MapUtils.isNotEmpty(sourceCapabilityType.getProperties())) {
+ if (targetCapabilityType.getProperties() == null) {
+ targetCapabilityType.setProperties(new HashMap<>());
+ }
+ targetCapabilityType.getProperties().putAll(sourceCapabilityType.getProperties());
+ }
+
+ if (CollectionUtils.isNotEmpty(sourceCapabilityType.getValid_source_types())) {
+ if (targetCapabilityType.getValid_source_types() == null) {
+ targetCapabilityType.setValid_source_types(new ArrayList<>());
+ }
+ targetCapabilityType.getValid_source_types()
+ .addAll(sourceCapabilityType.getValid_source_types());
+ }
+
+ if (CommonMethods.isEmpty(sourceCapabilityType.getDerived_from())) {
+ targetCapabilityType.setDerived_from(sourceCapabilityType.getDerived_from());
+ }
+ if (CommonMethods.isEmpty(sourceCapabilityType.getDescription())) {
+ targetCapabilityType.setDescription(sourceCapabilityType.getDescription());
+ }
+ if (CommonMethods.isEmpty(sourceCapabilityType.getVersion())) {
+ targetCapabilityType.setVersion(sourceCapabilityType.getVersion());
+ }
+
+
+ }
+
+
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/impl/ToscaFileOutputServiceCsarImpl.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/impl/ToscaFileOutputServiceCsarImpl.java
new file mode 100644
index 0000000000..d4c22f105f
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/impl/ToscaFileOutputServiceCsarImpl.java
@@ -0,0 +1,158 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.services.impl;
+
+import org.openecomp.core.utilities.file.FileContentHandler;
+import org.openecomp.core.utilities.file.FileUtils;
+import org.openecomp.sdc.common.errors.CoreException;
+import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
+import org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate;
+import org.openecomp.sdc.tosca.exceptions.CsarCreationErrorBuilder;
+import org.openecomp.sdc.tosca.exceptions.CsarMissingEntryPointErrorBuilder;
+import org.openecomp.sdc.tosca.services.ToscaFileOutputService;
+
+import java.io.BufferedOutputStream;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Map;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+
+public class ToscaFileOutputServiceCsarImpl implements ToscaFileOutputService {
+ static final String EXTERNAL_ARTIFACTS_FOLDER_NAME = "Artifacts";
+ private static final String DEFINITIONS_FOLDER_NAME = "Definitions";
+ private static final String ARTIFACTS_FOLDER_NAME = "Artifacts";
+ //todo currently duplicated, to be changed when external artifacts are separated from internal
+ private static final String TOSCA_META_FOLDER_NAME = "TOSCA-Metadata";
+ private static final String TOSCA_META_FILE_VERSION = "TOSCA-Meta-File-Version";
+ private static final String TOSCA_META_FILE_VERSION_VALUE = "1.0";
+ private static final String TOSCA_META_FILE_NAME = "TOSCA.meta";
+ private static final String CSAR_VERSION = "CSAR-Version";
+ private static final String CSAR_VERSION_VALUE = "1.1";
+ private static final String CREATED_BY = "Created-By";
+ private static final String CREATED_BY_VALUE = "ASDC Onboarding portal";
+ private static final String ENTRY_DEFINITIONS = "Entry-Definitions";
+ private static final String META_FILE_DELIMITER = ":";
+ private static final String SPACE = " ";
+ private static final String FILE_SEPARATOR = File.separator;
+
+ @Override
+ public byte[] createOutputFile(ToscaServiceModel toscaServiceModel,
+ FileContentHandler externalArtifacts) {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ try (ZipOutputStream zos = new ZipOutputStream(new BufferedOutputStream(baos))) {
+ packDefinitions(zos, toscaServiceModel.getServiceTemplates());
+ FileContentHandler artifactFiles = toscaServiceModel.getArtifactFiles();
+ if (artifactFiles != null && !artifactFiles.isEmpty()) {
+ packArtifacts(zos, artifactFiles);
+ }
+ if (toscaServiceModel.getEntryDefinitionServiceTemplate() == null) {
+ throw new CoreException(new CsarMissingEntryPointErrorBuilder().build());
+ }
+ createAndPackToscaMetaFile(zos, toscaServiceModel.getEntryDefinitionServiceTemplate());
+ if (externalArtifacts != null) {
+ packExternalArtifacts(zos, externalArtifacts);
+ }
+ } catch (IOException exc) {
+ throw new CoreException(new CsarCreationErrorBuilder().build(), exc);
+ }
+ return baos.toByteArray();
+ }
+
+ @Override
+ public String createMetaFile(String entryDefinitionsFileName) {
+ return TOSCA_META_FILE_VERSION + META_FILE_DELIMITER + SPACE + TOSCA_META_FILE_VERSION_VALUE
+ + System.lineSeparator()
+ + CSAR_VERSION + META_FILE_DELIMITER + SPACE + CSAR_VERSION_VALUE + System.lineSeparator()
+ + CREATED_BY + META_FILE_DELIMITER + SPACE + CREATED_BY_VALUE + System.lineSeparator()
+ + ENTRY_DEFINITIONS + META_FILE_DELIMITER + SPACE + DEFINITIONS_FOLDER_NAME
+ + FILE_SEPARATOR + entryDefinitionsFileName;
+ }
+
+ @Override
+ public String getArtifactsFolderName() {
+ return ARTIFACTS_FOLDER_NAME;
+ }
+
+ private void createAndPackToscaMetaFile(ZipOutputStream zos, String entryDefinitionsFileName)
+ throws IOException {
+ String metaFile = createMetaFile(entryDefinitionsFileName);
+ zos.putNextEntry(
+ new ZipEntry((TOSCA_META_FOLDER_NAME + FILE_SEPARATOR + TOSCA_META_FILE_NAME)));
+ writeBytesToZip(zos, new ByteArrayInputStream(metaFile.getBytes()));
+ }
+
+ private void packDefinitions(ZipOutputStream zos, Map<String, ServiceTemplate> serviceTemplates)
+ throws IOException {
+ for (Map.Entry<String, ServiceTemplate> serviceTemplate : serviceTemplates.entrySet()) {
+ String fileName = serviceTemplate.getKey();
+ zos.putNextEntry(new ZipEntry(DEFINITIONS_FOLDER_NAME + FILE_SEPARATOR + fileName));
+ writeBytesToZip(zos,
+ FileUtils.convertToInputStream(serviceTemplate.getValue(), FileUtils.FileExtension.YAML));
+ }
+ }
+
+ private void packExternalArtifacts(ZipOutputStream zos, FileContentHandler externalArtifacts) {
+
+ for (String filenameIncludingPath : externalArtifacts.getFileList()) {
+ try {
+ zos.putNextEntry(new ZipEntry(filenameIncludingPath));
+ writeBytesToZip(zos, externalArtifacts.getFileContent(filenameIncludingPath));
+
+ } catch (IOException exc) {
+ throw new RuntimeException(exc);
+ } finally {
+ try {
+ zos.closeEntry();
+ } catch (IOException ignore) {
+ //do nothing
+ }
+ }
+ }
+
+ }
+
+ private void packArtifacts(ZipOutputStream zos, FileContentHandler artifacts) {
+
+ for (String fileName : artifacts.getFileList()) {
+ try {
+ zos.putNextEntry(new ZipEntry((ARTIFACTS_FOLDER_NAME + FILE_SEPARATOR + fileName)));
+ writeBytesToZip(zos, artifacts.getFileContent(fileName));
+
+ } catch (IOException exc) {
+ throw new RuntimeException(exc);
+ } finally {
+ try {
+ zos.closeEntry();
+ } catch (IOException ignore) {
+ //do nothing
+ }
+ }
+ }
+ }
+
+ private void writeBytesToZip(ZipOutputStream zos, InputStream is) throws IOException {
+ FileUtils.copy(is, zos);
+ }
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/yamlutil/ToscaExtensionYamlUtil.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/yamlutil/ToscaExtensionYamlUtil.java
new file mode 100644
index 0000000000..a1c11c2483
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/services/yamlutil/ToscaExtensionYamlUtil.java
@@ -0,0 +1,93 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.tosca.services.yamlutil;
+
+import org.openecomp.core.utilities.yaml.YamlUtil;
+import org.yaml.snakeyaml.constructor.Constructor;
+import org.yaml.snakeyaml.introspector.Property;
+import org.yaml.snakeyaml.introspector.PropertyUtils;
+import org.yaml.snakeyaml.nodes.MappingNode;
+import org.yaml.snakeyaml.nodes.NodeId;
+
+import java.beans.IntrospectionException;
+
+public class ToscaExtensionYamlUtil extends YamlUtil {
+
+ @Override
+ public <T> Constructor getConstructor(Class<T> typClass) {
+ return new ToscaWithHeatExtensionConstructor(typClass);
+ }
+
+ @Override
+ protected PropertyUtils getPropertyUtils() {
+ return new ToscaPropertyUtilsWithHeatExtension();
+ }
+
+ public class ToscaPropertyUtilsWithHeatExtension extends MyPropertyUtils {
+ @Override
+ public Property getProperty(Class<? extends Object> type, String name)
+ throws IntrospectionException {
+ try {
+ if (type.equals(
+ Class.forName("org.openecomp.sdc.tosca.datatypes.model.ParameterDefinition"))) {
+ type = Class.forName(
+ "org.openecomp.sdc.tosca.datatypes.model.heatextend.ParameterDefinitionExt");
+ }
+ } catch (ClassNotFoundException exception) {
+ throw new RuntimeException(exception);
+ }
+ return super.getProperty(type, name);
+ }
+ }
+
+ protected class ToscaWithHeatExtensionConstructor extends StrictMapAppenderConstructor {
+ public ToscaWithHeatExtensionConstructor(Class<?> theRoot) {
+ super(theRoot);
+ yamlClassConstructors.put(NodeId.mapping, new MyPersistentObjectConstruct());
+ }
+
+ class MyPersistentObjectConstruct extends ConstructMapping {
+ @Override
+ protected Object constructJavaBean2ndStep(MappingNode node, Object object) {
+ Class type = node.getType();
+ try {
+ if (type.equals(
+ Class.forName("org.openecomp.sdc.tosca.datatypes.model.ParameterDefinition"))) {
+ Class extendHeatClass = Class.forName(
+ "org.openecomp.sdc.tosca.datatypes.model.heatextend.ParameterDefinitionExt");
+ Object extendHeatObject = extendHeatClass.newInstance();
+ // create JavaBean
+ return super.constructJavaBean2ndStep(node, extendHeatObject);
+ } else {
+ // create JavaBean
+ return super.constructJavaBean2ndStep(node, object);
+ }
+ } catch (ClassNotFoundException | InstantiationException
+ | IllegalAccessException exception) {
+ throw new RuntimeException(exception);
+ }
+ }
+ }
+ }
+}
+
+
+
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/TestUtil.java b/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/TestUtil.java
new file mode 100644
index 0000000000..da3ae76f27
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/TestUtil.java
@@ -0,0 +1,71 @@
+package org.openecomp.sdc.tosca;
+
+import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
+import org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate;
+import org.openecomp.sdc.tosca.services.yamlutil.ToscaExtensionYamlUtil;
+
+import java.io.*;
+import java.net.URL;
+import java.nio.file.NotDirectoryException;
+import java.util.HashMap;
+import java.util.Map;
+
+public class TestUtil {
+
+ public static ToscaServiceModel loadToscaServiceModel(String serviceTemplatesPath,
+ String globalServiceTemplatesPath,
+ String entryDefinitionServiceTemplate)
+ throws IOException {
+ ToscaExtensionYamlUtil toscaExtensionYamlUtil = new ToscaExtensionYamlUtil();
+ Map<String, ServiceTemplate> serviceTemplates = new HashMap<>();
+ if (entryDefinitionServiceTemplate == null) {
+ entryDefinitionServiceTemplate = "MainServiceTemplate.yaml";
+ }
+
+ loadServiceTemplates(serviceTemplatesPath, toscaExtensionYamlUtil, serviceTemplates);
+ if (globalServiceTemplatesPath != null) {
+ loadServiceTemplates(globalServiceTemplatesPath, toscaExtensionYamlUtil, serviceTemplates);
+ }
+
+ return new ToscaServiceModel(null, serviceTemplates, entryDefinitionServiceTemplate);
+ }
+
+ private static void loadServiceTemplates(String serviceTemplatesPath,
+ ToscaExtensionYamlUtil toscaExtensionYamlUtil,
+ Map<String, ServiceTemplate> serviceTemplates)
+ throws IOException {
+ URL urlFile = TestUtil.class.getResource(serviceTemplatesPath);
+ if (urlFile != null) {
+ File pathFile = new File(urlFile.getFile());
+ File[] files = pathFile.listFiles();
+ if (files != null) {
+ addServiceTemplateFiles(serviceTemplates, files, toscaExtensionYamlUtil);
+ } else {
+ throw new NotDirectoryException(serviceTemplatesPath);
+ }
+ } else {
+ throw new NotDirectoryException(serviceTemplatesPath);
+ }
+ }
+
+ private static void addServiceTemplateFiles(Map<String, ServiceTemplate> serviceTemplates,
+ File[] files,
+ ToscaExtensionYamlUtil toscaExtensionYamlUtil)
+ throws IOException {
+ for (File file : files) {
+ try (InputStream yamlFile = new FileInputStream(file)) {
+ ServiceTemplate serviceTemplateFromYaml =
+ toscaExtensionYamlUtil.yamlToObject(yamlFile, ServiceTemplate.class);
+ serviceTemplates.put(file.getName(), serviceTemplateFromYaml);
+ try {
+ yamlFile.close();
+ } catch (IOException ignore) {
+ }
+ } catch (FileNotFoundException e) {
+ throw e;
+ } catch (IOException e) {
+ throw e;
+ }
+ }
+ }
+}
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/datatypes/PropertyTypeTest.java b/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/datatypes/PropertyTypeTest.java
new file mode 100644
index 0000000000..470dd9784a
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/datatypes/PropertyTypeTest.java
@@ -0,0 +1,20 @@
+package org.openecomp.sdc.tosca.datatypes;
+
+import org.openecomp.sdc.tosca.datatypes.model.PropertyType;
+import org.junit.Assert;
+import org.junit.Test;
+
+public class PropertyTypeTest {
+ @Test
+ public void shouldReturnNullWhenDisplayNameDoesNotExistForAnyProperty() {
+ String s = "blabla";
+ Assert.assertEquals(PropertyType.getPropertyTypeByDisplayName(s), null);
+ }
+
+ @Test
+ public void shouldReturnApproppriatePropertyTypeWhenDisplayNameExist() {
+ String s = "scalar-unit.size";
+ Assert
+ .assertEquals(PropertyType.getPropertyTypeByDisplayName(s), PropertyType.SCALAR_UNIT_SIZE);
+ }
+} \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/datatypes/ToscaModelTest.java b/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/datatypes/ToscaModelTest.java
new file mode 100644
index 0000000000..13b05543fb
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/datatypes/ToscaModelTest.java
@@ -0,0 +1,282 @@
+package org.openecomp.sdc.tosca.datatypes;
+
+import org.openecomp.sdc.tosca.datatypes.model.ArtifactType;
+import org.openecomp.sdc.tosca.datatypes.model.AttributeDefinition;
+import org.openecomp.sdc.tosca.datatypes.model.CapabilityAssignment;
+import org.openecomp.sdc.tosca.datatypes.model.CapabilityDefinition;
+import org.openecomp.sdc.tosca.datatypes.model.Constraint;
+import org.openecomp.sdc.tosca.datatypes.model.Directive;
+import org.openecomp.sdc.tosca.datatypes.model.Import;
+import org.openecomp.sdc.tosca.datatypes.model.Metadata;
+import org.openecomp.sdc.tosca.datatypes.model.NodeFilter;
+import org.openecomp.sdc.tosca.datatypes.model.NodeTemplate;
+import org.openecomp.sdc.tosca.datatypes.model.NodeType;
+import org.openecomp.sdc.tosca.datatypes.model.ParameterDefinition;
+import org.openecomp.sdc.tosca.datatypes.model.PropertyDefinition;
+import org.openecomp.sdc.tosca.datatypes.model.PropertyType;
+import org.openecomp.sdc.tosca.datatypes.model.RequirementAssignment;
+import org.openecomp.sdc.tosca.datatypes.model.RequirementDefinition;
+import org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate;
+import org.openecomp.sdc.tosca.datatypes.model.SubstitutionMapping;
+import org.openecomp.sdc.tosca.datatypes.model.TopologyTemplate;
+import org.openecomp.sdc.tosca.datatypes.model.heatextend.ParameterDefinitionExt;
+import org.openecomp.sdc.tosca.services.DataModelUtil;
+import org.openecomp.sdc.tosca.services.ToscaConstants;
+import org.openecomp.sdc.tosca.services.yamlutil.ToscaExtensionYamlUtil;
+import org.openecomp.core.utilities.yaml.YamlUtil;
+import org.junit.Assert;
+import org.junit.Test;
+
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+
+public class ToscaModelTest {
+
+ @Test
+ public void testServiceTemplateJavaToYaml() {
+
+ ServiceTemplate serviceTemplate = new ServiceTemplate();
+ Metadata metadata = new Metadata();
+ metadata.setTemplate_author("OPENECOMP");
+ metadata.setTemplate_name("Test");
+ metadata.setTemplate_version("1.0.0");
+ serviceTemplate.setTosca_definitions_version("tosca_simple_yaml_1_0_0");
+ serviceTemplate.setDescription("testing desc tosca service template");
+ serviceTemplate.setMetadata(metadata);
+
+ Import fileImport1 = new Import();
+ fileImport1.setFile("path1/path2/file1.yaml");
+ Import fileImport2 = new Import();
+ fileImport2.setFile("path1/path2/file2.yaml");
+ Map<String, Import> imports = new HashMap<>();
+ imports.put("myfile1", fileImport1);
+ imports.put("myfile2", fileImport2);
+ serviceTemplate.setImports(imports);
+
+ ArtifactType artifact = new ArtifactType();
+ artifact.setMime_type("application/java-archive");
+ ArrayList<String> ext = new ArrayList<>();
+ ext.add("yaml");
+ ext.add("xml");
+ artifact.setFile_ext(ext);
+ Map<String, ArtifactType> artifactTypes = new HashMap<>();
+ artifactTypes.put("one_artifact", artifact);
+ serviceTemplate.setArtifact_types(artifactTypes);
+
+ NodeType nodeType = new NodeType();
+ nodeType.setDerived_from("tosca.nodes.Root");
+ nodeType.setVersion("1.0.0");
+ nodeType.setDescription("tosca compute test");
+
+ PropertyDefinition propDef1 = new PropertyDefinition();
+ propDef1.setType("integer");
+ propDef1.setDescription("Number of CPUs requested for a software node instance");
+ propDef1.setRequired(true);
+ propDef1.set_default(1);
+
+ Constraint graterOrEqual = new Constraint();
+ graterOrEqual.setGreater_or_equal((float) 5.0);
+ Constraint constraintEqual = new Constraint();
+ constraintEqual.setEqual(5);
+ Constraint greater_than = new Constraint();
+ greater_than.setGreater_than(6.02);
+ Constraint inRange = new Constraint();
+ inRange.setIn_range(new Object[2]);
+ inRange.getIn_range()[0] = 0;
+ inRange.getIn_range()[1] = ToscaConstants.UNBOUNDED;
+
+ List<Constraint> constraints = new ArrayList<>();
+ constraints.add(graterOrEqual);
+ constraints.add(constraintEqual);
+ constraints.add(greater_than);
+ constraints.add(inRange);
+ propDef1.setConstraints(constraints);
+
+ Map<String, PropertyDefinition> properties = new HashMap<>();
+ properties.put("cpu_num", propDef1);
+ nodeType.setProperties(properties);
+
+ Map<String, AttributeDefinition> attributesDef = new HashMap<>();
+ AttributeDefinition attDef = new AttributeDefinition();
+ attDef.setType(PropertyType.STRING.getDisplayName());
+ attDef.set_default("hi");
+ attributesDef.put("attDef1", attDef);
+ nodeType.setAttributes(attributesDef);
+
+ Map<String, RequirementDefinition> reqsDef = new HashMap<>();
+ RequirementDefinition reqDef = new RequirementDefinition();
+ reqDef.setCapability("tosca.cap1");
+ reqDef.getOccurrences()[0] = 5;
+ reqsDef.put("re1", reqDef);
+ List<Map<String, RequirementDefinition>> reqList = new ArrayList<>();
+ reqList.add(reqsDef);
+ nodeType.setRequirements(reqList);
+
+
+ Map<String, CapabilityDefinition> capsDef = new HashMap<>();
+ CapabilityDefinition capdef = new CapabilityDefinition();
+ capdef.setType("tosca.cap");
+ List<String> vvSource = new ArrayList<>();
+ vvSource.add("node1");
+ vvSource.add("node2");
+ capdef.setValid_source_types(vvSource);
+ capsDef.put("cap1", capdef);
+ nodeType.setCapabilities(capsDef);
+
+ Map<String, NodeType> nodeTypes = new HashMap<>();
+ nodeTypes.put("compute_node_type", nodeType);
+ serviceTemplate.setNode_types(nodeTypes);
+
+ TopologyTemplate topologyTemplate = new TopologyTemplate();
+ topologyTemplate.setDescription("topologi template descroption");
+ Map<String, ParameterDefinition> inputs = new HashMap<>();
+ ParameterDefinition paramDef = new ParameterDefinition();
+ paramDef.setType(PropertyType.STRING.getDisplayName());
+ paramDef.setDescription("desc");
+ paramDef.set_default("my default val");
+ paramDef.setRequired(false);
+ paramDef.setEntry_schema(DataModelUtil.createEntrySchema("tosca.myType", null, null));
+ List<Constraint> paramConstraint = new ArrayList<>();
+ Constraint paramConst1 = new Constraint();
+ paramConst1.setGreater_than(6);
+ Constraint paramConst2 = new Constraint();
+ paramConst2.setGreater_or_equal(9);
+ paramConstraint.add(paramConst1);
+ paramConstraint.add(paramConst2);
+ paramDef.setConstraints(paramConstraint);
+ inputs.put("inParam1", paramDef);
+ topologyTemplate.setInputs(inputs);
+
+ Map<String, NodeTemplate> nodeTemplates = new HashMap<>();
+ NodeTemplate nodeTemplate = new NodeTemplate();
+ nodeTemplate.setType("nodeTypeRef");
+ List<String> directives = new ArrayList<>();
+ directives.add(Directive.SELECTABLE.getDisplayName());
+ directives.add(Directive.SUBSTITUTABLE.getDisplayName());
+ nodeTemplate.setDirectives(directives);
+ Map<String, Object> nodeTemplateProperties = new HashMap<>();
+ nodeTemplateProperties.put("prop1", "abcd");
+ nodeTemplateProperties.put("prop2", "{ get_input: my_mysql_rootpw }");
+ nodeTemplate.setProperties(nodeTemplateProperties);
+ Map<String, Object> nodeTemplateAtts = new HashMap<>();
+ nodeTemplateAtts.put("att1", "att1Val");
+ nodeTemplateAtts.put("att2", "{ get_input: my_mysql_rootpw }");
+ nodeTemplate.setAttributes(nodeTemplateAtts);
+
+
+ RequirementAssignment reqAssignment1 = new RequirementAssignment();
+ reqAssignment1.setNode("nodeA");
+ reqAssignment1.setCapability("capA");
+ reqAssignment1.setRelationship("relationB");
+ Object[] reqAssOccurrences = new Object[2];
+ reqAssOccurrences[0] = 1;
+ reqAssOccurrences[1] = 2;
+ reqAssignment1.setOccurrences(reqAssOccurrences);
+ NodeFilter reqNodeFilter = new NodeFilter();
+ List<Constraint> propConstrain1 = new ArrayList<>();
+ Constraint propConst1 = new Constraint();
+ propConst1.setGreater_or_equal(9);
+ propConstrain1.add(propConst1);
+ List<Constraint> propConstrain2 = new ArrayList<>();
+ Constraint propConst2 = new Constraint();
+ propConst2.setMin_length(1);
+ propConstrain2.add(propConst2);
+ Constraint propConst3 = new Constraint();
+ propConst3.setMax_length(2);
+ propConstrain2.add(propConst3);
+ Map<String, List<Constraint>> nodeFilterProp = new HashMap<>();
+ nodeFilterProp.put("propName1", propConstrain1);
+ nodeFilterProp.put("propName2", propConstrain2);
+ reqNodeFilter.setProperties(nodeFilterProp);
+ reqAssignment1.setNode_filter(reqNodeFilter);
+
+ RequirementAssignment reqAssignment2 = new RequirementAssignment();
+ reqAssignment2.setNode("nodeA");
+ reqAssignment2.setCapability("capA");
+ reqAssignment2.setRelationship("relationB");
+ Map<String, RequirementAssignment> nodeTemplateRequirement1 = new HashMap<>();
+ Map<String, RequirementAssignment> nodeTemplateRequirement2 = new HashMap<>();
+ nodeTemplateRequirement1.put("req1", reqAssignment1);
+ nodeTemplateRequirement2.put("req2", reqAssignment2);
+ nodeTemplate.setRequirements(new ArrayList<>());
+ nodeTemplate.getRequirements().add(nodeTemplateRequirement1);
+ nodeTemplate.getRequirements().add(nodeTemplateRequirement2);
+
+ Map<String, CapabilityAssignment> nodeTemplateCapability = new HashMap<>();
+ CapabilityAssignment capAss = new CapabilityAssignment();
+ Map<String, Object> capProps = new HashMap<>();
+ capProps.put("num_cpus", "{ get_input: cpus }");
+ capAss.setProperties(capProps);
+ Map<String, Object> capAtts = new HashMap<>();
+ capAtts.put("num_cpus", "66");
+ capAss.setAttributes(capAtts);
+ nodeTemplateCapability.put("cap1", capAss);
+ nodeTemplate.setCapabilities(new ArrayList<>());
+ nodeTemplate.getCapabilities().add(nodeTemplateCapability);
+
+ NodeFilter nodeTemplateNodeFilter = new NodeFilter();
+ Map<String, List<Constraint>> ntProp = new HashMap<>();
+ Constraint c1 = new Constraint();
+ c1.setEqual("1 MB");
+ List<Constraint> consList = new ArrayList<>();
+ consList.add(c1);
+ ntProp.put("test1", consList);
+ nodeTemplateNodeFilter.setProperties(ntProp);
+ nodeTemplate.setNode_filter(nodeTemplateNodeFilter);
+ nodeTemplates.put("firatNodeTemplate", nodeTemplate);
+ topologyTemplate.setNode_templates(nodeTemplates);
+
+ SubstitutionMapping subMap = new SubstitutionMapping();
+ subMap.setNode_type("myNodeType.node");
+ Map<String, List<String>> mapCapabilities = new HashMap<>();
+ List<String> NodeCap = new ArrayList<>();
+ NodeCap.add("database");
+ NodeCap.add("database_endpoint");
+ mapCapabilities.put("database_endpoint", NodeCap);
+ subMap.setCapabilities(mapCapabilities);
+ topologyTemplate.setSubstitution_mappings(subMap);
+ serviceTemplate.setTopology_template(topologyTemplate);
+
+ String yaml = new YamlUtil().objectToYaml(serviceTemplate);
+ ServiceTemplate serviceTemplateFromYaml =
+ new YamlUtil().yamlToObject(yaml, ServiceTemplate.class);
+ Assert.assertNotNull(serviceTemplateFromYaml);
+ }
+
+
+ @Test
+ public void testYamlToServiceTemplateObj() {
+ InputStream yamlFile = new YamlUtil().loadYamlFileIs("/mock/model/serviceTemplate.yaml");
+ ServiceTemplate serviceTemplateFromYaml =
+ new YamlUtil().yamlToObject(yamlFile, ServiceTemplate.class);
+ Assert.assertNotNull(serviceTemplateFromYaml);
+ }
+
+
+ @Test
+ public void testYamlToServiceTemplateIncludingHeatExtend() {
+ ToscaExtensionYamlUtil toscaExtensionYamlUtil = new ToscaExtensionYamlUtil();
+ InputStream yamlFile =
+ toscaExtensionYamlUtil.loadYamlFileIs("/mock/model/serviceTemplateHeatExtend.yaml");
+ ServiceTemplate serviceTemplateFromYaml =
+ toscaExtensionYamlUtil.yamlToObject(yamlFile, ServiceTemplate.class);
+ ParameterDefinitionExt parameterDefinitionExt =
+ (ParameterDefinitionExt) serviceTemplateFromYaml.getTopology_template().getInputs()
+ .get("inParam1");
+ Assert.assertNotNull(parameterDefinitionExt.getLabel());
+ String backToYamlString = toscaExtensionYamlUtil.objectToYaml(serviceTemplateFromYaml);
+ Assert.assertNotNull(backToYamlString);
+ }
+
+}
+
+
+
+
+
+
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/datatypes/model/CapabilityDefinitionTest.java b/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/datatypes/model/CapabilityDefinitionTest.java
new file mode 100644
index 0000000000..2b0f88fdea
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/datatypes/model/CapabilityDefinitionTest.java
@@ -0,0 +1,101 @@
+package org.openecomp.sdc.tosca.datatypes.model;
+
+import org.openecomp.sdc.tosca.services.ToscaConstants;
+import org.openecomp.core.utilities.yaml.YamlUtil;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class CapabilityDefinitionTest {
+
+ @Test
+ public void cloneTest() {
+ CapabilityDefinition capDef1 = new CapabilityDefinition();
+ Map<String, AttributeDefinition> attributes = new HashMap<>();
+ attributes.put("key1", getAttributeDefinition());
+ capDef1.setAttributes(attributes);
+
+ capDef1.setDescription("This is my desc");
+ capDef1.setOccurrences(getMockOccurrences());
+
+ Map<String, PropertyDefinition> properties = new HashMap<>();
+ PropertyDefinition propertyDefinition = getMockPropertyDefinition();
+ properties.put("key1", propertyDefinition);
+ capDef1.setProperties(properties);
+ capDef1.setType("My Type");
+ List<String> valid_source_types = new ArrayList<>();
+ valid_source_types.add("nonono");
+ capDef1.setValid_source_types(valid_source_types);
+
+ CapabilityDefinition capDef2 = capDef1.clone();
+ NodeType nodeType = new NodeType();
+ nodeType.setCapabilities(new HashMap<>());
+ nodeType.getCapabilities().put("cap1", capDef1);
+ nodeType.getCapabilities().put("cap2", capDef2);
+
+ String yamlString = new YamlUtil().objectToYaml(nodeType);
+ Boolean passResult = !yamlString.contains("&") && !yamlString.contains("*");
+ Assert.assertEquals(true, passResult);
+ }
+
+ private PropertyDefinition getMockPropertyDefinition() {
+ PropertyDefinition propertyDefinition = new PropertyDefinition();
+ propertyDefinition.setConstraints(getMockConstraints());
+ propertyDefinition.setDescription("desc");
+ propertyDefinition.setType("typeProp");
+ propertyDefinition.set_default(5);
+ propertyDefinition.setEntry_schema(getMockEntrySchema());
+ propertyDefinition.setRequired(false);
+ propertyDefinition.setStatus(Status.UNSUPPORTED);
+ return propertyDefinition;
+ }
+
+ private Object[] getMockOccurrences() {
+ Object[] occurrences = new Object[2];
+ occurrences[0] = 2;
+ occurrences[1] = ToscaConstants.UNBOUNDED;
+ return occurrences;
+ }
+
+ private ArtifactDefinition getMockArtifactDefinition() {
+ ArtifactDefinition artifactDefinition = new ArtifactDefinition();
+ artifactDefinition.setType("type1");
+ artifactDefinition.setDescription("description of OPENECOMP def");
+ artifactDefinition.setDeploy_path("my deployment path");
+ artifactDefinition.setFile("my file");
+ artifactDefinition.setRepository("my repository");
+ return artifactDefinition;
+ }
+
+ private AttributeDefinition getAttributeDefinition() {
+ AttributeDefinition attributeDefinition = new AttributeDefinition();
+ attributeDefinition.setDescription("desc1");
+ attributeDefinition.setType("type1");
+ attributeDefinition.set_default("none");
+ attributeDefinition.setEntry_schema(getMockEntrySchema());
+ attributeDefinition.setStatus(Status.UNSUPPORTED);
+ return attributeDefinition;
+ }
+
+ private EntrySchema getMockEntrySchema() {
+ EntrySchema entrySchema = new EntrySchema();
+ entrySchema.setType("string");
+ entrySchema.setDescription("string for string");
+ List<Constraint> constraints = getMockConstraints();
+ entrySchema.setConstraints(constraints);
+ return entrySchema;
+ }
+
+ private List<Constraint> getMockConstraints() {
+ List<Constraint> constraints = new ArrayList<>();
+ Constraint constraint = new Constraint();
+ constraint.setEqual("5");
+ constraints.add(constraint);
+ return constraints;
+ }
+
+} \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/datatypes/model/RequirementDefinitionTest.java b/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/datatypes/model/RequirementDefinitionTest.java
new file mode 100644
index 0000000000..3109a8abff
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/datatypes/model/RequirementDefinitionTest.java
@@ -0,0 +1,40 @@
+package org.openecomp.sdc.tosca.datatypes.model;
+
+import org.openecomp.core.utilities.yaml.YamlUtil;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public class RequirementDefinitionTest {
+
+ @Test
+ public void cloneTest() {
+ RequirementDefinition reqDef1 = new RequirementDefinition();
+ reqDef1.setNode("node1");
+ reqDef1.setRelationship("my Relationship");
+ reqDef1.setCapability("capabilities");
+ reqDef1.setOccurrences(new Object[]{1, 1});
+
+ RequirementDefinition reqDef2 = reqDef1.clone();
+ NodeType nodeType = new NodeType();
+
+ List<Map<String, RequirementDefinition>> requirements = new ArrayList<>();
+ Map<String, RequirementDefinition> reqMap1 = new HashMap<>();
+ reqMap1.put("req1", reqDef1);
+ requirements.add(reqMap1);
+ Map<String, RequirementDefinition> reqMap2 = new HashMap<>();
+ reqMap2.put("req2", reqDef2);
+ requirements.add(reqMap2);
+ nodeType.setRequirements(requirements);
+
+ String yamlString = new YamlUtil().objectToYaml(nodeType);
+ Boolean passResult = !yamlString.contains("&") && !yamlString.contains("*");
+ Assert.assertEquals(true, passResult);
+ }
+
+
+} \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/services/DataModelUtilTest.java b/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/services/DataModelUtilTest.java
new file mode 100644
index 0000000000..893f7a1a5e
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/services/DataModelUtilTest.java
@@ -0,0 +1,104 @@
+package org.openecomp.sdc.tosca.services;
+
+import org.openecomp.sdc.common.errors.CoreException;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.openecomp.sdc.tosca.datatypes.model.GroupDefinition;
+import org.openecomp.sdc.tosca.datatypes.model.NodeTemplate;
+import org.openecomp.sdc.tosca.datatypes.model.NodeType;
+import org.openecomp.sdc.tosca.datatypes.model.PolicyDefinition;
+import org.openecomp.sdc.tosca.datatypes.model.RelationshipTemplate;
+import org.openecomp.sdc.tosca.datatypes.model.RequirementAssignment;
+import org.openecomp.sdc.tosca.datatypes.model.SubstitutionMapping;
+
+import java.util.ArrayList;
+
+@RunWith(MockitoJUnitRunner.class)
+public class DataModelUtilTest {
+
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ @Test
+ public void testAddSubstitutionMapping() throws Exception {
+ thrown.expect(CoreException.class);
+ thrown.expectMessage(
+ "Invalid action, can't add 'Substitution Mapping' to 'Service Template', 'Service Template' entity is NULL.");
+ DataModelUtil.addSubstitutionMapping(null, new SubstitutionMapping());
+ }
+
+ @Test
+ public void testAddSubstitutionMappingReq() throws Exception {
+ thrown.expect(CoreException.class);
+ thrown.expectMessage(
+ "Invalid action, can't add 'Substitution Mapping Requirements' to 'Service Template', 'Service Template' entity is NULL.");
+ DataModelUtil.addSubstitutionMappingReq(null, "123", new ArrayList<>());
+ }
+
+ @Test
+ public void testAddNodeTemplate() throws Exception {
+ thrown.expect(CoreException.class);
+ thrown.expectMessage(
+ "Invalid action, can't add 'Node Template' to 'Service Template', 'Service Template' entity is NULL.");
+ DataModelUtil.addNodeTemplate(null, "123", new NodeTemplate());
+ }
+
+ @Test
+ public void testAddPolicyDefinition() throws Exception {
+ thrown.expect(CoreException.class);
+ thrown.expectMessage(
+ "Invalid action, can't add 'Policy Definition' to 'Service Template', 'Service Template' entity is NULL.");
+ DataModelUtil.addPolicyDefinition(null, "123", new PolicyDefinition());
+ }
+
+ @Test
+ public void testAddNodeType() throws Exception {
+ thrown.expect(CoreException.class);
+ thrown.expectMessage(
+ "Invalid action, can't add 'Node Type' to 'Service Template', 'Service Template' entity is NULL.");
+ DataModelUtil.addNodeType(null, "123", new NodeType());
+ }
+
+ @Test
+ public void testAddRelationshipTemplate() throws Exception {
+ thrown.expect(CoreException.class);
+ thrown.expectMessage(
+ "Invalid action, can't add 'Relationship Template' to 'Service Template', 'Service Template' entity is NULL.");
+ DataModelUtil.addRelationshipTemplate(null, "123", new RelationshipTemplate());
+ }
+
+ @Test
+ public void testAddRequirementAssignment() throws Exception {
+ thrown.expect(CoreException.class);
+ thrown.expectMessage(
+ "Invalid action, can't add 'Requirement Assignment' to 'Node Template', 'Node Template' entity is NULL.");
+ DataModelUtil.addRequirementAssignment(null, "123", new RequirementAssignment());
+ }
+
+ @Test
+ public void testGetNodeTemplate() throws Exception {
+ thrown.expect(CoreException.class);
+ thrown.expectMessage(
+ "Invalid action, can't add 'Node Template' to 'Service Template', 'Service Template' entity is NULL.");
+ DataModelUtil.addNodeTemplate(null, "123", new NodeTemplate());
+ }
+
+ @Test
+ public void testGetNodeType() throws Exception {
+ thrown.expect(CoreException.class);
+ thrown.expectMessage(
+ "Invalid action, can't add 'Node Type' to 'Service Template', 'Service Template' entity is NULL.");
+ DataModelUtil.addNodeType(null, "123", new NodeType());
+ }
+
+ @Test
+ public void testAddGroupToTopologyTemplate() throws Exception {
+ thrown.expect(CoreException.class);
+ thrown.expectMessage(
+ "Invalid action, can't add 'Group Definition' to 'Service Template', 'Service Template' entity is NULL.");
+ DataModelUtil.addGroupDefinitionToTopologyTemplate(null, "123", new GroupDefinition());
+ }
+} \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/services/impl/ToscaAnalyzerServiceImplTest.java b/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/services/impl/ToscaAnalyzerServiceImplTest.java
new file mode 100644
index 0000000000..47f0bd9aef
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/services/impl/ToscaAnalyzerServiceImplTest.java
@@ -0,0 +1,472 @@
+package org.openecomp.sdc.tosca.services.impl;
+
+import org.openecomp.sdc.common.errors.CoreException;
+import org.openecomp.sdc.tosca.TestUtil;
+import org.openecomp.sdc.tosca.datatypes.ToscaNodeType;
+import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
+import org.openecomp.sdc.tosca.services.ToscaAnalyzerService;
+import org.openecomp.sdc.tosca.services.ToscaConstants;
+import org.openecomp.sdc.tosca.services.yamlutil.ToscaExtensionYamlUtil;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.openecomp.sdc.tosca.datatypes.model.Import;
+import org.openecomp.sdc.tosca.datatypes.model.NodeTemplate;
+import org.openecomp.sdc.tosca.datatypes.model.NodeType;
+import org.openecomp.sdc.tosca.datatypes.model.RequirementAssignment;
+import org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate;
+import org.openecomp.sdc.tosca.datatypes.model.SubstitutionMapping;
+import org.openecomp.sdc.tosca.datatypes.model.TopologyTemplate;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+
+import static org.junit.Assert.*;
+import static org.mockito.Mockito.when;
+
+@RunWith(MockitoJUnitRunner.class)
+public class ToscaAnalyzerServiceImplTest {
+ /*
+ Dictionary:
+ SrvTmp: ServiceTemplate
+ NdTmp: NodeTemplate
+ NdTy: NodeType
+ */
+
+ private static ToscaAnalyzerService toscaAnalyzerService;
+ private static ToscaServiceModel toscaServiceModel;
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ @Mock
+ NodeTemplate nodeTemplateMock;
+ @Mock
+ ToscaServiceModel toscaServiceModelMock;
+
+ @BeforeClass
+ public static void onlyOnceSetUp() throws IOException {
+ toscaAnalyzerService = new ToscaAnalyzerServiceImpl();
+ toscaServiceModel = TestUtil.loadToscaServiceModel("/mock/analyzerService/toscasubstitution/",
+ "/mock/globalServiceTemplates/", null);
+ }
+
+ @Before
+ public void init() throws IOException {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ @Test
+ public void testGetRequirements() throws Exception {
+ ToscaExtensionYamlUtil toscaExtensionYamlUtil = new ToscaExtensionYamlUtil();
+ InputStream yamlFile = toscaExtensionYamlUtil
+ .loadYamlFileIs("/mock/analyzerService/NestedServiceTemplateReqTest.yaml");
+ ServiceTemplate serviceTemplateFromYaml =
+ toscaExtensionYamlUtil.yamlToObject(yamlFile, ServiceTemplate.class);
+
+ NodeTemplate port_0 =
+ serviceTemplateFromYaml.getTopology_template().getNode_templates().get("cmaui_port_0");
+ List<RequirementAssignment> reqList =
+ toscaAnalyzerService.getRequirements(port_0, ToscaConstants.BINDING_REQUIREMENT_ID);
+ assertEquals(1, reqList.size());
+
+ reqList.clear();
+ NodeTemplate port_1 =
+ serviceTemplateFromYaml.getTopology_template().getNode_templates().get("cmaui1_port_1");
+ reqList = toscaAnalyzerService.getRequirements(port_1, ToscaConstants.LINK_REQUIREMENT_ID);
+ assertEquals(2, reqList.size());
+
+ reqList.clear();
+ reqList = toscaAnalyzerService.getRequirements(port_0, ToscaConstants.LINK_REQUIREMENT_ID);
+ assertEquals(0, reqList.size());
+ }
+
+ @Test
+ public void testGetNodeTemplateById() throws Exception {
+ ServiceTemplate emptyServiceTemplate = new ServiceTemplate();
+ Optional<NodeTemplate> nodeTemplate =
+ toscaAnalyzerService.getNodeTemplateById(emptyServiceTemplate, "test_net222");
+ assertEquals(false, nodeTemplate.isPresent());
+
+ ServiceTemplate mainServiceTemplate = toscaServiceModel.getServiceTemplates()
+ .get(toscaServiceModel.getEntryDefinitionServiceTemplate());
+ nodeTemplate = toscaAnalyzerService.getNodeTemplateById(mainServiceTemplate, "test_net");
+ assertEquals(true, nodeTemplate.isPresent());
+
+ nodeTemplate = toscaAnalyzerService.getNodeTemplateById(mainServiceTemplate, "test_net222");
+ assertEquals(false, nodeTemplate.isPresent());
+ }
+
+ @Test
+ public void testGetSubstituteServiceTemplateName() throws Exception {
+ thrown.expect(CoreException.class);
+ thrown.expectMessage(
+ "Invalid Substitute Node Template invalid2, mandatory map property service_template_filter with mandatory key substitute_service_template must be defined.");
+
+ ServiceTemplate mainServiceTemplate = toscaServiceModel.getServiceTemplates()
+ .get(toscaServiceModel.getEntryDefinitionServiceTemplate());
+ Optional<NodeTemplate> notSubstitutableNodeTemplate =
+ toscaAnalyzerService.getNodeTemplateById(mainServiceTemplate, "test_net");
+ Optional<String> substituteServiceTemplateName = toscaAnalyzerService
+ .getSubstituteServiceTemplateName("test_net", notSubstitutableNodeTemplate.get());
+ assertEquals(false, substituteServiceTemplateName.isPresent());
+
+ Optional<NodeTemplate> substitutableNodeTemplate =
+ toscaAnalyzerService.getNodeTemplateById(mainServiceTemplate, "test_nested");
+ substituteServiceTemplateName = toscaAnalyzerService
+ .getSubstituteServiceTemplateName("test_nested", substitutableNodeTemplate.get());
+ assertEquals(true, substituteServiceTemplateName.isPresent());
+ assertEquals("nestedServiceTemplate.yaml", substituteServiceTemplateName.get());
+
+ NodeTemplate invalidSubstitutableNodeTemplate1 = new NodeTemplate();
+ substituteServiceTemplateName = toscaAnalyzerService
+ .getSubstituteServiceTemplateName("invalid1", invalidSubstitutableNodeTemplate1);
+ assertEquals(false, substituteServiceTemplateName.isPresent());
+
+
+ NodeTemplate invalidSubstitutableNodeTemplate2 = substitutableNodeTemplate.get();
+ Object serviceTemplateFilter = invalidSubstitutableNodeTemplate2.getProperties()
+ .get(ToscaConstants.SERVICE_TEMPLATE_FILTER_PROPERTY_NAME);
+ ((Map) serviceTemplateFilter).clear();
+ toscaAnalyzerService
+ .getSubstituteServiceTemplateName("invalid2", invalidSubstitutableNodeTemplate2);
+
+
+ }
+
+
+ @Test
+ public void testGetSubstitutableNodeTemplates() throws Exception {
+ ToscaExtensionYamlUtil toscaExtensionYamlUtil = new ToscaExtensionYamlUtil();
+ InputStream yamlFile = toscaExtensionYamlUtil
+ .loadYamlFileIs("/mock/analyzerService/ServiceTemplateSubstituteTest.yaml");
+ ServiceTemplate serviceTemplateFromYaml =
+ toscaExtensionYamlUtil.yamlToObject(yamlFile, ServiceTemplate.class);
+
+ Map<String, NodeTemplate> substitutableNodeTemplates =
+ toscaAnalyzerService.getSubstitutableNodeTemplates(serviceTemplateFromYaml);
+ assertEquals(2, substitutableNodeTemplates.size());
+ assertNotNull(substitutableNodeTemplates.get("test_nested1"));
+ assertNotNull(substitutableNodeTemplates.get("test_nested2"));
+
+ ServiceTemplate emptyServiceTemplate = new ServiceTemplate();
+ emptyServiceTemplate.setTopology_template(new TopologyTemplate());
+ substitutableNodeTemplates =
+ toscaAnalyzerService.getSubstitutableNodeTemplates(emptyServiceTemplate);
+ assertEquals(0, substitutableNodeTemplates.size());
+
+ yamlFile = toscaExtensionYamlUtil
+ .loadYamlFileIs("/mock/analyzerService/NestedServiceTemplateReqTest.yaml");
+ serviceTemplateFromYaml = toscaExtensionYamlUtil.yamlToObject(yamlFile, ServiceTemplate.class);
+ substitutableNodeTemplates =
+ toscaAnalyzerService.getSubstitutableNodeTemplates(serviceTemplateFromYaml);
+ assertEquals(0, substitutableNodeTemplates.size());
+ }
+
+ @Test
+ public void testGetSubstitutionMappedNodeTemplateByExposedReq() throws Exception {
+ thrown.expect(CoreException.class);
+ thrown.expectMessage(
+ "Invalid Tosca model data, missing 'Node Template' entry for 'Node Template' id cmaui_port_9");
+ ToscaExtensionYamlUtil toscaExtensionYamlUtil = new ToscaExtensionYamlUtil();
+ InputStream yamlFile = toscaExtensionYamlUtil
+ .loadYamlFileIs("/mock/analyzerService/NestedServiceTemplateReqTest.yaml");
+ ServiceTemplate nestedServiceTemplateFromYaml =
+ toscaExtensionYamlUtil.yamlToObject(yamlFile, ServiceTemplate.class);
+
+ Optional<Map.Entry<String, NodeTemplate>> mappedNodeTemplate = toscaAnalyzerService
+ .getSubstitutionMappedNodeTemplateByExposedReq("NestedServiceTemplateSubstituteTest.yaml",
+ nestedServiceTemplateFromYaml, "local_storage_server_cmaui");
+ assertEquals("server_cmaui", mappedNodeTemplate.get().getKey());
+ assertNotNull(mappedNodeTemplate.get().getValue());
+
+ mappedNodeTemplate = toscaAnalyzerService
+ .getSubstitutionMappedNodeTemplateByExposedReq("NestedServiceTemplateSubstituteTest.yaml",
+ nestedServiceTemplateFromYaml, "link_cmaui_port_invalid");
+ assertEquals("server_cmaui", mappedNodeTemplate.get().getKey());
+ assertNotNull(mappedNodeTemplate.get().getValue());
+
+ ServiceTemplate mainServiceTemplate = toscaServiceModel.getServiceTemplates()
+ .get(toscaServiceModel.getEntryDefinitionServiceTemplate());
+ mappedNodeTemplate = toscaAnalyzerService.getSubstitutionMappedNodeTemplateByExposedReq(
+ toscaServiceModel.getEntryDefinitionServiceTemplate(), mainServiceTemplate,
+ "local_storage_server_cmaui");
+ assertEquals(false, mappedNodeTemplate.isPresent());
+ }
+
+ @Test
+ public void invalidSubstitutableMapping() throws Exception {
+ thrown.expect(CoreException.class);
+ thrown.expectMessage(
+ "Invalid Substitution Service Template invalidMappingServiceTemplate.yaml, missing mandatory file 'Node type' in substitution mapping.");
+ ServiceTemplate invalidMappingServiceTemplate = new ServiceTemplate();
+ invalidMappingServiceTemplate.setTopology_template(new TopologyTemplate());
+ invalidMappingServiceTemplate.getTopology_template()
+ .setSubstitution_mappings(new SubstitutionMapping());
+ toscaAnalyzerService
+ .getSubstitutionMappedNodeTemplateByExposedReq("invalidMappingServiceTemplate.yaml",
+ invalidMappingServiceTemplate, "local_storage_server_cmaui");
+ }
+
+ @Test
+ public void substitutableMappingWithNoReqMap() throws Exception {
+ ServiceTemplate mainServiceTemplate = toscaServiceModel.getServiceTemplates()
+ .get(toscaServiceModel.getEntryDefinitionServiceTemplate());
+ ServiceTemplate emptyReqMapping = new ServiceTemplate();
+ emptyReqMapping.setTopology_template(new TopologyTemplate());
+ emptyReqMapping.getTopology_template().setSubstitution_mappings(new SubstitutionMapping());
+ emptyReqMapping.getTopology_template().getSubstitution_mappings().setNode_type("temp");
+ Optional<Map.Entry<String, NodeTemplate>> mappedNodeTemplate = toscaAnalyzerService
+ .getSubstitutionMappedNodeTemplateByExposedReq(
+ toscaServiceModel.getEntryDefinitionServiceTemplate(), mainServiceTemplate,
+ "local_storage_server_cmaui");
+ assertEquals(false, mappedNodeTemplate.isPresent());
+ }
+
+ @Test
+ public void testGetSubstitutionMappedNodeTemplateByExposedReqInvalid() throws Exception {
+ thrown.expect(CoreException.class);
+ thrown.expectMessage(
+ "Invalid Tosca model data, missing 'Node Template' entry for 'Node Template' id cmaui_port_9");
+ ToscaExtensionYamlUtil toscaExtensionYamlUtil = new ToscaExtensionYamlUtil();
+ InputStream yamlFile = toscaExtensionYamlUtil
+ .loadYamlFileIs("/mock/analyzerService/NestedServiceTemplateReqTest.yaml");
+ ServiceTemplate nestedServiceTemplateFromYaml =
+ toscaExtensionYamlUtil.yamlToObject(yamlFile, ServiceTemplate.class);
+
+ toscaAnalyzerService
+ .getSubstitutionMappedNodeTemplateByExposedReq("NestedServiceTemplateSubstituteTest.yaml",
+ nestedServiceTemplateFromYaml, "link_cmaui_port_invalid");
+ }
+
+ @Test
+ public void testIsDesiredRequirementAssignmentMatch() throws Exception {
+
+ RequirementAssignment requirementAssignment = new RequirementAssignment();
+ String capability = "Test.Capability";
+ String node = "Test.node";
+ String relationship = "Test.relationship";
+ requirementAssignment.setCapability(capability);
+ requirementAssignment.setNode(node);
+ requirementAssignment.setRelationship(relationship);
+
+ assertEquals(true, toscaAnalyzerService
+ .isDesiredRequirementAssignment(requirementAssignment, capability, node, relationship));
+ assertEquals(true, toscaAnalyzerService
+ .isDesiredRequirementAssignment(requirementAssignment, null, node, relationship));
+ assertEquals(true, toscaAnalyzerService
+ .isDesiredRequirementAssignment(requirementAssignment, capability, null, relationship));
+ assertEquals(true, toscaAnalyzerService
+ .isDesiredRequirementAssignment(requirementAssignment, capability, node, null));
+ assertEquals(true, toscaAnalyzerService
+ .isDesiredRequirementAssignment(requirementAssignment, null, null, relationship));
+ assertEquals(true, toscaAnalyzerService
+ .isDesiredRequirementAssignment(requirementAssignment, capability, null, null));
+ assertEquals(true, toscaAnalyzerService
+ .isDesiredRequirementAssignment(requirementAssignment, null, node, null));
+
+ }
+
+ @Test
+ public void testIsDesiredRequirementAssignmentNoMatch() throws Exception {
+
+ RequirementAssignment requirementAssignment = new RequirementAssignment();
+ String capability = "Test.Capability";
+ String node = "Test.node";
+ String relationship = "Test.relationship";
+ requirementAssignment.setCapability(capability);
+ requirementAssignment.setNode(node);
+ requirementAssignment.setRelationship(relationship);
+
+ assertEquals(false, toscaAnalyzerService
+ .isDesiredRequirementAssignment(requirementAssignment, "no", node, relationship));
+ assertEquals(false, toscaAnalyzerService
+ .isDesiredRequirementAssignment(requirementAssignment, "no", "no", relationship));
+ assertEquals(false, toscaAnalyzerService
+ .isDesiredRequirementAssignment(requirementAssignment, "no", "no", "no"));
+ assertEquals(false, toscaAnalyzerService
+ .isDesiredRequirementAssignment(requirementAssignment, capability, "no", relationship));
+ assertEquals(false, toscaAnalyzerService
+ .isDesiredRequirementAssignment(requirementAssignment, capability, node, "no"));
+ assertEquals(false, toscaAnalyzerService
+ .isDesiredRequirementAssignment(requirementAssignment, capability, "no", "no"));
+ assertEquals(false, toscaAnalyzerService
+ .isDesiredRequirementAssignment(requirementAssignment, "no", null, null));
+ assertEquals(false, toscaAnalyzerService
+ .isDesiredRequirementAssignment(requirementAssignment, null, null, null));
+
+
+ }
+
+ @Test
+ public void shouldReturnFalseIfNdTmpIsNull() {
+ assertFalse(toscaAnalyzerService
+ .isTypeOf(null, ToscaNodeType.NETWORK.getDisplayName(), new ServiceTemplate(),
+ toscaServiceModelMock));
+ }
+
+ @Test
+ public void shouldReturnTrueIfNdTmpTypeIsOfRequestedType() {
+ NodeTemplate nodeTemplate = new NodeTemplate();
+ ToscaNodeType nodeTypeToSearch = ToscaNodeType.BLOCK_STORAGE;
+ nodeTemplate.setType(nodeTypeToSearch.getDisplayName());
+ assertTrue(toscaAnalyzerService
+ .isTypeOf(nodeTemplate, nodeTypeToSearch.getDisplayName(), new ServiceTemplate(),
+ toscaServiceModelMock));
+ }
+
+ @Test
+ public void shouldReturnTrueIfNdTmpTypeIsFoundInSrvTmpNdTyAndNdTyDerivedFromRequestedType() {
+ String typeToMatch = ToscaNodeType.CINDER_VOLUME.getDisplayName();
+ when(nodeTemplateMock.getType()).thenReturn(typeToMatch);
+ Map<String, NodeType> stNodeTypes = new HashMap<>();
+ addNodeType(stNodeTypes, ToscaNodeType.COMPUTE.getDisplayName(), new NodeType());
+ NodeType nodeType = createNodeType(ToscaNodeType.BLOCK_STORAGE.getDisplayName());
+ addNodeType(stNodeTypes, typeToMatch, nodeType);
+ ServiceTemplate serviceTemplate = new ServiceTemplate();
+ serviceTemplate.setNode_types(stNodeTypes);
+ assertTrue(toscaAnalyzerService
+ .isTypeOf(nodeTemplateMock, ToscaNodeType.BLOCK_STORAGE.getDisplayName(), serviceTemplate,
+ toscaServiceModelMock));
+
+ }
+
+ @Test
+ public void shouldThrowCoreExceptionForInvalidNodeType() {
+ thrown.expect(CoreException.class);
+ thrown.expectMessage(
+ "NodeType 'AAA' or one of its derivedFrom node type hierarchy, is not defined in tosca service model");
+ when(nodeTemplateMock.getType()).thenReturn("AAA");
+ Map<String, NodeType> stNodeTypes = new HashMap<>();
+ addNodeType(stNodeTypes, "notImportant", new NodeType());
+ ServiceTemplate serviceTemplate = new ServiceTemplate();
+ serviceTemplate.setNode_types(stNodeTypes);
+ toscaAnalyzerService
+ .isTypeOf(nodeTemplateMock, ToscaNodeType.COMPUTE.getDisplayName(), serviceTemplate,
+ toscaServiceModelMock);
+ }
+
+ @Test
+ public void shouldThrowCoreExceptionForInvalidNodeType2Level() {
+ thrown.expect(CoreException.class);
+ thrown.expectMessage(
+ "NodeType 'A' or one of its derivedFrom node type hierarchy, is not defined in tosca service model");
+ String typeToMatch = "A";
+ when(nodeTemplateMock.getType()).thenReturn(typeToMatch);
+ Map<String, NodeType> stNodeTypes = new HashMap<>();
+ addNodeType(stNodeTypes, "notImportant", new NodeType());
+ addNodeType(stNodeTypes, "A", createNodeType("ADerivedFromB"));
+ addNodeType(stNodeTypes, "ADerivedFromB'", createNodeType("BDerivedFromC"));
+ ServiceTemplate serviceTemplate = new ServiceTemplate();
+ serviceTemplate.setNode_types(stNodeTypes);
+ assertTrue(toscaAnalyzerService
+ .isTypeOf(nodeTemplateMock, "BDerivedFromC", serviceTemplate, toscaServiceModelMock));
+ }
+
+ @Test
+ public void shouldReturnTrueIfNdTmpTypeIsFoundInSrvTmpNdTyAndNotDerivedFromRequestedTypeBut2ndLevelDerivedFromMatch() {
+ String typeToMatch = "A";
+ when(nodeTemplateMock.getType()).thenReturn(typeToMatch);
+ Map<String, NodeType> stNodeTypes = new HashMap<>();
+ addNodeType(stNodeTypes, "notImportant", new NodeType());
+ addNodeType(stNodeTypes, "A", createNodeType("ADerivedFromB"));
+ addNodeType(stNodeTypes, "ADerivedFromB", createNodeType("BDerivedFromC"));
+ ServiceTemplate serviceTemplate = new ServiceTemplate();
+ serviceTemplate.setNode_types(stNodeTypes);
+ assertTrue(toscaAnalyzerService
+ .isTypeOf(nodeTemplateMock, "BDerivedFromC", serviceTemplate, toscaServiceModelMock));
+ }
+
+ private NodeType createNodeType(String derivedFrom) {
+ NodeType nodeType = new NodeType();
+ nodeType.setDerived_from(derivedFrom);
+ return nodeType;
+ }
+
+ private void addNodeType(Map<String, NodeType> stNodeTypes, String key, NodeType nodeType) {
+ stNodeTypes.put(key, nodeType);
+ }
+
+ @Test
+ public void shouldReturnTrueIfNdTmpTypeIsFoundInSrvTmpNdTyButRequestedTypeNotMatchButFoundIn1stLevelImports() {
+ String typeToMatch = ToscaNodeType.CINDER_VOLUME.getDisplayName();
+ when(nodeTemplateMock.getType()).thenReturn(typeToMatch);
+ ServiceTemplate mainST = new ServiceTemplate();
+ Map<String, Import> imports = new HashMap<>();
+ Import anImport = new Import();
+ anImport.setFile("mainImport");
+ imports.put("bla bla", anImport);
+ mainST.setImports(imports);
+
+ //create searchable service template
+ Map<String, NodeType> stNodeTypes = new HashMap<>();
+ addNodeType(stNodeTypes, ToscaNodeType.COMPUTE.getDisplayName(), new NodeType());
+ NodeType nodeType = createNodeType(ToscaNodeType.BLOCK_STORAGE.getDisplayName());
+ addNodeType(stNodeTypes, typeToMatch, nodeType);
+ ServiceTemplate serviceTemplate = new ServiceTemplate();
+ serviceTemplate.setNode_types(stNodeTypes);
+
+ // add service templates to tosca service model
+ Map<String, ServiceTemplate> serviceTemplates = toscaServiceModelMock.getServiceTemplates();
+ serviceTemplates.put("testMainServiceTemplate", mainST);
+ serviceTemplates.put("mainImport", serviceTemplate);
+ when(toscaServiceModelMock.getServiceTemplates()).thenReturn(serviceTemplates);
+
+ assertTrue(toscaAnalyzerService
+ .isTypeOf(nodeTemplateMock, ToscaNodeType.BLOCK_STORAGE.getDisplayName(), mainST,
+ toscaServiceModelMock));
+ }
+
+ @Test
+ public void shouldReturnTrueIfNdTmpTypeIsFoundInSrvTmpNdTyButRequestedTypeNotMatchButFoundIn2ndLevelImports() {
+ String typeToMatch = ToscaNodeType.CINDER_VOLUME.getDisplayName();
+ when(nodeTemplateMock.getType()).thenReturn(typeToMatch);
+ ServiceTemplate mainST = new ServiceTemplate();
+ Map<String, Import> imports = new HashMap<>();
+ Import anImport = new Import();
+ anImport.setFile("refToMainImport");
+ imports.put("bla bla", anImport);
+ mainST.setImports(imports);
+
+ //create searchable service template
+ Map<String, NodeType> stNodeTypes = new HashMap<>();
+ addNodeType(stNodeTypes, ToscaNodeType.COMPUTE.getDisplayName(), new NodeType());
+ NodeType nodeType = createNodeType(ToscaNodeType.BLOCK_STORAGE.getDisplayName());
+ addNodeType(stNodeTypes, typeToMatch, nodeType);
+ ServiceTemplate serviceTemplate = new ServiceTemplate();
+ serviceTemplate.setNode_types(stNodeTypes);
+
+ // create 1st level service template with import only
+ ServiceTemplate firstLevelST = new ServiceTemplate();
+ Map<String, Import> firstLevelImports = new HashMap<>();
+ Import firstLevelImport = new Import();
+ firstLevelImport.setFile("mainImport");
+ firstLevelImports.put("bla bla 2", firstLevelImport);
+
+ firstLevelST.setImports(firstLevelImports);
+
+ // add service templates to tosca service model
+ Map<String, ServiceTemplate> serviceTemplates = toscaServiceModelMock.getServiceTemplates();
+ serviceTemplates.put("testMainServiceTemplate", mainST);
+ serviceTemplates.put("refToMainImport", firstLevelST);
+ serviceTemplates.put("mainImport", serviceTemplate);
+ when(toscaServiceModelMock.getServiceTemplates()).thenReturn(serviceTemplates);
+
+ assertTrue(toscaAnalyzerService
+ .isTypeOf(nodeTemplateMock, ToscaNodeType.BLOCK_STORAGE.getDisplayName(), mainST,
+ toscaServiceModelMock));
+ }
+
+ // not found at all should throw core exception
+
+
+} \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/services/impl/ToscaFileOutputServiceCsarImplTest.java b/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/services/impl/ToscaFileOutputServiceCsarImplTest.java
new file mode 100644
index 0000000000..963b8a6f57
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/java/org/openecomp/sdc/tosca/services/impl/ToscaFileOutputServiceCsarImplTest.java
@@ -0,0 +1,150 @@
+package org.openecomp.sdc.tosca.services.impl;
+
+import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
+import org.openecomp.sdc.tosca.datatypes.model.Metadata;
+import org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate;
+import org.openecomp.sdc.tosca.services.ToscaUtil;
+import org.openecomp.core.utilities.file.FileContentHandler;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
+public class ToscaFileOutputServiceCsarImplTest {
+
+ private ToscaFileOutputServiceCsarImpl toscaFileOutputServiceCsarImpl =
+ new ToscaFileOutputServiceCsarImpl();
+
+ @Test
+ public void testCreationMetaFile() {
+ String createdMeta = toscaFileOutputServiceCsarImpl.createMetaFile("entryFile.yaml");
+ String expectedMeta =
+ "TOSCA-Meta-File-Version: 1.0\n" +
+ "CSAR-Version: 1.1\n" +
+ "Created-By: ASDC Onboarding portal\n" +
+ "Entry-Definitions: Definitions" + File.separator + "entryFile.yaml";
+ Assert.assertEquals(createdMeta.replaceAll("\\s+", ""), expectedMeta.replaceAll("\\s+", ""));
+ }
+
+ @Test
+ public void testCSARFileCreationWithExternalArtifacts() throws IOException {
+ ServiceTemplate mainServiceTemplate = new ServiceTemplate();
+ Metadata metadata1 = new Metadata();
+ metadata1.setTemplate_author("OPENECOMP");
+ metadata1.setTemplate_name("ST1");
+ metadata1.setTemplate_version("1.0.0");
+ mainServiceTemplate.setTosca_definitions_version("tosca_simple_yaml_1_0_0");
+ mainServiceTemplate.setDescription("testing desc tosca service template");
+ mainServiceTemplate.setMetadata(metadata1);
+
+ ServiceTemplate additionalServiceTemplate = new ServiceTemplate();
+ Metadata metadata2 = new Metadata();
+ metadata2.setTemplate_author("OPENECOMP");
+ metadata2.setTemplate_name("ST2");
+ metadata2.setTemplate_version("1.0.0");
+ additionalServiceTemplate.setTosca_definitions_version("tosca_simple_yaml_1_0_0");
+ additionalServiceTemplate.setDescription("testing desc tosca service template");
+ additionalServiceTemplate.setMetadata(metadata2);
+
+ Map<String, ServiceTemplate> definitionsInput = new HashMap<>();
+ definitionsInput
+ .put(ToscaUtil.getServiceTemplateFileName(mainServiceTemplate), mainServiceTemplate);
+ definitionsInput.put(ToscaUtil.getServiceTemplateFileName(additionalServiceTemplate),
+ additionalServiceTemplate);
+
+
+ Map<String, byte[]> dummyHeatArtifacts = new HashMap<>();
+ String file1Content = "this is file number 1";
+ String file2Content = "this is file number 2";
+ String file1 = "file1.xml";
+ dummyHeatArtifacts.put(file1, file1Content.getBytes());
+ String file2 = "file2.yml";
+ dummyHeatArtifacts.put(file2, file2Content.getBytes());
+
+
+ FileContentHandler heatFiles = new FileContentHandler();
+ heatFiles.putAll(dummyHeatArtifacts);
+ Map<String, byte[]> licenseArtifacts = new HashMap<>();
+
+ FileContentHandler licenseArtifactsFiles = new FileContentHandler();
+
+ licenseArtifacts.put(
+ ToscaFileOutputServiceCsarImpl.EXTERNAL_ARTIFACTS_FOLDER_NAME + File.separator +
+ "license-file-1.xml", file1Content.getBytes());
+ licenseArtifacts.put(
+ ToscaFileOutputServiceCsarImpl.EXTERNAL_ARTIFACTS_FOLDER_NAME + File.separator +
+ "license-file-2.xml", file1Content.getBytes());
+
+ licenseArtifactsFiles.putAll(licenseArtifacts);
+
+ byte[] csarFile = toscaFileOutputServiceCsarImpl.createOutputFile(
+ new ToscaServiceModel(heatFiles, definitionsInput,
+ ToscaUtil.getServiceTemplateFileName(mainServiceTemplate)), licenseArtifactsFiles);
+
+ String resultFileName = "resultFile.zip";
+ File file = new File(resultFileName);
+ FileOutputStream fos = new FileOutputStream(file);
+ fos.write(csarFile);
+ fos.close();
+
+ ZipFile zipFile = new ZipFile(resultFileName);
+
+ Enumeration<? extends ZipEntry> entries = zipFile.entries();
+
+ int count = 0;
+ while (entries.hasMoreElements()) {
+ count++;
+ entries.nextElement();
+ }
+ Assert.assertEquals(7, count);
+ zipFile.close();
+ Files.delete(Paths.get(file.getPath()));
+ }
+
+ @Test
+ public void testCSARFileCreation_noArtifacts() throws IOException {
+ ServiceTemplate serviceTemplate = new ServiceTemplate();
+ Metadata metadata = new Metadata();
+ metadata.setTemplate_author("OPENECOMP");
+ metadata.setTemplate_name("Test");
+ metadata.setTemplate_version("1.0.0");
+ serviceTemplate.setTosca_definitions_version("tosca_simple_yaml_1_0_0");
+ serviceTemplate.setDescription("testing desc tosca service template");
+ serviceTemplate.setMetadata(metadata);
+ Map<String, ServiceTemplate> definitionsInput = new HashMap<>();
+ String serviceTemplateFileName = ToscaUtil.getServiceTemplateFileName(serviceTemplate);
+ definitionsInput.put(serviceTemplateFileName, serviceTemplate);
+ byte[] csarFile = toscaFileOutputServiceCsarImpl
+ .createOutputFile(new ToscaServiceModel(null, definitionsInput, serviceTemplateFileName),
+ null);
+
+
+ String resultFileName = "resultFile.zip";
+ File file = new File(resultFileName);
+ FileOutputStream fos = new FileOutputStream(file);
+ fos.write(csarFile);
+ fos.close();
+
+ ZipFile zipFile = new ZipFile(resultFileName);
+
+ Enumeration<? extends ZipEntry> entries = zipFile.entries();
+
+ int count = 0;
+ while (entries.hasMoreElements()) {
+ count++;
+ entries.nextElement();
+ }
+ Assert.assertEquals(2, count);
+ zipFile.close();
+ Files.delete(Paths.get(file.getPath()));
+ }
+} \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/analyzerService/NestedServiceTemplateReqTest.yaml b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/analyzerService/NestedServiceTemplateReqTest.yaml
new file mode 100644
index 0000000000..f64cb709f0
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/analyzerService/NestedServiceTemplateReqTest.yaml
@@ -0,0 +1,176 @@
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+metadata:
+ template_name: nested
+imports:
+ NeutronPortGlobalTypes:
+ file: NeutronPortGlobalTypesServiceTemplate.yaml
+ NeutronNetGlobalTypes:
+ file: NeutronNetGlobalTypesServiceTemplate.yaml
+ CommonGlobalTypes:
+ file: CommonGlobalTypesServiceTemplate.yaml
+ CinderVolumeGlobalTypes:
+ file: CinderVolumeGlobalTypesServiceTemplate.yaml
+ ContrailNetworkRuleGlobalType:
+ file: ContrailNetworkRuleGlobalTypeServiceTemplate.yaml
+ NeutronSecurityRulesGlobalTypes:
+ file: NeutronSecurityRulesGlobalTypesServiceTemplate.yaml
+ NovaServerGlobalTypes:
+ file: NovaServerGlobalTypesServiceTemplate.yaml
+ ContrailVirtualNetworkGlobalType:
+ file: ContrailVirtualNetworkGlobalTypeServiceTemplate.yaml
+ AbstractSubstituteGlobalTypes:
+ file: AbstractSubstituteGlobalTypesServiceTemplate.yaml
+ nested:
+ file: GlobalSubstitutionTypesServiceTemplate.yaml
+node_types:
+ org.openecomp.resource.vfc.nodes.heat.cmaui_image:
+ derived_from: org.openecomp.resource.vfc.nodes.heat.nova.Server
+topology_template:
+ inputs:
+ cmaui_names:
+ hidden: false
+ immutable: false
+ type: list
+ description: CMAUI1, CMAUI2 server names
+ entry_schema:
+ type: String
+ p1:
+ hidden: false
+ immutable: false
+ type: string
+ description: UID of OAM network
+ cmaui_image:
+ hidden: false
+ immutable: false
+ type: string
+ description: Image for CMAUI server
+ cmaui_flavor:
+ hidden: false
+ immutable: false
+ type: string
+ description: Flavor for CMAUI server
+ security_group_name:
+ hidden: false
+ immutable: false
+ description: not impotrtant
+ availability_zone_0:
+ label: availabilityzone name
+ hidden: false
+ immutable: false
+ type: string
+ description: availabilityzone name
+ node_templates:
+ server_cmaui:
+ type: org.openecomp.resource.vfc.nodes.heat.cmaui_image
+ properties:
+ flavor:
+ get_input: cmaui_flavor
+ availability_zone:
+ get_input: availability_zone_0
+ image:
+ get_input: cmaui_image
+ name:
+ get_input:
+ - cmaui_names
+ - 0
+ cmaui_port_0:
+ type: org.openecomp.resource.cp.nodes.heat.network.neutron.Port
+ properties:
+ replacement_policy: AUTO
+ security_groups:
+ - get_input: security_group_name
+ fixed_ips:
+ - ip_address:
+ get_input:
+ - cmaui_oam_ips
+ - 0
+ network:
+ get_input: p1
+ requirements:
+ - binding:
+ capability: tosca.capabilities.network.Bindable
+ node: server_cmaui
+ relationship: tosca.relationships.network.BindsTo
+ cmaui1_port_1:
+ type: org.openecomp.resource.cp.nodes.heat.network.neutron.Port
+ properties:
+ replacement_policy: AUTO
+ security_groups:
+ - get_input: security_group_name
+ fixed_ips:
+ - subnet: subnetNameVal
+ ip_address:
+ get_input:
+ - cmaui_oam_ips
+ - 1
+ - subnet: subnetNameVal2
+ ip_address:
+ get_input:
+ - cmaui_oam_ips
+ - 1
+ network: jsa_net
+ requirements:
+ - link:
+ capability: tosca.capabilities.network.Linkable
+ node: jsa_net1
+ relationship: tosca.relationships.network.LinksTo
+ - link:
+ capability: tosca.capabilities.network.Linkable
+ node: jsa_net2
+ relationship: tosca.relationships.network.LinksTo
+ - binding:
+ capability: tosca.capabilities.network.Bindable
+ node: server_cmaui
+ relationship: tosca.relationships.network.BindsTo
+ jsa_net1:
+ type: org.openecomp.resource.vl.nodes.heat.network.neutron.Net
+ properties:
+ shared: true
+ network_name:
+ get_input: jsa_net_name
+ jsa_net2:
+ type: org.openecomp.resource.vl.nodes.heat.network.neutron.Net
+ properties:
+ shared: true
+ network_name:
+ get_input: jsa_net_name
+ groups:
+ nested:
+ type: org.openecomp.groups.heat.HeatStack
+ properties:
+ heat_file: ../Artifacts/nested.yml
+ description: cmaui server template for vMMSC
+ members:
+ - server_cmaui
+ - cmaui_port_0
+ substitution_mappings:
+ node_type: org.openecomp.resource.abstract.nodes.heat.nested
+ capabilities:
+ host_server_cmaui:
+ - server_cmaui
+ - host
+ os_server_cmaui:
+ - server_cmaui
+ - os
+ endpoint_server_cmaui:
+ - server_cmaui
+ - endpoint
+ binding_server_cmaui:
+ - server_cmaui
+ - binding
+ scalable_server_cmaui:
+ - server_cmaui
+ - scalable
+ attachment_cmaui_port_0:
+ - cmaui_port_0
+ - attachment
+ requirements:
+ local_storage_server_cmaui:
+ - server_cmaui
+ - local_storage
+ link_cmaui_port_0:
+ - cmaui_port_0
+ - link
+ link_cmaui_port_invalid:
+ - cmaui_port_9
+ - link
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/analyzerService/ServiceTemplateSubstituteTest.yaml b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/analyzerService/ServiceTemplateSubstituteTest.yaml
new file mode 100644
index 0000000000..c4df76a1aa
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/analyzerService/ServiceTemplateSubstituteTest.yaml
@@ -0,0 +1,89 @@
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+metadata:
+ template_name: Main
+imports:
+ NeutronPortGlobalTypes:
+ file: NeutronPortGlobalTypesServiceTemplate.yaml
+ NeutronNetGlobalTypes:
+ file: NeutronNetGlobalTypesServiceTemplate.yaml
+ CommonGlobalTypes:
+ file: CommonGlobalTypesServiceTemplate.yaml
+ CinderVolumeGlobalTypes:
+ file: CinderVolumeGlobalTypesServiceTemplate.yaml
+ ContrailNetworkRuleGlobalType:
+ file: ContrailNetworkRuleGlobalTypeServiceTemplate.yaml
+ NeutronSecurityRulesGlobalTypes:
+ file: NeutronSecurityRulesGlobalTypesServiceTemplate.yaml
+ NovaServerGlobalTypes:
+ file: NovaServerGlobalTypesServiceTemplate.yaml
+ ContrailVirtualNetworkGlobalType:
+ file: ContrailVirtualNetworkGlobalTypeServiceTemplate.yaml
+ AbstractSubstituteGlobalTypes:
+ file: AbstractSubstituteGlobalTypesServiceTemplate.yaml
+topology_template:
+ inputs:
+ shared_network_id:
+ hidden: false
+ immutable: false
+ type: string
+ description: network name of jsa log network
+ jsa_net_name:
+ hidden: false
+ immutable: false
+ type: string
+ description: network name of jsa log network
+ node_templates:
+ test_net:
+ type: org.openecomp.resource.vl.nodes.heat.network.neutron.Net
+ properties:
+ shared: true
+ network_name:
+ get_input: jsa_net_name
+ test_nested1:
+ type: org.openecomp.resource.abstract.nodes.heat.nested
+ directives:
+ - substitutable
+ properties:
+ p1:
+ get_input: shared_network_id
+ service_template_filter:
+ substitute_service_template: nestedServiceTemplate.yaml
+ requirements:
+ - link_cmaui_port_0:
+ capability: tosca.capabilities.network.Linkable
+ node: test_net
+ relationship: tosca.relationships.network.LinksTo
+ test_nested2:
+ type: org.openecomp.resource.abstract.nodes.heat.nested
+ directives:
+ - substitutable
+ properties:
+ p1:
+ get_input: shared_network_id
+ service_template_filter:
+ substitute_service_template: nestedServiceTemplate.yaml
+ requirements:
+ - link_cmaui_port_0:
+ capability: tosca.capabilities.network.Linkable
+ node: test_net
+ relationship: tosca.relationships.network.LinksTo
+ groups:
+ addOn:
+ type: org.openecomp.groups.heat.HeatStack
+ properties:
+ heat_file: ../Artifacts/addOn.yml
+ description: |
+ Version 2.0 02-09-2016 (Authors: John Doe, user PROD)
+ members:
+ - test_nested
+ main:
+ type: org.openecomp.groups.heat.HeatStack
+ properties:
+ heat_file: ../Artifacts/main.yml
+ description: |
+ Version 2.0 02-09-2016 (Authors: John Doe, user PROD)
+ members:
+ - test_net
+ outputs:
+ shared_network_id:
+ value: test_net \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/analyzerService/toscasubstitution/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/analyzerService/toscasubstitution/MainServiceTemplate.yaml
new file mode 100644
index 0000000000..65b90ef5b1
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/analyzerService/toscasubstitution/MainServiceTemplate.yaml
@@ -0,0 +1,75 @@
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+metadata:
+ template_name: Main
+imports:
+ NeutronPortGlobalTypes:
+ file: NeutronPortGlobalTypesServiceTemplate.yaml
+ NeutronNetGlobalTypes:
+ file: NeutronNetGlobalTypesServiceTemplate.yaml
+ CommonGlobalTypes:
+ file: CommonGlobalTypesServiceTemplate.yaml
+ CinderVolumeGlobalTypes:
+ file: CinderVolumeGlobalTypesServiceTemplate.yaml
+ ContrailNetworkRuleGlobalType:
+ file: ContrailNetworkRuleGlobalTypeServiceTemplate.yaml
+ NeutronSecurityRulesGlobalTypes:
+ file: NeutronSecurityRulesGlobalTypesServiceTemplate.yaml
+ NovaServerGlobalTypes:
+ file: NovaServerGlobalTypesServiceTemplate.yaml
+ ContrailVirtualNetworkGlobalType:
+ file: ContrailVirtualNetworkGlobalTypeServiceTemplate.yaml
+ AbstractSubstituteGlobalTypes:
+ file: AbstractSubstituteGlobalTypesServiceTemplate.yaml
+topology_template:
+ inputs:
+ shared_network_id:
+ hidden: false
+ immutable: false
+ type: string
+ description: network name of jsa log network
+ jsa_net_name:
+ hidden: false
+ immutable: false
+ type: string
+ description: network name of jsa log network
+ node_templates:
+ test_net:
+ type: org.openecomp.resource.vl.nodes.heat.network.neutron.Net
+ properties:
+ shared: true
+ network_name:
+ get_input: jsa_net_name
+ test_nested:
+ type: org.openecomp.resource.abstract.nodes.heat.nested
+ directives:
+ - substitutable
+ properties:
+ p1:
+ get_input: shared_network_id
+ service_template_filter:
+ substitute_service_template: nestedServiceTemplate.yaml
+ requirements:
+ - link_cmaui_port_0:
+ capability: tosca.capabilities.network.Linkable
+ node: test_net
+ relationship: tosca.relationships.network.LinksTo
+ groups:
+ addOn:
+ type: org.openecomp.groups.heat.HeatStack
+ properties:
+ heat_file: ../Artifacts/addOn.yml
+ description: |
+ Version 2.0 02-09-2016 (Authors: John Doe, user PROD)
+ members:
+ - test_nested
+ main:
+ type: org.openecomp.groups.heat.HeatStack
+ properties:
+ heat_file: ../Artifacts/main.yml
+ description: |
+ Version 2.0 02-09-2016 (Authors: John Doe, user PROD)
+ members:
+ - test_net
+ outputs:
+ shared_network_id:
+ value: test_net \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/analyzerService/toscasubstitution/nestedServiceTemplate.yaml b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/analyzerService/toscasubstitution/nestedServiceTemplate.yaml
new file mode 100644
index 0000000000..cd27e7ba1a
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/analyzerService/toscasubstitution/nestedServiceTemplate.yaml
@@ -0,0 +1,130 @@
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+metadata:
+ template_name: nested
+imports:
+ NeutronPortGlobalTypes:
+ file: NeutronPortGlobalTypesServiceTemplate.yaml
+ NeutronNetGlobalTypes:
+ file: NeutronNetGlobalTypesServiceTemplate.yaml
+ CommonGlobalTypes:
+ file: CommonGlobalTypesServiceTemplate.yaml
+ CinderVolumeGlobalTypes:
+ file: CinderVolumeGlobalTypesServiceTemplate.yaml
+ ContrailNetworkRuleGlobalType:
+ file: ContrailNetworkRuleGlobalTypeServiceTemplate.yaml
+ NeutronSecurityRulesGlobalTypes:
+ file: NeutronSecurityRulesGlobalTypesServiceTemplate.yaml
+ NovaServerGlobalTypes:
+ file: NovaServerGlobalTypesServiceTemplate.yaml
+ ContrailVirtualNetworkGlobalType:
+ file: ContrailVirtualNetworkGlobalTypeServiceTemplate.yaml
+ AbstractSubstituteGlobalTypes:
+ file: AbstractSubstituteGlobalTypesServiceTemplate.yaml
+ nested:
+ file: GlobalSubstitutionTypesServiceTemplate.yaml
+node_types:
+ org.openecomp.resource.vfc.nodes.heat.cmaui_image:
+ derived_from: org.openecomp.resource.vfc.nodes.heat.nova.Server
+topology_template:
+ inputs:
+ cmaui_names:
+ hidden: false
+ immutable: false
+ type: list
+ description: CMAUI1, CMAUI2 server names
+ entry_schema:
+ type: String
+ p1:
+ hidden: false
+ immutable: false
+ type: string
+ description: UID of OAM network
+ cmaui_image:
+ hidden: false
+ immutable: false
+ type: string
+ description: Image for CMAUI server
+ cmaui_flavor:
+ hidden: false
+ immutable: false
+ type: string
+ description: Flavor for CMAUI server
+ security_group_name:
+ hidden: false
+ immutable: false
+ description: not impotrtant
+ availability_zone_0:
+ label: availabilityzone name
+ hidden: false
+ immutable: false
+ type: string
+ description: availabilityzone name
+ node_templates:
+ server_cmaui:
+ type: org.openecomp.resource.vfc.nodes.heat.cmaui_image
+ properties:
+ flavor:
+ get_input: cmaui_flavor
+ availability_zone:
+ get_input: availability_zone_0
+ image:
+ get_input: cmaui_image
+ name:
+ get_input:
+ - cmaui_names
+ - 0
+ cmaui_port_0:
+ type: org.openecomp.resource.cp.nodes.heat.network.neutron.Port
+ properties:
+ replacement_policy: AUTO
+ security_groups:
+ - get_input: security_group_name
+ fixed_ips:
+ - ip_address:
+ get_input:
+ - cmaui_oam_ips
+ - 0
+ network:
+ get_input: p1
+ requirements:
+ - binding:
+ capability: tosca.capabilities.network.Bindable
+ node: server_cmaui
+ relationship: tosca.relationships.network.BindsTo
+ groups:
+ nested:
+ type: org.openecomp.groups.heat.HeatStack
+ properties:
+ heat_file: ../Artifacts/nested.yml
+ description: cmaui server template for vMMSC
+ members:
+ - server_cmaui
+ - cmaui_port_0
+ substitution_mappings:
+ node_type: org.openecomp.resource.abstract.nodes.heat.nested
+ capabilities:
+ host_server_cmaui:
+ - server_cmaui
+ - host
+ os_server_cmaui:
+ - server_cmaui
+ - os
+ endpoint_server_cmaui:
+ - server_cmaui
+ - endpoint
+ binding_server_cmaui:
+ - server_cmaui
+ - binding
+ scalable_server_cmaui:
+ - server_cmaui
+ - scalable
+ attachment_cmaui_port_0:
+ - cmaui_port_0
+ - attachment
+ requirements:
+ local_storage_server_cmaui:
+ - server_cmaui
+ - local_storage
+ link_cmaui_port_0:
+ - cmaui_port_0
+ - link \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/globalServiceTemplates/AbstractSubstituteGlobalTypesServiceTemplate.yaml b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/globalServiceTemplates/AbstractSubstituteGlobalTypesServiceTemplate.yaml
new file mode 100644
index 0000000000..8813b0abf6
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/globalServiceTemplates/AbstractSubstituteGlobalTypesServiceTemplate.yaml
@@ -0,0 +1,47 @@
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+metadata:
+ template_name: AbstractSubstituteGlobalTypes
+ template_version: 1.0.0
+description: Abstract Substitute Global Types
+imports:
+ common_definitions:
+ file: CommonGlobalTypesServiceTemplate.yaml
+data_types:
+ org.openecomp.datatypes.heat.substitution.SubstitutionFilter:
+ derived_from: tosca.datatypes.Root
+ description: Substitution Filter
+ properties:
+ substitute_service_template:
+ type: string
+ description: Substitute Service Template
+ required: true
+ status: SUPPORTED
+ index_variable:
+ type: string
+ description: Index variable
+ required: false
+ default: '%index%'
+ status: SUPPORTED
+ constraints:
+ - min_length: 3
+ count:
+ type: string
+ description: Count
+ required: false
+ default: 1
+ status: SUPPORTED
+ mandatory:
+ type: boolean
+ description: Mandatory
+ required: false
+ default: true
+ status: SUPPORTED
+node_types:
+ org.openecomp.resource.abstract.nodes.AbstractSubstitute:
+ derived_from: tosca.nodes.Root
+ properties:
+ service_template_filter:
+ type: org.openecomp.datatypes.heat.substitution.SubstitutionFilter
+ description: Substitution Filter
+ required: true
+ status: SUPPORTED \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/globalServiceTemplates/CinderVolumeGlobalTypesServiceTemplate.yaml b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/globalServiceTemplates/CinderVolumeGlobalTypesServiceTemplate.yaml
new file mode 100644
index 0000000000..3ef94f22e7
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/globalServiceTemplates/CinderVolumeGlobalTypesServiceTemplate.yaml
@@ -0,0 +1,176 @@
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+metadata:
+ template_name: CinderVolumeGlobalTypes
+ template_version: 1.0.0
+description: Cinder Volume TOSCA Global Types
+relationship_types:
+ org.openecomp.relationships.heat.cinder.VolumeAttachesTo:
+ derived_from: tosca.relationships.AttachesTo
+ description: This type represents an attachment relationship for associating volume
+ properties:
+ volume_id:
+ type: string
+ description: The ID of the volume to be attached
+ required: true
+ status: SUPPORTED
+ location:
+ type: string
+ description: The location where the volume is exposed on the instance, mountpoint
+ required: false
+ status: SUPPORTED
+ instance_uuid:
+ type: string
+ description: The ID of the server to which the volume attaches
+ required: true
+ status: SUPPORTED
+ attributes:
+ show:
+ type: string
+ description: Detailed information about resource
+ status: SUPPORTED
+node_types:
+ org.openecomp.resource.vfc.nodes.heat.cinder.Volume:
+ derived_from: tosca.nodes.BlockStorage
+ properties:
+ availability_zone:
+ type: string
+ description: The availability zone in which the volume will be created
+ required: false
+ status: SUPPORTED
+ image:
+ type: string
+ description: If specified, the name or ID of the image to create the volume from
+ required: false
+ status: SUPPORTED
+ metadata:
+ type: map
+ description: Key/value pairs to associate with the volume
+ required: false
+ status: SUPPORTED
+ entry_schema:
+ type: string
+ volume_type:
+ type: string
+ description: If specified, the type of volume to use, mapping to a specific backend
+ required: false
+ status: SUPPORTED
+ description:
+ type: string
+ description: A description of the volume
+ required: false
+ status: SUPPORTED
+ device_type:
+ type: string
+ description: Device type
+ required: false
+ status: SUPPORTED
+ constraints:
+ - valid_values:
+ - cdrom
+ - disk
+ disk_bus:
+ type: string
+ description: 'Bus of the device: hypervisor driver chooses a suitable default
+ if omitted'
+ required: false
+ status: SUPPORTED
+ constraints:
+ - valid_values:
+ - ide
+ - lame_bus
+ - scsi
+ - usb
+ - virtio
+ backup_id:
+ type: string
+ description: If specified, the backup to create the volume from
+ required: false
+ status: SUPPORTED
+ source_volid:
+ type: string
+ description: If specified, the volume to use as source
+ required: false
+ status: SUPPORTED
+ boot_index:
+ type: integer
+ description: Integer used for ordering the boot disks
+ required: false
+ status: SUPPORTED
+ size:
+ type: scalar-unit.size
+ description: The requested storage size (default unit is MB)
+ required: false
+ status: SUPPORTED
+ constraints:
+ - greater_or_equal: 1 GB
+ read_only:
+ type: boolean
+ description: Enables or disables read-only access mode of volume
+ required: false
+ status: SUPPORTED
+ name:
+ type: string
+ description: A name used to distinguish the volume
+ required: false
+ status: SUPPORTED
+ scheduler_hints:
+ type: map
+ description: Arbitrary key-value pairs specified by the client to help the Cinder scheduler creating a volume
+ required: false
+ status: SUPPORTED
+ entry_schema:
+ type: string
+ swap_size:
+ type: scalar-unit.size
+ description: The size of the swap, in MB
+ required: false
+ status: SUPPORTED
+ delete_on_termination:
+ type: boolean
+ description: Indicate whether the volume should be deleted when the server is terminated
+ required: false
+ status: SUPPORTED
+ multiattach:
+ type: boolean
+ description: Whether allow the volume to be attached more than once
+ required: false
+ status: SUPPORTED
+ attributes:
+ display_description:
+ type: string
+ description: Description of the volume
+ status: SUPPORTED
+ attachments:
+ type: string
+ description: The list of attachments of the volume
+ status: SUPPORTED
+ entry_schema:
+ type: string
+ encrypted:
+ type: boolean
+ description: Boolean indicating if the volume is encrypted or not
+ status: SUPPORTED
+ show:
+ type: string
+ description: Detailed information about resource
+ status: SUPPORTED
+ created_at:
+ type: timestamp
+ description: The timestamp indicating volume creation
+ status: SUPPORTED
+ display_name:
+ type: string
+ description: Name of the volume
+ status: SUPPORTED
+ metadata_values:
+ type: map
+ description: Key/value pairs associated with the volume in raw dict form
+ status: SUPPORTED
+ bootable:
+ type: boolean
+ description: Boolean indicating if the volume can be booted or not
+ status: SUPPORTED
+ status:
+ type: string
+ description: The current status of the volume
+ status: SUPPORTED
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/globalServiceTemplates/CommonGlobalTypesServiceTemplate.yaml b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/globalServiceTemplates/CommonGlobalTypesServiceTemplate.yaml
new file mode 100644
index 0000000000..1a183e9c50
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/globalServiceTemplates/CommonGlobalTypesServiceTemplate.yaml
@@ -0,0 +1,210 @@
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+metadata:
+ template_name: CommonGlobalTypes
+ template_version: 1.0.0
+description: TOSCA Global Types
+data_types:
+ org.openecomp.datatypes.heat.network.AddressPair:
+ derived_from: tosca.datatypes.Root
+ description: MAC/IP address pairs
+ properties:
+ mac_address:
+ type: string
+ description: MAC address
+ required: false
+ status: SUPPORTED
+ ip_address:
+ type: string
+ description: IP address
+ required: false
+ status: SUPPORTED
+ org.openecomp.datatypes.heat.network.subnet.HostRoute:
+ derived_from: tosca.datatypes.Root
+ description: Host route info for the subnet
+ properties:
+ destination:
+ type: string
+ description: The destination for static route
+ required: false
+ status: SUPPORTED
+ nexthop:
+ type: string
+ description: The next hop for the destination
+ required: false
+ status: SUPPORTED
+ org.openecomp.datatypes.heat.network.neutron.Subnet:
+ derived_from: tosca.datatypes.Root
+ description: A subnet represents an IP address block that can be used for assigning IP addresses to virtual instances
+ properties:
+ tenant_id:
+ type: string
+ description: The ID of the tenant who owns the network
+ required: false
+ status: SUPPORTED
+ enable_dhcp:
+ type: boolean
+ description: Set to true if DHCP is enabled and false if DHCP is disabled
+ required: false
+ default: true
+ status: SUPPORTED
+ ipv6_address_mode:
+ type: string
+ description: IPv6 address mode
+ required: false
+ status: SUPPORTED
+ constraints:
+ - valid_values:
+ - dhcpv6-stateful
+ - dhcpv6-stateless
+ - slaac
+ ipv6_ra_mode:
+ type: string
+ description: IPv6 RA (Router Advertisement) mode
+ required: false
+ status: SUPPORTED
+ constraints:
+ - valid_values:
+ - dhcpv6-stateful
+ - dhcpv6-stateless
+ - slaac
+ value_specs:
+ type: map
+ description: Extra parameters to include in the request
+ required: false
+ default: {
+ }
+ status: SUPPORTED
+ entry_schema:
+ type: string
+ allocation_pools:
+ type: list
+ description: The start and end addresses for the allocation pools
+ required: false
+ status: SUPPORTED
+ entry_schema:
+ type: org.openecomp.datatypes.heat.network.AllocationPool
+ subnetpool:
+ type: string
+ description: The name or ID of the subnet pool
+ required: false
+ status: SUPPORTED
+ dns_nameservers:
+ type: list
+ description: A specified set of DNS name servers to be used
+ required: false
+ default: [
+ ]
+ status: SUPPORTED
+ entry_schema:
+ type: string
+ host_routes:
+ type: list
+ description: The gateway IP address
+ required: false
+ status: SUPPORTED
+ entry_schema:
+ type: org.openecomp.datatypes.heat.network.subnet.HostRoute
+ ip_version:
+ type: integer
+ description: The gateway IP address
+ required: false
+ default: 4
+ status: SUPPORTED
+ constraints:
+ - valid_values:
+ - '4'
+ - '6'
+ name:
+ type: string
+ description: The name of the subnet
+ required: false
+ status: SUPPORTED
+ prefixlen:
+ type: integer
+ description: Prefix length for subnet allocation from subnet pool
+ required: false
+ status: SUPPORTED
+ constraints:
+ - greater_or_equal: 0
+ cidr:
+ type: string
+ description: The CIDR
+ required: false
+ status: SUPPORTED
+ gateway_ip:
+ type: string
+ description: The gateway IP address
+ required: false
+ status: SUPPORTED
+ org.openecomp.datatypes.heat.network.AllocationPool:
+ derived_from: tosca.datatypes.Root
+ description: The start and end addresses for the allocation pool
+ properties:
+ start:
+ type: string
+ description: Start address for the allocation pool
+ required: false
+ status: SUPPORTED
+ end:
+ type: string
+ description: End address for the allocation pool
+ required: false
+ status: SUPPORTED
+relationship_types:
+ org.openecomp.relationships.AttachesTo:
+ derived_from: tosca.relationships.Root
+ description: This type represents an attachment relationship
+group_types:
+ org.openecomp.groups.heat.HeatStack:
+ derived_from: tosca.groups.Root
+ description: Grouped all heat resources which are in the same heat stack
+ properties:
+ heat_file:
+ type: string
+ description: Heat file which associate to this group/heat stack
+ required: true
+ status: SUPPORTED
+ description:
+ type: string
+ description: Heat file description
+ required: false
+ status: SUPPORTED
+policy_types:
+ org.openecomp.policies.placement.Colocate:
+ derived_from: tosca.policy.placement
+ description: Keep associated nodes (groups of nodes) based upon affinity value
+ properties:
+ name:
+ type: string
+ description: The name of the policy
+ required: false
+ status: SUPPORTED
+ affinity:
+ type: string
+ description: affinity
+ required: true
+ status: SUPPORTED
+ constraints:
+ - valid_values:
+ - host
+ - region
+ - compute
+ org.openecomp.policies.placement.Antilocate:
+ derived_from: tosca.policy.placement
+ description: My placement policy for separation based upon container type value
+ properties:
+ name:
+ type: string
+ description: The name of the policy
+ required: false
+ status: SUPPORTED
+ container_type:
+ type: string
+ description: container type
+ required: false
+ status: SUPPORTED
+ constraints:
+ - valid_values:
+ - host
+ - region
+ - compute
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/globalServiceTemplates/ContrailNetworkRuleGlobalTypeServiceTemplate.yaml b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/globalServiceTemplates/ContrailNetworkRuleGlobalTypeServiceTemplate.yaml
new file mode 100644
index 0000000000..98317310fa
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/globalServiceTemplates/ContrailNetworkRuleGlobalTypeServiceTemplate.yaml
@@ -0,0 +1,117 @@
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+metadata:
+ template_name: ContrailNetworkRuleGlobalType
+ template_version: 1.0.0
+description: Contrail Network Rule Global Types
+imports:
+ common_definitions:
+ file: CommonGlobalTypesServiceTemplate.yaml
+data_types:
+ org.openecomp.datatypes.heat.contrail.network.rule.PortPairs:
+ derived_from: tosca.datatypes.Root
+ description: source and destination port pairs
+ properties:
+ start_port:
+ type: string
+ description: Start port
+ required: false
+ status: SUPPORTED
+ end_port:
+ type: string
+ description: End port
+ required: false
+ status: SUPPORTED
+ org.openecomp.datatypes.heat.contrail.network.rule.Rule:
+ derived_from: tosca.datatypes.Root
+ description: policy rule
+ properties:
+ src_ports:
+ type: list
+ description: Source ports
+ required: false
+ status: SUPPORTED
+ entry_schema:
+ type: org.openecomp.datatypes.heat.contrail.network.rule.PortPairs
+ protocol:
+ type: string
+ description: Protocol
+ required: false
+ status: SUPPORTED
+ dst_addresses:
+ type: list
+ description: Destination addresses
+ required: false
+ status: SUPPORTED
+ entry_schema:
+ type: org.openecomp.datatypes.heat.contrail.network.rule.VirtualNetwork
+ apply_service:
+ type: string
+ description: Service to apply
+ required: false
+ status: SUPPORTED
+ dst_ports:
+ type: list
+ description: Destination ports
+ required: false
+ status: SUPPORTED
+ entry_schema:
+ type: org.openecomp.datatypes.heat.contrail.network.rule.PortPairs
+ src_addresses:
+ type: list
+ description: Source addresses
+ required: false
+ status: SUPPORTED
+ entry_schema:
+ type: org.openecomp.datatypes.heat.contrail.network.rule.VirtualNetwork
+ direction:
+ type: string
+ description: Direction
+ required: false
+ status: SUPPORTED
+ org.openecomp.datatypes.heat.contrail.network.rule.RuleList:
+ derived_from: tosca.datatypes.Root
+ description: list of policy rules
+ properties:
+ policy_rule:
+ type: list
+ description: Contrail network rule
+ required: false
+ status: SUPPORTED
+ entry_schema:
+ type: org.openecomp.datatypes.heat.contrail.network.rule.Rule
+ org.openecomp.datatypes.heat.contrail.network.rule.VirtualNetwork:
+ derived_from: tosca.datatypes.Root
+ description: source and destination addresses
+ properties:
+ virtual_network:
+ type: string
+ description: Virtual network
+ required: false
+ status: SUPPORTED
+node_types:
+ org.openecomp.resource.nodes.heat.network.contrail.NetworkRules:
+ derived_from: tosca.nodes.Root
+ properties:
+ entries:
+ type: org.openecomp.datatypes.heat.contrail.network.rule.RuleList
+ description: A symbolic name for this contrail network rule
+ required: false
+ status: SUPPORTED
+ name:
+ type: string
+ description: A symbolic name for this contrail network rule
+ required: false
+ status: SUPPORTED
+ attributes:
+ fq_name:
+ type: string
+ description: fq_name
+ status: SUPPORTED
+ requirements:
+ - network:
+ capability: tosca.capabilities.Attachment
+ node: tosca.nodes.network.Network
+ relationship: org.openecomp.relationships.AttachesTo
+ occurrences:
+ - 0
+ - UNBOUNDED
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/globalServiceTemplates/ContrailVirtualNetworkGlobalTypeServiceTemplate.yaml b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/globalServiceTemplates/ContrailVirtualNetworkGlobalTypeServiceTemplate.yaml
new file mode 100644
index 0000000000..0927e3dd0e
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/globalServiceTemplates/ContrailVirtualNetworkGlobalTypeServiceTemplate.yaml
@@ -0,0 +1,71 @@
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+metadata:
+ template_name: ContrailVirtualNetworkGlobalType
+ template_version: 1.0.0
+description: Contrail Virtual Network Global Types
+imports:
+ common_definitions:
+ file: CommonGlobalTypesServiceTemplate.yaml
+node_types:
+ org.openecomp.resource.vl.nodes.heat.network.contrail.VirtualNetwork:
+ derived_from: tosca.nodes.network.Network
+ properties:
+ shared:
+ type: string
+ description: Is virtual network shared
+ required: false
+ status: SUPPORTED
+ forwarding_mode:
+ type: string
+ description: forwarding mode of the virtual network
+ required: false
+ status: SUPPORTED
+ external:
+ type: string
+ description: Is virtual network external
+ required: false
+ status: SUPPORTED
+ flood_unknown_unicast:
+ type: string
+ description: flood L2 packets on network
+ required: false
+ status: SUPPORTED
+ route_targets:
+ type: list
+ description: route targets associated with the virtual network
+ required: false
+ status: SUPPORTED
+ entry_schema:
+ type: string
+ subnets:
+ type: map
+ description: Network related subnets
+ required: false
+ status: SUPPORTED
+ entry_schema:
+ type: org.openecomp.datatypes.heat.network.neutron.Subnet
+ attributes:
+ subnets_name:
+ type: list
+ description: Subnets name of this network
+ status: SUPPORTED
+ entry_schema:
+ type: string
+ subnets_show:
+ type: map
+ description: Detailed information about each subnet
+ status: SUPPORTED
+ entry_schema:
+ type: string
+ subnets:
+ type: map
+ description: Network related subnets
+ status: SUPPORTED
+ entry_schema:
+ type: org.openecomp.datatypes.heat.network.neutron.Subnet
+ capabilities:
+ attachment:
+ type: tosca.capabilities.Attachment
+ occurrences:
+ - 1
+ - UNBOUNDED
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/globalServiceTemplates/GlobalSubstitutionTypesServiceTemplate.yaml b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/globalServiceTemplates/GlobalSubstitutionTypesServiceTemplate.yaml
new file mode 100644
index 0000000000..08c47bc646
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/globalServiceTemplates/GlobalSubstitutionTypesServiceTemplate.yaml
@@ -0,0 +1,93 @@
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+metadata:
+ template_name: GlobalSubstitutionTypes
+imports:
+ NeutronPortGlobalTypes:
+ file: NeutronPortGlobalTypesServiceTemplate.yaml
+ NeutronNetGlobalTypes:
+ file: NeutronNetGlobalTypesServiceTemplate.yaml
+ CommonGlobalTypes:
+ file: CommonGlobalTypesServiceTemplate.yaml
+ CinderVolumeGlobalTypes:
+ file: CinderVolumeGlobalTypesServiceTemplate.yaml
+ ContrailNetworkRuleGlobalType:
+ file: ContrailNetworkRuleGlobalTypeServiceTemplate.yaml
+ NeutronSecurityRulesGlobalTypes:
+ file: NeutronSecurityRulesGlobalTypesServiceTemplate.yaml
+ NovaServerGlobalTypes:
+ file: NovaServerGlobalTypesServiceTemplate.yaml
+ ContrailVirtualNetworkGlobalType:
+ file: ContrailVirtualNetworkGlobalTypeServiceTemplate.yaml
+ AbstractSubstituteGlobalTypes:
+ file: AbstractSubstituteGlobalTypesServiceTemplate.yaml
+node_types:
+ org.openecomp.resource.abstract.nodes.heat.nested:
+ derived_from: org.openecomp.resource.abstract.nodes.AbstractSubstitute
+ properties:
+ cmaui_names:
+ type: list
+ description: CMAUI1, CMAUI2 server names
+ entry_schema:
+ type: String
+ p1:
+ type: string
+ description: UID of OAM network
+ cmaui_image:
+ type: string
+ description: Image for CMAUI server
+ cmaui_flavor:
+ type: string
+ description: Flavor for CMAUI server
+ security_group_name:
+ description: not impotrtant
+ availability_zone_0:
+ type: string
+ description: availabilityzone name
+ requirements:
+ - local_storage_server_cmaui:
+ capability: tosca.capabilities.Attachment
+ node: tosca.nodes.BlockStorage
+ relationship: tosca.relationships.AttachesTo
+ occurrences:
+ - 0
+ - UNBOUNDED
+ - link_cmaui_port_0:
+ capability: tosca.capabilities.network.Linkable
+ node: tosca.nodes.Root
+ relationship: tosca.relationships.network.LinksTo
+ occurrences:
+ - 1
+ - 1
+ capabilities:
+ host_server_cmaui:
+ type: tosca.capabilities.Container
+ valid_source_types:
+ - tosca.nodes.SoftwareComponent
+ occurrences:
+ - 1
+ - UNBOUNDED
+ os_server_cmaui:
+ type: tosca.capabilities.OperatingSystem
+ occurrences:
+ - 1
+ - UNBOUNDED
+ endpoint_server_cmaui:
+ type: tosca.capabilities.Endpoint.Admin
+ occurrences:
+ - 1
+ - UNBOUNDED
+ binding_server_cmaui:
+ type: tosca.capabilities.network.Bindable
+ occurrences:
+ - 1
+ - UNBOUNDED
+ scalable_server_cmaui:
+ type: tosca.capabilities.Scalable
+ occurrences:
+ - 1
+ - UNBOUNDED
+ attachment_cmaui_port_0:
+ type: tosca.capabilities.Attachment
+ occurrences:
+ - 1
+ - UNBOUNDED \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/globalServiceTemplates/NativeTypesServiceTemplateServiceTemplate.yaml b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/globalServiceTemplates/NativeTypesServiceTemplateServiceTemplate.yaml
new file mode 100644
index 0000000000..e7dfd49ed9
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/globalServiceTemplates/NativeTypesServiceTemplateServiceTemplate.yaml
@@ -0,0 +1,194 @@
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+metadata:
+ template_name: NativeTypesServiceTemplate
+ template_version: 1.0.0
+description: TOSCA Native Node Types
+node_types:
+ tosca.nodes.Compute:
+ derived_from: tosca.nodes.Root
+ attributes:
+ private_address:
+ type: string
+ description: private address
+ status: SUPPORTED
+ public_address:
+ type: string
+ description: public_address
+ status: SUPPORTED
+ networks:
+ type: map
+ description: networks
+ status: SUPPORTED
+ entry_schema:
+ type: tosca.datatypes.network.NetworkInfo
+ ports:
+ type: map
+ description: ports
+ status: SUPPORTED
+ entry_schema:
+ type: tosca.datatypes.network.PortInfo
+ requirements:
+ - local_storage:
+ capability: tosca.capabilities.Attachment
+ node: tosca.nodes.BlockStorage
+ relationship: tosca.relationships.AttachesTo
+ occurrences:
+ - 0
+ - UNBOUNDED
+ capabilities:
+ scalable:
+ type: tosca.capabilities.Scalable
+ occurrences:
+ - 1
+ - UNBOUNDED
+ endpoint:
+ type: tosca.capabilities.Endpoint.Admin
+ occurrences:
+ - 1
+ - UNBOUNDED
+ os:
+ type: tosca.capabilities.OperatingSystem
+ occurrences:
+ - 1
+ - UNBOUNDED
+ host:
+ type: tosca.capabilities.Container
+ valid_source_types:
+ - tosca.nodes.SoftwareComponent
+ occurrences:
+ - 1
+ - UNBOUNDED
+ binding:
+ type: tosca.capabilities.network.Bindable
+ occurrences:
+ - 1
+ - UNBOUNDED
+ tosca.nodes.network.Port:
+ derived_from: tosca.nodes.Root
+ properties:
+ ip_range_end:
+ type: string
+ required: false
+ status: SUPPORTED
+ ip_range_start:
+ type: string
+ required: false
+ status: SUPPORTED
+ ip_address:
+ type: string
+ required: false
+ status: SUPPORTED
+ is_default:
+ type: boolean
+ required: false
+ default: false
+ status: SUPPORTED
+ order:
+ type: integer
+ required: true
+ default: 0
+ status: SUPPORTED
+ constraints:
+ - greater_or_equal: 0
+ requirements:
+ - link:
+ capability: tosca.capabilities.network.Linkable
+ node: tosca.nodes.Root
+ relationship: tosca.relationships.network.LinksTo
+ - binding:
+ capability: tosca.capabilities.network.Bindable
+ node: tosca.nodes.Root
+ relationship: tosca.relationships.network.BindsTo
+ tosca.nodes.Root:
+ attributes:
+ tosca_name:
+ type: string
+ description: tosca name
+ status: SUPPORTED
+ state:
+ type: string
+ description: state
+ status: SUPPORTED
+ tosca_id:
+ type: string
+ description: tosca id
+ status: SUPPORTED
+ interfaces: {
+ }
+ tosca.nodes.network.Network:
+ derived_from: tosca.nodes.Root
+ properties:
+ physical_network:
+ type: string
+ required: false
+ status: SUPPORTED
+ segmentation_id:
+ type: string
+ required: false
+ status: SUPPORTED
+ network_id:
+ type: string
+ required: false
+ status: SUPPORTED
+ ip_version:
+ type: integer
+ required: false
+ default: 4
+ status: SUPPORTED
+ constraints:
+ - valid_values:
+ - 4
+ - 6
+ start_ip:
+ type: string
+ required: false
+ status: SUPPORTED
+ network_name:
+ type: string
+ required: false
+ status: SUPPORTED
+ cidr:
+ type: string
+ required: false
+ status: SUPPORTED
+ gateway_ip:
+ type: string
+ required: false
+ status: SUPPORTED
+ network_type:
+ type: string
+ required: false
+ status: SUPPORTED
+ end_ip:
+ type: string
+ required: false
+ status: SUPPORTED
+ capabilities:
+ link:
+ type: tosca.capabilities.network.Linkable
+ occurrences:
+ - 1
+ - UNBOUNDED
+ tosca.nodes.BlockStorage:
+ derived_from: tosca.nodes.Root
+ properties:
+ size:
+ type: scalar-unit.size
+ required: false
+ status: SUPPORTED
+ constraints:
+ - greater_or_equal: 1 MB
+ volume_id:
+ type: string
+ required: false
+ status: SUPPORTED
+ snapshot_id:
+ type: string
+ required: false
+ status: SUPPORTED
+ capabilities:
+ attachment:
+ type: tosca.capabilities.Attachment
+ occurrences:
+ - 1
+ - UNBOUNDED
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/globalServiceTemplates/NeutronNetGlobalTypesServiceTemplate.yaml b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/globalServiceTemplates/NeutronNetGlobalTypesServiceTemplate.yaml
new file mode 100644
index 0000000000..e80e2727c7
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/globalServiceTemplates/NeutronNetGlobalTypesServiceTemplate.yaml
@@ -0,0 +1,97 @@
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+metadata:
+ template_name: NeutronNetGlobalTypes
+ template_version: 1.0.0
+description: Neutron Network TOSCA Global Types
+imports:
+ common_definitions:
+ file: CommonGlobalTypesServiceTemplate.yaml
+node_types:
+ org.openecomp.resource.vl.nodes.heat.network.neutron.Net:
+ derived_from: tosca.nodes.network.Network
+ properties:
+ dhcp_agent_ids:
+ type: list
+ description: The IDs of the DHCP agent to schedule the network
+ required: false
+ status: SUPPORTED
+ entry_schema:
+ type: string
+ tenant_id:
+ type: string
+ description: The ID of the tenant which will own the network
+ required: false
+ status: SUPPORTED
+ port_security_enabled:
+ type: boolean
+ description: Flag to enable/disable port security on the network
+ required: false
+ status: SUPPORTED
+ shared:
+ type: boolean
+ description: Whether this network should be shared across all tenants
+ required: false
+ default: false
+ status: SUPPORTED
+ admin_state_up:
+ type: boolean
+ description: A boolean value specifying the administrative status of the network
+ required: false
+ default: true
+ status: SUPPORTED
+ qos_policy:
+ type: string
+ description: The name or ID of QoS policy to attach to this network
+ required: false
+ status: SUPPORTED
+ subnets:
+ type: map
+ description: Network related subnets
+ required: false
+ status: SUPPORTED
+ entry_schema:
+ type: org.openecomp.datatypes.heat.network.neutron.Subnet
+ value_specs:
+ type: map
+ description: Extra parameters to include in the request
+ required: false
+ default: {
+ }
+ status: SUPPORTED
+ entry_schema:
+ type: string
+ attributes:
+ qos_policy_id:
+ type: string
+ description: The QoS policy ID attached to this network
+ status: SUPPORTED
+ show:
+ type: string
+ description: Detailed information about resource
+ status: SUPPORTED
+ subnets_name:
+ type: list
+ description: Subnets name of this network
+ status: SUPPORTED
+ entry_schema:
+ type: string
+ subnets:
+ type: map
+ description: Network related subnets
+ status: SUPPORTED
+ entry_schema:
+ type: org.openecomp.datatypes.heat.network.neutron.Subnet
+ mtu:
+ type: scalar-unit.size
+ description: The maximum transmission unit size(in bytes) for the network
+ status: SUPPORTED
+ status:
+ type: string
+ description: The status of the network
+ status: SUPPORTED
+ capabilities:
+ attachment:
+ type: tosca.capabilities.Attachment
+ occurrences:
+ - 1
+ - UNBOUNDED
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/globalServiceTemplates/NeutronPortGlobalTypesServiceTemplate.yaml b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/globalServiceTemplates/NeutronPortGlobalTypesServiceTemplate.yaml
new file mode 100644
index 0000000000..a337d6ed18
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/globalServiceTemplates/NeutronPortGlobalTypesServiceTemplate.yaml
@@ -0,0 +1,151 @@
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+metadata:
+ template_name: NeutronPortGlobalTypes
+ template_version: 1.0.0
+description: Neutron Port TOSCA Global Types
+imports:
+ common_definitions:
+ file: CommonGlobalTypesServiceTemplate.yaml
+data_types:
+ org.openecomp.datatypes.heat.neutron.port.FixedIps:
+ derived_from: tosca.datatypes.Root
+ description: subnet/ip_address
+ properties:
+ subnet:
+ type: string
+ description: Subnet in which to allocate the IP address for this port
+ required: false
+ status: SUPPORTED
+ ip_address:
+ type: string
+ description: IP address desired in the subnet for this port
+ required: false
+ status: SUPPORTED
+node_types:
+ org.openecomp.resource.cp.nodes.heat.network.neutron.Port:
+ derived_from: tosca.nodes.network.Port
+ properties:
+ port_security_enabled:
+ type: boolean
+ description: Flag to enable/disable port security on the network
+ required: false
+ status: SUPPORTED
+ device_id:
+ type: string
+ description: Device ID of this port
+ required: false
+ status: SUPPORTED
+ qos_policy:
+ type: string
+ description: The name or ID of QoS policy to attach to this network
+ required: false
+ status: SUPPORTED
+ allowed_address_pairs:
+ type: list
+ description: Additional MAC/IP address pairs allowed to pass through the port
+ required: false
+ status: SUPPORTED
+ entry_schema:
+ type: org.openecomp.datatypes.heat.network.AddressPair
+ binding:vnic_type:
+ type: string
+ description: The vnic type to be bound on the neutron port
+ required: false
+ status: SUPPORTED
+ constraints:
+ - valid_values:
+ - macvtap
+ - direct
+ - normal
+ value_specs:
+ type: map
+ description: Extra parameters to include in the request
+ required: false
+ default: {
+ }
+ status: SUPPORTED
+ entry_schema:
+ type: string
+ device_owner:
+ type: string
+ description: Name of the network owning the port
+ required: false
+ status: SUPPORTED
+ network:
+ type: string
+ description: Network this port belongs to
+ required: false
+ status: SUPPORTED
+ replacement_policy:
+ type: string
+ description: Policy on how to respond to a stack-update for this resource
+ required: false
+ default: AUTO
+ status: SUPPORTED
+ constraints:
+ - valid_values:
+ - REPLACE_ALWAYS
+ - AUTO
+ security_groups:
+ type: list
+ description: List of security group names or IDs
+ required: false
+ status: SUPPORTED
+ entry_schema:
+ type: string
+ fixed_ips:
+ type: list
+ description: Desired IPs for this port
+ required: false
+ status: SUPPORTED
+ entry_schema:
+ type: org.openecomp.datatypes.heat.neutron.port.FixedIps
+ mac_address:
+ type: string
+ description: MAC address to give to this port
+ required: false
+ status: SUPPORTED
+ admin_state_up:
+ type: boolean
+ description: A boolean value specifying the administrative status of the network
+ required: false
+ default: true
+ status: SUPPORTED
+ name:
+ type: string
+ description: A symbolic name for this port
+ required: false
+ status: SUPPORTED
+ attributes:
+ tenant_id:
+ type: string
+ description: Tenant owning the port
+ status: SUPPORTED
+ network_id:
+ type: string
+ description: Unique identifier for the network owning the port
+ status: SUPPORTED
+ qos_policy_id:
+ type: string
+ description: The QoS policy ID attached to this network
+ status: SUPPORTED
+ show:
+ type: string
+ description: Detailed information about resource
+ status: SUPPORTED
+ subnets:
+ type: list
+ description: Subnets of this network
+ status: SUPPORTED
+ entry_schema:
+ type: string
+ status:
+ type: string
+ description: The status of the network
+ status: SUPPORTED
+ capabilities:
+ attachment:
+ type: tosca.capabilities.Attachment
+ occurrences:
+ - 1
+ - UNBOUNDED \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/globalServiceTemplates/NeutronSecurityRulesGlobalTypesServiceTemplate.yaml b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/globalServiceTemplates/NeutronSecurityRulesGlobalTypesServiceTemplate.yaml
new file mode 100644
index 0000000000..49c9a102c8
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/globalServiceTemplates/NeutronSecurityRulesGlobalTypesServiceTemplate.yaml
@@ -0,0 +1,116 @@
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+metadata:
+ template_name: NeutronSecurityRulesGlobalTypes
+ template_version: 1.0.0
+description: Neutron Security Rules TOSCA Global Types
+imports:
+ common_definitions:
+ file: CommonGlobalTypesServiceTemplate.yaml
+data_types:
+ org.openecomp.datatypes.heat.network.neutron.SecurityRules.Rule:
+ derived_from: tosca.datatypes.Root
+ description: Rules Pairs
+ properties:
+ remote_group_id:
+ type: string
+ description: The remote group ID to be associated with this security group rule
+ required: false
+ status: SUPPORTED
+ protocol:
+ type: string
+ description: The protocol that is matched by the security group rule
+ required: false
+ status: SUPPORTED
+ constraints:
+ - valid_values:
+ - tcp
+ - udp
+ - icmp
+ ethertype:
+ type: string
+ description: Ethertype of the traffic
+ required: false
+ default: IPv4
+ status: SUPPORTED
+ constraints:
+ - valid_values:
+ - IPv4
+ - IPv6
+ port_range_max:
+ type: integer
+ description: 'The maximum port number in the range that is matched by the
+ security group rule. '
+ required: false
+ status: SUPPORTED
+ constraints:
+ - in_range:
+ - 0
+ - 65535
+ remote_ip_prefix:
+ type: string
+ description: The remote IP prefix (CIDR) to be associated with this security group rule
+ required: false
+ status: SUPPORTED
+ remote_mode:
+ type: string
+ description: Whether to specify a remote group or a remote IP prefix
+ required: false
+ default: remote_ip_prefix
+ status: SUPPORTED
+ constraints:
+ - valid_values:
+ - remote_ip_prefix
+ - remote_group_id
+ direction:
+ type: string
+ description: The direction in which the security group rule is applied
+ required: false
+ default: ingress
+ status: SUPPORTED
+ constraints:
+ - valid_values:
+ - egress
+ - ingress
+ port_range_min:
+ type: integer
+ description: The minimum port number in the range that is matched by the security group rule.
+ required: false
+ status: SUPPORTED
+ constraints:
+ - in_range:
+ - 0
+ - 65535
+node_types:
+ org.openecomp.resource.nodes.heat.network.neutron.SecurityRules:
+ derived_from: tosca.nodes.Root
+ properties:
+ description:
+ type: string
+ description: Description of the security group
+ required: false
+ status: SUPPORTED
+ name:
+ type: string
+ description: A symbolic name for this security group, which is not required to be unique.
+ required: false
+ status: SUPPORTED
+ rules:
+ type: list
+ description: List of security group rules
+ required: false
+ status: SUPPORTED
+ entry_schema:
+ type: org.openecomp.datatypes.heat.network.neutron.SecurityRules.Rule
+ attributes:
+ show:
+ type: string
+ description: Detailed information about resource
+ status: SUPPORTED
+ requirements:
+ - port:
+ capability: tosca.capabilities.Attachment
+ node: org.openecomp.resource.cp.nodes.heat.network.neutron.Port
+ relationship: org.openecomp.relationships.AttachesTo
+ occurrences:
+ - 0
+ - UNBOUNDED \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/globalServiceTemplates/NovaServerGlobalTypesServiceTemplate.yaml b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/globalServiceTemplates/NovaServerGlobalTypesServiceTemplate.yaml
new file mode 100644
index 0000000000..2253a1e4af
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/globalServiceTemplates/NovaServerGlobalTypesServiceTemplate.yaml
@@ -0,0 +1,249 @@
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+metadata:
+ template_name: NovaServerGlobalTypes
+ template_version: 1.0.0
+description: Nova Server TOSCA Global Types
+imports:
+ common_definitions:
+ file: CommonGlobalTypesServiceTemplate.yaml
+data_types:
+ org.openecomp.datatypes.heat.novaServer.network.PortExtraProperties:
+ derived_from: tosca.datatypes.Root
+ description: Nova server network expand properties for port
+ properties:
+ port_security_enabled:
+ type: boolean
+ description: Flag to enable/disable port security on the port
+ required: false
+ status: SUPPORTED
+ mac_address:
+ type: string
+ description: MAC address to give to this port
+ required: false
+ status: SUPPORTED
+ admin_state_up:
+ type: boolean
+ description: The administrative state of this port
+ required: false
+ default: true
+ status: SUPPORTED
+ qos_policy:
+ type: string
+ description: The name or ID of QoS policy to attach to this port
+ required: false
+ status: SUPPORTED
+ allowed_address_pairs:
+ type: list
+ description: Additional MAC/IP address pairs allowed to pass through the port
+ required: false
+ status: SUPPORTED
+ entry_schema:
+ type: org.openecomp.datatypes.heat.network.AddressPair
+ binding:vnic_type:
+ type: string
+ description: The vnic type to be bound on the neutron port
+ required: false
+ status: SUPPORTED
+ constraints:
+ - valid_values:
+ - macvtap
+ - direct
+ - normal
+ value_specs:
+ type: map
+ description: Extra parameters to include in the request
+ required: false
+ default: {
+ }
+ status: SUPPORTED
+ entry_schema:
+ type: string
+ org.openecomp.datatypes.heat.novaServer.network.AddressInfo:
+ derived_from: tosca.datatypes.network.NetworkInfo
+ description: Network addresses with corresponding port id
+ properties:
+ port_id:
+ type: string
+ description: Port id
+ required: false
+ status: SUPPORTED
+node_types:
+ org.openecomp.resource.vfc.nodes.heat.nova.Server:
+ derived_from: tosca.nodes.Compute
+ properties:
+ admin_pass:
+ type: string
+ description: The administrator password for the server
+ required: false
+ status: SUPPORTED
+ availability_zone:
+ type: string
+ description: Availability zone to create servers in
+ required: false
+ status: SUPPORTED
+ image:
+ type: string
+ description: The ID or name of the image to boot with
+ required: false
+ status: SUPPORTED
+ image_update_policy:
+ type: string
+ description: Policy on how to apply an image-id update
+ required: false
+ default: REBUILD
+ status: SUPPORTED
+ constraints:
+ - valid_values:
+ - REBUILD_PRESERVE_EPHEMERAL
+ - REPLACE
+ - REBUILD
+ metadata:
+ type: map
+ description: Arbitrary key/value metadata to store for this server
+ required: false
+ status: SUPPORTED
+ constraints:
+ - max_length: 255
+ entry_schema:
+ type: string
+ constraints:
+ - max_length: 255
+ user_data_update_policy:
+ type: string
+ description: Policy on how to apply a user_data update
+ required: false
+ default: REPLACE
+ status: SUPPORTED
+ constraints:
+ - valid_values:
+ - REPLACE
+ - IGNORE
+ flavor_update_policy:
+ type: string
+ description: Policy on how to apply a flavor update
+ required: false
+ default: RESIZE
+ status: SUPPORTED
+ constraints:
+ - valid_values:
+ - RESIZE
+ - REPLACE
+ user_data:
+ type: string
+ description: User data script to be executed by cloud-init
+ required: false
+ default: ''
+ status: SUPPORTED
+ flavor:
+ type: string
+ description: The ID or name of the flavor to boot onto
+ required: true
+ status: SUPPORTED
+ key_name:
+ type: string
+ description: Name of keypair to inject into the server
+ required: false
+ status: SUPPORTED
+ reservation_id:
+ type: string
+ description: A UUID for the set of servers being requested
+ required: false
+ status: SUPPORTED
+ security_groups:
+ type: list
+ description: List of security group names or IDs
+ required: false
+ default: [
+ ]
+ status: SUPPORTED
+ entry_schema:
+ type: string
+ config_drive:
+ type: boolean
+ description: enable config drive on the server
+ required: false
+ status: SUPPORTED
+ personality:
+ type: map
+ description: A map of files to create/overwrite on the server upon boot
+ required: false
+ default: {
+ }
+ status: SUPPORTED
+ entry_schema:
+ type: string
+ software_config_transport:
+ type: string
+ description: How the server should receive the metadata required for software configuration
+ required: false
+ default: POLL_SERVER_CFN
+ status: SUPPORTED
+ constraints:
+ - valid_values:
+ - POLL_SERVER_CFN
+ - POLL_SERVER_HEAT
+ - POLL_TEMP_URL
+ - ZAQAR_MESSAGE
+ user_data_format:
+ type: string
+ description: How the user_data should be formatted for the server
+ required: false
+ default: HEAT_CFNTOOLS
+ status: SUPPORTED
+ constraints:
+ - valid_values:
+ - SOFTWARE_CONFIG
+ - RAW
+ - HEAT_CFNTOOLS
+ diskConfig:
+ type: string
+ description: Control how the disk is partitioned when the server is created
+ required: false
+ status: SUPPORTED
+ constraints:
+ - valid_values:
+ - AUTO
+ - MANUAL
+ name:
+ type: string
+ description: Server name
+ required: false
+ status: SUPPORTED
+ scheduler_hints:
+ type: map
+ description: Arbitrary key-value pairs specified by the client to help boot a server
+ required: false
+ status: SUPPORTED
+ entry_schema:
+ type: string
+ attributes:
+ accessIPv4:
+ type: string
+ description: The manually assigned alternative public IPv4 address of the server
+ status: SUPPORTED
+ addresses:
+ type: map
+ description: A dict of all network addresses with corresponding port_id
+ status: SUPPORTED
+ entry_schema:
+ type: org.openecomp.datatypes.heat.novaServer.network.AddressInfo
+ accessIPv6:
+ type: string
+ description: The manually assigned alternative public IPv6 address of the server
+ status: SUPPORTED
+ instance_name:
+ type: string
+ description: AWS compatible instance name
+ status: SUPPORTED
+ name:
+ type: string
+ description: Name of the server
+ status: SUPPORTED
+ show:
+ type: string
+ description: Detailed information about resource
+ status: SUPPORTED
+ console_urls:
+ type: string
+ description: URLs of servers consoles
+ status: SUPPORTED \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/model/serviceTemplate.yaml b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/model/serviceTemplate.yaml
new file mode 100644
index 0000000000..612bc2d2fa
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/model/serviceTemplate.yaml
@@ -0,0 +1,116 @@
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+metadata:
+ template_name: Test
+ template_author: OPENECOMP
+ template_version: 1.0.0
+description: testing desc tosca service template
+imports:
+ myfile1:
+ file: path1/path2/file1.yaml
+ myfile2:
+ file: path1/path2/file2.yaml
+artifact_types:
+ one_artifact:
+ mime_type: application/java-archive
+ file_ext:
+ - yaml
+ - xml
+node_types:
+ compute_node_type:
+ derived_from: tosca.nodes.Root
+ version: 1.0.0
+ description: tosca compute test
+ properties:
+ cpu_num:
+ type: integer
+ description: Number of CPUs requested for a software node instance
+ required: true
+ default: 1
+ status: SUPPORTED
+ constraints:
+ - greater_or_equal: 5.0
+ - equal: 5
+ - greater_than: 6.02
+ - in_range:
+ - 0
+ - UNBOUNDED
+ attributes:
+ attDef1:
+ type: string
+ default: hi
+ status: SUPPORTED
+ requirements:
+ - re1:
+ capability: tosca.cap1
+ occurrences:
+ - 5
+ - 1
+ capabilities:
+ cap1:
+ type: tosca.cap
+ valid_source_types:
+ - node1
+ - node2
+ occurrences:
+ - 1
+ - UNBOUNDED
+topology_template:
+ description: topologi template descroption
+ inputs:
+ inParam1:
+ type: string
+ description: desc
+ required: false
+ default: my default val
+ constraints:
+ - greater_than: 6
+ - greater_or_equal: 9
+ entry_schema:
+ type: tosca.myType
+ node_templates:
+ firatNodeTemplate:
+ type: nodeTypeRef
+ directives:
+ - selectable
+ - substitutable
+ properties:
+ prop2: '{ get_input: my_mysql_rootpw }'
+ prop1: abcd
+ attributes:
+ att2: '{ get_input: my_mysql_rootpw }'
+ att1: att1Val
+ requirements:
+ - req1:
+ capability: capA
+ node: nodeA
+ relationship: relationB
+ node_filter:
+ properties:
+ propName1:
+ - greater_or_equal: 9
+ propName2:
+ - min_length: 1
+ - max_length: 2
+ occurrences:
+ - 1
+ - 2
+ - req2:
+ capability: capA
+ node: nodeA
+ relationship: relationB
+ capabilities:
+ - cap1:
+ properties:
+ num_cpus: '{ get_input: cpus }'
+ attributes:
+ num_cpus: '66'
+ node_filter:
+ properties:
+ test1:
+ - equal: 1 MB
+ substitution_mappings:
+ node_type: myNodeType.node
+ capabilities:
+ database_endpoint:
+ - database
+ - database_endpoint
diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/model/serviceTemplateHeatExtend.yaml b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/model/serviceTemplateHeatExtend.yaml
new file mode 100644
index 0000000000..4515e3dee3
--- /dev/null
+++ b/openecomp-be/lib/openecomp-tosca-lib/src/test/resources/mock/model/serviceTemplateHeatExtend.yaml
@@ -0,0 +1,117 @@
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+metadata:
+ template_name: Test
+ template_author: OPENECOMP
+ template_version: 1.0.0
+description: testing desc tosca service template
+imports:
+ myfile1:
+ file: path1/path2/file1.yaml
+ myfile2:
+ file: path1/path2/file2.yaml
+artifact_types:
+ one_artifact:
+ mime_type: application/java-archive
+ file_ext:
+ - yaml
+ - xml
+node_types:
+ compute_node_type:
+ derived_from: tosca.nodes.Root
+ version: 1.0.0
+ description: tosca compute test
+ properties:
+ cpu_num:
+ type: integer
+ description: Number of CPUs requested for a software node instance
+ required: true
+ default: 1
+ status: SUPPORTED
+ constraints:
+ - greater_or_equal: 5.0
+ - equal: 5
+ - greater_than: 6.02
+ - in_range:
+ - 0
+ - UNBOUNDED
+ attributes:
+ attDef1:
+ type: string
+ default: hi
+ status: SUPPORTED
+ requirements:
+ - re1:
+ capability: tosca.cap1
+ occurrences:
+ - 5
+ - 1
+ capabilities:
+ cap1:
+ type: tosca.cap
+ valid_source_types:
+ - node1
+ - node2
+ occurrences:
+ - 1
+ - UNBOUNDED
+topology_template:
+ description: topologi template descroption
+ inputs:
+ inParam1:
+ type: string
+ description: desc
+ required: false
+ default: my default val
+ label: my label
+ constraints:
+ - greater_than: 6
+ - greater_or_equal: 9
+ entry_schema:
+ type: tosca.myType
+ node_templates:
+ firatNodeTemplate:
+ type: nodeTypeRef
+ directives:
+ - selectable
+ - substitutable
+ properties:
+ prop2: '{ get_input: my_mysql_rootpw }'
+ prop1: abcd
+ attributes:
+ att2: '{ get_input: my_mysql_rootpw }'
+ att1: att1Val
+ requirements:
+ - req1:
+ capability: capA
+ node: nodeA
+ relationship: relationB
+ node_filter:
+ properties:
+ propName1:
+ - greater_or_equal: 9
+ propName2:
+ - min_length: 1
+ - max_length: 2
+ occurrences:
+ - 1
+ - 2
+ - req2:
+ capability: capA
+ node: nodeA
+ relationship: relationB
+ capabilities:
+ - cap1:
+ properties:
+ num_cpus: '{ get_input: cpus }'
+ attributes:
+ num_cpus: '66'
+ node_filter:
+ properties:
+ test1:
+ - equal: 1 MB
+ substitution_mappings:
+ node_type: myNodeType.node
+ capabilities:
+ database_endpoint:
+ - database
+ - database_endpoint