def isDebugEnabled = execution.getVariable("isDebugLogEnabled")\r
taskProcessor.logDebug(" ======== STARTED Execute AAI Get Process ======== ", isDebugEnabled)\r
try{\r
- String uuid = UUID.randomUUID()\r
+ String uuid = utils.getRequestID()\r
taskProcessor.logDebug( "Generated uuid is: " + uuid, isDebugEnabled)\r
taskProcessor.logDebug( "URL to be used is: " + url, isDebugEnabled)\r
\r
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")\r
taskProcessor.logDebug( " ======== Started Execute AAI Put Process ======== ", isDebugEnabled)\r
try{\r
- String uuid = UUID.randomUUID()\r
+ String uuid = utils.getRequestID()\r
taskProcessor.logDebug( "Generated uuid is: " + uuid, isDebugEnabled)\r
taskProcessor.logDebug( "URL to be used is: " + url, isDebugEnabled)\r
\r
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")\r
taskProcessor.logDebug( " ======== Started Execute AAI Patch Process ======== ", isDebugEnabled)\r
try{\r
- String uuid = UUID.randomUUID()\r
+ String uuid = utils.getRequestID()\r
taskProcessor.logDebug( "Generated uuid is: " + uuid, isDebugEnabled)\r
\r
taskProcessor.logDebug( "URL to be used is: " + url, isDebugEnabled)\r
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")\r
taskProcessor.logDebug( " ======== Started Execute AAI Delete Process ======== ", isDebugEnabled)\r
try{\r
- String uuid = UUID.randomUUID()\r
+ String uuid = utils.getRequestID()\r
taskProcessor.logDebug( "Generated uuid is: " + uuid, isDebugEnabled)\r
taskProcessor.logDebug( "URL to be used is: " + url, isDebugEnabled)\r
\r
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")\r
taskProcessor.logDebug( " ======== Started Execute AAI Delete Process ======== ", isDebugEnabled)\r
try{\r
- String uuid = UUID.randomUUID()\r
+ String uuid = utils.getRequestID()\r
taskProcessor.logDebug( "Generated uuid is: " + uuid, isDebugEnabled)\r
\r
taskProcessor.logDebug( "URL to be used is: " + url, isDebugEnabled)\r
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")\r
taskProcessor.logDebug( " ======== Started Execute AAI Post Process ======== ", isDebugEnabled)\r
try{\r
- String uuid = UUID.randomUUID()\r
+ String uuid = utils.getRequestID()\r
taskProcessor.logDebug( "Generated uuid is: " + uuid, isDebugEnabled)\r
taskProcessor.logDebug( "URL to be used is: " + url, isDebugEnabled)\r
\r
public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{\r
\r
def Prefix="DAAIVfMod_"\r
- ExceptionUtil exceptionUtil = new ExceptionUtil() \r
+ ExceptionUtil exceptionUtil = new ExceptionUtil()\r
+ private MsoUtils utils = new MsoUtils()\r
public void initProcessVariables(Execution execution) {\r
execution.setVariable("prefix",Prefix)\r
execution.setVariable("DAAIVfMod_vnfId",null)\r
def delModuleId = execution.getVariable("DAAIVfMod_vfModuleId")\r
def endPoint = execution.getVariable("URN_aai_endpoint") + execution.getVariable("DAAIVfMod_genericVnfEndpoint") + "?depth=1"\r
utils.logAudit("DeleteAAIVfModule endPoint: " + endPoint)\r
- def aaiRequestId = UUID.randomUUID().toString()\r
+ def aaiRequestId = utils.getRequestID()\r
\r
RESTConfig config = new RESTConfig(endPoint);\r
utils.log("DEBUG","queryAAIForGenericVnf() endpoint-" + endPoint, isDebugEnabled)\r
// note: to get here, all the modules associated with the Generic Vnf must already be deleted\r
public void deleteGenericVnf(Execution execution) {\r
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
- def aaiRequestId = UUID.randomUUID().toString()\r
+ def aaiRequestId = utils.getRequestID()\r
def endPoint = execution.getVariable("URN_aai_endpoint") + execution.getVariable("DAAIVfMod_genericVnfEndpoint") +\r
"/?resource-version=" + execution.getVariable("DAAIVfMod_genVnfRsrcVer")\r
utils.logAudit("AAI endPoint: " + endPoint)\r
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")\r
def endPoint = execution.getVariable("URN_aai_endpoint") + execution.getVariable("DAAIVfMod_vfModuleEndpoint") +\r
"/?resource-version=" + execution.getVariable("DAAIVfMod_vfModRsrcVer")\r
- def aaiRequestId = UUID.randomUUID().toString()\r
+ def aaiRequestId = utils.getRequestID()\r
\r
RESTConfig config = new RESTConfig(endPoint);\r
utils.log("DEBUG","deleteVfModule() endpoint-" + endPoint, isDebugEnabled)\r
import org.openecomp.mso.logger.MessageEnum\r
import org.openecomp.mso.logger.MsoLogger\r
import org.openecomp.mso.utils.CryptoUtils\r
+import org.slf4j.MDC\r
import org.w3c.dom.Element\r
\r
class MsoUtils {\r
}\r
return sortedModuleIndexList.size().toString()\r
}\r
+ /**\r
+ * This utility checks if there is transaction id already present in MDC.\r
+ * If found, it returns same else creates new, sets in MDC for future use before returning\r
+ * @return String RequestId in UUID format.\r
+ */\r
+ public String getRequestID()\r
+ {\r
+ String requestId = MDC.get("RequestId")\r
+ if(requestId == null || requestId.isEmpty())\r
+ {\r
+ requestId = java.util.UUID.randomUUID()\r
+ MDC.put("RequestId",requestId)\r
+ log("DEBUG","MsoUtils - Created new RequestId: " + requestId)\r
+ }\r
+ else\r
+ {\r
+ log("DEBUG","MsoUtils - Using existing RequestId: " + requestId)\r
+ }\r
\r
+ return requestId\r
+ }\r
}\r
public class PrepareUpdateAAIVfModule extends VfModuleBase {\r
\r
ExceptionUtil exceptionUtil = new ExceptionUtil()\r
+ private MsoUtils utils = new MsoUtils()\r
/**\r
* Initialize the flow's variables.\r
* \r
try {\r
RESTConfig config = new RESTConfig(endPoint);\r
def responseData = ''\r
- def aaiRequestId = UUID.randomUUID().toString()\r
+ String aaiRequestId = utils.getRequestID()\r
RESTClient client = new RESTClient(config).\r
addHeader('X-TransactionId', aaiRequestId).\r
addHeader('X-FromAppId', 'MSO').\r
try {\r
RESTConfig config = new RESTConfig(endPoint);\r
def responseData = ''\r
- def aaiRequestId = UUID.randomUUID().toString()\r
+ def aaiRequestId = utils.getRequestID()\r
RESTClient client = new RESTClient(config).\r
addHeader('X-TransactionId', aaiRequestId).\r
addHeader('X-FromAppId', 'MSO').\r