summaryrefslogtreecommitdiffstats
path: root/aai-service
diff options
context:
space:
mode:
authorvaibhav.jain1 <vaibhav.jain1@amdocs.com>2017-08-31 17:16:54 +0530
committervaibhav.jain1 <vaibhav.jain1@amdocs.com>2017-09-06 12:27:01 +0530
commitcf70dde69807ca143fc360cf572b2d6bf887010f (patch)
tree0bc386a59587887abcfc071f96bf34fdf816ddea /aai-service
parent6fbbf0193e7389c80d85c205f1edd9af6ac0e431 (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')
-rw-r--r--aai-service/provider/src/main/java/org/onap/ccsdk/sli/adaptors/aai/AAIService.java11
-rw-r--r--aai-service/provider/src/test/resources/aaiclient.properties2
2 files changed, 9 insertions, 4 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;
}
diff --git a/aai-service/provider/src/test/resources/aaiclient.properties b/aai-service/provider/src/test/resources/aaiclient.properties
index 732a96d0..bf0ab4e1 100644
--- a/aai-service/provider/src/test/resources/aaiclient.properties
+++ b/aai-service/provider/src/test/resources/aaiclient.properties
@@ -35,7 +35,7 @@ org.onap.ccsdk.sli.adaptors.aai.host.certificate.ignore=true
org.onap.ccsdk.sli.adaptors.aai.client.name=SDNC
org.onap.ccsdk.sli.adaptors.aai.client.psswd=SDNC
-org.onap.ccsdk.sli.adaptors.aai.application=openECOMP
+org.onap.ccsdk.sli.adaptors.aai.application=CCSDK
#
# Configuration file for A&AI Client