diff options
author | ojasdubey <ojas.dubey@amdocs.com> | 2018-05-07 14:33:30 +0530 |
---|---|---|
committer | Oren Kleks <orenkle@amdocs.com> | 2018-05-14 10:16:04 +0000 |
commit | 71bd1d935e56d8bac4677f840188ecb397da1b2a (patch) | |
tree | eb3a5b90fbc8072b317eeee360c66ae5d31d75d8 /openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main | |
parent | a5c4a996f58bfff602124fd4e38c0d2ec70d68f2 (diff) |
Refactored code as a part of guild week
1. Fixed static analysis issues
2. Refactored methods for code smells
Change-Id: If06c4301ca327635b6894ac07f55674b609abf68
Issue-ID: SDC-359
Signed-off-by: ojasdubey <ojas.dubey@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main')
-rw-r--r-- | openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/PortMirroringEnricher.java | 307 |
1 files changed, 156 insertions, 151 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 c8084ba9f3..6598d1a6ac 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/PortMirroringEnricher.java +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/PortMirroringEnricher.java @@ -1,40 +1,28 @@ /* -* 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. -*/ + * 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. + */ package org.openecomp.sdc.enrichment.impl.tosca; -import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.collections4.MapUtils; -import org.openecomp.core.utilities.orchestration.OnboardingTypesEnum; -import org.openecomp.sdc.datatypes.error.ErrorMessage; -import org.openecomp.sdc.enrichment.impl.tosca.model.PortMirroringConnectionPointDescription; -import org.openecomp.sdc.tosca.datatypes.ToscaNodeType; -import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel; -import org.onap.sdc.tosca.datatypes.model.Import; -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.openecomp.sdc.tosca.services.DataModelUtil; -import org.openecomp.sdc.tosca.services.ToscaConstants; -import org.openecomp.sdc.tosca.services.ToscaUtil; -import org.openecomp.sdc.translator.services.heattotosca.HeatToToscaUtil; -import org.openecomp.sdc.translator.services.heattotosca.globaltypes.GlobalTypesGenerator; +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 java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedList; @@ -45,21 +33,39 @@ import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; -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 org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.collections4.MapUtils; +import org.onap.sdc.tosca.datatypes.model.Import; +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.openecomp.core.utilities.orchestration.OnboardingTypesEnum; +import org.openecomp.sdc.datatypes.error.ErrorMessage; +import org.openecomp.sdc.enrichment.impl.tosca.model.PortMirroringConnectionPointDescription; +import org.openecomp.sdc.tosca.datatypes.ToscaNodeType; +import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel; +import org.openecomp.sdc.tosca.services.DataModelUtil; +import org.openecomp.sdc.tosca.services.ToscaConstants; +import org.openecomp.sdc.tosca.services.ToscaUtil; +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 Map<String, Map<String, NodeTemplate>> portNodeTemplates = new HashMap<>(); + 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 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 Map<String, List<String>> portNodeTemplateIdsFromAbstract = new HashMap<>(); - private Map<String, ServiceTemplate> globalTypesServiceTemplate = + 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()); + /** * Enrich tosca for port mirroring. * @@ -84,21 +90,20 @@ public class PortMirroringEnricher { } private void collectPorts(ServiceTemplate serviceTemplate) { - Map<String, NodeTemplate> nodeTemplates = - serviceTemplate.getTopology_template().getNode_templates(); - if (Objects.nonNull(nodeTemplates)) { - //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); + 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)); + + portNodeTemplates.put(ToscaUtil.getServiceTemplateFileName(serviceTemplate), + serviceTemplatePortNodeTemplates); + //Get all linked internal ports from abstract node template link requirements + collectLinkedInternalPorts(nodeTemplates); } private void collectLinkedInternalPorts(Map<String, NodeTemplate> nodeTemplates) { @@ -106,60 +111,58 @@ public class PortMirroringEnricher { for (Map.Entry<String, NodeTemplate> nodeTemplateEntry : nodeTemplates.entrySet()) { NodeTemplate nodeTemplate = nodeTemplateEntry.getValue(); if (isSubstitutableNodeTemplate(nodeTemplate)) { - List<Map<String, RequirementAssignment>> requirements = nodeTemplate.getRequirements(); - if (Objects.isNull(requirements)) { - continue; - } - - 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); - } + handleSubstitutableNodeTemplate(abstractLinkedPortNodeTemplates, nodeTemplate); } } } + 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 addInternalPortToAbstractNode(Map<String, RequirementAssignment> requirement, List<String> abstractLinkedPortNodeTemplates) { String requirementId = requirement.keySet().iterator().next(); - String abstractLinkRequirementIdPrefix = ToscaConstants.LINK_REQUIREMENT_ID + "_"; - if (requirementId.startsWith(abstractLinkRequirementIdPrefix)) { - //Collect port node template ids from the link requirement ids in the abstract - // node template - abstractLinkedPortNodeTemplates.add(requirementId.substring(requirementId - .indexOf("_") + 1)); + 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 addCollectedPortsToAbstractServiceTemplatePortMap(NodeTemplate nodeTemplate, - List<String> abstractLinkedPortNodeTemplates) { + List<String> abstractLinkedPortNodeTemplates) { String substitutionServiceTemplateName; - if (nodeTemplate.getProperties() != null) { - 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.nonNull(substitutionServiceTemplateName)) { - if (portNodeTemplateIdsFromAbstract.containsKey(substitutionServiceTemplateName)) { - List<String> portList = - portNodeTemplateIdsFromAbstract.get(substitutionServiceTemplateName); - portList.addAll(abstractLinkedPortNodeTemplates); - portNodeTemplateIdsFromAbstract.put(substitutionServiceTemplateName, portList); - } else { - portNodeTemplateIdsFromAbstract.put(substitutionServiceTemplateName, - abstractLinkedPortNodeTemplates); - } - } + 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 filterExternalPorts() { - for (Map.Entry<String, Map<String, NodeTemplate>> portNodeTemplateEntry : portNodeTemplates - .entrySet()) { + 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(); @@ -177,43 +180,32 @@ public class PortMirroringEnricher { private void updateExternalPortNodeTemplate(NodeTemplate externalPortNodeTemplate) { String currentPortNodeType = externalPortNodeTemplate.getType(); - if (currentPortNodeType.equals(ToscaNodeType.CONTRAIL_PORT)) { - //Set external contrail port node type - externalPortNodeTemplate.setType(ToscaNodeType.EXTERNAL_CONTRAIL_PORT); - } else if (currentPortNodeType.equals(ToscaNodeType.CONTRAILV2_VIRTUAL_MACHINE_INTERFACE)) { - //Set external contrail VMI port node type - externalPortNodeTemplate.setType(ToscaNodeType.EXTERNAL_VMI_PORT); - } else if (currentPortNodeType.equals(ToscaNodeType.NEUTRON_PORT)) { - //Set external neutron port node type - externalPortNodeTemplate.setType(ToscaNodeType.EXTERNAL_NEUTRON_PORT); + if (nodeTypeExternalNodeType.containsKey(currentPortNodeType)) { + externalPortNodeTemplate.setType(nodeTypeExternalNodeType.get(currentPortNodeType)); } - addPortMirroringCapability(externalPortNodeTemplate); } private void handleExternalPorts(ToscaServiceModel toscaServiceModel) { - - for (Map.Entry<String, Map<String, NodeTemplate>> entry : externalPortNodeTemplates - .entrySet()) { - String serviceTemplateName = entry.getKey(); - ServiceTemplate serviceTemplate = - toscaServiceModel.getServiceTemplates().get(serviceTemplateName); - Map<String, NodeTemplate> externalNodeTemplates = entry.getValue(); - if (MapUtils.isEmpty(externalNodeTemplates)) { + 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); + } + } - for (Map.Entry<String, NodeTemplate> externalNodeTemplate : externalNodeTemplates - .entrySet()) { - String externalPortNodeTemplateId = externalNodeTemplate.getKey(); - updateExternalPortNodeTemplate(externalNodeTemplate.getValue()); - if (serviceTemplate.getTopology_template().getSubstitution_mappings() != null) { - //Add port mirroring capability to substitution mapping for external ports - addPortMirroringSubstitutionMappingCapability(serviceTemplate, - externalPortNodeTemplateId); - } + 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()); } - addGlobalTypeImport(serviceTemplate); } } @@ -222,45 +214,50 @@ public class PortMirroringEnricher { List<String> portMirroringCapability = new LinkedList<>(); portMirroringCapability.add(externalPortNodeTemplateId); portMirroringCapability.add(PORT_MIRRORING_CAPABILITY_ID); - String substitutionMappingCapabilityId = PORT_MIRRORING_CAPABILITY_ID + "_" - + externalPortNodeTemplateId; + 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(); - //Get Network role property + PortMirroringConnectionPointDescription connectionPoint = new PortMirroringConnectionPointDescription(); if (Objects.nonNull(portNodeTemplate.getProperties())) { - Object networkRolePropertyValue = - portNodeTemplate.getProperties().get(ToscaConstants.PORT_NETWORK_ROLE_PROPERTY_NAME); - if (Objects.nonNull(networkRolePropertyValue)) { - Object portMirroringNetworkRolePropertyVal = getClonedObject(networkRolePropertyValue); - connectionPoint.setNetwork_role(portMirroringNetworkRolePropertyVal); - } + setConnectionPointNetworkRole(portNodeTemplate, connectionPoint); } - //Get NFC_Type from the binding requirement node if (Objects.nonNull(portNodeTemplate.getRequirements())) { - 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); - } + setConnectionPointNfcType(portNodeTemplate, connectionPoint); } - if (!connectionPoint.isEmpty()) { - portMirroringCapabilityProperties.put(PORT_MIRRORING_CAPABILITY_CP_PROPERTY_NAME, - connectionPoint); + portMirroringCapabilityProperties.put(PORT_MIRRORING_CAPABILITY_CP_PROPERTY_NAME, connectionPoint); DataModelUtil.addNodeTemplateCapability(portNodeTemplate, PORT_MIRRORING_CAPABILITY_ID, portMirroringCapabilityProperties, null); } } + 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 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 addGlobalTypeImport(ServiceTemplate serviceTemplate) { List<Map<String, Import>> imports = serviceTemplate.getImports(); Map<String, Import> openecompIndexImport = new HashMap<>(); @@ -273,8 +270,7 @@ public class PortMirroringEnricher { 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); + return Objects.nonNull(nodeType) && portNodeTypes.contains(nodeType); } private Set<String> getPortNodeTypes() { @@ -286,7 +282,7 @@ public class PortMirroringEnricher { private boolean isSubstitutableNodeTemplate(NodeTemplate nodeTemplate) { return Objects.nonNull(nodeTemplate.getDirectives()) && nodeTemplate.getDirectives() - .contains(ToscaConstants.NODE_TEMPLATE_DIRECTIVE_SUBSTITUTABLE); + .contains(ToscaConstants.NODE_TEMPLATE_DIRECTIVE_SUBSTITUTABLE); } private boolean isInternalPort(String serviceTemplateFileName, String nodeTemplateId, @@ -305,14 +301,23 @@ public class PortMirroringEnricher { private boolean isConcreteInternalPort(NodeTemplate nodeTemplate) { //Check if node template contains a link requirement List<Map<String, RequirementAssignment>> requirements = nodeTemplate.getRequirements(); - if (Objects.nonNull(requirements)) { - for (Map<String, RequirementAssignment> requirement : requirements) { - String requirementId = requirement.keySet().iterator().next(); - if (requirementId.equals(ToscaConstants.LINK_REQUIREMENT_ID)) { - return true; - } + 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; } + + 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; + } } |