diff options
11 files changed, 828 insertions, 825 deletions
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java index 56784ba475..892a96eb4e 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java @@ -53,6 +53,7 @@ import org.onap.sdc.toscaparser.api.Property; import org.onap.sdc.toscaparser.api.RequirementAssignment; import org.onap.sdc.toscaparser.api.RequirementAssignments; import org.onap.sdc.toscaparser.api.elements.Metadata; +import org.onap.sdc.toscaparser.api.elements.StatefulEntityType; import org.onap.sdc.toscaparser.api.functions.GetInput; import org.onap.sdc.toscaparser.api.parameters.Input; import org.onap.sdc.utils.DistributionStatusEnum; @@ -138,6 +139,10 @@ import com.fasterxml.jackson.databind.ObjectMapper; @Component public class ToscaResourceInstaller { + protected static final String NODES_VRF_ENTRY = "org.openecomp.nodes.VRFEntry"; + + protected static final String VLAN_NETWORK_RECEPTOR = "org.openecomp.nodes.VLANNetworkReceptor"; + protected static final String ALLOTTED_RESOURCE = "Allotted Resource"; protected static final String MULTI_STAGE_DESIGN = "multi_stage_design"; @@ -295,8 +300,7 @@ public class ToscaResourceInstaller { List<ASDCElementInfo> artifactListForLogging = new ArrayList<>(); try { createToscaCsar(toscaResourceStruct); - createService(toscaResourceStruct, vfResourceStruct); - Service service = toscaResourceStruct.getCatalogService(); + Service service = createService(toscaResourceStruct, vfResourceStruct); processResourceSequence(toscaResourceStruct, service); processVFResources(toscaResourceStruct, service, vfResourceStructure); @@ -524,6 +528,62 @@ public class ToscaResourceInstaller { } } } + + + protected ConfigurationResource getConfigurationResource(NodeTemplate nodeTemplate) { + Metadata metadata = nodeTemplate.getMetaData(); + ConfigurationResource configResource = new ConfigurationResource(); + configResource.setModelName(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME)); + configResource.setModelInvariantUUID(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)); + configResource.setModelUUID(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); + configResource.setModelVersion(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)); + configResource.setDescription(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)); + configResource.setToscaNodeType(nodeTemplate.getType()); + return configResource; + } + + protected ConfigurationResourceCustomization getConfigurationResourceCustomization(NodeTemplate nodeTemplate, ToscaResourceStructure toscaResourceStructure, + ServiceProxyResourceCustomization spResourceCustomization ) { + Metadata metadata = nodeTemplate.getMetaData(); + + ConfigurationResource configResource = getConfigurationResource(nodeTemplate); + + ConfigurationResourceCustomization configCustomizationResource = new ConfigurationResourceCustomization(); + + Set<ConfigurationResourceCustomization> configResourceCustomizationSet = new HashSet<>(); + + configCustomizationResource.setModelCustomizationUUID(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); + configCustomizationResource.setModelInstanceName(nodeTemplate.getName()); + + configCustomizationResource.setNfFunction(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFFUNCTION)); + configCustomizationResource.setNfRole(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFROLE)); + configCustomizationResource.setNfType(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFTYPE)); + configCustomizationResource.setServiceProxyResourceCustomizationUUID(spResourceCustomization.getModelCustomizationUUID()); + + configCustomizationResource.setConfigurationResource(configResource); + configResourceCustomizationSet.add(configCustomizationResource); + + configResource.setConfigurationResourceCustomization(configResourceCustomizationSet); + return configCustomizationResource; + } + + + protected Optional<ConfigurationResourceCustomization> getVnrNodeTemplate(List<NodeTemplate> configurationNodeTemplatesList, + ToscaResourceStructure toscaResourceStructure, ServiceProxyResourceCustomization spResourceCustomization) { + Optional<ConfigurationResourceCustomization> configurationResourceCust = Optional.empty(); + for (NodeTemplate nodeTemplate : configurationNodeTemplatesList) { + StatefulEntityType entityType = nodeTemplate.getTypeDefinition(); + String type = entityType.getType(); + + if(VLAN_NETWORK_RECEPTOR.equals(type)) { + configurationResourceCust= Optional.of(getConfigurationResourceCustomization(nodeTemplate, + toscaResourceStructure,spResourceCustomization)); + break; + } + } + + return configurationResourceCust; + } protected void processServiceProxyAndConfiguration(ToscaResourceStructure toscaResourceStruct, Service service) { @@ -538,16 +598,16 @@ public class ToscaResourceInstaller { if (serviceProxyResourceList != null) { for (NodeTemplate spNode : serviceProxyResourceList) { - serviceProxy = createServiceProxy(spNode, service, toscaResourceStruct); - + serviceProxy = createServiceProxy(spNode, service, toscaResourceStruct); serviceProxyList.add(serviceProxy); - + Optional<ConfigurationResourceCustomization> vnrResourceCustomization = getVnrNodeTemplate(configurationNodeTemplatesList,toscaResourceStruct,serviceProxy); + for (NodeTemplate configNode : configurationNodeTemplatesList) { List<RequirementAssignment> requirementsList = toscaResourceStruct.getSdcCsarHelper().getRequirementsOf(configNode).getAll(); for (RequirementAssignment requirement : requirementsList) { if (requirement.getNodeTemplateName().equals(spNode.getName())) { - ConfigurationResourceCustomization configurationResource = createConfiguration(configNode, toscaResourceStruct, serviceProxy); + ConfigurationResourceCustomization configurationResource = createConfiguration(configNode, toscaResourceStruct, serviceProxy, vnrResourceCustomization); Optional<ConfigurationResourceCustomization> matchingObject = configurationResourceList.stream() .filter(configurationResourceCustomization -> configNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID).equals(configurationResource.getModelCustomizationUUID())) @@ -881,8 +941,6 @@ public class ToscaResourceInstaller { protected Service createService(ToscaResourceStructure toscaResourceStructure, VfResourceStructure vfResourceStructure) { - toscaResourceStructure.getServiceMetadata(); - Metadata serviceMetadata = toscaResourceStructure.getServiceMetadata(); Service service = new Service(); @@ -945,32 +1003,26 @@ public class ToscaResourceInstaller { return spCustomizationResource; } - protected ConfigurationResourceCustomization createConfiguration(NodeTemplate nodeTemplate, ToscaResourceStructure toscaResourceStructure, ServiceProxyResourceCustomization spResourceCustomization) { + protected ConfigurationResourceCustomization createConfiguration(NodeTemplate nodeTemplate, + ToscaResourceStructure toscaResourceStructure, ServiceProxyResourceCustomization spResourceCustomization, + Optional<ConfigurationResourceCustomization> vnrResourceCustomization) { - Metadata metadata = nodeTemplate.getMetaData(); - - ConfigurationResource configResource = new ConfigurationResource(); - - configResource.setModelName(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME)); - configResource.setModelInvariantUUID(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)); - configResource.setModelUUID(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID)); - configResource.setModelVersion(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)); - configResource.setDescription(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)); - configResource.setToscaNodeType(nodeTemplate.getType()); + ConfigurationResourceCustomization configCustomizationResource = getConfigurationResourceCustomization(nodeTemplate, + toscaResourceStructure,spResourceCustomization); - ConfigurationResourceCustomization configCustomizationResource = new ConfigurationResourceCustomization(); + ConfigurationResource configResource = getConfigurationResource(nodeTemplate); Set<ConfigurationResourceCustomization> configResourceCustomizationSet = new HashSet<>(); - configCustomizationResource.setModelCustomizationUUID(metadata.getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)); - configCustomizationResource.setModelInstanceName(nodeTemplate.getName()); - - configCustomizationResource.setNfFunction(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFFUNCTION)); - configCustomizationResource.setNfRole(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFROLE)); - configCustomizationResource.setNfType(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFTYPE)); - configCustomizationResource.setServiceProxyResourceCustomizationUUID(spResourceCustomization.getModelCustomizationUUID()); - configCustomizationResource.setConfigResourceCustomization(configCustomizationResource); + StatefulEntityType entityType = nodeTemplate.getTypeDefinition(); + String type = entityType.getType(); + + if(NODES_VRF_ENTRY.equals(type)) { + configCustomizationResource.setConfigResourceCustomization(vnrResourceCustomization.orElse(null)); + } + configCustomizationResource.setConfigurationResource(configResource); + configResourceCustomizationSet.add(configCustomizationResource); configResource.setConfigurationResourceCustomization(configResourceCustomizationSet); diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java index 9ab4c5ecb2..e4eb09782a 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/installer/heat/ToscaResourceInstallerTest.java @@ -23,71 +23,48 @@ package org.onap.so.asdc.installer.heat; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; import static com.shazam.shazamcrest.MatcherAssert.assertThat; import static org.junit.Assert.assertEquals; - -import static org.junit.Assert.assertNull; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.Mockito.doNothing; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.doThrow; -import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import java.io.File; -import java.io.FileInputStream; import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; import java.util.List; +import java.util.Optional; -import javax.transaction.Transactional; - -import org.apache.commons.io.IOUtils; import org.hibernate.exception.LockAcquisitionException; import org.junit.Before; -import org.junit.Ignore; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.mockito.Mock; +import org.mockito.Mockito; import org.mockito.MockitoAnnotations; import org.onap.sdc.api.notification.IResourceInstance; -import org.onap.sdc.api.results.IDistributionClientDownloadResult; +import org.onap.sdc.tosca.parser.api.ISdcCsarHelper; import org.onap.sdc.tosca.parser.impl.SdcCsarHelperImpl; import org.onap.sdc.tosca.parser.impl.SdcPropertyNames; -import org.onap.sdc.toscaparser.api.CapabilityAssignment; -import org.onap.sdc.toscaparser.api.CapabilityAssignments; import org.onap.sdc.toscaparser.api.Group; import org.onap.sdc.toscaparser.api.NodeTemplate; import org.onap.sdc.toscaparser.api.elements.Metadata; +import org.onap.sdc.toscaparser.api.elements.StatefulEntityType; import org.onap.sdc.utils.DistributionStatusEnum; import org.onap.so.asdc.BaseTest; -import org.onap.so.asdc.client.ASDCConfiguration; import org.onap.so.asdc.client.exceptions.ArtifactInstallerException; import org.onap.so.asdc.client.test.emulators.ArtifactInfoImpl; import org.onap.so.asdc.client.test.emulators.JsonStatusData; import org.onap.so.asdc.client.test.emulators.NotificationDataImpl; -import org.onap.so.asdc.installer.VfModuleArtifact; -import org.onap.so.asdc.installer.VfResourceStructure; -import org.onap.so.db.catalog.beans.AllottedResource; -import org.onap.so.db.catalog.beans.AllottedResourceCustomization; -import org.onap.so.db.catalog.beans.ExternalServiceToInternalService; -import org.onap.so.db.catalog.beans.HeatTemplate; -import org.onap.so.db.catalog.beans.NetworkResource; -import org.onap.so.db.catalog.beans.NetworkResourceCustomization; -import org.onap.so.db.catalog.beans.Service; -import org.onap.so.db.catalog.beans.VnfResource; -import org.onap.so.db.catalog.beans.VnfResourceCustomization; +import org.onap.so.asdc.installer.ToscaResourceStructure; +import org.onap.so.db.catalog.beans.ConfigurationResource; +import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization; +import org.onap.so.db.catalog.beans.ServiceProxyResourceCustomization; import org.onap.so.db.catalog.data.repository.AllottedResourceCustomizationRepository; import org.onap.so.db.catalog.data.repository.AllottedResourceRepository; -import org.onap.so.db.catalog.data.repository.ExternalServiceToInternalServiceRepository; import org.onap.so.db.catalog.data.repository.ServiceRepository; import org.onap.so.db.request.beans.WatchdogComponentDistributionStatus; -import org.onap.so.db.request.beans.WatchdogDistributionStatus; -import org.onap.so.db.request.beans.WatchdogServiceModVerIdLookup; import org.onap.so.db.request.data.repository.WatchdogComponentDistributionStatusRepository; import org.springframework.beans.factory.annotation.Autowired; @@ -114,6 +91,16 @@ public class ToscaResourceInstallerTest extends BaseTest { private IResourceInstance resourceInstance; @Rule public ExpectedException expectedException = ExpectedException.none(); + @Mock + private NodeTemplate nodeTemplate; + @Mock + private ToscaResourceStructure toscaResourceStructure; + @Mock + private ServiceProxyResourceCustomization spResourceCustomization; + @Mock + private ISdcCsarHelper csarHelper; + @Mock + private StatefulEntityType entityType; private NotificationDataImpl notificationData; private JsonStatusData statusData; @@ -310,4 +297,82 @@ public class ToscaResourceInstallerTest extends BaseTest { } return actualWatchdogComponentDistributionStatus; } + + + + + private void prepareConfigurationResource() { + doReturn(metadata).when(nodeTemplate).getMetaData(); + doReturn(MockConstants.TEMPLATE_TYPE).when(nodeTemplate).getType(); + + doReturn(MockConstants.MODEL_NAME).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_NAME); + doReturn(MockConstants.MODEL_INVARIANT_UUID).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID); + doReturn(MockConstants.MODEL_UUID).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_UUID); + doReturn(MockConstants.MODEL_VERSION).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_VERSION); + doReturn(MockConstants.MODEL_DESCRIPTION).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION); + doReturn(MockConstants.MODEL_NAME).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_NAME); + doReturn(MockConstants.MODEL_NAME).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_NAME); + } + + @Test + public void getConfigurationResourceTest() { + prepareConfigurationResource(); + + ConfigurationResource configResource=toscaInstaller.getConfigurationResource(nodeTemplate); + + assertNotNull(configResource); + assertEquals(MockConstants.MODEL_NAME, configResource.getModelName()); + assertEquals(MockConstants.MODEL_INVARIANT_UUID, configResource.getModelInvariantUUID()); + assertEquals(MockConstants.MODEL_UUID, configResource.getModelUUID()); + assertEquals(MockConstants.MODEL_VERSION, configResource.getModelVersion()); + assertEquals(MockConstants.MODEL_DESCRIPTION, configResource.getDescription()); + assertEquals(MockConstants.TEMPLATE_TYPE, nodeTemplate.getType()); + } + + private void prepareConfigurationResourceCustomization() { + prepareConfigurationResource(); + doReturn(MockConstants.MODEL_CUSTOMIZATIONUUID).when(metadata).getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID); + doReturn(csarHelper).when(toscaResourceStructure).getSdcCsarHelper(); + doReturn(null).when(csarHelper).getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFFUNCTION); + doReturn(null).when(csarHelper).getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFROLE); + doReturn(null).when(csarHelper).getNodeTemplatePropertyLeafValue(nodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFTYPE); + doReturn(MockConstants.MODEL_CUSTOMIZATIONUUID).when(spResourceCustomization).getModelCustomizationUUID(); + } + + + @Test + public void getConfigurationResourceCustomizationTest() { + prepareConfigurationResourceCustomization(); + + ConfigurationResourceCustomization configurationResourceCustomization = toscaInstaller.getConfigurationResourceCustomization( + nodeTemplate, toscaResourceStructure, spResourceCustomization); + assertNotNull(configurationResourceCustomization); + assertNotNull(configurationResourceCustomization.getConfigurationResource()); + assertEquals(MockConstants.MODEL_CUSTOMIZATIONUUID, configurationResourceCustomization.getServiceProxyResourceCustomizationUUID()); + } + + @Test + public void getVnrNodeTemplateTest() { + prepareConfigurationResourceCustomization(); + List<NodeTemplate> nodeTemplateList = new ArrayList<>(); + doReturn(ToscaResourceInstaller.VLAN_NETWORK_RECEPTOR).when(entityType).getType(); + doReturn(entityType).when(nodeTemplate).getTypeDefinition(); + nodeTemplateList.add(nodeTemplate); + Optional<ConfigurationResourceCustomization> vnrResourceCustomization= + toscaInstaller.getVnrNodeTemplate(nodeTemplateList, toscaResourceStructure, spResourceCustomization); + assertTrue(vnrResourceCustomization.isPresent()); + assertEquals(ToscaResourceInstaller.VLAN_NETWORK_RECEPTOR, entityType.getType()); + } + + class MockConstants{ + public final static String MODEL_NAME = "VLAN Network Receptor Configuration"; + public final static String MODEL_INVARIANT_UUID = "1608eef4-de53-4334-a8d2-ba79cab4bde0"; + public final static String MODEL_UUID = "212ca27b-554c-474c-96b9-ddc2f1b1ddba"; + public final static String MODEL_VERSION = "30.0"; + public final static String MODEL_DESCRIPTION = "VLAN network receptor configuration object"; + public final static String MODEL_CUSTOMIZATIONUUID = "2db953e8-679d-437b-bff7-cb262638a8cd"; + public final static String TEMPLATE_TYPE = "org.openecomp.nodes.VLANNetworkReceptor"; + public final static String TEMPLATE_NAME = "VLAN Network Receptor Configuration 0"; + + } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy index 13d5aad2b0..0af1bcb00e 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -33,7 +35,9 @@ import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger -import org.springframework.web.util.UriUtils; +import org.springframework.web.util.UriUtils +import org.slf4j.Logger +import org.slf4j.LoggerFactory import groovy.json.* @@ -46,7 +50,7 @@ import groovy.json.* * */ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateVcpeResCustService.class); + private static final Logger logger = LoggerFactory.getLogger(CreateVcpeResCustService.class); private static final String DebugFlag = "isDebugLogEnabled" @@ -90,7 +94,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { def isDebugEnabled = execution.getVariable(DebugFlag) execution.setVariable("prefix", Prefix) - msoLogger.trace("Inside preProcessRequest CreateVcpeResCustService Request ") + logger.trace("Inside preProcessRequest CreateVcpeResCustService Request ") try { // initialize flow variables @@ -100,15 +104,15 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { String aaiDistDelay = UrnPropertiesReader.getVariable("aai.workflowAaiDistributionDelay", execution) if (isBlank(aaiDistDelay)) { String msg = "workflowAaiDistributionDelay is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } execution.setVariable("aaiDistDelay", aaiDistDelay) - msoLogger.debug("AAI distribution delay: " + aaiDistDelay) + logger.debug("AAI distribution delay: " + aaiDistDelay) // check for incoming json message/input String createVcpeServiceRequest = execution.getVariable("bpmnRequest") - msoLogger.debug(createVcpeServiceRequest) + logger.debug(createVcpeServiceRequest) execution.setVariable("createVcpeServiceRequest", createVcpeServiceRequest); println 'createVcpeServiceRequest - ' + createVcpeServiceRequest @@ -120,18 +124,18 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { if ((serviceInstanceId == null) || (serviceInstanceId.isEmpty())) { serviceInstanceId = UUID.randomUUID().toString() - msoLogger.debug(" Generated new Service Instance: " + serviceInstanceId) + logger.debug(" Generated new Service Instance: " + serviceInstanceId) } else { - msoLogger.debug("Using provided Service Instance ID: " + serviceInstanceId) + logger.debug("Using provided Service Instance ID: " + serviceInstanceId) } serviceInstanceId = UriUtils.encode(serviceInstanceId, "UTF-8") execution.setVariable("serviceInstanceId", serviceInstanceId) - utils.log("DEBUG", "Incoming serviceInstanceId is: " + serviceInstanceId, isDebugEnabled) + logger.debug("Incoming serviceInstanceId is: " + serviceInstanceId) String serviceInstanceName = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.instanceName") execution.setVariable("serviceInstanceName", serviceInstanceName) - utils.log("DEBUG", "Incoming serviceInstanceName is: " + serviceInstanceName, isDebugEnabled) + logger.debug("Incoming serviceInstanceName is: " + serviceInstanceName) String requestAction = execution.getVariable("requestAction") execution.setVariable("requestAction", requestAction) @@ -160,19 +164,19 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { // extract subscriptionServiceType String subscriptionServiceType = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestParameters.subscriptionServiceType") execution.setVariable("subscriptionServiceType", subscriptionServiceType) - msoLogger.debug("Incoming subscriptionServiceType is: " + subscriptionServiceType) + logger.debug("Incoming subscriptionServiceType is: " + subscriptionServiceType) String suppressRollback = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.suppressRollback") execution.setVariable("disableRollback", suppressRollback) - msoLogger.debug("Incoming Suppress/Disable Rollback is: " + suppressRollback) + logger.debug("Incoming Suppress/Disable Rollback is: " + suppressRollback) String productFamilyId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.productFamilyId") execution.setVariable("productFamilyId", productFamilyId) - msoLogger.debug("Incoming productFamilyId is: " + productFamilyId) + logger.debug("Incoming productFamilyId is: " + productFamilyId) String subscriberInfo = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.subscriberInfo") execution.setVariable("subscriberInfo", subscriberInfo) - msoLogger.debug("Incoming subscriberInfo is: " + subscriberInfo) + logger.debug("Incoming subscriberInfo is: " + subscriberInfo) // extract cloud configuration - if underscore "_" is present treat as vimId else it's a cloudRegion String vimId = jsonUtil.getJsonValue(createVcpeServiceRequest, @@ -182,21 +186,21 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { def cloudOwner = cloudRegion[0] def cloudRegionId = cloudRegion[1] execution.setVariable("cloudOwner", cloudOwner) - msoLogger.debug("cloudOwner: " + cloudOwner) + logger.debug("cloudOwner: " + cloudOwner) execution.setVariable("cloudRegionId", cloudRegionId) - msoLogger.debug("cloudRegionId: " + cloudRegionId) + logger.debug("cloudRegionId: " + cloudRegionId) } else { - msoLogger.debug("vimId is not present - setting cloudRegion/cloudOwner from request.") + logger.debug("vimId is not present - setting cloudRegion/cloudOwner from request.") String cloudOwner = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.cloudConfiguration.cloudOwner") if (!cloudOwner?.empty && cloudOwner != "") { execution.setVariable("cloudOwner", cloudOwner) - msoLogger.debug("cloudOwner: " + cloudOwner) + logger.debug("cloudOwner: " + cloudOwner) } def cloudRegionId = vimId execution.setVariable("cloudRegionId", cloudRegionId) - msoLogger.debug("cloudRegionId: " + cloudRegionId) + logger.debug("cloudRegionId: " + cloudRegionId) } /* * Extracting User Parameters from incoming Request and converting into a Map @@ -222,8 +226,8 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { execution.setVariable("customerLocation", customerMap) } if ("Homing_Model_Ids".equals(userParam?.name)) { - utils.log("DEBUG", "Homing_Model_Ids: " + userParam.value.toString() + " ---- Type is:" + - userParam.value.getClass() , isDebugEnabled) + logger.debug("Homing_Model_Ids: " + userParam.value.toString() + " ---- Type is:" + + userParam.value.getClass()) def modelIdLst = [] userParam.value.each { param -> @@ -233,8 +237,8 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { valueMap.put(entry.key, entry.value) } modelIdLst.add(valueMap) - utils.log("DEBUG", "Param: " + param.toString() + " ---- Type is:" + - param.getClass() , isDebugEnabled) + logger.debug("Param: " + param.toString() + " ---- Type is:" + + param.getClass()) } execution.setVariable("homingModelIds", modelIdLst) } @@ -252,7 +256,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { inputMap.put("orchestrator", userParam.value) } if ("VfModuleNames".equals(userParam?.name)) { - utils.log("DEBUG", "VfModuleNames: " + userParam.value.toString(), isDebugEnabled) + logger.debug("VfModuleNames: " + userParam.value.toString()) def vfModuleNames = [:] userParam.value.each { entry -> @@ -269,8 +273,8 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { if (vfModuleModelInvariantUuid != null && !vfModuleModelInvariantUuid.isEmpty() && vfModuleName != null && !vfModuleName.isEmpty()) { vfModuleNames.put(vfModuleModelInvariantUuid, vfModuleName) - utils.log("DEBUG", "VfModuleModelInvariantUuid: " + vfModuleModelInvariantUuid + " VfModuleName: " + vfModuleName, isDebugEnabled) - } + logger.debug("VfModuleModelInvariantUuid: " + vfModuleModelInvariantUuid + " VfModuleName: " + vfModuleName) + } } execution.setVariable("vfModuleNames", vfModuleNames) } @@ -282,10 +286,10 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { execution.setVariable("homingService", "oof") } - msoLogger.debug("User Input Parameters map: " + userParams.toString()) + logger.debug("User Input Parameters map: " + userParams.toString()) execution.setVariable("serviceInputParams", inputMap) // DOES NOT SEEM TO BE USED - msoLogger.debug("Incoming brgWanMacAddress is: " + execution.getVariable('brgWanMacAddress')) + logger.debug("Incoming brgWanMacAddress is: " + execution.getVariable('brgWanMacAddress')) //For Completion Handler & Fallout Handler String requestInfo = @@ -297,7 +301,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { execution.setVariable(Prefix + "requestInfo", requestInfo) - msoLogger.trace("Completed preProcessRequest CreateVcpeResCustService Request ") + logger.trace("Completed preProcessRequest CreateVcpeResCustService Request ") } catch (BpmnError e) { throw e; @@ -310,7 +314,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { public void sendSyncResponse(DelegateExecution execution) { - msoLogger.trace("Inside sendSyncResponse of CreateVcpeResCustService ") + logger.trace("Inside sendSyncResponse of CreateVcpeResCustService ") try { String serviceInstanceId = execution.getVariable("serviceInstanceId") @@ -321,7 +325,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { requestId }"}}""".trim() - msoLogger.debug(" sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse) + logger.debug(" sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse) sendWorkflowResponse(execution, 202, syncResponse) } catch (Exception ex) { @@ -336,7 +340,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { public void prepareDecomposeService(DelegateExecution execution) { try { - msoLogger.trace("Inside prepareDecomposeService of CreateVcpeResCustService ") + logger.trace("Inside prepareDecomposeService of CreateVcpeResCustService ") String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest") @@ -344,7 +348,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { String serviceModelInfo = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.modelInfo") execution.setVariable("serviceModelInfo", serviceModelInfo) - msoLogger.trace("Completed prepareDecomposeService of CreateVcpeResCustService ") + logger.trace("Completed prepareDecomposeService of CreateVcpeResCustService ") } catch (Exception ex) { // try error in method block String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method prepareDecomposeService() - " + ex.getMessage() @@ -358,7 +362,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { public void prepareCreateServiceInstance(DelegateExecution execution) { try { - msoLogger.trace("Inside prepareCreateServiceInstance of CreateVcpeResCustService ") + logger.trace("Inside prepareCreateServiceInstance of CreateVcpeResCustService ") /* * Service modelInfo is created in earlier step. This flow can use it as-is ... or, extract from DecompositionObject @@ -377,7 +381,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") execution.setVariable("serviceDecompositionString", serviceDecomposition.toJsonStringNoRootName()) - msoLogger.trace("Completed prepareCreateServiceInstance of CreateVcpeResCustService ") + logger.trace("Completed prepareCreateServiceInstance of CreateVcpeResCustService ") } catch (Exception ex) { // try error in method block String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage() @@ -387,7 +391,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { public void postProcessServiceInstanceCreate(DelegateExecution execution) { def method = getClass().getSimpleName() + '.postProcessServiceInstanceCreate(' + 'execution=' + execution.getId() + ')' - msoLogger.trace('Entered ' + method) + logger.trace('Entered ' + method) String requestId = execution.getVariable("mso-request-id") String serviceInstanceId = execution.getVariable("serviceInstanceId") @@ -409,13 +413,15 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { </soapenv:Envelope> """ execution.setVariable(Prefix + "setUpdateDbInstancePayload", payload) - msoLogger.debug(Prefix + "setUpdateDbInstancePayload: " + payload) - msoLogger.trace('Exited ' + method) + logger.debug(Prefix + "setUpdateDbInstancePayload: " + payload) + logger.trace('Exited ' + method) } catch (BpmnError e) { throw e; } catch (Exception e) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + 'Caught exception in ' + method, "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method) } } @@ -423,7 +429,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { public void processDecomposition(DelegateExecution execution) { - msoLogger.trace("Inside processDecomposition() of CreateVcpeResCustService ") + logger.trace("Inside processDecomposition() of CreateVcpeResCustService ") try { @@ -440,7 +446,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { String vnfModelInfoString = "" if (vnfList != null && vnfList.size() > 0) { execution.setVariable(Prefix + "VNFsCount", vnfList.size()) - msoLogger.debug("vnfs to create: " + vnfList.size()) + logger.debug("vnfs to create: " + vnfList.size()) ModelInfo vnfModelInfo = vnfList[0].getModelInfo() vnfModelInfoString = vnfModelInfo.toString() @@ -448,18 +454,18 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { vnfModelInfoString = jsonUtil.getJsonValue(vnfModelInfoWithRoot, "modelInfo") } else { execution.setVariable(Prefix + "VNFsCount", 0) - msoLogger.debug("no vnfs to create based upon serviceDecomposition content") + logger.debug("no vnfs to create based upon serviceDecomposition content") } execution.setVariable("vnfModelInfo", vnfModelInfoString) execution.setVariable("vnfModelInfoString", vnfModelInfoString) - msoLogger.debug(" vnfModelInfoString :" + vnfModelInfoString) + logger.debug(" vnfModelInfoString :" + vnfModelInfoString) - msoLogger.trace("Completed processDecomposition() of CreateVcpeResCustService ") + logger.trace("Completed processDecomposition() of CreateVcpeResCustService ") } catch (Exception ex) { sendSyncError(execution) String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. processDecomposition() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + logger.debug(exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } } @@ -486,7 +492,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { public void prepareCreateAllottedResourceTXC(DelegateExecution execution) { try { - msoLogger.trace("Inside prepareCreateAllottedResourceTXC of CreateVcpeResCustService ") + logger.trace("Inside prepareCreateAllottedResourceTXC of CreateVcpeResCustService ") /* * Service modelInfo is created in earlier step. This flow can use it as-is ... or, extract from DecompositionObject @@ -506,8 +512,8 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { while (iter.hasNext()) { AllottedResource allottedResource = (AllottedResource) iter.next(); - msoLogger.debug(" getting model info for AllottedResource # :" + allottedResource.toJsonStringNoRootName()) - msoLogger.debug(" allottedResource.getAllottedResourceType() :" + allottedResource.getAllottedResourceType()) + logger.debug(" getting model info for AllottedResource # :" + allottedResource.toJsonStringNoRootName()) + logger.debug(" allottedResource.getAllottedResourceType() :" + allottedResource.getAllottedResourceType()) if ("TunnelXConn".equalsIgnoreCase(allottedResource.getAllottedResourceType()) || "Tunnel XConn".equalsIgnoreCase(allottedResource.getAllottedResourceType())) { //set create flag to true execution.setVariable("createTXCAR", true) @@ -525,9 +531,9 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { //unit test only String allottedResourceId = execution.getVariable("allottedResourceId") execution.setVariable("allottedResourceIdTXC", allottedResourceId) - msoLogger.debug("setting allottedResourceId CreateVcpeResCustService " + allottedResourceId) + logger.debug("setting allottedResourceId CreateVcpeResCustService " + allottedResourceId) - msoLogger.trace("Completed prepareCreateAllottedResourceTXC of CreateVcpeResCustService ") + logger.trace("Completed prepareCreateAllottedResourceTXC of CreateVcpeResCustService ") } catch (Exception ex) { // try error in method block String exceptionMessage = "Bpmn error encountered in prepareCreateAllottedResourceTXC flow. Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage() @@ -538,7 +544,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { public void prepareCreateAllottedResourceBRG(DelegateExecution execution) { try { - msoLogger.trace("Inside prepareCreateAllottedResourceBRG of CreateVcpeResCustService ") + logger.trace("Inside prepareCreateAllottedResourceBRG of CreateVcpeResCustService ") /* * Service modelInfo is created in earlier step. This flow can use it as-is ... or, extract from DecompositionObject @@ -558,8 +564,8 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { while (iter.hasNext()) { AllottedResource allottedResource = (AllottedResource) iter.next(); - msoLogger.debug(" getting model info for AllottedResource # :" + allottedResource.toJsonStringNoRootName()) - msoLogger.debug(" allottedResource.getAllottedResourceType() :" + allottedResource.getAllottedResourceType()) + logger.debug(" getting model info for AllottedResource # :" + allottedResource.toJsonStringNoRootName()) + logger.debug(" allottedResource.getAllottedResourceType() :" + allottedResource.getAllottedResourceType()) if ("BRG".equalsIgnoreCase(allottedResource.getAllottedResourceType())) { //set create flag to true execution.setVariable("createBRGAR", true) @@ -577,9 +583,9 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { //unit test only String allottedResourceId = execution.getVariable("allottedResourceId") execution.setVariable("allottedResourceIdBRG", allottedResourceId) - msoLogger.debug("setting allottedResourceId CreateVcpeResCustService " + allottedResourceId) + logger.debug("setting allottedResourceId CreateVcpeResCustService " + allottedResourceId) - msoLogger.trace("Completed prepareCreateAllottedResourceBRG of CreateVcpeResCustService ") + logger.trace("Completed prepareCreateAllottedResourceBRG of CreateVcpeResCustService ") } catch (Exception ex) { // try error in method block String exceptionMessage = "Bpmn error encountered in prepareCreateAllottedResourceBRG flow. Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage() @@ -593,7 +599,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { public void prepareVnfAndModulesCreate(DelegateExecution execution) { try { - msoLogger.trace("Inside prepareVnfAndModulesCreate of CreateVcpeResCustService ") + logger.trace("Inside prepareVnfAndModulesCreate of CreateVcpeResCustService ") // String disableRollback = execution.getVariable("disableRollback") // def backoutOnFailure = "" @@ -609,7 +615,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest") String productFamilyId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.productFamilyId") execution.setVariable("productFamilyId", productFamilyId) - msoLogger.debug("productFamilyId: " + productFamilyId) + logger.debug("productFamilyId: " + productFamilyId) List<VnfResource> vnfList = execution.getVariable("vnfList") @@ -617,9 +623,9 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { String vnfModelInfoString = null; if (vnfList != null && vnfList.size() > 0) { - msoLogger.debug("getting model info for vnf # " + vnfsCreatedCount) + logger.debug("getting model info for vnf # " + vnfsCreatedCount) ModelInfo vnfModelInfo1 = vnfList[0].getModelInfo() - msoLogger.debug("got 0 ") + logger.debug("got 0 ") ModelInfo vnfModelInfo = vnfList[vnfsCreatedCount.intValue()].getModelInfo() vnfModelInfoString = vnfModelInfo.toString() } else { @@ -627,7 +633,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { vnfModelInfoString = execution.getVariable("vnfModelInfo") } - msoLogger.debug(" vnfModelInfoString :" + vnfModelInfoString) + logger.debug(" vnfModelInfoString :" + vnfModelInfoString) // extract cloud configuration - if underscore "_" is present treat as vimId else it's a cloudRegion String vimId = jsonUtil.getJsonValue(createVcpeServiceRequest, @@ -635,35 +641,35 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { if (vimId.contains("_") && vimId.split("_").length == 2 ) { def cloudRegion = vimId.split("_") execution.setVariable("cloudOwner", cloudRegion[0]) - msoLogger.debug("cloudOwner: " + cloudRegion[0]) + logger.debug("cloudOwner: " + cloudRegion[0]) execution.setVariable("cloudRegionId", cloudRegion[1]) - msoLogger.debug("cloudRegionId: " + cloudRegion[1]) + logger.debug("cloudRegionId: " + cloudRegion[1]) execution.setVariable("lcpCloudRegionId", cloudRegion[1]) - msoLogger.debug("lcpCloudRegionId: " + cloudRegion[1]) + logger.debug("lcpCloudRegionId: " + cloudRegion[1]) } else { - msoLogger.debug("vimId is not present - setting cloudRegion/cloudOwner from request.") + logger.debug("vimId is not present - setting cloudRegion/cloudOwner from request.") String cloudOwner = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.cloudConfiguration.cloudOwner") if (!cloudOwner?.empty && cloudOwner != "") { execution.setVariable("cloudOwner", cloudOwner) - msoLogger.debug("cloudOwner: " + cloudOwner) + logger.debug("cloudOwner: " + cloudOwner) } execution.setVariable("cloudRegionId", vimId) - msoLogger.debug("cloudRegionId: " + vimId) + logger.debug("cloudRegionId: " + vimId) execution.setVariable("lcpCloudRegionId", vimId) - msoLogger.debug("lcpCloudRegionId: " + vimId) + logger.debug("lcpCloudRegionId: " + vimId) } String tenantId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.cloudConfiguration.tenantId") execution.setVariable("tenantId", tenantId) - msoLogger.debug("tenantId: " + tenantId) + logger.debug("tenantId: " + tenantId) String sdncVersion = execution.getVariable("sdncVersion") - msoLogger.debug("sdncVersion: " + sdncVersion) + logger.debug("sdncVersion: " + sdncVersion) - msoLogger.trace("Completed prepareVnfAndModulesCreate of CreateVcpeResCustService ") + logger.trace("Completed prepareVnfAndModulesCreate of CreateVcpeResCustService ") } catch (Exception ex) { // try error in method block String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method prepareVnfAndModulesCreate() - " + ex.getMessage() @@ -677,14 +683,14 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { public void validateVnfCreate(DelegateExecution execution) { try { - msoLogger.trace("Inside validateVnfCreate of CreateVcpeResCustService ") + logger.trace("Inside validateVnfCreate of CreateVcpeResCustService ") Integer vnfsCreatedCount = execution.getVariable(Prefix + "VnfsCreatedCount") vnfsCreatedCount++ execution.setVariable(Prefix + "VnfsCreatedCount", vnfsCreatedCount) - msoLogger.debug(" ***** Completed validateVnfCreate of CreateVcpeResCustService ***** " + " vnf # " + vnfsCreatedCount) + logger.debug(" ***** Completed validateVnfCreate of CreateVcpeResCustService ***** " + " vnf # " + vnfsCreatedCount) } catch (Exception ex) { // try error in method block String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method validateVnfCreate() - " + ex.getMessage() @@ -697,7 +703,7 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { // ***************************************** public void postProcessResponse(DelegateExecution execution) { - msoLogger.trace("Inside postProcessResponse of CreateVcpeResCustService ") + logger.trace("Inside postProcessResponse of CreateVcpeResCustService ") try { String source = execution.getVariable("source") @@ -720,10 +726,10 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { // Format Response String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) - msoLogger.debug(xmlMsoCompletionRequest) + logger.debug(xmlMsoCompletionRequest) execution.setVariable(Prefix + "Success", true) execution.setVariable(Prefix + "CompleteMsoProcessRequest", xmlMsoCompletionRequest) - msoLogger.debug(" SUCCESS flow, going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest) + logger.debug(" SUCCESS flow, going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest) } catch (BpmnError e) { throw e; } catch (Exception ex) { @@ -734,53 +740,53 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { } public void preProcessRollback(DelegateExecution execution) { - msoLogger.trace("preProcessRollback of CreateVcpeResCustService ") + logger.trace("preProcessRollback of CreateVcpeResCustService ") try { Object workflowException = execution.getVariable("WorkflowException"); if (workflowException instanceof WorkflowException) { - msoLogger.debug("Prev workflowException: " + workflowException.getErrorMessage()) + logger.debug("Prev workflowException: " + workflowException.getErrorMessage()) execution.setVariable("prevWorkflowException", workflowException); //execution.setVariable("WorkflowException", null); } } catch (BpmnError e) { - msoLogger.debug("BPMN Error during preProcessRollback") + logger.debug("BPMN Error during preProcessRollback") } catch (Exception ex) { String msg = "Exception in preProcessRollback. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) } - msoLogger.trace("Exit preProcessRollback of CreateVcpeResCustService ") + logger.trace("Exit preProcessRollback of CreateVcpeResCustService ") } public void postProcessRollback(DelegateExecution execution) { - msoLogger.trace("postProcessRollback of CreateVcpeResCustService ") + logger.trace("postProcessRollback of CreateVcpeResCustService ") String msg = "" try { Object workflowException = execution.getVariable("prevWorkflowException"); if (workflowException instanceof WorkflowException) { - msoLogger.debug("Setting prevException to WorkflowException: ") + logger.debug("Setting prevException to WorkflowException: ") execution.setVariable("WorkflowException", workflowException); } } catch (BpmnError b) { - msoLogger.debug("BPMN Error during postProcessRollback") + logger.debug("BPMN Error during postProcessRollback") throw b; } catch (Exception ex) { msg = "Exception in postProcessRollback. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) } - msoLogger.trace("Exit postProcessRollback of CreateVcpeResCustService ") + logger.trace("Exit postProcessRollback of CreateVcpeResCustService ") } public void prepareFalloutRequest(DelegateExecution execution) { - msoLogger.trace("STARTED CreateVcpeResCustService prepareFalloutRequest Process ") + logger.trace("STARTED CreateVcpeResCustService prepareFalloutRequest Process ") try { WorkflowException wfex = execution.getVariable("WorkflowException") - msoLogger.debug(" Incoming Workflow Exception: " + wfex.toString()) + logger.debug(" Incoming Workflow Exception: " + wfex.toString()) String requestInfo = execution.getVariable(Prefix + "requestInfo") - msoLogger.debug(" Incoming Request Info: " + requestInfo) + logger.debug(" Incoming Request Info: " + requestInfo) //TODO. hmmm. there is no way to UPDATE error message. // String errorMessage = wfex.getErrorMessage() @@ -796,17 +802,17 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { execution.setVariable(Prefix + "falloutRequest", falloutRequest) } catch (Exception ex) { - msoLogger.debug("Error Occured in CreateVcpeResCustService prepareFalloutRequest Process " + ex.getMessage()) + logger.debug("Error Occured in CreateVcpeResCustService prepareFalloutRequest Process " + ex.getMessage()) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVcpeResCustService prepareFalloutRequest Process") } - msoLogger.trace("COMPLETED CreateVcpeResCustService prepareFalloutRequest Process ") + logger.trace("COMPLETED CreateVcpeResCustService prepareFalloutRequest Process ") } public void sendSyncError(DelegateExecution execution) { execution.setVariable("prefix", Prefix) - msoLogger.trace("Inside sendSyncError() of CreateVcpeResCustService ") + logger.trace("Inside sendSyncError() of CreateVcpeResCustService ") try { String errorMessage = "" @@ -823,31 +829,33 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { <aetgt:ErrorCode>7000</aetgt:ErrorCode> </aetgt:WorkflowException>""" - msoLogger.debug(buildworkflowException) + logger.debug(buildworkflowException) sendWorkflowResponse(execution, 500, buildworkflowException) } catch (Exception ex) { - msoLogger.debug(" Sending Sync Error Activity Failed. " + "\n" + ex.getMessage()) + logger.debug(" Sending Sync Error Activity Failed. " + "\n" + ex.getMessage()) } } public void processJavaException(DelegateExecution execution) { execution.setVariable("prefix", Prefix) try { - msoLogger.debug("Caught a Java Exception") - msoLogger.debug("Started processJavaException Method") - msoLogger.debug("Variables List: " + execution.getVariables()) + logger.debug("Caught a Java Exception") + logger.debug("Started processJavaException Method") + logger.debug("Variables List: " + execution.getVariables()) execution.setVariable(Prefix + "unexpectedError", "Caught a Java Lang Exception") // Adding this line temporarily until this flows error handling gets updated exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Caught a Java Lang Exception") } catch (BpmnError b) { - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Rethrowing MSOWorkflowException", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Rethrowing MSOWorkflowException", "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue()); throw b } catch (Exception e) { - msoLogger.debug("Caught Exception during processJavaException Method: " + e) + logger.debug("Caught Exception during processJavaException Method: " + e) execution.setVariable(Prefix + "unexpectedError", "Exception in processJavaException method") // Adding this line temporarily until this flows error handling gets updated exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception in processJavaException method") } - msoLogger.debug("Completed processJavaException Method") + logger.debug("Completed processJavaException Method") } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy index 7a40ef978b..75f5ec9161 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DeleteVcpeResCustService.groovy @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -29,6 +31,8 @@ import org.onap.so.bpmn.core.WorkflowException import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory import org.onap.so.client.aai.AAIResourcesClient import org.onap.so.client.aai.AAIObjectType @@ -45,7 +49,7 @@ import javax.ws.rs.NotFoundException * */ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DeleteVcpeResCustService.class); + private static final Logger logger = LoggerFactory.getLogger(DeleteVcpeResCustService.class); private static final String DebugFlag = "isDebugLogEnabled" @@ -79,7 +83,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { def isDebugEnabled=execution.getVariable(DebugFlag) execution.setVariable("prefix",Prefix) - msoLogger.trace("Inside preProcessRequest DeleteVcpeResCustService Request ") + logger.trace("Inside preProcessRequest DeleteVcpeResCustService Request ") try { // initialize flow variables @@ -87,7 +91,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { // check for incoming json message/input String DeleteVcpeResCustServiceRequest = execution.getVariable("bpmnRequest") - msoLogger.debug(DeleteVcpeResCustServiceRequest) + logger.debug(DeleteVcpeResCustServiceRequest) execution.setVariable("DeleteVcpeResCustServiceRequest", DeleteVcpeResCustServiceRequest); println 'DeleteVcpeResCustServiceRequest - ' + DeleteVcpeResCustServiceRequest @@ -120,34 +124,34 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { String suppressRollback = jsonUtil.getJsonValue(DeleteVcpeResCustServiceRequest, "requestDetails.requestInfo.suppressRollback") execution.setVariable("disableRollback", suppressRollback) - msoLogger.debug("Incoming Suppress/Disable Rollback is: " + suppressRollback) + logger.debug("Incoming Suppress/Disable Rollback is: " + suppressRollback) String productFamilyId = jsonUtil.getJsonValue(DeleteVcpeResCustServiceRequest, "requestDetails.requestInfo.productFamilyId") execution.setVariable("productFamilyId", productFamilyId) - msoLogger.debug("Incoming productFamilyId is: " + productFamilyId) + logger.debug("Incoming productFamilyId is: " + productFamilyId) // extract subscriptionServiceType String subscriptionServiceType = jsonUtil.getJsonValue(DeleteVcpeResCustServiceRequest, "requestDetails.requestParameters.subscriptionServiceType") execution.setVariable("subscriptionServiceType", subscriptionServiceType) - msoLogger.debug("Incoming subscriptionServiceType is: " + subscriptionServiceType) + logger.debug("Incoming subscriptionServiceType is: " + subscriptionServiceType) // extract cloud configuration String cloudConfiguration = jsonUtil.getJsonValue(DeleteVcpeResCustServiceRequest, "requestDetails.cloudConfiguration") execution.setVariable("cloudConfiguration", cloudConfiguration) - msoLogger.debug("cloudConfiguration: "+ cloudConfiguration) + logger.debug("cloudConfiguration: "+ cloudConfiguration) String lcpCloudRegionId = jsonUtil.getJsonValue(cloudConfiguration, "lcpCloudRegionId") execution.setVariable("lcpCloudRegionId", lcpCloudRegionId) - msoLogger.debug("lcpCloudRegionId: "+ lcpCloudRegionId) + logger.debug("lcpCloudRegionId: "+ lcpCloudRegionId) String cloudOwner = jsonUtil.getJsonValue(cloudConfiguration, "cloudOwner") execution.setVariable("cloudOwner", cloudOwner) - msoLogger.debug("cloudOwner: "+ cloudOwner) + logger.debug("cloudOwner: "+ cloudOwner) String tenantId = jsonUtil.getJsonValue(cloudConfiguration, "tenantId") execution.setVariable("tenantId", tenantId) - msoLogger.debug("tenantId: "+ tenantId) + logger.debug("tenantId: "+ tenantId) String sdncVersion = "1707" execution.setVariable("sdncVersion", sdncVersion) - msoLogger.debug("sdncVersion: "+ sdncVersion) + logger.debug("sdncVersion: "+ sdncVersion) //For Completion Handler & Fallout Handler String requestInfo = @@ -159,7 +163,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { execution.setVariable(Prefix+"requestInfo", requestInfo) - msoLogger.trace("Completed preProcessRequest DeleteVcpeResCustServiceRequest Request ") + logger.trace("Completed preProcessRequest DeleteVcpeResCustServiceRequest Request ") } catch (BpmnError e) { throw e; @@ -172,7 +176,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { public void sendSyncResponse(DelegateExecution execution) { def isDebugEnabled=execution.getVariable(DebugFlag) - msoLogger.trace("Inside sendSyncResponse of DeleteVcpeResCustService ") + logger.trace("Inside sendSyncResponse of DeleteVcpeResCustService ") try { String serviceInstanceId = execution.getVariable("serviceInstanceId") @@ -181,7 +185,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { // RESTResponse (for API Handler (APIH) Reply Task) String syncResponse ="""{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${requestId}"}}""".trim() - msoLogger.debug(" sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse) + logger.debug(" sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse) sendWorkflowResponse(execution, 202, syncResponse) } catch (Exception ex) { String exceptionMessage = "Bpmn error encountered in DeleteVcpeResCustService flow. Unexpected from method preProcessRequest() - " + ex.getMessage() @@ -225,23 +229,23 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { def id = jsonUtil.getJsonValue(ar, "id") if(type == "TunnelXConn" || type == "Tunnel XConn") { - msoLogger.debug("TunnelXConn AR found") + logger.debug("TunnelXConn AR found") TXC_found = true TXC_id = id }else if(type == "BRG") { - msoLogger.debug("BRG AR found") + logger.debug("BRG AR found") BRG_found = true BRG_id = id } execution.setVariable(Prefix+"TunnelXConn", TXC_found) execution.setVariable("TXC_allottedResourceId", TXC_id) - msoLogger.debug("TXC_allottedResourceId: " + TXC_id) + logger.debug("TXC_allottedResourceId: " + TXC_id) execution.setVariable(Prefix+"BRG", BRG_found) execution.setVariable("BRG_allottedResourceId", BRG_id) - msoLogger.debug("BRG_allottedResourceId: " + BRG_id) + logger.debug("BRG_allottedResourceId: " + BRG_id) } } @@ -258,11 +262,11 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { }catch(BpmnError e) { throw e; }catch(NotFoundException e) { - msoLogger.debug("Service Instance does not exist AAI") + logger.debug("Service Instance does not exist AAI") exceptionUtil.buildAndThrowWorkflowException(execution, 404, "Service Instance was not found in aai") }catch(Exception ex) { String msg = "Internal Error in getServiceInstance: " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } @@ -273,7 +277,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { // ******************************* public void prepareVnfAndModulesDelete (DelegateExecution execution) { def isDebugEnabled=execution.getVariable(DebugFlag) - msoLogger.trace("Inside prepareVnfAndModulesDelete of DeleteVcpeResCustService ") + logger.trace("Inside prepareVnfAndModulesDelete of DeleteVcpeResCustService ") try { List vnfList = execution.getVariable(Prefix+"relatedVnfIdList") @@ -285,9 +289,9 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { } execution.setVariable("vnfId", vnfId) - msoLogger.debug("need to delete vnfId:" + vnfId) + logger.debug("need to delete vnfId:" + vnfId) - msoLogger.trace("Completed prepareVnfAndModulesDelete of DeleteVcpeResCustService ") + logger.trace("Completed prepareVnfAndModulesDelete of DeleteVcpeResCustService ") } catch (Exception ex) { // try error in method block String exceptionMessage = "Bpmn error encountered in DeleteVcpeResCustService flow. Unexpected Error from method prepareVnfAndModulesDelete() - " + ex.getMessage() @@ -300,7 +304,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { // ******************************* public void validateVnfDelete (DelegateExecution execution) { def isDebugEnabled=execution.getVariable(DebugFlag) - msoLogger.trace("Inside validateVnfDelete of DeleteVcpeResCustService ") + logger.trace("Inside validateVnfDelete of DeleteVcpeResCustService ") try { int vnfsDeletedCount = execution.getVariable(Prefix+"vnfsDeletedCount") @@ -308,7 +312,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { execution.setVariable(Prefix+"vnfsDeletedCount", vnfsDeletedCount) - msoLogger.debug(" ***** Completed validateVnfDelete of DeleteVcpeResCustService ***** "+" vnf # "+vnfsDeletedCount) + logger.debug(" ***** Completed validateVnfDelete of DeleteVcpeResCustService ***** "+" vnf # "+vnfsDeletedCount) } catch (Exception ex) { // try error in method block String exceptionMessage = "Bpmn error encountered in DeleteVcpeResCustService flow. Unexpected Error from method validateVnfDelete() - " + ex.getMessage() @@ -322,7 +326,7 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { // ***************************************** public void postProcessResponse (DelegateExecution execution) { def isDebugEnabled=execution.getVariable(DebugFlag) - msoLogger.trace("Inside postProcessResponse of DeleteVcpeResCustService ") + logger.trace("Inside postProcessResponse of DeleteVcpeResCustService ") try { String source = execution.getVariable("source") @@ -343,10 +347,10 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { // Format Response String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) - msoLogger.debug(xmlMsoCompletionRequest) + logger.debug(xmlMsoCompletionRequest) execution.setVariable(Prefix+"Success", true) execution.setVariable(Prefix+"CompleteMsoProcessRequest", xmlMsoCompletionRequest) - msoLogger.debug(" SUCCESS flow, going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest) + logger.debug(" SUCCESS flow, going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest) } catch (BpmnError e) { throw e; @@ -359,28 +363,28 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { public void prepareFalloutRequest(DelegateExecution execution){ def isDebugEnabled=execution.getVariable(DebugFlag) - msoLogger.trace("STARTED DeleteVcpeResCustService prepareFalloutRequest Process ") + logger.trace("STARTED DeleteVcpeResCustService prepareFalloutRequest Process ") try { WorkflowException wfex = execution.getVariable("WorkflowException") - msoLogger.debug(" Incoming Workflow Exception: " + wfex.toString()) + logger.debug(" Incoming Workflow Exception: " + wfex.toString()) String requestInfo = execution.getVariable(Prefix+"requestInfo") - msoLogger.debug(" Incoming Request Info: " + requestInfo) + logger.debug(" Incoming Request Info: " + requestInfo) String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo) execution.setVariable(Prefix+"falloutRequest", falloutRequest) } catch (Exception ex) { - msoLogger.debug("Error Occured in DeleteVcpeResCustService prepareFalloutRequest Process " + ex.getMessage()) + logger.debug("Error Occured in DeleteVcpeResCustService prepareFalloutRequest Process " + ex.getMessage()) exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DeleteVcpeResCustService prepareFalloutRequest Process") } - msoLogger.trace("COMPLETED DeleteVcpeResCustService prepareFalloutRequest Process ") + logger.trace("COMPLETED DeleteVcpeResCustService prepareFalloutRequest Process ") } public void sendSyncError (DelegateExecution execution) { def isDebugEnabled=execution.getVariable(DebugFlag) - msoLogger.trace("Inside sendSyncError() of DeleteVcpeResCustService ") + logger.trace("Inside sendSyncError() of DeleteVcpeResCustService ") try { String errorMessage = "" @@ -397,10 +401,10 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { <aetgt:ErrorCode>7000</aetgt:ErrorCode> </aetgt:WorkflowException>""" - msoLogger.debug(buildworkflowException) + logger.debug(buildworkflowException) sendWorkflowResponse(execution, 500, buildworkflowException) } catch (Exception ex) { - msoLogger.debug(" Sending Sync Error Activity Failed. " + "\n" + ex.getMessage()) + logger.debug(" Sending Sync Error Activity Failed. " + "\n" + ex.getMessage()) } } @@ -408,20 +412,22 @@ public class DeleteVcpeResCustService extends AbstractServiceTaskProcessor { def isDebugEnabled=execution.getVariable(DebugFlag) execution.setVariable("prefix",Prefix) try{ - msoLogger.debug("Caught a Java Exception") - msoLogger.debug("Started processJavaException Method") - msoLogger.debug("Variables List: " + execution.getVariables()) + logger.debug("Caught a Java Exception") + logger.debug("Started processJavaException Method") + logger.debug("Variables List: " + execution.getVariables()) execution.setVariable(Prefix+"unexpectedError", "Caught a Java Lang Exception") // Adding this line temporarily until this flows error handling gets updated exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Caught a Java Lang Exception") }catch(BpmnError b){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Rethrowing MSOWorkflowException", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, ""); + logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Rethrowing MSOWorkflowException", "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue()); throw b }catch(Exception e){ - msoLogger.debug("Caught Exception during processJavaException Method: " + e) + logger.debug("Caught Exception during processJavaException Method: " + e) execution.setVariable(Prefix+"unexpectedError", "Exception in processJavaException method") // Adding this line temporarily until this flows error handling gets updated exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception in processJavaException method") } - msoLogger.debug("Completed processJavaException Method") + logger.debug("Completed processJavaException Method") } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy index e7baccd460..db8c993533 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRG.groovy @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -34,6 +36,8 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory import javax.ws.rs.NotFoundException import javax.ws.rs.core.UriBuilder @@ -71,7 +75,7 @@ import static org.apache.commons.lang3.StringUtils.isBlank * */ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateAllottedResourceBRG.class); + private static final Logger logger = LoggerFactory.getLogger(DoCreateAllottedResourceBRG.class); String Prefix="DCARBRG_" ExceptionUtil exceptionUtil = new ExceptionUtil() @@ -81,7 +85,7 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ String msg = "" - msoLogger.trace("start preProcessRequest") + logger.trace("start preProcessRequest") try { execution.setVariable("prefix", Prefix) @@ -90,78 +94,78 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ String sdncCallbackUrl = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) if (isBlank(sdncCallbackUrl)) { msg = "mso.workflow.sdncadapter.callback is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } execution.setVariable("sdncCallbackUrl", sdncCallbackUrl) - msoLogger.debug("SDNC Callback URL: " + sdncCallbackUrl) + logger.debug("SDNC Callback URL: " + sdncCallbackUrl) String sdncReplDelay = UrnPropertiesReader.getVariable("mso.workflow.sdnc.replication.delay",execution) if (isBlank(sdncReplDelay)) { msg = "mso.workflow.sdnc.replication.delay is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } execution.setVariable("sdncReplDelay", sdncReplDelay) - msoLogger.debug("SDNC replication delay: " + sdncReplDelay) + logger.debug("SDNC replication delay: " + sdncReplDelay) //Request Inputs if (isBlank(execution.getVariable("serviceInstanceId"))){ msg = "Input serviceInstanceId is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } if (isBlank(execution.getVariable("parentServiceInstanceId"))) { msg = "Input parentServiceInstanceId is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } if (isBlank(execution.getVariable("allottedResourceModelInfo"))) { msg = "Input allottedResourceModelInfo is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } if (isBlank(execution.getVariable("vni"))) { msg = "Input vni is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } if (isBlank(execution.getVariable("vgmuxBearerIP"))) { msg = "Input vgmuxBearerIP is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } if (isBlank(execution.getVariable("brgWanMacAddress"))) { msg = "Input brgWanMacAddress is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } if (isBlank(execution.getVariable("allottedResourceRole"))) { msg = "Input allottedResourceRole is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } if (isBlank(execution.getVariable("allottedResourceType"))) { msg = "Input allottedResourceType is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } }catch(BpmnError b){ - msoLogger.debug("Rethrowing MSOWorkflowException") + logger.debug("Rethrowing MSOWorkflowException") throw b } catch (Exception ex){ msg = "Exception in preProcessRequest " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("end preProcessRequest") + logger.trace("end preProcessRequest") } /** * Gets the service instance uri from aai */ public void getServiceInstance(DelegateExecution execution) { - msoLogger.trace("getServiceInstance ") + logger.trace("getServiceInstance ") try { String serviceInstanceId = execution.getVariable('serviceInstanceId') @@ -178,16 +182,16 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ throw e; }catch (Exception ex){ String msg = "Exception in getServiceInstance. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("Exit getServiceInstance ") + logger.trace("Exit getServiceInstance ") } public void getAaiAR (DelegateExecution execution) { - msoLogger.trace("start getAaiAR") + logger.trace("start getAaiAR") String arType = execution.getVariable("allottedResourceType") String arRole = execution.getVariable("allottedResourceRole") @@ -216,14 +220,14 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ } } if (!isBlank(errorMsg)) { - msoLogger.debug(errorMsg) + logger.debug(errorMsg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, errorMsg) } - msoLogger.trace("end getAaiAR") + logger.trace("end getAaiAR") } public void getParentServiceInstance(DelegateExecution execution) { - msoLogger.trace("getParentServiceInstance ") + logger.trace("getParentServiceInstance ") try { String serviceInstanceId = execution.getVariable('parentServiceInstanceId') @@ -242,17 +246,17 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ throw e; }catch (Exception ex){ String msg = "Exception in getParentServiceInstance. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("Exit getParentServiceInstance ") + logger.trace("Exit getParentServiceInstance ") } public void createAaiAR(DelegateExecution execution) { - msoLogger.trace("start createAaiAR") + logger.trace("start createAaiAR") String allottedResourceId = execution.getVariable("allottedResourceId") if (isBlank(allottedResourceId)) @@ -297,14 +301,14 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ rollbackData.put(Prefix, "serviceInstanceId", execution.getVariable("serviceInstanceId")) rollbackData.put(Prefix, "parentServiceInstanceId", execution.getVariable("parentServiceInstanceId")) execution.setVariable("rollbackData", rollbackData) - msoLogger.trace("end createAaiAR") + logger.trace("end createAaiAR") } public String buildSDNCRequest(DelegateExecution execution, String action, String sdncRequestId) { String msg = "" - msoLogger.trace("start buildSDNCRequest") + logger.trace("start buildSDNCRequest") String sdncReq = null try { @@ -392,15 +396,15 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ </sdncadapterworkflow:SDNCRequestData> </sdncadapterworkflow:SDNCAdapterWorkflowRequest>""" - msoLogger.debug("sdncRequest:\n" + sdncReq) + logger.debug("sdncRequest:\n" + sdncReq) sdncReq = utils.formatXml(sdncReq) } catch(Exception ex) { msg = "Exception in buildSDNCRequest. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("end buildSDNCRequest") + logger.trace("end buildSDNCRequest") return sdncReq } @@ -408,110 +412,110 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ String msg = "" - msoLogger.trace("start preProcessSDNCAssign") + logger.trace("start preProcessSDNCAssign") try { String sdncRequestId = UUID.randomUUID().toString() String sdncAssignReq = buildSDNCRequest(execution, "assign", sdncRequestId) execution.setVariable("sdncAssignRequest", sdncAssignReq) - msoLogger.debug("sdncAssignRequest: " + sdncAssignReq) + logger.debug("sdncAssignRequest: " + sdncAssignReq) def sdncRequestId2 = UUID.randomUUID().toString() String sdncAssignRollbackReq = sdncAssignReq.replace(">assign<", ">unassign<").replace(">CreateBRGInstance<", ">DeleteBRGInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<") def rollbackData = execution.getVariable("rollbackData") rollbackData.put(Prefix, "sdncAssignRollbackReq", sdncAssignRollbackReq) execution.setVariable("rollbackData", rollbackData) - msoLogger.debug("sdncAssignRollbackReq:\n" + sdncAssignRollbackReq) - msoLogger.debug("rollbackData:\n" + rollbackData.toString()) + logger.debug("sdncAssignRollbackReq:\n" + sdncAssignRollbackReq) + logger.debug("rollbackData:\n" + rollbackData.toString()) } catch (BpmnError e) { throw e; } catch(Exception ex) { msg = "Exception in preProcessSDNCAssign. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("end preProcessSDNCAssign") + logger.trace("end preProcessSDNCAssign") } public void preProcessSDNCCreate(DelegateExecution execution) { String msg = "" - msoLogger.trace("start preProcessSDNCCreate") + logger.trace("start preProcessSDNCCreate") try { String sdncRequestId = UUID.randomUUID().toString() String sdncCreateReq = buildSDNCRequest(execution, "create", sdncRequestId) execution.setVariable("sdncCreateRequest", sdncCreateReq) - msoLogger.debug("sdncCreateReq: " + sdncCreateReq) + logger.debug("sdncCreateReq: " + sdncCreateReq) def sdncRequestId2 = UUID.randomUUID().toString() String sdncCreateRollbackReq = sdncCreateReq.replace(">create<", ">delete<").replace(">CreateBRGInstance<", ">DeleteBRGInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<") def rollbackData = execution.getVariable("rollbackData") rollbackData.put(Prefix, "sdncCreateRollbackReq", sdncCreateRollbackReq) execution.setVariable("rollbackData", rollbackData) - msoLogger.debug("sdncCreateRollbackReq:\n" + sdncCreateRollbackReq) - msoLogger.debug("rollbackData:\n" + rollbackData.toString()) + logger.debug("sdncCreateRollbackReq:\n" + sdncCreateRollbackReq) + logger.debug("rollbackData:\n" + rollbackData.toString()) } catch (BpmnError e) { throw e; } catch(Exception ex) { msg = "Exception in preProcessSDNCCreate. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("end preProcessSDNCCreate") + logger.trace("end preProcessSDNCCreate") } public void preProcessSDNCActivate(DelegateExecution execution) { String msg = "" - msoLogger.trace("start preProcessSDNCActivate") + logger.trace("start preProcessSDNCActivate") try { String sdncRequestId = UUID.randomUUID().toString() String sdncActivateReq = buildSDNCRequest(execution, "activate", sdncRequestId) execution.setVariable("sdncActivateRequest", sdncActivateReq) - msoLogger.debug("sdncActivateReq: " + sdncActivateReq) + logger.debug("sdncActivateReq: " + sdncActivateReq) def sdncRequestId2 = UUID.randomUUID().toString() String sdncActivateRollbackReq = sdncActivateReq.replace(">activate<", ">deactivate<").replace(">CreateBRGInstance<", ">DeleteBRGInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<") def rollbackData = execution.getVariable("rollbackData") rollbackData.put(Prefix, "sdncActivateRollbackReq", sdncActivateRollbackReq) execution.setVariable("rollbackData", rollbackData) - msoLogger.debug("sdncActivateRollbackReq:\n" + sdncActivateRollbackReq) - msoLogger.debug("rollbackData:\n" + rollbackData.toString()) + logger.debug("sdncActivateRollbackReq:\n" + sdncActivateRollbackReq) + logger.debug("rollbackData:\n" + rollbackData.toString()) } catch (BpmnError e) { throw e; } catch(Exception ex) { msg = "Exception in preProcessSDNCActivate. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("end preProcessSDNCActivate") + logger.trace("end preProcessSDNCActivate") } public void validateSDNCResp(DelegateExecution execution, String response, String method){ - msoLogger.trace("ValidateSDNCResponse Process") + logger.trace("ValidateSDNCResponse Process") String msg = "" try { WorkflowException workflowException = execution.getVariable("WorkflowException") - msoLogger.debug("workflowException: " + workflowException) + logger.debug("workflowException: " + workflowException) boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - msoLogger.debug("SDNCResponse: " + response) + logger.debug("SDNCResponse: " + response) SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ - msoLogger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + response) + logger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + response) if (!"get".equals(method)) { @@ -521,22 +525,22 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ } }else{ - msoLogger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.") + logger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.") throw new BpmnError("MSOWorkflowException") } } catch (BpmnError e) { throw e; } catch(Exception ex) { msg = "Exception in validateSDNCResp. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("End ValidateSDNCResp Process") + logger.trace("End ValidateSDNCResp Process") } public void preProcessSDNCGet(DelegateExecution execution){ - msoLogger.trace("start preProcessSDNCGet") + logger.trace("start preProcessSDNCGet") try{ def callbackUrl = execution.getVariable("sdncCallbackUrl") @@ -548,15 +552,15 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ if (execution.getVariable("foundActiveAR")) { def aaiQueryResponse = execution.getVariable("aaiARGetResponse") serviceOperation = utils.getNodeText(aaiQueryResponse, "selflink") - msoLogger.debug("AR service operation/aaiARSelfLink: " + serviceOperation) + logger.debug("AR service operation/aaiARSelfLink: " + serviceOperation) } else { String response = execution.getVariable("sdncAssignResponse") String data = utils.getNodeXml(response, "response-data") - msoLogger.debug("Assign responseData: " + data) + logger.debug("Assign responseData: " + data) serviceOperation = utils.getNodeText(data, "object-path") - msoLogger.debug("AR service operation:" + serviceOperation) + logger.debug("AR service operation:" + serviceOperation) } String serviceInstanceId = execution.getVariable("serviceInstanceId") @@ -581,28 +585,30 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ execution.setVariable("sdncGetRequest", SDNCGetRequest) }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + e.getMessage()) } - msoLogger.trace("end preProcessSDNCGet") + logger.trace("end preProcessSDNCGet") } public void updateAaiAROrchStatus(DelegateExecution execution, String status){ - msoLogger.trace("start updateAaiAROrchStatus") + logger.trace("start updateAaiAROrchStatus") String aaiARPath = execution.getVariable("aaiARPath") //set during query (existing AR) or create AllottedResourceUtils arUtils = new AllottedResourceUtils(this) String orchStatus = arUtils.updateAROrchStatus(execution, status, aaiARPath) - msoLogger.trace("end updateAaiAROrchStatus") + logger.trace("end updateAaiAROrchStatus") } public void generateOutputs(DelegateExecution execution) { - msoLogger.trace("start generateOutputs") + logger.trace("start generateOutputs") try { String sdncGetResponse = execution.getVariable("enhancedCallbackRequestData") //unescaped - msoLogger.debug("resp:" + sdncGetResponse) + logger.debug("resp:" + sdncGetResponse) String arData = utils.getNodeXml(sdncGetResponse, "brg-topology") arData = utils.removeXmlNamespaces(arData) @@ -610,55 +616,55 @@ public class DoCreateAllottedResourceBRG extends AbstractServiceTaskProcessor{ String ari = utils.getNodeXml(arData, "allotted-resource-identifiers") execution.setVariable("allotedResourceName", utils.getNodeText(ari, "allotted-resource-name")) } catch (BpmnError e) { - msoLogger.debug("BPMN Error in generateOutputs ") + logger.debug("BPMN Error in generateOutputs ") } catch(Exception ex) { String msg = "Exception in generateOutputs " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) } - msoLogger.trace("end generateOutputs") + logger.trace("end generateOutputs") } public void preProcessRollback (DelegateExecution execution) { - msoLogger.trace("start preProcessRollback") + logger.trace("start preProcessRollback") try { Object workflowException = execution.getVariable("WorkflowException"); if (workflowException instanceof WorkflowException) { - msoLogger.debug("Prev workflowException: " + workflowException.getErrorMessage()) + logger.debug("Prev workflowException: " + workflowException.getErrorMessage()) execution.setVariable("prevWorkflowException", workflowException); //execution.setVariable("WorkflowException", null); } } catch (BpmnError e) { - msoLogger.debug("BPMN Error during preProcessRollback") + logger.debug("BPMN Error during preProcessRollback") } catch(Exception ex) { String msg = "Exception in preProcessRollback. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) } - msoLogger.trace("end preProcessRollback") + logger.trace("end preProcessRollback") } public void postProcessRollback (DelegateExecution execution) { - msoLogger.trace("start postProcessRollback") + logger.trace("start postProcessRollback") String msg = "" try { Object workflowException = execution.getVariable("prevWorkflowException"); if (workflowException instanceof WorkflowException) { - msoLogger.debug("Setting prevException to WorkflowException: ") + logger.debug("Setting prevException to WorkflowException: ") execution.setVariable("WorkflowException", workflowException); } execution.setVariable("rollbackData", null) } catch (BpmnError b) { - msoLogger.debug("BPMN Error during postProcessRollback") + logger.debug("BPMN Error during postProcessRollback") throw b; } catch(Exception ex) { msg = "Exception in postProcessRollback. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) } - msoLogger.trace("end postProcessRollback") + logger.trace("end postProcessRollback") } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy index 856c893b47..03f795cadf 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceBRGRollback.groovy @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -30,6 +32,8 @@ import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils import org.onap.so.bpmn.core.WorkflowException import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory import static org.apache.commons.lang3.StringUtils.isBlank @@ -50,7 +54,7 @@ import static org.apache.commons.lang3.StringUtils.isBlank * */ public class DoCreateAllottedResourceBRGRollback extends AbstractServiceTaskProcessor{ - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateAllottedResourceBRGRollback.class); + private static final Logger logger = LoggerFactory.getLogger(DoCreateAllottedResourceBRGRollback.class); String Prefix="DCARBRGRB_" ExceptionUtil exceptionUtil = new ExceptionUtil() @@ -59,13 +63,13 @@ public class DoCreateAllottedResourceBRGRollback extends AbstractServiceTaskProc String msg = "" - msoLogger.trace("start preProcessRequest") + logger.trace("start preProcessRequest") execution.setVariable("prefix", Prefix) String rbType = "DCARBRG_" try { def rollbackData = execution.getVariable("rollbackData") - msoLogger.debug("RollbackData:" + rollbackData) + logger.debug("RollbackData:" + rollbackData) if (rollbackData != null) { if (rollbackData.hasType(rbType)) { @@ -90,9 +94,9 @@ public class DoCreateAllottedResourceBRGRollback extends AbstractServiceTaskProc execution.setVariable("deleteSdnc", rollbackData.get(rbType, "rollbackSDNCcreate")) execution.setVariable("unassignSdnc", rollbackData.get(rbType, "rollbackSDNCassign")) - msoLogger.debug("sdncDeactivate:\n" + execution.getVariable("deactivateSdnc") ) - msoLogger.debug("sdncDelete:\n" + execution.getVariable("deleteSdnc")) - msoLogger.debug("sdncUnassign:\n" + execution.getVariable("unassignSdnc")) + logger.debug("sdncDeactivate:\n" + execution.getVariable("deactivateSdnc") ) + logger.debug("sdncDelete:\n" + execution.getVariable("deleteSdnc")) + logger.debug("sdncUnassign:\n" + execution.getVariable("unassignSdnc")) execution.setVariable("sdncDeactivateRequest", rollbackData.get(rbType, "sdncActivateRollbackReq")) execution.setVariable("sdncDeleteRequest", rollbackData.get(rbType, "sdncCreateRollbackReq")) @@ -117,24 +121,24 @@ public class DoCreateAllottedResourceBRGRollback extends AbstractServiceTaskProc } }catch(BpmnError b){ - msoLogger.debug("Rethrowing MSOWorkflowException") + logger.debug("Rethrowing MSOWorkflowException") throw b } catch (Exception ex){ msg = "Exception in preProcessRequest " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("end preProcessRequest") + logger.trace("end preProcessRequest") } // aaiARPath set during query (existing AR) public void updateAaiAROrchStatus(DelegateExecution execution, String status){ String msg = null; - msoLogger.trace("start updateAaiAROrchStatus") + logger.trace("start updateAaiAROrchStatus") AllottedResourceUtils arUtils = new AllottedResourceUtils(this) String aaiARPath = execution.getVariable("aaiARPath") - msoLogger.debug(" aaiARPath:" + aaiARPath) + logger.debug(" aaiARPath:" + aaiARPath) Optional<AllottedResource> ar = Optional.empty(); //need this for getting resourceVersion for delete if (!isBlank(aaiARPath)) { @@ -143,73 +147,75 @@ public class DoCreateAllottedResourceBRGRollback extends AbstractServiceTaskProc if(!ar.isPresent()) { msg = "AR not found in AAI at:" + aaiARPath - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } String orchStatus = arUtils.updateAROrchStatus(execution, status, aaiARPath) - msoLogger.trace("end updateAaiAROrchStatus") + logger.trace("end updateAaiAROrchStatus") } public void validateSDNCResp(DelegateExecution execution, String response, String method){ - msoLogger.trace("start ValidateSDNCResponse Process") + logger.trace("start ValidateSDNCResponse Process") String msg = "" try { WorkflowException workflowException = execution.getVariable("WorkflowException") - msoLogger.debug("workflowException: " + workflowException) + logger.debug("workflowException: " + workflowException) boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - msoLogger.debug("SDNCResponse: " + response) + logger.debug("SDNCResponse: " + response) SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ - msoLogger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + response) + logger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + response) }else{ - msoLogger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.") + logger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.") throw new BpmnError("MSOWorkflowException") } } catch (BpmnError e) { if ("404".contentEquals(e.getErrorCode())) { msg = "SDNC rollback " + method + " returned a 404. Proceding with rollback" - msoLogger.debug(msg) + logger.debug(msg) } else { throw e; } } catch(Exception ex) { msg = "Exception in validateSDNCResp. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("end ValidateSDNCResp Process") + logger.trace("end ValidateSDNCResp Process") } public void deleteAaiAR(DelegateExecution execution){ try{ - msoLogger.trace("start deleteAaiAR") + logger.trace("start deleteAaiAR") AllottedResourceUtils arUtils = new AllottedResourceUtils(this) String arLink = execution.getVariable("aaiARPath") arUtils.deleteAR(execution, arLink ) } catch (BpmnError e) { throw e; }catch(Exception ex){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + ex); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + ex.getMessage()) } - msoLogger.trace("end deleteAaiAR") + logger.trace("end deleteAaiAR") } public void postProcessRequest(DelegateExecution execution) { - msoLogger.trace("start postProcessRequest") + logger.trace("start postProcessRequest") String msg = "" try { execution.setVariable("rollbackData", null) @@ -217,52 +223,52 @@ public class DoCreateAllottedResourceBRGRollback extends AbstractServiceTaskProc if (skipRollback != true) { execution.setVariable("rolledBack", true) - msoLogger.debug("rolledBack") + logger.debug("rolledBack") } - msoLogger.trace("end postProcessRequest") + logger.trace("end postProcessRequest") } catch (BpmnError e) { msg = "Bpmn Exception in postProcessRequest. " - msoLogger.debug(msg) + logger.debug(msg) } catch (Exception ex) { msg = "Exception in postProcessRequest. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) } } public void processRollbackException(DelegateExecution execution){ - msoLogger.trace("start processRollbackException") + logger.trace("start processRollbackException") try{ - msoLogger.debug("Caught an Exception in DoCreateAllottedResourceRollback") + logger.debug("Caught an Exception in DoCreateAllottedResourceRollback") execution.setVariable("rollbackData", null) execution.setVariable("rolledBack", false) execution.setVariable("rollbackError", "Caught exception in AllottedResource Create Rollback") execution.setVariable("WorkflowException", null) }catch(BpmnError b){ - msoLogger.debug("BPMN Error during processRollbackExceptions Method: ") + logger.debug("BPMN Error during processRollbackExceptions Method: ") }catch(Exception e){ - msoLogger.debug("Caught Exception during processRollbackExceptions Method: " + e.getMessage()) + logger.debug("Caught Exception during processRollbackExceptions Method: " + e.getMessage()) } - msoLogger.trace("end processRollbackException") + logger.trace("end processRollbackException") } public void processRollbackJavaException(DelegateExecution execution){ - msoLogger.trace("start processRollbackJavaException") + logger.trace("start processRollbackJavaException") try{ execution.setVariable("rollbackData", null) execution.setVariable("rolledBack", false) execution.setVariable("rollbackError", "Caught Java exception in AllottedResource Create Rollback") - msoLogger.debug("Caught Exception in processRollbackJavaException") + logger.debug("Caught Exception in processRollbackJavaException") }catch(Exception e){ - msoLogger.debug("Caught Exception in processRollbackJavaException " + e.getMessage()) + logger.debug("Caught Exception in processRollbackJavaException " + e.getMessage()) } - msoLogger.trace("end processRollbackJavaException") + logger.trace("end processRollbackJavaException") } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy index 56fa3a6730..a5f0d7dc30 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXC.groovy @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -33,6 +35,8 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri import org.onap.so.client.aai.entities.uri.AAIUriFactory import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory import javax.ws.rs.core.UriBuilder import static org.apache.commons.lang3.StringUtils.isBlank @@ -69,7 +73,7 @@ import static org.apache.commons.lang3.StringUtils.isBlank * */ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{ - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateAllottedResourceTXC.class); + private static final Logger logger = LoggerFactory.getLogger(DoCreateAllottedResourceTXC.class); String Prefix="DCARTXC_" ExceptionUtil exceptionUtil = new ExceptionUtil() @@ -79,11 +83,11 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{ String msg = "" - msoLogger.trace("start preProcessRequest") + logger.trace("start preProcessRequest") try { String msoRequestId = execution.getVariable("msoRequestId") - msoLogger.debug(" msoRequestId = " + msoRequestId) + logger.debug(" msoRequestId = " + msoRequestId) execution.setVariable("prefix", Prefix) @@ -91,67 +95,67 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{ String sdncCallbackUrl = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) if (isBlank(sdncCallbackUrl)) { msg = "mso.workflow.sdncadapter.callback is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } execution.setVariable("sdncCallbackUrl", sdncCallbackUrl) - msoLogger.debug("SDNC Callback URL: " + sdncCallbackUrl) + logger.debug("SDNC Callback URL: " + sdncCallbackUrl) String sdncReplDelay = UrnPropertiesReader.getVariable("mso.workflow.sdnc.replication.delay",execution) if (isBlank(sdncReplDelay)) { msg = "mso.workflow.sdnc.replication.delay is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } execution.setVariable("sdncReplDelay", sdncReplDelay) - msoLogger.debug("SDNC replication delay: " + sdncReplDelay) + logger.debug("SDNC replication delay: " + sdncReplDelay) //Request Inputs if (isBlank(execution.getVariable("serviceInstanceId"))){ msg = "Input serviceInstanceId is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } if (isBlank(execution.getVariable("parentServiceInstanceId"))) { msg = "Input parentServiceInstanceId is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } if (isBlank(execution.getVariable("allottedResourceModelInfo"))) { msg = "Input allottedResourceModelInfo is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } if (isBlank(execution.getVariable("brgWanMacAddress"))) { msg = "Input brgWanMacAddress is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } if (isBlank(execution.getVariable("allottedResourceRole"))) { msg = "Input allottedResourceRole is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } if (isBlank(execution.getVariable("allottedResourceType"))) { msg = "Input allottedResourceType is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } }catch(BpmnError b){ - msoLogger.debug("Rethrowing MSOWorkflowException") + logger.debug("Rethrowing MSOWorkflowException") throw b } catch (Exception ex){ msg = "Exception in preProcessRequest " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("end preProcessRequest") + logger.trace("end preProcessRequest") } public void getAaiAR (DelegateExecution execution) { - msoLogger.trace("start getAaiAR") + logger.trace("start getAaiAR") String arType = execution.getVariable("allottedResourceType") String arRole = execution.getVariable("allottedResourceRole") @@ -180,16 +184,16 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{ } } if (!isBlank(errorMsg)) { - msoLogger.debug(errorMsg) + logger.debug(errorMsg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, errorMsg) } - msoLogger.trace("end getAaiAR") + logger.trace("end getAaiAR") } public void createAaiAR(DelegateExecution execution) { - msoLogger.trace("start createAaiAR") + logger.trace("start createAaiAR") String allottedResourceId = execution.getVariable("allottedResourceId") if (isBlank(allottedResourceId)) @@ -208,7 +212,7 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{ String arRole = execution.getVariable("allottedResourceRole") String CSI_resourceLink = execution.getVariable("CSI_resourceLink") String arModelInfo = execution.getVariable("allottedResourceModelInfo") - msoLogger.debug("arModelInfo is:\n" + arModelInfo) + logger.debug("arModelInfo is:\n" + arModelInfo) String modelInvariantId = jsonUtil.getJsonValue(arModelInfo, "modelInvariantUuid") String modelVersionId = jsonUtil.getJsonValue(arModelInfo, "modelUuid") @@ -235,14 +239,14 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{ rollbackData.put(Prefix, "serviceInstanceId", execution.getVariable("serviceInstanceId")) rollbackData.put(Prefix, "parentServiceInstanceId", execution.getVariable("parentServiceInstanceId")) execution.setVariable("rollbackData", rollbackData) - msoLogger.trace("end createAaiAR") + logger.trace("end createAaiAR") } public String buildSDNCRequest(DelegateExecution execution, String action, String sdncRequestId) { String msg = "" - msoLogger.trace("start buildSDNCRequest") + logger.trace("start buildSDNCRequest") String sdncReq = null try { @@ -327,15 +331,15 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{ </sdncadapterworkflow:SDNCRequestData> </sdncadapterworkflow:SDNCAdapterWorkflowRequest>""" - msoLogger.debug("sdncRequest:\n" + sdncReq) + logger.debug("sdncRequest:\n" + sdncReq) sdncReq = utils.formatXml(sdncReq) } catch(Exception ex) { msg = "Exception in buildSDNCRequest. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("end buildSDNCRequest") + logger.trace("end buildSDNCRequest") return sdncReq } @@ -343,110 +347,110 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{ String msg = "" - msoLogger.trace("start preProcessSDNCAssign") + logger.trace("start preProcessSDNCAssign") try { String sdncRequestId = UUID.randomUUID().toString() String sdncAssignReq = buildSDNCRequest(execution, "assign", sdncRequestId) execution.setVariable("sdncAssignRequest", sdncAssignReq) - msoLogger.debug("sdncAssignRequest: " + sdncAssignReq) + logger.debug("sdncAssignRequest: " + sdncAssignReq) def sdncRequestId2 = UUID.randomUUID().toString() String sdncAssignRollbackReq = sdncAssignReq.replace(">assign<", ">unassign<").replace(">CreateTunnelXConnInstance<", ">DeleteTunnelXConnInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<") def rollbackData = execution.getVariable("rollbackData") rollbackData.put(Prefix, "sdncAssignRollbackReq", sdncAssignRollbackReq) execution.setVariable("rollbackData", rollbackData) - msoLogger.debug("sdncAssignRollbackReq:\n" + sdncAssignRollbackReq) - msoLogger.debug("rollbackData:\n" + rollbackData.toString()) + logger.debug("sdncAssignRollbackReq:\n" + sdncAssignRollbackReq) + logger.debug("rollbackData:\n" + rollbackData.toString()) } catch (BpmnError e) { throw e; } catch(Exception ex) { msg = "Exception in preProcessSDNCAssign. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.debug("end preProcessSDNCAssign") + logger.debug("end preProcessSDNCAssign") } public void preProcessSDNCCreate(DelegateExecution execution) { String msg = "" - msoLogger.trace("start preProcessSDNCCreate") + logger.trace("start preProcessSDNCCreate") try { String sdncRequestId = UUID.randomUUID().toString() String sdncCreateReq = buildSDNCRequest(execution, "create", sdncRequestId) execution.setVariable("sdncCreateRequest", sdncCreateReq) - msoLogger.debug("sdncCreateReq: " + sdncCreateReq) + logger.debug("sdncCreateReq: " + sdncCreateReq) def sdncRequestId2 = UUID.randomUUID().toString() String sdncCreateRollbackReq = sdncCreateReq.replace(">create<", ">delete<").replace(">CreateTunnelXConnInstance<", ">DeleteTunnelXConnInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<") def rollbackData = execution.getVariable("rollbackData") rollbackData.put(Prefix, "sdncCreateRollbackReq", sdncCreateRollbackReq) execution.setVariable("rollbackData", rollbackData) - msoLogger.debug("sdncCreateRollbackReq:\n" + sdncCreateRollbackReq) - msoLogger.debug("rollbackData:\n" + rollbackData.toString()) + logger.debug("sdncCreateRollbackReq:\n" + sdncCreateRollbackReq) + logger.debug("rollbackData:\n" + rollbackData.toString()) } catch (BpmnError e) { throw e; } catch(Exception ex) { msg = "Exception in preProcessSDNCCreate. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("end preProcessSDNCCreate") + logger.trace("end preProcessSDNCCreate") } public void preProcessSDNCActivate(DelegateExecution execution) { String msg = "" - msoLogger.trace("start preProcessSDNCActivate") + logger.trace("start preProcessSDNCActivate") try { String sdncRequestId = UUID.randomUUID().toString() String sdncActivateReq = buildSDNCRequest(execution, "activate", sdncRequestId) execution.setVariable("sdncActivateRequest", sdncActivateReq) - msoLogger.debug("sdncActivateReq: " + sdncActivateReq) + logger.debug("sdncActivateReq: " + sdncActivateReq) def sdncRequestId2 = UUID.randomUUID().toString() String sdncActivateRollbackReq = sdncActivateReq.replace(">activate<", ">deactivate<").replace(">CreateTunnelXConnInstance<", ">DeleteTunnelXConnInstance<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<") def rollbackData = execution.getVariable("rollbackData") rollbackData.put(Prefix, "sdncActivateRollbackReq", sdncActivateRollbackReq) execution.setVariable("rollbackData", rollbackData) - msoLogger.debug("sdncActivateRollbackReq:\n" + sdncActivateRollbackReq) - msoLogger.debug("rollbackData:\n" + rollbackData.toString()) + logger.debug("sdncActivateRollbackReq:\n" + sdncActivateRollbackReq) + logger.debug("rollbackData:\n" + rollbackData.toString()) } catch (BpmnError e) { throw e; } catch(Exception ex) { msg = "Exception in preProcessSDNCActivate. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("end preProcessSDNCActivate") + logger.trace("end preProcessSDNCActivate") } public void validateSDNCResp(DelegateExecution execution, String response, String method){ - msoLogger.trace("start ValidateSDNCResponse Process") + logger.trace("start ValidateSDNCResponse Process") String msg = "" try { WorkflowException workflowException = execution.getVariable("WorkflowException") - msoLogger.debug("workflowException: " + workflowException) + logger.debug("workflowException: " + workflowException) boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - msoLogger.debug("SDNCResponse: " + response) + logger.debug("SDNCResponse: " + response) SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ - msoLogger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + response) + logger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + response) if (!"get".equals(method)) { @@ -456,22 +460,22 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{ } }else{ - msoLogger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.") + logger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.") throw new BpmnError("MSOWorkflowException") } } catch (BpmnError e) { throw e; } catch(Exception ex) { msg = "Exception in validateSDNCResp. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("end ValidateSDNCResp Process") + logger.trace("end ValidateSDNCResp Process") } public void preProcessSDNCGet(DelegateExecution execution){ - msoLogger.trace("start preProcessSDNCGet") + logger.trace("start preProcessSDNCGet") try{ def callbackUrl = execution.getVariable("sdncCallbackUrl") @@ -483,15 +487,15 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{ if (execution.getVariable("foundActiveAR")) { def aaiQueryResponse = execution.getVariable("aaiARGetResponse") serviceOperation = utils.getNodeText(aaiQueryResponse, "selflink") - msoLogger.debug("AR service operation/aaiARSelfLink: " + serviceOperation) + logger.debug("AR service operation/aaiARSelfLink: " + serviceOperation) } else { String response = execution.getVariable("sdncAssignResponse") String data = utils.getNodeXml(response, "response-data") - msoLogger.debug("Assign responseData: " + data) + logger.debug("Assign responseData: " + data) serviceOperation = utils.getNodeText(data, "object-path") - msoLogger.debug("AR service operation:" + serviceOperation) + logger.debug("AR service operation:" + serviceOperation) } String serviceInstanceId = execution.getVariable("serviceInstanceId") @@ -516,28 +520,30 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{ execution.setVariable("sdncGetRequest", SDNCGetRequest) }catch(Exception e){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + e); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + e); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + e.getMessage()) } - msoLogger.trace("end preProcessSDNCGet") + logger.trace("end preProcessSDNCGet") } public void updateAaiAROrchStatus(DelegateExecution execution, String status){ - msoLogger.trace("start updateAaiAROrchStatus") + logger.trace("start updateAaiAROrchStatus") String aaiARPath = execution.getVariable("aaiARPath") //set during query (existing AR) or create AllottedResourceUtils arUtils = new AllottedResourceUtils(this) String orchStatus = arUtils.updateAROrchStatus(execution, status, aaiARPath) - msoLogger.trace("end updateAaiAROrchStatus") + logger.trace("end updateAaiAROrchStatus") } public void generateOutputs(DelegateExecution execution) { - msoLogger.trace("start generateOutputs") + logger.trace("start generateOutputs") try { String sdncGetResponse = execution.getVariable("enhancedCallbackRequestData") //unescaped - msoLogger.debug("resp:" + sdncGetResponse) + logger.debug("resp:" + sdncGetResponse) String arData = utils.getNodeXml(sdncGetResponse, "tunnelxconn-topology") arData = utils.removeXmlNamespaces(arData) @@ -549,55 +555,55 @@ public class DoCreateAllottedResourceTXC extends AbstractServiceTaskProcessor{ String ari = utils.getNodeXml(arData, "allotted-resource-identifiers") execution.setVariable("allotedResourceName", utils.getNodeText(ari, "allotted-resource-name")) } catch (BpmnError e) { - msoLogger.debug("BPMN Error in generateOutputs ") + logger.debug("BPMN Error in generateOutputs ") } catch(Exception ex) { String msg = "Exception in generateOutputs " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) } - msoLogger.trace("end generateOutputs") + logger.trace("end generateOutputs") } public void preProcessRollback (DelegateExecution execution) { - msoLogger.trace("start preProcessRollback") + logger.trace("start preProcessRollback") try { Object workflowException = execution.getVariable("WorkflowException"); if (workflowException instanceof WorkflowException) { - msoLogger.debug("Prev workflowException: " + workflowException.getErrorMessage()) + logger.debug("Prev workflowException: " + workflowException.getErrorMessage()) execution.setVariable("prevWorkflowException", workflowException); //execution.setVariable("WorkflowException", null); } } catch (BpmnError e) { - msoLogger.debug("BPMN Error during preProcessRollback") + logger.debug("BPMN Error during preProcessRollback") } catch(Exception ex) { String msg = "Exception in preProcessRollback. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) } - msoLogger.trace("end preProcessRollback") + logger.trace("end preProcessRollback") } public void postProcessRollback (DelegateExecution execution) { - msoLogger.trace("start postProcessRollback") + logger.trace("start postProcessRollback") String msg = "" try { Object workflowException = execution.getVariable("prevWorkflowException"); if (workflowException instanceof WorkflowException) { - msoLogger.debug("Setting prevException to WorkflowException: ") + logger.debug("Setting prevException to WorkflowException: ") execution.setVariable("WorkflowException", workflowException); } execution.setVariable("rollbackData", null) } catch (BpmnError b) { - msoLogger.debug("BPMN Error during postProcessRollback") + logger.debug("BPMN Error during postProcessRollback") throw b; } catch(Exception ex) { msg = "Exception in postProcessRollback. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) } - msoLogger.trace("end postProcessRollback") + logger.trace("end postProcessRollback") } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy index 06d557532b..3d34e2de94 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoCreateAllottedResourceTXCRollback.groovy @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -39,6 +41,8 @@ import static org.apache.commons.lang3.StringUtils.* import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory /** * This groovy class supports the <class>CreateAllottedResourceTXCRollback.bpmn</class> process. @@ -57,7 +61,7 @@ import org.onap.so.logger.MsoLogger * */ public class DoCreateAllottedResourceTXCRollback extends AbstractServiceTaskProcessor{ - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoCreateAllottedResourceTXCRollback.class); + private static final Logger logger = LoggerFactory.getLogger(DoCreateAllottedResourceTXCRollback.class); String Prefix="DCARTXCRB_" ExceptionUtil exceptionUtil = new ExceptionUtil() @@ -66,13 +70,13 @@ public class DoCreateAllottedResourceTXCRollback extends AbstractServiceTaskProc String msg = "" - msoLogger.trace("start preProcessRequest") + logger.trace("start preProcessRequest") execution.setVariable("prefix", Prefix) String rbType = "DCARTXC_" try { def rollbackData = execution.getVariable("rollbackData") - msoLogger.debug("RollbackData:" + rollbackData) + logger.debug("RollbackData:" + rollbackData) if (rollbackData != null) { if (rollbackData.hasType(rbType)) { @@ -97,9 +101,9 @@ public class DoCreateAllottedResourceTXCRollback extends AbstractServiceTaskProc execution.setVariable("deleteSdnc", rollbackData.get(rbType, "rollbackSDNCcreate")) execution.setVariable("unassignSdnc", rollbackData.get(rbType, "rollbackSDNCassign")) - msoLogger.debug("sdncDeactivate:\n" + execution.getVariable("deactivateSdnc") ) - msoLogger.debug("sdncDelete:\n" + execution.getVariable("deleteSdnc")) - msoLogger.debug("sdncUnassign:\n" + execution.getVariable("unassignSdnc")) + logger.debug("sdncDeactivate:\n" + execution.getVariable("deactivateSdnc") ) + logger.debug("sdncDelete:\n" + execution.getVariable("deleteSdnc")) + logger.debug("sdncUnassign:\n" + execution.getVariable("unassignSdnc")) execution.setVariable("sdncDeactivateRequest", rollbackData.get(rbType, "sdncActivateRollbackReq")) execution.setVariable("sdncDeleteRequest", rollbackData.get(rbType, "sdncCreateRollbackReq")) @@ -124,24 +128,24 @@ public class DoCreateAllottedResourceTXCRollback extends AbstractServiceTaskProc } }catch(BpmnError b){ - msoLogger.debug("Rethrowing MSOWorkflowException") + logger.debug("Rethrowing MSOWorkflowException") throw b } catch (Exception ex){ msg = "Exception in preProcessRequest " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("end preProcessRequest") + logger.trace("end preProcessRequest") } // aaiARPath set during query (existing AR) public void updateAaiAROrchStatus(DelegateExecution execution, String status){ String msg = null; - msoLogger.trace("start updateAaiAROrchStatus") + logger.trace("start updateAaiAROrchStatus") AllottedResourceUtils arUtils = new AllottedResourceUtils(this) String aaiARPath = execution.getVariable("aaiARPath") - msoLogger.debug(" aaiARPath:" + aaiARPath) + logger.debug(" aaiARPath:" + aaiARPath) Optional<AllottedResource> ar = Optional.empty(); //need this for getting resourceVersion for delete if (!isBlank(aaiARPath)) { @@ -150,73 +154,75 @@ public class DoCreateAllottedResourceTXCRollback extends AbstractServiceTaskProc if (!ar.isPresent()) { msg = "AR not found in AAI at:" + aaiARPath - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } String orchStatus = arUtils.updateAROrchStatus(execution, status, aaiARPath) - msoLogger.trace("end updateAaiAROrchStatus") + logger.trace("end updateAaiAROrchStatus") } public void validateSDNCResp(DelegateExecution execution, String response, String method){ - msoLogger.trace("start ValidateSDNCResponse Process") + logger.trace("start ValidateSDNCResponse Process") String msg = "" try { WorkflowException workflowException = execution.getVariable("WorkflowException") - msoLogger.debug("workflowException: " + workflowException) + logger.debug("workflowException: " + workflowException) boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - msoLogger.debug("SDNCResponse: " + response) + logger.debug("SDNCResponse: " + response) SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ - msoLogger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + response) + logger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + response) }else{ - msoLogger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.") + logger.debug("Received a BAD Response from SDNC Adapter for " + method + " SDNC Call.") throw new BpmnError("MSOWorkflowException") } } catch (BpmnError e) { if ("404".contentEquals(e.getErrorCode())) { msg = "SDNC rollback " + method + " returned a 404. Proceding with rollback" - msoLogger.debug(msg) + logger.debug(msg) } else { throw e; } } catch(Exception ex) { msg = "Exception in validateSDNCResp. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("Exit ValidateSDNCResp Process") + logger.trace("Exit ValidateSDNCResp Process") } public void deleteAaiAR(DelegateExecution execution){ try{ - msoLogger.trace("start deleteAaiAR") + logger.trace("start deleteAaiAR") AllottedResourceUtils arUtils = new AllottedResourceUtils(this) String arLink = execution.getVariable("aaiARPath") arUtils.deleteAR(execution, arLink) } catch (BpmnError e) { throw e; }catch(Exception ex){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + ex); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + ex.getMessage()) } - msoLogger.trace("end deleteAaiAR") + logger.trace("end deleteAaiAR") } public void postProcessRequest(DelegateExecution execution) { - msoLogger.trace("start postProcessRequest") + logger.trace("start postProcessRequest") String msg = "" try { execution.setVariable("rollbackData", null) @@ -224,51 +230,51 @@ public class DoCreateAllottedResourceTXCRollback extends AbstractServiceTaskProc if (skipRollback != true) { execution.setVariable("rolledBack", true) - msoLogger.debug("rolledBack") + logger.debug("rolledBack") } - msoLogger.trace("end postProcessRequest") + logger.trace("end postProcessRequest") } catch (BpmnError e) { - msoLogger.debug(msg) + logger.debug(msg) } catch (Exception ex) { msg = "Exception in postProcessRequest. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) } } public void processRollbackException(DelegateExecution execution){ - msoLogger.trace("start processRollbackException") + logger.trace("start processRollbackException") try{ - msoLogger.debug("Caught an Exception in DoCreateAllottedResourceRollback") + logger.debug("Caught an Exception in DoCreateAllottedResourceRollback") execution.setVariable("rollbackData", null) execution.setVariable("rolledBack", false) execution.setVariable("rollbackError", "Caught exception in AllottedResource Create Rollback") execution.setVariable("WorkflowException", null) }catch(BpmnError b){ - msoLogger.debug("BPMN Error during processRollbackExceptions Method: ") + logger.debug("BPMN Error during processRollbackExceptions Method: ") }catch(Exception e){ - msoLogger.debug("Caught Exception during processRollbackExceptions Method: " + e.getMessage()) + logger.debug("Caught Exception during processRollbackExceptions Method: " + e.getMessage()) } - msoLogger.trace("end processRollbackException") + logger.trace("end processRollbackException") } public void processRollbackJavaException(DelegateExecution execution){ - msoLogger.trace("start processRollbackJavaException") + logger.trace("start processRollbackJavaException") try{ execution.setVariable("rollbackData", null) execution.setVariable("rolledBack", false) execution.setVariable("rollbackError", "Caught Java exception in AllottedResource Create Rollback") - msoLogger.debug("Caught Exception in processRollbackJavaException") + logger.debug("Caught Exception in processRollbackJavaException") }catch(Exception e){ - msoLogger.debug("Caught Exception in processRollbackJavaException " + e.getMessage()) + logger.debug("Caught Exception in processRollbackJavaException " + e.getMessage()) } - msoLogger.trace("end processRollbackJavaException") + logger.trace("end processRollbackJavaException") } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy index e39edffe68..3b80f3c468 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceBRG.groovy @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -31,6 +33,8 @@ import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory import static org.apache.commons.lang3.StringUtils.isBlank @@ -58,7 +62,7 @@ import static org.apache.commons.lang3.StringUtils.isBlank * */ public class DoDeleteAllottedResourceBRG extends AbstractServiceTaskProcessor{ - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoDeleteAllottedResourceBRG.class); + private static final Logger logger = LoggerFactory.getLogger(DoDeleteAllottedResourceBRG.class); String Prefix="DDARBRG_" ExceptionUtil exceptionUtil = new ExceptionUtil() @@ -66,7 +70,7 @@ public class DoDeleteAllottedResourceBRG extends AbstractServiceTaskProcessor{ public void preProcessRequest (DelegateExecution execution) { String msg = "" - msoLogger.trace("start preProcessRequest") + logger.trace("start preProcessRequest") try { execution.setVariable("prefix", Prefix) @@ -75,38 +79,38 @@ public class DoDeleteAllottedResourceBRG extends AbstractServiceTaskProcessor{ String sdncCallbackUrl = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) if (isBlank(sdncCallbackUrl)) { msg = "mso.workflow.sdncadapter.callback is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } execution.setVariable("sdncCallbackUrl", sdncCallbackUrl) - msoLogger.debug("SDNC Callback URL: " + sdncCallbackUrl) + logger.debug("SDNC Callback URL: " + sdncCallbackUrl) //Request Inputs if (isBlank(execution.getVariable("serviceInstanceId"))){ msg = "Input serviceInstanceId is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } if (isBlank(execution.getVariable("allottedResourceId"))){ msg = "Input allottedResourceId is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } }catch(BpmnError b){ - msoLogger.debug("Rethrowing MSOWorkflowException") + logger.debug("Rethrowing MSOWorkflowException") throw b } catch (Exception ex){ msg = "Exception in preProcessRequest " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("end preProcessRequest") + logger.trace("end preProcessRequest") } public void getAaiAR (DelegateExecution execution) { - msoLogger.trace("start getAaiAR end") + logger.trace("start getAaiAR end") String allottedResourceId = execution.getVariable("allottedResourceId") @@ -123,26 +127,26 @@ public class DoDeleteAllottedResourceBRG extends AbstractServiceTaskProcessor{ errorMsg = "Allotted resource not found in AAI with AllottedResourceId:" + allottedResourceId } if (!isBlank(errorMsg)) { - msoLogger.debug(errorMsg) + logger.debug(errorMsg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, errorMsg) } - msoLogger.trace("end getAaiAR") + logger.trace("end getAaiAR") } // aaiARPath set during query (existing AR) public void updateAaiAROrchStatus(DelegateExecution execution, String status){ - msoLogger.trace("start updateAaiAROrchStatus") + logger.trace("start updateAaiAROrchStatus") AllottedResourceUtils arUtils = new AllottedResourceUtils(this) String aaiARPath = execution.getVariable("aaiARPath") //set during query (existing AR) String orchStatus = arUtils.updateAROrchStatus(execution, status, aaiARPath) - msoLogger.trace("end updateAaiAROrchStatus") + logger.trace("end updateAaiAROrchStatus") } public String buildSDNCRequest(DelegateExecution execution, String action, String sdncRequestId) { String msg = "" - msoLogger.trace("start buildSDNCRequest") + logger.trace("start buildSDNCRequest") String sdncReq = null try { @@ -214,106 +218,107 @@ public class DoDeleteAllottedResourceBRG extends AbstractServiceTaskProcessor{ </sdncadapterworkflow:SDNCRequestData> </sdncadapterworkflow:SDNCAdapterWorkflowRequest>""" - msoLogger.debug("sdncRequest:\n" + sdncReq) + logger.debug("sdncRequest:\n" + sdncReq) sdncReq = utils.formatXml(sdncReq) } catch(Exception ex) { msg = "Exception in buildSDNCRequest. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("end buildSDNCRequest") + logger.trace("end buildSDNCRequest") return sdncReq } public void preProcessSDNCUnassign(DelegateExecution execution) { String msg = "" - msoLogger.trace("start preProcessSDNCUnassign") + logger.trace("start preProcessSDNCUnassign") try { String sdncRequestId = UUID.randomUUID().toString() String sdncUnassignReq = buildSDNCRequest(execution, "unassign", sdncRequestId) execution.setVariable("sdncUnassignRequest", sdncUnassignReq) - msoLogger.debug("sdncUnassignRequest: " + sdncUnassignReq) + logger.debug("sdncUnassignRequest: " + sdncUnassignReq) } catch (BpmnError e) { throw e; } catch(Exception ex) { msg = "Exception in preProcessSDNCUnassign. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("end preProcessSDNCUnassign") + logger.trace("end preProcessSDNCUnassign") } public void preProcessSDNCDelete(DelegateExecution execution) { String msg = "" - msoLogger.trace("start preProcessSDNCDelete") + logger.trace("start preProcessSDNCDelete") try { String sdncRequestId = UUID.randomUUID().toString() String sdncDeleteReq = buildSDNCRequest(execution, "delete", sdncRequestId) execution.setVariable("sdncDeleteRequest", sdncDeleteReq) - msoLogger.debug("sdncDeleteReq: " + sdncDeleteReq) + logger.debug("sdncDeleteReq: " + sdncDeleteReq) } catch (BpmnError e) { throw e; } catch(Exception ex) { msg = "Exception in preProcessSDNCDelete. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("end preProcessSDNCDelete") + logger.trace("end preProcessSDNCDelete") } public void preProcessSDNCDeactivate(DelegateExecution execution) { String msg = "" - msoLogger.trace("start preProcessSDNCDeactivate") + logger.trace("start preProcessSDNCDeactivate") try { String sdncRequestId = UUID.randomUUID().toString() String sdncDeactivateReq = buildSDNCRequest(execution, "deactivate", sdncRequestId) execution.setVariable("sdncDeactivateRequest", sdncDeactivateReq) - msoLogger.debug("sdncDeactivateReq: " + sdncDeactivateReq) + logger.debug("sdncDeactivateReq: " + sdncDeactivateReq) } catch (BpmnError e) { throw e; } catch(Exception ex) { msg = "Exception in preProcessSDNCDeactivate. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("end preProcessSDNCDeactivate") + logger.trace("end preProcessSDNCDeactivate") } public void validateSDNCResp(DelegateExecution execution, String response, String method){ - msoLogger.trace("start ValidateSDNCResponse Process") + logger.trace("start ValidateSDNCResponse Process") String msg = "" try { WorkflowException workflowException = execution.getVariable("WorkflowException") - msoLogger.debug("workflowException: " + workflowException) + logger.debug("workflowException: " + workflowException) boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - msoLogger.debug("SDNCResponse: " + response) + logger.debug("SDNCResponse: " + response) SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ - msoLogger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + response) - + logger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + + response) }else{ String sdncRespCode = execution.getVariable(Prefix + 'sdncRequestDataResponseCode') - msoLogger.debug(method + " AllottedResource received error response from SDNC. ResponseCode:" + sdncRespCode) + logger.debug(method + " AllottedResource received error response from SDNC. ResponseCode:" + + sdncRespCode) if (sdncRespCode.equals("404") && "deactivate".equals(method)) { execution.setVariable("ARNotFoundInSDNC", true) if ("true".equals(execution.getVariable("failNotFound"))) { msg = "Allotted Resource Not found in SDNC" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } else @@ -330,14 +335,14 @@ public class DoDeleteAllottedResourceBRG extends AbstractServiceTaskProcessor{ throw e; } catch(Exception ex) { msg = "Exception in validateSDNCResp. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("end ValidateSDNCResp Process") + logger.trace("end ValidateSDNCResp Process") } public void deleteAaiAR(DelegateExecution execution){ - msoLogger.trace("start deleteAaiAR") + logger.trace("start deleteAaiAR") try{ AllottedResourceUtils arUtils = new AllottedResourceUtils(this) @@ -346,10 +351,12 @@ public class DoDeleteAllottedResourceBRG extends AbstractServiceTaskProcessor{ } catch (BpmnError e) { throw e; }catch(Exception ex){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occurred Processing preProcessSDNCGetRequest." + ex, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "Exception is:" + ex); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Occurred Processing preProcessSDNCGetRequest." + ex, "BPMN", + MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:" + ex); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + ex.getMessage()) } - msoLogger.trace("end deleteAaiAR") + logger.trace("end deleteAaiAR") } public AllottedResourceUtils getAllottedResourceUtils(){ diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy index f305a7ad0d..9b9f9f0388 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/DoDeleteAllottedResourceTXC.groovy @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -31,6 +33,9 @@ import org.onap.so.bpmn.core.UrnPropertiesReader import org.onap.so.bpmn.core.WorkflowException import org.onap.so.logger.MessageEnum import org.onap.so.logger.MsoLogger +import org.slf4j.Logger +import org.slf4j.LoggerFactory + import static org.apache.commons.lang3.StringUtils.isBlank /** @@ -57,7 +62,7 @@ import static org.apache.commons.lang3.StringUtils.isBlank * */ public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{ - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DoDeleteAllottedResourceTXC.class); + private static final Logger logger = LoggerFactory.getLogger(DoDeleteAllottedResourceTXC.class); String Prefix="DDARTXC_" ExceptionUtil exceptionUtil = new ExceptionUtil() @@ -65,7 +70,7 @@ public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{ public void preProcessRequest (DelegateExecution execution) { String msg = "" - msoLogger.trace("start preProcessRequest") + logger.trace("start preProcessRequest") try { execution.setVariable("prefix", Prefix) @@ -74,38 +79,38 @@ public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{ String sdncCallbackUrl = UrnPropertiesReader.getVariable("mso.workflow.sdncadapter.callback",execution) if (isBlank(sdncCallbackUrl)) { msg = "mso.workflow.sdncadapter.callback is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } execution.setVariable("sdncCallbackUrl", sdncCallbackUrl) - msoLogger.debug("SDNC Callback URL: " + sdncCallbackUrl) + logger.debug("SDNC Callback URL: " + sdncCallbackUrl) //Request Inputs if (isBlank(execution.getVariable("serviceInstanceId"))){ msg = "Input serviceInstanceId is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } if (isBlank(execution.getVariable("allottedResourceId"))){ msg = "Input allottedResourceId is null" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } }catch(BpmnError b){ - msoLogger.debug("Rethrowing MSOWorkflowException") + logger.debug("Rethrowing MSOWorkflowException") throw b } catch (Exception ex){ msg = "Exception in preProcessRequest " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("end preProcessRequest") + logger.trace("end preProcessRequest") } public void getAaiAR (DelegateExecution execution) { - msoLogger.trace("start getAaiAR") + logger.trace("start getAaiAR") String allottedResourceId = execution.getVariable("allottedResourceId") @@ -122,10 +127,10 @@ public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{ errorMsg = "Allotted resource not found in AAI with AllottedResourceId:" + allottedResourceId } if (!isBlank(errorMsg)) { - msoLogger.debug(errorMsg) + logger.debug(errorMsg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, errorMsg) } - msoLogger.trace("end getAaiAR") + logger.trace("end getAaiAR") } @@ -135,17 +140,17 @@ public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{ // aaiARPath set during query (existing AR) public void updateAaiAROrchStatus(DelegateExecution execution, String status){ - msoLogger.trace("start updateAaiAROrchStatus") + logger.trace("start updateAaiAROrchStatus") AllottedResourceUtils arUtils = new AllottedResourceUtils(this) String aaiARPath = execution.getVariable("aaiARPath") //set during query (existing AR) String orchStatus = arUtils.updateAROrchStatus(execution, status, aaiARPath) - msoLogger.trace("end updateAaiAROrchStatus") + logger.trace("end updateAaiAROrchStatus") } public String buildSDNCRequest(DelegateExecution execution, String action, String sdncRequestId) { String msg = "" - msoLogger.trace("start buildSDNCRequest") + logger.trace("start buildSDNCRequest") String sdncReq = null try { @@ -217,106 +222,107 @@ public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{ </sdncadapterworkflow:SDNCRequestData> </sdncadapterworkflow:SDNCAdapterWorkflowRequest>""" - msoLogger.debug("sdncRequest:\n" + sdncReq) + logger.debug("sdncRequest:\n" + sdncReq) sdncReq = utils.formatXml(sdncReq) } catch(Exception ex) { msg = "Exception in buildSDNCRequest. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("end buildSDNCRequest") + logger.trace("end buildSDNCRequest") return sdncReq } public void preProcessSDNCUnassign(DelegateExecution execution) { String msg = "" - msoLogger.trace("start preProcessSDNCUnassign") + logger.trace("start preProcessSDNCUnassign") try { String sdncRequestId = UUID.randomUUID().toString() String sdncUnassignReq = buildSDNCRequest(execution, "unassign", sdncRequestId) execution.setVariable("sdncUnassignRequest", sdncUnassignReq) - msoLogger.debug("sdncUnassignRequest: " + sdncUnassignReq) + logger.debug("sdncUnassignRequest: " + sdncUnassignReq) } catch (BpmnError e) { throw e; } catch(Exception ex) { msg = "Exception in preProcessSDNCUnassign. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("end preProcessSDNCUnassign") + logger.trace("end preProcessSDNCUnassign") } public void preProcessSDNCDelete(DelegateExecution execution) { String msg = "" - msoLogger.trace("start preProcessSDNCDelete") + logger.trace("start preProcessSDNCDelete") try { String sdncRequestId = UUID.randomUUID().toString() String sdncDeleteReq = buildSDNCRequest(execution, "delete", sdncRequestId) execution.setVariable("sdncDeleteRequest", sdncDeleteReq) - msoLogger.debug("sdncDeleteReq: " + sdncDeleteReq) + logger.debug("sdncDeleteReq: " + sdncDeleteReq) } catch (BpmnError e) { throw e; } catch(Exception ex) { msg = "Exception in preProcessSDNCDelete. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("end preProcessSDNCDelete") + logger.trace("end preProcessSDNCDelete") } public void preProcessSDNCDeactivate(DelegateExecution execution) { String msg = "" - msoLogger.trace("start preProcessSDNCDeactivate") + logger.trace("start preProcessSDNCDeactivate") try { String sdncRequestId = UUID.randomUUID().toString() String sdncDeactivateReq = buildSDNCRequest(execution, "deactivate", sdncRequestId) execution.setVariable("sdncDeactivateRequest", sdncDeactivateReq) - msoLogger.debug("sdncDeactivateReq: " + sdncDeactivateReq) + logger.debug("sdncDeactivateReq: " + sdncDeactivateReq) } catch (BpmnError e) { throw e; } catch(Exception ex) { msg = "Exception in preProcessSDNCDeactivate. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("end preProcessSDNCDeactivate") + logger.trace("end preProcessSDNCDeactivate") } public void validateSDNCResp(DelegateExecution execution, String response, String method){ - msoLogger.trace("start ValidateSDNCResponse Process") + logger.trace("start ValidateSDNCResponse Process") String msg = "" try { WorkflowException workflowException = execution.getVariable("WorkflowException") - msoLogger.debug("workflowException: " + workflowException) + logger.debug("workflowException: " + workflowException) boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - msoLogger.debug("SDNCResponse: " + response) + logger.debug("SDNCResponse: " + response) SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils(this) sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) if(execution.getVariable(Prefix + 'sdncResponseSuccess') == true){ - msoLogger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + response) - + logger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + + response) }else{ String sdncRespCode = execution.getVariable(Prefix + 'sdncRequestDataResponseCode') - msoLogger.debug(method + " AllottedResource received error response from SDNC. ResponseCode:" + sdncRespCode) + logger.debug(method + " AllottedResource received error response from SDNC. ResponseCode:" + + sdncRespCode) if (sdncRespCode.equals("404") && "deactivate".equals(method)) { execution.setVariable("ARNotFoundInSDNC", true) if ("true".equals(execution.getVariable("failNotFound"))) { msg = "Allotted Resource Not found in SDNC" - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } else @@ -333,14 +339,14 @@ public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{ throw e; } catch(Exception ex) { msg = "Exception in validateSDNCResp. " + ex.getMessage() - msoLogger.debug(msg) + logger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.trace("end Exit ValidateSDNCResp Process") + logger.trace("end Exit ValidateSDNCResp Process") } public void deleteAaiAR(DelegateExecution execution){ - msoLogger.trace("start deleteAaiAR") + logger.trace("start deleteAaiAR") try{ AllottedResourceUtils arUtils = new AllottedResourceUtils(this) @@ -349,11 +355,12 @@ public class DoDeleteAllottedResourceTXC extends AbstractServiceTaskProcessor{ } catch (BpmnError e) { throw e; }catch(Exception ex){ - msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN", MsoLogger.getServiceName(), - MsoLogger.ErrorCode.UnknownError, "Exception is:\n" + ex); + logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Occurred Processing preProcessSDNCGetRequest.", "BPMN", MsoLogger.getServiceName(), + MsoLogger.ErrorCode.UnknownError.getValue(), "Exception is:\n" + ex); exceptionUtil.buildAndThrowWorkflowException(execution, 1002, "Error Occured during SDNC GET Method:\n" + ex.getMessage()) } - msoLogger.trace("end deleteAaiAR") + logger.trace("end deleteAaiAR") } } diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java index be1131ed78..84cac6ce5c 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java @@ -4,6 +4,8 @@ * ================================================================================ * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ * 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 @@ -25,6 +27,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.UUID; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; @@ -69,7 +72,8 @@ import org.onap.so.serviceinstancebeans.RequestInfo; import org.onap.so.serviceinstancebeans.RequestParameters; import org.onap.so.serviceinstancebeans.ServiceInstancesRequest; import org.onap.so.serviceinstancebeans.SubscriberInfo; -import org.onap.so.utils.UUIDChecker; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -85,8 +89,7 @@ import io.swagger.annotations.ApiOperation; public class E2EServiceInstances { private HashMap<String, String> instanceIdMap = new HashMap<>(); - private static final MsoLogger msoLogger = MsoLogger - .getMsoLogger(MsoLogger.Catalog.APIH, E2EServiceInstances.class); + private static final Logger logger = LoggerFactory.getLogger(E2EServiceInstances.class); private static final String MSO_PROP_APIHANDLER_INFRA = "MSO_PROP_APIHANDLER_INFRA"; @@ -190,7 +193,7 @@ public class E2EServiceInstances { @PathParam("version") String version, @PathParam("serviceId") String serviceId) throws ApiException { - msoLogger.debug("------------------scale begin------------------"); + logger.debug("------------------scale begin------------------"); instanceIdMap.put("serviceId", serviceId); return scaleE2EserviceInstances(request, Action.scaleInstance, instanceIdMap, version); } @@ -216,9 +219,8 @@ public class E2EServiceInstances { private Response compareModelwithTargetVersion(String requestJSON, Action action, HashMap<String, String> instanceIdMap, String version) throws ApiException { - String requestId = UUIDChecker.generateUUID(msoLogger); + String requestId = UUID.randomUUID().toString(); long startTime = System.currentTimeMillis(); - msoLogger.debug("requestId is: " + requestId); CompareModelsRequest e2eCompareModelReq; @@ -228,15 +230,13 @@ public class E2EServiceInstances { } catch (Exception e) { - msoLogger.debug("Mapping of request to JSON object failed : ", e); + logger.debug("Mapping of request to JSON object failed : ", e); Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException, "Mapping of request to JSON object failed. " + e.getMessage(), ErrorNumbers.SVC_BAD_PARAMETER, null, version); - msoLogger.error(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", - MsoLogger.ErrorCode.SchemaError, requestJSON, e); - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, - "Mapping of request to JSON object failed"); - msoLogger.debug(END_OF_THE_TRANSACTION + response.getEntity().toString()); + logger.error("{} {} {} {}", MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA, + MsoLogger.ErrorCode.SchemaError.getValue(), requestJSON, e); + logger.debug(END_OF_THE_TRANSACTION + response.getEntity().toString()); return response; } @@ -264,7 +264,7 @@ public class E2EServiceInstances { String bpmnRequest = jjo.toString(); // Capture audit event - msoLogger.debug("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl()); + logger.debug("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl()); String serviceId = instanceIdMap.get("serviceId"); String serviceType = e2eCompareModelReq.getServiceType(); RequestClientParameter postParam = new RequestClientParameter.Builder() @@ -277,32 +277,22 @@ public class E2EServiceInstances { .setRequestDetails(bpmnRequest) .setALaCarte(false).build(); response = requestClient.post(postParam); - - msoLogger.recordMetricEvent(subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, - "Successfully received response from BPMN engine", "BPMN", workflowUrl, null); } catch (Exception e) { - msoLogger.recordMetricEvent(subStartTime, MsoLogger.StatusCode.ERROR, - MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine", "BPMN", - workflowUrl, null); Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException, "Failed calling bpmn " + e.getMessage(), ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version); - msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", + logger.error("", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine",e); - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, - "Exception while communicate with BPMN engine"); - msoLogger.debug(END_OF_THE_TRANSACTION + resp.getEntity().toString()); + logger.debug(END_OF_THE_TRANSACTION + resp.getEntity().toString()); return resp; } if (response == null) { Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException, "bpelResponse is null", ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version); - msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", - MsoLogger.ErrorCode.BusinessProcesssError, "Null response from BPEL"); - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, - "Null response from BPMN"); - msoLogger.debug(END_OF_THE_TRANSACTION + resp.getEntity().toString()); + logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA, + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL"); + logger.debug(END_OF_THE_TRANSACTION + resp.getEntity().toString()); return resp; } @@ -327,24 +317,14 @@ public class E2EServiceInstances { operationStatus = requestsDbClient.getOneByServiceIdAndOperationId(serviceId, operationId); } catch (Exception e) { - msoLogger - .error(MessageEnum.APIH_DB_ACCESS_EXC, - MSO_PROP_APIHANDLER_INFRA, - "", - "", - MsoLogger.ErrorCode.AvailabilityError, - "Exception while communciate with Request DB - Infra Request Lookup", - e); + logger.error("{} {} {} {}", MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA, + MsoLogger.ErrorCode.AvailabilityError.getValue(), + "Exception while communciate with Request DB - Infra Request Lookup", e); Response response = msoRequest.buildServiceErrorResponse( HttpStatus.SC_NOT_FOUND, MsoException.ServiceException, e.getMessage(), ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB, null, version); - - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, - MsoLogger.ResponseCode.DBAccessError, - "Exception while communciate with Request DB"); - msoLogger.debug(END_OF_THE_TRANSACTION - + response.getEntity()); + logger.debug(END_OF_THE_TRANSACTION + response.getEntity()); return response; } @@ -354,15 +334,10 @@ public class E2EServiceInstances { HttpStatus.SC_NO_CONTENT, MsoException.ServiceException, "E2E serviceId " + serviceId + " is not found in DB", ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, null, version); - msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, - MSO_PROP_APIHANDLER_INFRA, "", "", - MsoLogger.ErrorCode.BusinessProcesssError, - "Null response from RequestDB when searching by serviceId"); - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, - MsoLogger.ResponseCode.DataNotFound, - "Null response from RequestDB when searching by serviceId"); - msoLogger.debug(END_OF_THE_TRANSACTION - + resp.getEntity()); + logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA, + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), + "Null response from RequestDB when searching by serviceId"); + logger.debug(END_OF_THE_TRANSACTION + resp.getEntity()); return resp; } @@ -375,9 +350,7 @@ public class E2EServiceInstances { private Response deleteE2EserviceInstances(String requestJSON, Action action, HashMap<String, String> instanceIdMap, String version) throws ApiException { // TODO should be a new one or the same service instance Id - String requestId = UUIDChecker.generateUUID(msoLogger); long startTime = System.currentTimeMillis(); - msoLogger.debug("requestId is: " + requestId); E2EServiceInstanceDeleteRequest e2eDelReq; ObjectMapper mapper = new ObjectMapper(); @@ -387,63 +360,49 @@ public class E2EServiceInstances { } catch (Exception e) { - msoLogger.debug("Mapping of request to JSON object failed : ", e); + logger.debug("Mapping of request to JSON object failed : ", e); Response response = msoRequest.buildServiceErrorResponse( HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException, "Mapping of request to JSON object failed. " + e.getMessage(), ErrorNumbers.SVC_BAD_PARAMETER, null, version); - msoLogger.error(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, - MSO_PROP_APIHANDLER_INFRA, "", "", - MsoLogger.ErrorCode.SchemaError, requestJSON, e); - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, - MsoLogger.ResponseCode.SchemaError, - "Mapping of request to JSON object failed"); - msoLogger.debug(END_OF_THE_TRANSACTION - + response.getEntity()); + logger.error("{} {} {} {}", MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA, + MsoLogger.ErrorCode.SchemaError.getValue(), requestJSON, e); + logger.debug(END_OF_THE_TRANSACTION + response.getEntity()); return response; } + String requestId = UUID.randomUUID().toString(); RecipeLookupResult recipeLookupResult; try { //TODO Get the service template model version uuid from AAI. recipeLookupResult = getServiceInstanceOrchestrationURI(null, action); } catch (Exception e) { - msoLogger.error(MessageEnum.APIH_DB_ACCESS_EXC, - MSO_PROP_APIHANDLER_INFRA, "", "", - MsoLogger.ErrorCode.AvailabilityError, - "Exception while communciate with Catalog DB", e); + logger.error(MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA, + MsoLogger.ErrorCode.AvailabilityError.getValue(), "Exception while communciate with Catalog DB", e); Response response = msoRequest.buildServiceErrorResponse( HttpStatus.SC_NOT_FOUND, MsoException.ServiceException, "No communication to catalog DB " + e.getMessage(), ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version); - msoRequest.createErrorRequestRecord(Status.FAILED, requestId, "Exception while communciate with Catalog DB", action, ModelType.service.name(), requestJSON); - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, - MsoLogger.ResponseCode.DBAccessError, - "Exception while communciate with DB"); - msoLogger.debug(END_OF_THE_TRANSACTION - + response.getEntity()); + msoRequest.createErrorRequestRecord(Status.FAILED, requestId, "Exception while communciate with " + + "Catalog DB", action, + ModelType.service.name(), requestJSON); + logger.debug(END_OF_THE_TRANSACTION + response.getEntity()); return response; } if (recipeLookupResult == null) { - msoLogger.error(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, - MSO_PROP_APIHANDLER_INFRA, "", "", - MsoLogger.ErrorCode.DataError, "No recipe found in DB"); + logger.error("{} {} {} {}", MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND.toString(), MSO_PROP_APIHANDLER_INFRA, + MsoLogger.ErrorCode.DataError.getValue(), "No recipe found in DB"); Response response = msoRequest.buildServiceErrorResponse( HttpStatus.SC_NOT_FOUND, MsoException.ServiceException, "Recipe does not exist in catalog DB", ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null, version); msoRequest.createErrorRequestRecord(Status.FAILED, requestId,"Recipe does not exist in catalog DB", action, ModelType.service.name(), requestJSON); - - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, - MsoLogger.ResponseCode.DataNotFound, - "No recipe found in DB"); - msoLogger.debug(END_OF_THE_TRANSACTION - + response.getEntity()); + logger.debug(END_OF_THE_TRANSACTION + response.getEntity()); return response; } @@ -455,14 +414,12 @@ public class E2EServiceInstances { requestClient = requestClientFactory.getRequestClient(recipeLookupResult.getOrchestrationURI()); JSONObject jjo = new JSONObject(requestJSON); - jjo.put("operationId", UUIDChecker.generateUUID(msoLogger)); + jjo.put("operationId", requestId); String bpmnRequest = jjo.toString(); // Capture audit event - msoLogger - .debug("MSO API Handler Posting call to BPEL engine for url: " - + requestClient.getUrl()); + logger.debug("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl()); String serviceId = instanceIdMap.get("serviceId"); String serviceInstanceType = e2eDelReq.getServiceType(); RequestClientParameter clientParam = new RequestClientParameter.Builder() @@ -478,29 +435,14 @@ public class E2EServiceInstances { .setRecipeParamXsd(recipeLookupResult.getRecipeParamXsd()).build(); response = requestClient.post(clientParam); - msoLogger.recordMetricEvent(subStartTime, - MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, - "Successfully received response from BPMN engine", "BPMN", - recipeLookupResult.getOrchestrationURI(), null); } catch (Exception e) { - msoLogger.recordMetricEvent(subStartTime, - MsoLogger.StatusCode.ERROR, - MsoLogger.ResponseCode.CommunicationError, - "Exception while communicate with BPMN engine", "BPMN", - recipeLookupResult.getOrchestrationURI(), null); Response resp = msoRequest.buildServiceErrorResponse( HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException, "Failed calling bpmn " + e.getMessage(), ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version); - msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, - MSO_PROP_APIHANDLER_INFRA, "", "", - MsoLogger.ErrorCode.AvailabilityError, - "Exception while communicate with BPMN engine"); - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, - MsoLogger.ResponseCode.CommunicationError, - "Exception while communicate with BPMN engine"); - msoLogger.debug("End of the transaction, the final response is: " - + resp.getEntity()); + logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA, + MsoLogger.ErrorCode.AvailabilityError.getValue(), "Exception while communicate with BPMN engine"); + logger.debug("End of the transaction, the final response is: " + resp.getEntity()); return resp; } @@ -509,14 +451,9 @@ public class E2EServiceInstances { HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException, "bpelResponse is null", ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version); - msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, - MSO_PROP_APIHANDLER_INFRA, "", "", - MsoLogger.ErrorCode.BusinessProcesssError, - "Null response from BPEL"); - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, - MsoLogger.ResponseCode.InternalError, - "Null response from BPMN"); - msoLogger.debug(END_OF_THE_TRANSACTION + resp.getEntity()); + logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA, + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL"); + logger.debug(END_OF_THE_TRANSACTION + resp.getEntity()); return resp; } @@ -531,9 +468,8 @@ public class E2EServiceInstances { private Response updateE2EserviceInstances(String requestJSON, Action action, HashMap<String, String> instanceIdMap, String version) throws ApiException { - String requestId = UUIDChecker.generateUUID(msoLogger); + String requestId = UUID.randomUUID().toString(); long startTime = System.currentTimeMillis(); - msoLogger.debug("requestId is: " + requestId); E2EServiceInstanceRequest e2eSir; String serviceId = instanceIdMap.get("serviceId"); @@ -543,15 +479,13 @@ public class E2EServiceInstances { } catch (Exception e) { - msoLogger.debug("Mapping of request to JSON object failed : ", e); + logger.debug("Mapping of request to JSON object failed : ", e); Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException, "Mapping of request to JSON object failed. " + e.getMessage(), ErrorNumbers.SVC_BAD_PARAMETER, null, version); - msoLogger.error(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", - MsoLogger.ErrorCode.SchemaError, requestJSON, e); - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, - "Mapping of request to JSON object failed"); - msoLogger.debug(END_OF_THE_TRANSACTION + response.getEntity()); + logger.error("{} {} {} {}", MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA, + MsoLogger.ErrorCode.SchemaError.getValue(), requestJSON, e); + logger.debug(END_OF_THE_TRANSACTION + response.getEntity()); return response; } @@ -560,18 +494,16 @@ public class E2EServiceInstances { try { parseRequest(sir, instanceIdMap, action, version, requestJSON, false, requestId); } catch (Exception e) { - msoLogger.debug("Validation failed: ", e); + logger.debug("Validation failed: ", e); Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException, "Error parsing request. " + e.getMessage(), ErrorNumbers.SVC_BAD_PARAMETER, null, version); if (requestId != null) { - msoLogger.debug("Logging failed message to the database"); + logger.debug("Logging failed message to the database"); } - msoLogger.error(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", - MsoLogger.ErrorCode.SchemaError, requestJSON, e); - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, - "Validation of the input request failed"); - msoLogger.debug(END_OF_THE_TRANSACTION + response.getEntity()); + logger.error("{} {} {} {}", MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA, + MsoLogger.ErrorCode.SchemaError.getValue(), requestJSON, e); + logger.debug(END_OF_THE_TRANSACTION + response.getEntity()); return response; } @@ -579,30 +511,24 @@ public class E2EServiceInstances { try { recipeLookupResult = getServiceInstanceOrchestrationURI(e2eSir.getService().getServiceUuid(), action); } catch (Exception e) { - msoLogger.error(MessageEnum.APIH_DB_ACCESS_EXC, MSO_PROP_APIHANDLER_INFRA, "", "", - MsoLogger.ErrorCode.AvailabilityError, "Exception while communciate with Catalog DB", e); + logger.error("{} {} {} {}", MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA, + MsoLogger.ErrorCode.AvailabilityError.getValue(), "Exception while communciate with Catalog DB", e); Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND, MsoException.ServiceException, "No communication to catalog DB " + e.getMessage(), ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version); - - - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, - "Exception while communciate with DB"); - msoLogger.debug(END_OF_THE_TRANSACTION + response.getEntity()); + + logger.debug(END_OF_THE_TRANSACTION + response.getEntity()); return response; } if (recipeLookupResult == null) { - msoLogger.error(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MSO_PROP_APIHANDLER_INFRA, "", "", - MsoLogger.ErrorCode.DataError, "No recipe found in DB"); + logger.error("{} {} {} {}", MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND.toString(), MSO_PROP_APIHANDLER_INFRA, + MsoLogger.ErrorCode.DataError.getValue(), "No recipe found in DB"); Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND, MsoException.ServiceException, "Recipe does not exist in catalog DB", ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null, version); - - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, - "No recipe found in DB"); - msoLogger.debug(END_OF_THE_TRANSACTION + response.getEntity()); + logger.debug(END_OF_THE_TRANSACTION + response.getEntity()); return response; } @@ -619,7 +545,7 @@ public class E2EServiceInstances { requestClient = requestClientFactory.getRequestClient(recipeLookupResult.getOrchestrationURI()); // Capture audit event - msoLogger.debug("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl()); + logger.debug("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl()); RequestClientParameter postParam = new RequestClientParameter.Builder() .setRequestId(requestId) .setBaseVfModule(false) @@ -632,24 +558,15 @@ public class E2EServiceInstances { .setALaCarte(false) .setRecipeParamXsd(recipeLookupResult.getRecipeParamXsd()).build(); response = requestClient.post(postParam); - - msoLogger.recordMetricEvent(subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, - "Successfully received response from BPMN engine", "BPMN", recipeLookupResult.getOrchestrationURI(), - null); } catch (Exception e) { - msoLogger.debug("Exception while communicate with BPMN engine", e); - msoLogger.recordMetricEvent(subStartTime, MsoLogger.StatusCode.ERROR, - MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine", "BPMN", - recipeLookupResult.getOrchestrationURI(), null); + logger.debug("Exception while communicate with BPMN engine", e); Response getBPMNResp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException, "Failed calling bpmn " + e.getMessage(), ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version); - msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", - MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine"); - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, - "Exception while communicate with BPMN engine"); - msoLogger.debug(END_OF_THE_TRANSACTION + getBPMNResp.getEntity()); + logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA, + MsoLogger.ErrorCode.AvailabilityError.getValue(), "Exception while communicate with BPMN engine"); + logger.debug(END_OF_THE_TRANSACTION + getBPMNResp.getEntity()); return getBPMNResp; } @@ -657,11 +574,9 @@ public class E2EServiceInstances { if (response == null) { Response getBPMNResp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException, "bpelResponse is null", ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version); - msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", - MsoLogger.ErrorCode.BusinessProcesssError, "Null response from BPEL"); - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, - "Null response from BPMN"); - msoLogger.debug(END_OF_THE_TRANSACTION + getBPMNResp.getEntity()); + logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA, + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL"); + logger.debug(END_OF_THE_TRANSACTION + getBPMNResp.getEntity()); return getBPMNResp; } @@ -675,9 +590,8 @@ public class E2EServiceInstances { private Response processE2EserviceInstances(String requestJSON, Action action, HashMap<String, String> instanceIdMap, String version) throws ApiException { - String requestId = UUIDChecker.generateUUID(msoLogger); + String requestId = UUID.randomUUID().toString(); long startTime = System.currentTimeMillis(); - msoLogger.debug("requestId is: " + requestId); E2EServiceInstanceRequest e2eSir; MsoRequest msoRequest = new MsoRequest(); @@ -687,15 +601,13 @@ public class E2EServiceInstances { } catch (Exception e) { - msoLogger.debug("Mapping of request to JSON object failed : ", e); + logger.debug("Mapping of request to JSON object failed : ", e); Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException, "Mapping of request to JSON object failed. " + e.getMessage(), ErrorNumbers.SVC_BAD_PARAMETER, null, version); - msoLogger.error(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", - MsoLogger.ErrorCode.SchemaError, requestJSON, e); - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, - "Mapping of request to JSON object failed"); - msoLogger.debug(END_OF_THE_TRANSACTION + response.getEntity()); + logger.error("{} {} {} {}", MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA, + MsoLogger.ErrorCode.SchemaError.getValue(), requestJSON, e); + logger.debug(END_OF_THE_TRANSACTION + response.getEntity()); return response; } @@ -704,18 +616,16 @@ public class E2EServiceInstances { try { parseRequest(sir, instanceIdMap, action, version, requestJSON, false, requestId); } catch (Exception e) { - msoLogger.debug("Validation failed: ", e); + logger.debug("Validation failed: ", e); Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException, "Error parsing request. " + e.getMessage(), ErrorNumbers.SVC_BAD_PARAMETER, null, version); if (requestId != null) { - msoLogger.debug("Logging failed message to the database"); + logger.debug("Logging failed message to the database"); } - msoLogger.error(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", - MsoLogger.ErrorCode.SchemaError, requestJSON, e); - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, - "Validation of the input request failed"); - msoLogger.debug(END_OF_THE_TRANSACTION + response.getEntity()); + logger.error("{} {} {} {}", MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA, + MsoLogger.ErrorCode.SchemaError.getValue(), requestJSON, e); + logger.debug(END_OF_THE_TRANSACTION + response.getEntity()); return response; } @@ -723,28 +633,22 @@ public class E2EServiceInstances { try { recipeLookupResult = getServiceInstanceOrchestrationURI(e2eSir.getService().getServiceUuid(), action); } catch (Exception e) { - msoLogger.error(MessageEnum.APIH_DB_ACCESS_EXC, MSO_PROP_APIHANDLER_INFRA, "", "", - MsoLogger.ErrorCode.AvailabilityError, "Exception while communciate with Catalog DB", e); + logger.error("{} {} {} {}", MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA, + MsoLogger.ErrorCode.AvailabilityError.getValue(), "Exception while communciate with Catalog DB", e); Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND, MsoException.ServiceException, "No communication to catalog DB " + e.getMessage(), ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version); - - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DBAccessError, - "Exception while communciate with DB"); - msoLogger.debug(END_OF_THE_TRANSACTION + response.getEntity()); + logger.debug(END_OF_THE_TRANSACTION + response.getEntity()); return response; } if (recipeLookupResult == null) { - msoLogger.error(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, MSO_PROP_APIHANDLER_INFRA, "", "", - MsoLogger.ErrorCode.DataError, "No recipe found in DB"); + logger.error("{} {} {} {}", MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND.toString(), MSO_PROP_APIHANDLER_INFRA, + MsoLogger.ErrorCode.DataError.getValue(), "No recipe found in DB"); Response response = msoRequest.buildServiceErrorResponse(HttpStatus.SC_NOT_FOUND, MsoException.ServiceException, "Recipe does not exist in catalog DB", ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null, version); - - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.DataNotFound, - "No recipe found in DB"); - msoLogger.debug(END_OF_THE_TRANSACTION + response.getEntity()); + logger.debug(END_OF_THE_TRANSACTION + response.getEntity()); return response; } @@ -761,7 +665,7 @@ public class E2EServiceInstances { requestClient = requestClientFactory.getRequestClient(recipeLookupResult.getOrchestrationURI()); // Capture audit event - msoLogger.debug("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl()); + logger.debug("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl()); RequestClientParameter parameter = new RequestClientParameter.Builder() .setRequestId(requestId) .setBaseVfModule(false) @@ -774,34 +678,23 @@ public class E2EServiceInstances { .setALaCarte(false) .setRecipeParamXsd(recipeLookupResult.getRecipeParamXsd()).build(); response = requestClient.post(parameter); - - msoLogger.recordMetricEvent(subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, - "Successfully received response from BPMN engine", "BPMN", recipeLookupResult.getOrchestrationURI(), - null); } catch (Exception e) { - msoLogger.recordMetricEvent(subStartTime, MsoLogger.StatusCode.ERROR, - MsoLogger.ResponseCode.CommunicationError, "Exception while communicate with BPMN engine", "BPMN", - recipeLookupResult.getOrchestrationURI(), null); Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException, "Failed calling bpmn " + e.getMessage(), ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version); - - msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", - MsoLogger.ErrorCode.AvailabilityError, "Exception while communicate with BPMN engine"); - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError, - "Exception while communicate with BPMN engine"); - msoLogger.debug(END_OF_THE_TRANSACTION + resp.getEntity()); + + logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA, + MsoLogger.ErrorCode.AvailabilityError.getValue(), "Exception while communicate with BPMN engine"); + logger.debug(END_OF_THE_TRANSACTION + resp.getEntity()); return resp; } if (response == null) { Response resp = msoRequest.buildServiceErrorResponse(HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException, "bpelResponse is null", ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version); - msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MSO_PROP_APIHANDLER_INFRA, "", "", - MsoLogger.ErrorCode.BusinessProcesssError, "Null response from BPEL"); - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError, - "Null response from BPMN"); - msoLogger.debug(END_OF_THE_TRANSACTION + resp.getEntity()); + logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA, + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL"); + logger.debug(END_OF_THE_TRANSACTION + resp.getEntity()); return resp; } @@ -815,9 +708,8 @@ public class E2EServiceInstances { private Response scaleE2EserviceInstances(String requestJSON, Action action, HashMap<String, String> instanceIdMap, String version) throws ApiException { - String requestId = UUIDChecker.generateUUID(msoLogger); + String requestId = UUID.randomUUID().toString(); long startTime = System.currentTimeMillis(); - msoLogger.debug("requestId is: " + requestId); E2EServiceInstanceScaleRequest e2eScaleReq; ObjectMapper mapper = new ObjectMapper(); @@ -827,22 +719,17 @@ public class E2EServiceInstances { } catch (Exception e) { - msoLogger.debug("Mapping of request to JSON object failed : ", e); + logger.debug("Mapping of request to JSON object failed : ", e); Response response = msoRequest.buildServiceErrorResponse( HttpStatus.SC_BAD_REQUEST, MsoException.ServiceException, "Mapping of request to JSON object failed. " + e.getMessage(), ErrorNumbers.SVC_BAD_PARAMETER, null, version); - msoLogger.error(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, - MSO_PROP_APIHANDLER_INFRA, "", "", - MsoLogger.ErrorCode.SchemaError, requestJSON, e); - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, - MsoLogger.ResponseCode.SchemaError, - "Mapping of request to JSON object failed"); - msoLogger.debug(END_OF_THE_TRANSACTION - + response.getEntity()); - return response; + logger.error("{} {} {} {}", MessageEnum.APIH_REQUEST_VALIDATION_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA, + MsoLogger.ErrorCode.SchemaError.getValue(), requestJSON, e); + logger.debug(END_OF_THE_TRANSACTION + response.getEntity()); + return response; } RecipeLookupResult recipeLookupResult; @@ -850,40 +737,29 @@ public class E2EServiceInstances { //TODO Get the service template model version uuid from AAI. recipeLookupResult = getServiceInstanceOrchestrationURI(null, action); } catch (Exception e) { - msoLogger.error(MessageEnum.APIH_DB_ACCESS_EXC, - MSO_PROP_APIHANDLER_INFRA, "", "", - MsoLogger.ErrorCode.AvailabilityError, - "Exception while communciate with Catalog DB", e); - - Response response = msoRequest.buildServiceErrorResponse( + logger.error("{} {} {} {}", MessageEnum.APIH_DB_ACCESS_EXC.toString(), MSO_PROP_APIHANDLER_INFRA, + MsoLogger.ErrorCode.AvailabilityError.getValue(), "Exception while communciate with Catalog DB", e); + + Response response = msoRequest.buildServiceErrorResponse( HttpStatus.SC_NOT_FOUND, MsoException.ServiceException, "No communication to catalog DB " + e.getMessage(), ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version); msoRequest.createErrorRequestRecord(Status.FAILED, requestId, "No communication to catalog DB " + e.getMessage(), action, ModelType.service.name(), requestJSON); - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, - MsoLogger.ResponseCode.DBAccessError, - "Exception while communciate with DB"); - msoLogger.debug(END_OF_THE_TRANSACTION - + response.getEntity()); - return response; + logger.debug(END_OF_THE_TRANSACTION + response.getEntity()); + return response; } if (recipeLookupResult == null) { - msoLogger.error(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, - MSO_PROP_APIHANDLER_INFRA, "", "", - MsoLogger.ErrorCode.DataError, "No recipe found in DB"); - - Response response = msoRequest.buildServiceErrorResponse( + logger.error("{} {} {} {}", MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND.toString(), MSO_PROP_APIHANDLER_INFRA, + MsoLogger.ErrorCode.DataError.getValue(), "No recipe found in DB"); + + Response response = msoRequest.buildServiceErrorResponse( HttpStatus.SC_NOT_FOUND, MsoException.ServiceException, "Recipe does not exist in catalog DB", ErrorNumbers.SVC_GENERAL_SERVICE_ERROR, null, version); msoRequest.createErrorRequestRecord(Status.FAILED, requestId, "No recipe found in DB", action, ModelType.service.name(), requestJSON); - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, - MsoLogger.ResponseCode.DataNotFound, - "No recipe found in DB"); - msoLogger.debug(END_OF_THE_TRANSACTION - + response.getEntity()); - return response; + logger.debug(END_OF_THE_TRANSACTION + response.getEntity()); + return response; } RequestClient requestClient; @@ -894,15 +770,13 @@ public class E2EServiceInstances { requestClient = requestClientFactory.getRequestClient(recipeLookupResult.getOrchestrationURI()); JSONObject jjo = new JSONObject(requestJSON); - jjo.put("operationId", UUIDChecker.generateUUID(msoLogger)); + jjo.put("operationId", requestId); String bpmnRequest = jjo.toString(); // Capture audit event - msoLogger - .debug("MSO API Handler Posting call to BPEL engine for url: " - + requestClient.getUrl()); - String serviceId = instanceIdMap.get("serviceId"); + logger.debug("MSO API Handler Posting call to BPEL engine for url: " + requestClient.getUrl()); + String serviceId = instanceIdMap.get("serviceId"); String serviceInstanceType = e2eScaleReq.getService().getServiceType(); RequestClientParameter postParam = new RequestClientParameter.Builder() .setRequestId(requestId) @@ -916,32 +790,16 @@ public class E2EServiceInstances { .setALaCarte(false) .setRecipeParamXsd(recipeLookupResult.getRecipeParamXsd()).build(); response = requestClient.post(postParam); - - msoLogger.recordMetricEvent(subStartTime, - MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, - "Successfully received response from BPMN engine", "BPMN", - recipeLookupResult.getOrchestrationURI(), null); - } catch (Exception e) { - msoLogger.recordMetricEvent(subStartTime, - MsoLogger.StatusCode.ERROR, - MsoLogger.ResponseCode.CommunicationError, - "Exception while communicate with BPMN engine", "BPMN", - recipeLookupResult.getOrchestrationURI(), null); + } catch (Exception e) { Response resp = msoRequest.buildServiceErrorResponse( HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException, "Failed calling bpmn " + e.getMessage(), ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version); - - msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, - MSO_PROP_APIHANDLER_INFRA, "", "", - MsoLogger.ErrorCode.AvailabilityError, - "Exception while communicate with BPMN engine",e); - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, - MsoLogger.ResponseCode.CommunicationError, - "Exception while communicate with BPMN engine"); - msoLogger.debug(END_OF_THE_TRANSACTION - + resp.getEntity()); - return resp; + + logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA, + MsoLogger.ErrorCode.AvailabilityError.getValue(), "Exception while communicate with BPMN engine", e); + logger.debug(END_OF_THE_TRANSACTION + resp.getEntity()); + return resp; } if (response == null) { @@ -949,15 +807,10 @@ public class E2EServiceInstances { HttpStatus.SC_BAD_GATEWAY, MsoException.ServiceException, "bpelResponse is null", ErrorNumbers.SVC_NO_SERVER_RESOURCES, null, version); - msoLogger.error(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, - MSO_PROP_APIHANDLER_INFRA, "", "", - MsoLogger.ErrorCode.BusinessProcesssError, - "Null response from BPEL"); - msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, - MsoLogger.ResponseCode.InternalError, - "Null response from BPMN"); - msoLogger.debug(END_OF_THE_TRANSACTION + resp.getEntity()); - return resp; + logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_COMMUNICATE_ERROR.toString(), MSO_PROP_APIHANDLER_INFRA, + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Null response from BPEL"); + logger.debug(END_OF_THE_TRANSACTION + resp.getEntity()); + return resp; } ResponseHandler respHandler = new ResponseHandler(response, @@ -978,11 +831,8 @@ public class E2EServiceInstances { // BPMN accepted the request, the request is in progress if (bpelStatus == HttpStatus.SC_ACCEPTED) { String camundaJSONResponseBody = respHandler.getResponseBody(); - msoLogger.debug("Received from Camunda: " + camundaJSONResponseBody); - msoLogger.recordAuditEvent(startTime, - MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, - "BPMN accepted the request, the request is in progress"); - msoLogger.debug(END_OF_THE_TRANSACTION + camundaJSONResponseBody); + logger.debug("Received from Camunda: " + camundaJSONResponseBody); + logger.debug(END_OF_THE_TRANSACTION + camundaJSONResponseBody); return builder.buildResponse(HttpStatus.SC_ACCEPTED, null, camundaJSONResponseBody, apiVersion); } else { List<String> variables = new ArrayList<>(); @@ -995,17 +845,10 @@ public class E2EServiceInstances { "Request Failed due to BPEL error with HTTP Status= %1 " + '\n' + camundaJSONResponseBody, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, variables, version); - msoLogger.error(MessageEnum.APIH_BPEL_RESPONSE_ERROR, - requestClient.getUrl(), "", "", - MsoLogger.ErrorCode.BusinessProcesssError, - "Response from BPEL engine is failed with HTTP Status=" - + bpelStatus); - msoLogger.recordAuditEvent(startTime, - MsoLogger.StatusCode.ERROR, - MsoLogger.ResponseCode.InternalError, - "Response from BPMN engine is failed"); - msoLogger.debug(END_OF_THE_TRANSACTION - + resp.getEntity()); + logger.error("{} {} {} {}", MessageEnum.APIH_BPEL_RESPONSE_ERROR.toString(), requestClient.getUrl(), + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), + "Response from BPEL engine is failed with HTTP Status=" + bpelStatus); + logger.debug(END_OF_THE_TRANSACTION + resp.getEntity()); return resp; } else { Response resp = msoRequest @@ -1015,16 +858,10 @@ public class E2EServiceInstances { "Request Failed due to BPEL error with HTTP Status= %1", ErrorNumbers.SVC_DETAILED_SERVICE_ERROR, variables, version); - msoLogger.error(MessageEnum.APIH_BPEL_RESPONSE_ERROR, - requestClient.getUrl(), "", "", - MsoLogger.ErrorCode.BusinessProcesssError, - "Response from BPEL engine is empty"); - msoLogger.recordAuditEvent(startTime, - MsoLogger.StatusCode.ERROR, - MsoLogger.ResponseCode.InternalError, + logger.error("", MessageEnum.APIH_BPEL_RESPONSE_ERROR.toString(), requestClient.getUrl(), + MsoLogger.ErrorCode.BusinessProcesssError.getValue(), "Response from BPEL engine is empty"); - msoLogger.debug(END_OF_THE_TRANSACTION - + resp.getEntity()); + logger.debug(END_OF_THE_TRANSACTION + resp.getEntity()); return resp; } } @@ -1042,12 +879,11 @@ public class E2EServiceInstances { RecipeLookupResult recipeLookupResult = getServiceURI(serviceModelUUID, action); if (recipeLookupResult != null) { - msoLogger.debug("Orchestration URI is: " - + recipeLookupResult.getOrchestrationURI() - + ", recipe Timeout is: " - + Integer.toString(recipeLookupResult.getRecipeTimeout())); + logger.debug( + "Orchestration URI is: " + recipeLookupResult.getOrchestrationURI() + ", recipe Timeout is: " + Integer + .toString(recipeLookupResult.getRecipeTimeout())); } else { - msoLogger.debug("No matching recipe record found"); + logger.debug("No matching recipe record found"); } return recipeLookupResult; } @@ -1204,9 +1040,7 @@ public class E2EServiceInstances { try { returnString = mapper.writeValueAsString(sir); } catch (IOException e) { - msoLogger - .debug("Exception while converting ServiceInstancesRequest object to string", - e); + logger.debug("Exception while converting ServiceInstancesRequest object to string", e); } return returnString; |