aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/onap/clamp/clds/util/LoggingUtils.java786
-rw-r--r--src/main/java/org/onap/clamp/clds/util/ONAPLogConstants.java3
-rw-r--r--src/main/java/org/onap/clamp/flow/log/FlowLogOperation.java104
-rw-r--r--src/main/java/org/onap/clamp/loop/LoopOperation.java29
-rw-r--r--src/main/resources/clds/camel/rest/clamp-api-v2.xml666
-rw-r--r--src/main/resources/clds/camel/routes/flexible-flow.xml122
-rw-r--r--src/main/resources/logback-default.xml2
7 files changed, 1141 insertions, 571 deletions
diff --git a/src/main/java/org/onap/clamp/clds/util/LoggingUtils.java b/src/main/java/org/onap/clamp/clds/util/LoggingUtils.java
index 08bb9760..cbe7eba9 100644
--- a/src/main/java/org/onap/clamp/clds/util/LoggingUtils.java
+++ b/src/main/java/org/onap/clamp/clds/util/LoggingUtils.java
@@ -1,373 +1,413 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP CLAMP
- * ================================================================================
- * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.
- * ============LICENSE_END============================================
- * ===================================================================
- *
- */
-
-package org.onap.clamp.clds.util;
-
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-import java.net.HttpURLConnection;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.time.ZoneOffset;
-import java.time.ZonedDateTime;
-import java.time.format.DateTimeFormatter;
-import java.util.Date;
-import java.util.TimeZone;
-import java.util.UUID;
-
-import javax.net.ssl.HttpsURLConnection;
-import javax.servlet.http.HttpServletRequest;
-import javax.validation.constraints.NotNull;
-
-import org.onap.clamp.clds.service.DefaultUserNameHandler;
-import org.slf4j.MDC;
-import org.slf4j.event.Level;
-import org.springframework.security.core.context.SecurityContextHolder;
-
-/**
- * This class handles the special info that appear in the log, like RequestID,
- * time context, ...
- */
-public class LoggingUtils {
- protected static final EELFLogger logger = EELFManager.getInstance().getLogger(LoggingUtils.class);
-
- private static final DateFormat DATE_FORMAT = createDateFormat();
-
- /** String constant for messages <tt>ENTERING</tt>, <tt>EXITING</tt>, etc. */
- private static final String EMPTY_MESSAGE = "";
-
- /** Logger delegate. */
- private EELFLogger mlogger;
- /** Automatic UUID, overrideable per adapter or per invocation. */
- private static UUID sInstanceUUID = UUID.randomUUID();
-
- /**
- * Constructor.
- */
- public LoggingUtils(final EELFLogger loggerP) {
- this.mlogger = checkNotNull(loggerP);
- }
-
- /**
- * Set request related logging variables in thread local data via MDC
- *
- * @param service Service Name of API (ex. "PUT template")
- * @param partner Partner name (client or user invoking API)
- */
- public static void setRequestContext(String service, String partner) {
- MDC.put("RequestId", UUID.randomUUID().toString());
- MDC.put("ServiceName", service);
- MDC.put("PartnerName", partner);
- //Defaulting to HTTP/1.1 protocol
- MDC.put("Protocol", "HTTP/1.1");
- try {
- MDC.put("ServerFQDN", InetAddress.getLocalHost().getCanonicalHostName());
- MDC.put("ServerIPAddress", InetAddress.getLocalHost().getHostAddress());
- } catch (UnknownHostException e) {
- logger.error("Failed to initiate setRequestContext", e);
- }
- }
-
- /**
- * Set time related logging variables in thread local data via MDC.
- *
- * @param beginTimeStamp Start time
- * @param endTimeStamp End time
- */
- public static void setTimeContext(@NotNull Date beginTimeStamp, @NotNull Date endTimeStamp) {
- MDC.put("BeginTimestamp", generateTimestampStr(beginTimeStamp));
- MDC.put("EndTimestamp", generateTimestampStr(endTimeStamp));
- MDC.put("ElapsedTime", String.valueOf(endTimeStamp.getTime() - beginTimeStamp.getTime()));
- }
-
- /**
- * Set response related logging variables in thread local data via MDC.
- *
- * @param code Response code ("0" indicates success)
- * @param description Response description
- * @param className class name of invoking class
- */
- public static void setResponseContext(String code, String description, String className) {
- MDC.put("ResponseCode", code);
- MDC.put("StatusCode", code.equals("0") ? "COMPLETE" : "ERROR");
- MDC.put("ResponseDescription", description != null ? description : "");
- MDC.put("ClassName", className != null ? className : "");
- }
-
- /**
- * Set target related logging variables in thread local data via MDC
- *
- * @param targetEntity Target entity (an external/sub component, for ex. "sdc")
- * @param targetServiceName Target service name (name of API invoked on target)
- */
- public static void setTargetContext(String targetEntity, String targetServiceName) {
- MDC.put("TargetEntity", targetEntity != null ? targetEntity : "");
- MDC.put("TargetServiceName", targetServiceName != null ? targetServiceName : "");
- }
-
- /**
- * Set error related logging variables in thread local data via MDC.
- *
- * @param code Error code
- * @param description Error description
- */
- public static void setErrorContext(String code, String description) {
- MDC.put("ErrorCode", code);
- MDC.put("ErrorDescription", description != null ? description : "");
- }
-
- private static String generateTimestampStr(Date timeStamp) {
- return DATE_FORMAT.format(timeStamp);
- }
-
- /**
- * Get a previously stored RequestID for the thread local data via MDC. If
- * one was not previously stored, generate one, store it, and return that
- * one.
- *
- * @return A string with the request ID
- */
- public static String getRequestId() {
- String requestId = MDC.get(ONAPLogConstants.MDCs.REQUEST_ID);
- if (requestId == null || requestId.isEmpty()) {
- requestId = UUID.randomUUID().toString();
- MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, requestId);
- }
- return requestId;
- }
-
- private static DateFormat createDateFormat() {
- DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX");
- dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
- return dateFormat;
- }
-
-
-
- /*********************************************************************************************
- * Method for ONAP Application Logging Specification v1.2
- ********************************************************************************************/
-
- /**
- * Report <tt>ENTERING</tt> marker.
- *
- * @param request non-null incoming request (wrapper)
- * @param serviceName service name
- */
- public void entering(HttpServletRequest request, String serviceName) {
- MDC.clear();
- checkNotNull(request);
- // Extract MDC values from standard HTTP headers.
- final String requestId = defaultToUUID(request.getHeader(ONAPLogConstants.Headers.REQUEST_ID));
- final String invocationId = defaultToUUID(request.getHeader(ONAPLogConstants.Headers.INVOCATION_ID));
- final String partnerName = defaultToEmpty(request.getHeader(ONAPLogConstants.Headers.PARTNER_NAME));
-
- // Default the partner name to the user name used to login to clamp
- if (partnerName.equalsIgnoreCase(EMPTY_MESSAGE)) {
- MDC.put(ONAPLogConstants.MDCs.PARTNER_NAME, new DefaultUserNameHandler()
- .retrieveUserName(SecurityContextHolder.getContext()));
- }
-
- // Set standard MDCs. Override this entire method if you want to set
- // others, OR set them BEFORE or AFTER the invocation of #entering,
- // depending on where you need them to appear, OR extend the
- // ServiceDescriptor to add them.
- MDC.put(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP,
- ZonedDateTime.now(ZoneOffset.UTC)
- .format(DateTimeFormatter.ISO_INSTANT));
- MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, requestId);
- MDC.put(ONAPLogConstants.MDCs.INVOCATION_ID, invocationId);
- MDC.put(ONAPLogConstants.MDCs.CLIENT_IP_ADDRESS, defaultToEmpty(request.getRemoteAddr()));
- MDC.put(ONAPLogConstants.MDCs.SERVER_FQDN, defaultToEmpty(request.getServerName()));
- MDC.put(ONAPLogConstants.MDCs.INSTANCE_UUID, defaultToEmpty(sInstanceUUID));
-
- // Default the service name to the requestURI, in the event that
- // no value has been provided.
- if (serviceName == null
- || serviceName.equalsIgnoreCase(EMPTY_MESSAGE)) {
- MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, request.getRequestURI());
- } else {
- MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, serviceName);
- }
-
- this.mlogger.info(ONAPLogConstants.Markers.ENTRY);
- }
-
- /**
- * Report <tt>EXITING</tt> marker.
- *
- * @param code response code
- * @param descrption response description
- * @param severity response severity
- * @param status response status code
- */
- public void exiting(String code, String descrption, Level severity, ONAPLogConstants.ResponseStatus status) {
- try {
- MDC.put(ONAPLogConstants.MDCs.RESPONSE_CODE, defaultToEmpty(code));
- MDC.put(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION, defaultToEmpty(descrption));
- MDC.put(ONAPLogConstants.MDCs.RESPONSE_SEVERITY, defaultToEmpty(severity));
- MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, defaultToEmpty(status));
- this.mlogger.info(ONAPLogConstants.Markers.EXIT);
- }
- finally {
- MDC.clear();
- }
- }
-
- /**
- * Report pending invocation with <tt>INVOKE</tt> marker,
- * setting standard ONAP logging headers automatically.
- *
- * @param con http URL connection
- * @param targetEntity target entity
- * @param targetServiceName target service name
- * @return invocation ID to be passed with invocation
- */
- public HttpURLConnection invoke(final HttpURLConnection con, String targetEntity, String targetServiceName) {
- final String invocationId = UUID.randomUUID().toString();
-
- // Set standard HTTP headers on (southbound request) builder.
- con.setRequestProperty(ONAPLogConstants.Headers.REQUEST_ID,
- defaultToEmpty(MDC.get(ONAPLogConstants.MDCs.REQUEST_ID)));
- con.setRequestProperty(ONAPLogConstants.Headers.INVOCATION_ID,
- invocationId);
- con.setRequestProperty(ONAPLogConstants.Headers.PARTNER_NAME,
- defaultToEmpty(MDC.get(ONAPLogConstants.MDCs.PARTNER_NAME)));
-
- invokeContext(targetEntity, targetServiceName, invocationId);
-
- // Log INVOKE*, with the invocationID as the message body.
- // (We didn't really want this kind of behavior in the standard,
- // but is it worse than new, single-message MDC?)
- this.mlogger.info(ONAPLogConstants.Markers.INVOKE);
- this.mlogger.info(ONAPLogConstants.Markers.INVOKE_SYNC + "{" + invocationId + "}");
- return con;
- }
-
- /**
- * Report pending invocation with <tt>INVOKE</tt> marker,
- * setting standard ONAP logging headers automatically.
- *
- * @param con http URL connection
- * @param targetEntity target entity
- * @param targetServiceName target service name
- * @return invocation ID to be passed with invocation
- */
- public HttpsURLConnection invokeHttps(final HttpsURLConnection con, String targetEntity, String targetServiceName) {
- final String invocationId = UUID.randomUUID().toString();
-
- // Set standard HTTP headers on (southbound request) builder.
- con.setRequestProperty(ONAPLogConstants.Headers.REQUEST_ID,
- defaultToEmpty(MDC.get(ONAPLogConstants.MDCs.REQUEST_ID)));
- con.setRequestProperty(ONAPLogConstants.Headers.INVOCATION_ID,
- invocationId);
- con.setRequestProperty(ONAPLogConstants.Headers.PARTNER_NAME,
- defaultToEmpty(MDC.get(ONAPLogConstants.MDCs.PARTNER_NAME)));
-
- invokeContext(targetEntity, targetServiceName, invocationId);
-
- // Log INVOKE*, with the invocationID as the message body.
- // (We didn't really want this kind of behavior in the standard,
- // but is it worse than new, single-message MDC?)
- this.mlogger.info(ONAPLogConstants.Markers.INVOKE);
- this.mlogger.info(ONAPLogConstants.Markers.INVOKE_SYNC + "{" + invocationId + "}");
- return con;
- }
-
- /**
- * Invokes return context.
- */
- public void invokeReturn() {
- // Add the Invoke-return marker and clear the needed MDC
- this.mlogger.info(ONAPLogConstants.Markers.INVOKE_RETURN);
- invokeReturnContext();
- }
-
- /**
- * Dependency-free nullcheck.
- *
- * @param in to be checked
- * @param <T> argument (and return) type
- * @return input arg
- */
- private static <T> T checkNotNull(final T in) {
- if (in == null) {
- throw new NullPointerException();
- }
- return in;
- }
-
- /**
- * Dependency-free string default.
- *
- * @param in to be filtered
- * @return input string or null
- */
- private static String defaultToEmpty(final Object in) {
- if (in == null) {
- return "";
- }
- return in.toString();
- }
-
- /**
- * Dependency-free string default.
- *
- * @param in to be filtered
- * @return input string or null
- */
- private static String defaultToUUID(final String in) {
- if (in == null) {
- return UUID.randomUUID().toString();
- }
- return in;
- }
-
- /**
- * Set target related logging variables in thread local data via MDC.
- *
- * @param targetEntity Target entity (an external/sub component, for ex. "sdc")
- * @param targetServiceName Target service name (name of API invoked on target)
- * @param invocationID The invocation ID
- */
- private void invokeContext(String targetEntity, String targetServiceName, String invocationID) {
- MDC.put(ONAPLogConstants.MDCs.TARGET_ENTITY, defaultToEmpty(targetEntity));
- MDC.put(ONAPLogConstants.MDCs.TARGET_SERVICE_NAME, defaultToEmpty(targetServiceName));
- MDC.put(ONAPLogConstants.MDCs.INVOCATIONID_OUT, invocationID);
- MDC.put(ONAPLogConstants.MDCs.INVOKE_TIMESTAMP,
- ZonedDateTime.now(ZoneOffset.UTC)
- .format(DateTimeFormatter.ISO_INSTANT));
- }
-
- /**
- * Clear target related logging variables in thread local data via MDC.
- */
- private void invokeReturnContext() {
- MDC.remove(ONAPLogConstants.MDCs.TARGET_ENTITY);
- MDC.remove(ONAPLogConstants.MDCs.TARGET_SERVICE_NAME);
- MDC.remove(ONAPLogConstants.MDCs.INVOCATIONID_OUT);
- }
-}
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2017-2018 AT&T Intellectual Property. 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.
+ * ============LICENSE_END============================================
+ * ===================================================================
+ *
+ */
+
+package org.onap.clamp.clds.util;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+
+import java.net.HttpURLConnection;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.text.DateFormat;
+import java.text.SimpleDateFormat;
+import java.time.ZoneOffset;
+import java.time.ZonedDateTime;
+import java.time.format.DateTimeFormatter;
+import java.time.temporal.ChronoUnit;
+import java.util.Date;
+import java.util.TimeZone;
+import java.util.UUID;
+
+import javax.net.ssl.HttpsURLConnection;
+import javax.servlet.http.HttpServletRequest;
+import javax.validation.constraints.NotNull;
+
+import org.onap.clamp.clds.service.DefaultUserNameHandler;
+import org.slf4j.MDC;
+import org.slf4j.event.Level;
+import org.springframework.security.core.context.SecurityContextHolder;
+
+/**
+ * This class handles the special info that appear in the log, like RequestID,
+ * time context, ...
+ */
+public class LoggingUtils {
+ protected static final EELFLogger logger = EELFManager.getInstance().getLogger(LoggingUtils.class);
+
+ private static final DateFormat DATE_FORMAT = createDateFormat();
+
+ /** String constant for messages <tt>ENTERING</tt>, <tt>EXITING</tt>, etc. */
+ private static final String EMPTY_MESSAGE = "";
+
+ /** Logger delegate. */
+ private EELFLogger mlogger;
+
+ /** Automatic UUID, overrideable per adapter or per invocation. */
+ private static UUID sInstanceUUID = UUID.randomUUID();
+
+ /**
+ * Constructor.
+ */
+ public LoggingUtils(final EELFLogger loggerP) {
+ this.mlogger = checkNotNull(loggerP);
+ }
+
+ /**
+ * Set request related logging variables in thread local data via MDC.
+ *
+ * @param service Service Name of API (ex. "PUT template")
+ * @param partner Partner name (client or user invoking API)
+ */
+ public static void setRequestContext(String service, String partner) {
+ MDC.put("RequestId", UUID.randomUUID().toString());
+ MDC.put("ServiceName", service);
+ MDC.put("PartnerName", partner);
+ //Defaulting to HTTP/1.1 protocol
+ MDC.put("Protocol", "HTTP/1.1");
+ try {
+ MDC.put("ServerFQDN", InetAddress.getLocalHost().getCanonicalHostName());
+ MDC.put("ServerIPAddress", InetAddress.getLocalHost().getHostAddress());
+ } catch (UnknownHostException e) {
+ logger.error("Failed to initiate setRequestContext", e);
+ }
+ }
+
+ /**
+ * Set time related logging variables in thread local data via MDC.
+ *
+ * @param beginTimeStamp Start time
+ * @param endTimeStamp End time
+ */
+ public static void setTimeContext(@NotNull Date beginTimeStamp, @NotNull Date endTimeStamp) {
+ MDC.put("EntryTimestamp", generateTimestampStr(beginTimeStamp));
+ MDC.put("EndTimestamp", generateTimestampStr(endTimeStamp));
+ MDC.put("ElapsedTime", String.valueOf(endTimeStamp.getTime() - beginTimeStamp.getTime()));
+ }
+
+ /**
+ * Set response related logging variables in thread local data via MDC.
+ *
+ * @param code Response code ("0" indicates success)
+ * @param description Response description
+ * @param className class name of invoking class
+ */
+ public static void setResponseContext(String code, String description, String className) {
+ MDC.put("ResponseCode", code);
+ MDC.put("StatusCode", code.equals("0") ? "COMPLETE" : "ERROR");
+ MDC.put("ResponseDescription", description != null ? description : "");
+ MDC.put("ClassName", className != null ? className : "");
+ }
+
+ /**
+ * Set target related logging variables in thread local data via MDC.
+ *
+ * @param targetEntity Target entity (an external/sub component, for ex. "sdc")
+ * @param targetServiceName Target service name (name of API invoked on target)
+ */
+ public static void setTargetContext(String targetEntity, String targetServiceName) {
+ MDC.put("TargetEntity", targetEntity != null ? targetEntity : "");
+ MDC.put("TargetServiceName", targetServiceName != null ? targetServiceName : "");
+ }
+
+ /**
+ * Set error related logging variables in thread local data via MDC.
+ *
+ * @param code Error code
+ * @param description Error description
+ */
+ public static void setErrorContext(String code, String description) {
+ MDC.put("ErrorCode", code);
+ MDC.put("ErrorDescription", description != null ? description : "");
+ }
+
+ private static String generateTimestampStr(Date timeStamp) {
+ return DATE_FORMAT.format(timeStamp);
+ }
+
+ /**
+ * Get a previously stored RequestID for the thread local data via MDC. If
+ * one was not previously stored, generate one, store it, and return that
+ * one.
+ *
+ * @return A string with the request ID
+ */
+ public static String getRequestId() {
+ String requestId = MDC.get(ONAPLogConstants.MDCs.REQUEST_ID);
+ if (requestId == null || requestId.isEmpty()) {
+ requestId = UUID.randomUUID().toString();
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, requestId);
+ }
+ return requestId;
+ }
+
+ private static DateFormat createDateFormat() {
+ DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssX");
+ dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
+ return dateFormat;
+ }
+
+
+
+ /*********************************************************************************************
+ * Method for ONAP Application Logging Specification v1.2
+ ********************************************************************************************/
+
+ /**
+ * Report <tt>ENTERING</tt> marker.
+ *
+ * @param request non-null incoming request (wrapper)
+ * @param serviceName service name
+ */
+ public void entering(HttpServletRequest request, String serviceName) {
+ MDC.clear();
+ checkNotNull(request);
+ // Extract MDC values from standard HTTP headers.
+ final String requestId = defaultToUUID(request.getHeader(ONAPLogConstants.Headers.REQUEST_ID));
+ final String invocationId = defaultToUUID(request.getHeader(ONAPLogConstants.Headers.INVOCATION_ID));
+ final String partnerName = defaultToEmpty(request.getHeader(ONAPLogConstants.Headers.PARTNER_NAME));
+
+ // Default the partner name to the user name used to login to clamp
+ if (partnerName.equalsIgnoreCase(EMPTY_MESSAGE)) {
+ MDC.put(ONAPLogConstants.MDCs.PARTNER_NAME, new DefaultUserNameHandler()
+ .retrieveUserName(SecurityContextHolder.getContext()));
+ }
+
+ // Set standard MDCs. Override this entire method if you want to set
+ // others, OR set them BEFORE or AFTER the invocation of #entering,
+ // depending on where you need them to appear, OR extend the
+ // ServiceDescriptor to add them.
+ MDC.put(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP,
+ ZonedDateTime.now(ZoneOffset.UTC)
+ .format(DateTimeFormatter.ISO_INSTANT));
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, requestId);
+ MDC.put(ONAPLogConstants.MDCs.INVOCATION_ID, invocationId);
+ MDC.put(ONAPLogConstants.MDCs.CLIENT_IP_ADDRESS, defaultToEmpty(request.getRemoteAddr()));
+ MDC.put(ONAPLogConstants.MDCs.SERVER_FQDN, defaultToEmpty(request.getServerName()));
+ MDC.put(ONAPLogConstants.MDCs.INSTANCE_UUID, defaultToEmpty(sInstanceUUID));
+
+ // Default the service name to the requestURI, in the event that
+ // no value has been provided.
+ if (serviceName == null
+ || serviceName.equalsIgnoreCase(EMPTY_MESSAGE)) {
+ MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, request.getRequestURI());
+ } else {
+ MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, serviceName);
+ }
+
+ this.mlogger.info(ONAPLogConstants.Markers.ENTRY);
+ }
+
+ /**
+ * Report <tt>EXITING</tt> marker.
+ *
+
+ * @param code response code
+ * @param descrption response description
+ * @param severity response severity
+ * @param status response status code
+ */
+ public void exiting(String code, String descrption, Level severity, ONAPLogConstants.ResponseStatus status) {
+ try {
+ MDC.put(ONAPLogConstants.MDCs.RESPONSE_CODE, defaultToEmpty(code));
+ MDC.put(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION, defaultToEmpty(descrption));
+ MDC.put(ONAPLogConstants.MDCs.RESPONSE_SEVERITY, defaultToEmpty(severity));
+ MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, defaultToEmpty(status));
+
+ ZonedDateTime startTime = ZonedDateTime.parse(MDC.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP),
+ DateTimeFormatter.ISO_INSTANT.withZone(ZoneOffset.UTC));
+ ZonedDateTime endTime = ZonedDateTime.now(ZoneOffset.UTC);
+ MDC.put(ONAPLogConstants.MDCs.END_TIMESTAMP, endTime.format(DateTimeFormatter.ISO_INSTANT));
+ long duration = ChronoUnit.MILLIS.between(startTime, endTime);
+ MDC.put(ONAPLogConstants.MDCs.ELAPSED_TIMESTAMP, String.valueOf(duration));
+ this.mlogger.info(ONAPLogConstants.Markers.EXIT);
+ }
+ finally {
+ MDC.clear();
+ }
+ }
+
+ /**
+ * Get the property value.
+ *
+ * @param name The name of the property
+ * @return The value of the property
+ */
+ public String getProperties(String name) {
+ return MDC.get(name);
+ }
+
+ /**
+ * Report pending invocation with <tt>INVOKE</tt> marker,
+ * setting standard ONAP logging headers automatically.
+ *
+ * @param con The HTTP url connection
+ * @param targetEntity The target entity
+ * @param targetServiceName The target service name
+ * @return The HTTP url connection
+ */
+ public HttpURLConnection invoke(final HttpURLConnection con, String targetEntity, String targetServiceName) {
+ final String invocationId = UUID.randomUUID().toString();
+
+ // Set standard HTTP headers on (southbound request) builder.
+ con.setRequestProperty(ONAPLogConstants.Headers.REQUEST_ID,
+ defaultToEmpty(MDC.get(ONAPLogConstants.MDCs.REQUEST_ID)));
+ con.setRequestProperty(ONAPLogConstants.Headers.INVOCATION_ID,
+ invocationId);
+ con.setRequestProperty(ONAPLogConstants.Headers.PARTNER_NAME,
+ defaultToEmpty(MDC.get(ONAPLogConstants.MDCs.PARTNER_NAME)));
+
+ invokeContext(targetEntity, targetServiceName, invocationId);
+
+ // Log INVOKE*, with the invocationID as the message body.
+ // (We didn't really want this kind of behavior in the standard,
+ // but is it worse than new, single-message MDC?)
+ this.mlogger.info(ONAPLogConstants.Markers.INVOKE);
+ this.mlogger.info(ONAPLogConstants.Markers.INVOKE_SYNC + "{" + invocationId + "}");
+ return con;
+ }
+
+ /**
+ * Report pending invocation with <tt>INVOKE</tt> marker,
+ * setting standard ONAP logging headers automatically.
+ *
+ * @param targetEntity The target entity
+ * @param targetServiceName The target service name
+ */
+ public void invoke(String targetEntity, String targetServiceName) {
+ final String invocationId = UUID.randomUUID().toString();
+
+ invokeContext(targetEntity, targetServiceName, invocationId);
+
+ // Log INVOKE*, with the invocationID as the message body.
+ // (We didn't really want this kind of behavior in the standard,
+ // but is it worse than new, single-message MDC?)
+ this.mlogger.info(ONAPLogConstants.Markers.INVOKE);
+ this.mlogger.info(ONAPLogConstants.Markers.INVOKE_SYNC + "{" + invocationId + "}");
+ }
+
+ /**
+ * Report pending invocation with <tt>INVOKE</tt> marker,
+ * setting standard ONAP logging headers automatically.
+ *
+ * @param con The HTTPS url connection
+ * @param targetEntity The target entity
+ * @param targetServiceName The target service name
+ * @return The HTTPS url connection
+ */
+ public HttpsURLConnection invokeHttps(final HttpsURLConnection con, String targetEntity, String targetServiceName) {
+ final String invocationId = UUID.randomUUID().toString();
+
+ // Set standard HTTP headers on (southbound request) builder.
+ con.setRequestProperty(ONAPLogConstants.Headers.REQUEST_ID,
+ defaultToEmpty(MDC.get(ONAPLogConstants.MDCs.REQUEST_ID)));
+ con.setRequestProperty(ONAPLogConstants.Headers.INVOCATION_ID,
+ invocationId);
+ con.setRequestProperty(ONAPLogConstants.Headers.PARTNER_NAME,
+ defaultToEmpty(MDC.get(ONAPLogConstants.MDCs.PARTNER_NAME)));
+
+ invokeContext(targetEntity, targetServiceName, invocationId);
+
+ // Log INVOKE*, with the invocationID as the message body.
+ // (We didn't really want this kind of behavior in the standard,
+ // but is it worse than new, single-message MDC?)
+ this.mlogger.info(ONAPLogConstants.Markers.INVOKE);
+ this.mlogger.info(ONAPLogConstants.Markers.INVOKE_SYNC + "{" + invocationId + "}");
+ return con;
+ }
+
+ /**
+ * Report pending invocation with <tt>INVOKE-RETURN</tt> marker.
+ */
+ public void invokeReturn() {
+ // Add the Invoke-return marker and clear the needed MDC
+ this.mlogger.info(ONAPLogConstants.Markers.INVOKE_RETURN);
+ invokeReturnContext();
+ }
+
+ /**
+ * Dependency-free nullcheck.
+ *
+ * @param in to be checked
+ * @param <T> argument (and return) type
+ * @return input arg
+ */
+ private static <T> T checkNotNull(final T in) {
+ if (in == null) {
+ throw new NullPointerException();
+ }
+ return in;
+ }
+
+ /**
+ * Dependency-free string default.
+ *
+ * @param in to be filtered
+ * @return input string or null
+ */
+ private static String defaultToEmpty(final Object in) {
+ if (in == null) {
+ return "";
+ }
+ return in.toString();
+ }
+
+ /**
+ * Dependency-free string default.
+ *
+ * @param in to be filtered
+ * @return input string or null
+ */
+ private static String defaultToUUID(final String in) {
+ if (in == null) {
+ return UUID.randomUUID().toString();
+ }
+ return in;
+ }
+
+ /**
+ * Set target related logging variables in thread local data via MDC.
+ *
+ * @param targetEntity Target entity (an external/sub component, for ex. "sdc")
+ * @param targetServiceName Target service name (name of API invoked on target)
+ * @param invocationID The invocation ID
+ */
+ private void invokeContext(String targetEntity, String targetServiceName, String invocationID) {
+ MDC.put(ONAPLogConstants.MDCs.TARGET_ENTITY, defaultToEmpty(targetEntity));
+ MDC.put(ONAPLogConstants.MDCs.TARGET_SERVICE_NAME, defaultToEmpty(targetServiceName));
+ MDC.put(ONAPLogConstants.MDCs.INVOCATIONID_OUT, invocationID);
+ MDC.put(ONAPLogConstants.MDCs.INVOKE_TIMESTAMP,
+ ZonedDateTime.now(ZoneOffset.UTC)
+ .format(DateTimeFormatter.ISO_INSTANT));
+ }
+
+ /**
+ * Clear target related logging variables in thread local data via MDC.
+ */
+ private void invokeReturnContext() {
+ MDC.remove(ONAPLogConstants.MDCs.TARGET_ENTITY);
+ MDC.remove(ONAPLogConstants.MDCs.TARGET_SERVICE_NAME);
+ MDC.remove(ONAPLogConstants.MDCs.INVOCATIONID_OUT);
+ MDC.remove(ONAPLogConstants.MDCs.INVOKE_TIMESTAMP);
+ }
+}
diff --git a/src/main/java/org/onap/clamp/clds/util/ONAPLogConstants.java b/src/main/java/org/onap/clamp/clds/util/ONAPLogConstants.java
index eea01a39..906f8e03 100644
--- a/src/main/java/org/onap/clamp/clds/util/ONAPLogConstants.java
+++ b/src/main/java/org/onap/clamp/clds/util/ONAPLogConstants.java
@@ -122,7 +122,8 @@ public final class ONAPLogConstants {
* </p>
* */
public static final String ENTRY_TIMESTAMP = "EntryTimestamp";
-
+ public static final String END_TIMESTAMP = "EndTimestamp";
+ public static final String ELAPSED_TIMESTAMP = "ElapsedTime";
/** MDC recording timestamp at the start of the current invocation. */
public static final String INVOKE_TIMESTAMP = "InvokeTimestamp";
diff --git a/src/main/java/org/onap/clamp/flow/log/FlowLogOperation.java b/src/main/java/org/onap/clamp/flow/log/FlowLogOperation.java
new file mode 100644
index 00000000..ae96f6a8
--- /dev/null
+++ b/src/main/java/org/onap/clamp/flow/log/FlowLogOperation.java
@@ -0,0 +1,104 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP CLAMP
+ * ================================================================================
+ * Copyright (C) 2019 AT&T Intellectual Property. 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.
+ * ============LICENSE_END============================================
+ * ===================================================================
+ *
+ */
+
+package org.onap.clamp.flow.log;
+
+import com.att.eelf.configuration.EELFLogger;
+import com.att.eelf.configuration.EELFManager;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.camel.Exchange;
+import org.onap.clamp.clds.util.LoggingUtils;
+import org.onap.clamp.clds.util.ONAPLogConstants;
+import org.slf4j.event.Level;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.stereotype.Component;
+
+/**
+ * The Flow log operations.
+ */
+@Component
+public class FlowLogOperation {
+
+ protected static final EELFLogger logger = EELFManager.getInstance().getLogger(FlowLogOperation.class);
+ protected static final EELFLogger auditLogger = EELFManager.getInstance().getMetricsLogger();
+ private LoggingUtils util = new LoggingUtils(logger);
+
+ @Autowired
+ private HttpServletRequest request;
+
+ /**
+ * Generate the entry log.
+ *
+ * @param serviceDesc The service description
+ * the loop name
+ */
+ public void startLog(Exchange exchange, String serviceDesc) {
+ util.entering(request, serviceDesc);
+ exchange.getIn().setHeader(ONAPLogConstants.Headers.REQUEST_ID,
+ util.getProperties(ONAPLogConstants.MDCs.REQUEST_ID));
+ exchange.getIn().setHeader(ONAPLogConstants.Headers.INVOCATION_ID,
+ util.getProperties(ONAPLogConstants.MDCs.INVOCATION_ID));
+ exchange.getIn().setHeader(ONAPLogConstants.Headers.PARTNER_NAME,
+ util.getProperties(ONAPLogConstants.MDCs.PARTNER_NAME));
+ }
+
+ /**
+ * Generate the exiting log.
+ */
+ public void endLog() {
+ util.exiting(HttpStatus.OK.toString(), "Successful", Level.INFO,
+ ONAPLogConstants.ResponseStatus.COMPLETED);
+ }
+
+ /**
+ * Generate the error exiting log.
+ */
+ public void errorLog() {
+ util.exiting(HttpStatus.INTERNAL_SERVER_ERROR.toString(), "Failed",
+ Level.INFO, ONAPLogConstants.ResponseStatus.ERROR);
+ }
+
+ /**
+ * Generate the error exiting log.
+ */
+ public void httpErrorLog() {
+
+ }
+
+ /**
+ * Generate the invoke log.
+ */
+ public void invokeLog(String targetEntity, String targetServiceName) {
+ util.invoke(targetEntity, targetServiceName);
+ }
+
+ /**
+ * Generate the invoke return marker.
+ */
+ public void invokeReturnLog() {
+ util.invokeReturn();
+ }
+}
diff --git a/src/main/java/org/onap/clamp/loop/LoopOperation.java b/src/main/java/org/onap/clamp/loop/LoopOperation.java
index d9ea2487..3f4c5293 100644
--- a/src/main/java/org/onap/clamp/loop/LoopOperation.java
+++ b/src/main/java/org/onap/clamp/loop/LoopOperation.java
@@ -52,7 +52,7 @@ import org.springframework.stereotype.Component;
import org.yaml.snakeyaml.Yaml;
/**
- * Closed loop operations
+ * Closed loop operations.
*/
@Component
public class LoopOperation {
@@ -72,15 +72,15 @@ public class LoopOperation {
this.loopService = loopService;
this.dcaeDispatcherServices = dcaeDispatcherServices;
}
-
+
/**
* Deploy the closed loop.
*
* @param loopName
* the loop name
* @return the updated loop
- * @throws Exceptions
- * during the operation
+ * @throws OperationException
+ * Exception during the operation
*/
public Loop deployLoop(Exchange camelExchange, String loopName) throws OperationException {
util.entering(request, "CldsService: Deploy model");
@@ -172,32 +172,35 @@ public class LoopOperation {
return loop;
}
- private JsonElement wrapSnakeObject(Object o) {
+ private JsonElement wrapSnakeObject(Object obj) {
// NULL => JsonNull
- if (o == null)
+ if (obj == null) {
return JsonNull.INSTANCE;
+ }
// Collection => JsonArray
- if (o instanceof Collection) {
+ if (obj instanceof Collection) {
JsonArray array = new JsonArray();
- for (Object childObj : (Collection<?>) o)
+ for (Object childObj : (Collection<?>) obj) {
array.add(wrapSnakeObject(childObj));
+ }
return array;
}
// Array => JsonArray
- if (o.getClass().isArray()) {
+ if (obj.getClass().isArray()) {
JsonArray array = new JsonArray();
int length = Array.getLength(array);
- for (int i = 0; i < length; i++)
+ for (int i = 0; i < length; i++) {
array.add(wrapSnakeObject(Array.get(array, i)));
+ }
return array;
}
// Map => JsonObject
- if (o instanceof Map) {
- Map<?, ?> map = (Map<?, ?>) o;
+ if (obj instanceof Map) {
+ Map<?, ?> map = (Map<?, ?>) obj;
JsonObject jsonObject = new JsonObject();
for (final Map.Entry<?, ?> entry : map.entrySet()) {
@@ -209,7 +212,7 @@ public class LoopOperation {
}
// otherwise take it as a string
- return new JsonPrimitive(String.valueOf(o));
+ return new JsonPrimitive(String.valueOf(obj));
}
}
diff --git a/src/main/resources/clds/camel/rest/clamp-api-v2.xml b/src/main/resources/clds/camel/rest/clamp-api-v2.xml
index a823c09d..6bd1132c 100644
--- a/src/main/resources/clds/camel/rest/clamp-api-v2.xml
+++ b/src/main/resources/clds/camel/rest/clamp-api-v2.xml
@@ -5,10 +5,23 @@
outType="java.lang.String[]"
produces="application/json">
<route>
- <to
- uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','read')" />
- <to
- uri="bean:org.onap.clamp.loop.LoopController?method=getLoopNames()" />
+ <doTry>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'Get All ClosedLoop')" />
+ <to
+ uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','read')" />
+ <to
+ uri="bean:org.onap.clamp.loop.LoopController?method=getLoopNames()" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
+ <doCatch>
+ <exception>java.lang.Exception</exception>
+ <handled>
+ <constant>false</constant>
+ </handled>
+ <to uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
+ </doCatch>
+ </doTry>
</route>
</get>
<get
@@ -16,10 +29,23 @@
outType="org.onap.clamp.loop.Loop"
produces="application/json">
<route>
- <to
- uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','read')" />
- <to
- uri="bean:org.onap.clamp.loop.LoopController?method=getLoop(${header.loopName})" />
+ <doTry>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'Get Closed Loop')" />
+ <to
+ uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','read')" />
+ <to
+ uri="bean:org.onap.clamp.loop.LoopController?method=getLoop(${header.loopName})" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
+ <doCatch>
+ <exception>java.lang.Exception</exception>
+ <handled>
+ <constant>false</constant>
+ </handled>
+ <to uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
+ </doCatch>
+ </doTry>
</route>
</get>
<get
@@ -27,10 +53,23 @@
outType="java.lang.String"
produces="application/xml">
<route>
- <to
- uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','read')" />
- <to
- uri="bean:org.onap.clamp.loop.LoopController?method=getSVGRepresentation(${header.loopName})" />
+ <doTry>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'Get SVG Representation')" />
+ <to
+ uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','read')" />
+ <to
+ uri="bean:org.onap.clamp.loop.LoopController?method=getSVGRepresentation(${header.loopName})" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
+ <doCatch>
+ <exception>java.lang.Exception</exception>
+ <handled>
+ <constant>false</constant>
+ </handled>
+ <to uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
+ </doCatch>
+ </doTry>
</route>
</get>
@@ -41,16 +80,29 @@
outType="org.onap.clamp.loop.Loop"
produces="application/json">
<route>
- <to
- uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
- <setHeader headerName="GlobalPropertiesJson">
- <simple>${body}</simple>
- </setHeader>
- <to uri="direct:load-loop" />
- <to
- uri="bean:org.onap.clamp.loop.LoopController?method=updateGlobalPropertiesJson(${header.loopName},${header.GlobalPropertiesJson})" />
- <to
- uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Global Properties UPDATED','INFO',${header.LoopObject})" />
+ <doTry>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'Update the global properties')" />
+ <to
+ uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
+ <setHeader headerName="GlobalPropertiesJson">
+ <simple>${body}</simple>
+ </setHeader>
+ <to uri="direct:load-loop" />
+ <to
+ uri="bean:org.onap.clamp.loop.LoopController?method=updateGlobalPropertiesJson(${header.loopName},${header.GlobalPropertiesJson})" />
+ <to
+ uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Global Properties UPDATED','INFO',${header.LoopObject})" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
+ <doCatch>
+ <exception>java.lang.Exception</exception>
+ <handled>
+ <constant>false</constant>
+ </handled>
+ <to uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
+ </doCatch>
+ </doTry>
</route>
</post>
<post
@@ -60,16 +112,29 @@
outType="org.onap.clamp.loop.Loop"
produces="application/json">
<route>
- <to
- uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
- <setHeader headerName="OperationalPoliciesArray">
- <simple>${body}</simple>
- </setHeader>
- <to uri="direct:load-loop" />
- <to
- uri="bean:org.onap.clamp.loop.LoopController?method=updateOperationalPolicies(${header.loopName},${header.OperationalPoliciesArray})" />
- <to
- uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Operational and Guard policies UPDATED','INFO',${header.LoopObject})" />
+ <doTry>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'Update operational policies')" />
+ <to
+ uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
+ <setHeader headerName="OperationalPoliciesArray">
+ <simple>${body}</simple>
+ </setHeader>
+ <to uri="direct:load-loop" />
+ <to
+ uri="bean:org.onap.clamp.loop.LoopController?method=updateOperationalPolicies(${header.loopName},${header.OperationalPoliciesArray})" />
+ <to
+ uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Operational and Guard policies UPDATED','INFO',${header.LoopObject})" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
+ <doCatch>
+ <exception>java.lang.Exception</exception>
+ <handled>
+ <constant>false</constant>
+ </handled>
+ <to uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
+ </doCatch>
+ </doTry>
</route>
</post>
<post
@@ -79,17 +144,30 @@
outType="org.onap.clamp.policy.microservice.MicroServicePolicy"
produces="application/json">
<route>
- <to
- uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
- <setHeader headerName="MicroServicePolicyObject">
- <simple>${body}</simple>
- </setHeader>
+ <doTry>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'Update Microservice policies')" />
+ <to
+ uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
+ <setHeader headerName="MicroServicePolicyObject">
+ <simple>${body}</simple>
+ </setHeader>
- <to uri="direct:load-loop" />
- <to
- uri="bean:org.onap.clamp.loop.LoopController?method=updateMicroservicePolicy(${header.loopName},${header.MicroServicePolicyObject})" />
- <to
- uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Micro Service policies UPDATED','INFO',${header.LoopObject})" />
+ <to uri="direct:load-loop" />
+ <to
+ uri="bean:org.onap.clamp.loop.LoopController?method=updateMicroservicePolicy(${header.loopName},${header.MicroServicePolicyObject})" />
+ <to
+ uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Micro Service policies UPDATED','INFO',${header.LoopObject})" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
+ <doCatch>
+ <exception>java.lang.Exception</exception>
+ <handled>
+ <constant>false</constant>
+ </handled>
+ <to uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
+ </doCatch>
+ </doTry>
</route>
</post>
<put
@@ -97,10 +175,23 @@
outType="org.onap.clamp.loop.Loop"
produces="application/json">
<route>
- <to
- uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
- <to
- uri="bean:org.onap.clamp.operation.LoopOperation?method=deployLoop(*,${header.loopName})" />
+ <doTry>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'Deploy the closed loop')" />
+ <to
+ uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
+ <to
+ uri="bean:org.onap.clamp.operation.LoopOperation?method=deployLoop(*,${header.loopName})" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
+ <doCatch>
+ <exception>java.lang.Exception</exception>
+ <handled>
+ <constant>false</constant>
+ </handled>
+ <to uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
+ </doCatch>
+ </doTry>
</route>
</put>
<put
@@ -108,10 +199,23 @@
outType="org.onap.clamp.loop.Loop"
produces="application/json">
<route>
- <to
- uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
- <to
- uri="bean:org.onap.clamp.operation.LoopOperation?method=unDeployLoop(${header.loopName})" />
+ <doTry>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'Undeploy the closed loop')" />
+ <to
+ uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
+ <to
+ uri="bean:org.onap.clamp.operation.LoopOperation?method=unDeployLoop(${header.loopName})" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
+ <doCatch>
+ <exception>java.lang.Exception</exception>
+ <handled>
+ <constant>false</constant>
+ </handled>
+ <to uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
+ </doCatch>
+ </doTry>
</route>
</put>
<put
@@ -119,193 +223,393 @@
outType="org.onap.clamp.loop.Loop"
produces="application/json">
<route>
- <log
- loggingLevel="INFO"
- message="Receive STOP request for loop: ${header.loopName}" />
+ <doTry>
+ <log
+ loggingLevel="INFO"
+ message="Receive STOP request for loop: ${header.loopName}" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog('Stop the closed loop')" />
+ <to
+ uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
+ <to uri="direct:load-loop" />
+
+ <doTry>
+ <to uri="direct:remove-all-policy-from-active-pdp-group" />
+ <doCatch>
+ <exception>java.lang.Exception</exception>
+ <handled>
+ <constant>false</constant>
+ </handled>
+ <to uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
+ </doCatch>
+ </doTry>
+
+
+ <log
+ loggingLevel="INFO"
+ message="STOP request successfully executed for loop: ${body}" />
+ <to
+ uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('STOP request successfully executed','INFO',${header.LoopObject})" />
+ <to
+ uri="bean:org.onap.clamp.loop.LoopController?method=getLoop(${header.loopName})" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
+ <doCatch>
+ <exception>java.lang.Exception</exception>
+ <handled>
+ <constant>false</constant>
+ </handled>
+ <to uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
+ </doCatch>
+ </doTry>
</route>
- <to
- uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
- <to uri="direct:load-loop" />
- <to uri="direct:remove-all-policy-from-active-pdp-group" />
- <log
- loggingLevel="INFO"
- message="STOP request successfully executed for loop: ${body}" />
- <to
- uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('STOP request successfully executed','INFO',${header.LoopObject})" />
- <to
- uri="bean:org.onap.clamp.loop.LoopController?method=getLoop(${header.loopName})" />
</put>
<put
uri="/v2/loop/start/{loopName}"
outType="org.onap.clamp.loop.Loop"
produces="application/json">
<route>
- <log
- loggingLevel="INFO"
- message="Receive START request for loop: ${header.loopName}" />
+ <doTry>
+ <log
+ loggingLevel="INFO"
+ message="Receive START request for loop: ${header.loopName}" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog('Start the closed loop')" />
+ <to
+ uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
+ <to uri="direct:load-loop" />
+
+ <doTry>
+ <to uri="direct:add-all-to-active-pdp-group" />
+ <doCatch>
+ <exception>java.lang.Exception</exception>
+ <handled>
+ <constant>false</constant>
+ </handled>
+ <to uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
+ </doCatch>
+ </doTry>
+
+ <log
+ loggingLevel="INFO"
+ message="START request successfully executed for loop: ${body}" />
+ <to
+ uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('START request successfully executed','INFO',${header.LoopObject})" />
+ <to
+ uri="bean:org.onap.clamp.loop.LoopController?method=getLoop(${header.loopName})" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
+ <doCatch>
+ <exception>java.lang.Exception</exception>
+ <handled>
+ <constant>false</constant>
+ </handled>
+ <to uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
+ </doCatch>
+ </doTry>
</route>
- <to
- uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
- <to uri="direct:load-loop" />
- <to uri="direct:add-all-to-active-pdp-group" />
- <log
- loggingLevel="INFO"
- message="START request successfully executed for loop: ${body}" />
- <to
- uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('START request successfully executed','INFO',${header.LoopObject})" />
- <to
- uri="bean:org.onap.clamp.loop.LoopController?method=getLoop(${header.loopName})" />
</put>
<put
uri="/v2/loop/submit/{loopName}"
outType="org.onap.clamp.loop.Loop"
produces="application/json">
<route>
- <log
- loggingLevel="INFO"
- message="Receive SUBMIT request for loop: ${header.loopName}" />
- <to
- uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
- <to uri="direct:load-loop" />
- <to
- uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Receive SUBMIT request','INFO',${header.LoopObject})" />
- <setHeader headerName="RaiseHttpExceptionFlag">
- <simple resultType="java.lang.Boolean">false</simple>
- </setHeader>
- <to uri="direct:remove-all-policy-from-active-pdp-group" />
- <log
- loggingLevel="INFO"
- message="Processing all MICRO-SERVICES policies defined in loop ${header.LoopObject.getName()}" />
- <split>
- <simple>${header.LoopObject.getMicroServicePolicies()}
- </simple>
- <setHeader headerName="microServicePolicy">
- <simple>${body}</simple>
- </setHeader>
+ <doTry>
<log
loggingLevel="INFO"
- message="Processing Micro Service Policy: ${header.microServicePolicy.getName()}" />
+ message="Receive SUBMIT request for loop: ${header.loopName}" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'Submit the closed loop')" />
+ <to
+ uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
+ <to uri="direct:load-loop" />
+ <to
+ uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Receive SUBMIT request','INFO',${header.LoopObject})" />
<setHeader headerName="RaiseHttpExceptionFlag">
<simple resultType="java.lang.Boolean">false</simple>
</setHeader>
- <to uri="direct:delete-micro-service-policy" />
-
- <to uri="direct:create-micro-service-policy" />
- </split>
+
+ <doTry>
+ <to uri="direct:remove-all-policy-from-active-pdp-group" />
+ <doCatch>
+ <exception>java.lang.Exception</exception>
+ <handled>
+ <constant>false</constant>
+ </handled>
+ <to uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
+ </doCatch>
+ </doTry>
- <log
- loggingLevel="INFO"
- message="Processing all OPERATIONAL policies defined in loop ${header.LoopObject.getName()}" />
- <split>
- <simple>${header.LoopObject.getOperationalPolicies()}
- </simple>
- <setHeader headerName="operationalPolicy">
- <simple>${body}</simple>
- </setHeader>
<log
loggingLevel="INFO"
- message="Processing Operational Policy: ${header.operationalPolicy.getName()}" />
- <setHeader headerName="RaiseHttpExceptionFlag">
- <simple resultType="java.lang.Boolean">false</simple>
- </setHeader>
- <to uri="direct:delete-operational-policy" />
+ message="Processing all MICRO-SERVICES policies defined in loop ${header.LoopObject.getName()}" />
+ <split>
+ <simple>${header.LoopObject.getMicroServicePolicies()}
+ </simple>
+ <setHeader headerName="microServicePolicy">
+ <simple>${body}</simple>
+ </setHeader>
+ <log
+ loggingLevel="INFO"
+ message="Processing Micro Service Policy: ${header.microServicePolicy.getName()}" />
+ <setHeader headerName="RaiseHttpExceptionFlag">
+ <simple resultType="java.lang.Boolean">false</simple>
+ </setHeader>
+
+ <doTry>
+ <to uri="direct:delete-micro-service-policy" />
+ <doCatch>
+ <exception>java.lang.Exception</exception>
+ <handled>
+ <constant>false</constant>
+ </handled>
+ <to uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
+ </doCatch>
+ </doTry>
- <to uri="direct:create-operational-policy" />
+ <doTry>
+ <to uri="direct:create-micro-service-policy" />
+ <doCatch>
+ <exception>java.lang.Exception</exception>
+ <handled>
+ <constant>false</constant>
+ </handled>
+ <to uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
+ </doCatch>
+ </doTry>
+
+ </split>
<log
loggingLevel="INFO"
- message="Processing all GUARD policies defined in loop ${header.LoopObject.getName()}" />
+ message="Processing all OPERATIONAL policies defined in loop ${header.LoopObject.getName()}" />
<split>
- <simple>${header.operationalPolicy.createGuardPolicyPayloads().entrySet()}
+ <simple>${header.LoopObject.getOperationalPolicies()}
</simple>
- <setHeader headerName="guardPolicy">
+ <setHeader headerName="operationalPolicy">
<simple>${body}</simple>
</setHeader>
<log
loggingLevel="INFO"
- message="Processing Guard Policy: ${header.guardPolicy.getKey()}" />
-
+ message="Processing Operational Policy: ${header.operationalPolicy.getName()}" />
<setHeader headerName="RaiseHttpExceptionFlag">
<simple resultType="java.lang.Boolean">false</simple>
- </setHeader>
- <to uri="direct:delete-guard-policy" />
+ </setHeader>
+
+ <doTry>
+ <to uri="direct:delete-operational-policy" />
+ <doCatch>
+ <exception>java.lang.Exception</exception>
+ <handled>
+ <constant>false</constant>
+ </handled>
+ <to uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
+ </doCatch>
+ </doTry>
+
+ <doTry>
+ <to uri="direct:create-operational-policy" />
+ <doCatch>
+ <exception>java.lang.Exception</exception>
+ <handled>
+ <constant>false</constant>
+ </handled>
+ <to uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
+ </doCatch>
+ </doTry>
+
+
+ <log
+ loggingLevel="INFO"
+ message="Processing all GUARD policies defined in loop ${header.LoopObject.getName()}" />
+ <split>
+ <simple>${header.operationalPolicy.createGuardPolicyPayloads().entrySet()}
+ </simple>
+ <setHeader headerName="guardPolicy">
+ <simple>${body}</simple>
+ </setHeader>
+ <log
+ loggingLevel="INFO"
+ message="Processing Guard Policy: ${header.guardPolicy.getKey()}" />
+
+ <setHeader headerName="RaiseHttpExceptionFlag">
+ <simple resultType="java.lang.Boolean">false</simple>
+ </setHeader>
+
+ <doTry>
+ <to uri="direct:delete-guard-policy" />
+ <doCatch>
+ <exception>java.lang.Exception</exception>
+ <handled>
+ <constant>false</constant>
+ </handled>
+ <to uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
+ </doCatch>
+ </doTry>
- <to uri="direct:create-guard-policy" />
+ <doTry>
+ <to uri="direct:create-guard-policy" />
+ <doCatch>
+ <exception>java.lang.Exception</exception>
+ <handled>
+ <constant>false</constant>
+ </handled>
+ <to uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
+ </doCatch>
+ </doTry>
+
+ </split>
</split>
- </split>
- <to uri="direct:add-all-to-active-pdp-group" />
+
+
+ <doTry>
+ <to uri="direct:add-all-to-active-pdp-group" />
+ <doCatch>
+ <exception>java.lang.Exception</exception>
+ <handled>
+ <constant>false</constant>
+ </handled>
+ <to uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
+ </doCatch>
+ </doTry>
+
+
- <log
- loggingLevel="INFO"
- message="SUBMIT request successfully executed for loop: ${body}" />
- <to
- uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('SUBMIT request successfully executed','INFO',${header.LoopObject})" />
- <to
- uri="bean:org.onap.clamp.loop.LoopController?method=getLoop(${header.loopName})" />
+ <log
+ loggingLevel="INFO"
+ message="SUBMIT request successfully executed for loop: ${body}" />
+ <to
+ uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('SUBMIT request successfully executed','INFO',${header.LoopObject})" />
+ <to
+ uri="bean:org.onap.clamp.loop.LoopController?method=getLoop(${header.loopName})" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
+ <doCatch>
+ <exception>java.lang.Exception</exception>
+ <handled>
+ <constant>false</constant>
+ </handled>
+ <to uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
+ </doCatch>
+ </doTry>
</route>
</put>
<put uri="/v2/loop/delete/{loopName}">
<route>
- <log
- loggingLevel="INFO"
- message="Receive DELETE request for loop: ${header.loopName}" />
- <to
- uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
- <to uri="direct:load-loop" />
- <to
- uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Receive DELETE request','INFO',${header.LoopObject})" />
- <to uri="direct:remove-all-policy-from-active-pdp-group" />
- <split>
- <simple>${header.LoopObject.getMicroServicePolicies()}
- </simple>
- <setHeader headerName="microServicePolicy">
- <simple>${body}</simple>
- </setHeader>
+ <doTry>
<log
loggingLevel="INFO"
- message="Processing Micro Service Policy: ${header.microServicePolicy.getName()}" />
+ message="Receive DELETE request for loop: ${header.loopName}" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog('Delete the closed loop')" />
+ <to
+ uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
+ <to uri="direct:load-loop" />
+ <to
+ uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Receive DELETE request','INFO',${header.LoopObject})" />
- <to uri="direct:delete-micro-service-policy" />
- </split>
+ <doTry>
+ <to uri="direct:remove-all-policy-from-active-pdp-group" />
+ <doCatch>
+ <exception>java.lang.Exception</exception>
+ <handled>
+ <constant>false</constant>
+ </handled>
+ <to uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
+ </doCatch>
+ </doTry>
- <log
- loggingLevel="INFO"
- message="Processing all OPERATIONAL policies defined in loop ${header.LoopObject.getName()}" />
- <split>
- <simple>${header.LoopObject.getOperationalPolicies()}
- </simple>
- <setHeader headerName="operationalPolicy">
- <simple>${body}</simple>
- </setHeader>
- <log
- loggingLevel="INFO"
- message="Processing Operational Policy: ${header.operationalPolicy.getName()}" />
+
+ <split>
+ <simple>${header.LoopObject.getMicroServicePolicies()}
+ </simple>
+ <setHeader headerName="microServicePolicy">
+ <simple>${body}</simple>
+ </setHeader>
+ <log
+ loggingLevel="INFO"
+ message="Processing Micro Service Policy: ${header.microServicePolicy.getName()}" />
+
+ <doTry>
+ <to uri="direct:delete-micro-service-policy" />
+ <doCatch>
+ <exception>java.lang.Exception</exception>
+ <handled>
+ <constant>false</constant>
+ </handled>
+ <to uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
+ </doCatch>
+ </doTry>
+
+ </split>
- <to uri="direct:delete-operational-policy" />
<log
loggingLevel="INFO"
- message="Processing all GUARD policies defined in loop ${header.LoopObject.getName()}" />
+ message="Processing all OPERATIONAL policies defined in loop ${header.LoopObject.getName()}" />
<split>
- <simple>${header.operationalPolicy.createGuardPolicyPayloads().entrySet()}
+ <simple>${header.LoopObject.getOperationalPolicies()}
</simple>
- <setHeader headerName="guardPolicy">
+ <setHeader headerName="operationalPolicy">
<simple>${body}</simple>
</setHeader>
<log
loggingLevel="INFO"
- message="Processing Guard Policy: ${header.guardPolicy.getKey()}" />
+ message="Processing Operational Policy: ${header.operationalPolicy.getName()}" />
+
+ <doTry>
+ <to uri="direct:delete-operational-policy" />
+ <doCatch>
+ <exception>java.lang.Exception</exception>
+ <handled>
+ <constant>false</constant>
+ </handled>
+ <to uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
+ </doCatch>
+ </doTry>
+
+ <log
+ loggingLevel="INFO"
+ message="Processing all GUARD policies defined in loop ${header.LoopObject.getName()}" />
+ <split>
+ <simple>${header.operationalPolicy.createGuardPolicyPayloads().entrySet()}
+ </simple>
+ <setHeader headerName="guardPolicy">
+ <simple>${body}</simple>
+ </setHeader>
+ <log
+ loggingLevel="INFO"
+ message="Processing Guard Policy: ${header.guardPolicy.getKey()}" />
- <to uri="direct:delete-guard-policy" />
+ <doTry>
+ <to uri="direct:delete-guard-policy" />
+ <doCatch>
+ <exception>java.lang.Exception</exception>
+ <handled>
+ <constant>false</constant>
+ </handled>
+ <to uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
+ </doCatch>
+ </doTry>
+
+ </split>
</split>
- </split>
- <to
- uri="bean:org.onap.clamp.loop.log.LoopService?method=deleteLoop(${header.loopName})" />
- <log
- loggingLevel="INFO"
- message="DELETE request successfully executed for loop: ${body}" />
- <to
- uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('DELETE request successfully executed','INFO',${header.LoopObject})" />
+ <to
+ uri="bean:org.onap.clamp.loop.log.LoopService?method=deleteLoop(${header.loopName})" />
+ <log
+ loggingLevel="INFO"
+ message="DELETE request successfully executed for loop: ${body}" />
+ <to
+ uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('DELETE request successfully executed','INFO',${header.LoopObject})" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
+ <doCatch>
+ <exception>java.lang.Exception</exception>
+ <handled>
+ <constant>false</constant>
+ </handled>
+ <to uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
+ </doCatch>
+ </doTry>
</route>
</put>
</rest>
</rests>
-
diff --git a/src/main/resources/clds/camel/routes/flexible-flow.xml b/src/main/resources/clds/camel/routes/flexible-flow.xml
index 683737af..808e1d8a 100644
--- a/src/main/resources/clds/camel/routes/flexible-flow.xml
+++ b/src/main/resources/clds/camel/routes/flexible-flow.xml
@@ -98,13 +98,14 @@
<stop />
</when>
</route>
-
<route id="create-micro-service-policy">
<from uri="direct:create-micro-service-policy" />
<log
loggingLevel="INFO"
message="Creating Micro Service Policy: ${header.microServicePolicy.getName()}" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Create Micro Service Policy')" />
<setBody>
<simple>${header.microServicePolicy.createPolicyPayload()}
</simple>
@@ -119,6 +120,18 @@
<simple>{{clamp.config.policy.url}}/policy/api/v1/policyTypes/${header.microServicePolicy.getModelType()}/versions/1.0.0/policies
</simple>
</setHeader>
+ <setHeader headerName="X-ONAP-RequestID">
+ <simple>${header.X-ONAP-REAUESTID}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-InvocationID">
+ <simple>${header.X-ONAP-InvocationID}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-PartnerName">
+ <simple>${header.X-ONAP-PartnerName}
+ </simple>
+ </setHeader>
<log
loggingLevel="INFO"
message="Endpoint to create microservice policy: ${header.CamelHttpMethod} ${header.CamelHttpUri}"></log>
@@ -127,6 +140,7 @@
<to
uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('MicroService policy created successfully','INFO',${header.LoopObject})" />
<to uri="direct:reset-raise-http-exception-flag" />
+ <to uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
</route>
<route id="delete-micro-service-policy">
<from uri="direct:delete-micro-service-policy" />
@@ -134,6 +148,8 @@
<log
loggingLevel="INFO"
message="Deleting Micro Service Policy: ${header.microServicePolicy.getName()}" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Delete Micro Service Policy')" />
<setBody>
<constant>null</constant>
</setBody>
@@ -144,6 +160,18 @@
<simple>{{clamp.config.policy.url}}/policy/api/v1/policyTypes/${header.microServicePolicy.getModelType()}/versions/1.0.0/policies/${header.microServicePolicy.getName()}
</simple>
</setHeader>
+ <setHeader headerName="X-ONAP-RequestID">
+ <simple>${header.X-ONAP-REAUESTID}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-InvocationID">
+ <simple>${header.X-ONAP-InvocationID}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-PartnerName">
+ <simple>${header.X-ONAP-PartnerName}
+ </simple>
+ </setHeader>
<log
loggingLevel="INFO"
message="Endpoint to delete microservice policy: ${header.CamelHttpMethod} ${header.CamelHttpUri}"></log>
@@ -152,6 +180,7 @@
<to
uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('MicroService policy deleted successfully','INFO',${header.LoopObject})" />
<to uri="direct:reset-raise-http-exception-flag" />
+ <to uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
</route>
<route id="create-operational-policy">
@@ -160,6 +189,8 @@
<log
loggingLevel="INFO"
message="Creating Operational Policy: ${header.operationalPolicy.getName()}" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Create Operational Policy')" />
<setBody>
<simple>${header.operationalPolicy.createPolicyPayload()}
</simple>
@@ -174,6 +205,18 @@
<simple>{{clamp.config.policy.url}}/policy/api/v1/policyTypes/onap.policies.controloop.operational/versions/1.0.0/policies
</simple>
</setHeader>
+ <setHeader headerName="X-ONAP-RequestID">
+ <simple>${header.X-ONAP-REAUESTID}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-InvocationID">
+ <simple>${header.X-ONAP-InvocationID}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-PartnerName">
+ <simple>${header.X-ONAP-PartnerName}
+ </simple>
+ </setHeader>
<log
loggingLevel="INFO"
message="Endpoint to create operational policy: ${header.CamelHttpMethod} ${header.CamelHttpUri}"></log>
@@ -182,6 +225,7 @@
<to
uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Operational policy created successfully','INFO',${header.LoopObject})" />
<to uri="direct:reset-raise-http-exception-flag" />
+ <to uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
</route>
<route id="delete-operational-policy">
<from uri="direct:delete-operational-policy" />
@@ -189,6 +233,8 @@
<log
loggingLevel="INFO"
message="Deleting Operational Policy: ${header.operationalPolicy.getName()}" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Delete Operational Policy')" />
<setBody>
<constant>null</constant>
</setBody>
@@ -199,6 +245,18 @@
<simple>{{clamp.config.policy.url}}/policy/api/v1/policyTypes/onap.policies.controloop.operational/versions/1.0.0/policies/${header.operationalPolicy.getName()}
</simple>
</setHeader>
+ <setHeader headerName="X-ONAP-RequestID">
+ <simple>${header.X-ONAP-REAUESTID}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-InvocationID">
+ <simple>${header.X-ONAP-InvocationID}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-PartnerName">
+ <simple>${header.X-ONAP-PartnerName}
+ </simple>
+ </setHeader>
<log
loggingLevel="INFO"
message="Endpoint to delete operational policy: ${header.CamelHttpMethod} ${header.CamelHttpUri}"></log>
@@ -207,6 +265,7 @@
<to
uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Operational policy deleted successfully','INFO',${header.LoopObject})" />
<to uri="direct:reset-raise-http-exception-flag" />
+ <to uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
</route>
<route id="create-guard-policy">
@@ -215,6 +274,8 @@
<log
loggingLevel="INFO"
message="Creating Guard Policy: ${header.guardPolicy.getKey()}" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Create Guard Policy')" />
<setBody>
<simple>${header.guardPolicy.getValue()}
</simple>
@@ -229,6 +290,18 @@
<simple>{{clamp.config.policy.url}}/policy/api/v1/policyTypes/onap.policies.controlloop.Guard/versions/1.0.0/policies
</simple>
</setHeader>
+ <setHeader headerName="X-ONAP-RequestID">
+ <simple>${header.X-ONAP-REAUESTID}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-InvocationID">
+ <simple>${header.X-ONAP-InvocationID}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-PartnerName">
+ <simple>${header.X-ONAP-PartnerName}
+ </simple>
+ </setHeader>
<log
loggingLevel="INFO"
message="Endpoint to create guard policy: ${header.CamelHttpMethod} ${header.CamelHttpUri}"></log>
@@ -237,6 +310,7 @@
<to
uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Guard policy created successfully','INFO',${header.LoopObject})" />
<to uri="direct:reset-raise-http-exception-flag" />
+ <to uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
</route>
<route id="delete-guard-policy">
<from uri="direct:delete-guard-policy" />
@@ -244,6 +318,8 @@
<log
loggingLevel="INFO"
message="Deleting Guard Policy: ${header.guardPolicy.getKey()}" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Delete Guard Policy')" />
<setBody>
<constant>null</constant>
</setBody>
@@ -254,6 +330,18 @@
<simple>{{clamp.config.policy.url}}/policy/api/v1/policyTypes/onap.policies.controlloop.Guard/versions/1.0.0/policies/${header.guardPolicy.getKey()}
</simple>
</setHeader>
+ <setHeader headerName="X-ONAP-RequestID">
+ <simple>${header.X-ONAP-REAUESTID}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-InvocationID">
+ <simple>${header.X-ONAP-InvocationID}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-PartnerName">
+ <simple>${header.X-ONAP-PartnerName}
+ </simple>
+ </setHeader>
<log
loggingLevel="INFO"
message="Endpoint to delete guard policy: ${header.CamelHttpMethod} ${header.CamelHttpUri}"></log>
@@ -262,6 +350,7 @@
<to
uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Guard policy deleted successfully','INFO',${header.LoopObject})" />
<to uri="direct:reset-raise-http-exception-flag" />
+ <to uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
</route>
<route id="add-all-to-active-pdp-group">
<from uri="direct:add-all-to-active-pdp-group" />
@@ -269,6 +358,8 @@
<log
loggingLevel="INFO"
message="Adding loop policies to PDP Group: ${header.LoopObject.getName()}" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Add policies to PDP group')" />
<setBody>
<simple>${header.LoopObject.createPoliciesPayloadPdpGroup()}
</simple>
@@ -283,6 +374,18 @@
<simple>{{clamp.config.policy.url}}/policy/pap/v1/pdps
</simple>
</setHeader>
+ <setHeader headerName="X-ONAP-RequestID">
+ <simple>${header.X-ONAP-REAUESTID}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-InvocationID">
+ <simple>${header.X-ONAP-InvocationID}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-PartnerName">
+ <simple>${header.X-ONAP-PartnerName}
+ </simple>
+ </setHeader>
<log
loggingLevel="INFO"
message="Endpoint to add policies to PDP Group: ${header.CamelHttpMethod} ${header.CamelHttpUri}"></log>
@@ -291,6 +394,7 @@
<to
uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Policies pushed to PDP Group successfully','INFO',${header.LoopObject})" />
<to uri="direct:reset-raise-http-exception-flag" />
+ <to uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
</route>
<route id="remove-all-policy-from-active-pdp-group">
@@ -298,6 +402,8 @@
<log
loggingLevel="INFO"
message="Removing policies from active PDP group for loop: ${header.LoopObject.getName()}" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Removing policies PDP group')" />
<split>
<simple>${header.LoopObject.listPolicyNamesPdpGroup()}</simple>
<setHeader headerName="PolicyName">
@@ -313,6 +419,18 @@
<simple>{{clamp.config.policy.url}}/pdps/policies/${header.PolicyName}/versions/1.0.0
</simple>
</setHeader>
+ <setHeader headerName="X-ONAP-RequestID">
+ <simple>${header.X-ONAP-REAUESTID}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-InvocationID">
+ <simple>${header.X-ONAP-InvocationID}
+ </simple>
+ </setHeader>
+ <setHeader headerName="X-ONAP-PartnerName">
+ <simple>${header.X-ONAP-PartnerName}
+ </simple>
+ </setHeader>
<log
loggingLevel="INFO"
message="Endpoint to delete policy from PDP Group: ${header.CamelHttpMethod} ${header.CamelHttpUri}"></log>
@@ -322,8 +440,8 @@
uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog(${header.PolicyName}' Policy removed from PDP Group successfully','INFO',${header.LoopObject})" />
</split>
<to uri="direct:reset-raise-http-exception-flag" />
+ <to uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
</route>
-
<route id="reset-raise-http-exception-flag">
<from uri="direct:reset-raise-http-exception-flag" />
<setHeader headerName="RaiseHttpExceptionFlag">
diff --git a/src/main/resources/logback-default.xml b/src/main/resources/logback-default.xml
index c2524bec..2eba127e 100644
--- a/src/main/resources/logback-default.xml
+++ b/src/main/resources/logback-default.xml
@@ -144,7 +144,7 @@
<appender-ref ref="DEBUG" />
</logger>
<!-- CLDS related loggers -->
- <logger name="org.onap.clamp.clds" level="INFO"
+ <logger name="org.onap.clamp" level="INFO"
additivity="true">
<appender-ref ref="ERROR" />
</logger>