summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-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
-rw-r--r--src/main/resources/jolt/getServiceInventory.json1
4 files changed, 20 insertions, 22 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");
diff --git a/src/main/resources/jolt/getServiceInventory.json b/src/main/resources/jolt/getServiceInventory.json
index cb75530..b3751b1 100644
--- a/src/main/resources/jolt/getServiceInventory.json
+++ b/src/main/resources/jolt/getServiceInventory.json
@@ -25,7 +25,6 @@
"operation": "default",
"spec": {
"type": "service-instance",
- "hasStarted": "yes",
"@type": "serviceONAP",
"serviceSpecification" : {
"@type" :"ONAPservice"