aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/orchestration/OnboardingTypesEnum.java18
-rw-r--r--openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/ForwarderCapabilityHealer.java19
-rw-r--r--openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/PortMirroringEnricher.java19
-rw-r--r--openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-core/src/main/java/org/openecomp/sdc/generator/core/services/ManualVspToscaGenerationService.java19
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/datatypes/heattotosca/TranslationContext.java18
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/HeatToToscaUtil.java18
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/globaltypes/GlobalTypesGenerator.java24
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/globaltypes/GlobalTypesServiceTemplates.java96
-rw-r--r--openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/globaltypes/GlobalTypesServiceTemplatesTest.java93
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/datatypes/Constants.java17
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/GlobalSubstitutionServiceTemplate.java30
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/ToscaConverterImpl.java53
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/converter/impl/ToscaConvertorDefinitionsTest.java22
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/conversionWithInt/out/MainServiceTemplate.yaml2
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertCsar/out/MainServiceTemplate.yaml2
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/out/MainServiceTemplate.yaml2
-rw-r--r--openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertParameters/out/MainServiceTemplate.yaml2
17 files changed, 367 insertions, 87 deletions
diff --git a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/orchestration/OnboardingTypesEnum.java b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/orchestration/OnboardingTypesEnum.java
index 85fe305060..91cbc2c505 100644
--- a/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/orchestration/OnboardingTypesEnum.java
+++ b/openecomp-be/lib/openecomp-core-lib/openecomp-utilities-lib/src/main/java/org/openecomp/core/utilities/orchestration/OnboardingTypesEnum.java
@@ -1,10 +1,26 @@
+/*
+ * Copyright © 2016-2017 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.openecomp.core.utilities.orchestration;
import java.util.Optional;
import static java.util.Arrays.asList;
public enum OnboardingTypesEnum {
- CSAR("csar"), ZIP("zip"), NONE("none");
+ CSAR("csar"), ZIP("zip"), MANUAL("manual"), NONE("none");
private String type;
OnboardingTypesEnum(String type) {
diff --git a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/ForwarderCapabilityHealer.java b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/ForwarderCapabilityHealer.java
index 7991c5904e..f3e5f4d568 100644
--- a/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/ForwarderCapabilityHealer.java
+++ b/openecomp-be/lib/openecomp-healing-lib/openecomp-sdc-healing-impl/src/main/java/org/openecomp/sdc/healing/healers/ForwarderCapabilityHealer.java
@@ -1,9 +1,26 @@
+/*
+ * Copyright © 2016-2017 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.openecomp.sdc.healing.healers;
import org.apache.commons.collections.MapUtils;
import org.openecomp.core.model.dao.ServiceModelDao;
import org.openecomp.core.model.dao.ServiceModelDaoFactory;
import org.openecomp.core.model.types.ServiceElement;
+import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
import org.openecomp.sdc.common.togglz.ToggleableFeature;
import org.openecomp.sdc.healing.interfaces.Healer;
import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
@@ -76,7 +93,7 @@ public class ForwarderCapabilityHealer implements Healer {
private void handleGlobalTypes(ToscaServiceModel serviceModel) {
Map<String, ServiceTemplate> globalTypesServiceTemplates =
- GlobalTypesServiceTemplates.getGlobalTypesServiceTemplates();
+ GlobalTypesServiceTemplates.getGlobalTypesServiceTemplates(OnboardingTypesEnum.ZIP);
if (MapUtils.isEmpty(globalTypesServiceTemplates)) {
return;
diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/PortMirroringEnricher.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/PortMirroringEnricher.java
index a855a7477f..f731e37b6f 100644
--- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/PortMirroringEnricher.java
+++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/PortMirroringEnricher.java
@@ -1,7 +1,24 @@
+/*
+ * Copyright © 2016-2017 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.openecomp.sdc.enrichment.impl.tosca;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
+import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
import org.openecomp.sdc.datatypes.error.ErrorMessage;
import org.openecomp.sdc.enrichment.impl.tosca.model.PortMirroringConnectionPointDescription;
import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
@@ -49,7 +66,7 @@ public class PortMirroringEnricher {
private Map<String, List<String>> portNodeTemplateIdsFromAbstract = new HashMap<>();
private static MdcDataDebugMessage mdcDataDebugMessage = new MdcDataDebugMessage();
private Map<String, ServiceTemplate> globalTypesServiceTemplate =
- GlobalTypesGenerator.getGlobalTypesServiceTemplate();
+ GlobalTypesGenerator.getGlobalTypesServiceTemplate(OnboardingTypesEnum.ZIP);
/**
* Enrich tosca for port mirroring.
diff --git a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-core/src/main/java/org/openecomp/sdc/generator/core/services/ManualVspToscaGenerationService.java b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-core/src/main/java/org/openecomp/sdc/generator/core/services/ManualVspToscaGenerationService.java
index 8234179017..ab5750684d 100644
--- a/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-core/src/main/java/org/openecomp/sdc/generator/core/services/ManualVspToscaGenerationService.java
+++ b/openecomp-be/lib/openecomp-sdc-tosca-generator-lib/openecomp-sdc-tosca-generator-core/src/main/java/org/openecomp/sdc/generator/core/services/ManualVspToscaGenerationService.java
@@ -1,7 +1,24 @@
+/*
+ * Copyright © 2016-2017 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.openecomp.sdc.generator.core.services;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
+import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
import org.openecomp.sdc.generator.core.utils.GeneratorUtils;
import org.openecomp.sdc.generator.datatypes.tosca.MultiFlavorVfcImage;
import org.openecomp.sdc.generator.datatypes.tosca.VspModelInfo;
@@ -69,7 +86,7 @@ public class ManualVspToscaGenerationService {
ToscaServiceModel toscaServiceModel = new ToscaServiceModel();
ToscaAnalyzerService toscaAnalyzerService = new ToscaAnalyzerServiceImpl();
Map<String, ServiceTemplate> serviceTemplates = new HashMap<>(GlobalTypesGenerator
- .getGlobalTypesServiceTemplate());
+ .getGlobalTypesServiceTemplate(OnboardingTypesEnum.MANUAL));
toscaServiceModel.setServiceTemplates(serviceTemplates);
toscaServiceModel.setEntryDefinitionServiceTemplate(Constants.MAIN_TEMPLATE_NAME
+ TOSCA_SERVICE_TEMPLATE_FILE_NAME_SUFFIX);
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/datatypes/heattotosca/TranslationContext.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/datatypes/heattotosca/TranslationContext.java
index 675a2c5e96..d2ad6daba1 100644
--- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/datatypes/heattotosca/TranslationContext.java
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/datatypes/heattotosca/TranslationContext.java
@@ -1,21 +1,17 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
+/*
+ * Copyright © 2016-2017 European Support Limited
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END=========================================================
*/
package org.openecomp.sdc.translator.datatypes.heattotosca;
@@ -25,6 +21,7 @@ import org.openecomp.config.api.Configuration;
import org.openecomp.config.api.ConfigurationManager;
import org.openecomp.core.utilities.CommonMethods;
import org.openecomp.core.utilities.file.FileContentHandler;
+import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
import org.openecomp.sdc.common.errors.CoreException;
import org.openecomp.sdc.common.utils.SdcCommon;
import org.openecomp.sdc.datatypes.configuration.ImplementationConfiguration;
@@ -70,7 +67,8 @@ public class TranslationContext {
translationMapping =
config.generateMap(ConfigConstants.MAPPING_NAMESPACE, ConfigConstants.RESOURCE_MAPPING_KEY);
try {
- globalServiceTemplates = GlobalTypesGenerator.getGlobalTypesServiceTemplate();
+ globalServiceTemplates =
+ GlobalTypesGenerator.getGlobalTypesServiceTemplate(OnboardingTypesEnum.ZIP);
} catch (Exception exc) {
throw new RuntimeException("Failed to load GlobalTypes", exc);
}
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/HeatToToscaUtil.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/HeatToToscaUtil.java
index 9d875d20f4..a0a7a51c92 100644
--- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/HeatToToscaUtil.java
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/HeatToToscaUtil.java
@@ -1,21 +1,17 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
+/*
+ * Copyright © 2016-2017 European Support Limited
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END=========================================================
*/
package org.openecomp.sdc.translator.services.heattotosca;
@@ -27,6 +23,7 @@ import org.openecomp.core.translator.datatypes.TranslatorOutput;
import org.openecomp.core.translator.factory.HeatToToscaTranslatorFactory;
import org.openecomp.core.utilities.file.FileContentHandler;
import org.openecomp.core.utilities.file.FileUtils;
+import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
import org.openecomp.core.validation.util.MessageContainerUtil;
import org.openecomp.sdc.common.errors.CoreException;
import org.openecomp.sdc.common.togglz.ToggleableFeature;
@@ -1457,7 +1454,8 @@ public class HeatToToscaUtil {
mdcDataDebugMessage.debugEntryMessage(null, null);
List<ServiceTemplate> serviceTemplates = new ArrayList<>();
- serviceTemplates.addAll(GlobalTypesGenerator.getGlobalTypesServiceTemplate().values());
+ serviceTemplates.addAll(GlobalTypesGenerator
+ .getGlobalTypesServiceTemplate(OnboardingTypesEnum.ZIP).values());
serviceTemplates.addAll(translationContext.getTranslatedServiceTemplates().values());
Map<String, ServiceTemplate> serviceTemplatesMap = new HashMap<>();
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/globaltypes/GlobalTypesGenerator.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/globaltypes/GlobalTypesGenerator.java
index 9eadfc2907..ecc0a5f06c 100644
--- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/globaltypes/GlobalTypesGenerator.java
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/globaltypes/GlobalTypesGenerator.java
@@ -1,25 +1,22 @@
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
+/*
+ * Copyright © 2016-2017 European Support Limited
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END=========================================================
*/
package org.openecomp.sdc.translator.services.heattotosca.globaltypes;
+import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
import org.openecomp.sdc.tosca.datatypes.model.Import;
import org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate;
import org.openecomp.sdc.translator.services.heattotosca.HeatToToscaUtil;
@@ -40,8 +37,9 @@ public class GlobalTypesGenerator {
*
* @return the global types service template
*/
- public static Map<String, ServiceTemplate> getGlobalTypesServiceTemplate() {
- return GlobalTypesServiceTemplates.getGlobalTypesServiceTemplates();
+ public static Map<String, ServiceTemplate> getGlobalTypesServiceTemplate(OnboardingTypesEnum
+ onboardingType) {
+ return GlobalTypesServiceTemplates.getGlobalTypesServiceTemplates(onboardingType);
}
/**
@@ -53,7 +51,7 @@ public class GlobalTypesGenerator {
List<Map<String, Import>> globalImports = new ArrayList<>();
Map<String, Import> globalImportMap = new HashMap<>();
Map<String, ServiceTemplate> globalTypesServiceTemplate =
- GlobalTypesGenerator.getGlobalTypesServiceTemplate();
+ GlobalTypesGenerator.getGlobalTypesServiceTemplate(OnboardingTypesEnum.ZIP);
globalImportMap.put("openecomp_heat_index",
HeatToToscaUtil.createServiceTemplateImport(globalTypesServiceTemplate.get
("openecomp-heat/_index.yml")));
@@ -70,7 +68,7 @@ public class GlobalTypesGenerator {
List<Map<String, Import>> globalImports = new ArrayList<>();
Map<String, Import> globalImportMap = new HashMap<>();
Map<String, ServiceTemplate> globalTypesServiceTemplate =
- GlobalTypesGenerator.getGlobalTypesServiceTemplate();
+ GlobalTypesGenerator.getGlobalTypesServiceTemplate(OnboardingTypesEnum.MANUAL);
globalImportMap.put("openecomp_index",
HeatToToscaUtil.createServiceTemplateImport(globalTypesServiceTemplate.get
("openecomp/_index.yml")));
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/globaltypes/GlobalTypesServiceTemplates.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/globaltypes/GlobalTypesServiceTemplates.java
index dff208f101..5490452155 100644
--- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/globaltypes/GlobalTypesServiceTemplates.java
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/main/java/org/openecomp/sdc/translator/services/heattotosca/globaltypes/GlobalTypesServiceTemplates.java
@@ -1,5 +1,22 @@
+/*
+ * Copyright © 2016-2017 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.openecomp.sdc.translator.services.heattotosca.globaltypes;
+import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
import org.openecomp.sdc.common.errors.CoreException;
import org.openecomp.sdc.common.errors.ErrorCategory;
import org.openecomp.sdc.common.errors.ErrorCode;
@@ -9,31 +26,20 @@ import org.openecomp.sdc.tosca.services.ToscaExtensionYamlUtil;
import org.openecomp.sdc.tosca.services.ToscaUtil;
import org.openecomp.sdc.translator.utils.ResourceWalker;
+import java.util.EnumMap;
import java.util.HashMap;
import java.util.Map;
-/**
- * @author Avrahamg
- * @since April 03, 2017
- */
public class GlobalTypesServiceTemplates {
- private static Map<String, ServiceTemplate> globalTypesServiceTemplates;
+ private static final Map<OnboardingTypesEnum, Map<String, ServiceTemplate>>
+ onboardingGlobalTypesServiceTemplates;
- public static Map<String, ServiceTemplate> getGlobalTypesServiceTemplates() {
- if (globalTypesServiceTemplates == null) {
- synchronized (GlobalTypesServiceTemplates.class) {
- if (globalTypesServiceTemplates == null) {
- init();
- }
- }
- }
- return globalTypesServiceTemplates;
+ private GlobalTypesServiceTemplates() {
}
- private static void init() {
- globalTypesServiceTemplates = new HashMap<>();
- Map<String, String> globalTypes = null;
+ static {
+ Map<String, String> globalTypes;
try {
globalTypes = ResourceWalker.readResourcesFromDirectory("globalTypes");
} catch (CoreException coreException) {
@@ -44,18 +50,66 @@ public class GlobalTypesServiceTemplates {
.withId("GlobalTypes Read Error").withCategory(ErrorCategory.APPLICATION).build(),
exception);
}
+ onboardingGlobalTypesServiceTemplates = init(globalTypes);
+ }
+
+ public static Map<String, ServiceTemplate> getGlobalTypesServiceTemplates(OnboardingTypesEnum
+ onboardingType) {
+ if (onboardingType == null) {
+ throw new CoreException((new ErrorCode.ErrorCodeBuilder())
+ .withMessage(LoggerErrorDescription.FAILED_TO_GENERATE_GLOBAL_TYPES)
+ .withId("Invalid Onboarding Type").withCategory(ErrorCategory.APPLICATION).build());
+ }
+ return onboardingGlobalTypesServiceTemplates.get(onboardingType);
+ }
+
+ private static Map<OnboardingTypesEnum, Map<String, ServiceTemplate>>
+ init(Map<String, String> globalTypes) {
+ Map<OnboardingTypesEnum, Map<String, ServiceTemplate>>
+ onboardingGlobalTypesServiceTemplates = new EnumMap<>(OnboardingTypesEnum.class);
+ Map<String, ServiceTemplate> zipOnboardingGlobalTypes =
+ getOnboardingGlobalTypes(globalTypes, OnboardingTypesEnum.ZIP);
+ Map<String, ServiceTemplate> csarOnboardingGlobalTypes =
+ getOnboardingGlobalTypes(globalTypes, OnboardingTypesEnum.CSAR);
+ Map<String, ServiceTemplate> manualOnboardingGlobalTypes =
+ getOnboardingGlobalTypes(globalTypes, OnboardingTypesEnum.MANUAL);
+ Map<String, ServiceTemplate> defaultOnboardingGlobalTypes =
+ getOnboardingGlobalTypes(globalTypes, OnboardingTypesEnum.NONE);
+ onboardingGlobalTypesServiceTemplates.put(OnboardingTypesEnum.ZIP, zipOnboardingGlobalTypes);
+ onboardingGlobalTypesServiceTemplates.put(OnboardingTypesEnum.CSAR, csarOnboardingGlobalTypes);
+ onboardingGlobalTypesServiceTemplates.put(OnboardingTypesEnum.MANUAL,
+ manualOnboardingGlobalTypes);
+ onboardingGlobalTypesServiceTemplates.put(OnboardingTypesEnum.NONE,
+ defaultOnboardingGlobalTypes);
+ return onboardingGlobalTypesServiceTemplates;
+ }
+
+ private static Map<String, ServiceTemplate> getOnboardingGlobalTypes(Map<String, String>
+ globalTypes,
+ OnboardingTypesEnum
+ onboardingType) {
+ Map<String, ServiceTemplate> globalTypesServiceTemplates = new HashMap<>();
ToscaExtensionYamlUtil toscaExtensionYamlUtil = new ToscaExtensionYamlUtil();
for (Map.Entry<String, String> globalTypeContent : globalTypes.entrySet()) {
- if (globalTypeContent.getKey().contains("openecomp-inventory")) { // this global types folder
- // should not be
- // processed to the CSAR
+ if (!isTypeValidCandidateForCsarPacking(globalTypeContent.getKey(), onboardingType)) {
+ // this global types folders should not be processed to the CSAR
continue;
}
ToscaUtil.addServiceTemplateToMapWithKeyFileName(globalTypesServiceTemplates,
toscaExtensionYamlUtil.yamlToObject(globalTypeContent.getValue(), ServiceTemplate.class));
}
+ return globalTypesServiceTemplates;
}
- private GlobalTypesServiceTemplates() {
+ private static boolean isTypeValidCandidateForCsarPacking(String globalTypeResourceKey,
+ OnboardingTypesEnum
+ onboardingType) {
+ if (globalTypeResourceKey.contains("openecomp-inventory")) {
+ // this global types folders should not be processed to the CSAR
+ return false;
+ }
+ //Global types specific to csar onboarding should not be packed for other onboarding types
+ return !globalTypeResourceKey.contains("onap") || onboardingType == OnboardingTypesEnum.CSAR;
}
+
}
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/globaltypes/GlobalTypesServiceTemplatesTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/globaltypes/GlobalTypesServiceTemplatesTest.java
new file mode 100644
index 0000000000..d97128eea3
--- /dev/null
+++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/globaltypes/GlobalTypesServiceTemplatesTest.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright © 2016-2017 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.openecomp.sdc.translator.services.heattotosca.globaltypes;
+
+import static org.openecomp.sdc.translator.services.heattotosca.globaltypes.GlobalTypesServiceTemplates.getGlobalTypesServiceTemplates;
+
+import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
+import org.openecomp.sdc.common.errors.CoreException;
+import org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+public class GlobalTypesServiceTemplatesTest {
+
+ @Test(expectedExceptions = CoreException.class,
+ expectedExceptionsMessageRegExp = "Failed to generate globalTypes")
+ public void testGetGlobalTypesServiceTemplatesOnboardingMethodNull() {
+ Map<String, ServiceTemplate> globalTypesServiceTemplates = getGlobalTypesServiceTemplates(null);
+ }
+
+ @Test
+ public void testGetGlobalTypesServiceTemplatesOnboardingMethodToscaCsar() {
+ Map<String, ServiceTemplate> globalTypesServiceTemplates =
+ getGlobalTypesServiceTemplates(OnboardingTypesEnum.CSAR);
+ Assert.assertNotNull(globalTypesServiceTemplates);
+ Assert.assertEquals(globalTypesServiceTemplates.size(), 24);
+ Set<String> globalTypeFolders = globalTypesServiceTemplates.keySet();
+ List<String> onapGlobalTypes = globalTypeFolders.stream()
+ .filter(resourceKey -> resourceKey.contains("onap"))
+ .collect(Collectors.toList());
+ Assert.assertNotNull(onapGlobalTypes);
+ Assert.assertEquals(onapGlobalTypes.size(), 5);
+ }
+
+ @Test
+ public void testGetGlobalTypesServiceTemplatesOnboardingMethodHeat() {
+ Map<String, ServiceTemplate> globalTypesServiceTemplates =
+ getGlobalTypesServiceTemplates(OnboardingTypesEnum.ZIP);
+ Assert.assertNotNull(globalTypesServiceTemplates);
+ Assert.assertEquals(globalTypesServiceTemplates.size(), 19);
+ Set<String> globalTypeFolders = globalTypesServiceTemplates.keySet();
+ List<String> onapGlobalTypes = globalTypeFolders.stream()
+ .filter(resourceKey -> resourceKey.contains("onap"))
+ .collect(Collectors.toList());
+ Assert.assertEquals(onapGlobalTypes.size(), 0);
+ }
+
+ @Test
+ public void testGetGlobalTypesServiceTemplatesOnboardingMethodManual() {
+ Map<String, ServiceTemplate> globalTypesServiceTemplates =
+ getGlobalTypesServiceTemplates(OnboardingTypesEnum.MANUAL);
+ Assert.assertNotNull(globalTypesServiceTemplates);
+ Assert.assertEquals(globalTypesServiceTemplates.size(), 19);
+ Set<String> globalTypeFolders = globalTypesServiceTemplates.keySet();
+ List<String> onapGlobalTypes = globalTypeFolders.stream()
+ .filter(resourceKey -> resourceKey.contains("onap"))
+ .collect(Collectors.toList());
+ Assert.assertEquals(onapGlobalTypes.size(), 0);
+ }
+
+ @Test
+ public void testGetGlobalTypesServiceTemplatesOnboardingMethodNone() {
+ Map<String, ServiceTemplate> globalTypesServiceTemplates =
+ getGlobalTypesServiceTemplates(OnboardingTypesEnum.NONE);
+ Assert.assertNotNull(globalTypesServiceTemplates);
+ Assert.assertEquals(globalTypesServiceTemplates.size(), 19);
+ Set<String> globalTypeFolders = globalTypesServiceTemplates.keySet();
+ List<String> onapGlobalTypes = globalTypeFolders.stream()
+ .filter(resourceKey -> resourceKey.contains("onap"))
+ .collect(Collectors.toList());
+ Assert.assertEquals(onapGlobalTypes.size(), 0);
+ }
+
+} \ No newline at end of file
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/datatypes/Constants.java b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/datatypes/Constants.java
index 6f7e6be8af..90ce3f6f6b 100644
--- a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/datatypes/Constants.java
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-api/src/main/java/org/openecomp/core/converter/datatypes/Constants.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright © 2016-2017 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.openecomp.core.converter.datatypes;
import java.io.File;
@@ -39,6 +55,7 @@ public class Constants {
public static final String requirements = "requirements";
public static final String openecompHeatIndex = "openecomp_heat_index";
+ public static final String ONAP_INDEX = "onap_index";
public static final String globalSubstitution = "GlobalSubstitutionTypes";
public static final String externalFilesFolder = "External" + File.separator;
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/GlobalSubstitutionServiceTemplate.java b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/GlobalSubstitutionServiceTemplate.java
index 4ff8af495c..4a1f7c53cc 100644
--- a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/GlobalSubstitutionServiceTemplate.java
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/GlobalSubstitutionServiceTemplate.java
@@ -1,6 +1,25 @@
+/*
+ * Copyright © 2016-2017 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.openecomp.core.impl;
+import static org.openecomp.core.converter.datatypes.Constants.ONAP_INDEX;
+
import org.apache.commons.collections4.MapUtils;
+import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
import org.openecomp.sdc.logging.api.Logger;
import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.sdc.tosca.datatypes.model.Import;
@@ -23,8 +42,10 @@ public class GlobalSubstitutionServiceTemplate extends ServiceTemplate {
public static final String TEMPLATE_NAME_PROPERTY = "template_name";
public static final String DEFININTION_VERSION = "tosca_simple_yaml_1_0_0";
public static final String HEAT_INDEX = "openecomp_heat_index";
+ public static final String HEAT_INDEX_IMPORT_FILE = "openecomp-heat/_index.yml";
+ public static final String ONAP_INDEX_IMPORT_FILE = "onap/_index.yml";
private static final Map<String, ServiceTemplate> globalServiceTemplates =
- GlobalTypesGenerator.getGlobalTypesServiceTemplate();
+ GlobalTypesGenerator.getGlobalTypesServiceTemplate(OnboardingTypesEnum.CSAR);
public GlobalSubstitutionServiceTemplate() {
super();
@@ -52,8 +73,11 @@ public class GlobalSubstitutionServiceTemplate extends ServiceTemplate {
imports.add(stringImportMap);
setImports(imports);
Import imprtObj = new Import();
- imprtObj.setFile("openecomp-heat/_index.yml");
- stringImportMap.put("openecomp_heat_index", imprtObj);
+ imprtObj.setFile(HEAT_INDEX_IMPORT_FILE);
+ stringImportMap.put(HEAT_INDEX, imprtObj);
+ Import onapDefinitionsImport = new Import();
+ onapDefinitionsImport.setFile(ONAP_INDEX_IMPORT_FILE);
+ stringImportMap.put(ONAP_INDEX, onapDefinitionsImport);
}
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/ToscaConverterImpl.java b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/ToscaConverterImpl.java
index 39a53b499d..283f7fc3be 100644
--- a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/ToscaConverterImpl.java
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/ToscaConverterImpl.java
@@ -1,5 +1,38 @@
+/*
+ * Copyright © 2016-2017 European Support Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package org.openecomp.core.impl;
+import static org.openecomp.core.converter.datatypes.Constants.ONAP_INDEX;
+import static org.openecomp.core.converter.datatypes.Constants.capabilities;
+import static org.openecomp.core.converter.datatypes.Constants.definitionsDir;
+import static org.openecomp.core.converter.datatypes.Constants.globalStName;
+import static org.openecomp.core.converter.datatypes.Constants.globalSubstitution;
+import static org.openecomp.core.converter.datatypes.Constants.inputs;
+import static org.openecomp.core.converter.datatypes.Constants.mainStName;
+import static org.openecomp.core.converter.datatypes.Constants.manifestFileName;
+import static org.openecomp.core.converter.datatypes.Constants.metadataFile;
+import static org.openecomp.core.converter.datatypes.Constants.nodeType;
+import static org.openecomp.core.converter.datatypes.Constants.openecompHeatIndex;
+import static org.openecomp.core.converter.datatypes.Constants.outputs;
+import static org.openecomp.core.converter.datatypes.Constants.requirements;
+import static org.openecomp.core.impl.GlobalSubstitutionServiceTemplate.GLOBAL_SUBSTITUTION_SERVICE_FILE_NAME;
+import static org.openecomp.core.impl.GlobalSubstitutionServiceTemplate.HEAT_INDEX_IMPORT_FILE;
+import static org.openecomp.core.impl.GlobalSubstitutionServiceTemplate.ONAP_INDEX_IMPORT_FILE;
+
import org.apache.commons.collections.MapUtils;
import org.openecomp.core.converter.ServiceTemplateReaderService;
import org.openecomp.core.converter.ToscaConverter;
@@ -8,6 +41,7 @@ import org.openecomp.core.converter.datatypes.CsarFileTypes;
import org.openecomp.core.converter.errors.SubstitutionMappingsConverterErrorBuilder;
import org.openecomp.core.impl.services.ServiceTemplateReaderServiceImpl;
import org.openecomp.core.utilities.file.FileContentHandler;
+import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum;
import org.openecomp.sdc.common.errors.CoreException;
import org.openecomp.sdc.common.errors.ErrorCategory;
import org.openecomp.sdc.common.errors.ErrorCode;
@@ -41,20 +75,6 @@ import java.util.Optional;
import java.util.jar.Manifest;
import java.util.regex.Pattern;
-import static org.openecomp.core.converter.datatypes.Constants.capabilities;
-import static org.openecomp.core.converter.datatypes.Constants.definitionsDir;
-import static org.openecomp.core.converter.datatypes.Constants.globalStName;
-import static org.openecomp.core.converter.datatypes.Constants.globalSubstitution;
-import static org.openecomp.core.converter.datatypes.Constants.inputs;
-import static org.openecomp.core.converter.datatypes.Constants.mainStName;
-import static org.openecomp.core.converter.datatypes.Constants.manifestFileName;
-import static org.openecomp.core.converter.datatypes.Constants.metadataFile;
-import static org.openecomp.core.converter.datatypes.Constants.nodeType;
-import static org.openecomp.core.converter.datatypes.Constants.openecompHeatIndex;
-import static org.openecomp.core.converter.datatypes.Constants.outputs;
-import static org.openecomp.core.converter.datatypes.Constants.requirements;
-import static org.openecomp.core.impl.GlobalSubstitutionServiceTemplate.GLOBAL_SUBSTITUTION_SERVICE_FILE_NAME;
-
public class ToscaConverterImpl implements ToscaConverter {
public ToscaConverterImpl() {
@@ -138,7 +158,7 @@ public class ToscaConverterImpl implements ToscaConverter {
GlobalSubstitutionServiceTemplate globalSubstitutionServiceTemplate,
Map<String, byte[]> csarFiles) {
Collection<ServiceTemplate> globalServiceTemplates =
- GlobalTypesGenerator.getGlobalTypesServiceTemplate().values();
+ GlobalTypesGenerator.getGlobalTypesServiceTemplate(OnboardingTypesEnum.CSAR).values();
addGlobalServiceTemplates(globalServiceTemplates, serviceTemplates);
toscaServiceModel.setEntryDefinitionServiceTemplate(mainStName);
toscaServiceModel.setServiceTemplates(serviceTemplates);
@@ -224,7 +244,8 @@ public class ToscaConverterImpl implements ToscaConverter {
private void convertImports(ServiceTemplate serviceTemplate) {
serviceTemplate.setImports(new ArrayList<>());
serviceTemplate.getImports()
- .add(createImportMap(openecompHeatIndex, "openecomp-heat/_index.yml"));
+ .add(createImportMap(openecompHeatIndex, HEAT_INDEX_IMPORT_FILE));
+ serviceTemplate.getImports().add(createImportMap(ONAP_INDEX, ONAP_INDEX_IMPORT_FILE));
serviceTemplate.getImports().add(createImportMap(globalSubstitution, globalStName));
}
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/converter/impl/ToscaConvertorDefinitionsTest.java b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/converter/impl/ToscaConvertorDefinitionsTest.java
index 82a36950f3..0fec361561 100644
--- a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/converter/impl/ToscaConvertorDefinitionsTest.java
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/converter/impl/ToscaConvertorDefinitionsTest.java
@@ -1,5 +1,16 @@
package org.openecomp.core.converter.impl;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.openecomp.core.converter.datatypes.Constants.ONAP_INDEX;
+import static org.openecomp.core.impl.GlobalSubstitutionServiceTemplate.DEFININTION_VERSION;
+import static org.openecomp.core.impl.GlobalSubstitutionServiceTemplate.GLOBAL_SUBSTITUTION_SERVICE_FILE_NAME;
+import static org.openecomp.core.impl.GlobalSubstitutionServiceTemplate.HEAT_INDEX;
+import static org.openecomp.core.impl.GlobalSubstitutionServiceTemplate.TEMPLATE_NAME_PROPERTY;
+import static org.openecomp.sdc.common.utils.CommonUtil.validateAndUploadFileContent;
+
import org.apache.commons.io.IOUtils;
import org.junit.Test;
import org.openecomp.core.impl.GlobalSubstitutionServiceTemplate;
@@ -12,16 +23,6 @@ import org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate;
import java.net.URL;
import java.util.Map;
import java.util.Set;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.openecomp.core.impl.GlobalSubstitutionServiceTemplate.DEFININTION_VERSION;
-import static org.openecomp.core.impl.GlobalSubstitutionServiceTemplate.GLOBAL_SUBSTITUTION_SERVICE_FILE_NAME;
-import static org.openecomp.core.impl.GlobalSubstitutionServiceTemplate.HEAT_INDEX;
-import static org.openecomp.core.impl.GlobalSubstitutionServiceTemplate.TEMPLATE_NAME_PROPERTY;
-import static org.openecomp.sdc.common.utils.CommonUtil.validateAndUploadFileContent;
public class ToscaConvertorDefinitionsTest {
@@ -48,6 +49,7 @@ public class ToscaConvertorDefinitionsTest {
assertFalse(serviceTemplate.getImports().isEmpty());
assertEquals(1 ,serviceTemplate.getImports().size());
assertTrue(serviceTemplate.getImports().get(0).containsKey(HEAT_INDEX));
+ assertTrue(serviceTemplate.getImports().get(0).containsKey(ONAP_INDEX));
assertEquals(DEFININTION_VERSION, serviceTemplate.getTosca_definitions_version());
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/conversionWithInt/out/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/conversionWithInt/out/MainServiceTemplate.yaml
index 10f7c21363..1a5c61efbe 100644
--- a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/conversionWithInt/out/MainServiceTemplate.yaml
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/conversionWithInt/out/MainServiceTemplate.yaml
@@ -12,6 +12,8 @@ metadata:
imports:
- openecomp_heat_index:
file: openecomp-heat/_index.yml
+- onap_index:
+ file: onap/_index.yml
- GlobalSubstitutionTypes:
file: GlobalSubstitutionTypesServiceTemplate.yaml
topology_template:
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertCsar/out/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertCsar/out/MainServiceTemplate.yaml
index e54533e7c2..590ee413b8 100644
--- a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertCsar/out/MainServiceTemplate.yaml
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertCsar/out/MainServiceTemplate.yaml
@@ -14,6 +14,8 @@ metadata:
imports:
- openecomp_heat_index:
file: openecomp-heat/_index.yml
+- onap_index:
+ file: onap/_index.yml
- GlobalSubstitutionTypes:
file: GlobalSubstitutionTypesServiceTemplate.yaml
topology_template:
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/out/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/out/MainServiceTemplate.yaml
index ff43b5a7e7..88ae60529d 100644
--- a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/out/MainServiceTemplate.yaml
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/out/MainServiceTemplate.yaml
@@ -13,6 +13,8 @@ metadata:
imports:
- openecomp_heat_index:
file: openecomp-heat/_index.yml
+- onap_index:
+ file: onap/_index.yml
- GlobalSubstitutionTypes:
file: GlobalSubstitutionTypesServiceTemplate.yaml
node_types:
diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertParameters/out/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertParameters/out/MainServiceTemplate.yaml
index 8dbe0517f5..d30f46e360 100644
--- a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertParameters/out/MainServiceTemplate.yaml
+++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertParameters/out/MainServiceTemplate.yaml
@@ -13,6 +13,8 @@ metadata:
imports:
- openecomp_heat_index:
file: openecomp-heat/_index.yml
+- onap_index:
+ file: onap/_index.yml
- GlobalSubstitutionTypes:
file: GlobalSubstitutionTypesServiceTemplate.yaml
topology_template: