aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorojasdubey <ojas.dubey@amdocs.com>2017-09-26 16:42:47 +0530
committerojasdubey <ojas.dubey@amdocs.com>2017-09-27 12:32:32 +0530
commit18b81c30d2ea81b3e768839008860d1ffb77f2c8 (patch)
tree06432d5db1f851299c2591491459dc1317c3bcbc
parent49d34b776677ca50c1d5b464d7b7b6dfe4c685c0 (diff)
Bugfix - Create VF failed for Manual VSPs
Excluded the manual onboarded VSP port type from port mirroring port collection Issue ID: SDC-399 Change-Id: I0c090375bc6ff1c935c01eb2c48793e3e196f808 Signed-off-by: ojasdubey <ojas.dubey@amdocs.com>
-rw-r--r--openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-impl/src/main/java/org/openecomp/sdc/enrichment/impl/tosca/PortMirroringEnricher.java26
1 files changed, 13 insertions, 13 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 9eeabebe6c..2fe1416ffc 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,5 +1,9 @@
package org.openecomp.sdc.enrichment.impl.tosca;
+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.openecomp.sdc.datatypes.error.ErrorMessage;
@@ -28,10 +32,6 @@ import java.util.Objects;
import java.util.Optional;
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;
-
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<>();
@@ -75,7 +75,8 @@ public class PortMirroringEnricher {
if (Objects.nonNull(nodeTemplates)) {
//Get all concrete port node templates from the service template
Map<String, NodeTemplate> serviceTemplatePortNodeTemplates = nodeTemplates.entrySet().stream()
- .filter(nodeTemplateEntry -> isPortNodeTemplate(nodeTemplateEntry.getValue()))
+ .filter(nodeTemplateEntry -> (Objects.nonNull(nodeTemplateEntry.getValue()))
+ && (isPortNodeTemplate(nodeTemplateEntry.getValue().getType())))
.collect(Collectors.toMap(nodeTemplateEntry -> nodeTemplateEntry.getKey(),
nodeTemplateEntry -> nodeTemplateEntry.getValue()));
@@ -281,15 +282,14 @@ public class PortMirroringEnricher {
imports.add(openecompIndexImport);
}
- private boolean isPortNodeTemplate(NodeTemplate nodeTemplate) {
- String nodeType = nodeTemplate.getType();
+ private boolean isPortNodeTemplate(String nodeType) {
//Check if node corresponds to a concrete port node
- if (nodeType.equals(ToscaNodeType.NEUTRON_PORT)
- || nodeType.equals(ToscaNodeType.CONTRAILV2_VIRTUAL_MACHINE_INTERFACE)
- || nodeType.equals(ToscaNodeType.CONTRAIL_PORT)
- || nodeType.equals(ToscaNodeType.NETWORK_PORT)
- || nodeType.equals(ToscaNodeType.NATIVE_NETWORK_PORT)) {
- return true;
+ if (Objects.nonNull(nodeType)) {
+ if (nodeType.equals(ToscaNodeType.NEUTRON_PORT)
+ || nodeType.equals(ToscaNodeType.CONTRAILV2_VIRTUAL_MACHINE_INTERFACE)
+ || nodeType.equals(ToscaNodeType.CONTRAIL_PORT)) {
+ return true;
+ }
}
return false;
}