aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-catalog-db-adapter
diff options
context:
space:
mode:
Diffstat (limited to 'adapters/mso-catalog-db-adapter')
-rw-r--r--adapters/mso-catalog-db-adapter/pom.xml10
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBApplication.java2
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/JerseyConfiguration.java2
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebMvcConfig.java42
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebSecurityConfigImpl.java4
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQueryExceptionCommon.java3
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java10
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java3
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java41
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.10__CvnfcCustomizationNullableColumn.sql4
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.11__RecreateRecipe.sql5
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.3__ScaleOutRecipe.sql (renamed from adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.2__ScaleOutRecipe.sql)2
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.4__AddVnfcTables.sql101
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.6__Remove1802StyleAssignNetwork.sql8
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.7__CreateTableControllerSelectionRefence.sql8
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.8__AutoScaleOutReferenceData.sql22
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.9__DeleteServiceRecipeOldMacro.sql5
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java30
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CloudConfigTest.java23
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/NetworkCollectionCatalogDbQueryTest.java14
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientPortChanger.java40
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java366
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql22
23 files changed, 690 insertions, 77 deletions
diff --git a/adapters/mso-catalog-db-adapter/pom.xml b/adapters/mso-catalog-db-adapter/pom.xml
index df5f3fac73..e8db6be2f9 100644
--- a/adapters/mso-catalog-db-adapter/pom.xml
+++ b/adapters/mso-catalog-db-adapter/pom.xml
@@ -153,20 +153,10 @@
</dependency>
<dependency>
<groupId>org.onap.so</groupId>
- <artifactId>deployment-configs</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.onap.so</groupId>
<artifactId>mso-catalog-db</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>janino</groupId>
- <artifactId>janino</artifactId>
- <version>2.5.15</version>
- </dependency>
- <dependency>
<groupId>uk.co.blackpepper.bowman</groupId>
<artifactId>bowman-client</artifactId>
<version>0.3.0</version>
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBApplication.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBApplication.java
index ce98b74fab..93e396bb94 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBApplication.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBApplication.java
@@ -25,7 +25,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
-@SpringBootApplication(scanBasePackages = {"org.onap.so.adapters.catalogdb", "org.onap.so.db.catalog.client"})
+@SpringBootApplication(scanBasePackages = {"org.onap.so.adapters.catalogdb", "org.onap.so.db.catalog.client","org.onap.so.logging.jaxrs.filter","org.onap.so.logging.spring.interceptor"})
@EnableJpaRepositories("org.onap.so.db.catalog.data.repository")
@EntityScan("org.onap.so.db.catalog.beans")
public class CatalogDBApplication {
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/JerseyConfiguration.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/JerseyConfiguration.java
index dcd668f2c8..ff162c862e 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/JerseyConfiguration.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/JerseyConfiguration.java
@@ -25,7 +25,7 @@ import javax.ws.rs.ApplicationPath;
import org.glassfish.jersey.server.ResourceConfig;
import org.onap.so.adapters.catalogdb.rest.CatalogDbAdapterRest;
-import org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging;
+import org.onap.so.logging.jaxrs.filter.JaxRsFilterLogging;
import org.springframework.context.annotation.Configuration;
import io.swagger.jaxrs.config.BeanConfig;
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebMvcConfig.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebMvcConfig.java
new file mode 100644
index 0000000000..efe6010f23
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebMvcConfig.java
@@ -0,0 +1,42 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.catalogdb;
+
+
+import org.onap.so.logging.spring.interceptor.LoggingInterceptor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
+import org.springframework.web.servlet.handler.MappedInterceptor;
+
+@Configuration
+public class WebMvcConfig extends WebMvcConfigurerAdapter {
+
+ @Autowired
+ LoggingInterceptor loggingInterceptor;
+
+ @Bean
+ public MappedInterceptor mappedLoggingInterceptor() {
+ return new MappedInterceptor(new String[]{"/**"}, loggingInterceptor);
+ }
+
+}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebSecurityConfigImpl.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebSecurityConfigImpl.java
index 144df5fe6a..2eb4858803 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebSecurityConfigImpl.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebSecurityConfigImpl.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2018 IBM.
+ * ================================================================================
* 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
@@ -36,7 +38,7 @@ public class WebSecurityConfigImpl extends WebSecurityConfig {
http.csrf().disable()
.authorizeRequests()
.antMatchers("/manage/health","/manage/info").permitAll()
- .antMatchers("/**").hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(),",").toString())
+ .antMatchers("/**").hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(),","))
.and()
.httpBasic();
}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQueryExceptionCommon.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQueryExceptionCommon.java
index fbaf12b337..283fef1d3b 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQueryExceptionCommon.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogQueryExceptionCommon.java
@@ -5,6 +5,8 @@
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2018 IBM.
+ * ================================================================================
* 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
@@ -26,7 +28,6 @@ import java.io.ByteArrayOutputStream;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Marshaller;
-import org.onap.so.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.fasterxml.jackson.databind.ObjectMapper;
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java
index b89c6275d4..3b50871a8d 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceMacroHolder.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2018 IBM.
+ * ================================================================================
* 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
@@ -71,10 +73,10 @@ public class QueryServiceMacroHolder extends CatalogQuery {
StringBuilder buf = new StringBuilder();
Map<String, String> valueMap = new HashMap<>();
- put(valueMap, "SERVICE_MODEL_NAME", service.getModelName()); //getServiceModelName());
- put(valueMap, "SERVICE_MODEL_UUID", service.getModelUUID()); //getServiceModelUuid());
- put(valueMap, "SERVICE_MODEL_INVARIANT_ID", service.getModelInvariantUUID()); //getServiceModelInvariantId());
- put(valueMap, "SERVICE_MODEL_VERSION", service.getModelVersion()); //getServiceModelVersion());
+ put(valueMap, "SERVICE_MODEL_NAME", service.getModelName());
+ put(valueMap, "SERVICE_MODEL_UUID", service.getModelUUID());
+ put(valueMap, "SERVICE_MODEL_INVARIANT_ID", service.getModelInvariantUUID());
+ put(valueMap, "SERVICE_MODEL_VERSION", service.getModelVersion());
put(valueMap, "SERVICE_TYPE", service.getServiceType());
put(valueMap, "SERVICE_ROLE", service.getServiceRole());
put(valueMap, "ENVIRONMENT_CONTEXT", service.getEnvironmentContext());
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java
index 4afc24ea10..a2256f724a 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2018 IBM.
+ * ================================================================================
* 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
@@ -28,7 +30,6 @@ import java.util.Map;
import javax.xml.bind.annotation.XmlRootElement;
import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
-import org.onap.so.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java
index a69e66cc69..5cd2559ef2 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Copyright (C) 2018 IBM.
+ * ================================================================================
* 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
@@ -51,19 +53,6 @@ min and initial counts can be 0. max can be null to indicate no maximum.
Once the network-level distribution artifacts are defined, similar updates can be made to the NETWORK_RESOURCE table.
*/
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.GenericEntity;
-import javax.ws.rs.core.HttpHeaders;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
import org.apache.http.HttpStatus;
import org.onap.so.adapters.catalogdb.catalogrest.CatalogQuery;
import org.onap.so.adapters.catalogdb.catalogrest.CatalogQueryException;
@@ -99,14 +88,24 @@ import org.onap.so.db.catalog.data.repository.VnfCustomizationRepository;
import org.onap.so.db.catalog.data.repository.VnfRecipeRepository;
import org.onap.so.db.catalog.data.repository.VnfResourceRepository;
import org.onap.so.db.catalog.rest.beans.ServiceMacroHolder;
-import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.GenericEntity;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.util.ArrayList;
+import java.util.List;
+
/**
* This class services calls to the REST interface for VF Modules (http://host:port/ecomp/mso/catalog/v1)
* Both XML and JSON can be produced/consumed. Set Accept: and Content-Type: headers appropriately. XML is the default.
@@ -203,7 +202,7 @@ public class CatalogDbAdapterRest {
service = serviceRepo.findFirstOneByModelUUIDOrderByModelVersionDesc(serviceModelUUID);
else if (smiUuid != null && !"".equals(smiUuid))
if (smVer != null && !"".equals(smVer))
- service = serviceRepo.findByModelVersionAndModelInvariantUUID(smVer,smiUuid);
+ service = serviceRepo.findFirstByModelVersionAndModelInvariantUUID(smVer,smiUuid);
else
service = serviceRepo.findFirstByModelInvariantUUIDOrderByModelVersionDesc(smiUuid);
else if (smName != null && !"".equals(smName)) {
@@ -287,7 +286,7 @@ public class CatalogDbAdapterRest {
else if (serviceModelInvariantUuid != null && !"".equals(serviceModelInvariantUuid)) {
uuid = serviceModelInvariantUuid;
if (serviceModelVersion != null && !"".equals(serviceModelVersion)) {
- service = serviceRepo.findByModelVersionAndModelInvariantUUID(serviceModelVersion, uuid);
+ service = serviceRepo.findFirstByModelVersionAndModelInvariantUUID(serviceModelVersion, uuid);
}
else {
service = serviceRepo.findFirstByModelInvariantUUIDOrderByModelVersionDesc(uuid);
@@ -347,7 +346,7 @@ public class CatalogDbAdapterRest {
uuid = modelInvariantUUID;
if (modelVersion != null && !"".equals(modelVersion)) {
logger.debug ("Query serviceMacroHolder getAllResourcesByServiceModelInvariantUuid serviceModelInvariantUuid: {} serviceModelVersion: {}",uuid, modelVersion);
- Service serv = serviceRepo.findByModelVersionAndModelInvariantUUID(modelVersion, uuid);
+ Service serv = serviceRepo.findFirstByModelVersionAndModelInvariantUUID(modelVersion, uuid);
ret.setService(serv);
}
else {
@@ -419,7 +418,7 @@ public class CatalogDbAdapterRest {
else if (serviceModelInvariantUuid != null && !"".equals(serviceModelInvariantUuid)) {
uuid = serviceModelInvariantUuid;
if (smVer != null && !"".equals(smVer)) {
- service = serviceRepo.findByModelVersionAndModelInvariantUUID(smVer, uuid);
+ service = serviceRepo.findFirstByModelVersionAndModelInvariantUUID(smVer, uuid);
}
else {
service = serviceRepo.findFirstByModelInvariantUUIDOrderByModelVersionDesc(uuid);
@@ -558,10 +557,10 @@ public class CatalogDbAdapterRest {
logger.debug("Query recipe by resource model uuid: {}", rmUuid);
//check vnf and network and ar, the resource could be any resource.
VnfResource vnf = vnfResourceRepo.findResourceByModelUUID(rmUuid);
- Recipe recipe = vnfRecipeRepo.findVnfRecipeByNfRoleAndAction(vnf.getModelName(), action);
+ Recipe recipe = vnfRecipeRepo.findFirstVnfRecipeByNfRoleAndAction(vnf.getModelName(), action);
if (null == recipe) {
NetworkResource nResource = networkResourceRepo.findResourceByModelUUID(rmUuid);
- recipe = networkRecipeRepo.findByModelNameAndAction(nResource.getModelName(), action);
+ recipe = networkRecipeRepo.findFirstByModelNameAndAction(nResource.getModelName(), action);
}
if (null == recipe) {
AllottedResource arResource = arResourceRepo.findResourceByModelUUID(rmUuid);
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.10__CvnfcCustomizationNullableColumn.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.10__CvnfcCustomizationNullableColumn.sql
new file mode 100644
index 0000000000..985c7cd44d
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.10__CvnfcCustomizationNullableColumn.sql
@@ -0,0 +1,4 @@
+use catalogdb;
+
+ALTER TABLE cvnfc_customization
+ MODIFY IF EXISTS VNFC_CUST_MODEL_CUSTOMIZATION_UUID varchar(200) NULL; \ No newline at end of file
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.11__RecreateRecipe.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.11__RecreateRecipe.sql
new file mode 100644
index 0000000000..627f7a4a61
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.11__RecreateRecipe.sql
@@ -0,0 +1,5 @@
+use catalogdb;
+
+INSERT INTO `vnf_recipe` (`NF_ROLE`, `ACTION`, `VERSION_STR`, `DESCRIPTION`, `ORCHESTRATION_URI`, `RECIPE_TIMEOUT`)
+VALUES
+('GR-API-DEFAULT', 'recreateInstance', '1', 'Gr api recipe to recreate vnf', '/mso/async/services/WorkflowActionBB', 180); \ No newline at end of file
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.2__ScaleOutRecipe.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.3__ScaleOutRecipe.sql
index b3d8b98176..3ae135fc56 100644
--- a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.2__ScaleOutRecipe.sql
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.3__ScaleOutRecipe.sql
@@ -1,5 +1,5 @@
use catalogdb;
-INSERT INTO vnf_components_recipe (VNF_COMPONENT_TYPE, ACTION, VERSION, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT, VF_MODULE_MODEL_UUID)
+INSERT IGNORE INTO vnf_components_recipe (VNF_COMPONENT_TYPE, ACTION, VERSION, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT, VF_MODULE_MODEL_UUID)
VALUES
('vfModule', 'scaleOut', '1', 'Gr api recipe to scale out vfModule', '/mso/async/services/WorkflowActionBB', '180', 'GR-API-DEFAULT');
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.4__AddVnfcTables.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.4__AddVnfcTables.sql
new file mode 100644
index 0000000000..f0b291ed6b
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.4__AddVnfcTables.sql
@@ -0,0 +1,101 @@
+USE catalogdb;
+
+CREATE TABLE IF NOT EXISTS vnfc_customization (
+`MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
+`MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL,
+`MODEL_UUID` VARCHAR(200) NOT NULL,
+`MODEL_INVARIANT_UUID` VARCHAR(200) NOT NULL,
+`MODEL_VERSION` VARCHAR(20) NOT NULL,
+`MODEL_NAME` VARCHAR(200) NOT NULL,
+`TOSCA_NODE_TYPE` VARCHAR(200) NOT NULL,
+`DESCRIPTION` VARCHAR(1200) NULL DEFAULT NULL,
+`CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
+PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`))
+ENGINE = InnoDB
+AUTO_INCREMENT = 20654
+DEFAULT CHARACTER SET = latin1;
+
+CREATE TABLE IF NOT EXISTS cvnfc_customization (
+ `ID` INT(11) NOT NULL AUTO_INCREMENT,
+ `MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
+ `MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL,
+ `MODEL_UUID` VARCHAR(200) NOT NULL,
+ `MODEL_INVARIANT_UUID` VARCHAR(200) NOT NULL,
+ `MODEL_VERSION` VARCHAR(20) NOT NULL,
+ `MODEL_NAME` VARCHAR(200) NOT NULL,
+ `TOSCA_NODE_TYPE` VARCHAR(200) NOT NULL,
+ `DESCRIPTION` VARCHAR(1200) NULL DEFAULT NULL,
+ `NFC_FUNCTION` VARCHAR(200) NULL,
+ `NFC_NAMING_CODE` VARCHAR(200) NULL,
+ `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
+ `VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
+ `VNFC_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
+ PRIMARY KEY (`ID`),
+ INDEX `fk_cvnfc_customization__vf_module_customization1_idx` (
+ `VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` ASC
+ ),
+ INDEX `fk_cvnfc_customization__vnfc_customization1_idx` (
+ `VNFC_CUST_MODEL_CUSTOMIZATION_UUID` ASC
+ ),
+ INDEX `fk_cvnfc_customization__vnf_resource_customization1_idx` (
+ `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC
+ ),
+ UNIQUE INDEX `UK_cvnfc_customization` (
+ `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC,
+ `VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` ASC,
+ `MODEL_CUSTOMIZATION_UUID` ASC
+ ),
+ INDEX `fk_cvnfc_customization__vnf_vfmod_cvnfc_config_cust1_idx` (`MODEL_CUSTOMIZATION_UUID` ASC),
+ CONSTRAINT `fk_cvnfc_customization__vf_module_customization1` FOREIGN KEY (
+ `VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID`
+ ) REFERENCES `vf_module_customization` (`MODEL_CUSTOMIZATION_UUID`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `fk_cvnfc_customization__vnfc_customization1` FOREIGN KEY (
+ `VNFC_CUST_MODEL_CUSTOMIZATION_UUID`
+ ) REFERENCES `vnfc_customization` (`MODEL_CUSTOMIZATION_UUID`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `fk_cvnfc_customization__vnf_resource_customization1` FOREIGN KEY (
+ `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID`
+ ) REFERENCES `vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE = InnoDB AUTO_INCREMENT = 20654 DEFAULT CHARACTER SET = latin1;
+
+CREATE TABLE IF NOT EXISTS vnf_vfmodule_cvnfc_configuration_customization (
+ `ID` INT(11) NOT NULL AUTO_INCREMENT,
+ `MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
+ `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
+ `VF_MODULE_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
+ `CVNFC_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
+ `MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL,
+ `CONFIGURATION_TYPE` VARCHAR(200) NULL,
+ `CONFIGURATION_ROLE` VARCHAR(200) NULL,
+ `CONFIGURATION_FUNCTION` VARCHAR(200) NULL,
+ `POLICY_NAME` VARCHAR(200) NULL,
+ `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `CONFIGURATION_MODEL_UUID` VARCHAR(200) NOT NULL,
+ PRIMARY KEY (`ID`),
+ INDEX `fk_vnf_vfmodule_cvnfc_config_cust__configuration_idx` (`CONFIGURATION_MODEL_UUID` ASC),
+ UNIQUE INDEX `UK_vnf_vfmodule_cvnfc_configuration_customization` (
+ `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC,
+ `VF_MODULE_MODEL_CUSTOMIZATION_UUID` ASC,
+ `CVNFC_MODEL_CUSTOMIZATION_UUID` ASC,
+ `MODEL_CUSTOMIZATION_UUID` ASC
+ ),
+ INDEX `fk_vnf_vfmodule_cvnfc_config_cust__cvnfc_cust1_idx` (
+ `CVNFC_MODEL_CUSTOMIZATION_UUID` ASC
+ ),
+ INDEX `fk_vnf_vfmodule_cvnfc_config_cust__vf_module_cust_idx` (
+ `VF_MODULE_MODEL_CUSTOMIZATION_UUID` ASC
+ ),
+ INDEX `fk_vnf_vfmodule_cvnfc_config_cust__vnf_res_cust_idx` (
+ `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC
+ ),
+ CONSTRAINT `fk_vnf_vfmod_cvnfc_config_cust__configuration_resource` FOREIGN KEY (`CONFIGURATION_MODEL_UUID`) REFERENCES `configuration` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `fk_cvnfc_configuration_customization__cvnfc_customization1` FOREIGN KEY (
+ `CVNFC_MODEL_CUSTOMIZATION_UUID`
+ ) REFERENCES `cvnfc_customization` (`MODEL_CUSTOMIZATION_UUID`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `fk_vnf_configuration_cvnfc_customization__vf_module_customiza1` FOREIGN KEY (
+ `VF_MODULE_MODEL_CUSTOMIZATION_UUID`
+ ) REFERENCES `vf_module_customization` (`MODEL_CUSTOMIZATION_UUID`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `fk_vfmodule_cvnfc_configuration_customization__vnf_resource_c1` FOREIGN KEY (
+ `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID`
+ ) REFERENCES `vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE = INNODB AUTO_INCREMENT = 20654 DEFAULT CHARACTER SET = LATIN1; \ No newline at end of file
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.6__Remove1802StyleAssignNetwork.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.6__Remove1802StyleAssignNetwork.sql
new file mode 100644
index 0000000000..126710e879
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.6__Remove1802StyleAssignNetwork.sql
@@ -0,0 +1,8 @@
+use catalogdb;
+
+DELETE FROM building_block_detail WHERE BUILDING_BLOCK_NAME = 'AssignNetwork1802BB';
+DELETE FROM building_block_detail WHERE BUILDING_BLOCK_NAME = 'UnassignNetwork1802BB';
+
+UPDATE orchestration_flow_reference SET `FLOW_NAME`='UnassignNetworkBB' WHERE `COMPOSITE_ACTION`='Network-Delete' and `FLOW_NAME`='UnassignNetwork1802BB';
+UPDATE orchestration_flow_reference SET `FLOW_NAME`='AssignNetworkBB' WHERE `COMPOSITE_ACTION`='Network-Create' and `FLOW_NAME`='AssignNetwork1802BB';
+
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.7__CreateTableControllerSelectionRefence.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.7__CreateTableControllerSelectionRefence.sql
new file mode 100644
index 0000000000..dbeba53acc
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.7__CreateTableControllerSelectionRefence.sql
@@ -0,0 +1,8 @@
+use catalogdb;
+
+CREATE TABLE IF NOT EXISTS `controller_selection_reference` (
+ `VNF_TYPE` VARCHAR(50) NOT NULL,
+ `CONTROLLER_NAME` VARCHAR(100) NOT NULL,
+ `ACTION_CATEGORY` VARCHAR(15) NOT NULL,
+ PRIMARY KEY (`VNF_TYPE`, `CONTROLLER_NAME`, `ACTION_CATEGORY`)
+ ) ENGINE = InnoDB DEFAULT CHARSET=latin1;
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.8__AutoScaleOutReferenceData.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.8__AutoScaleOutReferenceData.sql
new file mode 100644
index 0000000000..c5a8dcf806
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.8__AutoScaleOutReferenceData.sql
@@ -0,0 +1,22 @@
+use catalogdb;
+
+INSERT INTO building_block_detail (BUILDING_BLOCK_NAME, RESOURCE_TYPE, TARGET_ACTION)
+VALUES
+('ConfigurationScaleOutBB', 'VF_MODULE', 'CREATE'),
+('GenericVnfHealthCheckBB', 'VF_MODULE', 'CREATE');
+
+INSERT INTO northbound_request_ref_lookup(MACRO_ACTION, ACTION, REQUEST_SCOPE, IS_ALACARTE, IS_TOPLEVELFLOW, MIN_API_VERSION, MAX_API_VERSION) VALUES
+('VFModule-ScaleOut', 'createInstance', 'VfModule', true, true, '7','7');
+
+INSERT INTO orchestration_flow_reference(COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FLOW_VERSION, NB_REQ_REF_LOOKUP_ID) VALUES
+('VFModule-ScaleOut', '1', 'GenericVnfHealthCheckBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-ScaleOut')),
+('VFModule-ScaleOut', '2', 'AssignVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-ScaleOut')),
+('VFModule-ScaleOut', '3', 'CreateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-ScaleOut')),
+('VFModule-ScaleOut', '4', 'ActivateVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-ScaleOut')),
+('VFModule-ScaleOut', '5', 'ConfigurationScaleOutBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-ScaleOut')),
+('VFModule-ScaleOut', '6', 'GenericVnfHealthCheckBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-ScaleOut'));
+
+INSERT INTO rainy_day_handler_macro (FLOW_NAME, SERVICE_TYPE, VNF_TYPE, ERROR_CODE, WORK_STEP, POLICY)
+VALUES
+('GenericVnfHealthCheckBB', '*', '*', '*', "*" , 'Retry'),
+('ConfigurationScaleOutBB', '*', '*', '*', "*" , 'Retry');
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.9__DeleteServiceRecipeOldMacro.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.9__DeleteServiceRecipeOldMacro.sql
new file mode 100644
index 0000000000..7fd222a027
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.9__DeleteServiceRecipeOldMacro.sql
@@ -0,0 +1,5 @@
+use catalogdb;
+
+DELETE FROM catalogdb.service_recipe
+ where orchestration_uri = '/mso/async/services/CreateGenericMacroServiceNetworkVnf'
+ or orchestration_uri = '/mso/async/services/DeleteGenericMacroServiceNetworkVnf'; \ No newline at end of file
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java
index c3159f0e3b..8ccf40eff5 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java
@@ -34,6 +34,7 @@ import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.adapters.catalogdb.CatalogDBApplication;
import org.onap.so.logger.MsoLogger;
@@ -108,6 +109,27 @@ public class CatalogDBRestTest {
HttpMethod.GET, entity, String.class);
assertEquals(Response.Status.OK.getStatusCode(),response.getStatusCode().value());
+ for(ILoggingEvent logEvent : TestAppender.events)
+ if(logEvent.getLoggerName().equals("org.onap.so.logging.spring.interceptor.LoggingInterceptor") &&
+ logEvent.getMarker().getName().equals("ENTRY")
+ ){
+ Map<String,String> mdc = logEvent.getMDCPropertyMap();
+ assertNotNull(mdc.get(ONAPLogConstants.MDCs.INSTANCE_UUID));
+ assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
+ assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID));
+ assertEquals("",mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME));
+ assertEquals("/manage/health",mdc.get(ONAPLogConstants.MDCs.SERVICE_NAME));
+ assertEquals("INPROGRESS",mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE));
+ }else if(logEvent.getLoggerName().equals("org.onap.so.logging.spring.interceptor.LoggingInterceptor") &&
+ logEvent.getMarker()!= null && logEvent.getMarker().getName().equals("EXIT")){
+ Map<String,String> mdc = logEvent.getMDCPropertyMap();
+ assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
+ assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID));
+ assertEquals("200",mdc.get(ONAPLogConstants.MDCs.RESPONSE_CODE));
+ assertEquals("",mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME));
+ assertEquals("/manage/health",mdc.get(ONAPLogConstants.MDCs.SERVICE_NAME));
+ assertEquals("COMPLETED",mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE));
+ }
}
/* Service Resources Endpoint */
@@ -767,8 +789,8 @@ public class CatalogDBRestTest {
logEvent.getMarker().getName().equals("ENTRY")
){
Map<String,String> mdc = logEvent.getMDCPropertyMap();
- assertNotNull(mdc.get(MsoLogger.BEGINTIME));
- assertNotNull(mdc.get(MsoLogger.REQUEST_ID));
+ assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP));
+ assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
assertNotNull(mdc.get(MsoLogger.INVOCATION_ID));
assertEquals("UNKNOWN",mdc.get(MsoLogger.PARTNERNAME));
assertEquals("v2/vfModules",mdc.get(MsoLogger.SERVICE_NAME));
@@ -776,9 +798,9 @@ public class CatalogDBRestTest {
}else if(logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging") &&
logEvent.getMarker().getName().equals("EXIT")){
Map<String,String> mdc = logEvent.getMDCPropertyMap();
- assertNotNull(mdc.get(MsoLogger.BEGINTIME));
+ assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP));
assertNotNull(mdc.get(MsoLogger.ENDTIME));
- assertNotNull(mdc.get(MsoLogger.REQUEST_ID));
+ assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
assertNotNull(mdc.get(MsoLogger.INVOCATION_ID));
assertEquals("500",mdc.get(MsoLogger.RESPONSECODE));
assertEquals("UNKNOWN",mdc.get(MsoLogger.PARTNERNAME));
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CloudConfigTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CloudConfigTest.java
index 9ed61b33a3..0606848b04 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CloudConfigTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CloudConfigTest.java
@@ -21,33 +21,16 @@
package org.onap.so.adapters.catalogdb.catalogrest;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import java.net.URI;
-import java.util.List;
-
import javax.transaction.Transactional;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.so.adapters.catalogdb.CatalogDBApplication;
import org.onap.so.db.catalog.beans.AuthenticationType;
-import org.onap.so.db.catalog.beans.BuildingBlockDetail;
import org.onap.so.db.catalog.beans.CloudIdentity;
import org.onap.so.db.catalog.beans.CloudSite;
-import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization;
-import org.onap.so.db.catalog.beans.CollectionResourceCustomization;
-import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization;
-import org.onap.so.db.catalog.beans.InstanceGroup;
-import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization;
import org.onap.so.db.catalog.beans.ServerType;
-import org.onap.so.db.catalog.client.CatalogDbClient;
-import org.onap.so.logger.MsoLogger;
-import org.onap.so.logging.jaxrs.filter.jersey.SpringClientFilter;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.embedded.LocalServerPort;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.client.TestRestTemplate;
@@ -55,15 +38,9 @@ import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
-import org.springframework.http.client.BufferingClientHttpRequestFactory;
-import org.springframework.http.client.ClientHttpRequestFactory;
-import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.web.util.UriComponentsBuilder;
-import uk.co.blackpepper.bowman.Client;
-import uk.co.blackpepper.bowman.ClientFactory;
-import uk.co.blackpepper.bowman.Configuration;
import static com.shazam.shazamcrest.MatcherAssert.assertThat;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/NetworkCollectionCatalogDbQueryTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/NetworkCollectionCatalogDbQueryTest.java
index f09df8823c..fcc3eb4d66 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/NetworkCollectionCatalogDbQueryTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/NetworkCollectionCatalogDbQueryTest.java
@@ -39,7 +39,7 @@ import org.onap.so.db.catalog.beans.CollectionResourceCustomization;
import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization;
import org.onap.so.db.catalog.beans.InstanceGroup;
import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization;
-import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.onap.so.db.catalog.client.CatalogDbClientPortChanger;
import org.onap.so.logger.MsoLogger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.embedded.LocalServerPort;
@@ -59,14 +59,14 @@ public class NetworkCollectionCatalogDbQueryTest {
@LocalServerPort
private int port;
-
+ boolean isInitialized;
+
@Autowired
- private CatalogDbClient client;
-
+ CatalogDbClientPortChanger client;
+
@Before
- public void setPort() {
- client.removePortFromEndpoint();
- client.setPortToEndpoint(Integer.toString(port));
+ public void initialize(){
+ client.wiremockPort= String.valueOf(port);
}
@Test
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientPortChanger.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientPortChanger.java
new file mode 100644
index 0000000000..bf69686a76
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientPortChanger.java
@@ -0,0 +1,40 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.db.catalog.client;
+
+import org.springframework.stereotype.Component;
+
+import java.net.URI;
+
+@Component()
+public class CatalogDbClientPortChanger extends CatalogDbClient {
+
+ public String wiremockPort;
+
+ protected URI getUri(String template) {
+ URI uri = URI.create(template);
+ String path = uri.getPath();
+ String prefix = "http://localhost:" + wiremockPort;
+ String query = uri.getQuery();
+
+ return URI.create(prefix + path + (query == null || query.isEmpty()?"":"?"+query));
+ }
+}
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
new file mode 100644
index 0000000000..4ec5839cb6
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
@@ -0,0 +1,366 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.db.catalog.client;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.onap.so.adapters.catalogdb.CatalogDBApplication;
+import org.onap.so.db.catalog.beans.CloudSite;
+import org.onap.so.db.catalog.beans.CloudifyManager;
+import org.onap.so.db.catalog.beans.InstanceGroup;
+import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
+import org.onap.so.db.catalog.beans.Service;
+import org.onap.so.db.catalog.beans.ServiceRecipe;
+import org.onap.so.db.catalog.beans.VfModule;
+import org.onap.so.db.catalog.beans.VfModuleCustomization;
+import org.onap.so.db.catalog.beans.VnfComponentsRecipe;
+import org.onap.so.db.catalog.beans.VnfRecipe;
+import org.onap.so.db.catalog.beans.VnfResource;
+import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.context.embedded.LocalServerPort;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import java.util.List;
+import java.util.UUID;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = CatalogDBApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+@ActiveProfiles("test")
+public class CatalogDbClientTest {
+ public static final String MTN13 = "mtn13";
+ @LocalServerPort
+ private int port;
+ @Autowired
+ CatalogDbClientPortChanger client;
+
+ @Before
+ public void initialize() {
+ client.wiremockPort = String.valueOf(port);
+ }
+
+ @Test
+ public void testGetCloudSiteHappyPath() throws Exception {
+ CloudSite cloudSite = client.getCloudSite(MTN13);
+ Assert.assertNotNull(cloudSite);
+ Assert.assertNotNull(cloudSite.getIdentityService());
+ Assert.assertEquals("MDT13", cloudSite.getClli());
+ Assert.assertEquals("mtn13", cloudSite.getRegionId());
+ Assert.assertEquals("MTN13", cloudSite.getIdentityServiceId());
+ }
+
+ @Test
+ public void testGetCloudSiteNotFound() throws Exception {
+ CloudSite cloudSite = client.getCloudSite(UUID.randomUUID().toString());
+ Assert.assertNull(cloudSite);
+ }
+
+ @Test
+ public void testGetCloudifyManagerHappyPath() throws Exception {
+ CloudifyManager cloudifyManager = client.getCloudifyManager("mtn13");
+ Assert.assertNotNull(cloudifyManager);
+ Assert.assertEquals("http://localhost:28090/v2.0", cloudifyManager.getCloudifyUrl());
+
+ }
+
+ @Test
+ public void testGetCloudifyManagerNotFound() throws Exception {
+ CloudifyManager cloudifyManager = client.getCloudifyManager(UUID.randomUUID().toString());
+ Assert.assertNull(cloudifyManager);
+ }
+
+
+ @Test
+ public void testGetCloudSiteByClliAndAicVersionHappyPath() throws Exception {
+ CloudSite cloudSite = client.getCloudSiteByClliAndAicVersion("MDT13", "2.5");
+ Assert.assertNotNull(cloudSite);
+ }
+
+ @Test
+ public void testGetCloudSiteByClliAndAicVersionNotFound() throws Exception {
+ CloudSite cloudSite = client.getCloudSiteByClliAndAicVersion("MDT13", "232496239746328");
+ Assert.assertNull(cloudSite);
+ }
+
+ @Test
+ public void testGetServiceByID() throws Exception {
+ Service serviceByID = client.getServiceByID("5df8b6de-2083-11e7-93ae-92361f002671");
+ Assert.assertNotNull(serviceByID);
+ Assert.assertEquals("MSOTADevInfra_vSAMP10a_Service", serviceByID.getModelName());
+ Assert.assertEquals("NA", serviceByID.getServiceType());
+ Assert.assertEquals("NA", serviceByID.getServiceRole());
+ }
+
+ @Test
+ public void testGetServiceByIDNotFound() throws Exception {
+ Service serviceByID = client.getServiceByID(UUID.randomUUID().toString());
+ Assert.assertNull(serviceByID);
+ }
+
+ @Test
+ public void testGetVfModuleByModelUUID() throws Exception {
+ VfModule vfModule = client.getVfModuleByModelUUID("20c4431c-246d-11e7-93ae-92361f002671");
+ Assert.assertNotNull(vfModule);
+ Assert.assertNotNull(vfModule.getVfModuleCustomization());
+ Assert.assertEquals("78ca26d0-246d-11e7-93ae-92361f002671", vfModule.getModelInvariantUUID());
+ Assert.assertEquals("vSAMP10aDEV::base::module-0", vfModule.getModelName());
+ }
+
+ @Test
+ public void testGetVfModuleByModelUUIDNotFound() throws Exception {
+ VfModule vfModule = client.getVfModuleByModelUUID(UUID.randomUUID().toString());
+ Assert.assertNull(vfModule);
+ }
+
+ @Test
+ public void testGetVnfResourceByModelUUID() throws Exception {
+ VnfResource vnfResource = client.getVnfResourceByModelUUID("ff2ae348-214a-11e7-93ae-92361f002671");
+ Assert.assertNotNull(vnfResource);
+ Assert.assertEquals("vSAMP10a", vnfResource.getModelName());
+ }
+
+ @Test
+ public void testGetVnfResourceByModelUUIDNotFound() throws Exception {
+ VnfResource vnfResource = client.getVnfResourceByModelUUID(UUID.randomUUID().toString());
+ Assert.assertNull(vnfResource);
+ }
+
+ @Test
+ public void testGetVnfResourceCustomizationByModelCustomizationUUID() {
+ VnfResourceCustomization vnfResourceCustomization = client.getVnfResourceCustomizationByModelCustomizationUUID("68dc9a92-214c-11e7-93ae-92361f002671");
+ Assert.assertNotNull(vnfResourceCustomization);
+ Assert.assertEquals("vSAMP", vnfResourceCustomization.getNfRole());
+ Assert.assertNotNull(vnfResourceCustomization.getModelCustomizationUUID());
+ Assert.assertNotNull(vnfResourceCustomization.getVnfResources());
+ Assert.assertNotNull(vnfResourceCustomization.getVfModuleCustomizations());
+ Assert.assertEquals("vSAMP10a", vnfResourceCustomization.getVnfResources().getModelName());
+
+ }
+
+ @Test
+ public void testGetVnfResourceCustomizationByModelCustomizationUUINotFound() {
+ VnfResourceCustomization vnfResourceCustomization = client.getVnfResourceCustomizationByModelCustomizationUUID(UUID.randomUUID().toString());
+ Assert.assertNull(vnfResourceCustomization);
+ }
+
+ @Test
+ public void testGetInstanceGroupByModelUUID() {
+ InstanceGroup instanceGroup = client.getInstanceGroupByModelUUID("0c8692ef-b9c0-435d-a738-edf31e71f38b");
+ Assert.assertNotNull(instanceGroup);
+ Assert.assertEquals("network_collection_resource_1806..NetworkCollection..0", instanceGroup.getModelName());
+ Assert.assertEquals("org.openecomp.resource.cr.NetworkCollectionResource1806", instanceGroup.getToscaNodeType().toString());
+ }
+
+ @Test
+ public void testGetVfModuleCustomizationByModelCuztomizationUUID() {
+ VfModuleCustomization vfModuleCustomization = client.getVfModuleCustomizationByModelCuztomizationUUID("cb82ffd8-252a-11e7-93ae-92361f002671");
+ Assert.assertNotNull(vfModuleCustomization);
+ Assert.assertNotNull(vfModuleCustomization.getModelCustomizationUUID());
+ Assert.assertEquals("base", vfModuleCustomization.getLabel());
+ }
+
+ @Test
+ public void testGetVfModuleCustomizationByModelCuztomizationUUIDNotFound() {
+ VfModuleCustomization vfModuleCustomization = client.getVfModuleCustomizationByModelCuztomizationUUID(UUID.randomUUID().toString());
+ Assert.assertNull(vfModuleCustomization);
+ }
+
+ @Test
+ public void testGetNetworkResourceCustomizationByModelCustomizationUUID() {
+ NetworkResourceCustomization networkResourceCustomization = client.getNetworkResourceCustomizationByModelCustomizationUUID("3bdbb104-476c-483e-9f8b-c095b3d308ac");
+ Assert.assertNotNull(networkResourceCustomization);
+ Assert.assertNotNull(networkResourceCustomization.getModelCustomizationUUID());
+ Assert.assertEquals("CONTRAIL30_GNDIRECT 9", networkResourceCustomization.getModelInstanceName());
+ Assert.assertNotNull(networkResourceCustomization.getNetworkResource());
+ }
+
+ @Test
+ public void testGetNetworkResourceCustomizationByModelCustomizationUUIDNotFound() {
+ NetworkResourceCustomization networkResourceCustomization = client.getNetworkResourceCustomizationByModelCustomizationUUID(UUID.randomUUID().toString());
+ Assert.assertNull(networkResourceCustomization);
+ }
+
+ @Test
+ public void testGgetVfModuleCustomizationByModelCustomizationUUIDAndVfModuleModelUUID() {
+ VfModuleCustomization vfModuleCustomization = client.getVfModuleCustomizationByModelCustomizationUUIDAndVfModuleModelUUID("cb82ffd8-252a-11e7-93ae-92361f002672", "20c4431c-246d-11e7-93ae-92361f002672");
+ Assert.assertNotNull(vfModuleCustomization);
+ Assert.assertNotNull(vfModuleCustomization.getModelCustomizationUUID());
+ Assert.assertNotNull(vfModuleCustomization.getVfModule());
+ Assert.assertEquals("base", vfModuleCustomization.getLabel());
+ }
+
+ @Test
+ public void testGgetVfModuleCustomizationByModelCustomizationUUIDAndVfModuleModelUUIDNotFound() {
+ VfModuleCustomization vfModuleCustomization = client.getVfModuleCustomizationByModelCustomizationUUIDAndVfModuleModelUUID("cb82ffd8-252a-11e7-93ae-92361f002672", UUID.randomUUID().toString());
+ Assert.assertNull(vfModuleCustomization);
+ }
+
+ @Test
+ public void testGetFirstByServiceModelUUIDAndAction() {
+ ServiceRecipe serviceRecipe = client.getFirstByServiceModelUUIDAndAction("4694a55f-58b3-4f17-92a5-796d6f5ffd0d", "createInstance");
+ Assert.assertNotNull(serviceRecipe);
+ Assert.assertNotNull(serviceRecipe.getServiceModelUUID());
+ Assert.assertNotNull(serviceRecipe.getAction());
+ Assert.assertEquals("/mso/async/services/CreateGenericALaCarteServiceInstance", serviceRecipe.getOrchestrationUri());
+ Assert.assertEquals("MSOTADevInfra aLaCarte", serviceRecipe.getDescription());
+ }
+
+ @Test
+ public void testGetFirstByServiceModelUUIDAndActionNotFound() {
+ ServiceRecipe serviceRecipe = client.getFirstByServiceModelUUIDAndAction("5df8b6de-2083-11e7-93ae-92361f002671", UUID.randomUUID().toString());
+ Assert.assertNull(serviceRecipe);
+ }
+
+ @Test
+ public void testGetFirstVnfResourceByModelInvariantUUIDAndModelVersion() {
+ VnfResource vnfResource = client.getFirstVnfResourceByModelInvariantUUIDAndModelVersion("2fff5b20-214b-11e7-93ae-92361f002671", "2.0");
+ Assert.assertNotNull(vnfResource);
+ Assert.assertNotNull(vnfResource.getModelInvariantId());
+ Assert.assertNotNull(vnfResource.getModelVersion());
+ Assert.assertNotNull(vnfResource.getHeatTemplates());
+ Assert.assertNotNull(vnfResource.getVnfResourceCustomizations());
+ Assert.assertEquals("vSAMP10a", vnfResource.getModelName());
+ }
+
+ @Test
+ public void testGetFirstVnfResourceByModelInvariantUUIDAndModelVersionNotFound() {
+ VnfResource vnfResource = client.getFirstVnfResourceByModelInvariantUUIDAndModelVersion("2fff5b20-214b-11e7-93ae-92361f002671", UUID.randomUUID().toString());
+ Assert.assertNull(vnfResource);
+ }
+
+ @Test
+ public void testGetFirstVnfResourceCustomizationByModelInstanceNameAndVnfResources() {
+ VnfResource vnfr = new VnfResource();
+ vnfr.setModelUUID("ff2ae348-214a-11e7-93ae-92361f002671");
+ VnfResourceCustomization firstVnfResourceCustomizationByModelInstanceNameAndVnfResources = client.getFirstVnfResourceCustomizationByModelInstanceNameAndVnfResources("vSAMP10a 1", vnfr);
+ Assert.assertNotNull(firstVnfResourceCustomizationByModelInstanceNameAndVnfResources);
+ Assert.assertEquals("vSAMP", firstVnfResourceCustomizationByModelInstanceNameAndVnfResources.getNfRole());
+ Assert.assertEquals("vSAMP10a 1", firstVnfResourceCustomizationByModelInstanceNameAndVnfResources.getModelInstanceName());
+ Assert.assertNotNull(firstVnfResourceCustomizationByModelInstanceNameAndVnfResources.getVnfResources());
+ Assert.assertNotNull(firstVnfResourceCustomizationByModelInstanceNameAndVnfResources.getVfModuleCustomizations());
+ }
+
+ @Test
+ public void testGetFirstVnfRecipeByNfRoleAndAction() {
+ VnfRecipe vnfRecipe = client.getFirstVnfRecipeByNfRoleAndAction("GR-API-DEFAULT", "createInstance");
+ Assert.assertNotNull(vnfRecipe);
+ Assert.assertNotNull(vnfRecipe.getNfRole());
+ Assert.assertNotNull(vnfRecipe.getAction());
+ Assert.assertEquals("Gr api recipe to create vnf", vnfRecipe.getDescription());
+ Assert.assertEquals("/mso/async/services/WorkflowActionBB", vnfRecipe.getOrchestrationUri());
+ }
+
+ @Test
+ public void testGetFirstVnfRecipeByNfRoleAndActionNotFound() {
+ VnfRecipe vnfRecipe = client.getFirstVnfRecipeByNfRoleAndAction(UUID.randomUUID().toString(), "createInstance");
+ Assert.assertNull(vnfRecipe);
+ }
+
+ @Test
+ public void testGetFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction() {
+ VnfComponentsRecipe vnfComponentsRecipe = client.getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction("20c4431c-246d-11e7-93ae-92361f002671", "volumeGroup", "createInstance");
+ Assert.assertNotNull(vnfComponentsRecipe);
+ Assert.assertNotNull(vnfComponentsRecipe.getAction());
+ Assert.assertNotNull(vnfComponentsRecipe.getVfModuleModelUUID());
+ Assert.assertNotNull(vnfComponentsRecipe.getVnfComponentType());
+ Assert.assertEquals("Gr api recipe to create volume-group", vnfComponentsRecipe.getDescription());
+ Assert.assertEquals("/mso/async/services/WorkflowActionBB", vnfComponentsRecipe.getOrchestrationUri());
+
+ }
+
+
+ @Test
+ public void testGetFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndActionNotFound() {
+ VnfComponentsRecipe vnfComponentsRecipe = client.getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(UUID.randomUUID().toString(), "volumeGroup", "createInstance");
+ Assert.assertNull(vnfComponentsRecipe);
+ }
+
+ @Test
+ public void testGetFirstVnfComponentsRecipeByVnfComponentTypeAndAction() {
+ VnfComponentsRecipe vnfComponentsRecipe = client.getFirstVnfComponentsRecipeByVnfComponentTypeAndAction("volumeGroup", "createInstance");
+ Assert.assertNotNull(vnfComponentsRecipe);
+ Assert.assertNotNull(vnfComponentsRecipe.getAction());
+ Assert.assertNotNull(vnfComponentsRecipe.getVnfComponentType());
+ Assert.assertEquals("VID_DEFAULT recipe t", vnfComponentsRecipe.getDescription());
+ Assert.assertEquals("/mso/async/services/CreateVfModuleVolumeInfraV1", vnfComponentsRecipe.getOrchestrationUri());
+ }
+
+ @Test
+ public void testGetServiceByModelVersionAndModelInvariantUUID() {
+ Service service = client.getServiceByModelVersionAndModelInvariantUUID("2.0", "9647dfc4-2083-11e7-93ae-92361f002671");
+ Assert.assertNotNull(service);
+ Assert.assertNotNull(service.getModelVersion());
+ Assert.assertNotNull(service.getModelInvariantUUID());
+ Assert.assertEquals("MSOTADevInfra_vSAMP10a_Service", service.getModelName());
+ Assert.assertEquals("NA", service.getServiceRole());
+ }
+
+ @Test
+ public void testGetServiceByModelVersionAndModelInvariantUUIDNotFound() {
+ Service service = client.getServiceByModelVersionAndModelInvariantUUID("2.0", UUID.randomUUID().toString());
+ Assert.assertNull(service);
+ }
+
+ @Test
+ public void testGetVfModuleByModelInvariantUUIDAndModelVersion() {
+ VfModule vfModule = client.getVfModuleByModelInvariantUUIDAndModelVersion("78ca26d0-246d-11e7-93ae-92361f002671", "2");
+ Assert.assertNotNull(vfModule);
+ Assert.assertNotNull(vfModule.getModelVersion());
+ Assert.assertNotNull(vfModule.getModelInvariantUUID());
+ Assert.assertEquals("vSAMP10aDEV::base::module-0", vfModule.getModelName());
+ Assert.assertEquals("vSAMP10a DEV Base", vfModule.getDescription());
+ }
+
+ @Test
+ public void testGetVfModuleByModelInvariantUUIDAndModelVersionNotFound() {
+ VfModule vfModule = client.getVfModuleByModelInvariantUUIDAndModelVersion(UUID.randomUUID().toString(), "2");
+ Assert.assertNull(vfModule);
+ }
+
+ @Test
+ public void testGetServiceByModelInvariantUUIDOrderByModelVersionDesc() {
+ List<Service> serviceList = client.getServiceByModelInvariantUUIDOrderByModelVersionDesc("9647dfc4-2083-11e7-93ae-92361f002671");
+ Assert.assertFalse(serviceList.isEmpty());
+ Assert.assertEquals(2, serviceList.size());
+ Service service = serviceList.get(0);
+ Assert.assertEquals("2.0", service.getModelVersion());
+ }
+
+ @Test
+ public void testGetServiceByModelInvariantUUIDOrderByModelVersionDescNotFound() {
+ List<Service> serviceList = client.getServiceByModelInvariantUUIDOrderByModelVersionDesc(UUID.randomUUID().toString());
+ Assert.assertTrue(serviceList.isEmpty());
+ }
+
+ @Test
+ public void testGetVfModuleByModelInvariantUUIDOrderByModelVersionDesc() {
+ List<VfModule> moduleList = client.getVfModuleByModelInvariantUUIDOrderByModelVersionDesc("78ca26d0-246d-11e7-93ae-92361f002671");
+ Assert.assertFalse(moduleList.isEmpty());
+ Assert.assertEquals(2, moduleList.size());
+ VfModule module = moduleList.get(0);
+ Assert.assertEquals("vSAMP10a DEV Base",module.getDescription());
+ }
+}
diff --git a/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql b/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql
index 4106e8ac6d..d5cdb18a0c 100644
--- a/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql
+++ b/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql
@@ -95,7 +95,7 @@ insert into heat_environment(artifact_uuid, name, version, description, body, ar
('fefb1751-4333-11e7-9252-005056850d2e', 'module_nso.env', '2', 'Auto-generated HEAT Environment deployment artifact', 'parameters:\n availability_zone_0: \"alln-zone-1\"\n nso_flavor_name: \"citeis.1vCPUx2GB\"\n nso_image_name: \"RHEL-6.8-BASE-20160912\"\n nso_name_0: \"zrdm3vamp01nso001\"\n nso_oam_ip_0: \"172.18.25.175\"\n nso_oam_net_gw: \"172.18.25.1\"\n nso_oam_net_mask: \"255.255.255.0\"\n nso_sec_grp_id: \"36f48d82-f099-4437-bfbc-70d9e5d420d1\"\n nso_srv_grp_id: \"e431c477-5bd1-476a-bfa9-e4ce16b8356b\"\n oam_net_id: \"nso_oam\"\n vf_module_id: \"145cd730797234b4a40aa99335abc143\"\n vnf_id: \"730797234b4a40aa99335157b02871cd\"\n vnf_name: \"Mobisupport\"\n', 'MWI2ODY0Yjc1NDJjNWU1NjdkMTAyMjVkNzFmZDU0MzA=', '2017-11-27 08:42:58');
insert into vnf_resource(orchestration_mode, description, creation_timestamp, model_uuid, aic_version_min, aic_version_max, model_invariant_uuid, model_version, model_name, tosca_node_type, heat_template_artifact_uuid) values
-('HEAT', '1607 vSAMP10a - inherent network', '2017-04-14 21:46:28', 'ff2ae348-214a-11e7-93ae-92361f002671', '', '', '2fff5b20-214b-11e7-93ae-92361f002671', '1.0', 'vSAMP10a', 'VF', null);
+('HEAT', '1607 vSAMP10a - inherent network', '2017-04-14 21:46:28', 'ff2ae348-214a-11e7-93ae-92361f002671', '', '', '2fff5b20-214b-11e7-93ae-92361f002671', '1.0', 'vSAMP10a', 'VF', 'ff874603-4222-11e7-9252-005056850d2e');
insert into vnf_resource_customization(model_customization_uuid, model_instance_name, min_instances, max_instances, availability_zone_max_count, nf_type, nf_role, nf_function, nf_naming_code, creation_timestamp, vnf_resource_model_uuid, multi_stage_design) values
('68dc9a92-214c-11e7-93ae-92361f002671', 'vSAMP10a 1', '0', '0', '0', 'vSAMP', 'vSAMP', 'vSAMP', 'vSAMP', '2017-05-26 15:08:24', 'ff2ae348-214a-11e7-93ae-92361f002671', null);
@@ -135,7 +135,7 @@ insert into collection_network_resource_customization(model_customization_uuid,
('1a61be4b-3378-4c9a-91c8-c919519b2d01', 'CONTRAIL30_GNDIRECT 9', '', '', '', '', '2017-04-19 14:28:32', '10b36f65-f4e6-4be6-ae49-9596dc1c47fc', '0c8692ef-b9c0-435d-a738-edf31e71f38b', 'a07a5826-3281-485c-8f40-6988011ef3f2');
insert into vnf_resource(orchestration_mode, description, creation_timestamp, model_uuid, aic_version_min, aic_version_max, model_invariant_uuid, model_version, model_name, tosca_node_type, heat_template_artifact_uuid) values
-('HEAT', '1607 vSAMP10a - inherent network', '2017-04-14 21:46:28', 'ff2ae348-214a-11e7-93ae-92361f002672', '', '', '2fff5b20-214b-11e7-93ae-92361f002671', '2.0', 'vSAMP10a', 'VF', null);
+('HEAT', '1607 vSAMP10a - inherent network', '2017-04-14 21:46:28', 'ff2ae348-214a-11e7-93ae-92361f002672', '', '', '2fff5b20-214b-11e7-93ae-92361f002671', '2.0', 'vSAMP10a', 'VF', 'ff874603-4222-11e7-9252-005056850d2e');
insert into vnf_resource_customization(model_customization_uuid, model_instance_name, min_instances, max_instances, availability_zone_max_count, nf_type, nf_role, nf_function, nf_naming_code, creation_timestamp, vnf_resource_model_uuid, multi_stage_design) values
@@ -183,3 +183,21 @@ insert into allotted_resource_customization_to_service(service_model_uuid, resou
insert into vnf_components(vnf_id, component_type, heat_template_id, heat_environment_id, creation_timestamp) values
('13961', 'VOLUME', '13843', '13961', '2016-05-19 20:22:02');
+
+
+INSERT INTO `cloudify_managers` (`ID`, `CLOUDIFY_URL`, `USERNAME`, `PASSWORD`, `VERSION`, `LAST_UPDATED_BY`, `CREATION_TIMESTAMP`, `UPDATE_TIMESTAMP`) VALUES ('mtn13', 'http://localhost:28090/v2.0', 'm93945', '93937EA01B94A10A49279D4572B48369', NULL, 'MSO_USER', '2018-07-17 14:05:08', '2018-07-17 14:05:08');
+
+INSERT INTO `identity_services` (`ID`, `IDENTITY_URL`, `MSO_ID`, `MSO_PASS`, `ADMIN_TENANT`, `MEMBER_ROLE`, `TENANT_METADATA`, `IDENTITY_SERVER_TYPE`, `IDENTITY_AUTHENTICATION_TYPE`, `LAST_UPDATED_BY`, `CREATION_TIMESTAMP`, `UPDATE_TIMESTAMP`) VALUES ('MTN13', 'http://localhost:28090/v2.0', 'm93945', '93937EA01B94A10A49279D4572B48369', 'admin', 'admin', 1, 'KEYSTONE', 'USERNAME_PASSWORD', 'MSO_USER', '2018-07-17 14:02:33', '2018-07-17 14:02:33');
+
+INSERT INTO `cloud_sites` (`ID`, `REGION_ID`, `IDENTITY_SERVICE_ID`, `CLOUD_VERSION`, `CLLI`, `CLOUDIFY_ID`, `PLATFORM`, `ORCHESTRATOR`, `LAST_UPDATED_BY`, `CREATION_TIMESTAMP`, `UPDATE_TIMESTAMP`) VALUES ('mtn13', 'mtn13', 'MTN13', '2.5', 'MDT13', 'mtn13', NULL, 'orchestrator', 'MSO_USER', '2018-07-17 14:06:28', '2018-07-17 14:06:28');
+
+INSERT INTO service_recipe(ID, ACTION, VERSION_STR, DESCRIPTION, ORCHESTRATION_URI, SERVICE_PARAM_XSD, RECIPE_TIMEOUT, SERVICE_TIMEOUT_INTERIM, CREATION_TIMESTAMP, SERVICE_MODEL_UUID) VALUES
+('8', 'createInstance', '8', 'MSOTADevInfra aLaCarte', '/mso/async/services/CreateGenericALaCarteServiceInstance', null, '180', '0', '2017-04-14 19:18:20', '4694a55f-58b3-4f17-92a5-796d6f5ffd0d');
+
+INSERT INTO vnf_recipe (nf_role, ACTION, VERSION_STR, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT)
+VALUES
+('GR-API-DEFAULT', 'createInstance', '1', 'Gr api recipe to create vnf', '/mso/async/services/WorkflowActionBB', 180);
+
+INSERT INTO vnf_components_recipe (VNF_COMPONENT_TYPE, ACTION, VERSION, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT, VF_MODULE_MODEL_UUID)
+VALUES
+('volumeGroup', 'createInstance', '1', 'Gr api recipe to create volume-group', '/mso/async/services/WorkflowActionBB', 180, '20c4431c-246d-11e7-93ae-92361f002671'); \ No newline at end of file