From 5a3d729a49c1a62b0fef9530753c51e598a64c1f Mon Sep 17 00:00:00 2001 From: siddharth0905 Date: Wed, 28 Feb 2018 17:41:34 +0530 Subject: Code change to support new global type Code change to support new global type for VMI port Change-Id: I30427a8ec784c8d314c3df0e34178587dda0351c Issue-ID: SDC-1070 Signed-off-by: siddharth0905 --- .../impl/tosca/PortMirroringEnricher.java | 186 +++++++++------------ .../out/Nested_pd_serverServiceTemplate.yaml | 32 +--- .../out/Nested_pd_server_1ServiceTemplate.yaml | 32 +--- .../out/Nested_pd_server_3ServiceTemplate.yaml | 32 +--- .../out/Nested_pd_server_4ServiceTemplate.yaml | 32 +--- .../out/Nested_pd_server_6ServiceTemplate.yaml | 32 +--- .../out/Nested_computeServiceTemplate.yaml | 16 +- .../out/Nested_pd_serverServiceTemplate.yaml | 20 +-- .../diffPortType/out/MainServiceTemplate.yaml | 29 +++- .../out/Nested_pd_serverServiceTemplate.yaml | 20 +-- .../samePortType/out/MainServiceTemplate.yaml | 29 +++- .../out/Nested_pd_serverServiceTemplate.yaml | 20 +-- .../sdc/tosca/datatypes/ToscaNodeType.java | 2 + 13 files changed, 225 insertions(+), 257 deletions(-) (limited to 'openecomp-be/lib') 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 629868cb3a..eddbec3116 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,18 +1,18 @@ /* - * Copyright © 2016-2017 European Support Limited - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +* 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; @@ -21,21 +21,15 @@ 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.ToscaElementTypes; import org.openecomp.sdc.tosca.datatypes.ToscaNodeType; import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel; -import org.openecomp.sdc.tosca.datatypes.model.CapabilityAssignment; import org.openecomp.sdc.tosca.datatypes.model.Import; import org.openecomp.sdc.tosca.datatypes.model.NodeTemplate; -import org.openecomp.sdc.tosca.datatypes.model.NodeType; -import org.openecomp.sdc.tosca.datatypes.model.PropertyDefinition; import org.openecomp.sdc.tosca.datatypes.model.RequirementAssignment; import org.openecomp.sdc.tosca.datatypes.model.ServiceTemplate; import org.openecomp.sdc.tosca.services.DataModelUtil; -import org.openecomp.sdc.tosca.services.ToscaAnalyzerService; import org.openecomp.sdc.tosca.services.ToscaConstants; import org.openecomp.sdc.tosca.services.ToscaUtil; -import org.openecomp.sdc.tosca.services.impl.ToscaAnalyzerServiceImpl; import org.openecomp.sdc.translator.services.heattotosca.HeatToToscaUtil; import org.openecomp.sdc.translator.services.heattotosca.globaltypes.GlobalTypesGenerator; @@ -83,7 +77,7 @@ public class PortMirroringEnricher { //Collect all the ports across all the service templates collectPorts(serviceTemplateEntry.getValue())); //Collect External ports from the list of all ports collected above - filterExternalPorts(toscaServiceModel); + filterExternalPorts(); //Handle external port changes handleExternalPorts(toscaServiceModel); return errors; @@ -97,44 +91,53 @@ public class PortMirroringEnricher { Map serviceTemplatePortNodeTemplates = nodeTemplates.entrySet().stream() .filter(nodeTemplateEntry -> (Objects.nonNull(nodeTemplateEntry.getValue())) && (isPortNodeTemplate(nodeTemplateEntry.getValue().getType()))) - .collect(Collectors.toMap(nodeTemplateEntry -> nodeTemplateEntry.getKey(), - nodeTemplateEntry -> nodeTemplateEntry.getValue())); + .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 - List abstractLinkedPortNodeTemplates = new ArrayList<>(); - for (Map.Entry nodeTemplateEntry : nodeTemplates.entrySet()) { - NodeTemplate nodeTemplate = nodeTemplateEntry.getValue(); - if (isSubstitutableNodeTemplate(nodeTemplate)) { - List> requirements = nodeTemplate.getRequirements(); - if (Objects.nonNull(requirements)) { - for (Map requirement : requirements) { - 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 (CollectionUtils.isNotEmpty(abstractLinkedPortNodeTemplates)) { - //Populate a map of the substitution service templates and list of internal ports - addCollectedPortsToAbstractServiceTemplatePortMap(nodeTemplate, - abstractLinkedPortNodeTemplates); - } + collectLinkedInternalPorts(nodeTemplates); + } + } + + private void collectLinkedInternalPorts(Map nodeTemplates) { + List abstractLinkedPortNodeTemplates = new ArrayList<>(); + for (Map.Entry nodeTemplateEntry : nodeTemplates.entrySet()) { + NodeTemplate nodeTemplate = nodeTemplateEntry.getValue(); + if (isSubstitutableNodeTemplate(nodeTemplate)) { + List> 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 requirement, + List 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)); + } + } + private void addCollectedPortsToAbstractServiceTemplatePortMap(NodeTemplate nodeTemplate, - List - abstractLinkedPortNodeTemplates) { - String substitutionServiceTemplateName = null; + List abstractLinkedPortNodeTemplates) { + String substitutionServiceTemplateName; if (nodeTemplate.getProperties() != null) { Map serviceTemplateFilter = (Map) nodeTemplate.getProperties() .get(ToscaConstants.SERVICE_TEMPLATE_FILTER_PROPERTY_NAME); @@ -154,7 +157,7 @@ public class PortMirroringEnricher { } } - private void filterExternalPorts(ToscaServiceModel toscaServiceModel) { + private void filterExternalPorts() { for (Map.Entry> portNodeTemplateEntry : portNodeTemplates .entrySet()) { Map externalPorts = new HashMap<>(); @@ -163,7 +166,6 @@ public class PortMirroringEnricher { for (Map.Entry portNodeTemplate : portNodeTemplateMap.entrySet()) { String nodeTemplateId = portNodeTemplate.getKey(); NodeTemplate nodeTemplate = portNodeTemplate.getValue(); - String newPortNodeType = nodeTemplate.getType(); if (!isInternalPort(serviceTemplateFileName, nodeTemplateId, nodeTemplate)) { //External Port externalPorts.putIfAbsent(nodeTemplateId, nodeTemplate); @@ -173,19 +175,20 @@ public class PortMirroringEnricher { } } - private void updateExternalPortNodeTemplate(NodeTemplate externalPortNodeTemplate, - ToscaServiceModel toscaServiceModel) { + private void updateExternalPortNodeTemplate(NodeTemplate externalPortNodeTemplate) { String currentPortNodeType = externalPortNodeTemplate.getType(); - if (currentPortNodeType.equals(ToscaNodeType.CONTRAIL_PORT) - || currentPortNodeType.equals(ToscaNodeType.CONTRAILV2_VIRTUAL_MACHINE_INTERFACE)) { + if (currentPortNodeType.equals(ToscaNodeType.CONTRAIL_PORT)) { //Set external contrail port node type externalPortNodeTemplate.setType(ToscaNodeType.EXTERNAL_CONTRAIL_PORT); - addPortMirroringCapability(externalPortNodeTemplate); + } 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); - addPortMirroringCapability(externalPortNodeTemplate); } + + addPortMirroringCapability(externalPortNodeTemplate); } private void handleExternalPorts(ToscaServiceModel toscaServiceModel) { @@ -196,53 +199,22 @@ public class PortMirroringEnricher { ServiceTemplate serviceTemplate = toscaServiceModel.getServiceTemplates().get(serviceTemplateName); Map externalNodeTemplates = entry.getValue(); - if (MapUtils.isNotEmpty(externalNodeTemplates)) { - for (Map.Entry externalNodeTemplate : externalNodeTemplates - .entrySet()) { - String externalPortNodeTemplateId = externalNodeTemplate.getKey(); - updateExternalPortNodeTemplate(externalNodeTemplate.getValue(), toscaServiceModel); - if (serviceTemplate.getTopology_template().getSubstitution_mappings() != null) { - //Add port mirroring capability to substitution mapping for external ports - addPortMirroringSubstitutionMappingCapability(serviceTemplate, - externalPortNodeTemplateId); - } - handleExternalPortProperties(externalNodeTemplate.getValue(), serviceTemplate, toscaServiceModel); - } - addGlobalTypeImport(serviceTemplate); + if (MapUtils.isEmpty(externalNodeTemplates)) { + return; } - } - } - private void handleExternalPortProperties(NodeTemplate portNodeTemplate, - ServiceTemplate serviceTemplate, - ToscaServiceModel toscaServiceModel){ - - ToscaAnalyzerService toscaAnalyzerService = new ToscaAnalyzerServiceImpl(); - String externalPortType = portNodeTemplate.getType(); - Map globalTypesportProperties = new HashMap<>(); - NodeType flatNodeType = - (NodeType) toscaAnalyzerService.getFlatEntity(ToscaElementTypes.NODE_TYPE, externalPortType, serviceTemplate, toscaServiceModel); - globalTypesportProperties.putAll(flatNodeType.getProperties()); - - Map properties = portNodeTemplate.getProperties(); - Map filteredProperties = new HashMap<>(); - - if(MapUtils.isEmpty(properties)){ - return; - } - - for(Map.Entry propertyEntry: properties.entrySet()){ - if(globalTypesportProperties.containsKey(propertyEntry.getKey())){ - filteredProperties.put(propertyEntry.getKey(), propertyEntry.getValue()); + for (Map.Entry 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); + } } + addGlobalTypeImport(serviceTemplate); } - - if(!MapUtils.isEmpty(filteredProperties)) { - portNodeTemplate.setProperties(filteredProperties); - }else{ - portNodeTemplate.setProperties(null); - } - } private void addPortMirroringSubstitutionMappingCapability(ServiceTemplate serviceTemplate, @@ -305,18 +277,16 @@ public class PortMirroringEnricher { && portNodeTypes.contains(nodeType); } - private Set getPortNodeTypes(){ + private Set getPortNodeTypes() { return new HashSet<>(Arrays.asList(ToscaNodeType.NEUTRON_PORT, ToscaNodeType.CONTRAILV2_VIRTUAL_MACHINE_INTERFACE, ToscaNodeType.CONTRAIL_PORT)); } private boolean isSubstitutableNodeTemplate(NodeTemplate nodeTemplate) { - if (Objects.nonNull(nodeTemplate.getDirectives())) { - return nodeTemplate.getDirectives().contains(ToscaConstants - .NODE_TEMPLATE_DIRECTIVE_SUBSTITUTABLE); - } - return false; + return Objects.nonNull(nodeTemplate.getDirectives()) + && nodeTemplate.getDirectives() + .contains(ToscaConstants.NODE_TEMPLATE_DIRECTIVE_SUBSTITUTABLE); } private boolean isInternalPort(String serviceTemplateFileName, String nodeTemplateId, @@ -327,10 +297,8 @@ public class PortMirroringEnricher { private boolean isAbstractInternalPort(String serviceTemplateFileName, String nodeTemplateId) { //Check if port corresponds to an abstract internal port - if (portNodeTemplateIdsFromAbstract.containsKey(serviceTemplateFileName)) { - return portNodeTemplateIdsFromAbstract.get(serviceTemplateFileName).contains(nodeTemplateId); - } - return false; + return portNodeTemplateIdsFromAbstract.containsKey(serviceTemplateFileName) + && portNodeTemplateIdsFromAbstract.get(serviceTemplateFileName).contains(nodeTemplateId); } diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/multiLevel/out/Nested_pd_serverServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/multiLevel/out/Nested_pd_serverServiceTemplate.yaml index 1cee498cd2..796b811eb4 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/multiLevel/out/Nested_pd_serverServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/multiLevel/out/Nested_pd_serverServiceTemplate.yaml @@ -6,8 +6,6 @@ imports: file: openecomp-heat/_index.yml - GlobalSubstitutionTypes: file: GlobalSubstitutionTypesServiceTemplate.yaml -- openecomp_index: - file: openecomp/_index.yml node_types: org.openecomp.resource.vfc.nodes.heat.pd_server: derived_from: org.openecomp.resource.vfc.nodes.heat.nova.Server @@ -95,24 +93,24 @@ topology_template: - compute_pd_server_user_data_format - index_value pd_server_pd02_port: - type: org.openecomp.resource.cp.v2.extNeutronCP + type: org.openecomp.resource.cp.nodes.heat.network.neutron.Port properties: - ip_requirements: - get_input: port_pd02_port_ip_requirements - network_role: - get_input: port_pd02_port_network_role - subnetpoolid: - get_input: port_pd02_port_subnetpoolid - mac_requirements: - get_input: port_pd02_port_mac_requirements exCP_naming: get_input: port_pd02_port_exCP_naming vlan_requirements: get_input: port_pd02_port_vlan_requirements + ip_requirements: + get_input: port_pd02_port_ip_requirements network_role_tag: get_input: port_pd02_port_network_role_tag + mac_requirements: + get_input: port_pd02_port_mac_requirements order: get_input: port_pd02_port_order + network_role: + get_input: port_pd02_port_network_role + subnetpoolid: + get_input: port_pd02_port_subnetpoolid network: get_input: - port_pd02_port_network @@ -122,15 +120,6 @@ topology_template: capability: tosca.capabilities.network.Bindable node: pd_server relationship: tosca.relationships.network.BindsTo - capabilities: - port_mirroring: - properties: - connection_point: - nf_type: '' - nfc_type: pd_server - network_role: - get_input: port_pd02_port_network_role - pps_capacity: '' substitution_mappings: node_type: org.openecomp.resource.abstract.nodes.pd_server capabilities: @@ -290,9 +279,6 @@ topology_template: network.incoming.bytes_pd_server_pd02_port: - pd_server_pd02_port - network.incoming.bytes - port_mirroring_pd_server_pd02_port: - - pd_server_pd02_port - - port_mirroring requirements: local_storage_pd_server: - pd_server diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/multiLevel/out/Nested_pd_server_1ServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/multiLevel/out/Nested_pd_server_1ServiceTemplate.yaml index 9722ffec88..a6d8533b57 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/multiLevel/out/Nested_pd_server_1ServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/multiLevel/out/Nested_pd_server_1ServiceTemplate.yaml @@ -6,8 +6,6 @@ imports: file: openecomp-heat/_index.yml - GlobalSubstitutionTypes: file: GlobalSubstitutionTypesServiceTemplate.yaml -- openecomp_index: - file: openecomp/_index.yml node_types: org.openecomp.resource.vfc.nodes.heat.pd_server: derived_from: org.openecomp.resource.vfc.nodes.heat.nova.Server @@ -95,24 +93,24 @@ topology_template: - compute_pd_server_user_data_format - index_value pd_server_pd01_port: - type: org.openecomp.resource.cp.v2.extNeutronCP + type: org.openecomp.resource.cp.nodes.heat.network.neutron.Port properties: - ip_requirements: - get_input: port_pd01_port_ip_requirements - network_role: - get_input: port_pd01_port_network_role - subnetpoolid: - get_input: port_pd01_port_subnetpoolid - mac_requirements: - get_input: port_pd01_port_mac_requirements exCP_naming: get_input: port_pd01_port_exCP_naming vlan_requirements: get_input: port_pd01_port_vlan_requirements + ip_requirements: + get_input: port_pd01_port_ip_requirements network_role_tag: get_input: port_pd01_port_network_role_tag + mac_requirements: + get_input: port_pd01_port_mac_requirements order: get_input: port_pd01_port_order + network_role: + get_input: port_pd01_port_network_role + subnetpoolid: + get_input: port_pd01_port_subnetpoolid network: get_input: - port_pd01_port_network @@ -122,15 +120,6 @@ topology_template: capability: tosca.capabilities.network.Bindable node: pd_server relationship: tosca.relationships.network.BindsTo - capabilities: - port_mirroring: - properties: - connection_point: - nf_type: '' - nfc_type: pd_server - network_role: - get_input: port_pd01_port_network_role - pps_capacity: '' substitution_mappings: node_type: org.openecomp.resource.abstract.nodes.pd_server_1 capabilities: @@ -290,9 +279,6 @@ topology_template: disk.device.iops_pd_server: - pd_server - disk.device.iops - port_mirroring_pd_server_pd01_port: - - pd_server_pd01_port - - port_mirroring requirements: local_storage_pd_server: - pd_server diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/multiLevel/out/Nested_pd_server_3ServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/multiLevel/out/Nested_pd_server_3ServiceTemplate.yaml index 4d98183c51..9f140e097e 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/multiLevel/out/Nested_pd_server_3ServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/multiLevel/out/Nested_pd_server_3ServiceTemplate.yaml @@ -6,8 +6,6 @@ imports: file: openecomp-heat/_index.yml - GlobalSubstitutionTypes: file: GlobalSubstitutionTypesServiceTemplate.yaml -- openecomp_index: - file: openecomp/_index.yml node_types: org.openecomp.resource.vfc.nodes.heat.pd_server: derived_from: org.openecomp.resource.vfc.nodes.heat.nova.Server @@ -95,24 +93,24 @@ topology_template: - compute_pd_server_user_data_format - index_value pd_server_pd01_port: - type: org.openecomp.resource.cp.v2.extNeutronCP + type: org.openecomp.resource.cp.nodes.heat.network.neutron.Port properties: - ip_requirements: - get_input: port_pd01_port_ip_requirements - network_role: - get_input: port_pd01_port_network_role - subnetpoolid: - get_input: port_pd01_port_subnetpoolid - mac_requirements: - get_input: port_pd01_port_mac_requirements exCP_naming: get_input: port_pd01_port_exCP_naming vlan_requirements: get_input: port_pd01_port_vlan_requirements + ip_requirements: + get_input: port_pd01_port_ip_requirements network_role_tag: get_input: port_pd01_port_network_role_tag + mac_requirements: + get_input: port_pd01_port_mac_requirements order: get_input: port_pd01_port_order + network_role: + get_input: port_pd01_port_network_role + subnetpoolid: + get_input: port_pd01_port_subnetpoolid network: get_input: - port_pd01_port_network @@ -122,15 +120,6 @@ topology_template: capability: tosca.capabilities.network.Bindable node: pd_server relationship: tosca.relationships.network.BindsTo - capabilities: - port_mirroring: - properties: - connection_point: - nf_type: '' - nfc_type: pd_server - network_role: - get_input: port_pd01_port_network_role - pps_capacity: '' substitution_mappings: node_type: org.openecomp.resource.abstract.nodes.pd_server_3 capabilities: @@ -290,9 +279,6 @@ topology_template: disk.device.iops_pd_server: - pd_server - disk.device.iops - port_mirroring_pd_server_pd01_port: - - pd_server_pd01_port - - port_mirroring requirements: local_storage_pd_server: - pd_server diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/multiLevel/out/Nested_pd_server_4ServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/multiLevel/out/Nested_pd_server_4ServiceTemplate.yaml index 44f068ba31..0022b21c24 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/multiLevel/out/Nested_pd_server_4ServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/multiLevel/out/Nested_pd_server_4ServiceTemplate.yaml @@ -6,8 +6,6 @@ imports: file: openecomp-heat/_index.yml - GlobalSubstitutionTypes: file: GlobalSubstitutionTypesServiceTemplate.yaml -- openecomp_index: - file: openecomp/_index.yml node_types: org.openecomp.resource.vfc.nodes.heat.pd_server: derived_from: org.openecomp.resource.vfc.nodes.heat.nova.Server @@ -95,24 +93,24 @@ topology_template: - compute_pd_server_user_data_format - index_value pd_server_ps02_port: - type: org.openecomp.resource.cp.v2.extNeutronCP + type: org.openecomp.resource.cp.nodes.heat.network.neutron.Port properties: - ip_requirements: - get_input: port_ps02_port_ip_requirements - network_role: - get_input: port_ps02_port_network_role - subnetpoolid: - get_input: port_ps02_port_subnetpoolid - mac_requirements: - get_input: port_ps02_port_mac_requirements exCP_naming: get_input: port_ps02_port_exCP_naming vlan_requirements: get_input: port_ps02_port_vlan_requirements + ip_requirements: + get_input: port_ps02_port_ip_requirements network_role_tag: get_input: port_ps02_port_network_role_tag + mac_requirements: + get_input: port_ps02_port_mac_requirements order: get_input: port_ps02_port_order + network_role: + get_input: port_ps02_port_network_role + subnetpoolid: + get_input: port_ps02_port_subnetpoolid network: get_input: - port_ps02_port_network @@ -122,15 +120,6 @@ topology_template: capability: tosca.capabilities.network.Bindable node: pd_server relationship: tosca.relationships.network.BindsTo - capabilities: - port_mirroring: - properties: - connection_point: - nf_type: '' - nfc_type: pd_server - network_role: - get_input: port_ps02_port_network_role - pps_capacity: '' substitution_mappings: node_type: org.openecomp.resource.abstract.nodes.pd_server_4 capabilities: @@ -290,9 +279,6 @@ topology_template: disk.device.iops_pd_server: - pd_server - disk.device.iops - port_mirroring_pd_server_ps02_port: - - pd_server_ps02_port - - port_mirroring requirements: local_storage_pd_server: - pd_server diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/multiLevel/out/Nested_pd_server_6ServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/multiLevel/out/Nested_pd_server_6ServiceTemplate.yaml index 4750ccc1f2..653d1b6454 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/multiLevel/out/Nested_pd_server_6ServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/multiLevel/out/Nested_pd_server_6ServiceTemplate.yaml @@ -6,8 +6,6 @@ imports: file: openecomp-heat/_index.yml - GlobalSubstitutionTypes: file: GlobalSubstitutionTypesServiceTemplate.yaml -- openecomp_index: - file: openecomp/_index.yml node_types: org.openecomp.resource.vfc.nodes.heat.pd_server: derived_from: org.openecomp.resource.vfc.nodes.heat.nova.Server @@ -95,24 +93,24 @@ topology_template: - compute_pd_server_user_data_format - index_value pd_server_pd02_port: - type: org.openecomp.resource.cp.v2.extNeutronCP + type: org.openecomp.resource.cp.nodes.heat.network.neutron.Port properties: - ip_requirements: - get_input: port_pd02_port_ip_requirements - network_role: - get_input: port_pd02_port_network_role - subnetpoolid: - get_input: port_pd02_port_subnetpoolid - mac_requirements: - get_input: port_pd02_port_mac_requirements exCP_naming: get_input: port_pd02_port_exCP_naming vlan_requirements: get_input: port_pd02_port_vlan_requirements + ip_requirements: + get_input: port_pd02_port_ip_requirements network_role_tag: get_input: port_pd02_port_network_role_tag + mac_requirements: + get_input: port_pd02_port_mac_requirements order: get_input: port_pd02_port_order + network_role: + get_input: port_pd02_port_network_role + subnetpoolid: + get_input: port_pd02_port_subnetpoolid network: get_input: - port_pd02_port_network @@ -122,15 +120,6 @@ topology_template: capability: tosca.capabilities.network.Bindable node: pd_server relationship: tosca.relationships.network.BindsTo - capabilities: - port_mirroring: - properties: - connection_point: - nf_type: '' - nfc_type: pd_server - network_role: - get_input: port_pd02_port_network_role - pps_capacity: '' substitution_mappings: node_type: org.openecomp.resource.abstract.nodes.pd_server_6 capabilities: @@ -290,9 +279,6 @@ topology_template: network.incoming.bytes_pd_server_pd02_port: - pd_server_pd02_port - network.incoming.bytes - port_mirroring_pd_server_pd02_port: - - pd_server_pd02_port - - port_mirroring requirements: local_storage_pd_server: - pd_server diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/oneLevel/out/Nested_computeServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/oneLevel/out/Nested_computeServiceTemplate.yaml index 7a9311c041..65e0231a73 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/oneLevel/out/Nested_computeServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/nested/oneLevel/out/Nested_computeServiceTemplate.yaml @@ -6,6 +6,8 @@ imports: file: openecomp-heat/_index.yml - GlobalSubstitutionTypes: file: GlobalSubstitutionTypesServiceTemplate.yaml +- openecomp_index: + file: openecomp/_index.yml node_types: org.openecomp.resource.vfc.nodes.heat.compute: derived_from: org.openecomp.resource.vfc.nodes.heat.nova.Server @@ -111,7 +113,7 @@ topology_template: - compute_compute_user_data_format - index_value compute_compute_port: - type: org.openecomp.resource.cp.nodes.heat.network.neutron.Port + type: org.openecomp.resource.cp.v2.extNeutronCP properties: exCP_naming: get_input: port_compute_port_exCP_naming @@ -138,6 +140,15 @@ topology_template: capability: tosca.capabilities.network.Bindable node: compute relationship: tosca.relationships.network.BindsTo + capabilities: + port_mirroring: + properties: + connection_point: + nf_type: '' + nfc_type: compute + network_role: + get_input: port_compute_port_network_role + pps_capacity: '' substitution_mappings: node_type: org.openecomp.resource.abstract.nodes.compute capabilities: @@ -297,6 +308,9 @@ topology_template: disk.device.allocation_compute: - compute - disk.device.allocation + port_mirroring_compute_compute_port: + - compute_compute_port + - port_mirroring requirements: local_storage_compute: - compute diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/scalingInstance/out/Nested_pd_serverServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/scalingInstance/out/Nested_pd_serverServiceTemplate.yaml index 0f80630051..b0a2f1668d 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/scalingInstance/out/Nested_pd_serverServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/scalingInstance/out/Nested_pd_serverServiceTemplate.yaml @@ -167,26 +167,26 @@ topology_template: pd_server_pd02_port: type: org.openecomp.resource.cp.v2.extNeutronCP properties: + exCP_naming: + get_input: port_pd02_port_exCP_naming replacement_policy: get_input: - port_pd02_port_replacement_policy - index_value - ip_requirements: - get_input: port_pd02_port_ip_requirements - network_role: - get_input: port_pd02_port_network_role - subnetpoolid: - get_input: port_pd02_port_subnetpoolid - mac_requirements: - get_input: port_pd02_port_mac_requirements - exCP_naming: - get_input: port_pd02_port_exCP_naming vlan_requirements: get_input: port_pd02_port_vlan_requirements + ip_requirements: + get_input: port_pd02_port_ip_requirements network_role_tag: get_input: port_pd02_port_network_role_tag + mac_requirements: + get_input: port_pd02_port_mac_requirements order: get_input: port_pd02_port_order + network_role: + get_input: port_pd02_port_network_role + subnetpoolid: + get_input: port_pd02_port_subnetpoolid requirements: - binding: capability: tosca.capabilities.network.Bindable diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/singleSubstitution/diffPortType/out/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/singleSubstitution/diffPortType/out/MainServiceTemplate.yaml index 8fd8b17b55..dea55c7b77 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/singleSubstitution/diffPortType/out/MainServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/singleSubstitution/diffPortType/out/MainServiceTemplate.yaml @@ -285,7 +285,34 @@ topology_template: network_role: '' pps_capacity: '' template_VMInt_OAM_lb_external_VMI: - type: org.openecomp.resource.cp.v2.extContrailCP + type: org.openecomp.resource.cp.v2.extVirtualMachineInterfaceCP + properties: + name: template_VMInt_OAM_lb_NAME + security_group_refs: + - get_input: oam_sec_group_name + virtual_machine_interface_properties: + service_interface_type: + get_input: lb_st_interface_type_oam + port_tuple_refs: + - get_input: template_PortTuple_LB1 + virtual_machine_interface_allowed_address_pairs: + allowed_address_pair: + - address_mode: active-standby + ip: + ip_prefix: + get_input: virtual_ip_address + ip_prefix_len: 32 + mac: + get_input: mac_address + - address_mode: active-standby + ip: + ip_prefix: + get_input: virtual_ipv6_address + ip_prefix_len: 128 + mac: + get_input: mac_address + virtual_machine_interface_mac_addresses: + - get_input: mac_address capabilities: port_mirroring: properties: diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/singleSubstitution/diffPortType/out/Nested_pd_serverServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/singleSubstitution/diffPortType/out/Nested_pd_serverServiceTemplate.yaml index 1c327d212e..f80a037197 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/singleSubstitution/diffPortType/out/Nested_pd_serverServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/singleSubstitution/diffPortType/out/Nested_pd_serverServiceTemplate.yaml @@ -357,26 +357,26 @@ topology_template: pd_server_pd03_port: type: org.openecomp.resource.cp.v2.extNeutronCP properties: + exCP_naming: + get_input: port_pd03_port_exCP_naming replacement_policy: get_input: - port_pd03_port_replacement_policy - index_value - ip_requirements: - get_input: port_pd03_port_ip_requirements - network_role: - get_input: port_pd03_port_network_role - subnetpoolid: - get_input: port_pd03_port_subnetpoolid - mac_requirements: - get_input: port_pd03_port_mac_requirements - exCP_naming: - get_input: port_pd03_port_exCP_naming vlan_requirements: get_input: port_pd03_port_vlan_requirements + ip_requirements: + get_input: port_pd03_port_ip_requirements network_role_tag: get_input: port_pd03_port_network_role_tag + mac_requirements: + get_input: port_pd03_port_mac_requirements order: get_input: port_pd03_port_order + network_role: + get_input: port_pd03_port_network_role + subnetpoolid: + get_input: port_pd03_port_subnetpoolid requirements: - binding: capability: tosca.capabilities.network.Bindable diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/singleSubstitution/samePortType/out/MainServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/singleSubstitution/samePortType/out/MainServiceTemplate.yaml index 8a030f4628..3a697467c9 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/singleSubstitution/samePortType/out/MainServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/singleSubstitution/samePortType/out/MainServiceTemplate.yaml @@ -264,7 +264,34 @@ topology_template: node: pd01_volume relationship: pd01_volume_attachment template_VMInt_OAM_lb_external_VMI: - type: org.openecomp.resource.cp.v2.extContrailCP + type: org.openecomp.resource.cp.v2.extVirtualMachineInterfaceCP + properties: + name: template_VMInt_OAM_lb_NAME + security_group_refs: + - get_input: oam_sec_group_name + virtual_machine_interface_properties: + service_interface_type: + get_input: lb_st_interface_type_oam + port_tuple_refs: + - get_input: template_PortTuple_LB1 + virtual_machine_interface_allowed_address_pairs: + allowed_address_pair: + - address_mode: active-standby + ip: + ip_prefix: + get_input: virtual_ip_address + ip_prefix_len: 32 + mac: + get_input: mac_address + - address_mode: active-standby + ip: + ip_prefix: + get_input: virtual_ipv6_address + ip_prefix_len: 128 + mac: + get_input: mac_address + virtual_machine_interface_mac_addresses: + - get_input: mac_address capabilities: port_mirroring: properties: diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/singleSubstitution/samePortType/out/Nested_pd_serverServiceTemplate.yaml b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/singleSubstitution/samePortType/out/Nested_pd_serverServiceTemplate.yaml index 4cd5cd0894..567b020dd4 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/singleSubstitution/samePortType/out/Nested_pd_serverServiceTemplate.yaml +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/test/resources/mock/enrichPortMirroring/singleSubstitution/samePortType/out/Nested_pd_serverServiceTemplate.yaml @@ -241,26 +241,26 @@ topology_template: pd_server_pd01_port_2: type: org.openecomp.resource.cp.v2.extNeutronCP properties: + exCP_naming: + get_input: port_pd01_port_2_exCP_naming replacement_policy: get_input: - port_pd01_port_2_replacement_policy - index_value - ip_requirements: - get_input: port_pd01_port_2_ip_requirements - network_role: - get_input: port_pd01_port_2_network_role - subnetpoolid: - get_input: port_pd01_port_2_subnetpoolid - mac_requirements: - get_input: port_pd01_port_2_mac_requirements - exCP_naming: - get_input: port_pd01_port_2_exCP_naming vlan_requirements: get_input: port_pd01_port_2_vlan_requirements + ip_requirements: + get_input: port_pd01_port_2_ip_requirements network_role_tag: get_input: port_pd01_port_2_network_role_tag + mac_requirements: + get_input: port_pd01_port_2_mac_requirements order: get_input: port_pd01_port_2_order + network_role: + get_input: port_pd01_port_2_network_role + subnetpoolid: + get_input: port_pd01_port_2_subnetpoolid requirements: - binding: capability: tosca.capabilities.network.Bindable diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaNodeType.java b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaNodeType.java index 79fba798a4..91a33ed9f7 100644 --- a/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaNodeType.java +++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/java/org/openecomp/sdc/tosca/datatypes/ToscaNodeType.java @@ -82,6 +82,8 @@ public class ToscaNodeType { public static final String EXTERNAL_CP = EXTERNAL_CP_NODE_TYPE_PREFIX + "extCP"; public static final String EXTERNAL_CONTRAIL_PORT = EXTERNAL_CP_NODE_TYPE_PREFIX + "extContrailCP"; + public static final String EXTERNAL_VMI_PORT = EXTERNAL_CP_NODE_TYPE_PREFIX + + "extVirtualMachineInterfaceCP"; public static final String EXTERNAL_NEUTRON_PORT = EXTERNAL_CP_NODE_TYPE_PREFIX + "extNeutronCP"; public static final String ABSTRACT_SUBSTITUTE = ABSTRACT_NODE_TYPE_PREFIX + "AbstractSubstitute"; -- cgit 1.2.3-korg