summaryrefslogtreecommitdiffstats
path: root/catalog-model
diff options
context:
space:
mode:
authorpriyanshu <pagarwal@amdocs.com>2018-09-19 16:00:48 +0530
committerAvi Gaffa <avi.gaffa@amdocs.com>2018-09-27 10:41:36 +0000
commitc255bbeb22eed021d9da071c567908e507200bbc (patch)
treec5ed9fa4b0fda52a7a3d7daae06599291878be2e /catalog-model
parentf02c8a02bf45824ef7f8bb76b55462960f561ec3 (diff)
Interface Operation disappears on VSP update
Interface Operation disappears on VSP update Change-Id: I209e8a41292aa2ccfa4466b3f383d53005b7b08b Issue-ID: SDC-1772 Signed-off-by: priyanshu <pagarwal@amdocs.com>
Diffstat (limited to 'catalog-model')
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/TopologyTemplateOperation.java41
1 files changed, 31 insertions, 10 deletions
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/TopologyTemplateOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/TopologyTemplateOperation.java
index 0f124fd2eb..9a87874b2a 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/TopologyTemplateOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/TopologyTemplateOperation.java
@@ -173,7 +173,7 @@ public class TopologyTemplateOperation extends ToscaElementOperation {
return result;
}
- StorageOperationStatus associateInterfaces = associateInterfacesToResource(topologyTemplateVertex, topologyTemplate);
+ StorageOperationStatus associateInterfaces = associateInterfacesToComponent(topologyTemplateVertex, topologyTemplate);
if (associateInterfaces != StorageOperationStatus.OK) {
result = Either.right(associateInterfaces);
return result;
@@ -721,19 +721,23 @@ public class TopologyTemplateOperation extends ToscaElementOperation {
}
return TitanOperationStatus.OK;
}
-
- private StorageOperationStatus associateInterfacesToResource(GraphVertex topologyTemplateVertex,
- TopologyTemplate topologyTemplate) {
- Map<String, InterfaceDataDefinition> interfaces = topologyTemplate.getInterfaces();
- return associateInterfacesToComponent(topologyTemplateVertex,interfaces);
- }
-
- public StorageOperationStatus associateInterfacesToComponent(GraphVertex nodeTypeVertex, Map<String, InterfaceDataDefinition> interfaceMap) {
+
+ private StorageOperationStatus associateInterfacesToComponent(GraphVertex topologyTemplateVertex, TopologyTemplate topologyTemplate) {
+ Map<String, InterfaceDataDefinition> interfaceMap = topologyTemplate.getInterfaces();
if (interfaceMap != null && !interfaceMap.isEmpty()) {
- Either<GraphVertex, StorageOperationStatus> assosiateElementToData = associateElementToData(nodeTypeVertex, VertexTypeEnum.INTERFACE, EdgeLabelEnum.INTERFACE, interfaceMap);
+ Either<GraphVertex, StorageOperationStatus> assosiateElementToData = associateElementToData(topologyTemplateVertex, VertexTypeEnum.INTERFACE, EdgeLabelEnum.INTERFACE, interfaceMap);
if (assosiateElementToData.isRight()) {
return assosiateElementToData.right().value();
}
+ else {
+ Map<String, OperationDataDefinition> operationMap = interfaceMap.values().stream().filter(op -> MapUtils.isNotEmpty(op.getOperations())).flatMap(a -> a.getOperations().entrySet().stream()).collect(Collectors.toMap(entry -> entry.getKey(), entry -> entry.getValue()));
+ if(MapUtils.isNotEmpty(operationMap)) {
+ Either<GraphVertex, StorageOperationStatus> assosiateOpToInterface = associateElementToData(assosiateElementToData.left().value(), VertexTypeEnum.INTERFACE_OPERATION, EdgeLabelEnum.INTERFACE_OPERATION, operationMap);
+ if (assosiateOpToInterface.isRight()) {
+ return assosiateOpToInterface.right().value();
+ }
+ }
+ }
}
return StorageOperationStatus.OK;
}
@@ -1059,6 +1063,23 @@ public class TopologyTemplateOperation extends ToscaElementOperation {
Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
}
+ Either<GraphVertex, TitanOperationStatus> getInterfaceVertex = titanDao.getChildVertex(toscaElementVertex, EdgeLabelEnum.INTERFACE, JsonParseFlagEnum.NoParse);
+ if (getInterfaceVertex.isLeft()) {
+ status = titanDao.disassociateAndDeleteLast(getInterfaceVertex.left().value(), Direction.OUT, EdgeLabelEnum.INTERFACE_OPERATION);
+ if (status != TitanOperationStatus.OK) {
+ log.debug("Failed to disassociate interface operations for {} error {}", getInterfaceVertex.left().value().getUniqueId(), status);
+ Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ }
+ else {
+ status = titanDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.INTERFACE);
+ if (status != TitanOperationStatus.OK) {
+ log.debug("Failed to disassociate interfaces for {} error {}", toscaElementVertex.getUniqueId(), status);
+ Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ }
+ }
+
+ }
+
titanDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.INSTANCE_ARTIFACTS);
toscaElementVertex.getVertex().remove();
log.trace("Tosca element vertex for {} was removed", toscaElementVertex.getUniqueId());