summaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/baseclient/BaseClient.java8
-rw-r--r--bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn5
-rw-r--r--bpmn/MSOCommonBPMN/src/main/resources/subprocess/FalloutHandler.bpmn5
-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/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java67
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java21
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientLogResponseTest.java43
10 files changed, 55 insertions, 152 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy
index 1e2a703e70..0692e5022a 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy
@@ -755,8 +755,6 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
public void setBasicDBAuthHeader(DelegateExecution execution, isDebugLogEnabled) {
try {
String basicAuthValueDB = UrnPropertiesReader.getVariable("mso.adapters.db.auth", execution)
- utils.log("DEBUG", " Obtained BasicAuth userid password for Catalog DB adapter: " + basicAuthValueDB, isDebugLogEnabled)
-
def encodedString = utils.getBasicAuth(basicAuthValueDB, UrnPropertiesReader.getVariable("mso.msoKey", execution))
execution.setVariable("BasicAuthHeaderValueDB",encodedString)
} catch (IOException ex) {
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/baseclient/BaseClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/baseclient/BaseClient.java
index c3511e69a4..78f3e96978 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/baseclient/BaseClient.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/baseclient/BaseClient.java
@@ -20,13 +20,14 @@
package org.onap.so.bpmn.common.baseclient;
+import org.onap.so.logging.jaxrs.filter.SpringClientFilter;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.http.client.BufferingClientHttpRequestFactory;
-import org.springframework.http.client.SimpleClientHttpRequestFactory;
+import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.RestTemplate;
@@ -59,11 +60,12 @@ public class BaseClient<I,O> {
public O post(I data, ParameterizedTypeReference<O> typeRef, Object... uriVariables) throws RestClientException {
return run(data, HttpMethod.POST, typeRef, uriVariables);
}
-
+
public O run(I data, HttpMethod method, ParameterizedTypeReference<O> typeRef, Object... uriVariables) throws RestClientException {
HttpEntity<I> requestEntity = new HttpEntity<I>(data, getHttpHeader());
RestTemplate restTemplate = new RestTemplate();
- restTemplate.setRequestFactory(new BufferingClientHttpRequestFactory(new SimpleClientHttpRequestFactory()));
+ restTemplate.setRequestFactory(new BufferingClientHttpRequestFactory(new HttpComponentsClientHttpRequestFactory()));
+ restTemplate.getInterceptors().add(new SpringClientFilter());
ResponseEntity<O> responseEntity = restTemplate.exchange(getTargetUrl(), method, requestEntity, typeRef,
uriVariables);
return responseEntity.getBody();
diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn
index 67bd961844..63c867f3c7 100644
--- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn
+++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_EsMs0HcuEeW2U_kkOHX1ZQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
+<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_EsMs0HcuEeW2U_kkOHX1ZQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.7.1" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
<bpmn2:process id="CompleteMsoProcess" name="CompleteMsoProcess" isExecutable="true">
<bpmn2:scriptTask id="preProcessRequest" name="Pre-Process Request" scriptFormat="groovy">
<bpmn2:incoming>SequenceFlow_18</bpmn2:incoming>
@@ -56,6 +56,7 @@ completeMsoProcess.setUpdateDBstatustoSuccessPayload(execution)]]></bpmn2:script
<camunda:map>
<camunda:entry key="content-type">application/soap+xml</camunda:entry>
<camunda:entry key="Authorization">#{BasicAuthHeaderValueDB}</camunda:entry>
+ <camunda:entry key="X-ONAP-RequestID">#{CMSO_request_id}</camunda:entry>
</camunda:map>
</camunda:inputParameter>
<camunda:inputParameter name="method">POST</camunda:inputParameter>
@@ -88,7 +89,7 @@ buildDataErrorMessage.buildDataError(execution, "Complete MSO -- Update DB stat
<bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="ExclusiveGateway_7" targetRef="BuildErrorMessage" />
<bpmn2:boundaryEvent id="BoundaryEvent_7" name="" attachedToRef="updateInfraRequest">
<bpmn2:outgoing>SequenceFlow_0mipf25</bpmn2:outgoing>
- <bpmn2:errorEventDefinition id="_ErrorEventDefinition_84" errorRef="Error_1" />
+ <bpmn2:errorEventDefinition id="_ErrorEventDefinition_84" errorRef="Error_1" camunda:errorCodeVariable="gJavaErrorCode" camunda:errorMessageVariable="gJavaErrorMessage" />
</bpmn2:boundaryEvent>
<bpmn2:endEvent id="EndEvent_1">
<bpmn2:incoming>SequenceFlow_1pzb94j</bpmn2:incoming>
diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/FalloutHandler.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/FalloutHandler.bpmn
index c59564b1e3..990863ec93 100644
--- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/FalloutHandler.bpmn
+++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/FalloutHandler.bpmn
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_3SPHsLr9EeWak-hhutJWuQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.8.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
+<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_3SPHsLr9EeWak-hhutJWuQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.7.1" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
<bpmn2:process id="FalloutHandler" name="Fallout Handler" isExecutable="true">
<bpmn2:parallelGateway id="ParallelGateway_1">
<bpmn2:incoming>SequenceFlow_12</bpmn2:incoming>
@@ -139,6 +139,7 @@ falloutHandler.buildDBWorkflowException(execution, "FH_updateRequestInfraRespons
<camunda:map>
<camunda:entry key="content-type">application/soap+xml</camunda:entry>
<camunda:entry key="Authorization">#{BasicAuthHeaderValueDB}</camunda:entry>
+ <camunda:entry key="X-ONAP-RequestID">#{FH_request_id}</camunda:entry>
</camunda:map>
</camunda:inputParameter>
<camunda:inputParameter name="payload">
@@ -168,7 +169,7 @@ return updateRequestInfra.updateRequestInfraPayload(execution)]]></camunda:scrip
</bpmn2:sequenceFlow>
<bpmn2:boundaryEvent id="BoundaryEvent_3" name="Connect Fault" attachedToRef="ServiceTask_2">
<bpmn2:outgoing>SequenceFlow_80</bpmn2:outgoing>
- <bpmn2:errorEventDefinition id="_ErrorEventDefinition_90" errorRef="Error_2" />
+ <bpmn2:errorEventDefinition id="_ErrorEventDefinition_90" errorRef="Error_2" camunda:errorCodeVariable="gJavaErrorCode" camunda:errorMessageVariable="gJavaErrorMessage" />
</bpmn2:boundaryEvent>
<bpmn2:sequenceFlow id="SequenceFlow_80" name="" sourceRef="BoundaryEvent_3" targetRef="ScriptTask_7" />
<bpmn2:subProcess id="SubProcess_1" name="Event Handler" triggeredByEvent="true">
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/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
index a998f6934f..02459d789d 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
@@ -35,6 +35,7 @@ import java.util.stream.Collectors;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.javatuples.Pair;
+import org.slf4j.LoggerFactory;
import org.onap.aai.domain.yang.GenericVnf;
import org.onap.aai.domain.yang.L3Network;
import org.onap.aai.domain.yang.Relationship;
@@ -61,8 +62,6 @@ import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization;
import org.onap.so.db.catalog.beans.macro.NorthBoundRequest;
import org.onap.so.db.catalog.beans.macro.OrchestrationFlow;
import org.onap.so.db.catalog.client.CatalogDbClient;
-import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.onap.so.serviceinstancebeans.ModelInfo;
import org.onap.so.serviceinstancebeans.ModelType;
import org.onap.so.serviceinstancebeans.Networks;
@@ -71,6 +70,7 @@ import org.onap.so.serviceinstancebeans.Service;
import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
import org.onap.so.serviceinstancebeans.VfModules;
import org.onap.so.serviceinstancebeans.Vnfs;
+import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -79,6 +79,9 @@ import com.fasterxml.jackson.databind.ObjectMapper;
@Component
public class WorkflowAction {
+ private static final String WORKFLOW_ACTION_ERROR_MESSAGE = "WorkflowActionErrorMessage";
+ private static final String SERVICE_INSTANCES = "serviceInstances";
+ private static final String WORKFLOW_ACTION_WAS_UNABLE_TO_VERIFY_IF_THE_INSTANCE_NAME_ALREADY_EXIST_IN_AAI = "WorkflowAction was unable to verify if the instance name already exist in AAI.";
private static final String G_ORCHESTRATION_FLOW = "gOrchestrationFlow";
private static final String G_ACTION = "requestAction";
private static final String G_CURRENT_SEQUENCE = "gCurrentSequence";
@@ -100,7 +103,7 @@ public class WorkflowAction {
private static final String CREATEINSTANCE = "createInstance";
private static final String USERPARAMSERVICE = "service";
private static final String supportedTypes = "vnfs|vfModules|networks|networkCollections|volumeGroups|serviceInstances";
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, WorkflowAction.class);
+ private static final Logger logger = LoggerFactory.getLogger(WorkflowAction.class);
@Autowired
protected BBInputSetup bbInputSetup;
@@ -239,7 +242,7 @@ public class WorkflowAction {
for(WorkflowType type : WorkflowType.values()){
foundObjects = foundObjects + type + " - " + resourceCounter.stream().filter(x -> type.equals(x.getResourceType())).collect(Collectors.toList()).size() + " ";
}
- msoLogger.info("Found " + foundObjects);
+ logger.info("Found {}", foundObjects);
if (orchFlows == null || orchFlows.isEmpty()) {
orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte);
@@ -247,7 +250,7 @@ public class WorkflowAction {
flowsToExecute = buildExecuteBuildingBlockList(orchFlows, resourceCounter, requestId, apiVersion, resourceId,
resourceType, requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails);
if (!resourceCounter.stream().filter(x -> WorkflowType.NETWORKCOLLECTION == x.getResourceType()).collect(Collectors.toList()).isEmpty()) {
- msoLogger.info("Sorting for Vlan Tagging");
+ logger.info("Sorting for Vlan Tagging");
flowsToExecute = sortExecutionPathByObjectForVlanTagging(flowsToExecute, requestAction);
}
if (resourceType == WorkflowType.SERVICE
@@ -267,9 +270,9 @@ public class WorkflowAction {
throw new IllegalStateException("Macro did not come up with a valid execution path.");
}
- msoLogger.info("List of BuildingBlocks to execute:");
+ logger.info("List of BuildingBlocks to execute:");
for (ExecuteBuildingBlock ebb : flowsToExecute) {
- msoLogger.info(ebb.getBuildingBlock().getBpmnFlowName());
+ logger.info(ebb.getBuildingBlock().getBpmnFlowName());
}
execution.setVariable(G_CURRENT_SEQUENCE, 0);
@@ -296,7 +299,7 @@ public class WorkflowAction {
private void updateResourceIdsFromAAITraversal(List<ExecuteBuildingBlock> flowsToExecute,
List<Resource> resourceCounter, List<Pair<WorkflowType, String>> aaiResourceIds) {
for(Pair<WorkflowType,String> pair : aaiResourceIds){
- msoLogger.debug(pair.getValue0() + ", " + pair.getValue1());
+ logger.debug(pair.getValue0() + ", " + pair.getValue1());
}
Arrays.stream(WorkflowType.values()).filter(type -> !type.equals(WorkflowType.SERVICE)).forEach(type -> {
@@ -389,12 +392,12 @@ public class WorkflowAction {
if (service.getVnfCustomizations() == null || service.getVnfCustomizations().isEmpty()) {
List<CollectionResourceCustomization> customizations = service.getCollectionResourceCustomizations();
if(customizations.isEmpty()) {
- msoLogger.debug("No Collections found. CollectionResourceCustomization list is empty.");
+ logger.debug("No Collections found. CollectionResourceCustomization list is empty.");
}else{
CollectionResourceCustomization collectionResourceCustomization = findCatalogNetworkCollection(execution, service);
if(collectionResourceCustomization!=null){
resourceCounter.add(new Resource(WorkflowType.NETWORKCOLLECTION,collectionResourceCustomization.getModelCustomizationUUID(),false));
- msoLogger.debug("Found a network collection");
+ logger.debug("Found a network collection");
if(collectionResourceCustomization.getCollectionResource()!=null){
if(collectionResourceCustomization.getCollectionResource().getInstanceGroup() != null){
String toscaNodeType = collectionResourceCustomization.getCollectionResource().getInstanceGroup().getToscaNodeType();
@@ -413,7 +416,7 @@ public class WorkflowAction {
minNetworks = collectionInstCust.getSubInterfaceNetworkQuantity();
}
}
- msoLogger.debug("minNetworks: " + minNetworks);
+ logger.debug("minNetworks: {}" , minNetworks);
CollectionNetworkResourceCustomization collectionNetworkResourceCust = null;
for(CollectionNetworkResourceCustomization collectionNetworkTemp : instanceGroup.getCollectionNetworkResourceCustomizations()) {
if(collectionNetworkTemp.getNetworkResourceCustomization().getModelCustomizationUUID().equalsIgnoreCase(collectionResourceCustomization.getModelCustomizationUUID())) {
@@ -429,21 +432,21 @@ public class WorkflowAction {
}
}
} else {
- msoLogger.debug("Instance Group tosca node type does not contain NetworkCollection: " + toscaNodeType);
+ logger.debug("Instance Group tosca node type does not contain NetworkCollection: {}" , toscaNodeType);
}
}else{
- msoLogger.debug("No Instance Group found for network collection.");
+ logger.debug("No Instance Group found for network collection.");
}
}else{
- msoLogger.debug("No Network Collection found. collectionResource is null");
+ logger.debug("No Network Collection found. collectionResource is null");
}
} else {
- msoLogger.debug("No Network Collection Customization found");
+ logger.debug("No Network Collection Customization found");
}
}
if (resourceCounter.stream().filter(x -> WorkflowType.NETWORKCOLLECTION == x.getResourceType()).collect(Collectors.toList()).isEmpty()) {
if (service.getNetworkCustomizations() == null) {
- msoLogger.debug("No networks were found on this service model");
+ logger.debug("No networks were found on this service model");
} else {
for (int i = 0; i < service.getNetworkCustomizations().size(); i++) {
resourceCounter.add(new Resource(WorkflowType.NETWORK,service.getNetworkCustomizations().get(i).getModelCustomizationUUID(),false));
@@ -491,7 +494,7 @@ public class WorkflowAction {
}
}
if (serviceInstanceMSO.getCollection() != null) {
- msoLogger.debug("found networkcollection");
+ logger.debug("found networkcollection");
aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.NETWORKCOLLECTION, serviceInstanceMSO.getCollection().getId()));
resourceCounter.add(new Resource(WorkflowType.NETWORKCOLLECTION,serviceInstanceMSO.getCollection().getId(),false));
}
@@ -613,9 +616,10 @@ public class WorkflowAction {
}
}
}
- msoLogger.debug("found " + configurations.size() + " configurations");
+ logger.debug("found {} configurations" , configurations.size() );
return configurations;
} catch (Exception ex){
+ logger.error("Error in finding configurations", ex);
return configurations;
}
}
@@ -649,7 +653,7 @@ public class WorkflowAction {
Boolean generated = false;
if (m.find()) {
- msoLogger.debug("found match on " + uri + ": " + m);
+ logger.debug("found match on {} : {} " , uri , m);
String type = m.group("type");
String id = m.group("id");
String action = m.group("action");
@@ -657,7 +661,7 @@ public class WorkflowAction {
throw new IllegalArgumentException("Uri could not be parsed. No type found. " + uri);
}
if (action == null) {
- if (type.equals("serviceInstances") && (id == null || id.equals("assign"))) {
+ if (type.equals(SERVICE_INSTANCES) && (id == null || id.equals("assign"))) {
id = UUID.randomUUID().toString();
generated = true;
}
@@ -727,9 +731,9 @@ public class WorkflowAction {
}
return generatedResourceId;
} catch (Exception ex) {
- msoLogger.error(ex);
+ logger.error(WORKFLOW_ACTION_WAS_UNABLE_TO_VERIFY_IF_THE_INSTANCE_NAME_ALREADY_EXIST_IN_AAI, ex);
throw new IllegalStateException(
- "WorkflowAction was unable to verify if the instance name already exist in AAI.");
+ WORKFLOW_ACTION_WAS_UNABLE_TO_VERIFY_IF_THE_INSTANCE_NAME_ALREADY_EXIST_IN_AAI);
}
}
@@ -737,7 +741,7 @@ public class WorkflowAction {
if (!type.matches(supportedTypes)) {
return type;
} else {
- if (type.equals("serviceInstances")) {
+ if (type.equals(SERVICE_INSTANCES)) {
return SERVICE;
} else {
return type.substring(0, 1).toUpperCase() + type.substring(1, type.length() - 1);
@@ -948,20 +952,19 @@ public class WorkflowAction {
}
protected void buildAndThrowException(DelegateExecution execution, String msg, Exception ex) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.UnknownError, msg, ex);
- execution.setVariable("WorkflowActionErrorMessage", msg);
+ logger.error(msg, ex);
+ execution.setVariable(WORKFLOW_ACTION_ERROR_MESSAGE, msg);
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg);
}
protected void buildAndThrowException(DelegateExecution execution, String msg) {
- msoLogger.error(msg);
- execution.setVariable("WorkflowActionErrorMessage", msg);
+ logger.error(msg);
+ execution.setVariable(WORKFLOW_ACTION_ERROR_MESSAGE, msg);
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg);
}
public void handleRuntimeException (DelegateExecution execution){
- StringBuffer wfeExpMsg = new StringBuffer("Runtime error ");
+ StringBuilder wfeExpMsg = new StringBuilder("Runtime error ");
String runtimeErrorMessage = null;
try{
String javaExpMsg = (String) execution.getVariable("BPMN_javaExpMsg");
@@ -969,10 +972,10 @@ public class WorkflowAction {
wfeExpMsg = wfeExpMsg.append(": ").append(javaExpMsg);
}
runtimeErrorMessage = wfeExpMsg.toString();
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, runtimeErrorMessage, "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.UnknownError, runtimeErrorMessage);
- execution.setVariable("WorkflowActionErrorMessage", runtimeErrorMessage);
+ logger.error(runtimeErrorMessage);
+ execution.setVariable(WORKFLOW_ACTION_ERROR_MESSAGE, runtimeErrorMessage);
} catch (Exception e){
+ logger.error("Runtime error", e);
//if runtime message was mulformed
runtimeErrorMessage = "Runtime error";
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java
index a4b40393a3..67843a7ef9 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java
@@ -64,28 +64,10 @@ public class SDNCClient {
STOClient.setTargetUrl(targetUrl);
HttpHeaders httpHeader = sdnCommonTasks.getHttpHeaders(properties.getAuth());
STOClient.setHttpHeader(httpHeader);
- msoLogger.info("Running SDNC CLIENT for TargetUrl: " + targetUrl);
LinkedHashMap<?, ?> output = STOClient.post(jsonRequest, new ParameterizedTypeReference<LinkedHashMap<? ,?>>() {});
- Optional<String> sdncResponse = logSDNCResponse(output);
- if(sdncResponse.isPresent()){
- msoLogger.info(sdncResponse.get());
- }
- msoLogger.info("Validating output...");
return sdnCommonTasks.validateSDNResponse(output);
}
- protected Optional<String> logSDNCResponse(LinkedHashMap<?, ?> output) {
- ObjectMapper mapper = new ObjectMapper();
- String sdncOutput = "";
- try {
- sdncOutput = mapper.writeValueAsString(output);
- return Optional.of(sdncOutput);
- } catch (JsonProcessingException e) {
- msoLogger.debug("Failed to map response from sdnc to json string for logging purposes.");
- }
- return Optional.empty();
- }
-
/**
*
* @param queryLink
@@ -102,12 +84,9 @@ public class SDNCClient {
String jsonRequest = sdnCommonTasks.buildJsonRequest(request);
String targetUrl = UriBuilder.fromUri(properties.getHost()).path(queryLink).build().toString();
STOClient.setTargetUrl(targetUrl);
- msoLogger.info("TargetUrl: " + targetUrl);
HttpHeaders httpHeader = sdnCommonTasks.getHttpHeaders(properties.getAuth());
STOClient.setHttpHeader(httpHeader);
- msoLogger.info("Running SDNC CLIENT...");
LinkedHashMap<?, ?> output = STOClient.get(jsonRequest, new ParameterizedTypeReference<LinkedHashMap<? ,?>>() {});
- msoLogger.info("Validating output...");
return sdnCommonTasks.validateSDNGetResponse(output);
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientLogResponseTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientLogResponseTest.java
deleted file mode 100644
index e28c465437..0000000000
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientLogResponseTest.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.sdnc;
-
-import static org.junit.Assert.*;
-
-import java.util.LinkedHashMap;
-import java.util.Optional;
-
-import org.junit.Test;
-
-public class SDNCClientLogResponseTest {
-
- private SDNCClient sdncClient = new SDNCClient();
-
- @Test
- public void logSDNCResponseTest() {
- LinkedHashMap<String, String> output = new LinkedHashMap<>();
- output.put("response-code", "404");
- output.put("response-message", "not found");
- Optional<String> response = sdncClient.logSDNCResponse(output);
- assertEquals(true, response.isPresent());
- assertEquals("{\"response-code\":\"404\",\"response-message\":\"not found\"}",response.get());
- }
-}