From 799dafa576935e93c262a20f2b055a94dd637ddd Mon Sep 17 00:00:00 2001 From: RehanRaza Date: Thu, 17 Oct 2019 08:18:56 +0200 Subject: [PATCH] Fix issues, clean-up A1 controller northbound Change-Id: Icdf2f27aefc2f6128c690c1851f6a72c002ab706 Issue-ID: NONRTRIC-35 Signed-off-by: RehanRaza --- .../northbound/nonrt-ric-api/a1-client/.gitignore | 23 -- .../northbound/nonrt-ric-api/a1-client/README.md | 29 -- .../northbound/nonrt-ric-api/a1-client/pom.xml | 195 ----------- .../src/main/resources/a1_mediator_0.11.0.yaml | 388 --------------------- .../features/sdnc-nonrt-ric-api/pom.xml | 5 - .../northbound/nonrt-ric-api/pom.xml | 1 - .../northbound/nonrt-ric-api/provider/pom.xml | 15 +- .../northbound/provider/NonrtRicApiProvider.java | 144 ++++---- .../northbound/restadpter/NearRicUrlProvider.java | 46 +-- .../sdnc/northbound/restadpter/RestAdapter.java | 12 +- .../northbound/restadpter/RestAdapterImpl.java | 18 +- 11 files changed, 132 insertions(+), 744 deletions(-) delete mode 100644 sdnc-a1-controller/northbound/nonrt-ric-api/a1-client/.gitignore delete mode 100644 sdnc-a1-controller/northbound/nonrt-ric-api/a1-client/README.md delete mode 100644 sdnc-a1-controller/northbound/nonrt-ric-api/a1-client/pom.xml delete mode 100644 sdnc-a1-controller/northbound/nonrt-ric-api/a1-client/src/main/resources/a1_mediator_0.11.0.yaml diff --git a/sdnc-a1-controller/northbound/nonrt-ric-api/a1-client/.gitignore b/sdnc-a1-controller/northbound/nonrt-ric-api/a1-client/.gitignore deleted file mode 100644 index 27fd4617..00000000 --- a/sdnc-a1-controller/northbound/nonrt-ric-api/a1-client/.gitignore +++ /dev/null @@ -1,23 +0,0 @@ -*.class - -# Mobile Tools for Java (J2ME) -.mtj.tmp/ - -# Package Files # -*.jar -*.war -*.ear - -# exclude jar for gradle wrapper -!gradle/wrapper/*.jar - -# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml -hs_err_pid* - -# build files -**/target -target -.gradle -build - -logs/ diff --git a/sdnc-a1-controller/northbound/nonrt-ric-api/a1-client/README.md b/sdnc-a1-controller/northbound/nonrt-ric-api/a1-client/README.md deleted file mode 100644 index d5780ffb..00000000 --- a/sdnc-a1-controller/northbound/nonrt-ric-api/a1-client/README.md +++ /dev/null @@ -1,29 +0,0 @@ -# A1 Mediator Client Generator - -This projects generates a REST client library from the OpenAPI specification -file stored here and packages it in a jar. - -## Eclipse and STS Users - -The Swagger Codegen maven plugin is not supported in Eclipse/STS. You can -limp along by taking these steps: - -1. Generate the code using maven: - mvn install -2. Add this folder to the project build path: - target/generated-sources/swagger/src/main/java - -## License - -Copyright (C) 2019 AT&T Intellectual Property & Nokia. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. diff --git a/sdnc-a1-controller/northbound/nonrt-ric-api/a1-client/pom.xml b/sdnc-a1-controller/northbound/nonrt-ric-api/a1-client/pom.xml deleted file mode 100644 index f0718bfd..00000000 --- a/sdnc-a1-controller/northbound/nonrt-ric-api/a1-client/pom.xml +++ /dev/null @@ -1,195 +0,0 @@ - - - - - 4.0.0 - - - org.onap.ccsdk.parent - binding-parent - 1.4.3 - - - - org.onap.sdnc.northbound - nonrt-ric-api-a1-client - 1.7.3-SNAPSHOT - bundle - - sdnc-northbound :: nonrt-ric-api :: ${project.artifactId} - - - UTF-8 - UTF-8 - org.oransc.ric.a1med.client - - - - - io.swagger.core.v3 - swagger-annotations - 2.0.8 - provided - - - org.springframework - spring-context - provided - - - org.springframework - spring-web - provided - - - com.fasterxml.jackson.core - jackson-core - 2.9.0 - provided - - - com.fasterxml.jackson.core - jackson-annotations - 2.9.0 - provided - - - com.fasterxml.jackson.core - jackson-databind - 2.9.0 - provided - - - com.fasterxml.jackson.jaxrs - jackson-jaxrs-json-provider - 2.9.0 - provided - - - com.fasterxml.jackson.datatype - jackson-datatype-jsr310 - 2.9.0 - provided - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - - org.apache.maven.plugins - maven-dependency-plugin - - org.onap.sdnc.northbound - - - - org.apache.felix - maven-bundle-plugin - 3.0.1 - true - - - ${project.groupId}.${project.artifactId} - ${project.version} - * - *;scope=compile|runtime - true - target/dependency - *;resolution:=optional - * - - - - - io.swagger.codegen.v3 - swagger-codegen-maven-plugin - 3.0.8 - - - - generate - - - ${project.basedir}/src/main/resources/a1_mediator_0.11.0.yaml - java - - ${client.base.package.name} - ${client.base.package.name}.model - ${client.base.package.name}.api - ${client.base.package.name}.invoker - ${project.groupId} - ${project.artifactId} - ${project.version} - resttemplate - true - ${project.build.directory}/generated-sources/swagger - false - false - true - false - true - src/main/java - java8 - Apache 2.0 - https://www.apache.org/licenses/LICENSE-2.0 - - - - - - - - - - - org.eclipse.m2e - lifecycle-mapping - 1.0.0 - - - - - - io.swagger.codegen.v3 - swagger-codegen-maven-plugin - [1.0,) - - generate - - - - - - - - - - - - - - diff --git a/sdnc-a1-controller/northbound/nonrt-ric-api/a1-client/src/main/resources/a1_mediator_0.11.0.yaml b/sdnc-a1-controller/northbound/nonrt-ric-api/a1-client/src/main/resources/a1_mediator_0.11.0.yaml deleted file mode 100644 index b8b8f91c..00000000 --- a/sdnc-a1-controller/northbound/nonrt-ric-api/a1-client/src/main/resources/a1_mediator_0.11.0.yaml +++ /dev/null @@ -1,388 +0,0 @@ -# ================================================================================== -# Copyright (c) 2019 Nokia -# Copyright (c) 2018-2019 AT&T Intellectual Property. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# ================================================================================== -openapi: 3.0.0 -info: - version: 0.11.0 - title: RIC A1 -paths: - '/a1-p/healthcheck': - get: - description: > - Perform a healthcheck on a1 - tags: - - A1 Mediator - operationId: a1.controller.get_healthcheck - responses: - 200: - description: > - A1 is healthy. - Anything other than a 200 should be considered a1 as failing - - '/a1-p/policytypes/': - get: - description: "Get a list of all registered policy type ids" - tags: - - A1 Mediator - operationId: a1.controller.get_all_policy_types - responses: - 200: - description: "list of all registered policy type ids" - content: - application/json: - schema: - type: array - items: - "$ref": "#/components/schemas/policy_type_id" - example: [20000, 20020] - - '/a1-p/policytypes/{policy_type_id}': - parameters: - - name: policy_type_id - in: path - required: true - schema: - "$ref": "#/components/schemas/policy_type_id" - get: - description: > - Get this policy type - tags: - - A1 Mediator - operationId: a1.controller.get_policy_type - responses: - '200': - description: "policy type successfully found" - content: - application/json: - schema: - "$ref": "#/components/schemas/policy_type_schema" - '404': - description: > - policy type not found - delete: - description: > - Delete this policy type. Can only be performed if there are no instances of this type - tags: - - A1 Mediator - operationId: a1.controller.delete_policy_type - responses: - '204': - description: > - policy type successfully deleted - '400': - description: > - Policy type cannot be deleted because there are instances - All instances must be removed before a policy type can be deleted - '404': - description: > - policy type not found - put: - description: > - Create a new policy type . - Replace is not currently allowed; to replace, for now do a DELETE and then a PUT again. - - tags: - - A1 Mediator - operationId: a1.controller.create_policy_type - requestBody: - content: - application/json: - schema: - "$ref": "#/components/schemas/policy_type_schema" - example: - name: admission_control_policy - description: various parameters to control admission of dual connection - policy_type_id: 20000 - create_schema: - $schema: 'http://json-schema.org/draft-07/schema#' - type: object - properties: - enforce: - type: boolean - default: true - window_length: - type: integer - default: 1 - minimum: 1 - maximum: 60 - description: Sliding window length (in minutes) - blocking_rate: - type: number - default: 10 - minimum: 1 - maximum: 100 - description: '% Connections to block' - trigger_threshold: - type: integer - default: 10 - minimum: 1 - description: Minimum number of events in window to trigger blocking - additionalProperties: false - - responses: - '201': - description: "policy type successfully created" - '400': - description: "illegal ID, or object already existed" - - '/a1-p/policytypes/{policy_type_id}/policies': - parameters: - - name: policy_type_id - in: path - required: true - schema: - "$ref": "#/components/schemas/policy_type_id" - get: - description: "get a list of all policy instance ids for this policy type id" - tags: - - A1 Mediator - operationId: a1.controller.get_all_instances_for_type - responses: - 200: - description: "list of all policy instance ids for this policy type id" - content: - application/json: - schema: - type: array - items: - "$ref": "#/components/schemas/policy_instance_id" - example: ["3d2157af-6a8f-4a7c-810f-38c2f824bf12", "06911bfc-c127-444a-8eb1-1bffad27cc3d"] - - - '/a1-p/policytypes/{policy_type_id}/policies/{policy_instance_id}': - parameters: - - name: policy_type_id - in: path - required: true - schema: - "$ref": "#/components/schemas/policy_type_id" - - - name: policy_instance_id - in: path - required: true - schema: - "$ref": "#/components/schemas/policy_instance_id" - - get: - description: > - Retrieve the policy instance - - tags: - - A1 Mediator - operationId: a1.controller.get_policy_instance - responses: - '200': - description: > - The policy instance. - the schema of this object is defined by the create_schema field of the policy type - content: - application/json: - schema: - type: object - '404': - description: > - there is no policy instance with this policy_instance_id or there is no policy type with this policy_type_id - - delete: - description: > - Delete this policy instance - - tags: - - A1 Mediator - operationId: a1.controller.delete_policy_instance - responses: - '204': - description: > - policy instance successfully deleted - '404': - description: > - there is no policy instance with this policy_instance_id - or there is no policy type with this policy_type_id - - put: - description: > - Create or replace a policy instance of type policy_type_id. - The schema of the PUT body is defined by the create_schema field of the policy type. - - tags: - - A1 Mediator - operationId: a1.controller.create_or_replace_policy_instance - requestBody: - content: - application/json: - schema: - type: object - description: > - the schema of this object is defined by the create_schema field of the policy type - example: - enforce: true - window_length: 10 - blocking_rate: 20 - trigger_threshold: 10 - - responses: - '201': - description: > - Policy instance created - '400': - description: > - Bad PUT body for this policy instance - '404': - description: > - There is no policy type with this policy_type_id - - '/a1-p/policytypes/{policy_type_id}/policies/{policy_instance_id}/status': - parameters: - - name: policy_type_id - in: path - required: true - schema: - "$ref": "#/components/schemas/policy_type_id" - - - name: policy_instance_id - in: path - required: true - schema: - "$ref": "#/components/schemas/policy_instance_id" - - get: - description: > - Retrieve the policy instance status across all handlers of the policy - - tags: - - A1 Mediator - operationId: a1.controller.get_policy_instance_status - responses: - '200': - description: > - The policy instance status. - Returns a vector of statuses, where each contains a handler_id (opaque id of a RIC component that implements this policy) and the policy status as returned by that handler - content: - application/json: - schema: - type: array - items: - type: object - properties: - handler_id: - type: string - status: - type: string - example: - [{"handler_id": "1234-5678", "status" : "OK"}, {"handler_id": "abc-def", "status" : "NOT IMPLEMENTED"}] - '404': - description: > - there is no policy instance with this policy_instance_id or there is no policy type with this policy_type_id - - -components: - schemas: - policy_type_schema: - type: object - required: - - name - - description - - policy_type_id - - create_schema - additionalProperties: false - properties: - name: - type: string - description: name of the policy type - description: - type: string - description: description of the policy type - policy_type_id: - description: the integer of the policy type - type: integer - create_schema: - type: object - description: > - jsonschema (following http://json-schema.org/draft-07/schema) of the CREATE payload to be sent to handlers of this policy - - policy_type_id: - description: > - represents a policy type identifier. Currently this is restricted to an integer range. - type: integer - minimum: 20000 - maximum: 21024 - - policy_instance_id: - description: > - represents a policy instance identifier. UUIDs are advisable but can be any string - type: string - example: "3d2157af-6a8f-4a7c-810f-38c2f824bf12" - - downstream_message_schema: - type: object - required: - - operation - - policy_type_id - - policy_instance_id - - payload - additionalProperties: false - properties: - operation: - description: the operation being performed - type: string - enum: - - CREATE - - DELETE - - UPDATE - - READ - policy_type_id: - "$ref": "#/components/schemas/policy_type_id" - policy_instance_id: - "$ref": "#/components/schemas/policy_instance_id" - payload: - description: payload for this operation - type: object - example: - operation: CREATE - policy_type_id: 12345678 - policy_instance_id: 3d2157af-6a8f-4a7c-810f-38c2f824bf12 - payload: - enforce: true - window_length: 10 - blocking_rate: 20 - trigger_threshold: 10 - - downstream_notification_schema: - type: object - required: - - policy_type_id - - policy_instance_id - - handler_id - - status - additionalProperties: false - properties: - policy_type_id: - "$ref": "#/components/schemas/policy_type_id" - policy_instance_id: - "$ref": "#/components/schemas/policy_instance_id" - handler_id: - description: > - id of the policy handler - type: string - status: - description: > - the status of this policy instance in this handler - type: string - example: - policy_type_id: 12345678 - policy_instance_id: 3d2157af-6a8f-4a7c-810f-38c2f824bf12 - handler_id: 1234-5678 - status: OK diff --git a/sdnc-a1-controller/northbound/nonrt-ric-api/features/sdnc-nonrt-ric-api/pom.xml b/sdnc-a1-controller/northbound/nonrt-ric-api/features/sdnc-nonrt-ric-api/pom.xml index f6a6748b..d18f0a97 100644 --- a/sdnc-a1-controller/northbound/nonrt-ric-api/features/sdnc-nonrt-ric-api/pom.xml +++ b/sdnc-a1-controller/northbound/nonrt-ric-api/features/sdnc-nonrt-ric-api/pom.xml @@ -54,11 +54,6 @@ nonrt-ric-api-model ${project.version} - - ${project.groupId} - nonrt-ric-api-a1-client - ${project.version} - ${project.groupId} nonrt-ric-api-provider diff --git a/sdnc-a1-controller/northbound/nonrt-ric-api/pom.xml b/sdnc-a1-controller/northbound/nonrt-ric-api/pom.xml index fe26d12e..0635dec3 100644 --- a/sdnc-a1-controller/northbound/nonrt-ric-api/pom.xml +++ b/sdnc-a1-controller/northbound/nonrt-ric-api/pom.xml @@ -37,7 +37,6 @@ sdnc-northbound :: nonrt-ric-api - a1-client model provider features diff --git a/sdnc-a1-controller/northbound/nonrt-ric-api/provider/pom.xml b/sdnc-a1-controller/northbound/nonrt-ric-api/provider/pom.xml index 21aef793..51bcfe75 100644 --- a/sdnc-a1-controller/northbound/nonrt-ric-api/provider/pom.xml +++ b/sdnc-a1-controller/northbound/nonrt-ric-api/provider/pom.xml @@ -55,9 +55,14 @@ ${project.version} - org.onap.sdnc.northbound - nonrt-ric-api-a1-client - ${project.version} + org.springframework + spring-context + provided + + + org.springframework + spring-web + provided org.apache.commons @@ -111,5 +116,9 @@ 1.10.19 test + + org.json + json + diff --git a/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/java/org/onap/sdnc/northbound/provider/NonrtRicApiProvider.java b/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/java/org/onap/sdnc/northbound/provider/NonrtRicApiProvider.java index 206b096a..7f29fd17 100644 --- a/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/java/org/onap/sdnc/northbound/provider/NonrtRicApiProvider.java +++ b/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/java/org/onap/sdnc/northbound/provider/NonrtRicApiProvider.java @@ -20,15 +20,20 @@ package org.onap.sdnc.northbound.provider; +import com.google.common.base.Optional; +import com.google.common.util.concurrent.CheckedFuture; +import com.google.common.util.concurrent.Futures; +import com.google.common.util.concurrent.ListenableFuture; import java.text.DateFormat; import java.text.SimpleDateFormat; +import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.TimeZone; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; -import org.apache.commons.lang3.StringUtils; +import org.json.JSONObject; import org.onap.sdnc.northbound.restadpter.NearRicUrlProvider; import org.onap.sdnc.northbound.restadpter.RestAdapter; import org.onap.sdnc.northbound.restadpter.RestAdapterImpl; @@ -73,22 +78,17 @@ import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev19100 import org.opendaylight.yang.gen.v1.org.onap.sdnc.northbound.a1.adapter.rev191002.GetStatusOutputBuilder; import org.opendaylight.yangtools.yang.common.RpcResult; import org.opendaylight.yangtools.yang.common.RpcResultBuilder; -import org.oransc.ric.a1med.client.model.PolicyTypeSchema; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import com.google.common.base.Optional; -import com.google.common.util.concurrent.CheckedFuture; -import com.google.common.util.concurrent.Futures; -import com.google.common.util.concurrent.ListenableFuture; /** * Defines a base implementation for your provider. This class overrides the generated interface * from the YANG model and implements the request model for the A1 interface. This class identifies * the Near-RIC throught the IP passed over the payload and calls the corresponding Near-RIC over * Rest API - * + * *
- * 
+ *
  * @author lathishbabu.ganesan@est.tech
  *
  */
