aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java37
-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.java20
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java288
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql17
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java209
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java1257
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/DeactivateAndCloudDeleteVfModule.json4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/DeleteVfModule.json4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/NetworkInstanceNoReqParams.json3
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ReplaceVfModule.json4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ScaleOutRequest.json2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceInstanceActivate.json2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/UpdateVfModule.json4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/UpdateVnf.json2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/UpdateVnfRecipe_Response.json20
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/networkRecipeVNF_API_Response.json19
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/networkRecipe_Response.json19
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/networkResourceCustomization_Response.json21
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/networkResource_Response.json34
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/serviceVnf_Response.json46
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/service_Response.json177
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vfModuleCustomizationPCM_Response.json26
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vfModuleCustomizationVolGrp_Response.json26
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vfModuleCustomization_Response.json26
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vfModuleCustomizationsPCM_Response.json37
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vfModulePCM_Response.json30
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vfModuleVolGroup_Response.json41
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vfModule_Response.json41
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vfModulesListByInvariantId_Response.json82
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfComponentRecipeDeactivate_Response.json19
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfComponentRecipeDeleteVfModule_Response.json19
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfComponentRecipeVNF_API_Response.json19
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfComponentRecipeVfModuleScaleOut_Response.json19
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfComponentRecipeVolGrp_GRAPI_Response.json19
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfComponentRecipe_GRAPI_Response.json19
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfComponentRecipe_Response.json19
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfRecipeApplyUpdatedConfig_Response.json20
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfRecipeCreateInstance_Response.json20
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfRecipeDelete_Response.json20
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfRecipeInPlaceUpdate_Response.json20
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfRecipeReplaceInstance_Response.json20
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfRecipe_Response.json20
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfResourceCustomizationForVfModule_Response.json32
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfResourceCustomization_ReplaceVnf_Response.json32
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfResourceCustomization_Response.json32
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfResourceCustomizationsList_Response.json140
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfResourceForVfModule_Response.json101
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfResourcesCreateVnf_Response.json197
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfResources_ReplaceVnf_Response.json130
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfResources_Response.json71
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/AllottedResource.java4
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/AllottedResourceCustomization.java2
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java516
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ArRecipeRepository.java2
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/BuildingBlockDetailRepository.java3
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudSiteRepository.java3
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ModelRecipeRepository.java2
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ModelRepository.java2
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkRecipeRepository.java2
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkResourceRepository.java4
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NorthBoundRequestRepository.java4
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/OrchestrationFlowRepository.java9
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/OrchestrationStatusStateTransitionDirectiveRepository.java3
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/RainyDayHandlerStatusRepository.java5
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRecipeRepository.java7
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRepository.java14
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VFModuleRepository.java11
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfComponentRecipeRepository.java8
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfCustomizationRepository.java9
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfRecipeRepository.java2
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfResourceRepository.java4
-rw-r--r--pom.xml3
73 files changed, 3414 insertions, 705 deletions
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 d77fb097ae..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
@@ -53,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;
@@ -107,6 +94,18 @@ 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/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..b52cf73fe5
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientPortChanger.java
@@ -0,0 +1,20 @@
+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
index f75adc62c0..b1c3bdb29c 100644
--- 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
@@ -2,18 +2,29 @@ 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.CloudIdentity;
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)
@@ -24,12 +35,11 @@ public class CatalogDbClientTest {
@LocalServerPort
private int port;
@Autowired
- CatalogDbClient client;
+ CatalogDbClientPortChanger client;
@Before
- public void setPort() {
- client.removePortFromEndpoint();
- client.setPortToEndpoint(Integer.toString(port));
+ public void initialize() {
+ client.wiremockPort = String.valueOf(port);
}
@Test
@@ -63,16 +73,274 @@ public class CatalogDbClientTest {
}
-
@Test
- public void testGetCloudSiteByClliAndAicVersionHappyPath() throws Exception{
- CloudSite cloudSite = client.getCloudSiteByClliAndAicVersion("MDT13","2.5");
+ 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");
+ 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 c3969b4a51..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
@@ -189,4 +189,15 @@ INSERT INTO `cloudify_managers` (`ID`, `CLOUDIFY_URL`, `USERNAME`, `PASSWORD`, `
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'); \ No newline at end of file
+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
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java
index ced69df55c..a7dac34aa0 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java
@@ -22,27 +22,13 @@
package org.onap.so.apihandlerinfra;
-import java.io.IOException;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-
-import javax.transaction.Transactional;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.DELETE;
-import javax.ws.rs.POST;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.container.ContainerRequestContext;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang.StringUtils;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
@@ -70,21 +56,12 @@ import org.onap.so.db.catalog.beans.VfModuleCustomization;
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.onap.so.db.catalog.data.repository.NetworkRecipeRepository;
-import org.onap.so.db.catalog.data.repository.NetworkResourceCustomizationRepository;
-import org.onap.so.db.catalog.data.repository.ServiceRecipeRepository;
-import org.onap.so.db.catalog.data.repository.ServiceRepository;
-import org.onap.so.db.catalog.data.repository.VFModuleCustomizationRepository;
-import org.onap.so.db.catalog.data.repository.VFModuleRepository;
-import org.onap.so.db.catalog.data.repository.VnfComponentRecipeRepository;
-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.client.CatalogDbClient;
import org.onap.so.db.request.beans.InfraActiveRequests;
-import org.onap.so.db.request.data.repository.InfraActiveRequestsRepository;
import org.onap.so.exceptions.ValidationException;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
+import org.onap.so.requestsdb.client.RequestsDbClient;
import org.onap.so.serviceinstancebeans.CloudConfiguration;
import org.onap.so.serviceinstancebeans.ModelInfo;
import org.onap.so.serviceinstancebeans.ModelType;
@@ -104,14 +81,25 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
-import com.fasterxml.jackson.annotation.JsonInclude.Include;
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.JsonMappingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
+import javax.transaction.Transactional;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.POST;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.io.IOException;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
@Component
@Path("/onap/so/infra/serviceInstantiation")
@@ -129,37 +117,10 @@ public class ServiceInstances {
private RequestClientFactory reqClientFactory;
@Autowired
- private ServiceRepository serviceRepo;
-
- @Autowired
- private ServiceRecipeRepository serviceRecipeRepo;
-
- @Autowired
- private NetworkRecipeRepository networkRecipeRepo;
-
- @Autowired
- private NetworkResourceCustomizationRepository networkCustomizationRepo;
-
- @Autowired
- private VnfResourceRepository vnfRepo;
-
- @Autowired
- private VnfCustomizationRepository vnfCustomRepo;
-
- @Autowired
- private VnfRecipeRepository vnfRecipeRepo;
-
- @Autowired
- private VFModuleCustomizationRepository vfModuleCustomRepo;
-
- @Autowired
- private VFModuleRepository vfModuleRepo;
-
- @Autowired
- private VnfComponentRecipeRepository vnfComponentRecipeRepo;
-
+ private CatalogDbClient catalogDbClient;
+
@Autowired
- private InfraActiveRequestsRepository iar;
+ private RequestsDbClient infraActiveRequestsClient;
@Autowired
private ResponseBuilder builder;
@@ -707,9 +668,9 @@ public class ServiceInstances {
String modelVersionId = modelInfo.getModelVersionId();
if(modelVersionId != null) {
- vfm = vfModuleRepo.findByModelUUID(modelVersionId);
+ vfm = catalogDbClient.getVfModuleByModelUUID(modelVersionId);
} else {
- vfm = vfModuleRepo.findByModelInvariantUUIDAndModelVersion(modelInfo.getModelInvariantId(), modelInfo.getModelVersion());
+ vfm = catalogDbClient.getVfModuleByModelInvariantUUIDAndModelVersion(modelInfo.getModelInvariantId(), modelInfo.getModelVersion());
}
if (vfm != null) {
@@ -765,7 +726,7 @@ public class ServiceInstances {
if (sir.getCorrelationId() != null) {
correlationId = sir.getCorrelationId();
}
- iar.save(currentActiveReq);
+ infraActiveRequestsClient.save(currentActiveReq);
if(!requestScope.equalsIgnoreCase(ModelType.service.name())){
aLaCarte = true;
@@ -897,7 +858,7 @@ public class ServiceInstances {
currentActiveReq.setRequestStatus(Status.IN_PROGRESS.name());
setInstanceId(currentActiveReq, requestScope, jsonResponse.getRequestReferences().getInstanceId(), new HashMap<>());
- iar.save(currentActiveReq);
+ infraActiveRequestsClient.save(currentActiveReq);
return builder.buildResponse(HttpStatus.SC_ACCEPTED, requestId, jsonResponse, apiVersion);
}
}
@@ -1006,7 +967,7 @@ public class ServiceInstances {
InfraActiveRequests dup = null;
try {
if(!(instanceName==null && requestScope.equals("service") && (action == Action.createInstance || action == Action.activateInstance || action == Action.assignInstance))){
- dup = iar.checkInstanceNameDuplicate (instanceIdMap, instanceName, requestScope);
+ dup = infraActiveRequestsClient.checkInstanceNameDuplicate (instanceIdMap, instanceName, requestScope);
}
} catch (Exception e) {
ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DUPLICATE_CHECK_EXC, MsoLogger.ErrorCode.DataError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
@@ -1036,32 +997,12 @@ public class ServiceInstances {
.errorInfo(errorLoggerInfo).build();
String requestScope = requestScopeFromUri(requestUri);
- createErrorRequestRecord(Status.FAILED, requestId, validateException.getMessage(), action, requestScope, requestJSON);
+ msoRequest.createErrorRequestRecord(Status.FAILED, requestId, validateException.getMessage(), action, requestScope, requestJSON);
throw validateException;
}
}
- //TODO MSO-4177 -- remove this and call the msoRequest instead
- public void createErrorRequestRecord (Status status, String requestId, String errorMessage, Actions action, String requestScope, String requestJSON) {
- try {
- InfraActiveRequests request = new InfraActiveRequests(requestId);
- Timestamp startTimeStamp = new Timestamp (System.currentTimeMillis());
- request.setStartTime (startTimeStamp);
- request.setRequestStatus(status.toString());
- request.setStatusMessage(errorMessage);
- request.setProgress((long) 100);
- request.setLastModifiedBy(Constants.MODIFIED_BY_APIHANDLER);
- request.setRequestAction(action.toString());
- request.setRequestScope(requestScope);
- request.setRequestBody(requestJSON);
- Timestamp endTimeStamp = new Timestamp(System.currentTimeMillis());
- request.setEndTime(endTimeStamp);
- iar.save(request);
- } catch (Exception e) {
- msoLogger.error(MessageEnum.APIH_DB_UPDATE_EXC, e.getMessage(), "", "", MsoLogger.ErrorCode.DataError, "Exception when updating record in DB");
- msoLogger.debug ("Exception: ", e);
- }
- }
+
private void parseRequest(ServiceInstancesRequest sir, HashMap<String, String> instanceIdMap, Actions action, String version,
String requestJSON, Boolean aLaCarte, String requestId, InfraActiveRequests currentActiveReq) throws ValidateException {
int reqVersion = Integer.parseInt(version.substring(1));
@@ -1144,8 +1085,7 @@ public class ServiceInstances {
}
return recipeLookupResult;
}
-
-
+
private RecipeLookupResult getServiceURI(ServiceInstancesRequest servInstReq, Actions action, boolean alaCarteFlag) throws IOException {
// SERVICE REQUEST
// Construct the default service name
@@ -1158,18 +1098,18 @@ public class ServiceInstances {
ServiceRecipe recipe = null;
if(alaCarteFlag){
- serviceRecord = serviceRepo.findByModelNameOrderByModelVersionDesc(defaultServiceModelName);
- if(serviceRecord !=null){
- recipe = serviceRecord.getRecipes().get(action.toString());
+ serviceRecord = catalogDbClient.getFirstByModelNameOrderByModelVersionDesc(defaultServiceModelName);
+ if(serviceRecord !=null){
+ recipe =catalogDbClient.getFirstByServiceModelUUIDAndAction(serviceRecord.getModelUUID(),action.toString());
}
}else{
- serviceRecord = serviceRepo.findOneByModelUUID(modelInfo.getModelVersionId());
- recipe = serviceRecipeRepo.findFirstByServiceModelUUIDAndAction(modelInfo.getModelVersionId(), action.toString());
+ serviceRecord = catalogDbClient.getServiceByID(modelInfo.getModelVersionId());
+ recipe = catalogDbClient.getFirstByServiceModelUUIDAndAction(modelInfo.getModelVersionId(), action.toString());
if (recipe == null){
- serviceRecordList = serviceRepo.findByModelInvariantUUIDOrderByModelVersionDesc(modelInfo.getModelInvariantId());
+ serviceRecordList = catalogDbClient.getServiceByModelInvariantUUIDOrderByModelVersionDesc(modelInfo.getModelInvariantId());
if(!serviceRecordList.isEmpty()){
for(org.onap.so.db.catalog.beans.Service record : serviceRecordList){
- recipe = record.getRecipes().get(action.toString());
+ recipe = catalogDbClient.getFirstByServiceModelUUIDAndAction(record.getModelUUID(),action.toString());
if(recipe != null){
break;
}
@@ -1185,8 +1125,8 @@ public class ServiceInstances {
} else if(!alaCarteFlag && recipe != null && Action.createInstance.equals(action)) {
mapToLegacyRequest(requestDetails);
}else if (recipe == null) { //aLaCarte wasn't sent, so we'll try the default
- serviceRecord = serviceRepo.findByModelNameOrderByModelVersionDesc(defaultServiceModelName);
- recipe = serviceRecord.getRecipes().get( action.toString());
+ serviceRecord = catalogDbClient.getFirstByModelNameOrderByModelVersionDesc(defaultServiceModelName);
+ recipe = catalogDbClient.getFirstByServiceModelUUIDAndAction(serviceRecord.getModelUUID(),action.toString());
}
if(modelInfo.getModelVersionId() == null) {
modelInfo.setModelVersionId(serviceRecord.getModelUUID());
@@ -1381,14 +1321,14 @@ public class ServiceInstances {
// Validation for vnfResource
if(modelCustomizationId!=null) {
- vrc = vnfCustomRepo.findOneByModelCustomizationUUID(modelCustomizationId);
+ vrc = catalogDbClient.getVnfResourceCustomizationByModelCustomizationUUID(modelCustomizationId);
if(vrc != null){
vnfResource = vrc.getVnfResources();
}
} else {
- org.onap.so.db.catalog.beans.Service service = serviceRepo.findOneByModelUUID(relatedInstanceModelVersionId);
+ org.onap.so.db.catalog.beans.Service service = catalogDbClient.getServiceByID(relatedInstanceModelVersionId);
if(service == null) {
- service = serviceRepo.findByModelVersionAndModelInvariantUUID(relatedInstanceVersion, relatedInstanceModelInvariantId);
+ service = catalogDbClient.getServiceByModelVersionAndModelInvariantUUID(relatedInstanceVersion, relatedInstanceModelInvariantId);
}
if(service == null) {
@@ -1420,12 +1360,12 @@ public class ServiceInstances {
if(vrc != null) {
String nfRole = vrc.getNfRole();
if(nfRole != null) {
- vnfRecipe = vnfRecipeRepo.findVnfRecipeByNfRoleAndAction(vrc.getNfRole(), action.toString());
+ vnfRecipe = catalogDbClient.getFirstVnfRecipeByNfRoleAndAction(vrc.getNfRole(), action.toString());
}
}
if(vnfRecipe == null) {
- vnfRecipe = vnfRecipeRepo.findVnfRecipeByNfRoleAndAction(defaultSource, action.toString());
+ vnfRecipe = catalogDbClient.getFirstVnfRecipeByNfRoleAndAction(defaultSource, action.toString());
}
if (vnfRecipe == null) {
@@ -1449,13 +1389,13 @@ public class ServiceInstances {
VfModule vfModule = null;
if(modelInfo.getModelCustomizationId() != null) {
- vfmc = vfModuleCustomRepo.findByModelCustomizationUUID(modelInfo.getModelCustomizationId());
+ vfmc = catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID(modelInfo.getModelCustomizationId());
} else {
- vnfr = vnfRepo.findResourceByModelUUID(relatedInstanceModelVersionId);
+ vnfr = catalogDbClient.getVnfResourceByModelUUID(relatedInstanceModelVersionId);
if(vnfr == null){
- vnfr = vnfRepo.findResourceByModelInvariantUUIDAndModelVersion(relatedInstanceModelInvariantId, relatedInstanceVersion);
+ vnfr = catalogDbClient.getFirstVnfResourceByModelInvariantUUIDAndModelVersion(relatedInstanceModelInvariantId, relatedInstanceVersion);
}
- vnfrc = vnfCustomRepo.findByModelInstanceNameAndVnfResources(relatedInstanceModelCustomizationName, vnfr);
+ vnfrc = catalogDbClient.getFirstVnfResourceCustomizationByModelInstanceNameAndVnfResources(relatedInstanceModelCustomizationName, vnfr);
List<VfModuleCustomization> list = vnfrc.getVfModuleCustomizations();
@@ -1463,16 +1403,16 @@ public class ServiceInstances {
for(VfModuleCustomization vf : list) {
VfModuleCustomization vfmCustom;
if(vfModuleModelUUID != null){
- vfmCustom = vfModuleCustomRepo.findByModelCustomizationUUIDAndVfModuleModelUUID(vf.getModelCustomizationUUID(), vfModuleModelUUID);
+ vfmCustom = catalogDbClient.getVfModuleCustomizationByModelCustomizationUUIDAndVfModuleModelUUID(vf.getModelCustomizationUUID(), vfModuleModelUUID);
if(vfmCustom != null){
vfModule = vfmCustom.getVfModule();
}
}else{
- vfmCustom = vfModuleCustomRepo.findByModelCustomizationUUID(vf.getModelCustomizationUUID());
+ vfmCustom = catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID(vf.getModelCustomizationUUID());
if(vfmCustom != null){
vfModule = vfmCustom.getVfModule();
}else{
- vfModule = vfModuleRepo.findByModelInvariantUUIDAndModelVersion(relatedInstanceModelInvariantId, relatedInstanceVersion);
+ vfModule = catalogDbClient.getVfModuleByModelInvariantUUIDAndModelVersion(relatedInstanceModelInvariantId, relatedInstanceVersion);
}
}
@@ -1495,12 +1435,12 @@ public class ServiceInstances {
}
- recipe = vnfComponentRecipeRepo.findVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(vfModule.getModelUUID(), vnfComponentType, action.toString());
+ recipe = catalogDbClient.getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(vfModule.getModelUUID(), vnfComponentType, action.toString());
if(recipe == null){
- List<VfModule> vfModuleRecords= vfModuleRepo.findByModelInvariantUUIDOrderByModelVersionDesc(vfModule.getModelInvariantUUID());
+ List<VfModule> vfModuleRecords= catalogDbClient.getVfModuleByModelInvariantUUIDOrderByModelVersionDesc(vfModule.getModelInvariantUUID());
if(!vfModuleRecords.isEmpty()){
for(VfModule record : vfModuleRecords){
- recipe = vnfComponentRecipeRepo.findVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(record.getModelUUID(), vnfComponentType, action.toString());
+ recipe = catalogDbClient.getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(record.getModelUUID(), vnfComponentType, action.toString());
if(recipe != null){
break;
}
@@ -1508,9 +1448,9 @@ public class ServiceInstances {
}
}
if(recipe == null) {
- recipe = vnfComponentRecipeRepo.findVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(defaultSource, vnfComponentType, action.toString());
+ recipe = catalogDbClient.getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(defaultSource, vnfComponentType, action.toString());
if (recipe == null) {
- recipe = vnfComponentRecipeRepo.findVnfComponentsRecipeByVnfComponentTypeAndAction(vnfComponentType, action.toString());
+ recipe = catalogDbClient.getFirstVnfComponentsRecipeByVnfComponentTypeAndAction(vnfComponentType, action.toString());
}
if(recipe == null) {
@@ -1521,12 +1461,12 @@ public class ServiceInstances {
} else {
if(modelInfo.getModelType().equals(ModelType.vnf)) {
- recipe = vnfRecipeRepo.findVnfRecipeByNfRoleAndAction(defaultSource, action.toString());
+ recipe = catalogDbClient.getFirstVnfRecipeByNfRoleAndAction(defaultSource, action.toString());
if (recipe == null) {
return null;
}
} else {
- recipe = vnfComponentRecipeRepo.findVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(defaultSource, vnfComponentType, action.toString());
+ recipe = catalogDbClient.getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(defaultSource, vnfComponentType, action.toString());
if (recipe == null) {
return null;
@@ -1541,7 +1481,7 @@ public class ServiceInstances {
String defaultSource = getDefaultModel(sir);
- VnfRecipe vnfRecipe = vnfRecipeRepo.findVnfRecipeByNfRoleAndAction(defaultSource, action.toString());
+ VnfRecipe vnfRecipe = catalogDbClient.getFirstVnfRecipeByNfRoleAndAction(defaultSource, action.toString());
if (vnfRecipe == null) {
return null;
@@ -1560,22 +1500,22 @@ public class ServiceInstances {
Recipe recipe = null;
if(modelInfo.getModelCustomizationId()!=null){
- NetworkResource networkResource = networkCustomizationRepo.findOneByModelCustomizationUUID(modelInfo.getModelCustomizationId()).getNetworkResource();
+ NetworkResource networkResource = catalogDbClient.getNetworkResourceCustomizationByModelCustomizationUUID(modelInfo.getModelCustomizationId()).getNetworkResource();
if(networkResource!=null){
if(modelInfo.getModelVersionId() == null) {
modelInfo.setModelVersionId(networkResource.getModelUUID());
}
- recipe = networkRecipeRepo.findByModelNameAndAction(networkResource.getModelName(), action.toString());
+ recipe = catalogDbClient.getFirstNetworkRecipeByModelNameAndAction(networkResource.getModelName(), action.toString());
}else{
throw new ValidationException("no catalog entry found");
}
}else{
//ok for version < 3 and action delete
- recipe = networkRecipeRepo.findByModelNameAndAction(modelName, action.toString());
+ recipe = catalogDbClient.getFirstNetworkRecipeByModelNameAndAction(modelName, action.toString());
}
if(recipe == null){
- recipe = networkRecipeRepo.findByModelNameAndAction(defaultNetworkType, action.toString());
+ recipe = catalogDbClient.getFirstNetworkRecipeByModelNameAndAction(defaultNetworkType, action.toString());
}
return recipe !=null ? new RecipeLookupResult(recipe.getOrchestrationUri(), recipe.getRecipeTimeout()) : null;
@@ -1679,7 +1619,7 @@ public class ServiceInstances {
if (sir.getCorrelationId() != null) {
correlationId = sir.getCorrelationId();
}
- iar.save(currentActiveReq);
+ infraActiveRequestsClient.save(currentActiveReq);
if(!requestScope.equalsIgnoreCase(ModelType.service.name())){
aLaCarte = true;
@@ -1706,7 +1646,6 @@ public class ServiceInstances {
throw validateException;
}
}
- //TODO MSO-4177 -- remove this and call the msoRequest instead
public void updateStatus(InfraActiveRequests aq, Status status, String errorMessage){
if ((status == Status.FAILED) || (status == Status.COMPLETE)) {
aq.setStatusMessage (errorMessage);
@@ -1714,7 +1653,7 @@ public class ServiceInstances {
aq.setRequestStatus(status.toString());
Timestamp endTimeStamp = new Timestamp (System.currentTimeMillis());
aq.setEndTime (endTimeStamp);
- iar.save(aq);
+ infraActiveRequestsClient.save(aq);
}
}
} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java
index 48d424c8d1..5b37d772c6 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java
@@ -21,33 +21,17 @@
package org.onap.so.apihandlerinfra;
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.post;
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
-import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
-import static org.hamcrest.CoreMatchers.containsString;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
-
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.util.List;
-import java.util.Map;
-
-import javax.ws.rs.core.HttpHeaders;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-import org.apache.log4j.MDC;
-import org.junit.Ignore;
+import ch.qos.logback.classic.spi.ILoggingEvent;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.github.tomakehurst.wiremock.http.Fault;
+import org.apache.http.HttpStatus;
+import org.junit.Before;
import org.junit.Test;
+import org.onap.so.db.catalog.beans.Service;
+import org.onap.so.db.catalog.beans.ServiceRecipe;
import org.onap.so.db.request.beans.InfraActiveRequests;
-import org.onap.so.db.request.data.repository.InfraActiveRequestsRepository;
import org.onap.so.logger.MsoLogger;
import org.onap.so.serviceinstancebeans.CloudConfiguration;
import org.onap.so.serviceinstancebeans.ModelInfo;
@@ -57,50 +41,84 @@ import org.onap.so.serviceinstancebeans.RequestReferences;
import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
import org.onap.so.serviceinstancebeans.ServiceInstancesResponse;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
+import org.springframework.util.ResourceUtils;
import org.springframework.web.util.UriComponentsBuilder;
-import com.fasterxml.jackson.annotation.JsonInclude.Include;
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.JsonMappingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.github.tomakehurst.wiremock.http.Fault;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.List;
+import java.util.Map;
-import ch.qos.logback.classic.spi.ILoggingEvent;
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.post;
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
public class ServiceInstancesTest extends BaseTest{
- @Autowired
- private InfraActiveRequestsRepository iar;
-
+ private final ObjectMapper mapper = new ObjectMapper();
+
@Autowired
private ServiceInstances servInstances;
+ @Value("${wiremock.server.port}")
+ private String wiremockPort;
+
private final String servInstanceuri = "/onap/so/infra/serviceInstantiation/";
private final String servInstanceUriPrev7 = "/onap/so/infra/serviceInstances/";
private String uri;
+ @Before
+ public void beforeClass() {
+ stubFor(post(urlMatching(".*/infraActiveRequests.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withStatus(HttpStatus.SC_OK)));
+ }
+
public String inputStream(String JsonInput)throws IOException{
JsonInput = "src/test/resources/ServiceInstanceTest" + JsonInput;
- String input = new String(Files.readAllBytes(Paths.get(JsonInput)));
- return input;
+ return new String(Files.readAllBytes(Paths.get(JsonInput)));
}
+ private String getWiremockResponseForCatalogdb(String file) {
+ try {
+ File resource= ResourceUtils.getFile("classpath:__files/catalogdb/"+file);
+ return new String(Files.readAllBytes(resource.toPath())).replaceAll("localhost:8090","localhost:"+wiremockPort);
+ } catch (IOException e) {
+ e.printStackTrace();
+ return null;
+ }
+
+ }
+
+
public ResponseEntity<String> sendRequest(String requestJson, String uriPath, HttpMethod reqMethod){
headers.set("Accept", MediaType.APPLICATION_JSON);
- headers.set("Content-Type",MediaType.APPLICATION_JSON);
+ headers.set(HttpHeaders.CONTENT_TYPE,MediaType.APPLICATION_JSON);
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(createURLWithPort(uriPath));
- HttpEntity<String> request = new HttpEntity<String>(requestJson, headers);
- ResponseEntity<String> response = restTemplate.exchange(builder.toUriString(),
- reqMethod, request, String.class);
+ HttpEntity<String> request = new HttpEntity<>(requestJson, headers);
- return response;
+ return restTemplate.exchange(builder.toUriString(),
+ reqMethod, request, String.class);
}
@Test
@@ -118,13 +136,34 @@ public class ServiceInstancesTest extends BaseTest{
}
@Test
- public void createServiceInstanceVIDDefault() throws JsonParseException, JsonMappingException, IOException{
+ public void createServiceInstanceVIDDefault() throws IOException{
TestAppender.events.clear();
+
+ ServiceRecipe serviceRecipe = new ServiceRecipe();
+ serviceRecipe.setOrchestrationUri("/mso/async/services/WorkflowActionBB");
+ serviceRecipe.setServiceModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a");
+ serviceRecipe.setAction(Action.createInstance.toString());
+ serviceRecipe.setId(1);
+ serviceRecipe.setRecipeTimeout(180);
+ Service defaultService = new Service();
+ defaultService.setModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a");
+
+
stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
- headers.set(MsoLogger.ONAP_REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
+ stubFor(get(urlMatching(".*/service/search/.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(defaultService))
+ .withStatus(HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/serviceRecipe/search.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(serviceRecipe))
+ .withStatus(HttpStatus.SC_OK)));
+
+ headers.set(MsoLogger.TRANSACTION_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
headers.set(MsoLogger.CLIENT_ID, "VID");
//expect
ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse();
@@ -171,33 +210,33 @@ public class ServiceInstancesTest extends BaseTest{
assertEquals("0", response.getHeaders().get("X-PatchVersion").get(0));
assertEquals("5.0.0", response.getHeaders().get("X-LatestVersion").get(0));
}
-
- //ExpectedRecord
- InfraActiveRequests expectedRecord = new InfraActiveRequests();
- expectedRecord.setRequestStatus("IN_PROGRESS");
- expectedRecord.setRequestBody(inputStream("/ServiceInstanceDefault.json"));
- expectedRecord.setAction("createInstance");
- expectedRecord.setSource("VID");
- expectedRecord.setVnfId("1882938");
- expectedRecord.setLastModifiedBy("APIH");
- expectedRecord.setServiceInstanceId("1882939");
- expectedRecord.setServiceInstanceName("testService9");
- expectedRecord.setRequestScope("service");
- expectedRecord.setRequestorId("xxxxxx");
- expectedRecord.setRequestAction("createInstance");
- expectedRecord.setRequestId("32807a28-1a14-4b88-b7b3-2950918aa76d");
-
- //ActualRecord
- InfraActiveRequests requestRecord = iar.findOneByRequestId("32807a28-1a14-4b88-b7b3-2950918aa76d");
- assertEquals(sameBeanAs(expectedRecord).toString(), sameBeanAs(requestRecord).ignoring("startTime").ignoring("modifyTime").toString());
-
}
@Test
- public void createServiceInstanceServiceInstancesUri() throws JsonParseException, JsonMappingException, IOException{
+ public void createServiceInstanceServiceInstancesUri() throws IOException{
+ ServiceRecipe serviceRecipe = new ServiceRecipe();
+ serviceRecipe.setOrchestrationUri("/mso/async/services/CreateGenericALaCarteServiceInstance");
+ serviceRecipe.setServiceModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a");
+ serviceRecipe.setAction(Action.createInstance.toString());
+ serviceRecipe.setId(1);
+ serviceRecipe.setRecipeTimeout(180);
+ Service defaultService = new Service();
+ defaultService.setModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a");
+
stubFor(post(urlPathEqualTo("/mso/async/services/CreateGenericALaCarteServiceInstance"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+
+ stubFor(get(urlMatching(".*/service/search/.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(defaultService))
+ .withStatus(HttpStatus.SC_OK)));
+ stubFor(get(urlMatching(".*/serviceRecipe/search.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(serviceRecipe))
+ .withStatus(HttpStatus.SC_OK)));
+
//expect
ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse();
RequestReferences requestReferences = new RequestReferences();
@@ -215,10 +254,31 @@ public class ServiceInstancesTest extends BaseTest{
assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId"));
}
@Test
- public void createServiceInstanceBpelStatusError() throws JsonParseException, JsonMappingException, IOException{
+ public void createServiceInstanceBpelStatusError() throws IOException{
+ ServiceRecipe serviceRecipe = new ServiceRecipe();
+ serviceRecipe.setOrchestrationUri("/mso/async/services/WorkflowActionBB");
+ serviceRecipe.setServiceModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a");
+ serviceRecipe.setAction(Action.createInstance.toString());
+ serviceRecipe.setId(1);
+ serviceRecipe.setRecipeTimeout(180);
+ Service defaultService = new Service();
+ defaultService.setModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a");
+
+
stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_BAD_GATEWAY)));
+
+
+ stubFor(get(urlMatching(".*/service/search/.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(defaultService))
+ .withStatus(HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/serviceRecipe/search.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(serviceRecipe))
+ .withStatus(HttpStatus.SC_OK)));
uri = servInstanceuri + "v5/serviceInstances";
ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceStatusError.json"), uri, HttpMethod.POST);
@@ -226,19 +286,28 @@ public class ServiceInstancesTest extends BaseTest{
assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
}
@Test
- public void createServiceInstanceBadGateway() throws JsonParseException, JsonMappingException, IOException{
+ public void createServiceInstanceBadGateway() throws IOException{
+ ServiceRecipe serviceRecipe = new ServiceRecipe();
+ serviceRecipe.setOrchestrationUri("/mso/async/services/WorkflowActionBB");
+ serviceRecipe.setServiceModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a");
+ serviceRecipe.setAction(Action.createInstance.toString());
+ serviceRecipe.setId(1);
+ serviceRecipe.setRecipeTimeout(180);
+ Service defaultService = new Service();
+ defaultService.setModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a");
+
stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB"))
.willReturn(aResponse().withStatus(org.apache.http.HttpStatus.SC_BAD_GATEWAY).withBody("{}")));
+
+ stubFor(get(urlMatching(".*/service/search/.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(defaultService))
+ .withStatus(HttpStatus.SC_OK)));
- uri = servInstanceuri + "v5/serviceInstances";
- ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceBadGateway.json"), uri, HttpMethod.POST);
-
- assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
- }
- @Test
- public void createServiceInstanceBadData() throws JsonParseException, JsonMappingException, IOException{
- stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB"))
- .willReturn(aResponse().withStatus(org.apache.http.HttpStatus.SC_BAD_GATEWAY).withBody("{I AM REALLY BAD}")));
+ stubFor(get(urlMatching(".*/serviceRecipe/search.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(serviceRecipe))
+ .withStatus(HttpStatus.SC_OK)));
uri = servInstanceuri + "v5/serviceInstances";
ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceBadGateway.json"), uri, HttpMethod.POST);
@@ -246,56 +315,98 @@ public class ServiceInstancesTest extends BaseTest{
assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(), response.getStatusCode().value());
}
@Test
- public void createServiceInstanceEmptyResponse() throws JsonParseException, JsonMappingException, IOException{
+ public void createServiceInstanceEmptyResponse() throws IOException{
+ ServiceRecipe serviceRecipe = new ServiceRecipe();
+ serviceRecipe.setOrchestrationUri("/mso/async/services/WorkflowActionBB");
+ serviceRecipe.setServiceModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a");
+ serviceRecipe.setAction(Action.createInstance.toString());
+ serviceRecipe.setId(1);
+ serviceRecipe.setRecipeTimeout(180);
+ Service defaultService = new Service();
+ defaultService.setModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a");
+
stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB"))
.willReturn(aResponse().withFault(Fault.EMPTY_RESPONSE)));
-
+
+ stubFor(get(urlMatching(".*/service/search/.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(defaultService))
+ .withStatus(HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/serviceRecipe/search.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(serviceRecipe))
+ .withStatus(HttpStatus.SC_OK)));
+
uri = servInstanceuri + "v5/serviceInstances";
ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceEmpty.json"), uri, HttpMethod.POST);
assertEquals(Response.Status.BAD_GATEWAY.getStatusCode(), response.getStatusCode().value());
}
@Test
- public void activateServiceInstanceNoRecipeALaCarte() throws JsonParseException, JsonMappingException, IOException{
+ public void activateServiceInstanceNoRecipeALaCarte() throws IOException{
uri = servInstanceuri + "v5" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/activate";
headers.set("X-ECOMP-RequestID", "32807a28-1a14-4b88-b7b3-2950918aa76d");
ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceALaCarteTrueNoRecipe.json"), uri, HttpMethod.POST);
- //ExpectedRecord
- InfraActiveRequests expectedRecord = new InfraActiveRequests();
- expectedRecord.setRequestStatus("FAILED");
- expectedRecord.setAction("activateInstance");
- expectedRecord.setStatusMessage("Recipe could not be retrieved from catalog DB.");
- expectedRecord.setProgress(new Long(100));
- expectedRecord.setSource("VID");
- expectedRecord.setVnfId("1882938");
- expectedRecord.setRequestBody(inputStream("/ServiceInstanceALaCarteTrueNoRecipe.json"));
- expectedRecord.setLastModifiedBy("APIH");
- expectedRecord.setServiceInstanceId("f7ce78bb-423b-11e7-93f8-0050569a7968");
- expectedRecord.setServiceInstanceName("testService7");
- expectedRecord.setRequestScope("service");
- expectedRecord.setRequestAction("activateInstance");
- expectedRecord.setRequestorId("xxxxxx");
- expectedRecord.setRequestId("32807a28-1a14-4b88-b7b3-2950918aa76d");
+ Service defaultService = new Service();
+ defaultService.setModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a");
+
+ stubFor(get(urlMatching(".*/service/search/.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(defaultService))
+ .withStatus(HttpStatus.SC_OK)));
+
+
+ stubFor(get(urlMatching(".*/serviceRecipe/search/findFirstByServiceModelUUIDAndAction?serviceModelUUID=d88da85c-d9e8-4f73-b837-3a72a431622a&action=activateInstance"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withStatus(HttpStatus.SC_NOT_FOUND)));
- //ActualRecord
- InfraActiveRequests requestRecord = iar.findOneByRequestId("32807a28-1a14-4b88-b7b3-2950918aa76d");
- assertEquals(sameBeanAs(expectedRecord).toString(), sameBeanAs(requestRecord).ignoring("startTime").ignoring("endTime").ignoring("modifyTime").toString());
assertEquals(Response.Status.NOT_FOUND.getStatusCode(), response.getStatusCode().value());
}
@Test
- public void activateServiceInstanceNoRecipe() throws JsonParseException, JsonMappingException, IOException{
+ public void activateServiceInstanceNoRecipe() throws IOException{
uri = servInstanceuri + "v5" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/activate";
+ Service defaultService = new Service();
+ defaultService.setModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a");
+ stubFor(get(urlMatching(".*/service/search/.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(defaultService))
+ .withStatus(HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/serviceRecipe/search/.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withStatus(HttpStatus.SC_NOT_FOUND)));
+
ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceNoRecipe.json"), uri, HttpMethod.POST);
assertEquals(Response.Status.NOT_FOUND.getStatusCode(), response.getStatusCode().value());
}
@Test
- public void activateServiceInstance() throws JsonParseException, JsonMappingException, IOException{
- stubFor(post(urlPathEqualTo("/mso/async/services/ActivateInstance"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ public void activateServiceInstance() throws IOException{
+ ServiceRecipe serviceRecipe = new ServiceRecipe();
+ serviceRecipe.setOrchestrationUri("/mso/async/services/WorkflowActionBB");
+ serviceRecipe.setServiceModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a");
+ serviceRecipe.setAction(Action.createInstance.toString());
+ serviceRecipe.setId(1);
+ serviceRecipe.setRecipeTimeout(180);
+ Service defaultService = new Service();
+ defaultService.setModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a");
+
+ stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
+ stubFor(get(urlMatching(".*/service/search/.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(defaultService))
+ .withStatus(HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/serviceRecipe/search.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(serviceRecipe))
+ .withStatus(HttpStatus.SC_OK)));
+
headers.set("X-TransactionID", "32807a28-1a14-4b88-b7b3-2950918aa76d");
//expected response
ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse();
@@ -313,10 +424,36 @@ public class ServiceInstancesTest extends BaseTest{
assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId"));
}
@Test
- public void deactivateServiceInstance() throws JsonParseException, JsonMappingException, IOException{
- stubFor(post(urlPathEqualTo("/mso/async/services/DeactivateInstance"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ public void deactivateServiceInstance() throws IOException{
+
+ ServiceRecipe serviceRecipe = new ServiceRecipe();
+ serviceRecipe.setOrchestrationUri("/mso/async/services/WorkflowActionBB");
+ serviceRecipe.setServiceModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a");
+ serviceRecipe.setAction(Action.createInstance.toString());
+ serviceRecipe.setId(1);
+ serviceRecipe.setRecipeTimeout(180);
+ Service defaultService = new Service();
+ defaultService.setModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a");
+
+ stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/service/.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(defaultService))
+ .withStatus(HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/service/search/.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(defaultService))
+ .withStatus(HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/serviceRecipe/search.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(serviceRecipe))
+ .withStatus(HttpStatus.SC_OK)));
+
//expected response
ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse();
RequestReferences requestReferences = new RequestReferences();
@@ -333,10 +470,34 @@ public class ServiceInstancesTest extends BaseTest{
assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId"));
}
@Test
- public void deleteServiceInstance() throws JsonParseException, JsonMappingException, IOException {
- stubFor(post(urlPathEqualTo("/mso/async/services/DeleteInstance"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ public void deleteServiceInstance() throws IOException {
+ ServiceRecipe serviceRecipe = new ServiceRecipe();
+ serviceRecipe.setOrchestrationUri("/mso/async/services/WorkflowActionBB");
+ serviceRecipe.setServiceModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a");
+ serviceRecipe.setAction(Action.createInstance.toString());
+ serviceRecipe.setId(1);
+ serviceRecipe.setRecipeTimeout(180);
+ Service defaultService = new Service();
+ defaultService.setModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a");
+
+ stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/service/.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(defaultService))
+ .withStatus(HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/service/search/.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(defaultService))
+ .withStatus(HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/serviceRecipe/search.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(serviceRecipe))
+ .withStatus(HttpStatus.SC_OK)));
//expected response
ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse();
RequestReferences requestReferences = new RequestReferences();
@@ -353,10 +514,34 @@ public class ServiceInstancesTest extends BaseTest{
assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId"));
}
@Test
- public void assignServiceInstance() throws JsonParseException, JsonMappingException, IOException {
- stubFor(post(urlPathEqualTo("/mso/async/services/AssignServiceInstance"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ public void assignServiceInstance() throws IOException {
+ ServiceRecipe serviceRecipe = new ServiceRecipe();
+ serviceRecipe.setOrchestrationUri("/mso/async/services/WorkflowActionBB");
+ serviceRecipe.setServiceModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a");
+ serviceRecipe.setAction(Action.createInstance.toString());
+ serviceRecipe.setId(1);
+ serviceRecipe.setRecipeTimeout(180);
+ Service defaultService = new Service();
+ defaultService.setModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a");
+
+ stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/service/.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(defaultService))
+ .withStatus(HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/service/search/.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(defaultService))
+ .withStatus(HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/serviceRecipe/search.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(serviceRecipe))
+ .withStatus(HttpStatus.SC_OK)));
//expected response
ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse();
RequestReferences requestReferences = new RequestReferences();
@@ -374,10 +559,34 @@ public class ServiceInstancesTest extends BaseTest{
}
@Test
- public void unassignServiceInstance() throws JsonParseException, JsonMappingException, IOException {
- stubFor(post(urlPathEqualTo("/mso/async/services/UnassignServiceInstance"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ public void unassignServiceInstance() throws IOException {
+ ServiceRecipe serviceRecipe = new ServiceRecipe();
+ serviceRecipe.setOrchestrationUri("/mso/async/services/WorkflowActionBB");
+ serviceRecipe.setServiceModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a");
+ serviceRecipe.setAction(Action.createInstance.toString());
+ serviceRecipe.setId(1);
+ serviceRecipe.setRecipeTimeout(180);
+ Service defaultService = new Service();
+ defaultService.setModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a");
+
+ stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/service/.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(defaultService))
+ .withStatus(HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/service/search/.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(defaultService))
+ .withStatus(HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/serviceRecipe/search.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(serviceRecipe))
+ .withStatus(HttpStatus.SC_OK)));
//expected response
ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse();
RequestReferences requestReferences = new RequestReferences();
@@ -394,9 +603,9 @@ public class ServiceInstancesTest extends BaseTest{
assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId"));
}
@Test
- public void createPortConfiguration() throws JsonParseException, JsonMappingException, IOException {
+ public void createPortConfiguration() throws IOException {
stubFor(post(urlPathEqualTo("/mso/async/services/ALaCarteOrchestrator"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
headers.set("X-TransactionID", "32807a28-1a14-4b88-b7b3-2950918aa76d");
//expected response
@@ -416,16 +625,16 @@ public class ServiceInstancesTest extends BaseTest{
assertTrue(response.getBody().contains("1882939"));
}
@Test
- public void createPortConfigurationEmptyProductFamilyId() throws JsonParseException, JsonMappingException, IOException {
+ public void createPortConfigurationEmptyProductFamilyId() throws IOException {
uri = servInstanceuri + "v5" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7968/configurations";
ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceParseFail.json"), uri, HttpMethod.POST);
assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value());
}
@Test
- public void deletePortConfiguration() throws JsonParseException, JsonMappingException, IOException {
+ public void deletePortConfiguration() throws IOException {
stubFor(post(urlPathEqualTo("/mso/async/services/ALaCarteOrchestrator"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
headers.set("X-ECOMP-RequestID", "32807a28-1a14-4b88-b7b3-2950918aa76d");
@@ -445,9 +654,9 @@ public class ServiceInstancesTest extends BaseTest{
assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId"));
}
@Test
- public void enablePort() throws JsonParseException, JsonMappingException, IOException {
+ public void enablePort() throws IOException {
stubFor(post(urlPathEqualTo("/mso/async/services/ALaCarteOrchestrator"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
//expected response
ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse();
@@ -465,9 +674,9 @@ public class ServiceInstancesTest extends BaseTest{
assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId"));
}
@Test
- public void disablePort() throws JsonParseException, JsonMappingException, IOException {
+ public void disablePort() throws IOException {
stubFor(post(urlPathEqualTo("/mso/async/services/ALaCarteOrchestrator"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
//expected response
ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse();
@@ -485,9 +694,9 @@ public class ServiceInstancesTest extends BaseTest{
assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId"));
}
@Test
- public void activatePort() throws JsonParseException, JsonMappingException, IOException {
+ public void activatePort() throws IOException {
stubFor(post(urlPathEqualTo("/mso/async/services/ALaCarteOrchestrator"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
//expected response
ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse();
@@ -505,9 +714,9 @@ public class ServiceInstancesTest extends BaseTest{
assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId"));
}
@Test
- public void deactivatePort() throws JsonParseException, JsonMappingException, IOException {
+ public void deactivatePort() throws IOException {
stubFor(post(urlPathEqualTo("/mso/async/services/ALaCarteOrchestrator"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
//expected response
ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse();
@@ -525,9 +734,9 @@ public class ServiceInstancesTest extends BaseTest{
assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId"));
}
@Test
- public void addRelationships() throws JsonParseException, JsonMappingException, IOException {
+ public void addRelationships() throws IOException {
stubFor(post(urlPathEqualTo("/mso/async/services/ALaCarteOrchestrator"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
//expected response
@@ -546,9 +755,9 @@ public class ServiceInstancesTest extends BaseTest{
assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId"));
}
@Test
- public void removeRelationships() throws JsonParseException, JsonMappingException, IOException {
+ public void removeRelationships() throws IOException {
stubFor(post(urlPathEqualTo("/mso/async/services/ALaCarteOrchestrator"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
//expected response
@@ -567,11 +776,27 @@ public class ServiceInstancesTest extends BaseTest{
assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId"));
}
@Test
- public void createVnfInstanceNoALaCarte() throws JsonParseException, JsonMappingException, IOException {
+ public void createVnfInstanceNoALaCarte() throws IOException {
stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002671"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vnfResourceCustomization_ReplaceVnf_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002671/vnfResources"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vnfResources_ReplaceVnf_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/vnfRecipe/search/findFirstVnfRecipeByNfRoleAndAction[?]nfRole=GR-API-DEFAULT&action=createInstance"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vnfRecipeReplaceInstance_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
//expected response
ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse();
RequestReferences requestReferences = new RequestReferences();
@@ -588,11 +813,31 @@ public class ServiceInstancesTest extends BaseTest{
assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId"));
}
@Test
- public void createVnfInstance() throws JsonParseException, JsonMappingException, IOException {
+ public void createVnfInstance() throws IOException {
stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
+ stubFor(get(urlMatching(".*/service/5df8b6de-2083-11e7-93ae-92361f002672"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("serviceVnf_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+ stubFor(get(urlMatching(".*/service/5df8b6de-2083-11e7-93ae-92361f002672/vnfCustomizations"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vnfResourceCustomizationsList_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+
+ stubFor(get(urlMatching(".*/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002672/vnfResources"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vnfResourcesCreateVnf_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/vnfRecipe/search/findFirstVnfRecipeByNfRoleAndAction[?]nfRole=GR-API-DEFAULT&action=createInstance"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vnfRecipeCreateInstance_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
String requestId = "b7a6b76f-2ee2-416c-971b-548472a8c5c3";
headers.set(MsoLogger.ONAP_REQUEST_ID, requestId);
//expected response
@@ -606,22 +851,20 @@ public class ServiceInstancesTest extends BaseTest{
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
- InfraActiveRequests record = iar.findOneByRequestId(requestId);
assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class);
assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId"));
assertTrue(response.getBody().contains("1882939"));
- assertEquals(record.getVnfType(), "vSAMP12/test");
}
@Test
- public void createVnfWithServiceRelatedInstanceFail() throws JsonParseException, JsonMappingException, IOException {
+ public void createVnfWithServiceRelatedInstanceFail() throws IOException {
uri = servInstanceUriPrev7 + "v6" + "/f7ce78bb-423b-11e7-93f8-0050569a7968/vnfs";
ResponseEntity<String> response = sendRequest(inputStream("/VnfWithServiceRelatedInstanceFail.json"), uri, HttpMethod.POST);
assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value());
}
@Test
- public void createVnfInstanceInvalidVnfResource() throws JsonParseException, JsonMappingException, IOException {
+ public void createVnfInstanceInvalidVnfResource() throws IOException {
uri = servInstanceuri + "v7" + "/serviceInstances/ff305d54-75b4-431b-adb2-eb6b9e5ff000/vnfs";
ResponseEntity<String> response = sendRequest(inputStream("/NoVnfResource.json"), uri, HttpMethod.POST);
@@ -631,14 +874,28 @@ public class ServiceInstancesTest extends BaseTest{
assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value());
RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class);
- assertTrue(realResponse.getServiceException().getText().equals("No valid vnfResource is specified"));
+ assertEquals("No valid vnfResource is specified", realResponse.getServiceException().getText());
}
@Test
- public void replaceVnfInstance() throws JsonParseException, JsonMappingException, IOException {
+ public void replaceVnfInstance() throws IOException {
stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
+ stubFor(get(urlMatching(".*/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002671"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vnfResourceCustomization_ReplaceVnf_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002671/vnfResources"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vnfResources_ReplaceVnf_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/vnfRecipe/search/findFirstVnfRecipeByNfRoleAndAction[?]nfRole=GR-API-DEFAULT&action=replaceInstance"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vnfRecipeReplaceInstance_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
//expected response
ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse();
RequestReferences requestReferences = new RequestReferences();
@@ -655,11 +912,26 @@ public class ServiceInstancesTest extends BaseTest{
assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId"));
}
@Test
- public void replaceVnfRecreateInstance() throws JsonParseException, JsonMappingException, IOException {
+ public void replaceVnfRecreateInstance() throws IOException {
stubFor(post(urlPathEqualTo("/mso/async/services/RecreateInfraVce"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
+ stubFor(get(urlMatching(".*/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002674"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vnfResourceCustomization_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002674/vnfResources"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vnfResources_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/vnfRecipe/search/findFirstVnfRecipeByNfRoleAndAction[?]nfRole=TEST&action=replaceInstance"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vnfRecipe_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
//expected response
ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse();
RequestReferences requestReferences = new RequestReferences();
@@ -676,11 +948,27 @@ public class ServiceInstancesTest extends BaseTest{
assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId"));
}
@Test
- public void updateVnfInstance() throws JsonParseException, JsonMappingException, IOException {
+ public void updateVnfInstance() throws IOException {
stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
+ stubFor(get(urlMatching(".*/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002674"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vnfResourceCustomization_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002674/vnfResources"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vnfResources_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/vnfRecipe/search/findFirstVnfRecipeByNfRoleAndAction" +
+ "[?]nfRole=GR-API-DEFAULT&action=updateInstance"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("UpdateVnfRecipe_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
//expected response
ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse();
RequestReferences requestReferences = new RequestReferences();
@@ -697,11 +985,18 @@ public class ServiceInstancesTest extends BaseTest{
assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId"));
}
@Test
- public void applyUpdatedConfig() throws JsonParseException, JsonMappingException, IOException {
+ public void applyUpdatedConfig() throws IOException {
stubFor(post(urlPathEqualTo("/mso/async/services/VnfConfigUpdate"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/vnfRecipe/search/findFirstVnfRecipeByNfRoleAndAction" +
+ "[?]nfRole=GR-API-DEFAULT&action=applyUpdatedConfig"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vnfRecipeApplyUpdatedConfig_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
String requestId = "b7a6b76f-2ee2-416c-971b-548472a8c5c5";
headers.set(MsoLogger.ONAP_REQUEST_ID, requestId);
//expected response
@@ -715,18 +1010,21 @@ public class ServiceInstancesTest extends BaseTest{
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
- InfraActiveRequests record = iar.findOneByRequestId(requestId);
assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class);
assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId"));
- assertNull(record.getVnfType());
}
@Test
- public void deleteVnfInstanceV5() throws JsonParseException, JsonMappingException, IOException {
+ public void deleteVnfInstanceV5() throws IOException {
stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
+ stubFor(get(urlMatching(".*/vnfRecipe/search/findFirstVnfRecipeByNfRoleAndAction" +
+ "[?]nfRole=GR-API-DEFAULT&action=deleteInstance"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vnfRecipeDelete_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
//expected response
ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse();
RequestReferences requestReferences = new RequestReferences();
@@ -743,11 +1041,32 @@ public class ServiceInstancesTest extends BaseTest{
assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId"));
}
@Test
- public void createVfModuleInstance() throws JsonParseException, JsonMappingException, IOException {
- stubFor(post(urlPathEqualTo("/mso/async/services/CreateVfModuleInfra"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ public void createVfModuleInstance() throws IOException {
+
+ stubFor(get(urlMatching(".*/vfModuleCustomization/cb82ffd8-252a-11e7-93ae-92361f002671"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vfModuleCustomization_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/vfModuleCustomization/cb82ffd8-252a-11e7-93ae-92361f002671/vfModule"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vfModule_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/vfModule/20c4431c-246d-11e7-93ae-92361f002671"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vfModule_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ stubFor(post(urlPathEqualTo("/mso/async/services/CreateVfModuleInfra"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
+ stubFor(get(urlMatching(".*/vnfComponentsRecipe/search/findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction" +
+ "[?]vfModuleModelUUID=20c4431c-246d-11e7-93ae-92361f002671&vnfComponentType=vfModule&action=createInstance"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vnfComponentRecipe_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
//expected response
ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse();
RequestReferences requestReferences = new RequestReferences();
@@ -765,11 +1084,50 @@ public class ServiceInstancesTest extends BaseTest{
assertTrue(response.getBody().contains("1882939"));
}
@Test
- public void createVfModuleInstanceNoModelCustomization() throws JsonParseException, JsonMappingException, IOException {
- stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ public void createVfModuleInstanceNoModelCustomization() throws IOException {
+ stubFor(post(urlPathEqualTo("/mso/async/services/CreateVfModuleInfra"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
+ stubFor(get(urlMatching(".*/vnfResource/fe6478e4-ea33-3346-ac12-ab121484a3fe"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vnfResourceForVfModule_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/vnfResourceCustomization/search/findByModelInstanceNameAndVnfResources" +
+ "[?]modelInstanceName=test&vnfResourceModelUUID=fe6478e4-ea33-3346-ac12-ab121484a3fe"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vnfResourceCustomizationForVfModule_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002673/vfModuleCustomizations"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vfModuleCustomizationsPCM_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/vfModuleCustomization/search/findByModelCustomizationUUIDAndVfModuleModelUUID[?]" +
+ "modelCustomizationUUID=b4ea86b4-253f-11e7-93ae-92361f002672&vfModuleModelUUID=066de97e-253e-11e7-93ae-92361f002672"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vfModuleCustomizationPCM_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002672/vfModule"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vfModulePCM_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/vfModule/066de97e-253e-11e7-93ae-92361f002672"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vfModulePCM_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+
+ stubFor(get(urlMatching(".*/vnfComponentsRecipe/search/findFirstVnfComponentsRecipeByVnfComponentTypeAndAction" +
+ "[?]vnfComponentType=vfModule&action=createInstance"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vnfComponentRecipeVNF_API_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
//expected response
ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse();
RequestReferences requestReferences = new RequestReferences();
@@ -783,11 +1141,47 @@ public class ServiceInstancesTest extends BaseTest{
assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId"));
}
@Test
- public void deleteVfModuleInstanceNoMatchingModelUUD() throws JsonParseException, JsonMappingException, IOException {
+ public void deleteVfModuleInstanceNoMatchingModelUUD() throws IOException {
stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
+ stubFor(get(urlMatching(".*/vnfResource/.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vnfResourceForVfModule_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/vnfResourceCustomization/search/findByModelInstanceNameAndVnfResources.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vnfResourceCustomizationForVfModule_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002673/vfModuleCustomizations"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vfModuleCustomizationsPCM_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002672"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vfModuleCustomizationPCM_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002672/vfModule"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vfModulePCM_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/vfModule/066de97e-253e-11e7-93ae-92361f002672"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vfModulePCM_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/vnfComponentsRecipe/search/findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction" +
+ "[?]vfModuleModelUUID=GR-API-DEFAULT&vnfComponentType=vfModule&action=deleteInstance"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vnfComponentRecipeDeleteVfModule_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
//expected response
ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse();
RequestReferences requestReferences = new RequestReferences();
@@ -802,22 +1196,56 @@ public class ServiceInstancesTest extends BaseTest{
assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId"));
}
@Test
- public void createVfModuleInstanceNoRecipe() throws JsonParseException, JsonMappingException, IOException {
- uri = servInstanceuri + "v6" + "/serviceInstances/ff305d54-75b4-431b-adb2-eb6b9e5ff000/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff000/vfModules";
+ public void createVfModuleInstanceNoRecipe() throws IOException {
+
+ stubFor(get(urlMatching(".*/vnfResource/fe6478e4-ea33-3346-ac12-ab121484a3fe"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vnfResourceForVfModule_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/vnfResourceCustomization/search/findByModelInstanceNameAndVnfResources" +
+ "[?]modelInstanceName=test&vnfResourceModelUUID=fe6478e4-ea33-3346-ac12-ab121484a3fe"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vnfResourceCustomizationForVfModule_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002673/vfModuleCustomizations"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vfModuleCustomizationsPCM_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/vfModuleCustomization/search/findByModelCustomizationUUIDAndVfModuleModelUUID[?]" +
+ "modelCustomizationUUID=b4ea86b4-253f-11e7-93ae-92361f002672&vfModuleModelUUID=066de97e-253e-11e7-93ae-92361f002672"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vfModuleCustomizationPCM_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ uri = servInstanceuri + "v6" + "/serviceInstances/ff305d54-75b4-431b-adb2-eb6b9e5ff000/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff000/vfModules";
ResponseEntity<String> response = sendRequest(inputStream("/VfModuleInvalid.json"), uri, HttpMethod.POST);
assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value());
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true);
RequestError realResponse = mapper.readValue(response.getBody(), RequestError.class);
- assertTrue(realResponse.getServiceException().getText().equals("No valid vfModuleCustomization is specified"));
+ assertEquals("No valid vfModuleCustomization is specified", realResponse.getServiceException().getText());
}
@Test
- public void replaceVfModuleInstance() throws JsonParseException, JsonMappingException, IOException {
+ public void replaceVfModuleInstance() throws IOException {
stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
-
+
+ stubFor(get(urlMatching(".*/vfModule/search/findFirstVfModuleByModelInvariantUUIDAndModelVersion[?]" +
+ "modelInvariantUUID=78ca26d0-246d-11e7-93ae-92361f002671&modelVersion=2"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vfModule_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/vnfComponentsRecipe/search/findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction" +
+ "[?]vfModuleModelUUID=GR-API-DEFAULT&vnfComponentType=vfModule&action=replaceInstance"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vnfComponentRecipeDeleteVfModule_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
//expected response
ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse();
RequestReferences requestReferences = new RequestReferences();
@@ -834,11 +1262,32 @@ public class ServiceInstancesTest extends BaseTest{
assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId"));
}
@Test
- public void updateVfModuleInstance() throws JsonParseException, JsonMappingException, IOException {
+ public void updateVfModuleInstance() throws IOException {
stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
+ stubFor(get(urlMatching(".*/vfModuleCustomization/cb82ffd8-252a-11e7-93ae-92361f002671"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vfModuleCustomization_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/vfModuleCustomization/cb82ffd8-252a-11e7-93ae-92361f002671/vfModule"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vfModule_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/vfModule/20c4431c-246d-11e7-93ae-92361f002671"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vfModule_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/vnfComponentsRecipe/search/findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction" +
+ "[?]vfModuleModelUUID=GR-API-DEFAULT&vnfComponentType=vfModule&action=updateInstance"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vnfComponentRecipe_GRAPI_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
//expected response
ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse();
RequestReferences requestReferences = new RequestReferences();
@@ -856,13 +1305,13 @@ public class ServiceInstancesTest extends BaseTest{
assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId"));
}
@Test
- public void createVfModuleNoModelType() throws JsonParseException, JsonMappingException, IOException{
+ public void createVfModuleNoModelType() throws IOException{
headers.set(MsoLogger.ONAP_REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
InfraActiveRequests expectedRecord = new InfraActiveRequests();
expectedRecord.setRequestStatus("FAILED");
expectedRecord.setAction("createInstance");
expectedRecord.setStatusMessage("Error parsing request: No valid modelType is specified");
- expectedRecord.setProgress(new Long(100));
+ expectedRecord.setProgress(100L);
expectedRecord.setSource("VID");
expectedRecord.setRequestBody(inputStream("/VfModuleNoModelType.json"));
expectedRecord.setLastModifiedBy("APIH");
@@ -878,17 +1327,19 @@ public class ServiceInstancesTest extends BaseTest{
ResponseEntity<String> response = sendRequest(inputStream("/VfModuleNoModelType.json"), uri, HttpMethod.POST);
//ActualRecord
- InfraActiveRequests requestRecord = iar.findOneByRequestId("32807a28-1a14-4b88-b7b3-2950918aa76d");
assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value());
- assertEquals(sameBeanAs(expectedRecord).toString(), sameBeanAs(requestRecord).ignoring("startTime").ignoring("endTime").ignoring("modifyTime").toString());
- assertNotNull(requestRecord.getStartTime());
- assertNotNull(requestRecord.getEndTime());
}
@Test
- public void inPlaceSoftwareUpdate() throws JsonParseException, JsonMappingException, IOException {
+ public void inPlaceSoftwareUpdate() throws IOException {
stubFor(post(urlPathEqualTo("/mso/async/services/VnfInPlaceUpdate"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/vnfRecipe/search/findFirstVnfRecipeByNfRoleAndAction[?]" +
+ "nfRole=GR-API-DEFAULT&action=inPlaceSoftwareUpdate"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vnfRecipeInPlaceUpdate_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
//expected response
ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse();
@@ -905,52 +1356,25 @@ public class ServiceInstancesTest extends BaseTest{
ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class);
assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId"));
}
-
+
@Test
- public void inPlaceSoftwareUpdateDuplicate() throws JsonParseException, JsonMappingException, IOException {
- stubFor(post(urlPathEqualTo("/mso/async/services/VnfInPlaceUpdate"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
-
- InfraActiveRequests req = new InfraActiveRequests();
- req.setRequestStatus("IN_PROGRESS");
- req.setAction("inPlaceSoftwareUpdate");
- req.setProgress(new Long(10));
- req.setRequestBody(inputStream("/ServiceInstanceALaCarteTrueNoRecipe.json"));
- req.setServiceInstanceId("f7ce78bb-423b-11e7-93f8-0050569a7908");
- req.setVnfId("ff305d54-75b4-431b-adb2-eb6b9e5ff033");
- req.setRequestScope("vnf");
- req.setVnfName("duplicateCheck123");
- req.setRequestAction("inPlaceSoftwareUpdate");
- req.setRequestId("32807a28-1a14-4b88-b7b3-2950918aa76d");
- iar.save(req);
-
- //expected response
- ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse();
- RequestReferences requestReferences = new RequestReferences();
- requestReferences.setInstanceId("1882939");
- expectedResponse.setRequestReferences(requestReferences);
- uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7908/vnfs/ff305d54-75b4-431b-adb2-eb6b9e5ff033/inPlaceSoftwareUpdate";
- ResponseEntity<String> response = sendRequest(inputStream("/InPlaceSoftwareUpdate2.json"), uri, HttpMethod.POST);
-
- ObjectMapper mapper = new ObjectMapper();
- mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
-
- assertEquals(Response.Status.CONFLICT.getStatusCode(), response.getStatusCode().value());
-
- InfraActiveRequests newRecord = iar.findOneByRequestBody(inputStream("/InPlaceSoftwareUpdate2.json"));
-
- assertNotNull(newRecord.getServiceInstanceId());
- assertNotNull(newRecord.getVnfId());
-
- }
-
- @Test
- public void deleteVfModuleInstance() throws JsonParseException, JsonMappingException, IOException {
+ public void deleteVfModuleInstance() throws IOException {
stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
+ stubFor(get(urlMatching(".*/vfModule/search/findFirstVfModuleByModelInvariantUUIDAndModelVersion[?]" +
+ "modelInvariantUUID=78ca26d0-246d-11e7-93ae-92361f002671&modelVersion=2"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vfModule_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/vnfComponentsRecipe/search/findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction" +
+ "[?]vfModuleModelUUID=GR-API-DEFAULT&vnfComponentType=vfModule&action=deleteInstance"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vnfComponentRecipeDeleteVfModule_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
//expected response
ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse();
RequestReferences requestReferences = new RequestReferences();
@@ -967,11 +1391,23 @@ public class ServiceInstancesTest extends BaseTest{
assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId"));
}
@Test
- public void deactivateAndCloudDeleteVfModuleInstance() throws JsonParseException, JsonMappingException, IOException {
+ public void deactivateAndCloudDeleteVfModuleInstance() throws IOException {
stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
+ stubFor(get(urlMatching(".*/vfModule/search/findFirstVfModuleByModelInvariantUUIDAndModelVersion[?]" +
+ "modelInvariantUUID=78ca26d0-246d-11e7-93ae-92361f002671&modelVersion=2"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vfModule_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/vnfComponentsRecipe/search/findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction" +
+ "[?]vfModuleModelUUID=GR-API-DEFAULT&vnfComponentType=vfModule&action=deactivateAndCloudDelete"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vnfComponentRecipeDeactivate_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
//expected response
ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse();
RequestReferences requestReferences = new RequestReferences();
@@ -988,11 +1424,27 @@ public class ServiceInstancesTest extends BaseTest{
assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId"));
}
@Test
- public void createVolumeGroupInstance() throws JsonParseException, JsonMappingException, IOException {
+ public void createVolumeGroupInstance() throws IOException {
stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
+ stubFor(get(urlMatching(".*/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002671"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vfModuleCustomizationVolGrp_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002671/vfModule"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vfModuleVolGroup_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/vnfComponentsRecipe/search/findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction" +
+ "[?]vfModuleModelUUID=GR-API-DEFAULT&vnfComponentType=volumeGroup&action=createInstance"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vnfComponentRecipeVolGrp_GRAPI_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
//expected response
ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse();
RequestReferences requestReferences = new RequestReferences();
@@ -1010,11 +1462,27 @@ public class ServiceInstancesTest extends BaseTest{
assertTrue(response.getBody().contains("1882939"));
}
@Test
- public void updateVolumeGroupInstance() throws JsonParseException, JsonMappingException, IOException {
+ public void updateVolumeGroupInstance() throws IOException {
stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
+ stubFor(get(urlMatching(".*/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002671"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vfModuleCustomizationVolGrp_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002671/vfModule"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vfModuleVolGroup_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/vnfComponentsRecipe/search/findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction" +
+ "[?]vfModuleModelUUID=GR-API-DEFAULT&vnfComponentType=volumeGroup&action=updateInstance"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vnfComponentRecipeVolGrp_GRAPI_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
//expected response
ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse();
RequestReferences requestReferences = new RequestReferences();
@@ -1031,11 +1499,31 @@ public class ServiceInstancesTest extends BaseTest{
assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId"));
}
@Test
- public void deleteVolumeGroupInstance() throws JsonParseException, JsonMappingException, IOException {
+ public void deleteVolumeGroupInstance() throws IOException {
+ stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
+
stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
+ stubFor(get(urlMatching(".*/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002671"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vfModuleCustomizationVolGrp_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002671/vfModule"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vfModuleVolGroup_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/vnfComponentsRecipe/search/findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction" +
+ "[?]vfModuleModelUUID=GR-API-DEFAULT&vnfComponentType=volumeGroup&action=deleteInstance"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vnfComponentRecipeVolGrp_GRAPI_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
//expected response
ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse();
RequestReferences requestReferences = new RequestReferences();
@@ -1052,11 +1540,27 @@ public class ServiceInstancesTest extends BaseTest{
assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId"));
}
@Test
- public void createNetworkInstance() throws JsonParseException, JsonMappingException, IOException {
+ public void createNetworkInstance() throws IOException {
stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
+ stubFor(get(urlMatching(".*/networkResourceCustomization/3bdbb104-476c-483e-9f8b-c095b3d308ac"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("networkResourceCustomization_Response.json"))
+ .withStatus(HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/networkResourceCustomization/3bdbb104-476c-483e-9f8b-c095b3d308ac/networkResource"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("networkResource_Response.json"))
+ .withStatus(HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/networkRecipe/search/findFirstByModelNameAndAction[?]" +
+ "modelName=GR-API-DEFAULT&action=createInstance"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("networkRecipe_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
String requestId = "b7a6b76f-2ee2-416c-971b-548472a8c5c4";
headers.set(MsoLogger.ONAP_REQUEST_ID, requestId);
//expected response
@@ -1070,18 +1574,31 @@ public class ServiceInstancesTest extends BaseTest{
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
- InfraActiveRequests record = iar.findOneByRequestId(requestId);
assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class);
assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId"));
- assertEquals(record.getNetworkType(), "TestNetworkType");
}
@Test
- public void updateNetworkInstance() throws JsonParseException, JsonMappingException, IOException {
+ public void updateNetworkInstance() throws IOException {
stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
+ stubFor(get(urlMatching(".*/networkResourceCustomization/3bdbb104-476c-483e-9f8b-c095b3d308ac"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("networkResourceCustomization_Response.json"))
+ .withStatus(HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/networkResourceCustomization/3bdbb104-476c-483e-9f8b-c095b3d308ac/networkResource"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("networkResource_Response.json"))
+ .withStatus(HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/networkRecipe/search/findFirstByModelNameAndAction[?]" +
+ "modelName=GR-API-DEFAULT&action=updateInstance"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("networkRecipe_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
//expected response
ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse();
RequestReferences requestReferences = new RequestReferences();
@@ -1099,11 +1616,27 @@ public class ServiceInstancesTest extends BaseTest{
assertTrue(response.getBody().contains("1882939"));
}
@Test
- public void deleteNetworkInstance() throws JsonParseException, JsonMappingException, IOException {
+ public void deleteNetworkInstance() throws IOException {
stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
+ stubFor(get(urlMatching(".*/networkResourceCustomization/3bdbb104-476c-483e-9f8b-c095b3d308ac"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("networkResourceCustomization_Response.json"))
+ .withStatus(HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/networkResourceCustomization/3bdbb104-476c-483e-9f8b-c095b3d308ac/networkResource"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("networkResource_Response.json"))
+ .withStatus(HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/networkRecipe/search/findFirstByModelNameAndAction[?]" +
+ "modelName=GR-API-DEFAULT&action=deleteInstance"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("networkRecipe_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
//expected response
ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse();
RequestReferences requestReferences = new RequestReferences();
@@ -1120,11 +1653,18 @@ public class ServiceInstancesTest extends BaseTest{
assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId"));
}
@Test
- public void deleteNetworkInstanceNoReqParams() throws JsonParseException, JsonMappingException, IOException {
+ public void deleteNetworkInstanceNoReqParams() throws IOException {
stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
+ stubFor(get(urlMatching(".*/networkRecipe/search/findFirstByModelNameAndAction[?]" +
+ "modelName=GR-API-DEFAULT&action=deleteInstance"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("networkRecipe_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+
//expected response
ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse();
RequestReferences requestReferences = new RequestReferences();
@@ -1141,13 +1681,13 @@ public class ServiceInstancesTest extends BaseTest{
assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId"));
}
@Test
- public void convertJsonToServiceInstanceRequestFail() throws JsonParseException, JsonMappingException, IOException {
+ public void convertJsonToServiceInstanceRequestFail() throws IOException {
headers.set(MsoLogger.ONAP_REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
//ExpectedRecord
InfraActiveRequests expectedRecord = new InfraActiveRequests();
expectedRecord.setRequestStatus("FAILED");
expectedRecord.setStatusMessage("Error mapping request: ");
- expectedRecord.setProgress(new Long(100));
+ expectedRecord.setProgress(100L);
expectedRecord.setRequestBody(inputStream("/ConvertRequestFail.json"));
expectedRecord.setLastModifiedBy("APIH");
expectedRecord.setRequestScope("network");
@@ -1158,16 +1698,11 @@ public class ServiceInstancesTest extends BaseTest{
ResponseEntity<String> response = sendRequest(inputStream("/ConvertRequestFail.json"), uri, HttpMethod.DELETE);
//ActualRecord
- InfraActiveRequests requestRecord = iar.findOneByRequestId("32807a28-1a14-4b88-b7b3-2950918aa76d");
assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), response.getStatusCode().value());
- assertThat(expectedRecord, sameBeanAs(requestRecord).ignoring("startTime").ignoring("endTime").ignoring("modifyTime").ignoring("statusMessage"));
- assertThat(requestRecord.getStatusMessage(), containsString("Error mapping request: "));
- assertNotNull(requestRecord.getStartTime());
- assertNotNull(requestRecord.getEndTime());
}
@Test
- public void convertJsonToServiceInstanceRequestConfigurationFail() throws JsonParseException, JsonMappingException, IOException {
+ public void convertJsonToServiceInstanceRequestConfigurationFail() throws IOException {
uri = servInstanceuri + "v5" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7969/configurations/test/enablePort";
ResponseEntity<String> response = sendRequest(inputStream("/ConvertRequestFail.json"), uri, HttpMethod.POST);
@@ -1177,9 +1712,28 @@ public class ServiceInstancesTest extends BaseTest{
@Test
public void creatServiceInstanceGRTestApiNoCustomRecipeFound() throws IOException {
stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
+ ServiceRecipe serviceRecipe = new ServiceRecipe();
+ serviceRecipe.setOrchestrationUri("/mso/async/services/WorkflowActionBB");
+ serviceRecipe.setServiceModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a");
+ serviceRecipe.setAction(Action.createInstance.toString());
+ serviceRecipe.setId(1);
+ serviceRecipe.setRecipeTimeout(180);
+ Service defaultService = new Service();
+ defaultService.setModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a");
+
+ stubFor(get(urlMatching(".*/service/.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(defaultService))
+ .withStatus(HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/serviceRecipe/search.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(serviceRecipe))
+ .withStatus(HttpStatus.SC_OK)));
+
uri = servInstanceuri + "v7" + "/serviceInstances";
ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceMacro.json"), uri, HttpMethod.POST);
@@ -1200,9 +1754,25 @@ public class ServiceInstancesTest extends BaseTest{
@Test
public void createNetworkInstanceTestApiUndefinedUsePropertiesDefault() throws IOException {
stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
+ stubFor(get(urlMatching(".*/networkResourceCustomization/3bdbb104-476c-483e-9f8b-c095b3d308ac"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("networkResourceCustomization_Response.json"))
+ .withStatus(HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/networkResourceCustomization/3bdbb104-476c-483e-9f8b-c095b3d308ac/networkResource"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("networkResource_Response.json"))
+ .withStatus(HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/networkRecipe/search/findFirstByModelNameAndAction[?]" +
+ "modelName=GR-API-DEFAULT&action=createInstance"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("networkRecipe_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7969/networks";
ResponseEntity<String> response = sendRequest(inputStream("/NetworkCreateAlternateInstanceName.json"), uri, HttpMethod.POST);
@@ -1223,7 +1793,7 @@ public class ServiceInstancesTest extends BaseTest{
@Test
public void createNetworkInstanceTestApiIncorrectUsePropertiesDefault() throws IOException {
stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7969/networks";
@@ -1244,9 +1814,25 @@ public class ServiceInstancesTest extends BaseTest{
@Test
public void createNetworkInstanceTestApiGrApi() throws IOException {
stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
+ stubFor(get(urlMatching(".*/networkResourceCustomization/3bdbb104-476c-483e-9f8b-c095b3d308ac"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("networkResourceCustomization_Response.json"))
+ .withStatus(HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/networkResourceCustomization/3bdbb104-476c-483e-9f8b-c095b3d308ac/networkResource"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("networkResource_Response.json"))
+ .withStatus(HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/networkRecipe/search/findFirstByModelNameAndAction[?]" +
+ "modelName=GR-API-DEFAULT&action=createInstance"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("networkRecipe_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7969/networks";
ResponseEntity<String> response = sendRequest(inputStream("/NetworkCreateTestApiGrApi.json"), uri, HttpMethod.POST);
@@ -1267,9 +1853,25 @@ public class ServiceInstancesTest extends BaseTest{
@Test
public void createNetworkInstanceTestApiVnfApi() throws IOException {
stubFor(post(urlPathEqualTo("/mso/async/services/CreateNetworkInstance"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
+ stubFor(get(urlMatching(".*/networkResourceCustomization/3bdbb104-476c-483e-9f8b-c095b3d308ac"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("networkResourceCustomization_Response.json"))
+ .withStatus(HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/networkResourceCustomization/3bdbb104-476c-483e-9f8b-c095b3d308ac/networkResource"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("networkResource_Response.json"))
+ .withStatus(HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/networkRecipe/search/findFirstByModelNameAndAction[?]" +
+ "modelName=VNF-API-DEFAULT&action=createInstance"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("networkRecipeVNF_API_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
uri = servInstanceuri + "v7" + "/serviceInstances/f7ce78bb-423b-11e7-93f8-0050569a7969/networks";
ResponseEntity<String> response = sendRequest(inputStream("/NetworkCreateTestApiVnfApi.json"), uri, HttpMethod.POST);
@@ -1288,27 +1890,31 @@ public class ServiceInstancesTest extends BaseTest{
}
@Test
- public void activateServiceInstanceRequestStatus() throws JsonParseException, JsonMappingException, IOException{
- stubFor(post(urlPathEqualTo("/mso/async/services/ActivateInstance"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ public void activateServiceInstanceRequestStatus() throws IOException{
+ ServiceRecipe serviceRecipe = new ServiceRecipe();
+ serviceRecipe.setOrchestrationUri("/mso/async/services/WorkflowActionBB");
+ serviceRecipe.setServiceModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a");
+ serviceRecipe.setAction(Action.createInstance.toString());
+ serviceRecipe.setId(1);
+ serviceRecipe.setRecipeTimeout(180);
+ Service defaultService = new Service();
+ defaultService.setModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a");
+
+ stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
headers.set("X-ECOMP-RequestID", "32807a28-1a14-4b88-b7b3-2950918aa76d");
- InfraActiveRequests expectedRecord = new InfraActiveRequests();
- expectedRecord.setRequestStatus("FAILED");
- expectedRecord.setAction("activateInstance");
- expectedRecord.setStatusMessage("Recipe could not be retrieved from catalog DB.");
- expectedRecord.setProgress(new Long(100));
- expectedRecord.setSource("VID");
- expectedRecord.setRequestBody(inputStream("/ServiceInstanceALaCarteTrueNoRecipe.json"));
- expectedRecord.setLastModifiedBy("APIH");
- expectedRecord.setServiceInstanceId("f7ce78bb-423b-11e7-93f8-0050569a7999");
- expectedRecord.setServiceInstanceName("testService1234");
- expectedRecord.setRequestScope("service");
- expectedRecord.setRequestAction("activateInstance");
- expectedRecord.setRequestorId("xxxxxx");
- expectedRecord.setRequestId("32807a28-1a14-4b88-b7b3-2950918aa76d");
+ stubFor(get(urlMatching(".*/service/.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(defaultService))
+ .withStatus(HttpStatus.SC_OK)));
+ stubFor(get(urlMatching(".*/serviceRecipe/search.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(serviceRecipe))
+ .withStatus(HttpStatus.SC_OK)));
+
//expect
ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse();
RequestReferences requestReferences = new RequestReferences();
@@ -1320,10 +1926,6 @@ public class ServiceInstancesTest extends BaseTest{
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
- InfraActiveRequests requestRecord = iar.findOneByRequestId("32807a28-1a14-4b88-b7b3-2950918aa76d");
-
- //then
- assertEquals(Status.IN_PROGRESS.name(), requestRecord.getRequestStatus());
assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class);
assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId"));
@@ -1342,10 +1944,30 @@ public class ServiceInstancesTest extends BaseTest{
}
@Test
public void invalidBPELResponse() throws IOException{
- stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
+
+ ServiceRecipe serviceRecipe = new ServiceRecipe();
+ serviceRecipe.setOrchestrationUri("/mso/async/services/WorkflowActionBB");
+ serviceRecipe.setServiceModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a");
+ serviceRecipe.setAction(Action.createInstance.toString());
+ serviceRecipe.setId(1);
+ serviceRecipe.setRecipeTimeout(180);
+ Service defaultService = new Service();
+ defaultService.setModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a");
+
+ stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBodyFile("Camunda/TestResponseInvalid2.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
+ stubFor(get(urlMatching(".*/service/.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(defaultService))
+ .withStatus(HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/serviceRecipe/search.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(serviceRecipe))
+ .withStatus(HttpStatus.SC_OK)));
+
uri = servInstanceuri + "v5/serviceInstances";
ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceDefault.json"), uri, HttpMethod.POST);
@@ -1360,10 +1982,29 @@ public class ServiceInstancesTest extends BaseTest{
@Test
public void invalidBPELResponse2() throws IOException{
- stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
+
+ ServiceRecipe serviceRecipe = new ServiceRecipe();
+ serviceRecipe.setOrchestrationUri("/mso/async/services/WorkflowActionBB");
+ serviceRecipe.setServiceModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a");
+ serviceRecipe.setAction(Action.createInstance.toString());
+ serviceRecipe.setId(1);
+ serviceRecipe.setRecipeTimeout(180);
+ Service defaultService = new Service();
+ defaultService.setModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a");
+
+ stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBodyFile("Camunda/TestResponseInvalid.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
+ stubFor(get(urlMatching(".*/service/.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(defaultService))
+ .withStatus(HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/serviceRecipe/search.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(serviceRecipe))
+ .withStatus(HttpStatus.SC_OK)));
uri = servInstanceuri + "v5/serviceInstances";
ResponseEntity<String> response = sendRequest(inputStream("/ServiceInstanceDefault.json"), uri, HttpMethod.POST);
@@ -1377,11 +2018,34 @@ public class ServiceInstancesTest extends BaseTest{
}
@Test
- public void createMacroServiceInstance() throws JsonParseException, JsonMappingException, IOException{
- stubFor(post(urlPathEqualTo("/mso/async/services/CreateMacroServiceNetworkVnf"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ public void createMacroServiceInstance() throws IOException{
+ ServiceRecipe serviceRecipe = new ServiceRecipe();
+ serviceRecipe.setOrchestrationUri("/mso/async/services/CreateMacroServiceNetworkVnf");
+ serviceRecipe.setServiceModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a");
+ serviceRecipe.setAction(Action.createInstance.toString());
+ serviceRecipe.setId(1);
+ serviceRecipe.setRecipeTimeout(180);
+ Service defaultService = new Service();
+ defaultService.setModelUUID("d88da85c-d9e8-4f73-b837-3a72a431622a");
+
+ stubFor(post(urlPathEqualTo("/mso/async/services/CreateMacroServiceNetworkVnf"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
+ stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBodyFile("Camunda/TestResponseInvalid.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/service/.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(defaultService))
+ .withStatus(HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/serviceRecipe/search.*"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(serviceRecipe))
+ .withStatus(HttpStatus.SC_OK)));
+
//expect
ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse();
RequestReferences requestReferences = new RequestReferences();
@@ -1400,7 +2064,7 @@ public class ServiceInstancesTest extends BaseTest{
}
@Test
- public void testUserParams() throws JsonParseException, JsonMappingException, IOException {
+ public void testUserParams() throws IOException {
ObjectMapper mapper = new ObjectMapper();
ServiceInstancesRequest request = mapper.readValue(inputStream("/MacroServiceInstance.json"), ServiceInstancesRequest.class);
RequestParameters requestParameters = request.getRequestDetails().getRequestParameters();
@@ -1411,7 +2075,7 @@ public class ServiceInstancesTest extends BaseTest{
assertTrue(userParams.size() > 0);
assertTrue(userParams.get(0).containsKey("name"));
assertTrue(userParams.get(0).containsKey("value"));
- assertTrue(userParamsTxt.replaceAll("\\s+","").equals(userParams.toString().replaceAll("\\s+","")));
+ assertEquals(userParamsTxt.replaceAll("\\s+", ""), userParams.toString().replaceAll("\\s+", ""));
}
@Test
@@ -1434,11 +2098,36 @@ public class ServiceInstancesTest extends BaseTest{
assertThat(request, sameBeanAs(expected));
}
@Test
- public void scaleOutVfModule() throws JsonParseException, JsonMappingException, IOException {
+ public void scaleOutVfModule() throws IOException {
stubFor(post(urlPathEqualTo("/mso/async/services/WorkflowActionBB"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
+ stubFor(get(urlMatching(".*/vfModuleCustomization/cb82ffd8-252a-11e7-93ae-92361f002671"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vfModuleCustomization_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/vfModuleCustomization/cb82ffd8-252a-11e7-93ae-92361f002671/vfModule"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vfModule_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/vfModule/20c4431c-246d-11e7-93ae-92361f002671"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vfModule_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+
+ stubFor(get(urlMatching(".*/vnfComponentsRecipe/search/findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction" +
+ "[?]vfModuleModelUUID=GR-API-DEFAULT&vnfComponentType=vfModule&action=scaleOut"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vnfComponentRecipeVfModuleScaleOut_Response.json")).withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ stubFor(get(urlMatching(".*/vfModule/search/findByModelInvariantUUIDOrderByModelVersionDesc[?]modelInvariantUUID=78ca26d0-246d-11e7-93ae-92361f002671"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("vfModulesListByInvariantId_Response.json")).withStatus(org.apache.http.HttpStatus.SC_OK)));
+
//expected response
ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse();
RequestReferences requestReferences = new RequestReferences();
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/DeactivateAndCloudDeleteVfModule.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/DeactivateAndCloudDeleteVfModule.json
index 58db9d4f76..3d293d522b 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/DeactivateAndCloudDeleteVfModule.json
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/DeactivateAndCloudDeleteVfModule.json
@@ -1,7 +1,9 @@
{
"requestDetails": {
"modelInfo": {
- "modelType": "vfModule"
+ "modelType": "vfModule",
+ "modelInvariantId":"78ca26d0-246d-11e7-93ae-92361f002671",
+ "modelVersion": "2"
},
"cloudConfiguration": {
"lcpCloudRegionId": "mdt1",
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/DeleteVfModule.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/DeleteVfModule.json
index d612dd9704..34c28d3f7c 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/DeleteVfModule.json
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/DeleteVfModule.json
@@ -16,8 +16,8 @@
},
"modelInfo":{
"modelInvariantId": "f7ce78bb-423b-11e7-93f8-0050569a7968",
- "modelVersion":"1",
- "modelVersionId":"test",
+ "modelVersion":"2",
+ "modelVersionId":"78ca26d0-246d-11e7-93ae-92361f002671",
"modelType":"vfModule",
"modelName":"serviceModel",
"modelCustomizationId": "a7f1d08e-b02d-11e6-80f5-76304dec7eb7"
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/NetworkInstanceNoReqParams.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/NetworkInstanceNoReqParams.json
index cfd19ff0ca..6f4d0f9070 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/NetworkInstanceNoReqParams.json
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/NetworkInstanceNoReqParams.json
@@ -1,7 +1,8 @@
{
"requestDetails": {
"modelInfo": {
- "modelType": "network"
+ "modelType": "network",
+ "modelName": "CONTRAIL30_GNDIRECT"
},
"cloudConfiguration": {
"lcpCloudRegionId": "mtn6",
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ReplaceVfModule.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ReplaceVfModule.json
index 967250a0da..d8de481633 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ReplaceVfModule.json
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ReplaceVfModule.json
@@ -16,8 +16,8 @@
},
"modelInfo":{
"modelInvariantId": "f7ce78bb-423b-11e7-93f8-0050569a7968",
- "modelVersion":"1",
- "modelVersionId":"test",
+ "modelVersion":"2",
+ "modelVersionId":"78ca26d0-246d-11e7-93ae-92361f002671",
"modelType":"vfModule",
"modelName":"serviceModel",
"modelCustomizationId": "a7f1d08e-b02d-11e6-80f5-76304dec7eb7"
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ScaleOutRequest.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ScaleOutRequest.json
index ba5a8a92e5..809e8bcc1c 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ScaleOutRequest.json
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ScaleOutRequest.json
@@ -4,7 +4,7 @@
"modelType":"vfModule",
"modelInvariantId":"ff5256d2-5a33-55df-13ab-12abad84e7ff",
"modelVersionId":"fe6478e5-ea33-3346-ac12-ab121484a3fe",
- "modelCustomizationId":"cb82ffd8-252a-11e7-93ae-92361f002672",
+ "modelCustomizationId":"cb82ffd8-252a-11e7-93ae-92361f002671",
"modelName":"vSAMP12..base..module-0",
"modelVersion":"1"
},
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceInstanceActivate.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceInstanceActivate.json
index d675c79f06..90d5cebb6b 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceInstanceActivate.json
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ServiceInstanceActivate.json
@@ -19,7 +19,7 @@
"modelInfo":{
"modelInvariantId": "f7ce78bb-423b-11e7-93f8-0050569a7965",
"modelVersion": "1.0",
- "modelVersionId":"1",
+ "modelVersionId":"d88da85c-d9e8-4f73-b837-3a72a431622b",
"modelType":"service",
"modelName":"serviceModel"
},
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/UpdateVfModule.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/UpdateVfModule.json
index c3039a59f0..147754657f 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/UpdateVfModule.json
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/UpdateVfModule.json
@@ -17,10 +17,10 @@
"modelInfo":{
"modelInvariantId": "f7ce78bb-423b-11e7-93f8-0050569a7968",
"modelVersion":"1",
- "modelVersionId":"test",
+ "modelVersionId":"20c4431c-246d-11e7-93ae-92361f002671",
"modelType":"vfModule",
"modelName":"serviceModel",
- "modelCustomizationId": "b4ea86b4-253f-11e7-93ae-92361f002671"
+ "modelCustomizationId": "cb82ffd8-252a-11e7-93ae-92361f002671"
},
"subscriberInfo": {
"globalSubscriberId": "MSO_1610_dev",
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/UpdateVnf.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/UpdateVnf.json
index ec2916f0da..723a709927 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/UpdateVnf.json
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/UpdateVnf.json
@@ -7,7 +7,7 @@
"modelName": "vSAMP12..base..module-0",
"modelVersion": "1",
"modelVersionId": "1",
- "modelCustomizationId": "68dc9a92-214c-11e7-93ae-92361f002671"
+ "modelCustomizationId": "68dc9a92-214c-11e7-93ae-92361f002674"
},
"cloudConfiguration": {
"lcpCloudRegionId": "mdt1",
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/UpdateVnfRecipe_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/UpdateVnfRecipe_Response.json
new file mode 100644
index 0000000000..425ae1a81a
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/UpdateVnfRecipe_Response.json
@@ -0,0 +1,20 @@
+{
+ "id": 10008,
+ "nfRole": "GR-API-DEFAULT",
+ "paramXsd": null,
+ "vfModuleId": null,
+ "action": "updateInstance",
+ "description": "Gr api recipe to update vnf",
+ "orchestrationUri": "/mso/async/services/WorkflowActionBB",
+ "recipeTimeout": 180,
+ "serviceType": null,
+ "created": "2018-08-20T08:10:21.000+0000",
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/vnfRecipe/10008"
+ },
+ "vnfRecipe": {
+ "href": "http://localhost:8090/vnfRecipe/10008"
+ }
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/networkRecipeVNF_API_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/networkRecipeVNF_API_Response.json
new file mode 100644
index 0000000000..5a3e875a76
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/networkRecipeVNF_API_Response.json
@@ -0,0 +1,19 @@
+{
+ "id": 16,
+ "action": "createInstance",
+ "description": "Vnf api recipe to create network",
+ "orchestrationUri": "/mso/async/services/CreateNetworkInstance",
+ "recipeTimeout": 180,
+ "serviceType": null,
+ "modelName": "VNF-API-DEFAULT",
+ "paramXsd": null,
+ "created": "2017-10-05T13:22:03.000+0000",
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/networkRecipe/16"
+ },
+ "networkRecipe": {
+ "href": "http://localhost:8090/networkRecipe/16"
+ }
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/networkRecipe_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/networkRecipe_Response.json
new file mode 100644
index 0000000000..94311cc886
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/networkRecipe_Response.json
@@ -0,0 +1,19 @@
+{
+ "id": 180,
+ "action": "deleteInstance",
+ "description": "Gr api recipe to delete network",
+ "orchestrationUri": "/mso/async/services/WorkflowActionBB",
+ "recipeTimeout": 180,
+ "serviceType": null,
+ "modelName": "GR-API-DEFAULT",
+ "paramXsd": null,
+ "created": "2018-08-23T05:09:35.000+0000",
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/networkRecipe/180"
+ },
+ "networkRecipe": {
+ "href": "http://localhost:8090/networkRecipe/180"
+ }
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/networkResourceCustomization_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/networkResourceCustomization_Response.json
new file mode 100644
index 0000000000..ec35e581ae
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/networkResourceCustomization_Response.json
@@ -0,0 +1,21 @@
+{
+ "modelCustomizationUUID": "3bdbb104-476c-483e-9f8b-c095b3d308ac",
+ "modelInstanceName": "CONTRAIL30_GNDIRECT 9",
+ "created": "2017-04-19T08:58:32.000+0000",
+ "networkTechnology": "",
+ "networkType": "",
+ "networkScope": "",
+ "networkRole": "",
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/networkResourceCustomization/3bdbb104-476c-483e-9f8b-c095b3d308ac"
+ },
+ "networkResourceCustomization": {
+ "href": "http://localhost:8090/networkResourceCustomization/3bdbb104-476c-483e-9f8b-c095b3d308ac{?projection}",
+ "templated": true
+ },
+ "networkResource": {
+ "href": "http://localhost:8090/networkResourceCustomization/3bdbb104-476c-483e-9f8b-c095b3d308ac/networkResource"
+ }
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/networkResource_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/networkResource_Response.json
new file mode 100644
index 0000000000..f2579f147d
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/networkResource_Response.json
@@ -0,0 +1,34 @@
+{
+ "modelUUID": "10b36f65-f4e6-4be6-ae49-9596dc1c47fc",
+ "orchestrationMode": "HEAT",
+ "description": "Contrail 30 GNDIRECT NW",
+ "neutronNetworkType": "BASIC",
+ "aicVersionMin": "3.0",
+ "aicVersionMax": "",
+ "modelName": "CONTRAIL30_GNDIRECT",
+ "modelInvariantUUID": "ce4ff476-9641-4e60-b4d5-b4abbec1271d",
+ "modelVersion": "1.0",
+ "toscaNodeType": "",
+ "category": null,
+ "subCategory": null,
+ "created": "2017-01-17T15:05:05.000+0000",
+ "handler": {},
+ "hibernateLazyInitializer": {},
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/networkResources/10b36f65-f4e6-4be6-ae49-9596dc1c47fc"
+ },
+ "networkResource": {
+ "href": "http://localhost:8090/networkResources/10b36f65-f4e6-4be6-ae49-9596dc1c47fc"
+ },
+ "collectionNetworkResourceCustomization": {
+ "href": "http://localhost:8090/networkResources/10b36f65-f4e6-4be6-ae49-9596dc1c47fc/collectionNetworkResourceCustomization"
+ },
+ "heatTemplate": {
+ "href": "http://localhost:8090/networkResources/10b36f65-f4e6-4be6-ae49-9596dc1c47fc/heatTemplate"
+ },
+ "networkResourceCustomization": {
+ "href": "http://localhost:8090/networkResources/10b36f65-f4e6-4be6-ae49-9596dc1c47fc/networkResourceCustomization"
+ }
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/serviceVnf_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/serviceVnf_Response.json
new file mode 100644
index 0000000000..440b1db489
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/serviceVnf_Response.json
@@ -0,0 +1,46 @@
+{
+ "modelName": "Infra_v10_Service",
+ "description": "MSO aLaCarte Vfmodule with addon",
+ "modelUUID": "5df8b6de-2083-11e7-93ae-92361f002672",
+ "modelInvariantUUID": "9647dfc4-2083-11e7-93ae-92361f002671",
+ "created": "2017-04-14 08:12:39.000",
+ "modelVersion": "2.0",
+ "serviceType": "NA",
+ "serviceRole": "NA",
+ "environmentContext": "Luna",
+ "workloadContext": "Oxygen",
+ "category": null,
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/service/5df8b6de-2083-11e7-93ae-92361f002672"
+ },
+ "service": {
+ "href": "http://localhost:8090/service/5df8b6de-2083-11e7-93ae-92361f002672{?projection}",
+ "templated": true
+ },
+ "serviceProxyCustomizations": {
+ "href": "http://localhost:8090/service/5df8b6de-2083-11e7-93ae-92361f002672/serviceProxyCustomizations"
+ },
+ "csar": {
+ "href": "http://localhost:8090/service/5df8b6de-2083-11e7-93ae-92361f002672/csar"
+ },
+ "vnfCustomizations": {
+ "href": "http://localhost:8090/service/5df8b6de-2083-11e7-93ae-92361f002672/vnfCustomizations"
+ },
+ "configurationCustomizations": {
+ "href": "http://localhost:8090/service/5df8b6de-2083-11e7-93ae-92361f002672/configurationCustomizations"
+ },
+ "collectionResourceCustomizations": {
+ "href": "http://localhost:8090/service/5df8b6de-2083-11e7-93ae-92361f002672/collectionResourceCustomizations"
+ },
+ "networkCustomizations": {
+ "href": "http://localhost:8090/service/5df8b6de-2083-11e7-93ae-92361f002672/networkCustomizations"
+ },
+ "recipes": {
+ "href": "http://localhost:8090/service/5df8b6de-2083-11e7-93ae-92361f002672/recipes"
+ },
+ "allottedCustomizations": {
+ "href": "http://localhost:8090/service/5df8b6de-2083-11e7-93ae-92361f002672/allottedCustomizations"
+ }
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/service_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/service_Response.json
new file mode 100644
index 0000000000..545095e5d1
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/service_Response.json
@@ -0,0 +1,177 @@
+{
+ "modelName": "GR-API-DEFAULT",
+ "description": "Gr api service for VID to use for infra APIH orchestration",
+ "modelUUID": "d88da85c-d9e8-4f73-b837-3a72a431622b",
+ "modelInvariantUUID": "944862ae-bb65-4429-8330-a6c9170d6672",
+ "created": "2018-08-10 09:49:12.000",
+ "modelVersion": "1.0",
+ "serviceType": null,
+ "serviceRole": null,
+ "environmentContext": null,
+ "workloadContext": null,
+ "category": null,
+ "_embedded": {
+ "networkCustomizations": [
+ {
+ "description": "Contrail 30 GNDIRECT NW",
+ "modelName": "CONTRAIL30_GNDIRECT",
+ "networkScope": "",
+ "networkRole": "",
+ "modelUUID": "10b36f65-f4e6-4be6-ae49-9596dc1c47fc",
+ "created": "2017-01-17T15:05:05.000+0000",
+ "networkType": "",
+ "modelVersion": "1.0",
+ "toscaNodeType": "",
+ "aicVersionMin": "3.0",
+ "aicVersionMax": "",
+ "modelCustomizationUUID": "3bdbb104-476c-483e-9f8b-c095b3d308ac",
+ "modelInstanceName": "CONTRAIL30_GNDIRECT 9",
+ "modelInvariantUUID": "ce4ff476-9641-4e60-b4d5-b4abbec1271d",
+ "orchestrationMode": "HEAT",
+ "neutronNetworkType": "BASIC",
+ "networkTechnology": "",
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/networkResourceCustomization/3bdbb104-476c-483e-9f8b-c095b3d308ac{?projection}",
+ "templated": true
+ },
+ "networkResource": {
+ "href": "http://localhost:8090/networkResourceCustomization/3bdbb104-476c-483e-9f8b-c095b3d308ac/networkResource"
+ }
+ }
+ }
+ ],
+ "vnfCustomizations": [
+ {
+ "description": "1607 v10 - inherent network1",
+ "modelName": "v10",
+ "modelUUID": "ff2ae348-214a-11e7-93ae-92361f002672",
+ "nfNamingCode": "vSAMP",
+ "created": "2017-04-14 21:46:28.0",
+ "nfRole": "vSAMP",
+ "modelVersion": "2.0",
+ "toscaNodeType": "VF",
+ "aicVersionMin": "",
+ "aicVersionMax": "",
+ "minInstances": "0",
+ "maxInstances": "0",
+ "nfFunction": "vSAMP",
+ "nfType": "vSAMP",
+ "modelCustomizationUUID": "68dc9a92-214c-11e7-93ae-92361f002672",
+ "modelInstanceName": "test",
+ "vfModuleCustomizations": [
+ {
+ "description": "v10 DEV PCM",
+ "modelName": "test::PCM::module-1",
+ "modelUUID": "066de97e-253e-11e7-93ae-92361f002672",
+ "created": "2016-09-14 18:19:56.0",
+ "modelVersion": "2",
+ "minInstances": "0",
+ "maxInstances": "0",
+ "modelCustomizationUUID": "b4ea86b4-253f-11e7-93ae-92361f002672",
+ "modelInvariantUUID": "64efd51a-2544-11e7-93ae-92361f002671",
+ "isBase": false,
+ "initialCount": "0",
+ "label": "PCM",
+ "availabilityZoneCount": "0",
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002672"
+ },
+ "volumeHeatEnv": {
+ "href": "http://localhost:8090/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002672/volumeHeatEnv"
+ },
+ "vfModule": {
+ "href": "http://localhost:8090/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002672/vfModule"
+ },
+ "heatEnvironment": {
+ "href": "http://localhost:8090/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002672/heatEnvironment"
+ }
+ }
+ },
+ {
+ "description": "v10 DEV Base",
+ "modelName": "test::base::module-0",
+ "modelUUID": "20c4431c-246d-11e7-93ae-92361f002672",
+ "created": "2016-09-14 18:19:56.0",
+ "modelVersion": "2",
+ "minInstances": "0",
+ "maxInstances": "0",
+ "modelCustomizationUUID": "cb82ffd8-252a-11e7-93ae-92361f002672",
+ "modelInvariantUUID": "78ca26d0-246d-11e7-93ae-92361f002671",
+ "isBase": true,
+ "initialCount": "1",
+ "label": "base",
+ "availabilityZoneCount": "0",
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/vfModuleCustomization/cb82ffd8-252a-11e7-93ae-92361f002672"
+ },
+ "volumeHeatEnv": {
+ "href": "http://localhost:8090/vfModuleCustomization/cb82ffd8-252a-11e7-93ae-92361f002672/volumeHeatEnv"
+ },
+ "vfModule": {
+ "href": "http://localhost:8090/vfModuleCustomization/cb82ffd8-252a-11e7-93ae-92361f002672/vfModule"
+ },
+ "heatEnvironment": {
+ "href": "http://localhost:8090/vfModuleCustomization/cb82ffd8-252a-11e7-93ae-92361f002672/heatEnvironment"
+ }
+ }
+ }
+ ],
+ "modelInvariantUUID": "2fff5b20-214b-11e7-93ae-92361f002671",
+ "availabilityZoneMaxCount": "0",
+ "multiStageDesign": null,
+ "orchestrationMode": "HEAT",
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002672{?projection}",
+ "templated": true
+ },
+ "vfModuleCustomizations": {
+ "href": "http://localhost:8090/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002672/vfModuleCustomizations"
+ },
+ "vnfResources": {
+ "href": "http://localhost:8090/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002672/vnfResources"
+ },
+ "vnfcInstanceGroupCustomizations": {
+ "href": "http://localhost:8090/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002672/vnfcInstanceGroupCustomizations"
+ }
+ }
+ }
+ ]
+ },
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/service/d88da85c-d9e8-4f73-b837-3a72a431622b"
+ },
+ "service": {
+ "href": "http://localhost:8090/service/d88da85c-d9e8-4f73-b837-3a72a431622b{?projection}",
+ "templated": true
+ },
+ "networkCustomizations": {
+ "href": "http://localhost:8090/service/d88da85c-d9e8-4f73-b837-3a72a431622b/networkCustomizations"
+ },
+ "collectionResourceCustomizations": {
+ "href": "http://localhost:8090/service/d88da85c-d9e8-4f73-b837-3a72a431622b/collectionResourceCustomizations"
+ },
+ "recipes": {
+ "href": "http://localhost:8090/service/d88da85c-d9e8-4f73-b837-3a72a431622b/recipes"
+ },
+ "vnfCustomizations": {
+ "href": "http://localhost:8090/service/d88da85c-d9e8-4f73-b837-3a72a431622b/vnfCustomizations"
+ },
+ "allottedCustomizations": {
+ "href": "http://localhost:8090/service/d88da85c-d9e8-4f73-b837-3a72a431622b/allottedCustomizations"
+ },
+ "serviceProxyCustomizations": {
+ "href": "http://localhost:8090/service/d88da85c-d9e8-4f73-b837-3a72a431622b/serviceProxyCustomizations"
+ },
+ "configurationCustomizations": {
+ "href": "http://localhost:8090/service/d88da85c-d9e8-4f73-b837-3a72a431622b/configurationCustomizations"
+ },
+ "csar": {
+ "href": "http://localhost:8090/service/d88da85c-d9e8-4f73-b837-3a72a431622b/csar"
+ }
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vfModuleCustomizationPCM_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vfModuleCustomizationPCM_Response.json
new file mode 100644
index 0000000000..895c905ec9
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vfModuleCustomizationPCM_Response.json
@@ -0,0 +1,26 @@
+{
+ "modelCustomizationUUID": "b4ea86b4-253f-11e7-93ae-92361f002672",
+ "label": "PCM",
+ "minInstances": 0,
+ "maxInstances": 0,
+ "initialCount": 0,
+ "availabilityZoneCount": 0,
+ "created": "2017-05-26 09:38:23.000",
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002672"
+ },
+ "vfModuleCustomization": {
+ "href": "http://localhost:8090/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002672"
+ },
+ "volumeHeatEnv": {
+ "href": "http://localhost:8090/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002672/volumeHeatEnv"
+ },
+ "heatEnvironment": {
+ "href": "http://localhost:8090/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002672/heatEnvironment"
+ },
+ "vfModule": {
+ "href": "http://localhost:8090/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002672/vfModule"
+ }
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vfModuleCustomizationVolGrp_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vfModuleCustomizationVolGrp_Response.json
new file mode 100644
index 0000000000..dd7fbe1a84
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vfModuleCustomizationVolGrp_Response.json
@@ -0,0 +1,26 @@
+{
+ "modelCustomizationUUID": "b4ea86b4-253f-11e7-93ae-92361f002671",
+ "label": "PCM",
+ "minInstances": 0,
+ "maxInstances": 0,
+ "initialCount": 0,
+ "availabilityZoneCount": 0,
+ "created": "2017-05-26 09:38:23.000",
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002671"
+ },
+ "vfModuleCustomization": {
+ "href": "http://localhost:8090/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002671"
+ },
+ "volumeHeatEnv": {
+ "href": "http://localhost:8090/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002671/volumeHeatEnv"
+ },
+ "vfModule": {
+ "href": "http://localhost:8090/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002671/vfModule"
+ },
+ "heatEnvironment": {
+ "href": "http://localhost:8090/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002671/heatEnvironment"
+ }
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vfModuleCustomization_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vfModuleCustomization_Response.json
new file mode 100644
index 0000000000..a3ace2b24c
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vfModuleCustomization_Response.json
@@ -0,0 +1,26 @@
+{
+ "modelCustomizationUUID": "cb82ffd8-252a-11e7-93ae-92361f002671",
+ "label": "base",
+ "minInstances": 0,
+ "maxInstances": 0,
+ "initialCount": 1,
+ "availabilityZoneCount": 0,
+ "created": "2017-05-26 09:38:23.000",
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/vfModuleCustomization/cb82ffd8-252a-11e7-93ae-92361f002671"
+ },
+ "vfModuleCustomization": {
+ "href": "http://localhost:8090/vfModuleCustomization/cb82ffd8-252a-11e7-93ae-92361f002671"
+ },
+ "volumeHeatEnv": {
+ "href": "http://localhost:8090/vfModuleCustomization/cb82ffd8-252a-11e7-93ae-92361f002671/volumeHeatEnv"
+ },
+ "vfModule": {
+ "href": "http://localhost:8090/vfModuleCustomization/cb82ffd8-252a-11e7-93ae-92361f002671/vfModule"
+ },
+ "heatEnvironment": {
+ "href": "http://localhost:8090/vfModuleCustomization/cb82ffd8-252a-11e7-93ae-92361f002671/heatEnvironment"
+ }
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vfModuleCustomizationsPCM_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vfModuleCustomizationsPCM_Response.json
new file mode 100644
index 0000000000..4743bd39b2
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vfModuleCustomizationsPCM_Response.json
@@ -0,0 +1,37 @@
+{
+ "_embedded": {
+ "vfModuleCustomization": [
+ {
+ "modelCustomizationUUID": "b4ea86b4-253f-11e7-93ae-92361f002672",
+ "label": "PCM",
+ "minInstances": 0,
+ "maxInstances": 0,
+ "initialCount": 0,
+ "availabilityZoneCount": 0,
+ "created": "2017-05-26 09:38:23.000",
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002672"
+ },
+ "vfModuleCustomization": {
+ "href": "http://localhost:8090/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002672"
+ },
+ "volumeHeatEnv": {
+ "href": "http://localhost:8090/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002672/volumeHeatEnv"
+ },
+ "heatEnvironment": {
+ "href": "http://localhost:8090/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002672/heatEnvironment"
+ },
+ "vfModule": {
+ "href": "http://localhost:8090/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002672/vfModule"
+ }
+ }
+ }
+ ]
+ },
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002673/vfModuleCustomizations"
+ }
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vfModulePCM_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vfModulePCM_Response.json
new file mode 100644
index 0000000000..d4693bd075
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vfModulePCM_Response.json
@@ -0,0 +1,30 @@
+{
+ "modelUUID": "066de97e-253e-11e7-93ae-92361f002672",
+ "modelInvariantUUID": "64efd51a-2544-11e7-93ae-92361f002671",
+ "modelName": "test::PCM::module-1",
+ "modelVersion": "2",
+ "description": "v10 DEV PCM",
+ "isBase": false,
+ "created": "2016-09-14 12:49:56.000",
+ "heatFiles": [],
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/vfModule/066de97e-253e-11e7-93ae-92361f002672"
+ },
+ "vfModule": {
+ "href": "http://localhost:8090/vfModule/066de97e-253e-11e7-93ae-92361f002672"
+ },
+ "vfModuleCustomization": {
+ "href": "http://localhost:8090/vfModule/066de97e-253e-11e7-93ae-92361f002672/vfModuleCustomization"
+ },
+ "volumeHeatTemplate": {
+ "href": "http://localhost:8090/vfModule/066de97e-253e-11e7-93ae-92361f002672/volumeHeatTemplate"
+ },
+ "vnfResources": {
+ "href": "http://localhost:8090/vfModule/066de97e-253e-11e7-93ae-92361f002672/vnfResources"
+ },
+ "moduleHeatTemplate": {
+ "href": "http://localhost:8090/vfModule/066de97e-253e-11e7-93ae-92361f002672/moduleHeatTemplate"
+ }
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vfModuleVolGroup_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vfModuleVolGroup_Response.json
new file mode 100644
index 0000000000..6e429391d8
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vfModuleVolGroup_Response.json
@@ -0,0 +1,41 @@
+{
+ "modelUUID": "066de97e-253e-11e7-93ae-92361f002671",
+ "modelInvariantUUID": "64efd51a-2544-11e7-93ae-92361f002671",
+ "modelName": "test::PCM::module-1",
+ "modelVersion": "2",
+ "description": "v10 DEV PCM",
+ "isBase": false,
+ "created": "2016-09-14 12:49:56.000",
+ "heatFiles": [
+ {
+ "artifactUuid": "00535bdd-0878-4478-b95a-c575c742bfb0",
+ "description": "created from csar",
+ "fileName": "nimbus-ethernet-gw",
+ "fileBody": "DEVICE=$dev\nBOOTPROTO=none\nNM_CONTROLLED=no\nIPADDR=$ip\nNETMASK=$netmask\nGATEWAY=$gateway\n",
+ "created": "2017-01-21T18:26:43.000+0000",
+ "artifactChecksum": "MANUAL RECORD",
+ "version": "1",
+ "asdcUuid": "00535bdd-0878-4478-b95a-c575c742bfb0"
+ }
+ ],
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/vfModule/066de97e-253e-11e7-93ae-92361f002671"
+ },
+ "vfModule": {
+ "href": "http://localhost:8090/vfModule/066de97e-253e-11e7-93ae-92361f002671"
+ },
+ "vfModuleCustomization": {
+ "href": "http://localhost:8090/vfModule/066de97e-253e-11e7-93ae-92361f002671/vfModuleCustomization"
+ },
+ "volumeHeatTemplate": {
+ "href": "http://localhost:8090/vfModule/066de97e-253e-11e7-93ae-92361f002671/volumeHeatTemplate"
+ },
+ "moduleHeatTemplate": {
+ "href": "http://localhost:8090/vfModule/066de97e-253e-11e7-93ae-92361f002671/moduleHeatTemplate"
+ },
+ "vnfResources": {
+ "href": "http://localhost:8090/vfModule/066de97e-253e-11e7-93ae-92361f002671/vnfResources"
+ }
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vfModule_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vfModule_Response.json
new file mode 100644
index 0000000000..db26575fcd
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vfModule_Response.json
@@ -0,0 +1,41 @@
+{
+ "modelUUID": "20c4431c-246d-11e7-93ae-92361f002671",
+ "modelInvariantUUID": "78ca26d0-246d-11e7-93ae-92361f002671",
+ "modelName": "test::base::module-0",
+ "modelVersion": "2",
+ "description": "v10 DEV Base",
+ "isBase": true,
+ "created": "2016-09-14 12:49:56.000",
+ "heatFiles": [
+ {
+ "artifactUuid": "00535bdd-0878-4478-b95a-c575c742bfb0",
+ "description": "created from csar",
+ "fileName": "nimbus-ethernet-gw",
+ "fileBody": "DEVICE=$dev\nBOOTPROTO=none\nNM_CONTROLLED=no\nIPADDR=$ip\nNETMASK=$netmask\nGATEWAY=$gateway\n",
+ "created": "2017-01-21T18:26:43.000+0000",
+ "artifactChecksum": "MANUAL RECORD",
+ "version": "1",
+ "asdcUuid": "00535bdd-0878-4478-b95a-c575c742bfb0"
+ }
+ ],
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/vfModule/20c4431c-246d-11e7-93ae-92361f002671"
+ },
+ "vfModule": {
+ "href": "http://localhost:8090/vfModule/20c4431c-246d-11e7-93ae-92361f002671"
+ },
+ "moduleHeatTemplate": {
+ "href": "http://localhost:8090/vfModule/20c4431c-246d-11e7-93ae-92361f002671/moduleHeatTemplate"
+ },
+ "volumeHeatTemplate": {
+ "href": "http://localhost:8090/vfModule/20c4431c-246d-11e7-93ae-92361f002671/volumeHeatTemplate"
+ },
+ "vfModuleCustomization": {
+ "href": "http://localhost:8090/vfModule/20c4431c-246d-11e7-93ae-92361f002671/vfModuleCustomization"
+ },
+ "vnfResources": {
+ "href": "http://localhost:8090/vfModule/20c4431c-246d-11e7-93ae-92361f002671/vnfResources"
+ }
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vfModulesListByInvariantId_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vfModulesListByInvariantId_Response.json
new file mode 100644
index 0000000000..1a17c3f6f9
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vfModulesListByInvariantId_Response.json
@@ -0,0 +1,82 @@
+{
+ "_embedded": {
+ "vfModule": [
+ {
+ "modelUUID": "20c4431c-246d-11e7-93ae-92361f002671",
+ "modelInvariantUUID": "78ca26d0-246d-11e7-93ae-92361f002671",
+ "modelName": "test::base::module-0",
+ "modelVersion": "2",
+ "description": "v10 DEV Base",
+ "isBase": true,
+ "created": "2016-09-14 12:49:56.000",
+ "heatFiles": [
+ {
+ "artifactUuid": "00535bdd-0878-4478-b95a-c575c742bfb0",
+ "description": "created from csar",
+ "fileName": "nimbus-ethernet-gw",
+ "fileBody": "DEVICE=$dev\nBOOTPROTO=none\nNM_CONTROLLED=no\nIPADDR=$ip\nNETMASK=$netmask\nGATEWAY=$gateway\n",
+ "created": "2017-01-21T18:26:43.000+0000",
+ "artifactChecksum": "MANUAL RECORD",
+ "version": "1",
+ "asdcUuid": "00535bdd-0878-4478-b95a-c575c742bfb0"
+ }
+ ],
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/vfModule/20c4431c-246d-11e7-93ae-92361f002671"
+ },
+ "vfModule": {
+ "href": "http://localhost:8090/vfModule/20c4431c-246d-11e7-93ae-92361f002671"
+ },
+ "moduleHeatTemplate": {
+ "href": "http://localhost:8090/vfModule/20c4431c-246d-11e7-93ae-92361f002671/moduleHeatTemplate"
+ },
+ "vnfResources": {
+ "href": "http://localhost:8090/vfModule/20c4431c-246d-11e7-93ae-92361f002671/vnfResources"
+ },
+ "volumeHeatTemplate": {
+ "href": "http://localhost:8090/vfModule/20c4431c-246d-11e7-93ae-92361f002671/volumeHeatTemplate"
+ },
+ "vfModuleCustomization": {
+ "href": "http://localhost:8090/vfModule/20c4431c-246d-11e7-93ae-92361f002671/vfModuleCustomization"
+ }
+ }
+ },
+ {
+ "modelUUID": "20c4431c-246d-11e7-93ae-92361f002672",
+ "modelInvariantUUID": "78ca26d0-246d-11e7-93ae-92361f002671",
+ "modelName": "test::base::module-0",
+ "modelVersion": "2",
+ "description": "v10 DEV Base",
+ "isBase": true,
+ "created": "2016-09-14 12:49:56.000",
+ "heatFiles": [],
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/vfModule/20c4431c-246d-11e7-93ae-92361f002672"
+ },
+ "vfModule": {
+ "href": "http://localhost:8090/vfModule/20c4431c-246d-11e7-93ae-92361f002672"
+ },
+ "moduleHeatTemplate": {
+ "href": "http://localhost:8090/vfModule/20c4431c-246d-11e7-93ae-92361f002672/moduleHeatTemplate"
+ },
+ "vnfResources": {
+ "href": "http://localhost:8090/vfModule/20c4431c-246d-11e7-93ae-92361f002672/vnfResources"
+ },
+ "volumeHeatTemplate": {
+ "href": "http://localhost:8090/vfModule/20c4431c-246d-11e7-93ae-92361f002672/volumeHeatTemplate"
+ },
+ "vfModuleCustomization": {
+ "href": "http://localhost:8090/vfModule/20c4431c-246d-11e7-93ae-92361f002672/vfModuleCustomization"
+ }
+ }
+ }
+ ]
+ },
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/vfModule/search/findByModelInvariantUUIDOrderByModelVersionDesc?modelInvariantUUID=78ca26d0-246d-11e7-93ae-92361f002671"
+ }
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfComponentRecipeDeactivate_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfComponentRecipeDeactivate_Response.json
new file mode 100644
index 0000000000..a8adf9e26b
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfComponentRecipeDeactivate_Response.json
@@ -0,0 +1,19 @@
+{
+ "id": 36,
+ "action": "deactivateAndCloudDelete",
+ "description": "Gr api recipe to soft delete vf-module",
+ "orchestrationUri": "/mso/async/services/WorkflowActionBB",
+ "recipeTimeout": 180,
+ "vnfType": null,
+ "paramXsd": null,
+ "vnfComponentType": "vfModule",
+ "vfModuleModelUUID": "GR-API-DEFAULT",
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/vnfComponentsRecipe/36"
+ },
+ "vnfComponentsRecipe": {
+ "href": "http://localhost:8090/vnfComponentsRecipe/36"
+ }
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfComponentRecipeDeleteVfModule_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfComponentRecipeDeleteVfModule_Response.json
new file mode 100644
index 0000000000..c0a40cc834
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfComponentRecipeDeleteVfModule_Response.json
@@ -0,0 +1,19 @@
+{
+ "id": 33,
+ "action": "deleteInstance",
+ "description": "Gr api recipe to delete vf-module",
+ "orchestrationUri": "/mso/async/services/WorkflowActionBB",
+ "recipeTimeout": 180,
+ "vnfType": null,
+ "paramXsd": null,
+ "vnfComponentType": "vfModule",
+ "vfModuleModelUUID": "GR-API-DEFAULT",
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/vnfComponentsRecipe/33"
+ },
+ "vnfComponentsRecipe": {
+ "href": "http://localhost:8090/vnfComponentsRecipe/33"
+ }
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfComponentRecipeVNF_API_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfComponentRecipeVNF_API_Response.json
new file mode 100644
index 0000000000..dc63699fd2
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfComponentRecipeVNF_API_Response.json
@@ -0,0 +1,19 @@
+{
+ "id": 10,
+ "action": "createInstance",
+ "description": "VID_DEFAULT recipe t",
+ "orchestrationUri": "/mso/async/services/CreateVfModuleInfra",
+ "recipeTimeout": 180,
+ "vnfType": null,
+ "paramXsd": null,
+ "vnfComponentType": "vfModule",
+ "vfModuleModelUUID": "VNF-API-DEFAULT",
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/vnfComponentsRecipe/10"
+ },
+ "vnfComponentsRecipe": {
+ "href": "http://localhost:8090/vnfComponentsRecipe/10"
+ }
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfComponentRecipeVfModuleScaleOut_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfComponentRecipeVfModuleScaleOut_Response.json
new file mode 100644
index 0000000000..1f7c778d2b
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfComponentRecipeVfModuleScaleOut_Response.json
@@ -0,0 +1,19 @@
+{
+ "id": 37,
+ "action": "scaleOut",
+ "description": "Gr api recipe to scale out vfModule",
+ "orchestrationUri": "/mso/async/services/WorkflowActionBB",
+ "recipeTimeout": 180,
+ "vnfType": null,
+ "paramXsd": null,
+ "vnfComponentType": "vfModule",
+ "vfModuleModelUUID": "GR-API-DEFAULT",
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/vnfComponentsRecipe/37"
+ },
+ "vnfComponentsRecipe": {
+ "href": "http://localhost:8090/vnfComponentsRecipe/37"
+ }
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfComponentRecipeVolGrp_GRAPI_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfComponentRecipeVolGrp_GRAPI_Response.json
new file mode 100644
index 0000000000..2c8c1f2318
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfComponentRecipeVolGrp_GRAPI_Response.json
@@ -0,0 +1,19 @@
+{
+ "id": 29,
+ "action": "createInstance",
+ "description": "Gr api recipe to create volume-group",
+ "orchestrationUri": "/mso/async/services/WorkflowActionBB",
+ "recipeTimeout": 180,
+ "vnfType": null,
+ "paramXsd": null,
+ "vnfComponentType": "volumeGroup",
+ "vfModuleModelUUID": "GR-API-DEFAULT",
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/vnfComponentsRecipe/29"
+ },
+ "vnfComponentsRecipe": {
+ "href": "http://localhost:8090/vnfComponentsRecipe/29"
+ }
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfComponentRecipe_GRAPI_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfComponentRecipe_GRAPI_Response.json
new file mode 100644
index 0000000000..8317d9f002
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfComponentRecipe_GRAPI_Response.json
@@ -0,0 +1,19 @@
+{
+ "id": 34,
+ "action": "updateInstance",
+ "description": "Gr api recipe to update vf-module",
+ "orchestrationUri": "/mso/async/services/WorkflowActionBB",
+ "recipeTimeout": 180,
+ "vnfType": null,
+ "paramXsd": null,
+ "vnfComponentType": "vfModule",
+ "vfModuleModelUUID": "GR-API-DEFAULT",
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/vnfComponentsRecipe/34"
+ },
+ "vnfComponentsRecipe": {
+ "href": "http://localhost:8090/vnfComponentsRecipe/34"
+ }
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfComponentRecipe_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfComponentRecipe_Response.json
new file mode 100644
index 0000000000..c47d0aad99
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfComponentRecipe_Response.json
@@ -0,0 +1,19 @@
+{
+ "id": 19,
+ "action": "createInstance",
+ "description": "VID_DEFAULT recipe to create vf-module if no custom BPMN flow is found",
+ "orchestrationUri": "/mso/async/services/CreateVfModuleInfra",
+ "recipeTimeout": 180,
+ "vnfType": "vfModule",
+ "paramXsd": "",
+ "vnfComponentType": "vfModule",
+ "vfModuleModelUUID": "20c4431c-246d-11e7-93ae-92361f002671",
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/vnfComponentsRecipe/19"
+ },
+ "vnfComponentsRecipe": {
+ "href": "http://localhost:8090/vnfComponentsRecipe/19"
+ }
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfRecipeApplyUpdatedConfig_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfRecipeApplyUpdatedConfig_Response.json
new file mode 100644
index 0000000000..bde4541f6e
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfRecipeApplyUpdatedConfig_Response.json
@@ -0,0 +1,20 @@
+{
+ "id": 10011,
+ "nfRole": "GR-API-DEFAULT",
+ "paramXsd": null,
+ "vfModuleId": null,
+ "action": "applyUpdatedConfig",
+ "description": "Gr api recipe to apply updated config",
+ "orchestrationUri": "/mso/async/services/VnfConfigUpdate",
+ "recipeTimeout": 180,
+ "serviceType": null,
+ "created": "2018-08-10T09:49:12.000+0000",
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/vnfRecipe/10011"
+ },
+ "vnfRecipe": {
+ "href": "http://localhost:8090/vnfRecipe/10011"
+ }
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfRecipeCreateInstance_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfRecipeCreateInstance_Response.json
new file mode 100644
index 0000000000..99bbf122ad
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfRecipeCreateInstance_Response.json
@@ -0,0 +1,20 @@
+{
+ "id": 10006,
+ "nfRole": "GR-API-DEFAULT",
+ "paramXsd": null,
+ "vfModuleId": null,
+ "action": "createInstance",
+ "description": "Gr api recipe to create vnf",
+ "orchestrationUri": "/mso/async/services/WorkflowActionBB",
+ "recipeTimeout": 180,
+ "serviceType": null,
+ "created": "2018-08-10T09:49:12.000+0000",
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/vnfRecipe/10006"
+ },
+ "vnfRecipe": {
+ "href": "http://localhost:8090/vnfRecipe/10006"
+ }
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfRecipeDelete_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfRecipeDelete_Response.json
new file mode 100644
index 0000000000..33d7f4799c
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfRecipeDelete_Response.json
@@ -0,0 +1,20 @@
+{
+ "id": 10007,
+ "nfRole": "GR-API-DEFAULT",
+ "paramXsd": null,
+ "vfModuleId": null,
+ "action": "deleteInstance",
+ "description": "Gr api recipe to delete vnf",
+ "orchestrationUri": "/mso/async/services/WorkflowActionBB",
+ "recipeTimeout": 180,
+ "serviceType": null,
+ "created": "2018-08-10T09:49:12.000+0000",
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/vnfRecipe/10007"
+ },
+ "vnfRecipe": {
+ "href": "http://localhost:8090/vnfRecipe/10007"
+ }
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfRecipeInPlaceUpdate_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfRecipeInPlaceUpdate_Response.json
new file mode 100644
index 0000000000..9364fe76b3
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfRecipeInPlaceUpdate_Response.json
@@ -0,0 +1,20 @@
+{
+ "id": 10010,
+ "nfRole": "GR-API-DEFAULT",
+ "paramXsd": null,
+ "vfModuleId": null,
+ "action": "inPlaceSoftwareUpdate",
+ "description": "Gr api recipe to do an in place software update",
+ "orchestrationUri": "/mso/async/services/VnfInPlaceUpdate",
+ "recipeTimeout": 180,
+ "serviceType": null,
+ "created": "2018-08-20T08:10:21.000+0000",
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/vnfRecipe/10010"
+ },
+ "vnfRecipe": {
+ "href": "http://localhost:8090/vnfRecipe/10010"
+ }
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfRecipeReplaceInstance_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfRecipeReplaceInstance_Response.json
new file mode 100644
index 0000000000..13e9a5937f
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfRecipeReplaceInstance_Response.json
@@ -0,0 +1,20 @@
+{
+ "id": 10009,
+ "nfRole": "GR-API-DEFAULT",
+ "paramXsd": null,
+ "vfModuleId": null,
+ "action": "replaceInstance",
+ "description": "Gr api recipe to replace vnf",
+ "orchestrationUri": "/mso/async/services/WorkflowActionBB",
+ "recipeTimeout": 180,
+ "serviceType": null,
+ "created": "2018-08-20T08:10:21.000+0000",
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/vnfRecipe/10009"
+ },
+ "vnfRecipe": {
+ "href": "http://localhost:8090/vnfRecipe/10009"
+ }
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfRecipe_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfRecipe_Response.json
new file mode 100644
index 0000000000..53f4ddfbb5
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfRecipe_Response.json
@@ -0,0 +1,20 @@
+{
+ "id": 21,
+ "nfRole": "TEST",
+ "paramXsd": "",
+ "vfModuleId": "1882934",
+ "action": "replaceInstance",
+ "description": "custom bpmn for vnf recreate",
+ "orchestrationUri": "/mso/async/services/RecreateInfraVce",
+ "recipeTimeout": 180,
+ "serviceType": "VID_DEFAULT",
+ "created": "2016-06-03T04:44:10.000+0000",
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/vnfRecipe/21"
+ },
+ "vnfRecipe": {
+ "href": "http://localhost:8090/vnfRecipe/21"
+ }
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfResourceCustomizationForVfModule_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfResourceCustomizationForVfModule_Response.json
new file mode 100644
index 0000000000..85a02e76ba
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfResourceCustomizationForVfModule_Response.json
@@ -0,0 +1,32 @@
+{
+ "modelCustomizationUUID": "68dc9a92-214c-11e7-93ae-92361f002673",
+ "modelInstanceName": "test",
+ "created": "2017-05-26 09:38:24.000",
+ "minInstances": 0,
+ "maxInstances": 0,
+ "availabilityZoneMaxCount": 0,
+ "nfFunction": "vSAMP",
+ "nfType": "vSAMP",
+ "nfRole": "vSAMP",
+ "nfNamingCode": "vSAMP",
+ "multiStageDesign": null,
+ "creationTimestamp": "2017-05-26T09:38:24.000+0000",
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002673"
+ },
+ "vnfResourceCustomization": {
+ "href": "http://localhost:8090/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002673{?projection}",
+ "templated": true
+ },
+ "vnfResources": {
+ "href": "http://localhost:8090/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002673/vnfResources"
+ },
+ "vfModuleCustomizations": {
+ "href": "http://localhost:8090/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002673/vfModuleCustomizations"
+ },
+ "vnfcInstanceGroupCustomizations": {
+ "href": "http://localhost:8090/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002673/vnfcInstanceGroupCustomizations"
+ }
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfResourceCustomization_ReplaceVnf_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfResourceCustomization_ReplaceVnf_Response.json
new file mode 100644
index 0000000000..97e2be4a6a
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfResourceCustomization_ReplaceVnf_Response.json
@@ -0,0 +1,32 @@
+{
+ "modelCustomizationUUID": "68dc9a92-214c-11e7-93ae-92361f002671",
+ "modelInstanceName": "v10 1",
+ "created": "2017-05-26 09:38:24.000",
+ "minInstances": 0,
+ "maxInstances": 0,
+ "availabilityZoneMaxCount": 0,
+ "nfFunction": "vSAMP",
+ "nfType": "vSAMP",
+ "nfRole": "vSAMP",
+ "nfNamingCode": "vSAMP",
+ "multiStageDesign": null,
+ "creationTimestamp": "2017-05-26T09:38:24.000+0000",
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002671"
+ },
+ "vnfResourceCustomization": {
+ "href": "http://localhost:8090/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002671{?projection}",
+ "templated": true
+ },
+ "vnfResources": {
+ "href": "http://localhost:8090/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002671/vnfResources"
+ },
+ "vfModuleCustomizations": {
+ "href": "http://localhost:8090/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002671/vfModuleCustomizations"
+ },
+ "vnfcInstanceGroupCustomizations": {
+ "href": "http://localhost:8090/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002671/vnfcInstanceGroupCustomizations"
+ }
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfResourceCustomization_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfResourceCustomization_Response.json
new file mode 100644
index 0000000000..e83ad10245
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfResourceCustomization_Response.json
@@ -0,0 +1,32 @@
+{
+ "modelCustomizationUUID": "68dc9a92-214c-11e7-93ae-92361f002674",
+ "modelInstanceName": "test",
+ "created": "2017-05-26 09:38:24.000",
+ "minInstances": 0,
+ "maxInstances": 0,
+ "availabilityZoneMaxCount": 0,
+ "nfFunction": "",
+ "nfType": "",
+ "nfRole": "TEST",
+ "nfNamingCode": "",
+ "multiStageDesign": null,
+ "creationTimestamp": "2017-05-26T09:38:24.000+0000",
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002674"
+ },
+ "vnfResourceCustomization": {
+ "href": "http://localhost:8090/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002674{?projection}",
+ "templated": true
+ },
+ "vnfcInstanceGroupCustomizations": {
+ "href": "http://localhost:8090/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002674/vnfcInstanceGroupCustomizations"
+ },
+ "vnfResources": {
+ "href": "http://localhost:8090/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002674/vnfResources"
+ },
+ "vfModuleCustomizations": {
+ "href": "http://localhost:8090/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002674/vfModuleCustomizations"
+ }
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfResourceCustomizationsList_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfResourceCustomizationsList_Response.json
new file mode 100644
index 0000000000..7b6b5cde21
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfResourceCustomizationsList_Response.json
@@ -0,0 +1,140 @@
+{
+ "_embedded": {
+ "vnfResourceCustomization": [
+ {
+ "description": "1607 v10 - inherent network1",
+ "modelName": "v10",
+ "modelUUID": "ff2ae348-214a-11e7-93ae-92361f002672",
+ "modelInstanceName": "test",
+ "modelCustomizationUUID": "68dc9a92-214c-11e7-93ae-92361f002672",
+ "orchestrationMode": "HEAT",
+ "multiStageDesign": null,
+ "availabilityZoneMaxCount": "0",
+ "vfModuleCustomizations": [
+ {
+ "description": "v10 DEV PCM",
+ "modelName": "test::PCM::module-1",
+ "availabilityZoneCount": "0",
+ "isBase": true,
+ "initialCount": "1",
+ "label": "base",
+ "modelUUID": "test",
+ "modelCustomizationUUID": "a7f1d08e-b02d-11e6-80f5-76304dec7eb7",
+ "modelInvariantUUID": "f7ce78bb-423b-11e7-93f8-0050569a7968",
+ "maxInstances": "0",
+ "modelVersion": "1",
+ "minInstances": "0",
+ "created": "2016-09-14 18:19:56.0",
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/vfModuleCustomization/a7f1d08e-b02d-11e6-80f5-76304dec7eb7"
+ },
+ "volumeHeatEnv": {
+ "href": "http://localhost:8090/vfModuleCustomization/a7f1d08e-b02d-11e6-80f5-76304dec7eb7/volumeHeatEnv"
+ },
+ "heatEnvironment": {
+ "href": "http://localhost:8090/vfModuleCustomization/a7f1d08e-b02d-11e6-80f5-76304dec7eb7/heatEnvironment"
+ },
+ "vfModule": {
+ "href": "http://localhost:8090/vfModuleCustomization/a7f1d08e-b02d-11e6-80f5-76304dec7eb7/vfModule"
+ }
+ }
+ },
+ {
+ "description": "v10 DEV PCM",
+ "modelName": "test::PCM::module-1",
+ "availabilityZoneCount": "0",
+ "isBase": false,
+ "initialCount": "0",
+ "label": "PCM",
+ "modelUUID": "066de97e-253e-11e7-93ae-92361f002672",
+ "modelCustomizationUUID": "b4ea86b4-253f-11e7-93ae-92361f002672",
+ "modelInvariantUUID": "64efd51a-2544-11e7-93ae-92361f002671",
+ "maxInstances": "0",
+ "modelVersion": "2",
+ "minInstances": "0",
+ "created": "2016-09-14 18:19:56.0",
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002672"
+ },
+ "volumeHeatEnv": {
+ "href": "http://localhost:8090/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002672/volumeHeatEnv"
+ },
+ "heatEnvironment": {
+ "href": "http://localhost:8090/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002672/heatEnvironment"
+ },
+ "vfModule": {
+ "href": "http://localhost:8090/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002672/vfModule"
+ }
+ }
+ },
+ {
+ "description": "v10 DEV Base",
+ "modelName": "test::base::module-0",
+ "availabilityZoneCount": "0",
+ "isBase": true,
+ "initialCount": "1",
+ "label": "base",
+ "modelUUID": "20c4431c-246d-11e7-93ae-92361f002672",
+ "modelCustomizationUUID": "cb82ffd8-252a-11e7-93ae-92361f002672",
+ "modelInvariantUUID": "78ca26d0-246d-11e7-93ae-92361f002671",
+ "maxInstances": "0",
+ "modelVersion": "2",
+ "minInstances": "0",
+ "created": "2016-09-14 18:19:56.0",
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/vfModuleCustomization/cb82ffd8-252a-11e7-93ae-92361f002672"
+ },
+ "volumeHeatEnv": {
+ "href": "http://localhost:8090/vfModuleCustomization/cb82ffd8-252a-11e7-93ae-92361f002672/volumeHeatEnv"
+ },
+ "heatEnvironment": {
+ "href": "http://localhost:8090/vfModuleCustomization/cb82ffd8-252a-11e7-93ae-92361f002672/heatEnvironment"
+ },
+ "vfModule": {
+ "href": "http://localhost:8090/vfModuleCustomization/cb82ffd8-252a-11e7-93ae-92361f002672/vfModule"
+ }
+ }
+ }
+ ],
+ "modelInvariantUUID": "2fff5b20-214b-11e7-93ae-92361f002671",
+ "maxInstances": "0",
+ "nfRole": "vSAMP",
+ "nfNamingCode": "vSAMP",
+ "toscaNodeType": "VF",
+ "nfType": "vSAMP",
+ "modelVersion": "2.0",
+ "minInstances": "0",
+ "aicVersionMax": "",
+ "nfFunction": "vSAMP",
+ "aicVersionMin": "",
+ "created": "2017-04-14 21:46:28.0",
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002672"
+ },
+ "vnfResourceCustomization": {
+ "href": "http://localhost:8090/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002672{?projection}",
+ "templated": true
+ },
+ "vnfResources": {
+ "href": "http://localhost:8090/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002672/vnfResources"
+ },
+ "vfModuleCustomizations": {
+ "href": "http://localhost:8090/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002672/vfModuleCustomizations"
+ },
+ "vnfcInstanceGroupCustomizations": {
+ "href": "http://localhost:8090/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002672/vnfcInstanceGroupCustomizations"
+ }
+ }
+ }
+ ]
+ },
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/service/5df8b6de-2083-11e7-93ae-92361f002672/vnfCustomizations"
+ }
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfResourceForVfModule_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfResourceForVfModule_Response.json
new file mode 100644
index 0000000000..a4e8424e0c
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfResourceForVfModule_Response.json
@@ -0,0 +1,101 @@
+{
+ "modelUUID": "fe6478e4-ea33-3346-ac12-ab121484a3fe",
+ "modelInvariantUUID": "ff5256d1-5a33-55df-13ab-12abad84e7ff",
+ "modelName": "vSAMP12",
+ "modelVersion": "1.0",
+ "toscaNodeType": "VF",
+ "description": "1607 vSAMP10a - inherent network",
+ "orchestrationMode": "HEAT",
+ "aicVersionMin": "",
+ "aicVersionMax": "",
+ "category": null,
+ "subCategory": null,
+ "created": "2017-04-14T16:16:28.000+0000",
+ "modelInvariantId": "ff5256d1-5a33-55df-13ab-12abad84e7ff",
+ "_embedded": {
+ "vnfResourceCustomizations": [
+ {
+ "description": "1607 vSAMP10a - inherent network",
+ "modelName": "vSAMP12",
+ "modelUUID": "fe6478e4-ea33-3346-ac12-ab121484a3fe",
+ "modelInstanceName": "test",
+ "modelCustomizationUUID": "68dc9a92-214c-11e7-93ae-92361f002673",
+ "orchestrationMode": "HEAT",
+ "multiStageDesign": null,
+ "availabilityZoneMaxCount": "0",
+ "vfModuleCustomizations": [
+ {
+ "description": "v10 DEV PCM",
+ "modelName": "test::PCM::module-1",
+ "availabilityZoneCount": "0",
+ "isBase": false,
+ "initialCount": "0",
+ "label": "PCM",
+ "modelUUID": "066de97e-253e-11e7-93ae-92361f002672",
+ "modelCustomizationUUID": "b4ea86b4-253f-11e7-93ae-92361f002672",
+ "modelInvariantUUID": "64efd51a-2544-11e7-93ae-92361f002671",
+ "maxInstances": "0",
+ "modelVersion": "2",
+ "minInstances": "0",
+ "created": "2016-09-14 18:19:56.0",
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002672"
+ },
+ "volumeHeatEnv": {
+ "href": "http://localhost:8090/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002672/volumeHeatEnv"
+ },
+ "heatEnvironment": {
+ "href": "http://localhost:8090/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002672/heatEnvironment"
+ },
+ "vfModule": {
+ "href": "http://localhost:8090/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002672/vfModule"
+ }
+ }
+ }
+ ],
+ "modelInvariantUUID": "ff5256d1-5a33-55df-13ab-12abad84e7ff",
+ "maxInstances": "0",
+ "nfRole": "vSAMP",
+ "nfNamingCode": "vSAMP",
+ "toscaNodeType": "VF",
+ "nfType": "vSAMP",
+ "modelVersion": "1.0",
+ "minInstances": "0",
+ "aicVersionMax": "",
+ "nfFunction": "vSAMP",
+ "aicVersionMin": "",
+ "created": "2017-04-14 21:46:28.0",
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002673{?projection}",
+ "templated": true
+ },
+ "vnfResources": {
+ "href": "http://localhost:8090/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002673/vnfResources"
+ },
+ "vfModuleCustomizations": {
+ "href": "http://localhost:8090/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002673/vfModuleCustomizations"
+ },
+ "vnfcInstanceGroupCustomizations": {
+ "href": "http://localhost:8090/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002673/vnfcInstanceGroupCustomizations"
+ }
+ }
+ }
+ ]
+ },
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/vnfResource/fe6478e4-ea33-3346-ac12-ab121484a3fe"
+ },
+ "vnfResource": {
+ "href": "http://localhost:8090/vnfResource/fe6478e4-ea33-3346-ac12-ab121484a3fe"
+ },
+ "heatTemplates": {
+ "href": "http://localhost:8090/vnfResource/fe6478e4-ea33-3346-ac12-ab121484a3fe/heatTemplates"
+ },
+ "vnfResourceCustomizations": {
+ "href": "http://localhost:8090/vnfResource/fe6478e4-ea33-3346-ac12-ab121484a3fe/vnfResourceCustomizations"
+ }
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfResourcesCreateVnf_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfResourcesCreateVnf_Response.json
new file mode 100644
index 0000000000..79b2727ffe
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfResourcesCreateVnf_Response.json
@@ -0,0 +1,197 @@
+{
+ "modelUUID": "ff2ae348-214a-11e7-93ae-92361f002672",
+ "modelInvariantUUID": "2fff5b20-214b-11e7-93ae-92361f002671",
+ "modelName": "v10",
+ "modelVersion": "2.0",
+ "toscaNodeType": "VF",
+ "description": "1607 v10 - inherent network1",
+ "orchestrationMode": "HEAT",
+ "aicVersionMin": "",
+ "aicVersionMax": "",
+ "category": null,
+ "subCategory": null,
+ "created": "2017-04-14T16:16:28.000+0000",
+ "modelInvariantId": "2fff5b20-214b-11e7-93ae-92361f002671",
+ "_embedded": {
+ "vnfResourceCustomizations": [
+ {
+ "description": "1607 v10 - inherent network1",
+ "modelName": "v10",
+ "modelUUID": "ff2ae348-214a-11e7-93ae-92361f002672",
+ "modelInstanceName": "test",
+ "modelCustomizationUUID": "68dc9a92-214c-11e7-93ae-92361f002672",
+ "orchestrationMode": "HEAT",
+ "multiStageDesign": null,
+ "availabilityZoneMaxCount": "0",
+ "vfModuleCustomizations": [
+ {
+ "description": "v10 DEV PCM",
+ "modelName": "test::PCM::module-1",
+ "availabilityZoneCount": "0",
+ "isBase": true,
+ "initialCount": "1",
+ "label": "base",
+ "modelUUID": "test",
+ "modelCustomizationUUID": "a7f1d08e-b02d-11e6-80f5-76304dec7eb7",
+ "modelInvariantUUID": "f7ce78bb-423b-11e7-93f8-0050569a7968",
+ "maxInstances": "0",
+ "modelVersion": "1",
+ "minInstances": "0",
+ "created": "2016-09-14 18:19:56.0",
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/vfModuleCustomization/a7f1d08e-b02d-11e6-80f5-76304dec7eb7"
+ },
+ "volumeHeatEnv": {
+ "href": "http://localhost:8090/vfModuleCustomization/a7f1d08e-b02d-11e6-80f5-76304dec7eb7/volumeHeatEnv"
+ },
+ "heatEnvironment": {
+ "href": "http://localhost:8090/vfModuleCustomization/a7f1d08e-b02d-11e6-80f5-76304dec7eb7/heatEnvironment"
+ },
+ "vfModule": {
+ "href": "http://localhost:8090/vfModuleCustomization/a7f1d08e-b02d-11e6-80f5-76304dec7eb7/vfModule"
+ }
+ }
+ },
+ {
+ "description": "v10 DEV PCM",
+ "modelName": "test::PCM::module-1",
+ "availabilityZoneCount": "0",
+ "isBase": false,
+ "initialCount": "0",
+ "label": "PCM",
+ "modelUUID": "066de97e-253e-11e7-93ae-92361f002672",
+ "modelCustomizationUUID": "b4ea86b4-253f-11e7-93ae-92361f002672",
+ "modelInvariantUUID": "64efd51a-2544-11e7-93ae-92361f002671",
+ "maxInstances": "0",
+ "modelVersion": "2",
+ "minInstances": "0",
+ "created": "2016-09-14 18:19:56.0",
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002672"
+ },
+ "volumeHeatEnv": {
+ "href": "http://localhost:8090/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002672/volumeHeatEnv"
+ },
+ "heatEnvironment": {
+ "href": "http://localhost:8090/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002672/heatEnvironment"
+ },
+ "vfModule": {
+ "href": "http://localhost:8090/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002672/vfModule"
+ }
+ }
+ },
+ {
+ "description": "v10 DEV Base",
+ "modelName": "test::base::module-0",
+ "availabilityZoneCount": "0",
+ "isBase": true,
+ "initialCount": "1",
+ "label": "base",
+ "modelUUID": "20c4431c-246d-11e7-93ae-92361f002672",
+ "modelCustomizationUUID": "cb82ffd8-252a-11e7-93ae-92361f002672",
+ "modelInvariantUUID": "78ca26d0-246d-11e7-93ae-92361f002671",
+ "maxInstances": "0",
+ "modelVersion": "2",
+ "minInstances": "0",
+ "created": "2016-09-14 18:19:56.0",
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/vfModuleCustomization/cb82ffd8-252a-11e7-93ae-92361f002672"
+ },
+ "volumeHeatEnv": {
+ "href": "http://localhost:8090/vfModuleCustomization/cb82ffd8-252a-11e7-93ae-92361f002672/volumeHeatEnv"
+ },
+ "heatEnvironment": {
+ "href": "http://localhost:8090/vfModuleCustomization/cb82ffd8-252a-11e7-93ae-92361f002672/heatEnvironment"
+ },
+ "vfModule": {
+ "href": "http://localhost:8090/vfModuleCustomization/cb82ffd8-252a-11e7-93ae-92361f002672/vfModule"
+ }
+ }
+ }
+ ],
+ "modelInvariantUUID": "2fff5b20-214b-11e7-93ae-92361f002671",
+ "maxInstances": "0",
+ "nfRole": "vSAMP",
+ "nfNamingCode": "vSAMP",
+ "toscaNodeType": "VF",
+ "nfType": "vSAMP",
+ "modelVersion": "2.0",
+ "minInstances": "0",
+ "aicVersionMax": "",
+ "nfFunction": "vSAMP",
+ "aicVersionMin": "",
+ "created": "2017-04-14 21:46:28.0",
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002672{?projection}",
+ "templated": true
+ },
+ "vnfResources": {
+ "href": "http://localhost:8090/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002672/vnfResources"
+ },
+ "vfModuleCustomizations": {
+ "href": "http://localhost:8090/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002672/vfModuleCustomizations"
+ },
+ "vnfcInstanceGroupCustomizations": {
+ "href": "http://localhost:8090/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002672/vnfcInstanceGroupCustomizations"
+ }
+ }
+ },
+ {
+ "description": "1607 v10 - inherent network1",
+ "modelName": "v10",
+ "modelUUID": "ff2ae348-214a-11e7-93ae-92361f002672",
+ "modelInstanceName": "test",
+ "modelCustomizationUUID": "f78914d9-423b-11e7-93f8-0050569a7967",
+ "orchestrationMode": "HEAT",
+ "multiStageDesign": null,
+ "availabilityZoneMaxCount": "0",
+ "vfModuleCustomizations": [],
+ "modelInvariantUUID": "2fff5b20-214b-11e7-93ae-92361f002671",
+ "maxInstances": "0",
+ "nfRole": "vSAMP",
+ "nfNamingCode": "vSAMP",
+ "toscaNodeType": "VF",
+ "nfType": "vSAMP",
+ "modelVersion": "2.0",
+ "minInstances": "0",
+ "aicVersionMax": "",
+ "nfFunction": "vSAMP",
+ "aicVersionMin": "",
+ "created": "2017-04-14 21:46:28.0",
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/vnfResourceCustomization/f78914d9-423b-11e7-93f8-0050569a7967{?projection}",
+ "templated": true
+ },
+ "vnfResources": {
+ "href": "http://localhost:8090/vnfResourceCustomization/f78914d9-423b-11e7-93f8-0050569a7967/vnfResources"
+ },
+ "vfModuleCustomizations": {
+ "href": "http://localhost:8090/vnfResourceCustomization/f78914d9-423b-11e7-93f8-0050569a7967/vfModuleCustomizations"
+ },
+ "vnfcInstanceGroupCustomizations": {
+ "href": "http://localhost:8090/vnfResourceCustomization/f78914d9-423b-11e7-93f8-0050569a7967/vnfcInstanceGroupCustomizations"
+ }
+ }
+ }
+ ]
+ },
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/vnfResource/ff2ae348-214a-11e7-93ae-92361f002672"
+ },
+ "vnfResource": {
+ "href": "http://localhost:8090/vnfResource/ff2ae348-214a-11e7-93ae-92361f002672"
+ },
+ "heatTemplates": {
+ "href": "http://localhost:8090/vnfResource/ff2ae348-214a-11e7-93ae-92361f002672/heatTemplates"
+ },
+ "vnfResourceCustomizations": {
+ "href": "http://localhost:8090/vnfResource/ff2ae348-214a-11e7-93ae-92361f002672/vnfResourceCustomizations"
+ }
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfResources_ReplaceVnf_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfResources_ReplaceVnf_Response.json
new file mode 100644
index 0000000000..303275a713
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfResources_ReplaceVnf_Response.json
@@ -0,0 +1,130 @@
+{
+ "modelUUID": "ff2ae348-214a-11e7-93ae-92361f002671",
+ "modelInvariantUUID": "2fff5b20-214b-11e7-93ae-92361f002671",
+ "modelName": "v10",
+ "modelVersion": "1.0",
+ "toscaNodeType": "VF",
+ "description": "1607 v10 - inherent network",
+ "orchestrationMode": "HEAT",
+ "aicVersionMin": "",
+ "aicVersionMax": "",
+ "category": null,
+ "subCategory": null,
+ "created": "2017-04-14T16:16:28.000+0000",
+ "modelInvariantId": "2fff5b20-214b-11e7-93ae-92361f002671",
+ "_embedded": {
+ "vnfResourceCustomizations": [
+ {
+ "description": "1607 v10 - inherent network",
+ "modelName": "v10",
+ "modelUUID": "ff2ae348-214a-11e7-93ae-92361f002671",
+ "modelInstanceName": "v10 1",
+ "modelCustomizationUUID": "68dc9a92-214c-11e7-93ae-92361f002671",
+ "orchestrationMode": "HEAT",
+ "multiStageDesign": null,
+ "availabilityZoneMaxCount": "0",
+ "vfModuleCustomizations": [
+ {
+ "description": "v10 DEV PCM",
+ "modelName": "test::PCM::module-1",
+ "availabilityZoneCount": "0",
+ "isBase": false,
+ "initialCount": "0",
+ "label": "PCM",
+ "modelUUID": "066de97e-253e-11e7-93ae-92361f002671",
+ "modelCustomizationUUID": "b4ea86b4-253f-11e7-93ae-92361f002671",
+ "modelInvariantUUID": "64efd51a-2544-11e7-93ae-92361f002671",
+ "maxInstances": "0",
+ "modelVersion": "2",
+ "minInstances": "0",
+ "created": "2016-09-14 18:19:56.0",
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002671"
+ },
+ "volumeHeatEnv": {
+ "href": "http://localhost:8090/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002671/volumeHeatEnv"
+ },
+ "heatEnvironment": {
+ "href": "http://localhost:8090/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002671/heatEnvironment"
+ },
+ "vfModule": {
+ "href": "http://localhost:8090/vfModuleCustomization/b4ea86b4-253f-11e7-93ae-92361f002671/vfModule"
+ }
+ }
+ },
+ {
+ "description": "v10 DEV Base",
+ "modelName": "test::base::module-0",
+ "availabilityZoneCount": "0",
+ "isBase": true,
+ "initialCount": "1",
+ "label": "base",
+ "modelUUID": "20c4431c-246d-11e7-93ae-92361f002671",
+ "modelCustomizationUUID": "cb82ffd8-252a-11e7-93ae-92361f002671",
+ "modelInvariantUUID": "78ca26d0-246d-11e7-93ae-92361f002671",
+ "maxInstances": "0",
+ "modelVersion": "2",
+ "minInstances": "0",
+ "created": "2016-09-14 18:19:56.0",
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/vfModuleCustomization/cb82ffd8-252a-11e7-93ae-92361f002671"
+ },
+ "volumeHeatEnv": {
+ "href": "http://localhost:8090/vfModuleCustomization/cb82ffd8-252a-11e7-93ae-92361f002671/volumeHeatEnv"
+ },
+ "heatEnvironment": {
+ "href": "http://localhost:8090/vfModuleCustomization/cb82ffd8-252a-11e7-93ae-92361f002671/heatEnvironment"
+ },
+ "vfModule": {
+ "href": "http://localhost:8090/vfModuleCustomization/cb82ffd8-252a-11e7-93ae-92361f002671/vfModule"
+ }
+ }
+ }
+ ],
+ "modelInvariantUUID": "2fff5b20-214b-11e7-93ae-92361f002671",
+ "maxInstances": "0",
+ "nfRole": "vSAMP",
+ "nfNamingCode": "vSAMP",
+ "toscaNodeType": "VF",
+ "nfType": "vSAMP",
+ "modelVersion": "1.0",
+ "minInstances": "0",
+ "aicVersionMax": "",
+ "nfFunction": "vSAMP",
+ "aicVersionMin": "",
+ "created": "2017-04-14 21:46:28.0",
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002671{?projection}",
+ "templated": true
+ },
+ "vnfResources": {
+ "href": "http://localhost:8090/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002671/vnfResources"
+ },
+ "vfModuleCustomizations": {
+ "href": "http://localhost:8090/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002671/vfModuleCustomizations"
+ },
+ "vnfcInstanceGroupCustomizations": {
+ "href": "http://localhost:8090/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002671/vnfcInstanceGroupCustomizations"
+ }
+ }
+ }
+ ]
+ },
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/vnfResource/ff2ae348-214a-11e7-93ae-92361f002671"
+ },
+ "vnfResource": {
+ "href": "http://localhost:8090/vnfResource/ff2ae348-214a-11e7-93ae-92361f002671"
+ },
+ "heatTemplates": {
+ "href": "http://localhost:8090/vnfResource/ff2ae348-214a-11e7-93ae-92361f002671/heatTemplates"
+ },
+ "vnfResourceCustomizations": {
+ "href": "http://localhost:8090/vnfResource/ff2ae348-214a-11e7-93ae-92361f002671/vnfResourceCustomizations"
+ }
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfResources_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfResources_Response.json
new file mode 100644
index 0000000000..e95ead4435
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/vnfResources_Response.json
@@ -0,0 +1,71 @@
+{
+ "modelUUID": "fe6478e4-ea33-3346-ac12-ab121484a3fw",
+ "modelInvariantUUID": "2fff5b20-214b-11e7-93ae-92361f002671",
+ "modelName": "vSAMP10a",
+ "modelVersion": "1.0",
+ "toscaNodeType": "VF",
+ "description": "1607 vSAMP10a - inherent network",
+ "orchestrationMode": "HEAT",
+ "aicVersionMin": "",
+ "aicVersionMax": "",
+ "category": null,
+ "subCategory": null,
+ "created": "2017-04-14T16:16:28.000+0000",
+ "modelInvariantId": "2fff5b20-214b-11e7-93ae-92361f002671",
+ "_embedded": {
+ "vnfResourceCustomizations": [
+ {
+ "description": "1607 vSAMP10a - inherent network",
+ "modelName": "vSAMP10a",
+ "modelUUID": "fe6478e4-ea33-3346-ac12-ab121484a3fw",
+ "multiStageDesign": null,
+ "modelInvariantUUID": "2fff5b20-214b-11e7-93ae-92361f002671",
+ "modelInstanceName": "test",
+ "availabilityZoneMaxCount": "0",
+ "vfModuleCustomizations": [],
+ "modelCustomizationUUID": "68dc9a92-214c-11e7-93ae-92361f002674",
+ "orchestrationMode": "HEAT",
+ "nfFunction": "",
+ "modelVersion": "1.0",
+ "aicVersionMax": "",
+ "nfRole": "TEST",
+ "nfNamingCode": "",
+ "toscaNodeType": "VF",
+ "minInstances": "0",
+ "aicVersionMin": "",
+ "maxInstances": "0",
+ "created": "2017-04-14 21:46:28.0",
+ "nfType": "",
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002674{?projection}",
+ "templated": true
+ },
+ "vfModuleCustomizations": {
+ "href": "http://localhost:8090/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002674/vfModuleCustomizations"
+ },
+ "vnfResources": {
+ "href": "http://localhost:8090/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002674/vnfResources"
+ },
+ "vnfcInstanceGroupCustomizations": {
+ "href": "http://localhost:8090/vnfResourceCustomization/68dc9a92-214c-11e7-93ae-92361f002674/vnfcInstanceGroupCustomizations"
+ }
+ }
+ }
+ ]
+ },
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/vnfResource/fe6478e4-ea33-3346-ac12-ab121484a3fw"
+ },
+ "vnfResource": {
+ "href": "http://localhost:8090/vnfResource/fe6478e4-ea33-3346-ac12-ab121484a3fw"
+ },
+ "vnfResourceCustomizations": {
+ "href": "http://localhost:8090/vnfResource/fe6478e4-ea33-3346-ac12-ab121484a3fw/vnfResourceCustomizations"
+ },
+ "heatTemplates": {
+ "href": "http://localhost:8090/vnfResource/fe6478e4-ea33-3346-ac12-ab121484a3fw/heatTemplates"
+ }
+ }
+} \ No newline at end of file
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/AllottedResource.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/AllottedResource.java
index 75461c6cde..1d3ee7c36e 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/AllottedResource.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/AllottedResource.java
@@ -35,6 +35,7 @@ import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
+import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
@@ -70,7 +71,8 @@ public class AllottedResource implements Serializable {
@Column(name = "DESCRIPTION")
private String description;
-
+
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
@Column(name = "CREATION_TIMESTAMP", updatable = false)
@Temporal(TemporalType.TIMESTAMP)
private Date created;
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/AllottedResourceCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/AllottedResourceCustomization.java
index f68c6d2502..00ddf35a5f 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/AllottedResourceCustomization.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/AllottedResourceCustomization.java
@@ -35,6 +35,7 @@ import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
+import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
@@ -55,6 +56,7 @@ public class AllottedResourceCustomization implements Serializable {
private String modelCustomizationUUID;
@Column(name = "CREATION_TIMESTAMP", updatable = false)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
@Temporal(TemporalType.TIMESTAMP)
private Date created;
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
index e43fc1796d..a0e2409023 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
@@ -21,27 +21,34 @@
package org.onap.so.db.catalog.client;
import org.onap.so.db.catalog.beans.BuildingBlockDetail;
+import org.onap.so.db.catalog.beans.CloudSite;
+import org.onap.so.db.catalog.beans.CloudifyManager;
import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization;
import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization;
import org.onap.so.db.catalog.beans.ControllerSelectionReference;
import org.onap.so.db.catalog.beans.InstanceGroup;
import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization;
+import org.onap.so.db.catalog.beans.NetworkRecipe;
+import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
import org.onap.so.db.catalog.beans.OrchestrationAction;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
import org.onap.so.db.catalog.beans.OrchestrationStatusStateTransitionDirective;
import org.onap.so.db.catalog.beans.ResourceType;
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.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization;
-import org.onap.so.db.catalog.beans.CloudSite;
-import org.onap.so.db.catalog.beans.CloudIdentity;
-import org.onap.so.db.catalog.beans.CloudifyManager;
-import org.onap.so.db.catalog.beans.ServiceRecipe;
import org.onap.so.db.catalog.beans.macro.NorthBoundRequest;
import org.onap.so.db.catalog.beans.macro.OrchestrationFlow;
import org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus;
import org.onap.so.logging.jaxrs.filter.jersey.SpringClientFilter;
import org.springframework.beans.factory.annotation.Value;
+import org.springframework.http.HttpHeaders;
import org.springframework.http.client.BufferingClientHttpRequestFactory;
import org.springframework.http.client.ClientHttpRequestFactory;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
@@ -60,50 +67,136 @@ import java.util.List;
@Component("CatalogDbClient")
public class CatalogDbClient {
- private static final String SERVICE_RECIPE_SEARCH = "/serviceRecipe/search";
- private static final String SERVICE_MODEL_UUID = "SERVICE_MODEL_UUID";
- private static final String ACTION = "ACTION";
- private static final String MODEL_NAME = "MODEL_NAME";
- private static final String SERVICE_SEARCH = "/service/search";
- private static final String MODEL_VERSION = "MODEL_VERSION";
- private static final String MODEL_INVARIANT_UUID = "MODEL_INVARIANT_UUID";
+ private static final String CLOUD_SITE = "/cloudSite";
+ private static final String CLOUDIFY_MANAGER = "/cloudifyManager";
+ private static final String RAINY_DAY_HANDLER_MACRO = "/rainy_day_handler_macro";
+ private static final String NORTHBOUND_REQUEST_REF_LOOKUP = "/northbound_request_ref_lookup";
+ private static final String NETWORK_RESOURCE_CUSTOMIZATION = "/networkResourceCustomization";
+ private static final String COLLECTION_RESOURCE_INSTANCE_GROUP_CUSTOMIZATION = "/collectionResourceInstanceGroupCustomization";
+ private static final String VNFC_INSTANCE_GROUP_CUSTOMIZATION = "/vnfcInstanceGroupCustomization";
+ private static final String ORCHESTRATION_FLOW = "/orchestrationFlow";
+ private static final String ORCHESTRATION_STATUS_STATE_TRANSITION_DIRECTIVE = "/orchestrationStatusStateTransitionDirective";
+ private static final String INSTANCE_GROUP = "/instanceGroup";
+ private static final String COLLECTION_NETWORK_RESOURCE_CUSTOMIZATION = "/collectionNetworkResourceCustomization";
+ private static final String BUILDING_BLOCK_DETAIL = "/buildingBlockDetail";
+ private static final String NETWORK_COLLECTION_RESOURCE_CUSTOMIZATION = "/networkCollectionResourceCustomization";
+ private static final String VNF_RESOURCE_CUSTOMIZATION = "/vnfResourceCustomization";
+ private static final String SERVICE = "/service";
+ private static final String VNF_RESOURCE = "/vnfResource";
+ private static final String VNF_RECIPE = "/vnfRecipe";
+ private static final String VFMODULE = "/vfModule";
+ private static final String VFMODULE_CUSTOMIZATION = "/vfModuleCustomization";
+ private static final String VNF_COMPONENTS_RECIPE = "/vnfComponentsRecipe";
+ private static final String SERVICE_RECIPE = "/serviceRecipe";
+ private static final String NETWORK_RECIPE = "/networkRecipe";
+
+ private static final String SEARCH = "/search";
+ private static final String URI_SEPARATOR = "/";
+
+ private static final String SERVICE_MODEL_UUID = "serviceModelUUID";
+ private static final String MODEL_CUSTOMIZATION_UUID = "modelCustomizationUUID";
+ private static final String ACTION = "action";
+ private static final String MODEL_NAME = "modelName";
+ private static final String MODEL_VERSION = "modelVersion";
+ private static final String MODEL_INVARIANT_UUID = "modelInvariantUUID";
+ private static final String MODEL_INSTANCE_NAME = "modelInstanceName";
+ private static final String VNF_RESOURCE_MODEL_UUID = "vnfResourceModelUUID";
+ private static final String NF_ROLE = "nfRole";
+ private static final String VF_MODULE_MODEL_UUID = "vfModuleModelUUID";
+ private static final String VNF_COMPONENT_TYPE = "vnfComponentType";
+ private static final String BUILDING_BLOCK_NAME = "buildingBlockName";
+ private static final String RESOURCE_TYPE = "resourceType";
+ private static final String ORCHESTRATION_STATUS = "orchestrationStatus";
+ private static final String TARGET_ACTION = "targetAction";
+ private static final String REQUEST_SCOPE = "requestScope";
+ private static final String IS_ALACARTE = "isALaCarte";
+ private static final String FLOW_NAME = "flowName";
+ private static final String SERVICE_TYPE = "serviceType";
+ private static final String VNF_TYPE = "vnfType";
+ private static final String ERROR_CODE = "errorCode";
+ private static final String WORK_STEP = "workStep";
+ private static final String CLLI = "clli";
+ private static final String CLOUD_VERSION = "cloudVersion";
+
private String findFirstByModelNameURI = "/findFirstByModelNameOrderByModelVersionDesc";
private String findFirstByServiceModelUUIDAndActionURI = "/findFirstByServiceModelUUIDAndAction";
- private String findByModelVersionAndModelInvariantUUIDURI = "/findByModelVersionAndModelInvariantUUID";
-
- private Client<Service> serviceClient;
+ private String findFirstByModelVersionAndModelInvariantUUIDURI = "/findFirstByModelVersionAndModelInvariantUUID";
+ private String findByModelInvariantUUIDURI = "/findByModelInvariantUUIDOrderByModelVersionDesc";
+ private String findFirstByModelNameAndAction = "/findFirstByModelNameAndAction";
+ private String findFirstResourceByModelInvariantUUIDAndModelVersion = "/findFirstResourceByModelInvariantUUIDAndModelVersion";
+ private String findByModelInstanceNameAndVnfResources = "/findByModelInstanceNameAndVnfResources";
+ private String findFirstVnfRecipeByNfRoleAndAction = "/findFirstVnfRecipeByNfRoleAndAction";
+ private String findByModelCustomizationUUIDAndVfModuleModelUUID = "/findByModelCustomizationUUIDAndVfModuleModelUUID";
+ private String findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction = "/findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction";
+ private String findFirstVnfComponentsRecipeByVnfComponentTypeAndAction = "/findFirstVnfComponentsRecipeByVnfComponentTypeAndAction";
+ private String findVfModuleByModelInvariantUUIDOrderByModelVersionDesc = "/findByModelInvariantUUIDOrderByModelVersionDesc";
+ private String findFirstVfModuleByModelInvariantUUIDAndModelVersion = "/findFirstVfModuleByModelInvariantUUIDAndModelVersion";
+ private String findOneByBuildingBlockName = "/findOneByBuildingBlockName";
+ private String findOneByResourceTypeAndOrchestrationStatusAndTargetAction = "/findOneByResourceTypeAndOrchestrationStatusAndTargetAction";
+ private String findByAction = "/findByAction";
+ private String findVnfcInstanceGroupCustomizationByModelCustomizationUUID = "/findByModelCustomizationUUID";
+ private String findCollectionResourceInstanceGroupCustomizationByModelCustomizationUUID = "/findByModelCustomizationUUID";
+ private String findOneByActionAndRequestScopeAndIsAlacarte = "/findOneByActionAndRequestScopeAndIsAlacarte";
+ private String findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep = "/findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep";
+ private String findByClliAndCloudVersion = "/findByClliAndCloudVersion";
- private Client<VfModuleCustomization> vfModuleCustomizationClient;
+ private String serviceURI;
+ private String vfModuleURI;
+ private String vnfResourceURI;
+ private String vfModuleCustomizationURI;
+ private String networkCollectionResourceCustomizationURI;
+ private String networkResourceCustomizationURI;
+ private String vnfResourceCustomizationURI;
+ private String collectionNetworkResourceCustomizationURI;
+ private String instanceGroupURI;
+ private String cloudifyManagerURI;
+ private String cloudSiteURI;
- private Client<OrchestrationFlow> orchestrationClient;
+ private final Client<Service> serviceClient;
- private Client<NorthBoundRequest> northBoundRequestClient;
+ private final Client<NetworkRecipe> networkRecipeClient;
- private Client<RainyDayHandlerStatus> rainyDayHandlerStatusClient;
+ private final Client<NetworkResourceCustomization> networkResourceCustomizationClient;
- private Client<BuildingBlockDetail> buildingBlockDetailClient;
+ private final Client<VnfResource> vnfResourceClient;
- private Client<OrchestrationStatusStateTransitionDirective> orchestrationStatusStateTransitionDirectiveClient;
+ private final Client<VnfResourceCustomization> vnfResourceCustomizationClient;
- private Client<VnfcInstanceGroupCustomization> vnfcInstanceGroupCustomizationClient;
+ private final Client<VnfRecipe> vnfRecipeClient;
- private Client<CollectionResourceInstanceGroupCustomization> collectionResourceInstanceGroupCustomizationClient;
+ private final Client<VfModuleCustomization> vfModuleCustomizationClient;
- private Client<InstanceGroup> instanceGroupClient;
-
- private Client<NetworkCollectionResourceCustomization> networkCollectionResourceCustomizationClient;
-
- private Client<CollectionNetworkResourceCustomization> collectionNetworkResourceCustomizationClient;
+ private final Client<VfModule> vfModuleClient;
+
+ private final Client<VnfComponentsRecipe> vnfComponentsRecipeClient;
+
+ private final Client<OrchestrationFlow> orchestrationClient;
+
+ private final Client<NorthBoundRequest> northBoundRequestClient;
- private Client<ServiceRecipe> serviceRecipeClient;
+ private final Client<RainyDayHandlerStatus> rainyDayHandlerStatusClient;
- private Client<CloudSite> cloudSiteClient;
+ private final Client<BuildingBlockDetail> buildingBlockDetailClient;
- private Client<CloudIdentity> cloudIdentityClient;
+ private final Client<OrchestrationStatusStateTransitionDirective> orchestrationStatusStateTransitionDirectiveClient;
- private Client<CloudifyManager> cloudifyManagerClient;
+ private final Client<VnfcInstanceGroupCustomization> vnfcInstanceGroupCustomizationClient;
- protected Client<ControllerSelectionReference> controllerSelectionReferenceClient;
+ private final Client<CollectionResourceInstanceGroupCustomization> collectionResourceInstanceGroupCustomizationClient;
+
+ private final Client<InstanceGroup> instanceGroupClient;
+
+ private final Client<NetworkCollectionResourceCustomization> networkCollectionResourceCustomizationClient;
+
+ private final Client<CollectionNetworkResourceCustomization> collectionNetworkResourceCustomizationClient;
+
+ private final Client<ServiceRecipe> serviceRecipeClient;
+
+ private final Client<CloudSite> cloudSiteClient;
+
+ private final Client<CloudifyManager> cloudifyManagerClient;
+
+ private final Client<ControllerSelectionReference> controllerSelectionReferenceClient;
@Value("${mso.catalog.db.spring.endpoint}")
private String endpoint;
@@ -111,28 +204,66 @@ public class CatalogDbClient {
@Value("${mso.db.auth}")
private String msoAdaptersAuth;
+
@PostConstruct
public void init(){
- findFirstByModelNameURI = endpoint + SERVICE_SEARCH + findFirstByModelNameURI;
- findByModelVersionAndModelInvariantUUIDURI = endpoint + SERVICE_SEARCH + findByModelVersionAndModelInvariantUUIDURI;
- findFirstByServiceModelUUIDAndActionURI = endpoint + SERVICE_RECIPE_SEARCH + findFirstByServiceModelUUIDAndActionURI;
+ findFirstByModelNameURI = endpoint + SERVICE + SEARCH + findFirstByModelNameURI;
+ findFirstByModelVersionAndModelInvariantUUIDURI = endpoint + SERVICE + SEARCH + findFirstByModelVersionAndModelInvariantUUIDURI;
+ findByModelInvariantUUIDURI = endpoint + SERVICE + SEARCH + findByModelInvariantUUIDURI;
+ findFirstByServiceModelUUIDAndActionURI = endpoint + SERVICE_RECIPE + SEARCH + findFirstByServiceModelUUIDAndActionURI;
+ findFirstByModelNameAndAction = endpoint + NETWORK_RECIPE + SEARCH + findFirstByModelNameAndAction;
+ findFirstResourceByModelInvariantUUIDAndModelVersion = endpoint + VNF_RESOURCE + SEARCH + findFirstResourceByModelInvariantUUIDAndModelVersion;
+ findByModelInstanceNameAndVnfResources = endpoint + VNF_RESOURCE_CUSTOMIZATION + SEARCH + findByModelInstanceNameAndVnfResources;
+ findFirstVnfRecipeByNfRoleAndAction = endpoint + VNF_RECIPE + SEARCH + findFirstVnfRecipeByNfRoleAndAction;
+ findByModelCustomizationUUIDAndVfModuleModelUUID = endpoint + VFMODULE_CUSTOMIZATION + SEARCH + findByModelCustomizationUUIDAndVfModuleModelUUID;
+ findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction = endpoint + VNF_COMPONENTS_RECIPE + SEARCH + findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction;
+ findFirstVnfComponentsRecipeByVnfComponentTypeAndAction = endpoint + VNF_COMPONENTS_RECIPE + SEARCH + findFirstVnfComponentsRecipeByVnfComponentTypeAndAction;
+ findVfModuleByModelInvariantUUIDOrderByModelVersionDesc = endpoint + VFMODULE + SEARCH +findVfModuleByModelInvariantUUIDOrderByModelVersionDesc;
+ findFirstVfModuleByModelInvariantUUIDAndModelVersion = endpoint + VFMODULE + SEARCH + findFirstVfModuleByModelInvariantUUIDAndModelVersion;
+ findOneByBuildingBlockName = endpoint + BUILDING_BLOCK_DETAIL + SEARCH + findOneByBuildingBlockName;
+ findOneByResourceTypeAndOrchestrationStatusAndTargetAction = endpoint + ORCHESTRATION_STATUS_STATE_TRANSITION_DIRECTIVE + SEARCH + findOneByResourceTypeAndOrchestrationStatusAndTargetAction;
+ findByAction = endpoint + ORCHESTRATION_FLOW + SEARCH + findByAction;
+ findVnfcInstanceGroupCustomizationByModelCustomizationUUID = endpoint + VNFC_INSTANCE_GROUP_CUSTOMIZATION + SEARCH + findVnfcInstanceGroupCustomizationByModelCustomizationUUID;
+ findCollectionResourceInstanceGroupCustomizationByModelCustomizationUUID = endpoint + COLLECTION_RESOURCE_INSTANCE_GROUP_CUSTOMIZATION + SEARCH + findCollectionResourceInstanceGroupCustomizationByModelCustomizationUUID;
+ findOneByActionAndRequestScopeAndIsAlacarte = endpoint + NORTHBOUND_REQUEST_REF_LOOKUP + SEARCH + findOneByActionAndRequestScopeAndIsAlacarte;
+ findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep = endpoint + RAINY_DAY_HANDLER_MACRO + SEARCH + findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep;
+ findByClliAndCloudVersion = endpoint + CLOUD_SITE + SEARCH + findByClliAndCloudVersion;
+
+ serviceURI = endpoint + SERVICE + URI_SEPARATOR;
+ vfModuleURI = endpoint + VFMODULE + URI_SEPARATOR;
+ vnfResourceURI = endpoint + VNF_RESOURCE + URI_SEPARATOR;
+ vfModuleCustomizationURI = endpoint + VFMODULE_CUSTOMIZATION + URI_SEPARATOR;
+ networkCollectionResourceCustomizationURI = endpoint + NETWORK_COLLECTION_RESOURCE_CUSTOMIZATION + URI_SEPARATOR;
+ networkResourceCustomizationURI = endpoint + NETWORK_RESOURCE_CUSTOMIZATION + URI_SEPARATOR;
+ vnfResourceCustomizationURI = endpoint + VNF_RESOURCE_CUSTOMIZATION + URI_SEPARATOR;
+ collectionNetworkResourceCustomizationURI = endpoint + COLLECTION_NETWORK_RESOURCE_CUSTOMIZATION + URI_SEPARATOR;
+ instanceGroupURI = endpoint + INSTANCE_GROUP + URI_SEPARATOR;
+ cloudifyManagerURI = endpoint + CLOUDIFY_MANAGER + URI_SEPARATOR;
+ cloudSiteURI = endpoint + CLOUD_SITE + URI_SEPARATOR;
}
public CatalogDbClient() {
ClientHttpRequestFactory factory = new BufferingClientHttpRequestFactory(new HttpComponentsClientHttpRequestFactory());
-
+
ClientFactory clientFactory = Configuration.builder().setClientHttpRequestFactory(factory).setRestTemplateConfigurer(restTemplate -> {
restTemplate.getInterceptors().add((new SpringClientFilter()));
-
+
restTemplate.getInterceptors().add((request, body, execution) -> {
- request.getHeaders().add("Authorization", msoAdaptersAuth);
+ request.getHeaders().add(HttpHeaders.AUTHORIZATION, msoAdaptersAuth);
return execution.execute(request, body);
});
}).build().buildClientFactory();
serviceClient = clientFactory.create(Service.class);
+ networkRecipeClient = clientFactory.create(NetworkRecipe.class);
+ networkResourceCustomizationClient = clientFactory.create(NetworkResourceCustomization.class);
+ vnfResourceClient = clientFactory.create(VnfResource.class);
+ vnfResourceCustomizationClient = clientFactory.create(VnfResourceCustomization.class);
+ vnfRecipeClient = clientFactory.create(VnfRecipe.class);
orchestrationClient = clientFactory.create(OrchestrationFlow.class);
vfModuleCustomizationClient = clientFactory.create(VfModuleCustomization.class);
+ vfModuleClient = clientFactory.create(VfModule.class);
+ vnfComponentsRecipeClient = clientFactory.create(VnfComponentsRecipe.class);
northBoundRequestClient = clientFactory.create(NorthBoundRequest.class);
rainyDayHandlerStatusClient = clientFactory.create(RainyDayHandlerStatus.class);
buildingBlockDetailClient = clientFactory.create(BuildingBlockDetail.class);
@@ -145,47 +276,57 @@ public class CatalogDbClient {
networkCollectionResourceCustomizationClient = clientFactory.create(NetworkCollectionResourceCustomization.class);
collectionNetworkResourceCustomizationClient = clientFactory.create(CollectionNetworkResourceCustomization.class);
cloudSiteClient = clientFactory.create(CloudSite.class);
- cloudIdentityClient = clientFactory.create(CloudIdentity.class);
cloudifyManagerClient = clientFactory.create(CloudifyManager.class);
serviceRecipeClient = clientFactory.create(ServiceRecipe.class);
controllerSelectionReferenceClient = clientFactory.create(ControllerSelectionReference.class);
}
-
+
public NetworkCollectionResourceCustomization getNetworkCollectionResourceCustomizationByID(String modelCustomizationUUID) {
- NetworkCollectionResourceCustomization networkCollectionResourceCustomization =
- this.getSingleNetworkCollectionResourceCustomization(UriBuilder.fromUri(endpoint + "/networkCollectionResourceCustomization/" + modelCustomizationUUID).build());
+ NetworkCollectionResourceCustomization networkCollectionResourceCustomization =
+ this.getSingleResource(networkCollectionResourceCustomizationClient, getUri(networkCollectionResourceCustomizationURI + modelCustomizationUUID));
if (networkCollectionResourceCustomization != null) {
networkCollectionResourceCustomization.setModelCustomizationUUID(modelCustomizationUUID);
}
return networkCollectionResourceCustomization;
}
- private NetworkCollectionResourceCustomization getSingleNetworkCollectionResourceCustomization(URI uri) {
- return networkCollectionResourceCustomizationClient.get(uri);
- }
-
public Service getServiceByID(String modelUUID) {
- Service service = this.getSingleService(UriBuilder.fromUri(endpoint + "/service/" + modelUUID).build());
+ Service service = getSingleResource(serviceClient,getUri(serviceURI + modelUUID));
if (service != null) {
service.setModelUUID(modelUUID);
}
return service;
}
- public BuildingBlockDetail getBuildingBlockDetail(String buildingBlockName) {
- BuildingBlockDetail buildingBlockDetail = buildingBlockDetailClient
- .get(UriBuilder.fromUri(endpoint + "/buildingBlockDetail/search/findOneByBuildingBlockName")
- .queryParam("buildingBlockName", buildingBlockName).build());
- if (buildingBlockDetail != null) {
- buildingBlockDetail.setBuildingBlockName(buildingBlockName);
+ public VfModule getVfModuleByModelUUID(String modelUUID) {
+ VfModule vfModule = getSingleResource(vfModuleClient,getUri(vfModuleURI + modelUUID));
+ if (vfModule != null) {
+ vfModule.setModelUUID(modelUUID);
}
- return buildingBlockDetail;
+ return vfModule;
+ }
+
+ public VnfResource getVnfResourceByModelUUID(String modelUUID){
+
+ VnfResource vnfResource = this.getSingleResource(vnfResourceClient, getUri(vnfResourceURI + modelUUID));
+ if (vnfResource != null) {
+ vnfResource.setModelUUID(modelUUID);
+ }
+ return vnfResource;
+ }
+
+ public VnfResourceCustomization getVnfResourceCustomizationByModelCustomizationUUID(String modelCustomizationUUID){
+ VnfResourceCustomization vnfResourceCustomization = getSingleResource(vnfResourceCustomizationClient, getUri(vnfResourceCustomizationURI + modelCustomizationUUID));
+ if (vnfResourceCustomization != null) {
+ vnfResourceCustomization.setModelCustomizationUUID(modelCustomizationUUID);
+ }
+ return vnfResourceCustomization;
}
public CollectionNetworkResourceCustomization getCollectionNetworkResourceCustomizationByID(String modelCustomizationUUID) {
- CollectionNetworkResourceCustomization collectionNetworkResourceCustomization =
- this.getSingleCollectionNetworkResourceCustomization(
- UriBuilder.fromUri(endpoint + "/collectionNetworkResourceCustomization/" + modelCustomizationUUID).build());
+ CollectionNetworkResourceCustomization collectionNetworkResourceCustomization =
+ this.getSingleResource(collectionNetworkResourceCustomizationClient,getUri(UriBuilder
+ .fromUri(collectionNetworkResourceCustomizationURI + modelCustomizationUUID).build().toString()));
if (collectionNetworkResourceCustomization != null) {
collectionNetworkResourceCustomization.setModelCustomizationUUID(modelCustomizationUUID);
}
@@ -193,202 +334,215 @@ public class CatalogDbClient {
}
public InstanceGroup getInstanceGroupByModelUUID(String modelUUID) {
- InstanceGroup instanceGroup = this
- .getSingleInstanceGroup(UriBuilder.fromUri(endpoint + "/instanceGroup/" + modelUUID).build());
+ InstanceGroup instanceGroup = this.getSingleResource(instanceGroupClient, getUri(instanceGroupURI + modelUUID));
if (instanceGroup != null) {
instanceGroup.setModelUUID(modelUUID);
}
return instanceGroup;
}
- public OrchestrationStatusStateTransitionDirective getOrchestrationStatusStateTransitionDirective(
- ResourceType resourceType, OrchestrationStatus orchestrationStatus, OrchestrationAction targetAction) {
- return orchestrationStatusStateTransitionDirectiveClient.get(UriBuilder
- .fromUri(
- endpoint + "/orchestrationStatusStateTransitionDirective/search/findOneByResourceTypeAndOrchestrationStatusAndTargetAction")
- .queryParam("resourceType", resourceType.name())
- .queryParam("orchestrationStatus", orchestrationStatus.name())
- .queryParam("targetAction", targetAction.name()).build());
+ public VfModuleCustomization getVfModuleCustomizationByModelCuztomizationUUID(String modelCustomizationUUID) {
+ VfModuleCustomization vfModuleCust = this.getSingleResource(vfModuleCustomizationClient, getUri(vfModuleCustomizationURI + modelCustomizationUUID));
+ if (vfModuleCust != null) {
+ vfModuleCust.setModelCustomizationUUID(modelCustomizationUUID);
+ }
+ return vfModuleCust;
}
- public List<OrchestrationFlow> getOrchestrationFlowByAction(String action) {
- return this
- .getMultipleOrchestrationFlows(UriBuilder.fromUri(endpoint + "/orchestrationFlow/search/findByAction")
- .queryParam("COMPOSITE_ACTION", action).build());
+ public NetworkResourceCustomization getNetworkResourceCustomizationByModelCustomizationUUID(String modelCustomizationUUID){
+ NetworkResourceCustomization networkResourceCustomization =
+ this.getSingleResource(networkResourceCustomizationClient, getUri(networkResourceCustomizationURI + modelCustomizationUUID));
+ if (networkResourceCustomization != null) {
+ networkResourceCustomization.setModelCustomizationUUID(modelCustomizationUUID);
+ }
+ return networkResourceCustomization;
}
- public List<OrchestrationFlow> getAllOrchestrationFlows() {
- return this.getMultipleOrchestrationFlows(UriBuilder.fromUri(endpoint + "/orchestrationFlow/").build());
+ public BuildingBlockDetail getBuildingBlockDetail(String buildingBlockName) {
+ BuildingBlockDetail buildingBlockDetail = getSingleResource(buildingBlockDetailClient, getUri(UriBuilder
+ .fromUri(findOneByBuildingBlockName).queryParam(BUILDING_BLOCK_NAME, buildingBlockName).build().toString()));
+ if (buildingBlockDetail != null) {
+ buildingBlockDetail.setBuildingBlockName(buildingBlockName);
+ }
+ return buildingBlockDetail;
}
- private List<OrchestrationFlow> getMultipleOrchestrationFlows(URI uri) {
- Iterable<OrchestrationFlow> orchIterator = orchestrationClient.getAll(uri);
- List<OrchestrationFlow> orchList = new ArrayList<>();
- Iterator<OrchestrationFlow> it = orchIterator.iterator();
- it.forEachRemaining(orchList::add);
- return orchList;
+
+ public OrchestrationStatusStateTransitionDirective getOrchestrationStatusStateTransitionDirective(
+ ResourceType resourceType, OrchestrationStatus orchestrationStatus, OrchestrationAction targetAction) {
+ return getSingleResource(orchestrationStatusStateTransitionDirectiveClient, UriBuilder
+ .fromUri(findOneByResourceTypeAndOrchestrationStatusAndTargetAction)
+ .queryParam(RESOURCE_TYPE, resourceType.name())
+ .queryParam(ORCHESTRATION_STATUS, orchestrationStatus.name())
+ .queryParam(TARGET_ACTION, targetAction.name()).build());
+ }
+
+ public List<OrchestrationFlow> getOrchestrationFlowByAction(String action) {
+ return this.getMultipleResources(orchestrationClient, UriBuilder
+ .fromUri(findByAction).queryParam(ACTION, action).build());
}
public List<VnfcInstanceGroupCustomization> getVnfcInstanceGroupsByVnfResourceCust(String modelCustomizationUUID) {
- return this.getMultipleVnfcInstanceGroupCustomizations(
- UriBuilder.fromUri(endpoint + "/vnfcInstanceGroupCustomization/search/findByModelCustomizationUUID")
- .queryParam("MODEL_CUSTOMIZATION_UUID", modelCustomizationUUID).build());
+ return this.getMultipleResources(vnfcInstanceGroupCustomizationClient, UriBuilder
+ .fromUri(findVnfcInstanceGroupCustomizationByModelCustomizationUUID)
+ .queryParam(MODEL_CUSTOMIZATION_UUID, modelCustomizationUUID).build());
}
public List<CollectionResourceInstanceGroupCustomization> getCollectionResourceInstanceGroupCustomizationByModelCustUUID(
String modelCustomizationUUID) {
- return this.getMultipleCollectionResourceInstanceGroupCustomizations(UriBuilder
- .fromUri(endpoint + "/collectionResourceInstanceGroupCustomization/search/findByModelCustomizationUUID")
- .queryParam("MODEL_CUSTOMIZATION_UUID", modelCustomizationUUID).build());
- }
-
- private List<CollectionResourceInstanceGroupCustomization> getMultipleCollectionResourceInstanceGroupCustomizations(
- URI uri) {
- Iterable<CollectionResourceInstanceGroupCustomization> collectionInstanceGroupCustIter = collectionResourceInstanceGroupCustomizationClient
- .getAll(uri);
- List<CollectionResourceInstanceGroupCustomization> collectionInstanceGroupCustList = new ArrayList<>();
- Iterator<CollectionResourceInstanceGroupCustomization> it = collectionInstanceGroupCustIter.iterator();
- it.forEachRemaining(collectionInstanceGroupCustList::add);
- return collectionInstanceGroupCustList;
+ return this.getMultipleResources(collectionResourceInstanceGroupCustomizationClient, UriBuilder
+ .fromUri(findCollectionResourceInstanceGroupCustomizationByModelCustomizationUUID)
+ .queryParam(MODEL_CUSTOMIZATION_UUID, modelCustomizationUUID).build());
}
- private List<VnfcInstanceGroupCustomization> getMultipleVnfcInstanceGroupCustomizations(URI uri) {
- Iterable<VnfcInstanceGroupCustomization> vnfcIterator = vnfcInstanceGroupCustomizationClient.getAll(uri);
- List<VnfcInstanceGroupCustomization> vnfcList = new ArrayList<>();
- Iterator<VnfcInstanceGroupCustomization> it = vnfcIterator.iterator();
- it.forEachRemaining(vnfcList::add);
- return vnfcList;
- }
-
- public VfModuleCustomization getVfModuleCustomizationByModelCuztomizationUUID(String modelCustomizationUUID) {
- VfModuleCustomization vfModuleCust = this.getSingleVfModuleCustomization(
- UriBuilder.fromUri(endpoint + "/vfModuleCustomization/" + modelCustomizationUUID).build());
- if (vfModuleCust != null) {
- vfModuleCust.setModelCustomizationUUID(modelCustomizationUUID);
- }
- return vfModuleCust;
+ public VfModuleCustomization getVfModuleCustomizationByModelCustomizationUUIDAndVfModuleModelUUID(String modelCustomizationUUID, String vfModuleModelUUID) {
+ return this.getSingleResource(vfModuleCustomizationClient, getUri(UriBuilder
+ .fromUri(findByModelCustomizationUUIDAndVfModuleModelUUID)
+ .queryParam(MODEL_CUSTOMIZATION_UUID,modelCustomizationUUID)
+ .queryParam(VF_MODULE_MODEL_UUID,vfModuleModelUUID).build().toString()));
}
public NorthBoundRequest getNorthBoundRequestByActionAndIsALaCarteAndRequestScope(String requestAction,
String resourceName, boolean aLaCarte) {
- return this.getSingleNorthBoundRequest(UriBuilder
- .fromUri(endpoint + "/northbound_request_ref_lookup/search/findOneByActionAndRequestScopeAndIsAlacarte")
- .queryParam("ACTION", requestAction).queryParam("REQUEST_SCOPE", resourceName)
- .queryParam("IS_ALACARTE", aLaCarte).build());
+ return this.getSingleResource(northBoundRequestClient, UriBuilder
+ .fromUri(findOneByActionAndRequestScopeAndIsAlacarte)
+ .queryParam(ACTION, requestAction).queryParam(REQUEST_SCOPE, resourceName)
+ .queryParam(IS_ALACARTE, aLaCarte).build());
}
public RainyDayHandlerStatus getRainyDayHandlerStatusByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(
String flowName, String serviceType, String vnfType, String errorCode, String workStep) {
- return this.getSingleRainyDayHandlerStatus(UriBuilder
- .fromUri(
- endpoint + "/rainy_day_handler_macro/search/findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep")
- .queryParam("FLOW_NAME", flowName).queryParam("SERVICE_TYPE", serviceType)
- .queryParam("VNF_TYPE", vnfType).queryParam("ERROR_CODE", errorCode).queryParam("WORK_STEP", workStep)
+ return this.getSingleResource(rainyDayHandlerStatusClient, UriBuilder
+ .fromUri(findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep)
+ .queryParam(FLOW_NAME, flowName).queryParam(SERVICE_TYPE, serviceType)
+ .queryParam(VNF_TYPE, vnfType).queryParam(ERROR_CODE, errorCode).queryParam(WORK_STEP, workStep)
.build());
}
-
+
public ServiceRecipe getFirstByServiceModelUUIDAndAction(String modelUUID, String action){
- return this.getSingleServiceRecipe(UriBuilder.fromUri(findFirstByServiceModelUUIDAndActionURI)
+ return this.getSingleResource(serviceRecipeClient, getUri(UriBuilder
+ .fromUri(findFirstByServiceModelUUIDAndActionURI)
.queryParam(SERVICE_MODEL_UUID,modelUUID)
- .queryParam(ACTION,action)
- .build());
+ .queryParam(ACTION,action).build().toString()));
}
-
- public Service getFirstByModelNameOrderByModelVersionDesc(String modelName){
- return this.getSingleService(UriBuilder.fromUri(findFirstByModelNameURI)
+
+ public NetworkRecipe getFirstNetworkRecipeByModelNameAndAction(String modelName, String action){
+ return this.getSingleResource(networkRecipeClient, UriBuilder
+ .fromUri(findFirstByModelNameAndAction)
.queryParam(MODEL_NAME,modelName)
- .build());
+ .queryParam(ACTION,action).build());
}
public ControllerSelectionReference getControllerSelectionReferenceByVnfType(String vnfType) {
- return this.getSingleControllerSelectionReference(UriBuilder
+ return this.getSingleResource(controllerSelectionReferenceClient, UriBuilder
.fromUri(endpoint + "/controllerSelectionReference/search/findControllerSelectionReferenceByVnfType")
.queryParam("VNF_TYPE", vnfType).build());
}
public ControllerSelectionReference getControllerSelectionReferenceByVnfTypeAndActionCategory(String vnfType, String actionCategory) {
- return this.getSingleControllerSelectionReference(UriBuilder
+ return this.getSingleResource(controllerSelectionReferenceClient, UriBuilder
.fromUri(endpoint + "/controllerSelectionReference/search/findControllerSelectionReferenceByVnfTypeAndActionCategory")
.queryParam("VNF_TYPE", vnfType).queryParam("ACTION_CATEGORY", actionCategory).build());
}
-
- private CollectionNetworkResourceCustomization getSingleCollectionNetworkResourceCustomization(URI uri) {
- return collectionNetworkResourceCustomizationClient.get(uri);
- }
- public CloudifyManager getCloudifyManager(String id) {
- return this.getSingleCloudifyManager(UriBuilder.fromUri(endpoint+"/cloudifyManager/"+id).build());
- }
-
- public CloudSite getCloudSite(String id){
- return this.getSinglCloudSite(UriBuilder.fromUri(endpoint+"/cloudSite/"+id).build());
- }
-
- public CloudIdentity getCloudIdentity(String id){
- return this.getSingleCloudIdentity(UriBuilder.fromUri(endpoint+"/cloudIdentity/"+id).build());
+ public Service getFirstByModelNameOrderByModelVersionDesc(String modelName){
+ return this.getSingleResource(serviceClient,UriBuilder
+ .fromUri(findFirstByModelNameURI)
+ .queryParam(MODEL_NAME,modelName).build());
}
-
- public CloudSite getCloudSiteByClliAndAicVersion (String clli, String cloudVersion){
- return this.getSinglCloudSite(UriBuilder.fromUri(endpoint+"/cloudSite/search/findByClliAndCloudVersion")
- .queryParam("CLLI",clli).queryParam("CLOUD_VERSION",cloudVersion)
- .build());
+
+
+ public VnfResource getFirstVnfResourceByModelInvariantUUIDAndModelVersion(String modelInvariantUUID, String modelVersion){
+ return this.getSingleResource(vnfResourceClient, getUri(UriBuilder
+ .fromUri(findFirstResourceByModelInvariantUUIDAndModelVersion)
+ .queryParam(MODEL_INVARIANT_UUID,modelInvariantUUID)
+ .queryParam(MODEL_VERSION,modelVersion).build().toString()));
}
- private InstanceGroup getSingleInstanceGroup(URI uri) {
- return instanceGroupClient.get(uri);
+
+ public VnfResourceCustomization getFirstVnfResourceCustomizationByModelInstanceNameAndVnfResources(String modelInstanceName, VnfResource vnfResource){
+ return this.getSingleResource(vnfResourceCustomizationClient, getUri(UriBuilder
+ .fromUri(findByModelInstanceNameAndVnfResources)
+ .queryParam(MODEL_INSTANCE_NAME,modelInstanceName)
+ .queryParam(VNF_RESOURCE_MODEL_UUID,vnfResource.getModelUUID()).build().toString()));
}
- private Service getSingleService(URI uri) {
- return serviceClient.get(uri);
+ public VnfRecipe getFirstVnfRecipeByNfRoleAndAction(String nfRole, String action){
+ return this.getSingleResource(vnfRecipeClient,getUri(UriBuilder
+ .fromUri(findFirstVnfRecipeByNfRoleAndAction)
+ .queryParam(NF_ROLE,nfRole)
+ .queryParam(ACTION,action).build().toString()));
}
- private VfModuleCustomization getSingleVfModuleCustomization(URI uri) {
- return vfModuleCustomizationClient.get(uri);
+ public VnfComponentsRecipe getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(String vfModuleModelUUID, String vnfComponentType, String action){
+ return this.getSingleResource(vnfComponentsRecipeClient,getUri(UriBuilder
+ .fromUri(findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction)
+ .queryParam(VF_MODULE_MODEL_UUID,vfModuleModelUUID)
+ .queryParam(VNF_COMPONENT_TYPE,vnfComponentType)
+ .queryParam(ACTION,action).build().toString()));
}
- private NorthBoundRequest getSingleNorthBoundRequest(URI uri) {
- return northBoundRequestClient.get(uri);
+ public VnfComponentsRecipe getFirstVnfComponentsRecipeByVnfComponentTypeAndAction(String vnfComponentType, String action) {
+ return this.getSingleResource(vnfComponentsRecipeClient,getUri(UriBuilder
+ .fromUri(findFirstVnfComponentsRecipeByVnfComponentTypeAndAction)
+ .queryParam(VNF_COMPONENT_TYPE,vnfComponentType)
+ .queryParam(ACTION,action).build().toString()));
+ }
+ protected URI getUri(String template){
+ return URI.create(template);
}
- private RainyDayHandlerStatus getSingleRainyDayHandlerStatus(URI uri) {
- return rainyDayHandlerStatusClient.get(uri);
+ public CloudifyManager getCloudifyManager(String id) {
+ return this.getSingleResource(cloudifyManagerClient,getUri(cloudifyManagerURI + id));
}
-
- private ServiceRecipe getSingleServiceRecipe(URI uri){
- return serviceRecipeClient.get(uri);
+
+ public CloudSite getCloudSite(String id){
+ return this.getSingleResource(cloudSiteClient, getUri(cloudSiteURI + id));
}
- protected CloudSite getSinglCloudSite(URI uri) {
- return cloudSiteClient.get(uri);
+ public CloudSite getCloudSiteByClliAndAicVersion (String clli, String cloudVersion){
+ return this.getSingleResource(cloudSiteClient, getUri(UriBuilder
+ .fromUri(findByClliAndCloudVersion)
+ .queryParam(CLLI,clli).queryParam(CLOUD_VERSION,cloudVersion).build().toString()));
}
- protected CloudIdentity getSingleCloudIdentity(URI uri) {
- return cloudIdentityClient.get(uri);
+ public Service getServiceByModelVersionAndModelInvariantUUID(String modelVersion, String modelInvariantUUID) {
+ return this.getSingleResource(serviceClient, getUri(UriBuilder
+ .fromUri(findFirstByModelVersionAndModelInvariantUUIDURI)
+ .queryParam(MODEL_VERSION, modelVersion)
+ .queryParam(MODEL_INVARIANT_UUID, modelInvariantUUID).build().toString()));
}
- protected CloudifyManager getSingleCloudifyManager(URI uri) {
- return cloudifyManagerClient.get(uri);
+ public VfModule getVfModuleByModelInvariantUUIDAndModelVersion(String modelInvariantUUID, String modelVersion){
+ return this.getSingleResource(vfModuleClient,getUri(UriBuilder
+ .fromUri(findFirstVfModuleByModelInvariantUUIDAndModelVersion)
+ .queryParam(MODEL_INVARIANT_UUID, modelInvariantUUID)
+ .queryParam(MODEL_VERSION, modelVersion).build().toString()));
}
- private ControllerSelectionReference getSingleControllerSelectionReference(URI uri) {
- return controllerSelectionReferenceClient.get(uri);
+ public List<Service> getServiceByModelInvariantUUIDOrderByModelVersionDesc(String modelInvariantUUID) {
+ return this.getMultipleResources(serviceClient, getUri(UriBuilder
+ .fromUri(findByModelInvariantUUIDURI)
+ .queryParam(MODEL_INVARIANT_UUID, modelInvariantUUID).build().toString()));
}
- public Service getServiceByModelVersionAndModelInvariantUUID(String modelVersion, String modelInvariantUUID) {
- return this.getSingleService(
- UriBuilder.fromUri(findByModelVersionAndModelInvariantUUIDURI)
- .queryParam(MODEL_VERSION, modelVersion)
- .queryParam(MODEL_INVARIANT_UUID, modelInvariantUUID).build());
+ public List<VfModule> getVfModuleByModelInvariantUUIDOrderByModelVersionDesc(String modelInvariantUUID) {
+ return this.getMultipleResources(vfModuleClient, getUri(UriBuilder
+ .fromUri(findVfModuleByModelInvariantUUIDOrderByModelVersionDesc)
+ .queryParam(MODEL_INVARIANT_UUID, modelInvariantUUID).build().toString()));
}
- //USED FOR TEST ONLY
- public void setPortToEndpoint(String port) {
- endpoint = endpoint + port;
+ private <T> T getSingleResource(Client<T> client, URI uri) {
+ return client.get(uri);
}
-
- //USED FOR TEST ONLY
- public void removePortFromEndpoint() {
- endpoint = endpoint.substring(0, endpoint.lastIndexOf(':') + 1);
+
+ private <T> List<T> getMultipleResources(Client<T> client, URI uri) {
+ Iterable<T> iterator = client.getAll(uri);
+ List<T> list = new ArrayList<>();
+ Iterator<T> it = iterator.iterator();
+ it.forEachRemaining(list::add);
+ return list;
}
+
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ArRecipeRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ArRecipeRepository.java
index 58058da380..1241dac4ee 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ArRecipeRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ArRecipeRepository.java
@@ -27,5 +27,5 @@ import org.springframework.data.rest.core.annotation.RepositoryRestResource;
@RepositoryRestResource(collectionResourceRel = "arRecipe", path = "arRecipe")
public interface ArRecipeRepository extends JpaRepository<ArRecipe, String> {
- public ArRecipe findByModelNameAndAction(String modelName, String action);
+ ArRecipe findByModelNameAndAction(String modelName, String action);
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/BuildingBlockDetailRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/BuildingBlockDetailRepository.java
index 79ad9c77d1..d86377127c 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/BuildingBlockDetailRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/BuildingBlockDetailRepository.java
@@ -22,10 +22,9 @@ package org.onap.so.db.catalog.data.repository;
import org.onap.so.db.catalog.beans.BuildingBlockDetail;
import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
@RepositoryRestResource(collectionResourceRel = "buildingBlockDetail", path = "buildingBlockDetail")
public interface BuildingBlockDetailRepository extends JpaRepository<BuildingBlockDetail, String> {
- BuildingBlockDetail findOneByBuildingBlockName(@Param("buildingBlockName") String buildingBlockName);
+ BuildingBlockDetail findOneByBuildingBlockName(String buildingBlockName);
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudSiteRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudSiteRepository.java
index 65181ff070..ba40a9c506 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudSiteRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudSiteRepository.java
@@ -2,7 +2,6 @@ package org.onap.so.db.catalog.data.repository;
import org.onap.so.db.catalog.beans.CloudSite;
import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import javax.transaction.Transactional;
@@ -11,5 +10,5 @@ import javax.transaction.Transactional;
@Transactional
public interface CloudSiteRepository extends JpaRepository<CloudSite, String> {
- CloudSite findByClliAndCloudVersion(@Param("CLLI") String clli,@Param("CLOUD_VERSION") String cloudVersion);
+ CloudSite findByClliAndCloudVersion(String clli,String cloudVersion);
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ModelRecipeRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ModelRecipeRepository.java
index 6ad1c64196..c54331b43d 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ModelRecipeRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ModelRecipeRepository.java
@@ -28,6 +28,6 @@ import org.springframework.data.rest.core.annotation.RepositoryRestResource;
public interface ModelRecipeRepository extends JpaRepository<ModelRecipe, Integer> {
- public ModelRecipe findByModelIdAndAction(String modelId, String action);
+ ModelRecipe findByModelIdAndAction(String modelId, String action);
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ModelRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ModelRepository.java
index 4ace731817..e6e2904d43 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ModelRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ModelRepository.java
@@ -28,6 +28,6 @@ import org.springframework.data.rest.core.annotation.RepositoryRestResource;
public interface ModelRepository extends JpaRepository<Model, Integer> {
- public Model findByModelVersionIdAndModelType(String modelVersionid, String modelType);
+ Model findByModelVersionIdAndModelType(String modelVersionid, String modelType);
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkRecipeRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkRecipeRepository.java
index 3fb7d7aa19..10290b5877 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkRecipeRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkRecipeRepository.java
@@ -26,5 +26,5 @@ import org.springframework.data.rest.core.annotation.RepositoryRestResource;
@RepositoryRestResource(collectionResourceRel = "networkRecipe", path = "networkRecipe")
public interface NetworkRecipeRepository extends JpaRepository<NetworkRecipe, String> {
- NetworkRecipe findByModelNameAndAction(String modelName, String action);
+ NetworkRecipe findFirstByModelNameAndAction(String modelName, String action);
} \ No newline at end of file
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkResourceRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkResourceRepository.java
index 842c888091..94c57945d1 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkResourceRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NetworkResourceRepository.java
@@ -21,8 +21,6 @@
package org.onap.so.db.catalog.data.repository;
import org.onap.so.db.catalog.beans.NetworkResource;
-import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
-import org.onap.so.db.catalog.beans.VnfResource;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
@@ -38,6 +36,6 @@ public interface NetworkResourceRepository extends JpaRepository<NetworkResource
@Query(value = "SELECT * FROM network_resource WHERE MODEL_NAME = ?1 ORDER BY INET_ATON(SUBSTRING_INDEX(CONCAT(MODEL_VERSION,'.0.0.0'),'.',4)) DESC LIMIT 1;", nativeQuery = true)
NetworkResource findFirstByModelNameOrderByModelVersionDesc(String modelName);
- public NetworkResource findResourceByModelUUID(String modelUUID);
+ NetworkResource findResourceByModelUUID(String modelUUID);
NetworkResource findOneByModelName(String modelName);
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NorthBoundRequestRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NorthBoundRequestRepository.java
index b568d6c09b..92a46d51f7 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NorthBoundRequestRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/NorthBoundRequestRepository.java
@@ -22,11 +22,9 @@ package org.onap.so.db.catalog.data.repository;
import org.onap.so.db.catalog.beans.macro.NorthBoundRequest;
import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
@RepositoryRestResource(collectionResourceRel = "northbound_request_ref_lookup", path = "northbound_request_ref_lookup")
public interface NorthBoundRequestRepository extends JpaRepository<NorthBoundRequest, Integer> {
- NorthBoundRequest findOneByActionAndRequestScopeAndIsAlacarte(@Param("ACTION") String action,
- @Param("REQUEST_SCOPE") String requestScope, @Param("IS_ALACARTE") Boolean isALaCarte);
+ NorthBoundRequest findOneByActionAndRequestScopeAndIsAlacarte(String action, String requestScope, Boolean isALaCarte);
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/OrchestrationFlowRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/OrchestrationFlowRepository.java
index db9cd745db..12fbc418f7 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/OrchestrationFlowRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/OrchestrationFlowRepository.java
@@ -20,16 +20,15 @@
package org.onap.so.db.catalog.data.repository;
-import java.util.List;
-
import org.onap.so.db.catalog.beans.macro.OrchestrationFlow;
import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
+import java.util.List;
+
@RepositoryRestResource(collectionResourceRel = "orchestrationFlow", path = "orchestrationFlow")
public interface OrchestrationFlowRepository extends JpaRepository<OrchestrationFlow, Integer> {
- List<OrchestrationFlow> findByAction(@Param("COMPOSITE_ACTION") String action);
+ List<OrchestrationFlow> findByAction(String action);
- OrchestrationFlow findOneByAction(@Param("COMPOSITE_ACTION") String action);
+ OrchestrationFlow findOneByAction(String action);
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/OrchestrationStatusStateTransitionDirectiveRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/OrchestrationStatusStateTransitionDirectiveRepository.java
index ab728f46bf..e88480a022 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/OrchestrationStatusStateTransitionDirectiveRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/OrchestrationStatusStateTransitionDirectiveRepository.java
@@ -25,10 +25,9 @@ import org.onap.so.db.catalog.beans.OrchestrationStatus;
import org.onap.so.db.catalog.beans.OrchestrationStatusStateTransitionDirective;
import org.onap.so.db.catalog.beans.ResourceType;
import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
@RepositoryRestResource(collectionResourceRel = "orchestrationStatusStateTransitionDirective", path = "orchestrationStatusStateTransitionDirective")
public interface OrchestrationStatusStateTransitionDirectiveRepository extends JpaRepository<OrchestrationStatusStateTransitionDirective, String> {
- OrchestrationStatusStateTransitionDirective findOneByResourceTypeAndOrchestrationStatusAndTargetAction(@Param("resourceType") ResourceType resourceType, @Param("orchestrationStatus") OrchestrationStatus orchestrationStatus, @Param("targetAction") OrchestrationAction targetAction);
+ OrchestrationStatusStateTransitionDirective findOneByResourceTypeAndOrchestrationStatusAndTargetAction(ResourceType resourceType, OrchestrationStatus orchestrationStatus, OrchestrationAction targetAction);
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/RainyDayHandlerStatusRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/RainyDayHandlerStatusRepository.java
index 283c9623c8..5039384845 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/RainyDayHandlerStatusRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/RainyDayHandlerStatusRepository.java
@@ -22,13 +22,10 @@ package org.onap.so.db.catalog.data.repository;
import org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus;
import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
@RepositoryRestResource(collectionResourceRel = "rainy_day_handler_macro", path = "rainy_day_handler_macro")
public interface RainyDayHandlerStatusRepository extends JpaRepository<RainyDayHandlerStatus, Integer> {
RainyDayHandlerStatus findOneByFlowNameAndServiceTypeAndVnfTypeAndErrorCodeAndWorkStep(
- @Param("FLOW_NAME") String flowName, @Param("SERVICE_TYPE") String serviceType,
- @Param("VNF_TYPE") String vnfType, @Param("ERROR_CODE") String errorCode,
- @Param("WORK_STEP") String workStep);
+ String flowName, String serviceType, String vnfType, String errorCode, String workStep);
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRecipeRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRecipeRepository.java
index cd46846d78..40ab1704fd 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRecipeRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRecipeRepository.java
@@ -22,14 +22,13 @@ package org.onap.so.db.catalog.data.repository;
import org.onap.so.db.catalog.beans.ServiceRecipe;
import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
@RepositoryRestResource(collectionResourceRel = "serviceRecipe", path = "serviceRecipe")
public interface ServiceRecipeRepository extends JpaRepository<ServiceRecipe, Long> {
- public ServiceRecipe findByActionAndServiceModelUUID(String action, String serviceModelUUID);
+ ServiceRecipe findByActionAndServiceModelUUID(String action, String serviceModelUUID);
- public ServiceRecipe findByAction(String action);
+ ServiceRecipe findByAction(String action);
- public ServiceRecipe findFirstByServiceModelUUIDAndAction(@Param("SERVICE_MODEL_UUID") String serviceModelUUID, @Param("ACTION") String action);
+ ServiceRecipe findFirstByServiceModelUUIDAndAction(String serviceModelUUID, String action);
} \ No newline at end of file
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRepository.java
index 25b1757185..6d432c443c 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRepository.java
@@ -20,15 +20,14 @@
package org.onap.so.db.catalog.data.repository;
-import java.util.List;
-
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.data.projections.InlineService;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
-import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
+import java.util.List;
+
@RepositoryRestResource(collectionResourceRel = "service", path = "service", excerptProjection = InlineService.class)
public interface ServiceRepository extends JpaRepository<Service, String> {
List<Service> findByModelName(String modelName);
@@ -41,7 +40,7 @@ public interface ServiceRepository extends JpaRepository<Service, String> {
* @return
*/
@Query(value = "SELECT * FROM service WHERE MODEL_NAME = ?1 ORDER BY INET_ATON(SUBSTRING_INDEX(CONCAT(MODEL_VERSION,'.0.0.0'),'.',4)) DESC LIMIT 1;", nativeQuery = true)
- Service findFirstByModelNameOrderByModelVersionDesc(@Param("MODEL_NAME") String modelName);
+ Service findFirstByModelNameOrderByModelVersionDesc(String modelName);
/**
* This method will not work for versions greater than 255, as it is utilizing an ip address function to do the sorting
@@ -73,8 +72,7 @@ public interface ServiceRepository extends JpaRepository<Service, String> {
@Query(value = "SELECT * FROM service WHERE MODEL_UUID = ?1 ORDER BY INET_ATON(SUBSTRING_INDEX(CONCAT(MODEL_VERSION,'.0.0.0'),'.',4)) DESC LIMIT 1;", nativeQuery = true)
Service findOneByModelUUIDOrderByModelVersionDesc(String modelUUID);
- Service findByModelVersionAndModelInvariantUUID(@Param("MODEL_VERSION") String modelVersion,
- @Param("MODEL_INVARIANT_UUID") String modelInvariantUUID);
+ Service findFirstByModelVersionAndModelInvariantUUID(String modelVersion, String modelInvariantUUID);
/**
* This method will not work for versions greater than 255, as it is utilizing an ip address function to do the sorting
@@ -90,9 +88,9 @@ public interface ServiceRepository extends JpaRepository<Service, String> {
/**
* This method will not work for versions greater than 255, as it is utilizing an ip address function to do the sorting
- * @param modelInvariantId
+ * @param modelInvariantUUID
* @return
*/
@Query(value = "SELECT * FROM service WHERE MODEL_INVARIANT_UUID = ?1 ORDER BY INET_ATON(SUBSTRING_INDEX(CONCAT(MODEL_VERSION,'.0.0.0'),'.',4)) DESC;", nativeQuery = true)
- List<Service> findByModelInvariantUUIDOrderByModelVersionDesc(String modelInvariantId);
+ List<Service> findByModelInvariantUUIDOrderByModelVersionDesc(String modelInvariantUUID);
} \ No newline at end of file
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VFModuleRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VFModuleRepository.java
index 6b403b312e..cd985dba9f 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VFModuleRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VFModuleRepository.java
@@ -20,25 +20,24 @@
package org.onap.so.db.catalog.data.repository;
-import java.util.List;
-
import org.onap.so.db.catalog.beans.VfModule;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
-import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
+import java.util.List;
+
@RepositoryRestResource(collectionResourceRel = "vfModule", path = "vfModule")
public interface VFModuleRepository extends JpaRepository<VfModule, String> {
VfModule findByModelUUID(String modelUUID);
- VfModule findByModelInvariantUUIDAndModelVersion(String modelInvariantUUID, String modelVersion);
+ VfModule findFirstVfModuleByModelInvariantUUIDAndModelVersion(String modelInvariantUUID, String modelVersion);
VfModule findByModelName(String modelName);
/**
* This method will not work for versions greater than 255, as it is utilizing an ip address function to do the sorting
- * @param modelInvariantUUID
+ * @param modelName
* @return
*/
@Query(value = "SELECT * FROM vf_module WHERE MODEL_NAME = ?1 ORDER BY INET_ATON(SUBSTRING_INDEX(CONCAT(MODEL_VERSION,'.0.0.0'),'.',4)) DESC LIMIT 1;", nativeQuery = true)
@@ -46,7 +45,7 @@ public interface VFModuleRepository extends JpaRepository<VfModule, String> {
VfModule findByModelInvariantUUIDAndModelUUID(String modelCustomizationUUID, String modelUUID);
- VfModule findByModelInvariantUUID(@Param("ACTION") String modelCustomizationUUID);
+ VfModule findByModelInvariantUUID(String modelCustomizationUUID);
/**
* This method will not work for versions greater than 255, as it is utilizing an ip address function to do the sorting
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfComponentRecipeRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfComponentRecipeRepository.java
index 822ac44be2..440a675c97 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfComponentRecipeRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfComponentRecipeRepository.java
@@ -27,13 +27,13 @@ import org.springframework.data.rest.core.annotation.RepositoryRestResource;
@RepositoryRestResource(collectionResourceRel = "vnfComponentsRecipe", path = "vnfComponentsRecipe")
public interface VnfComponentRecipeRepository extends JpaRepository<VnfComponentsRecipe, String> {
- VnfComponentsRecipe findVnfComponentsRecipeByVfModuleModelUUIDAndVnfTypeAndAction(String vfModuleModelUUID,
+ VnfComponentsRecipe findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfTypeAndAction(String vfModuleModelUUID,
String vnfType, String action);
- VnfComponentsRecipe findVnfComponentsRecipeByVnfTypeAndAction(String vnfType, String action);
+ VnfComponentsRecipe findFirstVnfComponentsRecipeByVnfTypeAndAction(String vnfType, String action);
- VnfComponentsRecipe findVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(String modelUUID,
+ VnfComponentsRecipe findFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(String vfModuleModelUUID,
String vnfComponentType, String action);
- VnfComponentsRecipe findVnfComponentsRecipeByVnfComponentTypeAndAction(String vnfComponentType, String action);
+ VnfComponentsRecipe findFirstVnfComponentsRecipeByVnfComponentTypeAndAction(String vnfComponentType, String action);
} \ No newline at end of file
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfCustomizationRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfCustomizationRepository.java
index 0d9ac2b33d..46a4cfba11 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfCustomizationRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfCustomizationRepository.java
@@ -20,20 +20,21 @@
package org.onap.so.db.catalog.data.repository;
-import java.util.List;
-
-import org.onap.so.db.catalog.beans.VnfResource;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
import org.onap.so.db.catalog.data.projections.InlineVnf;
import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
+import java.util.List;
+
@RepositoryRestResource(collectionResourceRel = "vnfResourceCustomization", path = "vnfResourceCustomization", excerptProjection = InlineVnf.class)
public interface VnfCustomizationRepository extends JpaRepository<VnfResourceCustomization, String> {
List<VnfResourceCustomization> findByModelCustomizationUUID(String modelCustomizationUUID);
VnfResourceCustomization findOneByModelCustomizationUUID(String modelCustomizationUuid);
- VnfResourceCustomization findByModelInstanceNameAndVnfResources(String modelInstanceName, VnfResource vnfResource);
+ @Query(value = "SELECT * FROM vnf_resource_customization WHERE MODEL_INSTANCE_NAME = ?1 AND VNF_RESOURCE_MODEL_UUID = ?2 LIMIT 1;", nativeQuery = true)
+ VnfResourceCustomization findByModelInstanceNameAndVnfResources(String modelInstanceName, String vnfResourceModelUUID);
} \ No newline at end of file
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfRecipeRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfRecipeRepository.java
index 97d6669c58..dbc86cbb8f 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfRecipeRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfRecipeRepository.java
@@ -28,5 +28,5 @@ import org.springframework.data.rest.core.annotation.RepositoryRestResource;
public interface VnfRecipeRepository extends JpaRepository<VnfRecipe, String> {
VnfRecipe findVnfRecipeByServiceTypeAndAction(String serviceType, String action);
- VnfRecipe findVnfRecipeByNfRoleAndAction(String nfRole, String action);
+ VnfRecipe findFirstVnfRecipeByNfRoleAndAction(String nfRole, String action);
} \ No newline at end of file
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfResourceRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfResourceRepository.java
index 5b0258238e..e48f8bb653 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfResourceRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfResourceRepository.java
@@ -35,7 +35,7 @@ public interface VnfResourceRepository extends JpaRepository<VnfResource, String
VnfResource findResourceByModelUUID(String modelUUID);
- VnfResource findResourceByModelInvariantUUID(String modelInvariantId);
+ VnfResource findResourceByModelInvariantUUID(String modelInvariantUUID);
- VnfResource findResourceByModelInvariantUUIDAndModelVersion(String relatedInstanceModelInvariantId, String relatedInstanceVersion);
+ VnfResource findFirstResourceByModelInvariantUUIDAndModelVersion(String modelInvariantUUID, String modelVersion);
} \ No newline at end of file
diff --git a/pom.xml b/pom.xml
index beb42242b0..073c9c165f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -249,6 +249,9 @@
<showWarnings>true</showWarnings>
<source>1.8</source>
<target>1.8</target>
+ <compilerArgs>
+ <arg>-parameters</arg>
+ </compilerArgs>
</configuration>
</plugin>
<plugin>