summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-heat-lib/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/lib/openecomp-heat-lib/src/test')
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/services/HeatResourceUtilTest.java89
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/services/HeatStructureUtilTest.java146
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/services/manifest/ManifestUtilTest.java109
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerTest.java65
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerUtilTest.java230
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/services/tree/ToscaTreeManagerTest.java163
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/model/MANIFEST.json48
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/model/base_cscf_volume.env9
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/model/base_cscf_volume.yaml103
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/model/first.env2
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/model/first.yaml71
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/model/nested.yml76
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/model/network.yml733
-rw-r--r--openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/model/second.yaml14
14 files changed, 1785 insertions, 73 deletions
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/services/HeatResourceUtilTest.java b/openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/services/HeatResourceUtilTest.java
new file mode 100644
index 0000000000..93f8fc9f23
--- /dev/null
+++ b/openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/services/HeatResourceUtilTest.java
@@ -0,0 +1,89 @@
+/*
+ *
+ * Copyright © 2017-2018 European Support Limited
+ *
+ * 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.
+ * /
+ *
+ */
+
+package org.openecomp.sdc.heat.services;
+
+import java.util.Optional;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.openecomp.sdc.heat.datatypes.model.HeatResourcesTypes;
+
+public class HeatResourceUtilTest {
+
+ private static final String ROLE = "role";
+
+ @Test
+ public void testEvaluateNetworkRoleFromResourceIdEmpty() {
+ Assert.assertFalse(HeatResourceUtil.evaluateNetworkRoleFromResourceId(null, null).isPresent());
+ }
+
+ @Test
+ public void testEvaluateNetworkRoleFromResourceIdNeutronExternal() {
+ Optional<String> networkRole = HeatResourceUtil.evaluateNetworkRoleFromResourceId(
+ "vm_type_1_role_port_1", HeatResourcesTypes.NEUTRON_PORT_RESOURCE_TYPE.getHeatResource());
+
+ Assert.assertTrue(networkRole.isPresent());
+ Assert.assertEquals(networkRole.get(), ROLE);
+ }
+
+ @Test
+ public void testEvaluateNetworkRoleFromResourceIdNeutronInternal() {
+ Optional<String> networkRole = HeatResourceUtil.evaluateNetworkRoleFromResourceId(
+ "vm_type_1_int_role_port_1", HeatResourcesTypes.NEUTRON_PORT_RESOURCE_TYPE.getHeatResource());
+
+ Assert.assertTrue(networkRole.isPresent());
+ Assert.assertEquals(networkRole.get(), ROLE);
+ }
+
+ @Test
+ public void testEvaluateNetworkRoleFromResourceIdVMIExternal() {
+ Optional<String> networkRole = HeatResourceUtil.evaluateNetworkRoleFromResourceId(
+ "vm_type_1_role_vmi_1", HeatResourcesTypes.CONTRAIL_V2_VIRTUAL_MACHINE_INTERFACE_RESOURCE_TYPE
+ .getHeatResource());
+
+ Assert.assertTrue(networkRole.isPresent());
+ Assert.assertEquals(networkRole.get(), ROLE);
+ }
+
+ @Test
+ public void testEvaluateNetworkRoleFromResourceIdVMIInternal() {
+ Optional<String> networkRole = HeatResourceUtil.evaluateNetworkRoleFromResourceId(
+ "vm_type_1_int_role_vmi_1", HeatResourcesTypes.CONTRAIL_V2_VIRTUAL_MACHINE_INTERFACE_RESOURCE_TYPE
+ .getHeatResource());
+
+ Assert.assertTrue(networkRole.isPresent());
+ Assert.assertEquals(networkRole.get(), ROLE);
+ }
+
+ @Test
+ public void testExtractNetworkRoleFromSubInterfaceIdEmpty() {
+ Assert.assertFalse(HeatResourceUtil.extractNetworkRoleFromSubInterfaceId(null, null).isPresent());
+ }
+
+ @Test
+ public void testExtractNetworkRoleFromSubInterfaceId() {
+ Optional<String> networkRole = HeatResourceUtil.extractNetworkRoleFromSubInterfaceId(
+ "vm_type_1_subint_role_vmi_1", HeatResourcesTypes.CONTRAIL_V2_VIRTUAL_MACHINE_INTERFACE_RESOURCE_TYPE
+ .getHeatResource());
+
+ Assert.assertTrue(networkRole.isPresent());
+ Assert.assertEquals(networkRole.get(), ROLE);
+ }
+}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/services/HeatStructureUtilTest.java b/openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/services/HeatStructureUtilTest.java
new file mode 100644
index 0000000000..70f149be2c
--- /dev/null
+++ b/openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/services/HeatStructureUtilTest.java
@@ -0,0 +1,146 @@
+/*
+ *
+ * Copyright © 2017-2018 European Support Limited
+ *
+ * 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.
+ * /
+ *
+ */
+
+package org.openecomp.sdc.heat.services;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.openecomp.core.validation.types.GlobalValidationContext;
+import org.openecomp.sdc.heat.datatypes.model.ResourceReferenceFunctions;
+
+public class HeatStructureUtilTest {
+
+ @Mock
+ private GlobalValidationContext globalValidationContextMock;
+
+ @Before
+ public void setUp() throws Exception {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ @Test
+ public void testIsResourceNestedFalse() {
+ Assert.assertFalse(HeatStructureUtil.isNestedResource("Test.txt"));
+ }
+
+ @Test
+ public void testIsResourceNestedNull() {
+ Assert.assertFalse(HeatStructureUtil.isNestedResource(null));
+ }
+
+ @Test
+ public void testIsResourceNestedTrue() {
+ Assert.assertTrue(HeatStructureUtil.isNestedResource("Test.yml"));
+ }
+
+ @Test
+ public void testGetReferencedValuesByFunctionNameAddMessageCall() {
+ Map<String, Object> propertyMap = new HashMap<>();
+ propertyMap.put(ResourceReferenceFunctions.GET_RESOURCE.getFunction(), Collections.emptyList());
+
+ Mockito.doNothing().when(globalValidationContextMock).addMessage(Mockito.anyString(), Mockito.any(),
+ Mockito.anyString());
+
+ Set<String> valueNames = HeatStructureUtil.getReferencedValuesByFunctionName("Main.yml",
+ ResourceReferenceFunctions.GET_RESOURCE.getFunction(), propertyMap, globalValidationContextMock);
+
+ Mockito.verify(globalValidationContextMock, Mockito.times(1))
+ .addMessage(Mockito.anyString(), Mockito.any(), Mockito.anyString());
+ Assert.assertTrue(valueNames.isEmpty());
+ }
+
+ @Test
+ public void testGetReferencedValuesByFunctionNameGetFile() {
+ Map<String, Object> propertyMap = new HashMap<>();
+ propertyMap.put(ResourceReferenceFunctions.GET_FILE.getFunction(), "file:///filename");
+
+ Set<String> valueNames = HeatStructureUtil.getReferencedValuesByFunctionName("Main.yml",
+ ResourceReferenceFunctions.GET_FILE.getFunction(), propertyMap, globalValidationContextMock);
+
+ Assert.assertFalse(valueNames.isEmpty());
+ Assert.assertTrue(valueNames.contains("filename"));
+ }
+
+ @Test
+ public void testGetReferencedValuesByFunctionNameGetFileValueList() {
+ Map<String, Object> propertyMap = new HashMap<>();
+ propertyMap
+ .put(ResourceReferenceFunctions.GET_FILE.getFunction(), Collections.singletonList("file:///filename"));
+
+ Set<String> valueNames = HeatStructureUtil.getReferencedValuesByFunctionName("Main.yml",
+ ResourceReferenceFunctions.GET_FILE.getFunction(), propertyMap, globalValidationContextMock);
+
+ Assert.assertFalse(valueNames.isEmpty());
+ Assert.assertTrue(valueNames.contains("filename"));
+ }
+
+ @Test
+ public void testGetReferencedValuesByFunctionNameGetFileValueListWithAnotherList() {
+ Map<String, Object> propertyMap = new HashMap<>();
+ propertyMap.put(ResourceReferenceFunctions.GET_FILE.getFunction(),
+ Collections.singletonList(Collections.emptyList()));
+
+ Set<String> valueNames = HeatStructureUtil.getReferencedValuesByFunctionName("Main.yml",
+ ResourceReferenceFunctions.GET_FILE.getFunction(), propertyMap, globalValidationContextMock);
+
+ Assert.assertTrue(valueNames.isEmpty());
+ }
+
+ @Test
+ public void testGetReferencedValuesByFunctionNamePassingPropertyMapWithSet() {
+ Set<String> valueNames = HeatStructureUtil.getReferencedValuesByFunctionName("Main.yml",
+ ResourceReferenceFunctions.GET_FILE.getFunction(), Collections.singletonList(new HashSet<>()),
+ globalValidationContextMock);
+
+ Assert.assertTrue(valueNames.isEmpty());
+ }
+
+ @Test
+ public void testGetReferencedValuesByFunctionNameGetFileValueListSet() {
+ Map<String, Object> propertyMap = new HashMap<>();
+ propertyMap.put(ResourceReferenceFunctions.GET_FILE.getFunction(),
+ new HashSet<>());
+
+ Set<String> valueNames = HeatStructureUtil.getReferencedValuesByFunctionName("Main.yml",
+ ResourceReferenceFunctions.GET_FILE.getFunction(), propertyMap, globalValidationContextMock);
+
+ Assert.assertTrue(valueNames.isEmpty());
+ }
+
+ @Test
+ public void testGetReferencedValuesByFunctionNameIncorrectKeyWithSet() {
+ Map<String, Object> propertyMap = new HashMap<>();
+ propertyMap.put("test", new HashSet<>());
+
+ Set<String> valueNames = HeatStructureUtil.getReferencedValuesByFunctionName("Main.yml",
+ ResourceReferenceFunctions.GET_FILE.getFunction(), propertyMap, globalValidationContextMock);
+
+ Assert.assertTrue(valueNames.isEmpty());
+ }
+}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/services/manifest/ManifestUtilTest.java b/openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/services/manifest/ManifestUtilTest.java
new file mode 100644
index 0000000000..13cf5c901e
--- /dev/null
+++ b/openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/services/manifest/ManifestUtilTest.java
@@ -0,0 +1,109 @@
+/*
+ *
+ * Copyright © 2017-2018 European Support Limited
+ *
+ * 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.
+ * /
+ *
+ */
+
+package org.openecomp.sdc.heat.services.manifest;
+
+import java.util.Collections;
+import java.util.Map;
+import java.util.Set;
+import org.junit.Assert;
+import org.junit.Test;
+import org.openecomp.sdc.heat.datatypes.manifest.FileData;
+import org.openecomp.sdc.heat.datatypes.manifest.ManifestContent;
+
+public class ManifestUtilTest {
+
+ @Test
+ public void testGetFileAndItsEnvNull() {
+ Assert.assertTrue(ManifestUtil.getFileAndItsEnv(new ManifestContent()).isEmpty());
+ }
+
+ @Test
+ public void testGetFileAndItsEnv() {
+
+ Assert.assertEquals(ManifestUtil.getFileAndItsEnv(createManifestContent()).size(), 1);
+ }
+
+ @Test
+ public void testGetFileTypeMapDataNull() {
+ Assert.assertTrue(ManifestUtil.getFileTypeMap(new ManifestContent()).isEmpty());
+ }
+
+ @Test
+ public void testGetFileTypeMap() {
+ Map<String, FileData.Type> fileTypeMap = ManifestUtil.getFileTypeMap(createManifestContent());
+
+ Assert.assertEquals(fileTypeMap.size(), 2);
+ Assert.assertTrue(fileTypeMap.containsKey("Main.yml") && fileTypeMap.containsKey("Test.yml"));
+ }
+
+ @Test
+ public void testGetFileTypeMapDataBlank() {
+ ManifestContent manifestContent = new ManifestContent();
+ manifestContent.setData(Collections.emptyList());
+
+ Assert.assertTrue(ManifestUtil.getFileTypeMap(manifestContent).isEmpty());
+ }
+
+ @Test
+ public void testGetArtifactsDataNull() {
+ Assert.assertTrue(ManifestUtil.getArtifacts(new ManifestContent()).isEmpty());
+ }
+
+ @Test
+ public void testGetArtifacts() {
+ ManifestContent manifestContent = createManifestContent();
+ manifestContent.getData().get(0).getData().get(0).setType(FileData.Type.OTHER);
+
+ Set<String> typeSet = ManifestUtil.getArtifacts(manifestContent);
+ Assert.assertEquals(typeSet.size(), 1);
+ Assert.assertTrue(typeSet.contains("Test.yml"));
+ }
+
+ @Test
+ public void testGetBaseFilesDataNull() {
+ Assert.assertTrue(ManifestUtil.getArtifacts(new ManifestContent()).isEmpty());
+ }
+
+ @Test
+ public void testGetBaseFiles() {
+ Set<String> typeSet = ManifestUtil.getBaseFiles(createManifestContent());
+ Assert.assertEquals(typeSet.size(), 1);
+ Assert.assertTrue(typeSet.contains("Main.yml"));
+ }
+
+ private ManifestContent createManifestContent() {
+
+ FileData fileData1 = new FileData();
+ fileData1.setFile("Test.yml");
+ fileData1.setType(FileData.Type.HEAT_ENV);
+
+ FileData fileData = new FileData();
+ fileData.setFile("Main.yml");
+ fileData.setType(FileData.Type.HEAT_ENV);
+ fileData.setBase(true);
+
+ fileData.setData(Collections.singletonList(fileData1));
+
+ ManifestContent manifestContent = new ManifestContent();
+ manifestContent.setData(Collections.singletonList(fileData));
+
+ return manifestContent;
+ }
+}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerTest.java b/openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerTest.java
new file mode 100644
index 0000000000..e3e19792f5
--- /dev/null
+++ b/openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerTest.java
@@ -0,0 +1,65 @@
+/*
+ *
+ * Copyright © 2017-2018 European Support Limited
+ *
+ * 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.
+ * /
+ *
+ */
+
+package org.openecomp.sdc.heat.services.tree;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.List;
+import org.junit.Assert;
+import org.junit.Test;
+import org.openecomp.core.utilities.file.FileUtils;
+import org.openecomp.sdc.common.utils.SdcCommon;
+import org.openecomp.sdc.heat.datatypes.structure.HeatStructureTree;
+
+public class HeatTreeManagerTest {
+
+ @Test
+ public void testCreateTree() throws IOException {
+ HeatTreeManager heatTreeManager = new HeatTreeManager();
+ addFile(heatTreeManager, "mock/model/MANIFEST.json", SdcCommon.MANIFEST_NAME);
+ addFile(heatTreeManager, "mock/model/first.yaml", "first.yaml");
+ addFile(heatTreeManager, "mock/model/second.yaml", "second.yaml");
+ addFile(heatTreeManager, "mock/model/first.env", "first.env");
+ addFile(heatTreeManager, "mock/model/base_cscf_volume.yaml", "base_cscf_volume.yaml");
+ addFile(heatTreeManager, "mock/model/network.yml", "network.yml");
+ addFile(heatTreeManager, "mock/model/testHeat.yml", "testHeat.yml");
+ addFile(heatTreeManager, "mock/model/nested.yml", "nested.yml");
+ addFile(heatTreeManager, "mock/model/base_cscf_volume.env", "base_cscf_volume.env");
+
+ heatTreeManager.createTree();
+
+ HeatStructureTree heatStructureTree = heatTreeManager.getTree();
+ Assert.assertNotNull(heatStructureTree);
+ Assert.assertEquals(1, heatStructureTree.getHeat().size());
+ Assert.assertEquals(1, heatStructureTree.getNetwork().size());
+ }
+
+ private void addFile(HeatTreeManager heatTreeManager, String fileLocation, String fileName)
+ throws IOException {
+
+ List<URL> urlList = FileUtils.getAllLocations(fileLocation);
+ try (InputStream inputStream = new FileInputStream(new File(urlList.get(0).getPath()))) {
+ heatTreeManager.addFile(fileName, inputStream);
+ }
+ }
+}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerUtilTest.java b/openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerUtilTest.java
new file mode 100644
index 0000000000..6e34350d19
--- /dev/null
+++ b/openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/services/tree/HeatTreeManagerUtilTest.java
@@ -0,0 +1,230 @@
+/*
+ *
+ * Copyright © 2017-2018 European Support Limited
+ *
+ * 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.
+ * /
+ *
+ */
+
+package org.openecomp.sdc.heat.services.tree;
+
+import java.io.File;
+import java.net.URL;
+import java.util.AbstractMap;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.openecomp.core.utilities.file.FileContentHandler;
+import org.openecomp.core.utilities.file.FileUtils;
+import org.openecomp.core.validation.types.GlobalValidationContext;
+import org.openecomp.sdc.heat.datatypes.model.HeatOrchestrationTemplate;
+import org.openecomp.sdc.heat.datatypes.model.Resource;
+
+public class HeatTreeManagerUtilTest {
+
+ private static final String TEST_YML = "test.yml";
+ private static final String TEST = "test";
+ private static final String RESOURCE_DEF = "resource_def";
+
+ @Mock
+ private HeatTreeManager heatTreeManager;
+
+ @Before
+ public void setUp() throws Exception {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ @Test
+ public void testInitHeatTreeManager() {
+ FileContentHandler fileContentHandler = getFileContentHandler();
+
+ Mockito.doNothing().when(heatTreeManager).addFile(Mockito.any(), Mockito.any());
+ HeatTreeManagerUtil.initHeatTreeManager(fileContentHandler);
+ Mockito.verify(heatTreeManager, Mockito.times(0)).addFile(Mockito.any(), Mockito.any());
+ }
+
+ @Test
+ public void testGetNestedFiles() {
+ HeatOrchestrationTemplate heatOrchestrationTemplate = new HeatOrchestrationTemplate();
+ heatOrchestrationTemplate.setResources(getResourceMap("Type1.yml"));
+ Set<String> nestedFilesSet = HeatTreeManagerUtil.getNestedFiles(heatOrchestrationTemplate);
+
+ Assert.assertNotNull(nestedFilesSet);
+ Assert.assertEquals(nestedFilesSet.size(), 1);
+ }
+
+ @Test
+ public void testGetResourceDefNested() {
+ HeatOrchestrationTemplate heatOrchestrationTemplate = new HeatOrchestrationTemplate();
+ heatOrchestrationTemplate.setResources(getResourceMap("OS::Heat::ResourceGroup"));
+
+ Set<String> nestedFilesSet = HeatTreeManagerUtil.getNestedFiles(heatOrchestrationTemplate);
+ Assert.assertNotNull(nestedFilesSet);
+ Assert.assertTrue(nestedFilesSet.size() == 1 && nestedFilesSet.contains(TEST_YML));
+ }
+
+ @Test
+ public void testGetArtifactFiles() {
+ HeatOrchestrationTemplate heatOrchestrationTemplate = new HeatOrchestrationTemplate();
+ heatOrchestrationTemplate.setResources(getResourceMap("Type1.yml"));
+ Set<String> nestedFilesSet = HeatTreeManagerUtil.getArtifactFiles("filename.yml", heatOrchestrationTemplate,
+ null);
+
+ Assert.assertNotNull(nestedFilesSet);
+ Assert.assertTrue(nestedFilesSet.contains(TEST));
+ }
+
+ @Test
+ public void testGetResourceDefIfProvidedResourceIsNull() {
+ Assert.assertNull(HeatTreeManagerUtil.getResourceDef(new Resource()));
+ }
+
+ @Test
+ public void testGetResourceDef() {
+ Resource resource = new Resource();
+
+ Map<String, Object> resourceMap = new HashMap<>();
+ Map<String, String> nestedResourceMap = new HashMap<String, String>() {{
+ put("type", TEST_YML);
+ }};
+
+ resourceMap.put(RESOURCE_DEF, nestedResourceMap);
+ resource.setProperties(resourceMap);
+ Resource resultResource = HeatTreeManagerUtil.getResourceDef(resource);
+ Assert.assertNotNull(resultResource);
+ Assert.assertEquals(TEST_YML, resultResource.getType());
+ }
+
+ @Test
+ public void testCheckResourceGroupTypeValid() {
+ Resource resource = new Resource();
+
+ Map<String, Object> resourceMap = new HashMap<>();
+ Map<String, Object> nestedResourceMap = new HashMap<String, Object>() {{
+ put("type", Collections.emptyList());
+ }};
+
+ resourceMap.put(RESOURCE_DEF, nestedResourceMap);
+ resource.setProperties(resourceMap);
+
+ GlobalValidationContext globalValidationContextMock = Mockito.mock(GlobalValidationContext.class);
+ Mockito.doNothing().when(globalValidationContextMock).addMessage(Mockito.anyString(), Mockito.any(), Mockito
+ .anyString());
+
+ HeatTreeManagerUtil.checkResourceGroupTypeValid(TEST_YML, TEST, resource, globalValidationContextMock);
+
+ Mockito.verify(globalValidationContextMock, Mockito.times(1))
+ .addMessage(Mockito.anyString(), Mockito.any(), Mockito.anyString());
+ }
+
+ @Test
+ public void testCheckResourceTypeValid() {
+ Resource resource = new Resource();
+
+ Map<String, Object> resourceMap = new HashMap<>();
+ Map<String, Object> nestedResourceMap = new HashMap<String, Object>() {{
+ put("properties", Collections.emptyList());
+ }};
+
+ resourceMap.put(RESOURCE_DEF, nestedResourceMap);
+ resource.setProperties(resourceMap);
+
+ GlobalValidationContext globalValidationContextMock = Mockito.mock(GlobalValidationContext.class);
+ Mockito.doNothing().when(globalValidationContextMock).addMessage(Mockito.anyString(), Mockito.any(), Mockito
+ .anyString());
+
+ HeatTreeManagerUtil.checkResourceTypeValid(TEST_YML, TEST, resource, globalValidationContextMock);
+
+ Mockito.verify(globalValidationContextMock, Mockito.times(1))
+ .addMessage(Mockito.anyString(), Mockito.any(), Mockito.anyString());
+ }
+
+ @Test
+ public void testCheckIfResourceGroupTypeIsNested() {
+ Resource resource = new Resource();
+
+ Map<String, Object> resourceMap = new HashMap<>();
+ Map<String, Object> nestedResourceMap = new HashMap<String, Object>() {{
+ put("type", TEST_YML);
+ }};
+
+ resourceMap.put(RESOURCE_DEF, nestedResourceMap);
+ resource.setProperties(resourceMap);
+
+ GlobalValidationContext globalValidationContextMock = Mockito.mock(GlobalValidationContext.class);
+ Mockito.doNothing().when(globalValidationContextMock).addMessage(Mockito.anyString(), Mockito.any(), Mockito
+ .anyString());
+
+ boolean result = HeatTreeManagerUtil
+ .checkIfResourceGroupTypeIsNested(TEST_YML, TEST, resource, globalValidationContextMock);
+
+ Mockito.verify(globalValidationContextMock, Mockito.times(1))
+ .addMessage(Mockito.anyString(), Mockito.any(), Mockito.anyString());
+
+ Assert.assertTrue(result);
+ }
+
+ @Test
+ public void testCheckIfResourceGroupTypeIsNestedNull() {
+ Assert.assertFalse(HeatTreeManagerUtil.checkIfResourceGroupTypeIsNested(TEST_YML, TEST, new Resource(),
+ null));
+ }
+
+ private FileContentHandler getFileContentHandler() {
+ FileContentHandler fileContentHandler = new FileContentHandler();
+ Map<String, byte[]> filesByteMap = new HashMap<>();
+ List<URL> urlList = FileUtils.getAllLocations("mock/model");
+ File files = new File(urlList.get(0).getPath());
+ if (files.isDirectory()) {
+ int fileCount = 0;
+ for (File file : Objects.requireNonNull(files.listFiles())) {
+ byte[] bytesArray = new byte[(int) file.length()];
+ filesByteMap.put("File" + ++fileCount, bytesArray);
+ }
+ }
+
+ fileContentHandler.setFiles(filesByteMap);
+
+ return fileContentHandler;
+ }
+
+ private Map<String, Resource> getResourceMap(String type) {
+ Resource resource = new Resource();
+ resource.setType(type);
+ Map<String, String> map = new HashMap<>();
+ map.put("get_file", TEST);
+ resource.setProperties(new HashMap<String, Object>() {{
+ put("get_file", Collections.singletonList(map));
+ put("resource_def", new HashMap<String, Object>() {{
+ put("type", TEST_YML);
+ }});
+ }});
+
+
+ return Stream.of(new AbstractMap.SimpleEntry<>("Res1", resource))
+ .collect(Collectors.toMap(AbstractMap.SimpleEntry::getKey, AbstractMap.SimpleEntry::getValue));
+ }
+}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/services/tree/ToscaTreeManagerTest.java b/openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/services/tree/ToscaTreeManagerTest.java
index 0cfac52318..4ccf7ea623 100644
--- a/openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/services/tree/ToscaTreeManagerTest.java
+++ b/openecomp-be/lib/openecomp-heat-lib/src/test/java/org/openecomp/sdc/heat/services/tree/ToscaTreeManagerTest.java
@@ -1,86 +1,103 @@
+/*
+ * Copyright © 2017-2018 European Support Limited
+ *
+ * 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.
+ **/
+
package org.openecomp.sdc.heat.services.tree;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.regex.Pattern;
+
import org.junit.Assert;
import org.junit.Test;
import org.openecomp.core.utilities.file.FileUtils;
import org.openecomp.core.utilities.json.JsonUtil;
import org.openecomp.sdc.heat.datatypes.structure.HeatStructureTree;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.util.regex.Pattern;
-
public class ToscaTreeManagerTest {
- private static final String BASE_DIR = "/mock/toscaTree/";
- private static final String IN = "in";
- private static final String OUT = "out";
- private static final String EXPECTED_TREE_FILE = "/expectedTree.json";
- private ToscaTreeManager toscaTreeManager = new ToscaTreeManager();
-
- @Test
- public void testTreeWithDiffFileNames() throws IOException {
- String inputDirectory = BASE_DIR + "diffFileNames/" + IN;
- String outputFileName = BASE_DIR + "diffFileNames/" + OUT + EXPECTED_TREE_FILE;
-
- testTreeManager(inputDirectory, outputFileName);
- }
-
- @Test
- public void testDirectoriesWithSimilarNameUnderDifferentRoots() throws IOException {
- String inputDirectory = BASE_DIR + "similarDirectoryName/" + IN;
- String outputFileName = BASE_DIR + "similarDirectoryName/" + OUT + EXPECTED_TREE_FILE;
-
- testTreeManager(inputDirectory, outputFileName);
- }
-
- @Test
- public void testTwoFilesUnderSameDirectory() throws IOException {
- String inputDirectory = BASE_DIR + "twoFilesUnderSameDirectory/" + IN;
- String outputFileName = BASE_DIR + "twoFilesUnderSameDirectory/" + OUT + EXPECTED_TREE_FILE;
-
- testTreeManager(inputDirectory, outputFileName);
- }
-
- private void testTreeManager(String inputDirectory, String outputFileName) throws IOException {
- initTreeManager(inputDirectory);
- toscaTreeManager.createTree();
- HeatStructureTree tree = toscaTreeManager.getTree();
-
- validateToscaTree(outputFileName, tree);
- }
-
- private void validateToscaTree(String outputFileName, HeatStructureTree tree) throws IOException {
- String actualTree = JsonUtil.object2Json(tree);
- File expectedTreeFile = new File(this.getClass().getResource(outputFileName).getFile());
-
- String expectedTree;
- try(FileInputStream fis = new FileInputStream(expectedTreeFile)) {
- expectedTree = new String(FileUtils.toByteArray(fis));
+
+ private static final String BASE_DIR = "/mock/toscaTree/";
+ private static final String IN = "in";
+ private static final String OUT = "out";
+ private static final String EXPECTED_TREE_FILE = "/expectedTree.json";
+ private ToscaTreeManager toscaTreeManager = new ToscaTreeManager();
+
+ @Test
+ public void testTreeWithDiffFileNames() throws IOException {
+ String inputDirectory = BASE_DIR + "diffFileNames/" + IN;
+ String outputFileName = BASE_DIR + "diffFileNames/" + OUT + EXPECTED_TREE_FILE;
+
+ testTreeManager(inputDirectory, outputFileName);
+ }
+
+ @Test
+ public void testDirectoriesWithSimilarNameUnderDifferentRoots() throws IOException {
+ String inputDirectory = BASE_DIR + "similarDirectoryName/" + IN;
+ String outputFileName = BASE_DIR + "similarDirectoryName/" + OUT + EXPECTED_TREE_FILE;
+
+ testTreeManager(inputDirectory, outputFileName);
+ }
+
+ @Test
+ public void testTwoFilesUnderSameDirectory() throws IOException {
+ String inputDirectory = BASE_DIR + "twoFilesUnderSameDirectory/" + IN;
+ String outputFileName = BASE_DIR + "twoFilesUnderSameDirectory/" + OUT + EXPECTED_TREE_FILE;
+
+ testTreeManager(inputDirectory, outputFileName);
}
- Assert.assertNotNull(expectedTree);
- expectedTree = expectedTree.trim().replace("\r", "");
- Assert.assertEquals(expectedTree, actualTree);
- }
-
- private void initTreeManager(String inputDir) throws IOException {
- String fileName = inputDir.replace("/", File.separator);
- File directory = new File(this.getClass().getResource(inputDir).getFile());
-
- addFilesToTreeManager(fileName, directory.listFiles());
- }
-
- private void addFilesToTreeManager(String baseDir, File[] listFiles) throws IOException {
- for (File file : listFiles) {
- if (file.isDirectory()) {
- addFilesToTreeManager(baseDir, file.listFiles());
- } else {
- toscaTreeManager.addFile(getFileNameWithoutTestDirectory(baseDir, file.getPath()), new byte[2]);
- }
+
+ private void testTreeManager(String inputDirectory, String outputFileName) throws IOException {
+ initTreeManager(inputDirectory);
+ toscaTreeManager.createTree();
+ HeatStructureTree tree = toscaTreeManager.getTree();
+
+ validateToscaTree(outputFileName, tree);
}
- }
- private String getFileNameWithoutTestDirectory(String baseDir, String fileName) {
- return fileName.split(Pattern.quote(baseDir) + Pattern.quote(File.separator))[1];
- }
+ private void validateToscaTree(String outputFileName, HeatStructureTree tree) throws IOException {
+ File expectedTreeFile = new File(this.getClass().getResource(outputFileName).getFile());
+
+ String expectedTree;
+ try (FileInputStream fis = new FileInputStream(expectedTreeFile)) {
+ expectedTree = new String(FileUtils.toByteArray(fis));
+ }
+ Assert.assertNotNull(expectedTree);
+ expectedTree = expectedTree.trim().replace("\r", "");
+ String actualTree = JsonUtil.object2Json(tree);
+ Assert.assertEquals(expectedTree, actualTree);
+ }
+
+ private void initTreeManager(String inputDir) {
+ String fileName = inputDir.replace("/", File.separator);
+ File directory = new File(this.getClass().getResource(inputDir).getFile());
+
+ addFilesToTreeManager(fileName, directory.listFiles());
+ }
+
+ private void addFilesToTreeManager(String baseDir, File[] listFiles) {
+ for (File file : listFiles) {
+ if (file.isDirectory()) {
+ addFilesToTreeManager(baseDir, file.listFiles());
+ } else {
+ toscaTreeManager.addFile(getFileNameWithoutTestDirectory(baseDir, file.getPath()), new byte[2]);
+ }
+ }
+ }
+
+ private String getFileNameWithoutTestDirectory(String baseDir, String fileName) {
+ return fileName.split(Pattern.quote(baseDir) + Pattern.quote(File.separator))[1];
+ }
} \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/model/MANIFEST.json b/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/model/MANIFEST.json
new file mode 100644
index 0000000000..fefb79cf5b
--- /dev/null
+++ b/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/model/MANIFEST.json
@@ -0,0 +1,48 @@
+{
+ "name": "validTest",
+ "description": "Valid Test",
+ "version": "1610",
+ "data": [
+ {
+ "file": "first.yaml",
+ "type": "HEAT",
+ "isBase": true,
+ "data": [
+ {
+ "file": "first.env",
+ "type": "HEAT_ENV"
+ },
+ {
+ "file": "base_cscf_volume.yaml",
+ "type": "HEAT_VOL",
+ "data": [
+ {
+ "file": "base_cscf_volume.env",
+ "type": "HEAT_ENV"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "file": "nested.yml",
+ "type": "HEAT",
+ "isBase": false
+ },
+ {
+ "file": "network.yml",
+ "type": "HEAT_NET"
+ },
+ {
+ "file": "testHeat.yml",
+ "type": "OTHER"
+ },
+ {
+ "file": "testHeat.yml",
+ "type": "VF_LICENSE"
+ },
+ {
+ "file": "envSettings.env"
+ }
+ ]
+} \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/model/base_cscf_volume.env b/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/model/base_cscf_volume.env
new file mode 100644
index 0000000000..9f0eef670c
--- /dev/null
+++ b/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/model/base_cscf_volume.env
@@ -0,0 +1,9 @@
+## Name: "base_cscf_volume.env"
+## Date: 20 Mar 2017
+## Kilo Version
+parameters:
+# PSEUDO CONSTANTS
+# -----------------------------------------------------------------------------
+ cif_volume_size_0: 300
+ oam_volume_size_0: 300
+ vcscf_name_delimeter: "_" \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/model/base_cscf_volume.yaml b/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/model/base_cscf_volume.yaml
new file mode 100644
index 0000000000..145f82e9ec
--- /dev/null
+++ b/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/model/base_cscf_volume.yaml
@@ -0,0 +1,103 @@
+## Name: "base_cscf_volume.yaml"
+## Date: 20 Mar 2017
+## Kilo Version
+heat_template_version: 2015-04-30
+
+description: Volume template for CFX
+
+parameters:
+ vnf_name:
+ type: string
+ description: Unique name for this VF instance
+
+ vcscf_name_delimeter:
+ type: string
+ description: 'delimeter used in concatenating different words while naming (ex: "-","_",".",...)'
+ constraints:
+ - allowed_values: [ '-', '', '_', '.']
+
+ availability_zone_0:
+ type: string
+ description: Storage availability zone for volume of first vm
+
+ availability_zone_1:
+ type: string
+ description: Storage availability zone for volume of second vm
+
+ cif_volume_size_0:
+ type: number
+ description: Size of Volume for cif VMs
+ constraints:
+ - range: { min: 1, max: 300 }
+
+ oam_volume_size_0:
+ type: number
+ description: Size of Volume for oam VMs
+ constraints:
+ - range: { min: 1, max: 300 }
+
+resources:
+ cif_volume_0:
+ type: OS::Cinder::Volume
+ properties:
+ size: { get_param: cif_volume_size_0 }
+ availability_zone: { get_param: availability_zone_0}
+ name:
+ str_replace:
+ template: "$VNF$DELcif$DELvolume$DEL0"
+ params:
+ $VNF: { get_param: vnf_name }
+ $DEL: { get_param: vcscf_name_delimeter }
+
+ cif_volume_1:
+ type: OS::Cinder::Volume
+ properties:
+ availability_zone: { get_param: availability_zone_1}
+ size: { get_param: cif_volume_size_0 }
+ name:
+ str_replace:
+ template: "$VNF$DELcif$DELvolume$DEL1"
+ params:
+ $VNF: { get_param: vnf_name }
+ $DEL: { get_param: vcscf_name_delimeter }
+
+ oam_volume_0:
+ type: OS::Cinder::Volume
+ properties:
+ size: { get_param: oam_volume_size_0 }
+ availability_zone: { get_param: availability_zone_0}
+ name:
+ str_replace:
+ template: "$VNF$DELoam$DELvolume$DEL0"
+ params:
+ $VNF: { get_param: vnf_name }
+ $DEL: { get_param: vcscf_name_delimeter }
+
+ oam_volume_1:
+ type: OS::Cinder::Volume
+ properties:
+ size: { get_param: oam_volume_size_0 }
+ availability_zone: { get_param: availability_zone_1}
+ name:
+ str_replace:
+ template: "$VNF$DELoam$DELvolume$DEL1"
+ params:
+ $VNF: { get_param: vnf_name }
+ $DEL: { get_param: vcscf_name_delimeter }
+
+outputs:
+ cif_volume_id_0:
+ description: volume id for first cif
+ value: {get_resource: cif_volume_0}
+
+ cif_volume_id_1:
+ description: volume id for second cif
+ value: {get_resource: cif_volume_1}
+
+ oam_volume_id_0:
+ description: volume id for first oam
+ value: {get_resource: oam_volume_0}
+
+ oam_volume_id_1:
+ description: volume id for second oam
+ value: {get_resource: oam_volume_1}
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/model/first.env b/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/model/first.env
new file mode 100644
index 0000000000..90bdb18e56
--- /dev/null
+++ b/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/model/first.env
@@ -0,0 +1,2 @@
+parameters:
+network_ids: Internal2_net_id \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/model/first.yaml b/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/model/first.yaml
new file mode 100644
index 0000000000..02234e9222
--- /dev/null
+++ b/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/model/first.yaml
@@ -0,0 +1,71 @@
+heat_template_version: 2013-05-23
+description: heat expose volume resource
+
+parameters:
+ network_ids:
+ type: string
+ label: FBS2 label
+ description: FBS2 internal id2
+
+resources:
+ vm_config:
+ type: OS::Heat::SoftwareConfig
+ properties:
+ group: ungrouped
+ config:
+ str_replace:
+ template: {get_file: envSettings.env}
+
+ cmaui_port_2:
+ type: OS::Neutron::Port
+ properties:
+ network: { get_resource: test_net1 }
+ fixed_ips: [{"ip_address": {get_param: [cmaui_oam_ips, 0]}}]
+ security_groups: [{get_param: security_group_name}]
+ replacement_policy: AUTO
+
+ test_net1:
+ type: OS::Neutron::Net
+ properties:
+ name: {get_param: jsa_net_name}
+ shared: True
+
+ FSB2_Internal1:
+ type: OS::Neutron::Port
+ properties:
+ network_id: Internal1_net_id
+ FSB2_Internal2:
+ type: OS::Neutron::Port
+ properties:
+ network_id: { get_param: [network_ids, 0] }
+ FSB2_OAM:
+ type: OS::Neutron::Port
+ properties:
+ network_id: { get_param: Internal1_net_name }
+ FSB2:
+ type: OS::Nova::Server
+ properties:
+ name: fsb2_name_2
+ block_device_mapping: [{device_name: "vda", volume_id : {get_param: cif_volume_id_0 }, delete_on_termination: "false" }]
+ flavor: fsb2_flavor_name
+ availability_zone: availability_zone_0
+ metadata:
+ VNF_id: { get_param: vnfvfVF_id }
+ vf_module_id: { get_param: vf_module_id }
+ networks:
+ - port: { get_resource: FSB2_Internal1 }
+ - port: { get_resource: FSB2_Internal2 }
+ - port: { get_resource: FSB2_OAM }
+
+ test_nested:
+ type: nested.yml
+ properties:
+ p2: { get_resource: cmaui_port_2}
+ net1: { get_resource: test_net1}
+
+outputs:
+ expose_resource_nove_output:
+ description: the pcrf_server
+ value: { get_resource: FSB2 }
+
+
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/model/nested.yml b/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/model/nested.yml
new file mode 100644
index 0000000000..e68541e3ae
--- /dev/null
+++ b/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/model/nested.yml
@@ -0,0 +1,76 @@
+heat_template_version: 2013-05-23
+
+description: cmaui server template for vMMSC
+
+parameters:
+ p1:
+ type: number
+ p2:
+ type: string
+ net1:
+ type: string
+ net2:
+ type: string
+ lb_st_vlan_type_oam:
+ description: dummy
+ type: string
+ mac_address:
+ type: string
+ virtual_ip_address:
+ type: string
+ virtual_ipv6_address:
+ type: string
+ vlan_ids:
+ type: string
+ subinterface_name_prefix:
+ type: string
+ subinterface_instance_index:
+ type: number
+resources:
+
+
+ vdbe_0_subint_untr_vmi_0:
+ type: OS::ContrailV2::VirtualMachineInterface
+ properties:
+ name:
+ str_replace:
+ template: $NAME$VLAN
+ params:
+ $NAME: { get_param: subinterface_name_prefix }
+ $VLAN: { get_param: [ vlan_ids, { get_param: subinterface_instance_index } ] }
+ virtual_machine_interface_properties:
+ {
+ virtual_machine_interface_properties_sub_interface_vlan_tag: { get_param: lb_st_vlan_type_oam }
+ }
+ virtual_machine_interface_mac_addresses:
+ {
+ virtual_machine_interface_mac_addresses_mac_address: [{ get_param: mac_address }],
+ }
+ virtual_machine_interface_allowed_address_pairs:
+ {
+ virtual_machine_interface_allowed_address_pairs_allowed_address_pair: [
+ {
+ virtual_machine_interface_allowed_address_pairs_allowed_address_pair_address_mode: active-standby,
+ virtual_machine_interface_allowed_address_pairs_allowed_address_pair_mac: { get_param: mac_address },
+ virtual_machine_interface_allowed_address_pairs_allowed_address_pair_ip:
+ {
+ virtual_machine_interface_allowed_address_pairs_allowed_address_pair_ip_ip_prefix: { get_param: virtual_ip_address },
+ virtual_machine_interface_allowed_address_pairs_allowed_address_pair_ip_ip_prefix_len: 32
+ }
+ },
+ {
+ virtual_machine_interface_allowed_address_pairs_allowed_address_pair_address_mode: active-standby,
+ virtual_machine_interface_allowed_address_pairs_allowed_address_pair_mac: { get_param: mac_address },
+ virtual_machine_interface_allowed_address_pairs_allowed_address_pair_ip:
+ {
+ virtual_machine_interface_allowed_address_pairs_allowed_address_pair_ip_ip_prefix: { get_param: virtual_ipv6_address },
+ virtual_machine_interface_allowed_address_pairs_allowed_address_pair_ip_ip_prefix_len: 128
+ }
+ }
+ ]
+ }
+ virtual_network_refs: [{ get_param: net2 },{ get_param: net1 }]
+ virtual_machine_interface_refs: [{ get_param: p2 }]
+
+
+
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/model/network.yml b/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/model/network.yml
new file mode 100644
index 0000000000..f069d4dd23
--- /dev/null
+++ b/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/model/network.yml
@@ -0,0 +1,733 @@
+heat_template_version: 2013-05-23
+
+description: heat template that creates MOG stack
+
+parameters:
+ pd_server_names:
+ type: comma_delimited_list
+ label: PD server names
+ description: name of the PD instance
+ pd_image_name:
+ type: string
+ label: image name
+ description: PD image name
+ pd_flavor_name:
+ type: string
+ label: PD flavor name
+ description: flavor name of PD instance
+ oam_server_names:
+ type: comma_delimited_list
+ label: OAM server names
+ description: name of the OAM instance
+ oam_image_name:
+ type: string
+ label: image name
+ description: OAM image name
+ oam_flavor_name:
+ type: string
+ label: OAM flavor name
+ description: flavor name of OAM instance
+ sm_server_names:
+ type: comma_delimited_list
+ label: SM server names
+ description: name of the SM instance
+ sm_image_name:
+ type: string
+ label: image name
+ description: SM image name
+ sm_flavor_name:
+ type: string
+ label: SM flavor name
+ description: flavor name of SM instance
+ ps_server_names:
+ type: comma_delimited_list
+ label: PS server names
+ description: name of the PS instance
+ ps_image_name:
+ type: string
+ label: PS image name
+ description: PS image name
+ ps_flavor_name:
+ type: string
+ label: PS flavor name
+ description: flavor name of PS instance
+ cm_server_names:
+ type: comma_delimited_list
+ label: CM server names
+ description: name of the CM instance
+ cm_image_name:
+ type: string
+ label: image name
+ description: CM image name
+ cm_flavor_name:
+ type: string
+ label: CM flavor name
+ description: flavor name of CM instance
+ availabilityzone_name:
+ type: string
+ label: availabilityzone name
+ description: availabilityzone name
+ oam_net_name:
+ type: string
+ label: oam network name
+ description: name of the oam network
+ oam_net_ips:
+ type: comma_delimited_list
+ label: internet network ips
+ description: ip of the OAM network
+ # internet_net_name:
+ # type: string
+ # label: internet network name
+ # description: id of the internet network
+ # internet_net_ips:
+ # type: comma_delimited_list
+ # label: internet network ips
+ # description: ip of the internet network
+ # internet_net_floating_ip:
+ # type: string
+ # label: mog internet virtual ip
+ # description: mog internet virtual ip
+ sl_net_name:
+ type: string
+ label: silver lining network name
+ description: id of the sl network
+ sl_net_ips:
+ type: comma_delimited_list
+ label: silver lining network ips
+ description: ips of the sl network
+ sl_net_floating_ip:
+ type: string
+ label: mog sl net virtual ip
+ description: mog sl net virtual ip
+ repl_net_name:
+ type: string
+ label: Replication network name
+ description: name of the replication network
+ repl_net_ips:
+ type: comma_delimited_list
+ label: repl network ips
+ description: ips of repl network
+ rx_net_name:
+ type: string
+ label: Rx network name
+ description: Rx network name
+ rx_net_ips:
+ type: comma_delimited_list
+ label: Rx network ips
+ description: Rx network ips
+ rx_net_floating_ip:
+ type: string
+ label: mog rx net virtual ip
+ description: mog rx net virtual ip
+ ran_net_name:
+ type: string
+ label: RAN network name
+ description: RAN network name
+ ran_net_ips:
+ type: comma_delimited_list
+ label: RAN network ips
+ description: RAN network ip
+ ran_net_floating_ip:
+ type: string
+ label: mog ran net virtual ip
+ description: mog ran net virtual ip
+ csb_net_name:
+ type: string
+ label: csb internal network name
+ description: csb internal network name
+ csb_net_start:
+ type: string
+ label: csb internal start
+ description: csb internal start
+ csb_net_end:
+ type: string
+ label: csb internal end
+ description: csb internal end
+ csb_net_cidr:
+ type: string
+ label: csb ineternal cidr
+ description: csb internal cidr
+ csb_net_netmask:
+ type: string
+ description: CSB internal network subnet mask
+ csb_net_ips:
+ type: comma_delimited_list
+ description: mog_csb_net IP addresses
+ dummy_net_name_0:
+ type: string
+ label: csb internal network name
+ description: csb internal network name
+ dummy_net_start_0:
+ type: string
+ label: csb internal start
+ description: csb internal start
+ dummy_net_end_0:
+ type: string
+ label: csb internal end
+ description: csb internal end
+ dummy_net_cidr_0:
+ type: string
+ label: csb ineternal cidr
+ description: csb internal cidr
+ dummy_net_netmask_0:
+ type: string
+ description: CSB internal network subnet mask
+ dummy_net_name_1:
+ type: string
+ label: csb internal network name
+ description: csb internal network name
+ dummy_net_start_1:
+ type: string
+ label: csb internal start
+ description: csb internal start
+ dummy_net_end_1:
+ type: string
+ label: csb internal end
+ description: csb internal end
+ dummy_net_cidr_1:
+ type: string
+ label: csb ineternal cidr
+ description: csb internal cidr
+ dummy_net_netmask_1:
+ type: string
+ description: CSB internal network subnet mask
+
+ security_group_name:
+ type: string
+ label: security group name
+ description: the name of security group
+ cluster-manager-vol-1:
+ type: string
+ label: mog-cm-vol-1
+ description: Cluster Manager volume 1
+ session-manager-vol-1:
+ type: string
+ label: mog-sm-vol-1
+ description: Session Manager volume 1
+ session-manager-vol-2:
+ type: string
+ label: mog-sm-vol-2
+ description: Session Manager volume 2
+ oam-vol-1:
+ type: string
+ label: mog-oam-vol-1
+ description: OAM volume 1
+ oam-vol-2:
+ type: string
+ label: mog-oam-vol-2
+ description: OAM volume 2
+ mog_swift_container:
+ type: string
+ label: mog Config URL
+ description: Config URL
+ mog_script_dir:
+ type: string
+ label: mog Config script directory
+ description: Config script directory
+ mog_script_name:
+ type: string
+ label: mog Config script name
+ description: Config script name
+ mog_parameter_name:
+ type: string
+ label: mog script parameter name
+ description: Config script parameter csv file name
+ cluster-manager-vol-2:
+ type: string
+ label: mog-cm-vol-2
+ description: Cluster Manager volume 2 with ISO image
+
+resources:
+ mog_security_group:
+ type: OS::Neutron::SecurityGroup
+ properties:
+ description: mog security group
+ name: {get_param: security_group_name}
+ 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}
+ ]
+
+ csb_net:
+ type: OS::Contrail::VirtualNetwork
+ properties:
+ name: { get_param: csb_net_name}
+
+ csb_ip_subnet:
+ type: OS::Neutron::Subnet
+ properties:
+ name: {get_param: csb_net_name}
+ network_id: { get_resource: csb_net }
+ cidr: { get_param: csb_net_cidr }
+ allocation_pools: [{"start": {get_param: csb_net_start}, "end": {get_param: csb_net_end}}]
+ enable_dhcp: true
+
+ dummy_net_0:
+ type: OS::Contrail::VirtualNetwork
+ properties:
+ name: { get_param: dummy_net_name_0}
+
+ dummy_ip_subnet_0:
+ type: OS::Neutron::Subnet
+ properties:
+ name: {get_param: dummy_net_name_0}
+ network_id: { get_resource: dummy_net_0 }
+ cidr: { get_param: dummy_net_cidr_0 }
+ allocation_pools: [{"start": {get_param: dummy_net_start_0}, "end": {get_param: dummy_net_end_0}}]
+ enable_dhcp: true
+
+ dummy_net_1:
+ type: OS::Contrail::VirtualNetwork
+ properties:
+ name: { get_param: dummy_net_name_1}
+
+ dummy_ip_subnet_1:
+ type: OS::Neutron::Subnet
+ properties:
+ name: {get_param: dummy_net_name_1}
+ network_id: { get_resource: dummy_net_1 }
+ cidr: { get_param: dummy_net_cidr_1 }
+ allocation_pools: [{"start": {get_param: dummy_net_start_1}, "end": {get_param: dummy_net_end_1}}]
+ enable_dhcp: true
+
+
+ mogconfig:
+ type: OS::Heat::SoftwareConfig
+ properties:
+ group: ungrouped
+ config:
+ str_replace:
+ template: |
+ #!/bin/bash
+ wget -P script_dir swift_container/script_name
+ wget -P script_dir swift_container/parameter_name
+ chmod 755 script_dir/script_name
+ script_dir/script_name
+ params:
+ swift_container: {get_param: mog_swift_container}
+ script_dir: {get_param: mog_script_dir}
+ script_name: {get_param: mog_script_name}
+ #parameter_name: {get_param: mog_parameter_name}
+
+
+ servergroup_mog01:
+ type: OS::Nova::ServerGroup
+ properties:
+ policies:
+ - anti-affinity
+ server_pd_01:
+ type: OS::Nova::Server
+ properties:
+# config_drive: "True"
+ name: {get_param: [pd_server_names, 0]}
+ image: {get_param: pd_image_name}
+ flavor: {get_param: pd_flavor_name}
+ availability_zone: {get_param: availabilityzone_name}
+ networks:
+ - port: {get_resource: pd01_port_0}
+ - port: {get_resource: pd01_port_1}
+ - port: {get_resource: pd01_port_2}
+ - port: {get_resource: pd01_port_3}
+ - port: {get_resource: pd01_port_4}
+ - port: {get_resource: pd01_port_5}
+ - port: {get_resource: pd01_port_6}
+ # - port: {get_resource: pd01_port_7}
+ user_data:
+ scheduler_hints: {group: {get_resource: servergroup_mog01}}
+ user_data_format: RAW
+
+
+ pd01_port_0:
+ type: OS::Neutron::Port
+ properties:
+ network: {get_resource: csb_net}
+ security_groups: [{get_resource: mog_security_group}]
+ pd01_port_1:
+ type: OS::Neutron::Port
+ properties:
+ network: {get_param: oam_net_name}
+ fixed_ips: [{"ip_address": {get_param: [oam_net_ips, 0]}}]
+ security_groups: [{get_resource: mog_security_group}]
+ pd01_port_2:
+ type: OS::Neutron::Port
+ properties:
+ network: {get_resource: dummy_net_0}
+ security_groups: [{get_resource: mog_security_group}]
+ pd01_port_3:
+ type: OS::Neutron::Port
+ properties:
+ network: {get_param: rx_net_name}
+ fixed_ips: [{"ip_address": {get_param: [rx_net_ips, 0]}}]
+ allowed_address_pairs: [{"ip_address": {get_param: rx_net_floating_ip} }]
+ security_groups: [{get_resource: mog_security_group}]
+ pd01_port_4:
+ type: OS::Neutron::Port
+ properties:
+ network: {get_resource: dummy_net_1}
+ security_groups: [{get_resource: mog_security_group}]
+ pd01_port_5:
+ type: OS::Neutron::Port
+ properties:
+ network: {get_param: ran_net_name}
+ fixed_ips: [{"ip_address": {get_param: [ran_net_ips, 0]}}]
+ allowed_address_pairs: [{"ip_address": {get_param: ran_net_floating_ip} }]
+ security_groups: [{get_resource: mog_security_group}]
+
+ pd01_port_6:
+ type: OS::Neutron::Port
+ properties:
+ network: {get_param: sl_net_name}
+ fixed_ips: [{"ip_address": {get_param: [sl_net_ips, 0]}}]
+ allowed_address_pairs: [{"ip_address": {get_param: sl_net_floating_ip}}]
+ security_groups: [{get_resource: mog_security_group}]
+
+ # pd01_port_7:
+ #j type: OS::Neutron::Port
+ # properties:
+ # network: {get_param: internet_net_name}
+ # fixed_ips: [{"ip_address": {get_param: [internet_net_ips, 0]}}]
+ # allowed_address_pairs: [{"ip_address": {get_param: internet_net_floating_ip} }]
+ # security_groups: [{get_resource: mog_security_group}]
+
+ server_pd_02:
+ type: OS::Nova::Server
+ properties:
+# config_drive: "True"
+ name: {get_param: [pd_server_names, 1]}
+ image: {get_param: pd_image_name}
+ flavor: {get_param: pd_flavor_name}
+ availability_zone: {get_param: availabilityzone_name}
+ networks:
+ - port: {get_resource: pd02_port_0}
+ - port: {get_resource: pd02_port_1}
+ - port: {get_resource: pd01_port_2}
+ - port: {get_resource: pd01_port_3}
+ - port: {get_resource: pd02_port_4}
+ - port: {get_resource: pd02_port_5}
+ - port: {get_resource: pd02_port_6}
+ # - port: {get_resource: pd02_port_7}
+
+ user_data:
+ scheduler_hints: {group: {get_resource: servergroup_mog01}}
+ user_data_format: RAW
+
+ pd02_port_0:
+ type: OS::Neutron::Port
+ properties:
+ network: {get_resource: csb_net}
+ security_groups: [{get_resource: mog_security_group}]
+
+ pd02_port_1:
+ type: OS::Neutron::Port
+ properties:
+ network: {get_param: oam_net_name}
+ fixed_ips: [{"ip_address": {get_param: [oam_net_ips, 1]}}]
+ security_groups: [{get_resource: mog_security_group}]
+
+ pd02_port_2:
+ type: OS::Neutron::Port
+ properties:
+ network: {get_resource: dummy_net_0}
+ security_groups: [{get_resource: mog_security_group}]
+
+ pd02_port_3:
+ type: OS::Neutron::Port
+ properties:
+ network: {get_param: rx_net_name}
+ fixed_ips: [{"ip_address": {get_param: [rx_net_ips, 1]}}]
+ allowed_address_pairs: [{"ip_address": {get_param: rx_net_floating_ip} }]
+ security_groups: [{get_resource: mog_security_group}]
+
+ pd02_port_4:
+ type: OS::Neutron::Port
+ properties:
+ network: {get_resource: dummy_net_1}
+ security_groups: [{get_resource: mog_security_group}]
+
+ pd02_port_5:
+ type: OS::Neutron::Port
+ properties:
+ network: {get_param: ran_net_name}
+ fixed_ips: [{"ip_address": {get_param: [ran_net_ips, 1]}}]
+ allowed_address_pairs: [{"ip_address": {get_param: ran_net_floating_ip} }]
+ security_groups: [{get_resource: mog_security_group}]
+
+ pd02_port_6:
+ type: OS::Neutron::Port
+ properties:
+ network: {get_param: sl_net_name}
+ fixed_ips: [{"ip_address": {get_param: [sl_net_ips, 1]}}]
+ allowed_address_pairs: [{"ip_address": {get_param: sl_net_floating_ip}}]
+ security_groups: [{get_resource: mog_security_group}]
+
+ # pd02_port_7:
+ # type: OS::Neutron::Port
+ # properties:
+ # network: {get_param: internet_net_name}
+ # fixed_ips: [{"ip_address": {get_param: [internet_net_ips, 1]}}]
+ # allowed_address_pairs: [{"ip_address": {get_param: internet_net_floating_ip} }]
+ # security_groups: [{get_resource: mog_security_group}]
+
+ servergroup_mog02:
+ type: OS::Nova::ServerGroup
+ properties:
+ policies:
+ - anti-affinity
+ server_oam01:
+ type: OS::Nova::Server
+ properties:
+# config_drive: "True"
+ name: {get_param: [oam_server_names, 0]}
+ image: {get_param: oam_image_name}
+ flavor: {get_param: oam_flavor_name}
+ availability_zone: {get_param: availabilityzone_name}
+ networks:
+ - port: {get_resource: oam01_port_0}
+ - port: {get_resource: oam01_port_1}
+# block_device_mapping:
+# - device_name: vdd
+# volume_id: { get_param: oam-vol-1 }
+ user_data:
+ scheduler_hints: {group: {get_resource: servergroup_mog02}}
+ user_data_format: RAW
+
+ oam01_port_0:
+ type: OS::Neutron::Port
+ properties:
+ network: {get_resource: csb_net}
+ security_groups: [{get_resource: mog_security_group}]
+
+ oam01_port_1:
+ type: OS::Neutron::Port
+ properties:
+ network: {get_param: oam_net_name}
+ fixed_ips: [{"ip_address": {get_param: [oam_net_ips, 2]}}]
+ security_groups: [{get_resource: mog_security_group}]
+
+
+ server_oam02:
+ type: OS::Nova::Server
+ properties:
+# config_drive: "True"
+ name: {get_param: [oam_server_names, 1]}
+ image: {get_param: oam_image_name}
+ flavor: {get_param: oam_flavor_name}
+ availability_zone: {get_param: availabilityzone_name}
+ networks:
+ - port: {get_resource: oam02_port_0}
+ - port: {get_resource: oam02_port_1}
+# block_device_mapping:
+# - device_name: vdd
+# volume_id: { get_param: oam-vol-2 }
+ user_data:
+ scheduler_hints: {group: {get_resource: servergroup_mog02}}
+ user_data_format: RAW
+
+ oam02_port_0:
+ type: OS::Neutron::Port
+ properties:
+ network: {get_resource: csb_net}
+ security_groups: [{get_resource: mog_security_group}]
+
+ oam02_port_1:
+ type: OS::Neutron::Port
+ properties:
+ network: {get_param: oam_net_name}
+ fixed_ips: [{"ip_address": {get_param: [oam_net_ips, 3]}}]
+ security_groups: [{get_resource: mog_security_group}]
+
+
+ server_sm01:
+ type: OS::Nova::Server
+ properties:
+# config_drive: "True"
+ name: {get_param: [sm_server_names, 0]}
+ image: {get_param: sm_image_name}
+ flavor: {get_param: sm_flavor_name}
+ availability_zone: {get_param: availabilityzone_name}
+ networks:
+ - port: {get_resource: sm01_port_0}
+ - port: {get_resource: sm01_port_1}
+# block_device_mapping:
+# - device_name: vdd
+# volume_id: { get_param: session-manager-vol-1 }
+ user_data:
+ scheduler_hints: {group: {get_resource: servergroup_mog02}}
+ user_data_format: RAW
+
+ sm01_port_0:
+ type: OS::Neutron::Port
+ properties:
+ network: {get_resource: csb_net}
+ security_groups: [{get_resource: mog_security_group}]
+
+ sm01_port_1:
+ type: OS::Neutron::Port
+ properties:
+ network: {get_resource: dummy_net_0}
+ security_groups: [{get_resource: mog_security_group}]
+
+ sm01_port_2:
+ type: OS::Neutron::Port
+ properties:
+ network: {get_param: repl_net_name}
+ fixed_ips: [{"ip_address": {get_param: [repl_net_ips, 0]}}]
+ security_groups: [{get_resource: mog_security_group}]
+
+ server_sm02:
+ type: OS::Nova::Server
+ properties:
+# config_drive: "True"
+ name: {get_param: [sm_server_names, 1]}
+ image: {get_param: sm_image_name}
+ flavor: {get_param: sm_flavor_name}
+ availability_zone: {get_param: availabilityzone_name}
+# block_device_mapping:
+# - device_name: vdd
+# volume_id: { get_param: session-manager-vol-2 }
+ networks:
+ - port: {get_resource: sm02_port_0}
+ - port: {get_resource: sm02_port_1}
+ user_data:
+ scheduler_hints: {group: {get_resource: servergroup_mog02}}
+ user_data_format: RAW
+
+ sm02_port_0:
+ type: OS::Neutron::Port
+ properties:
+ network: {get_resource: csb_net}
+ security_groups: [{get_resource: mog_security_group}]
+
+ sm02_port_1:
+ type: OS::Neutron::Port
+ properties:
+ network: {get_resource: dummy_net_0}
+ security_groups: [{get_resource: mog_security_group}]
+
+ sm02_port_2:
+ type: OS::Neutron::Port
+ properties:
+ network: {get_param: repl_net_name}
+ fixed_ips: [{"ip_address": {get_param: [repl_net_ips, 1]}}]
+ security_groups: [{get_resource: mog_security_group}]
+
+ servergroup_mog03:
+ type: OS::Nova::ServerGroup
+ properties:
+ policies:
+ - anti-affinity
+ server_ps01:
+ type: OS::Nova::Server
+ properties:
+# config_drive: "True"
+ name: {get_param: [ps_server_names, 0]}
+ image: {get_param: ps_image_name}
+ flavor: {get_param: ps_flavor_name}
+ availability_zone: {get_param: availabilityzone_name}
+ networks:
+ - port: {get_resource: ps01_port_0}
+ user_data:
+ scheduler_hints: {group: {get_resource: servergroup_mog03}}
+ user_data_format: RAW
+
+ ps01_port_0:
+ type: OS::Neutron::Port
+ properties:
+ network: {get_resource: csb_net}
+ security_groups: [{get_resource: mog_security_group}]
+
+ server_ps02:
+ type: OS::Nova::Server
+ properties:
+# config_drive: "True"
+ name: {get_param: [ps_server_names, 1]}
+ image: {get_param: ps_image_name}
+ flavor: {get_param: ps_flavor_name}
+ availability_zone: {get_param: availabilityzone_name}
+ networks:
+ - port: {get_resource: ps02_port_0}
+ user_data:
+ scheduler_hints: {group: {get_resource: servergroup_mog03}}
+ user_data_format: RAW
+
+ ps02_port_0:
+ type: OS::Neutron::Port
+ properties:
+ network: {get_resource: csb_net}
+ security_groups: [{get_resource: mog_security_group}]
+
+ server_ps03:
+ type: OS::Nova::Server
+ properties:
+ name: {get_param: [ps_server_names, 2]}
+ image: {get_param: ps_image_name}
+ flavor: {get_param: ps_flavor_name}
+ availability_zone: {get_param: availabilityzone_name}
+ networks:
+ - port: {get_resource: ps03_port_0}
+ user_data:
+ scheduler_hints: {group: {get_resource: servergroup_mog03}}
+ user_data_format: RAW
+
+ ps03_port_0:
+ type: OS::Neutron::Port
+ properties:
+ network: {get_resource: csb_net}
+ security_groups: [{get_resource: mog_security_group}]
+
+ server_ps04:
+ type: OS::Nova::Server
+ properties:
+ name: {get_param: [ps_server_names, 3]}
+ image: {get_param: ps_image_name}
+ flavor: {get_param: ps_flavor_name}
+ availability_zone: {get_param: availabilityzone_name}
+ networks:
+ - port: {get_resource: ps04_port_0}
+ user_data:
+ scheduler_hints: {group: {get_resource: servergroup_mog03}}
+ user_data_format: RAW
+
+ ps04_port_0:
+ type: OS::Neutron::Port
+ properties:
+ network: {get_resource: csb_net}
+ security_groups: [{get_resource: mog_security_group}]
+
+ server_cm01:
+ type: OS::Nova::Server
+ properties:
+# config_drive: "True"
+ name: {get_param: [cm_server_names, 0]}
+ image: {get_param: cm_image_name}
+ flavor: {get_param: cm_flavor_name}
+ availability_zone: {get_param: availabilityzone_name}
+ networks:
+ - port: {get_resource: cm01_port_0}
+ - port: {get_resource: cm01_port_1}
+# block_device_mapping:
+# - device_name: vdd
+# volume_id: { get_param: cluster-manager-vol-2 }
+# - device_name: vde
+# volume_id: { get_param: cluster-manager-vol-1 }
+ user_data:
+ scheduler_hints: {group: {get_resource: servergroup_mog03}}
+ user_data_format: RAW
+
+ cm01_port_0:
+ type: OS::Neutron::Port
+ properties:
+ network: {get_resource: csb_net}
+ fixed_ips: [{"ip_address": {get_param: [csb_net_ips, 10]}}]
+ security_groups: [{get_resource: mog_security_group}]
+
+ cm01_port_1:
+ type: OS::Neutron::Port
+ properties:
+ network: {get_param: oam_net_name}
+ fixed_ips: [{"ip_address": {get_param: [oam_net_ips, 4]}}]
+ security_groups: [{get_resource: mog_security_group}]
+
diff --git a/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/model/second.yaml b/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/model/second.yaml
new file mode 100644
index 0000000000..bb06b9d60a
--- /dev/null
+++ b/openecomp-be/lib/openecomp-heat-lib/src/test/resources/mock/model/second.yaml
@@ -0,0 +1,14 @@
+heat_template_version: 2013-05-23
+
+description: heat second
+
+resources:
+ network_expose:
+ type: OS::Neutron::Net
+
+outputs:
+ expose_resource_network_output:
+ description: the pcrf_server
+ value: { get_resource: network_expose }
+
+