summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterAsyncImpl.java27
-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
5 files changed, 47 insertions, 27 deletions
diff --git a/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterAsyncImpl.java b/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterAsyncImpl.java
index c643443791..d697182c90 100644
--- a/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterAsyncImpl.java
+++ b/adapters/mso-network-adapter/src/main/java/org/openecomp/mso/adapters/network/MsoNetworkAdapterAsyncImpl.java
@@ -61,7 +61,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
CloudConfigFactory cloudConfigFactory=new CloudConfigFactory();
public static final String MSO_PROP_NETWORK_ADAPTER="MSO_PROP_NETWORK_ADAPTER";
- private static MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger ();
private static final String BPEL_AUTH_PROP = "org.openecomp.mso.adapters.network.bpelauth";
private static final String ENCRYPTION_KEY = "aa3871669d893c7fb8abbcda31b88b4f";
@@ -116,8 +116,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
MsoRequest msoRequest,
String notificationUrl) {
String error;
- // Will capture execution time for metrics
- long startTime = System.currentTimeMillis ();
+
MsoLogger.setLogContext (msoRequest);
MsoLogger.setServiceName ("CreateNetworkA");
LOGGER.debug ("Async Create Network: " + networkName
@@ -234,8 +233,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
MsoRequest msoRequest,
String notificationUrl) {
String error;
- // Will capture execution time for metrics
- long startTime = System.currentTimeMillis ();
+
String serviceName = "UpdateNetworkA";
MsoLogger.setServiceName (serviceName);
MsoLogger.setLogContext (msoRequest);
@@ -251,8 +249,8 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
MsoNetworkAdapter networkAdapter = new MsoNetworkAdapterImpl (msoPropertiesFactory,cloudConfigFactory);
// Synchronous Web Service Outputs
- Holder <NetworkRollback> networkRollback = new Holder <NetworkRollback> ();
- Holder <Map <String, String>> subnetIdMap = new Holder <Map <String, String>> ();
+ Holder <NetworkRollback> networkRollback = new Holder <> ();
+ Holder <Map <String, String>> subnetIdMap = new Holder <> ();
try {
networkAdapter.updateNetwork (cloudSiteId,
@@ -323,8 +321,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
MsoRequest msoRequest,
String notificationUrl) {
String error;
- // Will capture execution time for metrics
- long startTime = System.currentTimeMillis ();
+
MsoLogger.setLogContext (msoRequest);
String serviceName = "QueryNetworkA";
MsoLogger.setServiceName (serviceName);
@@ -334,12 +331,12 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
MsoNetworkAdapter networkAdapter = new MsoNetworkAdapterImpl (msoPropertiesFactory,cloudConfigFactory);
// Synchronous Web Service Outputs
- Holder <Boolean> networkExists = new Holder <Boolean> ();
- Holder <String> networkId = new Holder <String> ();
- Holder <String> neutronNetworkId = new Holder <String> ();
- Holder <NetworkStatus> status = new Holder <NetworkStatus> ();
- Holder <List <Integer>> vlans = new Holder <List <Integer>> ();
- Holder <Map <String, String>> subnetIdMap = new Holder <Map <String, String>> ();
+ Holder <Boolean> networkExists = new Holder <> ();
+ Holder <String> networkId = new Holder <> ();
+ Holder <String> neutronNetworkId = new Holder <> ();
+ Holder <NetworkStatus> status = new Holder <> ();
+ Holder <List <Integer>> vlans = new Holder <> ();
+ Holder <Map <String, String>> subnetIdMap = new Holder <> ();
try {
networkAdapter.queryNetwork (cloudSiteId,
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').