aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-be
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-be')
-rw-r--r--catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-configuration.yaml.erb1
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogic.java2
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/tosca/ToscaExportHandler.java10
-rw-r--r--catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogicTest.java12
4 files changed, 14 insertions, 11 deletions
diff --git a/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-configuration.yaml.erb b/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-configuration.yaml.erb
index aa9d3f275b..974fc009ed 100644
--- a/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-configuration.yaml.erb
+++ b/catalog-be/src/main/docker/backend/chef-repo/cookbooks/sdc-catalog-be/templates/default/BE-configuration.yaml.erb
@@ -189,6 +189,7 @@ componentAllowedInstanceTypes:
Service:
"*":
- VF
+ - VFC
- CR
- CP
- PNF
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<Map<String, InterfaceDefinition>, 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<String> allGlobalInterfaceTypes = lifecycleTypeEither.left().value().values().stream().map(InterfaceDataDefinition::getType)
- .collect(Collectors.toList());
- toscaNode.setInterface_types(addInterfaceTypeElement(component, allGlobalInterfaceTypes));
+ if (lifecycleTypeEither.isLeft()) {
+ List<String> allGlobalInterfaceTypes = lifecycleTypeEither.left().value().values().stream().map(InterfaceDataDefinition::getType)
+ .collect(Collectors.toList());
+ toscaNode.setInterface_types(addInterfaceTypeElement(component, allGlobalInterfaceTypes));
+ }
Either<Map<String, DataTypeDefinition>, JanusGraphOperationStatus> dataTypesEither = applicationDataTypeCache.getAll(component.getModel());
if (dataTypesEither.isRight()) {
log.debug("Failed to fetch all data types :", dataTypesEither.right().value());
diff --git a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogicTest.java b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogicTest.java
index 99034f7785..8499dad5dc 100644
--- a/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogicTest.java
+++ b/catalog-be/src/test/java/org/openecomp/sdc/be/components/impl/ComponentInstanceBusinessLogicTest.java
@@ -1726,14 +1726,14 @@ class ComponentInstanceBusinessLogicTest {
when(toscaOperationFacade.getToscaFullElement(eq(ORIGIN_COMPONENT_ID)))
.thenReturn(Either.left(originComponent));
// Assume services cannot contain VF resource
- when(containerInstanceTypeData.isAllowedForServiceComponent(eq(ResourceTypeEnum.VF)))
+ when(containerInstanceTypeData.isAllowedForServiceComponent(eq(ResourceTypeEnum.VF), eq(null)))
.thenReturn(false);
ByActionStatusComponentException actualException = assertThrows(ByActionStatusComponentException.class, () -> {
componentInstanceBusinessLogic.createComponentInstance(ComponentTypeEnum.SERVICE_PARAM_NAME, COMPONENT_ID, USER_ID, ci);
});
assertThat(actualException.getActionStatus()).isEqualTo(ActionStatus.CONTAINER_CANNOT_CONTAIN_INSTANCE);
- verify(containerInstanceTypeData, times(1)).isAllowedForServiceComponent(eq(ResourceTypeEnum.VF));
+ verify(containerInstanceTypeData, times(1)).isAllowedForServiceComponent(eq(ResourceTypeEnum.VF), eq(null));
//given
final Resource resource = createResource();
@@ -1765,7 +1765,7 @@ class ComponentInstanceBusinessLogicTest {
.thenReturn(Either.left(service));
when(toscaOperationFacade.getToscaFullElement(eq(ORIGIN_COMPONENT_ID)))
.thenReturn(Either.left(originComponent));
- when(containerInstanceTypeData.isAllowedForServiceComponent(eq(ResourceTypeEnum.VF)))
+ when(containerInstanceTypeData.isAllowedForServiceComponent(eq(ResourceTypeEnum.VF), eq(null)))
.thenReturn(true);
Mockito.doNothing().when(compositionBusinessLogic).validateAndSetDefaultCoordinates(ci);
when(graphLockOperation.lockComponent(COMPONENT_ID, NodeTypeEnum.Service))
@@ -1784,7 +1784,7 @@ class ComponentInstanceBusinessLogicTest {
componentInstanceBusinessLogic.createComponentInstance(ComponentTypeEnum.SERVICE_PARAM_NAME, COMPONENT_ID, USER_ID, ci);
});
verify(containerInstanceTypeData, times(1))
- .isAllowedForServiceComponent(eq(ResourceTypeEnum.VF));
+ .isAllowedForServiceComponent(eq(ResourceTypeEnum.VF), eq(null));
verify(compositionBusinessLogic, times(1)).validateAndSetDefaultCoordinates(ci);
verify(toscaOperationFacade, times(1))
.addComponentInstanceToTopologyTemplate(service, originComponent, ci, false, user);
@@ -1807,7 +1807,7 @@ class ComponentInstanceBusinessLogicTest {
.thenReturn(Either.left(service));
when(toscaOperationFacade.getToscaFullElement(eq(ORIGIN_COMPONENT_ID)))
.thenReturn(Either.left(originComponent));
- when(containerInstanceTypeData.isAllowedForServiceComponent(eq(ResourceTypeEnum.VF)))
+ when(containerInstanceTypeData.isAllowedForServiceComponent(eq(ResourceTypeEnum.VF), eq(null)))
.thenReturn(true);
Mockito.doNothing().when(compositionBusinessLogic).validateAndSetDefaultCoordinates(instanceToBeCreated);
when(graphLockOperation.lockComponent(COMPONENT_ID, NodeTypeEnum.Service))
@@ -1830,7 +1830,7 @@ class ComponentInstanceBusinessLogicTest {
assertThat(instanceToBeCreated.getComponentVersion()).isEqualTo(originComponent.getVersion());
assertThat(instanceToBeCreated.getIcon()).isEqualTo(originComponent.getIcon());
verify(containerInstanceTypeData, times(1))
- .isAllowedForServiceComponent(eq(ResourceTypeEnum.VF));
+ .isAllowedForServiceComponent(eq(ResourceTypeEnum.VF), eq(null));
verify(compositionBusinessLogic, times(1)).validateAndSetDefaultCoordinates(instanceToBeCreated);
verify(toscaOperationFacade, times(1))
.addComponentInstanceToTopologyTemplate(service, originComponent, instanceToBeCreated, false, user);