From 6ba0a22bc952232d14d2d24c5f73a42aae2791a9 Mon Sep 17 00:00:00 2001 From: "Benjamin, Max (mb388a)" Date: Thu, 11 Oct 2018 13:55:37 -0400 Subject: Dynamic Cloud Owner Support added in cloud configuration object to request params Fix Bean scanning so it picks up the resttemplate removed unnecessary RestTemplate Bean configurations corrected typo in CloudConfiguration class updated gr api test cases with dynamic cloud owner updated groovy files to allow for dynamic cloud owner values updated GR API layer to include cloud owner added enum for default cloud owner add cloud owner variable to camunda in mapping removed references to att-aic from BBInputSetup updated aai schema dependency to 1.3.1 from 1.3.0 Fixed incorrect type AAIUri and updated logging in the method. use existing service instance id instead of generating Pass cloudOwner to process to propagate to subprocesses. NOTE: our aai-schema dependency is 1.3.1-SNAPSHOT to be compatible with the cloud owner changes here. The releaesed 1.3.0 version is NOT compatible. Change-Id: I43b46774b77981d1c8bfe7c7a79b9434889e62ae Issue-ID: SO-1128 Signed-off-by: Benjamin, Max (mb388a) Signed-off-by: Rob Daugherty --- .../onap/so/db/catalog/client/CatalogDbClient.java | 56 +++++++++++++++++++--- 1 file changed, 49 insertions(+), 7 deletions(-) (limited to 'mso-catalog-db/src') 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 9742a0c85b..4f070e71c9 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 @@ -20,6 +20,14 @@ package org.onap.so.db.catalog.client; +import java.net.URI; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import javax.annotation.PostConstruct; +import javax.ws.rs.core.UriBuilder; + import org.onap.so.db.catalog.beans.BuildingBlockDetail; import org.onap.so.db.catalog.beans.CloudSite; import org.onap.so.db.catalog.beans.CloudifyManager; @@ -27,6 +35,7 @@ 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.CvnfcCustomization; +import org.onap.so.db.catalog.beans.ExternalServiceToInternalService; import org.onap.so.db.catalog.beans.InstanceGroup; import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization; import org.onap.so.db.catalog.beans.NetworkRecipe; @@ -55,17 +64,11 @@ import org.springframework.http.client.BufferingClientHttpRequestFactory; import org.springframework.http.client.ClientHttpRequestFactory; import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.stereotype.Component; + import uk.co.blackpepper.bowman.Client; import uk.co.blackpepper.bowman.ClientFactory; import uk.co.blackpepper.bowman.Configuration; -import javax.annotation.PostConstruct; -import javax.ws.rs.core.UriBuilder; -import java.net.URI; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - @Component("CatalogDbClient") public class CatalogDbClient { @@ -84,6 +87,7 @@ public class CatalogDbClient { 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 EXTERNAL_SERVICE_TO_INTERNAL_MODEL_MAPPING = "/externalServiceToInternalService"; private static final String VNF_RESOURCE = "/vnfResource"; private static final String VNF_RECIPE = "/vnfRecipe"; private static final String VFMODULE = "/vfModule"; @@ -96,6 +100,8 @@ public class CatalogDbClient { private static final String URI_SEPARATOR = "/"; private static final String SERVICE_MODEL_UUID = "serviceModelUUID"; + private static final String SERVICE_NAME = "serviceName"; + private static final String MODEL_UUID = "modelUUID"; private static final String MODEL_CUSTOMIZATION_UUID = "modelCustomizationUUID"; private static final String ACTION = "action"; private static final String MODEL_NAME = "modelName"; @@ -122,6 +128,10 @@ public class CatalogDbClient { private static final String TARGET_ENTITY = "SO:CatalogDB"; + private String findExternalToInternalServiceByServiceName = "/findByServiceName"; + private String findServiceByModelName = "/findOneByModelName"; + private String findServiceRecipeByActionAndServiceModelUUID = "/findByActionAndServiceModelUUID"; + private String findServiceByModelUUID = "/findOneByModelUUID"; private String findFirstByModelNameURI = "/findFirstByModelNameOrderByModelVersionDesc"; private String findFirstByServiceModelUUIDAndActionURI = "/findFirstByServiceModelUUIDAndAction"; private String findFirstByModelVersionAndModelInvariantUUIDURI = "/findFirstByModelVersionAndModelInvariantUUID"; @@ -196,6 +206,8 @@ public class CatalogDbClient { private final Client serviceRecipeClient; + private final Client externalServiceToInternalServiceClient; + private final Client cloudSiteClient; private final Client cloudifyManagerClient; @@ -213,6 +225,10 @@ public class CatalogDbClient { @PostConstruct public void init(){ + findExternalToInternalServiceByServiceName = endpoint + EXTERNAL_SERVICE_TO_INTERNAL_MODEL_MAPPING + SEARCH + findExternalToInternalServiceByServiceName; + findServiceByModelName = endpoint + SERVICE + SEARCH + findServiceByModelName; + findServiceRecipeByActionAndServiceModelUUID = endpoint + SERVICE_RECIPE + SEARCH + findServiceRecipeByActionAndServiceModelUUID; + findServiceByModelUUID = endpoint + SERVICE + SEARCH + findServiceByModelUUID; findFirstByModelNameURI = endpoint + SERVICE + SEARCH + findFirstByModelNameURI; findFirstByModelVersionAndModelInvariantUUIDURI = endpoint + SERVICE + SEARCH + findFirstByModelVersionAndModelInvariantUUIDURI; findByModelInvariantUUIDURI = endpoint + SERVICE + SEARCH + findByModelInvariantUUIDURI; @@ -288,6 +304,7 @@ public class CatalogDbClient { serviceRecipeClient = clientFactory.create(ServiceRecipe.class); cvnfcCustomizationClient = clientFactory.create(CvnfcCustomization.class); controllerSelectionReferenceClient = clientFactory.create(ControllerSelectionReference.class); + externalServiceToInternalServiceClient = clientFactory.create(ExternalServiceToInternalService.class); } public CatalogDbClient(String baseUri, String auth) { @@ -329,6 +346,7 @@ public class CatalogDbClient { serviceRecipeClient = clientFactory.create(ServiceRecipe.class); cvnfcCustomizationClient = clientFactory.create(CvnfcCustomization.class); controllerSelectionReferenceClient = clientFactory.create(ControllerSelectionReference.class); + externalServiceToInternalServiceClient = clientFactory.create(ExternalServiceToInternalService.class); } public NetworkCollectionResourceCustomization getNetworkCollectionResourceCustomizationByID(String modelCustomizationUUID) { @@ -495,6 +513,30 @@ public class CatalogDbClient { .queryParam(MODEL_NAME,modelName).build()); } + public ExternalServiceToInternalService findExternalToInternalServiceByServiceName(String serviceName){ + return this.getSingleResource(externalServiceToInternalServiceClient, getUri(UriBuilder + .fromUri(findExternalToInternalServiceByServiceName) + .queryParam(SERVICE_NAME,serviceName).build().toString())); + } + + public ServiceRecipe findServiceRecipeByActionAndServiceModelUUID(String action,String modelUUID){ + return this.getSingleResource(serviceRecipeClient, getUri(UriBuilder + .fromUri(findServiceRecipeByActionAndServiceModelUUID) + .queryParam(ACTION,action) + .queryParam(SERVICE_MODEL_UUID,modelUUID).build().toString())); + } + + public Service getServiceByModelName(String modelName){ + return this.getSingleResource(serviceClient,getUri(UriBuilder + .fromUri(findServiceByModelName) + .queryParam(MODEL_NAME,modelName).build().toString())); + } + + public Service getServiceByModelUUID(String modelModelUUID){ + return this.getSingleResource(serviceClient,getUri(UriBuilder + .fromUri(findServiceByModelUUID) + .queryParam(MODEL_UUID,modelModelUUID).build().toString())); + } public VnfResource getFirstVnfResourceByModelInvariantUUIDAndModelVersion(String modelInvariantUUID, String modelVersion){ return this.getSingleResource(vnfResourceClient, getUri(UriBuilder -- cgit 1.2.3-korg