aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/org
diff options
context:
space:
mode:
authoraosull01 <adrian.osullivan@huawei.com>2019-02-01 17:33:45 +0000
committeraosull01 <adrian.osullivan@huawei.com>2019-02-06 14:52:41 +0000
commit8661255afca19d7ef0750288c1a905e0bf89599a (patch)
treef62ab14d999d7dba6aea9a7c89650c17aac0a15c /src/main/java/org
parent2afa1a1b9b020c0ada15581658268e98b7219a64 (diff)
node query for service instance query
Change-Id: I7147f76b65a02e61f804ff5fd1304e47a983e092 Issue-ID: EXTAPI-194 Signed-off-by: aosull01 <adrian.osullivan@huawei.com>
Diffstat (limited to 'src/main/java/org')
-rw-r--r--src/main/java/org/onap/nbi/OnapComponentsUrlPaths.java14
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceinventory/AaiClient.java12
-rw-r--r--src/main/java/org/onap/nbi/apis/serviceinventory/ServiceInventoryService.java15
3 files changed, 20 insertions, 21 deletions
diff --git a/src/main/java/org/onap/nbi/OnapComponentsUrlPaths.java b/src/main/java/org/onap/nbi/OnapComponentsUrlPaths.java
index 2414c68..212242b 100644
--- a/src/main/java/org/onap/nbi/OnapComponentsUrlPaths.java
+++ b/src/main/java/org/onap/nbi/OnapComponentsUrlPaths.java
@@ -30,16 +30,16 @@ public final class OnapComponentsUrlPaths {
// AAI
public static final String AAI_GET_TENANTS_PATH =
- "/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/$onap.cloudOwner/$onap.lcpCloudRegionId/tenants";
- public static final String AAI_GET_CUSTOMER_PATH = "/aai/v11/business/customers/customer/";
+ "/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/$onap.cloudOwner/$onap.lcpCloudRegionId/tenants";
+ public static final String AAI_GET_CUSTOMER_PATH = "/aai/v14/business/customers/customer/";
public static final String AAI_GET_SERVICES_FOR_CUSTOMER_PATH =
- "/aai/v11/business/customers/customer/$customerId/service-subscriptions";
+ "/aai/v14/business/customers/customer/$customerId/service-subscriptions";
public static final String AAI_PUT_SERVICE_FOR_CUSTOMER_PATH =
- "/aai/v11/business/customers/customer/$customerId/service-subscriptions/service-subscription/";
- public static final String AAI_GET_SERVICE_FOR_CUSTOMER_PATH =
- "/aai/v11/business/customers/customer/$customerId/service-subscriptions/service-subscription/$serviceSpecName/service-instances/service-instance/$serviceId";
+ "/aai/v14/business/customers/customer/$customerId/service-subscriptions/service-subscription/";
+ public static final String AAI_GET_SERVICE =
+ "/aai/v14/nodes/service-instances/service-instance/$serviceId";
public static final String AAI_GET_SERVICE_INSTANCES_PATH =
- "/aai/v11/business/customers/customer/$customerId/service-subscriptions/service-subscription/$serviceSpecName/service-instances/";
+ "/aai/v14/business/customers/customer/$customerId/service-subscriptions/service-subscription/$serviceSpecName/service-instances/";
// MSO
public static final String MSO_CREATE_SERVICE_INSTANCE_PATH = "/onap/so/infra/serviceInstantiation/v7/serviceInstances/";
diff --git a/src/main/java/org/onap/nbi/apis/serviceinventory/AaiClient.java b/src/main/java/org/onap/nbi/apis/serviceinventory/AaiClient.java
index 391cf41..ebb5144 100644
--- a/src/main/java/org/onap/nbi/apis/serviceinventory/AaiClient.java
+++ b/src/main/java/org/onap/nbi/apis/serviceinventory/AaiClient.java
@@ -57,7 +57,7 @@ public class AaiClient extends BaseClient {
@PostConstruct
private void setUpAndlogAAIUrl() {
- aaiServiceUrl= new StringBuilder().append(aaiHost).append(OnapComponentsUrlPaths.AAI_GET_SERVICE_FOR_CUSTOMER_PATH).toString();
+ aaiServiceUrl= new StringBuilder().append(aaiHost).append(OnapComponentsUrlPaths.AAI_GET_SERVICE).toString();
aaiServicesUrl= new StringBuilder().append(aaiHost).append(OnapComponentsUrlPaths.AAI_GET_SERVICES_FOR_CUSTOMER_PATH).toString();
aaiServicesInstancesUrl= new StringBuilder().append(aaiHost).append(OnapComponentsUrlPaths.AAI_GET_SERVICE_INSTANCES_PATH).toString();
@@ -94,7 +94,17 @@ public class AaiClient extends BaseClient {
}
return null;
}
+
+ public Map getService(String serviceId) {
+ String callUrlFormated = aaiServiceUrl.replace("$serviceId", serviceId);
+
+ ResponseEntity<Object> response = callApiGet(callUrlFormated, buildRequestHeaderForAAI());
+ if (response != null && response.getStatusCode().equals(HttpStatus.OK)) {
+ return (LinkedHashMap) response.getBody();
+ }
+ return null;
+ }
public Map getVNF(String relatedLink) {
diff --git a/src/main/java/org/onap/nbi/apis/serviceinventory/ServiceInventoryService.java b/src/main/java/org/onap/nbi/apis/serviceinventory/ServiceInventoryService.java
index 1564e9c..57bb0f9 100644
--- a/src/main/java/org/onap/nbi/apis/serviceinventory/ServiceInventoryService.java
+++ b/src/main/java/org/onap/nbi/apis/serviceinventory/ServiceInventoryService.java
@@ -48,24 +48,13 @@ public class ServiceInventoryService {
public Map get(String serviceId, MultiValueMap<String, String> params) {
- String clientId = params.getFirst("relatedParty.id");
- String serviceSpecId = params.getFirst("serviceSpecification.id");
- String serviceSpecName = params.getFirst("serviceSpecification.name");
-
- if (StringUtils.isEmpty(serviceSpecId) && StringUtils.isEmpty(serviceSpecName)) {
- throw new BackendFunctionalException(HttpStatus.NOT_FOUND,
- "serviceSpecName or serviceSpecId must be provided","serviceSpecName or serviceSpecId must be provided");
- }
-
- String customerId = getCustomerId(clientId);
- String serviceName = getServiceName(serviceSpecName, serviceSpecId);
- Map serviceResponse = aaiClient.getCatalogService(customerId, serviceName, serviceId);
+
+ Map serviceResponse = aaiClient.getService(serviceId);
if (serviceResponse != null) {
addVnfsToResponse(serviceResponse);
LinkedHashMap serviceInventoryResponse =
(LinkedHashMap) getServiceInventoryJsonTransformer.transform(serviceResponse);
- addRelatedPartyId(customerId, serviceInventoryResponse);
return serviceInventoryResponse;
} else {
throw new BackendFunctionalException(HttpStatus.NOT_FOUND, "no catalog service found","no catalog service found");