diff options
Diffstat (limited to 'openecomp-be/lib')
23 files changed, 566 insertions, 630 deletions
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 6598d1a6ac..c95274d7fe 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 @@ -20,11 +20,11 @@ import static org.openecomp.sdc.tosca.services.DataModelUtil.getClonedObject; import static org.openecomp.sdc.tosca.services.ToscaConstants.PORT_MIRRORING_CAPABILITY_CP_PROPERTY_NAME; import static org.openecomp.sdc.tosca.services.ToscaConstants.PORT_MIRRORING_CAPABILITY_ID; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; + import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; import java.util.HashMap; -import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Map; @@ -51,273 +51,267 @@ import org.openecomp.sdc.translator.services.heattotosca.HeatToToscaUtil; import org.openecomp.sdc.translator.services.heattotosca.globaltypes.GlobalTypesGenerator; public class PortMirroringEnricher { - //Map of service template file name and map of all port node template ids, node template - private final Map<String, Map<String, NodeTemplate>> portNodeTemplates = new HashMap<>(); - //Map of service template file name and map of external port node template ids, node template - private final Map<String, Map<String, NodeTemplate>> externalPortNodeTemplates = new HashMap<>(); - //Map of substitution service template name and the list of ports with link requirement from the abstract - private final Map<String, List<String>> portNodeTemplateIdsFromAbstract = new HashMap<>(); - private final Map<String, ServiceTemplate> globalTypesServiceTemplate = - GlobalTypesGenerator.getGlobalTypesServiceTemplate(OnboardingTypesEnum.ZIP); - - private static final String ABSTRACT_LINK_REQUIREMENT_ID_PREFIX = ToscaConstants.LINK_REQUIREMENT_ID + "_"; - private static final int ABSTRACT_LINK_REQUIREMENT_ID_PREFIX_LENGTH = ABSTRACT_LINK_REQUIREMENT_ID_PREFIX.length(); - - private static final Map<String, String> nodeTypeExternalNodeType = - Collections.unmodifiableMap(initializeNodeTypeExternalNodeType()); + private static final String ABSTRACT_LINK_REQUIREMENT_ID_PREFIX = ToscaConstants.LINK_REQUIREMENT_ID + "_"; + private static final int ABSTRACT_LINK_REQUIREMENT_ID_PREFIX_LENGTH = ABSTRACT_LINK_REQUIREMENT_ID_PREFIX.length(); + private static final Map<String, String> nodeTypeExternalNodeType = initializeNodeTypeExternalNodeType(); + //Map of service template file name and map of all port node template ids, node template + private final Map<String, Map<String, NodeTemplate>> portNodeTemplates = new HashMap<>(); + //Map of service template file name and map of external port node template ids, node template + private final Map<String, Map<String, NodeTemplate>> externalPortNodeTemplates = new HashMap<>(); + //Map of substitution service template name and the list of ports with link requirement from the abstract + private final Map<String, List<String>> portNodeTemplateIdsFromAbstract = new HashMap<>(); + private final Map<String, ServiceTemplate> globalTypesServiceTemplate = + GlobalTypesGenerator.getGlobalTypesServiceTemplate(OnboardingTypesEnum.ZIP); - /** - * Enrich tosca for port mirroring. - * - * @param toscaServiceModel the tosca service model - * @return the map Error descriptor map - */ - public Map<String, List<ErrorMessage>> enrich(ToscaServiceModel toscaServiceModel) { - Map<String, List<ErrorMessage>> errors = new HashMap<>(); - Map<String, ServiceTemplate> serviceTemplates = toscaServiceModel.getServiceTemplates(); - serviceTemplates.entrySet().stream() - //Skipping the service templates which do not contain topology template - .filter(serviceTemplateEntry -> serviceTemplateEntry.getValue() - .getTopology_template() != null) - .forEach(serviceTemplateEntry -> - //Collect all the ports across all the service templates - collectPorts(serviceTemplateEntry.getValue())); - //Collect External ports from the list of all ports collected above - filterExternalPorts(); - //Handle external port changes - handleExternalPorts(toscaServiceModel); - return errors; - } + private static ImmutableMap<String,String> initializeNodeTypeExternalNodeType() { + return ImmutableMap.<String, String>builder() + .put(ToscaNodeType.CONTRAIL_PORT, ToscaNodeType.EXTERNAL_CONTRAIL_PORT) + .put(ToscaNodeType.CONTRAILV2_VIRTUAL_MACHINE_INTERFACE, ToscaNodeType.EXTERNAL_VMI_PORT) + .put(ToscaNodeType.NEUTRON_PORT, ToscaNodeType.EXTERNAL_NEUTRON_PORT) + .build(); + } - private void collectPorts(ServiceTemplate serviceTemplate) { - Map<String, NodeTemplate> nodeTemplates = DataModelUtil.getNodeTemplates(serviceTemplate); - if (Objects.isNull(nodeTemplates)) { - return; + /** + * Enrich tosca for port mirroring. + * + * @param toscaServiceModel the tosca service model + * @return the map Error descriptor map + */ + public Map<String, List<ErrorMessage>> enrich(ToscaServiceModel toscaServiceModel) { + Map<String, List<ErrorMessage>> errors = new HashMap<>(); + Map<String, ServiceTemplate> serviceTemplates = toscaServiceModel.getServiceTemplates(); + serviceTemplates.entrySet().stream() + //Skipping the service templates which do not contain topology template + .filter(serviceTemplateEntry -> serviceTemplateEntry.getValue().getTopology_template() != null) + .forEach(serviceTemplateEntry -> + //Collect all the ports across all the service templates + collectPorts(serviceTemplateEntry.getValue())); + //Collect External ports from the list of all ports collected above + filterExternalPorts(); + //Handle external port changes + handleExternalPorts(toscaServiceModel); + return errors; } - //Get all concrete port node templates from the service template - Map<String, NodeTemplate> serviceTemplatePortNodeTemplates = nodeTemplates.entrySet().stream() - .filter(nodeTemplateEntry -> (Objects.nonNull(nodeTemplateEntry.getValue())) - && (isPortNodeTemplate(nodeTemplateEntry.getValue().getType()))) - .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); - portNodeTemplates.put(ToscaUtil.getServiceTemplateFileName(serviceTemplate), - serviceTemplatePortNodeTemplates); - //Get all linked internal ports from abstract node template link requirements - collectLinkedInternalPorts(nodeTemplates); - } + private void collectPorts(ServiceTemplate serviceTemplate) { + Map<String, NodeTemplate> nodeTemplates = DataModelUtil.getNodeTemplates(serviceTemplate); + if (Objects.isNull(nodeTemplates)) { + return; + } + //Get all concrete port node templates from the service template + Map<String, NodeTemplate> serviceTemplatePortNodeTemplates = nodeTemplates.entrySet().stream() + .filter(nodeTemplateEntry -> (Objects.nonNull(nodeTemplateEntry.getValue())) + && (isPortNodeTemplate(nodeTemplateEntry.getValue().getType()))) + .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); - private void collectLinkedInternalPorts(Map<String, NodeTemplate> nodeTemplates) { - List<String> abstractLinkedPortNodeTemplates = new ArrayList<>(); - for (Map.Entry<String, NodeTemplate> nodeTemplateEntry : nodeTemplates.entrySet()) { - NodeTemplate nodeTemplate = nodeTemplateEntry.getValue(); - if (isSubstitutableNodeTemplate(nodeTemplate)) { - handleSubstitutableNodeTemplate(abstractLinkedPortNodeTemplates, nodeTemplate); - } + portNodeTemplates.put(ToscaUtil.getServiceTemplateFileName(serviceTemplate), + serviceTemplatePortNodeTemplates); + //Get all linked internal ports from abstract node template link requirements + collectLinkedInternalPorts(nodeTemplates); } - } - private void handleSubstitutableNodeTemplate(List<String> abstractLinkedPortNodeTemplates, - NodeTemplate nodeTemplate) { - List<Map<String, RequirementAssignment>> requirements = nodeTemplate.getRequirements(); - if (Objects.isNull(requirements)) { - return; - } - requirements.forEach(requirement -> addInternalPortToAbstractNode(requirement, abstractLinkedPortNodeTemplates)); - if (CollectionUtils.isNotEmpty(abstractLinkedPortNodeTemplates)) { - //Populate a map of the substitution service templates and list of internal ports - addCollectedPortsToAbstractServiceTemplatePortMap(nodeTemplate, - abstractLinkedPortNodeTemplates); + private void collectLinkedInternalPorts(Map<String, NodeTemplate> nodeTemplates) { + List<String> abstractLinkedPortNodeTemplates = new ArrayList<>(); + for (Map.Entry<String, NodeTemplate> nodeTemplateEntry : nodeTemplates.entrySet()) { + NodeTemplate nodeTemplate = nodeTemplateEntry.getValue(); + if (isSubstitutableNodeTemplate(nodeTemplate)) { + handleSubstitutableNodeTemplate(abstractLinkedPortNodeTemplates, nodeTemplate); + } + } } - } - private void addInternalPortToAbstractNode(Map<String, RequirementAssignment> requirement, - List<String> abstractLinkedPortNodeTemplates) { - String requirementId = requirement.keySet().iterator().next(); - if (requirementId.startsWith(ABSTRACT_LINK_REQUIREMENT_ID_PREFIX)) { - //Collect port node template ids from the link requirement ids in the abstract node template - abstractLinkedPortNodeTemplates.add(requirementId.substring(ABSTRACT_LINK_REQUIREMENT_ID_PREFIX_LENGTH)); + private void handleSubstitutableNodeTemplate(List<String> abstractLinkedPortNodeTemplates, + NodeTemplate nodeTemplate) { + List<Map<String, RequirementAssignment>> requirements = nodeTemplate.getRequirements(); + if (Objects.isNull(requirements)) { + return; + } + requirements + .forEach(requirement -> addInternalPortToAbstractNode(requirement, abstractLinkedPortNodeTemplates)); + if (CollectionUtils.isNotEmpty(abstractLinkedPortNodeTemplates)) { + //Populate a map of the substitution service templates and list of internal ports + addCollectedPortsToAbstractServiceTemplatePortMap(nodeTemplate, abstractLinkedPortNodeTemplates); + } } - } - private void addCollectedPortsToAbstractServiceTemplatePortMap(NodeTemplate nodeTemplate, - List<String> abstractLinkedPortNodeTemplates) { - String substitutionServiceTemplateName; - if (Objects.isNull(nodeTemplate.getProperties())) { - return; - } - Map serviceTemplateFilter = (Map<String, Object>) nodeTemplate.getProperties() - .get(ToscaConstants.SERVICE_TEMPLATE_FILTER_PROPERTY_NAME); - substitutionServiceTemplateName = (String) - serviceTemplateFilter.get(ToscaConstants.SUBSTITUTE_SERVICE_TEMPLATE_PROPERTY_NAME); - if (Objects.isNull(substitutionServiceTemplateName)) { - return; - } - if (portNodeTemplateIdsFromAbstract.containsKey(substitutionServiceTemplateName)) { - List<String> portList = portNodeTemplateIdsFromAbstract.get(substitutionServiceTemplateName); - portList.addAll(abstractLinkedPortNodeTemplates); - portNodeTemplateIdsFromAbstract.put(substitutionServiceTemplateName, portList); - } else { - portNodeTemplateIdsFromAbstract.put(substitutionServiceTemplateName, abstractLinkedPortNodeTemplates); + private void addInternalPortToAbstractNode(Map<String, RequirementAssignment> requirement, + List<String> abstractLinkedPortNodeTemplates) { + String requirementId = requirement.keySet().iterator().next(); + if (requirementId.startsWith(ABSTRACT_LINK_REQUIREMENT_ID_PREFIX)) { + //Collect port node template ids from the link requirement ids in the abstract node template + abstractLinkedPortNodeTemplates.add(requirementId.substring(ABSTRACT_LINK_REQUIREMENT_ID_PREFIX_LENGTH)); + } } - } - private void filterExternalPorts() { - for (Map.Entry<String, Map<String, NodeTemplate>> portNodeTemplateEntry : portNodeTemplates.entrySet()) { - Map<String, NodeTemplate> externalPorts = new HashMap<>(); - String serviceTemplateFileName = portNodeTemplateEntry.getKey(); - Map<String, NodeTemplate> portNodeTemplateMap = portNodeTemplateEntry.getValue(); - for (Map.Entry<String, NodeTemplate> portNodeTemplate : portNodeTemplateMap.entrySet()) { - String nodeTemplateId = portNodeTemplate.getKey(); - NodeTemplate nodeTemplate = portNodeTemplate.getValue(); - if (!isInternalPort(serviceTemplateFileName, nodeTemplateId, nodeTemplate)) { - //External Port - externalPorts.putIfAbsent(nodeTemplateId, nodeTemplate); + private void addCollectedPortsToAbstractServiceTemplatePortMap(NodeTemplate nodeTemplate, + List<String> abstractLinkedPortNodeTemplates) { + String substitutionServiceTemplateName; + if (Objects.isNull(nodeTemplate.getProperties())) { + return; + } + Map serviceTemplateFilter = (Map<String, Object>) nodeTemplate.getProperties() + .get(ToscaConstants.SERVICE_TEMPLATE_FILTER_PROPERTY_NAME); + substitutionServiceTemplateName = (String) + serviceTemplateFilter.get(ToscaConstants.SUBSTITUTE_SERVICE_TEMPLATE_PROPERTY_NAME); + if (Objects.isNull(substitutionServiceTemplateName)) { + return; + } + if (portNodeTemplateIdsFromAbstract.containsKey(substitutionServiceTemplateName)) { + List<String> portList = portNodeTemplateIdsFromAbstract.get(substitutionServiceTemplateName); + portList.addAll(abstractLinkedPortNodeTemplates); + portNodeTemplateIdsFromAbstract.put(substitutionServiceTemplateName, portList); + } else { + portNodeTemplateIdsFromAbstract.put(substitutionServiceTemplateName, abstractLinkedPortNodeTemplates); } - } - externalPortNodeTemplates.putIfAbsent(serviceTemplateFileName, externalPorts); } - } - private void updateExternalPortNodeTemplate(NodeTemplate externalPortNodeTemplate) { - String currentPortNodeType = externalPortNodeTemplate.getType(); - if (nodeTypeExternalNodeType.containsKey(currentPortNodeType)) { - externalPortNodeTemplate.setType(nodeTypeExternalNodeType.get(currentPortNodeType)); + private void filterExternalPorts() { + for (Map.Entry<String, Map<String, NodeTemplate>> portNodeTemplateEntry : portNodeTemplates.entrySet()) { + Map<String, NodeTemplate> externalPorts = new HashMap<>(); + String serviceTemplateFileName = portNodeTemplateEntry.getKey(); + Map<String, NodeTemplate> portNodeTemplateMap = portNodeTemplateEntry.getValue(); + for (Map.Entry<String, NodeTemplate> portNodeTemplate : portNodeTemplateMap.entrySet()) { + String nodeTemplateId = portNodeTemplate.getKey(); + NodeTemplate nodeTemplate = portNodeTemplate.getValue(); + if (!isInternalPort(serviceTemplateFileName, nodeTemplateId, nodeTemplate)) { + //External Port + externalPorts.putIfAbsent(nodeTemplateId, nodeTemplate); + } + } + externalPortNodeTemplates.putIfAbsent(serviceTemplateFileName, externalPorts); + } } - addPortMirroringCapability(externalPortNodeTemplate); - } - private void handleExternalPorts(ToscaServiceModel toscaServiceModel) { - for (Map.Entry<String, Map<String, NodeTemplate>> entry : externalPortNodeTemplates.entrySet()) { - ServiceTemplate serviceTemplate = toscaServiceModel.getServiceTemplates().get(entry.getKey()); - Map<String, NodeTemplate> serviceTemplateExternalPortNodeTemplates = entry.getValue(); - if (MapUtils.isEmpty(serviceTemplateExternalPortNodeTemplates)) { - continue; - } - handleExternalPortNodeTemplates(serviceTemplate, serviceTemplateExternalPortNodeTemplates); - addGlobalTypeImport(serviceTemplate); + private void updateExternalPortNodeTemplate(NodeTemplate externalPortNodeTemplate) { + String currentPortNodeType = externalPortNodeTemplate.getType(); + if (nodeTypeExternalNodeType.containsKey(currentPortNodeType)) { + externalPortNodeTemplate.setType(nodeTypeExternalNodeType.get(currentPortNodeType)); + } + addPortMirroringCapability(externalPortNodeTemplate); } - } - private void handleExternalPortNodeTemplates(ServiceTemplate serviceTemplate, - Map<String, NodeTemplate> externalPortNodeTemplates) { - for (Map.Entry<String, NodeTemplate> externalNodeTemplate : externalPortNodeTemplates.entrySet()) { - updateExternalPortNodeTemplate(externalNodeTemplate.getValue()); - if (Objects.nonNull(DataModelUtil.getSubstitutionMappings(serviceTemplate))) { - //Add port mirroring capability to substitution mapping for external ports - addPortMirroringSubstitutionMappingCapability(serviceTemplate, externalNodeTemplate.getKey()); - } + private void handleExternalPorts(ToscaServiceModel toscaServiceModel) { + for (Map.Entry<String, Map<String, NodeTemplate>> entry : externalPortNodeTemplates.entrySet()) { + ServiceTemplate serviceTemplate = toscaServiceModel.getServiceTemplates().get(entry.getKey()); + Map<String, NodeTemplate> serviceTemplateExternalPortNodeTemplates = entry.getValue(); + if (MapUtils.isEmpty(serviceTemplateExternalPortNodeTemplates)) { + continue; + } + handleExternalPortNodeTemplates(serviceTemplate, serviceTemplateExternalPortNodeTemplates); + addGlobalTypeImport(serviceTemplate); + } } - } - private void addPortMirroringSubstitutionMappingCapability(ServiceTemplate serviceTemplate, - String externalPortNodeTemplateId) { - List<String> portMirroringCapability = new LinkedList<>(); - portMirroringCapability.add(externalPortNodeTemplateId); - portMirroringCapability.add(PORT_MIRRORING_CAPABILITY_ID); - String substitutionMappingCapabilityId = PORT_MIRRORING_CAPABILITY_ID + "_" + externalPortNodeTemplateId; - DataModelUtil.addSubstitutionMappingCapability(serviceTemplate, - substitutionMappingCapabilityId, portMirroringCapability); - } - - private void addPortMirroringCapability(NodeTemplate portNodeTemplate) { - Map<String, Object> portMirroringCapabilityProperties = new HashMap<>(); - PortMirroringConnectionPointDescription connectionPoint = new PortMirroringConnectionPointDescription(); - if (Objects.nonNull(portNodeTemplate.getProperties())) { - setConnectionPointNetworkRole(portNodeTemplate, connectionPoint); - } - if (Objects.nonNull(portNodeTemplate.getRequirements())) { - setConnectionPointNfcType(portNodeTemplate, connectionPoint); - } - if (!connectionPoint.isEmpty()) { - portMirroringCapabilityProperties.put(PORT_MIRRORING_CAPABILITY_CP_PROPERTY_NAME, connectionPoint); - DataModelUtil.addNodeTemplateCapability(portNodeTemplate, - PORT_MIRRORING_CAPABILITY_ID, portMirroringCapabilityProperties, null); + private void handleExternalPortNodeTemplates(ServiceTemplate serviceTemplate, + Map<String, NodeTemplate> externalPortNodeTemplates) { + for (Map.Entry<String, NodeTemplate> externalNodeTemplate : externalPortNodeTemplates.entrySet()) { + updateExternalPortNodeTemplate(externalNodeTemplate.getValue()); + if (Objects.nonNull(DataModelUtil.getSubstitutionMappings(serviceTemplate))) { + //Add port mirroring capability to substitution mapping for external ports + addPortMirroringSubstitutionMappingCapability(serviceTemplate, externalNodeTemplate.getKey()); + } + } } - } - private void setConnectionPointNfcType(NodeTemplate portNodeTemplate, - PortMirroringConnectionPointDescription connectionPoint) { - //Get NFC_Type from the binding requirement node - Optional<List<RequirementAssignment>> requirementAssignment = - DataModelUtil.getRequirementAssignment(portNodeTemplate.getRequirements(), ToscaConstants - .BINDING_REQUIREMENT_ID); - if (requirementAssignment.isPresent()) { - RequirementAssignment bindingRequirementAssignment = requirementAssignment.get().get(0); - String node = bindingRequirementAssignment.getNode(); - connectionPoint.setNfc_type(node); + private void addPortMirroringSubstitutionMappingCapability(ServiceTemplate serviceTemplate, + String externalPortNodeTemplateId) { + List<String> portMirroringCapability = new LinkedList<>(); + portMirroringCapability.add(externalPortNodeTemplateId); + portMirroringCapability.add(PORT_MIRRORING_CAPABILITY_ID); + String substitutionMappingCapabilityId = PORT_MIRRORING_CAPABILITY_ID + "_" + externalPortNodeTemplateId; + DataModelUtil.addSubstitutionMappingCapability(serviceTemplate, + substitutionMappingCapabilityId, portMirroringCapability); } - } - private void setConnectionPointNetworkRole(NodeTemplate portNodeTemplate, - PortMirroringConnectionPointDescription connectionPoint) { - Object networkRolePropertyValue = - portNodeTemplate.getProperties().get(ToscaConstants.PORT_NETWORK_ROLE_PROPERTY_NAME); - if (Objects.nonNull(networkRolePropertyValue)) { - Object portMirroringNetworkRolePropertyVal = getClonedObject(networkRolePropertyValue); - connectionPoint.setNetwork_role(portMirroringNetworkRolePropertyVal); + private void addPortMirroringCapability(NodeTemplate portNodeTemplate) { + Map<String, Object> portMirroringCapabilityProperties = new HashMap<>(); + PortMirroringConnectionPointDescription connectionPoint = new PortMirroringConnectionPointDescription(); + if (Objects.nonNull(portNodeTemplate.getProperties())) { + setConnectionPointNetworkRole(portNodeTemplate, connectionPoint); + } + if (Objects.nonNull(portNodeTemplate.getRequirements())) { + setConnectionPointNfcType(portNodeTemplate, connectionPoint); + } + if (!connectionPoint.isEmpty()) { + portMirroringCapabilityProperties.put(PORT_MIRRORING_CAPABILITY_CP_PROPERTY_NAME, connectionPoint); + DataModelUtil.addNodeTemplateCapability(portNodeTemplate, + PORT_MIRRORING_CAPABILITY_ID, portMirroringCapabilityProperties, null); + } } - } - private void addGlobalTypeImport(ServiceTemplate serviceTemplate) { - List<Map<String, Import>> imports = serviceTemplate.getImports(); - Map<String, Import> openecompIndexImport = new HashMap<>(); - openecompIndexImport.put("openecomp_index", - HeatToToscaUtil.createServiceTemplateImport(globalTypesServiceTemplate - .get("openecomp/_index.yml"))); - imports.add(openecompIndexImport); - } - - private boolean isPortNodeTemplate(String nodeType) { - //Check if node corresponds to a concrete port node - Set<String> portNodeTypes = getPortNodeTypes(); - return Objects.nonNull(nodeType) && portNodeTypes.contains(nodeType); - } + private void setConnectionPointNfcType(NodeTemplate portNodeTemplate, + PortMirroringConnectionPointDescription connectionPoint) { + //Get NFC_Type from the binding requirement node + Optional<List<RequirementAssignment>> requirementAssignment = + DataModelUtil.getRequirementAssignment(portNodeTemplate.getRequirements(), ToscaConstants + .BINDING_REQUIREMENT_ID); + if (requirementAssignment.isPresent()) { + RequirementAssignment bindingRequirementAssignment = requirementAssignment.get().get(0); + String node = bindingRequirementAssignment.getNode(); + connectionPoint.setNfc_type(node); + } + } - private Set<String> getPortNodeTypes() { - return new HashSet<>(Arrays.asList(ToscaNodeType.NEUTRON_PORT, - ToscaNodeType.CONTRAILV2_VIRTUAL_MACHINE_INTERFACE, - ToscaNodeType.CONTRAIL_PORT)); - } + private void setConnectionPointNetworkRole(NodeTemplate portNodeTemplate, + PortMirroringConnectionPointDescription connectionPoint) { + Object networkRolePropertyValue = + portNodeTemplate.getProperties().get(ToscaConstants.PORT_NETWORK_ROLE_PROPERTY_NAME); + if (Objects.nonNull(networkRolePropertyValue)) { + Object portMirroringNetworkRolePropertyVal = getClonedObject(networkRolePropertyValue); + connectionPoint.setNetwork_role(portMirroringNetworkRolePropertyVal); + } + } - private boolean isSubstitutableNodeTemplate(NodeTemplate nodeTemplate) { - return Objects.nonNull(nodeTemplate.getDirectives()) - && nodeTemplate.getDirectives() - .contains(ToscaConstants.NODE_TEMPLATE_DIRECTIVE_SUBSTITUTABLE); - } + private void addGlobalTypeImport(ServiceTemplate serviceTemplate) { + List<Map<String, Import>> imports = serviceTemplate.getImports(); + Map<String, Import> openecompIndexImport = new HashMap<>(); + openecompIndexImport.put("openecomp_index", + HeatToToscaUtil.createServiceTemplateImport(globalTypesServiceTemplate + .get("openecomp/_index.yml"))); + imports.add(openecompIndexImport); + } - private boolean isInternalPort(String serviceTemplateFileName, String nodeTemplateId, - NodeTemplate nodeTemplate) { - return isAbstractInternalPort(serviceTemplateFileName, nodeTemplateId) - || isConcreteInternalPort(nodeTemplate); - } + private boolean isPortNodeTemplate(String nodeType) { + //Check if node corresponds to a concrete port node + Set<String> portNodeTypes = getPortNodeTypes(); + return Objects.nonNull(nodeType) && portNodeTypes.contains(nodeType); + } - private boolean isAbstractInternalPort(String serviceTemplateFileName, String nodeTemplateId) { - //Check if port corresponds to an abstract internal port - return portNodeTemplateIdsFromAbstract.containsKey(serviceTemplateFileName) - && portNodeTemplateIdsFromAbstract.get(serviceTemplateFileName).contains(nodeTemplateId); - } + private Set<String> getPortNodeTypes() { + return ImmutableSet.of(ToscaNodeType.NEUTRON_PORT, + ToscaNodeType.CONTRAILV2_VIRTUAL_MACHINE_INTERFACE, ToscaNodeType.CONTRAIL_PORT); + } + private boolean isSubstitutableNodeTemplate(NodeTemplate nodeTemplate) { + return Objects.nonNull(nodeTemplate.getDirectives()) + && nodeTemplate.getDirectives() + .contains(ToscaConstants.NODE_TEMPLATE_DIRECTIVE_SUBSTITUTABLE); + } - private boolean isConcreteInternalPort(NodeTemplate nodeTemplate) { - //Check if node template contains a link requirement - List<Map<String, RequirementAssignment>> requirements = nodeTemplate.getRequirements(); - if (Objects.isNull(requirements)) { - return false; + private boolean isInternalPort(String serviceTemplateFileName, String nodeTemplateId, + NodeTemplate nodeTemplate) { + return isAbstractInternalPort(serviceTemplateFileName, nodeTemplateId) + || isConcreteInternalPort(nodeTemplate); } - for (Map<String, RequirementAssignment> requirement : requirements) { - String requirementId = requirement.keySet().iterator().next(); - if (requirementId.equals(ToscaConstants.LINK_REQUIREMENT_ID)) { - return true; - } + + private boolean isAbstractInternalPort(String serviceTemplateFileName, String nodeTemplateId) { + //Check if port corresponds to an abstract internal port + return portNodeTemplateIdsFromAbstract.containsKey(serviceTemplateFileName) + && portNodeTemplateIdsFromAbstract.get(serviceTemplateFileName).contains(nodeTemplateId); } - return false; - } - private static Map<String, String> initializeNodeTypeExternalNodeType() { - Map<String, String> nodeTypeExternalNodeType = new HashMap<>(3); - nodeTypeExternalNodeType.put(ToscaNodeType.CONTRAIL_PORT, ToscaNodeType.EXTERNAL_CONTRAIL_PORT); - nodeTypeExternalNodeType.put(ToscaNodeType.CONTRAILV2_VIRTUAL_MACHINE_INTERFACE, ToscaNodeType.EXTERNAL_VMI_PORT); - nodeTypeExternalNodeType.put(ToscaNodeType.NEUTRON_PORT, ToscaNodeType.EXTERNAL_NEUTRON_PORT); - return nodeTypeExternalNodeType; - } + private boolean isConcreteInternalPort(NodeTemplate nodeTemplate) { + //Check if node template contains a link requirement + List<Map<String, RequirementAssignment>> requirements = nodeTemplate.getRequirements(); + if (Objects.isNull(requirements)) { + return false; + } + for (Map<String, RequirementAssignment> requirement : requirements) { + String requirementId = requirement.keySet().iterator().next(); + if (requirementId.equals(ToscaConstants.LINK_REQUIREMENT_ID)) { + return true; + } + } + return false; + } } diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/TestUtils.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/TestUtils.java index a0a6d12cb9..95adef3a8c 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/TestUtils.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/TestUtils.java @@ -16,22 +16,43 @@ package org.openecomp.sdc.translator; +import static org.junit.Assert.assertEquals; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.URISyntaxException; +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 java.util.Optional; +import java.util.Set; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; + import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.tuple.Pair; import org.codehaus.jackson.map.ObjectMapper; import org.junit.Assert; -import org.openecomp.core.translator.api.HeatToToscaTranslator; -import org.openecomp.core.utilities.file.FileUtils; -import org.openecomp.sdc.common.utils.SdcCommon; -import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel; import org.onap.sdc.tosca.datatypes.model.GroupDefinition; import org.onap.sdc.tosca.datatypes.model.NodeTemplate; import org.onap.sdc.tosca.datatypes.model.RequirementAssignment; import org.onap.sdc.tosca.datatypes.model.ServiceTemplate; import org.onap.sdc.tosca.datatypes.model.TopologyTemplate; +import org.onap.sdc.tosca.services.ToscaExtensionYamlUtil; +import org.openecomp.core.translator.api.HeatToToscaTranslator; +import org.openecomp.core.utilities.file.FileUtils; +import org.openecomp.sdc.common.utils.SdcCommon; +import org.openecomp.sdc.datatypes.error.ErrorMessage; +import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel; import org.openecomp.sdc.tosca.services.DataModelUtil; import org.openecomp.sdc.tosca.services.ToscaConstants; -import org.onap.sdc.tosca.services.ToscaExtensionYamlUtil; import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.ComputeConsolidationData; import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.ComputeTemplateConsolidationData; import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.ConsolidationData; @@ -48,21 +69,6 @@ import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolida import org.openecomp.sdc.translator.datatypes.heattotosca.unifiedmodel.consolidation.TypeComputeConsolidationData; import org.openecomp.sdc.translator.services.heattotosca.globaltypes.GlobalTypesGenerator; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.net.URISyntaxException; -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 java.util.Optional; - public class TestUtils { private static final String MANIFEST_NAME = SdcCommon.MANIFEST_NAME; private static String zipFilename = "VSP.zip"; @@ -675,4 +681,43 @@ public class TestUtils { return initServiceTemplate; } + public static void compareTranslatedOutput(Set<String> expectedResultFileNameSet, + Map<String, byte[]> expectedResultMap, + ZipInputStream zis) throws IOException { + ZipEntry entry; + String name; + String expected; + String actual; + + while ((entry = zis.getNextEntry()) != null) { + + name = entry.getName() + .substring(entry.getName().lastIndexOf(File.separator) + 1, entry.getName().length()); + if (expectedResultFileNameSet.contains(name)) { + expected = new String(expectedResultMap.get(name)).trim().replace("\r", ""); + actual = new String(FileUtils.toByteArray(zis)).trim().replace("\r", ""); + assertEquals("difference in file: " + name, expected, actual); + + expectedResultFileNameSet.remove(name); + } + } + if (expectedResultFileNameSet.isEmpty()) { + expectedResultFileNameSet.forEach(System.out::println); + } + } + + public static String getErrorAsString(Map<String, List<ErrorMessage>> errorMessages) { + StringBuilder sb = new StringBuilder(); + errorMessages.forEach((file, errorList) -> sb.append("File:").append(file).append(System.lineSeparator()) + .append(getErrorList(errorList))); + + return sb.toString(); + } + + private static String getErrorList(List<ErrorMessage> errors) { + StringBuilder sb = new StringBuilder(); + errors.forEach(error -> sb.append(error.getMessage()).append("[").append(error.getLevel()).append("]") + .append(System.lineSeparator())); + return sb.toString(); + } } diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/impl/heattotosca/nested/multi/Translate_Heat_Nested_Multi.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/impl/heattotosca/nested/multi/TranslateHeatNestedMultiTest.java index 10462c2838..38beb60c65 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/impl/heattotosca/nested/multi/Translate_Heat_Nested_Multi.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/impl/heattotosca/nested/multi/TranslateHeatNestedMultiTest.java @@ -23,7 +23,7 @@ package org.openecomp.sdc.translator.impl.heattotosca.nested.multi; import org.junit.Test; import org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation.BaseResourceTranslationTest; -public class Translate_Heat_Nested_Multi extends BaseResourceTranslationTest { +public class TranslateHeatNestedMultiTest extends BaseResourceTranslationTest { { inputFilesPath = "/mock/heat/nested/multi/inputs"; diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/impl/heattotosca/nested/nestedvolumelocal/NestedVolumelocal.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/impl/heattotosca/nested/nestedvolumelocal/NestedVolumeLocalTest.java index 84f05ce891..951e5d4c46 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/impl/heattotosca/nested/nestedvolumelocal/NestedVolumelocal.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/impl/heattotosca/nested/nestedvolumelocal/NestedVolumeLocalTest.java @@ -1,29 +1,26 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ +/* + * Copyright © 2016-2018 European Support Limited + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * ============LICENSE_END========================================================= */ + package org.openecomp.sdc.translator.impl.heattotosca.nested.nestedvolumelocal; import org.junit.Test; import org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation.BaseResourceTranslationTest; -public class NestedVolumelocal extends BaseResourceTranslationTest { +public class NestedVolumeLocalTest extends BaseResourceTranslationTest { { inputFilesPath = "/mock/heat/nested/nestedvolumelocal/inputs"; diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/impl/heattotosca/nested/nestedvolumeseperatefile/NestedVolumeSeperateFile.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/impl/heattotosca/nested/nestedvolumeseperatefile/NestedVolumeSeperateFileTest.java index bd59303305..8ea3808da5 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/impl/heattotosca/nested/nestedvolumeseperatefile/NestedVolumeSeperateFile.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/impl/heattotosca/nested/nestedvolumeseperatefile/NestedVolumeSeperateFileTest.java @@ -1,29 +1,26 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ +/* + * Copyright © 2016-2018 European Support Limited + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * ============LICENSE_END========================================================= */ + package org.openecomp.sdc.translator.impl.heattotosca.nested.nestedvolumeseperatefile; import org.junit.Test; import org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation.BaseResourceTranslationTest; -public class NestedVolumeSeperateFile extends BaseResourceTranslationTest { +public class NestedVolumeSeperateFileTest extends BaseResourceTranslationTest { { inputFilesPath = "/mock/heat/nested/nestedvolumeseperatefile/inputs"; diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/impl/heattotosca/nested/reusenestedfrommultibase/Translate_Heat_Nested_From_Multi_Base.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/impl/heattotosca/nested/reusenestedfrommultibase/TranslateHeatNestedFromMultiBaseTest.java index b715316146..9405bc0f78 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/impl/heattotosca/nested/reusenestedfrommultibase/Translate_Heat_Nested_From_Multi_Base.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/impl/heattotosca/nested/reusenestedfrommultibase/TranslateHeatNestedFromMultiBaseTest.java @@ -1,30 +1,27 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ +/* + * Copyright © 2016-2018 European Support Limited + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. - * ============LICENSE_END========================================================= */ + package org.openecomp.sdc.translator.impl.heattotosca.nested.reusenestedfrommultibase; import org.junit.Test; import org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.TestConstants; import org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation.BaseResourceTranslationTest; -public class Translate_Heat_Nested_From_Multi_Base extends BaseResourceTranslationTest { +public class TranslateHeatNestedFromMultiBaseTest extends BaseResourceTranslationTest { { inputFilesPath = "/mock/heat/nested/reusenestedfrommultibase/inputs"; diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/impl/heattotosca/nested/single/TranslateHeatNestedSingle.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/impl/heattotosca/nested/single/TranslateHeatNestedSingleTest.java index 640da0c12b..29020cd96d 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/impl/heattotosca/nested/single/TranslateHeatNestedSingle.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/impl/heattotosca/nested/single/TranslateHeatNestedSingleTest.java @@ -27,7 +27,7 @@ import org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslatio import java.io.IOException; -public class TranslateHeatNestedSingle extends BaseResourceTranslationTest { +public class TranslateHeatNestedSingleTest extends BaseResourceTranslationTest { @Override @Before diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/buildconsolidationdata/TestConstants.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/buildconsolidationdata/TestConstants.java index 3b97be7f33..f8a922b963 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/buildconsolidationdata/TestConstants.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/buildconsolidationdata/TestConstants.java @@ -2,19 +2,14 @@ package org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata public class TestConstants{ - public static final String MAIN_SERVICE_TEMPLATE = "MainServiceTemplate.yaml"; + static final String MAIN_SERVICE_TEMPLATE = "MainServiceTemplate.yaml"; public static final String TEST_GROUP_POSITIVE = "TestGroupsPositive"; - public static final String TEST_GROUP_NEGATIVE = "TestGroupsNegative"; public static final String TEST_VOLUME_POSITIVE = "TestVolumePositive"; public static final String TEST_VOLUME_NEGATIVE = "TestVolumeNegative"; public static final String TEST_PORT_POSITIVE = "TestPortPositive"; - public static final String TEST_PORT_NEGATIVE = "TestPortNegative"; - - public static final String TEST_CONNECTIVITY_POSITIVE = "TestConnectivityPositive"; - public static final String TEST_CONNECTIVITY_NEGATIVE = "TestConnectivityNegative"; public static final String TEST_DEPENDS_ON_NODES_CONNECTED_IN = "TestDependsOnNodesConnectedIn"; public static final String TEST_DEPENDS_ON_NODES_CONNECTED_OUT = "TestDependsOnNodesConnectedOut"; diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseFullTranslationTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseFullTranslationTest.java index 801f2c67a0..758271bf46 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseFullTranslationTest.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseFullTranslationTest.java @@ -17,20 +17,8 @@ package org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslation; import static org.junit.Assert.assertEquals; +import static org.openecomp.sdc.translator.TestUtils.getErrorAsString; -import java.io.BufferedInputStream; -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.net.URL; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.zip.ZipEntry; -import java.util.zip.ZipInputStream; import org.apache.commons.collections4.MapUtils; import org.junit.Assert; import org.junit.BeforeClass; @@ -44,18 +32,28 @@ import org.openecomp.sdc.common.errors.ErrorCategory; import org.openecomp.sdc.common.errors.ErrorCode; import org.openecomp.sdc.common.togglz.ToggleableFeature; import org.openecomp.sdc.datatypes.error.ErrorLevel; -import org.openecomp.sdc.datatypes.error.ErrorMessage; import org.openecomp.sdc.tosca.services.impl.ToscaFileOutputServiceCsarImpl; import org.openecomp.sdc.translator.TestUtils; import org.togglz.testing.TestFeatureManager; import org.togglz.testing.TestFeatureManagerProvider; +import java.io.BufferedInputStream; +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.net.URL; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import java.util.zip.ZipInputStream; -public class BaseFullTranslationTest { - public static final String IN_POSTFIX = "/in"; - public static final String OUT_POSTFIX = "/out"; +public class BaseFullTranslationTest { + private static final String IN_POSTFIX = "/in"; + private static final String OUT_POSTFIX = "/out"; protected static TestFeatureManager manager; @@ -66,13 +64,6 @@ public class BaseFullTranslationTest { TestFeatureManagerProvider.setFeatureManager(manager); } - - public static void disableToggleableFeatures() { - manager.disableAll(); - manager = null; - TestFeatureManagerProvider.setFeatureManager(null); - } - protected void testTranslationWithInit(String path) throws IOException { byte[] translatedZipFile = initTranslatorAndTranslate(path); testTranslation(path, translatedZipFile); @@ -101,27 +92,9 @@ public class BaseFullTranslationTest { } try (ByteArrayInputStream fis = new ByteArrayInputStream(translatedZipFile); - BufferedInputStream bis = new BufferedInputStream(fis); ZipInputStream zis = new ZipInputStream(bis)) { - ZipEntry entry; - String name; - String expected; - String actual; - - while ((entry = zis.getNextEntry()) != null) { - - name = entry.getName() - .substring(entry.getName().lastIndexOf(File.separator) + 1, entry.getName().length()); - if (expectedResultFileNameSet.contains(name)) { - expected = new String(expectedResultMap.get(name)).trim().replace("\r", ""); - actual = new String(FileUtils.toByteArray(zis)).trim().replace("\r", ""); - assertEquals("difference in file: " + name, expected, actual); - - expectedResultFileNameSet.remove(name); - } - } - if (expectedResultFileNameSet.isEmpty()) { - expectedResultFileNameSet.forEach(System.out::println); - } + BufferedInputStream bis = new BufferedInputStream(fis); + ZipInputStream zis = new ZipInputStream(bis)) { + TestUtils.compareTranslatedOutput(expectedResultFileNameSet, expectedResultMap, zis); } assertEquals(0, expectedResultFileNameSet.size()); } @@ -140,26 +113,7 @@ public class BaseFullTranslationTest { .withCategory(ErrorCategory.APPLICATION).build()); } - byte[] data = - new ToscaFileOutputServiceCsarImpl().createOutputFile(translatorOutput.getToscaServiceModel(), null); - - return data; - } - - private String getErrorAsString(Map<String, List<ErrorMessage>> errorMessages) { - StringBuilder sb = new StringBuilder(); - errorMessages.entrySet().forEach( - entry -> sb.append("File:").append(entry.getKey()).append(System.lineSeparator()) - .append(getErrorList(entry.getValue()))); - - return sb.toString(); - } - - private String getErrorList(List<ErrorMessage> errors) { - StringBuilder sb = new StringBuilder(); - errors.forEach(error -> sb.append(error.getMessage()).append("[").append(error.getLevel()).append("]") - .append(System.lineSeparator())); - return sb.toString(); + return new ToscaFileOutputServiceCsarImpl().createOutputFile(translatorOutput.getToscaServiceModel(), null); } } diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseResourceTranslationTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseResourceTranslationTest.java index 80c20360d2..f399cc15e0 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseResourceTranslationTest.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/BaseResourceTranslationTest.java @@ -34,8 +34,7 @@ import org.apache.commons.collections4.MapUtils; import org.junit.Assert; import org.junit.Before; import org.junit.BeforeClass; -import org.junit.Rule; -import org.junit.rules.TestName; +import org.onap.sdc.tosca.datatypes.model.ServiceTemplate; import org.openecomp.core.translator.datatypes.TranslatorOutput; import org.openecomp.core.utilities.file.FileUtils; import org.openecomp.core.utilities.json.JsonUtil; @@ -45,11 +44,9 @@ import org.openecomp.sdc.common.errors.ErrorCategory; import org.openecomp.sdc.common.errors.ErrorCode; import org.openecomp.sdc.common.togglz.ToggleableFeature; import org.openecomp.sdc.datatypes.error.ErrorLevel; -import org.openecomp.sdc.datatypes.error.ErrorMessage; import org.openecomp.sdc.heat.datatypes.manifest.FileData; import org.openecomp.sdc.heat.datatypes.manifest.ManifestContent; import org.openecomp.sdc.heat.datatypes.manifest.ManifestFile; -import org.onap.sdc.tosca.datatypes.model.ServiceTemplate; import org.openecomp.sdc.tosca.services.impl.ToscaFileOutputServiceCsarImpl; import org.openecomp.sdc.translator.TestUtils; import org.openecomp.sdc.translator.datatypes.heattotosca.TranslationContext; @@ -64,8 +61,11 @@ import org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata. import org.togglz.testing.TestFeatureManager; import org.togglz.testing.TestFeatureManagerProvider; - -import java.io.*; +import java.io.BufferedInputStream; +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; import java.net.URL; import java.util.Collection; import java.util.HashMap; @@ -73,7 +73,6 @@ import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; -import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; @@ -81,17 +80,11 @@ public class BaseResourceTranslationTest { protected String inputFilesPath; protected String outputFilesPath; - protected TranslationContext translationContext; + TranslationContext translationContext; - @Rule - public TestName name = new TestName(); - - private String zipFilename = "VSP.zip"; private TranslationService translationService; private byte[] translatedZipFile; - private static File tempDir = new File(System.getProperty("java.io.tmpdir")); - private Map<String, byte[]> expectedResultMap = new HashMap<>(); private Set<String> expectedResultFileNameSet = new HashSet<>(); @@ -101,12 +94,7 @@ public class BaseResourceTranslationTest { public static void enableToggleableFeatures(){ manager = new TestFeatureManager(ToggleableFeature.class); manager.enableAll(); - } - - public static void disableToggleableFeatures() { - manager.disableAll(); - manager = null; - TestFeatureManagerProvider.setFeatureManager(null); + TestFeatureManagerProvider.setFeatureManager(manager); } @Before @@ -136,28 +124,10 @@ public class BaseResourceTranslationTest { } } - try (ByteArrayInputStream fis = new ByteArrayInputStream(translatedZipFile); BufferedInputStream bis = new BufferedInputStream(fis); + try (ByteArrayInputStream fis = new ByteArrayInputStream(translatedZipFile); + BufferedInputStream bis = new BufferedInputStream(fis); ZipInputStream zis = new ZipInputStream(bis)) { - ZipEntry entry; - String name; - String expected; - String actual; - - while ((entry = zis.getNextEntry()) != null) { - - name = entry.getName() - .substring(entry.getName().lastIndexOf(File.separator) + 1, entry.getName().length()); - if (expectedResultFileNameSet.contains(name)) { - expected = new String(expectedResultMap.get(name)).trim().replace("\r", ""); - actual = new String(FileUtils.toByteArray(zis)).trim().replace("\r", ""); - assertEquals("difference in file: " + name, expected, actual); - - expectedResultFileNameSet.remove(name); - } - } - if (expectedResultFileNameSet.isEmpty()) { - expectedResultFileNameSet.forEach(System.out::println); - } + TestUtils.compareTranslatedOutput(expectedResultFileNameSet, expectedResultMap, zis); } assertEquals(0, expectedResultFileNameSet.size()); } @@ -172,34 +142,15 @@ public class BaseResourceTranslationTest { MessageContainerUtil .getMessageByLevel(ErrorLevel.ERROR, translatorOutput.getErrorMessages()))) { throw new CoreException((new ErrorCode.ErrorCodeBuilder()).withMessage( - "Error in validation " + getErrorAsString(translatorOutput.getErrorMessages())) + "Error in validation " + TestUtils.getErrorAsString(translatorOutput.getErrorMessages())) .withId("Validation Error").withCategory(ErrorCategory.APPLICATION).build()); } - byte[] data = new ToscaFileOutputServiceCsarImpl().createOutputFile(translatorOutput.getToscaServiceModel(), null); - - return data; - } - - - private String getErrorAsString(Map<String, List<ErrorMessage>> errorMessages) { - StringBuilder sb = new StringBuilder(); - errorMessages.entrySet().forEach( - entry -> sb.append("File:").append(entry.getKey()).append(System.lineSeparator()) - .append(getErrorList(entry.getValue()))); - - return sb.toString(); + return new ToscaFileOutputServiceCsarImpl().createOutputFile(translatorOutput.getToscaServiceModel(), null); } - private String getErrorList(List<ErrorMessage> errors) { - StringBuilder sb = new StringBuilder(); - errors.forEach( - error -> sb.append(error.getMessage()).append("[").append(error.getLevel()).append("]") - .append(System.lineSeparator())); - return sb.toString(); - } - public void addFilesToTranslator(TranslationContext translationContext, String path) + private void addFilesToTranslator(TranslationContext translationContext, String path) throws IOException { File manifestFile = new File(path); File[] files = manifestFile.listFiles(); @@ -214,9 +165,10 @@ public class BaseResourceTranslationTest { fileContent = FileUtils.toByteArray(fis); if (file.getName().equals(MANIFEST_NAME)) { - addManifest(translationContext, MANIFEST_NAME, fileContent); + addManifest(translationContext, fileContent); } else { String validationFilename = "validationOutput.json"; + String zipFilename = "VSP.zip"; if (!file.getName().equals(zipFilename) && (!file.getName().equals(validationFilename))) { addFile(translationContext, file.getName(), fileContent); } @@ -225,20 +177,20 @@ public class BaseResourceTranslationTest { } } - public static void addManifest(TranslationContext translationContext, - String name, byte[] content) { + private static void addManifest(TranslationContext translationContext, + byte[] content) { ManifestContent manifestData = JsonUtil.json2Object(new String(content), ManifestContent.class); ManifestFile manifest = new ManifestFile(); - manifest.setName(name); + manifest.setName(MANIFEST_NAME); manifest.setContent(manifestData); translationContext.setManifest(manifest); - translationContext.addFile(name, content); + translationContext.addFile(MANIFEST_NAME, content); addFilesFromManifestToTranslationContextManifestFilesMap(translationContext, manifestData .getData()); } - public static void addFile(TranslationContext translationContext, - String name, byte[] content) { + private static void addFile(TranslationContext translationContext, + String name, byte[] content) { translationContext.addFile(name, content); } @@ -249,7 +201,7 @@ public class BaseResourceTranslationTest { } } - public void validateNodeTemplateIdInNestedConsolidationData(){ + void validateNodeTemplateIdInNestedConsolidationData(){ ConsolidationData consolidationData = translationContext.getConsolidationData(); Map<String, ServiceTemplate> expectedServiceTemplateModels = TestUtils.getServiceTemplates (expectedResultMap); @@ -257,9 +209,9 @@ public class BaseResourceTranslationTest { validateNestedConsolidationDataNodeTemplateIds(consolidationData,expectedServiceTemplateModels); } - public void validateComputeTemplateConsolidationData(ConsolidationDataValidationType - validationType, - String testName) { + protected void validateComputeTemplateConsolidationData(ConsolidationDataValidationType + validationType, + String testName) { ConsolidationData consolidationData = translationContext.getConsolidationData(); Map<String, ServiceTemplate> expectedServiceTemplateModels = TestUtils.getServiceTemplates (expectedResultMap); @@ -322,19 +274,17 @@ public class BaseResourceTranslationTest { } } - public void validateGetAttribute(String testName){ + protected void validateGetAttribute(String testName){ Map<String, ServiceTemplate> expectedServiceTemplateModels = TestUtils.getServiceTemplates (expectedResultMap); validateGetAttr(translationContext,expectedServiceTemplateModels,testName); } - public void validateNestedTemplateConsolidationData(String testName){ + protected void validateNestedTemplateConsolidationData(String testName){ validateNestedConsolidationData(translationContext, testName); } - public void validatePortTemplateConsolidationData(ConsolidationDataValidationType - validationType, - String testName) { + void validatePortTemplateConsolidationData() { ConsolidationData consolidationData = translationContext.getConsolidationData(); Map<String, ServiceTemplate> expectedServiceTemplateModels = TestUtils.getServiceTemplates (expectedResultMap); @@ -358,7 +308,7 @@ public class BaseResourceTranslationTest { for(String portNodeTemplateId : portNodeTemplateIds) { PortTemplateConsolidationData portTemplateConsolidationData = filePortConsolidationData.getPortTemplateConsolidationData(portNodeTemplateId); - switch(validationType){ + switch(ConsolidationDataValidationType.VALIDATE_CONNECTIVITY){ case VALIDATE_CONNECTIVITY: validatePortConnectivityIn(portTemplateConsolidationData,expectedServiceTemplate); validatePortConnectivityOut(portNodeTemplateId, portTemplateConsolidationData, diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationContrailV2VmInterfaceImplTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationContrailV2VmInterfaceImplTest.java index 74a6ce5a5b..85557cb19f 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationContrailV2VmInterfaceImplTest.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationContrailV2VmInterfaceImplTest.java @@ -22,12 +22,9 @@ package org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslati import org.junit.Before; import org.junit.Test; -import org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.ConsolidationDataValidationType; import java.io.IOException; -import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.TestConstants.TEST_CONNECTIVITY_POSITIVE; - /** * @author Avrahamg * @since August 10, 2016 @@ -46,8 +43,7 @@ public class ResourceTranslationContrailV2VmInterfaceImplTest extends BaseResour outputFilesPath = "/mock/services/heattotosca/contrailv2VMinterface/oneNet/expectedoutputfiles"; initTranslatorAndTranslate(); testTranslation(); - validatePortTemplateConsolidationData(ConsolidationDataValidationType - .VALIDATE_CONNECTIVITY, TEST_CONNECTIVITY_POSITIVE); + validatePortTemplateConsolidationData(); } @Test @@ -57,8 +53,7 @@ public class ResourceTranslationContrailV2VmInterfaceImplTest extends BaseResour "/mock/services/heattotosca/contrailv2VMinterface/listNet/expectedoutputfiles"; initTranslatorAndTranslate(); testTranslation(); - validatePortTemplateConsolidationData(ConsolidationDataValidationType - .VALIDATE_CONNECTIVITY, TEST_CONNECTIVITY_POSITIVE); + validatePortTemplateConsolidationData(); } @Test diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNeutronPortImplTest.java b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNeutronPortImplTest.java index 96e7af7414..2e55cb96bf 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNeutronPortImplTest.java +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/java/org/openecomp/sdc/translator/services/heattotosca/impl/resourcetranslation/ResourceTranslationNeutronPortImplTest.java @@ -22,12 +22,9 @@ package org.openecomp.sdc.translator.services.heattotosca.impl.resourcetranslati import org.junit.Before; import org.junit.Test; -import org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.ConsolidationDataValidationType; import java.io.IOException; -import static org.openecomp.sdc.translator.services.heattotosca.buildconsolidationdata.TestConstants.TEST_CONNECTIVITY_POSITIVE; - public class ResourceTranslationNeutronPortImplTest extends BaseResourceTranslationTest { @@ -43,8 +40,7 @@ public class ResourceTranslationNeutronPortImplTest extends BaseResourceTranslat outputFilesPath = "/mock/services/heattotosca/neutron_port_translation/expectedoutputfiles"; initTranslatorAndTranslate(); testTranslation(); - validatePortTemplateConsolidationData(ConsolidationDataValidationType - .VALIDATE_CONNECTIVITY, TEST_CONNECTIVITY_POSITIVE); + validatePortTemplateConsolidationData(); } @Test @@ -54,8 +50,7 @@ public class ResourceTranslationNeutronPortImplTest extends BaseResourceTranslat "/mock/services/heattotosca/neutron_security_group_translation/expectedoutputfiles"; initTranslatorAndTranslate(); testTranslation(); - validatePortTemplateConsolidationData(ConsolidationDataValidationType - .VALIDATE_CONNECTIVITY, TEST_CONNECTIVITY_POSITIVE); + validatePortTemplateConsolidationData(); } @Test @@ -65,7 +60,6 @@ public class ResourceTranslationNeutronPortImplTest extends BaseResourceTranslat "/mock/services/heattotosca/neutron_dual_stacks/expectedoutputfiles"; initTranslatorAndTranslate(); testTranslation(); - validatePortTemplateConsolidationData(ConsolidationDataValidationType - .VALIDATE_CONNECTIVITY, TEST_CONNECTIVITY_POSITIVE); + validatePortTemplateConsolidationData(); } } diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/heat/nested/multi/expectedoutputfiles/GlobalSubstitutionTypesServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/heat/nested/multi/expectedoutputfiles/GlobalSubstitutionTypesServiceTemplate.yaml index e8e9adfc58..248290cf5d 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/heat/nested/multi/expectedoutputfiles/GlobalSubstitutionTypesServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/heat/nested/multi/expectedoutputfiles/GlobalSubstitutionTypesServiceTemplate.yaml @@ -209,6 +209,7 @@ node_types: type: tosca.capabilities.network.Bindable valid_source_types: - org.openecomp.resource.cp.nodes.heat.network.contrailV2.VLANSubInterface + - org.openecomp.resource.cp.nodes.heat.network.v2.contrailV2.VLANSubInterface occurrences: - 0 - UNBOUNDED @@ -216,6 +217,7 @@ node_types: type: tosca.capabilities.network.Bindable valid_source_types: - org.openecomp.resource.cp.nodes.heat.network.contrailV2.VLANSubInterface + - org.openecomp.resource.cp.nodes.heat.network.v2.contrailV2.VLANSubInterface occurrences: - 0 - UNBOUNDED @@ -863,6 +865,7 @@ node_types: type: tosca.capabilities.network.Bindable valid_source_types: - org.openecomp.resource.cp.nodes.heat.network.contrailV2.VLANSubInterface + - org.openecomp.resource.cp.nodes.heat.network.v2.contrailV2.VLANSubInterface occurrences: - 0 - UNBOUNDED @@ -881,6 +884,7 @@ node_types: type: tosca.capabilities.network.Bindable valid_source_types: - org.openecomp.resource.cp.nodes.heat.network.contrailV2.VLANSubInterface + - org.openecomp.resource.cp.nodes.heat.network.v2.contrailV2.VLANSubInterface occurrences: - 0 - UNBOUNDED diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/heat/nested/nestedwithoutNodeTemplates/expectedoutputfiles/GlobalSubstitutionTypesServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/heat/nested/nestedwithoutNodeTemplates/expectedoutputfiles/GlobalSubstitutionTypesServiceTemplate.yaml index 29a1ada429..dd7f089424 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/heat/nested/nestedwithoutNodeTemplates/expectedoutputfiles/GlobalSubstitutionTypesServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/heat/nested/nestedwithoutNodeTemplates/expectedoutputfiles/GlobalSubstitutionTypesServiceTemplate.yaml @@ -251,7 +251,7 @@ node_types: occurrences:
- 0
- UNBOUNDED
- - link_contrail_vmi_subinterface_perimeta_ssc_a_untrusted_0_vlan_ports:
+ - subinterface_link_contrail_vmi_subinterface_perimeta_ssc_a_untrusted_0_vlan_ports:
capability: tosca.capabilities.network.Linkable
relationship: tosca.relationships.network.LinksTo
occurrences:
@@ -374,6 +374,7 @@ node_types: type: tosca.capabilities.network.Bindable
valid_source_types:
- org.openecomp.resource.cp.nodes.heat.network.contrailV2.VLANSubInterface
+ - org.openecomp.resource.cp.nodes.heat.network.v2.contrailV2.VLANSubInterface
occurrences:
- 0
- UNBOUNDED
@@ -528,6 +529,7 @@ node_types: type: tosca.capabilities.network.Bindable
valid_source_types:
- org.openecomp.resource.cp.nodes.heat.network.contrailV2.VLANSubInterface
+ - org.openecomp.resource.cp.nodes.heat.network.v2.contrailV2.VLANSubInterface
occurrences:
- 0
- UNBOUNDED
@@ -762,6 +764,7 @@ node_types: type: tosca.capabilities.network.Bindable
valid_source_types:
- org.openecomp.resource.cp.nodes.heat.network.contrailV2.VLANSubInterface
+ - org.openecomp.resource.cp.nodes.heat.network.v2.contrailV2.VLANSubInterface
occurrences:
- 0
- UNBOUNDED
@@ -793,6 +796,7 @@ node_types: type: tosca.capabilities.network.Bindable
valid_source_types:
- org.openecomp.resource.cp.nodes.heat.network.contrailV2.VLANSubInterface
+ - org.openecomp.resource.cp.nodes.heat.network.v2.contrailV2.VLANSubInterface
occurrences:
- 0
- UNBOUNDED
@@ -872,6 +876,7 @@ node_types: type: tosca.capabilities.network.Bindable
valid_source_types:
- org.openecomp.resource.cp.nodes.heat.network.contrailV2.VLANSubInterface
+ - org.openecomp.resource.cp.nodes.heat.network.v2.contrailV2.VLANSubInterface
occurrences:
- 0
- UNBOUNDED
@@ -944,6 +949,7 @@ node_types: type: tosca.capabilities.network.Bindable
valid_source_types:
- org.openecomp.resource.cp.nodes.heat.network.contrailV2.VLANSubInterface
+ - org.openecomp.resource.cp.nodes.heat.network.v2.contrailV2.VLANSubInterface
occurrences:
- 0
- UNBOUNDED
@@ -1052,7 +1058,7 @@ node_types: occurrences:
- 0
- UNBOUNDED
- - link_contrail_vmi_subinterface:
+ - subinterface_link_contrail_vmi_subinterface:
capability: tosca.capabilities.network.Linkable
relationship: tosca.relationships.network.LinksTo
occurrences:
@@ -1299,7 +1305,7 @@ node_types: occurrences:
- 0
- UNBOUNDED
- - link_contrail_vmi_subinterface_perimeta_ssc_b_untrusted_0_vlan_ports:
+ - subinterface_link_contrail_vmi_subinterface_perimeta_ssc_b_untrusted_0_vlan_ports:
capability: tosca.capabilities.network.Linkable
relationship: tosca.relationships.network.LinksTo
occurrences:
@@ -1400,6 +1406,7 @@ node_types: type: tosca.capabilities.network.Bindable
valid_source_types:
- org.openecomp.resource.cp.nodes.heat.network.contrailV2.VLANSubInterface
+ - org.openecomp.resource.cp.nodes.heat.network.v2.contrailV2.VLANSubInterface
occurrences:
- 0
- UNBOUNDED
@@ -1500,6 +1507,7 @@ node_types: type: tosca.capabilities.network.Bindable
valid_source_types:
- org.openecomp.resource.cp.nodes.heat.network.contrailV2.VLANSubInterface
+ - org.openecomp.resource.cp.nodes.heat.network.v2.contrailV2.VLANSubInterface
occurrences:
- 0
- UNBOUNDED
@@ -1662,6 +1670,7 @@ node_types: type: tosca.capabilities.network.Bindable
valid_source_types:
- org.openecomp.resource.cp.nodes.heat.network.contrailV2.VLANSubInterface
+ - org.openecomp.resource.cp.nodes.heat.network.v2.contrailV2.VLANSubInterface
occurrences:
- 0
- UNBOUNDED
@@ -1704,6 +1713,7 @@ node_types: type: tosca.capabilities.network.Bindable
valid_source_types:
- org.openecomp.resource.cp.nodes.heat.network.contrailV2.VLANSubInterface
+ - org.openecomp.resource.cp.nodes.heat.network.v2.contrailV2.VLANSubInterface
occurrences:
- 0
- UNBOUNDED
@@ -1756,6 +1766,7 @@ node_types: type: tosca.capabilities.network.Bindable
valid_source_types:
- org.openecomp.resource.cp.nodes.heat.network.contrailV2.VLANSubInterface
+ - org.openecomp.resource.cp.nodes.heat.network.v2.contrailV2.VLANSubInterface
occurrences:
- 0
- UNBOUNDED
@@ -2041,6 +2052,7 @@ node_types: type: tosca.capabilities.network.Bindable
valid_source_types:
- org.openecomp.resource.cp.nodes.heat.network.contrailV2.VLANSubInterface
+ - org.openecomp.resource.cp.nodes.heat.network.v2.contrailV2.VLANSubInterface
occurrences:
- 0
- UNBOUNDED
@@ -2273,7 +2285,7 @@ node_types: occurrences:
- 0
- UNBOUNDED
- - link_contrail_vmi_subinterface_perimeta_rtp_msc_a_untrusted_0_vlan_ports:
+ - subinterface_link_contrail_vmi_subinterface_perimeta_rtp_msc_a_untrusted_0_vlan_ports:
capability: tosca.capabilities.network.Linkable
relationship: tosca.relationships.network.LinksTo
occurrences:
@@ -2394,6 +2406,7 @@ node_types: type: tosca.capabilities.network.Bindable
valid_source_types:
- org.openecomp.resource.cp.nodes.heat.network.contrailV2.VLANSubInterface
+ - org.openecomp.resource.cp.nodes.heat.network.v2.contrailV2.VLANSubInterface
occurrences:
- 0
- UNBOUNDED
@@ -2578,6 +2591,7 @@ node_types: type: tosca.capabilities.network.Bindable
valid_source_types:
- org.openecomp.resource.cp.nodes.heat.network.contrailV2.VLANSubInterface
+ - org.openecomp.resource.cp.nodes.heat.network.v2.contrailV2.VLANSubInterface
occurrences:
- 0
- UNBOUNDED
@@ -2772,6 +2786,7 @@ node_types: type: tosca.capabilities.network.Bindable
valid_source_types:
- org.openecomp.resource.cp.nodes.heat.network.contrailV2.VLANSubInterface
+ - org.openecomp.resource.cp.nodes.heat.network.v2.contrailV2.VLANSubInterface
occurrences:
- 0
- UNBOUNDED
@@ -2791,6 +2806,7 @@ node_types: type: tosca.capabilities.network.Bindable
valid_source_types:
- org.openecomp.resource.cp.nodes.heat.network.contrailV2.VLANSubInterface
+ - org.openecomp.resource.cp.nodes.heat.network.v2.contrailV2.VLANSubInterface
occurrences:
- 0
- UNBOUNDED
@@ -3128,7 +3144,7 @@ node_types: occurrences:
- 0
- UNBOUNDED
- - link_contrail_vmi_subinterface_perimeta_rtp_msc_b_untrusted_0_vlan_ports:
+ - subinterface_link_contrail_vmi_subinterface_perimeta_rtp_msc_b_untrusted_0_vlan_ports:
capability: tosca.capabilities.network.Linkable
relationship: tosca.relationships.network.LinksTo
occurrences:
@@ -3334,6 +3350,7 @@ node_types: type: tosca.capabilities.network.Bindable
valid_source_types:
- org.openecomp.resource.cp.nodes.heat.network.contrailV2.VLANSubInterface
+ - org.openecomp.resource.cp.nodes.heat.network.v2.contrailV2.VLANSubInterface
occurrences:
- 0
- UNBOUNDED
@@ -3580,6 +3597,7 @@ node_types: type: tosca.capabilities.network.Bindable
valid_source_types:
- org.openecomp.resource.cp.nodes.heat.network.contrailV2.VLANSubInterface
+ - org.openecomp.resource.cp.nodes.heat.network.v2.contrailV2.VLANSubInterface
occurrences:
- 0
- UNBOUNDED
@@ -3627,6 +3645,7 @@ node_types: type: tosca.capabilities.network.Bindable
valid_source_types:
- org.openecomp.resource.cp.nodes.heat.network.contrailV2.VLANSubInterface
+ - org.openecomp.resource.cp.nodes.heat.network.v2.contrailV2.VLANSubInterface
occurrences:
- 0
- UNBOUNDED
@@ -3652,6 +3671,7 @@ node_types: type: tosca.capabilities.network.Bindable
valid_source_types:
- org.openecomp.resource.cp.nodes.heat.network.contrailV2.VLANSubInterface
+ - org.openecomp.resource.cp.nodes.heat.network.v2.contrailV2.VLANSubInterface
occurrences:
- 0
- UNBOUNDED
@@ -3706,4 +3726,4 @@ node_types: description: A node type that includes the Metric capability indicates that it can be monitored using ceilometer.
occurrences:
- 1
- - UNBOUNDED
+ - UNBOUNDED
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/heat/nested/nestedwithoutNodeTemplates/expectedoutputfiles/module_1_perimeta_swmu_a_childServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/heat/nested/nestedwithoutNodeTemplates/expectedoutputfiles/module_1_perimeta_swmu_a_childServiceTemplate.yaml index 49a49f526c..9823edae9c 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/heat/nested/nestedwithoutNodeTemplates/expectedoutputfiles/module_1_perimeta_swmu_a_childServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/heat/nested/nestedwithoutNodeTemplates/expectedoutputfiles/module_1_perimeta_swmu_a_childServiceTemplate.yaml @@ -242,7 +242,7 @@ topology_template: ip_count_required:
is_required: true
floating_ip_count_required:
- is_required: true
+ is_required: false
security_groups:
get_input: perimeta_sec_groups
fixed_ips:
@@ -278,7 +278,7 @@ topology_template: ip_count_required:
is_required: true
floating_ip_count_required:
- is_required: true
+ is_required: false
security_groups:
get_input: perimeta_sec_groups
fixed_ips:
@@ -359,7 +359,7 @@ topology_template: ip_count_required:
is_required: true
floating_ip_count_required:
- is_required: true
+ is_required: false
security_groups:
get_input: perimeta_sec_groups
fixed_ips:
@@ -423,7 +423,7 @@ topology_template: ip_count_required:
is_required: true
floating_ip_count_required:
- is_required: true
+ is_required: false
security_groups:
get_input: perimeta_sec_groups
fixed_ips:
@@ -869,6 +869,9 @@ topology_template: dependency_perimeta_ssc_a_untrusted_parent_0_port:
- perimeta_ssc_a_untrusted_parent_0_port
- dependency
+ subinterface_link_contrail_vmi_subinterface_perimeta_ssc_a_untrusted_0_vlan_ports:
+ - perimeta_ssc_a_untrusted_0_vlan_ports
+ - subinterface_link_contrail_vmi_subinterface
link_perimeta_ssc_a_mgmt_1_port:
- perimeta_ssc_a_mgmt_1_port
- link
@@ -884,9 +887,6 @@ topology_template: dependency_perimeta_ssc_a_ha_0_port:
- perimeta_ssc_a_ha_0_port
- dependency
- link_contrail_vmi_subinterface_perimeta_ssc_a_untrusted_0_vlan_ports:
- - perimeta_ssc_a_untrusted_0_vlan_ports
- - link_contrail_vmi_subinterface
link_perimeta_ssc_a_mgmt_0_port:
- perimeta_ssc_a_mgmt_0_port
- link
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/heat/nested/nestedwithoutNodeTemplates/expectedoutputfiles/module_1_perimeta_swmu_b_childServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/heat/nested/nestedwithoutNodeTemplates/expectedoutputfiles/module_1_perimeta_swmu_b_childServiceTemplate.yaml index 406756105c..3a11fe31b3 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/heat/nested/nestedwithoutNodeTemplates/expectedoutputfiles/module_1_perimeta_swmu_b_childServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/heat/nested/nestedwithoutNodeTemplates/expectedoutputfiles/module_1_perimeta_swmu_b_childServiceTemplate.yaml @@ -204,7 +204,7 @@ topology_template: ip_count_required:
is_required: true
floating_ip_count_required:
- is_required: true
+ is_required: false
security_groups:
get_input: perimeta_sec_groups
fixed_ips:
@@ -240,7 +240,7 @@ topology_template: ip_count_required:
is_required: true
floating_ip_count_required:
- is_required: true
+ is_required: false
security_groups:
get_input: perimeta_sec_groups
fixed_ips:
@@ -321,7 +321,7 @@ topology_template: ip_count_required:
is_required: true
floating_ip_count_required:
- is_required: true
+ is_required: false
security_groups:
get_input: perimeta_sec_groups
fixed_ips:
@@ -417,7 +417,7 @@ topology_template: ip_count_required:
is_required: true
floating_ip_count_required:
- is_required: true
+ is_required: false
security_groups:
get_input: perimeta_sec_groups
fixed_ips:
@@ -852,6 +852,9 @@ topology_template: dependency_perimeta_ssc_b_unused_0_port:
- perimeta_ssc_b_unused_0_port
- dependency
+ subinterface_link_contrail_vmi_subinterface_perimeta_ssc_b_untrusted_0_vlan_ports:
+ - perimeta_ssc_b_untrusted_0_vlan_ports
+ - subinterface_link_contrail_vmi_subinterface
dependency_contrail_vmi_subinterface_perimeta_ssc_b_untrusted_0_vlan_ports:
- perimeta_ssc_b_untrusted_0_vlan_ports
- dependency_contrail_vmi_subinterface
@@ -861,9 +864,6 @@ topology_template: local_storage_perimeta_ssc_b_server_0:
- perimeta_ssc_b_server_0
- local_storage
- link_contrail_vmi_subinterface_perimeta_ssc_b_untrusted_0_vlan_ports:
- - perimeta_ssc_b_untrusted_0_vlan_ports
- - link_contrail_vmi_subinterface
link_perimeta_ssc_b_mgmt_0_port:
- perimeta_ssc_b_mgmt_0_port
- link
@@ -893,4 +893,4 @@ topology_template: - dependency
link_perimeta_ssc_b_ha_0_port:
- perimeta_ssc_b_ha_0_port
- - link
+ - link
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/heat/nested/nestedwithoutNodeTemplates/expectedoutputfiles/module_2_perimeta_sw_a_childServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/heat/nested/nestedwithoutNodeTemplates/expectedoutputfiles/module_2_perimeta_sw_a_childServiceTemplate.yaml index 8d11d9b6e4..c2b4697234 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/heat/nested/nestedwithoutNodeTemplates/expectedoutputfiles/module_2_perimeta_sw_a_childServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/heat/nested/nestedwithoutNodeTemplates/expectedoutputfiles/module_2_perimeta_sw_a_childServiceTemplate.yaml @@ -795,9 +795,6 @@ topology_template: dependency_perimeta_rtp_msc_a_ha_0_port:
- perimeta_rtp_msc_a_ha_0_port
- dependency
- link_contrail_vmi_subinterface_perimeta_rtp_msc_a_untrusted_0_vlan_ports:
- - perimeta_rtp_msc_a_untrusted_0_vlan_ports
- - link_contrail_vmi_subinterface
link_perimeta_rtp_msc_a_untrusted_parent_0_port:
- perimeta_rtp_msc_a_untrusted_parent_0_port
- link
@@ -807,6 +804,9 @@ topology_template: dependency_perimeta_rtp_msc_a_server_0:
- perimeta_rtp_msc_a_server_0
- dependency
+ subinterface_link_contrail_vmi_subinterface_perimeta_rtp_msc_a_untrusted_0_vlan_ports:
+ - perimeta_rtp_msc_a_untrusted_0_vlan_ports
+ - subinterface_link_contrail_vmi_subinterface
dependency_perimeta_rtp_msc_a_trusted_0_port:
- perimeta_rtp_msc_a_trusted_0_port
- dependency
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/heat/nested/nestedwithoutNodeTemplates/expectedoutputfiles/module_2_perimeta_sw_b_childServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/heat/nested/nestedwithoutNodeTemplates/expectedoutputfiles/module_2_perimeta_sw_b_childServiceTemplate.yaml index f71b4500fa..449677d8da 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/heat/nested/nestedwithoutNodeTemplates/expectedoutputfiles/module_2_perimeta_sw_b_childServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/heat/nested/nestedwithoutNodeTemplates/expectedoutputfiles/module_2_perimeta_sw_b_childServiceTemplate.yaml @@ -781,15 +781,15 @@ topology_template: dependency_perimeta_rtp_msc_b_mgmt_0_port:
- perimeta_rtp_msc_b_mgmt_0_port
- dependency
- link_contrail_vmi_subinterface_perimeta_rtp_msc_b_untrusted_0_vlan_ports:
- - perimeta_rtp_msc_b_untrusted_0_vlan_ports
- - link_contrail_vmi_subinterface
link_perimeta_rtp_msc_b_trusted_0_port:
- perimeta_rtp_msc_b_trusted_0_port
- link
dependency_perimeta_rtp_msc_b_untrusted_parent_0_port:
- perimeta_rtp_msc_b_untrusted_parent_0_port
- dependency
+ subinterface_link_contrail_vmi_subinterface_perimeta_rtp_msc_b_untrusted_0_vlan_ports:
+ - perimeta_rtp_msc_b_untrusted_0_vlan_ports
+ - subinterface_link_contrail_vmi_subinterface
link_perimeta_rtp_msc_b_ha_0_port:
- perimeta_rtp_msc_b_ha_0_port
- link
diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/heat/nested/nestedwithoutNodeTemplates/expectedoutputfiles/vlan_subinterface_dualServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/heat/nested/nestedwithoutNodeTemplates/expectedoutputfiles/vlan_subinterface_dualServiceTemplate.yaml index 12a1064c31..7c222cceb0 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/heat/nested/nestedwithoutNodeTemplates/expectedoutputfiles/vlan_subinterface_dualServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/heat/nested/nestedwithoutNodeTemplates/expectedoutputfiles/vlan_subinterface_dualServiceTemplate.yaml @@ -1,137 +1,137 @@ -tosca_definitions_version: tosca_simple_yaml_1_0_0
-metadata:
- template_name: vlan_subinterface_dual
-imports:
-- openecomp_heat_index:
- file: openecomp-heat/_index.yml
-- GlobalSubstitutionTypes:
- file: GlobalSubstitutionTypesServiceTemplate.yaml
-topology_template:
- inputs:
- perimeta_parent_interface:
- hidden: false
- immutable: false
- type: string
- description: Parent Contrail interface
- perimeta_v6_vip_0:
- hidden: false
- immutable: false
- type: string
- description: virtual IPv6 address associated with subinterfaces
- perimeta_subinterface_name_prefix:
- hidden: false
- immutable: false
- type: string
- description: Combined with subinterface_instance_index, this is used as the name of the subinterface resource
- perimeta_vlan_networks:
- hidden: false
- immutable: false
- type: list
- description: List of Contrail VLAN networks to use for the subinterfaces. The order and number of these must match the VLAN ID list
- entry_schema:
- type: string
- perimeta_subinterface_instance_index:
- hidden: false
- immutable: false
- type: float
- description: Index of instance among multiple instances. Use to retrieve correct parameter for this instance when passed all parameters for all instances.
- constraints:
- - in_range:
- - 1
- - 1001
- perimeta_ip_0:
- hidden: false
- immutable: false
- type: string
- description: IPv4 address associated with subinterfaces
- perimeta_vip_0:
- hidden: false
- immutable: false
- type: string
- description: virtual IPv4 address associated with subinterfaces
- perimeta_vlan_ids:
- hidden: false
- immutable: false
- type: list
- description: List of VLAN IDs to use for subinterfaces
- entry_schema:
- type: string
- perimeta_mac_address:
- hidden: false
- immutable: false
- type: string
- description: MAC address to use for subinterface
- perimeta_v6_ip_0:
- hidden: false
- immutable: false
- type: string
- description: IPv6 address associated with subinterfaces
- node_templates:
- contrail_vmi_subinterface:
- type: org.openecomp.resource.cp.nodes.heat.network.contrailV2.VLANSubInterface
- properties:
- virtual_machine_interface_refs:
- - get_input: perimeta_parent_interface
- name:
- str_replace:
- template: $NAME_$VLAN
- params:
- $NAME:
- get_input: perimeta_subinterface_name_prefix
- $VLAN:
- get_input:
- - perimeta_vlan_ids
- - get_input: perimeta_subinterface_instance_index
- virtual_network_refs:
- - get_input:
- - perimeta_vlan_networks
- - get_input: perimeta_subinterface_instance_index
- virtual_machine_interface_properties:
- sub_interface_vlan_tag:
- get_input:
- - perimeta_vlan_ids
- - get_input: perimeta_subinterface_instance_index
- virtual_machine_interface_allowed_address_pairs:
- allowed_address_pair:
- - address_mode: active-standby
- ip:
- ip_prefix:
- get_input: perimeta_vip_0
- ip_prefix_len: 32
- mac:
- get_input: perimeta_mac_address
- - address_mode: active-standby
- ip:
- ip_prefix:
- get_input: perimeta_v6_vip_0
- ip_prefix_len: 128
- mac:
- get_input: perimeta_mac_address
- virtual_machine_interface_mac_addresses:
- mac_address:
- - get_input: perimeta_mac_address
- groups:
- vlan_subinterface_dual_group:
- type: org.openecomp.groups.heat.HeatStack
- properties:
- heat_file: ../Artifacts/vlan_subinterface_dual.yaml
- description: |
- HOT template to instantiate a single Contrail VLAN sub-interface with associated instance IP addresses and allowed address pairs
- members:
- - contrail_vmi_subinterface
- substitution_mappings:
- node_type: org.openecomp.resource.abstract.nodes.heat.subinterface.vlan_subinterface_dual
- capabilities:
- feature_contrail_vmi_subinterface:
- - contrail_vmi_subinterface
- - feature
- requirements:
- binding_contrail_vmi_subinterface:
- - contrail_vmi_subinterface
- - binding
- link_contrail_vmi_subinterface:
- - contrail_vmi_subinterface
- - link
- dependency_contrail_vmi_subinterface:
- - contrail_vmi_subinterface
- - dependency
\ No newline at end of file +tosca_definitions_version: tosca_simple_yaml_1_0_0 +metadata: + template_name: vlan_subinterface_dual +imports: +- openecomp_heat_index: + file: openecomp-heat/_index.yml +- GlobalSubstitutionTypes: + file: GlobalSubstitutionTypesServiceTemplate.yaml +topology_template: + inputs: + perimeta_parent_interface: + hidden: false + immutable: false + type: string + description: Parent Contrail interface + perimeta_v6_vip_0: + hidden: false + immutable: false + type: string + description: virtual IPv6 address associated with subinterfaces + perimeta_subinterface_name_prefix: + hidden: false + immutable: false + type: string + description: Combined with subinterface_instance_index, this is used as the name of the subinterface resource + perimeta_vlan_networks: + hidden: false + immutable: false + type: list + description: List of Contrail VLAN networks to use for the subinterfaces. The order and number of these must match the VLAN ID list + entry_schema: + type: string + perimeta_subinterface_instance_index: + hidden: false + immutable: false + type: float + description: Index of instance among multiple instances. Use to retrieve correct parameter for this instance when passed all parameters for all instances. + constraints: + - in_range: + - 1 + - 1001 + perimeta_ip_0: + hidden: false + immutable: false + type: string + description: IPv4 address associated with subinterfaces + perimeta_vip_0: + hidden: false + immutable: false + type: string + description: virtual IPv4 address associated with subinterfaces + perimeta_vlan_ids: + hidden: false + immutable: false + type: list + description: List of VLAN IDs to use for subinterfaces + entry_schema: + type: string + perimeta_mac_address: + hidden: false + immutable: false + type: string + description: MAC address to use for subinterface + perimeta_v6_ip_0: + hidden: false + immutable: false + type: string + description: IPv6 address associated with subinterfaces + node_templates: + contrail_vmi_subinterface: + type: org.openecomp.resource.cp.nodes.heat.network.v2.contrailV2.VLANSubInterface + properties: + virtual_machine_interface_refs: + - get_input: perimeta_parent_interface + name: + str_replace: + template: $NAME_$VLAN + params: + $NAME: + get_input: perimeta_subinterface_name_prefix + $VLAN: + get_input: + - perimeta_vlan_ids + - get_input: perimeta_subinterface_instance_index + virtual_network_refs: + - get_input: + - perimeta_vlan_networks + - get_input: perimeta_subinterface_instance_index + virtual_machine_interface_properties: + sub_interface_vlan_tag: + get_input: + - perimeta_vlan_ids + - get_input: perimeta_subinterface_instance_index + virtual_machine_interface_allowed_address_pairs: + allowed_address_pair: + - address_mode: active-standby + ip: + ip_prefix: + get_input: perimeta_vip_0 + ip_prefix_len: 32 + mac: + get_input: perimeta_mac_address + - address_mode: active-standby + ip: + ip_prefix: + get_input: perimeta_v6_vip_0 + ip_prefix_len: 128 + mac: + get_input: perimeta_mac_address + virtual_machine_interface_mac_addresses: + mac_address: + - get_input: perimeta_mac_address + groups: + vlan_subinterface_dual_group: + type: org.openecomp.groups.heat.HeatStack + properties: + heat_file: ../Artifacts/vlan_subinterface_dual.yaml + description: | + HOT template to instantiate a single Contrail VLAN sub-interface with associated instance IP addresses and allowed address pairs + members: + - contrail_vmi_subinterface + substitution_mappings: + node_type: org.openecomp.resource.abstract.nodes.heat.subinterface.vlan_subinterface_dual + capabilities: + feature_contrail_vmi_subinterface: + - contrail_vmi_subinterface + - feature + requirements: + binding_contrail_vmi_subinterface: + - contrail_vmi_subinterface + - binding + subinterface_link_contrail_vmi_subinterface: + - contrail_vmi_subinterface + - subinterface_link + dependency_contrail_vmi_subinterface: + - contrail_vmi_subinterface + - dependency
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/heat/nested/reusenestedfrommultibase/expectedoutputfiles/GlobalSubstitutionTypesServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/heat/nested/reusenestedfrommultibase/expectedoutputfiles/GlobalSubstitutionTypesServiceTemplate.yaml index 49b834be32..f890787ebd 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/heat/nested/reusenestedfrommultibase/expectedoutputfiles/GlobalSubstitutionTypesServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/heat/nested/reusenestedfrommultibase/expectedoutputfiles/GlobalSubstitutionTypesServiceTemplate.yaml @@ -238,6 +238,7 @@ node_types: type: tosca.capabilities.network.Bindable valid_source_types: - org.openecomp.resource.cp.nodes.heat.network.contrailV2.VLANSubInterface + - org.openecomp.resource.cp.nodes.heat.network.v2.contrailV2.VLANSubInterface occurrences: - 0 - UNBOUNDED @@ -245,6 +246,7 @@ node_types: type: tosca.capabilities.network.Bindable valid_source_types: - org.openecomp.resource.cp.nodes.heat.network.contrailV2.VLANSubInterface + - org.openecomp.resource.cp.nodes.heat.network.v2.contrailV2.VLANSubInterface occurrences: - 0 - UNBOUNDED diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/heat/nested/reusenestedfrommultibase/expectedoutputfiles/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/heat/nested/reusenestedfrommultibase/expectedoutputfiles/MainServiceTemplate.yaml index 7d86e3774a..be31e6ebde 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/heat/nested/reusenestedfrommultibase/expectedoutputfiles/MainServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/heat/nested/reusenestedfrommultibase/expectedoutputfiles/MainServiceTemplate.yaml @@ -281,11 +281,6 @@ topology_template: properties: network_name: get_input: cps_net_name - requirements: - - dependency: - capability: tosca.capabilities.Node - node: server_pcm_001 - relationship: tosca.relationships.DependsOn server_pcm_003: type: org.openecomp.resource.abstract.nodes.heat.nested-pcm_v0.1 directives: @@ -336,4 +331,4 @@ topology_template: value: get_attribute: - server_pcm_002 - - oam_net_ip + - oam_net_ip
\ No newline at end of file diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/heat/nested/single/expectedoutputfiles/GlobalSubstitutionTypesServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/heat/nested/single/expectedoutputfiles/GlobalSubstitutionTypesServiceTemplate.yaml index 49b834be32..f890787ebd 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/heat/nested/single/expectedoutputfiles/GlobalSubstitutionTypesServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/heat/nested/single/expectedoutputfiles/GlobalSubstitutionTypesServiceTemplate.yaml @@ -238,6 +238,7 @@ node_types: type: tosca.capabilities.network.Bindable valid_source_types: - org.openecomp.resource.cp.nodes.heat.network.contrailV2.VLANSubInterface + - org.openecomp.resource.cp.nodes.heat.network.v2.contrailV2.VLANSubInterface occurrences: - 0 - UNBOUNDED @@ -245,6 +246,7 @@ node_types: type: tosca.capabilities.network.Bindable valid_source_types: - org.openecomp.resource.cp.nodes.heat.network.contrailV2.VLANSubInterface + - org.openecomp.resource.cp.nodes.heat.network.v2.contrailV2.VLANSubInterface occurrences: - 0 - UNBOUNDED diff --git a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/heat/nested/single/expectedoutputfiles/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/heat/nested/single/expectedoutputfiles/MainServiceTemplate.yaml index 973d8c0409..864aa08c82 100644 --- a/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/heat/nested/single/expectedoutputfiles/MainServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-translator-lib/openecomp-sdc-translator-core/src/test/resources/mock/heat/nested/single/expectedoutputfiles/MainServiceTemplate.yaml @@ -289,11 +289,6 @@ topology_template: properties: network_name: get_input: net_name - requirements: - - dependency: - capability: tosca.capabilities.Node - node: server_pcm_001 - relationship: tosca.relationships.DependsOn compute_port_0: type: org.openecomp.resource.cp.nodes.heat.network.neutron.Port properties: @@ -359,4 +354,4 @@ topology_template: value: get_attribute: - server_pcm_001 - - pcm_vol + - pcm_vol
\ No newline at end of file |