From 2f1ee658482437e0c5b45451d20468411e2e2b6a Mon Sep 17 00:00:00 2001 From: "Magnusen, Drew (dm741q)" Date: Thu, 19 Oct 2017 14:26:32 -0500 Subject: Added log output to multiple drools applications. Added logger statments to network.log for AAI, SO, PDPX Guard, and VFC for all inbound/outbound traffic. Issue-Id: POLICY-356 Change-Id: I802d45d8136f987b4304baa8f17e166b1c8df165 Signed-off-by: Magnusen, Drew (dm741q) --- controlloop/common/model-impl/aai/pom.xml | 6 ++++++ .../src/main/java/org/onap/policy/aai/AAIManager.java | 18 +++++++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) (limited to 'controlloop/common/model-impl/aai') diff --git a/controlloop/common/model-impl/aai/pom.xml b/controlloop/common/model-impl/aai/pom.xml index dcf6f3741..04bd9fe25 100644 --- a/controlloop/common/model-impl/aai/pom.xml +++ b/controlloop/common/model-impl/aai/pom.xml @@ -28,5 +28,11 @@ 4.12 test + + org.onap.policy.drools-pdp + policy-endpoints + 1.1.0-SNAPSHOT + provided + diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIManager.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIManager.java index b295a0635..6a0fb3adb 100644 --- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIManager.java +++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIManager.java @@ -34,6 +34,7 @@ import com.google.gson.JsonSyntaxException; public final class AAIManager { private static final Logger logger = LoggerFactory.getLogger(AAIManager.class); + private static final Logger netLogger = LoggerFactory.getLogger(org.onap.policy.drools.event.comm.Topic.NETWORK_LOGGER); public static AAINQResponse postQuery(String url, String username, String password, AAINQRequest request, UUID requestID) { @@ -44,8 +45,10 @@ public final class AAIManager { url = url + "/aai/search/named-query"; - logger.debug("RESTManager.post before"); - Pair httpDetails = RESTManager.post(url, username, password, headers, "application/json", Serialization.gsonPretty.toJson(request)); + logger.debug("RESTManager.post before"); + String requestJson = Serialization.gsonPretty.toJson(request); + netLogger.info("[OUT|{}|{}|]{}{}", "AAI", url, System.lineSeparator(), requestJson); + Pair httpDetails = RESTManager.post(url, username, password, headers, "application/json", requestJson); logger.debug("RESTManager.post after"); if (httpDetails == null) { @@ -59,6 +62,7 @@ public final class AAIManager { if (httpDetails.b != null) { try { AAINQResponse response = Serialization.gsonPretty.fromJson(httpDetails.b, AAINQResponse.class); + netLogger.info("[IN|{}|{}|]{}{}", "AAI", url, System.lineSeparator(), response.toString()); return response; } catch (JsonSyntaxException e) { logger.error("postQuery threw: ", e); @@ -80,7 +84,8 @@ public final class AAIManager { AAIGETVserverResponse responseGet = null; while(attemptsLeft-- > 0){ - + + netLogger.info("[OUT|{}|{}|]", "AAI", urlGet); Pair httpDetailsGet = RESTManager.get(urlGet, username, password, headers); if (httpDetailsGet == null) { logger.info("AAI GET Null Response to " + urlGet); @@ -94,6 +99,7 @@ public final class AAIManager { if (httpDetailsGet.a == 200) { try { responseGet = Serialization.gsonPretty.fromJson(httpDetailsGet.b, AAIGETVserverResponse.class); + netLogger.info("[IN|{}|{}|]{}{}", "AAI", urlGet, System.lineSeparator(), responseGet.toString()); return responseGet; } catch (JsonSyntaxException e) { logger.error("postQuery threw: ", e); @@ -120,7 +126,7 @@ public final class AAIManager { AAIGETVnfResponse responseGet = null; while(attemptsLeft-- > 0){ - + netLogger.info("[OUT|{}|{}|]", "AAI", urlGet); Pair httpDetailsGet = RESTManager.get(urlGet, username, password, headers); if (httpDetailsGet == null) { logger.info("AAI GET Null Response to " + urlGet); @@ -134,6 +140,7 @@ public final class AAIManager { if (httpDetailsGet.a == 200) { try { responseGet = Serialization.gsonPretty.fromJson(httpDetailsGet.b, AAIGETVnfResponse.class); + netLogger.info("[IN|{}|{}|]{}{}", "AAI", urlGet, System.lineSeparator(), responseGet.toString()); return responseGet; } catch (JsonSyntaxException e) { logger.error("postQuery threw: ", e); @@ -161,7 +168,7 @@ public final class AAIManager { AAIGETVnfResponse responseGet = null; while(attemptsLeft-- > 0){ - + netLogger.info("[OUT|{}|{}|]", "AAI", urlGet); Pair httpDetailsGet = RESTManager.get(urlGet, username, password, headers); if (httpDetailsGet == null) { logger.info("AAI GET Null Response to " + urlGet); @@ -175,6 +182,7 @@ public final class AAIManager { if (httpDetailsGet.a == 200) { try { responseGet = Serialization.gsonPretty.fromJson(httpDetailsGet.b, AAIGETVnfResponse.class); + netLogger.info("[IN|{}|{}|]{}{}", "AAI", urlGet, System.lineSeparator(), responseGet.toString()); return responseGet; } catch (JsonSyntaxException e) { logger.error("postQuery threw: ", e); -- cgit 1.2.3-korg