From f0ae661923f06ea7e6e256a12f4e93028f307726 Mon Sep 17 00:00:00 2001 From: Mehreen Kaleem Date: Tue, 30 Jun 2020 06:01:41 +0000 Subject: Changes for the async support in MDONS Change-Id: I16bc015e6982441fbc59b121639fa44917cb5cb7 Issue-ID: SDNC-1233 Signed-off-by: Mehreen Kaleem --- .../org/onap/sdnc/northbound/OpticalServiceProvider.java | 11 ++++++++--- .../asyncrequests/AsyncNotificationHandling.java | 16 +++++++++++----- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/optical-service/provider/src/main/java/org/onap/sdnc/northbound/OpticalServiceProvider.java b/optical-service/provider/src/main/java/org/onap/sdnc/northbound/OpticalServiceProvider.java index 3688547d..931b28ad 100644 --- a/optical-service/provider/src/main/java/org/onap/sdnc/northbound/OpticalServiceProvider.java +++ b/optical-service/provider/src/main/java/org/onap/sdnc/northbound/OpticalServiceProvider.java @@ -131,8 +131,10 @@ public class OpticalServiceProvider implements AutoCloseable, OpticalserviceServ errorCode = outputParams.getProperty("error-code"); LOG.info("Response Code" + errorCode); String errorMessage = outputParams.getProperty("error-message"); + String ackFinalIndicator = outputParams.getProperty("ack-final-indicator"); serviceDataBuilder.setResponseCode(errorCode); serviceDataBuilder.setResponseMessage(errorMessage); + serviceDataBuilder.setAckFinalIndicator(ackFinalIndicator); } catch (Exception e) { LOG.error("Caught exception executing service LOGic for " + svcOperation, e); @@ -195,9 +197,12 @@ public class OpticalServiceProvider implements AutoCloseable, OpticalserviceServ serviceDataBuilder, parms); String errorCode = outputParams.getProperty("error-code"); LOG.info("Response Code" + errorCode); - String errorMessage = outputParams.getProperty("error-message"); - serviceDataBuilder.setResponseCode(errorCode); - serviceDataBuilder.setResponseMessage(errorMessage); + String errorMessage = outputParams.getProperty("error-message"); + String ackFinalIndicator = outputParams.getProperty("ack-final-indicator"); + serviceDataBuilder.setResponseCode(errorCode); + serviceDataBuilder.setResponseMessage(errorMessage); + serviceDataBuilder.setAckFinalIndicator(ackFinalIndicator); + } catch (Exception e) { LOG.error("Caught exception executing service LOGic for " + svcOperation, e); serviceDataBuilder.setResponseCode("500"); diff --git a/optical-service/provider/src/main/java/org/onap/sdnc/northbound/asyncrequests/AsyncNotificationHandling.java b/optical-service/provider/src/main/java/org/onap/sdnc/northbound/asyncrequests/AsyncNotificationHandling.java index 955cbb48..cf00bd33 100644 --- a/optical-service/provider/src/main/java/org/onap/sdnc/northbound/asyncrequests/AsyncNotificationHandling.java +++ b/optical-service/provider/src/main/java/org/onap/sdnc/northbound/asyncrequests/AsyncNotificationHandling.java @@ -31,6 +31,9 @@ import java.util.Properties; import java.io.Writer; import java.io.StringWriter; import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; import java.io.IOException; import java.util.stream.Collectors; @@ -58,7 +61,7 @@ public class AsyncNotificationHandling extends HttpServlet implements Servlet { private static final String RESPONSE_CODE = "response-code"; private static final String ACK_FINAL_INDICATOR = "ack-final-indicator"; private static final String CONFIGURATION_RESPONSE = "configuration-response-common"; - private static final String PROPERTIES_PATH = "/opt/onap/ccsdk/data/properties/"; + private static final String PROPERTIES_PATH = "/opt/onap/sdnc/data/properties/"; private static final String TEMPLATE_NAME = "rpc-message-sliapi-execute-async.vt"; private static final String UTF_8 = "UTF-8"; @@ -108,10 +111,12 @@ public class AsyncNotificationHandling extends HttpServlet implements Servlet { private void invokeRPC(String rpcMsgbody) { try { - String odlUrlBase = "http://sdnc.onap:8282/restconf/operations"; // using cluster SDNC URL - String odlUser = "admin"; - String odlPassword = "Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U"; - String sdncEndpoint = "SLI-API:execute-graph"; + Properties baseProperties = new Properties(); + baseProperties.load(new FileInputStream(new File("/opt/onap/sdnc/data/properties/optical-service-dg.properties"))); + String odlUrlBase = baseProperties.getProperty("odlUrlBase"); + String odlUser = baseProperties.getProperty("controller.user"); + String odlPassword = baseProperties.getProperty("controller.pwd"); + String sdncEndpoint = baseProperties.getProperty("sdncEndpoint"); if ((odlUrlBase != null) && (odlUrlBase.length() > 0)) { SdncOdlConnection conn = @@ -124,6 +129,7 @@ public class AsyncNotificationHandling extends HttpServlet implements Servlet { } catch (Exception e) { LOG.error("Unable to process message", e); } + } private String buildAsyncNotifRPCMsgRoadm(JSONObject payloadString) throws IOException { -- cgit 1.2.3-korg