summaryrefslogtreecommitdiffstats
path: root/catalog-model/src
diff options
context:
space:
mode:
authorMichaelMorris <michael.morris@est.tech>2022-01-21 21:18:01 +0000
committerAndr� Schmid <andre.schmid@est.tech>2022-01-24 18:50:46 +0000
commitd77bdf472a4fb5b6cf8e17f2d0d8e8d2bababeaf (patch)
treeaeedcacfeb7a7b6c4466aed6a9f55340591d8596 /catalog-model/src
parent03df024d4f9ace16307f380bdb5c131dd896f3db (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')
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/config/ContainerInstanceTypesData.java18
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacade.java6
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/config/ContainerInstanceTypesDataTest.java2
3 files changed, 20 insertions, 6 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);
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/config/ContainerInstanceTypesDataTest.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/config/ContainerInstanceTypesDataTest.java
index 5df79146c4..8a038c8791 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/config/ContainerInstanceTypesDataTest.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/config/ContainerInstanceTypesDataTest.java
@@ -124,7 +124,7 @@ public class ContainerInstanceTypesDataTest {
public void isAllowedForServiceComponent() {
for (final ResourceTypeEnum allowedType : serviceAllowedTypes) {
assertThat(String.format("%s should be allowed", allowedType.getValue()),
- containerInstanceTypesData.isAllowedForServiceComponent(allowedType), is(true));
+ containerInstanceTypesData.isAllowedForServiceComponent(allowedType, ""), is(true));
}
}