aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOCommonBPMN/src/main/groovy/org
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/MSOCommonBPMN/src/main/groovy/org')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AaiUtil.groovy12
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/DeleteAAIVfModule.groovy9
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/MsoUtils.groovy21
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy5
4 files changed, 35 insertions, 12 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AaiUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AaiUtil.groovy
index b50bf68207..af650b49a4 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AaiUtil.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AaiUtil.groovy
@@ -296,7 +296,7 @@ class AaiUtil {
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
taskProcessor.logDebug(" ======== STARTED Execute AAI Get Process ======== ", isDebugEnabled)
try{
- String uuid = UUID.randomUUID()
+ String uuid = utils.getRequestID()
taskProcessor.logDebug( "Generated uuid is: " + uuid, isDebugEnabled)
taskProcessor.logDebug( "URL to be used is: " + url, isDebugEnabled)
@@ -335,7 +335,7 @@ class AaiUtil {
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
taskProcessor.logDebug( " ======== Started Execute AAI Put Process ======== ", isDebugEnabled)
try{
- String uuid = UUID.randomUUID()
+ String uuid = utils.getRequestID()
taskProcessor.logDebug( "Generated uuid is: " + uuid, isDebugEnabled)
taskProcessor.logDebug( "URL to be used is: " + url, isDebugEnabled)
@@ -371,7 +371,7 @@ class AaiUtil {
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
taskProcessor.logDebug( " ======== Started Execute AAI Patch Process ======== ", isDebugEnabled)
try{
- String uuid = UUID.randomUUID()
+ String uuid = utils.getRequestID()
taskProcessor.logDebug( "Generated uuid is: " + uuid, isDebugEnabled)
taskProcessor.logDebug( "URL to be used is: " + url, isDebugEnabled)
@@ -408,7 +408,7 @@ class AaiUtil {
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
taskProcessor.logDebug( " ======== Started Execute AAI Delete Process ======== ", isDebugEnabled)
try{
- String uuid = UUID.randomUUID()
+ String uuid = utils.getRequestID()
taskProcessor.logDebug( "Generated uuid is: " + uuid, isDebugEnabled)
taskProcessor.logDebug( "URL to be used is: " + url, isDebugEnabled)
@@ -445,7 +445,7 @@ class AaiUtil {
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
taskProcessor.logDebug( " ======== Started Execute AAI Delete Process ======== ", isDebugEnabled)
try{
- String uuid = UUID.randomUUID()
+ String uuid = utils.getRequestID()
taskProcessor.logDebug( "Generated uuid is: " + uuid, isDebugEnabled)
taskProcessor.logDebug( "URL to be used is: " + url, isDebugEnabled)
@@ -483,7 +483,7 @@ class AaiUtil {
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
taskProcessor.logDebug( " ======== Started Execute AAI Post Process ======== ", isDebugEnabled)
try{
- String uuid = UUID.randomUUID()
+ String uuid = utils.getRequestID()
taskProcessor.logDebug( "Generated uuid is: " + uuid, isDebugEnabled)
taskProcessor.logDebug( "URL to be used is: " + url, isDebugEnabled)
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/DeleteAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/DeleteAAIVfModule.groovy
index 72ad1402e1..aaac86c8c9 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/DeleteAAIVfModule.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/DeleteAAIVfModule.groovy
@@ -29,7 +29,8 @@ import org.openecomp.mso.rest.RESTConfig;
public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
def Prefix="DAAIVfMod_"
- ExceptionUtil exceptionUtil = new ExceptionUtil()
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ private MsoUtils utils = new MsoUtils()
public void initProcessVariables(Execution execution) {
execution.setVariable("prefix",Prefix)
execution.setVariable("DAAIVfMod_vnfId",null)
@@ -83,7 +84,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
def delModuleId = execution.getVariable("DAAIVfMod_vfModuleId")
def endPoint = execution.getVariable("URN_aai_endpoint") + execution.getVariable("DAAIVfMod_genericVnfEndpoint") + "?depth=1"
utils.logAudit("DeleteAAIVfModule endPoint: " + endPoint)
- def aaiRequestId = UUID.randomUUID().toString()
+ def aaiRequestId = utils.getRequestID()
RESTConfig config = new RESTConfig(endPoint);
utils.log("DEBUG","queryAAIForGenericVnf() endpoint-" + endPoint, isDebugEnabled)
@@ -118,7 +119,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
// note: to get here, all the modules associated with the Generic Vnf must already be deleted
public void deleteGenericVnf(Execution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- def aaiRequestId = UUID.randomUUID().toString()
+ def aaiRequestId = utils.getRequestID()
def endPoint = execution.getVariable("URN_aai_endpoint") + execution.getVariable("DAAIVfMod_genericVnfEndpoint") +
"/?resource-version=" + execution.getVariable("DAAIVfMod_genVnfRsrcVer")
utils.logAudit("AAI endPoint: " + endPoint)
@@ -153,7 +154,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
def endPoint = execution.getVariable("URN_aai_endpoint") + execution.getVariable("DAAIVfMod_vfModuleEndpoint") +
"/?resource-version=" + execution.getVariable("DAAIVfMod_vfModRsrcVer")
- def aaiRequestId = UUID.randomUUID().toString()
+ def aaiRequestId = utils.getRequestID()
RESTConfig config = new RESTConfig(endPoint);
utils.log("DEBUG","deleteVfModule() endpoint-" + endPoint, isDebugEnabled)
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/MsoUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/MsoUtils.groovy
index a0256d33e9..26c30491bc 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/MsoUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/MsoUtils.groovy
@@ -30,6 +30,7 @@ import org.openecomp.mso.bpmn.core.xml.XmlTool
import org.openecomp.mso.logger.MessageEnum
import org.openecomp.mso.logger.MsoLogger
import org.openecomp.mso.utils.CryptoUtils
+import org.slf4j.MDC
import org.w3c.dom.Element
class MsoUtils {
@@ -947,5 +948,25 @@ class MsoUtils {
}
return sortedModuleIndexList.size().toString()
}
+ /**
+ * This utility checks if there is transaction id already present in MDC.
+ * If found, it returns same else creates new, sets in MDC for future use before returning
+ * @return String RequestId in UUID format.
+ */
+ public String getRequestID()
+ {
+ String requestId = MDC.get("RequestId")
+ if(requestId == null || requestId.isEmpty())
+ {
+ requestId = java.util.UUID.randomUUID()
+ MDC.put("RequestId",requestId)
+ log("DEBUG","MsoUtils - Created new RequestId: " + requestId)
+ }
+ else
+ {
+ log("DEBUG","MsoUtils - Using existing RequestId: " + requestId)
+ }
+ return requestId
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy
index f30692c409..14732fbfb5 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy
@@ -31,6 +31,7 @@ import org.springframework.web.util.UriUtils
public class PrepareUpdateAAIVfModule extends VfModuleBase {
ExceptionUtil exceptionUtil = new ExceptionUtil()
+ private MsoUtils utils = new MsoUtils()
/**
* Initialize the flow's variables.
*
@@ -116,7 +117,7 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase {
try {
RESTConfig config = new RESTConfig(endPoint);
def responseData = ''
- def aaiRequestId = UUID.randomUUID().toString()
+ String aaiRequestId = utils.getRequestID()
RESTClient client = new RESTClient(config).
addHeader('X-TransactionId', aaiRequestId).
addHeader('X-FromAppId', 'MSO').
@@ -255,7 +256,7 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase {
try {
RESTConfig config = new RESTConfig(endPoint);
def responseData = ''
- def aaiRequestId = UUID.randomUUID().toString()
+ def aaiRequestId = utils.getRequestID()
RESTClient client = new RESTClient(config).
addHeader('X-TransactionId', aaiRequestId).
addHeader('X-FromAppId', 'MSO').