From 5c1f5756bcb5856e2d8b35e3c6ac206f891f8695 Mon Sep 17 00:00:00 2001 From: aribeiro Date: Thu, 19 Nov 2020 13:28:43 +0000 Subject: Add support for updating interface operations Allows to update interface operations on a component instance. Issue-ID: SDC-3446 Signed-off-by: aribeiro Signed-off-by: andre.schmid Change-Id: I6a2c44997c04d9d9ea298e3d0bc971da7b137799 --- .../sdc/be/model/ComponentParametersView.java | 3 +++ .../operations/NodeTemplateOperation.java | 18 +++++++++++------- 2 files changed, 14 insertions(+), 7 deletions(-) (limited to 'catalog-model/src') diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentParametersView.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentParametersView.java index 505b8e6c7c..6488d41f25 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentParametersView.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentParametersView.java @@ -98,6 +98,8 @@ public class ComponentParametersView { this.setIgnoreNodeFilter(false); this.setIgnoreSubstitutionFilter(false); this.setIgnoreCapabiltyProperties(false); + this.setIgnoreInterfaces(false); + this.setIgnoreComponentInstancesInterfaces(false); break; case COMPONENT_INSTANCES_PROPERTIES: this.setIgnoreComponentInstances(false); //we need this in order to get the calculate capabilities requirements @@ -160,6 +162,7 @@ public class ComponentParametersView { break; case COMPONENT_INSTANCES_INTERFACES: this.setIgnoreComponentInstances(false); + this.setIgnoreInterfaces(false); this.setIgnoreComponentInstancesInterfaces(false); break; case DATA_TYPES: 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 facbcbe2a4..3f3e54146d 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 @@ -169,8 +169,9 @@ public class NodeTemplateOperation extends BaseOperation { } result = Either.right(status); } - if (componentInstance.getOriginType() == OriginTypeEnum.ServiceProxy || componentInstance.getOriginType() == OriginTypeEnum.ServiceSubstitution) { - TopologyTemplate updatedContainer = addComponentInstanceRes.left().value(); + final TopologyTemplate updatedContainer = addComponentInstanceRes.left().value(); + if (componentInstance.getOriginType() == OriginTypeEnum.ServiceProxy + || componentInstance.getOriginType() == OriginTypeEnum.ServiceSubstitution) { result = addCapAndReqToProxyServiceInstance(updatedContainer, componentInstance, componentInstanceData); if(result.isRight()) { return result; @@ -185,12 +186,15 @@ public class NodeTemplateOperation extends BaseOperation { if(result.isRight()) { return result; } - - result = addServiceInstanceInterfacesToProxyServiceInstance(updatedContainer, componentInstance); + } + if (componentInstance.getOriginType() == OriginTypeEnum.ServiceProxy + || componentInstance.getOriginType() == OriginTypeEnum.ServiceSubstitution + || componentInstance.getOriginType() == OriginTypeEnum.VF + || componentInstance.getOriginType() == OriginTypeEnum.VFC) { + result = addComponentInstanceInterfacesToTopologyTemplate(updatedContainer, componentInstance); if(result.isRight()) { return result; } - } } if (result == null) { @@ -362,11 +366,11 @@ public class NodeTemplateOperation extends BaseOperation { return Either.left(new ImmutablePair<>(updatedContainer, componentInstance.getUniqueId())); } - private Either, StorageOperationStatus> addServiceInstanceInterfacesToProxyServiceInstance(TopologyTemplate updatedContainer, ComponentInstance componentInstance) { + private Either, StorageOperationStatus> addComponentInstanceInterfacesToTopologyTemplate(TopologyTemplate updatedContainer, ComponentInstance componentInstance) { Map interfaces = componentInstance.getInterfaces(); if(MapUtils.isNotEmpty(interfaces)){ - Map interfacesMap = interfaces.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, e -> (InterfaceDataDefinition) e.getValue())); + Map interfacesMap = interfaces.entrySet().stream().collect(Collectors.toMap(e -> ((InterfaceDataDefinition) e.getValue()).getUniqueId(), e -> (InterfaceDataDefinition) e.getValue())); MapInterfaceDataDefinition instInterfaces = new MapInterfaceDataDefinition(interfacesMap); Map instInterfacesMap = new HashMap<>(); -- cgit 1.2.3-korg