@@ -199,12 +199,13 @@ public class NonrtRicApiProvider implements AutoCloseable, A1ADAPTERAPIService {
   @Override
   public ListenableFuture> createPolicyInstance(
       CreatePolicyInstanceInput input) {
-    log.debug("Start of createPolicyInstance");
-    String uri = nearRicUrlProvider.getPolicyInstanceId(String.valueOf(input.getPolicyTypeId()),
-        String.valueOf(input.getPolicyInstanceId()));
+    log.info("Start of createPolicyInstance");
+    String uri = nearRicUrlProvider.getPolicyInstanceId(String.valueOf(input.getNearRtRicId()),
+            String.valueOf(input.getPolicyTypeId()), String.valueOf(input.getPolicyInstanceId()));
+    log.info("PUT Request input.getPolicyInstance() : {} ", input.getPolicyInstance());
     restAdapter.put(uri, input.getPolicyInstance());
     CreatePolicyInstanceOutputBuilder responseBuilder = new CreatePolicyInstanceOutputBuilder();
-    log.debug("End of createPolicyInstance");
+    log.info("End of createPolicyInstance");
     RpcResult rpcResult = RpcResultBuilder
         .status(true).withResult(responseBuilder.build()).build();
     return Futures.immediateFuture(rpcResult);
@@ -213,14 +214,15 @@ public class NonrtRicApiProvider implements AutoCloseable, A1ADAPTERAPIService {
   @Override
   public ListenableFuture> createPolicyType(
       CreatePolicyTypeInput input) {
-    log.debug("Start of createPolicyType");
-    String uri = nearRicUrlProvider.getPolicyTypeId(String.valueOf(input.getPolicyTypeId()));
-    PolicyTypeSchema policyTypeSchema = new PolicyTypeSchema();
-    restAdapter.put(uri, policyTypeSchema);
+    log.info("Start of createPolicyType");
+    String uri = nearRicUrlProvider.getPolicyTypeId(String.valueOf(input.getNearRtRicId()),
+            String.valueOf(input.getPolicyTypeId()));
+    log.info("PUT Request input.getPolicyType() : {} ", input.getPolicyType());
+    restAdapter.put(uri, input.getPolicyType());
     CreatePolicyTypeOutputBuilder responseBuilder = new CreatePolicyTypeOutputBuilder();
     responseBuilder.setCode(RESPONSE_CODE_SUCCESS);
     responseBuilder.setStatus(RESPONSE_SUCCESS);
-    log.debug("End of createPolicyType");
+    log.info("End of createPolicyType");
     RpcResult rpcResult = RpcResultBuilder
         .status(true).withResult(responseBuilder.build()).build();
     return Futures.immediateFuture(rpcResult);
@@ -229,12 +231,12 @@ public class NonrtRicApiProvider implements AutoCloseable, A1ADAPTERAPIService {
   @Override
   public ListenableFuture> deletePolicyInstance(
       DeletePolicyInstanceInput input) {
-    log.debug("Start of deletePolicyInstance");
-    String uri = nearRicUrlProvider.getPolicyInstanceId(String.valueOf(input.getPolicyTypeId()),
-        String.valueOf(input.getPolicyInstanceId()));
+    log.info("Start of deletePolicyInstance");
+    String uri = nearRicUrlProvider.getPolicyInstanceId(String.valueOf(input.getNearRtRicId()),
+            String.valueOf(input.getPolicyTypeId()), String.valueOf(input.getPolicyInstanceId()));
     restAdapter.delete(uri);
     DeletePolicyInstanceOutputBuilder responseBuilder = new DeletePolicyInstanceOutputBuilder();
-    log.debug("End of deletePolicyInstance");
+    log.info("End of deletePolicyInstance");
     RpcResult rpcResult = RpcResultBuilder
         .status(true).withResult(responseBuilder.build()).build();
     return Futures.immediateFuture(rpcResult);
@@ -243,11 +245,12 @@ public class NonrtRicApiProvider implements AutoCloseable, A1ADAPTERAPIService {
   @Override
   public ListenableFuture> deletePolicyType(
       DeletePolicyTypeInput input) {
-    log.debug("Start of deletePolicyType");
-    String uri = nearRicUrlProvider.getPolicyTypeId(String.valueOf(input.getPolicyTypeId()));
+    log.info("Start of deletePolicyType");
+    String uri = nearRicUrlProvider.getPolicyTypeId(String.valueOf(input.getNearRtRicId()),
+            String.valueOf(input.getPolicyTypeId()));
     restAdapter.delete(uri);
     DeletePolicyTypeOutputBuilder responseBuilder = new DeletePolicyTypeOutputBuilder();
-    log.debug("End of deletePolicyType");
+    log.info("End of deletePolicyType");
     RpcResult rpcResult = RpcResultBuilder
         .status(true).withResult(responseBuilder.build()).build();
     return Futures.immediateFuture(rpcResult);
@@ -256,14 +259,12 @@ public class NonrtRicApiProvider implements AutoCloseable, A1ADAPTERAPIService {
   @Override
   public ListenableFuture> getHealthCheck(
       GetHealthCheckInput input) {
-    log.debug("Start of getHealthCheck");
-    String uri = nearRicUrlProvider.getHealthCheck();
-    Optional heathCheckStatus = restAdapter.get(uri, String.class);
+    log.info("Start of getHealthCheck");
+    String uri = nearRicUrlProvider.getHealthCheck(String.valueOf(input.getNearRtRicId()));
+    restAdapter.get(uri, String.class);
     GetHealthCheckOutputBuilder responseBuilder = new GetHealthCheckOutputBuilder();
-    if (heathCheckStatus.get().equals("")) {
-      responseBuilder.setHealthStatus(true);
-    }
-    log.debug("End of getHealthCheck");
+    responseBuilder.setHealthStatus(true);
+    log.info("End of getHealthCheck");
     RpcResult rpcResult = RpcResultBuilder.status(true)
         .withResult(responseBuilder.build()).build();
     return Futures.immediateFuture(rpcResult);
@@ -278,14 +279,17 @@ public class NonrtRicApiProvider implements AutoCloseable, A1ADAPTERAPIService {
   @Override
   public ListenableFuture> getPolicyInstance(
       GetPolicyInstanceInput input) {
-    log.debug("Start of getPolicyInstance");
-    String uri = nearRicUrlProvider.getPolicyInstanceId(String.valueOf(input.getPolicyTypeId()),
-        String.valueOf(input.getPolicyInstanceId()));
+    log.info("Start of getPolicyInstance");
+    log.info("Policy Type Id : {},  Policy Instance Id : {}", input.getPolicyTypeId(), input.getPolicyInstanceId());
+    String uri = nearRicUrlProvider.getPolicyInstanceId(String.valueOf(input.getNearRtRicId()),
+            String.valueOf(input.getPolicyTypeId()), String.valueOf(input.getPolicyInstanceId()));
     Optional policyInstance = restAdapter.get(uri, String.class);
     GetPolicyInstanceOutputBuilder responseBuilder = new GetPolicyInstanceOutputBuilder();
-    responseBuilder
-        .setPolicyInstance(policyInstance.isPresent() ? policyInstance.get() : StringUtils.EMPTY);
-    log.debug("End of getPolicyInstance");
+    if (policyInstance.isPresent()) {
+        log.info("Response policyInstance.get() : {} ", policyInstance.get());
+        responseBuilder.setPolicyInstance(policyInstance.get());
+    }
+    log.info("End of getPolicyInstance");
     RpcResult rpcResult = RpcResultBuilder
         .status(true).withResult(responseBuilder.build()).build();
     return Futures.immediateFuture(rpcResult);
@@ -294,14 +298,16 @@ public class NonrtRicApiProvider implements AutoCloseable, A1ADAPTERAPIService {
   @Override
   public ListenableFuture> getPolicyInstances(
       GetPolicyInstancesInput input) {
-    log.debug("Start of getPolicyInstances");
-    String uri = nearRicUrlProvider.getPolicyInstances(String.valueOf(input.getPolicyTypeId()));
+    log.info("Start of getPolicyInstances");
+    String uri = nearRicUrlProvider.getPolicyInstances(String.valueOf(input.getNearRtRicId()),
+            String.valueOf(input.getPolicyTypeId()));
     Optional> policyInstances = restAdapter.get(uri, List.class);
     GetPolicyInstancesOutputBuilder responseBuilder = new GetPolicyInstancesOutputBuilder();
     if (policyInstances.isPresent()) {
+      log.info("Response policyInstances.get() : {} ", policyInstances.get());
       responseBuilder.setPolicyInstanceIdList(policyInstances.get());
     }
-    log.debug("End of getPolicyInstances");
+    log.info("End of getPolicyInstances");
     RpcResult rpcResult = RpcResultBuilder
         .status(true).withResult(responseBuilder.build()).build();
     return Futures.immediateFuture(rpcResult);
@@ -309,17 +315,20 @@ public class NonrtRicApiProvider implements AutoCloseable, A1ADAPTERAPIService {
 
   @Override
   public ListenableFuture> getPolicyType(GetPolicyTypeInput input) {
-    log.debug("Start of getPolicyType");
-    log.debug("Policy Type Id : ", input.getPolicyTypeId());
-    String uri = nearRicUrlProvider.getPolicyTypeId(String.valueOf(input.getPolicyTypeId()));
-    Optional policyTypeSchema = restAdapter.get(uri, PolicyTypeSchema.class);
+    log.info("Start of getPolicyType");
+    log.info("Policy Type Id : {} ", input.getPolicyTypeId());
+    String uri = nearRicUrlProvider.getPolicyTypeId(String.valueOf(input.getNearRtRicId()),
+            String.valueOf(input.getPolicyTypeId()));
+    Optional policyType = restAdapter.get(uri, String.class);
     GetPolicyTypeOutputBuilder responseBuilder = new GetPolicyTypeOutputBuilder();
-    if (policyTypeSchema.isPresent()) {
-      responseBuilder.setDescription(policyTypeSchema.get().getDescription());
-      responseBuilder.setName(policyTypeSchema.get().getName());
-      responseBuilder.setPolicyType(policyTypeSchema.get().getCreateSchema().toString());
+    if (policyType.isPresent()) {
+      log.info("Response policyType.get() : {} ", policyType.get());
+      JSONObject policyTypeObj = new JSONObject(policyType.get());
+      responseBuilder.setDescription(policyTypeObj.getString("description"));
+      responseBuilder.setName(policyTypeObj.getString("name"));
+      responseBuilder.setPolicyType(policyTypeObj.getJSONObject("create_schema").toString());
     }
-    log.debug("End of getPolicyType");
+    log.info("End of getPolicyType");
     RpcResult rpcResult = RpcResultBuilder.status(true)
         .withResult(responseBuilder.build()).build();
     return Futures.immediateFuture(rpcResult);
@@ -328,12 +337,20 @@ public class NonrtRicApiProvider implements AutoCloseable, A1ADAPTERAPIService {
   @Override
   public ListenableFuture> getPolicyTypes(
       GetPolicyTypesInput input) {
-    log.debug("Start of getPolicyTypes");
-    String uri = nearRicUrlProvider.getPolicyTypes();
-    Optional> policyTypes = restAdapter.get(uri, List.class);
+    log.info("Start of getPolicyTypes");
+    String uri = nearRicUrlProvider.getPolicyTypes(String.valueOf(input.getNearRtRicId()));
+    Optional> policyTypes = restAdapter.get(uri, List.class);
     GetPolicyTypesOutputBuilder responseBuilder = new GetPolicyTypesOutputBuilder();
-    responseBuilder.setPolicyTypeIdList(policyTypes.get());
-    log.debug("End of getPolicyTypes");
+    if (policyTypes.isPresent()) {
+        log.info("Response policyTypes.get() : {} ", policyTypes.get());
+        List policyTypesListInteger = policyTypes.get();
+        List policyTypesListLong = new ArrayList<>();
+        for(Integer i : policyTypesListInteger){
+            policyTypesListLong.add(i.longValue());
+        }
+        responseBuilder.setPolicyTypeIdList(policyTypesListLong);
+    }
+    log.info("End of getPolicyTypes");
     RpcResult rpcResult = RpcResultBuilder.status(true)
         .withResult(responseBuilder.build()).build();
     return Futures.immediateFuture(rpcResult);
@@ -341,18 +358,17 @@ public class NonrtRicApiProvider implements AutoCloseable, A1ADAPTERAPIService {
 
   @Override
   public ListenableFuture> getStatus(GetStatusInput input) {
-    log.debug("Start of getStatus");
-    String uri = nearRicUrlProvider.getPolicyInstanceIdStatus(
+    log.info("Start of getStatus");
+    String uri = nearRicUrlProvider.getPolicyInstanceIdStatus(String.valueOf(input.getNearRtRicId()),
         String.valueOf(input.getPolicyTypeId()), String.valueOf(input.getPolicyInstanceId()));
-    Optional> policyTypes = restAdapter.get(uri, List.class);
+    Optional status = restAdapter.get(uri, String.class);
     GetStatusOutputBuilder responseBuilder = new GetStatusOutputBuilder();
-    // TODO:
-    /*
-     * No Schema defined for the response so Identify a way to parse the schema or create the java
-     * object
-     */
-    responseBuilder.setStatus(RESPONSE_SUCCESS);
-    log.debug("End of getStatus");
+    if (status.isPresent()) {
+        log.info("Response status.get() : {} ", status.get());
+        JSONObject statusObj = new JSONObject(status.get());
+        responseBuilder.setStatus(statusObj.getString("status"));
+    }
+    log.info("End of getStatus");
     RpcResult rpcResult =
         RpcResultBuilder.status(true).withResult(responseBuilder.build()).build();
     return Futures.immediateFuture(rpcResult);
diff --git a/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/java/org/onap/sdnc/northbound/restadpter/NearRicUrlProvider.java b/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/java/org/onap/sdnc/northbound/restadpter/NearRicUrlProvider.java
index 469e4075..496b4bdf 100644
--- a/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/java/org/onap/sdnc/northbound/restadpter/NearRicUrlProvider.java
+++ b/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/java/org/onap/sdnc/northbound/restadpter/NearRicUrlProvider.java
@@ -24,7 +24,7 @@ import org.springframework.web.util.UriComponentsBuilder;
 
 /**
  * This class provides Near-RIC api to invoke the A1 interface
- * 
+ *
  * @author lathishbabu.ganesan@est.tech
  *
  */
@@ -34,83 +34,83 @@ public class NearRicUrlProvider {
   private String baseUrl;
 
   public NearRicUrlProvider() {
-    // Near ric ip is passed in payload
-    baseUrl = "http://localhost:8080/a1-p/";
+    // Near ric ip:port is passed in payload currently
   }
 
   /**
    * Retrieve the base url of the Near-RIC
-   * 
+   *
    * @return the base url
    */
-  public String getBaseUrl() {
+  public String getBaseUrl(final String nearRtRicId) {
+    baseUrl = "http://" + nearRtRicId + "/a1-p/";
     return UriComponentsBuilder.fromUriString(baseUrl).build().toString();
   }
 
   /**
    * Retrieve the url of A1 healthcheck
-   * 
+   *
    * @return the health check url
    */
-  public String getHealthCheck() {
-    return UriComponentsBuilder.fromUriString(getBaseUrl()).pathSegment("healthcheck").build()
+  public String getHealthCheck(final String nearRtRicId) {
+    return UriComponentsBuilder.fromUriString(getBaseUrl(nearRtRicId)).pathSegment("healthcheck").build()
         .toString();
   }
 
   /**
    * Retrieve the policy type url
-   * 
+   *
    * @return the base url with the policytypes
    */
-  public String getPolicyTypes() {
-    return UriComponentsBuilder.fromUriString(getBaseUrl()).pathSegment("policytypes").build()
+  public String getPolicyTypes(final String nearRtRicId) {
+    return UriComponentsBuilder.fromUriString(getBaseUrl(nearRtRicId)).pathSegment("policytypes/").build()
         .toString();
   }
 
   /**
    * Retrieve the url of policy type id
-   * 
+   *
    * @param policyTypeId Policy Type Id
    * @return the policy type id url
    */
-  public String getPolicyTypeId(final String policyTypeId) {
-    return UriComponentsBuilder.fromUriString(getBaseUrl()).pathSegment("policytypes")
+  public String getPolicyTypeId(final String nearRtRicId, final String policyTypeId) {
+    return UriComponentsBuilder.fromUriString(getBaseUrl(nearRtRicId)).pathSegment("policytypes")
         .pathSegment(policyTypeId).build().toString();
   }
 
   /**
    * Retrieve the url of the policy instances
-   * 
+   *
    * @param policyTypeId Policy Type Id
    * @return the policy instances for the given policy type
    */
-  public String getPolicyInstances(final String policyTypeId) {
-    return UriComponentsBuilder.fromUriString(getPolicyTypeId(policyTypeId)).pathSegment("policies")
+  public String getPolicyInstances(final String nearRtRicId, final String policyTypeId) {
+    return UriComponentsBuilder.fromUriString(getPolicyTypeId(nearRtRicId, policyTypeId)).pathSegment("policies")
         .build().toString();
   }
 
   /**
    * Retrieve the url of the policy instance id
-   * 
+   *
    * @param policyTypeId Policy Type Id
    * @param policyInstanceId Policy Instance Id
    * @return the policy instance id for the given policy type
    */
-  public String getPolicyInstanceId(final String policyTypeId, final String policyInstanceId) {
-    return UriComponentsBuilder.fromUriString(getPolicyTypeId(policyTypeId)).pathSegment("policies")
+  public String getPolicyInstanceId(final String nearRtRicId, final String policyTypeId, final String policyInstanceId) {
+    return UriComponentsBuilder.fromUriString(getPolicyTypeId(nearRtRicId, policyTypeId)).pathSegment("policies")
         .pathSegment(policyInstanceId).build().toString();
   }
 
   /**
    * Retrieve the url of the policy instance id status
-   * 
+   *
    * @param policyTypeId Policy Type Id
    * @param policyInstanceId Policy Instance Id
    * @return the policy instance id status for the given policy type
    */
-  public String getPolicyInstanceIdStatus(final String policyTypeId,
+  public String getPolicyInstanceIdStatus(final String nearRtRicId, final String policyTypeId,
       final String policyInstanceId) {
-    return UriComponentsBuilder.fromUriString(getPolicyInstanceId(policyTypeId, policyInstanceId))
+    return UriComponentsBuilder.fromUriString(getPolicyInstanceId(nearRtRicId, policyTypeId, policyInstanceId))
         .pathSegment("status").build().toString();
   }
 }
diff --git a/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/java/org/onap/sdnc/northbound/restadpter/RestAdapter.java b/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/java/org/onap/sdnc/northbound/restadpter/RestAdapter.java
index 98759fd5..504c128d 100644
--- a/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/java/org/onap/sdnc/northbound/restadpter/RestAdapter.java
+++ b/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/java/org/onap/sdnc/northbound/restadpter/RestAdapter.java
@@ -25,7 +25,7 @@ import com.google.common.base.Optional;
 
 /**
  * An interface to wrap the generic HTTP methods
- * 
+ *
  * @author lathishbabu.ganesan@est.tech
  *
  */
@@ -34,7 +34,7 @@ public interface RestAdapter {
   /**
    * Retrieve a representation by doing a GET on the specified URL. The response (if any) is
    * converted and returned.
-   * 
+   *
    * @param uri the URL
    * @param clazz responseType the type of the return value
    * @return the converted object
@@ -44,16 +44,16 @@ public interface RestAdapter {
 
   /**
    * Create or update a resource by PUTting the given object to the URI.
-   * 
+   *
    * @param url the URL
-   * @param request the Object to be PUT (may be {@code null})
+   * @param request the String to be PUT (may be {@code null})
    * @return the response code
    */
-   Optional put(final String url, final Object object);
+   Optional put(final String url, final String body);
 
   /**
    * Delete resource for the given object to the URI.
-   * 
+   *
    * @param url the URL
    * @return the response code
    */
diff --git a/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/java/org/onap/sdnc/northbound/restadpter/RestAdapterImpl.java b/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/java/org/onap/sdnc/northbound/restadpter/RestAdapterImpl.java
index bbdcb002..215ebad4 100644
--- a/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/java/org/onap/sdnc/northbound/restadpter/RestAdapterImpl.java
+++ b/sdnc-a1-controller/northbound/nonrt-ric-api/provider/src/main/java/org/onap/sdnc/northbound/restadpter/RestAdapterImpl.java
@@ -20,18 +20,20 @@
 
 package org.onap.sdnc.northbound.restadpter;
 
+import com.google.common.base.Optional;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
 import org.springframework.http.HttpMethod;
 import org.springframework.http.HttpStatus;
+import org.springframework.http.MediaType;
 import org.springframework.http.ResponseEntity;
 import org.springframework.web.client.RestTemplate;
-import com.google.common.base.Optional;
 
 /**
  * This class provides the Generic Rest Adapter interface to the RestTemplate
- * 
+ *
  * @author lathishbabu.ganesan@est.tech
  *
  */
@@ -58,8 +60,10 @@ public class RestAdapterImpl implements RestAdapter {
   }
 
   @Override
-  public  Optional put(String uri, Object object) {
-    HttpEntity entity = getHttpEntity(object);
+  public  Optional put(String uri, String body) {
+    HttpHeaders headers = new HttpHeaders();
+    headers.setContentType(MediaType.APPLICATION_JSON);
+    HttpEntity entity = new HttpEntity(body, headers);
     final ResponseEntity response = invokeHttpRequest(uri, HttpMethod.PUT, null, entity);
     return buildOptional(response);
   }
@@ -79,9 +83,9 @@ public class RestAdapterImpl implements RestAdapter {
 
   private  Optional buildOptional(ResponseEntity response) {
     if (!response.getStatusCode().equals(HttpStatus.OK)
-        | !response.getStatusCode().equals(HttpStatus.CREATED)
-        | !response.getStatusCode().equals(HttpStatus.NO_CONTENT)) {
-      log.error("Failed to get the Response");
+        & !response.getStatusCode().equals(HttpStatus.CREATED)
+        & !response.getStatusCode().equals(HttpStatus.NO_CONTENT)) {
+      log.error("Failed to get the Response, Status Code = {}", response.getStatusCode());
       return Optional.absent();
     }
     if (response.hasBody()) {
-- 
2.16.6