summaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation')
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseFullTranslationTest.java180
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseResourceTranslationTest.java366
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ContrailV2VlanToInterfaceResourceConnectionTest.java77
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ContrailV2VmInterfaceToNetResourceConnectionTest.java138
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/DependsOnResourceBaseTranslationlTest.java148
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/MultipleHeatTranslationTest.java52
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/NovaToVolResourceConnectionTest.java148
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/PortToContrailV2VirtualNetworkResourceConnectionTest.java66
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/PortToNetResourceConnectionTest.java78
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationCinderVolumeAttachmentImplTest.java85
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationCinderVolumeImplTest.java36
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationContrailServiceInstanceImplTest.java99
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationContrailV2Test.java76
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationContrailV2VlanSubInterfaceImplTest.java62
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationContrailV2VmInterfaceImplTest.java113
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNeutronPortImplTest.java60
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNeutronSecurityGroupImplTest.java40
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNovaServerGroupsImplTest.java72
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationResourceGroupImplTest.java113
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/SecurityGroupToNovaResourceConnectionTest.java44
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/SecurityRulesToPortResourceConnectionTest.java109
21 files changed, 2162 insertions, 0 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseFullTranslationTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseFullTranslationTest.java
new file mode 100644
index 0000000000..9f0a6d79b9
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseFullTranslationTest.java
@@ -0,0 +1,180 @@
+/*-
+ * ============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.translator.services.heattotosca.impl.resourcetranslation;
+
+import static org.junit.Assert.assertEquals;
+
+import org.apache.commons.collections4.MapUtils;
+import org.junit.Assert;
+import org.junit.Before;
+import org.openecomp.config.api.Configuration;
+import org.openecomp.config.api.ConfigurationManager;
+import org.openecomp.core.translator.api.HeatToToscaTranslator;
+import org.openecomp.core.translator.datatypes.TranslatorOutput;
+import org.openecomp.core.translator.factory.HeatToToscaTranslatorFactory;
+import org.openecomp.core.utilities.file.FileUtils;
+import org.openecomp.core.validation.util.MessageContainerUtil;
+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.datatypes.error.ErrorLevel;
+import org.openecomp.sdc.datatypes.error.ErrorMessage;
+import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage;
+import org.openecomp.sdc.logging.types.LoggerConstants;
+import org.openecomp.sdc.logging.types.LoggerErrorCode;
+import org.openecomp.sdc.logging.types.LoggerTragetServiceName;
+import org.openecomp.sdc.tosca.services.ToscaFileOutputService;
+import org.openecomp.sdc.tosca.services.impl.ToscaFileOutputServiceCsarImpl;
+import org.openecomp.sdc.translator.TestUtils;
+import org.openecomp.sdc.translator.datatypes.heattotosca.TranslationContext;
+import org.openecomp.sdc.translator.services.heattotosca.ConfigConstants;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+
+
+public class BaseFullTranslationTest {
+
+ protected String inputFilesPath;
+ protected String outputFilesPath;
+ protected TranslationContext translationContext;
+
+ private String zipFilename = "VSP.zip";
+ private HeatToToscaTranslator heatToToscaTranslator;
+ private File translatedZipFile;
+
+ private Map<String, byte[]> expectedResultMap = new HashMap<>();
+ private Set<String> expectedResultFileNameSet = new HashSet<>();
+
+ @Before
+ public void setUp() throws IOException {
+ initTranslatorAndTranslate();
+ }
+
+ protected void testTranslationWithInit() throws IOException {
+ initTranslatorAndTranslate();
+ testTranslation();
+ }
+
+ protected void initTranslatorAndTranslate() throws IOException {
+ heatToToscaTranslator = HeatToToscaTranslatorFactory.getInstance().createInterface();
+ translatedZipFile = translateZipFile();
+ }
+
+ protected void testTranslation() throws IOException {
+
+ URL url = BaseFullTranslationTest.class.getResource(outputFilesPath);
+ expectedResultFileNameSet = new HashSet<>();
+
+ String path = url.getPath();
+ File pathFile = new File(path);
+ File[] files = pathFile.listFiles();
+ Assert.assertNotNull("manifest files is empty", files);
+ for (File expectedFile : files) {
+ expectedResultFileNameSet.add(expectedFile.getName());
+ try (FileInputStream input = new FileInputStream(expectedFile)) {
+ expectedResultMap.put(expectedFile.getName(), FileUtils.toByteArray(input));
+ }
+ }
+
+ try (FileInputStream fis = new FileInputStream(translatedZipFile);
+ ZipInputStream zis = new ZipInputStream(new BufferedInputStream(fis))) {
+ ZipEntry entry;
+ String name;
+ String expected;
+ String actual;
+
+ while ((entry = zis.getNextEntry()) != null) {
+
+ name = entry.getName()
+ .substring(entry.getName().lastIndexOf(File.separator) + 1, entry.getName().length());
+ if (expectedResultFileNameSet.contains(name)) {
+ expected = new String(expectedResultMap.get(name)).trim().replace("\r", "");
+ actual = new String(FileUtils.toByteArray(zis)).trim().replace("\r", "");
+ assertEquals("difference in file: " + name, expected, actual);
+
+ expectedResultFileNameSet.remove(name);
+ }
+ }
+ if (expectedResultFileNameSet.isEmpty()) {
+ expectedResultFileNameSet.forEach(System.out::println);
+ }
+ }
+ assertEquals(0, expectedResultFileNameSet.size());
+ }
+
+ private File translateZipFile() throws IOException {
+ URL inputFilesUrl = this.getClass().getResource(inputFilesPath);
+ String path = inputFilesUrl.getPath();
+ TestUtils.addFilesToTranslator(heatToToscaTranslator, path);
+ TranslatorOutput translatorOutput = heatToToscaTranslator.translate();
+ Assert.assertNotNull(translatorOutput);
+ if (MapUtils.isNotEmpty(translatorOutput.getErrorMessages()) && MapUtils.isNotEmpty(
+ MessageContainerUtil
+ .getMessageByLevel(ErrorLevel.ERROR, translatorOutput.getErrorMessages()))) {
+ MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+ LoggerTragetServiceName.VALIDATE_HEAT_BEFORE_TRANSLATE, ErrorLevel.ERROR.name(),
+ LoggerErrorCode.DATA_ERROR.getErrorCode(), "Can't translate HEAT file");
+ throw new CoreException((new ErrorCode.ErrorCodeBuilder()).withMessage(
+ "Error in validation " + getErrorAsString(translatorOutput.getErrorMessages()))
+ .withId("Validation Error").withCategory(ErrorCategory.APPLICATION).build());
+ }
+ File file = new File(path + "/" + zipFilename);
+ file.createNewFile();
+
+ try (FileOutputStream fos = new FileOutputStream(file)) {
+ ToscaFileOutputService toscaFileOutputService = new ToscaFileOutputServiceCsarImpl();
+ fos.write(
+ toscaFileOutputService.createOutputFile(translatorOutput.getToscaServiceModel(), null));
+ }
+
+ return file;
+ }
+
+ private String getErrorAsString(Map<String, List<ErrorMessage>> errorMessages) {
+ StringBuilder sb = new StringBuilder();
+ errorMessages.entrySet().forEach(
+ entry -> sb.append("File:").append(entry.getKey()).append(System.lineSeparator())
+ .append(getErrorList(entry.getValue())));
+
+ return sb.toString();
+ }
+
+ private String getErrorList(List<ErrorMessage> errors) {
+ StringBuilder sb = new StringBuilder();
+ errors.forEach(
+ error -> sb.append(error.getMessage()).append("[").append(error.getLevel()).append("]")
+ .append(System.lineSeparator()));
+ return sb.toString();
+ }
+
+}
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseResourceTranslationTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseResourceTranslationTest.java
new file mode 100644
index 0000000000..c5fcd442cb
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseResourceTranslationTest.java
@@ -0,0 +1,366 @@
+/*-
+ * ============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.translator.services.heattotosca.impl.resourcetranslation;
+
+import static org.junit.Assert.assertEquals;
+import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.ConsolidationDataTestUtil.validateComputeConnectivityIn;
+import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.ConsolidationDataTestUtil.validateComputeConnectivityOut;
+import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.ConsolidationDataTestUtil.validateDependsOnInConsolidationData;
+import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.ConsolidationDataTestUtil.validateGetAttr;
+import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.ConsolidationDataTestUtil.validateGroupsInConsolidationData;
+import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.ConsolidationDataTestUtil.validateNestedConsolidationData;
+import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.ConsolidationDataTestUtil.validatePortConnectivityIn;
+import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.ConsolidationDataTestUtil.validatePortConnectivityOut;
+import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.ConsolidationDataTestUtil.validatePortsInConsolidationData;
+import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.ConsolidationDataTestUtil.validateSubstituteMappingInConsolidationData;
+import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.ConsolidationDataTestUtil.validateVolumeInConsolidationData;
+
+import org.apache.commons.collections4.MapUtils;
+import org.junit.Assert;
+import org.junit.Before;
+import org.openecomp.core.translator.datatypes.TranslatorOutput;
+import org.openecomp.core.utilities.file.FileUtils;
+import org.openecomp.core.utilities.json.JsonUtil;
+import org.openecomp.core.validation.util.MessageContainerUtil;
+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.common.utils.SdcCommon;
+import org.openecomp.sdc.datatypes.error.ErrorLevel;
+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.manifest.ManifestFile;
+import org.openecomp.sdc.logging.context.impl.MdcDataErrorMessage;
+import org.openecomp.sdc.logging.types.LoggerConstants;
+import org.openecomp.sdc.logging.types.LoggerErrorCode;
+import org.openecomp.sdc.logging.types.LoggerTragetServiceName;
+import org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate;
+import org.openecomp.sdc.tosca.services.ToscaFileOutputService;
+import org.openecomp.sdc.tosca.services.impl.ToscaFileOutputServiceCsarImpl;
+import org.openecomp.sdc.translator.TestUtils;
+import org.openecomp.sdc.translator.datatypes.heattotosca.TranslationContext;
+import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.ComputeTemplateConsolidationData;
+import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.ConsolidationData;
+import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.FileComputeConsolidationData;
+import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.FilePortConsolidationData;
+import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.PortTemplateConsolidationData;
+import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.TypeComputeConsolidationData;
+import org.openecomp.sdc.translator.services.heattotosca.TranslationService;
+import org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.ConsolidationDataValidationType;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+
+
+public class BaseResourceTranslationTest {
+
+ protected String inputFilesPath;
+ protected String outputFilesPath;
+ protected TranslationContext translationContext;
+
+ private String zipFilename = "VSP.zip";
+ private TranslationService translationService;
+ private File translatedZipFile;
+
+ private Map<String, byte[]> expectedResultMap = new HashMap<>();
+ private Set<String> expectedResultFileNameSet = new HashSet<>();
+
+ private final String MANIFEST_NAME = SdcCommon.MANIFEST_NAME;
+ private String validationFilename = "validationOutput.json";
+
+ @Before
+ public void setUp() throws IOException {
+ initTranslatorAndTranslate();
+ }
+
+ protected void initTranslatorAndTranslate() throws IOException {
+ translationService = new TranslationService();
+ translationContext = new TranslationContext();
+ translatedZipFile = translateZipFile();
+ }
+
+ protected void testTranslation() throws IOException {
+
+ URL url = BaseResourceTranslationTest.class.getResource(outputFilesPath);
+
+ String path = url.getPath();
+ File pathFile = new File(path);
+ File[] files = pathFile.listFiles();
+ Assert.assertNotNull("manifest files is empty", files);
+ for (File expectedFile : files) {
+ expectedResultFileNameSet.add(expectedFile.getName());
+ try (FileInputStream input = new FileInputStream(expectedFile)) {
+ expectedResultMap.put(expectedFile.getName(), FileUtils.toByteArray(input));
+ }
+ }
+
+ try (FileInputStream fis = new FileInputStream(translatedZipFile);
+ ZipInputStream zis = new ZipInputStream(new BufferedInputStream(fis))) {
+ ZipEntry entry;
+ String name;
+ String expected;
+ String actual;
+
+ while ((entry = zis.getNextEntry()) != null) {
+
+ name = entry.getName()
+ .substring(entry.getName().lastIndexOf(File.separator) + 1, entry.getName().length());
+ if (expectedResultFileNameSet.contains(name)) {
+ expected = new String(expectedResultMap.get(name)).trim().replace("\r", "");
+ actual = new String(FileUtils.toByteArray(zis)).trim().replace("\r", "");
+ assertEquals("difference in file: " + name, expected, actual);
+
+ expectedResultFileNameSet.remove(name);
+ }
+ }
+ if (expectedResultFileNameSet.isEmpty()) {
+ expectedResultFileNameSet.forEach(System.out::println);
+ }
+ }
+ assertEquals(0, expectedResultFileNameSet.size());
+ }
+
+ private File translateZipFile() throws IOException {
+ URL inputFilesUrl = this.getClass().getResource(inputFilesPath);
+ String path = inputFilesUrl.getPath();
+ addFilesToTranslator(translationContext, path);
+ TranslatorOutput translatorOutput = translationService.translateHeatFiles(translationContext);
+ Assert.assertNotNull(translatorOutput);
+ if (MapUtils.isNotEmpty(translatorOutput.getErrorMessages()) && MapUtils.isNotEmpty(
+ MessageContainerUtil
+ .getMessageByLevel(ErrorLevel.ERROR, translatorOutput.getErrorMessages()))) {
+ MdcDataErrorMessage.createErrorMessageAndUpdateMdc(LoggerConstants.TARGET_ENTITY_DB,
+ LoggerTragetServiceName.VALIDATE_HEAT_BEFORE_TRANSLATE, ErrorLevel.ERROR.name(),
+ LoggerErrorCode.DATA_ERROR.getErrorCode(), "Can't translate HEAT file");
+ throw new CoreException((new ErrorCode.ErrorCodeBuilder()).withMessage(
+ "Error in validation " + getErrorAsString(translatorOutput.getErrorMessages()))
+ .withId("Validation Error").withCategory(ErrorCategory.APPLICATION).build());
+ }
+ File file = new File(path + "/" + zipFilename);
+ file.createNewFile();
+
+ try (FileOutputStream fos = new FileOutputStream(file)) {
+ ToscaFileOutputService toscaFileOutputService = new ToscaFileOutputServiceCsarImpl();
+ fos.write(
+ toscaFileOutputService.createOutputFile(translatorOutput.getToscaServiceModel(), null));
+ }
+
+ return file;
+ }
+
+ private String getErrorAsString(Map<String, List<ErrorMessage>> errorMessages) {
+ StringBuilder sb = new StringBuilder();
+ errorMessages.entrySet().forEach(
+ entry -> sb.append("File:").append(entry.getKey()).append(System.lineSeparator())
+ .append(getErrorList(entry.getValue())));
+
+ return sb.toString();
+ }
+
+ private String getErrorList(List<ErrorMessage> errors) {
+ StringBuilder sb = new StringBuilder();
+ errors.forEach(
+ error -> sb.append(error.getMessage()).append("[").append(error.getLevel()).append("]")
+ .append(System.lineSeparator()));
+ return sb.toString();
+ }
+
+ public void addFilesToTranslator(TranslationContext translationContext, String path)
+ throws IOException {
+ File manifestFile = new File(path);
+ File[] files = manifestFile.listFiles();
+ byte[] fileContent;
+
+ Assert.assertNotNull("manifest files is empty", files);
+
+ for (File file : files) {
+
+ try (FileInputStream fis = new FileInputStream(file)) {
+
+ fileContent = FileUtils.toByteArray(fis);
+
+ if (file.getName().equals(MANIFEST_NAME)) {
+ addManifest(translationContext, MANIFEST_NAME, fileContent);
+ } else {
+ if (!file.getName().equals(zipFilename) && (!file.getName().equals(validationFilename))) {
+ addFile(translationContext, file.getName(), fileContent);
+ }
+ }
+ }
+ }
+ }
+
+ public static void addManifest(TranslationContext translationContext,
+ String name, byte[] content) {
+ ManifestContent manifestData = JsonUtil.json2Object(new String(content), ManifestContent.class);
+ ManifestFile manifest = new ManifestFile();
+ manifest.setName(name);
+ manifest.setContent(manifestData);
+ translationContext.setManifest(manifest);
+ translationContext.addFile(name, content);
+ addFilesFromManifestToTranslationContextManifestFilesMap(translationContext, manifestData
+ .getData());
+ }
+
+ public static void addFile(TranslationContext translationContext,
+ String name, byte[] content) {
+ translationContext.addFile(name, content);
+ }
+
+ private static void addFilesFromManifestToTranslationContextManifestFilesMap(TranslationContext
+ translationContext, List<FileData> fileDataListFromManifest) {
+ for (FileData fileFromManfiest : fileDataListFromManifest) {
+ translationContext.addManifestFile(fileFromManfiest.getFile(), fileFromManfiest.getType());
+ }
+ }
+
+ public void validateSubsMappingInConsolidationData(){
+ ConsolidationData consolidationData = translationContext.getConsolidationData();
+ Map<String, ServiceTemplate> expectedServiceTemplateModels = TestUtils.getServiceTemplates
+ (expectedResultMap);
+ Assert.assertNotNull(consolidationData);
+ validateSubstituteMappingInConsolidationData(consolidationData,expectedServiceTemplateModels);
+ }
+
+ public void validateComputeTemplateConsolidationData(ConsolidationDataValidationType
+ validationType,
+ String testName) {
+ ConsolidationData consolidationData = translationContext.getConsolidationData();
+ Map<String, ServiceTemplate> expectedServiceTemplateModels = TestUtils.getServiceTemplates
+ (expectedResultMap);
+ Assert.assertNotNull(consolidationData);
+ Assert.assertNotNull(consolidationData.getComputeConsolidationData());
+ Set<String> serviceTemplateFileNames = consolidationData.getComputeConsolidationData()
+ .getAllServiceTemplateFileNames();
+ Assert.assertNotNull(serviceTemplateFileNames);
+ for(String serviceTemplateName : serviceTemplateFileNames){
+ Assert.assertTrue(expectedServiceTemplateModels.containsKey(serviceTemplateName));
+ ServiceTemplate expectedServiceTemplate = expectedServiceTemplateModels.get
+ (serviceTemplateName);
+ FileComputeConsolidationData fileComputeConsolidationData = consolidationData
+ .getComputeConsolidationData().getFileComputeConsolidationData(serviceTemplateName);
+ Assert.assertNotNull(fileComputeConsolidationData);
+ Set<String> computeTypes = fileComputeConsolidationData.getAllComputeTypes();
+ Assert.assertNotNull(computeTypes);
+ for(String computeType : computeTypes) {
+ TypeComputeConsolidationData typeComputeConsolidationData = fileComputeConsolidationData
+ .getTypeComputeConsolidationData(computeType);
+ Assert.assertNotNull(typeComputeConsolidationData);
+
+ Set<String> computeNodeTemplateIds = typeComputeConsolidationData
+ .getAllComputeNodeTemplateIds();
+ Assert.assertNotNull(computeNodeTemplateIds);
+ Assert.assertNotEquals(computeNodeTemplateIds.size(), 0);
+
+ for(String computeNodeTemplateId : computeNodeTemplateIds) {
+ ComputeTemplateConsolidationData computeTemplateConsolidationData =
+ typeComputeConsolidationData.getComputeTemplateConsolidationData
+ (computeNodeTemplateId);
+ switch(validationType){
+ case VALIDATE_GROUP:
+ validateGroupsInConsolidationData(computeNodeTemplateId,
+ computeTemplateConsolidationData, expectedServiceTemplate);
+ break;
+ case VALIDATE_PORT:
+ validatePortsInConsolidationData(computeNodeTemplateId,
+ computeTemplateConsolidationData,
+ expectedServiceTemplate);
+ break;
+ case VALIDATE_VOLUME:
+ validateVolumeInConsolidationData(computeNodeTemplateId,
+ computeTemplateConsolidationData, expectedServiceTemplate, testName);
+ break;
+ case VALIDATE_CONNECTIVITY:
+ validateComputeConnectivityIn(computeTemplateConsolidationData,
+ expectedServiceTemplate);
+ validateComputeConnectivityOut(computeNodeTemplateId,computeTemplateConsolidationData,
+ expectedServiceTemplate);
+ break;
+ case VALIDATE_DEPENDS_ON:
+ validateDependsOnInConsolidationData(computeNodeTemplateId,
+ computeTemplateConsolidationData,
+ expectedServiceTemplate, testName);
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ public void validateGetAttribute(String testName){
+ Map<String, ServiceTemplate> expectedServiceTemplateModels = TestUtils.getServiceTemplates
+ (expectedResultMap);
+ validateGetAttr(translationContext,expectedServiceTemplateModels,testName);
+ }
+
+ public void validateNestedTemplateConsolidationData(String testName){
+ validateNestedConsolidationData(translationContext, testName);
+ }
+
+ public void validatePortTemplateConsolidationData(ConsolidationDataValidationType
+ validationType,
+ String testName) {
+ ConsolidationData consolidationData = translationContext.getConsolidationData();
+ Map<String, ServiceTemplate> expectedServiceTemplateModels = TestUtils.getServiceTemplates
+ (expectedResultMap);
+ Assert.assertNotNull(consolidationData);
+ Assert.assertNotNull(consolidationData.getPortConsolidationData());
+ Set<String> serviceTemplateFileNames = consolidationData.getPortConsolidationData()
+ .getAllServiceTemplateFileNames();
+ Assert.assertNotNull(serviceTemplateFileNames);
+ for(String serviceTemplateName : serviceTemplateFileNames){
+ Assert.assertTrue(expectedServiceTemplateModels.containsKey(serviceTemplateName));
+ ServiceTemplate expectedServiceTemplate = expectedServiceTemplateModels.get
+ (serviceTemplateName);
+ FilePortConsolidationData filePortConsolidationData = consolidationData
+ .getPortConsolidationData().getFilePortConsolidationData(serviceTemplateName);
+ Assert.assertNotNull(filePortConsolidationData);
+
+ Set<String> portNodeTemplateIds = filePortConsolidationData.getAllPortNodeTemplateIds();
+ Assert.assertNotNull(portNodeTemplateIds);
+ Assert.assertNotEquals(portNodeTemplateIds.size(), 0);
+
+ for(String portNodeTemplateId : portNodeTemplateIds) {
+ PortTemplateConsolidationData portTemplateConsolidationData =
+ filePortConsolidationData.getPortTemplateConsolidationData(portNodeTemplateId);
+ switch(validationType){
+ case VALIDATE_CONNECTIVITY:
+ validatePortConnectivityIn(portTemplateConsolidationData,expectedServiceTemplate);
+ validatePortConnectivityOut(portNodeTemplateId, portTemplateConsolidationData,
+ expectedServiceTemplate);
+ break;
+ }
+ }
+ }
+ }
+}
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ContrailV2VlanToInterfaceResourceConnectionTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ContrailV2VlanToInterfaceResourceConnectionTest.java
new file mode 100644
index 0000000000..a6944bacad
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ContrailV2VlanToInterfaceResourceConnectionTest.java
@@ -0,0 +1,77 @@
+/*-
+ * ============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.translator.services.heattotosca.impl.resourcetranslation;
+
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import java.io.IOException;
+
+/**
+ * @author SHIRIA
+ * @since December 06, 2016.
+ */
+public class ContrailV2VlanToInterfaceResourceConnectionTest extends BaseResourceTranslationTest {
+
+ @Override
+ @Before
+ public void setUp() throws IOException {
+ // do not delete this function. it prevents the superclass setup from running
+ }
+
+ //todo - remove the ignore once we will support VMI as sub port
+ @Ignore
+ @Test
+ public void testTranslateVlanToInterfaceNestedConnection() throws Exception {
+ inputFilesPath =
+ "/mock/services/heattotosca/subInterfaceToInterfaceConnection/nested/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/subInterfaceToInterfaceConnection/nested/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ }
+
+ //todo - remove the ignore once we will support VMI as sub port
+ @Ignore
+ @Test
+ public void testTranslateVlanToNetMultiNestedConnection() throws Exception {
+ inputFilesPath =
+ "/mock/services/heattotosca/subInterfaceToInterfaceConnection/nestedMultiLevels/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/subInterfaceToInterfaceConnection/nestedMultiLevels/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ }
+
+ //todo - remove the ignore once we will support VMI as sub port
+ @Ignore
+ @Test
+ public void testTranslateVTSBCVendorHeat() throws Exception {
+ inputFilesPath =
+ "/mock/services/heattotosca/subInterfaceToInterfaceConnection/vTSBC/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/subInterfaceToInterfaceConnection/vTSBC/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ }
+
+}
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ContrailV2VmInterfaceToNetResourceConnectionTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ContrailV2VmInterfaceToNetResourceConnectionTest.java
new file mode 100644
index 0000000000..86e9afbbe0
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ContrailV2VmInterfaceToNetResourceConnectionTest.java
@@ -0,0 +1,138 @@
+/*-
+ * ============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.translator.services.heattotosca.impl.resourcetranslation;
+
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import java.io.IOException;
+
+
+public class ContrailV2VmInterfaceToNetResourceConnectionTest extends BaseResourceTranslationTest {
+ @Override
+ @Before
+ public void setUp() throws IOException {
+ // do not delete this function. it prevents the superclass setup from running
+ }
+
+ @Test
+ public void testTranslateVMIToNetNestedConnection() throws Exception {
+ inputFilesPath = "/mock/services/heattotosca/VMInterfaceToNettworkConnection/nested/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/VMInterfaceToNettworkConnection/nested/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ }
+
+ //todo - remove the ignore once we will support VMI as sub port
+ @Ignore
+ @Test
+ public void testTranslateVlanToNetNestedConnection() throws Exception {
+ inputFilesPath = "/mock/services/heattotosca/VlanToNetConnection/nested/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/VlanToNetConnection/nested/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ }
+
+ @Test
+ public void testTranslateVMIToNetMultiNestedConnection() throws Exception {
+ inputFilesPath =
+ "/mock/services/heattotosca/VMInterfaceToNettworkConnection/nestedMultiLevels/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/VMInterfaceToNettworkConnection/nestedMultiLevels/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ }
+
+ //todo - remove the ignore once we will support VMI as sub port
+ @Ignore
+ @Test
+ public void testTranslateVlanToNetMultiNestedConnection() throws Exception {
+ inputFilesPath =
+ "/mock/services/heattotosca/VlanToNetConnection/nestedMultiLevels/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/VlanToNetConnection/nestedMultiLevels/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ }
+
+ @Test
+ public void testTranslateVMIToSharedNetNestedConnection() throws Exception {
+ inputFilesPath = "/mock/services/heattotosca/VMInterfaceToNettworkConnection/shared/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/VMInterfaceToNettworkConnection/shared/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ }
+
+ //todo - remove the ignore once we will support VMI as sub port
+ @Ignore
+ @Test
+ public void testTranslateVlanToSharedNetNestedConnection() throws Exception {
+ inputFilesPath = "/mock/services/heattotosca/VlanToNetConnection/shared/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/VlanToNetConnection/shared/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ }
+
+ @Test
+ public void testTranslateVMIToNetSharedMultiNestedConnection() throws Exception {
+ inputFilesPath =
+ "/mock/services/heattotosca/VMInterfaceToNettworkConnection/sharedNestedMultiLevels/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/VMInterfaceToNettworkConnection/sharedNestedMultiLevels/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ }
+
+ @Test
+ public void testTranslateVMIToNetSharedAddOnConnection() throws Exception {
+ inputFilesPath = "/mock/services/heattotosca/VMInterfaceToNettworkConnection/sharedAddOn/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/VMInterfaceToNettworkConnection/sharedAddOn/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ }
+
+ //todo - remove the ignore once we will support VMI as sub port
+ @Ignore
+ @Test
+ public void testTranslateVlanToNetSharedAddOnConnection() throws Exception {
+ inputFilesPath = "/mock/services/heattotosca/VlanToNetConnection/sharedAddOn/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/VlanToNetConnection/sharedAddOn/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ }
+
+ @Test
+ public void testTranslateVMIToNetArrayParameterConnection() throws Exception {
+ inputFilesPath = "/mock/services/heattotosca/VMInterfaceToNettworkConnection/nestedArrayParam/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/VMInterfaceToNettworkConnection/nestedArrayParam/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ }
+
+}
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/DependsOnResourceBaseTranslationlTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/DependsOnResourceBaseTranslationlTest.java
new file mode 100644
index 0000000000..117dd0cd59
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/DependsOnResourceBaseTranslationlTest.java
@@ -0,0 +1,148 @@
+/*-
+ * ============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.translator.services.heattotosca.impl.resourcetranslation;
+
+import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.TestConstants.TEST_DEPENDS_ON_INVALID_DEPENDENCY_CANDIDATE;
+import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.TestConstants.TEST_DEPENDS_ON_MULTIPLE_COMPUTE;
+import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.TestConstants.TEST_DEPENDS_ON_NODES_CONNECTED_IN;
+import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.TestConstants.TEST_DEPENDS_ON_NODES_CONNECTED_IN_AND_OUT;
+import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.TestConstants.TEST_DEPENDS_ON_NODES_CONNECTED_OUT;
+import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.TestConstants.TEST_DEPENDS_ON_NODE_TEMPLATE_TRANSLATION_ORDER_INVARIANCE;
+import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.TestConstants.TEST_DEPENDS_ON_NO_DEPENDENCY;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.ConsolidationDataValidationType;
+
+import java.io.IOException;
+
+
+public class DependsOnResourceBaseTranslationlTest extends BaseResourceTranslationTest {
+ @Override
+ @Before
+ public void setUp() throws IOException {
+ // do not delete this function. it prevents the superclass setup from running
+ }
+
+ @Test
+ public void testTranslate() throws Exception {
+ inputFilesPath = "/mock/services/heattotosca/baseResourceTranslation/inputfiles";
+ outputFilesPath = "/mock/services/heattotosca/baseResourceTranslation/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ }
+
+ @Test
+ public void testDependsOnConsolidationNodesConnectedOut() throws Exception {
+ inputFilesPath = "/mock/services/heattotosca/buildconsolidationdata/dependsonresource" +
+ "/nodesConnectedOut/inputfiles";
+ outputFilesPath = "/mock/services/heattotosca/buildconsolidationdata/dependsonresource" +
+ "/nodesConnectedOut/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ validateComputeTemplateConsolidationData(ConsolidationDataValidationType.VALIDATE_DEPENDS_ON,
+ TEST_DEPENDS_ON_NODES_CONNECTED_OUT);
+ }
+
+ @Test
+ public void testDependsOnConsolidationNodesConnectedIn() throws Exception {
+ inputFilesPath = "/mock/services/heattotosca/buildconsolidationdata/dependsonresource" +
+ "/nodesConnectedIn/inputfiles";
+ outputFilesPath = "/mock/services/heattotosca/buildconsolidationdata/dependsonresource" +
+ "/nodesConnectedIn/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ validateComputeTemplateConsolidationData(ConsolidationDataValidationType.VALIDATE_DEPENDS_ON,
+ TEST_DEPENDS_ON_NODES_CONNECTED_IN);
+ }
+
+ @Test
+ public void testDependsOnConsolidationNodesConnectedInAndOut() throws Exception {
+ inputFilesPath = "/mock/services/heattotosca/buildconsolidationdata/dependsonresource" +
+ "/nodesConnectedInOut/inputfiles";
+ outputFilesPath = "/mock/services/heattotosca/buildconsolidationdata/dependsonresource" +
+ "/nodesConnectedInOut/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ validateComputeTemplateConsolidationData(ConsolidationDataValidationType.VALIDATE_DEPENDS_ON,
+ TEST_DEPENDS_ON_NODES_CONNECTED_IN_AND_OUT);
+ }
+
+ @Test
+ public void testDependsOnConsolidationNoDependency() throws Exception {
+ inputFilesPath = "/mock/services/heattotosca/buildconsolidationdata/dependsonresource" +
+ "/noDependency/inputfiles";
+ outputFilesPath = "/mock/services/heattotosca/buildconsolidationdata/dependsonresource" +
+ "/noDependency/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ validateComputeTemplateConsolidationData(ConsolidationDataValidationType.VALIDATE_DEPENDS_ON,
+ TEST_DEPENDS_ON_NO_DEPENDENCY);
+ }
+
+ @Test
+ public void testDependsOnConsolidationInvalidDependencyCandidate() throws Exception {
+ inputFilesPath = "/mock/services/heattotosca/buildconsolidationdata/dependsonresource" +
+ "/noDependency/inputfiles";
+ outputFilesPath = "/mock/services/heattotosca/buildconsolidationdata/dependsonresource" +
+ "/noDependency/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ validateComputeTemplateConsolidationData(ConsolidationDataValidationType.VALIDATE_DEPENDS_ON,
+ TEST_DEPENDS_ON_INVALID_DEPENDENCY_CANDIDATE);
+ }
+
+ @Test
+ public void testDependsOnConsolidationMultipleCompute() throws Exception {
+ inputFilesPath = "/mock/services/heattotosca/buildconsolidationdata/dependsonresource" +
+ "/multiplecompute/inputfiles";
+ outputFilesPath = "/mock/services/heattotosca/buildconsolidationdata/dependsonresource/multiplecompute/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ validateComputeTemplateConsolidationData(ConsolidationDataValidationType.VALIDATE_DEPENDS_ON,
+ TEST_DEPENDS_ON_MULTIPLE_COMPUTE);
+ }
+
+ @Test
+ public void testDependsOnNodeTemplateTranslationOrderInvariance() throws Exception {
+ //Tests that the resource dependency is independent of the order of resource translation
+ inputFilesPath = "/mock/services/heattotosca/buildconsolidationdata/dependsonresource" +
+ "/translationorderinvariance/inputfiles";
+ outputFilesPath = "/mock/services/heattotosca/buildconsolidationdata/dependsonresource" +
+ "/translationorderinvariance/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ validateComputeTemplateConsolidationData(ConsolidationDataValidationType.VALIDATE_DEPENDS_ON,
+ TEST_DEPENDS_ON_NODE_TEMPLATE_TRANSLATION_ORDER_INVARIANCE);
+ }
+
+ @Test
+ public void testDependsOnRemoveDependencyForInvalidCandidates() throws Exception {
+ //Tests the deletion of dependencies of Compute->Compute, Compute->Port, Port->Port,
+ // Port->Compute from the original tosca data model
+ inputFilesPath = "/mock/services/heattotosca/buildconsolidationdata/dependsonresource" +
+ "/removeInvalidDependencyFromTosca/inputfiles";
+ outputFilesPath = "/mock/services/heattotosca/buildconsolidationdata/dependsonresource" +
+ "/removeInvalidDependencyFromTosca/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ }
+}
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/MultipleHeatTranslationTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/MultipleHeatTranslationTest.java
new file mode 100644
index 0000000000..eae9d5877a
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/MultipleHeatTranslationTest.java
@@ -0,0 +1,52 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import java.io.IOException;
+
+
+public class MultipleHeatTranslationTest extends BaseResourceTranslationTest {
+
+ @Override
+ @Before
+ public void setUp() throws IOException {
+ // do not delete this function. it prevents the superclass setup from running
+ }
+
+ @Test
+ public void testTranslateBaseHeats() throws Exception {
+ inputFilesPath = "/mock/multiHeat/allHeatsAreBase/inputs";
+ outputFilesPath = "/mock/multiHeat/allHeatsAreBase/expectedOutput/";
+ initTranslatorAndTranslate();
+ testTranslation();
+ }
+
+ @Test
+ public void testTranslateOneOutOfFourFilesIsNotBase() throws Exception {
+ inputFilesPath = "/mock/multiHeat/referencedHeatResources/inputs";
+ outputFilesPath = "/mock/multiHeat/referencedHeatResources/expectedOutput/";
+ initTranslatorAndTranslate();
+ testTranslation();
+ }
+}
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/NovaToVolResourceConnectionTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/NovaToVolResourceConnectionTest.java
new file mode 100644
index 0000000000..fe6d68aa1b
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/NovaToVolResourceConnectionTest.java
@@ -0,0 +1,148 @@
+/*-
+ * ============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.translator.services.heattotosca.impl.resourcetranslation;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import java.io.IOException;
+
+
+public class NovaToVolResourceConnectionTest extends BaseResourceTranslationTest {
+ @Override
+ @Before
+ public void setUp() throws IOException {
+ // do not delete this function. it prevents the superclass setup from running
+ }
+
+ @Test
+ public void testNovaToVolumeConnectionSharedAddOnConnection() throws Exception {
+ inputFilesPath = "/mock/services/heattotosca/novatovolumeconnection/sharedAddOn/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/novatovolumeconnection/sharedAddOn/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ }
+
+ @Test
+ public void testNovaToVolumeConnectionMultiNotCreatedIfVolPorpertyInVolAttacheIsNotAReferenceToVolume()
+ throws Exception {
+ inputFilesPath =
+ "/mock/services/heattotosca/novatovolumeconnection/multinotconnected/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/novatovolumeconnection/multinotconnected/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ }
+
+ @Test
+ public void testNovaToVolumeConnectionNestedNotCreatedIfVolPorpertyInVolAttacheIsNotAReferenceToVolume()
+ throws Exception {
+ inputFilesPath =
+ "/mock/services/heattotosca/novatovolumeconnection/nestednotconnected/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/novatovolumeconnection/nestednotconnected/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ validateSubsMappingInConsolidationData();
+ }
+
+ @Test
+ public void testTranslateNovaToVolumeNestedConnection() throws Exception {
+ inputFilesPath =
+ "/mock/services/heattotosca/novatovolumeconnection/nestedconnection/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/novatovolumeconnection/nestedconnection/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ validateSubsMappingInConsolidationData();
+ }
+
+ @Test
+ public void testTranslateNovaToVolumeSharedNestedConnection() throws Exception {
+ inputFilesPath =
+ "/mock/services/heattotosca/novatovolumeconnection/sharednestedconnection/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/novatovolumeconnection/sharednestedconnection/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ validateSubsMappingInConsolidationData();
+ }
+
+ @Test
+ public void testTranslateNovaToVolumeSharedNestedNotCreatedIfVolPorpertyInVolAttacheIsNotAReferenceToVolume()
+ throws Exception {
+ inputFilesPath =
+ "/mock/services/heattotosca/novatovolumeconnection/sharednestednotconnected/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/novatovolumeconnection/sharednestednotconnected/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ validateSubsMappingInConsolidationData();
+ }
+
+ @Test
+ public void testTranslateNovaToVolumeInnerNestedConnection() throws Exception {
+ inputFilesPath =
+ "/mock/services/heattotosca/novatovolumeconnection/innernestedconnection/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/novatovolumeconnection/innernestedconnection/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ validateSubsMappingInConsolidationData();
+ }
+
+ @Test
+ public void testTranslateNovaToVolumeNestedMultiLevelConnection() throws Exception {
+ inputFilesPath =
+ "/mock/services/heattotosca/novatovolumeconnection/nestedMultiLevels/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/novatovolumeconnection/nestedMultiLevels/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ validateSubsMappingInConsolidationData();
+ }
+
+ @Test
+ public void testTranslateNovaToVolumeSharedNestedMultiLevelConnection() throws Exception {
+ inputFilesPath =
+ "/mock/services/heattotosca/novatovolumeconnection/sharedNestedMultiLevels/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/novatovolumeconnection/sharedNestedMultiLevels/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ validateSubsMappingInConsolidationData();
+ }
+
+ @Test
+ public void testTranslateNovaToVolumeInnerHeatVolumeNestedMultiLevelConnection()
+ throws Exception {
+ inputFilesPath =
+ "/mock/services/heattotosca/novatovolumeconnection/innerHeatVolNestedMultiLevel/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/novatovolumeconnection/innerHeatVolNestedMultiLevel/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ validateSubsMappingInConsolidationData();
+ }
+
+
+}
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/PortToContrailV2VirtualNetworkResourceConnectionTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/PortToContrailV2VirtualNetworkResourceConnectionTest.java
new file mode 100644
index 0000000000..bc8c3385f1
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/PortToContrailV2VirtualNetworkResourceConnectionTest.java
@@ -0,0 +1,66 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import java.io.IOException;
+
+
+public class PortToContrailV2VirtualNetworkResourceConnectionTest
+ extends BaseResourceTranslationTest {
+ @Override
+ @Before
+ public void setUp() throws IOException {
+ // do not delete this function. it prevents the superclass setup from running
+ }
+
+ @Test
+ public void testPortToNetNestedConnection() throws Exception {
+ inputFilesPath =
+ "/mock/services/heattotosca/porttocontrailv2virtualnetworkconnection/nested/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/porttocontrailv2virtualnetworkconnection/nested/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ }
+
+ @Test
+ public void testPortToSharedNetNestedConnection() throws Exception {
+ inputFilesPath =
+ "/mock/services/heattotosca/porttocontrailv2virtualnetworkconnection/shared/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/porttocontrailv2virtualnetworkconnection/shared/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ }
+
+ @Test
+ public void testPortToNetSharedAddOnConnection() throws Exception {
+ inputFilesPath =
+ "/mock/services/heattotosca/porttocontrailv2virtualnetworkconnection/sharedAddOn/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/porttocontrailv2virtualnetworkconnection/sharedAddOn/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ }
+}
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/PortToNetResourceConnectionTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/PortToNetResourceConnectionTest.java
new file mode 100644
index 0000000000..828904e545
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/PortToNetResourceConnectionTest.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.translator.services.heattotosca.impl.resourcetranslation;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import java.io.IOException;
+
+
+public class PortToNetResourceConnectionTest extends BaseResourceTranslationTest {
+ @Override
+ @Before
+ public void setUp() throws IOException {
+ // do not delete this function. it prevents the superclass setup from running
+ }
+
+ @Test
+ public void testTranslatePortToNetNestedConnection() throws Exception {
+ inputFilesPath = "/mock/services/heattotosca/porttonetconnection/nested/inputfiles";
+ outputFilesPath = "/mock/services/heattotosca/porttonetconnection/nested/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ }
+
+ @Test
+ public void testTranslatePortToNetNestedMultiLevelsConnection() throws Exception {
+ inputFilesPath = "/mock/services/heattotosca/porttonetconnection/nestedMultiLevels/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/porttonetconnection/nestedMultiLevels/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ }
+
+ @Test
+ public void testTranslatePortToNetSharedNestedMultiLevelsConnection() throws Exception {
+ inputFilesPath =
+ "/mock/services/heattotosca/porttonetconnection/sharedNestedMultiLevels/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/porttonetconnection/sharedNestedMultiLevels/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ }
+
+ @Test
+ public void testTranslatePortToSharedNetNestedConnection() throws Exception {
+ inputFilesPath = "/mock/services/heattotosca/porttonetconnection/shared/inputfiles";
+ outputFilesPath = "/mock/services/heattotosca/porttonetconnection/shared/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ }
+
+ @Test
+ public void testTranslatePortToNetSharedAddOnConnection() throws Exception {
+ inputFilesPath = "/mock/services/heattotosca/porttonetconnection/sharedAddOn/inputfiles";
+ outputFilesPath = "/mock/services/heattotosca/porttonetconnection/sharedAddOn/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ }
+}
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationCinderVolumeAttachmentImplTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationCinderVolumeAttachmentImplTest.java
new file mode 100644
index 0000000000..786b613d0f
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationCinderVolumeAttachmentImplTest.java
@@ -0,0 +1,85 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation;
+
+import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.TestConstants.TEST_VOLUME_NEGATIVE;
+import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.TestConstants.TEST_VOLUME_POSITIVE;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.ConsolidationDataValidationType;
+
+import java.io.IOException;
+
+
+public class ResourceTranslationCinderVolumeAttachmentImplTest extends BaseResourceTranslationTest {
+
+ @Override
+ @Before
+ public void setUp() throws IOException {
+ // do not delete this function. it prevents the superclass setup from running
+ }
+
+ @Test
+ public void testTranslateAllResourcesInOneFile() throws Exception {
+ inputFilesPath = "/mock/services/heattotosca/vol_attach/volume_and_attach_one_file/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/vol_attach/volume_and_attach_one_file/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ validateComputeTemplateConsolidationData(ConsolidationDataValidationType.VALIDATE_VOLUME,
+ TEST_VOLUME_POSITIVE);
+ }
+
+ @Test
+ public void testVolFileIsNestedInMainHeatFile() throws Exception {
+ inputFilesPath =
+ "/mock/services/heattotosca/vol_attach/volume_file_nested_in_main_file_in_manifest/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/vol_attach/volume_file_nested_in_main_file_in_manifest/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ validateComputeTemplateConsolidationData(ConsolidationDataValidationType.VALIDATE_VOLUME,
+ TEST_VOLUME_POSITIVE);
+ }
+
+ @Test
+ public void testVolFileAsDataOfNested() throws Exception {
+ inputFilesPath = "/mock/services/heattotosca/vol_attach/nested_with_inner_vol/inputfiles";
+ outputFilesPath = "/mock/services/heattotosca/vol_attach/nested_with_inner_vol/out";
+ initTranslatorAndTranslate();
+ testTranslation();
+ validateComputeTemplateConsolidationData(ConsolidationDataValidationType.VALIDATE_VOLUME,
+ TEST_VOLUME_POSITIVE);
+ }
+
+ @Test
+ public void testVolFileIsParallelToMainHeatFile() throws Exception {
+ inputFilesPath =
+ "/mock/services/heattotosca/vol_attach/volume_file_parallel_to_main_file/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/vol_attach/volume_file_parallel_to_main_file/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ validateComputeTemplateConsolidationData(ConsolidationDataValidationType.VALIDATE_VOLUME,
+ TEST_VOLUME_NEGATIVE);
+ }
+}
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationCinderVolumeImplTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationCinderVolumeImplTest.java
new file mode 100644
index 0000000000..6afb3cf5bd
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationCinderVolumeImplTest.java
@@ -0,0 +1,36 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation;
+
+import org.junit.Test;
+
+
+public class ResourceTranslationCinderVolumeImplTest extends BaseResourceTranslationTest {
+ public ResourceTranslationCinderVolumeImplTest() {
+ inputFilesPath = "/mock/services/heattotosca/cinder_volume_translation/inputfiles";
+ outputFilesPath = "/mock/services/heattotosca/cinder_volume_translation/expectedoutputfiles";
+ }
+
+ @Test
+ public void testTranslate() throws Exception {
+ testTranslation();
+ }
+}
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationContrailServiceInstanceImplTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationContrailServiceInstanceImplTest.java
new file mode 100644
index 0000000000..723766ba78
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationContrailServiceInstanceImplTest.java
@@ -0,0 +1,99 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import java.io.IOException;
+
+
+public class ResourceTranslationContrailServiceInstanceImplTest
+ extends BaseResourceTranslationTest {
+
+ @Override
+ @Before
+ public void setUp() throws IOException {
+ // do not delete this function. it prevents the superclass setup from running
+ }
+
+ @Test
+ public void testTranslateOneServiceInstance() throws Exception {
+ inputFilesPath =
+ "/mock/services/heattotosca/contrail2serviceinstance/oneServiceInstance/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/contrail2serviceinstance/oneServiceInstance/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ }
+
+ @Test
+ public void testTranslateDiffServiceTemplate() throws Exception {
+ inputFilesPath =
+ "/mock/services/heattotosca/contrail2serviceinstance/diffServiceTemplate/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/contrail2serviceinstance/diffServiceTemplate/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ }
+
+ @Test
+ public void testTranslateSharedNetworkMulti() throws Exception {
+ inputFilesPath =
+ "/mock/services/heattotosca/contrail2serviceinstance/sharedNetworkMulti/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/contrail2serviceinstance/sharedNetworkMulti/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ }
+
+ @Test
+ public void testTranslateSameServiceTemplate() throws Exception {
+ inputFilesPath =
+ "/mock/services/heattotosca/contrail2serviceinstance/sameServiceTemplate/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/contrail2serviceinstance/sameServiceTemplate/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ }
+
+
+ @Test
+ public void testTranslateConnectToNetworkMultiNested() throws Exception {
+ inputFilesPath =
+ "/mock/services/heattotosca/contrail2serviceinstance/connectToNetworkMultiNested/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/contrail2serviceinstance/connectToNetworkMultiNested/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ }
+
+ @Test
+ public void testTranslateConnectToSharedNetworkMultiNested() throws Exception {
+ inputFilesPath =
+ "/mock/services/heattotosca/contrail2serviceinstance/connectToNetworkSharedMultiNested/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/contrail2serviceinstance/connectToNetworkSharedMultiNested/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ }
+
+}
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationContrailV2Test.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationContrailV2Test.java
new file mode 100644
index 0000000000..fe47858727
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationContrailV2Test.java
@@ -0,0 +1,76 @@
+/*-
+ * ============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.translator.services.heattotosca.impl.resourcetranslation;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import java.io.IOException;
+
+public class ResourceTranslationContrailV2Test extends BaseResourceTranslationTest {
+
+ @Override
+ @Before
+ public void setUp() throws IOException {
+ // do not delete this function. it prevents the superclass setup from running
+ }
+
+ @Test
+ public void testTranslate() throws Exception {
+ inputFilesPath = "/mock/services/heattotosca/ContrailV2_translation/simple/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/ContrailV2_translation/simple/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ }
+
+ @Test
+ public void testMultiPolicySingleNetTranslate() throws Exception {
+ inputFilesPath =
+ "/mock/services/heattotosca/ContrailV2_translation/ContrailV2_MultiPolicy_single_net_translation/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/ContrailV2_translation/ContrailV2_MultiPolicy_single_net_translation/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ }
+
+ @Test
+ public void testMultiNetSinglePolicyTranslate() throws Exception {
+ inputFilesPath =
+ "/mock/services/heattotosca/ContrailV2_translation/ContrailV2_Multi_net_single_policy_translation/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/ContrailV2_translation/ContrailV2_Multi_net_single_policy_translation/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ }
+
+ @Test
+ public void testInvalidPolicyResourceTypeTranslate() throws Exception {
+ inputFilesPath =
+ "/mock/services/heattotosca/ContrailV2_translation/invalid_policy_resource_type/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/ContrailV2_translation/invalid_policy_resource_type/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ }
+
+
+}
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationContrailV2VlanSubInterfaceImplTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationContrailV2VlanSubInterfaceImplTest.java
new file mode 100644
index 0000000000..796bb82dbd
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationContrailV2VlanSubInterfaceImplTest.java
@@ -0,0 +1,62 @@
+/*-
+ * ============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.translator.services.heattotosca.impl.resourcetranslation;
+
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+import java.io.IOException;
+
+/**
+ * @author SHIRIA
+ * @since December 04, 2016.
+ */
+public class ResourceTranslationContrailV2VlanSubInterfaceImplTest extends
+ BaseResourceTranslationTest {
+ @Override
+ @Before
+ public void setUp() throws IOException {
+ // do not delete this function. it prevents the superclass setup from running
+ }
+
+ //todo - remove the ignore once we will support VMI as sub port
+ @Ignore
+ @Test
+ public void testTranslateVlanSubInterfaceWithGetResource() throws Exception {
+ inputFilesPath = "/mock/services/heattotosca/contrailv2Vlan/oneInterface/inputfiles";
+ outputFilesPath = "/mock/services/heattotosca/contrailv2Vlan/oneInterface/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ }
+
+ //todo - remove the ignore once we will support VMI as sub port
+ @Ignore
+ @Test
+ public void testTranslateVlanSubInterfaceWithListOfInterfaceAndNetworks() throws Exception {
+ inputFilesPath = "/mock/services/heattotosca/contrailv2Vlan/listInterface/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/contrailv2Vlan/listInterface/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ }
+
+}
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationContrailV2VmInterfaceImplTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationContrailV2VmInterfaceImplTest.java
new file mode 100644
index 0000000000..3e69ed17c0
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationContrailV2VmInterfaceImplTest.java
@@ -0,0 +1,113 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation;
+
+import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.TestConstants.TEST_CONNECTIVITY_POSITIVE;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.ConsolidationDataValidationType;
+
+import java.io.IOException;
+
+/**
+ * @author Avrahamg
+ * @since August 10, 2016
+ */
+public class ResourceTranslationContrailV2VmInterfaceImplTest extends BaseResourceTranslationTest {
+
+ @Override
+ @Before
+ public void setUp() throws IOException {
+ // do not delete this function. it prevents the superclass setup from running
+ }
+
+ @Test
+ public void testTranslateVMIWithGetResource() throws Exception {
+ inputFilesPath = "/mock/services/heattotosca/contrailv2VMinterface/oneNet/inputfiles";
+ outputFilesPath = "/mock/services/heattotosca/contrailv2VMinterface/oneNet/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ validatePortTemplateConsolidationData(ConsolidationDataValidationType
+ .VALIDATE_CONNECTIVITY, TEST_CONNECTIVITY_POSITIVE);
+ }
+
+ @Test
+ public void testTranslateVMIWithListOfNetworks() throws Exception {
+ inputFilesPath = "/mock/services/heattotosca/contrailv2VMinterface/listNet/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/contrailv2VMinterface/listNet/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ validatePortTemplateConsolidationData(ConsolidationDataValidationType
+ .VALIDATE_CONNECTIVITY, TEST_CONNECTIVITY_POSITIVE);
+ }
+
+ @Test
+ public void testMacAddressesValueMapOfListWithOneItem() throws IOException {
+ inputFilesPath =
+ "/mock/services/heattotosca/contrailv2VMinterface/macAddressesValueMapOneItem/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/contrailv2VMinterface/macAddressesValueMapOneItem/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ }
+
+ @Test
+ public void testMacAddressesValueMapOfListWithTwoItems() throws IOException {
+ inputFilesPath =
+ "/mock/services/heattotosca/contrailv2VMinterface/macAddressesValueMapTwoItems/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/contrailv2VMinterface/macAddressesValueMapTwoItems/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ }
+
+ @Test
+ public void testMacAddressesValueMapOfListWithStaticValue() throws IOException {
+ inputFilesPath =
+ "/mock/services/heattotosca/contrailv2VMinterface/macAddressStaticValue/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/contrailv2VMinterface/macAddressStaticValue/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ }
+
+ @Test
+ public void testMacAddressesValueNotList() throws IOException {
+ inputFilesPath =
+ "/mock/services/heattotosca/contrailv2VMinterface/macAddressesValueNotAList/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/contrailv2VMinterface/macAddressesValueNotAList/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ }
+
+ @Test
+ public void testMacAddressesValueInProperForm() throws IOException {
+ inputFilesPath =
+ "/mock/services/heattotosca/contrailv2VMinterface/macAddressesValueInProperForm/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/contrailv2VMinterface/macAddressesValueInProperForm/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ }
+}
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNeutronPortImplTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNeutronPortImplTest.java
new file mode 100644
index 0000000000..854a2632b3
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNeutronPortImplTest.java
@@ -0,0 +1,60 @@
+/*-
+ * ============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.translator.services.heattotosca.impl.resourcetranslation;
+
+import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.TestConstants.TEST_CONNECTIVITY_POSITIVE;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.ConsolidationDataValidationType;
+
+import java.io.IOException;
+
+
+public class ResourceTranslationNeutronPortImplTest extends BaseResourceTranslationTest {
+
+ @Override
+ @Before
+ public void setUp() throws IOException {
+ // do not delete this function. it prevents the superclass setup from running
+ }
+
+ @Test
+ public void testTranslate() throws Exception {
+ inputFilesPath = "/mock/services/heattotosca/neutron_port_translation/inputfiles";
+ outputFilesPath = "/mock/services/heattotosca/neutron_port_translation/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ validatePortTemplateConsolidationData(ConsolidationDataValidationType
+ .VALIDATE_CONNECTIVITY, TEST_CONNECTIVITY_POSITIVE);
+ }
+
+ @Test
+ public void testTranslateSecure() throws Exception {
+ inputFilesPath = "/mock/services/heattotosca/neutron_security_group_translation/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/neutron_security_group_translation/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ validatePortTemplateConsolidationData(ConsolidationDataValidationType
+ .VALIDATE_CONNECTIVITY, TEST_CONNECTIVITY_POSITIVE);
+ }
+}
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNeutronSecurityGroupImplTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNeutronSecurityGroupImplTest.java
new file mode 100644
index 0000000000..a0766d99ba
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNeutronSecurityGroupImplTest.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.translator.services.heattotosca.impl.resourcetranslation;
+
+import org.junit.Test;
+
+
+public class ResourceTranslationNeutronSecurityGroupImplTest extends BaseResourceTranslationTest {
+
+ {
+ inputFilesPath = "/mock/services/heattotosca/neutron_security_group_translation/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/neutron_security_group_translation/expectedoutputfiles";
+ }
+
+ @Test
+ public void testTranslate() throws Exception {
+ testTranslation();
+ }
+
+
+}
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNovaServerGroupsImplTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNovaServerGroupsImplTest.java
new file mode 100644
index 0000000000..03b9402e01
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNovaServerGroupsImplTest.java
@@ -0,0 +1,72 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation;
+
+import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.TestConstants.TEST_GROUP_POSITIVE;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.ConsolidationDataValidationType;
+
+import java.io.IOException;
+
+
+public class ResourceTranslationNovaServerGroupsImplTest extends BaseResourceTranslationTest {
+
+ @Override
+ @Before
+ public void setUp() throws IOException {
+ // do not delete this function. it prevents the superclass setup from running
+ }
+
+ @Test
+ public void testTranslate() throws Exception {
+ inputFilesPath = "/mock/services/heattotosca/novaservergroups/staticPolicy/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/novaservergroups/staticPolicy/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ validateComputeTemplateConsolidationData(ConsolidationDataValidationType.VALIDATE_GROUP,
+ TEST_GROUP_POSITIVE);
+ }
+
+ @Test
+ public void testTranslateDynamicPolicy() throws Exception {
+ inputFilesPath = "/mock/services/heattotosca/novaservergroups/dynamicPolicy/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/novaservergroups/dynamicPolicy/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ validateComputeTemplateConsolidationData(ConsolidationDataValidationType.VALIDATE_GROUP,
+ TEST_GROUP_POSITIVE);
+ }
+
+ @Test
+ public void testTranslateServerGroupShared() throws IOException {
+ inputFilesPath = "/mock/services/heattotosca/novaservergroups/sharedServerGroup/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/novaservergroups/sharedServerGroup/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ validateComputeTemplateConsolidationData(ConsolidationDataValidationType.VALIDATE_GROUP,
+ TEST_GROUP_POSITIVE);
+ }
+}
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationResourceGroupImplTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationResourceGroupImplTest.java
new file mode 100644
index 0000000000..1488edc16e
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationResourceGroupImplTest.java
@@ -0,0 +1,113 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * SDC
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
+import org.mockito.runners.MockitoJUnitRunner;
+
+import java.io.IOException;
+
+@RunWith(MockitoJUnitRunner.class)
+public class ResourceTranslationResourceGroupImplTest extends BaseResourceTranslationTest {
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ @Override
+ @Before
+ public void setUp() throws IOException {
+ // do not delete this function. it prevents the superclass setup from running
+ }
+
+ @Test
+ public void testTranslateResourceGroup() throws Exception {
+ inputFilesPath = "/mock/heat/nested/resource_group/inputs";
+ outputFilesPath = "/mock/heat/nested/resource_group/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ }
+
+ @Test
+ public void testTranslateMultiResourceGroup() throws Exception {
+ inputFilesPath = "/mock/heat/nested/multiple_resource_groups/inputs";
+ outputFilesPath = "/mock/heat/nested/multiple_resource_groups/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ }
+
+ @Test
+ public void testTranslateResourceGroupDynamicCount() throws Exception {
+ inputFilesPath = "/mock/heat/nested/resource_group_with_dynamic_count/inputs";
+ outputFilesPath = "/mock/heat/nested/resource_group_with_dynamic_count/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ }
+
+
+ @Test
+ public void testTranslatePortToNetNestedByResourceGroupConnection() throws Exception {
+ inputFilesPath = "/mock/services/heattotosca/porttonetresourcegroupconnection/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/porttonetresourcegroupconnection/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ }
+
+ @Test
+ public void testTranslatePortToNetSharedConnection() throws Exception {
+ inputFilesPath = "/mock/services/heattotosca/porttosharednetresourcegrouplinking/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/porttosharednetresourcegrouplinking/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ }
+
+ @Test
+ public void testTranslateSecurityGroupToSharedPortConnection() throws Exception {
+ inputFilesPath =
+ "/mock/services/heattotosca/securityruletosharedportresourcegrouplinking/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/securityruletosharedportresourcegrouplinking/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ }
+
+ @Test
+ public void testTranslateResourceGroupIndexVar() throws Exception {
+ inputFilesPath = "/mock/heat/nested/resourceGroupIndexVar/inputs";
+ outputFilesPath = "/mock/heat/nested/resourceGroupIndexVar/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ }
+
+ @Test
+ public void testTranslateMDNS() throws Exception {
+ inputFilesPath = "/mock/heat/nested/resourceGroupMDNS/inputs";
+ outputFilesPath = "/mock/heat/nested/resourceGroupMDNS/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ }
+
+
+}
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/SecurityGroupToNovaResourceConnectionTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/SecurityGroupToNovaResourceConnectionTest.java
new file mode 100644
index 0000000000..3aa8cf5545
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/SecurityGroupToNovaResourceConnectionTest.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.translator.services.heattotosca.impl.resourcetranslation;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import java.io.IOException;
+
+public class SecurityGroupToNovaResourceConnectionTest extends BaseResourceTranslationTest {
+ @Override
+ @Before
+ public void setUp() throws IOException {
+ // do not delete this function. it prevents the superclass setup from running
+ }
+
+ @Test
+ public void testSecurityGroupToPortConnectionAddOnConnection() throws Exception {
+ inputFilesPath = "/mock/services/heattotosca/securityGroupToNovaAddOn/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/securityGroupToNovaAddOn/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ }
+
+}
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/SecurityRulesToPortResourceConnectionTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/SecurityRulesToPortResourceConnectionTest.java
new file mode 100644
index 0000000000..724f6247af
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/SecurityRulesToPortResourceConnectionTest.java
@@ -0,0 +1,109 @@
+/*-
+ * ============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.translator.services.heattotosca.impl.resourcetranslation;
+
+import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.ConsolidationDataTestUtil.validateNestedNodesConnectedInSecurityRuleToPort;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.TestConstants;
+
+import java.io.IOException;
+
+
+public class SecurityRulesToPortResourceConnectionTest extends BaseResourceTranslationTest {
+ @Override
+ @Before
+ public void setUp() throws IOException {
+ // do not delete this function. it prevents the superclass setup from running
+ }
+
+ @Test
+ public void testTranslateSecurityRuleToPortNestedConnection() throws Exception {
+ inputFilesPath =
+ "/mock/services/heattotosca/securityrulestoportconnection/securityrulestoportnestedconnection/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/securityrulestoportconnection/securityrulestoportnestedconnection/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ validateNestedNodesConnectedInSecurityRuleToPort(TestConstants
+ .TEST_SECURITY_RULE_PORT_NESTED_CONNECTION, translationContext);
+ }
+
+ @Test
+ public void testTranslateSecurityRuleToPortSharedPortNestedConnection() throws Exception {
+ inputFilesPath =
+ "/mock/services/heattotosca/securityrulestoportconnection/securityruletosharedportlinking/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/securityrulestoportconnection/securityruletosharedportlinking/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ validateNestedNodesConnectedInSecurityRuleToPort(TestConstants
+ .TEST_SECURITY_RULE_PORT_NESTED_SHARED_PORT, translationContext);
+ }
+
+ @Test
+ public void testSecurityRuleToPortConnectionSharedAddOnConnection() throws Exception {
+ inputFilesPath =
+ "/mock/services/heattotosca/securityrulestoportconnection/securityRulesToPortSharedAddOn/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/securityrulestoportconnection/securityRulesToPortSharedAddOn/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ }
+
+ @Test
+ public void testSecurityRuleToPortConnectionNestedGetResource() throws Exception {
+ inputFilesPath =
+ "/mock/services/heattotosca/securityrulestoportconnection/securityRulesToPortGetResource/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/securityrulestoportconnection/securityRulesToPortGetResource/out";
+ initTranslatorAndTranslate();
+ testTranslation();
+ }
+
+
+ @Test
+ public void testSecurityRuleToPortConnectionNestedMultiLevelsGetResource() throws Exception {
+ inputFilesPath =
+ "/mock/services/heattotosca/securityrulestoportconnection/nestedMultiLevels/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/securityrulestoportconnection/nestedMultiLevels/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ validateNestedNodesConnectedInSecurityRuleToPort(TestConstants
+ .TEST_SECURITY_RULE_PORT_MULTI_LEVEL_NESTED_CONNECTION, translationContext);
+ }
+
+ @Test
+ public void testSecurityRuleToPortConnectionSharedNestedMultiLevelsGetResource()
+ throws Exception {
+ inputFilesPath =
+ "/mock/services/heattotosca/securityrulestoportconnection/sharedNestedMultiLevels/inputfiles";
+ outputFilesPath =
+ "/mock/services/heattotosca/securityrulestoportconnection/sharedNestedMultiLevels/expectedoutputfiles";
+ initTranslatorAndTranslate();
+ testTranslation();
+ validateNestedNodesConnectedInSecurityRuleToPort(TestConstants
+ .TEST_SECURITY_RULE_PORT_MULTI_LEVEL_NESTED_SHARED_PORT, translationContext);
+ }
+
+}