aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core
diff options
context:
space:
mode:
Diffstat (limited to 'openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core')
-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
2 files changed, 64 insertions, 19 deletions
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));
}