diff options
author | vaibhav.jain1 <vaibhav.jain1@amdocs.com> | 2017-08-31 17:16:54 +0530 |
---|---|---|
committer | vaibhav.jain1 <vaibhav.jain1@amdocs.com> | 2017-09-06 12:27:01 +0530 |
commit | cf70dde69807ca143fc360cf572b2d6bf887010f (patch) | |
tree | 0bc386a59587887abcfc071f96bf34fdf816ddea /aai-service/provider/src/main | |
parent | 6fbbf0193e7389c80d85c205f1edd9af6ac0e431 (diff) |
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 <vaibhav.jain1@amdocs.com>
Diffstat (limited to 'aai-service/provider/src/main')
-rw-r--r-- | aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIService.java | 11 |
1 files changed, 8 insertions, 3 deletions
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 46e03df3..3090e498 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; } |