From c8a540b3c234449163f6fb1899807bba951113b4 Mon Sep 17 00:00:00 2001 From: shrek2000 Date: Mon, 11 Sep 2017 15:45:37 +0300 Subject: Create new VSP, onboard from TOSCA file - UI Change-Id: I018c6d07a4b9ec7e6b1507ab37e2550865423cfe Issue-ID: SDC-230 Signed-off-by: shrek2000 --- .../impl/GlobalSubstitutionServiceTemplate.java | 59 +++ .../openecomp/core/impl/ToscaConverterImpl.java | 446 +++++++++++++++++ .../core/impl/ToscaConverterManagerImpl.java | 49 ++ .../impl/factory/ToscaConverterFactoryImpl.java | 12 + .../services/ServiceTemplateReaderServiceImpl.java | 76 +++ .../src/resources/ToscaConverters.json | 3 + .../converter/impl/ToscaConverterImplTest.java | 193 ++++++++ .../impl/ToscaConvertorDefinitionsTest.java | 62 +++ .../src/test/resources/csar/vCSCF.csar | Bin 0 -> 8186 bytes .../convertMainSt/in/Artifacts/checksum.lst | 1 + .../convertMainSt/in/Artifacts/csar.meta | 3 + .../GlobalSubstitutionTypesServiceTemplate.yaml | 60 +++ .../convertMainSt/in/MainServiceTemplate.mf | 12 + .../convertMainSt/in/MainServiceTemplate.yaml | 551 +++++++++++++++++++++ .../convertMainSt/in/TOSCA-Metadata/TOSCA.meta | 135 +++++ .../convertMainSt/out/MainServiceTemplate.yaml | 546 ++++++++++++++++++++ 16 files changed, 2208 insertions(+) create mode 100644 openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/GlobalSubstitutionServiceTemplate.java create mode 100644 openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/ToscaConverterImpl.java create mode 100644 openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/ToscaConverterManagerImpl.java create mode 100644 openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/factory/ToscaConverterFactoryImpl.java create mode 100644 openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/services/ServiceTemplateReaderServiceImpl.java create mode 100644 openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/resources/ToscaConverters.json create mode 100644 openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/converter/impl/ToscaConverterImplTest.java create mode 100644 openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/converter/impl/ToscaConvertorDefinitionsTest.java create mode 100644 openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/csar/vCSCF.csar create mode 100644 openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/in/Artifacts/checksum.lst create mode 100644 openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/in/Artifacts/csar.meta create mode 100644 openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/in/Definitions/GlobalSubstitutionTypesServiceTemplate.yaml create mode 100644 openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/in/MainServiceTemplate.mf create mode 100644 openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/in/MainServiceTemplate.yaml create mode 100644 openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/in/TOSCA-Metadata/TOSCA.meta create mode 100644 openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/out/MainServiceTemplate.yaml (limited to 'openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src') 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 new file mode 100644 index 0000000000..2d33748e26 --- /dev/null +++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/GlobalSubstitutionServiceTemplate.java @@ -0,0 +1,59 @@ +package org.openecomp.core.impl; + +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; +import org.openecomp.sdc.tosca.datatypes.model.Import; +import org.openecomp.sdc.tosca.datatypes.model.NodeType; +import org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GlobalSubstitutionServiceTemplate extends ServiceTemplate { + private static final Logger logger = LoggerFactory.getLogger(ServiceTemplate.class); + + public static final String GLOBAL_SUBSTITUTION_SERVICE_FILE_NAME = "GlobalSubstitutionServiceTemplate.yaml"; + 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 GlobalSubstitutionServiceTemplate() { + super(); + init(); + } + + + public void appendNodes(Map nodes) { + getNode_types().putAll(nodes); + } + + public void init() { + writeDefinitionSection(); + writeMetadataSection(); + writeImportsSection(); + setNode_types(new HashMap<>()); + } + + private void writeImportsSection() { + List> imports = new ArrayList<>(); + Map stringImportMap = new HashMap<>(); + imports.add(stringImportMap); + setImports(imports); + Import imprtObj = new Import(); + imprtObj.setFile("openecomp-heat/_index.yml"); + stringImportMap.put("openecomp_heat_index", imprtObj); + } + + + private void writeMetadataSection() { + Map metadata = new HashMap<>(); + metadata.put(TEMPLATE_NAME_PROPERTY, "GlobalSubstitutionTypes"); + setMetadata(metadata); + } + + private void writeDefinitionSection() { + setTosca_definitions_version(DEFININTION_VERSION); + } +} 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 new file mode 100644 index 0000000000..c4ed6f9c5f --- /dev/null +++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/ToscaConverterImpl.java @@ -0,0 +1,446 @@ +package org.openecomp.core.impl; + +import org.apache.commons.collections.MapUtils; +import org.openecomp.core.converter.ServiceTemplateReaderService; +import org.openecomp.core.converter.ToscaConverter; +import org.openecomp.core.converter.datatypes.Constants; +import org.openecomp.core.converter.datatypes.CsarFileTypes; +import org.openecomp.core.impl.services.ServiceTemplateReaderServiceImpl; +import org.openecomp.core.utilities.file.FileContentHandler; +import org.openecomp.core.utilities.json.JsonUtil; +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.tosca.datatypes.ToscaServiceModel; +import org.openecomp.sdc.tosca.datatypes.model.*; +import org.openecomp.sdc.tosca.services.DataModelUtil; +import org.openecomp.sdc.tosca.services.ToscaUtil; +import org.openecomp.sdc.translator.services.heattotosca.globaltypes.GlobalTypesGenerator; +import org.yaml.snakeyaml.error.YAMLException; + +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.IOException; +import java.util.*; +import java.util.jar.Manifest; +import java.util.regex.Pattern; + +import static org.openecomp.core.converter.datatypes.Constants.*; +import static org.openecomp.core.impl.GlobalSubstitutionServiceTemplate.GLOBAL_SUBSTITUTION_SERVICE_FILE_NAME; + +public class ToscaConverterImpl implements ToscaConverter { + + public ToscaConverterImpl() { + + } + + @Override + public ToscaServiceModel convert(FileContentHandler fileContentHandler) + throws IOException { + Map csarFiles = new HashMap<>(fileContentHandler.getFiles()); + ToscaServiceModel toscaServiceModel = new ToscaServiceModel(); + Map serviceTemplates = new HashMap<>(); + FileContentHandler artifacts = new FileContentHandler(); + GlobalSubstitutionServiceTemplate gsst = new GlobalSubstitutionServiceTemplate(); + for (Map.Entry fileEntry : csarFiles.entrySet()) { + CsarFileTypes fileType = getFileType(fileEntry.getKey()); + switch (fileType) { + case mainServiceTemplate: + handleServiceTemplate(mainStName, fileEntry.getKey(), csarFiles, serviceTemplates); + break; + + case globalServiceTemplate: + handleServiceTemplate(globalStName, fileEntry.getKey(), csarFiles, serviceTemplates); + break; + + case externalFile: + artifacts.addFile(fileEntry.getKey(), fileEntry.getValue()); + break; + + case definitionsFile: + handleDefintionTemplate(fileEntry.getKey(), csarFiles, gsst); + break; + } + } + handleMetadataFile(csarFiles); + updateToscaServiceModel(toscaServiceModel, serviceTemplates, artifacts, gsst, csarFiles); + return toscaServiceModel; + } + + private void handleMetadataFile(Map csarFiles) { + byte[] bytes = csarFiles.remove(metadataFile); + if (bytes != null) { + csarFiles.put(metadataFile + ".old", bytes); + } + } + + private void handleDefintionTemplate(String key, Map csarFiles, + GlobalSubstitutionServiceTemplate gsst) { + try { + ServiceTemplateReaderService readerService = new ServiceTemplateReaderServiceImpl(csarFiles.get(key)); + if (readerService == null) { + return; + } + Object nodeTypes = readerService.getNodeTypes(); + if (nodeTypes instanceof Map) { + Map nodeTypeMap = (Map) nodeTypes; + gsst.appendNodes(nodeTypeMap); + } + } catch (YAMLException ye) { + throw new CoreException(new ErrorCode.ErrorCodeBuilder() + .withMessage("Invalid YAML content in file " + key + ". reason - " + + ye.getMessage()) + .withCategory(ErrorCategory.APPLICATION).build()); + } + } + + private void updateToscaServiceModel(ToscaServiceModel toscaServiceModel, + Map serviceTemplates, + FileContentHandler externalFilesHandler, + GlobalSubstitutionServiceTemplate globalSubstitutionServiceTemplate, + Map csarFiles) { + Collection globalServiceTemplates = + GlobalTypesGenerator.getGlobalTypesServiceTemplate().values(); + addGlobalServiceTemplates(globalServiceTemplates, serviceTemplates); + serviceTemplates.put(GLOBAL_SUBSTITUTION_SERVICE_FILE_NAME, globalSubstitutionServiceTemplate); + toscaServiceModel.setEntryDefinitionServiceTemplate(mainStName); + toscaServiceModel.setServiceTemplates(serviceTemplates); + externalFilesHandler.addFile(metadataFile + ".old", csarFiles.get(metadataFile + ".old")); + toscaServiceModel.setArtifactFiles(externalFilesHandler); + } + + private void addGlobalServiceTemplates(Collection globalServiceTemplates, + Map serviceTemplates) { + for (ServiceTemplate serviceTemplate : globalServiceTemplates) { + serviceTemplates.put(ToscaUtil.getServiceTemplateFileName(serviceTemplate), serviceTemplate); + } + } + + private void handleServiceTemplate(String serviceTemplateName, + String fileName, Map csarFiles, + Map serviceTemplates) { + Optional serviceTemplate = + getServiceTemplateFromCsar(fileName, csarFiles); + serviceTemplate.ifPresent( + serviceTemplate1 -> addServiceTemplate(serviceTemplateName, serviceTemplate1, + serviceTemplates)); + } + + private void addServiceTemplate(String serviceTemplateName, + ServiceTemplate serviceTemplate, + Map serviceTemplates) { + serviceTemplates.put(serviceTemplateName, serviceTemplate); + } + + private Optional getManifestContent(Map csarFiles) { + for (Map.Entry csarFileEntry : csarFiles.entrySet()) { + if (csarFileEntry.getKey().contains(manifestFileName)) { + return Optional.of(csarFileEntry.getValue()); + } + } + + return Optional.empty(); + } + + private Optional getServiceTemplateFromCsar(String fileName, + Map csarFiles) { + byte[] fileContent = csarFiles.get(fileName); + ServiceTemplate serviceTemplate = convertServiceTemplate(fileName, fileContent); + + return Optional.of(serviceTemplate); + } + + private ServiceTemplate convertServiceTemplate(String serviceTemplateName, + byte[] fileContent) { + ServiceTemplate serviceTemplate = new ServiceTemplate(); + try { + ServiceTemplateReaderService readerService = + new ServiceTemplateReaderServiceImpl(fileContent); + convertMetadata(serviceTemplateName, serviceTemplate, readerService); + convertToscaVersion(serviceTemplate, readerService); + convertImports(serviceTemplate); + convertNodeTypes(serviceTemplate, readerService); + convertTopologyTemplate(serviceTemplate, readerService); + + } catch (YAMLException ye) { + throw new CoreException(new ErrorCode.ErrorCodeBuilder() + .withMessage("Invalid YAML content in file" + serviceTemplateName + ". reason - " + + ye.getMessage()) + .withCategory(ErrorCategory.APPLICATION).build()); + } + + + return serviceTemplate; + } + + private void convertToscaVersion(ServiceTemplate serviceTemplate, + ServiceTemplateReaderService readerService) { + Object toscaVersion = readerService.getToscaVersion(); + serviceTemplate.setTosca_definitions_version((String) toscaVersion); + } + + private void convertImports(ServiceTemplate serviceTemplate) { + serviceTemplate.setImports(new ArrayList<>()); + serviceTemplate.getImports() + .add(createImportMap(openecompHeatIndex, "openecomp-heat/_index.yml")); + serviceTemplate.getImports().add(createImportMap(globalSubstitution, globalStName)); + + } + + private Map createImportMap(String key, String fileName) { + Map importMap = new HashMap<>(); + Import anImport = new Import(); + anImport.setFile(fileName); + importMap.put(key, anImport); + + return importMap; + } + + private void convertMetadata(String serviceTemplateName, + ServiceTemplate serviceTemplate, + ServiceTemplateReaderService readerService) { + Map metadataToConvert = (Map) readerService.getMetadata(); + Map finalMetadata = new HashMap<>(); + + if (MapUtils.isNotEmpty(metadataToConvert)) { + for (Map.Entry metadataEntry : metadataToConvert.entrySet()) { + if (Objects.isNull(metadataEntry.getValue()) || + !(metadataEntry.getValue() instanceof String)) { + continue; + } + finalMetadata.put(metadataEntry.getKey(), (String) metadataEntry.getValue()); + } + } + + finalMetadata.put("template_name", getTemplateNameFromStName(serviceTemplateName)); + serviceTemplate.setMetadata(finalMetadata); + } + + private void convertNodeTypes(ServiceTemplate serviceTemplate, ServiceTemplateReaderService readerService) { + Map nodeTypes = (Map) readerService.getNodeTypes(); + if (MapUtils.isEmpty(nodeTypes)) { + return; + } + + for (Map.Entry nodeTypeEntry : nodeTypes.entrySet()) { + DataModelUtil + .addNodeType(serviceTemplate, nodeTypeEntry.getKey(), + (NodeType) createObjectFromClass(nodeTypeEntry.getKey(), nodeTypeEntry.getValue(), + NodeType.class)); + } + } + + private void convertTopologyTemplate(ServiceTemplate serviceTemplate, + ServiceTemplateReaderService readerService) { + + convertInputs(serviceTemplate, readerService); + convertNodeTemplates(serviceTemplate, readerService); + convertOutputs(serviceTemplate, readerService); + convertSubstitutionMappings(serviceTemplate, readerService); + } + + private void convertInputs(ServiceTemplate serviceTemplate, + ServiceTemplateReaderService readerService) { + Map inputs = readerService.getInputs(); + addInputsOrOutputsToServiceTemplate(serviceTemplate, inputs, Constants.inputs); + } + + private void convertOutputs(ServiceTemplate serviceTemplate, + ServiceTemplateReaderService readerService) { + Map outputs = readerService.getOutputs(); + addInputsOrOutputsToServiceTemplate(serviceTemplate, outputs, Constants.outputs); + } + + private void addInputsOrOutputsToServiceTemplate(ServiceTemplate serviceTemplate, + Map mapToConvert, + String inputsOrOutputs) { + if (MapUtils.isEmpty(mapToConvert)) { + return; + } + + for (Map.Entry entry : mapToConvert.entrySet()) { + ParameterDefinition parameterDefinition = + (ParameterDefinition) createObjectFromClass( + entry.getKey(), entry.getValue(), ParameterDefinition.class); + addToServiceTemplateAccordingToSection( + serviceTemplate, inputsOrOutputs, entry.getKey(), parameterDefinition); + } + } + + private void addToServiceTemplateAccordingToSection(ServiceTemplate serviceTemplate, + String inputsOrOutputs, + String parameterId, + ParameterDefinition parameterDefinition) { + switch (inputsOrOutputs) { + case inputs: + DataModelUtil + .addInputParameterToTopologyTemplate(serviceTemplate, parameterId, parameterDefinition); + break; + case outputs: + DataModelUtil + .addOutputParameterToTopologyTemplate(serviceTemplate, parameterId, parameterDefinition); + } + } + + private void convertNodeTemplates(ServiceTemplate serviceTemplate, + ServiceTemplateReaderService readerService) { + Map nodeTemplates = readerService.getNodeTemplates(); + if (MapUtils.isEmpty(nodeTemplates)) { + return; + } + + for (Map.Entry nodeTemplateEntry : nodeTemplates.entrySet()) { + NodeTemplate nodeTemplate = convertNodeTemplate(nodeTemplateEntry.getValue()); + DataModelUtil.addNodeTemplate(serviceTemplate, nodeTemplateEntry.getKey(), nodeTemplate); + } + } + + private void convertSubstitutionMappings(ServiceTemplate serviceTemplate, + ServiceTemplateReaderService readerService) { + Map substitutionMappings = readerService.getSubstitutionMappings(); + if (MapUtils.isEmpty(substitutionMappings)) { + return; + } + SubstitutionMapping substitutionMapping = convertSubstitutionMappings(substitutionMappings); + DataModelUtil.addSubstitutionMapping(serviceTemplate, substitutionMapping); + } + + private SubstitutionMapping convertSubstitutionMappings(Map substitutionMappings) { + SubstitutionMapping substitutionMapping = new SubstitutionMapping(); + + substitutionMapping.setNode_type((String) substitutionMappings.get(nodeType)); + substitutionMapping.setCapabilities( + convertSubstitutionMappingsSections((Map) substitutionMappings.get(capabilities))); + substitutionMapping.setRequirements( + convertSubstitutionMappingsSections((Map) substitutionMappings.get(requirements))); + + return substitutionMapping; + } + + private Map> convertSubstitutionMappingsSections( + Map sectionToConvert) { + Map> convertedSection = new HashMap<>(); + if (MapUtils.isEmpty(sectionToConvert)) { + return null; + } + + for (Map.Entry entry : sectionToConvert.entrySet()) { + if (entry.getValue() instanceof List) { + convertedSection.put(entry.getKey(), (List) entry.getValue()); + } + } + + return convertedSection; + } + + private CsarFileTypes getFileType(String fileName) { + if (isMainServiceTemplate(fileName)) { + return CsarFileTypes.mainServiceTemplate; + } else if (isGlobalServiceTemplate(fileName)) { + return CsarFileTypes.globalServiceTemplate; + } else if (isDefinitions(fileName)) { + return CsarFileTypes.definitionsFile; + } else if (isMetadataFile(metadataFile)) { + return CsarFileTypes.toscaMetadata; + } + return CsarFileTypes.externalFile; + } + + private Optional getCsarManifest(Map csarFiles) throws IOException { + Optional manifestContent = getManifestContent(csarFiles); + + if (manifestContent.isPresent()) { + ByteArrayInputStream byteInputStream = new ByteArrayInputStream(manifestContent.get()); + + return Optional.of(new Manifest(byteInputStream)); + } + + return Optional.empty(); + } + + private NodeTemplate convertNodeTemplate(Object candidateNodeTemplate) { + NodeTemplate nodeTemplate = new NodeTemplate(); + + Map nodeTemplateAsMap = (Map) candidateNodeTemplate; + nodeTemplate.setArtifacts((Map) nodeTemplateAsMap.get("artifacts")); + nodeTemplate.setAttributes((Map) nodeTemplateAsMap.get("attributes")); + nodeTemplate.setCopy((String) nodeTemplateAsMap.get("copy")); + nodeTemplate.setDescription((String) nodeTemplateAsMap.get("description")); + nodeTemplate.setDirectives((List) nodeTemplateAsMap.get("directives")); + nodeTemplate.setInterfaces( + (Map) nodeTemplateAsMap.get("interfaces")); + nodeTemplate.setNode_filter((NodeFilter) nodeTemplateAsMap.get("node_filter")); + nodeTemplate.setProperties((Map) nodeTemplateAsMap.get("properties")); + nodeTemplate.setRequirements( + (List>) nodeTemplateAsMap.get("requirements")); + nodeTemplate.setType((String) nodeTemplateAsMap.get("type")); + nodeTemplate.setCapabilities( + convertCapabilities((Map) nodeTemplateAsMap.get("capabilities"))); + + return nodeTemplate; + } + + private List> convertCapabilities(Map capabilities) { + List> convertedCapabilities = new ArrayList<>(); + if (MapUtils.isEmpty(capabilities)) { + return null; + } + for (Map.Entry capabilityAssignmentEntry : capabilities.entrySet()) { + Map tempMap = new HashMap<>(); + tempMap.put(capabilityAssignmentEntry.getKey(), + (CapabilityAssignment) createObjectFromClass + (capabilityAssignmentEntry.getKey(), capabilityAssignmentEntry.getValue(), CapabilityAssignment.class)); + convertedCapabilities.add(tempMap); + } + return convertedCapabilities; + } + + private Object createObjectFromClass(String nodeTypeId, + Object objectCandidate, + Class classToCreate) { + try { + return JsonUtil.json2Object(objectCandidate.toString(), classToCreate); + } catch (Exception e) { + //todo - return error to user? + throw new CoreException(new ErrorCode.ErrorCodeBuilder() + .withCategory(ErrorCategory.APPLICATION) + .withMessage("Can't create Node Type from " + nodeTypeId).build()); + } + } + + private boolean isMainServiceTemplate(String fileName) { + return fileName.endsWith(mainStName); + } + + private boolean isMetadataFile(String fileName) { + return fileName.equals(metadataFile); + } + + private boolean isGlobalServiceTemplate(String fileName) { + return fileName.endsWith(globalStName); + } + + private boolean isDefinitions(String fileName) { + return fileName.startsWith(definitionsDir); + } + + private String getTemplateNameFromStName(String serviceTemplateName) { + String fileNameWithoutDirectories; + fileNameWithoutDirectories = getFileNameWithoutDirectories(serviceTemplateName); + return fileNameWithoutDirectories.split("ServiceTemplate")[0]; + } + + private String getFileNameWithoutDirectories(String serviceTemplateName) { + String fileNameWithoutDirectories; + if (serviceTemplateName.contains("/")) { + String[] split = serviceTemplateName.split("/"); + fileNameWithoutDirectories = split[split.length - 1]; + } else if (serviceTemplateName.contains(File.separator)) { + String[] split = serviceTemplateName.split(Pattern.quote(File.separator)); + fileNameWithoutDirectories = split[split.length - 1]; + } else { + fileNameWithoutDirectories = serviceTemplateName; + } + return fileNameWithoutDirectories; + } +} diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/ToscaConverterManagerImpl.java b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/ToscaConverterManagerImpl.java new file mode 100644 index 0000000000..520e41817e --- /dev/null +++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/ToscaConverterManagerImpl.java @@ -0,0 +1,49 @@ +package org.openecomp.core.impl; + +import org.openecomp.core.converter.ToscaConverter; +import org.openecomp.core.converter.api.ToscaConverterManager; +import org.openecomp.core.utilities.file.FileContentHandler; +import org.openecomp.core.utilities.file.FileUtils; +import org.openecomp.core.utilities.json.JsonUtil; +import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel; + +import java.lang.reflect.Constructor; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +public class ToscaConverterManagerImpl implements ToscaConverterManager { + + private static List toscaConverters; + private static final String toscaConverterFileName = "ToscaConverters.json"; + + static { + toscaConverters = getConvertersList(); + } + + @Override + public ToscaServiceModel convert(String csarName, FileContentHandler fileContentHandler) { + return null; + } + + private static List getConvertersList(){ + List toscaConvertersList = new ArrayList<>(); + Map convertersMap = FileUtils.readViaInputStream(toscaConverterFileName, + stream -> JsonUtil.json2Object(stream, Map.class)); + return getToscaConvertersList(toscaConvertersList, convertersMap); + } + + private static List getToscaConvertersList( + List toscaConvertersList, Map convertersMap) { + for(String implClassName : convertersMap.values()){ + try{ + Class clazz = Class.forName(implClassName); + Constructor constructor = clazz.getConstructor(); + toscaConvertersList.add((ToscaConverter) constructor.newInstance()); + }catch (Exception e){ + continue; + } + } + return toscaConvertersList; + } +} diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/factory/ToscaConverterFactoryImpl.java b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/factory/ToscaConverterFactoryImpl.java new file mode 100644 index 0000000000..e04cd239c9 --- /dev/null +++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/factory/ToscaConverterFactoryImpl.java @@ -0,0 +1,12 @@ +package org.openecomp.core.impl.factory; + +import org.openecomp.core.converter.ToscaConverter; +import org.openecomp.core.converter.factory.ToscaConverterFactory; +import org.openecomp.core.impl.ToscaConverterImpl; + +public class ToscaConverterFactoryImpl extends ToscaConverterFactory { + @Override + public ToscaConverter createInterface() { + return new ToscaConverterImpl(); + } +} diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/services/ServiceTemplateReaderServiceImpl.java b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/services/ServiceTemplateReaderServiceImpl.java new file mode 100644 index 0000000000..fa8532546c --- /dev/null +++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/main/java/org/openecomp/core/impl/services/ServiceTemplateReaderServiceImpl.java @@ -0,0 +1,76 @@ +package org.openecomp.core.impl.services; + +import org.openecomp.core.converter.ServiceTemplateReaderService; +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.tosca.services.YamlUtil; +import org.yaml.snakeyaml.error.YAMLException; + +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +import static org.openecomp.core.converter.datatypes.Constants.*; + +public class ServiceTemplateReaderServiceImpl implements ServiceTemplateReaderService { + + private Map readServiceTemplate = new HashMap<>(); + + public ServiceTemplateReaderServiceImpl(byte[] serviceTemplateContent){ + this.readServiceTemplate = readServiceTemplate(serviceTemplateContent); + } + + @Override + public Map readServiceTemplate(byte[] serviceTemplateContent) { + + Map readSt = + new YamlUtil().yamlToObject(new String(serviceTemplateContent), Map.class); + + return readSt; + } + + @Override + public Object getMetadata(){ + return this.readServiceTemplate.get(metadata); + } + + @Override + public Object getToscaVersion(){ + return this.readServiceTemplate.get(definitionVersion); + } + + @Override + public Object getNodeTypes(){ + return this.readServiceTemplate.get(nodeTypes); + } + + @Override + public Object getTopologyTemplate(){ + return this.readServiceTemplate.get(topologyTemplate); + } + + @Override + public Map getNodeTemplates(){ + return Objects.isNull(this.getTopologyTemplate()) ? new HashMap<>() + : (Map) ((Map)this.getTopologyTemplate()).get(nodeTemplates); + } + + @Override + public Map getInputs(){ + return Objects.isNull(this.getTopologyTemplate()) ? new HashMap<>() + : (Map) ((Map)this.getTopologyTemplate()).get(inputs); + } + + @Override + public Map getOutputs(){ + return Objects.isNull(this.getTopologyTemplate()) ? new HashMap<>() + : (Map) ((Map)this.getTopologyTemplate()).get(outputs); + } + + @Override + public Map getSubstitutionMappings(){ + return Objects.isNull(this.getTopologyTemplate()) ? new HashMap<>() + : (Map) ((Map)this.getTopologyTemplate()).get(substitutionMappings); + } +} diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/resources/ToscaConverters.json b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/resources/ToscaConverters.json new file mode 100644 index 0000000000..e1cddeb854 --- /dev/null +++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/resources/ToscaConverters.json @@ -0,0 +1,3 @@ +{ + "ToscaConverter" : "org.openecomp.core.converter.impl.ToscaConverterImpl" +} \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/converter/impl/ToscaConverterImplTest.java b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/converter/impl/ToscaConverterImplTest.java new file mode 100644 index 0000000000..4abed3e316 --- /dev/null +++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/converter/impl/ToscaConverterImplTest.java @@ -0,0 +1,193 @@ +package org.openecomp.core.converter.impl; + +import org.apache.commons.collections.CollectionUtils; +import org.junit.Test; +import org.openecomp.core.converter.ToscaConverter; +import org.openecomp.core.impl.ToscaConverterImpl; +import org.openecomp.core.utilities.file.FileContentHandler; +import org.openecomp.core.utilities.file.FileUtils; +import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel; +import org.openecomp.sdc.tosca.datatypes.model.NodeTemplate; +import org.openecomp.sdc.tosca.datatypes.model.RequirementAssignment; +import org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate; +import org.openecomp.sdc.tosca.services.ToscaExtensionYamlUtil; +import org.openecomp.sdc.tosca.services.YamlUtil; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.nio.file.NotDirectoryException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.ListIterator; +import java.util.Map; +import java.util.Objects; + +import static org.junit.Assert.assertEquals; +import static org.openecomp.core.converter.datatypes.Constants.globalStName; +import static org.openecomp.core.converter.datatypes.Constants.mainStName; + +public class ToscaConverterImplTest { + + private static ToscaConverter toscaConverter = new ToscaConverterImpl(); + private static String inputFilesPath; + private static String outputFilesPath; + private static Map expectedOutserviceTemplates; + + + @Test + public void testConvertMainSt() throws IOException { + inputFilesPath = "/mock/toscaConverter/convertMainSt/in"; + outputFilesPath = "/mock/toscaConverter/convertMainSt/out"; + + FileContentHandler fileContentHandler = + createFileContentHandlerFromInput(inputFilesPath); + + expectedOutserviceTemplates = new HashMap<>(); + loadServiceTemplates(outputFilesPath, new ToscaExtensionYamlUtil(), + expectedOutserviceTemplates); + + ToscaServiceModel toscaServiceModel = toscaConverter.convert(fileContentHandler); + ServiceTemplate mainSt = toscaServiceModel.getServiceTemplates().get(mainStName); + + checkSTResults(expectedOutserviceTemplates, null, mainSt); + } + + + + private FileContentHandler createFileContentHandlerFromInput(String inputFilesPath) + throws IOException { + URL inputFilesUrl = this.getClass().getResource(inputFilesPath); + String path = inputFilesUrl.getPath(); + File directory = new File(path); + File[] listFiles = directory.listFiles(); + + FileContentHandler fileContentHandler = new FileContentHandler(); + insertFilesIntoFileContentHandler(listFiles, fileContentHandler); + return fileContentHandler; + } + + private void insertFilesIntoFileContentHandler(File[] listFiles, + FileContentHandler fileContentHandler) + throws IOException { + byte[] fileContent; + if(CollectionUtils.isEmpty(fileContentHandler.getFileList())) { + fileContentHandler.setFiles(new HashMap<>()); + } + + for (File file : listFiles) { + if(!file.isDirectory()) { + try (FileInputStream fis = new FileInputStream(file)) { + fileContent = FileUtils.toByteArray(fis); + fileContentHandler.addFile(file.getPath(), fileContent); + } + }else{ + File[] currFileList = file.listFiles(); + insertFilesIntoFileContentHandler(currFileList, fileContentHandler); + } + + } + } + + private void checkSTResults( + Map expectedOutserviceTemplates, + ServiceTemplate gloablSubstitutionServiceTemplate, ServiceTemplate mainServiceTemplate) { + YamlUtil yamlUtil = new YamlUtil(); + if (Objects.nonNull(gloablSubstitutionServiceTemplate)) { + assertEquals("difference global substitution service template: ", + yamlUtil.objectToYaml(expectedOutserviceTemplates.get(globalStName)), + yamlUtil.objectToYaml(gloablSubstitutionServiceTemplate)); + } + if (Objects.nonNull(mainServiceTemplate)) { + assertEquals("difference main service template: ", + yamlUtil.objectToYaml(expectedOutserviceTemplates.get(mainStName)), + yamlUtil.objectToYaml(mainServiceTemplate)); + } + } + + public static void loadServiceTemplates(String serviceTemplatesPath, + ToscaExtensionYamlUtil toscaExtensionYamlUtil, + Map serviceTemplates) + throws IOException { + URL urlFile = ToscaConverterImplTest.class.getResource(serviceTemplatesPath); + if (urlFile != null) { + File pathFile = new File(urlFile.getFile()); + File[] files = pathFile.listFiles(); + if (files != null) { + addServiceTemplateFiles(serviceTemplates, files, toscaExtensionYamlUtil); + } else { + throw new NotDirectoryException(serviceTemplatesPath); + } + } else { + throw new NotDirectoryException(serviceTemplatesPath); + } + } + + private static void addServiceTemplateFiles(Map serviceTemplates, + File[] files, + ToscaExtensionYamlUtil toscaExtensionYamlUtil) + throws IOException { + for (File file : files) { + try (InputStream yamlFile = new FileInputStream(file)) { + ServiceTemplate serviceTemplateFromYaml = + toscaExtensionYamlUtil.yamlToObject(yamlFile, ServiceTemplate.class); + createConcreteRequirementObjectsInServiceTemplate(serviceTemplateFromYaml, toscaExtensionYamlUtil); + serviceTemplates.put(file.getName(), serviceTemplateFromYaml); + try { + yamlFile.close(); + } catch (IOException ignore) { + } + } catch (FileNotFoundException e) { + throw e; + } catch (IOException e) { + throw e; + } + } + } + + private static void createConcreteRequirementObjectsInServiceTemplate(ServiceTemplate + serviceTemplateFromYaml, + ToscaExtensionYamlUtil + toscaExtensionYamlUtil) { + + if (serviceTemplateFromYaml == null + || serviceTemplateFromYaml.getTopology_template() == null + || serviceTemplateFromYaml.getTopology_template().getNode_templates() == null) { + return; + } + + //Creating concrete objects + Map nodeTemplates = + serviceTemplateFromYaml.getTopology_template().getNode_templates(); + for (Map.Entry entry : nodeTemplates.entrySet()) { + NodeTemplate nodeTemplate = entry.getValue(); + List> requirements = nodeTemplate.getRequirements(); + List> concreteRequirementList = new ArrayList<>(); + if (requirements != null) { + ListIterator> reqListIterator = requirements + .listIterator(); + while (reqListIterator.hasNext()){ + Map requirement = reqListIterator.next(); + Map concreteRequirement = new HashMap<>(); + for (Map.Entry reqEntry : requirement.entrySet()) { + RequirementAssignment requirementAssignment = (toscaExtensionYamlUtil + .yamlToObject(toscaExtensionYamlUtil.objectToYaml(reqEntry.getValue()), + RequirementAssignment.class)); + concreteRequirement.put(reqEntry.getKey(), requirementAssignment); + concreteRequirementList.add(concreteRequirement); + reqListIterator.remove(); + } + } + requirements.clear(); + requirements.addAll(concreteRequirementList); + nodeTemplate.setRequirements(requirements); + } + System.out.println(); + //toscaExtensionYamlUtil.yamlToObject(nodeTemplate, NodeTemplate.class); + } + } +} 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 new file mode 100644 index 0000000000..9f7071e9e7 --- /dev/null +++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/java/org/openecomp/core/converter/impl/ToscaConvertorDefinitionsTest.java @@ -0,0 +1,62 @@ +package org.openecomp.core.converter.impl; + +import org.apache.commons.io.IOUtils; +import org.junit.Test; +import org.openecomp.core.impl.GlobalSubstitutionServiceTemplate; +import org.openecomp.core.impl.ToscaConverterImpl; +import org.openecomp.core.utilities.file.FileContentHandler; +import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum; +import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel; +import org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate; + +import java.net.URL; +import java.util.Map; +import java.util.Set; + +import static org.openecomp.sdc.common.utils.CommonUtil.*; +import static org.junit.Assert.*; +import static org.openecomp.core.impl.GlobalSubstitutionServiceTemplate.*; +public class ToscaConvertorDefinitionsTest { + + + @Test + public void loadCsar() throws Exception { + URL resource = ToscaConvertorDefinitionsTest.class.getResource("/csar/vCSCF.csar"); + byte[] bytes = IOUtils.toByteArray(resource); + assertNotNull(bytes); + FileContentHandler contentMap = validateAndUploadFileContent(OnboardingTypesEnum.CSAR, bytes); + ToscaConverterImpl toscaConverter = new ToscaConverterImpl(); + ToscaServiceModel convert = toscaConverter.convert(contentMap); + Map serviceTemplates = convert.getServiceTemplates(); + assertTrue(serviceTemplates.containsKey(GLOBAL_SUBSTITUTION_SERVICE_FILE_NAME)); + ServiceTemplate serviceTemplate = serviceTemplates.get(GLOBAL_SUBSTITUTION_SERVICE_FILE_NAME); + + assertNotNull(serviceTemplate); + assertTrue(serviceTemplate instanceof GlobalSubstitutionServiceTemplate); + + assertNotNull(serviceTemplate.getMetadata()); + assertFalse(serviceTemplate.getMetadata().isEmpty()); + assertTrue(serviceTemplate.getMetadata().containsKey(TEMPLATE_NAME_PROPERTY)); + + assertNotNull(serviceTemplate.getImports()); + assertFalse(serviceTemplate.getImports().isEmpty()); + assertEquals(1 ,serviceTemplate.getImports().size()); + assertTrue(serviceTemplate.getImports().get(0).containsKey(HEAT_INDEX)); + + assertEquals(DEFININTION_VERSION, serviceTemplate.getTosca_definitions_version()); + + + assertNotNull(serviceTemplate.getNode_types()); + assertEquals(7, serviceTemplate.getNode_types().size()); + Set keys = serviceTemplate.getNode_types().keySet(); + assertTrue(keys.contains("tosca.nodes.nfv.ext.zte.VDU")); + assertTrue(keys.contains("tosca.nodes.nfv.ext.zte.CP")); + assertTrue(keys.contains("tosca.nodes.nfv.ext.zte.VNF.vCSCF")); + assertTrue(keys.contains("tosca.nodes.nfv.ext.ImageFile")); + assertTrue(keys.contains("tosca.nodes.nfv.ext.LocalStorage")); + assertTrue(keys.contains("tosca.nodes.nfv.ext.zte.VNF")); + assertTrue(keys.contains("tosca.nodes.nfv.ext.zte.VL")); + } + + +} diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/csar/vCSCF.csar b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/csar/vCSCF.csar new file mode 100644 index 0000000000..f1b77554e4 Binary files /dev/null and b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/csar/vCSCF.csar differ diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/in/Artifacts/checksum.lst b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/in/Artifacts/checksum.lst new file mode 100644 index 0000000000..701f14d45d --- /dev/null +++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/in/Artifacts/checksum.lst @@ -0,0 +1 @@ +Definitions/openovnf__vPCRF.yaml:75bd8963ecc09bf769d0bb5cb475314d diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/in/Artifacts/csar.meta b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/in/Artifacts/csar.meta new file mode 100644 index 0000000000..aac2fed3c3 --- /dev/null +++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/in/Artifacts/csar.meta @@ -0,0 +1,3 @@ +Type:NFAR +Version:v1.0 +Provider:Huawei \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/in/Definitions/GlobalSubstitutionTypesServiceTemplate.yaml b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/in/Definitions/GlobalSubstitutionTypesServiceTemplate.yaml new file mode 100644 index 0000000000..a88171701e --- /dev/null +++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/in/Definitions/GlobalSubstitutionTypesServiceTemplate.yaml @@ -0,0 +1,60 @@ +node_types: + tosca.nodes.nfv.VDU.Compute: + attributes: + private_address: + type: string + public_address: + type: string + networks: + type: string + ports: + type: string + capabilities: + scalable: + type: tosca.capabilities.Scalable + virtual_compute: + type: tosca.capabilities.nfv.VirtualCompute + endpoint: + type: tosca.capabilities.Endpoint.Admin + os: + type: tosca.capabilities.OperatingSystem + virtual_binding: + type: tosca.capabilities.nfv.VirtualBindable + host: + type: tosca.capabilities.Container + binding: + type: tosca.capabilities.network.Bindable + monitoring_parameter: + type: tosca.capabilities.nfv.Metric + derived_from: tosca.nodes.Root + properties: + configurable_properties: + entry_schema: + type: tosca.datatypes.nfv.VnfcConfigurableProperties + type: map + name: + type: string + nfvi_constraints: + entry_schema: + type: string + required: false + type: list + descrption: + type: string + boot_order: + entry_schema: + type: string + required: false + type: list + requirements: + - local_storage: + capability: tosca.capabilities.Attachment + occurrences: + - 0 + - UNBOUNDED + - virtual_storage: + capability: tosca.capabilities.nfv.VirtualStorage + occurrences: + - 0 + - UNBOUNDED +tosca_definitions_version: tosca_simple_yaml_1_0 diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/in/MainServiceTemplate.mf b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/in/MainServiceTemplate.mf new file mode 100644 index 0000000000..e45f002332 --- /dev/null +++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/in/MainServiceTemplate.mf @@ -0,0 +1,12 @@ +Manifest-Version: 1.0 + +Name: Entry-Definitions +Name: MainServiceTemplate.yaml + +Name: Definitions\GlobalSubstitutionTypesServiceTemplate.yaml + +Name: Artifacts\install.sh + +Name: Artifacts\create_stack.sh + +Name: Licenses\license.xml diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/in/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/in/MainServiceTemplate.yaml new file mode 100644 index 0000000000..041afbacf8 --- /dev/null +++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/in/MainServiceTemplate.yaml @@ -0,0 +1,551 @@ +imports: +- openovnf__tosca.nodes.nfv.VNF.vPCRF.yaml +- openonfv__tosca.capabilities.Scalable.yaml +- openonfv__tosca.capabilities.nfv.Metric.yaml +- openonfv__tosca.nodes.nfv.VnfVirtualLinkDesc.yaml +- openonfv__tosca.capabilities.network.Bindable.yaml +- openonfv__tosca.capabilities.Attachment.yaml +- openonfv__tosca.capabilities.nfv.VirtualBindable.yaml +- openonfv__tosca.capabilities.nfv.VirtualLinkable.yaml +- openonfv__tosca.requirements.nfv.VirtualStorage.yaml +- openonfv__tosca.nodes.nfv.VDU.VirtualStorage.yaml +- openonfv__tosca.relationships.nfv.VirtualBindsTo.yaml +- openonfv__tosca.nodes.nfv.VDU.Compute.yaml +- openonfv__tosca.relationships.nfv.VirtualLinksTo.yaml +- openonfv__tosca.capabilities.nfv.VirtualCompute.yaml +- openonfv__tosca.capabilities.Container.yaml +- openonfv__tosca.capabilities.nfv.VirtualStorage.yaml +- openonfv__tosca.requirements.nfv.VirtualBinding.yaml +- openonfv__tosca.capabilities.Endpoint.Admin.yaml +- openonfv__tosca.capabilities.OperatingSystem.yaml +- openonfv__tosca.nodes.nfv.VduCpd.yaml +- openonfv__tosca.relationships.nfv.VDU.AttachedTo.yaml + +metadata: + vendor: Huawei + csarVersion: v1.0 + csarProvider: Huawei + id: vPCRF_NF_HW + version: v1.0 + csarType: NFAR + name: vPCRF + vnfdVersion: v1.0 + vnfmType: hwvnfm + +node_types: + org.openecomp.resource.vfc.nodes.heat.nat_fw: + derived_from: org.openecomp.resource.vfc.nodes.heat.nova.Server + +topology_template: + node_templates: + PUPDU_Storage: + attributes: + tosca_name: PUPDU_Storage + properties: + id: PUPDU_Storage + size_of_storage: 200G + type_of_storage: volume + type: tosca.nodes.nfv.VDU.VirtualStorage + USRSU: + attributes: + tosca_name: USRSU + capabilities: + virtual_compute: + properties: + virtual_memory: + virtual_mem_size: 24G + requested_additional_capabilities: {} + virtual_cpu: + num_virtual_cpu: 4 + properties: + configurable_properties: + test: {"additional_vnfc_configurable_properties":{"aaa":"1"}} + name: USRSU + descrption: the virtual machine of USRSU + requirements: + - virtual_storage: + capability: virtual_storage + node: USRSU_Storage + - local_storage: + node: tosca.nodes.Root + type: tosca.nodes.nfv.VDU.Compute + USPID3_VduCpd_Fabric: + attributes: + tosca_name: USPID3_VduCpd_Fabric + properties: + role: root + layer_protocol: ipv4 + requirements: + - virtual_binding: + capability: virtual_binding + node: USPID3 + - virtual_link: + capability: virtual_linkable + node: Fabric + type: tosca.nodes.nfv.VduCpd + PUPDU_VduCpd_Base: + attributes: + tosca_name: PUPDU_VduCpd_Base + properties: + role: root + layer_protocol: ipv4 + requirements: + - virtual_binding: + capability: virtual_binding + node: PUPDU + - virtual_link: + capability: virtual_linkable + node: Base + type: tosca.nodes.nfv.VduCpd + OMU_VduCpd_Fabric: + attributes: + tosca_name: OMU_VduCpd_Fabric + properties: + role: root + layer_protocol: ipv4 + requirements: + - virtual_binding: + capability: virtual_binding + node: OMU + - virtual_link: + capability: virtual_linkable + node: Fabric + type: tosca.nodes.nfv.VduCpd + USPID3: + attributes: + tosca_name: USPID3 + capabilities: + virtual_compute: + properties: + virtual_memory: + virtual_mem_size: 24G + requested_additional_capabilities: {} + virtual_cpu: + num_virtual_cpu: 4 + properties: + configurable_properties: + test: {"additional_vnfc_configurable_properties":{"aaa":"1"}} + name: USPID3 + descrption: the virtual machine of USPID3 + requirements: + - virtual_storage: + capability: virtual_storage + node: USPID3_Storage + - local_storage: + node: tosca.nodes.Root + type: tosca.nodes.nfv.VDU.Compute + UPIRU_VduCpd_Base: + attributes: + tosca_name: UPIRU_VduCpd_Base + properties: + role: root + layer_protocol: ipv4 + requirements: + - virtual_binding: + capability: virtual_binding + node: UPIRU + - virtual_link: + capability: virtual_linkable + node: Base + type: tosca.nodes.nfv.VduCpd + OMU2ManageNet: + attributes: + tosca_name: OMU2ManageNet + properties: + role: root + layer_protocol: ipv4 + requirements: + - virtual_binding: + node: tosca.nodes.Root + - virtual_link: + node: tosca.nodes.Root + type: tosca.nodes.nfv.VduCpd + OMU_Storage: + attributes: + tosca_name: OMU_Storage + properties: + id: OMU_Storage + size_of_storage: 256G + rdma_enabled: false + type_of_storage: volume + type: tosca.nodes.nfv.VDU.VirtualStorage + UPSPU: + attributes: + tosca_name: UPSPU + capabilities: + virtual_compute: + properties: + virtual_memory: + virtual_mem_size: 24G + requested_additional_capabilities: {} + virtual_cpu: + num_virtual_cpu: 4 + properties: + configurable_properties: + test: {"additional_vnfc_configurable_properties":{"aaa":"1"}} + name: UPSPU + descrption: the virtual machine of UPSPU + requirements: + - virtual_storage: + capability: virtual_storage + node: UPSPU_Storage + - local_storage: + node: tosca.nodes.Root + type: tosca.nodes.nfv.VDU.Compute + PUPDU_VduCpd_Fabric: + attributes: + tosca_name: PUPDU_VduCpd_Fabric + properties: + role: root + layer_protocol: ipv4 + requirements: + - virtual_binding: + capability: virtual_binding + node: PUPDU + - virtual_link: + capability: virtual_linkable + node: Fabric + type: tosca.nodes.nfv.VduCpd + USPID2BossNet: + attributes: + tosca_name: USPID2BossNet + properties: + role: root + layer_protocol: ethernet + requirements: + - virtual_binding: + capability: virtual_binding + node: USPID3 + - virtual_link: + node: tosca.nodes.Root + type: tosca.nodes.nfv.VduCpd + OMU_VduCpd_Base: + attributes: + tosca_name: OMU_VduCpd_Base + properties: + role: root + layer_protocol: ipv4 + requirements: + - virtual_binding: + capability: virtual_binding + node: OMU + - virtual_link: + capability: virtual_linkable + node: Base + type: tosca.nodes.nfv.VduCpd + USPID3_Storage: + attributes: + tosca_name: USPID3_Storage + properties: + id: USPID3_Storage + size_of_storage: 300G + type_of_storage: volume + type: tosca.nodes.nfv.VDU.VirtualStorage + UPIRU2DataNet2: + attributes: + tosca_name: UPIRU2DataNet2 + properties: + role: root + layer_protocol: ipv4 + requirements: + - virtual_binding: + capability: virtual_binding + node: UPIRU + - virtual_link: + node: tosca.nodes.Root + type: tosca.nodes.nfv.VduCpd + USPID2ManageNet: + attributes: + tosca_name: USPID2ManageNet + properties: + role: root + layer_protocol: ipv4 + requirements: + - virtual_binding: + capability: virtual_binding + node: USPID3 + - virtual_link: + node: tosca.nodes.Root + type: tosca.nodes.nfv.VduCpd + UPIRU2DataNet3: + attributes: + tosca_name: UPIRU2DataNet3 + properties: + role: root + layer_protocol: ipv4 + requirements: + - virtual_binding: + capability: virtual_binding + node: UPIRU + - virtual_link: + node: tosca.nodes.Root + type: tosca.nodes.nfv.VduCpd + PUPDU2DataNet3: + attributes: + tosca_name: PUPDU2DataNet3 + properties: + role: root + layer_protocol: ethernet + requirements: + - virtual_binding: + capability: virtual_binding + node: PUPDU + - virtual_link: + node: tosca.nodes.Root + type: tosca.nodes.nfv.VduCpd + USRSU2DataNet1: + attributes: + tosca_name: USRSU2DataNet1 + properties: + role: root + layer_protocol: ipv4 + requirements: + - virtual_binding: + capability: virtual_binding + node: USRSU + - virtual_link: + node: tosca.nodes.Root + type: tosca.nodes.nfv.VduCpd + USRSU2DataNet2: + attributes: + tosca_name: USRSU2DataNet2 + properties: + role: root + layer_protocol: ipv4 + requirements: + - virtual_binding: + capability: virtual_binding + node: USRSU + - virtual_link: + node: tosca.nodes.Root + type: tosca.nodes.nfv.VduCpd + UPIRU_Storage: + attributes: + tosca_name: UPIRU_Storage + properties: + id: UPIRU_Storage + size_of_storage: 4G + type_of_storage: volume + type: tosca.nodes.nfv.VDU.VirtualStorage + PUPDU2SignalNet1: + attributes: + tosca_name: PUPDU2SignalNet1 + properties: + role: root + layer_protocol: ipv4 + requirements: + - virtual_binding: + capability: virtual_binding + node: PUPDU + - virtual_link: + node: tosca.nodes.Root + type: tosca.nodes.nfv.VduCpd + UPIRU2DataNet1: + attributes: + tosca_name: UPIRU2DataNet1 + properties: + role: root + layer_protocol: ipv4 + requirements: + - virtual_binding: + capability: virtual_binding + node: UPIRU + - virtual_link: + node: tosca.nodes.Root + type: tosca.nodes.nfv.VduCpd + USPID3_VduCpd_Base: + attributes: + tosca_name: USPID3_VduCpd_Base + properties: + role: root + layer_protocol: ipv4 + requirements: + - virtual_binding: + capability: virtual_binding + node: USPID3 + - virtual_link: + capability: virtual_linkable + node: Base + type: tosca.nodes.nfv.VduCpd + Base: + attributes: + tosca_name: Base + properties: + vl_flavours: + flavours: test2 + connectivity_type: + layer_protocol: ipv4 + flow_pattern: + type: tosca.nodes.nfv.VnfVirtualLinkDesc + USRSU_Storage: + attributes: + tosca_name: USRSU_Storage + properties: + id: USRSU_Storage + size_of_storage: 200G + type_of_storage: volume + type: tosca.nodes.nfv.VDU.VirtualStorage + UPSPU_VduCpd_Base: + attributes: + tosca_name: UPSPU_VduCpd_Base + properties: + role: root + layer_protocol: ipv4 + requirements: + - virtual_binding: + capability: virtual_binding + node: UPSPU + - virtual_link: + capability: virtual_linkable + node: Base + type: tosca.nodes.nfv.VduCpd + PUPDU: + attributes: + tosca_name: PUPDU + capabilities: + virtual_compute: + properties: + virtual_memory: + virtual_mem_size: 24G + requested_additional_capabilities: {} + virtual_cpu: + num_virtual_cpu: 4 + properties: + configurable_properties: + test: {"additional_vnfc_configurable_properties":{"aaa":"1"}} + name: PUPDU + descrption: the virtual machine of PUPDU + requirements: + - virtual_storage: + capability: virtual_storage + node: PUPDU_Storage + - local_storage: + node: tosca.nodes.Root + type: tosca.nodes.nfv.VDU.Compute + USRSU_VduCpd_Base: + attributes: + tosca_name: USRSU_VduCpd_Base + properties: + role: root + layer_protocol: ipv4 + requirements: + - virtual_binding: + capability: virtual_binding + node: USRSU + - virtual_link: + capability: virtual_linkable + node: Base + type: tosca.nodes.nfv.VduCpd + OMU: + attributes: + tosca_name: OMU + capabilities: + virtual_compute: + properties: + virtual_memory: + virtual_mem_size: 16G + requested_additional_capabilities: {} + virtual_cpu: + num_virtual_cpu: 4 + properties: + configurable_properties: + test: {"additional_vnfc_configurable_properties":{"aaa":"1"}} + name: OMU + descrption: the virtual machine of OMU + requirements: + - virtual_storage: + capability: virtual_storage + node: OMU_Storage + - local_storage: + node: tosca.nodes.Root + type: tosca.nodes.nfv.VDU.Compute + UPIRU_VduCpd_Fabric: + attributes: + tosca_name: UPIRU_VduCpd_Fabric + properties: + role: root + layer_protocol: ipv4 + requirements: + - virtual_binding: + capability: virtual_binding + node: UPIRU + - virtual_link: + capability: virtual_linkable + node: Fabric + type: tosca.nodes.nfv.VduCpd + UPSPU_Storage: + attributes: + tosca_name: UPSPU_Storage + properties: + id: UPSPU_Storage + size_of_storage: 4G + type_of_storage: volume + type: tosca.nodes.nfv.VDU.VirtualStorage + PUPDU2ManageNet: + attributes: + tosca_name: PUPDU2ManageNet + properties: + role: root + layer_protocol: ethernet + requirements: + - virtual_binding: + capability: virtual_binding + node: PUPDU + - virtual_link: + node: tosca.nodes.Root + type: tosca.nodes.nfv.VduCpd + USRSU_VduCpd_Fabric: + attributes: + tosca_name: USRSU_VduCpd_Fabric + properties: + role: root + layer_protocol: ipv4 + requirements: + - virtual_binding: + capability: virtual_binding + node: USRSU + - virtual_link: + capability: virtual_linkable + node: Fabric + type: tosca.nodes.nfv.VduCpd + UPIRU2SignalNet1: + attributes: + tosca_name: UPIRU2SignalNet1 + properties: + role: root + layer_protocol: ipv4 + requirements: + - virtual_binding: + capability: virtual_binding + node: UPIRU + - virtual_link: + node: tosca.nodes.Root + type: tosca.nodes.nfv.VduCpd + Fabric: + attributes: + tosca_name: Fabric + properties: + vl_flavours: + flavours: test1 + connectivity_type: + layer_protocol: ipv4 + flow_pattern: + type: tosca.nodes.nfv.VnfVirtualLinkDesc + UPSPU_VduCpd_Fabric: + attributes: + tosca_name: UPSPU_VduCpd_Fabric + properties: + role: root + layer_protocol: ipv4 + requirements: + - virtual_binding: + capability: virtual_binding + node: UPSPU + - virtual_link: + capability: virtual_linkable + node: Fabric + type: tosca.nodes.nfv.VduCpd + + substitution_mappings: + node_type: tosca.nodes.nfv.VNF.vPCRF +tosca_definitions_version: tosca_simple_yaml_1_0 \ No newline at end of file diff --git a/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/in/TOSCA-Metadata/TOSCA.meta b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/in/TOSCA-Metadata/TOSCA.meta new file mode 100644 index 0000000000..69f62ca864 --- /dev/null +++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/in/TOSCA-Metadata/TOSCA.meta @@ -0,0 +1,135 @@ +TOSCA-Meta-Version: 1.0 +CSAR-Version: 1.0 +Created-By: Winery 0.1.37-SNAPSHOT +Entry-Definitions: Definitions/openovnf__vPCRF.yaml + +Name: Definitions/openovnf__vPCRF.yaml +Content-Type: application/vnd.oasis.tosca.definitions + +Name: Definitions/openovnf__tosca.nodes.nfv.VNF.vPCRF.yaml +Content-Type: application/vnd.oasis.tosca.definitions + +Name: Definitions/openonfv__tosca.capabilities.Scalable.yaml +Content-Type: application/vnd.oasis.tosca.definitions + +Name: Definitions/openonfv__tosca.capabilities.nfv.Metric.yaml +Content-Type: application/vnd.oasis.tosca.definitions + +Name: Definitions/openonfv__tosca.nodes.nfv.VnfVirtualLinkDesc.yaml +Content-Type: application/vnd.oasis.tosca.definitions + +Name: Definitions/openonfv__tosca.capabilities.network.Bindable.yaml +Content-Type: application/vnd.oasis.tosca.definitions + +Name: Definitions/openonfv__tosca.capabilities.Attachment.yaml +Content-Type: application/vnd.oasis.tosca.definitions + +Name: Definitions/openonfv__tosca.capabilities.nfv.VirtualBindable.yaml +Content-Type: application/vnd.oasis.tosca.definitions + +Name: Definitions/openonfv__tosca.capabilities.nfv.VirtualLinkable.yaml +Content-Type: application/vnd.oasis.tosca.definitions + +Name: Definitions/openonfv__tosca.requirements.nfv.VirtualStorage.yaml +Content-Type: application/vnd.oasis.tosca.definitions + +Name: Definitions/openonfv__tosca.nodes.nfv.VDU.VirtualStorage.yaml +Content-Type: application/vnd.oasis.tosca.definitions + +Name: Definitions/openonfv__tosca.relationships.nfv.VirtualBindsTo.yaml +Content-Type: application/vnd.oasis.tosca.definitions + +Name: Definitions/openonfv__tosca.nodes.nfv.VDU.Compute.yaml +Content-Type: application/vnd.oasis.tosca.definitions + +Name: Definitions/openonfv__tosca.relationships.nfv.VirtualLinksTo.yaml +Content-Type: application/vnd.oasis.tosca.definitions + +Name: Definitions/openonfv__tosca.capabilities.nfv.VirtualCompute.yaml +Content-Type: application/vnd.oasis.tosca.definitions + +Name: Definitions/openonfv__tosca.capabilities.Container.yaml +Content-Type: application/vnd.oasis.tosca.definitions + +Name: Definitions/openonfv__tosca.capabilities.nfv.VirtualStorage.yaml +Content-Type: application/vnd.oasis.tosca.definitions + +Name: Definitions/openonfv__tosca.requirements.nfv.VirtualBinding.yaml +Content-Type: application/vnd.oasis.tosca.definitions + +Name: Definitions/openonfv__tosca.capabilities.Endpoint.Admin.yaml +Content-Type: application/vnd.oasis.tosca.definitions + +Name: Definitions/openonfv__tosca.capabilities.OperatingSystem.yaml +Content-Type: application/vnd.oasis.tosca.definitions + +Name: Definitions/openonfv__tosca.nodes.nfv.VduCpd.yaml +Content-Type: application/vnd.oasis.tosca.definitions + +Name: Definitions/openonfv__tosca.relationships.nfv.VDU.AttachedTo.yaml +Content-Type: application/vnd.oasis.tosca.definitions + +Name: Definitions/openonfv__tosca.requirements.nfv.VirtualLink.yaml +Content-Type: application/vnd.oasis.tosca.definitions + +Name: Definitions/openovnf__tosca.nodes.nfv.VNF.yaml +Content-Type: application/vnd.oasis.tosca.definitions + +Name: nodetypes/http%3A%2F%2Fwww.open-o.org%2Ftosca%2Fnfv/tosca.nodes.nfv.VDU.VirtualStorage/propertiesdefinition/Properties.xsd +Content-Type: text/xml + +Name: nodetypes/http%3A%2F%2Fwww.open-o.org%2Ftosca%2Fnfv/tosca.nodes.nfv.VnfVirtualLinkDesc/appearance/bigIcon.png +Content-Type: image/png + +Name: nodetypes/http%3A%2F%2Fwww.open-o.org%2Ftosca%2Fnfv/tosca.nodes.nfv.VnfVirtualLinkDesc/appearance/smallIcon.png +Content-Type: image/png + +Name: nodetypes/http%3A%2F%2Fwww.open-o.org%2Ftosca%2Fnfv/tosca.nodes.nfv.VDU.Compute/propertiesdefinition/Properties.xsd +Content-Type: text/xml + +Name: nodetypes/http%3A%2F%2Fwww.open-o.org%2Ftosca%2Fnfv/tosca.nodes.nfv.VduCpd/propertiesdefinition/Properties.xsd +Content-Type: text/xml + +Name: capabilitytypes/http%3A%2F%2Fwww.open-o.org%2Ftosca%2Fnfv/tosca.capabilities.nfv.VirtualCompute/propertiesdefinition/Properties.xsd +Content-Type: text/xml + +Name: nodetypes/http%3A%2F%2Fwww.open-o.org%2Ftosca%2Fnfv%2Fvnf/tosca.nodes.nfv.VNF/propertiesdefinition/Properties.xsd +Content-Type: text/xml + +Name: nodetypes/http%3A%2F%2Fwww.open-o.org%2Ftosca%2Fnfv/tosca.nodes.nfv.VDU.VirtualStorage/appearance/bigIcon.png +Content-Type: image/png + +Name: nodetypes/http%3A%2F%2Fwww.open-o.org%2Ftosca%2Fnfv/tosca.nodes.nfv.VDU.VirtualStorage/appearance/smallIcon.png +Content-Type: image/png + +Name: capabilitytypes/http%3A%2F%2Fwww.open-o.org%2Ftosca%2Fnfv/tosca.capabilities.Container/propertiesdefinition/Properties.xsd +Content-Type: text/xml + +Name: nodetypes/http%3A%2F%2Fwww.open-o.org%2Ftosca%2Fnfv/tosca.nodes.nfv.VDU.Compute/appearance/bigIcon.png +Content-Type: image/png + +Name: nodetypes/http%3A%2F%2Fwww.open-o.org%2Ftosca%2Fnfv/tosca.nodes.nfv.VDU.Compute/appearance/smallIcon.png +Content-Type: image/png + +Name: nodetypes/http%3A%2F%2Fwww.open-o.org%2Ftosca%2Fnfv%2Fvnf/tosca.nodes.nfv.VNF.vPCRF/propertiesdefinition/Properties.xsd +Content-Type: text/xml + +Name: capabilitytypes/http%3A%2F%2Fwww.open-o.org%2Ftosca%2Fnfv/tosca.capabilities.OperatingSystem/propertiesdefinition/Properties.xsd +Content-Type: text/xml + +Name: nodetypes/http%3A%2F%2Fwww.open-o.org%2Ftosca%2Fnfv/tosca.nodes.nfv.VnfVirtualLinkDesc/propertiesdefinition/Properties.xsd +Content-Type: text/xml + +Name: nodetypes/http%3A%2F%2Fwww.open-o.org%2Ftosca%2Fnfv/tosca.nodes.nfv.VduCpd/appearance/bigIcon.png +Content-Type: image/png + +Name: nodetypes/http%3A%2F%2Fwww.open-o.org%2Ftosca%2Fnfv/tosca.nodes.nfv.VduCpd/appearance/smallIcon.png +Content-Type: image/png + +Name: capabilitytypes/http%3A%2F%2Fwww.open-o.org%2Ftosca%2Fnfv/tosca.capabilities.Scalable/propertiesdefinition/Properties.xsd +Content-Type: text/xml + +Name: relationshiptypes/http%3A%2F%2Fwww.open-o.org%2Ftosca%2Fnfv/tosca.relationships.nfv.VDU.AttachedTo/propertiesdefinition/Properties.xsd +Content-Type: text/xml + + 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 new file mode 100644 index 0000000000..77bfcac710 --- /dev/null +++ b/openecomp-be/lib/openecomp-tosca-converter-lib/openecomp-tosca-converter-core/src/test/resources/mock/toscaConverter/convertMainSt/out/MainServiceTemplate.yaml @@ -0,0 +1,546 @@ +tosca_definitions_version: tosca_simple_yaml_1_0 +metadata: + vnfdVersion: v1.0 + template_name: Main + vendor: Huawei + csarVersion: v1.0 + vnfmType: hwvnfm + csarProvider: Huawei + name: vPCRF + id: vPCRF_NF_HW + version: v1.0 + csarType: NFAR +imports: +- openecomp_heat_index: + file: openecomp-heat/_index.yml +- GlobalSubstitutionTypes: + file: GlobalSubstitutionTypesServiceTemplate.yaml +node_types: + org.openecomp.resource.vfc.nodes.heat.nat_fw: + derived_from: org.openecomp.resource.vfc.nodes.heat.nova.Server +topology_template: + node_templates: + PUPDU_Storage: + type: tosca.nodes.nfv.VDU.VirtualStorage + properties: + id: PUPDU_Storage + size_of_storage: 200G + type_of_storage: volume + attributes: + tosca_name: PUPDU_Storage + USRSU: + type: tosca.nodes.nfv.VDU.Compute + properties: + configurable_properties: + test: + additional_vnfc_configurable_properties: + aaa: '1' + name: USRSU + descrption: the virtual machine of USRSU + attributes: + tosca_name: USRSU + requirements: + - virtual_storage: + capability: virtual_storage + node: USRSU_Storage + - local_storage: + node: tosca.nodes.Root + capabilities: + - virtual_compute: + properties: + virtual_memory: + virtual_mem_size: 24G + requested_additional_capabilities: { + } + virtual_cpu: + num_virtual_cpu: 4.0 + USPID3_VduCpd_Fabric: + type: tosca.nodes.nfv.VduCpd + properties: + role: root + layer_protocol: ipv4 + attributes: + tosca_name: USPID3_VduCpd_Fabric + requirements: + - virtual_binding: + capability: virtual_binding + node: USPID3 + - virtual_link: + capability: virtual_linkable + node: Fabric + PUPDU_VduCpd_Base: + type: tosca.nodes.nfv.VduCpd + properties: + role: root + layer_protocol: ipv4 + attributes: + tosca_name: PUPDU_VduCpd_Base + requirements: + - virtual_binding: + capability: virtual_binding + node: PUPDU + - virtual_link: + capability: virtual_linkable + node: Base + OMU_VduCpd_Fabric: + type: tosca.nodes.nfv.VduCpd + properties: + role: root + layer_protocol: ipv4 + attributes: + tosca_name: OMU_VduCpd_Fabric + requirements: + - virtual_binding: + capability: virtual_binding + node: OMU + - virtual_link: + capability: virtual_linkable + node: Fabric + USPID3: + type: tosca.nodes.nfv.VDU.Compute + properties: + configurable_properties: + test: + additional_vnfc_configurable_properties: + aaa: '1' + name: USPID3 + descrption: the virtual machine of USPID3 + attributes: + tosca_name: USPID3 + requirements: + - virtual_storage: + capability: virtual_storage + node: USPID3_Storage + - local_storage: + node: tosca.nodes.Root + capabilities: + - virtual_compute: + properties: + virtual_memory: + virtual_mem_size: 24G + requested_additional_capabilities: { + } + virtual_cpu: + num_virtual_cpu: 4.0 + UPIRU_VduCpd_Base: + type: tosca.nodes.nfv.VduCpd + properties: + role: root + layer_protocol: ipv4 + attributes: + tosca_name: UPIRU_VduCpd_Base + requirements: + - virtual_binding: + capability: virtual_binding + node: UPIRU + - virtual_link: + capability: virtual_linkable + node: Base + OMU2ManageNet: + type: tosca.nodes.nfv.VduCpd + properties: + role: root + layer_protocol: ipv4 + attributes: + tosca_name: OMU2ManageNet + requirements: + - virtual_binding: + node: tosca.nodes.Root + - virtual_link: + node: tosca.nodes.Root + OMU_Storage: + type: tosca.nodes.nfv.VDU.VirtualStorage + properties: + id: OMU_Storage + size_of_storage: 256G + rdma_enabled: false + type_of_storage: volume + attributes: + tosca_name: OMU_Storage + UPSPU: + type: tosca.nodes.nfv.VDU.Compute + properties: + configurable_properties: + test: + additional_vnfc_configurable_properties: + aaa: '1' + name: UPSPU + descrption: the virtual machine of UPSPU + attributes: + tosca_name: UPSPU + requirements: + - virtual_storage: + capability: virtual_storage + node: UPSPU_Storage + - local_storage: + node: tosca.nodes.Root + capabilities: + - virtual_compute: + properties: + virtual_memory: + virtual_mem_size: 24G + requested_additional_capabilities: { + } + virtual_cpu: + num_virtual_cpu: 4.0 + PUPDU_VduCpd_Fabric: + type: tosca.nodes.nfv.VduCpd + properties: + role: root + layer_protocol: ipv4 + attributes: + tosca_name: PUPDU_VduCpd_Fabric + requirements: + - virtual_binding: + capability: virtual_binding + node: PUPDU + - virtual_link: + capability: virtual_linkable + node: Fabric + USPID2BossNet: + type: tosca.nodes.nfv.VduCpd + properties: + role: root + layer_protocol: ethernet + attributes: + tosca_name: USPID2BossNet + requirements: + - virtual_binding: + capability: virtual_binding + node: USPID3 + - virtual_link: + node: tosca.nodes.Root + OMU_VduCpd_Base: + type: tosca.nodes.nfv.VduCpd + properties: + role: root + layer_protocol: ipv4 + attributes: + tosca_name: OMU_VduCpd_Base + requirements: + - virtual_binding: + capability: virtual_binding + node: OMU + - virtual_link: + capability: virtual_linkable + node: Base + USPID3_Storage: + type: tosca.nodes.nfv.VDU.VirtualStorage + properties: + id: USPID3_Storage + size_of_storage: 300G + type_of_storage: volume + attributes: + tosca_name: USPID3_Storage + UPIRU2DataNet2: + type: tosca.nodes.nfv.VduCpd + properties: + role: root + layer_protocol: ipv4 + attributes: + tosca_name: UPIRU2DataNet2 + requirements: + - virtual_binding: + capability: virtual_binding + node: UPIRU + - virtual_link: + node: tosca.nodes.Root + USPID2ManageNet: + type: tosca.nodes.nfv.VduCpd + properties: + role: root + layer_protocol: ipv4 + attributes: + tosca_name: USPID2ManageNet + requirements: + - virtual_binding: + capability: virtual_binding + node: USPID3 + - virtual_link: + node: tosca.nodes.Root + UPIRU2DataNet3: + type: tosca.nodes.nfv.VduCpd + properties: + role: root + layer_protocol: ipv4 + attributes: + tosca_name: UPIRU2DataNet3 + requirements: + - virtual_binding: + capability: virtual_binding + node: UPIRU + - virtual_link: + node: tosca.nodes.Root + PUPDU2DataNet3: + type: tosca.nodes.nfv.VduCpd + properties: + role: root + layer_protocol: ethernet + attributes: + tosca_name: PUPDU2DataNet3 + requirements: + - virtual_binding: + capability: virtual_binding + node: PUPDU + - virtual_link: + node: tosca.nodes.Root + USRSU2DataNet1: + type: tosca.nodes.nfv.VduCpd + properties: + role: root + layer_protocol: ipv4 + attributes: + tosca_name: USRSU2DataNet1 + requirements: + - virtual_binding: + capability: virtual_binding + node: USRSU + - virtual_link: + node: tosca.nodes.Root + USRSU2DataNet2: + type: tosca.nodes.nfv.VduCpd + properties: + role: root + layer_protocol: ipv4 + attributes: + tosca_name: USRSU2DataNet2 + requirements: + - virtual_binding: + capability: virtual_binding + node: USRSU + - virtual_link: + node: tosca.nodes.Root + UPIRU_Storage: + type: tosca.nodes.nfv.VDU.VirtualStorage + properties: + id: UPIRU_Storage + size_of_storage: 4G + type_of_storage: volume + attributes: + tosca_name: UPIRU_Storage + PUPDU2SignalNet1: + type: tosca.nodes.nfv.VduCpd + properties: + role: root + layer_protocol: ipv4 + attributes: + tosca_name: PUPDU2SignalNet1 + requirements: + - virtual_binding: + capability: virtual_binding + node: PUPDU + - virtual_link: + node: tosca.nodes.Root + UPIRU2DataNet1: + type: tosca.nodes.nfv.VduCpd + properties: + role: root + layer_protocol: ipv4 + attributes: + tosca_name: UPIRU2DataNet1 + requirements: + - virtual_binding: + capability: virtual_binding + node: UPIRU + - virtual_link: + node: tosca.nodes.Root + USPID3_VduCpd_Base: + type: tosca.nodes.nfv.VduCpd + properties: + role: root + layer_protocol: ipv4 + attributes: + tosca_name: USPID3_VduCpd_Base + requirements: + - virtual_binding: + capability: virtual_binding + node: USPID3 + - virtual_link: + capability: virtual_linkable + node: Base + Base: + type: tosca.nodes.nfv.VnfVirtualLinkDesc + properties: + vl_flavours: + flavours: test2 + connectivity_type: + layer_protocol: ipv4 + flow_pattern: null + attributes: + tosca_name: Base + USRSU_Storage: + type: tosca.nodes.nfv.VDU.VirtualStorage + properties: + id: USRSU_Storage + size_of_storage: 200G + type_of_storage: volume + attributes: + tosca_name: USRSU_Storage + UPSPU_VduCpd_Base: + type: tosca.nodes.nfv.VduCpd + properties: + role: root + layer_protocol: ipv4 + attributes: + tosca_name: UPSPU_VduCpd_Base + requirements: + - virtual_binding: + capability: virtual_binding + node: UPSPU + - virtual_link: + capability: virtual_linkable + node: Base + PUPDU: + type: tosca.nodes.nfv.VDU.Compute + properties: + configurable_properties: + test: + additional_vnfc_configurable_properties: + aaa: '1' + name: PUPDU + descrption: the virtual machine of PUPDU + attributes: + tosca_name: PUPDU + requirements: + - virtual_storage: + capability: virtual_storage + node: PUPDU_Storage + - local_storage: + node: tosca.nodes.Root + capabilities: + - virtual_compute: + properties: + virtual_memory: + virtual_mem_size: 24G + requested_additional_capabilities: { + } + virtual_cpu: + num_virtual_cpu: 4.0 + USRSU_VduCpd_Base: + type: tosca.nodes.nfv.VduCpd + properties: + role: root + layer_protocol: ipv4 + attributes: + tosca_name: USRSU_VduCpd_Base + requirements: + - virtual_binding: + capability: virtual_binding + node: USRSU + - virtual_link: + capability: virtual_linkable + node: Base + OMU: + type: tosca.nodes.nfv.VDU.Compute + properties: + configurable_properties: + test: + additional_vnfc_configurable_properties: + aaa: '1' + name: OMU + descrption: the virtual machine of OMU + attributes: + tosca_name: OMU + requirements: + - virtual_storage: + capability: virtual_storage + node: OMU_Storage + - local_storage: + node: tosca.nodes.Root + capabilities: + - virtual_compute: + properties: + virtual_memory: + virtual_mem_size: 16G + requested_additional_capabilities: { + } + virtual_cpu: + num_virtual_cpu: 4.0 + UPIRU_VduCpd_Fabric: + type: tosca.nodes.nfv.VduCpd + properties: + role: root + layer_protocol: ipv4 + attributes: + tosca_name: UPIRU_VduCpd_Fabric + requirements: + - virtual_binding: + capability: virtual_binding + node: UPIRU + - virtual_link: + capability: virtual_linkable + node: Fabric + UPSPU_Storage: + type: tosca.nodes.nfv.VDU.VirtualStorage + properties: + id: UPSPU_Storage + size_of_storage: 4G + type_of_storage: volume + attributes: + tosca_name: UPSPU_Storage + PUPDU2ManageNet: + type: tosca.nodes.nfv.VduCpd + properties: + role: root + layer_protocol: ethernet + attributes: + tosca_name: PUPDU2ManageNet + requirements: + - virtual_binding: + capability: virtual_binding + node: PUPDU + - virtual_link: + node: tosca.nodes.Root + USRSU_VduCpd_Fabric: + type: tosca.nodes.nfv.VduCpd + properties: + role: root + layer_protocol: ipv4 + attributes: + tosca_name: USRSU_VduCpd_Fabric + requirements: + - virtual_binding: + capability: virtual_binding + node: USRSU + - virtual_link: + capability: virtual_linkable + node: Fabric + UPIRU2SignalNet1: + type: tosca.nodes.nfv.VduCpd + properties: + role: root + layer_protocol: ipv4 + attributes: + tosca_name: UPIRU2SignalNet1 + requirements: + - virtual_binding: + capability: virtual_binding + node: UPIRU + - virtual_link: + node: tosca.nodes.Root + Fabric: + type: tosca.nodes.nfv.VnfVirtualLinkDesc + properties: + vl_flavours: + flavours: test1 + connectivity_type: + layer_protocol: ipv4 + flow_pattern: null + attributes: + tosca_name: Fabric + UPSPU_VduCpd_Fabric: + type: tosca.nodes.nfv.VduCpd + properties: + role: root + layer_protocol: ipv4 + attributes: + tosca_name: UPSPU_VduCpd_Fabric + requirements: + - virtual_binding: + capability: virtual_binding + node: UPSPU + - virtual_link: + capability: virtual_linkable + node: Fabric + substitution_mappings: + node_type: tosca.nodes.nfv.VNF.vPCRF -- cgit 1.2.3-korg