aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-model/src
diff options
context:
space:
mode:
authoraribeiro <anderson.ribeiro@est.tech>2020-11-19 13:28:43 +0000
committerChristophe Closset <christophe.closset@intl.att.com>2021-01-29 08:22:04 +0000
commit5c1f5756bcb5856e2d8b35e3c6ac206f891f8695 (patch)
tree29a7c4424b3ced8800e5bcacc629c8fff8dd8753 /catalog-model/src
parent3c957597725f306b4ca06cebfa54fbf0f2622938 (diff)
Add support for updating interface operations
Allows to update interface operations on a component instance. Issue-ID: SDC-3446 Signed-off-by: aribeiro <anderson.ribeiro@est.tech> Signed-off-by: andre.schmid <andre.schmid@est.tech> Change-Id: I6a2c44997c04d9d9ea298e3d0bc971da7b137799
Diffstat (limited to 'catalog-model/src')
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentParametersView.java3
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/NodeTemplateOperation.java18
2 files changed, 14 insertions, 7 deletions
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<ImmutablePair<TopologyTemplate, String>, StorageOperationStatus> addServiceInstanceInterfacesToProxyServiceInstance(TopologyTemplate updatedContainer, ComponentInstance componentInstance) {
+ private Either<ImmutablePair<TopologyTemplate, String>, StorageOperationStatus> addComponentInstanceInterfacesToTopologyTemplate(TopologyTemplate updatedContainer, ComponentInstance componentInstance) {
Map<String, Object> interfaces = componentInstance.getInterfaces();
if(MapUtils.isNotEmpty(interfaces)){
- Map<String, InterfaceDataDefinition> interfacesMap = interfaces.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, e -> (InterfaceDataDefinition) e.getValue()));
+ Map<String, InterfaceDataDefinition> interfacesMap = interfaces.entrySet().stream().collect(Collectors.toMap(e -> ((InterfaceDataDefinition) e.getValue()).getUniqueId(), e -> (InterfaceDataDefinition) e.getValue()));
MapInterfaceDataDefinition instInterfaces = new MapInterfaceDataDefinition(interfacesMap);
Map<String, MapInterfaceDataDefinition> instInterfacesMap = new HashMap<>();