summaryrefslogtreecommitdiffstats
path: root/vnfapi/provider/src/main
diff options
context:
space:
mode:
authorvaibhav.jain1 <vaibhav.jain1@amdocs.com>2017-09-13 10:32:02 +0530
committervaibhav.jain1 <vaibhav.jain1@amdocs.com>2017-09-14 11:53:17 +0530
commit329e3595d6a08cc31cdc532282b98aec3a9f98fa (patch)
treeaf1c4516a00b1629472de578a1ad806c64ce3a89 /vnfapi/provider/src/main
parent8e779f4fe71c07e6d13d4d1ad3a9ac5295c53651 (diff)
Set RequestId as MDC in SDNC
SDNC dosen't set RequestId as MDC whereas it logs it into the log message as svcRequestId. A change has been made to set RequestId as MDC so that it propagates throughout the flow. Change-Id: I0b66958f3ece2a90e11d2986cfd5bbd0858d27ce Issue-ID: SO-87 Signed-off-by: vaibhav.jain1 <vaibhav.jain1@amdocs.com>
Diffstat (limited to 'vnfapi/provider/src/main')
-rw-r--r--vnfapi/provider/src/main/java/org/onap/sdnc/vnfapi/vnfapiProvider.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/vnfapi/provider/src/main/java/org/onap/sdnc/vnfapi/vnfapiProvider.java b/vnfapi/provider/src/main/java/org/onap/sdnc/vnfapi/vnfapiProvider.java
index 9893235a..60d7e886 100644
--- a/vnfapi/provider/src/main/java/org/onap/sdnc/vnfapi/vnfapiProvider.java
+++ b/vnfapi/provider/src/main/java/org/onap/sdnc/vnfapi/vnfapiProvider.java
@@ -139,6 +139,7 @@ import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
import com.google.common.base.Optional;
import com.google.common.util.concurrent.CheckedFuture;
@@ -1002,6 +1003,11 @@ public class vnfapiProvider implements AutoCloseable, VNFAPIService, DataChangeL
}
}
+ //Save the requestId into MDC
+ private void setRequestIdAsMDC(String requestId){
+ MDC.put("RequestId", requestId);
+ }
+
//1610 vnf-instance-topology-operation
@Override
public Future<RpcResult<VnfInstanceTopologyOperationOutput>> vnfInstanceTopologyOperation(
@@ -1050,6 +1056,7 @@ public class vnfapiProvider implements AutoCloseable, VNFAPIService, DataChangeL
if (input.getSdncRequestHeader() != null) {
responseBuilder.setSvcRequestId(input.getSdncRequestHeader().getSvcRequestId());
+ setRequestIdAsMDC(input.getSdncRequestHeader().getSvcRequestId());
}
// Get vnf-instance-preload-data
@@ -1280,6 +1287,7 @@ public class vnfapiProvider implements AutoCloseable, VNFAPIService, DataChangeL
if (input.getSdncRequestHeader() != null) {
responseBuilder.setSvcRequestId(input.getSdncRequestHeader().getSvcRequestId());
+ setRequestIdAsMDC(input.getSdncRequestHeader().getSvcRequestId());
}
// Get vf-module-preload-data
@@ -1534,6 +1542,7 @@ public class vnfapiProvider implements AutoCloseable, VNFAPIService, DataChangeL
if (input.getSdncRequestHeader() != null) {
responseBuilder.setSvcRequestId(input.getSdncRequestHeader().getSvcRequestId());
+ setRequestIdAsMDC(input.getSdncRequestHeader().getSvcRequestId());
}
PreloadDataBuilder preloadDataBuilder = new PreloadDataBuilder();
@@ -1768,6 +1777,7 @@ public class vnfapiProvider implements AutoCloseable, VNFAPIService, DataChangeL
if (input.getSdncRequestHeader() != null) {
responseBuilder.setSvcRequestId(input.getSdncRequestHeader().getSvcRequestId());
+ setRequestIdAsMDC(input.getSdncRequestHeader().getSvcRequestId());
}
PreloadDataBuilder preloadDataBuilder = new PreloadDataBuilder();
@@ -1931,6 +1941,7 @@ public class vnfapiProvider implements AutoCloseable, VNFAPIService, DataChangeL
if (input.getSdncRequestHeader() != null) {
responseBuilder.setSvcRequestId(input.getSdncRequestHeader().getSvcRequestId());
+ setRequestIdAsMDC(input.getSdncRequestHeader().getSvcRequestId());
}
PreloadDataBuilder preloadDataBuilder = new PreloadDataBuilder();
@@ -2125,6 +2136,7 @@ public class vnfapiProvider implements AutoCloseable, VNFAPIService, DataChangeL
if (input.getSdncRequestHeader() != null) {
responseBuilder.setSvcRequestId(input.getSdncRequestHeader().getSvcRequestId());
+ setRequestIdAsMDC(input.getSdncRequestHeader().getSvcRequestId());
}
VnfInstancePreloadDataBuilder vnfInstancePreloadDataBuilder = new VnfInstancePreloadDataBuilder();
@@ -2320,6 +2332,7 @@ public class vnfapiProvider implements AutoCloseable, VNFAPIService, DataChangeL
if (input.getSdncRequestHeader() != null) {
responseBuilder.setSvcRequestId(input.getSdncRequestHeader().getSvcRequestId());
+ setRequestIdAsMDC(input.getSdncRequestHeader().getSvcRequestId());
}
VfModulePreloadDataBuilder vfModulePreloadDataBuilder = new VfModulePreloadDataBuilder();
@@ -2510,6 +2523,7 @@ public class vnfapiProvider implements AutoCloseable, VNFAPIService, DataChangeL
if (input.getSdncRequestHeader() != null) {
responseBuilder.setSvcRequestId(input.getSdncRequestHeader().getSvcRequestId());
+ setRequestIdAsMDC(input.getSdncRequestHeader().getSvcRequestId());
}
PreloadDataBuilder preloadDataBuilder = new PreloadDataBuilder();
@@ -2647,4 +2661,5 @@ public class vnfapiProvider implements AutoCloseable, VNFAPIService, DataChangeL
RpcResultBuilder.<PreloadNetworkTopologyOperationOutput> status(true).withResult(responseBuilder.build()).build();
return Futures.immediateFuture(rpcResult);
}
+
}