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.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;
}
}
+ if (!componentParametersView.isIgnoreComponentInstancesInterfaces()) {
+ TitanOperationStatus storageStatus =
+ setComponentInstancesInterfacesFromGraph(componentV, toscaElement);
+ if (storageStatus != TitanOperationStatus.OK) {
+ return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(storageStatus));
+ }
+ }
return Either.left(toscaElement);
}
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()) {
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());
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) &&