aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-heat-lib/src
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-heat-lib/src
parent451a3400b76511393c62a444f588a4ed15f4a549 (diff)
push addional code
Change-Id: Ia427bb3460cda3a896f8faced2de69eaf3807b74 Signed-off-by: Michael Lando <ml636r@att.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-heat-lib/src')
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/DefinedHeatParameterTypes.java110
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/HeatBoolean.java96
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/manifest/FileData.java107
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/manifest/ManifestContent.java63
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/manifest/ManifestFile.java43
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Constraint.java78
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Environment.java35
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/GroupTypeValues.java49
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/HeatOrchestrationTemplate.java90
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/HeatPseudoParameters.java61
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/HeatResourcesTypes.java206
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Output.java42
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Parameter.java90
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ParameterGroup.java53
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ParameterType.java42
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/PolicyTypes.java61
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/PropertiesMapKeyTypes.java42
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Resource.java92
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ResourceReferenceFunctions.java44
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ResourceTypeToMessageString.java55
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/structure/Artifact.java105
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/structure/HeatStructureTree.java467
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/structure/ValidationStructureList.java40
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/ErrorCodes.java25
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/HeatConstants.java34
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/HeatStructureUtil.java261
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/manifest/ManifestUtil.java176
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManager.java298
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerUtil.java43
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/datatypes/model/EnvironmentTest.java38
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/datatypes/model/HeatOrchestrationTemplateTest.java122
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/model/envSettings.env36
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/model/testHeat.yml524
33 files changed, 3628 insertions, 0 deletions
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/DefinedHeatParameterTypes.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/DefinedHeatParameterTypes.java
new file mode 100644
index 0000000000..62364e7a11
--- /dev/null
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/DefinedHeatParameterTypes.java
@@ -0,0 +1,110 @@
+/*-
+ * ============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.heat.datatypes;
+
+import org.apache.commons.lang.math.NumberUtils;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+
+public enum DefinedHeatParameterTypes {
+ NUMBER("number"),
+ STRING("string"),
+ COMMA_DELIMITED_LIST("comma_delimited_list"),
+ JSON("json"),
+ BOOLEAN("boolean");
+ // TODO : ASK SEGEV ABOUT STRING
+
+ private static Map<String, DefinedHeatParameterTypes> stringToDefinedType = new HashMap<>();
+
+ static {
+ stringToDefinedType = new HashMap<>();
+ for (DefinedHeatParameterTypes definedHeatParameterType : DefinedHeatParameterTypes.values()) {
+ stringToDefinedType.put(definedHeatParameterType.type, definedHeatParameterType);
+ }
+ }
+
+ private String type;
+
+ DefinedHeatParameterTypes(String type) {
+ this.type = type;
+ }
+
+ public static DefinedHeatParameterTypes findByHeatResource(String type) {
+ return stringToDefinedType.get(type);
+ }
+
+ /**
+ * Is value is from given type boolean.
+ *
+ * @param value the value
+ * @param parameterType the parameter type
+ * @return the boolean
+ */
+ public static boolean isValueIsFromGivenType(Object value, String parameterType) {
+ DefinedHeatParameterTypes definedType = findByHeatResource(parameterType);
+
+ if (Objects.nonNull(definedType)) {
+ switch (definedType) {
+ case NUMBER:
+ return NumberUtils.isNumber(String.valueOf(value));
+
+ case BOOLEAN:
+ return HeatBoolean.isValueBoolean(value);
+
+ case COMMA_DELIMITED_LIST:
+ String valAsString = String.valueOf(value);
+ return valAsString.split(",") instanceof String[];
+
+ case JSON:
+ return (value instanceof Map) || (value instanceof List);
+
+ case STRING:
+ //return value instanceof String;
+ return true;
+
+ default:
+ // return false;
+ }
+ }
+
+ return false;
+ }
+
+ public static boolean isNovaServerEnvValueIsFromRightType(Object value) {
+ return isValueIsFromGivenType(value, COMMA_DELIMITED_LIST.getType())
+ || isValueIsFromGivenType(value, STRING.getType());
+ }
+
+ public static boolean isEmptyValueInEnv(Object value) {
+ return Objects.isNull(value);
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/HeatBoolean.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/HeatBoolean.java
new file mode 100644
index 0000000000..249dcaf4a5
--- /dev/null
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/HeatBoolean.java
@@ -0,0 +1,96 @@
+/*-
+ * ============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.heat.datatypes;
+
+import org.openecomp.sdc.common.errors.CoreException;
+import org.openecomp.sdc.common.errors.ErrorCategory;
+import org.openecomp.sdc.common.errors.ErrorCode;
+import org.openecomp.sdc.heat.services.ErrorCodes;
+
+import java.util.HashSet;
+import java.util.Set;
+
+public class HeatBoolean {
+
+ private static Set<Object> heatFalse;
+ private static Set<Object> heatTrue;
+
+ static {
+
+
+ heatFalse = new HashSet<>();
+ heatFalse.add("f");
+ heatFalse.add(false);
+ heatFalse.add("false");
+ heatFalse.add("off");
+ heatFalse.add("n");
+ heatFalse.add("no");
+ heatFalse.add(0);
+
+ heatTrue = new HashSet<>();
+ heatTrue.add("t");
+ heatTrue.add(true);
+ heatTrue.add("true");
+ heatTrue.add("on");
+ heatTrue.add("y");
+ heatTrue.add("yes");
+ heatTrue.add(1);
+
+ }
+
+ /**
+ * Eval boolean.
+ *
+ * @param value the value
+ * @return the boolean
+ */
+ public static Boolean eval(Object value) {
+
+ if (value instanceof String) {
+ value = (String) ((String) value).toLowerCase();
+ }
+ if (heatFalse.contains(value)) {
+ return false;
+ } else if (heatTrue.contains(value)) {
+ return true;
+ } else {
+ throw new CoreException((new ErrorCode.ErrorCodeBuilder()).withId(ErrorCodes.INVALID_BOOLEAN)
+ .withCategory(ErrorCategory.APPLICATION)
+ .withMessage("Invalid boolean value [" + value + "].").build());
+ }
+
+ }
+
+ /**
+ * Is value boolean boolean.
+ *
+ * @param value the value
+ * @return the boolean
+ */
+ public static boolean isValueBoolean(Object value) {
+ try {
+ Boolean answer = eval(value);
+ return true;
+ } catch (CoreException ce) {
+ return false;
+ }
+ }
+}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/manifest/FileData.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/manifest/FileData.java
new file mode 100644
index 0000000000..728b714868
--- /dev/null
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/manifest/FileData.java
@@ -0,0 +1,107 @@
+/*-
+ * ============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.heat.datatypes.manifest;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.function.Predicate;
+
+public class FileData {
+
+ public static Set<Type> heatFileTypes =
+ new HashSet<>(Arrays.asList(Type.HEAT, Type.HEAT_NET, Type.HEAT_VOL));
+ private Boolean isBase;
+ private String file;
+ private Type type;
+ private List<FileData> data;
+
+ public static Predicate<FileData> buildFileDataPredicateByType(Type... types) {
+ return fileData -> Arrays.asList(types).contains(fileData.getType());
+ }
+
+ public static boolean isHeatFile(Type type) {
+ return heatFileTypes.contains(type);
+ }
+
+ public Boolean getBase() {
+ return isBase;
+ }
+
+ public void setBase(Boolean base) {
+ isBase = base;
+ }
+
+ public String getFile() {
+ return file;
+ }
+
+ public void setFile(String file) {
+ this.file = file;
+ }
+
+ public Type getType() {
+ return type;
+ }
+
+ public void setType(Type type) {
+ this.type = type;
+ }
+
+ public List<FileData> getData() {
+ return data;
+ }
+
+ public void setData(List<FileData> data) {
+ this.data = data;
+ }
+
+ public enum Type {
+
+ HEAT("HEAT"),
+ HEAT_ENV("HEAT_ENV"),
+ HEAT_NET("HEAT_NET"),
+ HEAT_VOL("HEAT_VOL"),
+ CHEF("CHEF"),
+ PUPPET("PUPPET"),
+ SHELL("SHELL"),
+ YANG("YANG"),
+ YANG_XML("YANG_XML"),
+ BPEL("BPEL"),
+ DG_XML("DG_XML"),
+ MURANO_PKG("MURANO_PKG"),
+ VENDOR_LICENSE("VENDOR_LICENSE"),
+ VF_LICENSE("VF_LICENSE"),
+ OTHER("OTHER");
+
+ private String displayName;
+
+ Type(String displayName) {
+ this.displayName = displayName;
+ }
+
+ public String getDisplayName() {
+ return displayName;
+ }
+
+ }
+}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/manifest/ManifestContent.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/manifest/ManifestContent.java
new file mode 100644
index 0000000000..d89717125a
--- /dev/null
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/manifest/ManifestContent.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.heat.datatypes.manifest;
+
+import java.util.List;
+
+public class ManifestContent {
+
+ String name;
+ String description;
+ String version;
+ List<FileData> data;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ public List<FileData> getData() {
+ return data;
+ }
+
+ public void setData(List<FileData> data) {
+ this.data = data;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/manifest/ManifestFile.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/manifest/ManifestFile.java
new file mode 100644
index 0000000000..607f52a86d
--- /dev/null
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/manifest/ManifestFile.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.heat.datatypes.manifest;
+
+public class ManifestFile {
+
+ String name;
+ ManifestContent content;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public ManifestContent getContent() {
+ return content;
+ }
+
+ public void setContent(ManifestContent content) {
+ this.content = content;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Constraint.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Constraint.java
new file mode 100644
index 0000000000..8aad825055
--- /dev/null
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Constraint.java
@@ -0,0 +1,78 @@
+/*-
+ * ============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.heat.datatypes.model;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class Constraint {
+ private Object[] length;
+ private Integer[] range;
+ private List<Object> valid_values;
+ private String pattern;
+
+ public Constraint() {
+ }
+
+ public Integer[] getRange() {
+ return range;
+ }
+
+ public void setRange(Integer[] inRange) {
+ this.range = new Integer[]{inRange[0], 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 Object[] getLength() {
+ return length;
+ }
+
+ public void setLength(Object[] length) {
+ this.length = length;
+ }
+
+ public String getPattern() {
+ return pattern;
+ }
+
+ public void setPattern(String pattern) {
+ this.pattern = pattern;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Environment.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Environment.java
new file mode 100644
index 0000000000..b2f45d06d9
--- /dev/null
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Environment.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.heat.datatypes.model;
+
+import java.util.Map;
+
+public class Environment {
+ Map<String, Object> parameters;
+
+ public Map<String, Object> getParameters() {
+ return parameters;
+ }
+
+ public void setParameters(Map<String, Object> parameters) {
+ this.parameters = parameters;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/GroupTypeValues.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/GroupTypeValues.java
new file mode 100644
index 0000000000..84259b1807
--- /dev/null
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/GroupTypeValues.java
@@ -0,0 +1,49 @@
+/*-
+ * ============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.heat.datatypes.model;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public enum GroupTypeValues {
+ EXCLUSIVITY("exclusivity"),
+ AFFINITY("affinity"),
+ DIVERSITY("diversity");
+
+ private static List<String> groupTypeAsStrings;
+
+ static {
+ groupTypeAsStrings = new ArrayList<>();
+ for (GroupTypeValues attGroupTypeValue : GroupTypeValues.values()) {
+ groupTypeAsStrings.add(attGroupTypeValue.groupTypeValue);
+ }
+ }
+
+ private String groupTypeValue;
+
+ GroupTypeValues(String groupTypeValue) {
+ this.groupTypeValue = groupTypeValue;
+ }
+
+ public static boolean isGroupTypeValid(String groupType) {
+ return groupTypeAsStrings.contains(groupType);
+ }
+}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/HeatOrchestrationTemplate.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/HeatOrchestrationTemplate.java
new file mode 100644
index 0000000000..4170d35d7a
--- /dev/null
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/HeatOrchestrationTemplate.java
@@ -0,0 +1,90 @@
+/*-
+ * ============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.heat.datatypes.model;
+
+import java.util.List;
+import java.util.Map;
+
+public class HeatOrchestrationTemplate {
+ String heat_template_version;
+ String description;
+ List<ParameterGroup> parameter_groups;
+ Map<String, Parameter> parameters;
+ Map<String, Resource> resources;
+ Map<String, Output> outputs;
+ Map<String, Object> conditions;
+
+ public String getHeat_template_version() {
+ return heat_template_version;
+ }
+
+ public void setHeat_template_version(String heatTemplateVersion) {
+ this.heat_template_version = heatTemplateVersion;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public List<ParameterGroup> getParameter_groups() {
+ return parameter_groups;
+ }
+
+ public void setParameter_groups(List<ParameterGroup> parameterGroups) {
+ this.parameter_groups = parameterGroups;
+ }
+
+ public Map<String, Parameter> getParameters() {
+ return parameters;
+ }
+
+ public void setParameters(Map<String, Parameter> parameters) {
+ this.parameters = parameters;
+ }
+
+ public Map<String, Resource> getResources() {
+ return resources;
+ }
+
+ public void setResources(Map<String, Resource> resources) {
+ this.resources = resources;
+ }
+
+ public Map<String, Output> getOutputs() {
+ return outputs;
+ }
+
+ public void setOutputs(Map<String, Output> outputs) {
+ this.outputs = outputs;
+ }
+
+ public Map<String, Object> getConditions() {
+ return conditions;
+ }
+
+ public void setConditions(Map<String, Object> conditions) {
+ this.conditions = conditions;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/HeatPseudoParameters.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/HeatPseudoParameters.java
new file mode 100644
index 0000000000..c822a78a93
--- /dev/null
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/HeatPseudoParameters.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.heat.datatypes.model;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public enum HeatPseudoParameters {
+ OS_STACK_NAME("OS::stack_name"),
+ OS_STACK_ID("OS::stack_id"),
+ OS_PROJECT_ID("OS::project_id");
+
+ private static List<String> pseudoParameterNames;
+
+ static {
+ pseudoParameterNames = new ArrayList<>();
+ for (HeatPseudoParameters parameter : HeatPseudoParameters.values()) {
+ pseudoParameterNames.add(parameter.getPseudoParameter());
+ }
+ }
+
+ private String pseudoParameter;
+
+ HeatPseudoParameters(String pseudoParameter) {
+ this.pseudoParameter = pseudoParameter;
+ }
+
+ public static List<String> getPseudoParameterNames() {
+ return pseudoParameterNames;
+ }
+
+ public static void setPseudoParameterNames(List<String> pseudoParameterNames) {
+ HeatPseudoParameters.pseudoParameterNames = pseudoParameterNames;
+ }
+
+ public String getPseudoParameter() {
+ return pseudoParameter;
+ }
+
+ public void setPseudoParameter(String pseudoParameter) {
+ this.pseudoParameter = pseudoParameter;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/HeatResourcesTypes.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/HeatResourcesTypes.java
new file mode 100644
index 0000000000..d4adfe7d32
--- /dev/null
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/HeatResourcesTypes.java
@@ -0,0 +1,206 @@
+/*-
+ * ============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.heat.datatypes.model;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+
+/**
+ * The enum Heat resources types.
+ */
+public enum HeatResourcesTypes {
+ /**
+ * Nova server resource type heat resources types.
+ */
+ NOVA_SERVER_RESOURCE_TYPE("OS::Nova::Server"),
+ /**
+ * Nova server group resource type heat resources types.
+ */
+ NOVA_SERVER_GROUP_RESOURCE_TYPE("OS::Nova::ServerGroup"),
+ /**
+ * Neutron port resource type heat resources types.
+ */
+ NEUTRON_PORT_RESOURCE_TYPE("OS::Neutron::Port"),
+ /**
+ * Contrail network rule resource type heat resources types.
+ */
+ CONTRAIL_NETWORK_RULE_RESOURCE_TYPE("OS::Contrail::NetworkPolicy"),
+ /**
+ * Contrail network attach rule resource type heat resources types.
+ */
+ CONTRAIL_NETWORK_ATTACH_RULE_RESOURCE_TYPE("OS::Contrail::AttachPolicy"),
+ /**
+ * Contrail virtual network resource type heat resources types.
+ */
+ CONTRAIL_VIRTUAL_NETWORK_RESOURCE_TYPE("OS::Contrail::VirtualNetwork"),
+ /**
+ * Cinder volume resource type heat resources types.
+ */
+ CINDER_VOLUME_RESOURCE_TYPE("OS::Cinder::Volume"),
+ /**
+ * Cinder volume attachment resource type heat resources types.
+ */
+ CINDER_VOLUME_ATTACHMENT_RESOURCE_TYPE("OS::Cinder::VolumeAttachment"),
+ /**
+ * Neutron net resource type heat resources types.
+ */
+ NEUTRON_NET_RESOURCE_TYPE("OS::Neutron::Net"),
+ /**
+ * Neutron subnet resource type heat resources types.
+ */
+ NEUTRON_SUBNET_RESOURCE_TYPE("OS::Neutron::Subnet"),
+ /**
+ * Neutron security group resource type heat resources types.
+ */
+ NEUTRON_SECURITY_GROUP_RESOURCE_TYPE("OS::Neutron::SecurityGroup"),
+ /**
+ * Heat software config type heat resources types.
+ */
+ HEAT_SOFTWARE_CONFIG_TYPE("OS::Heat::SoftwareConfig"),
+ /**
+ * Heat cloud config type heat resources types.
+ */
+ HEAT_CLOUD_CONFIG_TYPE("OS::Heat::CloudConfig"),
+ /**
+ * Heat multipart mime type heat resources types.
+ */
+ HEAT_MULTIPART_MIME_TYPE("OS::Heat::MultipartMime"),
+ /**
+ * Heat contrail network ipam type heat resources types.
+ */
+ HEAT_CONTRAIL_NETWORK_IPAM_TYPE("OS::Contrail::NetworkIpam"),
+ /**
+ * Contrail v 2 virtual network resource type heat resources types.
+ */
+ CONTRAIL_V2_VIRTUAL_NETWORK_RESOURCE_TYPE("OS::ContrailV2::VirtualNetwork"),
+ /**
+ * Contrail v 2 virtual machine interface resource type heat resources types.
+ */
+ CONTRAIL_V2_VIRTUAL_MACHINE_INTERFACE_RESOURCE_TYPE("OS::ContrailV2::VirtualMachineInterface"),
+ /**
+ * Contrail service template heat resources types.
+ */
+ CONTRAIL_SERVICE_TEMPLATE("OS::Contrail::ServiceTemplate"),
+ /**
+ * Contrail service instance heat resources types.
+ */
+ CONTRAIL_SERVICE_INSTANCE("OS::Contrail::ServiceInstance"),
+ /**
+ * Contrail v 2 network rule resource type heat resources types.
+ */
+ CONTRAIL_V2_NETWORK_RULE_RESOURCE_TYPE("OS::ContrailV2::NetworkPolicy"),
+ /**
+ * Resource group resource type heat resources types.
+ */
+ RESOURCE_GROUP_RESOURCE_TYPE("OS::Heat::ResourceGroup");
+
+ private static Map<String, HeatResourcesTypes> stringToHeatResourceTypeMap;
+
+ static {
+ stringToHeatResourceTypeMap = new HashMap<>();
+
+ for (HeatResourcesTypes type : HeatResourcesTypes.values()) {
+ stringToHeatResourceTypeMap.put(type.heatResource, type);
+ }
+ }
+
+ private String heatResource;
+
+
+ HeatResourcesTypes(String heatResource) {
+ this.heatResource = heatResource;
+ }
+
+ /**
+ * Find by heat resource heat resources types.
+ *
+ * @param heatResource the heat resource
+ * @return the heat resources types
+ */
+ public static HeatResourcesTypes findByHeatResource(String heatResource) {
+ return stringToHeatResourceTypeMap.get(heatResource);
+ }
+
+ /**
+ * Is resource type valid boolean.
+ *
+ * @param resourceType the resource type
+ * @return the boolean
+ */
+ public static boolean isResourceTypeValid(String resourceType) {
+ return Objects.nonNull(findByHeatResource(resourceType));
+ }
+
+ /**
+ * Is resource expected to be exposed boolean.
+ *
+ * @param resourceType the resource type
+ * @return the boolean
+ */
+ public static boolean isResourceExpectedToBeExposed(String resourceType) {
+ return (resourceType.equals(NOVA_SERVER_GROUP_RESOURCE_TYPE.getHeatResource())
+ || resourceType.equals(CONTRAIL_VIRTUAL_NETWORK_RESOURCE_TYPE.getHeatResource())
+ || resourceType.equals(NEUTRON_NET_RESOURCE_TYPE.getHeatResource())
+ || resourceType.equals(CINDER_VOLUME_RESOURCE_TYPE.getHeatResource())
+ || resourceType.equals(NEUTRON_SECURITY_GROUP_RESOURCE_TYPE.getHeatResource())
+ );
+ }
+
+ /**
+ * Gets list for resource type.
+ *
+ * @param types the types
+ * @return the list for resource type
+ */
+ public static Map<HeatResourcesTypes, List<String>> getListForResourceType(
+ HeatResourcesTypes... types) {
+ Map<HeatResourcesTypes, List<String>> result = new HashMap<>();
+
+ for (HeatResourcesTypes type : types) {
+ result.put(type, new ArrayList<>());
+ }
+
+ return result;
+ }
+
+ /**
+ * Gets heat resource.
+ *
+ * @return the heat resource
+ */
+ public String getHeatResource() {
+
+ return heatResource;
+ }
+
+ /**
+ * Sets heat resource.
+ *
+ * @param heatResource the heat resource
+ */
+ public void setHeatResource(String heatResource) {
+ this.heatResource = heatResource;
+ }
+
+}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Output.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Output.java
new file mode 100644
index 0000000000..8222edded2
--- /dev/null
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Output.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.heat.datatypes.model;
+
+public class Output {
+ String description;
+ Object value;
+
+ 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;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Parameter.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Parameter.java
new file mode 100644
index 0000000000..63681cc80c
--- /dev/null
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Parameter.java
@@ -0,0 +1,90 @@
+/*-
+ * ============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.heat.datatypes.model;
+
+import java.util.List;
+import java.util.Map;
+
+public class Parameter {
+ String type;
+ String label;
+ String description;
+ Object _default;
+ boolean hidden;
+ List<Map<String, Object>> constraints;
+ boolean immutable;
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ public void setLabel(String label) {
+ this.label = label;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public Object get_default() {
+ return _default;
+ }
+
+ public void set_default(Object defaultValue) {
+ this._default = defaultValue;
+ }
+
+ public boolean isHidden() {
+ return hidden;
+ }
+
+ public void setHidden(boolean hidden) {
+ this.hidden = hidden;
+ }
+
+ public List<Map<String, Object>> getConstraints() {
+ return constraints;
+ }
+
+ public void setConstraints(List<Map<String, Object>> constraints) {
+ this.constraints = constraints;
+ }
+
+ public boolean isImmutable() {
+ return immutable;
+ }
+
+ public void setImmutable(boolean immutable) {
+ this.immutable = immutable;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ParameterGroup.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ParameterGroup.java
new file mode 100644
index 0000000000..8ab066f4a4
--- /dev/null
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ParameterGroup.java
@@ -0,0 +1,53 @@
+/*-
+ * ============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.heat.datatypes.model;
+
+import java.util.List;
+
+public class ParameterGroup {
+ String label;
+ String description;
+ List<String> parameters;
+
+ public String getLabel() {
+ return label;
+ }
+
+ public void setLabel(String label) {
+ this.label = label;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public List<String> getParameters() {
+ return parameters;
+ }
+
+ public void setParameters(List<String> parameters) {
+ this.parameters = parameters;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ParameterType.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ParameterType.java
new file mode 100644
index 0000000000..37c430ec36
--- /dev/null
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ParameterType.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.heat.datatypes.model;
+
+public enum ParameterType {
+
+ STRING("string"),
+ NUMBER("number"),
+ JSON("json"),
+ BOOLEAN("boolean"),
+ COMMA_DELIMITED_LIST("comma_delimited_list");
+
+ private String displayName;
+
+ ParameterType(String displayName) {
+ this.displayName = displayName;
+ }
+
+ public String getDisplayName() {
+ return displayName;
+ }
+
+
+}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/PolicyTypes.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/PolicyTypes.java
new file mode 100644
index 0000000000..3195e61fe5
--- /dev/null
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/PolicyTypes.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.heat.datatypes.model;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+
+public enum PolicyTypes {
+ AFFINITY("affinity"),
+ ANTI_AFFINITY("anti-affinity");
+
+ private static Map<String, PolicyTypes> stringToPolicyTypesMap;
+
+ static {
+ stringToPolicyTypesMap = new HashMap<>();
+ for (PolicyTypes type : PolicyTypes.values()) {
+ stringToPolicyTypesMap.put(type.policy, type);
+ }
+ }
+
+ private String policy;
+
+ PolicyTypes(String policy) {
+ this.policy = policy;
+ }
+
+ public static PolicyTypes findByPolicy(String policy) {
+ return stringToPolicyTypesMap.get(policy);
+ }
+
+ public static boolean isGivenPolicyValid(String policyToCheck) {
+ return Objects.nonNull(findByPolicy(policyToCheck));
+ }
+
+ public String getPolicy() {
+ return policy;
+ }
+
+ public void setPolicy(String policy) {
+ this.policy = policy;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/PropertiesMapKeyTypes.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/PropertiesMapKeyTypes.java
new file mode 100644
index 0000000000..e8d43fc10c
--- /dev/null
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/PropertiesMapKeyTypes.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.heat.datatypes.model;
+
+public enum PropertiesMapKeyTypes {
+ IMAGE("image"),
+ FLAVOR("flavor"),
+ NETWORKS("networks"),
+ RESOURCE_DEF("resource_def");
+
+ private String keyMap;
+
+ PropertiesMapKeyTypes(String keyMap) {
+ this.keyMap = keyMap;
+ }
+
+ public String getKeyMap() {
+ return keyMap;
+ }
+
+ public void setKeyMap(String keyMap) {
+ this.keyMap = keyMap;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Resource.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Resource.java
new file mode 100644
index 0000000000..f4c3cd91cb
--- /dev/null
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/Resource.java
@@ -0,0 +1,92 @@
+/*-
+ * ============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.heat.datatypes.model;
+
+import java.util.Map;
+
+public class Resource {
+ String type;
+ Map<String, Object> properties;
+ Object metadata;
+ Object depends_on;
+ Object update_policy;
+ Object deletion_policy;
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public Map<String, Object> getProperties() {
+ return properties;
+ }
+
+ public void setProperties(Map<String, Object> properties) {
+ this.properties = properties;
+ }
+
+ public Object getMetadata() {
+ return metadata;
+ }
+
+ public void setMetadata(Object metadata) {
+ this.metadata = metadata;
+ }
+
+ public Object getDepends_on() {
+ return depends_on;
+ }
+
+ public void setDepends_on(Object dependsOn) {
+ this.depends_on = dependsOn;
+ }
+
+ public Object getUpdate_policy() {
+ return update_policy;
+ }
+
+ public void setUpdate_policy(Object updatePolicy) {
+ this.update_policy = updatePolicy;
+ }
+
+ public Object getDeletion_policy() {
+ return deletion_policy;
+ }
+
+ public void setDeletion_policy(Object deletionPolicy) {
+ this.deletion_policy = deletionPolicy;
+ }
+
+ @Override
+ public String toString() {
+ return "Resource{"
+ + "type='" + type + '\''
+ + ", properties=" + properties
+ + ", metadata=" + metadata
+ + ", depends_on=" + depends_on
+ + ", update_policy='" + update_policy + '\''
+ + ", deletion_policy='" + deletion_policy + '\''
+ + '}';
+ }
+}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ResourceReferenceFunctions.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ResourceReferenceFunctions.java
new file mode 100644
index 0000000000..b36d130597
--- /dev/null
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ResourceReferenceFunctions.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.heat.datatypes.model;
+
+public enum ResourceReferenceFunctions {
+ GET_RESOURCE("get_resource"),
+ GET_PARAM("get_param"),
+ GET_ATTR("get_attr"),
+ GET_FILE("get_file"),
+ SCHEDULER_HINTS("scheduler_hints");
+
+
+ private String function;
+
+ ResourceReferenceFunctions(String function) {
+ this.function = function;
+ }
+
+ public String getFunction() {
+ return function;
+ }
+
+ public void setFunction(String function) {
+ this.function = function;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ResourceTypeToMessageString.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ResourceTypeToMessageString.java
new file mode 100644
index 0000000000..d7ede70942
--- /dev/null
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/model/ResourceTypeToMessageString.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.heat.datatypes.model;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public enum ResourceTypeToMessageString {
+ SERVER_GROUP(HeatResourcesTypes.NOVA_SERVER_GROUP_RESOURCE_TYPE, "ServerGroup"),
+ SECURITY_GROUP(HeatResourcesTypes.NEUTRON_SECURITY_GROUP_RESOURCE_TYPE, "SecurityGroup"),
+ NETWORK_POLICY(HeatResourcesTypes.CONTRAIL_NETWORK_RULE_RESOURCE_TYPE, "NetworkPolicy");
+
+ private static Map<HeatResourcesTypes, String> resourcesTypesStringMap;
+
+ static {
+ resourcesTypesStringMap = new HashMap<>();
+
+ for (ResourceTypeToMessageString resourceTypeToMessageString : ResourceTypeToMessageString
+ .values()) {
+ resourcesTypesStringMap
+ .put(resourceTypeToMessageString.type, resourceTypeToMessageString.messageString);
+ }
+ }
+
+ private String messageString;
+ private HeatResourcesTypes type;
+
+
+ ResourceTypeToMessageString(HeatResourcesTypes type, String messgageString) {
+ this.type = type;
+ this.messageString = messgageString;
+ }
+
+ public static String getTypeForMessageFromResourceType(HeatResourcesTypes type) {
+ return resourcesTypesStringMap.get(type);
+ }
+}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/structure/Artifact.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/structure/Artifact.java
new file mode 100644
index 0000000000..b5c263f545
--- /dev/null
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/structure/Artifact.java
@@ -0,0 +1,105 @@
+/*-
+ * ============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.heat.datatypes.structure;
+
+
+import org.openecomp.sdc.datatypes.error.ErrorMessage;
+import org.openecomp.sdc.heat.datatypes.manifest.FileData;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class Artifact implements Comparable<Artifact> {
+
+ private String fileName;
+ private FileData.Type type;
+ private List<ErrorMessage> errors;
+
+ public Artifact(String fileName, FileData.Type type) {
+ this.fileName = fileName;
+ this.type = type;
+ }
+
+
+ public String getFileName() {
+ return fileName;
+ }
+
+ public void setFileName(String name) {
+ this.fileName = name;
+ }
+
+
+ public FileData.Type getType() {
+ return type;
+ }
+
+ public List<ErrorMessage> getErrors() {
+ return errors;
+ }
+
+ public void setErrors(List<ErrorMessage> errors) {
+ this.errors = errors;
+ }
+
+ /**
+ * Add error to error list.
+ *
+ * @param error the error
+ */
+ public void addErrorToErrorList(ErrorMessage error) {
+ if (this.errors == null || this.errors.isEmpty()) {
+ this.errors = new ArrayList<>();
+ }
+
+ this.errors.add(error);
+ }
+
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null || getClass() != obj.getClass()) {
+ return false;
+ }
+
+ Artifact artifact = (Artifact) obj;
+
+ if (!fileName.equals(artifact.fileName)) {
+ return false;
+ }
+ return true;
+
+ }
+
+ @Override
+ public int hashCode() {
+ int result = fileName.hashCode();
+ return result;
+ }
+
+ @Override
+ public int compareTo(Artifact artifact) {
+ return artifact.getFileName().compareTo(this.getFileName());
+ }
+}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/structure/HeatStructureTree.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/structure/HeatStructureTree.java
new file mode 100644
index 0000000000..c86425fd43
--- /dev/null
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/structure/HeatStructureTree.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.heat.datatypes.structure;
+
+
+import org.codehaus.jackson.annotate.JsonProperty;
+import org.openecomp.sdc.datatypes.error.ErrorMessage;
+import org.openecomp.sdc.heat.datatypes.manifest.FileData;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
+
+/**
+ * The type Heat structure tree.
+ */
+public class HeatStructureTree implements Comparable<HeatStructureTree> {
+
+ private String fileName;
+ private FileData.Type type;
+ private Boolean isBase;
+ private HeatStructureTree env;
+ private List<ErrorMessage> errors;
+ private Set<HeatStructureTree> HEAT;
+ private Set<HeatStructureTree> volume;
+ private Set<HeatStructureTree> network;
+ private Set<HeatStructureTree> nested;
+ private Set<HeatStructureTree> other;
+ private Set<Artifact> artifacts;
+
+ /**
+ * Instantiates a new Heat structure tree.
+ */
+ public HeatStructureTree() {
+ }
+
+ ;
+
+ /**
+ * Instantiates a new Heat structure tree.
+ *
+ * @param fileName the file name
+ * @param isBase the is base
+ */
+ public HeatStructureTree(String fileName, boolean isBase) {
+ setBase(isBase);
+ setFileName(fileName);
+ }
+
+ /**
+ * Gets heat structure tree by name.
+ *
+ * @param filesSet the files set
+ * @param filename the filename
+ * @return the heat structure tree by name
+ */
+ public static HeatStructureTree getHeatStructureTreeByName(Set<HeatStructureTree> filesSet,
+ String filename) {
+ for (HeatStructureTree heatStructureTree : filesSet) {
+ if (heatStructureTree.getFileName().equals(filename)) {
+ return heatStructureTree;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Sets type.
+ *
+ * @param type the type
+ */
+ public void setType(FileData.Type type) {
+ this.type = type;
+ }
+
+ /**
+ * Gets base.
+ *
+ * @return the base
+ */
+ public Boolean getBase() {
+ return isBase;
+ }
+
+ /**
+ * Sets base.
+ *
+ * @param base the base
+ */
+ public void setBase(Boolean base) {
+ isBase = base;
+ }
+
+ /**
+ * Gets file name.
+ *
+ * @return the file name
+ */
+ public String getFileName() {
+ return fileName;
+ }
+
+ /**
+ * Sets file name.
+ *
+ * @param file the file
+ */
+ public void setFileName(String file) {
+ this.fileName = file;
+ }
+
+ /**
+ * Gets heat.
+ *
+ * @return the heat
+ */
+ @JsonProperty(value = "HEAT")
+ public Set<HeatStructureTree> getHEAT() {
+ return HEAT;
+ }
+
+ /**
+ * Sets heat.
+ *
+ * @param heat the heat
+ */
+ public void setHEAT(Set<HeatStructureTree> heat) {
+ this.HEAT = heat;
+ }
+
+ /**
+ * Gets nested.
+ *
+ * @return the nested
+ */
+ public Set<HeatStructureTree> getNested() {
+ return nested;
+ }
+
+ /**
+ * Sets nested.
+ *
+ * @param nested the nested
+ */
+ public void setNested(Set<HeatStructureTree> nested) {
+ this.nested = nested;
+ }
+
+ /**
+ * Gets artifacts.
+ *
+ * @return the artifacts
+ */
+ public Set<Artifact> getArtifacts() {
+ return artifacts;
+ }
+
+ /**
+ * Sets artifacts.
+ *
+ * @param artifacts the artifacts
+ */
+ public void setArtifacts(Set<Artifact> artifacts) {
+ this.artifacts = artifacts;
+ }
+
+ /**
+ * Add heat structure tree to nested heat list.
+ *
+ * @param heatStructureTree the heat structure tree
+ */
+ public void addHeatStructureTreeToNestedHeatList(HeatStructureTree heatStructureTree) {
+ if (this.nested == null) {
+ this.nested = new TreeSet<>();
+ }
+ if (!findItemInSetByName(this.nested, heatStructureTree)) {
+ this.nested.add(heatStructureTree);
+ }
+ }
+
+ /**
+ * Add artifact to artifact list.
+ *
+ * @param artifact the artifact
+ */
+ public void addArtifactToArtifactList(Artifact artifact) {
+ if (this.artifacts == null || this.artifacts.isEmpty()) {
+ this.artifacts = new TreeSet<>();
+ }
+ this.artifacts.add(artifact);
+ }
+
+ /**
+ * Gets env.
+ *
+ * @return the env
+ */
+ public HeatStructureTree getEnv() {
+ return env;
+ }
+
+ /**
+ * Sets env.
+ *
+ * @param env the env
+ */
+ public void setEnv(HeatStructureTree env) {
+ this.env = env;
+ }
+
+ /**
+ * Gets volume.
+ *
+ * @return the volume
+ */
+ public Set<HeatStructureTree> getVolume() {
+ return volume;
+ }
+
+ /**
+ * Sets volume.
+ *
+ * @param volume the volume
+ */
+ public void setVolume(Set<HeatStructureTree> volume) {
+ this.volume = volume;
+ }
+
+ /**
+ * Gets network.
+ *
+ * @return the network
+ */
+ public Set<HeatStructureTree> getNetwork() {
+ return network;
+ }
+
+ /**
+ * Sets network.
+ *
+ * @param network the network
+ */
+ public void setNetwork(Set<HeatStructureTree> network) {
+ this.network = network;
+ }
+
+ /**
+ * Add network to network list.
+ *
+ * @param heatStructureTree the heat structure tree
+ */
+ public void addNetworkToNetworkList(HeatStructureTree heatStructureTree) {
+ if (this.network == null) {
+ this.network = new TreeSet<>();
+ }
+ if (!findItemInSetByName(this.network, heatStructureTree)) {
+ this.network.add(heatStructureTree);
+ }
+ }
+
+ /**
+ * Add volume file to volume list.
+ *
+ * @param heatStructureTree the heat structure tree
+ */
+ public void addVolumeFileToVolumeList(HeatStructureTree heatStructureTree) {
+ if (this.volume == null) {
+ this.volume = new TreeSet<>();
+ }
+ if (!findItemInSetByName(this.volume, heatStructureTree)) {
+ this.volume.add(heatStructureTree);
+ }
+ }
+
+ /**
+ * Add heat to heat list.
+ *
+ * @param heat the heat
+ */
+ public void addHeatToHEATList(HeatStructureTree heat) {
+ if (this.HEAT == null) {
+ this.HEAT = new TreeSet<>();
+ }
+
+ this.HEAT.add(heat);
+ }
+
+ /**
+ * Add other to other list.
+ *
+ * @param other the other
+ */
+ public void addOtherToOtherList(HeatStructureTree other) {
+ if (this.other == null) {
+ this.other = new TreeSet<>();
+ }
+
+ this.other.add(other);
+ }
+
+ /**
+ * Find item in set by name boolean.
+ *
+ * @param searchSet the search set
+ * @param toFind the to find
+ * @return the boolean
+ */
+ public boolean findItemInSetByName(Set<HeatStructureTree> searchSet, HeatStructureTree toFind) {
+ for (HeatStructureTree heatStructureTree : searchSet) {
+ if (heatStructureTree.getFileName().equals(toFind.getFileName())) {
+ return true;
+ }
+
+ }
+
+ return false;
+ }
+
+ /**
+ * Remove from volume or network.
+ *
+ * @param fileNameToRemove the file name to remove
+ * @param type the type
+ */
+ public void removeFromVolumeOrNetwork(String fileNameToRemove, FileData.Type type) {
+ Set<HeatStructureTree> volumeOrNetworkSet =
+ type.equals(FileData.Type.HEAT_VOL) ? this.volume : this.network;
+ HeatStructureTree toRemove = getHeatStructureTreeByName(volumeOrNetworkSet, fileNameToRemove);
+
+ volumeOrNetworkSet.remove(toRemove);
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (this == other) {
+ return true;
+ }
+ if (other == null || getClass() != other.getClass()) {
+ return false;
+ }
+
+ HeatStructureTree heatStructureTree = (HeatStructureTree) other;
+
+ if (fileName != null ? !fileName.equals(heatStructureTree.fileName)
+ : heatStructureTree.fileName != null) {
+ return false;
+ }
+ if (env != null ? !env.equals(heatStructureTree.env) : heatStructureTree.env != null) {
+ return false;
+ }
+ if (HEAT != null ? !HEAT.equals(heatStructureTree.HEAT) : heatStructureTree.HEAT != null) {
+ return false;
+ }
+ if (volume != null ? !volume.equals(heatStructureTree.volume)
+ : heatStructureTree.volume != null) {
+ return false;
+ }
+ if (network != null ? !network.equals(heatStructureTree.network)
+ : heatStructureTree.network != null) {
+ return false;
+ }
+ if (artifacts != null ? !artifacts.equals(heatStructureTree.artifacts)
+ : heatStructureTree.artifacts != null) {
+ return false;
+ }
+ if (nested != null ? !nested.equals(heatStructureTree.nested)
+ : heatStructureTree.nested != null) {
+ return false;
+ }
+ if (errors != null ? !errors.equals(heatStructureTree.errors)
+ : heatStructureTree.errors != null) {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int result1 = fileName != null ? fileName.hashCode() : 0;
+ result1 = 31 * result1 + (env != null ? env.hashCode() : 0);
+ result1 = 31 * result1 + (HEAT != null ? HEAT.hashCode() : 0);
+ result1 = 31 * result1 + (volume != null ? volume.hashCode() : 0);
+ result1 = 31 * result1 + (network != null ? network.hashCode() : 0);
+ result1 = 31 * result1 + (artifacts != null ? artifacts.hashCode() : 0);
+ result1 = 31 * result1 + (nested != null ? nested.hashCode() : 0);
+ result1 = 31 * result1 + (errors != null ? errors.hashCode() : 0);
+
+
+ return result1;
+ }
+
+ /**
+ * Gets errors.
+ *
+ * @return the errors
+ */
+ public List<ErrorMessage> getErrors() {
+ return errors;
+ }
+
+ /**
+ * Sets errors.
+ *
+ * @param errors the errors
+ */
+ public void setErrors(List<ErrorMessage> errors) {
+ this.errors = errors;
+ }
+
+ /**
+ * Add error to errors list.
+ *
+ * @param error the error
+ */
+ public void addErrorToErrorsList(ErrorMessage error) {
+ if (this.errors == null || this.errors.isEmpty()) {
+ this.errors = new ArrayList<>();
+ }
+ if (!this.errors.contains(error)) {
+ this.errors.add(error);
+ }
+ }
+
+ /**
+ * Gets other.
+ *
+ * @return the other
+ */
+ public Set<HeatStructureTree> getOther() {
+ return other;
+ }
+
+ /**
+ * Sets other.
+ *
+ * @param other the other
+ */
+ public void setOther(Set<HeatStructureTree> other) {
+ this.other = other;
+ }
+
+ @Override
+ public int compareTo(HeatStructureTree heatStructureTree) {
+ return heatStructureTree.getFileName().compareTo(this.getFileName());
+ }
+}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/structure/ValidationStructureList.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/structure/ValidationStructureList.java
new file mode 100644
index 0000000000..f2acb2810d
--- /dev/null
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/datatypes/structure/ValidationStructureList.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.heat.datatypes.structure;
+
+public class ValidationStructureList {
+ private HeatStructureTree importStructure;
+
+ public ValidationStructureList() {
+ }
+
+ public ValidationStructureList(HeatStructureTree importStructure) {
+ this.importStructure = importStructure;
+ }
+
+ public HeatStructureTree getImportStructure() {
+ return importStructure;
+ }
+
+ public void setImportStructure(HeatStructureTree importStructure) {
+ this.importStructure = importStructure;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/ErrorCodes.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/ErrorCodes.java
new file mode 100644
index 0000000000..c48d732e63
--- /dev/null
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/ErrorCodes.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.heat.services;
+
+public class ErrorCodes {
+ public static final String INVALID_BOOLEAN = "INVALID_BOOLEAN";
+}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/HeatConstants.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/HeatConstants.java
new file mode 100644
index 0000000000..e2afe89a06
--- /dev/null
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/HeatConstants.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.heat.services;
+
+public class HeatConstants {
+ public static final String GET_ATT_FROM_RESOURCE_GROUP_PREFIX = "resource.";
+ public static final String RESOURCE_GROUP_INDEX_VAR_DEFAULT_VALUE = "%index%";
+
+ public static final String INDEX_PROPERTY_NAME = "index_var";
+ public static final String SERVICE_SCALING_PROPERTY_NAME = "service_scaling";
+ public static final String INSTANCE_UUID_PROPERTY_NAME = "instance_uuid";
+ public static final String VOLUME_ID_PROPERTY_NAME = "volume_id";
+ public static final String RESOURCE_DEF_PROPERTY_NAME = "resource_def";
+ public static final String SCALE_OUT_PROPERTY_NAME = "scale_out";
+
+}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/HeatStructureUtil.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/HeatStructureUtil.java
new file mode 100644
index 0000000000..a216b224af
--- /dev/null
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/HeatStructureUtil.java
@@ -0,0 +1,261 @@
+/*-
+ * ============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.heat.services;
+
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.MapUtils;
+import org.openecomp.core.validation.errors.ErrorMessagesFormatBuilder;
+import org.openecomp.core.validation.errors.Messages;
+import org.openecomp.core.validation.types.GlobalValidationContext;
+import org.openecomp.sdc.datatypes.error.ErrorLevel;
+import org.openecomp.sdc.heat.datatypes.model.HeatOrchestrationTemplate;
+import org.openecomp.sdc.heat.datatypes.model.HeatResourcesTypes;
+import org.openecomp.sdc.heat.datatypes.model.PropertiesMapKeyTypes;
+import org.openecomp.sdc.heat.datatypes.model.Resource;
+import org.openecomp.sdc.heat.datatypes.model.ResourceReferenceFunctions;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+
+/**
+ * The type Heat structure util.
+ */
+public class HeatStructureUtil {
+
+ /**
+ * Gets nested files.
+ *
+ * @param filename the filename
+ * @param hot the hot
+ * @param globalContext the global context
+ * @return the nested files
+ */
+ public static Set<String> getNestedFiles(String filename, HeatOrchestrationTemplate hot,
+ GlobalValidationContext globalContext) {
+
+ Set<String> nestedFileList = new HashSet<>();
+ Set<String> resourceDefNestedFiles;
+ hot.getResources().values().stream().filter(
+ resource -> (resource.getType().endsWith(".yaml") || resource.getType().endsWith(".yml")))
+ .forEach(resource -> nestedFileList.add(resource.getType()));
+
+ resourceDefNestedFiles = getResourceDefNestedFiles(filename, hot, globalContext);
+ nestedFileList.addAll(resourceDefNestedFiles);
+
+ return nestedFileList;
+ }
+
+
+ private static Set<String> getResourceDefNestedFiles(String filename,
+ HeatOrchestrationTemplate hot,
+ GlobalValidationContext globalContext) {
+ Set<String> resourceDefNestedFiles = new HashSet<>();
+ hot.getResources()
+ .entrySet()
+ .stream()
+ .filter(entry -> entry.getValue().getType()
+ .equals(HeatResourcesTypes.RESOURCE_GROUP_RESOURCE_TYPE.getHeatResource()))
+ .filter(entry ->
+ getResourceDef(filename, entry.getKey(), entry.getValue(), globalContext) != null
+ && isNestedResource(
+ getResourceDef(filename, entry.getKey(), entry.getValue(), globalContext)
+ .getType()))
+ .forEach(entry -> resourceDefNestedFiles.add(
+ getResourceDef(filename, entry.getKey(), entry.getValue(), globalContext).getType()));
+
+ return resourceDefNestedFiles;
+ }
+
+
+ /**
+ * Gets resource def.
+ *
+ * @param filename the filename
+ * @param resourceName the resource name
+ * @param resource the resource
+ * @param globalContext the global context
+ * @return the resource def
+ */
+ @SuppressWarnings("unchecked")
+ public static Resource getResourceDef(String filename, String resourceName, Resource resource,
+ GlobalValidationContext globalContext) {
+ Resource resourceDef = null;
+ Map<String, Object> resourceDefValueMap = resource.getProperties() == null ? null
+ : (Map<String, Object>) resource.getProperties()
+ .get(PropertiesMapKeyTypes.RESOURCE_DEF.getKeyMap());
+ if (MapUtils.isNotEmpty(resourceDefValueMap)) {
+ Object resourceDefType = resourceDefValueMap.get("type");
+ if (Objects.nonNull(resourceDefType)) {
+ if (resourceDefType instanceof String) {
+ boolean isNested =
+ checkIfResourceGroupTypeIsNested(filename, resourceName, (String) resourceDefType,
+ globalContext);
+ if (isNested) {
+ resourceDef = new Resource();
+ resourceDef.setType((String) resourceDefType);
+ //noinspection unchecked
+ resourceDef.setProperties((Map<String, Object>) resourceDefValueMap.get("properties"));
+ }
+ } else {
+ globalContext.addMessage(filename, ErrorLevel.WARNING, ErrorMessagesFormatBuilder
+ .getErrorWithParameters(Messages.INVALID_RESOURCE_GROUP_TYPE.getErrorMessage(),
+ resourceName, resourceDefType.toString()));
+ }
+ } else {
+ globalContext.addMessage(filename, ErrorLevel.WARNING, ErrorMessagesFormatBuilder
+ .getErrorWithParameters(Messages.INVALID_RESOURCE_TYPE.getErrorMessage(), "null",
+ resourceName));
+ }
+
+ }
+ return resourceDef;
+ }
+
+
+ /**
+ * Check if resource group type is nested boolean.
+ *
+ * @param filename the filename
+ * @param resourceName the resource name
+ * @param resourceDefType the resource def type
+ * @param globalContext the global context
+ * @return the boolean
+ */
+ public static boolean checkIfResourceGroupTypeIsNested(String filename, String resourceName,
+ String resourceDefType,
+ GlobalValidationContext globalContext) {
+ if (!HeatStructureUtil.isNestedResource(resourceDefType)) {
+ globalContext.addMessage(filename, ErrorLevel.WARNING, ErrorMessagesFormatBuilder
+ .getErrorWithParameters(Messages.INVALID_RESOURCE_GROUP_TYPE.getErrorMessage(),
+ resourceName, resourceDefType));
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * Gets artifact files.
+ *
+ * @param filename the filename
+ * @param hot the hot
+ * @param globalContext the global context
+ * @return the artifact files
+ */
+ public static Set<String> getArtifactFiles(String filename, HeatOrchestrationTemplate hot,
+ GlobalValidationContext globalContext) {
+ Set<String> artifactSet = new HashSet<>();
+ Collection<Resource> resourcesValue =
+ hot.getResources() == null ? null : hot.getResources().values();
+ if (CollectionUtils.isNotEmpty(resourcesValue)) {
+ for (Resource resource : resourcesValue) {
+ Collection<Object> properties =
+ resource.getProperties() == null ? null : resource.getProperties().values();
+ if (CollectionUtils.isNotEmpty(properties)) {
+ for (Object property : properties) {
+ Set<String> artifactNames =
+ getReferencedValuesByFunctionName(filename, "get_file", property, globalContext);
+ artifactSet.addAll(artifactNames);
+ }
+ }
+ }
+ }
+ return artifactSet;
+ }
+
+ /**
+ * Gets referenced values by function name.
+ *
+ * @param filename the filename
+ * @param functionName the function name
+ * @param propertyValue the property value
+ * @param globalContext the global context
+ * @return the referenced values by function name
+ */
+ public static Set<String> getReferencedValuesByFunctionName(String filename, String functionName,
+ Object propertyValue,
+ GlobalValidationContext globalContext) {
+ Set<String> valuesNames = new HashSet<>();
+ if (propertyValue instanceof Map) {
+ Map<String, Object> currPropertyMap = (Map<String, Object>) propertyValue;
+ if (currPropertyMap.containsKey(functionName)) {
+ Object getFunctionValue = currPropertyMap.get(functionName);
+ if (!(getFunctionValue instanceof String)
+ && functionName.equals(ResourceReferenceFunctions.GET_RESOURCE.getFunction())) {
+ globalContext.addMessage(filename, ErrorLevel.ERROR, ErrorMessagesFormatBuilder
+ .getErrorWithParameters(Messages.INVALID_GET_RESOURCE_SYNTAX.getErrorMessage(),
+ getFunctionValue == null ? "null" : getFunctionValue.toString()));
+ return valuesNames;
+ }
+ if (getFunctionValue instanceof String) {
+
+ if (functionName.equals(ResourceReferenceFunctions.GET_FILE.getFunction())) {
+ getFunctionValue = ((String) getFunctionValue).replace("file:///", "");
+ }
+
+ valuesNames.add((String) getFunctionValue);
+ } else if (getFunctionValue instanceof List) {
+ if (CollectionUtils.isNotEmpty((List) getFunctionValue)) {
+ if (((List) getFunctionValue).get(0) instanceof String) {
+ valuesNames.add(((String) ((List) getFunctionValue).get(0)).replace("file:///", ""));
+ } else {
+ valuesNames.addAll(getReferencedValuesByFunctionName(filename, functionName,
+ ((List) getFunctionValue).get(0), globalContext));
+ }
+
+ }
+ } else {
+ valuesNames.addAll(
+ getReferencedValuesByFunctionName(filename, functionName, getFunctionValue,
+ globalContext));
+ }
+ } else {
+ for (Map.Entry<String, Object> nestedPropertyMap : currPropertyMap.entrySet()) {
+ valuesNames.addAll(getReferencedValuesByFunctionName(filename, functionName,
+ nestedPropertyMap.getValue(), globalContext));
+ }
+ }
+ } else if (propertyValue instanceof List) {
+ List propertyValueArray = (List) propertyValue;
+ for (Object propertyValueArrayInstance : propertyValueArray) {
+ valuesNames.addAll(
+ getReferencedValuesByFunctionName(filename, functionName, propertyValueArrayInstance,
+ globalContext));
+ }
+ }
+
+ return valuesNames;
+ }
+
+
+ /**
+ * Is nested resource boolean.
+ *
+ * @param resourceType the resource type
+ * @return the boolean
+ */
+ public static boolean isNestedResource(String resourceType) {
+ return resourceType.endsWith(".yaml") || resourceType.endsWith(".yml");
+ }
+}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/manifest/ManifestUtil.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/manifest/ManifestUtil.java
new file mode 100644
index 0000000000..09378cebf4
--- /dev/null
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/manifest/ManifestUtil.java
@@ -0,0 +1,176 @@
+/*-
+ * ============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.heat.services.manifest;
+
+import org.apache.commons.collections4.CollectionUtils;
+import org.openecomp.sdc.heat.datatypes.manifest.FileData;
+import org.openecomp.sdc.heat.datatypes.manifest.ManifestContent;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+
+/**
+ * The type Manifest util.
+ */
+public class ManifestUtil {
+
+
+ /**
+ * Gets file and its env.
+ *
+ * @param manifestContent the manifest content
+ * @return the file and its env
+ */
+ public static Map<String, FileData> getFileAndItsEnv(ManifestContent manifestContent) {
+ Map<String, FileData> fileEnvMap = new HashMap<>();
+ scanFileEnvMap(null, manifestContent.getData(), fileEnvMap);
+ return fileEnvMap;
+ }
+
+
+ /**
+ * Scan file env map.
+ *
+ * @param fileData the file data
+ * @param fileDataList the file data list
+ * @param fileEnvMap the file env map
+ */
+ public static void scanFileEnvMap(FileData fileData, List<FileData> fileDataList,
+ Map<String, FileData> fileEnvMap) {
+ if (CollectionUtils.isEmpty(fileDataList)) {
+ return;
+ }
+
+ for (FileData childFileData : fileDataList) {
+ FileData.Type childType = childFileData.getType();
+ if (fileData != null) {
+ if (childType != null && childType.equals(FileData.Type.HEAT_ENV)) {
+ fileEnvMap.put(fileData.getFile(), childFileData);
+ }
+ }
+ scanFileEnvMap(childFileData, childFileData.getData(), fileEnvMap);
+ }
+ }
+
+
+ /**
+ * Gets file type map.
+ *
+ * @param manifestContent the manifest content
+ * @return the file type map
+ */
+ public static Map<String, FileData.Type> getFileTypeMap(ManifestContent manifestContent) {
+ Map<String, FileData.Type> fileTypeMap = new HashMap<>();
+ scanFileTypeMap(null, manifestContent.getData(), fileTypeMap);
+ return fileTypeMap;
+ }
+
+ private static FileData.Type scanFileTypeMap(FileData fileData, List<FileData> data,
+ Map<String, FileData.Type> fileTypeMap) {
+ if (fileData != null) {
+ fileTypeMap.put(fileData.getFile(), fileData.getType());
+ }
+ if (data == null) {
+ return null;
+ }
+
+ for (FileData chileFileData : data) {
+ FileData.Type type = scanFileTypeMap(chileFileData, chileFileData.getData(), fileTypeMap);
+ if (type != null) {
+ return type;
+ }
+ }
+ return null;
+ }
+
+
+ /**
+ * Gets artifacts.
+ *
+ * @param manifestContent the manifest content
+ * @return the artifacts
+ */
+ public static Set<String> getArtifacts(ManifestContent manifestContent) {
+ Set<String> artifacts = new HashSet<>();
+ scanArtifacts(null, manifestContent.getData(), artifacts);
+
+ return artifacts;
+ }
+
+
+ private static void scanArtifacts(FileData fileData, List<FileData> data, Set<String> artifacts) {
+ if (fileData != null && fileData.getType() != null) {
+ if (isArtifact(fileData)) {
+ artifacts.add(fileData.getFile());
+ }
+ }
+
+ if (data == null) {
+ return;
+ }
+
+ for (FileData chileFileData : data) {
+ scanArtifacts(chileFileData, chileFileData.getData(), artifacts);
+ }
+ }
+
+ private static boolean isArtifact(FileData fileData) {
+ if (FileData.Type.valueOf(fileData.getType().name()) != null
+ && !fileData.getType().equals(FileData.Type.HEAT)
+ && !fileData.getType().equals(FileData.Type.HEAT_ENV)
+ && !fileData.getType().equals(FileData.Type.HEAT_NET)
+ && !fileData.getType().equals(FileData.Type.HEAT_VOL)) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Gets base files.
+ *
+ * @param manifestContent the manifest content
+ * @return the base files
+ */
+ public static Set<String> getBaseFiles(ManifestContent manifestContent) {
+ Set<String> baseFiles = new HashSet<>();
+ scanBase(null, manifestContent.getData(), baseFiles);
+ return baseFiles;
+ }
+
+ private static void scanBase(FileData fileData, List<FileData> data, Set<String> baseFiles) {
+ if (fileData != null && fileData.getBase() != null) {
+ if (fileData.getBase()) {
+ baseFiles.add(fileData.getFile());
+ }
+ }
+ if (data == null) {
+ return;
+ }
+
+ for (FileData chileFileData : data) {
+ scanBase(chileFileData, chileFileData.getData(), baseFiles);
+ }
+ }
+}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManager.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManager.java
new file mode 100644
index 0000000000..71c532dbd3
--- /dev/null
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManager.java
@@ -0,0 +1,298 @@
+/*-
+ * ============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.heat.services.tree;
+
+import org.openecomp.core.utilities.file.FileContentHandler;
+import org.openecomp.core.utilities.file.FileUtils;
+import org.openecomp.core.utilities.json.JsonUtil;
+import org.openecomp.core.utilities.yaml.YamlUtil;
+import org.openecomp.core.validation.types.GlobalValidationContext;
+import org.openecomp.sdc.common.utils.AsdcCommon;
+import org.openecomp.sdc.datatypes.error.ErrorMessage;
+import org.openecomp.sdc.heat.datatypes.manifest.FileData;
+import org.openecomp.sdc.heat.datatypes.manifest.ManifestContent;
+import org.openecomp.sdc.heat.datatypes.model.HeatOrchestrationTemplate;
+import org.openecomp.sdc.heat.datatypes.structure.Artifact;
+import org.openecomp.sdc.heat.datatypes.structure.HeatStructureTree;
+import org.openecomp.sdc.heat.services.HeatStructureUtil;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * The type Heat tree manager.
+ */
+public class HeatTreeManager {
+
+ private static Logger logger = LoggerFactory.getLogger(HeatTreeManager.class);
+
+
+ private FileContentHandler heatContentMap = new FileContentHandler();
+ private byte[] manifest;
+ private HeatStructureTree tree = new HeatStructureTree();
+ private Map<String, HeatStructureTree> fileTreeRef = new HashMap<>();
+ private Map<String, Artifact> artifactRef = new HashMap<>();
+ private Map<String, Artifact> candidateOrphanArtifacts = new HashMap<>();
+ private Map<String, HeatStructureTree> nestedFiles = new HashMap<>();
+ private Map<HeatStructureTree, HeatStructureTree> volumeFileToParent = new HashMap<>();
+ private Map<HeatStructureTree, HeatStructureTree> networkFileToParent = new HashMap<>();
+ private Set<String> manifestFiles = new HashSet<>();
+
+ /**
+ * Add file.
+ *
+ * @param fileName the file name
+ * @param content the content
+ */
+ public void addFile(String fileName, InputStream content) {
+ if (fileName.equals(AsdcCommon.MANIFEST_NAME)) {
+ manifest = FileUtils.toByteArray(content);
+
+ } else {
+ heatContentMap.addFile(fileName, content);
+ }
+ }
+
+ /**
+ * Create tree.
+ */
+ public void createTree() {
+ if (manifest == null) {
+ logger.error("Missing manifest file in the zip.");
+ return;
+ }
+ ManifestContent manifestData =
+ JsonUtil.json2Object(new String(manifest), ManifestContent.class);
+ scanTree(null, manifestData.getData());
+ addNonNestedVolumeNetworkToTree(volumeFileToParent, nestedFiles.keySet(), true);
+ addNonNestedVolumeNetworkToTree(networkFileToParent, nestedFiles.keySet(), false);
+ handleOrphans();
+
+ tree = fileTreeRef.get(AsdcCommon.PARENT);
+ }
+
+ private void handleOrphans() {
+ tree = fileTreeRef.get(AsdcCommon.PARENT);
+ candidateOrphanArtifacts.entrySet().stream()
+ .forEach(entry -> tree.addArtifactToArtifactList(entry.getValue()));
+ nestedFiles
+ .values()
+ .stream()
+ .filter(heatStructureTree -> tree.getHEAT().contains(heatStructureTree))
+ .forEach(heatStructureTree -> tree.getHEAT().remove(heatStructureTree));
+
+ heatContentMap.getFileList().stream().filter(fileName -> !manifestFiles.contains(fileName))
+ .forEach(fileName -> addTreeOther(fileName));
+ }
+
+ private void addTreeOther(String fileName) {
+ if (tree.getOther() == null) {
+ tree.setOther(new HashSet<>());
+ }
+ HeatStructureTree other = new HeatStructureTree(fileName, false);
+ fileTreeRef.put(fileName, other);
+ tree.getOther().add(other);
+ }
+
+
+ private void handleHeatContentReference(String filename, HeatStructureTree fileHeatStructureTree,
+ GlobalValidationContext globalContext) {
+
+ String fileName = fileHeatStructureTree.getFileName();
+ InputStream fileContent = this.heatContentMap.getFileContent(fileName);
+ if (fileContent == null) {
+ return; // file exist in manifest but does not exist in zip
+ }
+ try {
+ HeatOrchestrationTemplate hot =
+ new YamlUtil().yamlToObject(fileContent, HeatOrchestrationTemplate.class);
+
+ Set<String> nestedSet = HeatStructureUtil.getNestedFiles(filename, hot, globalContext);
+ addHeatNestedFiles(fileHeatStructureTree, nestedSet);
+
+ Set<String> artifactSet = HeatStructureUtil.getArtifactFiles(filename, hot, globalContext);
+ addHeatArtifactFiles(fileHeatStructureTree, artifactSet);
+ } catch (Exception ignore) { /* invalid yaml no need to process reference */ }
+ }
+
+ private void addHeatArtifactFiles(HeatStructureTree fileHeatStructureTree,
+ Set<String> artifactSet) {
+ Artifact artifact;
+ for (String artifactName : artifactSet) {
+ FileData.Type type =
+ candidateOrphanArtifacts.get(artifactName) != null ? candidateOrphanArtifacts
+ .get(artifactName).getType() : null;
+ artifact = new Artifact(artifactName, type);
+ artifactRef.put(artifactName, artifact);
+ candidateOrphanArtifacts.remove(artifactName);
+ fileHeatStructureTree.addArtifactToArtifactList(artifact);
+ }
+ }
+
+
+ private void addHeatNestedFiles(HeatStructureTree fileHeatStructureTree, Set<String> nestedSet) {
+ HeatStructureTree childHeatStructureTree;
+ for (String nestedName : nestedSet) {
+ childHeatStructureTree = fileTreeRef.get(nestedName);
+ if (childHeatStructureTree == null) {
+ childHeatStructureTree = new HeatStructureTree();
+ childHeatStructureTree.setFileName(nestedName);
+ fileTreeRef.put(nestedName, childHeatStructureTree);
+ }
+ fileHeatStructureTree.addHeatStructureTreeToNestedHeatList(childHeatStructureTree);
+ nestedFiles.put(childHeatStructureTree.getFileName(), childHeatStructureTree);
+ }
+ }
+
+
+ /**
+ * Add errors.
+ *
+ * @param validationErrors the validation errors
+ */
+ public void addErrors(Map<String, List<ErrorMessage>> validationErrors) {
+
+ validationErrors.entrySet().stream().filter(entry -> {
+ return fileTreeRef.get(entry.getKey()) != null;
+ }).forEach(entry -> entry.getValue().stream().forEach(error ->
+ fileTreeRef.get(entry.getKey()).addErrorToErrorsList(error)));
+
+ validationErrors.entrySet().stream().filter(entry -> {
+ return artifactRef.get(entry.getKey()) != null;
+ }).forEach(entry -> artifactRef.get(entry.getKey()).setErrors(entry.getValue()));
+
+ }
+
+ /**
+ * Scan tree.
+ *
+ * @param parent the parent
+ * @param data the data
+ */
+ public void scanTree(String parent, List<FileData> data) {
+ String fileName;
+ FileData.Type type;
+ HeatStructureTree parentHeatStructureTree;
+ HeatStructureTree fileHeatStructureTree;
+ HeatStructureTree childHeatStructureTree;
+ Artifact artifact;
+ if (parent == null) {
+ parentHeatStructureTree = new HeatStructureTree();
+ fileTreeRef.put(AsdcCommon.PARENT, parentHeatStructureTree);
+ } else {
+ parentHeatStructureTree = fileTreeRef.get(parent);
+ }
+
+ for (FileData fileData : data) {
+ fileName = fileData.getFile();
+ manifestFiles.add(fileName);
+ type = fileData.getType();
+
+ if (FileData.Type.HEAT.equals(type)) {
+ fileHeatStructureTree = fileTreeRef.get(fileName);
+ if (fileHeatStructureTree == null) {
+ fileHeatStructureTree = new HeatStructureTree();
+ fileTreeRef.put(fileName, fileHeatStructureTree);
+ }
+ fileHeatStructureTree.setFileName(fileName);
+ fileHeatStructureTree.setBase(fileData.getBase());
+ fileHeatStructureTree.setType(type);
+ handleHeatContentReference(null, fileHeatStructureTree, null);
+ parentHeatStructureTree.addHeatToHEATList(fileHeatStructureTree);
+ if (fileData.getData() != null) {
+ scanTree(fileName, fileData.getData());
+ }
+ } else {
+ childHeatStructureTree = new HeatStructureTree();
+ childHeatStructureTree.setFileName(fileName);
+ childHeatStructureTree.setBase(fileData.getBase());
+ childHeatStructureTree.setType(type);
+ fileTreeRef.put(childHeatStructureTree.getFileName(), childHeatStructureTree);
+
+ if (type == null) {
+ parentHeatStructureTree.addOtherToOtherList(childHeatStructureTree);
+ } else if (FileData.Type.HEAT_NET.equals(type)) {
+ // parentHeatStructureTree.addNetworkToNetworkList(childHeatStructureTree);
+ networkFileToParent.put(childHeatStructureTree, parentHeatStructureTree);
+ if (fileData.getData() != null) {
+ scanTree(fileName, fileData.getData());
+ }
+
+ } else if (FileData.Type.HEAT_VOL.equals(type)) {
+ // parentHeatStructureTree.addVolumeFileToVolumeList(childHeatStructureTree);
+ volumeFileToParent.put(childHeatStructureTree, parentHeatStructureTree);
+ if (fileData.getData() != null) {
+ scanTree(fileName, fileData.getData());
+ }
+ } else if (FileData.Type.HEAT_ENV.equals(type)) {
+ if (parentHeatStructureTree != null && parentHeatStructureTree.getFileName() != null) {
+ parentHeatStructureTree.setEnv(childHeatStructureTree);
+ } else {
+ if (parentHeatStructureTree.getOther() == null) {
+ parentHeatStructureTree.setOther(new HashSet<>());
+ }
+ parentHeatStructureTree.getOther().add(childHeatStructureTree);
+ }
+ } else {
+ artifact = new Artifact(fileName, type);
+ if (!artifactRef.keySet().contains(fileName)) {
+ artifactRef.put(fileName, artifact);
+ candidateOrphanArtifacts.put(fileName, artifact);
+ }
+ }
+ }
+ }
+ }
+
+
+ private void addNonNestedVolumeNetworkToTree(
+ Map<HeatStructureTree, HeatStructureTree> netVolToParent, Set<String> nestedFileNames,
+ boolean isVolume) {
+ for (Map.Entry<HeatStructureTree, HeatStructureTree> entry : netVolToParent.entrySet()) {
+ HeatStructureTree netOrVolNode = entry.getKey();
+ HeatStructureTree parent = entry.getValue();
+ if (!nestedFileNames.contains(netOrVolNode.getFileName())) {
+ if (isVolume) {
+ parent.addVolumeFileToVolumeList(netOrVolNode);
+ } else {
+ parent.addNetworkToNetworkList(netOrVolNode);
+ }
+ }
+ }
+ }
+
+
+ /**
+ * Gets tree.
+ *
+ * @return the tree
+ */
+ public HeatStructureTree getTree() {
+ return tree;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerUtil.java b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerUtil.java
new file mode 100644
index 0000000000..dac7cdbbcb
--- /dev/null
+++ b/openecomp-be/lib/openecomp-heat-lib/src/main/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerUtil.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.heat.services.tree;
+
+import org.openecomp.core.utilities.file.FileContentHandler;
+
+/**
+ * The type Heat tree manager util.
+ */
+public class HeatTreeManagerUtil {
+ /**
+ * Init heat tree manager heat tree manager.
+ *
+ * @param fileContentMap the file content map
+ * @return the heat tree manager
+ */
+ public static HeatTreeManager initHeatTreeManager(FileContentHandler fileContentMap) {
+
+ HeatTreeManager heatTreeManager = new HeatTreeManager();
+ fileContentMap.getFileList().stream().forEach(
+ fileName -> heatTreeManager.addFile(fileName, fileContentMap.getFileContent(fileName)));
+
+ return heatTreeManager;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/datatypes/model/EnvironmentTest.java b/openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/datatypes/model/EnvironmentTest.java
new file mode 100644
index 0000000000..2c0cf0b1aa
--- /dev/null
+++ b/openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/datatypes/model/EnvironmentTest.java
@@ -0,0 +1,38 @@
+package org.openecomp.sdc.heat.datatypes.model;
+
+import org.openecomp.core.utilities.yaml.YamlUtil;
+import org.junit.Test;
+
+import java.io.InputStream;
+
+public class EnvironmentTest {
+
+ @Test
+ public void testYamlToServiceTemplateObj() {
+ YamlUtil yamlUtil = new YamlUtil();
+ InputStream yamlFile = yamlUtil.loadYamlFileIs("/mock/model/envSettings.env");
+ Environment envVars = yamlUtil.yamlToObject(yamlFile, Environment.class);
+ envVars.toString();
+ }
+
+ @Test
+ public void test() {
+ String heatResourceName = "server_abc_0u";
+ String novaServerPrefix = "server_";
+ if (heatResourceName.startsWith(novaServerPrefix)) {
+ heatResourceName = heatResourceName.substring(novaServerPrefix.length());
+ }
+ int lastIndexOfUnderscore = heatResourceName.lastIndexOf("_");
+ if (heatResourceName.length() == lastIndexOfUnderscore) {
+ System.out.println(heatResourceName);
+ } else {
+ String heatResourceNameSuffix = heatResourceName.substring(lastIndexOfUnderscore + 1);
+ try {
+ Integer.parseInt(heatResourceNameSuffix);
+ System.out.println(heatResourceName.substring(0, lastIndexOfUnderscore));
+ } catch (NumberFormatException ignored) {
+ System.out.println(heatResourceName);
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/datatypes/model/HeatOrchestrationTemplateTest.java b/openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/datatypes/model/HeatOrchestrationTemplateTest.java
new file mode 100644
index 0000000000..09c83ca217
--- /dev/null
+++ b/openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/datatypes/model/HeatOrchestrationTemplateTest.java
@@ -0,0 +1,122 @@
+package org.openecomp.sdc.heat.datatypes.model;
+
+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 HeatOrchestrationTemplateTest {
+
+ @Test
+ public void testYamlToServiceTemplateObj() {
+ YamlUtil yamlUtil = new YamlUtil();
+ InputStream yamlFile = yamlUtil.loadYamlFileIs("/mock/model/testHeat.yml");
+ HeatOrchestrationTemplate heatOrchestrationTemplate =
+ yamlUtil.yamlToObject(yamlFile, HeatOrchestrationTemplate.class);
+ heatOrchestrationTemplate.toString();
+ }
+
+ @Test
+ public void createHotTemplate() {
+ HeatOrchestrationTemplate template = new HeatOrchestrationTemplate();
+ template.setHeat_template_version("2016-04-14");
+ template.setDescription("test description for hot template");
+ Map<String, Parameter> params = createParameters();
+ template.setParameters(params);
+ List<ParameterGroup> parameterGroup = new ArrayList<>();
+ ParameterGroup paramsGroup = new ParameterGroup();
+ paramsGroup.setDescription("params group test description");
+ paramsGroup.setLabel("params group test label");
+ String paramName = params.get("param1").getLabel();
+ List<String> paramsNames = new ArrayList<>();
+ paramsNames.add(paramName);
+ paramsGroup.setParameters(paramsNames);
+ parameterGroup.add(paramsGroup);
+ template.setParameter_groups(parameterGroup);
+ Map<String, Object> conditions = new HashMap<>();
+ conditions.put("key1", "val1");
+ HashMap<String, Object> mapValue = new HashMap<>();
+ mapValue.put("innerKey", "innerVal");
+ conditions.put("key2", mapValue);
+ template.setConditions(conditions);
+
+ Map<String, Resource> resources = new HashMap<>();
+ Resource resource = new Resource();
+ resource.setMetadata("resource metadata");
+ resource.setType("resource type");
+ //Map<String, String> resourceProps = new ;
+ Map<String, Object> resourceProps = new HashMap<>();
+ resourceProps.put("aaa", "bbb");
+ //resourceProps.add(resourceProp);
+ resource.setProperties(resourceProps);
+ resources.put("R1", resource);
+ resource = new Resource();
+ resource.setMetadata("resource2 metadata");
+ resource.setType("resource2 type");
+ //resourceProps = new ArrayList<>();
+ resourceProps = new HashMap<>();
+ resourceProps.put("aaa2", "bbb2");
+ //resourceProps.add(resourceProp);
+ resource.setProperties(resourceProps);
+ List<String> dependsOn = new ArrayList<>();
+ dependsOn.add("R1");
+ resource.setDepends_on(dependsOn);
+ resource.setDeletion_policy("all");
+ resource.setUpdate_policy("once");
+ resources.put("R2", resource);
+ template.setResources(resources);
+
+ YamlUtil yamlUtil = new YamlUtil();
+ String yml = yamlUtil.objectToYaml(template);
+ Assert.assertNotNull(yml);
+ try {
+ HeatOrchestrationTemplate heatOrchestrationTemplate =
+ yamlUtil.yamlToObject(yml, HeatOrchestrationTemplate.class);
+ Assert.assertNotNull(heatOrchestrationTemplate);
+ } catch (Exception ignored) {
+ }
+ }
+
+ private Map<String, Parameter> createParameters() {
+ Map<String, Parameter> params = new HashMap<>();
+ Parameter param;
+ for (int i = 0; i < 2; i++) {
+ param = new Parameter();
+ param.setDescription("param " + i + " desc");
+ param.setLabel("param " + i + " label");
+ param.set_default("PARAM " + i + " default");
+ param.setHidden(i % 2 == 0);
+ param.setImmutable(i % 2 == 0);
+ param.setType(i % 2 == 0 ? ParameterType.STRING.getDisplayName()
+ : ParameterType.BOOLEAN.getDisplayName());
+ params.put("param" + i, param);
+ }
+
+ return params;
+ }
+
+ private List<Constraint> createConstraints() {
+ List<Constraint> constraints = new ArrayList<>();
+ Constraint constraint = new Constraint();
+ constraint.setLength(new Integer[]{2, 4});
+ constraints.add(constraint);
+ constraint = new Constraint();
+ constraint.setPattern("some regex");
+ constraints.add(constraint);
+ constraint = new Constraint();
+ constraint.setRange(new Integer[]{5, 8});
+ constraints.add(constraint);
+ constraint = new Constraint();
+ List<Object> validValues = new ArrayList<>();
+ validValues.add("abc");
+ validValues.add("def");
+ constraint.setValid_values(validValues);
+ constraints.add(constraint);
+ return constraints;
+ }
+} \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/model/envSettings.env b/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/model/envSettings.env
new file mode 100644
index 0000000000..4f5e20a55f
--- /dev/null
+++ b/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/model/envSettings.env
@@ -0,0 +1,36 @@
+parameters:
+ czid: RDM1
+ vf_inst_number: 01
+ admin_password: cisco123
+ vpc_vip_addr: 172.17.32.112
+ vpc_vip_gateway: 172.17.32.1
+ availability_zone: nova
+
+ instance_image_cf1: SGW_19.2.0v-CF1-ATTM1.0.1_nimbus
+ instance_image_cf2: SGW_19.2.0v-CF2-ATTM1.0.1_nimbus
+ instance_image_sf: SGW_19.2.0v-SFn-ATTM1.0.1_nimbus
+ instance_flavor_cf: m1.xlarge
+ instance_flavor_sf: m1.xlarge
+
+
+ instance_network: mns-oam_direct_net_0
+ cgw_int_di2_net: nimbus_int_sae_gw_di-2_net_0
+ cgw_gn_net: mns-gn_direct_net_0
+ cgw_cor_net: mns-cor_direct_net_0
+ cgw_sgi_protected_net: nimbus_sgi_protected_net_0
+ cgw_sgi_ims_net: nimbus_sgi_ims_net_0
+ cgw_oam_calea_net: nimbus_oam_calea_net_0
+ cgw_int_icsr_net: nimbus_int_icsr_net_0
+
+ # CF VNFs Neutron static IP for management port
+ CF01-OAM-IP: 172.17.32.110
+ CF02-OAM-IP: 172.17.32.111
+ # SF VNFs Neutron static IPs for port 1-6
+ SF03-IP: { gn_ip: [107.243.0.5, "2606:ae00:2e01:140::5"], cor_ip: [107.243.3.5, "fd00:ae00:2e01:40::5"], sgi_prot_ip: [107.243.1.5, "fd00:ae00:2030:a40::5"], sgi_ims_ip: [107.243.2.5, "fd00:ae00:2030:b40::5"], oam_calea_ip: [107.243.4.5], int_icsr_ip: [172.26.0.5, "fd00:2600:2600::5"]}
+ SF04-IP: { gn_ip: [107.243.0.6, "2606:ae00:2e01:140::6"], cor_ip: [107.243.3.6, "fd00:ae00:2e01:40::6"], sgi_prot_ip: [107.243.1.6, "fd00:ae00:2030:a40::6"], sgi_ims_ip: [107.243.2.6, "fd00:ae00:2030:b40::6"], oam_calea_ip: [107.243.4.6], int_icsr_ip: [172.26.0.10, "fd00:2600:2600::10"]}
+ SF05-IP: { gn_ip: [107.243.0.7, "2606:ae00:2e01:140::7"], cor_ip: [107.243.3.7, "fd00:ae00:2e01:40::7"], sgi_prot_ip: [107.243.1.7, "fd00:ae00:2030:a40::7"], sgi_ims_ip: [107.243.2.7, "fd00:ae00:2030:b40::7"], oam_calea_ip: [107.243.4.7], int_icsr_ip: [172.26.0.9, "fd00:2600:2600::9"]}
+ SF06-IP: { gn_ip: [107.243.0.8, "2606:ae00:2e01:140::8"], cor_ip: [107.243.3.8, "fd00:ae00:2e01:40::8"], sgi_prot_ip: [107.243.1.8, "fd00:ae00:2030:a40::8"], sgi_ims_ip: [107.243.2.8, "fd00:ae00:2030:b40::8"], oam_calea_ip: [107.243.4.8], int_icsr_ip: [172.26.0.8, "fd00:2600:2600::8"]}
+ # Volume size for HDD attaching to CF card for CDR storage
+ vol_size_1: 16
+ vol_size_2: 16
+
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/model/testHeat.yml b/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/model/testHeat.yml
new file mode 100644
index 0000000000..d1eb621731
--- /dev/null
+++ b/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/model/testHeat.yml
@@ -0,0 +1,524 @@
+heat_template_version: 2013-05-23
+
+description: vSeGW/vSRX Firewall Template
+
+parameter_groups:
+- label: System Settings
+ description: System Level Settings
+ parameters:
+ - availability_zone_0
+ - vnf_name
+ - vnf_id
+
+parameters:
+ availability_zone_0:
+ type: string
+ description: Availability Zone
+ vnf_name:
+ type: string
+ description: Unique name for this VNF instance
+ vnf_id:
+ type: string
+ description: Unique ID for this VNF instance
+
+# Note we are requesting a flavor with 10 physical CPU cores and may be limited by 16 vCPU flavor.
+ flavor_segw_name:
+ type: string
+ description: flavor type
+# The image will be provided as a qcow2 KVM image.
+ image_segw_name:
+ type: string
+ description: Image use to boot a server
+
+ flavor_vsrxfw_name:
+ type: string
+ description: flavor type
+ image_vsrxfw_name:
+ type: string
+ description: Image use to boot a server
+
+ INTERNET_direct_net_id:
+ type: string
+ description: The Internet
+
+ oam_mgmt_net_0_id:
+ type: string
+ description: Name of OAM mgmt network
+
+ oam_protected_net_0_id:
+ type: string
+ description: Name of OAM protected network
+
+ Mobility_OAM_protected_net_0_id:
+ type: string
+ description: Network name for OAM
+
+ GN_direct_net_0_id:
+ type: string
+ description: Network name for GN network
+
+ Mobility_OAM_protected_net_1_id:
+ type: string
+ description: Network name for OAM
+
+ GN_direct_net_1_id:
+ type: string
+ description: Network name for GN network
+
+ HSL_direct_net_id:
+ type: string
+ description: Name of HSL (Logging) network
+ HSL_direct_net_cidr:
+ type: string
+ description: HSL (Logging) network address (CIDR notation)
+
+ int_dummi0_net_id:
+ type: string
+ description: Dummi Parent Network for port
+ int_dummi1_net_id:
+ type: string
+ description: Dummi Parent Network for port
+# int_dummi2_net_id:
+# type: string
+# description: Dummi Parent Network for port
+# int_dummi3_net_id:
+# type: string
+# description: Dummi Parent Network for port
+# int_dummi4_net_id:
+# type: string
+# description: Dummi Parent Network for port
+# int_dummi5_net_id:
+# type: string
+# description: Dummi Parent Network for port
+
+ int_dummi0_cidr:
+ type: string
+ description: IPv4 prefix (CIDR notation)
+ int_dummi1_cidr:
+ type: string
+ description: IPv4 prefix (CIDR notation)
+# int_dummi2_cidr:
+# type: string
+# description: IPv4 prefix (CIDR notation)
+# int_dummi3_cidr:
+# type: string
+# description: IPv4 prefix (CIDR notation)
+# int_dummi4_cidr:
+# type: string
+# description: IPv4 prefix (CIDR notation)
+# int_dummi5_cidr:
+# type: string
+# description: IPv4 prefix (CIDR notation)
+
+ segw_0_inet_ip_0:
+ type: string
+ label: segw_0 port ens10 Ingress IP address alias_0
+ description: SeGW's Ingress interface IPv4 address, primary
+ segw_0_inet_ip_1:
+ type: string
+ label: segw_0 port ens10 Ingress IP address alias_1
+ description: SeGW's Ingress interface IPv4 address, alias 1
+ segw_0_inet_ip_2:
+ type: string
+ label: segw_0 port ens10 Ingress IP address alias_2
+ description: SeGW's Ingress interface IPv4 address, alias 2
+
+ segw_1_inet_ip_0:
+ type: string
+ label: segw_1 port ens10 Ingress IP address alias_0
+ description: SeGW's Ingress interface IPv4 address, primary
+ segw_1_inet_ip_1:
+ type: string
+ label: segw_1 port ens10 Ingress IP address alias_1
+ description: SeGW's Ingress interface IPv4 address, alias 1
+ segw_1_inet_ip_2:
+ type: string
+ label: segw_1 port ens10 Ingress IP address alias_2
+ description: SeGW's Ingress interface IPv4 address, alias 2
+ segw_0_oam_protected_ip:
+ type: string
+ label: segw_0 OAM MGMT IP address
+ description: segw_0 OAM MGMT IP address
+ segw_1_oam_protected_ip:
+ type: string
+ label: segw_1 OAM MGMT IP address
+ description: segw_1 OAM MGMT IP address
+
+# vsrx_fw_0_GN_direct_ip:
+# type: string
+# label: vsrx_fw_0 GN Direct IP address
+# description: vsrx_fw_0 GN Direct IP address
+# vsrx_fw_1_GN_direct_ip:
+# type: string
+# label: vsrx_fw_1 GN Direct IP address
+# description: vsrx_fw_1 GN Direct IP address
+# vsrx_fw_2_OAM_protected_ip:
+# type: string
+# label: vsrx_fw_2 OAM Protected IP address
+# description: vsrx_fw_2 OAM Protected IP address
+# vsrx_fw_3_OAM_protected_ip:
+# type: string
+# label: vsrx_fw_3 OAM Protected IP address
+# description: vsrx_fw_3 OAM Protected IP address
+
+ segw_0_name:
+ type: string
+ default: vSeGW_0
+ description: name of VM
+ segw_1_name:
+ type: string
+ default: vSeGW_1
+ description: name of VM
+ vsrx_fw_0_name:
+ type: string
+ default: vSRX_FW_0
+ description: name of VM
+ vsrx_fw_1_name:
+ type: string
+ default: vSRX_FW_1
+ description: name of VM
+ vsrx_fw_2_name:
+ type: string
+ default: vSRX_FW_2
+ description: name of VM
+ vsrx_fw_3_name:
+ type: string
+ default: vSRX_FW_3
+ description: name of VM
+
+ security_group_name:
+ type: string
+ label: SEGW security group name
+ description: SEGW security group name
+
+resources:
+
+ SeGW_Affinity:
+ type: OS::Nova::ServerGroup
+ properties:
+ policies: ["anti-affinity"]
+ vSRXFW_Affinity:
+ type: OS::Nova::ServerGroup
+ properties:
+ policies: ["anti-affinity"]
+
+ Dummi0_net:
+ type: OS::Contrail::VirtualNetwork
+ properties:
+ name: { get_param: int_dummi0_net_id }
+ Dummi0_subnet:
+ type: OS::Neutron::Subnet
+ properties:
+ network_id: { get_resource: Dummi0_net }
+ cidr: { get_param: int_dummi0_cidr }
+
+ Dummi1_net:
+ type: OS::Contrail::VirtualNetwork
+ properties:
+ name: { get_param: int_dummi1_net_id }
+ Dummi1_subnet:
+ type: OS::Neutron::Subnet
+ properties:
+ network_id: { get_resource: Dummi1_net }
+ cidr: { get_param: int_dummi1_cidr }
+
+ hsl_direct_net:
+ type: OS::Contrail::VirtualNetwork
+ properties:
+ name: { get_param: HSL_direct_net_id }
+
+ hsl_ip_subnet:
+ type: OS::Neutron::Subnet
+ properties:
+ network_id: { get_resource: hsl_direct_net }
+ cidr: { get_param: HSL_direct_net_cidr }
+
+ segw_security_group:
+ type: OS::Neutron::SecurityGroup
+ properties:
+ description: vscp security group
+ name: {get_param: security_group_name}
+# Need to add any-any rule through GUI to get SCTP traffic to work - any-any rules are not supported in heat template
+ rules: [{"direction": egress, "ethertype": IPv4, "port_range_min": 1, "port_range_max": 65535, "protocol": tcp, "remote_ip_prefix": 0.0.0.0/0},
+ {"direction": egress, "ethertype": IPv4, "port_range_min": 1, "port_range_max": 65535, "protocol": udp, "remote_ip_prefix": 0.0.0.0/0},
+ {"direction": egress, "ethertype": IPv4, "protocol": icmp, "remote_ip_prefix": 0.0.0.0/0},
+ {"direction": ingress, "ethertype": IPv4, "port_range_min": 1, "port_range_max": 65535, "protocol": tcp, "remote_ip_prefix": 0.0.0.0/0},
+ {"direction": ingress, "ethertype": IPv4, "port_range_min": 1, "port_range_max": 65535, "protocol": udp, "remote_ip_prefix": 0.0.0.0/0},
+ {"direction": ingress, "ethertype": IPv4, "protocol": icmp, "remote_ip_prefix": 0.0.0.0/0}
+ ]
+
+ server_segw_segw_0:
+ type: OS::Nova::Server
+ properties:
+ name: { get_param: segw_0_name }
+ image: { get_param: image_segw_name }
+ availability_zone: { get_param: availability_zone_0 }
+ flavor: { get_param: flavor_segw_name }
+ scheduler_hints: { group: { get_resource: SeGW_Affinity } }
+ networks:
+ - port: { get_resource: port_segw_0_oam_protected }
+ - port: { get_resource: port_segw_0_internet }
+ - port: { get_resource: port_segw_0_dummi }
+ metadata:
+ vnf_id: { get_param: vnf_id }
+
+ port_segw_0_oam_protected:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: oam_protected_net_0_id }
+ fixed_ips: [{"ip_address": {get_param: segw_0_oam_protected_ip}}]
+ security_groups: [{get_resource: segw_security_group}]
+
+ port_segw_0_internet:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: INTERNET_direct_net_id }
+ fixed_ips: [{"ip_address": {get_param: segw_0_inet_ip_0}}, {"ip_address": {get_param: segw_0_inet_ip_1}}, {"ip_address": {get_param: segw_0_inet_ip_2}}]
+ security_groups: [{get_resource: segw_security_group}]
+
+ port_segw_0_dummi:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_resource: Dummi0_net }
+ security_groups: [{get_resource: segw_security_group}]
+
+ server_segw_segw_1:
+ type: OS::Nova::Server
+ properties:
+ name: { get_param: segw_1_name }
+ image: { get_param: image_segw_name }
+ availability_zone: { get_param: availability_zone_0 }
+ flavor: { get_param: flavor_segw_name }
+ scheduler_hints: { group: { get_resource: SeGW_Affinity } }
+ networks:
+ - port: { get_resource: port_segw_1_oam_protected }
+ - port: { get_resource: port_segw_1_internet }
+ - port: { get_resource: port_segw_1_dummi }
+ metadata:
+ vnf_id: { get_param: vnf_id }
+
+ port_segw_1_oam_protected:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: oam_protected_net_0_id }
+ fixed_ips: [{"ip_address": {get_param: segw_1_oam_protected_ip}}]
+ security_groups: [{get_resource: segw_security_group}]
+
+ port_segw_1_internet:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: INTERNET_direct_net_id }
+ fixed_ips: [{"ip_address": {get_param: segw_1_inet_ip_0}}, {"ip_address": {get_param: segw_1_inet_ip_1}}, {"ip_address": {get_param: segw_1_inet_ip_2}}]
+ security_groups: [{get_resource: segw_security_group}]
+
+ port_segw_1_dummi:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_resource: Dummi1_net }
+ security_groups: [{get_resource: segw_security_group}]
+
+ server_vsrx_fw_0:
+ type: OS::Nova::Server
+ properties:
+ name: { get_param: vsrx_fw_0_name }
+ image: { get_param: image_vsrxfw_name }
+ availability_zone: { get_param: availability_zone_0 }
+ flavor: { get_param: flavor_vsrxfw_name }
+ scheduler_hints: { group: { get_resource: vSRXFW_Affinity } }
+ networks:
+ - port: { get_resource: port_vsrx_fw_0_oam_mgmt }
+ - port: { get_resource: port_vsrx_fw_0_dummi }
+ - port: { get_resource: port_vsrx_fw_0_GN }
+ - port: { get_resource: port_vsrx_fw_0_HSL }
+
+ metadata:
+ vnf_id: { get_param: vnf_id }
+
+ port_vsrx_fw_0_oam_mgmt:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: oam_mgmt_net_0_id }
+ security_groups: [{get_resource: segw_security_group}]
+
+ port_vsrx_fw_0_dummi:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_resource: Dummi0_net }
+ security_groups: [{get_resource: segw_security_group}]
+
+ port_vsrx_fw_0_GN:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: GN_direct_net_0_id }
+# fixed_ips: [{"ip_address": {get_param: vsrx_fw_0_GN_direct_ip}}]
+ security_groups: [{get_resource: segw_security_group}]
+
+ port_vsrx_fw_0_HSL:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_resource: hsl_direct_net }
+ security_groups: [{get_resource: segw_security_group}]
+
+ server_vsrx_fw_1:
+ type: OS::Nova::Server
+ properties:
+ name: { get_param: vsrx_fw_1_name }
+ image: { get_param: image_vsrxfw_name }
+ availability_zone: { get_param: availability_zone_0 }
+ flavor: { get_param: flavor_vsrxfw_name }
+ scheduler_hints: { group: { get_resource: vSRXFW_Affinity } }
+ networks:
+ - port: { get_resource: port_vsrx_fw_1_oam_mgmt }
+ - port: { get_resource: port_vsrx_fw_1_dummi }
+ - port: { get_resource: port_vsrx_fw_1_GN }
+ - port: { get_resource: port_vsrx_fw_1_HSL }
+
+ metadata:
+ vnf_id: { get_param: vnf_id }
+
+ port_vsrx_fw_1_oam_mgmt:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: oam_mgmt_net_0_id }
+ security_groups: [{get_resource: segw_security_group}]
+
+ port_vsrx_fw_1_dummi:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_resource: Dummi1_net }
+ security_groups: [{get_resource: segw_security_group}]
+
+ port_vsrx_fw_1_GN:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: GN_direct_net_1_id }
+# fixed_ips: [{"ip_address": {get_param: vsrx_fw_1_GN_direct_ip}}]
+ security_groups: [{get_resource: segw_security_group}]
+
+ port_vsrx_fw_1_HSL:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_resource: hsl_direct_net }
+ security_groups: [{get_resource: segw_security_group}]
+
+ server_vsrx_fw_2:
+ type: OS::Nova::Server
+ properties:
+ name: { get_param: vsrx_fw_2_name }
+ image: { get_param: image_vsrxfw_name }
+ availability_zone: { get_param: availability_zone_0 }
+ flavor: { get_param: flavor_vsrxfw_name }
+ scheduler_hints: { group: { get_resource: vSRXFW_Affinity } }
+ networks:
+ - port: { get_resource: port_vsrx_fw_2_oam_mgmt }
+ - port: { get_resource: port_vsrx_fw_2_dummi }
+ - port: { get_resource: port_vsrx_fw_2_OAM }
+ - port: { get_resource: port_vsrx_fw_2_HSL }
+
+ metadata:
+ vnf_id: { get_param: vnf_id }
+
+ port_vsrx_fw_2_oam_mgmt:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: oam_mgmt_net_0_id }
+ security_groups: [{get_resource: segw_security_group}]
+
+ port_vsrx_fw_2_dummi:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_resource: Dummi0_net }
+ security_groups: [{get_resource: segw_security_group}]
+
+ port_vsrx_fw_2_OAM:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: Mobility_OAM_protected_net_0_id }
+# fixed_ips: [{"ip_address": {get_param: vsrx_fw_2_OAM_protected_ip}}]
+ security_groups: [{get_resource: segw_security_group}]
+
+ port_vsrx_fw_2_HSL:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_resource: hsl_direct_net }
+ security_groups: [{get_resource: segw_security_group}]
+
+ server_vsrx_fw_3:
+ type: OS::Nova::Server
+ properties:
+ name: { get_param: vsrx_fw_3_name }
+ image: { get_param: image_vsrxfw_name }
+ availability_zone: { get_param: availability_zone_0 }
+ flavor: { get_param: flavor_vsrxfw_name }
+ scheduler_hints: { group: { get_resource: vSRXFW_Affinity } }
+ networks:
+ - port: { get_resource: port_vsrx_fw_3_oam_mgmt }
+ - port: { get_resource: port_vsrx_fw_3_dummi }
+ - port: { get_resource: port_vsrx_fw_3_OAM }
+ - port: { get_resource: port_vsrx_fw_3_HSL }
+
+ metadata:
+ vnf_id: { get_param: vnf_id }
+
+ port_vsrx_fw_3_oam_mgmt:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: oam_mgmt_net_0_id }
+ security_groups: [{get_resource: segw_security_group}]
+
+ port_vsrx_fw_3_dummi:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_resource: Dummi1_net }
+ security_groups: [{get_resource: segw_security_group}]
+
+ port_vsrx_fw_3_OAM:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_param: Mobility_OAM_protected_net_1_id }
+# fixed_ips: [{"ip_address": {get_param: vsrx_fw_3_OAM_protected_ip}}]
+ security_groups: [{get_resource: segw_security_group}]
+
+ port_vsrx_fw_3_HSL:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_resource: hsl_direct_net }
+ security_groups: [{get_resource: segw_security_group}]
+
+conditions:
+ cd1: True
+ cd2:
+ get_param: param1
+ cd3:
+ equals:
+ - get_param: param2
+ - yes
+ cd4:
+ not:
+ equals:
+ - get_param: param3
+ - yes
+ cd5:
+ and:
+ - equals:
+ - get_param: env_type
+ - prod
+ - not:
+ equals:
+ - get_param: zone
+ - beijing
+ cd6:
+ or:
+ - equals:
+ - get_param: zone
+ - shanghai
+ - equals:
+ - get_param: zone
+ - beijing
+ cd7:
+ not: cd4
+ cd8:
+ and:
+ - cd1
+ - cd2
+ create_prod_res: {equals : [{get_param: env_type}, "prod"]} \ No newline at end of file