summaryrefslogtreecommitdiffstats
path: root/catalog-model
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-model')
-rw-r--r--catalog-model/pom.xml22
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/config/CatalogModelSpringConfig.java5
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/config/ContainerInstanceTypesData.java122
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ToscaOperationFacade.java49
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/config/ModelOperationsSpringConfig.java1
-rw-r--r--catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/config/ContainerInstanceTypesDataTest.java195
-rw-r--r--catalog-model/src/test/resources/application-context-test.xml4
-rw-r--r--catalog-model/src/test/resources/config/configuration.yaml61
8 files changed, 431 insertions, 28 deletions
diff --git a/catalog-model/pom.xml b/catalog-model/pom.xml
index 599bb91516..6e30eacb6c 100644
--- a/catalog-model/pom.xml
+++ b/catalog-model/pom.xml
@@ -212,6 +212,20 @@
<!-- CASSANDRA END -->
<dependency>
+ <groupId>org.hamcrest</groupId>
+ <artifactId>hamcrest</artifactId>
+ <version>${hamcrest.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.hamcrest</groupId>
+ <artifactId>hamcrest-library</artifactId>
+ <version>${hamcrest.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${junitJupiter.version}</version>
@@ -308,10 +322,10 @@
<artifactId>joda-time</artifactId>
<version>${joda.time.version}</version>
</dependency>
- <dependency>
- <groupId>org.openecomp.sdc.core</groupId>
- <artifactId>openecomp-tosca-lib</artifactId>
- <version>${project.version}</version>
+ <dependency>
+ <groupId>org.openecomp.sdc.core</groupId>
+ <artifactId>openecomp-tosca-lib</artifactId>
+ <version>${project.version}</version>
<exclusions>
<exclusion>
<groupId>com.fasterxml.jackson.core</groupId>
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/config/CatalogModelSpringConfig.java b/catalog-model/src/main/java/org/openecomp/sdc/be/config/CatalogModelSpringConfig.java
index bd98076f34..061975b1e2 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/config/CatalogModelSpringConfig.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/config/CatalogModelSpringConfig.java
@@ -27,10 +27,11 @@ import org.springframework.context.annotation.Configuration;
@Configuration
@ComponentScan({"org.openecomp.sdc.be.model.operations.impl",
- "org.openecomp.sdc.be.model.cache",
+ "org.openecomp.sdc.be.model.cache",
"org.openecomp.sdc.be.model.jsonjanusgraph.utils",
"org.openecomp.sdc.be.model.jsonjanusgraph.operations",
- "org.openecomp.sdc.be.dao.cassandra"
+ "org.openecomp.sdc.be.model.jsonjanusgraph.config",
+ "org.openecomp.sdc.be.dao.cassandra"
})
public class CatalogModelSpringConfig {
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
new file mode 100644
index 0000000000..903855b74b
--- /dev/null
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/config/ContainerInstanceTypesData.java
@@ -0,0 +1,122 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix Foundation
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.be.model.jsonjanusgraph.config;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.collections4.MapUtils;
+import org.openecomp.sdc.be.config.ConfigurationManager;
+import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+@Component
+public class ContainerInstanceTypesData {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(ContainerInstanceTypesData.class);
+ private static final String WILDCARD = "*";
+
+ private final ConfigurationManager configurationManager;
+
+ public ContainerInstanceTypesData() {
+ this.configurationManager = ConfigurationManager.getConfigurationManager();
+ }
+
+ /**
+ * Checks if a resource instance type is allowed in a Service component.
+ *
+ * @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);
+ if (CollectionUtils.isEmpty(allowedResourceInstanceTypeList)) {
+ return false;
+ }
+ return allowedResourceInstanceTypeList.contains(resourceTypeToCheck.getValue());
+ }
+
+ /**
+ * Checks if a resource instance type is allowed for a resource component.
+ *
+ * @param containerComponentResourceType the container component type that the instance will be added
+ * @param resourceToCheck the resource instance type that will be added to the container component
+ * @return {@code true} if the resource instance is allowed in the container component, {@code false} otherwise
+ */
+ public boolean isAllowedForResourceComponent(final ResourceTypeEnum containerComponentResourceType,
+ final ResourceTypeEnum resourceToCheck) {
+ final List<String> allowedResourceInstanceTypeList =
+ getComponentAllowedList(ComponentTypeEnum.RESOURCE, containerComponentResourceType);
+ if (CollectionUtils.isEmpty(allowedResourceInstanceTypeList)) {
+ return false;
+ }
+ return allowedResourceInstanceTypeList.contains(resourceToCheck.getValue());
+ }
+
+ /**
+ * Gets the list of allowed component instances for a component type.
+ *
+ * @param componentType the component type
+ * @param resourceInstanceType the instance type to check, or null for any instance
+ * @return the list of allowed component instances for the given component
+ */
+ public List<String> getComponentAllowedList(final ComponentTypeEnum componentType,
+ final ResourceTypeEnum resourceInstanceType) {
+ final Map<String, List<String>> componentAllowedResourceTypeMap =
+ getComponentAllowedInstanceTypes().get(componentType.getValue());
+ if (MapUtils.isEmpty(componentAllowedResourceTypeMap)) {
+ final String resourceTypeString = resourceInstanceType == null ? WILDCARD : resourceInstanceType.getValue();
+ LOGGER.warn("No '{}' instance resource type configuration found for '{}'",
+ componentType.getValue(), resourceTypeString);
+ return Collections.emptyList();
+ }
+ return getAllowedInstanceType(resourceInstanceType, componentAllowedResourceTypeMap);
+ }
+
+ private Map<String, Map<String, List<String>>> getComponentAllowedInstanceTypes() {
+ return configurationManager.getConfiguration().getComponentAllowedInstanceTypes();
+ }
+
+ private List<String> getAllowedInstanceType(final ResourceTypeEnum resourceInstanceType,
+ final Map<String, List<String>> instanceAllowedResourceTypeMap) {
+ if (MapUtils.isEmpty(instanceAllowedResourceTypeMap)) {
+ return Collections.emptyList();
+ }
+ List<String> allowedInstanceResourceType = null;
+ if (resourceInstanceType == null) {
+ if (instanceAllowedResourceTypeMap.containsKey(WILDCARD)) {
+ allowedInstanceResourceType = instanceAllowedResourceTypeMap.get(WILDCARD);
+ }
+ } else {
+ allowedInstanceResourceType = instanceAllowedResourceTypeMap.get(resourceInstanceType.getValue());
+ }
+
+ if (CollectionUtils.isEmpty(allowedInstanceResourceType)) {
+ return Collections.emptyList();
+ }
+
+ return allowedInstanceResourceType;
+ }
+}
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 cde3ef1975..427939f2f8 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
@@ -27,6 +27,9 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.tinkerpop.gremlin.structure.Direction;
import org.apache.tinkerpop.gremlin.structure.Edge;
+import org.openecomp.sdc.be.config.Configuration;
+import org.openecomp.sdc.be.config.ConfigurationManager;
+import org.openecomp.sdc.be.model.jsonjanusgraph.config.ContainerInstanceTypesData;
import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.jsongraph.GraphVertex;
import org.openecomp.sdc.be.dao.jsongraph.HealingJanusGraphDao;
@@ -40,8 +43,6 @@ import org.openecomp.sdc.be.model.*;
import org.openecomp.sdc.be.datatypes.elements.MapCapabilityProperty;
import org.openecomp.sdc.be.datatypes.elements.MapListCapabilityDataDefinition;
import org.openecomp.sdc.be.model.CatalogUpdateTimestamp;
-import org.openecomp.sdc.be.datatypes.elements.MapCapabilityProperty;
-import org.openecomp.sdc.be.datatypes.elements.MapListCapabilityDataDefinition;
import org.openecomp.sdc.be.model.catalog.CatalogComponent;
import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.TopologyTemplate;
import org.openecomp.sdc.be.model.jsonjanusgraph.datamodel.ToscaElement;
@@ -91,6 +92,8 @@ public class ToscaOperationFacade {
private GroupsOperation groupsOperation;
@Autowired
private HealingJanusGraphDao janusGraphDao;
+ @Autowired
+ private ContainerInstanceTypesData containerInstanceTypesData;
private static final Logger log = Logger.getLogger(ToscaOperationFacade.class.getName());
// endregion
@@ -1768,24 +1771,30 @@ public class ToscaOperationFacade {
}
}
- private void fillNodeTypePropsMap(Map<GraphPropertyEnum, Object> hasProps, Map<GraphPropertyEnum, Object> hasNotProps, String internalComponentType) {
- switch (internalComponentType.toLowerCase()) {
- case "vf":
- hasNotProps.put(GraphPropertyEnum.RESOURCE_TYPE, Arrays.asList(ResourceTypeEnum.VFCMT.name()));
- break;
- case "cvfc":
- hasNotProps.put(GraphPropertyEnum.RESOURCE_TYPE, Arrays.asList(ResourceTypeEnum.VFCMT.name(), ResourceTypeEnum.Configuration.name()));
- break;
- case SERVICE:
- case "pnf":
- case "cr":
- hasNotProps.put(GraphPropertyEnum.RESOURCE_TYPE, Arrays.asList(ResourceTypeEnum.VFC.name(), ResourceTypeEnum.VFCMT.name()));
- break;
- case "vl":
- hasProps.put(GraphPropertyEnum.RESOURCE_TYPE, ResourceTypeEnum.VL.name());
- break;
- default:
- break;
+ private void fillNodeTypePropsMap(final Map<GraphPropertyEnum, Object> hasProps,
+ final Map<GraphPropertyEnum, Object> hasNotProps,
+ final String internalComponentType) {
+ final Configuration configuration = ConfigurationManager.getConfigurationManager().getConfiguration();
+ final List<String> allowedTypes;
+
+ if (ComponentTypeEnum.SERVICE.getValue().equalsIgnoreCase(internalComponentType)) {
+ allowedTypes = containerInstanceTypesData.getComponentAllowedList(ComponentTypeEnum.SERVICE, null);
+ } else {
+ final ResourceTypeEnum resourceType = ResourceTypeEnum.getTypeIgnoreCase(internalComponentType);
+ allowedTypes = containerInstanceTypesData.getComponentAllowedList(ComponentTypeEnum.RESOURCE, resourceType);
+ }
+ final List<String> allResourceTypes = configuration.getResourceTypes();
+ if (allowedTypes == null) {
+ hasNotProps.put(GraphPropertyEnum.RESOURCE_TYPE, allResourceTypes);
+ return;
+ }
+
+ if (ResourceTypeEnum.VL.getValue().equalsIgnoreCase(internalComponentType)) {
+ hasProps.put(GraphPropertyEnum.RESOURCE_TYPE, allowedTypes);
+ } else {
+ final List<String> notAllowedTypes = allResourceTypes.stream().filter(s -> !allowedTypes.contains(s))
+ .collect(Collectors.toList());
+ hasNotProps.put(GraphPropertyEnum.RESOURCE_TYPE, notAllowedTypes);
}
}
diff --git a/catalog-model/src/test/java/org/openecomp/sdc/be/model/config/ModelOperationsSpringConfig.java b/catalog-model/src/test/java/org/openecomp/sdc/be/model/config/ModelOperationsSpringConfig.java
index a473e31c58..929441cf01 100644
--- a/catalog-model/src/test/java/org/openecomp/sdc/be/model/config/ModelOperationsSpringConfig.java
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/config/ModelOperationsSpringConfig.java
@@ -28,6 +28,7 @@ import org.springframework.context.annotation.PropertySource;
@ComponentScan({"org.openecomp.sdc.be.dao.cassandra", "org.openecomp.sdc.be.model.cache",
"org.openecomp.sdc.be.model.jsonjanusgraph.operations",
"org.openecomp.sdc.be.model.jsonjanusgraph.utils",
+ "org.openecomp.sdc.be.model.jsonjanusgraph.config",
"org.openecomp.sdc.be.model.operations.impl"})
@PropertySource("classpath:dao.properties")
public class ModelOperationsSpringConfig { }
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
new file mode 100644
index 0000000000..5df79146c4
--- /dev/null
+++ b/catalog-model/src/test/java/org/openecomp/sdc/be/model/jsonjanusgraph/config/ContainerInstanceTypesDataTest.java
@@ -0,0 +1,195 @@
+/*
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix Foundation
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.sdc.be.model.jsonjanusgraph.config;
+
+import static java.util.Collections.emptyList;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.containsInAnyOrder;
+import static org.hamcrest.Matchers.empty;
+import static org.hamcrest.Matchers.is;
+
+import java.util.EnumMap;
+import java.util.EnumSet;
+import java.util.List;
+import org.apache.commons.collections4.CollectionUtils;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.openecomp.sdc.be.config.ConfigurationManager;
+import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
+import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
+import org.openecomp.sdc.common.impl.ExternalConfiguration;
+import org.openecomp.sdc.common.impl.FSConfigurationSource;
+
+public class ContainerInstanceTypesDataTest {
+
+ private ContainerInstanceTypesData containerInstanceTypesData;
+ private EnumSet<ResourceTypeEnum> serviceAllowedTypes;
+ private EnumMap<ResourceTypeEnum, EnumSet<ResourceTypeEnum>> resourceAllowedTypeConfig;
+ private EnumSet<ResourceTypeEnum> allResourceTypes;
+
+ @BeforeAll
+ public static void beforeClass() {
+ new ConfigurationManager(new FSConfigurationSource(ExternalConfiguration.getChangeListener(),
+ "src/test/resources/config"));
+ }
+
+ @BeforeEach
+ public void setUp() {
+ containerInstanceTypesData = new ContainerInstanceTypesData();
+
+ allResourceTypes = EnumSet.allOf(ResourceTypeEnum.class);
+
+ serviceAllowedTypes = EnumSet.of(ResourceTypeEnum.VF,
+ ResourceTypeEnum.CR,
+ ResourceTypeEnum.CP,
+ ResourceTypeEnum.PNF,
+ ResourceTypeEnum.CVFC,
+ ResourceTypeEnum.VL,
+ ResourceTypeEnum.Configuration,
+ ResourceTypeEnum.ServiceProxy,
+ ResourceTypeEnum.ABSTRACT
+ );
+
+ resourceAllowedTypeConfig =
+ new EnumMap<>(ResourceTypeEnum.class);
+
+ resourceAllowedTypeConfig.put(ResourceTypeEnum.VF,
+ EnumSet.of(ResourceTypeEnum.VFC,
+ ResourceTypeEnum.VF,
+ ResourceTypeEnum.CR,
+ ResourceTypeEnum.CP,
+ ResourceTypeEnum.PNF,
+ ResourceTypeEnum.CVFC,
+ ResourceTypeEnum.VL,
+ ResourceTypeEnum.Configuration,
+ ResourceTypeEnum.ServiceProxy,
+ ResourceTypeEnum.ABSTRACT));
+
+ resourceAllowedTypeConfig.put(ResourceTypeEnum.CVFC,
+ EnumSet.of(ResourceTypeEnum.VFC,
+ ResourceTypeEnum.VF,
+ ResourceTypeEnum.CR,
+ ResourceTypeEnum.CP,
+ ResourceTypeEnum.PNF,
+ ResourceTypeEnum.CVFC,
+ ResourceTypeEnum.VL,
+ ResourceTypeEnum.ServiceProxy,
+ ResourceTypeEnum.ABSTRACT));
+
+ resourceAllowedTypeConfig.put(ResourceTypeEnum.PNF,
+ EnumSet.of(ResourceTypeEnum.VF,
+ ResourceTypeEnum.CR,
+ ResourceTypeEnum.CP,
+ ResourceTypeEnum.PNF,
+ ResourceTypeEnum.CVFC,
+ ResourceTypeEnum.VL,
+ ResourceTypeEnum.Configuration,
+ ResourceTypeEnum.ServiceProxy,
+ ResourceTypeEnum.ABSTRACT));
+
+ resourceAllowedTypeConfig.put(ResourceTypeEnum.CR,
+ EnumSet.of(ResourceTypeEnum.VF,
+ ResourceTypeEnum.CR,
+ ResourceTypeEnum.CP,
+ ResourceTypeEnum.PNF,
+ ResourceTypeEnum.CVFC,
+ ResourceTypeEnum.VL,
+ ResourceTypeEnum.Configuration,
+ ResourceTypeEnum.ServiceProxy,
+ ResourceTypeEnum.ABSTRACT));
+
+ resourceAllowedTypeConfig.put(ResourceTypeEnum.VL,
+ EnumSet.of(ResourceTypeEnum.VL));
+ }
+
+ @Test
+ public void isAllowedForServiceComponent() {
+ for (final ResourceTypeEnum allowedType : serviceAllowedTypes) {
+ assertThat(String.format("%s should be allowed", allowedType.getValue()),
+ containerInstanceTypesData.isAllowedForServiceComponent(allowedType), is(true));
+ }
+ }
+
+ @Test
+ public void isAllowedForResourceComponent() {
+ for (final ResourceTypeEnum componentResourceType : allResourceTypes) {
+ final EnumSet<ResourceTypeEnum> allowedResourceType = resourceAllowedTypeConfig.get(componentResourceType);
+ for (final ResourceTypeEnum resourceType : allResourceTypes) {
+ if (allowedResourceType == null) {
+ final String msg = String
+ .format("'%s' resource type should not be allowed", resourceType.getValue());
+ assertThat(msg, containerInstanceTypesData
+ .isAllowedForResourceComponent(componentResourceType, resourceType), is(false));
+ continue;
+ }
+ final boolean isAllowed = allowedResourceType.contains(resourceType);
+ final String msg = String
+ .format("'%s' resource type should %s be allowed", resourceType.getValue(), isAllowed ? "" : "not");
+ assertThat(msg, containerInstanceTypesData
+ .isAllowedForResourceComponent(componentResourceType, resourceType), is(
+ isAllowed));
+ }
+ }
+ }
+
+ @Test
+ public void getComponentAllowedListTest() {
+ List<String> actualAllowedList = containerInstanceTypesData
+ .getComponentAllowedList(ComponentTypeEnum.SERVICE, null);
+ assertThat("Allowed Instance Resource Type List should be as expected",
+ actualAllowedList, containsInAnyOrder(actualAllowedList.toArray()));
+
+ for (final ResourceTypeEnum resourceType : allResourceTypes) {
+ actualAllowedList = containerInstanceTypesData
+ .getComponentAllowedList(ComponentTypeEnum.RESOURCE, resourceType);
+ final EnumSet<ResourceTypeEnum> expectedAllowedSet = resourceAllowedTypeConfig.get(resourceType);
+ if (CollectionUtils.isEmpty(expectedAllowedSet)) {
+ assertThat("Allowed Instance Resource Type List should be as expected",
+ actualAllowedList, is(empty()));
+ continue;
+ }
+ assertThat("Allowed Instance Resource Type List should be as expected",
+ actualAllowedList,
+ containsInAnyOrder(expectedAllowedSet.stream().map(ResourceTypeEnum::getValue).toArray()));
+ }
+ }
+
+ @Test
+ public void getComponentAllowedListTestEmptyList() {
+ List<String> actualAllowedList = containerInstanceTypesData
+ .getComponentAllowedList(ComponentTypeEnum.PRODUCT, null);
+ final String msg = "Allowed Instance Resource Type List should be empty";
+ assertThat(msg, actualAllowedList, is(emptyList()));
+
+ actualAllowedList = containerInstanceTypesData
+ .getComponentAllowedList(ComponentTypeEnum.SERVICE, ResourceTypeEnum.VF);
+ assertThat(msg, actualAllowedList, is(emptyList()));
+
+ actualAllowedList = containerInstanceTypesData
+ .getComponentAllowedList(ComponentTypeEnum.SERVICE, ResourceTypeEnum.ServiceProxy);
+ assertThat(msg, actualAllowedList, is(emptyList()));
+
+ actualAllowedList = containerInstanceTypesData
+ .getComponentAllowedList(ComponentTypeEnum.RESOURCE, null);
+ assertThat(msg, actualAllowedList, is(emptyList()));
+ }
+
+} \ No newline at end of file
diff --git a/catalog-model/src/test/resources/application-context-test.xml b/catalog-model/src/test/resources/application-context-test.xml
index 475760f51a..dc9d5ba7bf 100644
--- a/catalog-model/src/test/resources/application-context-test.xml
+++ b/catalog-model/src/test/resources/application-context-test.xml
@@ -12,8 +12,8 @@
org.openecomp.sdc.be.model.cache,
org.openecomp.sdc.be.dao.janusgraph,
org.openecomp.sdc.be.dao.cassandra,
- org.openecomp.sdc.be.model.jsonjanusgraph.utils
- ">
+ org.openecomp.sdc.be.model.jsonjanusgraph.utils,
+ org.openecomp.sdc.be.model.jsonjanusgraph.config">
</context:component-scan>
diff --git a/catalog-model/src/test/resources/config/configuration.yaml b/catalog-model/src/test/resources/config/configuration.yaml
index 4e8bc0a7dc..504c020dca 100644
--- a/catalog-model/src/test/resources/config/configuration.yaml
+++ b/catalog-model/src/test/resources/config/configuration.yaml
@@ -97,9 +97,70 @@ resourceTypes: &allResourceTypes
- CP
- VL
- VF
+ - CR
- VFCMT
- Abstract
- CVFC
+ - Configuration
+ - ServiceProxy
+ - PNF
+
+componentAllowedInstanceTypes:
+ Resource:
+ VF:
+ - VFC
+ - VF
+ - CR
+ - CP
+ - PNF
+ - CVFC
+ - VL
+ - Configuration
+ - ServiceProxy
+ - Abstract
+ CVFC:
+ - VFC
+ - VF
+ - CR
+ - CP
+ - PNF
+ - CVFC
+ - VL
+ - ServiceProxy
+ - Abstract
+ PNF:
+ - VF
+ - CR
+ - CP
+ - PNF
+ - CVFC
+ - VL
+ - Configuration
+ - ServiceProxy
+ - Abstract
+ CR:
+ - VF
+ - CR
+ - CP
+ - PNF
+ - CVFC
+ - VL
+ - Configuration
+ - ServiceProxy
+ - Abstract
+ VL:
+ - VL
+ Service:
+ "*":
+ - VF
+ - CR
+ - CP
+ - PNF
+ - CVFC
+ - VL
+ - Configuration
+ - ServiceProxy
+ - Abstract
# validForResourceTypes usage
# validForResourceTypes: