summaryrefslogtreecommitdiffstats
path: root/catalog-model/src/main
diff options
context:
space:
mode:
authorajay_dp001 <ajay.deep.singh@est.tech>2020-08-23 13:21:04 +0530
committerXue Gao <xg353y@intl.att.com>2020-08-24 08:52:56 +0000
commitec44cb3e846e1129dc0cb245bd1edef67d8ed3e3 (patch)
tree32eb14b4120a03b93c0586d6f8bf14d16c51ba15 /catalog-model/src/main
parentb16794663103fe5716af7627e1d420bf4bbd1aa2 (diff)
Fix Error Updating VSP in Rresource Template for PNF
Issue-ID: SDC-3090 Signed-off-by: ajay_dp001 <ajay.deep.singh@est.tech> Change-Id: I3389a9a942c74f41ed037b9f13498b9cf999d441
Diffstat (limited to 'catalog-model/src/main')
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTemplateOperation.java40
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/ModelConverter.java3
2 files changed, 23 insertions, 20 deletions
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTemplateOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTemplateOperation.java
index 6bdc7868d4..930ba791d5 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTemplateOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTemplateOperation.java
@@ -20,8 +20,22 @@
package org.openecomp.sdc.be.model.jsonjanusgraph.operations;
-import org.janusgraph.core.JanusGraphVertex;
import fj.data.Either;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.EnumMap;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Optional;
+import java.util.Set;
+import java.util.UUID;
+import java.util.function.BiConsumer;
+import java.util.function.BiPredicate;
+import java.util.stream.Collectors;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang.StringUtils;
@@ -29,6 +43,7 @@ import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.tinkerpop.gremlin.structure.Direction;
import org.apache.tinkerpop.gremlin.structure.Edge;
+import org.janusgraph.core.JanusGraphVertex;
import org.openecomp.sdc.be.config.BeEcompErrorManager;
import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
@@ -38,10 +53,6 @@ import org.openecomp.sdc.be.dao.jsongraph.types.EdgePropertyEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
import org.openecomp.sdc.be.dao.jsongraph.utils.JsonParserUtils;
-import org.openecomp.sdc.be.datatypes.elements.*;
-import org.openecomp.sdc.be.datatypes.elements.MapCapabilityProperty;
-import org.openecomp.sdc.be.datatypes.elements.MapListCapabilityDataDefinition;
-import org.openecomp.sdc.be.datatypes.elements.*;
import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.CapabilityDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.ComponentInstanceDataDefinition;
@@ -105,13 +116,6 @@ import org.openecomp.sdc.common.log.enums.StatusCode;
import org.openecomp.sdc.common.log.wrappers.Logger;
import org.openecomp.sdc.common.util.ValidationUtils;
-import java.io.IOException;
-import java.util.*;
-import java.util.Map.Entry;
-import java.util.function.BiConsumer;
-import java.util.function.BiPredicate;
-import java.util.stream.Collectors;
-
@org.springframework.stereotype.Component("node-template-operation")
public class NodeTemplateOperation extends BaseOperation {
private static final String FAILED_TO_FETCH_CONTAINER_VERTEX_ERROR = "Failed to fetch container vertex {} error {}";
@@ -2007,16 +2011,11 @@ public class NodeTemplateOperation extends BaseOperation {
if (!validateInstanceNames(componentInstanceTMap)) {
throw new StorageException(StorageOperationStatus.INCONSISTENCY);
}
- if (!validateInstanceNames(componentInstanceTMap)) {
- throw new StorageException(StorageOperationStatus.INCONSISTENCY);
- }
-
if (!allowDeleted) {
if (!validateDeletedResources(componentInstanceTMap)) {
throw new StorageException(StorageOperationStatus.INCONSISTENCY);
}
}
-
instancesJsonData = convertToComponentInstanceDataDefinition(componentInstanceTMap, containerId, isUpdateCsar);
if (MapUtils.isNotEmpty(instancesJsonData)) {
@@ -2066,11 +2065,14 @@ public class NodeTemplateOperation extends BaseOperation {
Set<String> names = new HashSet<>();
for (ComponentInstance instance : resourcesInstancesMap.keySet()) {
if (StringUtils.isEmpty(instance.getName())) {
- CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Component instance {} name is empty. Cannot add component instance. ", instance.getUniqueId());
+ CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG,
+ "Component instance {} name is empty. Cannot add component instance. ", instance.getUniqueId());
result = false;
break;
} else if (names.contains(instance.getName())) {
- CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Component instance with the name {} already exsists. Cannot add component instance. ", instance.getName());
+ CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG,
+ "Component instance with the name {} already exsists. Cannot add component instance. ",
+ instance.getName());
result = false;
break;
} else {
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/ModelConverter.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/ModelConverter.java
index 272d664b8e..c278632dad 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/ModelConverter.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/utils/ModelConverter.java
@@ -1410,7 +1410,8 @@ public class ModelConverter {
}
private static boolean isFromCsar(Resource resource) {
- return resource.getResourceType() == ResourceTypeEnum.VF || resource.getResourceType() == ResourceTypeEnum.CVFC;
+ return resource.getResourceType() == ResourceTypeEnum.VF || resource.getResourceType() == ResourceTypeEnum.CVFC
+ || resource.getResourceType() == ResourceTypeEnum.PNF;
}
private static void setComponentInstancesInputsToComponent(TopologyTemplate topologyTemplate, Component component) {