From d77bdf472a4fb5b6cf8e17f2d0d8e8d2bababeaf Mon Sep 17 00:00:00 2001 From: MichaelMorris Date: Fri, 21 Jan 2022 21:18:01 +0000 Subject: Fix issues creating control loop model Change-Id: I38812f812fdf082aaadf13b79b8b05d26a481b15 Issue-ID: SDC-3856 Signed-off-by: MichaelMorris --- .../sdc/be/components/impl/ComponentInstanceBusinessLogic.java | 2 +- .../java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'catalog-be/src/main/java/org') diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java index ebfb4c5851..ca4002f26a 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java @@ -637,7 +637,7 @@ public class ComponentInstanceBusinessLogic extends BaseBusinessLogic { private void validateOriginComponentIsValidForContainer(Component containerComponent, ResourceTypeEnum resourceType) { switch (containerComponent.getComponentType()) { case SERVICE: - if (!containerInstanceTypesData.isAllowedForServiceComponent(resourceType)) { + if (!containerInstanceTypesData.isAllowedForServiceComponent(resourceType, containerComponent.getModel())) { throw new ByActionStatusComponentException(ActionStatus.CONTAINER_CANNOT_CONTAIN_INSTANCE, containerComponent.getComponentType().toString(), resourceType.name()); } diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java index b6bd2a3967..ef63a86d39 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java @@ -765,13 +765,15 @@ public class ToscaExportHandler { ToscaNodeType toscaNodeType = createNodeType(component); Either, StorageOperationStatus> lifecycleTypeEither = interfaceLifecycleOperation .getAllInterfaceLifecycleTypes(component.getModel()); - if (lifecycleTypeEither.isRight()) { + if (lifecycleTypeEither.isRight() && !StorageOperationStatus.NOT_FOUND.equals(lifecycleTypeEither.right().value())) { log.debug("Failed to fetch all interface types :", lifecycleTypeEither.right().value()); return Either.right(ToscaError.GENERAL_ERROR); } - List allGlobalInterfaceTypes = lifecycleTypeEither.left().value().values().stream().map(InterfaceDataDefinition::getType) - .collect(Collectors.toList()); - toscaNode.setInterface_types(addInterfaceTypeElement(component, allGlobalInterfaceTypes)); + if (lifecycleTypeEither.isLeft()) { + List allGlobalInterfaceTypes = lifecycleTypeEither.left().value().values().stream().map(InterfaceDataDefinition::getType) + .collect(Collectors.toList()); + toscaNode.setInterface_types(addInterfaceTypeElement(component, allGlobalInterfaceTypes)); + } Either, JanusGraphOperationStatus> dataTypesEither = applicationDataTypeCache.getAll(component.getModel()); if (dataTypesEither.isRight()) { log.debug("Failed to fetch all data types :", dataTypesEither.right().value()); -- cgit 1.2.3-korg