From cf70dde69807ca143fc360cf572b2d6bf887010f Mon Sep 17 00:00:00 2001 From: "vaibhav.jain1" Date: Thu, 31 Aug 2017 17:16:54 +0530 Subject: CCSDK propagation of RequestID & PartnrName to AAI Currently, CCSDK generates a random uuid for every request to AAI using method getNextTransactionId() in class AAIService.java. A change is made to first get the RequestId value from MDC and if this is missing, a new RequestId is generated and set as MDC. Also, X-FromAppId is set as openECOMP which is very much generic. This has been changed to CCSDK in file aaiclient.properties Change-Id: Id269de708919de9dbabd019785e22afa0561abba Issue-ID: SDNC-68 Signed-off-by: vaibhav.jain1 --- .../main/java/org/onap/ccsdk/sli/adaptors/aai/AAIService.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'aai-service/provider/src/main') diff --git a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIService.java b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIService.java index 46e03df36..3090e4981 100644 --- a/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIService.java +++ b/aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIService.java @@ -109,6 +109,7 @@ import org.onap.ccsdk.sli.adaptors.aai.data.notify.NotifyEvent; import org.onap.ccsdk.sli.adaptors.aai.data.v1507.VServer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.slf4j.MDC; import com.fasterxml.jackson.annotation.JsonInclude.Include; import com.fasterxml.jackson.databind.AnnotationIntrospector; @@ -673,9 +674,13 @@ public class AAIService extends AAIDeclarations implements AAIClient, SvcLogicRe // protected static AtomicLong tracker = new AtomicLong(); public static String getNextTransactionId() { -// long id = tracker.getAndIncrement(); -// String transactionId = String.format("N%016X", id); - String transactionId = UUID.randomUUID().toString(); + // Check if RequestId exists as MDC. If not, create new. + String transactionId = MDC.get("RequestId"); + if ("".equals(transactionId) || transactionId == null) { + transactionId = UUID.randomUUID().toString(); + LOG.info("Missing requestID. Assigned " + transactionId); + MDC.put("RequestId", transactionId); + } return transactionId; } -- cgit 1.2.3-korg