summaryrefslogtreecommitdiffstats
path: root/bpmn/mso-infrastructure-bpmn
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/mso-infrastructure-bpmn')
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java16
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java36
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java4
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingIT.java134
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java134
5 files changed, 263 insertions, 61 deletions
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java
index da24ba14fd..9ea97258ef 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java
@@ -31,7 +31,6 @@ import org.camunda.bpm.engine.variable.impl.VariableMapImpl;
import org.onap.so.bpmn.common.workflow.context.WorkflowResponse;
import org.onap.so.logger.MsoLogger;
import org.openecomp.mso.bpmn.common.workflow.service.WorkflowProcessorException;
-import org.slf4j.MDC;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
@@ -46,19 +45,14 @@ public class WorkflowProcessor extends ProcessEngineAwareService {
@Async
public void startProcess( String processKey, VariableMapImpl variableMap) throws InterruptedException
{
- MDC.getCopyOfContextMap();
+
long startTime = System.currentTimeMillis();
Map<String, Object> inputVariables = null;
String processInstanceId = null;
try {
inputVariables = getInputVariables(variableMap);
- setLogContext(processKey, inputVariables);
-
// This variable indicates that the flow was invoked asynchronously
inputVariables.put("isAsyncProcess", "true");
-
-
- setLogContext(processKey, inputVariables);
// Note: this creates a random businessKey if it wasn't specified.
String businessKey = getBusinessKey(inputVariables);
@@ -87,14 +81,6 @@ public class WorkflowProcessor extends ProcessEngineAwareService {
}
}
- protected static void setLogContext(String processKey,
- Map<String, Object> inputVariables) {
- MsoLogger.setServiceName("MSO." + processKey);
- if (inputVariables != null) {
- MsoLogger.setLogContext(getKeyValueFromInputVariables(inputVariables,"mso-request-id"), getKeyValueFromInputVariables(inputVariables,"mso-service-instance-id"));
- }
- }
-
protected static String getKeyValueFromInputVariables(Map<String,Object> inputVariables, String key) {
if (inputVariables == null) {
return "";
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java
index 00ee6eb235..9b65cca6c9 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/LoggingAndURNMappingPlugin.java
@@ -70,9 +70,7 @@ import org.springframework.stereotype.Component;
* Plugin for MSO logging and URN mapping.
*/
@Component
-public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin {
- private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, LoggingAndURNMappingPlugin.class);
- private static final String FSPROPKEY = "URNMapping.FileSystemLoading.Enabled";
+public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin {
@Autowired
private LoggingParseListener loggingParseListener;
@@ -198,7 +196,6 @@ public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin {
@Override
public void parseSequenceFlow(Element sequenceFlowElement, ScopeImpl scopeElement, TransitionImpl transition) {
- //injectLogExecutionListener(activity);
}
@Override
@@ -216,9 +213,9 @@ public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin {
injectLogExecutionListener(timerActivity);
}
- @Override
+ @Override
public void parseRootElement(Element rootElement, List<ProcessDefinitionEntity> processDefinitions) {
- //injectLogExecutionListener(activity);
+
}
@Override
@@ -298,17 +295,7 @@ public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin {
}
@Override
- public void notify(DelegateExecution execution) throws Exception {
- logger.trace("Logging for activity---------------:" + event + ":"
- + execution.getCurrentActivityName()
- + ", processDefinitionId="
- + execution.getProcessDefinitionId() + ", activtyId="
- + execution.getCurrentActivityId() + ", activtyName='"
- + execution.getCurrentActivityName() + "'"
- + ", processInstanceId="
- + execution.getProcessInstanceId() + ", businessKey="
- + execution.getProcessBusinessKey() + ", executionId="
- + execution.getId());
+ public void notify(DelegateExecution execution) throws Exception {
//required for legacy groovy processing in camunda
execution.setVariable("isDebugLogEnabled", "true");
if (!isBlank(execution.getCurrentActivityName())) {
@@ -322,20 +309,7 @@ public class LoggingAndURNMappingPlugin extends AbstractProcessEnginePlugin {
.singleResult()
.getName();
- if (execution.getBpmnModelElementInstance() instanceof StartEvent) {
- logger.debug("Starting process: " + processName);
- }
- if (execution.getBpmnModelElementInstance() instanceof EndEvent) {
- logger.debug("Ending process: " + processName);
- }
-
- String serviceName = MDC.get(MsoLogger.SERVICE_NAME);
-
- if(serviceName != null && !serviceName.contains(processName))
- MsoLogger.setServiceName( serviceName + "." + processName);
- else if(serviceName == null)
- MsoLogger.setServiceName(processName);
-
+ MsoLogger.setServiceName(processName);
String requestId = (String) execution.getVariable("mso-request-id");
String svcid = (String) execution.getVariable("mso-service-instance-id");
MsoLogger.setLogContext(requestId, svcid);
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java
index db2304d6b7..efd73ba4f2 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java
@@ -30,6 +30,8 @@ import org.camunda.bpm.engine.ProcessEngine;
import org.camunda.bpm.spring.boot.starter.annotation.EnableProcessApplication;
import org.onap.so.bpmn.common.DefaultToShortClassNameBeanNameGenerator;
import org.onap.so.logger.MsoLogger;
+import org.onap.so.logging.jaxrs.filter.MDCTaskDecorator;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -102,7 +104,7 @@ public class MSOInfrastructureApplication {
@Primary
public Executor asyncExecutor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
-
+ executor.setTaskDecorator(new MDCTaskDecorator());
executor.setCorePoolSize(corePoolSize);
executor.setMaxPoolSize(maxPoolSize);
executor.setQueueCapacity(queueCapacity);
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingIT.java
index 9bcc5593e2..d2dbde4843 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingIT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingIT.java
@@ -38,7 +38,6 @@ import org.junit.Test;
import org.onap.so.BaseIntegrationTest;
import org.onap.so.bpmn.core.WorkflowException;
import org.onap.so.bpmn.core.domain.AllottedResource;
-import org.onap.so.bpmn.core.domain.CloudFlavor;
import org.onap.so.bpmn.core.domain.HomingSolution;
import org.onap.so.bpmn.core.domain.ModelInfo;
import org.onap.so.bpmn.core.domain.NetworkResource;
@@ -122,12 +121,133 @@ public class OofHomingIT extends BaseIntegrationTest {
VnfResource vnf = new VnfResource();
vnf.setResourceId("testResourceIdVNF");
vnf.setNfFunction("testVnfFunctionName");
- ArrayList<CloudFlavor> flavors = new ArrayList<>();
- CloudFlavor flavor1 = new CloudFlavor("flavorLabel1xxx", "vimFlavorxxx");
- CloudFlavor flavor2 = new CloudFlavor("flavorLabel2xxx", "vimFlavorxxx");
- flavors.add(flavor1);
- flavors.add(flavor2);
- vnf.getHomingSolution().setFlavors(flavors);
+ vnf.getHomingSolution().setOofDirectives(
+ "{ \n" +
+ " \"directives\":[ \n" +
+ " { \n" +
+ " \"vnfc_directives\":[ \n" +
+ " { \n" +
+ " \"vnfc_id\":\"<ID of VNFC>\",\n" +
+ " \"directives\":[ \n" +
+ " { \n" +
+ " \"directive_name\":\"<Name of directive,example flavor_directive>\",\n" +
+ " \"attributes\":[ \n" +
+ " { \n" +
+ " \"attribute_name\":\"<name of attribute, such as flavor label>\",\n" +
+ " \"attribute_value\":\"<value such as cloud specific flavor>\"\n" +
+ " }\n" +
+ " ]\n" +
+ " },\n" +
+ " { \n" +
+ " \"directive_name\":\"<Name of directive,example vnic-info>\",\n" +
+ " \"attributes\":[ \n" +
+ " { \n" +
+ " \"attribute_name\":\"<name of attribute, such as vnic-type>\",\n" +
+ " \"attribute_value\":\"<value such as direct/normal>\"\n" +
+ " },\n" +
+ " { \n" +
+ " \"attribute_name\":\"<name of attribute, such as provider netweork>\",\n" +
+ " \"attribute_value\":\"<value such as physnet>\"\n" +
+ " }\n" +
+ " ]\n" +
+ " }\n" +
+ " ]\n" +
+ " }\n" +
+ " ]\n" +
+ " },\n" +
+ " { \n" +
+ " \"vnf_directives\":{ \n" +
+ " \"directives\":[ \n" +
+ " { \n" +
+ " \"directive_name\":\"<Name of directive>\",\n" +
+ " \"attributes\":[ \n" +
+ " { \n" +
+ " \"attribute_name\":\"<name of attribute>\",\n" +
+ " \"attribute_value\":\"<value>\"\n" +
+ " }\n" +
+ " ]\n" +
+ " },\n" +
+ " { \n" +
+ " \"directive_name\":\"<Name of directive>\",\n" +
+ " \"attributes\":[ \n" +
+ " { \n" +
+ " \"attribute_name\":\"<name of attribute>\",\n" +
+ " \"attribute_value\":\"<value >\"\n" +
+ " },\n" +
+ " { \n" +
+ " \"attribute_name\":\"<name of attribute>\",\n" +
+ " \"attribute_value\":\"<value >\"\n" +
+ " }\n" +
+ " ]\n" +
+ " }\n" +
+ " ]\n" +
+ " }\n" +
+ " }\n" +
+ " ]\n" +
+ " },\n" +
+ " \"sdnc_directives\":{ \n" +
+ " \"directives\":[ \n" +
+ " { \n" +
+ " \"vnfc_directives\":[ \n" +
+ " { \n" +
+ " \"vnfc_id\":\"<ID of VNFC>\",\n" +
+ " \"directives\":[ \n" +
+ " { \n" +
+ " \"directive_name\":\"<Name of directive,example flavor_directive>\",\n" +
+ " \"attributes\":[ \n" +
+ " { \n" +
+ " \"attribute_name\":\"<name of attribute, such as flavor label>\",\n" +
+ " \"attribute_value\":\"<value such as cloud specific flavor>\"\n" +
+ " }\n" +
+ " ]\n" +
+ " },\n" +
+ " { \n" +
+ " \"directive_name\":\"<Name of directive,example vnic-info>\",\n" +
+ " \"attributes\":[ \n" +
+ " { \n" +
+ " \"attribute_name\":\"<name of attribute, such as vnic-type>\",\n" +
+ " \"attribute_value\":\"<value such as direct/normal>\"\n" +
+ " },\n" +
+ " { \n" +
+ " \"attribute_name\":\"<name of attribute, such as provider netweork>\",\n" +
+ " \"attribute_value\":\"<value such as physnet>\"\n" +
+ " }\n" +
+ " ]\n" +
+ " }\n" +
+ " ]\n" +
+ " }\n" +
+ " ]\n" +
+ " },\n" +
+ " { \n" +
+ " \"vnf_directives\":{ \n" +
+ " \"directives\":[ \n" +
+ " { \n" +
+ " \"directive_name\":\"<Name of directive>\",\n" +
+ " \"attributes\":[ \n" +
+ " { \n" +
+ " \"attribute_name\":\"<name of attribute>\",\n" +
+ " \"attribute_value\":\"<value>\"\n" +
+ " }\n" +
+ " ]\n" +
+ " },\n" +
+ " { \n" +
+ " \"directive_name\":\"<Name of directive>\",\n" +
+ " \"attributes\":[ \n" +
+ " { \n" +
+ " \"attribute_name\":\"<name of attribute>\",\n" +
+ " \"attribute_value\":\"<value >\"\n" +
+ " },\n" +
+ " { \n" +
+ " \"attribute_name\":\"<name of attribute>\",\n" +
+ " \"attribute_value\":\"<value >\"\n" +
+ " }\n" +
+ " ]\n" +
+ " }\n" +
+ " ]\n" +
+ " }\n" +
+ " }\n" +
+ " ]\n" +
+ " }");
ModelInfo vnfModel = new ModelInfo();
vnfModel.setModelCustomizationUuid("testModelCustomizationUuidVNF");
vnfModel.setModelInvariantUuid("testModelInvariantIdVNF");
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java
index 33e444310f..748552623e 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/OofHomingTestIT.java
@@ -26,7 +26,6 @@ import org.junit.Test;
import org.onap.so.BaseIntegrationTest;
import org.onap.so.bpmn.core.WorkflowException;
import org.onap.so.bpmn.core.domain.AllottedResource;
-import org.onap.so.bpmn.core.domain.CloudFlavor;
import org.onap.so.bpmn.core.domain.HomingSolution;
import org.onap.so.bpmn.core.domain.ModelInfo;
import org.onap.so.bpmn.core.domain.NetworkResource;
@@ -126,12 +125,133 @@ public class OofHomingTestIT extends BaseIntegrationTest {
VnfResource vnf = new VnfResource();
vnf.setResourceId("testResourceIdVNF");
vnf.setResourceInstanceName("testVnfInstanceName");
- ArrayList<CloudFlavor> flavors = new ArrayList<>();
- CloudFlavor flavor1 = new CloudFlavor("flavorLabel1xxx", "vimFlavorxxx");
- CloudFlavor flavor2 = new CloudFlavor("flavorLabel2xxx", "vimFlavorxxx");
- flavors.add(flavor1);
- flavors.add(flavor2);
- vnf.getHomingSolution().setFlavors(flavors);
+ vnf.getHomingSolution().setOofDirectives(
+ "{ \n" +
+ " \"directives\":[ \n" +
+ " { \n" +
+ " \"vnfc_directives\":[ \n" +
+ " { \n" +
+ " \"vnfc_id\":\"<ID of VNFC>\",\n" +
+ " \"directives\":[ \n" +
+ " { \n" +
+ " \"directive_name\":\"<Name of directive,example flavor_directive>\",\n" +
+ " \"attributes\":[ \n" +
+ " { \n" +
+ " \"attribute_name\":\"<name of attribute, such as flavor label>\",\n" +
+ " \"attribute_value\":\"<value such as cloud specific flavor>\"\n" +
+ " }\n" +
+ " ]\n" +
+ " },\n" +
+ " { \n" +
+ " \"directive_name\":\"<Name of directive,example vnic-info>\",\n" +
+ " \"attributes\":[ \n" +
+ " { \n" +
+ " \"attribute_name\":\"<name of attribute, such as vnic-type>\",\n" +
+ " \"attribute_value\":\"<value such as direct/normal>\"\n" +
+ " },\n" +
+ " { \n" +
+ " \"attribute_name\":\"<name of attribute, such as provider netweork>\",\n" +
+ " \"attribute_value\":\"<value such as physnet>\"\n" +
+ " }\n" +
+ " ]\n" +
+ " }\n" +
+ " ]\n" +
+ " }\n" +
+ " ]\n" +
+ " },\n" +
+ " { \n" +
+ " \"vnf_directives\":{ \n" +
+ " \"directives\":[ \n" +
+ " { \n" +
+ " \"directive_name\":\"<Name of directive>\",\n" +
+ " \"attributes\":[ \n" +
+ " { \n" +
+ " \"attribute_name\":\"<name of attribute>\",\n" +
+ " \"attribute_value\":\"<value>\"\n" +
+ " }\n" +
+ " ]\n" +
+ " },\n" +
+ " { \n" +
+ " \"directive_name\":\"<Name of directive>\",\n" +
+ " \"attributes\":[ \n" +
+ " { \n" +
+ " \"attribute_name\":\"<name of attribute>\",\n" +
+ " \"attribute_value\":\"<value >\"\n" +
+ " },\n" +
+ " { \n" +
+ " \"attribute_name\":\"<name of attribute>\",\n" +
+ " \"attribute_value\":\"<value >\"\n" +
+ " }\n" +
+ " ]\n" +
+ " }\n" +
+ " ]\n" +
+ " }\n" +
+ " }\n" +
+ " ]\n" +
+ " },\n" +
+ " \"sdnc_directives\":{ \n" +
+ " \"directives\":[ \n" +
+ " { \n" +
+ " \"vnfc_directives\":[ \n" +
+ " { \n" +
+ " \"vnfc_id\":\"<ID of VNFC>\",\n" +
+ " \"directives\":[ \n" +
+ " { \n" +
+ " \"directive_name\":\"<Name of directive,example flavor_directive>\",\n" +
+ " \"attributes\":[ \n" +
+ " { \n" +
+ " \"attribute_name\":\"<name of attribute, such as flavor label>\",\n" +
+ " \"attribute_value\":\"<value such as cloud specific flavor>\"\n" +
+ " }\n" +
+ " ]\n" +
+ " },\n" +
+ " { \n" +
+ " \"directive_name\":\"<Name of directive,example vnic-info>\",\n" +
+ " \"attributes\":[ \n" +
+ " { \n" +
+ " \"attribute_name\":\"<name of attribute, such as vnic-type>\",\n" +
+ " \"attribute_value\":\"<value such as direct/normal>\"\n" +
+ " },\n" +
+ " { \n" +
+ " \"attribute_name\":\"<name of attribute, such as provider netweork>\",\n" +
+ " \"attribute_value\":\"<value such as physnet>\"\n" +
+ " }\n" +
+ " ]\n" +
+ " }\n" +
+ " ]\n" +
+ " }\n" +
+ " ]\n" +
+ " },\n" +
+ " { \n" +
+ " \"vnf_directives\":{ \n" +
+ " \"directives\":[ \n" +
+ " { \n" +
+ " \"directive_name\":\"<Name of directive>\",\n" +
+ " \"attributes\":[ \n" +
+ " { \n" +
+ " \"attribute_name\":\"<name of attribute>\",\n" +
+ " \"attribute_value\":\"<value>\"\n" +
+ " }\n" +
+ " ]\n" +
+ " },\n" +
+ " { \n" +
+ " \"directive_name\":\"<Name of directive>\",\n" +
+ " \"attributes\":[ \n" +
+ " { \n" +
+ " \"attribute_name\":\"<name of attribute>\",\n" +
+ " \"attribute_value\":\"<value >\"\n" +
+ " },\n" +
+ " { \n" +
+ " \"attribute_name\":\"<name of attribute>\",\n" +
+ " \"attribute_value\":\"<value >\"\n" +
+ " }\n" +
+ " ]\n" +
+ " }\n" +
+ " ]\n" +
+ " }\n" +
+ " }\n" +
+ " ]\n" +
+ " }");
ModelInfo vnfModel = new ModelInfo();
vnfModel.setModelCustomizationUuid("testModelCustomizationUuidVNF");
vnfModel.setModelInvariantUuid("testModelInvariantIdVNF");