diff options
9 files changed, 58 insertions, 30 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/aria/aria-rest-server/src/main/python/aria-rest/setup.py b/aria/aria-rest-server/src/main/python/aria-rest/setup.py index 8c80a9004d..4bb79cc1d9 100644 --- a/aria/aria-rest-server/src/main/python/aria-rest/setup.py +++ b/aria/aria-rest-server/src/main/python/aria-rest/setup.py @@ -24,7 +24,7 @@ setup( name='aria-rest', version='0.1', author='dewayne', - author_email='dewayne@gigaspaces.com', + author_email='dewayne@cloudify.co', packages=[ 'aria_rest' ], @@ -36,6 +36,6 @@ setup( install_requires=[ 'Flask==0.12.2', 'flask-autodoc==0.1.2', - 'apache-ariatosca==0.1.0' + 'apache-ariatosca==0.2.0' ] ) diff --git a/aria/multivim-plugin/openstack_plugin_common/__init__.py b/aria/multivim-plugin/openstack_plugin_common/__init__.py index 353b2be03f..6ed7daac0b 100644 --- a/aria/multivim-plugin/openstack_plugin_common/__init__.py +++ b/aria/multivim-plugin/openstack_plugin_common/__init__.py @@ -40,7 +40,7 @@ INFINITE_RESOURCE_QUOTA = -1 # properties USE_EXTERNAL_RESOURCE_PROPERTY = 'use_external_resource' CREATE_IF_MISSING_PROPERTY = 'create_if_missing' -CONFIG_PROPERTY = 'openstack_config' +CONFIG_PROPERTY = 'multivim_config' # runtime properties OPENSTACK_AZ_PROPERTY = 'availability_zone' 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').
diff --git a/common/src/main/java/org/openecomp/mso/logger/LogFilter.java b/common/src/main/java/org/openecomp/mso/logger/LogFilter.java index ca25ad2e22..6eaf356c0e 100644 --- a/common/src/main/java/org/openecomp/mso/logger/LogFilter.java +++ b/common/src/main/java/org/openecomp/mso/logger/LogFilter.java @@ -53,6 +53,11 @@ public class LogFilter implements Filter { if (null != userPrincipal) { MDC.put (MsoLogger.PARTNERNAME, userPrincipal.getName ()); } + //Set identity of calling application / component + String fromAppId = httpRequest.getHeader(MsoLogger.HEADER_FROM_APP_ID); + if(fromAppId != null && !fromAppId.isEmpty()) { + MDC.put (MsoLogger.FROM_APP_ID, fromAppId); + } chain.doFilter(httpRequest, httpResponse); } diff --git a/common/src/main/java/org/openecomp/mso/logger/MsoLogger.java b/common/src/main/java/org/openecomp/mso/logger/MsoLogger.java index 4c39815bd0..e9b6fb1225 100644 --- a/common/src/main/java/org/openecomp/mso/logger/MsoLogger.java +++ b/common/src/main/java/org/openecomp/mso/logger/MsoLogger.java @@ -71,6 +71,9 @@ public class MsoLogger { private static final String USER = "User"; private static final String DUMMY_VALUE = "trace-#"; public static final String UNKNOWN = "UNKNOWN"; + //For getting an identity of calling application + public static final String HEADER_FROM_APP_ID = "X-FromAppId"; + public static final String FROM_APP_ID = "FromAppId"; // Audit/Metric log specific private static final String BEGINTIME = "BeginTimestamp"; private static final String ENDTIME = "EndTimestamp"; |