diff options
author | Vitaly Emporopulo <Vitaliy.Emporopulo@amdocs.com> | 2017-09-25 09:12:20 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2017-09-25 09:12:20 +0000 |
commit | d73e31e7ad477739d34f56a0484acce844338cc4 (patch) | |
tree | 3ccf18d105e66e3cd9bf618f92060d2b141c2e7c | |
parent | 700b3ef4a004cfa2cdec4c75994695943149c2fb (diff) | |
parent | 31b2ced9ebad2ef143b1892152997dc23c935a5c (diff) |
Merge "Add property"
2 files changed, 25 insertions, 21 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 130590cbb3..9eeabebe6c 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 @@ -50,21 +50,21 @@ public class PortMirroringEnricher { * @param toscaServiceModel the tosca service model * @return the map Error descriptor map */ - public Map<String,List<ErrorMessage>> enrich(ToscaServiceModel toscaServiceModel) { + public Map<String, List<ErrorMessage>> enrich(ToscaServiceModel toscaServiceModel) { mdcDataDebugMessage.debugEntryMessage(null); 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(toscaServiceModel); - //Handle external port changes - handleExternalPorts(toscaServiceModel); + 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(toscaServiceModel); + //Handle external port changes + handleExternalPorts(toscaServiceModel); mdcDataDebugMessage.debugExitMessage(null); return errors; } @@ -192,30 +192,33 @@ public class PortMirroringEnricher { } } - private void handleExternalPortProperties(NodeTemplate portNodeTemplate){ + private void handleExternalPortProperties(NodeTemplate portNodeTemplate) { ServiceTemplate serviceTemplate = globalTypesServiceTemplate.get("openecomp/nodes.yml"); String externalPortType = portNodeTemplate.getType(); Map<String, PropertyDefinition> globalTypesportProperties = new HashMap<>(); - globalTypesportProperties.putAll(serviceTemplate.getNode_types().get("org.openecomp.resource.cp.nodes.network.Port").getProperties()); - globalTypesportProperties.putAll(serviceTemplate.getNode_types().get(externalPortType).getProperties()); + globalTypesportProperties.putAll( + serviceTemplate.getNode_types().get("org.openecomp.resource.cp.nodes.network.Port") + .getProperties()); + globalTypesportProperties + .putAll(serviceTemplate.getNode_types().get(externalPortType).getProperties()); Map<String, Object> properties = portNodeTemplate.getProperties(); Map<String, Object> filteredProperties = new HashMap<>(); - if(MapUtils.isEmpty(properties)){ + if (MapUtils.isEmpty(properties)) { return; } - for(Map.Entry<String, Object> propertyEntry: properties.entrySet()){ - if(globalTypesportProperties.containsKey(propertyEntry.getKey())){ + for (Map.Entry<String, Object> propertyEntry : properties.entrySet()) { + if (globalTypesportProperties.containsKey(propertyEntry.getKey())) { filteredProperties.put(propertyEntry.getKey(), propertyEntry.getValue()); } } - if(!MapUtils.isEmpty(filteredProperties)) { + if (!MapUtils.isEmpty(filteredProperties)) { portNodeTemplate.setProperties(filteredProperties); - }else{ + } else { portNodeTemplate.setProperties(null); } diff --git a/openecomp-be/lib/openecomp-tosca-lib/src/main/resources/config.properties b/openecomp-be/lib/openecomp-tosca-lib/src/main/resources/config.properties index d4149dbac6..3b90c809fa 100644 --- a/openecomp-be/lib/openecomp-tosca-lib/src/main/resources/config.properties +++ b/openecomp-be/lib/openecomp-tosca-lib/src/main/resources/config.properties @@ -9,6 +9,7 @@ tosca.entity.namespace.prefix.monitoringUploadType=${tosca.entity.namespace.pref tosca.entity.namespace.prefix.nodeType.vfc=${tosca.entity.namespace.prefix}resource.vfc.nodes. tosca.entity.namespace.prefix.nodeType.network=${tosca.entity.namespace.prefix}resource.vl.nodes. tosca.entity.namespace.prefix.nodeType.connectionPoint=${tosca.entity.namespace.prefix}resource.cp.nodes. +tosca.entity.namespace.prefix.nodeType.external.connectionPoint=${tosca.entity.namespace.prefix}resource.cp.v2. tosca.entity.namespace.prefix.nodeType.abstract=${tosca.entity.namespace.prefix}resource.abstract.nodes. tosca.entity.namespace.prefix.nodeType.rule=${tosca.entity.namespace.prefix}resource.vfc.rules.nodes. |