summaryrefslogtreecommitdiffstats
path: root/mso-catalog-db
diff options
context:
space:
mode:
authorRob Daugherty <rd472p@att.com>2018-10-12 15:11:07 +0000
committerGerrit Code Review <gerrit@onap.org>2018-10-12 15:11:07 +0000
commitd6c21ac6f38474841d3b9ced0524fe7671ae8682 (patch)
treeac5a12fd0acdc5e0f07fe5089637b7da279e37bc /mso-catalog-db
parentea7f1ce7584deb1e4896ffcddb8c45e64422a9d0 (diff)
parent6ba0a22bc952232d14d2d24c5f73a42aae2791a9 (diff)
Merge "Dynamic Cloud Owner Support"
Diffstat (limited to 'mso-catalog-db')
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java56
1 files changed, 49 insertions, 7 deletions
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<ServiceRecipe> serviceRecipeClient;
+ private final Client<ExternalServiceToInternalService> externalServiceToInternalServiceClient;
+
private final Client<CloudSite> cloudSiteClient;
private final Client<CloudifyManager> 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