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 --- .../config/ContainerInstanceTypesData.java | 18 ++++++++++++++++-- .../operations/ToscaOperationFacade.java | 6 +++--- 2 files changed, 19 insertions(+), 5 deletions(-) (limited to 'catalog-model/src/main/java') diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/config/ContainerInstanceTypesData.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/config/ContainerInstanceTypesData.java index 341d5222a1..a355aa9607 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/config/ContainerInstanceTypesData.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/config/ContainerInstanceTypesData.java @@ -47,8 +47,8 @@ public class ContainerInstanceTypesData { * @param resourceTypeToCheck the resource instance type that will be added to the container component * @return {@code true} if the resource instance is allowed, {@code false} otherwise */ - public boolean isAllowedForServiceComponent(final ResourceTypeEnum resourceTypeToCheck) { - final List allowedResourceInstanceTypeList = getComponentAllowedList(ComponentTypeEnum.SERVICE, null); + public boolean isAllowedForServiceComponent(final ResourceTypeEnum resourceTypeToCheck, final String modelName) { + final List allowedResourceInstanceTypeList = getServiceAllowedList(modelName); if (CollectionUtils.isEmpty(allowedResourceInstanceTypeList)) { return false; } @@ -69,6 +69,20 @@ public class ContainerInstanceTypesData { } return allowedResourceInstanceTypeList.contains(resourceToCheck.getValue()); } + + /** + * Gets the list of allowed component instances for a service of the given model. + * + * @param model the model + * @return the list of allowed component instances + */ + public List getServiceAllowedList(final String modelName) { + List allowedInstanceResourceType = getComponentAllowedList(ComponentTypeEnum.SERVICE, null); + if (modelName == null || modelName.isEmpty() || modelName.equals("SDC AID")){ + allowedInstanceResourceType.remove("VFC"); + } + return allowedInstanceResourceType; + } /** * Gets the list of allowed component instances for a component type. diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacade.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacade.java index 2dcc4362d9..d477b8ce6a 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacade.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacade.java @@ -2150,11 +2150,11 @@ public class ToscaOperationFacade { } private void fillNodeTypePropsMap(final Map hasProps, final Map hasNotProps, - final String internalComponentType) { + final String internalComponentType, String modelName) { final Configuration configuration = ConfigurationManager.getConfigurationManager().getConfiguration(); final List allowedTypes; if (ComponentTypeEnum.SERVICE.getValue().equalsIgnoreCase(internalComponentType)) { - allowedTypes = containerInstanceTypesData.getComponentAllowedList(ComponentTypeEnum.SERVICE, null); + allowedTypes = containerInstanceTypesData.getServiceAllowedList(modelName); } else { final ResourceTypeEnum resourceType = ResourceTypeEnum.getTypeIgnoreCase(internalComponentType); allowedTypes = containerInstanceTypesData.getComponentAllowedList(ComponentTypeEnum.RESOURCE, resourceType); @@ -2197,7 +2197,7 @@ public class ToscaOperationFacade { if (VertexTypeEnum.NODE_TYPE == internalVertexType) { hasProps.put(GraphPropertyEnum.IS_ABSTRACT, isAbstract); if (internalComponentType != null) { - fillNodeTypePropsMap(hasProps, hasNotProps, internalComponentType); + fillNodeTypePropsMap(hasProps, hasNotProps, internalComponentType, modelName); } } else { fillTopologyTemplatePropsMap(hasProps, hasNotProps, componentTypeEnum); -- cgit 1.2.3-korg