summaryrefslogtreecommitdiffstats
path: root/catalog-model
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-model')
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentInstance.java9
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentParametersView.java13
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/datamodel/TopologyTemplate.java1
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTemplateOperation.java147
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/TopologyTemplateOperation.java45
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaOperationFacade.java8
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/utils/ModelConverter.java7
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/InterfaceLifecycleOperation.java15
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/ToscaFunctions.java3
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/ui/model/UiComponentDataTransfer.java22
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/ui/model/UiResourceDataTransfer.java11
11 files changed, 246 insertions, 35 deletions
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentInstance.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentInstance.java
index c75f22cef0..fc3eb69656 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentInstance.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/ComponentInstance.java
@@ -41,6 +41,7 @@ public class ComponentInstance extends ComponentInstanceDataDefinition implement
private Map<String, Object> interfaces;
private List<PropertyDefinition> properties;
private CINodeFilterDataDefinition nodeFilter;
+ private List<InputDefinition> inputs;
public ComponentInstance() {
super();
@@ -145,7 +146,11 @@ public class ComponentInstance extends ComponentInstanceDataDefinition implement
this.nodeFilter = nodeFilter;
}
+ public List<InputDefinition> getInputs() {
+ return inputs;
+ }
-
-
+ public void setInputs(List<InputDefinition> inputs) {
+ this.inputs = inputs;
+ }
}
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 087816c053..35b4a865a1 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
@@ -40,6 +40,7 @@ public class ComponentParametersView {
private boolean ignoreAdditionalInformation = false;
private boolean ignoreArtifacts = false;
private boolean ignoreInterfaces = false;
+ private boolean ignoreComponentInstancesInterfaces = false;
private boolean ignoreDerivedFrom = false;
private boolean ignoreAttributesFrom = false;
private boolean ignoreComponentInstancesAttributesFrom = false;
@@ -147,6 +148,10 @@ public class ComponentParametersView {
case NODE_FILTER:
this.setIgnoreNodeFilter(false);
break;
+ case COMPONENT_INSTANCES_INTERFACES:
+ this.setIgnoreComponentInstances(false);
+ this.setIgnoreComponentInstancesInterfaces(false);
+ break;
default:
break;
}
@@ -351,6 +356,14 @@ public class ComponentParametersView {
this.ignoreInterfaces = ignoreInterfaces;
}
+ public boolean isIgnoreComponentInstancesInterfaces() {
+ return ignoreComponentInstancesInterfaces;
+ }
+
+ public void setIgnoreComponentInstancesInterfaces(boolean ignoreComponentInstancesInterfaces) {
+ this.ignoreComponentInstancesInterfaces = ignoreComponentInstancesInterfaces;
+ }
+
public boolean isIgnoreAttributesFrom() {
return ignoreAttributesFrom;
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/datamodel/TopologyTemplate.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/datamodel/TopologyTemplate.java
index 04cc6ea16a..14b7a2f786 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/datamodel/TopologyTemplate.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/datamodel/TopologyTemplate.java
@@ -25,7 +25,6 @@ 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.tosca.ToscaDataDefinition;
-import org.openecomp.sdc.be.model.MapInterfaceDataDefinition;
import org.openecomp.sdc.be.model.MapInterfaceInstanceDataDefinition;
import org.openecomp.sdc.be.model.jsontitan.enums.JsonConstantKeysEnum;
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTemplateOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTemplateOperation.java
index 3e91d74bd1..3bb5e1348c 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTemplateOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTemplateOperation.java
@@ -38,15 +38,48 @@ 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.dao.titan.TitanOperationStatus;
-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;
+import org.openecomp.sdc.be.datatypes.elements.CompositionDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.GroupDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.GroupInstanceDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.InterfaceDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.ListCapabilityDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.ListRequirementDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.MapArtifactDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.MapCapabilityProperty;
+import org.openecomp.sdc.be.datatypes.elements.MapDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.MapGroupsDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.MapInterfaceDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.MapListCapabilityDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.MapListRequirementDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.MapPropertiesDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.RelationshipInstDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.RequirementDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
-import org.openecomp.sdc.be.model.*;
+import org.openecomp.sdc.be.model.ArtifactDefinition;
+import org.openecomp.sdc.be.model.CapabilityDefinition;
+import org.openecomp.sdc.be.model.CapabilityRequirementRelationship;
+import org.openecomp.sdc.be.model.Component;
+import org.openecomp.sdc.be.model.ComponentInstance;
+import org.openecomp.sdc.be.model.ComponentInstanceInput;
+import org.openecomp.sdc.be.model.ComponentInstanceProperty;
+import org.openecomp.sdc.be.model.ComponentParametersView;
+import org.openecomp.sdc.be.model.GroupDefinition;
+import org.openecomp.sdc.be.model.GroupInstance;
+import org.openecomp.sdc.be.model.InputDefinition;
+import org.openecomp.sdc.be.model.PropertyDefinition;
+import org.openecomp.sdc.be.model.RelationshipImpl;
+import org.openecomp.sdc.be.model.RelationshipInfo;
+import org.openecomp.sdc.be.model.RequirementCapabilityRelDef;
+import org.openecomp.sdc.be.model.RequirementDefinition;
+import org.openecomp.sdc.be.model.User;
import org.openecomp.sdc.be.model.jsontitan.datamodel.NodeType;
import org.openecomp.sdc.be.model.jsontitan.datamodel.TopologyTemplate;
import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElement;
@@ -145,6 +178,16 @@ public class NodeTemplateOperation extends BaseOperation {
return result;
}
+ result = addServiceInstanceInputsToProxyServiceInstance(updatedContainer, componentInstance);
+ if(result.isRight()) {
+ return result;
+ }
+
+ result = addServiceInstanceInterfacesToProxyServiceInstance(updatedContainer, componentInstance);
+ if(result.isRight()) {
+ return result;
+ }
+
}
}
if (result == null) {
@@ -285,8 +328,9 @@ public class NodeTemplateOperation extends BaseOperation {
List<PropertyDefinition> propertiesList = componentInstance.getProperties();
if (propertiesList != null && !propertiesList.isEmpty()) {
- Map<String, PropertyDataDefinition> propertiesMap = propertiesList.stream().map(i -> new PropertyDataDefinition(i))
- .collect(Collectors.toMap(i -> i.getName(), i -> i));
+ Map<String, PropertyDataDefinition> propertiesMap = propertiesList.stream().map(PropertyDataDefinition::new)
+ .collect(Collectors.toMap(
+ PropertyDataDefinition::getName, i -> i));
MapPropertiesDataDefinition instProperties = new MapPropertiesDataDefinition(propertiesMap);
Map<String, MapPropertiesDataDefinition> instPropertiesMap = new HashMap<>();
instPropertiesMap.put(componentInstance.getUniqueId(), instProperties);
@@ -308,8 +352,58 @@ public class NodeTemplateOperation extends BaseOperation {
return Either.left(new ImmutablePair<>(updatedContainer, componentInstance.getUniqueId()));
}
- public Either<TopologyTemplate, StorageOperationStatus> addComponentInstanceToTopologyTemplate(TopologyTemplate container, ToscaElement originToscaElement, ComponentInstanceDataDefinition componentInstance, GraphVertex metadataVertex,
- boolean allowDeleted, User user) {
+ private Either<ImmutablePair<TopologyTemplate, String>, StorageOperationStatus> addServiceInstanceInputsToProxyServiceInstance(TopologyTemplate updatedContainer, ComponentInstance componentInstance) {
+
+ List<InputDefinition> inputsList = componentInstance.getInputs();
+
+ if (CollectionUtils.isNotEmpty(inputsList)) {
+ Map<String, PropertyDataDefinition> inputsMap = inputsList.stream().map(
+ PropertyDataDefinition::new).collect(Collectors.toMap(PropertyDataDefinition::getName, i -> i));
+ MapPropertiesDataDefinition instInputs = new MapPropertiesDataDefinition(inputsMap);
+ Map<String, MapPropertiesDataDefinition> instInputsMap = new HashMap<>();
+ instInputsMap.put(componentInstance.getUniqueId(), instInputs);
+ updatedContainer.setInstInputs(instInputsMap);
+
+ StorageOperationStatus status =
+ addToscaDataDeepElementsBlockToToscaElement(updatedContainer.getUniqueId(),
+ EdgeLabelEnum.INST_INPUTS, VertexTypeEnum.INST_INPUTS, instInputs,
+ componentInstance.getUniqueId());
+ if(status != StorageOperationStatus.OK) {
+ return Either.right(status);
+ }
+ }
+
+ return Either.left(new ImmutablePair<>(updatedContainer, componentInstance.getUniqueId()));
+ }
+
+ private Either<ImmutablePair<TopologyTemplate, String>, StorageOperationStatus> addServiceInstanceInterfacesToProxyServiceInstance(TopologyTemplate updatedContainer, ComponentInstance componentInstance) {
+ Map<String, Object> interfaces = componentInstance.getInterfaces();
+
+ if(interfaces != null && !interfaces.isEmpty()) {
+ Map<String, InterfaceDataDefinition> interfacesMap = interfaces.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, e -> (InterfaceDataDefinition) e.getValue()));
+ MapInterfaceDataDefinition instIntrefaces = new MapInterfaceDataDefinition(interfacesMap);
+
+ Map<String, MapInterfaceDataDefinition> instInterfacesMap = new HashMap<>();
+ instInterfacesMap.put(componentInstance.getUniqueId(), instIntrefaces);
+ updatedContainer.setComponentInstInterfaces(instInterfacesMap);
+
+ StorageOperationStatus status =
+ addToscaDataDeepElementsBlockToToscaElement(updatedContainer.getUniqueId(),
+ EdgeLabelEnum.INST_INTERFACES, VertexTypeEnum.INST_INTERFACES, instIntrefaces,
+ componentInstance.getUniqueId());
+
+ if(status != StorageOperationStatus.OK) {
+ return Either.right(status);
+ }
+ }
+
+ return Either.left(new ImmutablePair<>(updatedContainer, componentInstance.getUniqueId()));
+ }
+
+ public Either<TopologyTemplate, StorageOperationStatus> addComponentInstanceToTopologyTemplate(
+ TopologyTemplate container, ToscaElement originToscaElement,
+ ComponentInstanceDataDefinition componentInstance, GraphVertex metadataVertex, boolean allowDeleted,
+ User user) {
Either<TopologyTemplate, StorageOperationStatus> result = null;
Either<ToscaElement, StorageOperationStatus> updateContainerComponentRes = null;
@@ -615,6 +709,14 @@ public class NodeTemplateOperation extends BaseOperation {
CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG, "Failed to remove instance external refs for instance {} in container {}. error {] ", componentInstanceId, containerV.getUniqueId(), status);
return status;
}
+ status = deleteToscaDataDeepElementsBlockToToscaElement(containerV, EdgeLabelEnum.INST_INTERFACES,
+ VertexTypeEnum.INST_INTERFACES, componentInstanceId);
+ if (status != StorageOperationStatus.OK && status != StorageOperationStatus.NOT_FOUND) {
+ CommonUtility.addRecordToLog(log, LogLevelEnum.DEBUG,
+ "Failed to remove service instance interfaces for instance {} in container {}. " +
+ "error {] ", componentInstanceId, containerV.getUniqueId(), status);
+ return status;
+ }
return StorageOperationStatus.OK;
}
@@ -623,7 +725,7 @@ public class NodeTemplateOperation extends BaseOperation {
Either<GraphVertex, StorageOperationStatus> result;
StorageOperationStatus status;
if (originToscaElement.getToscaType() == ToscaElementTypeEnum.NODE_TYPE) {
- status = addComponentInstanceToscaDataToNodeTypeContainer((NodeType) originToscaElement, componentInstance, updatedContainerVertex, user, HEAT_VF_ENV_NAME);
+ status = addComponentInstanceToscaDataToNodeTypeContainer((NodeType) originToscaElement, componentInstance, updatedContainerVertex);
} else {
status = addComponentInstanceToscaDataToTopologyTemplateContainer((TopologyTemplate) originToscaElement, componentInstance, updatedContainerVertex);
}
@@ -838,22 +940,29 @@ public class NodeTemplateOperation extends BaseOperation {
}
return StorageOperationStatus.OK;
}
+ private StorageOperationStatus addComponentInstanceToscaDataToNodeTypeContainer(NodeType originNodeType,
+ ComponentInstanceDataDefinition componentInstance, GraphVertex updatedContainerVertex) {
- private StorageOperationStatus addComponentInstanceToscaDataToNodeTypeContainer(NodeType originNodeType, ComponentInstanceDataDefinition componentInstance, GraphVertex updatedContainerVertex, User user, String envType) {
-
- MapPropertiesDataDefinition instProperties = new MapPropertiesDataDefinition(originNodeType.getProperties());
+ StorageOperationStatus status;
- StorageOperationStatus status = addToscaDataDeepElementsBlockToToscaElement(updatedContainerVertex, EdgeLabelEnum.INST_PROPERTIES, VertexTypeEnum.INST_PROPERTIES, instProperties, componentInstance.getUniqueId());
- if (status != StorageOperationStatus.OK) {
- return status;
+ if(MapUtils.isNotEmpty(originNodeType.getProperties())){
+ MapPropertiesDataDefinition instProperties =
+ new MapPropertiesDataDefinition(originNodeType.getProperties());
+ status = addToscaDataDeepElementsBlockToToscaElement(updatedContainerVertex, EdgeLabelEnum.INST_PROPERTIES,
+ VertexTypeEnum.INST_PROPERTIES, instProperties, componentInstance.getUniqueId());
+ if (status != StorageOperationStatus.OK) {
+ return status;
+ }
}
- MapPropertiesDataDefinition instAttributes = new MapPropertiesDataDefinition(originNodeType.getAttributes());
-
- status = addToscaDataDeepElementsBlockToToscaElement(updatedContainerVertex, EdgeLabelEnum.INST_ATTRIBUTES, VertexTypeEnum.INST_ATTRIBUTES, instAttributes, componentInstance.getUniqueId());
-
- if (status != StorageOperationStatus.OK) {
- return status;
+ if(MapUtils.isNotEmpty(originNodeType.getAttributes())){
+ MapPropertiesDataDefinition instAttributes =
+ new MapPropertiesDataDefinition(originNodeType.getAttributes());
+ status = addToscaDataDeepElementsBlockToToscaElement(updatedContainerVertex, EdgeLabelEnum.INST_ATTRIBUTES,
+ VertexTypeEnum.INST_ATTRIBUTES, instAttributes, componentInstance.getUniqueId());
+ if (status != StorageOperationStatus.OK) {
+ return status;
+ }
}
return addCalculatedCapReqFromNodeType(originNodeType, componentInstance, updatedContainerVertex);
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 095425748a..417577320c 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
@@ -56,6 +56,7 @@ import org.openecomp.sdc.be.datatypes.elements.MapArtifactDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.MapCapabilityProperty;
import org.openecomp.sdc.be.datatypes.elements.MapDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.MapGroupsDataDefinition;
+import org.openecomp.sdc.be.datatypes.elements.MapInterfaceDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.MapListCapabilityDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.MapListRequirementDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.MapPropertiesDataDefinition;
@@ -71,6 +72,7 @@ import org.openecomp.sdc.be.model.ComponentInstanceProperty;
import org.openecomp.sdc.be.model.ComponentParametersView;
import org.openecomp.sdc.be.model.DistributionStatusEnum;
import org.openecomp.sdc.be.model.GroupDefinition;
+
import org.openecomp.sdc.be.model.PolicyDefinition;
import org.openecomp.sdc.be.model.User;
import org.openecomp.sdc.be.model.category.CategoryDefinition;
@@ -768,6 +770,13 @@ public class TopologyTemplateOperation extends ToscaElementOperation {
}
}
+ if (!componentParametersView.isIgnoreComponentInstancesInterfaces()) {
+ TitanOperationStatus storageStatus =
+ setComponentInstancesInterfacesFromGraph(componentV, toscaElement);
+ if (storageStatus != TitanOperationStatus.OK) {
+ return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(storageStatus));
+ }
+ }
return Either.left(toscaElement);
}
@@ -795,6 +804,22 @@ public class TopologyTemplateOperation extends ToscaElementOperation {
return TitanOperationStatus.OK;
}
+
+ private TitanOperationStatus setComponentInstancesInterfacesFromGraph(GraphVertex componentV,
+ TopologyTemplate topologyTemplate) {
+ Either<Map<String, MapInterfaceDataDefinition>, TitanOperationStatus> result =
+ getDataFromGraph(componentV, EdgeLabelEnum.INST_INTERFACES);
+ if (result.isLeft()) {
+ result.left().value().entrySet().forEach(entry -> topologyTemplate
+ .addComponentInstanceInterfaceMap(entry.getKey(), entry.getValue()));
+ } else {
+ if (result.right().value() != TitanOperationStatus.NOT_FOUND) {
+ return result.right().value();
+ }
+ }
+ return TitanOperationStatus.OK;
+ }
+
private StorageOperationStatus associateInterfacesToComponent(GraphVertex topologyTemplateVertex, TopologyTemplate topologyTemplate) {
Map<String, InterfaceDataDefinition> interfaceMap = topologyTemplate.getInterfaces();
if (interfaceMap != null && !interfaceMap.isEmpty()) {
@@ -1182,16 +1207,20 @@ public class TopologyTemplateOperation extends ToscaElementOperation {
if (status != TitanOperationStatus.OK) {
log.debug("Failed to disassociate requirements for {} error {}",
toscaElementVertex.getUniqueId(), status);
- Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
}
status = titanDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT,
EdgeLabelEnum.CAPABILITIES);
if (status != TitanOperationStatus.OK) {
log.debug("Failed to disassociate capabilities for {} error {}",
toscaElementVertex.getUniqueId(), status);
- Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
+ }
+ status = titanDao.disassociateAndDeleteLast(toscaElementVertex, Direction.OUT, EdgeLabelEnum.INST_INTERFACES);
+ if (status != TitanOperationStatus.OK) {
+ log.debug("Failed to disassociate instances interfaces for {} error {}", toscaElementVertex.getUniqueId(), status);
+ return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status));
}
-
toscaElementVertex.getVertex().remove();
log.trace("Tosca element vertex for {} was removed", toscaElementVertex.getUniqueId());
@@ -1349,6 +1378,16 @@ public class TopologyTemplateOperation extends ToscaElementOperation {
return updateToscaDataDeepElementsBlockToToscaElement(containerComponent.getUniqueId(), EdgeLabelEnum.CALCULATED_CAP_PROPERTIES, instanceProperties, componentInstanceId);
}
+ public StorageOperationStatus updateComponentInstanceInterfaces(Component containerComponent,
+ String componentInstanceId,
+ MapInterfaceDataDefinition instanceInterfaces) {
+ if (MapUtils.isNotEmpty(instanceInterfaces.getMapToscaDataDefinition())) {
+ return updateToscaDataDeepElementsBlockToToscaElement(containerComponent.getUniqueId(),
+ EdgeLabelEnum.INST_INTERFACES, instanceInterfaces, componentInstanceId);
+ }
+ return StorageOperationStatus.OK;
+ }
+
private boolean isNotEmptyMapOfProperties(String instanceId, Map<String, MapCapabilityProperty> mapPropertiesDataDefinition) {
return MapUtils.isNotEmpty(mapPropertiesDataDefinition) &&
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaOperationFacade.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaOperationFacade.java
index a69c80cd36..9e1e001f2e 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaOperationFacade.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaOperationFacade.java
@@ -34,6 +34,7 @@ import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.*;
+import org.openecomp.sdc.be.datatypes.elements.MapInterfaceDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.*;
import org.openecomp.sdc.be.model.*;
import org.openecomp.sdc.be.model.catalog.CatalogComponent;
@@ -2296,6 +2297,13 @@ public class ToscaOperationFacade {
.orElse(StorageOperationStatus.NOT_FOUND);
}
+ public StorageOperationStatus updateComponentInstanceInterfaces(Component containerComponent, String componentInstanceUniqueId) {
+ MapInterfaceDataDefinition mapInterfaceDataDefinition =
+ convertComponentInstanceInterfaces(containerComponent, componentInstanceUniqueId);
+ return topologyTemplateOperation
+ .updateComponentInstanceInterfaces(containerComponent, componentInstanceUniqueId, mapInterfaceDataDefinition);
+ }
+
public StorageOperationStatus updateComponentCalculatedCapabilitiesProperties(Component containerComponent) {
Map<String, MapCapabilityProperty> mapCapabiltyPropertyMap =
convertComponentCapabilitiesProperties(containerComponent);
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/utils/ModelConverter.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/utils/ModelConverter.java
index 6fbd7adc98..31a445add1 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/utils/ModelConverter.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/utils/ModelConverter.java
@@ -29,6 +29,7 @@ import org.apache.commons.lang3.StringUtils;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
import org.openecomp.sdc.be.datatypes.elements.*;
+import org.openecomp.sdc.be.datatypes.elements.MapInterfaceDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
@@ -279,6 +280,8 @@ public class ModelConverter {
setComponentInstancesArtifactsToComponent(topologyTemplate, component);
+ setComponentInstancesInterfacesToComponent(topologyTemplate, component);
+
}
}
@@ -1182,6 +1185,10 @@ public class ModelConverter {
List<PropertyDefinition> instanceProps = topologyTemplate.getInstProperties().get(key).getMapToscaDataDefinition().entrySet().stream().map(e -> new PropertyDefinition(e.getValue())).collect(Collectors.toList());
currComponentInstance.setProperties(instanceProps);
}
+ if(topologyTemplate.getInstInputs() != null && topologyTemplate.getInstInputs().containsKey(key) && topologyTemplate.getInstInputs().get(key) != null ){
+ List<InputDefinition> instanceInputs = topologyTemplate.getInstInputs().get(key).getMapToscaDataDefinition().entrySet().stream().map(e -> new InputDefinition(e.getValue())).collect(Collectors.toList());
+ currComponentInstance.setInputs(instanceInputs);
+ }
if(topologyTemplate.getComponentInstInterfaces() != null && topologyTemplate.getComponentInstInterfaces().containsKey(key) && topologyTemplate.getComponentInstInterfaces().get(key) != null ){
Map<String, Object> interfacesMap = topologyTemplate.getComponentInstInterfaces().get(key).getMapToscaDataDefinition().entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
currComponentInstance.setInterfaces(interfacesMap);
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/InterfaceLifecycleOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/InterfaceLifecycleOperation.java
index c842e5b59d..ab2eb0323d 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/InterfaceLifecycleOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/InterfaceLifecycleOperation.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -909,21 +909,18 @@ public class InterfaceLifecycleOperation implements IInterfaceLifecycleOperation
.collect(Collectors.toList());
for (InterfaceDefinition interfaceDefinition : interfaceDefinitions) {
-
- Either<List<ImmutablePair<OperationData, GraphEdge>>, TitanOperationStatus>
+ Either<List<ImmutablePair<OperationData, GraphEdge>>, TitanOperationStatus>
childrenNodes = titanGenericDao.getChildrenNodes(GraphPropertiesDictionary.UNIQUE_ID.getProperty(),
interfaceDefinition.getUniqueId(), GraphEdgeLabels.INTERFACE_OPERATION, NodeTypeEnum.InterfaceOperation, OperationData.class);
- if(childrenNodes.isRight()) {
- return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(childrenNodes.right().value()));
- }
-
+ if (childrenNodes.isLeft()) {
Map<String, OperationDataDefinition> operationsDataDefinitionMap = new HashMap<>();
for(ImmutablePair<OperationData, GraphEdge> operation : childrenNodes.left().value()) {
OperationData operationData = operation.getLeft();
operationsDataDefinitionMap.put(operationData.getUniqueId(), operationData.getOperationDataDefinition());
}
interfaceDefinition.setOperations(operationsDataDefinitionMap);
- interfaceTypes.put(interfaceDefinition.getUniqueId(), interfaceDefinition);
+ }
+ interfaceTypes.put(interfaceDefinition.getUniqueId(), interfaceDefinition);
}
return Either.left(interfaceTypes);
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/ToscaFunctions.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/ToscaFunctions.java
index 36e5148286..1f55fecc86 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/ToscaFunctions.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/ToscaFunctions.java
@@ -6,7 +6,8 @@ package org.openecomp.sdc.be.model.tosca;
public enum ToscaFunctions {
GET_INPUT("get_input"),
- GET_PROPERTY("get_property");
+ GET_PROPERTY("get_property"),
+ GET_OPERATION_OUTPUT("get_operation_output");
private String functionName;
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/ui/model/UiComponentDataTransfer.java b/catalog-model/src/main/java/org/openecomp/sdc/be/ui/model/UiComponentDataTransfer.java
index a8a2409715..4272a5c485 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/ui/model/UiComponentDataTransfer.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/ui/model/UiComponentDataTransfer.java
@@ -28,11 +28,13 @@ import org.openecomp.sdc.be.model.ArtifactDefinition;
import org.openecomp.sdc.be.model.CapabilityDefinition;
import org.openecomp.sdc.be.model.ComponentInstance;
import org.openecomp.sdc.be.model.ComponentInstanceInput;
+import org.openecomp.sdc.be.model.ComponentInstanceInterface;
import org.openecomp.sdc.be.model.ComponentInstanceProperty;
import org.openecomp.sdc.be.model.GroupDefinition;
import org.openecomp.sdc.be.model.InputDefinition;
import org.openecomp.sdc.be.model.InterfaceDefinition;
import org.openecomp.sdc.be.model.PolicyDefinition;
+import org.openecomp.sdc.be.model.PropertyDefinition;
import org.openecomp.sdc.be.model.RequirementCapabilityRelDef;
import org.openecomp.sdc.be.model.RequirementDefinition;
import org.openecomp.sdc.be.model.category.CategoryDefinition;
@@ -84,6 +86,8 @@ public class UiComponentDataTransfer {
private Map<String, CINodeFilterDataDefinition> nodeFilter;
private Map<String, UINodeFilter> nodeFilterforNode;
+ private List<PropertyDefinition> properties;
+ private Map<String, List<ComponentInstanceInterface>> componentInstancesInterfaces;
public Map<String, InterfaceDefinition> getInterfaces() {
return interfaces;
@@ -309,4 +313,22 @@ public class UiComponentDataTransfer {
public void setNodeFilterData(Map<String, UINodeFilter> nodeFilterforNode) {
this.nodeFilterforNode = nodeFilterforNode;
}
+
+ public List<PropertyDefinition> getProperties() {
+ return properties;
+ }
+
+ public void setProperties(List<PropertyDefinition> properties) {
+ this.properties = properties;
+ }
+
+ public Map<String, List<ComponentInstanceInterface>> getComponentInstancesInterfaces() {
+ return componentInstancesInterfaces;
+ }
+
+ public void setComponentInstancesInterfaces(
+ Map<String, List<ComponentInstanceInterface>> componentInstancesInterfaces) {
+ this.componentInstancesInterfaces = componentInstancesInterfaces;
+ }
+
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/ui/model/UiResourceDataTransfer.java b/catalog-model/src/main/java/org/openecomp/sdc/be/ui/model/UiResourceDataTransfer.java
index b3afd9617b..b3c3b6781b 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/ui/model/UiResourceDataTransfer.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/ui/model/UiResourceDataTransfer.java
@@ -21,9 +21,11 @@
package org.openecomp.sdc.be.ui.model;
import org.openecomp.sdc.be.model.AdditionalInformationDefinition;
+import org.openecomp.sdc.be.model.InterfaceDefinition;
import org.openecomp.sdc.be.model.PropertyDefinition;
import java.util.List;
+import java.util.Map;
public class UiResourceDataTransfer extends UiComponentDataTransfer{
@@ -37,6 +39,7 @@ public class UiResourceDataTransfer extends UiComponentDataTransfer{
private List<PropertyDefinition> attributes;
+ private Map<String, InterfaceDefinition> interfaces;
private List<String> defaultCapabilities;
@@ -91,6 +94,14 @@ public class UiResourceDataTransfer extends UiComponentDataTransfer{
this.attributes = attributes;
}
+ public Map<String, InterfaceDefinition> getInterfaces() {
+ return interfaces;
+ }
+
+ public void setInterfaces(Map<String, InterfaceDefinition> interfaces) {
+ this.interfaces = interfaces;
+ }
+
public List<String> getDefaultCapabilities() {
return defaultCapabilities;
}