diff options
author | MichaelMorris <michael.morris@est.tech> | 2022-01-21 21:18:01 +0000 |
---|---|---|
committer | Andr� Schmid <andre.schmid@est.tech> | 2022-01-24 18:50:46 +0000 |
commit | d77bdf472a4fb5b6cf8e17f2d0d8e8d2bababeaf (patch) | |
tree | aeedcacfeb7a7b6c4466aed6a9f55340591d8596 /catalog-model/src/main/java/org | |
parent | 03df024d4f9ace16307f380bdb5c131dd896f3db (diff) |
Fix issues creating control loop model
Change-Id: I38812f812fdf082aaadf13b79b8b05d26a481b15
Issue-ID: SDC-3856
Signed-off-by: MichaelMorris <michael.morris@est.tech>
Diffstat (limited to 'catalog-model/src/main/java/org')
2 files changed, 19 insertions, 5 deletions
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<String> allowedResourceInstanceTypeList = getComponentAllowedList(ComponentTypeEnum.SERVICE, null); + public boolean isAllowedForServiceComponent(final ResourceTypeEnum resourceTypeToCheck, final String modelName) { + final List<String> 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<String> getServiceAllowedList(final String modelName) { + List<String> 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<GraphPropertyEnum, Object> hasProps, final Map<GraphPropertyEnum, Object> hasNotProps, - final String internalComponentType) { + final String internalComponentType, String modelName) { final Configuration configuration = ConfigurationManager.getConfigurationManager().getConfiguration(); final List<String> 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); |