summaryrefslogtreecommitdiffstats
path: root/bpmn/MSOCommonBPMN
diff options
context:
space:
mode:
authorWitold Ficio Kopel <w.kopel@samsung.com>2019-03-12 17:12:00 +0100
committerWitold Ficio Kopel <w.kopel@samsung.com>2019-03-13 13:39:00 +0100
commit22673d5b7929ddb7936a0ccdfda111b17e6dc1b8 (patch)
treea727a68f35fd38b5051221ba9b6a9c89546c6b5f /bpmn/MSOCommonBPMN
parent22c74e97c4d75249c7b15b4ba8862c6a4efdb84a (diff)
Remove MsoLogger from MSOCommonBPMN scripts
Modifications of groovy scripts in MSOCommonBPMN removing following: Replaced MsoLogger with plain slf4j. Refactored loging output. Fixed imports. Replaced utils.log() with respective logger calls (except for AbstractServiceTaskProcessor class). Modifications to MsoUtils class. Change-Id: I6bdd8ab6f60dca9b765fcf7d56f5aaa707c028cc Issue-ID: LOG-631 Signed-off-by: Witold Ficio Kopel <w.kopel@samsung.com>
Diffstat (limited to 'bpmn/MSOCommonBPMN')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy28
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy14
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy64
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AppCClient.groovy36
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy76
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy76
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy24
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy50
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy110
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy65
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DecomposeService.groovy39
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy69
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy78
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy39
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.groovy170
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy50
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericNotificationService.groovy8
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ManualHandling.groovy124
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy36
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy111
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy60
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy62
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/RainyDayHandler.groovy61
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ReceiveWorkflowMessage.groovy44
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy88
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy91
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy81
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy97
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.groovy46
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroUtils.groovy28
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtil.groovy136
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy61
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModule.groovy42
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModule.groovy10
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy42
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VidUtils.groovy28
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy96
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterUtils.groovy18
38 files changed, 1308 insertions, 1050 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy
index 8a8e41247c..b9053b75da 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.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
@@ -38,12 +40,14 @@ import org.onap.so.client.aai.AAIVersion
import org.onap.so.client.aai.entities.uri.AAIUri
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import org.onap.so.openpojo.rules.HasToStringRule
import org.onap.so.utils.TargetEntity
@Deprecated
class AaiUtil {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AaiUtil.class);
+ private static final Logger logger = LoggerFactory.getLogger( AaiUtil.class);
public MsoUtils utils = new MsoUtils()
@@ -101,14 +105,14 @@ class AaiUtil {
String returnCode = apiResponse.getStatus()
String aaiResponseAsString = apiResponse.readEntity(String.class)
- msoLogger.debug("Call AAI Cloud Region Return code: " + returnCode)
+ logger.debug("Call AAI Cloud Region Return code: " + returnCode)
execution.setVariable(execution.getVariable("prefix")+"queryCloudRegionReturnCode", returnCode)
if(returnCode == "200"){
- msoLogger.debug("Call AAI Cloud Region is Successful.")
+ logger.debug("Call AAI Cloud Region is Successful.")
String regionVersion = taskProcessor.utils.getNodeText(aaiResponseAsString, "cloud-region-version")
- msoLogger.debug("Cloud Region Version from AAI for " + backend + " is: " + regionVersion)
+ logger.debug("Cloud Region Version from AAI for " + backend + " is: " + regionVersion)
if (backend == "PO") {
regionId = taskProcessor.utils.getNodeText(aaiResponseAsString, "cloud-region-id")
} else { // backend not "PO"
@@ -121,20 +125,24 @@ class AaiUtil {
if(regionId == null){
throw new BpmnError("MSOWorkflowException")
}
- msoLogger.debug("Cloud Region Id from AAI " + backend + " is: " + regionId)
+ logger.debug("Cloud Region Id from AAI " + backend + " is: " + regionId)
}else if (returnCode == "404"){ // not 200
if (backend == "PO") {
regionId = inputCloudRegion
}else{ // backend not "PO"
regionId = "AAIAIC25"
}
- msoLogger.debug("Cloud Region value for code='404' of " + backend + " is: " + regionId)
+ logger.debug("Cloud Region value for code='404' of " + backend + " is: " + regionId)
}else{
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Call AAI Cloud Region is NOT Successful.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Call AAI Cloud Region is NOT Successful.", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue());
throw new BpmnError("MSOWorkflowException")
}
}catch(Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception occured while getting the Cloud Reqion.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.getMessage());
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception occured while getting the Cloud Reqion.", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), e.getMessage());
(new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage())
}
return regionId
@@ -157,7 +165,7 @@ class AaiUtil {
if (aaiVnfResponse != null) {
String vfModulesText = taskProcessor.utils.getNodeXml(aaiVnfResponse, "vf-modules")
if (aaiVnfResponse.getVfModules() == null || aaiVnfResponse.getVfModules().getVfModule().isEmpty()) {
- msoLogger.debug("There are no VF modules in this VNF yet")
+ logger.debug("There are no VF modules in this VNF yet")
return 0
}
else {
@@ -176,7 +184,7 @@ class AaiUtil {
}
}
matchingVfModules = matchingVfModules + "</vfModules>"
- msoLogger.debug("Matching VF Modules: " + matchingVfModules)
+ logger.debug("Matching VF Modules: " + matchingVfModules)
String lowestUnusedIndex = taskProcessor.utils.getLowestUnusedIndex(matchingVfModules)
return Integer.parseInt(lowestUnusedIndex)
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy
index 57af763ed5..c700fa70e1 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy
@@ -387,7 +387,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
/**
* Returns the process definition key (i.e. the process name) of the
* current process.
- *
+ *
* @param execution the execution
*/
public String getProcessKey(DelegateExecution execution) {
@@ -718,19 +718,19 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
'/' + UriUtils.encodePathSegment(messageType, 'UTF-8') +
'/' + UriUtils.encodePathSegment(correlator, 'UTF-8')
}
-
+
public void setRollbackEnabled(DelegateExecution execution, isDebugLogEnabled) {
-
+
// Rollback settings
def prefix = execution.getVariable('prefix')
def disableRollback = execution.getVariable("disableRollback")
def defaultRollback = UrnPropertiesReader.getVariable("mso.rollback", execution).toBoolean()
-
+
logDebug('disableRollback: ' + disableRollback, isDebugLogEnabled)
logDebug('defaultRollback: ' + defaultRollback, isDebugLogEnabled)
-
+
def rollbackEnabled
-
+
if(disableRollback == null || disableRollback == '' ) {
// get from default urn settings for mso_rollback
disableRollback = !defaultRollback
@@ -752,7 +752,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
execution.setVariable(prefix+"backoutOnFailure", rollbackEnabled)
logDebug('rollbackEnabled (aka backoutOnFailure): ' + rollbackEnabled, isDebugLogEnabled)
}
-
+
public void setBasicDBAuthHeader(DelegateExecution execution, isDebugLogEnabled) {
try {
String basicAuthValueDB = UrnPropertiesReader.getVariable("mso.adapters.db.auth", execution)
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy
index a43a2b1f89..d0967cc327 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AllottedResourceUtils.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,11 +41,13 @@ 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
class AllottedResourceUtils {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AllottedResourceUtils.class);
+ private static final Logger logger = LoggerFactory.getLogger( AllottedResourceUtils.class);
private AbstractServiceTaskProcessor taskProcessor
@@ -65,7 +69,7 @@ class AllottedResourceUtils {
*/
public String getAROrchStatus (DelegateExecution execution) {
- msoLogger.trace("getAROrchStatus ")
+ logger.trace("getAROrchStatus ")
String msg = ""
String serviceInstanceId = execution.getVariable("serviceInstanceId")
String arType = execution.getVariable("allottedResourceType")
@@ -73,7 +77,7 @@ class AllottedResourceUtils {
String siXml = execution.getVariable("CSI_service")
String orchStatus = null
XmlParser xmlParser = new XmlParser()
- msoLogger.debug("getAROrchStatus siXml:" + siXml)
+ logger.debug("getAROrchStatus siXml:" + siXml)
try {
if (!isBlank(siXml)) {
def groovy.util.Node siNode = xmlParser.parseText(siXml)
@@ -83,7 +87,7 @@ class AllottedResourceUtils {
for (groovy.util.Node relationship in relationships) {
def groovy.util.Node relatedTo = utils.getChildNode(relationship, 'related-to')
if ((relatedTo != null) && (relatedTo.text().equals('allotted-resource'))) {
- msoLogger.debug("getARORchStatus AR found")
+ logger.debug("getARORchStatus AR found")
def groovy.util.Node relatedLink = utils.getChildNode(relationship, 'related-link')
if (relatedLink != null){
Optional<AllottedResource> ar = getARbyLink(execution, relatedLink.text(), arRole)
@@ -97,10 +101,10 @@ class AllottedResourceUtils {
}
}
}catch(Exception e){
- msoLogger.debug(" Error encountered in getAROrchStatus" + e.getMessage())
+ logger.debug(" Error encountered in getAROrchStatus" + e.getMessage())
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error in getAROrchStatus" + e.getMessage())
}
- msoLogger.trace(" Exit getAROrchStatus - OrchStatus:" + orchStatus)
+ logger.trace(" Exit getAROrchStatus - OrchStatus:" + orchStatus)
return orchStatus
}
@@ -108,7 +112,7 @@ class AllottedResourceUtils {
// used on Delete - called from doDeleteAR
// setsVariable aaiARGetResponse
public boolean ifExistsAR(DelegateExecution execution, String allottedResourceId) {
- msoLogger.trace("ifExistsAR ")
+ logger.trace("ifExistsAR ")
try {
AAIResourceUri resourceUri = AAIUriFactory.createResourceUri(AAIObjectType.ALLOTTED_RESOURCE, allottedResourceId)
AAIResultWrapper wrapper = getAAIClient().get(resourceUri)
@@ -127,24 +131,24 @@ class AllottedResourceUtils {
public String getPSIFmARLink(DelegateExecution execution, String arLink)
{
// Path: /aai/{version}/business/customers/customer/{cust}/service-subscriptions/service-subscription/{subs}/service-instances/service-instance/{psiid}/allotted-resources/allotted-resource/{arid}
- msoLogger.trace(" getPSIFmARLink - path:" + arLink)
+ logger.trace(" getPSIFmARLink - path:" + arLink)
String[] split = arLink.split("/service-instance/")
String[] splitB = split[1].split("/allotted-resources/")
String siId = splitB[0]
- msoLogger.trace(" Exit getPSIFmARLink - parentServiceInstanceId:" + siId )
+ logger.trace(" Exit getPSIFmARLink - parentServiceInstanceId:" + siId )
return siId
}
-
+
// get Allotted resource using Link
// used on Create called from getARORchStatus
// used on Delete called from ifExistsAR
// setsVariable aaiARPath - used for Patch in create
-
+
public Optional<AllottedResource> getARbyLink (DelegateExecution execution, String link, String role) {
- msoLogger.trace("getARbyLink ")
+ logger.trace("getARbyLink ")
Optional<AllottedResource> allottedResource = Optional.empty()
try {
- msoLogger.debug("GET AR Aai Path is: \n" + link)
+ logger.debug("GET AR Aai Path is: \n" + link)
AAIResourceUri uri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.ALLOTTED_RESOURCE, UriBuilder.fromPath(link).build())
allottedResource = getAAIClient().get(AllottedResource.class,uri);
if(allottedResource.isPresent()) {
@@ -152,16 +156,16 @@ class AllottedResourceUtils {
if (role == allottedResource.get().getRole()) {
setExecutionVariables(execution,allottedResource.get(),uri)
} else {
- msoLogger.debug("AAI AR does not match input role:" + role)
+ logger.debug("AAI AR does not match input role:" + role)
}
} else {
setExecutionVariables(execution,allottedResource.get(),uri)
}
}else{
- msoLogger.debug("GET AR received a Not Found (404) Response")
+ logger.debug("GET AR received a Not Found (404) Response")
}
}catch(Exception e){
- msoLogger.debug(" Error encountered within GetAaiAR" + e.getMessage())
+ logger.debug(" Error encountered within GetAaiAR" + e.getMessage())
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error in GetAaiAR" + e.getMessage())
}
return allottedResource
@@ -181,45 +185,47 @@ class AllottedResourceUtils {
}
public void updateAROrchStatus(DelegateExecution execution, String status, String aaiARPath){
- msoLogger.trace("updaAROrchStatus ")
+ logger.trace("updaAROrchStatus ")
try{
AllottedResource allottedResource = new AllottedResource();
allottedResource.setOrchestrationStatus(status)
- msoLogger.debug('AAI AR URI: ' + aaiARPath)
+ logger.debug('AAI AR URI: ' + aaiARPath)
AAIResourceUri uri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.ALLOTTED_RESOURCE, UriBuilder.fromPath(aaiARPath).build())
getAAIClient().update(uri,allottedResource)
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in updateAR.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.getMessage());
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception in updateAR.", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), e.getMessage());
exceptionUtil.buildAndThrowWorkflowException(execution, 500, 'Internal Error in updateAROrchStatus.' + e.getMessage())
}
- msoLogger.trace("Exit updateAROrchStatus ")
+ logger.trace("Exit updateAROrchStatus ")
}
//Sets Variable "wasDeleted"
public void deleteAR(DelegateExecution execution, String aaiARPath){
- msoLogger.trace(" deleteAR - aaiARPath:" + aaiARPath)
+ logger.trace(" deleteAR - aaiARPath:" + aaiARPath)
try {
AAIResourceUri uri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.ALLOTTED_RESOURCE, UriBuilder.fromPath(aaiARPath).build())
getAAIClient().delete(uri);
}catch(NotFoundException ex){
- msoLogger.debug(" Delete AR Received a Not Found (404) Response")
+ logger.debug(" Delete AR Received a Not Found (404) Response")
}catch(PreconditionFailedException ex){
- msoLogger.debug("Delete AR Received a Resource Version Mismatch Error: \n")
+ logger.debug("Delete AR Received a Resource Version Mismatch Error: \n")
exceptionUtil.buildAndThrowWorkflowException(execution, 412, "DeleteAR Received a resource-version Mismatch Error Response from AAI")
}catch(Exception e){
- msoLogger.debug(" Error encountered in deleteAR!" + e)
+ logger.debug(" Error encountered in deleteAR!" + e)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During Delete AR")
}
- msoLogger.debug(" Delete AR Received a Good Response")
+ logger.debug(" Delete AR Received a Good Response")
execution.setVariable("wasDeleted", "true")
- msoLogger.trace("Exit deleteAR ")
+ logger.trace("Exit deleteAR ")
}
public void buildAAIErrorResponse(DelegateExecution execution, String response, String errorMessage){
- msoLogger.trace("BuildAAIErrorResponse")
+ logger.trace("BuildAAIErrorResponse")
if((response != null) && (response.contains("Fault") || response.contains("RESTFault"))){
WorkflowException workflowException = exceptionUtil.MapAAIExceptionToWorkflowException(response, execution)
@@ -228,10 +234,10 @@ class AllottedResourceUtils {
exceptionUtil.buildWorkflowException(execution, 500, errorMessage)
}
- msoLogger.trace("Exit BuildAAIErrorResponse Process")
+ logger.trace("Exit BuildAAIErrorResponse Process")
throw new BpmnError("MSOWorkflowException")
}
-
+
public AAIResourcesClient getAAIClient(){
return new AAIResourcesClient()
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AppCClient.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AppCClient.groovy
index 5cbbe0ab46..7beb24f692 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AppCClient.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AppCClient.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
@@ -27,6 +29,8 @@ import org.onap.appc.client.lcm.model.Action
import org.onap.so.client.appc.ApplicationControllerAction;
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>AppCClient.bpmn</class> process.
@@ -49,22 +53,22 @@ import org.onap.so.logger.MsoLogger
*/
public class AppCClient extends AbstractServiceTaskProcessor{
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AppCClient.class);
+ private static final Logger logger = LoggerFactory.getLogger( AppCClient.class);
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtils = new JsonUtils()
def prefix = "UPDVnfI_"
-
+
public void preProcessRequest(DelegateExecution execution){
}
-
+
public void runAppcCommand(DelegateExecution execution) {
- msoLogger.trace("Start runCommand ")
+ logger.trace("Start runCommand ")
def method = getClass().getSimpleName() + '.runAppcCommand(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
execution.setVariable("rollbackVnfStop", false)
execution.setVariable("rollbackVnfLock", false)
execution.setVariable("rollbackQuiesceTraffic", false)
@@ -83,7 +87,7 @@ public class AppCClient extends AbstractServiceTaskProcessor{
String vserverIdList = execution.getVariable("vserverIdList")
String identityUrl = execution.getVariable("identityUrl")
String controllerType = execution.getVariable("controllerType")
- String vfModuleId = execution.getVariable("vfModuleId")
+ String vfModuleId = execution.getVariable("vfModuleId")
HashMap<String, String> payloadInfo = new HashMap<String, String>();
payloadInfo.put("vnfName", vnfName)
payloadInfo.put("aicIdentity", aicIdentity)
@@ -93,8 +97,8 @@ public class AppCClient extends AbstractServiceTaskProcessor{
payloadInfo.put("identityUrl", identityUrl)
payloadInfo.put("vfModuleId",vfModuleId)
Optional<String> payload
- msoLogger.debug("Running APP-C action: " + action.toString())
- msoLogger.debug("VNFID: " + vnfId)
+ logger.debug("Running APP-C action: " + action.toString())
+ logger.debug("VNFID: " + vnfId)
execution.setVariable('msoRequestId', msoRequestId)
execution.setVariable("failedActivity", "APP-C")
execution.setVariable('workStep', action.toString())
@@ -108,17 +112,19 @@ public class AppCClient extends AbstractServiceTaskProcessor{
execution.setVariable('healthCheckIndex', healthCheckIndex + 1)
}
ApplicationControllerAction client = new ApplicationControllerAction()
- msoLogger.debug("Created Application Controller Action Object")
+ logger.debug("Created Application Controller Action Object")
//PayloadInfo contains extra information that adds on to payload before making request to appc
client.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo, controllerType)
- msoLogger.debug("ran through the main method for Application Contoller")
+ logger.debug("ran through the main method for Application Contoller")
appcCode = client.getErrorCode()
appcMessage = client.getErrorMessage()
}
catch (BpmnError 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);
appcMessage = e.getMessage()
- }
+ }
execution.setVariable("errorCode", appcCode)
if (appcCode == '0' && action != null) {
if (action.equals(Action.Lock)) {
@@ -142,8 +148,8 @@ public class AppCClient extends AbstractServiceTaskProcessor{
}
execution.setVariable("errorText", appcMessage)
execution.setVariable("responsePayload", responsePayload)
- msoLogger.debug("Error Message: " + appcMessage)
- msoLogger.debug("ERROR CODE: " + execution.getVariable("errorCode"))
- msoLogger.trace("End of runCommand ")
+ logger.debug("Error Message: " + appcMessage)
+ logger.debug("ERROR CODE: " + execution.getVariable("errorCode"))
+ logger.trace("End of runCommand ")
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy
index df0dfaee60..7511a855a4 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.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.client.HttpClient
import org.onap.so.client.HttpClientFactory
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import org.onap.so.utils.TargetEntity
import org.springframework.web.util.UriUtils
@@ -43,7 +47,7 @@ import javax.ws.rs.core.Response
*/
class CatalogDbUtils {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CatalogDbUtils.class);
+ private static final Logger logger = LoggerFactory.getLogger( CatalogDbUtils.class);
private HttpClientFactory httpClientFactory
private MsoUtils msoUtils
@@ -60,7 +64,7 @@ class CatalogDbUtils {
JSONArray vnfsList = null
String endPoint = "/serviceVnfs?vnfModelCustomizationUuid=" + UriUtils.encode(vnfModelCustomizationUuid, "UTF-8")
try {
- msoLogger.debug("ENDPOINT: " + endPoint)
+ logger.debug("ENDPOINT: " + endPoint)
String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
if (catalogDbResponse != null) {
@@ -75,7 +79,9 @@ class CatalogDbUtils {
}
catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), e.message);
throw e
}
@@ -111,7 +117,9 @@ class CatalogDbUtils {
return getResponseFromCatalogDb(execution, endPoint)
}
catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), e.message);
throw e
}
}
@@ -133,7 +141,9 @@ class CatalogDbUtils {
}
catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), e.message);
throw e
}
@@ -157,7 +167,9 @@ class CatalogDbUtils {
}
catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception in Querying Catalog DB", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), e.message);
throw e
}
@@ -167,7 +179,7 @@ class CatalogDbUtils {
private JSONArray parseNetworksJson (String catalogDbResponse, String arrayName, String catalogUtilsVersion) {
JSONArray modelInfos = null
- msoLogger.debug("parseNetworksJson - catalogUtilsVersion is " + catalogUtilsVersion)
+ logger.debug("parseNetworksJson - catalogUtilsVersion is " + catalogUtilsVersion)
try {
// Create array of jsons
@@ -202,10 +214,12 @@ class CatalogDbUtils {
}
String modelInfosString = modelInfos.toString()
- msoLogger.debug("Returning networks JSON: " + modelInfosString)
+ logger.debug("Returning networks JSON: " + modelInfosString)
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in parsing Catalog DB Response", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception in parsing Catalog DB Response", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), e.message);
}
return modelInfos
@@ -214,7 +228,7 @@ class CatalogDbUtils {
private JSONArray parseVnfsJson (String catalogDbResponse, String arrayName, String catalogUtilsVersion) {
JSONArray modelInfos = null
- msoLogger.debug("parseVnfsJson - catalogUtilsVersion is " + catalogUtilsVersion)
+ logger.debug("parseVnfsJson - catalogUtilsVersion is " + catalogUtilsVersion)
try {
// Create array of jsons
@@ -226,7 +240,7 @@ class CatalogDbUtils {
for (int i = 0; i < vnfs.length(); i++) {
JSONObject vnf = vnfs.getJSONObject(i)
- msoLogger.debug(vnf.toString(2))
+ logger.debug(vnf.toString(2))
JSONObject modelInfo = buildModelInfo("vnf", vnf, catalogUtilsVersion)
JSONObject modelJson = new JSONObject()
modelJson.put("modelInfo", modelInfo)
@@ -254,7 +268,7 @@ class CatalogDbUtils {
vfModules = vnf.getJSONArray("vfModules")
} catch (Exception e)
{
- msoLogger.debug("Cannot find VF MODULE ARRAY: " + i + ", exception is " + e.message)
+ logger.debug("Cannot find VF MODULE ARRAY: " + i + ", exception is " + e.message)
}
if (vfModules != null) {
@@ -279,10 +293,12 @@ class CatalogDbUtils {
}
String modelInfosString = modelInfos.toString()
- msoLogger.debug("Returning vnfs JSON: " + modelInfosString)
+ logger.debug("Returning vnfs JSON: " + modelInfosString)
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in parsing Catalog DB Response", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception in parsing Catalog DB Response", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), e.message);
}
return modelInfos
@@ -291,7 +307,7 @@ class CatalogDbUtils {
private JSONArray parseAllottedResourcesJson (String catalogDbResponse, String arrayName, String catalogUtilsVersion) {
JSONArray modelInfos = null
- msoLogger.debug("parseAllottedResourcesJson - catalogUtilsVersion is " + catalogUtilsVersion)
+ logger.debug("parseAllottedResourcesJson - catalogUtilsVersion is " + catalogUtilsVersion)
try {
// Create array of jsons
@@ -331,10 +347,12 @@ class CatalogDbUtils {
}
String modelInfosString = modelInfos.toString()
- msoLogger.debug("Returning allottedResources JSON: " + modelInfosString)
+ logger.debug("Returning allottedResources JSON: " + modelInfosString)
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in parsing Catalog DB Response", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception in parsing Catalog DB Response", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), e.message);
}
return modelInfos
@@ -358,10 +376,12 @@ class CatalogDbUtils {
JSONArray allottedResourcesArray = parseAllottedResourcesJson(serviceResourcesRoot.toString(), "serviceAllottedResources", catalogUtilsVersion)
serviceResources.put("serviceAllottedResources", allottedResourcesArray)
serviceResourcesObject.put("serviceResources", serviceResources)
- msoLogger.debug("Returning serviceResources JSON: " + serviceResourcesObject.toString())
+ logger.debug("Returning serviceResources JSON: " + serviceResourcesObject.toString())
} catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception in parsing Catalog DB Response", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception in parsing Catalog DB Response", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), e.message);
}
return serviceResourcesObject
@@ -407,7 +427,9 @@ class CatalogDbUtils {
modelJson.put("modelInfo", modelInfo)
}
catch (Exception e) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception while parsing model information", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.message);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception while parsing model information", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), e.message);
}
return modelInfo
}
@@ -425,16 +447,16 @@ class CatalogDbUtils {
String basicAuthCred = execution.getVariable("BasicAuthHeaderValueDB")
client.addAdditionalHeader("Authorization", StringUtils.defaultIfEmpty(basicAuthCred, getBasicDBAuthHeader(execution)))
- msoLogger.debug('sending GET to Catalog DB endpoint: ' + endPoint)
+ logger.debug('sending GET to Catalog DB endpoint: ' + endPoint)
Response response = client.get()
responseData = response.readEntity(String.class)
if (responseData != null) {
- msoLogger.debug("Received data from Catalog DB: " + responseData)
+ logger.debug("Received data from Catalog DB: " + responseData)
}
- msoLogger.debug('Response code:' + response.getStatus())
- msoLogger.debug('Response:' + System.lineSeparator() + responseData)
+ logger.debug('Response code:' + response.getStatus())
+ logger.debug('Response:' + System.lineSeparator() + responseData)
if (response.getStatus() == 200) {
// parse response as needed
return responseData
@@ -444,7 +466,7 @@ class CatalogDbUtils {
}
}
catch (Exception e) {
- msoLogger.debug("ERROR WHILE QUERYING CATALOG DB: " + e.message)
+ logger.debug("ERROR WHILE QUERYING CATALOG DB: " + e.message)
throw e
}
@@ -457,7 +479,7 @@ class CatalogDbUtils {
String endPoint = "/resourceRecipe?resourceModelUuid=" + UriUtils.encode(resourceModelUuid, "UTF-8")+ "&action=" + UriUtils.encode(action, "UTF-8")
JSONObject responseJson = null
try {
- msoLogger.debug("ENDPOINT: " + endPoint)
+ logger.debug("ENDPOINT: " + endPoint)
String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
if (catalogDbResponse != null) {
@@ -488,4 +510,4 @@ class CatalogDbUtils {
return encodedString
}
-} \ No newline at end of file
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy
index 865b9ee8a7..b12230009d 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CompleteMsoProcess.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
@@ -24,9 +26,11 @@ import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
public class CompleteMsoProcess extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CompleteMsoProcess.class);
+ private static final Logger logger = LoggerFactory.getLogger( CompleteMsoProcess.class);
String Prefix="CMSO_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -35,7 +39,7 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor {
public initializeProcessVariables(DelegateExecution execution){
def method = getClass().getSimpleName() + '.initializeProcessVariables(' +'execution=' + execution.getId() +')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
/* Initialize all the process request variables in this block */
@@ -70,7 +74,7 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor {
} 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)
}
@@ -80,16 +84,16 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor {
initializeProcessVariables(execution)
def method = getClass().getSimpleName() + '.preProcessRequest(' +'execution=' + execution.getId() +')'
- // msoLogger.trace("Started CompleteMsoProcess preProcessRequest Method ");
- msoLogger.trace('Entered ' + method)
-
+ // logger.trace("Started CompleteMsoProcess preProcessRequest Method ");
+ logger.trace('Entered ' + method)
+
setBasicDBAuthHeader(execution, execution.getVariable('isDebugLogEnabled'))
try {
def xml = execution.getVariable("CompleteMsoProcessRequest")
- msoLogger.debug("CompleteMsoProcess Request: " + xml)
- msoLogger.debug("Incoming Request is: "+ xml)
+ logger.debug("CompleteMsoProcess Request: " + xml)
+ logger.debug("Incoming Request is: "+ xml)
//mso-bpel-name from the incoming request
def msoBpelName = utils.getNodeText(xml,"mso-bpel-name")
@@ -142,18 +146,18 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor {
execution.setVariable("CMSO_source",utils.getNodeText(xml,"source"))
}
- msoLogger.trace("--> " + execution.getVariable(""))
- msoLogger.trace("--> " + execution.getVariable(""))
+ logger.trace("--> " + execution.getVariable(""))
+ logger.trace("--> " + execution.getVariable(""))
// set the DHV/Service Instantiation values if specified in the request
execution.setVariable("CMSO_is_srv_inst_req", String.valueOf("true".equals(utils.getNodeText(xml, "is-srv-inst-req"))))
- msoLogger.trace("--> " + execution.getVariable(""))
+ logger.trace("--> " + execution.getVariable(""))
execution.setVariable("CMSO_is_json_content", String.valueOf("JSON".equals(utils.getNodeText(xml, "resp-content-type"))))
- msoLogger.trace("--> " + execution.getVariable(""))
+ logger.trace("--> " + execution.getVariable(""))
execution.setVariable("CMSO_service_inst_id", utils.getNodeText(xml, "service-instance-id"))
- msoLogger.trace("--> " + execution.getVariable(""))
+ logger.trace("--> " + execution.getVariable(""))
execution.setVariable("CMSO_start_time", utils.getNodeText(xml, "start-time"))
- msoLogger.trace("--> " + execution.getVariable(""))
+ logger.trace("--> " + execution.getVariable(""))
// this variable is used by the camunda flow to set the Content-Type for the async response
if (execution.getVariable("CMSO_is_srv_inst_req").equals("true") &&
execution.getVariable("CMSO_is_json_content").equals("true")) {
@@ -162,11 +166,11 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor {
execution.setVariable("CMSO_content_type", "text/xml")
}
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.debug("Exception Occured During PreProcessRequest: " + e);
+ logger.debug("Exception Occured During PreProcessRequest: " + e);
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in " + method)
}
}
@@ -174,7 +178,7 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor {
public void setUpdateDBstatustoSuccessPayload (DelegateExecution execution){
def method = getClass().getSimpleName() + '.setUpdateDBstatustoSuccessPayload(' +'execution=' + execution.getId() +')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
@@ -207,7 +211,7 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor {
}
idXml = utils.removeXmlPreamble(idXml)
idXml = utils.removeXmlNamespaces(idXml)
- msoLogger.debug("Incoming Instance Id Xml: " + idXml)
+ logger.debug("Incoming Instance Id Xml: " + idXml)
String payload = """
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.onap.so/requestsdb">
@@ -225,22 +229,24 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor {
</soapenv:Envelope>"""
execution.setVariable("CMSO_setUpdateDBstatustoSuccessPayload", payload)
- msoLogger.debug("Outgoing Update Mso Request Payload is: " + payload)
- msoLogger.debug("setUpdateDBstatustoSuccessPayload: " + payload)
+ logger.debug("Outgoing Update Mso Request Payload is: " + payload)
+ logger.debug("setUpdateDBstatustoSuccessPayload: " + payload)
} 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)
}
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
}
public void buildDataError (DelegateExecution execution, String message) {
def method = getClass().getSimpleName() + '.buildDataError(' +'execution=' + execution.getId() +')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
String msoCompletionResponse = """
@@ -252,17 +258,19 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor {
// Format Response
def xmlMsoCompletionResponse = utils.formatXml(msoCompletionResponse)
String buildMsoCompletionResponseAsString = xmlMsoCompletionResponse.drop(38).trim()
- msoLogger.debug("CompleteMsoProcess Response: " + buildMsoCompletionResponseAsString)
+ logger.debug("CompleteMsoProcess Response: " + buildMsoCompletionResponseAsString)
execution.setVariable("CompleteMsoProcessResponse", buildMsoCompletionResponseAsString)
- msoLogger.debug("@@ CompleteMsoProcess Response @@ " + "\n" + execution.getVariable("CompletionHandlerResponse"))
+ logger.debug("@@ CompleteMsoProcess Response @@ " + "\n" + execution.getVariable("CompletionHandlerResponse"))
exceptionUtil.buildAndThrowWorkflowException(execution, 500, message)
} catch (BpmnError e) {
- msoLogger.debug("Rethrowing MSOWorkflowException")
+ logger.debug("Rethrowing MSOWorkflowException")
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)
}
@@ -271,8 +279,8 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor {
public void postProcessResponse (DelegateExecution execution) {
def method = getClass().getSimpleName() + '.postProcessResponse(' +'execution=' + execution.getId() +')'
- msoLogger.trace('Entered ' + method)
- // msoLogger.trace("Started CompleteMsoProcess PostProcessRequest Method ");
+ logger.trace('Entered ' + method)
+ // logger.trace("Started CompleteMsoProcess PostProcessRequest Method ");
try {
String msoCompletionResponse = """
@@ -286,19 +294,21 @@ public class CompleteMsoProcess extends AbstractServiceTaskProcessor {
String buildMsoCompletionResponseAsString = xmlMsoCompletionResponse.drop(38).trim()
// TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead
execution.setVariable("WorkflowResponse", buildMsoCompletionResponseAsString)
- msoLogger.debug("CompleteMsoProcess Response: " + buildMsoCompletionResponseAsString)
+ logger.debug("CompleteMsoProcess Response: " + buildMsoCompletionResponseAsString)
execution.setVariable("CompleteMsoProcessResponse", buildMsoCompletionResponseAsString)
execution.setVariable("CMSO_ResponseCode", "200")
setSuccessIndicator(execution, true)
- msoLogger.debug("@@ CompleteMsoProcess Response @@ " + "\n" + execution.getVariable("CompleteMsoProcessResponse"))
+ logger.debug("@@ CompleteMsoProcess Response @@ " + "\n" + execution.getVariable("CompleteMsoProcessResponse"))
- msoLogger.trace('Exited ' + method)
+ 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)
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy
index f4e7926c8e..7d18a8b1ce 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupName.groovy
@@ -6,6 +6,8 @@
* ================================================================================
* Modifications Copyright 2018 Nokia
* ================================================================================
+ * 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
@@ -36,9 +38,11 @@ import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.constants.Defaults
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
public class ConfirmVolumeGroupName extends AbstractServiceTaskProcessor{
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ConfirmVolumeGroupName.class);
+ private static final Logger logger = LoggerFactory.getLogger( ConfirmVolumeGroupName.class);
def static final Prefix = "CVGN_"
private final ExceptionUtil exceptionUtil
@@ -92,7 +96,7 @@ public class ConfirmVolumeGroupName extends AbstractServiceTaskProcessor{
execution.setVariable("CVGN_queryVolumeGroupResponse", "Volume Group not Found!")
}
} catch (Exception ex) {
- msoLogger.debug("Exception occurred while executing AAI GET:" + ex.getMessage())
+ logger.debug("Exception occurred while executing AAI GET:" + ex.getMessage())
execution.setVariable("CVGN_queryVolumeGroupResponseCode", HttpStatus.INTERNAL_SERVER_ERROR.value())
execution.setVariable("CVGN_queryVolumeGroupResponse", "AAI GET Failed:" + ex.getMessage())
exceptionUtil.buildAndThrowWorkflowException(execution, HttpStatus.INTERNAL_SERVER_ERROR.value(), "AAI GET Failed")
@@ -104,21 +108,21 @@ public class ConfirmVolumeGroupName extends AbstractServiceTaskProcessor{
public void checkAAIQueryResult(DelegateExecution execution) {
def actualVolumeGroupName = ""
if (execution.getVariable("CVGN_queryVolumeGroupResponseCode") == HttpStatus.NOT_FOUND.value()) {
- msoLogger.debug('volumeGroupId does not exist in AAI')
+ logger.debug('volumeGroupId does not exist in AAI')
}
else if (execution.getVariable("CVGN_queryVolumeGroupResponseCode") == HttpStatus.OK.value()) {
VolumeGroup volumeGroup = execution.getVariable("CVGN_queryVolumeGroupResponse")
if (!Strings.isNullOrEmpty(volumeGroup.getVolumeGroupName())) {
actualVolumeGroupName = volumeGroup.getVolumeGroupName()
- msoLogger.debug("volumeGroupId exists in AAI")
+ logger.debug("volumeGroupId exists in AAI")
}
}
execution.setVariable("CVGN_volumeGroupNameMatches", false)
def volumeGroupName = execution.getVariable("CVGN_volumeGroupName")
if (!actualVolumeGroupName.isEmpty() && volumeGroupName.equals(actualVolumeGroupName)) {
- msoLogger.debug('Volume Group Name Matches AAI records')
+ logger.debug('Volume Group Name Matches AAI records')
execution.setVariable("CVGN_volumeGroupNameMatches", true)
}
}
@@ -126,20 +130,24 @@ public class ConfirmVolumeGroupName extends AbstractServiceTaskProcessor{
// generates a WorkflowException if the A&AI query returns a response code other than 200/404
public void handleAAIQueryFailure(DelegateExecution execution) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Error occurred attempting to query AAI, Response Code " + execution.getVariable("CVGN_queryVolumeGroupResponseCode"), "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "ErrorResponse is:\n" + execution.getVariable("CVGN_queryVolumeGroupResponse"));
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Error occurred attempting to query AAI, Response Code " + execution.getVariable("CVGN_queryVolumeGroupResponseCode"),
+ "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(),
+ "ErrorResponse is:\n" + execution.getVariable("CVGN_queryVolumeGroupResponse"));
}
// generates a WorkflowException if the volume group name does not match AAI record for this volume group
public void handleVolumeGroupNameNoMatch(DelegateExecution execution) {
def errorNotAssociated = "Error occurred - volume group id ${execution.getVariable('CVGN_volumeGroupId')} " +
"is not associated with ${execution.getVariable('CVGN_volumeGroupName')}"
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, errorNotAssociated, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), errorNotAssociated, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, errorNotAssociated)
}
// sends a successful WorkflowResponse
public void reportSuccess(DelegateExecution execution) {
- msoLogger.debug("Sending 200 back to the caller")
+ logger.debug("Sending 200 back to the caller")
def responseXML = ""
execution.setVariable("WorkflowResponse", responseXML)
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy
index 47a4612672..9c6c5cd0aa 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ConfirmVolumeGroupTenant.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.client.aai.entities.uri.AAIUriFactory
import org.onap.so.constants.Defaults
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
/**
* Vnf Module Subflow for confirming the volume group belongs
@@ -41,16 +45,16 @@ import org.onap.so.logger.MsoLogger
*
*/
class ConfirmVolumeGroupTenant extends AbstractServiceTaskProcessor{
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ConfirmVolumeGroupTenant.class);
+ private static final Logger logger = LoggerFactory.getLogger( ConfirmVolumeGroupTenant.class);
String Prefix="CVGT_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
public void preProcessRequest(DelegateExecution execution){
execution.setVariable("prefix", Prefix)
- msoLogger.trace("STARTED Confirm Volume Group Tenant Subflow ")
+ logger.trace("STARTED Confirm Volume Group Tenant Subflow ")
try{
- msoLogger.trace("Started QueryAAIForVolumeGroup Process ")
+ logger.trace("Started QueryAAIForVolumeGroup Process ")
String volumeGroupId = execution.getVariable("volumeGroupId")
String incomingGroupName = execution.getVariable("volumeGroupName")
@@ -71,46 +75,48 @@ class ConfirmVolumeGroupTenant extends AbstractServiceTaskProcessor{
}
//Determine if Tenant Ids match
if(incomingTenantId.equals(volumeGroupTenantId)){
- msoLogger.debug("Tenant Ids Match")
+ logger.debug("Tenant Ids Match")
execution.setVariable("tenantIdsMatch", true)
}else{
- msoLogger.debug("Tenant Ids DO NOT Match")
+ logger.debug("Tenant Ids DO NOT Match")
execution.setVariable("tenantIdsMatch", false)
}
//Determine if Volume Group Names match
String volumeGroupName = volumeGroup.get().getVolumeGroupName()
if(incomingGroupName == null || incomingGroupName.length() < 1){
- msoLogger.debug("Incoming Volume Group Name is NOT Provided.")
+ logger.debug("Incoming Volume Group Name is NOT Provided.")
execution.setVariable("groupNamesMatch", true)
}else{
- msoLogger.debug("Incoming Volume Group Name is: " + incomingGroupName)
+ logger.debug("Incoming Volume Group Name is: " + incomingGroupName)
if(volumeGroupName.equals(incomingGroupName)){
- msoLogger.debug("Volume Group Names Match.")
+ logger.debug("Volume Group Names Match.")
execution.setVariable("groupNamesMatch", true)
}else{
- msoLogger.debug("Volume Group Names DO NOT Match.")
+ logger.debug("Volume Group Names DO NOT Match.")
execution.setVariable("groupNamesMatch", false)
}
}
}else{
- msoLogger.debug("QueryAAIForVolumeGroup Bad REST Response!")
+ logger.debug("QueryAAIForVolumeGroup Bad REST Response!")
exceptionUtil.buildAndThrowWorkflowException(execution, 1, "Error Searching AAI for Volume Group. Received a Bad Response.")
}
}catch(BpmnError b){
throw b
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing queryAAIForVolumeGroup.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e.getMessage());
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing queryAAIForVolumeGroup.", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), e.getMessage());
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured in preProcessRequest.")
}
- msoLogger.trace("COMPLETED queryAAIForVolumeGroup Process ")
+ logger.trace("COMPLETED queryAAIForVolumeGroup Process ")
}
public void assignVolumeHeatId(DelegateExecution execution){
execution.setVariable("prefix", Prefix)
try{
- msoLogger.trace("Started assignVolumeHeatId Process ")
+ logger.trace("Started assignVolumeHeatId Process ")
VolumeGroup volumeGroup = execution.getVariable("queryAAIVolumeGroupResponse")
String heatStackId = volumeGroup.getHeatStackId()
@@ -118,20 +124,22 @@ class ConfirmVolumeGroupTenant extends AbstractServiceTaskProcessor{
execution.setVariable("ConfirmVolumeGroupTenantResponse", heatStackId)
// TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead
execution.setVariable("WorkflowResponse", heatStackId)
- msoLogger.debug("Volume Heat Stack Id is: " + heatStackId)
+ logger.debug("Volume Heat Stack Id is: " + heatStackId)
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing assignVolumeHeatId.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing assignVolumeHeatId.", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), e);
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured in assignVolumeHeatId.")
}
- msoLogger.trace("COMPLETED assignVolumeHeatId Process ")
- msoLogger.trace("COMPLETED Confirm Volume Group Tenant Subflow ")
+ logger.trace("COMPLETED assignVolumeHeatId Process ")
+ logger.trace("COMPLETED Confirm Volume Group Tenant Subflow ")
}
public void assignWorkflowException(DelegateExecution execution, String message){
execution.setVariable("prefix", Prefix)
String processKey = getProcessKey(execution);
- msoLogger.trace("STARTED Assign Workflow Exception ")
+ logger.trace("STARTED Assign Workflow Exception ")
try{
String volumeGroupId = execution.getVariable("volumeGroupId")
int errorCode = 1
@@ -139,9 +147,11 @@ class ConfirmVolumeGroupTenant extends AbstractServiceTaskProcessor{
exceptionUtil.buildWorkflowException(execution, errorCode, errorMessage)
}catch(Exception e){
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Exception Occured Processing assignWorkflowException.", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, e);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Exception Occured Processing assignWorkflowException.", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), e);
}
- msoLogger.trace("COMPLETED Assign Workflow Exception =")
+ logger.trace("COMPLETED Assign Workflow Exception =")
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy
index 370600755b..e608bbddbe 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModule.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
@@ -32,9 +34,11 @@ import org.onap.so.client.graphinventory.entities.uri.Depth
import org.onap.so.db.catalog.beans.OrchestrationStatus
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateAAIVfModule.class);
+ private static final Logger logger = LoggerFactory.getLogger( CreateAAIVfModule.class);
def prefix="CAAIVfMod_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -119,13 +123,13 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
Boolean isBaseVfModule = false
String isBaseVfModuleString = execution.getVariable("isBaseVfModule")
if (isBaseVfModuleString != null && isBaseVfModuleString.equals("true")) {
- isBaseVfModule = true
+ isBaseVfModule = true
}
execution.setVariable("CAAIVfMod_isBaseVfModule", isBaseVfModule)
String isVidRequest = execution.getVariable("isVidRequest")
if (isVidRequest != null && "true".equals(isVidRequest)) {
- msoLogger.debug("VID Request received")
+ logger.debug("VID Request received")
}
execution.setVariable("CAAIVfMod_moduleName",execution.getVariable("vfModuleName"))
@@ -133,8 +137,8 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
AaiUtil aaiUriUtil = new AaiUtil(this)
String aaiNamespace = aaiUriUtil.getNamespace()
- msoLogger.debug('AAI namespace is: ' + aaiNamespace)
-
+ logger.debug('AAI namespace is: ' + aaiNamespace)
+
execution.setVariable("CAAIVfMod_aaiNamespace",aaiNamespace)
}
@@ -163,30 +167,30 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
execution.setVariable("CAAIVfMod_queryGenericVnfResponse", "Generic Vnf not Found!")
}
} catch (Exception ex) {
- msoLogger.debug("Exception occurred while executing AAI GET:" + ex.getMessage())
+ logger.debug("Exception occurred while executing AAI GET:" + ex.getMessage())
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured in queryAAIForGenericVnf.")
}
}
-
+
// process the result from queryAAIForGenericVnf()
- // note: this method is primarily for logging as the actual decision logic is embedded in the bpmn flow
+ // note: this method is primarily for logging as the actual decision logic is embedded in the bpmn flow
public void processAAIGenericVnfQuery(DelegateExecution execution) {
if (execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") == 404 &&
execution.getVariable("CAAIVfMod_vnfId").isEmpty()) {
- msoLogger.debug("New Generic VNF requested and it does not already exist")
+ logger.debug("New Generic VNF requested and it does not already exist")
} else if (execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") == 200 &&
!execution.getVariable("CAAIVfMod_vnfId").isEmpty()) {
- msoLogger.debug("Adding module to existing Generic VNF")
+ logger.debug("Adding module to existing Generic VNF")
} else if (execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") == 200 &&
execution.getVariable("CAAIVfMod_vnfId").isEmpty()) {
- msoLogger.debug("Invalid request for new Generic VNF which already exists")
+ logger.debug("Invalid request for new Generic VNF which already exists")
execution.setVariable("CAAIVfMod_queryGenericVnfResponse",
"Invalid request for new Generic VNF which already exists, Vnf Name=" +
- execution.getVariable("CAAIVfMod_vnfName"))
+ execution.getVariable("CAAIVfMod_vnfName"))
} else { // execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") == 404 &&
// !execution.getVariable("CAAIVfMod_vnfId").isEmpty())
- msoLogger.debug("Invalid request for Add-on Module requested for non-existant Generic VNF")
+ logger.debug("Invalid request for Add-on Module requested for non-existant Generic VNF")
execution.setVariable("CAAIVfMod_createVfModuleResponse",
"Invalid request for Add-on Module requested for non-existant Generic VNF, VNF Id=" +
execution.getVariable("CAAIVfMod_vnfId"))
@@ -216,7 +220,7 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
execution.setVariable("CAAIVfMod_createGenericVnfResponse", "Vnf Created")
} catch (Exception ex) {
ex.printStackTrace()
- msoLogger.debug("Exception occurred while executing AAI PUT:" + ex.getMessage())
+ logger.debug("Exception occurred while executing AAI PUT:" + ex.getMessage())
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured in createGenericVnf.")
}
}
@@ -224,7 +228,7 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
// construct and send a PUT request to A&AI to create a Base or Add-on VF Module
public void createVfModule(DelegateExecution execution, Boolean isBaseModule) {
// TBD - is this how we want to generate the Id for the new (Base) VF Module?
-
+
// Generate the new VF Module ID here if it has not been provided by the parent process
def newModuleId = execution.getVariable('newVfModuleId')
if (newModuleId == null || newModuleId.isEmpty()) {
@@ -249,7 +253,7 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
rollbackData.put("VFMODULE", "vnfName", execution.getVariable("CAAIVfMod_vnfName"))
rollbackData.put("VFMODULE", "isBaseModule", isBaseModule.toString())
execution.setVariable("RollbackData", rollbackData)
- msoLogger.debug("RollbackData:" + rollbackData)
+ logger.debug("RollbackData:" + rollbackData)
org.onap.aai.domain.yang.VfModule vfModule = new org.onap.aai.domain.yang.VfModule()
vfModule.setVfModuleId(newModuleId)
@@ -276,14 +280,14 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
rollbackData.put("VFMODULE", "vfModuleId", newModuleId)
rollbackData.put("VFMODULE", "vfModuleName", execution.getVariable("CAAIVfMod_moduleName"))
execution.setVariable("RollbackData", rollbackData)
- msoLogger.debug("RollbackData:" + rollbackData)
-
+ logger.debug("RollbackData:" + rollbackData)
+
String responseOut = ""
-
+
String isVidRequest = execution.getVariable("isVidRequest")
def moduleIndexString = String.valueOf(moduleIndex)
- if (isBaseModule && (isVidRequest == null || "false".equals(isVidRequest))) {
-
+ if (isBaseModule && (isVidRequest == null || "false".equals(isVidRequest))) {
+
responseOut = """<CreateAAIVfModuleResponse>
<vnf-id>${MsoUtils.xmlEscape(execution.getVariable("CAAIVfMod_vnfId"))}</vnf-id>
<vf-module-id>${MsoUtils.xmlEscape(newModuleId)}</vf-module-id>
@@ -300,13 +304,13 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
}
execution.setVariable("CreateAAIVfModuleResponse", responseOut)
- msoLogger.debug("CreateAAIVfModuleResponse:" + System.lineSeparator()+responseOut)
- msoLogger.debug("CreateAAIVfModule Response /n " + responseOut)
+ logger.debug("CreateAAIVfModuleResponse:" + System.lineSeparator()+responseOut)
+ logger.debug("CreateAAIVfModule Response /n " + responseOut)
}
} catch (Exception ex) {
execution.setVariable("CAAIVfMod_createVfModuleResponseCode", 500)
execution.setVariable("CAAIVfMod_createVfModuleResponse", ex.getMessage())
- msoLogger.debug("Exception occurred while executing AAI PUT:" + ex.getMessage())
+ logger.debug("Exception occurred while executing AAI PUT:" + ex.getMessage())
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured in createVfModule.")
}
}
@@ -344,18 +348,18 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
GenericVnf genericVnf = execution.getVariable("CAAIVfMod_queryGenericVnfResponse")
def vnfNameFromAAI = genericVnf.getVnfName()
execution.setVariable("CAAIVfMod_vnfNameFromAAI", vnfNameFromAAI)
- msoLogger.debug("Obtained vnf-name from AAI for existing VNF: " + vnfNameFromAAI)
+ logger.debug("Obtained vnf-name from AAI for existing VNF: " + vnfNameFromAAI)
def newModuleName = execution.getVariable("CAAIVfMod_moduleName")
- msoLogger.debug("VF Module to be added: " + newModuleName)
+ logger.debug("VF Module to be added: " + newModuleName)
execution.setVariable("CAAIVfMod_moduleExists", false)
if (genericVnf !=null && genericVnf.getVfModules()!=null && !genericVnf.getVfModules().getVfModule().isEmpty()) {
def qryModuleList = genericVnf.getVfModules().getVfModule()
- msoLogger.debug("Existing VF Module List: " + qryModuleList)
+ logger.debug("Existing VF Module List: " + qryModuleList)
for (org.onap.aai.domain.yang.VfModule qryModule : qryModuleList) {
def qryModuleName = qryModule.getVfModuleName()
if (newModuleName.equals(qryModuleName)) {
// a module with the requested name already exists - failure
- msoLogger.debug("VF Module " + qryModuleName + " already exists for Generic VNF " + vnfNameFromAAI)
+ logger.debug("VF Module " + qryModuleName + " already exists for Generic VNF " + vnfNameFromAAI)
execution.setVariable("CAAIVfMod_moduleExists", true)
execution.setVariable("CAAIVfMod_parseModuleResponse",
"VF Module " + qryModuleName + " already exists for Generic VNF " + vnfNameFromAAI)
@@ -364,31 +368,31 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
}
}
if (execution.getVariable("CAAIVfMod_moduleExists") == false) {
- msoLogger.debug("VF Module " + execution.getVariable("CAAIVfMod_moduleName") + " does not exist for Generic VNF " + vnfNameFromAAI)
+ logger.debug("VF Module " + execution.getVariable("CAAIVfMod_moduleName") + " does not exist for Generic VNF " + vnfNameFromAAI)
execution.setVariable("CAAIVfMod_parseModuleResponse",
"VF Module " + newModuleName + " does not exist for Generic VNF " + vnfNameFromAAI)
- }
+ }
}
-
+
// parses the output from the result from queryAAIForGenericVnf() to determine if the vf-module-name
- // requested for an Add-on VF Module does not already exist for the specified Generic VNF;
+ // requested for an Add-on VF Module does not already exist for the specified Generic VNF;
// also retrieves VNF name from AAI response for existing VNF
public void parseForBaseModule(DelegateExecution execution) {
GenericVnf genericVnf = execution.getVariable("CAAIVfMod_queryGenericVnfResponse")
def vnfNameFromAAI = genericVnf.getVnfName()
execution.setVariable("CAAIVfMod_vnfNameFromAAI", vnfNameFromAAI)
- msoLogger.debug("Obtained vnf-name from AAI for existing VNF: " + vnfNameFromAAI)
+ logger.debug("Obtained vnf-name from AAI for existing VNF: " + vnfNameFromAAI)
def newModuleName = execution.getVariable("CAAIVfMod_moduleName")
- msoLogger.debug("VF Module to be added: " + newModuleName)
+ logger.debug("VF Module to be added: " + newModuleName)
def qryModuleList = genericVnf !=null ? genericVnf.getVfModules():null;
execution.setVariable("CAAIVfMod_moduleExists", false)
if (qryModuleList != null && !qryModuleList.getVfModule().isEmpty()) {
def qryModules = qryModuleList.getVfModule()
- msoLogger.debug("Existing VF Module List: " + qryModules)
+ logger.debug("Existing VF Module List: " + qryModules)
for (org.onap.aai.domain.yang.VfModule qryModule : qryModules) {
if (newModuleName.equals(qryModule.getVfModuleName())) {
// a module with the requested name already exists - failure
- msoLogger.debug("VF Module " + qryModule.getVfModuleName() + " already exists for Generic VNF " + vnfNameFromAAI)
+ logger.debug("VF Module " + qryModule.getVfModuleName() + " already exists for Generic VNF " + vnfNameFromAAI)
execution.setVariable("CAAIVfMod_baseModuleConflict", true)
execution.setVariable("CAAIVfMod_parseModuleResponse",
"VF Module " + qryModule.getVfModuleName() + " already exists for Generic VNF " + vnfNameFromAAI)
@@ -402,30 +406,32 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
for (org.onap.aai.domain.yang.VfModule qryModule : qryModules) {
if (qryModule.isBaseVfModule) {
// a base module already exists in this VNF - failure
- msoLogger.debug("Base VF Module already exists for Generic VNF " + vnfNameFromAAI)
+ logger.debug("Base VF Module already exists for Generic VNF " + vnfNameFromAAI)
execution.setVariable("CAAIVfMod_baseModuleConflict", true)
execution.setVariable("CAAIVfMod_parseModuleResponse",
"Base VF Module already exists for Generic VNF " + vnfNameFromAAI)
break
}
}
-
+
}
if (execution.getVariable("CAAIVfMod_baseModuleConflict") == false) {
- msoLogger.debug("VF Module " + execution.getVariable("CAAIVfMod_moduleName") + " does not exist for Generic VNF " + execution.getVariable("CAAIVfMod_vnfNameFromAAI"))
+ logger.debug("VF Module " + execution.getVariable("CAAIVfMod_moduleName") + " does not exist for Generic VNF " + execution.getVariable("CAAIVfMod_vnfNameFromAAI"))
execution.setVariable("CAAIVfMod_parseModuleResponse",
"VF Module " + newModuleName + " does not exist for Generic VNF " + vnfNameFromAAI)
- }
+ }
}
-
+
// generates a WorkflowException when the A&AI query returns a response code other than 200 or 404
public void handleAAIQueryFailure(DelegateExecution execution) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Error occurred attempting to query AAI, Response Code " + execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") + ", Error Response " + execution.getVariable("CAAIVfMod_queryGenericVnfResponse"), "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Error occurred attempting to query AAI, Response Code " + execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") + ", Error Response " + execution.getVariable("CAAIVfMod_queryGenericVnfResponse"),
+ "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
int code = execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode")
exceptionUtil.buildAndThrowWorkflowException(execution, code, "Error occurred attempting to query AAI")
}
-
+
// generates a WorkflowException if
// - the A&AI Generic VNF PUT returns a response code other than 200 or 201
// - the requested Generic VNF already exists but vnf-id == null
@@ -437,31 +443,31 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
def errorResponse
if (execution.getVariable("CAAIVfMod_createGenericVnfResponseCode") != null &&
!isOneOf(execution.getVariable("CAAIVfMod_createGenericVnfResponseCode"), 200, 201)) {
- msoLogger.debug("Failure creating Generic VNF: " + execution.getVariable("CAAIVfMod_createGenericVnfResponse"))
+ logger.debug("Failure creating Generic VNF: " + execution.getVariable("CAAIVfMod_createGenericVnfResponse"))
errorResponse = execution.getVariable("CAAIVfMod_createGenericVnfResponse")
errorCode = 5000
} else if (execution.getVariable("CAAIVfMod_queryGenericVnfResponse") != null &&
execution.getVariable("CAAIVfMod_newGenericVnf") == true) {
// attempted to create a Generic VNF that already exists but vnf-id == null
- msoLogger.debug(execution.getVariable("CAAIVfMod_queryGenericVnfResponse"))
+ logger.debug(execution.getVariable("CAAIVfMod_queryGenericVnfResponse"))
errorResponse = execution.getVariable("CAAIVfMod_queryGenericVnfResponse")
errorCode = 1002
} else if (execution.getVariable("CAAIVfMod_queryGenericVnfResponseCode") == 404 &&
execution.getVariable("CAAIVfMod_newGenericVnf") == false) {
// attempted to create a Generic VNF where vnf-name does not exist but vnf-id != null
- msoLogger.debug(execution.getVariable("CAAIVfMod_queryGenericVnfResponse"))
+ logger.debug(execution.getVariable("CAAIVfMod_queryGenericVnfResponse"))
errorResponse = execution.getVariable("CAAIVfMod_queryGenericVnfResponse")
errorCode = 1002
} else if (execution.getVariable("CAAIVfMod_createVfModuleResponseCode") != null) {
- msoLogger.debug("Failed to add VF Module: " + execution.getVariable("CAAIVfMod_createVfModuleResponse"))
+ logger.debug("Failed to add VF Module: " + execution.getVariable("CAAIVfMod_createVfModuleResponse"))
errorResponse = execution.getVariable("CAAIVfMod_createVfModuleResponse")
errorCode = 5000
} else if (execution.getVariable("CAAIVfMod_moduleExists") == true) {
- msoLogger.debug("Attempting to add VF Module that already exists: " + execution.getVariable("CAAIVfMod_parseModuleResponse"))
+ logger.debug("Attempting to add VF Module that already exists: " + execution.getVariable("CAAIVfMod_parseModuleResponse"))
errorResponse = execution.getVariable("CAAIVfMod_parseModuleResponse")
errorCode = 1002
} else if (execution.getVariable("CAAIVfMod_baseModuleConflict") == true) {
- msoLogger.debug("Attempting to add Base VF Module to VNF that already has a Base VF Module: " + execution.getVariable("CAAIVfMod_parseModuleResponse"))
+ logger.debug("Attempting to add Base VF Module to VNF that already has a Base VF Module: " + execution.getVariable("CAAIVfMod_parseModuleResponse"))
errorResponse = execution.getVariable("CAAIVfMod_parseModuleResponse")
errorCode = 1002
} else {
@@ -470,8 +476,10 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
errorCode = 2000
}
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Error occurred during CreateAAIVfModule flow", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, errorResponse);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Error occurred during CreateAAIVfModule flow", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), errorResponse);
exceptionUtil.buildAndThrowWorkflowException(execution, errorCode, errorResponse)
- msoLogger.debug("Workflow exception occurred in CreateAAIVfModule: " + errorResponse)
+ logger.debug("Workflow exception occurred in CreateAAIVfModule: " + errorResponse)
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy
index 075068513a..dc4871119e 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.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
@@ -25,10 +27,11 @@ import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.so.client.aai.AAIObjectType
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
-import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
public class CreateAAIVfModuleVolumeGroup extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateAAIVfModuleVolumeGroup.class);
+ private static final Logger logger = LoggerFactory.getLogger( CreateAAIVfModuleVolumeGroup.class);
private XmlParser xmlParser = new XmlParser()
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -59,12 +62,12 @@ public class CreateAAIVfModuleVolumeGroup extends AbstractServiceTaskProcessor {
def method = getClass().getSimpleName() + '.preProcessRequest(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
def xml = execution.getVariable('CreateAAIVfModuleVolumeGroupRequest')
- msoLogger.debug('Received request xml:\n' + xml)
- msoLogger.debug("CreateAAIVfModuleVolume Received Request XML: " + xml)
+ logger.debug('Received request xml:\n' + xml)
+ logger.debug("CreateAAIVfModuleVolume Received Request XML: " + xml)
initProcessVariables(execution)
def vnfId = getRequiredNodeText(execution, xml,'vnf-id')
@@ -72,21 +75,21 @@ public class CreateAAIVfModuleVolumeGroup extends AbstractServiceTaskProcessor {
def vfModuleId = getRequiredNodeText(execution, xml,'vf-module-id')
execution.setVariable('CAAIVfModVG_vfModuleId', vfModuleId)
-
+
def aicCloudRegion = getRequiredNodeText(execution, xml,'aic-cloud-region')
execution.setVariable('CAAIVfModVG_aicCloudRegion', aicCloudRegion)
-
+
def cloudOwner = getRequiredNodeText(execution, xml,'cloud-owner')
execution.setVariable('CAAIVfModVG_cloudOwner', cloudOwner)
-
+
def volumeGroupId = getRequiredNodeText(execution, xml,'volume-group-id')
execution.setVariable('CAAIVfModVG_volumeGroupId', volumeGroupId)
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(e);
+ logger.error(e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage())
}
@@ -102,7 +105,7 @@ public class CreateAAIVfModuleVolumeGroup extends AbstractServiceTaskProcessor {
def method = getClass().getSimpleName() + '.getVfModule(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
def vnfId = execution.getVariable('CAAIVfModVG_vnfId')
@@ -119,15 +122,15 @@ public class CreateAAIVfModuleVolumeGroup extends AbstractServiceTaskProcessor {
}
}catch (Exception ex) {
ex.printStackTrace()
- msoLogger.debug('Exception occurred while executing AAI GET:' + ex.getMessage())
+ logger.debug('Exception occurred while executing AAI GET:' + ex.getMessage())
execution.setVariable('CAAIVfModVG_getVfModuleResponseCode', 500)
execution.setVariable('CAAIVfModVG_getVfModuleResponse', 'AAI GET Failed:' + ex.getMessage())
}
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(e);
+ logger.error(e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in getVfModule(): ' + e.getMessage())
}
}
@@ -142,7 +145,7 @@ public class CreateAAIVfModuleVolumeGroup extends AbstractServiceTaskProcessor {
def method = getClass().getSimpleName() + '.updateVfModule(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
def vnfId = execution.getVariable('CAAIVfModVG_vnfId')
@@ -152,10 +155,10 @@ public class CreateAAIVfModuleVolumeGroup extends AbstractServiceTaskProcessor {
// Confirm resource-version is in retrieved VF Module
if (vfModule.getResourceVersion() == null) {
def msg = 'Can\'t update VF Module ' + vfModuleId + ' since \'resource-version\' is missing'
- msoLogger.error( msg);
+ logger.error(msg);
throw new Exception(msg)
}
-
+
// Construct payload by creating a Volume Group relationhip and inserting it into the VF Module
def aicCloudRegion = execution.getVariable('CAAIVfModVG_aicCloudRegion')
def cloudOwner = execution.getVariable('CAAIVfModVG_cloudOwner')
@@ -164,31 +167,31 @@ public class CreateAAIVfModuleVolumeGroup extends AbstractServiceTaskProcessor {
try {
AAIResourceUri vfModuleUri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId,vfModuleId);
AAIResourceUri volumeGroupUri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudOwner, aicCloudRegion,volumeGroupId);
- msoLogger.debug("Creating relationship between Vf Module: " + vfModuleUri.build().toString() + " and Volume Group: " + volumeGroupUri.build().toString())
+ logger.debug("Creating relationship between Vf Module: " + vfModuleUri.build().toString() + " and Volume Group: " + volumeGroupUri.build().toString())
getAAIClient().connect(vfModuleUri,volumeGroupUri)
execution.setVariable('CAAIVfModVG_updateVfModuleResponseCode', 200)
execution.setVariable('CAAIVfModVG_updateVfModuleResponse', "Success")
- msoLogger.debug("CreateAAIVfModule Response code: " + 200)
- msoLogger.debug("CreateAAIVfModule Response: " + "Success")
+ logger.debug("CreateAAIVfModule Response code: " + 200)
+ logger.debug("CreateAAIVfModule Response: " + "Success")
} catch (Exception ex) {
ex.printStackTrace()
- msoLogger.debug('Exception occurred while executing AAI PUT:' + ex.getMessage())
+ logger.debug('Exception occurred while executing AAI PUT:' + ex.getMessage())
execution.setVariable('CAAIVfModVG_updateVfModuleResponseCode', 500)
execution.setVariable('CAAIVfModVG_updateVfModuleResponse', 'AAI PUT Failed:' + ex.getMessage())
}
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(e);
+ logger.error(e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in updateVfModule(): ' + e.getMessage())
}
}
-
+
/**
* Find and return the value of the Volume Group ID for the specified VF Module. If
* the value of the Volume Group ID cannot be found for any reason, 'null' is returned.
- *
+ *
* @param vfModuleNode VF Module (as a Node) retrieved from AAI.
* @return the value of the Volume Group ID for the specified VF Module. If the
* value of the Volume Group ID cannot be found for any reason, 'null' is returned.
@@ -214,12 +217,12 @@ public class CreateAAIVfModuleVolumeGroup extends AbstractServiceTaskProcessor {
def method = getClass().getSimpleName() + '.handleAAIQueryFailure(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
- msoLogger.error( 'Error occurred attempting to query AAI, Response Code ' + execution.getVariable('CAAIVfModVG_getVfModuleResponseCode'));
+ logger.trace('Entered ' + method)
+ logger.error('Error occurred attempting to query AAI, Response Code ' + execution.getVariable('CAAIVfModVG_getVfModuleResponseCode'));
ExceptionUtil exceptionUtil = new ExceptionUtil()
exceptionUtil.buildWorkflowException(execution, 5000, execution.getVariable('CAAIVfModVG_getVfModuleResponse'))
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
}
/**
@@ -231,12 +234,12 @@ public class CreateAAIVfModuleVolumeGroup extends AbstractServiceTaskProcessor {
def method = getClass().getSimpleName() + '.handleUpdateVfModuleFailure(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
- msoLogger.error('Error occurred attempting to update VF Module in AAI, Response Code ' + execution.getVariable('CAAIVfModVG_updateVfModuleResponseCode'));
+ logger.error('Error occurred attempting to update VF Module in AAI, Response Code ' + execution.getVariable('CAAIVfModVG_updateVfModuleResponseCode'));
ExceptionUtil exceptionUtil = new ExceptionUtil()
exceptionUtil.buildWorkflowException(execution, 5000, execution.getVariable('CAAIVfModVG_updateVfModuleResponse'))
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DecomposeService.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DecomposeService.groovy
index 1c1d5eb0e3..d8e4b7f6b1 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DecomposeService.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DecomposeService.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
@@ -26,7 +28,8 @@ import org.json.JSONObject;
import org.onap.so.bpmn.core.domain.ServiceDecomposition
import org.onap.so.bpmn.core.json.DecomposeJsonUtil;
import org.onap.so.bpmn.core.json.JsonUtils
-import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
/**
* This groovy class supports the <class>DecomposeService.bpmn</class> process.
@@ -48,7 +51,7 @@ import org.onap.so.logger.MsoLogger
*
*/
public class DecomposeService extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DecomposeService.class);
+ private static final Logger logger = LoggerFactory.getLogger( DecomposeService.class);
String Prefix="DDS_"
@@ -58,7 +61,7 @@ public class DecomposeService extends AbstractServiceTaskProcessor {
public void preProcessRequest (DelegateExecution execution) {
String msg = ""
- msoLogger.trace("preProcessRequest of DecomposeService ")
+ logger.trace("preProcessRequest of DecomposeService ")
setBasicDBAuthHeader(execution, execution.getVariable('isDebugLogEnabled'))
try {
@@ -80,15 +83,15 @@ public class DecomposeService extends AbstractServiceTaskProcessor {
throw e;
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit preProcessRequest of DecomposeService ")
+ logger.trace("Exit preProcessRequest of DecomposeService ")
}
public void queryCatalogDb (DelegateExecution execution) {
String msg = ""
- msoLogger.trace("queryCatalogDB of DecomposeService ")
+ logger.trace("queryCatalogDB of DecomposeService ")
try {
@@ -97,8 +100,8 @@ public class DecomposeService extends AbstractServiceTaskProcessor {
String serviceModelUuid = execution.getVariable("DDS_serviceModelUuid")
String modelVersion = execution.getVariable("DDS_modelVersion")
- msoLogger.debug("serviceModelInvariantId: " + serviceModelInvariantId)
- msoLogger.debug("modelVersion: " + modelVersion)
+ logger.debug("serviceModelInvariantId: " + serviceModelInvariantId)
+ logger.debug("modelVersion: " + modelVersion)
JSONObject catalogDbResponse = null
if(serviceModelUuid != null && serviceModelUuid.length() > 0)
@@ -110,30 +113,30 @@ public class DecomposeService extends AbstractServiceTaskProcessor {
if (catalogDbResponse == null || catalogDbResponse.toString().equalsIgnoreCase("null")) {
msg = "No data found in Catalog DB"
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
String catalogDbResponseString = catalogDbResponse.toString()
execution.setVariable("DDS_catalogDbResponse", catalogDbResponseString)
- msoLogger.debug("catalog DB response string: "+ catalogDbResponseString)
+ logger.debug("catalog DB response string: "+ catalogDbResponseString)
} catch (BpmnError e) {
throw e;
} catch (Exception ex){
msg = "Exception in queryCatalogDb " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit queryCatalogDb of DecomposeService ")
+ logger.trace("Exit queryCatalogDb of DecomposeService ")
}
public void actuallyDecomposeService (DelegateExecution execution) {
String msg = ""
- msoLogger.trace("actuallyDecomposeService of DecomposeService ")
+ logger.trace("actuallyDecomposeService of DecomposeService ")
try {
@@ -142,9 +145,9 @@ public class DecomposeService extends AbstractServiceTaskProcessor {
String serviceInstanceId = execution.getVariable("serviceInstanceId")
String serviceModelInvariantId = execution.getVariable("DDS_serviceModelInvariantId")
- msoLogger.debug("serviceModelInvariantId: " + serviceModelInvariantId)
+ logger.debug("serviceModelInvariantId: " + serviceModelInvariantId)
- msoLogger.debug("getting service decomposition")
+ logger.debug("getting service decomposition")
String catalogDbResponse = execution.getVariable("DDS_catalogDbResponse")
ServiceDecomposition serviceDecomposition = DecomposeJsonUtil.jsonToServiceDecomposition(catalogDbResponse, serviceInstanceId)
@@ -152,16 +155,16 @@ public class DecomposeService extends AbstractServiceTaskProcessor {
execution.setVariable("serviceDecomposition", serviceDecomposition)
execution.setVariable("serviceDecompositionString", serviceDecomposition.toJsonString())
- msoLogger.debug("service decomposition: "+ serviceDecomposition.toJsonString())
+ logger.debug("service decomposition: "+ serviceDecomposition.toJsonString())
} catch (BpmnError e) {
throw e;
} catch (Exception ex){
msg = "Exception in actuallyDecomposeService " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit actuallyDecomposeService of DecomposeService ")
+ logger.trace("Exit actuallyDecomposeService of DecomposeService ")
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy
index b8df241913..301c74d2eb 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DeleteAAIVfModule.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
@@ -27,9 +29,11 @@ import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.client.graphinventory.entities.uri.Depth
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DeleteAAIVfModule.class);
+ private static final Logger logger = LoggerFactory.getLogger( DeleteAAIVfModule.class);
def Prefix="DAAIVfMod_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -55,20 +59,20 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
execution.setVariable("DAAIVfMod_deleteVfModuleResponse","")
}
-
+
// parse the incoming DELETE_VF_MODULE request and store the Generic Vnf
// and Vf Module Ids in the flow DelegateExecution
public void preProcessRequest(DelegateExecution execution) {
def xml = execution.getVariable("DeleteAAIVfModuleRequest")
- msoLogger.debug("DeleteAAIVfModule Request: " + xml)
- msoLogger.debug("input request xml:" + xml)
+ logger.debug("DeleteAAIVfModule Request: " + xml)
+ logger.debug("input request xml:" + xml)
initProcessVariables(execution)
def vnfId = utils.getNodeText(xml,"vnf-id")
def vfModuleId = utils.getNodeText(xml,"vf-module-id")
execution.setVariable("DAAIVfMod_vnfId", vnfId)
execution.setVariable("DAAIVfMod_vfModuleId", vfModuleId)
}
-
+
// send a GET request to AA&I to retrieve the Generic Vnf/Vf Module information based on a Vnf Id
// expect a 200 response with the information in the response body or a 404 if the Generic Vnf does not exist
public void queryAAIForGenericVnf(DelegateExecution execution) {
@@ -91,12 +95,12 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
}
} catch (Exception ex) {
- msoLogger.debug("Exception occurred while executing AAI GET:" + ex.getMessage())
+ logger.debug("Exception occurred while executing AAI GET:" + ex.getMessage())
execution.setVariable("DAAIVfMod_queryGenericVnfResponse", "AAI GET Failed:" + ex.getMessage())
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured during queryAAIForGenericVnf")
}
}
-
+
// construct and send a DELETE request to A&AI to delete a Generic Vnf
// note: to get here, all the modules associated with the Generic Vnf must already be deleted
public void deleteGenericVnf(DelegateExecution execution) {
@@ -109,7 +113,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
execution.setVariable("DAAIVfMod_deleteGenericVnfResponse", "Vnf Deleted")
} catch (Exception ex) {
ex.printStackTrace()
- msoLogger.debug("Exception occurred while executing AAI DELETE:" + ex.getMessage())
+ logger.debug("Exception occurred while executing AAI DELETE:" + ex.getMessage())
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured during deleteGenericVnf")
}
}
@@ -120,7 +124,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
try {
String vnfId = execution.getVariable("DAAIVfMod_vnfId")
String vfModuleId = execution.getVariable("DAAIVfMod_vfModuleId")
-
+
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId)
getAAIClient().delete(uri)
@@ -128,19 +132,19 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
execution.setVariable("DAAIVfMod_deleteVfModuleResponse", "Vf Module Deleted")
} catch (Exception ex) {
ex.printStackTrace()
- msoLogger.debug("Exception occurred while executing AAI PUT:" + ex.getMessage())
+ logger.debug("Exception occurred while executing AAI PUT:" + ex.getMessage())
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error - Occured during deleteVfModule")
}
}
-
+
// parses the output from the result from queryAAIForGenericVnf() to determine if the Vf Module
// to be deleted exists for the specified Generic Vnf and if it is the Base Module,
// there are no Add-on Modules present
public void parseForVfModule(DelegateExecution execution) {
GenericVnf genericVnf = execution.getVariable("DAAIVfMod_queryGenericVnfResponse")
-
+
def delModuleId = execution.getVariable("DAAIVfMod_vfModuleId")
- msoLogger.debug("Vf Module to be deleted: " + delModuleId)
+ logger.debug("Vf Module to be deleted: " + delModuleId)
execution.setVariable("DAAIVfMod_genVnfRsrcVer", genericVnf.getResourceVersion())
@@ -179,30 +183,32 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
}
}
}
- msoLogger.debug(execution.getVariable("DAAIVfMod_parseModuleResponse"))
+ logger.debug(execution.getVariable("DAAIVfMod_parseModuleResponse"))
}
}
if (execution.getVariable("DAAIVfMod_moduleExists") == false) { // (execution.getVariable("DAAIVfMod_moduleExists") == false)
- msoLogger.debug("Vf Module Id " + delModuleId + " does not exist for Generic Vnf Id " + execution.getVariable("DAAIVfMod_vnfId"))
+ logger.debug("Vf Module Id " + delModuleId + " does not exist for Generic Vnf Id " + execution.getVariable("DAAIVfMod_vnfId"))
execution.setVariable("DAAIVfMod_parseModuleResponse",
"Vf Module Id " + delModuleId + " does not exist for Generic Vnf Id " +
execution.getVariable("DAAIVfMod_vnfName"))
}
}
-
+
// parses the output from the result from queryAAIForGenericVnf() to determine if the Vf Module
// to be deleted exists for the specified Generic Vnf and if it is the Base Module,
// there are no Add-on Modules present
public void parseForResourceVersion(DelegateExecution execution) {
GenericVnf genericVnf = execution.getVariable("DAAIVfMod_queryGenericVnfResponse")
execution.setVariable("DAAIVfMod_genVnfRsrcVer", genericVnf.getResourceVersion())
- msoLogger.debug("Latest Generic VNF Resource Version: " + genericVnf.getResourceVersion())
+ logger.debug("Latest Generic VNF Resource Version: " + genericVnf.getResourceVersion())
}
-
-
+
+
// generates a WorkflowException if the A&AI query returns a response code other than 200
public void handleAAIQueryFailure(DelegateExecution execution) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Error occurred attempting to query AAI, Response Code " + execution.getVariable("DAAIVfMod_queryGenericVnfResponseCode") + ", Error Response " + execution.getVariable("DAAIVfMod_queryGenericVnfResponse"), "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Error occurred attempting to query AAI, Response Code " + execution.getVariable("DAAIVfMod_queryGenericVnfResponseCode") + ", Error Response " + execution.getVariable("DAAIVfMod_queryGenericVnfResponse"),
+ "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
def errorCode = 5000
// set the errorCode to distinguish between a A&AI failure
// and the Generic Vnf Id not found
@@ -211,7 +217,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
}
exceptionUtil.buildAndThrowWorkflowException(execution, errorCode, execution.getVariable("DAAIVfMod_queryGenericVnfResponse"))
}
-
+
// generates a WorkflowException if
// - the A&AI Vf Module DELETE returns a response code other than 200
// - the Vf Module is a Base Module that is not the last Vf Module
@@ -221,24 +227,24 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
def errorResponse = ""
if (execution.getVariable("DAAIVfMod_deleteVfModuleResponseCode") != null &&
execution.getVariable("DAAIVfMod_deleteVfModuleResponseCode") != 200) {
- msoLogger.debug("AAI failure deleting a Vf Module: " + execution.getVariable("DAAIVfMod_deleteVfModuleResponse"))
+ logger.debug("AAI failure deleting a Vf Module: " + execution.getVariable("DAAIVfMod_deleteVfModuleResponse"))
errorResponse = execution.getVariable("DAAIVfMod_deleteVfModuleResponse")
- msoLogger.debug("DeleteAAIVfModule - deleteVfModuleResponse" + errorResponse)
+ logger.debug("DeleteAAIVfModule - deleteVfModuleResponse" + errorResponse)
errorCode = 5000
} else {
if (execution.getVariable("DAAIVfMod_isBaseModule", true) == true &&
execution.getVariable("DAAIVfMod_isLastModule") == false) {
// attempt to delete a Base Module that is not the last Vf Module
- msoLogger.debug(execution.getVariable("DAAIVfMod_parseModuleResponse"))
+ logger.debug(execution.getVariable("DAAIVfMod_parseModuleResponse"))
errorResponse = execution.getVariable("DAAIVfMod_parseModuleResponse")
- msoLogger.debug("DeleteAAIVfModule - parseModuleResponse" + errorResponse)
+ logger.debug("DeleteAAIVfModule - parseModuleResponse" + errorResponse)
errorCode = 1002
} else {
// attempt to delete a non-existant Vf Module
if (execution.getVariable("DAAIVfMod_moduleExists") == false) {
- msoLogger.debug(execution.getVariable("DAAIVfMod_parseModuleResponse"))
+ logger.debug(execution.getVariable("DAAIVfMod_parseModuleResponse"))
errorResponse = execution.getVariable("DAAIVfMod_parseModuleResponse")
- msoLogger.debug("DeleteAAIVfModule - parseModuleResponse" + errorResponse)
+ logger.debug("DeleteAAIVfModule - parseModuleResponse" + errorResponse)
errorCode = 1002
} else {
// if the responses get populated corerctly, we should never get here
@@ -247,7 +253,9 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
}
}
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Error occurred during DeleteAAIVfModule flow", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, errorResponse);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Error occurred during DeleteAAIVfModule flow", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), errorResponse);
exceptionUtil.buildAndThrowWorkflowException(execution, errorCode, errorResponse)
}
@@ -255,7 +263,10 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
// generates a WorkflowException if
// - the A&AI Generic Vnf DELETE returns a response code other than 200
public void handleDeleteGenericVnfFailure(DelegateExecution execution) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "AAI error occurred deleting the Generic Vnf", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, execution.getVariable("DAAIVfMod_deleteGenericVnfResponse"));
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "AAI error occurred deleting the Generic Vnf", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(),
+ execution.getVariable("DAAIVfMod_deleteGenericVnfResponse"));
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, execution.getVariable("DAAIVfMod_deleteGenericVnfResponse"))
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy
index e132b411a5..a77320b771 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.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.camunda.bpm.engine.delegate.DelegateExecution
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
@@ -37,7 +41,7 @@ import org.onap.so.logger.MsoLogger
* @version 1.0
*/
class ExceptionUtil extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ExceptionUtil.class);
+ private static final Logger logger = LoggerFactory.getLogger( ExceptionUtil.class);
@@ -57,12 +61,12 @@ class ExceptionUtil extends AbstractServiceTaskProcessor {
def utils=new MsoUtils()
def prefix=execution.getVariable("prefix")
def errorMsg = execution.getVariable(prefix+"ErrorResponse")
- msoLogger.trace("Begin MapAAIExceptionToWorkflowException ")
+ logger.trace("Begin MapAAIExceptionToWorkflowException ")
String text = null
def variables
String errorCode = '5000'
WorkflowException wfex
- msoLogger.debug("response: " + response)
+ logger.debug("response: " + response)
try{
try {
//String msg = utils.getNodeXml(response, "Fault")
@@ -70,7 +74,7 @@ class ExceptionUtil extends AbstractServiceTaskProcessor {
text = utils.getNodeText(response, "text")
} catch (Exception ex) {
//Ignore the exception - cases include non xml payload
- msoLogger.debug("error mapping error, ignoring: " + ex)
+ logger.debug("error mapping error, ignoring: " + ex)
}
if(text != null) {
@@ -81,12 +85,13 @@ class ExceptionUtil extends AbstractServiceTaskProcessor {
text = text.replaceFirst("%4", variables[3])
}
String modifiedErrorMessage = 'Received error from A&amp;AI (' + text +')'
- msoLogger.debug("ModifiedErrorMessage " + modifiedErrorMessage)
+ logger.debug("ModifiedErrorMessage " + modifiedErrorMessage)
// let $ModifiedErrorMessage := concat( 'Received error from A',$exceptionaai:ampersand,'AI (' ,functx:replace-multi($ErrorMessage,$from,$Variables ),')')
buildWorkflowException(execution, 5000, modifiedErrorMessage)
wfex = execution.getVariable("WorkflowException")
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Fault", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, wfex.errorMessage);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Fault", "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), wfex.errorMessage);
return wfex
} else {
try {
@@ -96,18 +101,19 @@ class ExceptionUtil extends AbstractServiceTaskProcessor {
int errorCodeInt = Integer.parseInt(errorCode)
buildWorkflowException(execution, errorCodeInt, mappedErrorMessage)
- msoLogger.debug("mappedErrorMessage " + mappedErrorMessage)
+ logger.debug("mappedErrorMessage " + mappedErrorMessage)
wfex = execution.getVariable("WorkflowException")
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Fault", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, wfex.errorMessage);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Fault", "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), wfex.errorMessage);
return wfex
} catch(Exception ex) {
- msoLogger.debug("error mapping error, return null: " + ex)
+ logger.debug("error mapping error, return null: " + ex)
return null
}
}
}catch(Exception e){
- msoLogger.debug("Exception occured during MapAAIExceptionToWorkflowException: " + e)
+ logger.debug("Exception occured during MapAAIExceptionToWorkflowException: " + e)
buildWorkflowException(execution, 5000, "Error mapping AAI Response to WorkflowException")
}
}
@@ -125,7 +131,7 @@ class ExceptionUtil extends AbstractServiceTaskProcessor {
*/
WorkflowException MapAAIExceptionToWorkflowExceptionGeneric(DelegateExecution execution, String response, int resCode){
def utils=new MsoUtils()
- msoLogger.debug("Start MapAAIExceptionToWorkflowExceptionGeneric Process")
+ logger.debug("Start MapAAIExceptionToWorkflowExceptionGeneric Process")
WorkflowException wfex
try {
@@ -142,12 +148,12 @@ class ExceptionUtil extends AbstractServiceTaskProcessor {
buildWorkflowException(execution, resCode, "Received a bad response from AAI")
}
} catch (Exception ex) {
- msoLogger.debug("Exception Occured during MapAAIExceptionToWorkflowExceptionGeneric: " + ex)
+ logger.debug("Exception Occured during MapAAIExceptionToWorkflowExceptionGeneric: " + ex)
buildWorkflowException(execution, resCode, "Internal Error - Occured in MapAAIExceptionToWorkflowExceptionGeneric")
}
- msoLogger.debug("Outgoing WorkflowException is: " + execution.getVariable("WorkflowException"))
- msoLogger.debug("Completed MapAAIExceptionToWorkflowExceptionGeneric Process")
+ logger.debug("Outgoing WorkflowException is: " + execution.getVariable("WorkflowException"))
+ logger.debug("Completed MapAAIExceptionToWorkflowExceptionGeneric Process")
}
/**
@@ -269,11 +275,11 @@ class ExceptionUtil extends AbstractServiceTaskProcessor {
public void buildWorkflowException(DelegateExecution execution, int errorCode, String errorMessage) {
MsoUtils utils = new MsoUtils()
String processKey = getProcessKey(execution);
- msoLogger.debug("Building a WorkflowException for " + processKey)
+ logger.debug("Building a WorkflowException for " + processKey)
WorkflowException exception = new WorkflowException(processKey, errorCode, errorMessage);
execution.setVariable("WorkflowException", exception);
- msoLogger.debug("Outgoing WorkflowException is " + exception)
+ logger.debug("Outgoing WorkflowException is " + exception)
}
/**
@@ -287,12 +293,12 @@ class ExceptionUtil extends AbstractServiceTaskProcessor {
*/
public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, String errorMessage) {
String processKey = getProcessKey(execution);
- msoLogger.debug("Building a WorkflowException for Subflow " + processKey)
+ logger.debug("Building a WorkflowException for Subflow " + processKey)
WorkflowException exception = new WorkflowException(processKey, errorCode, errorMessage);
execution.setVariable("WorkflowException", exception);
- msoLogger.debug("Outgoing WorkflowException is " + exception)
- msoLogger.debug("Throwing MSOWorkflowException")
+ logger.debug("Outgoing WorkflowException is " + exception)
+ logger.debug("Throwing MSOWorkflowException")
throw new BpmnError(errorCode.toString(), String.format("MSOWorkflowException: %s", errorMessage))
}
@@ -308,16 +314,16 @@ class ExceptionUtil extends AbstractServiceTaskProcessor {
public void processSubflowsBPMNException(DelegateExecution execution){
String processKey = getProcessKey(execution)
try{
- msoLogger.debug("Started ProcessSubflowsBPMNException Method")
+ logger.debug("Started ProcessSubflowsBPMNException Method")
if(execution.getVariable("WorkflowException") == null){
buildWorkflowException(execution, 2500, "Internal Error - Occured During " + processKey)
}
- msoLogger.debug(processKey + " Outgoing WorkflowException is: " + execution.getVariable("WorkflowException"))
+ logger.debug(processKey + " Outgoing WorkflowException is: " + execution.getVariable("WorkflowException"))
}catch(Exception e){
- msoLogger.debug("Caught Exception during ProcessSubflowsBPMNException Method: " + e)
+ logger.debug("Caught Exception during ProcessSubflowsBPMNException Method: " + e)
}
- msoLogger.debug("Completed ProcessSubflowsBPMNException Method")
+ logger.debug("Completed ProcessSubflowsBPMNException Method")
}
/**
@@ -334,7 +340,7 @@ class ExceptionUtil extends AbstractServiceTaskProcessor {
public String processMainflowsBPMNException(DelegateExecution execution, String requestInfo){
String processKey = getProcessKey(execution)
try{
- msoLogger.debug("Started ProcessMainflowBPMNException Method")
+ logger.debug("Started ProcessMainflowBPMNException Method")
if(execution.getVariable("WorkflowException") == null || isBlank(requestInfo)){
buildWorkflowException(execution, 2500, "Internal Error - WorkflowException Object and/or RequestInfo is null! " + processKey)
}
@@ -354,16 +360,16 @@ class ExceptionUtil extends AbstractServiceTaskProcessor {
</aetgt:WorkflowException>
</aetgt:FalloutHandlerRequest>"""
- msoLogger.debug(processKey + " Outgoing WorkflowException is: " + execution.getVariable("WorkflowException"))
- msoLogger.debug(processKey + " Outgoing FalloutHandler Request is: " + falloutHandlerRequest)
+ logger.debug(processKey + " Outgoing WorkflowException is: " + execution.getVariable("WorkflowException"))
+ logger.debug(processKey + " Outgoing FalloutHandler Request is: " + falloutHandlerRequest)
return falloutHandlerRequest
}catch(Exception e){
- msoLogger.debug("Caught Exception during ProcessMainflowBPMNException Method: " + e)
+ logger.debug("Caught Exception during ProcessMainflowBPMNException Method: " + e)
return null
}
- msoLogger.debug("Completed ProcessMainflowBPMNException Method")
+ logger.debug("Completed ProcessMainflowBPMNException Method")
}
/**
@@ -377,8 +383,8 @@ class ExceptionUtil extends AbstractServiceTaskProcessor {
public void processJavaException(DelegateExecution execution){
String processKey = getProcessKey(execution)
try{
- msoLogger.debug("Caught a Java Exception in " + processKey)
- msoLogger.debug("Started processJavaException Method")
+ logger.debug("Caught a Java Exception in " + processKey)
+ logger.debug("Started processJavaException Method")
// if the BPMN flow java error handler sets "BPMN_javaExpMsg", append it to the WFE
String javaExpMsg = execution.getVariable("BPMN_javaExpMsg")
String errorMessage = execution.getVariable("gUnknownError")
@@ -387,20 +393,20 @@ class ExceptionUtil extends AbstractServiceTaskProcessor {
wfeExpMsg = wfeExpMsg + ": " + javaExpMsg
}
if (errorMessage != null && !errorMessage.empty) {
- msoLogger.error("Unknown Error: " + errorMessage);
+ logger.error("Unknown Error: " + errorMessage);
}
- msoLogger.error("Java Error: " + wfeExpMsg);
+ logger.error("Java Error: " + wfeExpMsg);
buildWorkflowException(execution, 2500, wfeExpMsg)
}catch(BpmnError b){
- msoLogger.error(b);
+ logger.error(b);
throw b
}catch(Exception e){
- msoLogger.error(e);
- msoLogger.debug("Caught Exception during processJavaException Method: " + e)
+ logger.error(e);
+ logger.debug("Caught Exception during processJavaException Method: " + e)
buildWorkflowException(execution, 2500, "Internal Error - During Process Java Exception")
}
- msoLogger.debug("Completed processJavaException Method")
+ logger.debug("Completed processJavaException Method")
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy
index 94c82f5a0c..918bcdd4cc 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2018 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,7 +27,8 @@ import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.logging.ref.slf4j.ONAPLogConstants
import org.onap.so.client.HttpClient
import org.onap.so.client.HttpClientFactory
-import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import org.onap.so.utils.TargetEntity
import javax.ws.rs.core.MediaType
@@ -37,7 +40,7 @@ class ExternalAPIUtil {
String Prefix="EXTAPI_"
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ExternalAPIUtil.class)
+ private static final Logger logger = LoggerFactory.getLogger( ExternalAPIUtil.class);
private final HttpClientFactory httpClientFactory;
private final MsoUtils utils;
@@ -96,7 +99,7 @@ class ExternalAPIUtil {
//
// def uri = execution.getVariable("ExternalAPIURi")
// if(uri) {
-// msoLogger.debug("ExternalAPIUtil.getUri: " + uri)
+// logger.debug("ExternalAPIUtil.getUri: " + uri)
// return uri
// }
//
@@ -104,21 +107,21 @@ class ExternalAPIUtil {
// }
public String setTemplate(String template, Map<String, String> valueMap) {
- msoLogger.debug("ExternalAPIUtil setTemplate", true);
+ logger.debug("ExternalAPIUtil setTemplate", true);
StringBuffer result = new StringBuffer();
String pattern = "<.*>";
Pattern r = Pattern.compile(pattern);
Matcher m = r.matcher(template);
- msoLogger.debug("ExternalAPIUtil template:" + template, true);
+ logger.debug("ExternalAPIUtil template:" + template, true);
while (m.find()) {
String key = template.substring(m.start() + 1, m.end() - 1);
- msoLogger.debug("ExternalAPIUtil key:" + key + " contains key? " + valueMap.containsKey(key), true);
+ logger.debug("ExternalAPIUtil key:" + key + " contains key? " + valueMap.containsKey(key), true);
m.appendReplacement(result, valueMap.getOrDefault(key, "\"TBD\""));
}
m.appendTail(result);
- msoLogger.debug("ExternalAPIUtil return:" + result.toString(), true);
+ logger.debug("ExternalAPIUtil return:" + result.toString(), true);
return result.toString();
}
@@ -134,12 +137,12 @@ class ExternalAPIUtil {
*
*/
public Response executeExternalAPIGetCall(DelegateExecution execution, String url){
- msoLogger.debug(" ======== STARTED Execute ExternalAPI Get Process ======== ")
+ logger.debug(" ======== STARTED Execute ExternalAPI Get Process ======== ")
Response apiResponse = null
try{
String uuid = utils.getRequestID()
- msoLogger.debug( "Generated uuid is: " + uuid)
- msoLogger.debug( "URL to be used is: " + url)
+ logger.debug( "Generated uuid is: " + uuid)
+ logger.debug( "URL to be used is: " + url)
HttpClient client = httpClientFactory.newJsonClient(new URL(url), TargetEntity.EXTERNAL)
client.addBasicAuthHeader(execution.getVariable("URN_externalapi_auth"), execution.getVariable("URN_mso_msoKey"))
@@ -149,9 +152,9 @@ class ExternalAPIUtil {
apiResponse = client.get()
- msoLogger.debug( "======== COMPLETED Execute ExternalAPI Get Process ======== ")
+ logger.debug( "======== COMPLETED Execute ExternalAPI Get Process ======== ")
}catch(Exception e){
- msoLogger.debug("Exception occured while executing ExternalAPI Get Call. Exception is: \n" + e)
+ logger.debug("Exception occured while executing ExternalAPI Get Call. Exception is: \n" + e)
exceptionUtil.buildAndThrowWorkflowException(execution, 9999, e.getMessage())
}
return apiResponse
@@ -170,12 +173,12 @@ class ExternalAPIUtil {
*
*/
public Response executeExternalAPIPostCall(DelegateExecution execution, String url, String payload){
- msoLogger.debug( " ======== Started Execute ExternalAPI Post Process ======== ")
+ logger.debug( " ======== Started Execute ExternalAPI Post Process ======== ")
Response apiResponse = null
try{
String uuid = utils.getRequestID()
- msoLogger.debug( "Generated uuid is: " + uuid)
- msoLogger.debug( "URL to be used is: " + url)
+ logger.debug( "Generated uuid is: " + uuid)
+ logger.debug( "URL to be used is: " + url)
HttpClient httpClient = httpClientFactory.newJsonClient(new URL(url), TargetEntity.AAI)
httpClient.addBasicAuthHeader(execution.getVariable("URN_externalapi_auth"), execution.getVariable("URN_mso_msoKey"))
@@ -184,9 +187,9 @@ class ExternalAPIUtil {
apiResponse = httpClient.post(payload)
- msoLogger.debug( "======== Completed Execute ExternalAPI Post Process ======== ")
+ logger.debug( "======== Completed Execute ExternalAPI Post Process ======== ")
}catch(Exception e){
- msoLogger.error("Exception occured while executing ExternalAPI Post Call. Exception is: \n" + e)
+ logger.error("Exception occured while executing ExternalAPI Post Call. Exception is: \n" + e)
exceptionUtil.buildAndThrowWorkflowException(execution, 9999, e.getMessage())
}
return apiResponse
@@ -194,4 +197,4 @@ class ExternalAPIUtil {
-} \ No newline at end of file
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.groovy
index 480dcd5e8f..2a8f8f1593 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/FalloutHandler.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
@@ -28,20 +30,22 @@ import org.apache.commons.lang3.*
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
public class FalloutHandler extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, FalloutHandler.class);
+ private static final Logger logger = LoggerFactory.getLogger( FalloutHandler.class);
String Prefix="FH_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
-
+
public initializeProcessVariables(DelegateExecution execution){
def method = getClass().getSimpleName() + '.initializeProcessVariables(' +'execution=' + execution.getId() +')'
- msoLogger.trace('Entered ' + method)
-
+ logger.trace('Entered ' + method)
+
try {
execution.setVariable("prefix",Prefix)
-
+
//These variables are form the input Message to the BPMN
execution.setVariable("FH_request_id","")
execution.setVariable("FH_request_action","")
@@ -83,42 +87,44 @@ public class FalloutHandler extends AbstractServiceTaskProcessor {
//Auth variables
execution.setVariable("BasicAuthHeaderValue","")
-
+
//Parameter list
execution.setVariable("FH_parameterList", "")
-
+
//Response variables
execution.setVariable("FalloutHandlerResponse","")
execution.setVariable("FH_ErrorResponse", null)
execution.setVariable("FH_ResponseCode", "")
-
+
} 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.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method)
}
}
-
+
public void preProcessRequest (DelegateExecution execution) {
def method = getClass().getSimpleName() + '.preProcessRequest(' +'execution=' + execution.getId() +')'
- msoLogger.trace('Entered ' + method)
-
+ logger.trace('Entered ' + method)
+
// Initialize flow variables
initializeProcessVariables(execution)
setSuccessIndicator(execution, false)
-
+
setBasicDBAuthHeader(execution, execution.getVariable('isDebugLogEnabled'))
-
+
try {
def xml = execution.getVariable("FalloutHandlerRequest")
- msoLogger.debug(" XML --> " + xml)
- msoLogger.debug("FalloutHandler request: " + xml)
-
+ logger.debug(" XML --> " + xml)
+ logger.debug("FalloutHandler request: " + xml)
+
//Check the incoming request type
//Incoming request can be ACTIVE_REQUESTS (request-information node) or INFRA_ACTIVE_REQUESTS (request-info node)
if (utils.nodeExists(xml, "request-information")) {
execution.setVariable("FH_request_id-Ok", true) // Incoming request is for ACTIVE_REQUESTS
}
-
+
//Check notification-url for the incoming request type
//ACTIVE_REQUESTS may have notificationurl node
//INFRA_ACTIVE_REQUESTS notificationurl node does not exist
@@ -126,7 +132,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor {
if (utils.nodeExists(xml, "notification-url")) {
notificationurl = utils.getNodeText(xml,"notification-url")
if(notificationurl != null && !notificationurl.isEmpty()) {
- msoLogger.debug("********** Incoming notification Url is: " + notificationurl);
+ logger.debug("********** Incoming notification Url is: " + notificationurl);
execution.setVariable("FH_notification-url-Ok", true)
execution.setVariable("FH_notification-url",notificationurl)
}
@@ -139,8 +145,8 @@ public class FalloutHandler extends AbstractServiceTaskProcessor {
if (utils.nodeExists(xml, "request-id")) {
execution.setVariable("FH_request_id",utils.getNodeText(xml,"request-id"))
}
- msoLogger.debug("FH_request_id: " + execution.getVariable("FH_request_id"))
-
+ logger.debug("FH_request_id: " + execution.getVariable("FH_request_id"))
+
// INFRA_ACTIVE_REQUESTS have "action" element ... mandatory
// ACTIVE_REQUEST have "request-action" ... mandatory
if (utils.nodeExists(xml, "request-action")) {
@@ -148,8 +154,8 @@ public class FalloutHandler extends AbstractServiceTaskProcessor {
} else if (utils.nodeExists(xml, "action")) {
execution.setVariable("FH_request_action",utils.getNodeText(xml,"action"))
}
-
-
+
+
//Check source for the incoming request type
//For INFRA_ACTIVE_REQUESTS payload source IS optional
//For ACTIVE_REQUESTS payload source is NOT optional
@@ -157,7 +163,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor {
if (utils.nodeExists(xml, "source")) {
execution.setVariable("FH_source",utils.getNodeText(xml,"source"))
}
-
+
//Check if ErrorCode node exists. If yes, initialize it from request xml, if no, it will stay with defaulf value already set in initializeProcessVariables() method above.
def errorCode = ""
if (utils.nodeExists(xml, "ErrorCode")) {
@@ -166,8 +172,8 @@ public class FalloutHandler extends AbstractServiceTaskProcessor {
execution.setVariable("FH_ErrorCode", errorCode)
}
}
- msoLogger.debug("FH_ErrorCode: " + errorCode)
-
+ logger.debug("FH_ErrorCode: " + errorCode)
+
//Check if ErrorMessage node exists. If yes, initialize it from request xml, if no, it will stay with defaulf value already set in initializeProcessVariables() method above.
def errorMessage = ""
if (utils.nodeExists(xml, "ErrorMessage")) {
@@ -177,25 +183,25 @@ public class FalloutHandler extends AbstractServiceTaskProcessor {
execution.setVariable("FH_ErrorMessage", errorCode)
}
}
-
+
//Check for Parameter List
if (utils.nodeExists(xml, "parameter-list")) {
def parameterList = utils.getNodeXml(xml, "parameter-list", false)
execution.setVariable("FH_parameterList", parameterList)
}
-
- msoLogger.trace("--> " + execution.getVariable(""))
- msoLogger.debug("FH_request_id-OK --> " + execution.getVariable("FH_request_id-Ok"))
-
+
+ logger.trace("--> " + execution.getVariable(""))
+ logger.debug("FH_request_id-OK --> " + execution.getVariable("FH_request_id-Ok"))
+
// set the DHV/Service Instantiation values if specified in the request
execution.setVariable("FH_is_srv_inst_req", String.valueOf("true".equals(utils.getNodeText(xml, "is-srv-inst-req"))))
- msoLogger.trace("--> " + execution.getVariable(""))
+ logger.trace("--> " + execution.getVariable(""))
execution.setVariable("FH_is_json_content", String.valueOf("JSON".equals(utils.getNodeText(xml, "resp-content-type"))))
- msoLogger.trace("--> " + execution.getVariable(""))
+ logger.trace("--> " + execution.getVariable(""))
execution.setVariable("FH_service_inst_id", utils.getNodeText(xml, "service-instance-id"))
- msoLogger.trace("--> " + execution.getVariable(""))
+ logger.trace("--> " + execution.getVariable(""))
execution.setVariable("FH_start_time", utils.getNodeText(xml, "start-time"))
- msoLogger.trace("--> " + execution.getVariable(""))
+ logger.trace("--> " + execution.getVariable(""))
// this variable is used by the camunda flow to set the Content-Type for the async response
if (execution.getVariable("FH_is_srv_inst_req").equals("true") &&
execution.getVariable("FH_is_json_content").equals("true")) {
@@ -204,17 +210,19 @@ public class FalloutHandler extends AbstractServiceTaskProcessor {
execution.setVariable("FH_content_type", "text/xml")
}
} 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.buildWorkflowException(execution, 2000, "Internal Error - Occured in" + method)
}
-
- msoLogger.debug("OUTOF --> Initialize Variables Fallout Handler #########");
+
+ logger.debug("OUTOF --> Initialize Variables Fallout Handler #########");
}
-
+
public String updateRequestPayload (DelegateExecution execution){
def method = getClass().getSimpleName() + '.updateRequestPayload(' +'execution=' + execution.getId() +')'
- msoLogger.trace('Entered ' + method)
-
+ logger.trace('Entered ' + method)
+
try {
String payload = """
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.onap.so/requestsdb">
@@ -231,19 +239,21 @@ public class FalloutHandler extends AbstractServiceTaskProcessor {
</soapenv:Body>
</soapenv:Envelope>
"""
-
- msoLogger.debug("updateRequestPayload: " + payload)
+
+ logger.debug("updateRequestPayload: " + payload)
execution.setVariable("FH_updateRequestPayload", payload)
return execution.getVariable("FH_updateRequestPayload")
} 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.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method)
}
}
-
+
public String updateRequestInfraPayload (DelegateExecution execution){
def method = getClass().getSimpleName() + '.updateRequestInfraPayload(' +'execution=' + execution.getId() +')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
String payload = """
@@ -262,18 +272,20 @@ public class FalloutHandler extends AbstractServiceTaskProcessor {
"""
execution.setVariable("FH_updateRequestInfraPayload", payload)
- msoLogger.debug("updateRequestInfraPayload: " + payload)
+ logger.debug("updateRequestInfraPayload: " + payload)
return execution.getVariable("FH_updateRequestInfraPayload")
} 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.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method)
}
}
-
+
public String updateRequestGammaPayload (DelegateExecution execution){
def method = getClass().getSimpleName() + '.updateRequestGammaPayload(' +'execution=' + execution.getId() +')'
- msoLogger.trace('Entered ' + method)
-
+ logger.trace('Entered ' + method)
+
try {
String payload = """
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="${UrnPropertiesReader.getVariable("mso.default.adapter.namespace", execution)}/requestsdb">
@@ -289,20 +301,22 @@ public class FalloutHandler extends AbstractServiceTaskProcessor {
</soapenv:Body>
</soapenv:Envelope>
"""
-
+
execution.setVariable("FH_updateRequestGammaPayload", payload)
- msoLogger.debug("updateRequestGammaPayload: " + payload)
+ logger.debug("updateRequestGammaPayload: " + payload)
return execution.getVariable("FH_updateRequestGammaPayload")
} 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.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method)
}
}
-
+
public String updateResponseStatusPayload (DelegateExecution execution){
def method = getClass().getSimpleName() + '.updateResponseStatusPayload(' +'execution=' + execution.getId() +')'
- msoLogger.trace('Entered ' + method)
-
+ logger.trace('Entered ' + method)
+
try {
String payload = """
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.onap.so/requestsdb">
@@ -316,22 +330,24 @@ public class FalloutHandler extends AbstractServiceTaskProcessor {
</soapenv:Body>
</soapenv:Envelope>
"""
-
+
execution.setVariable("FH_updateResponseStatusPayload", payload)
- msoLogger.debug("updateResponseStatusPayload: " + payload)
+ logger.debug("updateResponseStatusPayload: " + payload)
return execution.getVariable("FH_updateResponseStatusPayload")
} 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.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method)
}
}
-
+
public void buildDBWorkflowException(DelegateExecution execution, String responseCodeVariable) {
def method = getClass().getSimpleName() + '.buildDBWorkflowException(' +
'execution=' + execution.getId() +
', responseCodeVariable=' + responseCodeVariable + ')'
- msoLogger.trace('Entered ' + method)
-
+ logger.trace('Entered ' + method)
+
try {
def responseCode = execution.getVariable(responseCodeVariable)
// If the HTTP response code was null, it means a connection fault occurred (a java exception)
@@ -339,40 +355,44 @@ public class FalloutHandler extends AbstractServiceTaskProcessor {
def errorCode = responseCode == null ? 7000 : 7020
// exceptionUtil.buildWorkflowException(execution, errorCode, errorMessage)
} 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.buildWorkflowException(execution, 2000, "Internal Error - Occured in " + method)
}
}
-
+
/**
* Used to create a workflow response in success and failure cases.
*/
public void postProcessResponse (DelegateExecution execution) {
def method = getClass().getSimpleName() + '.postProcessResponse(' +'execution=' + execution.getId() +')'
- msoLogger.trace('Entered ' + method)
-
+ logger.trace('Entered ' + method)
+
try {
Boolean success = (Boolean) execution.getVariable("FH_success")
String out = success ? "Fallout Handler Succeeded" : "Fallout Handler Failed";
-
+
String falloutHandlerResponse = """
<workflow:FalloutHandlerResponse xmlns:workflow="http://org.onap/so/workflow/schema/v1">
<workflow:out>${MsoUtils.xmlEscape(out)}</workflow:out>
</workflow:FalloutHandlerResponse>
"""
-
+
falloutHandlerResponse = utils.formatXml(falloutHandlerResponse)
- msoLogger.debug("FalloutHandler Response: " + falloutHandlerResponse);
-
+ logger.debug("FalloutHandler Response: " + falloutHandlerResponse);
+
execution.setVariable("FalloutHandlerResponse", falloutHandlerResponse)
execution.setVariable("WorkflowResponse", falloutHandlerResponse)
execution.setVariable("FH_ResponseCode", success ? "200" : "500")
setSuccessIndicator(execution, success)
-
- msoLogger.debug("FalloutHandlerResponse =\n" + falloutHandlerResponse)
+
+ logger.debug("FalloutHandlerResponse =\n" + falloutHandlerResponse)
} catch (Exception e) {
// Do NOT throw WorkflowException!
- 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);
}
}
-} \ No newline at end of file
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy
index 1be24c4ce0..4d7557bfcd 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.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
@@ -41,9 +43,11 @@ import org.onap.so.client.graphinventory.entities.uri.Depth
import org.onap.so.utils.TargetEntity
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
public class GenerateVfModuleName extends AbstractServiceTaskProcessor{
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, GenerateVfModuleName.class);
+ private static final Logger logger = LoggerFactory.getLogger( GenerateVfModuleName.class);
def Prefix="GVFMN_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -53,13 +57,13 @@ public class GenerateVfModuleName extends AbstractServiceTaskProcessor{
public void preProcessRequest(DelegateExecution execution) {
try {
def vnfId = execution.getVariable("vnfId")
- msoLogger.debug("vnfId is " + vnfId)
+ logger.debug("vnfId is " + vnfId)
def vnfName = execution.getVariable("vnfName")
- msoLogger.debug("vnfName is " + vnfName)
+ logger.debug("vnfName is " + vnfName)
def vfModuleLabel = execution.getVariable("vfModuleLabel")
- msoLogger.debug("vfModuleLabel is " + vfModuleLabel)
+ logger.debug("vfModuleLabel is " + vfModuleLabel)
def personaModelId = execution.getVariable("personaModelId")
- msoLogger.debug("personaModelId is " + personaModelId)
+ logger.debug("personaModelId is " + personaModelId)
execution.setVariable("GVFMN_vfModuleXml", "")
}catch(BpmnError b){
throw b
@@ -73,7 +77,7 @@ public class GenerateVfModuleName extends AbstractServiceTaskProcessor{
def method = getClass().getSimpleName() + '.queryAAI(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
def vnfId = execution.getVariable('vnfId')
@@ -84,7 +88,7 @@ public class GenerateVfModuleName extends AbstractServiceTaskProcessor{
uri.depth(Depth.ONE)
String endPoint = aaiUtil.createAaiUri(uri)
- msoLogger.debug("AAI endPoint: " + endPoint)
+ logger.debug("AAI endPoint: " + endPoint)
try {
HttpClient client = new HttpClientFactory().newXmlClient(new URL(endPoint), TargetEntity.AAI)
@@ -96,29 +100,29 @@ public class GenerateVfModuleName extends AbstractServiceTaskProcessor{
def responseData = ''
- msoLogger.debug('sending GET to AAI endpoint \'' + endPoint + '\'')
+ logger.debug('sending GET to AAI endpoint \'' + endPoint + '\'')
Response response = client.get()
- msoLogger.debug("GenerateVfModuleName - invoking httpGet() to AAI")
+ logger.debug("GenerateVfModuleName - invoking httpGet() to AAI")
responseData = response.readEntity(String.class)
if (responseData != null) {
- msoLogger.debug("Received generic VNF data: " + responseData)
+ logger.debug("Received generic VNF data: " + responseData)
}
- msoLogger.debug("GenerateVfModuleName - queryAAIVfModule Response: " + responseData)
- msoLogger.debug("GenerateVfModuleName - queryAAIVfModule ResponseCode: " + response.getStatus())
+ logger.debug("GenerateVfModuleName - queryAAIVfModule Response: " + responseData)
+ logger.debug("GenerateVfModuleName - queryAAIVfModule ResponseCode: " + response.getStatus())
execution.setVariable('GVFMN_queryAAIVfModuleResponseCode', response.getStatus())
execution.setVariable('GVFMN_queryAAIVfModuleResponse', responseData)
- msoLogger.debug('Response code:' + response.getStatus())
- msoLogger.debug('Response:' + System.lineSeparator() + responseData)
+ logger.debug('Response code:' + response.getStatus())
+ logger.debug('Response:' + System.lineSeparator() + responseData)
if (response.getStatus() == 200) {
// Set the VfModuleXML
if (responseData != null) {
String vfModulesText = utils.getNodeXml(responseData, "vf-modules")
if (vfModulesText == null || vfModulesText.isEmpty()) {
- msoLogger.debug("There are no VF modules in this VNF yet")
+ logger.debug("There are no VF modules in this VNF yet")
execution.setVariable("GVFMN_vfModuleXml", null)
}
else {
@@ -141,21 +145,23 @@ public class GenerateVfModuleName extends AbstractServiceTaskProcessor{
}
}
matchingVfModules = matchingVfModules + "</vfModules>"
- msoLogger.debug("Matching VF Modules: " + matchingVfModules)
+ logger.debug("Matching VF Modules: " + matchingVfModules)
execution.setVariable("GVFMN_vfModuleXml", matchingVfModules)
}
}
}
} catch (Exception ex) {
ex.printStackTrace()
- msoLogger.debug('Exception occurred while executing AAI GET:' + ex.getMessage())
+ logger.debug('Exception occurred while executing AAI GET:' + ex.getMessage())
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'AAI GET Failed:' + ex.getMessage())
}
- msoLogger.trace('Exited ' + method)
+ 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, 1002, 'Error in queryAAI(): ' + e.getMessage())
}
@@ -165,16 +171,16 @@ public class GenerateVfModuleName extends AbstractServiceTaskProcessor{
def method = getClass().getSimpleName() + '.generateName() ' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
String vfModuleXml = execution.getVariable("GVFMN_vfModuleXml")
String moduleIndex = utils.getLowestUnusedIndex(vfModuleXml)
- msoLogger.debug("moduleIndex is: " + moduleIndex)
+ logger.debug("moduleIndex is: " + moduleIndex)
def vnfName = execution.getVariable("vnfName")
def vfModuleLabel = execution.getVariable("vfModuleLabel")
def vfModuleName = vnfName + "_" + vfModuleLabel + "_" + moduleIndex
- msoLogger.debug("vfModuleName is: " + vfModuleName)
+ logger.debug("vfModuleName is: " + vfModuleName)
execution.setVariable("vfModuleName", vfModuleName)
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericNotificationService.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericNotificationService.groovy
index 591e76e491..1163b6bf08 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericNotificationService.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenericNotificationService.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
@@ -27,16 +29,10 @@ import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.bpmn.core.json.JsonUtils
import java.text.SimpleDateFormat
-import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
public class GenericNotificationService extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, GenericNotificationService.class);
-
-
-
ExceptionUtil exceptionUtil = new ExceptionUtil()
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ManualHandling.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ManualHandling.groovy
index 820364b1f7..7e04adbff2 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ManualHandling.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ManualHandling.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
@@ -43,6 +45,8 @@ import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.client.ruby.*
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
@@ -73,7 +77,7 @@ import org.onap.so.logger.MsoLogger
*
*/
public class ManualHandling extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ManualHandling.class);
+ private static final Logger logger = LoggerFactory.getLogger( ManualHandling.class);
String Prefix="MH_"
@@ -83,46 +87,46 @@ public class ManualHandling extends AbstractServiceTaskProcessor {
public void preProcessRequest (DelegateExecution execution) {
String msg = ""
- msoLogger.trace("preProcessRequest of ManualHandling ")
+ logger.trace("preProcessRequest of ManualHandling ")
try {
execution.setVariable("prefix", Prefix)
setBasicDBAuthHeader(execution, execution.getVariable('isDebugLogEnabled'))
// check for required input
String requestId = execution.getVariable("msoRequestId")
- msoLogger.debug("msoRequestId is: " + requestId)
+ logger.debug("msoRequestId is: " + requestId)
def serviceType = execution.getVariable("serviceType")
- msoLogger.debug("serviceType is: " + serviceType)
+ logger.debug("serviceType is: " + serviceType)
def vnfType = execution.getVariable("vnfType")
- msoLogger.debug("vnftype is: " + vnfType)
+ logger.debug("vnftype is: " + vnfType)
def currentActivity = execution.getVariable("currentActivity")
- msoLogger.debug("currentActivity is: " + currentActivity)
+ logger.debug("currentActivity is: " + currentActivity)
def workStep = execution.getVariable("workStep")
- msoLogger.debug("workStep is: " + workStep)
+ logger.debug("workStep is: " + workStep)
def failedActivity = execution.getVariable("failedActivity")
- msoLogger.debug("failedActivity is: " + failedActivity)
+ logger.debug("failedActivity is: " + failedActivity)
def errorCode = execution.getVariable("errorCode")
- msoLogger.debug("errorCode is: " + errorCode)
+ logger.debug("errorCode is: " + errorCode)
def errorText = execution.getVariable("errorText")
- msoLogger.debug("errorText is: " + errorText)
+ logger.debug("errorText is: " + errorText)
def requestorId = execution.getVariable("requestorId")
- msoLogger.debug("requestorId is: " + requestorId)
+ logger.debug("requestorId is: " + requestorId)
def validResponses = execution.getVariable("validResponses")
- msoLogger.debug("validResponses is: " + validResponses)
+ logger.debug("validResponses is: " + validResponses)
} catch (BpmnError e) {
throw e;
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit preProcessRequest of RainyDayHandler ")
+ logger.trace("Exit preProcessRequest of RainyDayHandler ")
}
public void createManualTask (DelegateExecution execution) {
String msg = ""
- msoLogger.trace("createManualTask of ManualHandling ")
+ logger.trace("createManualTask of ManualHandling ")
try {
String taskId = UUID.randomUUID()
@@ -139,7 +143,7 @@ public class ManualHandling extends AbstractServiceTaskProcessor {
String buildingBlockStep = execution.getVariable("workStep")
String validResponses = execution.getVariable("validResponses")
- msoLogger.debug("Before creating task")
+ logger.debug("Before creating task")
Map<String, String> taskVariables = new HashMap<String, String>()
taskVariables.put("type", type)
@@ -158,16 +162,16 @@ public class ManualHandling extends AbstractServiceTaskProcessor {
Task manualTask = taskService.newTask(taskId)
taskService.saveTask(manualTask)
taskService.setVariables(taskId, taskVariables)
- msoLogger.debug("successfully created task: "+ taskId)
+ logger.debug("successfully created task: "+ taskId)
} catch (BpmnError e) {
- msoLogger.debug("BPMN exception: " + e.errorMessage)
+ logger.debug("BPMN exception: " + e.errorMessage)
throw e;
} catch (Exception ex){
msg = "Exception in createManualTask " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit createManualTask of ManualHandling ")
+ logger.trace("Exit createManualTask of ManualHandling ")
}
public void setTaskVariables (DelegateTask task) {
@@ -175,9 +179,9 @@ public class ManualHandling extends AbstractServiceTaskProcessor {
DelegateExecution execution = task.getExecution()
String msg = ""
- msoLogger.trace("setTaskVariables of ManualHandling ")
+ logger.trace("setTaskVariables of ManualHandling ")
String taskId = task.getId()
- msoLogger.debug("taskId is: " + taskId)
+ logger.debug("taskId is: " + taskId)
try {
execution.setVariable('taskId', taskId)
@@ -193,7 +197,7 @@ public class ManualHandling extends AbstractServiceTaskProcessor {
String buildingBlockStep = execution.getVariable("workStep")
String validResponses = execution.getVariable("validResponses")
- msoLogger.debug("Before creating task")
+ logger.debug("Before creating task")
Map<String, String> taskVariables = new HashMap<String, String>()
taskVariables.put("type", type)
@@ -211,16 +215,16 @@ public class ManualHandling extends AbstractServiceTaskProcessor {
taskService.setVariables(taskId, taskVariables)
- msoLogger.debug("successfully created task: "+ taskId)
+ logger.debug("successfully created task: "+ taskId)
} catch (BpmnError e) {
- msoLogger.debug("BPMN exception: " + e.errorMessage)
+ logger.debug("BPMN exception: " + e.errorMessage)
throw e;
} catch (Exception ex){
msg = "Exception in createManualTask " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit createManualTask of ManualHandling ")
+ logger.trace("Exit createManualTask of ManualHandling ")
}
public void completeTask (DelegateTask task) {
@@ -228,9 +232,9 @@ public class ManualHandling extends AbstractServiceTaskProcessor {
DelegateExecution execution = task.getExecution()
String msg = ""
- msoLogger.trace("completeTask of ManualHandling ")
+ logger.trace("completeTask of ManualHandling ")
String taskId = task.getId()
- msoLogger.debug("taskId is: " + taskId)
+ logger.debug("taskId is: " + taskId)
try {
TaskService taskService = execution.getProcessEngineServices().getTaskService()
@@ -238,27 +242,27 @@ public class ManualHandling extends AbstractServiceTaskProcessor {
Map<String, String> taskVariables = taskService.getVariables(taskId)
String responseValue = taskVariables.get("responseValue")
- msoLogger.debug("Received responseValue on completion: "+ responseValue)
+ logger.debug("Received responseValue on completion: "+ responseValue)
// Have to set the first letter of the response to upper case
String responseValueForRainyDay = responseValue.substring(0, 1).toUpperCase() + responseValue.substring(1)
- msoLogger.debug("ResponseValue to RainyDayHandler: "+ responseValueForRainyDay)
+ logger.debug("ResponseValue to RainyDayHandler: "+ responseValueForRainyDay)
execution.setVariable("responseValue", responseValueForRainyDay)
} catch (BpmnError e) {
- msoLogger.debug("BPMN exception: " + e.errorMessage)
+ logger.debug("BPMN exception: " + e.errorMessage)
throw e;
} catch (Exception ex){
msg = "Exception in createManualTask " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit completeTask of ManualHandling ")
+ logger.trace("Exit completeTask of ManualHandling ")
}
public void prepareRequestsDBStatusUpdate (DelegateExecution execution, String requestStatus){
def method = getClass().getSimpleName() + '.prepareRequestsDBStatusUpdate(' +'execution=' + execution.getId() +')'
- msoLogger.trace("prepareRequestsDBStatusUpdate of ManualHandling ")
+ logger.trace("prepareRequestsDBStatusUpdate of ManualHandling ")
try {
def requestId = execution.getVariable("msoRequestId")
String payload = """
@@ -267,29 +271,31 @@ public class ManualHandling extends AbstractServiceTaskProcessor {
<soapenv:Body>
<req:updateInfraRequest>
<requestId>${MsoUtils.xmlEscape(requestId)}</requestId>
- <lastModifiedBy>ManualHandling</lastModifiedBy>
- <requestStatus>${MsoUtils.xmlEscape(requestStatus)}</requestStatus>
+ <lastModifiedBy>ManualHandling</lastModifiedBy>
+ <requestStatus>${MsoUtils.xmlEscape(requestStatus)}</requestStatus>
</req:updateInfraRequest>
</soapenv:Body>
</soapenv:Envelope>
"""
execution.setVariable("setUpdateDBstatusPayload", payload)
- msoLogger.debug("Outgoing Update Mso Request Payload is: " + payload)
- msoLogger.debug("setUpdateDBstatusPayload: " + payload)
+ logger.debug("Outgoing Update Mso Request Payload is: " + payload)
+ logger.debug("setUpdateDBstatusPayload: " + payload)
} 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)
}
- msoLogger.trace("Exit prepareRequestsDBStatusUpdate of ManualHandling ")
+ logger.trace("Exit prepareRequestsDBStatusUpdate of ManualHandling ")
}
public void createAOTSTicket (DelegateExecution execution) {
String msg = ""
- msoLogger.trace("createAOTSTicket of ManualHandling ")
+ logger.trace("createAOTSTicket of ManualHandling ")
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
// This method will not be throwing an exception, but rather log the error
@@ -298,44 +304,46 @@ public class ManualHandling extends AbstractServiceTaskProcessor {
setBasicDBAuthHeader(execution,isDebugLogEnabled)
// check for required input
String requestId = execution.getVariable("msoRequestId")
- msoLogger.debug("requestId is: " + requestId)
+ logger.debug("requestId is: " + requestId)
def currentActivity = execution.getVariable("currentActivity")
- msoLogger.debug("currentActivity is: " + currentActivity)
+ logger.debug("currentActivity is: " + currentActivity)
def workStep = execution.getVariable("workStep")
- msoLogger.debug("workStep is: " + workStep)
+ logger.debug("workStep is: " + workStep)
def failedActivity = execution.getVariable("failedActivity")
- msoLogger.debug("failedActivity is: " + failedActivity)
+ logger.debug("failedActivity is: " + failedActivity)
def errorCode = execution.getVariable("errorCode")
- msoLogger.debug("errorCode is: " + errorCode)
+ logger.debug("errorCode is: " + errorCode)
def errorText = execution.getVariable("errorText")
- msoLogger.debug("errorText is: " + errorText)
+ logger.debug("errorText is: " + errorText)
def vnfName = execution.getVariable("vnfName")
- msoLogger.debug("vnfName is: " + vnfName)
+ logger.debug("vnfName is: " + vnfName)
String rubyRequestId = UUID.randomUUID()
- msoLogger.debug("rubyRequestId: " + rubyRequestId)
+ logger.debug("rubyRequestId: " + rubyRequestId)
String sourceName = vnfName
- msoLogger.debug("sourceName: " + sourceName)
+ logger.debug("sourceName: " + sourceName)
String reason = "VID Workflow failed at " + failedActivity + " " + workStep + " call with error " + errorCode
- msoLogger.debug("reason: " + reason)
+ logger.debug("reason: " + reason)
String workflowId = requestId
- msoLogger.debug("workflowId: " + workflowId)
+ logger.debug("workflowId: " + workflowId)
String notification = "Request originated from VID | Workflow fallout on " + vnfName + " | Workflow step failure: " + workStep + " failed | VID workflow ID: " + workflowId
- msoLogger.debug("notification: " + notification)
+ logger.debug("notification: " + notification)
- msoLogger.debug("Creating AOTS Ticket request")
+ logger.debug("Creating AOTS Ticket request")
RubyClient rubyClient = new RubyClient()
rubyClient.rubyCreateTicketCheckRequest(rubyRequestId, sourceName, reason, workflowId, notification)
} catch (BpmnError e) {
msg = "BPMN error in createAOTSTicket " + ex.getMessage()
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
} catch (Exception ex){
msg = "Exception in createAOTSTicket " + ex.getMessage()
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
}
- msoLogger.trace("Exit createAOTSTicket of ManualHandling ")
+ logger.trace("Exit createAOTSTicket of ManualHandling ")
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy
index 4f0b530a3b..ff1d2ecb19 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.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
@@ -28,6 +30,8 @@ import org.onap.so.bpmn.core.BPMNLogger
import org.onap.so.bpmn.core.xml.XmlTool
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import org.onap.so.utils.CryptoUtils
import org.slf4j.MDC
import org.w3c.dom.Element
@@ -36,16 +40,16 @@ import groovy.util.slurpersupport.NodeChild
import groovy.xml.XmlUtil
class MsoUtils {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, MsoUtils.class);
-
+ private static final Logger logger = LoggerFactory.getLogger( MsoUtils.class);
+
def initializeEndPoints(execution){
// use this placeholder to initialize end points, if called independently, this need to be set
- execution.setVariable("AAIEndPoint","http://localhost:28080/SoapUIMocks")
+ execution.setVariable("AAIEndPoint","http://localhost:28080/SoapUIMocks")
}
-
+
/**
* Returns the unescaped contents of element
- *
+ *
* @param xmlInput
* @param element
* @return
@@ -287,36 +291,38 @@ class MsoUtils {
return null
}
}
-
+
def log(logmode,logtxt,isDebugLogEnabled="false"){
if ("INFO"==logmode) {
- msoLogger.info(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, logtxt, "BPMN", MsoLogger.getServiceName());
+ logger.info(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, logtxt, "BPMN", MsoLogger.getServiceName());
} else if ("WARN"==logmode) {
// to see the warning text displayed in the log entry, the text must also be passed as arg0 (2nd argument) to invoke the correct MsoLogger warn() method
- msoLogger.warn (MessageEnum.BPMN_GENERAL_WARNING, logtxt, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, logtxt);
+ logger.warn ("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_WARNING.toString(), logtxt, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), logtxt);
} else if ("ERROR"==logmode) {
// to see the error text displayed in the log entry, the text must also be passed as arg0 (2nd argument) to invoke the correct MsoLogger error() method
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, logtxt, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, logtxt);
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), logtxt, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(), logtxt);
} else {
BPMNLogger.debug(isDebugLogEnabled, logtxt);
}
}
-
+
def logContext(requestId, serviceInstanceId){
- msoLogger.setLogContext(requestId, serviceInstanceId);
+// msoLogger.setLogContext(requestId, serviceInstanceId);
}
def logMetrics(elapsedTime, logtxt){
- msoLogger.recordMetricEvent (elapsedTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- logtxt, "BPMN", MsoLogger.getServiceName(), null);
+// msoLogger.recordMetricEvent (elapsedTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
+// logtxt, "BPMN", MsoLogger.getServiceName(), null);
}
-
+
def logAudit(logtxt){
long startTime = System.currentTimeMillis();
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, logtxt);
+// msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, logtxt);
}
// headers: header - name-value
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy
index 5e949fd8d2..cac7a35282 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2018 Intel Corp. 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
@@ -32,7 +34,8 @@ import org.onap.so.bpmn.core.domain.VnfResource
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.client.HttpClient
import org.onap.so.client.HttpClientFactory
-import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import org.onap.so.db.catalog.beans.CloudIdentity
import org.onap.so.db.catalog.beans.CloudSite
import org.onap.so.db.catalog.beans.HomingInstance
@@ -54,6 +57,7 @@ import javax.ws.rs.core.Response
* resources by calling OOF.
*/
class OofHoming extends AbstractServiceTaskProcessor {
+ private static final Logger logger = LoggerFactory.getLogger( OofHoming.class);
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
@@ -67,29 +71,28 @@ class OofHoming extends AbstractServiceTaskProcessor {
* @param execution
*/
public void callOof(DelegateExecution execution) {
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix", "HOME_")
- utils.log("DEBUG", "*** Started Homing Call OOF ***", isDebugEnabled)
+ logger.debug( "*** Started Homing Call OOF ***")
try {
execution.setVariable("rollbackData", null)
execution.setVariable("rolledBack", false)
String requestId = execution.getVariable("msoRequestId")
- utils.log("DEBUG", "Incoming Request Id is: " + requestId, isDebugEnabled)
+ logger.debug( "Incoming Request Id is: " + requestId)
String serviceInstanceId = execution.getVariable("serviceInstanceId")
- utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled)
+ logger.debug( "Incoming Service Instance Id is: " + serviceInstanceId)
String serviceInstanceName = execution.getVariable("serviceInstanceName")
- utils.log("DEBUG", "Incoming Service Instance Name is: " + serviceInstanceName, isDebugEnabled)
+ logger.debug( "Incoming Service Instance Name is: " + serviceInstanceName)
ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
- utils.log("DEBUG", "Incoming Service Decomposition is: " + serviceDecomposition, isDebugEnabled)
+ logger.debug( "Incoming Service Decomposition is: " + serviceDecomposition)
String subscriberInfo = execution.getVariable("subscriberInfo")
- utils.log("DEBUG", "Incoming Subscriber Information is: " + subscriberInfo, isDebugEnabled)
+ logger.debug( "Incoming Subscriber Information is: " + subscriberInfo)
Map customerLocation = execution.getVariable("customerLocation")
- utils.log("DEBUG", "Incoming Customer Location is: " + customerLocation.toString(), isDebugEnabled)
+ logger.debug( "Incoming Customer Location is: " + customerLocation.toString())
String cloudOwner = execution.getVariable("cloudOwner")
- utils.log("DEBUG", "Incoming cloudOwner is: " + cloudOwner, isDebugEnabled)
+ logger.debug( "Incoming cloudOwner is: " + cloudOwner)
String cloudRegionId = execution.getVariable("cloudRegionId")
- utils.log("DEBUG", "Incoming cloudRegionId is: " + cloudRegionId, isDebugEnabled)
+ logger.debug( "Incoming cloudRegionId is: " + cloudRegionId)
if (isBlank(requestId) ||
isBlank(serviceInstanceId) ||
@@ -119,18 +122,17 @@ class OofHoming extends AbstractServiceTaskProcessor {
String basicAuthValue = utils.encrypt(basicAuth, msokey)
if (basicAuthValue != null) {
- utils.log("DEBUG", "Obtained BasicAuth username and password for OOF Adapter: " + basicAuthValue,
- isDebugEnabled)
+ logger.debug( "Obtained BasicAuth username and password for OOF Adapter: " + basicAuthValue)
try {
authHeader = utils.getBasicAuth(basicAuthValue, msokey)
execution.setVariable("BasicAuthHeaderValue", authHeader)
} catch (Exception ex) {
- utils.log("DEBUG", "Unable to encode username and password string: " + ex, isDebugEnabled)
+ logger.debug( "Unable to encode username and password string: " + ex)
exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - Unable to " +
"encode username and password string")
}
} else {
- utils.log("DEBUG", "Unable to obtain BasicAuth - BasicAuth value null", isDebugEnabled)
+ logger.debug( "Unable to obtain BasicAuth - BasicAuth value null")
exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - BasicAuth " +
"value null")
}
@@ -143,7 +145,7 @@ class OofHoming extends AbstractServiceTaskProcessor {
timeout = "PT30M"
}
}
- utils.log("DEBUG", "Async Callback Timeout will be: " + timeout, isDebugEnabled)
+ logger.debug( "Async Callback Timeout will be: " + timeout)
execution.setVariable("timeout", timeout)
execution.setVariable("correlator", requestId)
@@ -153,10 +155,10 @@ class OofHoming extends AbstractServiceTaskProcessor {
String oofRequest = oofUtils.buildRequest(execution, requestId, serviceDecomposition,
subscriber, customerLocation)
execution.setVariable("oofRequest", oofRequest)
- utils.log("DEBUG", "OOF Request is: " + oofRequest, isDebugEnabled)
+ logger.debug( "OOF Request is: " + oofRequest)
String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution)
- utils.log("DEBUG", "Posting to OOF Url: " + urlString, isDebugEnabled)
+ logger.debug( "Posting to OOF Url: " + urlString)
URL url = new URL(urlString);
@@ -165,15 +167,15 @@ class OofHoming extends AbstractServiceTaskProcessor {
Response httpResponse = httpClient.post(oofRequest)
int responseCode = httpResponse.getStatus()
- logDebug("OOF sync response code is: " + responseCode, isDebugEnabled)
+ logDebug("OOF sync response code is: " + responseCode)
- utils.log("DEBUG", "*** Completed Homing Call OOF ***", isDebugEnabled)
+ logger.debug( "*** Completed Homing Call OOF ***")
}
} catch (BpmnError b) {
throw b
} catch (Exception e) {
- msoLogger.error(e);
+ logger.error(e);
exceptionUtil.buildAndThrowWorkflowException(execution, 2500,
"Internal Error - Occured in Homing callOof: " + e.getMessage())
}
@@ -188,19 +190,19 @@ class OofHoming extends AbstractServiceTaskProcessor {
* @param execution
*/
public void processHomingSolution(DelegateExecution execution) {
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- utils.log("DEBUG", "*** Started Homing Process Homing Solution ***", isDebugEnabled)
+
+ logger.debug( "*** Started Homing Process Homing Solution ***")
try {
String response = execution.getVariable("asyncCallbackResponse")
- utils.log("DEBUG", "OOF Async Callback Response is: " + response, isDebugEnabled)
+ logger.debug( "OOF Async Callback Response is: " + response)
utils.logAudit("OOF Async Callback Response is: " + response)
oofUtils.validateCallbackResponse(execution, response)
String placements = jsonUtil.getJsonValue(response, "solutions.placementSolutions")
- utils.log("DEBUG", "****** Solution Placements: " + placements + " *****", isDebugEnabled)
+ logger.debug( "****** Solution Placements: " + placements + " *****")
ServiceDecomposition decomposition = execution.getVariable("serviceDecomposition")
- utils.log("DEBUG", "Service Decomposition: " + decomposition, isDebugEnabled)
+ logger.debug( "Service Decomposition: " + decomposition)
List<Resource> resourceList = decomposition.getServiceResources()
JSONArray arr = new JSONArray(placements)
@@ -208,12 +210,12 @@ class OofHoming extends AbstractServiceTaskProcessor {
JSONArray arrSol = arr.getJSONArray(i)
for (int j = 0; j < arrSol.length(); j++) {
JSONObject placement = arrSol.getJSONObject(j)
- utils.log("DEBUG", "****** Placement Solution is: " + placement + " *****", "true")
+ logger.debug( "****** Placement Solution is: " + placement + " *****")
String jsonServiceResourceId = jsonUtil.getJsonValue( placement.toString(), "serviceResourceId")
- utils.log("DEBUG", "****** homing serviceResourceId is: " + jsonServiceResourceId + " *****", "true")
+ logger.debug( "****** homing serviceResourceId is: " + jsonServiceResourceId + " *****")
for (Resource resource : resourceList) {
String serviceResourceId = resource.getResourceId()
- utils.log("DEBUG", "****** decomp serviceResourceId is: " + serviceResourceId + " *****", "true")
+ logger.debug( "****** decomp serviceResourceId is: " + serviceResourceId + " *****")
if (serviceResourceId.equalsIgnoreCase(jsonServiceResourceId)) {
JSONObject solution = placement.getJSONObject("solution")
String solutionType = solution.getString("identifierType")
@@ -223,26 +225,26 @@ class OofHoming extends AbstractServiceTaskProcessor {
} else {
inventoryType = "cloud"
}
- utils.log("DEBUG", "****** homing inventoryType is: " + inventoryType + " *****", "true")
+ logger.debug( "****** homing inventoryType is: " + inventoryType + " *****")
resource.getHomingSolution().setInventoryType(InventoryType.valueOf(inventoryType))
JSONArray assignmentArr = placement.getJSONArray("assignmentInfo")
- utils.log("DEBUG", "****** assignmentInfo is: " + assignmentArr.toString() + " *****", "true")
+ logger.debug( "****** assignmentInfo is: " + assignmentArr.toString() + " *****")
Map<String, String> assignmentMap = jsonUtil.entryArrayToMap(execution,
assignmentArr.toString(), "key", "value")
String oofDirectives = null
assignmentMap.each { key, value ->
- utils.log("DEBUG", "****** element: " + key + " *****", "true")
+ logger.debug( "****** element: " + key + " *****")
if (key == "oof_directives") {
oofDirectives = value
- utils.log("DEBUG", "****** homing oofDirectives: " + oofDirectives + " *****", "true")
+ logger.debug( "****** homing oofDirectives: " + oofDirectives + " *****")
}
}
String cloudOwner = assignmentMap.get("cloudOwner")
- utils.log("DEBUG", "****** homing cloudOwner: " + cloudOwner + " *****", "true")
+ logger.debug( "****** homing cloudOwner: " + cloudOwner + " *****")
String cloudRegionId = assignmentMap.get("locationId")
- utils.log("DEBUG", "****** homing cloudRegionId: " + cloudRegionId + " *****", "true")
+ logger.debug( "****** homing cloudRegionId: " + cloudRegionId + " *****")
resource.getHomingSolution().setCloudOwner(cloudOwner)
resource.getHomingSolution().setCloudRegionId(cloudRegionId)
@@ -252,7 +254,7 @@ class OofHoming extends AbstractServiceTaskProcessor {
String orchestrator = execution.getVariable("orchestrator")
if ((orchestrator != null) && (orchestrator != "")) {
cloudSite.setOrchestrator(orchestrator)
- utils.log("DEBUG", "****** orchestrator: " + orchestrator + " *****", "true")
+ logger.debug( "****** orchestrator: " + orchestrator + " *****")
} else {
cloudSite.setOrchestrator("multicloud")
}
@@ -278,15 +280,15 @@ class OofHoming extends AbstractServiceTaskProcessor {
cloudIdentity.setIdentityUrl(msbHost + multicloudApiEndpoint
+ "/" + cloudOwner + "/" +
cloudRegionId + "/infra_workload")
- utils.log("DEBUG", "****** Cloud IdentityUrl: " + msbHost + multicloudApiEndpoint
+ logger.debug( "****** Cloud IdentityUrl: " + msbHost + multicloudApiEndpoint
+ "/" + cloudOwner + "/" +
cloudRegionId + "/infra_workload"
- + " *****", "true")
- utils.log("DEBUG", "****** CloudIdentity: " + cloudIdentity.toString()
- + " *****", "true")
+ + " *****")
+ logger.debug( "****** CloudIdentity: " + cloudIdentity.toString()
+ + " *****")
cloudSite.setIdentityService(cloudIdentity)
- utils.log("DEBUG", "****** CloudSite: " + cloudSite.toString()
- + " *****", "true")
+ logger.debug( "****** CloudSite: " + cloudSite.toString()
+ + " *****")
// Set cloudsite in catalog DB here
oofUtils.createCloudSite(cloudSite, execution)
@@ -294,7 +296,7 @@ class OofHoming extends AbstractServiceTaskProcessor {
if (oofDirectives != null && oofDirectives != "") {
resource.getHomingSolution().setOofDirectives(oofDirectives)
execution.setVariable("oofDirectives", oofDirectives)
- utils.log("DEBUG", "***** OofDirectives set to: " + oofDirectives +
+ logger.debug( "***** OofDirectives set to: " + oofDirectives +
" *****", "true")
}
@@ -319,8 +321,8 @@ class OofHoming extends AbstractServiceTaskProcessor {
resource.getHomingSolution().setServiceInstanceId(solution.getJSONArray("identifiers")[0].toString())
}
} else {
- utils.log("DEBUG", "ProcessHomingSolution Exception: no matching serviceResourceIds returned in " +
- "homing solution", isDebugEnabled)
+ logger.debug( "ProcessHomingSolution Exception: no matching serviceResourceIds returned in " +
+ "homing solution")
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - " +
"Occurred in Homing ProcessHomingSolution: no matching serviceResourceIds returned")
@@ -351,13 +353,13 @@ class OofHoming extends AbstractServiceTaskProcessor {
execution.setVariable("serviceDecomposition", decomposition)
execution.setVariable("homingSolution", placements) //TODO - can be removed as output variable
- utils.log("DEBUG", "*** Completed Homing Process Homing Solution ***", isDebugEnabled)
+ logger.debug( "*** Completed Homing Process Homing Solution ***")
} catch (BpmnError b) {
- utils.log("DEBUG", "ProcessHomingSolution Error: " + b, isDebugEnabled)
+ logger.debug( "ProcessHomingSolution Error: " + b)
throw b
} catch (Exception e) {
- utils.log("DEBUG", "ProcessHomingSolution Exception: " + e, isDebugEnabled)
- msoLogger.error(e);
+ logger.debug( "ProcessHomingSolution Exception: " + e)
+ logger.error(e);
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occurred in Homing ProcessHomingSolution")
}
}
@@ -369,14 +371,13 @@ class OofHoming extends AbstractServiceTaskProcessor {
* @param - execution
*/
public String logStart(DelegateExecution execution) {
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+
String requestId = execution.getVariable("testReqId")
if (isBlank(requestId)) {
requestId = execution.getVariable("msoRequestId")
}
execution.setVariable("DHVCS_requestId", requestId)
- utils.log("DEBUG", "***** STARTED Homing Subflow for request: " + requestId + " *****", "true")
- utils.log("DEBUG", "****** Homing Subflow Global Debug Enabled: " + isDebugEnabled + " *****", "true")
+ logger.debug( "***** STARTED Homing Subflow for request: " + requestId + " *****")
utils.logAudit("***** STARTED Homing Subflow for request: " + requestId + " *****")
}
@@ -404,18 +405,18 @@ class OofHoming extends AbstractServiceTaskProcessor {
'mso:workflow:message:endpoint was not passed in')
}
- utils.log("DEBUG", "passed in endpoint: " + endpoint + " *****", "true")
+ logger.debug( "passed in endpoint: " + endpoint + " *****")
while (endpoint.endsWith('/')) {
endpoint = endpoint.substring(0, endpoint.length() - 1)
}
- utils.log("DEBUG", "processed endpoint: " + endpoint + " *****", "true")
+ logger.debug( "processed endpoint: " + endpoint + " *****")
return endpoint +
'/' + UriUtils.encodePathSegment(messageType, 'UTF-8') +
'/' + UriUtils.encodePathSegment(correlator, 'UTF-8')
} catch (Exception ex) {
- utils.log("DEBUG", "createCallbackURL Exception: " + ex + " *****", "true")
+ logger.debug( "createCallbackURL Exception: " + ex + " *****")
}
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy
index af33f38a64..b68e979b3c 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2018 Intel Corp. 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
@@ -46,6 +48,8 @@ import org.springframework.http.client.BufferingClientHttpRequestFactory
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory
import org.springframework.web.client.RestTemplate
import org.springframework.web.util.UriComponentsBuilder
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import javax.ws.rs.core.MediaType
import javax.ws.rs.core.Response
@@ -54,6 +58,8 @@ import javax.xml.ws.http.HTTPException
import static org.onap.so.bpmn.common.scripts.GenericUtils.*
class OofUtils {
+ private static final Logger logger = LoggerFactory.getLogger( OofUtils.class);
+
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
@@ -86,40 +92,39 @@ class OofUtils {
ArrayList existingCandidates = null,
ArrayList excludedCandidates = null,
ArrayList requiredCandidates = null) {
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- utils.log("DEBUG", "Started Building OOF Request", isDebugEnabled)
+ logger.debug( "Started Building OOF Request")
String callbackEndpoint = UrnPropertiesReader.getVariable("mso.oof.callbackEndpoint", execution)
- utils.log("DEBUG", "mso.oof.callbackEndpoint is: " + callbackEndpoint, isDebugEnabled)
+ logger.debug( "mso.oof.callbackEndpoint is: " + callbackEndpoint)
try {
def callbackUrl = utils.createHomingCallbackURL(callbackEndpoint, "oofResponse", requestId)
- utils.log("DEBUG", "callbackUrl is: " + callbackUrl, isDebugEnabled)
+ logger.debug( "callbackUrl is: " + callbackUrl)
def transactionId = requestId
- utils.log("DEBUG", "transactionId is: " + transactionId, isDebugEnabled)
+ logger.debug( "transactionId is: " + transactionId)
//ServiceInstance Info
ServiceInstance serviceInstance = decomposition.getServiceInstance()
def serviceInstanceId = ""
def serviceName = ""
serviceInstanceId = execution.getVariable("serviceInstanceId")
- utils.log("DEBUG", "serviceInstanceId is: " + serviceInstanceId, isDebugEnabled)
+ logger.debug( "serviceInstanceId is: " + serviceInstanceId)
serviceName = execution.getVariable("subscriptionServiceType")
- utils.log("DEBUG", "serviceName is: " + serviceName, isDebugEnabled)
+ logger.debug( "serviceName is: " + serviceName)
if (serviceInstanceId == null || serviceInstanceId == "null") {
- utils.log("DEBUG", "Unable to obtain Service Instance Id", isDebugEnabled)
+ logger.debug( "Unable to obtain Service Instance Id")
exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - Unable to " +
"obtain Service Instance Id, execution.getVariable(\"serviceInstanceId\") is null")
}
if (serviceName == null || serviceName == "null") {
- utils.log("DEBUG", "Unable to obtain Service Name", isDebugEnabled)
+ logger.debug( "Unable to obtain Service Name")
exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - Unable to " +
"obtain Service Name, execution.getVariable(\"subscriptionServiceType\") is null")
}
//Model Info
ModelInfo model = decomposition.getModelInfo()
- utils.log("DEBUG", "ModelInfo: " + model.toString(), isDebugEnabled)
+ logger.debug( "ModelInfo: " + model.toString())
String modelType = model.getModelType()
String modelInvariantId = model.getModelInvariantUuid()
String modelVersionId = model.getModelUuid()
@@ -153,12 +158,10 @@ class OofUtils {
List<VnfResource> vnfResourceList = decomposition.getVnfResources()
if (allottedResourceList == null || allottedResourceList.isEmpty()) {
- utils.log("DEBUG", "Allotted Resources List is empty - will try to get service VNFs instead.",
- isDebugEnabled)
+ logger.debug( "Allotted Resources List is empty - will try to get service VNFs instead.")
} else {
for (AllottedResource resource : allottedResourceList) {
- utils.log("DEBUG", "Allotted Resource: " + resource.toString(),
- isDebugEnabled)
+ logger.debug( "Allotted Resource: " + resource.toString())
def serviceResourceId = resource.getResourceId()
def toscaNodeType = resource.getToscaNodeType()
def resourceModuleName = toscaNodeType.substring(toscaNodeType.lastIndexOf(".") + 1)
@@ -195,13 +198,11 @@ class OofUtils {
}
if (vnfResourceList == null || vnfResourceList.isEmpty()) {
- utils.log("DEBUG", "VNF Resources List is empty",
- isDebugEnabled)
+ logger.debug( "VNF Resources List is empty")
} else {
for (VnfResource vnfResource : vnfResourceList) {
- utils.log("DEBUG", "VNF Resource: " + vnfResource.toString(),
- isDebugEnabled)
+ logger.debug( "VNF Resource: " + vnfResource.toString())
ModelInfo vnfResourceModelInfo = vnfResource.getModelInfo()
def toscaNodeType = vnfResource.getToscaNodeType()
def resourceModuleName = toscaNodeType.substring(toscaNodeType.lastIndexOf(".") + 1)
@@ -239,7 +240,7 @@ class OofUtils {
String licenseDemands = ""
sb = new StringBuilder()
if (vnfResourceList.isEmpty() || vnfResourceList == null) {
- utils.log("DEBUG", "Vnf Resources List is Empty", isDebugEnabled)
+ logger.debug( "Vnf Resources List is Empty")
} else {
for (VnfResource vnfResource : vnfResourceList) {
ModelInfo vnfResourceModelInfo = vnfResource.getModelInfo()
@@ -322,10 +323,10 @@ class OofUtils {
"}"
- utils.log("DEBUG", "Completed Building OOF Request", isDebugEnabled)
+ logger.debug( "Completed Building OOF Request")
return request
} catch (Exception ex) {
- utils.log("DEBUG", "buildRequest Exception: " + ex, isDebugEnabled)
+ logger.debug( "buildRequest Exception: " + ex)
}
}
@@ -339,7 +340,6 @@ class OofUtils {
* @param response - the async callback response from oof
*/
Void validateCallbackResponse(DelegateExecution execution, String response) {
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
String placements = ""
if (isBlank(response)) {
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "OOF Async Callback Response is Empty")
@@ -349,12 +349,12 @@ class OofUtils {
if (isBlank(placements) || placements.equalsIgnoreCase("[]")) {
String statusMessage = jsonUtil.getJsonValue(response, "statusMessage")
if (isBlank(statusMessage)) {
- utils.log("DEBUG", "Error Occurred in Homing: OOF Async Callback Response does " +
- "not contain placement solution.", isDebugEnabled)
+ logger.debug( "Error Occurred in Homing: OOF Async Callback Response does " +
+ "not contain placement solution.")
exceptionUtil.buildAndThrowWorkflowException(execution, 400,
"OOF Async Callback Response does not contain placement solution.")
} else {
- utils.log("DEBUG", "Error Occurred in Homing: " + statusMessage, isDebugEnabled)
+ logger.debug( "Error Occurred in Homing: " + statusMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 400, statusMessage)
}
} else {
@@ -374,11 +374,11 @@ class OofUtils {
} else {
errorMessage = "OOF Async Callback Response contains a Request Error. Unable to determine the Request Error Exception."
}
- utils.log("DEBUG", "Error Occurred in Homing: " + errorMessage, isDebugEnabled)
+ logger.debug( "Error Occurred in Homing: " + errorMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 400, errorMessage)
} else {
- utils.log("DEBUG", "Error Occurred in Homing: Received an Unknown Async Callback Response from OOF.", isDebugEnabled)
+ logger.debug( "Error Occurred in Homing: Received an Unknown Async Callback Response from OOF.")
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Received an Unknown Async Callback Response from OOF.")
}
}
@@ -518,15 +518,15 @@ class OofUtils {
Response response = client.post(request.getBody().toString())
int responseCode = response.getStatus()
- logDebug("CatalogDB response code is: " + responseCode, isDebugEnabled)
+ logDebug("CatalogDB response code is: " + responseCode)
String syncResponse = response.readEntity(String.class)
- logDebug("CatalogDB response is: " + syncResponse, isDebugEnabled)
+ logDebug("CatalogDB response is: " + syncResponse)
if(responseCode != 202){
exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from CatalogDB.")
}
}
-
+
/**
* This method creates a HomingInstance in catalog database.
*
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy
index 15f00ac25f..259808feb6 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/PrepareUpdateAAIVfModule.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
@@ -37,11 +39,13 @@ import org.onap.so.client.graphinventory.entities.uri.Depth
import org.springframework.web.util.UriUtils
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
public class PrepareUpdateAAIVfModule extends VfModuleBase {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, PrepareUpdateAAIVfModule.class);
+ private static final Logger logger = LoggerFactory.getLogger( PrepareUpdateAAIVfModule.class);
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -76,12 +80,12 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase {
def method = getClass().getSimpleName() + '.preProcessRequest(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
def xml = execution.getVariable('PrepareUpdateAAIVfModuleRequest')
- msoLogger.debug('Received request xml:\n' + xml)
- msoLogger.debug("PrepareUpdateAAIVfModule Request : " + xml)
+ logger.debug('Received request xml:\n' + xml)
+ logger.debug("PrepareUpdateAAIVfModule Request : " + xml)
initProcessVariables(execution)
@@ -94,11 +98,11 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase {
def orchestrationStatus = getRequiredNodeText(execution, xml,'orchestration-status')
execution.setVariable('PUAAIVfMod_orchestrationStatus', orchestrationStatus)
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(e)
+ logger.error(e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage())
}
}
@@ -113,7 +117,7 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase {
def method = getClass().getSimpleName() + '.getGenericVnf(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
def vnfId = execution.getVariable('PUAAIVfMod_vnfId')
@@ -129,16 +133,16 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase {
execution.setVariable('PUAAIVfMod_getVnfResponseCode', 200)
} catch (Exception ex) {
- msoLogger.error(ex);
- msoLogger.debug('Exception occurred while executing AAI GET:' + ex.getMessage())
+ logger.error(ex);
+ logger.debug('Exception occurred while executing AAI GET:' + ex.getMessage())
execution.setVariable('PUAAIVfMod_getVnfResponseCode', 500)
execution.setVariable('PUAAIVfMod_getVnfResponse', 'AAI GET Failed:' + ex.getMessage())
}
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(e)
+ logger.error(e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in getGenericVnf(): ' + e.getMessage())
}
}
@@ -155,7 +159,7 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase {
def method = getClass().getSimpleName() + '.validateVfModule(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
GenericVnf genericVnf = execution.getVariable('PUAAIVfMod_getVnfResponse')
@@ -190,11 +194,11 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase {
}
}
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(e)
+ logger.error(e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in validateVfModule(): ' + e.getMessage())
}
}
@@ -208,7 +212,7 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase {
def method = getClass().getSimpleName() + '.updateVfModule(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
def vnfId = execution.getVariable('PUAAIVfMod_vnfId')
@@ -228,20 +232,20 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase {
// backward compatibilty, the heat-stack-id is an output
execution.setVariable('PUAAIVfMod_outVfModule', vfModule)
def vnfName = execution.getVariable('PUAAIVfMod_vnfName')
- msoLogger.debug('Output PUAAIVfMod_vnfName set to ' + vnfName)
+ logger.debug('Output PUAAIVfMod_vnfName set to ' + vnfName)
// TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead
execution.setVariable('WorkflowResponse', vfModule)
def heatStackId = vfModule.getHeatStackId()
execution.setVariable('PUAAIVfMod_heatStackId', heatStackId)
- msoLogger.debug('Output PUAAIVfMod_heatStackId set to \'' + heatStackId + '\'')
+ logger.debug('Output PUAAIVfMod_heatStackId set to \'' + heatStackId + '\'')
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
execution.setVariable('PUAAIVfMod_updateVfModuleResponseCode', 500)
throw e;
} catch (Exception e) {
- msoLogger.error(e)
+ logger.error(e)
execution.setVariable('PUAAIVfMod_updateVfModuleResponseCode', 500)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in updateVfModule(): ' + e.getMessage())
}
@@ -256,15 +260,15 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase {
def method = getClass().getSimpleName() + '.handleVnfNotFound(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
- msoLogger.error('Error occurred attempting to query AAI, Response Code ' + execution.getVariable('PUAAIVfMod_getVnfResponseCode'));
+ logger.error('Error occurred attempting to query AAI, Response Code ' + execution.getVariable('PUAAIVfMod_getVnfResponseCode'));
String processKey = getProcessKey(execution);
WorkflowException exception = new WorkflowException(processKey, 5000,
execution.getVariable('PUAAIVfMod_getVnfResponse'))
execution.setVariable('WorkflowException', exception)
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
}
/**
@@ -276,17 +280,17 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase {
def method = getClass().getSimpleName() + '.handleVfModuleValidationError(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
def String errorMsg = 'VF Module validation error: ' + execution.getVariable('PUAAIVfMod_vfModuleValidationError')
- msoLogger.error(errorMsg);
- msoLogger.debug("PrepareUpdateAAIVfModule: Error Message : " + errorMsg)
+ logger.error(errorMsg);
+ logger.debug("PrepareUpdateAAIVfModule: Error Message : " + errorMsg)
String processKey = getProcessKey(execution);
WorkflowException exception = new WorkflowException(processKey, 5000, errorMsg)
execution.setVariable('WorkflowException', exception)
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
}
/**
@@ -298,14 +302,14 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase {
def method = getClass().getSimpleName() + '.handleUpdateVfModuleFailure(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
- msoLogger.error('Error occurred attempting to update VF Module in AAI, Response Code ' + execution.getVariable('PUAAIVfMod_updateVfModuleResponseCode'));
+ logger.error('Error occurred attempting to update VF Module in AAI, Response Code ' + execution.getVariable('PUAAIVfMod_updateVfModuleResponseCode'));
String processKey = getProcessKey(execution);
WorkflowException exception = new WorkflowException(processKey, 5000,
execution.getVariable('PUAAIVfMod_updateVfModuleResponse'))
execution.setVariable('WorkflowException', exception)
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/RainyDayHandler.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/RainyDayHandler.groovy
index 0d66b8f51b..9f26cead49 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/RainyDayHandler.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/RainyDayHandler.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
@@ -32,7 +34,8 @@ import org.onap.so.client.policy.PolicyClientImpl
import org.onap.so.client.policy.entities.DictionaryData
import org.onap.so.client.policy.entities.PolicyDecision
import org.onap.so.client.policy.entities.Treatments
-import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
/**
@@ -58,7 +61,7 @@ import org.onap.so.logger.MsoLogger
*
*/
public class RainyDayHandler extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, RainyDayHandler.class);
+ private static final Logger logger = LoggerFactory.getLogger( RainyDayHandler.class);
String Prefix="RDH_"
@@ -68,44 +71,44 @@ public class RainyDayHandler extends AbstractServiceTaskProcessor {
public void preProcessRequest (DelegateExecution execution) {
String msg = ""
- msoLogger.trace("preProcessRequest of RainyDayHandler ")
+ logger.trace("preProcessRequest of RainyDayHandler ")
try {
execution.setVariable("prefix", Prefix)
// check for required input
String requestId = execution.getVariable("msoRequestId")
- msoLogger.debug("msoRequestId is: " + requestId)
+ logger.debug("msoRequestId is: " + requestId)
def serviceType = execution.getVariable("serviceType")
- msoLogger.debug("serviceType is: " + serviceType)
+ logger.debug("serviceType is: " + serviceType)
def vnfType = execution.getVariable("vnfType")
- msoLogger.debug("vnftype is: " + vnfType)
+ logger.debug("vnftype is: " + vnfType)
def currentActivity = execution.getVariable("currentActivity")
- msoLogger.debug("currentActivity is: " + currentActivity)
+ logger.debug("currentActivity is: " + currentActivity)
def workStep = execution.getVariable("workStep")
- msoLogger.debug("workStep is: " + workStep)
+ logger.debug("workStep is: " + workStep)
def failedActivity = execution.getVariable("failedActivity")
- msoLogger.debug("failedActivity is: " + failedActivity)
+ logger.debug("failedActivity is: " + failedActivity)
def errorCode = execution.getVariable("errorCode")
- msoLogger.debug("errorCode is: " + errorCode)
+ logger.debug("errorCode is: " + errorCode)
def errorText = execution.getVariable("errorText")
- msoLogger.debug("errorText is: " + errorText)
+ logger.debug("errorText is: " + errorText)
String defaultPolicyDisposition = (String) UrnPropertiesReader.getVariable("policy.default.disposition",execution)
- msoLogger.debug("defaultPolicyDisposition is: " + defaultPolicyDisposition)
+ logger.debug("defaultPolicyDisposition is: " + defaultPolicyDisposition)
execution.setVariable('defaultPolicyDisposition', defaultPolicyDisposition)
} catch (BpmnError e) {
throw e;
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit preProcessRequest of RainyDayHandler ")
+ logger.trace("Exit preProcessRequest of RainyDayHandler ")
}
public void queryPolicy (DelegateExecution execution) {
String msg = ""
- msoLogger.trace("queryPolicy of RainyDayHandler ")
+ logger.trace("queryPolicy of RainyDayHandler ")
try {
@@ -113,14 +116,14 @@ public class RainyDayHandler extends AbstractServiceTaskProcessor {
String serviceType = execution.getVariable("serviceType")
String vnfType = execution.getVariable("vnfType")
- msoLogger.debug("serviceType: " + serviceType)
- msoLogger.debug("vnfType: " + vnfType)
+ logger.debug("serviceType: " + serviceType)
+ logger.debug("vnfType: " + vnfType)
def errorCode = execution.getVariable("errorCode")
def bbId = execution.getVariable("currentActivity")
def workStep = execution.getVariable("workStep")
- msoLogger.debug("Before querying policy")
+ logger.debug("Before querying policy")
String decision = 'DENY'
String disposition = "Abort"
@@ -128,9 +131,9 @@ public class RainyDayHandler extends AbstractServiceTaskProcessor {
String defaultPolicyDisposition = (String) execution.getVariable('defaultPolicyDisposition')
if (defaultPolicyDisposition != null && !defaultPolicyDisposition.isEmpty()) {
- msoLogger.debug("Setting disposition to the configured default instead of querying Policy: " + defaultPolicyDisposition)
+ logger.debug("Setting disposition to the configured default instead of querying Policy: " + defaultPolicyDisposition)
disposition = defaultPolicyDisposition
- msoLogger.debug("Setting default allowed treatments: " + defaultAllowedTreatments)
+ logger.debug("Setting default allowed treatments: " + defaultAllowedTreatments)
execution.setVariable("validResponses", defaultAllowedTreatments)
}
else {
@@ -139,28 +142,28 @@ public class RainyDayHandler extends AbstractServiceTaskProcessor {
try {
PolicyClient policyClient = new PolicyClientImpl()
- msoLogger.debug("Created policy client")
+ logger.debug("Created policy client")
decisionObject = policyClient.getDecision(serviceType, vnfType, bbId, workStep, errorCode)
- msoLogger.debug("Obtained decision object")
+ logger.debug("Obtained decision object")
DictionaryData dictClient = policyClient.getAllowedTreatments(bbId, workStep)
Treatments treatments = dictClient.getTreatments()
String validResponses = treatments.getString()
if (validResponses != null) {
validResponses = validResponses.toLowerCase()
}
- msoLogger.debug("Obtained validResponses: " + validResponses)
+ logger.debug("Obtained validResponses: " + validResponses)
execution.setVariable("validResponses", validResponses)
} catch(Exception e) {
msg = "Exception in queryPolicy " + e.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
}
if (decisionObject != null) {
decision = decisionObject.getDecision()
disposition = decisionObject.getDetails()
- msoLogger.debug("Obtained disposition from policy engine: " + disposition)
+ logger.debug("Obtained disposition from policy engine: " + disposition)
}
else {
disposition = "Abort"
@@ -171,17 +174,17 @@ public class RainyDayHandler extends AbstractServiceTaskProcessor {
}
execution.setVariable("handlingCode", disposition)
- msoLogger.debug("Disposition: "+ disposition)
+ logger.debug("Disposition: "+ disposition)
} catch (BpmnError e) {
- msoLogger.debug("BPMN exception: " + e.errorMessage)
+ logger.debug("BPMN exception: " + e.errorMessage)
throw e;
} catch (Exception ex){
msg = "Exception in queryPolicy " + ex.getMessage()
- msoLogger.debug(msg)
+ logger.debug(msg)
//exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.trace("Exit queryPolicy of RainyDayHandler ")
+ logger.trace("Exit queryPolicy of RainyDayHandler ")
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ReceiveWorkflowMessage.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ReceiveWorkflowMessage.groovy
index 717d0df1ba..6094e457f1 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ReceiveWorkflowMessage.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ReceiveWorkflowMessage.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,12 +31,14 @@ import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
class ReceiveWorkflowMessage extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ReceiveWorkflowMessage.class);
+ private static final Logger logger = LoggerFactory.getLogger( ReceiveWorkflowMessage.class);
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -48,7 +52,7 @@ public void preProcessRequest (DelegateExecution execution) {
def method = getClass().getSimpleName() + '.preProcessRequest(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
def prefix="RCVWFMSG_"
execution.setVariable("prefix", prefix)
@@ -58,42 +62,46 @@ public void preProcessRequest (DelegateExecution execution) {
// Confirm that timeout value has been provided in 'RCVWFMSG_timeout'.
def timeout = execution.getVariable('RCVWFMSG_timeout')
- msoLogger.debug('Timeout value is \'' + timeout + '\'')
+ logger.debug('Timeout value is \'' + timeout + '\'')
if ((timeout == null) || (timeout.isEmpty())) {
String msg = getProcessKey(execution) + ': Missing or empty input variable \'RCVWFMSG_timeout\''
- msoLogger.debug(msg)
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.debug(msg)
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
// Confirm that message type has been provided in 'RCVWFMSG_messageType'
def messageType = execution.getVariable('RCVWFMSG_messageType')
- msoLogger.debug('Message type is \'' + messageType + '\'')
+ logger.debug('Message type is \'' + messageType + '\'')
if ((messageType == null) || (messageType.isEmpty())) {
String msg = getProcessKey(execution) + ': Missing or empty input variable \'RCVWFMSG_messageType\''
- msoLogger.debug(msg)
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.debug(msg)
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
// Confirm that correlator value has been provided in 'RCVWFMSG_correlator'
def correlator = execution.getVariable('RCVWFMSG_correlator')
- msoLogger.debug('Correlator value is \'' + correlator + '\'')
+ logger.debug('Correlator value is \'' + correlator + '\'')
if ((correlator == null) || (correlator.isEmpty())) {
String msg = getProcessKey(execution) + ': Missing or empty input variable \'RCVWFMSG_correlator\''
- msoLogger.debug(msg)
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.debug(msg)
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
execution.setVariable(messageType + '_CORRELATOR', correlator)
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e
} catch (Exception e) {
String msg = 'Caught exception in ' + method + ": " + e
- msoLogger.debug(msg)
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.debug(msg)
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
}
@@ -107,7 +115,7 @@ public void preProcessRequest (DelegateExecution execution) {
def method = getClass().getSimpleName() + '.processReceivedMessage(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
String messageType = null;
String receivedMessage = null;
@@ -115,18 +123,18 @@ public void preProcessRequest (DelegateExecution execution) {
try {
messageType = execution.getVariable('RCVWFMSG_messageType')
receivedMessage = execution.getVariable(messageType + '_MESSAGE')
- msoLogger.debug(getProcessKey(execution) + ": received message:\n" + receivedMessage)
+ logger.debug(getProcessKey(execution) + ": received message:\n" + receivedMessage)
// The received message is made available to the calling flow in WorkflowResponse
execution.setVariable("WorkflowResponse", receivedMessage)
setSuccessIndicator(execution, true)
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (Exception e) {
receivedMessage = receivedMessage == null || String.valueOf(receivedMessage).isEmpty() ? "NONE" : receivedMessage
String msg = "Error processing received workflow message: " + receivedMessage
- msoLogger.debug(getProcessKey(execution) + ': ' + msg)
+ logger.debug(getProcessKey(execution) + ': ' + msg)
exceptionUtil.buildWorkflowException(execution, 7020, msg)
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy
index a430cdb715..5444c6a44b 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapter.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
@@ -27,13 +29,15 @@ import org.camunda.bpm.engine.delegate.DelegateExecution
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.*
// SDNC Adapter Request/Response processing
public class SDNCAdapter extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCAdapter.class);
+ private static final Logger logger = LoggerFactory.getLogger( SDNCAdapter.class);
def Prefix="SDNCA_"
@@ -46,8 +50,8 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor {
public void preProcessRequest (DelegateExecution execution) {
try{
- msoLogger.trace("Begin PreProcess SDNCAdapterRequestScript ")
- msoLogger.debug("Incoming sdncAdapterWorkflowRequest:\n" + execution.getVariable("sdncAdapterWorkflowRequest"))
+ logger.trace("Begin PreProcess SDNCAdapterRequestScript ")
+ logger.debug("Incoming sdncAdapterWorkflowRequest:\n" + execution.getVariable("sdncAdapterWorkflowRequest"))
// Initialize some variables used throughout the flow
execution.setVariable("prefix", Prefix)
@@ -69,7 +73,9 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor {
def encodedString = utils.getBasicAuth(basicAuthValue, UrnPropertiesReader.getVariable("mso.msoKey", execution))
execution.setVariable("BasicAuthHeaderValue",encodedString)
} catch (IOException ex) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Unable to encode username password string", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ "Unable to encode username password string", "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue());
}
// TODO Use variables instead of passing xml request - Huh?
@@ -87,27 +93,27 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor {
if((useQualifiedHostName!=null) && (useQualifiedHostName.equals("true"))){
callbackUrlToUse = msoUtil.getQualifiedHostNameForCallback(callbackUrlToUse)
}
- msoLogger.debug("Callback URL to use:\n" + callbackUrlToUse)
+ logger.debug("Callback URL to use:\n" + callbackUrlToUse)
requestHeader = requestHeader.replace(origCallbackUrl, callbackUrlToUse)
// Get parameters from request header
def sdnca_svcInstanceId = utils.getNodeText(requestHeader, "SvcInstanceId") // optional
- msoLogger.debug("SvcInstanceId: " + sdnca_svcInstanceId)
+ logger.debug("SvcInstanceId: " + sdnca_svcInstanceId)
def sdnca_msoAction = utils.getNodeText(requestHeader, "MsoAction") // optional
- msoLogger.debug("MsoAction: " + sdnca_msoAction)
+ logger.debug("MsoAction: " + sdnca_msoAction)
def sdnca_svcAction = utils.getNodeText(requestHeader, "SvcAction")
- msoLogger.debug("SvcAction: " + sdnca_svcAction)
+ logger.debug("SvcAction: " + sdnca_svcAction)
def sdnca_svcOperation = utils.getNodeText(requestHeader, "SvcOperation")
- msoLogger.debug("SvcOperation: " + sdnca_svcOperation)
+ logger.debug("SvcOperation: " + sdnca_svcOperation)
def sdncRequestData = utils.getChildNodes(sdncwfreq, "SDNCRequestData")
sdncRequestData = sdncRequestData.replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n", "")
sdncRequestData = sdncRequestData.replaceAll('tag0:', '').replaceAll(':tag0', '')
- msoLogger.debug("SDNCRequestData:\n" + sdncRequestData)
+ logger.debug("SDNCRequestData:\n" + sdncRequestData)
def sdnca_serviceType = ""
if (utils.nodeExists(sdncwfreq, "service-type")) {
sdnca_serviceType = utils.getNodeText(sdncwfreq, "service-type")
}
- msoLogger.debug("service-type: " + sdnca_serviceType)
+ logger.debug("service-type: " + sdnca_serviceType)
def serviceConfigActivate = false
def source = ''
if ((sdnca_svcAction == 'activate') && (sdnca_svcOperation == 'service-configuration-operation') && (sdnca_serviceType == 'uCPE-VMS')) {
@@ -117,9 +123,9 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor {
}
}
execution.setVariable("serviceConfigActivate", serviceConfigActivate)
- msoLogger.debug("serviceConfigActivate: " + serviceConfigActivate)
+ logger.debug("serviceConfigActivate: " + serviceConfigActivate)
execution.setVariable("source", source)
- msoLogger.debug("source: " + source)
+ logger.debug("source: " + source)
//calling process should pass a generated uuid if sending multiple sdnc requests
def sdncRequestId = utils.getNodeText(requestHeader, "RequestId")
@@ -155,22 +161,22 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor {
${sdncRequestData}
</sdncadaptersc:RequestData></aetgt:SDNCAdapterRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>"""
- msoLogger.debug("Outgoing SDNCAdapterRequest:\n" + sdncAdapterRequest)
+ logger.debug("Outgoing SDNCAdapterRequest:\n" + sdncAdapterRequest)
execution.setVariable("sdncAdapterRequest", sdncAdapterRequest)
- msoLogger.debug(UrnPropertiesReader.getVariable("mso.adapters.sdnc.endpoint", execution))
+ logger.debug(UrnPropertiesReader.getVariable("mso.adapters.sdnc.endpoint", execution))
}catch(Exception e){
- msoLogger.debug('Internal Error occured during PreProcess Method: ', e)
+ logger.debug('Internal Error occured during PreProcess Method: ', e)
exceptionUtil.buildAndThrowWorkflowException(execution, 9999, 'Internal Error occured during PreProcess Method') // TODO: what message and error code?
}
- msoLogger.trace("End pre Process SDNCRequestScript ")
+ logger.trace("End pre Process SDNCRequestScript ")
}
public void postProcessResponse (DelegateExecution execution) {
try{
- msoLogger.trace("Begin POSTProcess SDNCAdapter ")
- msoLogger.trace("Incoming sdncAdapterCallbackRequest:\n" + execution.getVariable("sdncAdapterCallbackRequest"))
+ logger.trace("Begin POSTProcess SDNCAdapter ")
+ logger.trace("Incoming sdncAdapterCallbackRequest:\n" + execution.getVariable("sdncAdapterCallbackRequest"))
// Check the sdnccallback request and get the responsecode
def sdnccallbackreq = execution.getVariable("sdncAdapterCallbackRequest")
@@ -185,7 +191,7 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor {
callbackRequestData = callbackRequestData.replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n", "")
- msoLogger.trace("EnhancedCallbackRequestData:\n" + callbackRequestData)
+ logger.trace("EnhancedCallbackRequestData:\n" + callbackRequestData)
execution.setVariable("enhancedCallbackRequestData", callbackRequestData)
String sdncAdapterWorkflowResponse ="""
@@ -210,25 +216,25 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor {
}
}
execution.setVariable("continueListening", continueListening)
- msoLogger.debug("Continue Listening: " + continueListening)
+ logger.debug("Continue Listening: " + continueListening)
execution.setVariable("asynchronousResponseTimeout", false)
}else{
// Timed out waiting for asynchronous message, build error response
exceptionUtil.buildWorkflowException(execution, 500, "SDNC Callback Timeout Error")
execution.setVariable("asynchronousResponseTimeout", true)
- msoLogger.debug("Timed out waiting for asynchronous message")
+ logger.debug("Timed out waiting for asynchronous message")
}
}catch(Exception e){
- msoLogger.debug('Internal Error occured during PostProcess Method: ' + e)
+ logger.debug('Internal Error occured during PostProcess Method: ' + e)
exceptionUtil.buildAndThrowWorkflowException(execution, 9999, 'Internal Error occured during PostProcess Method') // TODO: what message and error code?
}
- msoLogger.trace("End POSTProcess SDNCAdapter ")
+ logger.trace("End POSTProcess SDNCAdapter ")
}
public void callbackResponsecheck(DelegateExecution execution){
def sdnccallbackreq=execution.getVariable("sdncAdapterCallbackRequest")
- msoLogger.debug("sdncAdapterCallbackRequest :" + sdnccallbackreq)
+ logger.debug("sdncAdapterCallbackRequest :" + sdnccallbackreq)
if (sdnccallbackreq==null){
execution.setVariable("callbackResponseReceived",false);
}else{
@@ -238,14 +244,14 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor {
public void resetCallbackRequest(DelegateExecution execution) {
- msoLogger.trace("Begin Reset Callback Info SDNCAdapter ")
+ logger.trace("Begin Reset Callback Info SDNCAdapter ")
// Clear sdncAdapterCallbackRequest variable
execution.removeVariable("sdncAdapterCallbackRequest")
// Determine and set SDNC Timeout Value
def enhancedCallbackRequestData = execution.getVariable("enhancedCallbackRequestData")
- msoLogger.debug("sdncAdapter - enhancedCallbackRequestData :" + enhancedCallbackRequestData)
+ logger.debug("sdncAdapter - enhancedCallbackRequestData :" + enhancedCallbackRequestData)
def interim = false
if (enhancedCallbackRequestData != null) {
if (utils.nodeExists(enhancedCallbackRequestData, "ack-final-indicator")) {
@@ -264,15 +270,15 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor {
timeoutValue = "PT" + utils.getNodeText(sdncAdapterWorkflowRequest, "SDNCTimeOutValueInMinutes") + "M"
}
execution.setVariable("sdncTimeoutValue", timeoutValue)
- msoLogger.debug("Setting SDNC Timeout Value to " + timeoutValue)
+ logger.debug("Setting SDNC Timeout Value to " + timeoutValue)
- msoLogger.trace("End Reset Callback Info SDNCAdapter ")
+ logger.trace("End Reset Callback Info SDNCAdapter ")
}
public void prepareDBMessage(DelegateExecution execution) {
- msoLogger.trace("Begin Prepare DB Message SDNCAdapter ")
+ logger.trace("Begin Prepare DB Message SDNCAdapter ")
// Create DB Message
def dbRequestId = execution.getVariable("mso-request-id")
@@ -289,9 +295,9 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor {
"""
execution.setVariable("dbUpdateInterimStageCompletion", dbUpdateInterimStageCompletion)
- msoLogger.debug("sdncAdapter - dbUpdateInterimStageCompletion :" + dbUpdateInterimStageCompletion)
- msoLogger.debug("DB UpdateInterimStageCompletion:\n" + dbUpdateInterimStageCompletion)
- msoLogger.trace("End Prepare DB Message SDNCAdapter ")
+ logger.debug("sdncAdapter - dbUpdateInterimStageCompletion :" + dbUpdateInterimStageCompletion)
+ logger.debug("DB UpdateInterimStageCompletion:\n" + dbUpdateInterimStageCompletion)
+ logger.trace("End Prepare DB Message SDNCAdapter ")
}
public String generateCurrentTimeInUtc(){
@@ -303,11 +309,11 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor {
public void toggleSuccessIndicator(DelegateExecution execution){
execution.setVariable("SDNCA_SuccessIndicator", true)
- msoLogger.debug("Setting SDNCA Success Indicator to True")
+ logger.debug("Setting SDNCA Success Indicator to True")
}
public void assignError(DelegateExecution execution){
- msoLogger.trace("Started Assign Error ")
+ logger.trace("Started Assign Error ")
WorkflowException wf = execution.getVariable("WorkflowException")
if(wf == null){
exceptionUtil.buildWorkflowException(execution, 5000, "SDNCAdapter Encountered an Internal Error") // TODO: Not sure what message and error code we want here.....
@@ -315,17 +321,17 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor {
execution.setVariable("WorkflowException", wf)
}
- msoLogger.debug("Outgoing WorkflowException is: " + execution.getVariable("WorkflowException"))
- msoLogger.trace("End Assign Error ")
+ logger.debug("Outgoing WorkflowException is: " + execution.getVariable("WorkflowException"))
+ logger.trace("End Assign Error ")
}
public void setTimeout(DelegateExecution execution){
- msoLogger.trace("Started SetTimeout ")
- msoLogger.debug("Timer expired, telling correlation service to stop listening")
+ logger.trace("Started SetTimeout ")
+ logger.debug("Timer expired, telling correlation service to stop listening")
execution.setVariable("asynchronousResponseTimeout", true)
- msoLogger.debug("Timed out branch sleeping for one second to give success branch a chance to complete if running")
+ logger.debug("Timed out branch sleeping for one second to give success branch a chance to complete if running")
Thread.sleep(1000)
- msoLogger.trace("End SetTimeout ")
+ logger.trace("End SetTimeout ")
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy
index 9f1570ee15..1f39a5eac9 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.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
@@ -42,13 +44,15 @@ import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.client.HttpClient
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import org.onap.so.utils.TargetEntity
class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCAdapterRestV1.class);
+ private static final Logger logger = LoggerFactory.getLogger( SDNCAdapterRestV1.class);
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -61,7 +65,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
def method = getClass().getSimpleName() + '.preProcessRequest(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
def prefix="SDNCREST_"
execution.setVariable("prefix", prefix)
@@ -73,7 +77,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
String request = validateRequest(execution, "mso-request-id")
String requestType = jsonUtil.getJsonRootProperty(request)
execution.setVariable(prefix + 'requestType', requestType)
- msoLogger.debug(getProcessKey(execution) + ': ' + prefix + 'requestType = ' + requestType)
+ logger.debug(getProcessKey(execution) + ': ' + prefix + 'requestType = ' + requestType)
// Determine the SDNCAdapter endpoint
@@ -81,8 +85,9 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
if (sdncAdapterEndpoint == null || sdncAdapterEndpoint.isEmpty()) {
String msg = getProcessKey(execution) + ': mso:adapters:sdnc:rest:endpoint URN mapping is not defined'
- msoLogger.debug(msg)
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.debug(msg)
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -101,13 +106,14 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
if (sdncRequestId == null || sdncRequestId.isEmpty()) {
String msg = getProcessKey(execution) + ': no sdncRequestId in ' + requestType
- msoLogger.debug(msg)
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.debug(msg)
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
execution.setVariable('SDNCAResponse_CORRELATOR', sdncRequestId)
- msoLogger.debug(getProcessKey(execution) + ': SDNCAResponse_CORRELATOR = ' + sdncRequestId)
+ logger.debug(getProcessKey(execution) + ': SDNCAResponse_CORRELATOR = ' + sdncRequestId)
// Get the bpNotificationUrl from the request (just to make sure it's there)
@@ -115,8 +121,9 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
if (bpNotificationUrl == null || bpNotificationUrl.isEmpty()) {
String msg = getProcessKey(execution) + ': no bpNotificationUrl in ' + requestType
- msoLogger.debug(msg)
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.debug(msg)
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -131,8 +138,9 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
} else {
String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType
- msoLogger.debug(msg)
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.debug(msg)
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -145,15 +153,19 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
String basicAuthValue = UrnPropertiesReader.getVariable("mso.adapters.po.auth", execution)
if (basicAuthValue == null || basicAuthValue.isEmpty()) {
- msoLogger.debug(getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined")
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.debug(getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined")
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined", "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
} else {
try {
def encodedString = utils.getBasicAuth(basicAuthValue, UrnPropertiesReader.getVariable("mso.msoKey", execution))
execution.setVariable(prefix + 'basicAuthHeaderValue', encodedString)
} catch (IOException ex) {
- msoLogger.debug(getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter")
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.debug(getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter")
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter",
+ "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
}
}
@@ -165,7 +177,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
// in addition to null/empty, also need to verify that the timer value is a valid duration "P[n]T[n]H|M|S"
String timerRegex = "PT[0-9]+[HMS]";
if (timeout == null || timeout.isEmpty() || !timeout.matches(timerRegex)) {
- msoLogger.debug(getProcessKey(execution) + ': preProcessRequest(): null/empty/invalid bpTimeout value. Using "mso.adapters.sdnc.timeout"')
+ logger.debug(getProcessKey(execution) + ': preProcessRequest(): null/empty/invalid bpTimeout value. Using "mso.adapters.sdnc.timeout"')
timeout = UrnPropertiesReader.getVariable("mso.adapters.sdnc.timeout", execution)
}
@@ -177,13 +189,14 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
}
execution.setVariable(prefix + 'timeout', timeout)
- msoLogger.debug(getProcessKey(execution) + ': ' + prefix + 'timeout = ' + timeout)
+ logger.debug(getProcessKey(execution) + ': ' + prefix + 'timeout = ' + timeout)
} catch (BpmnError e) {
throw e
} catch (Exception e) {
String msg = 'Caught exception in ' + method + ": " + e
- msoLogger.debug(msg)
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.debug(msg)
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
}
@@ -195,17 +208,17 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
def method = getClass().getSimpleName() + '.sendRequestToSDNCAdapter(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
String prefix = execution.getVariable('prefix')
try {
String sdncAdapterMethod = execution.getVariable(prefix + 'sdncAdapterMethod')
- msoLogger.debug("SDNC Method is: " + sdncAdapterMethod)
+ logger.debug("SDNC Method is: " + sdncAdapterMethod)
String sdncAdapterUrl = execution.getVariable(prefix + 'sdncAdapterUrl')
- msoLogger.debug("SDNC Url is: " + sdncAdapterUrl)
+ logger.debug("SDNC Url is: " + sdncAdapterUrl)
String sdncAdapterRequest = execution.getVariable(prefix + 'sdncAdapterRequest')
- msoLogger.debug("SDNC Rest Request is: " + sdncAdapterRequest)
+ logger.debug("SDNC Rest Request is: " + sdncAdapterRequest)
URL url = new URL(sdncAdapterUrl);
@@ -229,8 +242,9 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
response = httpClient.delete(sdncAdapterRequest)
} else {
String msg = 'Unsupported HTTP method "' + sdncAdapterMethod + '" in ' + method + ": " + e
- msoLogger.debug(msg)
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.debug(msg)
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -242,8 +256,9 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
throw e
} catch (Exception e) {
String msg = 'Caught exception in ' + method + ": " + e
- msoLogger.debug(msg, e)
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.debug(msg, e)
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
}
@@ -255,14 +270,14 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
def method = getClass().getSimpleName() + '.processCallback(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
String prefix = execution.getVariable('prefix')
String callback = execution.getVariable('SDNCAResponse_MESSAGE')
String requestId = execution.getVariable("mso-request-id");
String serviceInstanceId = execution.getVariable("mso-service-instance-id")
utils.logContext(requestId, serviceInstanceId)
- msoLogger.debug("Incoming SDNC Rest Callback is: " + callback)
+ logger.debug("Incoming SDNC Rest Callback is: " + callback)
try {
int callbackNumber = 1
@@ -290,7 +305,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
} catch (Exception e) {
callback = callback == null || String.valueOf(callback).isEmpty() ? "NONE" : callback
String msg = "Received error from SDNCAdapter: " + callback
- msoLogger.debug(getProcessKey(execution) + ': ' + msg)
+ logger.debug(getProcessKey(execution) + ': ' + msg)
exceptionUtil.buildWorkflowException(execution, 5300, msg)
}
}
@@ -333,7 +348,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
def method = getClass().getSimpleName() + '.getLastCallback(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
String prefix = execution.getVariable('prefix')
@@ -355,8 +370,9 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
return callback
} catch (Exception e) {
String msg = 'Caught exception in ' + method + ": " + e
- msoLogger.debug(msg)
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.debug(msg)
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
}
@@ -368,7 +384,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
def method = getClass().getSimpleName() + '.setTimeoutValue(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
String prefix = execution.getVariable('prefix')
@@ -380,8 +396,9 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
}
} catch (Exception e) {
String msg = 'Caught exception in ' + method + ": " + e
- msoLogger.debug(msg)
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.debug(msg)
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy
index 1a20497bbc..64f54dbd66 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV2.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
@@ -37,6 +39,8 @@ 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.slf4j.Logger
+import org.slf4j.LoggerFactory
@@ -45,7 +49,7 @@ import org.onap.so.logger.MsoLogger
* any non-final response received from SDNC.
*/
class SDNCAdapterRestV2 extends SDNCAdapterRestV1 {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCAdapterRestV2.class);
+ private static final Logger logger = LoggerFactory.getLogger( SDNCAdapterRestV2.class);
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -58,7 +62,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 {
def method = getClass().getSimpleName() + '.preProcessRequest(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
def prefix="SDNCREST_"
execution.setVariable("prefix", prefix)
@@ -70,8 +74,8 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 {
String request = validateRequest(execution, "mso-request-id")
String requestType = jsonUtil.getJsonRootProperty(request)
execution.setVariable(prefix + 'requestType', requestType)
- msoLogger.debug(getProcessKey(execution) + ': ' + prefix + 'requestType = ' + requestType)
- msoLogger.debug('SDNCAdapterRestV2, request: ' + request)
+ logger.debug(getProcessKey(execution) + ': ' + prefix + 'requestType = ' + requestType)
+ logger.debug('SDNCAdapterRestV2, request: ' + request)
// Determine the SDNCAdapter endpoint
@@ -79,8 +83,9 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 {
if (sdncAdapterEndpoint == null || sdncAdapterEndpoint.isEmpty()) {
String msg = getProcessKey(execution) + ': mso:adapters:sdnc:rest:endpoint URN mapping is not defined'
- msoLogger.debug(msg)
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.debug(msg)
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -99,13 +104,14 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 {
if (sdncRequestId == null || sdncRequestId.isEmpty()) {
String msg = getProcessKey(execution) + ': no sdncRequestId in ' + requestType
- msoLogger.debug(msg)
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.debug(msg)
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
execution.setVariable('SDNCAResponse_CORRELATOR', sdncRequestId)
- msoLogger.debug(getProcessKey(execution) + ': SDNCAResponse_CORRELATOR = ' + sdncRequestId)
+ logger.debug(getProcessKey(execution) + ': SDNCAResponse_CORRELATOR = ' + sdncRequestId)
// Get the bpNotificationUrl from the request (just to make sure it's there)
@@ -113,8 +119,9 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 {
if (bpNotificationUrl == null || bpNotificationUrl.isEmpty()) {
String msg = getProcessKey(execution) + ': no bpNotificationUrl in ' + requestType
- msoLogger.debug(msg)
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.debug(msg)
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -123,32 +130,37 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 {
} else {
String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType
- msoLogger.debug(msg)
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.debug(msg)
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
execution.setVariable(prefix + 'sdncAdapterMethod', sdncAdapterMethod)
- msoLogger.debug(getProcessKey(execution) + ': ' + prefix + 'sdncAdapterMethod = ' + sdncAdapterMethod)
+ logger.debug(getProcessKey(execution) + ': ' + prefix + 'sdncAdapterMethod = ' + sdncAdapterMethod)
execution.setVariable(prefix + 'sdncAdapterUrl', sdncAdapterUrl)
- msoLogger.debug(getProcessKey(execution) + ': ' + prefix + 'sdncAdapterUrl = ' + sdncAdapterUrl)
+ logger.debug(getProcessKey(execution) + ': ' + prefix + 'sdncAdapterUrl = ' + sdncAdapterUrl)
execution.setVariable(prefix + 'sdncAdapterRequest', sdncAdapterRequest)
- msoLogger.debug(getProcessKey(execution) + ': ' + prefix + 'sdncAdapterRequest = \n' + sdncAdapterRequest)
+ logger.debug(getProcessKey(execution) + ': ' + prefix + 'sdncAdapterRequest = \n' + sdncAdapterRequest)
// Get the Basic Auth credentials for the SDNCAdapter (yes... we ARE using the PO adapters credentials)
String basicAuthValue = UrnPropertiesReader.getVariable("mso.adapters.po.auth",execution)
if (basicAuthValue == null || basicAuthValue.isEmpty()) {
- msoLogger.debug(getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined")
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.debug(getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined")
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined", "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
} else {
try {
def encodedString = utils.getBasicAuth(basicAuthValue, UrnPropertiesReader.getVariable("mso.msoKey", execution))
execution.setVariable(prefix + 'basicAuthHeaderValue', encodedString)
} catch (IOException ex) {
- msoLogger.debug(getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter")
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.debug(getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter")
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter",
+ "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
}
}
@@ -160,25 +172,26 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 {
// in addition to null/empty, also need to verify that the timer value is a valid duration "P[n]T[n]H|M|S"
String timerRegex = "PT[0-9]+[HMS]";
if (timeout == null || timeout.isEmpty() || !timeout.matches(timerRegex)) {
- msoLogger.debug(getProcessKey(execution) + ': preProcessRequest(): null/empty/invalid bpTimeout value. Using "mso.adapters.sdnc.timeout"')
+ logger.debug(getProcessKey(execution) + ': preProcessRequest(): null/empty/invalid bpTimeout value. Using "mso.adapters.sdnc.timeout"')
timeout = UrnPropertiesReader.getVariable("mso.adapters.sdnc.timeout", execution)
}
// the timeout could still be null at this point if the config parm is missing/undefined
// forced to log (so OPs can fix the config) and temporarily use a hard coded value of 10 seconds
if (timeout == null) {
- msoLogger.warnSimple('preProcessRequest()', 'property "mso.adapters.sdnc.timeout" is missing/undefined. Using "PT10S"')
+ logger.warn("Service Name: {} Error: {}", 'preProcessRequest()', 'property "mso.adapters.sdnc.timeout" is missing/undefined. Using "PT10S"')
timeout = "PT10S"
}
execution.setVariable(prefix + 'timeout', timeout)
- msoLogger.debug(getProcessKey(execution) + ': ' + prefix + 'timeout = ' + timeout)
+ logger.debug(getProcessKey(execution) + ': ' + prefix + 'timeout = ' + timeout)
} catch (BpmnError e) {
throw e
} catch (Exception e) {
String msg = 'Caught exception in ' + method + ": " + e
- msoLogger.debug(msg)
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.debug(msg)
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
}
@@ -190,14 +203,14 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 {
def method = getClass().getSimpleName() + '.processCallback(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
String prefix = execution.getVariable('prefix')
String callback = execution.getVariable('SDNCAResponse_MESSAGE')
- msoLogger.debug("Incoming SDNC Rest Callback is: " + callback)
+ logger.debug("Incoming SDNC Rest Callback is: " + callback)
try {
- msoLogger.debug(getProcessKey(execution) + ": received callback:\n" + callback)
+ logger.debug(getProcessKey(execution) + ": received callback:\n" + callback)
int callbackNumber = 1
while (execution.getVariable(prefix + 'callback' + callbackNumber) != null) {
@@ -236,7 +249,7 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 {
} catch (Exception e) {
callback = callback == null || String.valueOf(callback).isEmpty() ? "NONE" : callback
String msg = "Received error from SDNCAdapter: " + callback
- msoLogger.debug(getProcessKey(execution) + ': ' + msg)
+ logger.debug(getProcessKey(execution) + ': ' + msg)
exceptionUtil.buildWorkflowException(execution, 5300, msg)
}
}
@@ -250,14 +263,14 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 {
def method = getClass().getSimpleName() + '.prepareInterimNotification(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
String prefix = execution.getVariable('prefix')
- msoLogger.debug("Preparing Interim Notification")
+ logger.debug("Preparing Interim Notification")
try {
def interimNotification = execution.getVariable(prefix + "interimNotification")
- msoLogger.debug("Preparing Interim Notification:\n" + JsonUtils.prettyJson(interimNotification))
+ logger.debug("Preparing Interim Notification:\n" + JsonUtils.prettyJson(interimNotification))
for (int i = 0; ; i++) {
def variable = JsonUtils.getJsonParamValue(interimNotification, 'variableList', 'variable', i)
@@ -270,13 +283,13 @@ class SDNCAdapterRestV2 extends SDNCAdapterRestV1 {
if ((variableName != null) && !variableName.isEmpty()) {
def variableValue = JsonUtils.getJsonValue(variable, "value")
execution.setVariable(variableName, variableValue)
- msoLogger.debug("Setting "+ variableName + "=" + variableValue)
+ logger.debug("Setting "+ variableName + "=" + variableValue)
}
}
} catch (Exception e) {
String msg = "Error preparing interim notification"
- msoLogger.debug(getProcessKey(execution) + ': ' + msg)
+ logger.debug(getProcessKey(execution) + ': ' + msg)
exceptionUtil.buildWorkflowException(execution, 5300, msg)
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy
index bed857dda8..b5ea12b85a 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.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.springframework.web.util.UriUtils
import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
@@ -38,7 +42,7 @@ import org.onap.so.logger.MsoLogger
*
*/
class SDNCAdapterUtils {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SDNCAdapterUtils.class);
+ private static final Logger logger = LoggerFactory.getLogger( SDNCAdapterUtils.class);
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -259,7 +263,9 @@ class SDNCAdapterUtils {
def callbackUrl = (String)UrnPropertiesReader.getVariable('mso.workflow.sdncadapter.callback',execution)
if (callbackUrl == null || callbackUrl.trim() == "") {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'mso:workflow:sdncadapter:callback URN is not set', "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'mso:workflow:sdncadapter:callback URN is not set', "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue());
workflowException(execution, 'Internal Error', 9999) // TODO: what message and error code?
}
@@ -373,7 +379,7 @@ class SDNCAdapterUtils {
', additionalData=' + (additionalData == null ? "no" : "yes") +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
MsoUtils utils = taskProcessor.utils
try {
def prefix = execution.getVariable('prefix')
@@ -395,7 +401,9 @@ class SDNCAdapterUtils {
def callbackUrl = (String)UrnPropertiesReader.getVariable('mso.workflow.sdncadapter.callback',execution)
if (callbackUrl == null || callbackUrl.trim() == "") {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, 'mso:workflow:sdncadapter:callback URN is not set', "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ 'mso:workflow:sdncadapter:callback URN is not set', "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Internal Error - During PreProcess Request")
}
@@ -460,13 +468,15 @@ class SDNCAdapterUtils {
content = utils.removeXmlPreamble(utils.formatXML(content))
execution.setVariable(resultVar, content)
- msoLogger.debug(resultVar + ' = ' + System.lineSeparator() + content)
+ logger.debug(resultVar + ' = ' + System.lineSeparator() + content)
- msoLogger.trace('Exited ' + method)
+ 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, 5000, "Internal Error")
}
}
@@ -783,17 +793,17 @@ class SDNCAdapterUtils {
* @param workflowException the WorkflowException Object returned from sdnc call
*/
public void validateSDNCResponse(DelegateExecution execution, String response, WorkflowException workflowException, boolean successIndicator){
- msoLogger.debug("SDNC Response is: " + response)
- msoLogger.debug("SuccessIndicator is: " + successIndicator)
+ logger.debug("SDNC Response is: " + response)
+ logger.debug("SuccessIndicator is: " + successIndicator)
try {
def prefix = execution.getVariable('prefix')
execution.setVariable(prefix+'sdncResponseSuccess', false)
- msoLogger.debug("Response" + ' = ' + (response == null ? "" : System.lineSeparator()) + response)
+ logger.debug("Response" + ' = ' + (response == null ? "" : System.lineSeparator()) + response)
if (successIndicator){
if (response == null || response.trim().equals("")) {
- msoLogger.debug(response + ' is empty');
+ logger.debug(response + ' is empty');
exceptionUtil.buildAndThrowWorkflowException(execution, 500, "SDNCAdapter Workflow Response is Empty")
}else{
@@ -801,7 +811,7 @@ class SDNCAdapterUtils {
def String sdncAdapterWorkflowResponse = taskProcessor.utils.getNodeXml(response, 'response-data', false)
def String decodedXml = sdncAdapterWorkflowResponse.replace('<?xml version="1.0" encoding="UTF-8"?>', "")
decodedXml = taskProcessor.utils.getNodeXml(response, 'RequestData')
- msoLogger.debug("decodedXml:\n" + decodedXml)
+ logger.debug("decodedXml:\n" + decodedXml)
int requestDataResponseCode = 200
def String requestDataResponseMessage = ''
@@ -813,33 +823,33 @@ class SDNCAdapterUtils {
requestDataResponseMessage = taskProcessor.utils.getNodeText(sdncAdapterWorkflowResponse, "ResponseMessage")
}
}catch(Exception e){
- msoLogger.debug('Error caught while decoding resposne ' + e.getMessage())
+ logger.debug('Error caught while decoding resposne ' + e.getMessage())
}
if(taskProcessor.utils.nodeExists(decodedXml, "response-code")) {
- msoLogger.debug("response-code node Exist ")
+ logger.debug("response-code node Exist ")
String code = taskProcessor.utils.getNodeText(decodedXml, "response-code")
if(code.isEmpty() || code.equals("")){
// if response-code is blank then Success
- msoLogger.debug("response-code node is empty")
+ logger.debug("response-code node is empty")
requestDataResponseCode = 0
}else{
requestDataResponseCode = code.toInteger()
- msoLogger.debug("response-code is: " + requestDataResponseCode)
+ logger.debug("response-code is: " + requestDataResponseCode)
}
}else if(taskProcessor.utils.nodeExists(sdncAdapterWorkflowResponse, "ResponseCode")){
- msoLogger.debug("ResponseCode node Exist ")
+ logger.debug("ResponseCode node Exist ")
String code = taskProcessor.utils.getNodeText(sdncAdapterWorkflowResponse, "ResponseCode")
if(code.isEmpty() || code.equals("")){
// if ResponseCode blank then Success
- msoLogger.debug("ResponseCode node is empty")
+ logger.debug("ResponseCode node is empty")
requestDataResponseCode = 0
}else{
requestDataResponseCode = code.toInteger()
- msoLogger.debug("ResponseCode is: " + requestDataResponseCode)
+ logger.debug("ResponseCode is: " + requestDataResponseCode)
}
}else{
- msoLogger.debug("A Response Code DOES NOT Exist.")
+ logger.debug("A Response Code DOES NOT Exist.")
// if a response code does not exist then Success
requestDataResponseCode = 0
}
@@ -849,8 +859,8 @@ class SDNCAdapterUtils {
// if a response code is 0 or 2XX then Success
if ((requestDataResponseCode >= 200 && requestDataResponseCode <= 299) || requestDataResponseCode == 0) {
execution.setVariable(prefix+'sdncResponseSuccess', true)
- msoLogger.debug("Setting sdncResponseSuccess to True ")
- msoLogger.debug("Exited ValidateSDNCResponse Method")
+ logger.debug("Setting sdncResponseSuccess to True ")
+ logger.debug("Exited ValidateSDNCResponse Method")
}else{
ExceptionUtil exceptionUtil = new ExceptionUtil()
String convertedCode = exceptionUtil.MapSDNCResponseCodeToErrorCode(requestDataResponseCode.toString())
@@ -863,12 +873,12 @@ class SDNCAdapterUtils {
requestDataResponseCode = 500
}
- msoLogger.debug("SDNC callback response-code: " + requestDataResponseCode)
- msoLogger.debug("SDNC callback response-message: " + requestDataResponseMessage)
+ logger.debug("SDNC callback response-code: " + requestDataResponseCode)
+ logger.debug("SDNC callback response-message: " + requestDataResponseMessage)
}
}else {
- msoLogger.debug('SDNCAdapter Subflow did NOT complete Successfully. SuccessIndicator is False. ')
+ logger.debug('SDNCAdapter Subflow did NOT complete Successfully. SuccessIndicator is False. ')
if(workflowException != null){
exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage())
}else{
@@ -880,7 +890,7 @@ class SDNCAdapterUtils {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.debug('END of Validate SDNC Response')
+ logger.debug('END of Validate SDNC Response')
exceptionUtil.buildAndThrowWorkflowException(execution, 500, 'Internal Error- Unable to validate SDNC Response ');
}
}
@@ -897,20 +907,20 @@ class SDNCAdapterUtils {
'execution=' + execution.getId() +
', response=' + response +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
def prefix = execution.getVariable('prefix')
TrinityExceptionUtil trinityExceptionUtil = new TrinityExceptionUtil()
try {
execution.setVariable(prefix+'sdncResponseSuccess', false)
- msoLogger.debug("sdncAdapter Success Indicator is: " + success)
+ logger.debug("sdncAdapter Success Indicator is: " + success)
if (success) {
// we need to look inside the request data for error
def String callbackRequestData = taskProcessor.utils.getNodeXml(response, 'RequestData', false)
def String decodedXml = callbackRequestData
- msoLogger.debug("decodedXml:\n" + decodedXml)
+ logger.debug("decodedXml:\n" + decodedXml)
def requestDataResponseCode = '200'
def requestDataResponseMessage = ''
@@ -929,29 +939,29 @@ class SDNCAdapterUtils {
requestDataResponseMessage = taskProcessor.utils.getNodeText(response, "ResponseMessage")
}
- msoLogger.debug("SDNC callback response-code: " + requestDataResponseCode)
- msoLogger.debug("SDNC callback response-message: " + requestDataResponseMessage)
+ logger.debug("SDNC callback response-code: " + requestDataResponseCode)
+ logger.debug("SDNC callback response-message: " + requestDataResponseMessage)
// Get the AAI Status to determine if rollback is needed on ASSIGN
def aai_status = ''
if (taskProcessor.utils.nodeExists(decodedXml, "aai-status")) {
aai_status = ((String) taskProcessor.utils.getNodeText(decodedXml, "aai-status"))
- msoLogger.debug("SDNC sent AAI STATUS code: " + aai_status)
+ logger.debug("SDNC sent AAI STATUS code: " + aai_status)
}
if (aai_status != null && !aai_status.equals("")) {
execution.setVariable(prefix+"AaiStatus",aai_status)
- msoLogger.debug("Set variable " + prefix + "AaiStatus: " + execution.getVariable(prefix+"AaiStatus"))
+ logger.debug("Set variable " + prefix + "AaiStatus: " + execution.getVariable(prefix+"AaiStatus"))
}
// Get the result string to determine if rollback is needed on ASSIGN in Add Bonding flow only
def sdncResult = ''
if (taskProcessor.utils.nodeExists(decodedXml, "result")) {
sdncResult = ((String) taskProcessor.utils.getNodeText(decodedXml, "result"))
- msoLogger.debug("SDNC sent result: " + sdncResult)
+ logger.debug("SDNC sent result: " + sdncResult)
}
if (sdncResult != null && !sdncResult.equals("")) {
execution.setVariable(prefix+"SdncResult",sdncResult)
- msoLogger.debug("Set variable " + prefix + "SdncResult: " + execution.getVariable(prefix+"SdncResult"))
+ logger.debug("Set variable " + prefix + "SdncResult: " + execution.getVariable(prefix+"SdncResult"))
}
try{
@@ -960,7 +970,7 @@ class SDNCAdapterUtils {
intDataResponseCode = 400
}
- msoLogger.debug("intDataResponseCode " + intDataResponseCode )
+ logger.debug("intDataResponseCode " + intDataResponseCode )
// if response-code is not Success (200, 201, etc) we need to throw an exception
if ((intDataResponseCode < 200 || intDataResponseCode > 299) && intDataResponseCode != 0) {
@@ -971,25 +981,30 @@ class SDNCAdapterUtils {
}
}else {
- msoLogger.warn(MessageEnum.BPMN_GENERAL_WARNING, 'sdncAdapter did not complete successfully, sdncAdapter Success Indicator was false ', "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, 'sdncAdapter did not complete successfully, sdncAdapter Success Indicator was false ');
+ logger.warn("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_WARNING,
+ 'sdncAdapter did not complete successfully, sdncAdapter Success Indicator was false ',
+ "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError,
+ 'sdncAdapter did not complete successfully, sdncAdapter Success Indicator was false ')
execution.setVariable("L3HLAB_rollback", true)
def msg = trinityExceptionUtil.intDataResponseCode(response, execution)
exceptionUtil.buildAndThrowWorkflowException(execution, intDataResponseCode, msg)
}
if (response == null || response.trim().equals("")) {
- msoLogger.warn(MessageEnum.BPMN_GENERAL_WARNING, 'sdncAdapter workflow response is empty', "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, 'sdncAdapter workflow response is empty');;
+ logger.warn("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_WARNING,
+ 'sdncAdapter workflow response is empty', "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError, 'sdncAdapter workflow response is empty')
execution.setVariable("L3HLAB_rollback", true)
def msg = trinityExceptionUtil.buildException("Exception occurred while validating SDNC response " , execution)
exceptionUtil.buildAndThrowWorkflowException(execution, intResponseCode, msg)
}
execution.setVariable(prefix+'sdncResponseSuccess', true)
- msoLogger.trace('Exited ' + method)
+ 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);
execution.setVariable(prefix+"ResponseCode",400)
execution.setVariable("L3HLAB_rollback", true)
def msg = trinityExceptionUtil.buildException("Exception occurred while validating SDNC response: " + e.getMessage(), execution)
@@ -1024,4 +1039,4 @@ class SDNCAdapterUtils {
return ecompModelInformation
}
-} \ No newline at end of file
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.groovy
index 9556ae7d6a..8c2da2c112 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.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
@@ -46,8 +48,8 @@ import static org.onap.so.bpmn.common.scripts.GenericUtils.*;
import java.net.URL
import javax.ws.rs.core.Response
-import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
/**
@@ -61,7 +63,7 @@ import org.onap.so.logger.MsoLogger
*/
class SniroHomingV1 extends AbstractServiceTaskProcessor{
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SniroHomingV1.class);
+ private static final Logger logger = LoggerFactory.getLogger( SniroHomingV1.class);
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
SniroUtils sniroUtils = new SniroUtils(this)
@@ -77,19 +79,19 @@ class SniroHomingV1 extends AbstractServiceTaskProcessor{
*/
public void callSniro(DelegateExecution execution){
execution.setVariable("prefix","HOME_")
- msoLogger.trace("Started Sniro Homing Call Sniro ")
+ logger.trace("Started Sniro Homing Call Sniro ")
try{
execution.setVariable("rollbackData", null)
execution.setVariable("rolledBack", false)
String requestId = execution.getVariable("msoRequestId")
- msoLogger.debug("Incoming Request Id is: " + requestId)
+ logger.debug("Incoming Request Id is: " + requestId)
String serviceInstanceId = execution.getVariable("serviceInstanceId")
- msoLogger.debug("Incoming Service Instance Id is: " + serviceInstanceId)
+ logger.debug("Incoming Service Instance Id is: " + serviceInstanceId)
ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
- msoLogger.debug("Incoming Service Decomposition is: " + serviceDecomposition)
+ logger.debug("Incoming Service Decomposition is: " + serviceDecomposition)
String subscriberInfo = execution.getVariable("subscriberInfo")
- msoLogger.debug("Incoming Subscriber Information is: " + subscriberInfo)
+ logger.debug("Incoming Subscriber Information is: " + subscriberInfo)
if(isBlank(requestId) || isBlank(serviceInstanceId) || isBlank(serviceDecomposition.toString()) || isBlank(subscriberInfo)){
exceptionUtil.buildAndThrowWorkflowException(execution, 4000, "A required input variable is missing or null")
@@ -117,7 +119,7 @@ class SniroHomingV1 extends AbstractServiceTaskProcessor{
timeout = "PT30M";
}
}
- msoLogger.debug("Async Callback Timeout will be: " + timeout)
+ logger.debug("Async Callback Timeout will be: " + timeout)
execution.setVariable("timeout", timeout);
execution.setVariable("correlator", requestId);
@@ -126,12 +128,12 @@ class SniroHomingV1 extends AbstractServiceTaskProcessor{
//Build Request & Call Sniro
String sniroRequest = sniroUtils.buildRequest(execution, requestId, serviceDecomposition, subscriber, homingParameters)
execution.setVariable("sniroRequest", sniroRequest)
- msoLogger.debug("SNIRO Request is: " + sniroRequest)
+ logger.debug("SNIRO Request is: " + sniroRequest)
String endpoint = UrnPropertiesReader.getVariable("sniro.manager.uri.v1", execution)
String host = UrnPropertiesReader.getVariable("sniro.manager.host", execution)
String urlString = host + endpoint
- msoLogger.debug("Sniro Url is: " + urlString)
+ logger.debug("Sniro Url is: " + urlString)
URL url = new URL(urlString);
HttpClient httpClient = new HttpClientFactory().newJsonClient(url, TargetEntity.SNIRO)
@@ -140,21 +142,21 @@ class SniroHomingV1 extends AbstractServiceTaskProcessor{
int responseCode = httpResponse.getStatus()
- msoLogger.debug("Sniro sync response code is: " + responseCode)
+ logger.debug("Sniro sync response code is: " + responseCode)
if(httpResponse.hasEntity()){
- msoLogger.debug("Sniro sync response is: " + httpResponse.readEntity(String.class))
+ logger.debug("Sniro sync response is: " + httpResponse.readEntity(String.class))
}
if(responseCode != 202){
exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from Sniro.")
}
- msoLogger.trace("Completed Sniro Homing Call Sniro")
+ logger.trace("Completed Sniro Homing Call Sniro")
}
}catch(BpmnError b){
throw b
}catch(Exception e){
- msoLogger.debug("Error encountered within Homing CallSniro method: " + e)
+ logger.debug("Error encountered within Homing CallSniro method: " + e)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in Homing CallSniro: " + e.getMessage())
}
}
@@ -170,10 +172,10 @@ class SniroHomingV1 extends AbstractServiceTaskProcessor{
* @author cb645j
*/
public void processHomingSolution(DelegateExecution execution){
- msoLogger.trace("Started Sniro Homing Process Homing Solution")
+ logger.trace("Started Sniro Homing Process Homing Solution")
try{
String response = execution.getVariable("asyncCallbackResponse")
- msoLogger.debug("Sniro Async Callback Response is: " + response)
+ logger.debug("Sniro Async Callback Response is: " + response)
sniroUtils.validateCallbackResponse(execution, response)
@@ -233,11 +235,11 @@ class SniroHomingV1 extends AbstractServiceTaskProcessor{
}
execution.setVariable("serviceDecomposition", decomposition)
- msoLogger.trace("Completed Sniro Homing Process Homing Solution")
+ logger.trace("Completed Sniro Homing Process Homing Solution")
}catch(BpmnError b){
throw b
}catch(Exception e){
- msoLogger.debug("Error encountered within Homing ProcessHomingSolution method: " + e)
+ logger.debug("Error encountered within Homing ProcessHomingSolution method: " + e)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in Sniro Homing Process Solution")
}
}
@@ -255,9 +257,9 @@ class SniroHomingV1 extends AbstractServiceTaskProcessor{
requestId = execution.getVariable("msoRequestId")
}
execution.setVariable("DHVCS_requestId", requestId)
- msoLogger.trace("STARTED Homing Subflow for request: " + requestId + " ")
- msoLogger.debug("****** Homing Subflow Global Debug Enabled: " + execution.getVariable("isDebugLogEnabled") + " *****")
- msoLogger.trace("STARTED Homing Subflow for request: " + requestId + " ")
+ logger.trace("STARTED Homing Subflow for request: " + requestId + " ")
+ logger.debug("****** Homing Subflow Global Debug Enabled: " + execution.getVariable("isDebugLogEnabled") + " *****")
+ logger.trace("STARTED Homing Subflow for request: " + requestId + " ")
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroUtils.groovy
index 5ff49fbae8..2343d5451c 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroUtils.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,13 +36,13 @@ import static org.onap.so.bpmn.common.scripts.GenericUtils.*
import java.time.Duration
-import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
class SniroUtils{
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SniroUtils.class);
+ private static final Logger logger = LoggerFactory.getLogger( SniroUtils.class);
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -70,14 +72,14 @@ class SniroUtils{
* @author cb645j
*/
public String buildRequest(DelegateExecution execution, String requestId, ServiceDecomposition decomposition, Subscriber subscriber, String homingParams){
- msoLogger.debug("Started Building Sniro Request")
+ logger.debug("Started Building Sniro Request")
def callbackUrl = utils.createWorkflowMessageAdapterCallbackURL(execution, "SNIROResponse", requestId)
def transactionId = requestId
//ServiceInstance Info
ServiceInstance serviceInstance = decomposition.getServiceInstance()
def serviceInstanceId
if(serviceInstance == null){
- msoLogger.debug("Unable to obtain Service Instance Id, ServiceInstance Object is null" )
+ logger.debug("Unable to obtain Service Instance Id, ServiceInstance Object is null" )
exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - Unable to obtain Service Instance Id, ServiceInstance Object is null")
}else{
serviceInstanceId = serviceInstance.getInstanceId()
@@ -142,7 +144,7 @@ class SniroUtils{
}
if(resourceList.isEmpty() || resourceList == null){
- msoLogger.debug("Resources List is Empty")
+ logger.debug("Resources List is Empty")
}else{
for(Resource resource:resourceList){
ModelInfo resourceModelInfo = resource.getModelInfo()
@@ -197,7 +199,7 @@ class SniroUtils{
String licenseDemands = ""
sb = new StringBuilder()
if(vnfResourceList.isEmpty() || vnfResourceList == null){
- msoLogger.debug("Vnf Resources List is Empty")
+ logger.debug("Vnf Resources List is Empty")
}else{
for(VnfResource vnfResource:vnfResourceList){
ModelInfo vnfResourceModelInfo = vnfResource.getModelInfo()
@@ -291,7 +293,7 @@ class SniroUtils{
}
}"""
- msoLogger.debug("Completed Building Sniro Request")
+ logger.debug("Completed Building Sniro Request")
return request
}
@@ -321,7 +323,7 @@ class SniroUtils{
licenses = jsonUtil.getJsonValue(response, "solutionInfo.licenseInfo")
}
if((isBlank(placements) || placements.equalsIgnoreCase("[]")) && (isBlank(licenses) || licenses.equalsIgnoreCase("[]"))){
- msoLogger.debug("Sniro Async Response does not contain: licenses or placements")
+ logger.debug("Sniro Async Response does not contain: licenses or placements")
}else{
return
}
@@ -336,20 +338,20 @@ class SniroUtils{
}else{
errorMessage = "Sniro Async Response contains an error: not provided"
}
- msoLogger.debug("Sniro Async Response contains an error: " + errorMessage)
+ logger.debug("Sniro Async Response contains an error: " + errorMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 400, errorMessage)
}else{
- msoLogger.debug("Sniro Async Response contains an error: not provided")
+ logger.debug("Sniro Async Response contains an error: not provided")
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Sniro Async Response contains an error: not provided")
}
}
}catch(BpmnError b){
throw b
}catch(Exception e){
- msoLogger.debug("Error encountered within Homing validateCallbackResponse method: " + e)
+ logger.debug("Error encountered within Homing validateCallbackResponse method: " + e)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in Sniro Homing Validate Async Response")
}
}
-} \ No newline at end of file
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtil.groovy
index 3cf1edb8ca..ebce0c6753 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtil.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/TrinityExceptionUtil.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
@@ -24,15 +26,17 @@ import org.camunda.bpm.engine.delegate.DelegateExecution
import org.apache.commons.lang3.*
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
class TrinityExceptionUtil {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, TrinityExceptionUtil.class);
+ private static final Logger logger = LoggerFactory.getLogger( TrinityExceptionUtil.class);
+
+
+
-
-
-
public static enum Error {
SVC_GENERAL_SERVICE_ERROR("SVC0001","Internal Error"),
SVC_BAD_PARAMETER("SVC0002", "Invalid input value for message part %1"),
@@ -64,8 +68,8 @@ class TrinityExceptionUtil {
}
-
-
+
+
String mapAdapterExecptionToCommonException(String response, DelegateExecution execution)
{
def utils=new MsoUtils()
@@ -73,26 +77,26 @@ class TrinityExceptionUtil {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
+
-
def errorCode
-
+
try {
- errorCode = MapCategoryToErrorCode(utils.getNodeText(response, "category"))
+ errorCode = MapCategoryToErrorCode(utils.getNodeText(response, "category"))
execution.setVariable(prefix+"err",errorCode)
String message = buildException(response, execution)
- msoLogger.trace("End MapAdapterExecptionToWorkflowException ")
+ logger.trace("End MapAdapterExecptionToWorkflowException ")
return message
}catch (Exception ex) {
//Ignore the exception - cases include non xml payload
- msoLogger.debug("error mapping error, ignoring: " + ex)
- msoLogger.trace("End MapAdapterExecptionToWorkflowException ")
+ logger.debug("error mapping error, ignoring: " + ex)
+ logger.trace("End MapAdapterExecptionToWorkflowException ")
return buildException(response, execution)
- }
+ }
}
-
+
/**
* @param response
* @param execution
@@ -107,9 +111,9 @@ class TrinityExceptionUtil {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
-
-
+ logger.trace('Entered ' + method)
+
+
try {
def errorCode = utils.getNodeText(response,"code")
def descr = utils.getNodeText(response, "description")
@@ -122,16 +126,16 @@ class TrinityExceptionUtil {
}
execution.setVariable(prefix+"err",mappedErr)
def message = buildException("Received error from AOTS: " + descr, execution)
- msoLogger.trace("End MapAOTSExecptionToCommonException ")
+ logger.trace("End MapAOTSExecptionToCommonException ")
return message
}catch (Exception ex) {
//Ignore the exception - cases include non xml payload
- msoLogger.debug("error mapping error, ignoring: " + ex)
- msoLogger.trace("End MapAOTSExecptionToCommonException ")
+ logger.debug("error mapping error, ignoring: " + ex)
+ logger.trace("End MapAOTSExecptionToCommonException ")
return buildException(response, execution)
}
}
-
+
String mapSDNCAdapterExceptionToErrorResponse(String sdncAdapterCallbackRequest, DelegateExecution execution) {
def utils=new MsoUtils()
def prefix=execution.getVariable("prefix")
@@ -139,15 +143,15 @@ class TrinityExceptionUtil {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
-
+ logger.trace('Entered ' + method)
+
def sdncResponseCode
String responseCode = execution.getVariable(prefix+"ResponseCode")
- msoLogger.debug('responseCode to map: ' + responseCode)
+ logger.debug('responseCode to map: ' + responseCode)
def errorMessage
-
+
try {
-
+
if(utils.nodeExists(sdncAdapterCallbackRequest, "RequestData")) {
def reqDataXml = utils.getNodeXml(sdncAdapterCallbackRequest, "RequestData")
errorMessage = utils.getNodeText(reqDataXml, "response-message")
@@ -168,18 +172,18 @@ class TrinityExceptionUtil {
execution.setVariable(prefix+"err",mappedErr)
def message = buildException(modifiedErrorMessage, execution)
-
- msoLogger.trace("End MapSDNCAdapterException ")
+
+ logger.trace("End MapSDNCAdapterException ")
return message
}catch (Exception ex) {
//Ignore the exception - cases include non xml payload
- msoLogger.debug("error mapping sdnc error, ignoring: " + ex)
- msoLogger.trace("End MapSDNCAdapterException ")
+ logger.debug("error mapping sdnc error, ignoring: " + ex)
+ logger.trace("End MapSDNCAdapterException ")
return null
- }
-
+ }
+
}
-
+
/**
* @param response message from called component (ex: AAI)
* @param execution
@@ -193,11 +197,11 @@ class TrinityExceptionUtil {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
def variables
def message
String errorCode = 'SVC0001'
- msoLogger.debug("response: " + response)
+ logger.debug("response: " + response)
//they use the same format we do, pass their error along
//TODO add Received error from A&AI at beg of text
try {
@@ -206,20 +210,20 @@ class TrinityExceptionUtil {
} catch (Exception ex) {
//Ignore the exception - cases include non xml payload
message = buildException("Received error from A&AI, unable to parse",execution)
- msoLogger.debug("error mapping error, ignoring: " + ex)
+ logger.debug("error mapping error, ignoring: " + ex)
}
-
- if(message != null) {
+
+ if(message != null) {
execution.setVariable(prefix+"ErrorResponse",message)
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Fault", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, execution.getVariable(prefix+"ErrorResponse"));
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Fault", "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(),
+ execution.getVariable(prefix+"ErrorResponse"));
return message
} else {
-
return null
-
}
}
-
+
/**
* @param execution
* @return an error response conforming to the common API with default text msg
@@ -239,21 +243,21 @@ class TrinityExceptionUtil {
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
def prefix=execution.getVariable("prefix")
def responseCode = String.valueOf(execution.getVariable(prefix+"ResponseCode"))
def variables
- msoLogger.debug("response: " + response)
-
+ logger.debug("response: " + response)
+
try {
- msoLogger.debug("formatting error message" )
+ logger.debug("formatting error message" )
def msgVars = execution.getVariable(prefix+"errVariables")
def myErr = execution.getVariable(prefix+"err")
def messageTxt = execution.getVariable(prefix+"errTxt")
def messageId = null
-
+
if(myErr == null){
- msoLogger.debug("mapping response code: " + responseCode)
+ logger.debug("mapping response code: " + responseCode)
myErr = mapErrorCodetoError(responseCode, response)
if(myErr == null){
//not a service or policy error, just return error code
@@ -261,7 +265,7 @@ class TrinityExceptionUtil {
}
}
messageId = myErr.getMsgId()
-
+
if(messageTxt == null){
if(myErr!=null){
messageTxt = myErr.getMsgTxt()
@@ -293,35 +297,37 @@ class TrinityExceptionUtil {
<tns:messageId>${MsoUtils.xmlEscape(messageId)}</tns:messageId>
<tns:text>${MsoUtils.xmlEscape(messageTxt)}</tns:text>${msgVarsBuff}
</tns:serviceException>
-</tns:requestError>"""
+</tns:requestError>"""
}else{
message ="""<tns:requestError xmlns:tns="http://org.onap/so/request/types/v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://org.onap/so/request/types/v1 MsoServiceInstanceTypesV1.xsd">
<tns:policyException>
<tns:messageId>${MsoUtils.xmlEscape(messageId)}</tns:messageId>
<tns:text>${MsoUtils.xmlEscape(messageTxt)}</tns:text>${msgVarsBuff}
</tns:policyException>
-</tns:requestError>"""
+</tns:requestError>"""
}
- msoLogger.debug("message " + message)
+ logger.debug("message " + message)
execution.setVariable(prefix+"ErrorResponse",message)
execution.setVariable(prefix+"err", myErr)
execution.setVariable(prefix+"errTxt", messageTxt)
execution.setVariable(prefix+"errVariables", msgVars)
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, "Fault", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, execution.getVariable(prefix+"ErrorResponse"));
+ logger.error("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), "Fault", "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue(),
+ execution.getVariable(prefix+"ErrorResponse"));
return message
}catch(Exception ex) {
- msoLogger.debug("error mapping error, return null: " + ex)
+ logger.debug("error mapping error, return null: " + ex)
return null
}
}
-
+
String parseError(DelegateExecution execution){
def utils=new MsoUtils()
def prefix=execution.getVariable("prefix")
def text = execution.getVariable(prefix+"errTxt")
def msgVars = execution.getVariable(prefix+"errVariables")
- msoLogger.debug('parsing message: ' + text)
+ logger.debug('parsing message: ' + text)
if(text == null){
return 'failed'
}
@@ -330,15 +336,15 @@ class TrinityExceptionUtil {
text = text.replaceFirst("%"+(i+1), msgVars[i])
}
}
- msoLogger.debug('parsed message is: ' + text)
+ logger.debug('parsed message is: ' + text)
return text
}
-
-
+
+
Error mapErrorCodetoError(responseCode, descr)
{
-
+
if(responseCode==null || responseCode=='0' || responseCode=='500' || responseCode =='408'){
return Error.SVC_NO_SERVER_RESOURCES
}else if(responseCode == '401' || responseCode == '405' || responseCode == '409' || responseCode == '503'){
@@ -373,10 +379,4 @@ class TrinityExceptionUtil {
else
return Error.SVC_GENERAL_SERVICE_ERROR
}
-
-
-
-
-
-
-} \ No newline at end of file
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy
index f96e3bea0e..867065696e 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIGenericVnf.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,12 +32,14 @@ import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.client.graphinventory.entities.uri.Depth
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, UpdateAAIGenericVnf.class)
+ private static final Logger logger = LoggerFactory.getLogger( UpdateAAIGenericVnf.class);
private XmlParser xmlParser = new XmlParser()
@@ -69,12 +73,12 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
def method = getClass().getSimpleName() + '.preProcessRequest(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
def xml = execution.getVariable('UpdateAAIGenericVnfRequest')
- msoLogger.debug('Received request xml:\n' + xml)
- msoLogger.debug("UpdateAAIGenericVnf Request XML: " + xml)
+ logger.debug('Received request xml:\n' + xml)
+ logger.debug("UpdateAAIGenericVnf Request XML: " + xml)
initProcessVariables(execution)
def vnfId = getRequiredNodeText(execution, xml,'vnf-id')
@@ -99,17 +103,17 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
if (managementV6Address != null && !managementV6Address.isEmpty()) {
execution.setVariable('UAAIGenVnf_managementV6Address', managementV6Address)
}
-
+
def orchestrationStatus = getNodeTextForce(xml, 'orchestration-status')
if (orchestrationStatus != null && !orchestrationStatus.isEmpty()) {
execution.setVariable('UAAIGenVnf_orchestrationStatus', orchestrationStatus)
}
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e
} catch (Exception e) {
- msoLogger.error(e)
+ logger.error(e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage())
}
}
@@ -124,7 +128,7 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
def method = getClass().getSimpleName() + '.getGenericVnf(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
def vnfId = execution.getVariable('UAAIGenVnf_vnfId')
@@ -141,14 +145,14 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
execution.setVariable('UAAIGenVnf_getGenericVnfResponse', "Generic VNF not found for VNF ID: "+vnfId)
}
}catch (Exception ex) {
- msoLogger.error(ex.getMessage())
- msoLogger.debug('Exception occurred while executing AAI GET:' + ex.getMessage())
+ logger.error(ex.getMessage())
+ logger.debug('Exception occurred while executing AAI GET:' + ex.getMessage())
execution.setVariable('UAAIGenVnf_getGenericVnfResponseCode', 500)
execution.setVariable('UAAIGenVnf_getGenericVnfResponse', 'AAI GET Failed:' + ex.getMessage())
}
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (Exception e) {
- msoLogger.error(e)
+ logger.error(e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in getGenericVnf(): ' + e.getMessage())
}
}
@@ -162,14 +166,14 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
def method = getClass().getSimpleName() + '.updateGenericVnf(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
def vnfId = execution.getVariable('UAAIGenVnf_vnfId')
GenericVnf genericVnf = execution.getVariable('UAAIGenVnf_getGenericVnfResponse')
def origRequest = execution.getVariable('UpdateAAIGenericVnfRequest')
- msoLogger.debug("UpdateGenericVnf Request: " + origRequest)
+ logger.debug("UpdateGenericVnf Request: " + origRequest)
// Handle persona-model-id/persona-model-version
String newPersonaModelId = execution.getVariable('UAAIGenVnf_personaModelId')
@@ -178,7 +182,8 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
if (newPersonaModelId != null || newPersonaModelVersion != null) {
if (newPersonaModelId != genericVnf.getModelInvariantId()) {
def msg = 'Can\'t update Generic VNF ' + vnfId + ' since there is \'persona-model-id\' mismatch between the current and new values'
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "")
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue())
throw new Exception(msg)
}
@@ -216,27 +221,27 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
payload.setIpv4OamAddress(ipv4OamAddressEntry)
payload.setManagementV6Address(managementV6AddressEntry)
payload.setOrchestrationStatus(orchestrationStatusEntry)
-
+
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId)
try {
getAAIClient().update(uri,payload)
} catch (Exception ex) {
ex.printStackTrace()
- msoLogger.debug('Exception occurred while executing AAI PATCH:' + ex.getMessage())
+ logger.debug('Exception occurred while executing AAI PATCH:' + ex.getMessage())
execution.setVariable('UAAIGenVnf_updateGenericVnfResponseCode', 500)
execution.setVariable('UAAIGenVnf_updateGenericVnfResponse', 'AAI PATCH Failed:' + ex.getMessage())
}
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (Exception e) {
- msoLogger.error(e)
+ logger.error(e)
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in updateGenericVnf(): ' + e.getMessage())
}
}
/**
* Sets up json attributes for PATCH request for Update
- *
+ *
* @param origRequest Incoming update request with Generic VNF element(s) to be updated.
* @param genericVnf Current Generic VNF retrieved from AAI.
* @param element Name of element to be inserted.
@@ -267,16 +272,16 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
def method = getClass().getSimpleName() + '.handleAAIQueryFailure(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
- msoLogger.error( 'Error occurred attempting to query AAI, Response Code ' + execution.getVariable('UAAIGenVnf_getGenericVnfResponseCode'))
+ logger.error('Error occurred attempting to query AAI, Response Code ' + execution.getVariable('UAAIGenVnf_getGenericVnfResponseCode'))
String processKey = getProcessKey(execution)
WorkflowException exception = new WorkflowException(processKey, 5000,
execution.getVariable('UAAIGenVnf_getGenericVnfResponse'))
execution.setVariable('WorkflowException', exception)
- msoLogger.debug("Workflow Exception occurred when handling Quering AAI: " + exception.getErrorMessage())
- msoLogger.trace('Exited ' + method)
+ logger.debug("Workflow Exception occurred when handling Quering AAI: " + exception.getErrorMessage())
+ logger.trace('Exited ' + method)
}
/**
@@ -288,16 +293,16 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
def method = getClass().getSimpleName() + '.handleUpdateGenericVnfFailure(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
- msoLogger.error('Error occurred attempting to update Generic VNF in AAI, Response Code ' + execution.getVariable('UAAIGenVnf_updateGenericVnfResponseCode'))
+ logger.error('Error occurred attempting to update Generic VNF in AAI, Response Code ' + execution.getVariable('UAAIGenVnf_updateGenericVnfResponseCode'))
String processKey = getProcessKey(execution)
WorkflowException exception = new WorkflowException(processKey, 5000,
execution.getVariable('UAAIGenVnf_updateGenericVnfResponse'))
execution.setVariable('WorkflowException', exception)
- msoLogger.debug("Workflow Exception occurred when Updating GenericVnf: " + exception.getErrorMessage())
- msoLogger.trace('Exited ' + method)
+ logger.debug("Workflow Exception occurred when Updating GenericVnf: " + exception.getErrorMessage())
+ logger.trace('Exited ' + method)
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModule.groovy
index 3c4edd21ca..92a043e65a 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModule.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/UpdateAAIVfModule.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,10 +31,12 @@ import org.onap.so.client.aai.AAIObjectType
import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
public class UpdateAAIVfModule extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, UpdateAAIVfModule.class);
+ private static final Logger logger = LoggerFactory.getLogger( UpdateAAIVfModule.class);
private XmlParser xmlParser = new XmlParser()
@@ -65,11 +69,11 @@ public class UpdateAAIVfModule extends AbstractServiceTaskProcessor {
def method = getClass().getSimpleName() + '.preProcessRequest(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
def xml = execution.getVariable('UpdateAAIVfModuleRequest')
- msoLogger.debug('Received request xml:\n' + xml)
+ logger.debug('Received request xml:\n' + xml)
initProcessVariables(execution)
def vnfId = getRequiredNodeText(execution, xml,'vnf-id')
@@ -78,11 +82,11 @@ public class UpdateAAIVfModule extends AbstractServiceTaskProcessor {
def vfModuleId = getRequiredNodeText(execution, xml,'vf-module-id')
execution.setVariable('UAAIVfMod_vfModuleId', vfModuleId)
- msoLogger.trace('Exited ' + method)
+ logger.trace('Exited ' + method)
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(e);
+ logger.error(e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage())
}
}
@@ -97,7 +101,7 @@ public class UpdateAAIVfModule extends AbstractServiceTaskProcessor {
def method = getClass().getSimpleName() + '.getVfModule(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
def vnfId = execution.getVariable('UAAIVfMod_vnfId')
@@ -113,14 +117,14 @@ public class UpdateAAIVfModule extends AbstractServiceTaskProcessor {
execution.setVariable('UAAIVfMod_getVfModuleResponse', "VF Module not found in AAI")
}
} catch (Exception ex) {
- msoLogger.debug('Exception occurred while executing AAI GET:' + ex.getMessage())
+ logger.debug('Exception occurred while executing AAI GET:' + ex.getMessage())
execution.setVariable('UAAIVfMod_getVfModuleResponseCode', 500)
execution.setVariable('UAAIVfMod_getVfModuleResponse', 'AAI GET Failed:' + ex.getMessage())
}
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(e);
+ logger.error(e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in getVfModule(): ' + e.getMessage())
}
}
@@ -134,7 +138,7 @@ public class UpdateAAIVfModule extends AbstractServiceTaskProcessor {
def method = getClass().getSimpleName() + '.updateVfModule(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
def vnfId = execution.getVariable('UAAIVfMod_vnfId')
@@ -142,7 +146,7 @@ public class UpdateAAIVfModule extends AbstractServiceTaskProcessor {
org.onap.aai.domain.yang.VfModule vfModule = execution.getVariable('UAAIVfMod_getVfModuleResponse')
def origRequest = execution.getVariable('UpdateAAIVfModuleRequest')
- msoLogger.debug("UpdateAAIVfModule request: " + origRequest)
+ logger.debug("UpdateAAIVfModule request: " + origRequest)
// Handle persona-model-id/persona-model-version
def boolean doPersonaModelVersion = true
def String newPersonaModelId = utils.getNodeText(origRequest, 'persona-model-id')
@@ -161,11 +165,11 @@ public class UpdateAAIVfModule extends AbstractServiceTaskProcessor {
}
if (!newPersonaModelId.equals(currPersonaModelId)) {
def msg = 'Can\'t update VF Module ' + vfModuleId + ' since there is \'persona-model-id\' mismatch between the current and new values'
- msoLogger.error(msg)
+ logger.error(msg)
throw new Exception(msg)
}
}
-
+
// Construct payload
String orchestrationStatusEntry = updateVfModuleNode(origRequest , 'orchestration-status')
String heatStackIdEntry = updateVfModuleNode(origRequest, 'heat-stack-id')
@@ -187,7 +191,7 @@ public class UpdateAAIVfModule extends AbstractServiceTaskProcessor {
execution.setVariable('UAAIVfMod_updateVfModuleResponseCode', 200)
execution.setVariable('UAAIVfMod_updateVfModuleResponse', "Success")
}catch(NotFoundException ignored){
- msoLogger.debug("VF-Module not found!!")
+ logger.debug("VF-Module not found!!")
execution.setVariable('UAAIVfMod_updateVfModuleResponseCode', 404)
execution.setVariable('UAAIVfMod_updateVfModuleResponse', ignored.getMessage())
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "vf-module " + vfModuleId + " not found for under vnf " + vnfId + " in A&AI!")
@@ -200,7 +204,7 @@ public class UpdateAAIVfModule extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception e) {
- msoLogger.error(e);
+ logger.error(e);
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in updateVfModule(): ' + e.getMessage())
}
}
@@ -210,7 +214,7 @@ public class UpdateAAIVfModule extends AbstractServiceTaskProcessor {
*
* @param origRequest Incoming update request with VF Module elements to be updated.
* @param element Name of element to be inserted.
- */
+ */
private String updateVfModuleNode(String origRequest, String elementName) {
if (!utils.nodeExists(origRequest, elementName)) {
@@ -236,14 +240,14 @@ public class UpdateAAIVfModule extends AbstractServiceTaskProcessor {
def method = getClass().getSimpleName() + '.handleAAIQueryFailure(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
- msoLogger.error( 'Error occurred attempting to query AAI, Response Code ' + execution.getVariable('UAAIVfMod_getVfModuleResponseCode'));
+ logger.error('Error occurred attempting to query AAI, Response Code ' + execution.getVariable('UAAIVfMod_getVfModuleResponseCode'))
String processKey = getProcessKey(execution);
WorkflowException exception = new WorkflowException(processKey, 5000,
execution.getVariable('UAAIVfMod_getVfModuleResponse'))
execution.setVariable('WorkflowException', exception)
- msoLogger.debug("UpdateAAIVfModule query failure: " + exception.getErrorMessage())
- msoLogger.trace('Exited ' + method)
+ logger.debug("UpdateAAIVfModule query failure: " + exception.getErrorMessage())
+ logger.trace('Exited ' + method)
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModule.groovy
index b20cc38b8b..af0715cb11 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModule.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModule.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
@@ -20,16 +22,8 @@
package org.onap.so.bpmn.common.scripts;
-import org.apache.commons.lang3.*
-import org.onap.so.logger.MessageEnum
-import org.onap.so.logger.MsoLogger
-
-
public class VfModule implements Serializable {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VfModule.class);
-
-
/**
* Class representing a VF Module Node. Fields of this class include indicators
* as to whether the VF Module is the only VF Module in its containing Generic VNF
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy
index c1cd42e893..168ea1fdc9 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VfModuleBase.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,16 +32,18 @@ import org.w3c.dom.NodeList
import org.xml.sax.InputSource
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
public abstract class VfModuleBase extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VfModuleBase.class);
+ private static final Logger logger = LoggerFactory.getLogger( VfModuleBase.class);
+
-
protected XmlParser xmlParser = new XmlParser()
-
+
/**
* Get the XmlParser.
- *
+ *
* @return the XmlParser.
*/
protected XmlParser getXmlParser() {
@@ -105,11 +109,13 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor {
}
}
} catch (Exception e) {
- msoLogger.warn(MessageEnum.BPMN_GENERAL_WARNING, 'Exception transforming network params to vnfNetworks', "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, 'Exception is: \n' + e);
+ logger.warn("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_WARNING.toString(),
+ 'Exception transforming network params to vnfNetworks', "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), 'Exception is: \n' + e);
}
return vnfNetworks
}
-
+
/**
* Transform the parameter specifications from the incoming '*-params' root element to
* a corresponding list of 'entry's (typically used when invoking the VNF Rest Adpater).
@@ -142,7 +148,9 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor {
entries = entries + entry
}
} catch (Exception e) {
- msoLogger.warn(MessageEnum.BPMN_GENERAL_WARNING, 'Exception transforming params to entries', "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, 'Exception transforming params to entries', e);
+ logger.warn("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_WARNING.toString(),
+ 'Exception transforming params to entries', "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), 'Exception transforming params to entries' + e);
}
return entries
}
@@ -181,7 +189,9 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor {
}
}
} catch (Exception e) {
- msoLogger.warn(MessageEnum.BPMN_GENERAL_WARNING, 'Exception transforming params to entries', "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, 'Exception transforming params to entries', e);
+ logger.warn("{} {} {} {} {} {}", MessageEnum.BPMN_GENERAL_WARNING.toString(),
+ 'Exception transforming params to entries', "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError.getValue(), 'Exception transforming params to entries' + e);
}
return entries
}
@@ -877,15 +887,15 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor {
<key>vf_module_name</key>
<value>${MsoUtils.xmlEscape(vfModuleName)}</value>
</entry>"""
-
- msoLogger.debug("vnfInfo: " + vnfInfo)
+
+ logger.debug("vnfInfo: " + vnfInfo)
InputSource source = new InputSource(new StringReader(data));
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
docFactory.setNamespaceAware(true)
DocumentBuilder docBuilder = docFactory.newDocumentBuilder()
Document responseXml = docBuilder.parse(source)
-
-
+
+
// Availability Zones Data
String aZones = ""
StringBuilder sbAZone = new StringBuilder()
@@ -1235,9 +1245,9 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor {
${interfaceRoutePrefixes}
${vnfParams}
${sdncResponseParams}"""
-
+
return vfModuleParams
-
+
}
-
-} \ No newline at end of file
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VidUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VidUtils.groovy
index 40b0368eaa..259a7872a3 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VidUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VidUtils.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
@@ -26,20 +28,20 @@ import groovy.json.JsonSlurper
import org.json.JSONObject
import org.json.XML
import org.onap.so.bpmn.core.xml.XmlTool
-import org.onap.so.logger.MsoLogger
-import org.onap.so.logger.MessageEnum
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
class VidUtils {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VidUtils.class);
-
+ private static final Logger logger = LoggerFactory.getLogger( VidUtils.class);
+
public MsoUtils utils = new MsoUtils()
private AbstractServiceTaskProcessor taskProcessor
public VidUtils(AbstractServiceTaskProcessor taskProcessor) {
this.taskProcessor = taskProcessor
}
-
+
/**
* Create a volume-request XML using a JSON string
* @param jsonReq - JSON request from VID
@@ -259,7 +261,7 @@ class VidUtils {
<source>VID</source>
<service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id>
</request-info>
- <network-inputs>
+ <network-inputs>
<network-id>${MsoUtils.xmlEscape(networkId)}</network-id>
<network-name>${MsoUtils.xmlEscape(instanceName)}</network-name>
<network-type>${MsoUtils.xmlEscape(modelName)}</network-type>
@@ -269,25 +271,25 @@ class VidUtils {
<service-id>${MsoUtils.xmlEscape(serviceId)}</service-id>
<backout-on-failure>${MsoUtils.xmlEscape(backoutOnFailure)}</backout-on-failure>
<sdncVersion>${MsoUtils.xmlEscape(sdncVersion)}</sdncVersion>
- </network-inputs>
+ </network-inputs>
<network-params>
${userParamsNode}
- </network-params>
+ </network-params>
</network-request>
"""
// return a pretty-print of the volume-request xml without the preamble
return groovy.xml.XmlUtil.serialize(xmlReq.normalize().replaceAll("\t", "").replaceAll("\n", "")).replaceAll("(<\\?[^<]*\\?>\\s*[\\r\\n]*)?", "")
-
+
} catch(Exception e) {
- msoLogger.debug("Error in Vid Utils",e.getCause())
+ logger.debug("{} {}", "Error in Vid Utils", e.getCause())
e.printStackTrace();
throw e
}
}
-
+
/**
- * Create a network-request XML using a map,
- * @param execution
+ * Create a network-request XML using a map,
+ * @param execution
* @return
*/
public String createXmlNetworkRequestInstance(execution) {
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy
index 78af8768f9..50a0fe44a6 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.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.core.UrnPropertiesReader
import org.onap.so.client.HttpClient
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
import org.onap.so.utils.TargetEntity
import java.util.UUID
@@ -37,7 +41,7 @@ import java.util.UUID
class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterRestV1.class);
+ private static final Logger logger = LoggerFactory.getLogger( VnfAdapterRestV1.class);
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -47,7 +51,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
def method = getClass().getSimpleName() + '.preProcessRequest(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
def prefix="VNFREST_"
execution.setVariable("prefix", prefix)
@@ -61,9 +65,9 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
Node root = new XmlParser().parseText(request)
String requestType = root.name()
execution.setVariable(prefix + 'requestType', requestType)
- msoLogger.debug(getProcessKey(execution) + ': ' + prefix + 'requestType = ' + requestType)
+ logger.debug(getProcessKey(execution) + ': ' + prefix + 'requestType = ' + requestType)
- msoLogger.debug('VnfAdapterRestV1, request: ' + request)
+ logger.debug('VnfAdapterRestV1, request: ' + request)
// Get the messageId from the request
String messageId = getChildText(root, 'messageId')
@@ -74,12 +78,13 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
if (messageId == null || messageId.isEmpty()) {
String msg = getProcessKey(execution) + ': no messageId in ' + requestType
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
execution.setVariable('VNFAResponse_CORRELATOR', messageId)
- msoLogger.debug(getProcessKey(execution) + ': VNFAResponse_CORRELATOR = ' + messageId)
+ logger.debug(getProcessKey(execution) + ': VNFAResponse_CORRELATOR = ' + messageId)
// Get the notificationUrl from the request
@@ -87,12 +92,13 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
if (notificationUrl == null || notificationUrl.isEmpty()) {
String msg = getProcessKey(execution) + ': no notificationUrl in ' + requestType
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
execution.setVariable(prefix + 'notificationUrl', notificationUrl)
- msoLogger.debug(getProcessKey(execution) + ': ' + prefix + 'notificationUrl = ' + notificationUrl)
+ logger.debug(getProcessKey(execution) + ': ' + prefix + 'notificationUrl = ' + notificationUrl)
// Determine the VnfAdapter endpoint
@@ -100,7 +106,8 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
if (vnfAdapterEndpoint == null || vnfAdapterEndpoint.isEmpty()) {
String msg = getProcessKey(execution) + ': mso:adapters:vnf:rest:endpoint URN mapping is not defined'
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -117,7 +124,8 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
if (vnfId == null || vnfId.isEmpty()) {
String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -129,7 +137,8 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
if (vnfId == null || vnfId.isEmpty()) {
String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -137,7 +146,8 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
if (vfModuleId == null || vfModuleId.isEmpty()) {
String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -150,7 +160,8 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
if (vnfId == null || vnfId.isEmpty()) {
String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -158,7 +169,8 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
if (vfModuleId == null || vfModuleId.isEmpty()) {
String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -171,7 +183,8 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
if (vfModuleRollbackNode == null) {
String msg = getProcessKey(execution) + ': no vfModuleRollback in ' + requestType
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -179,7 +192,8 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
if (vnfId == null || vnfId.isEmpty()) {
String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -187,7 +201,8 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
if (vfModuleId == null || vfModuleId.isEmpty()) {
String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -207,7 +222,8 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
if (volumeGroupId == null || volumeGroupId.isEmpty()) {
String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -222,7 +238,8 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
if (volumeGroupId == null || volumeGroupId.isEmpty()) {
String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -237,7 +254,8 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
if (volumeGroupId == null || volumeGroupId.isEmpty()) {
String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -249,39 +267,45 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
} else {
String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
execution.setVariable(prefix + 'vnfAdapterMethod', vnfAdapterMethod)
- msoLogger.debug(getProcessKey(execution) + ': ' + prefix + 'vnfAdapterMethod = ' + vnfAdapterMethod)
+ logger.debug(getProcessKey(execution) + ': ' + prefix + 'vnfAdapterMethod = ' + vnfAdapterMethod)
execution.setVariable(prefix + 'vnfAdapterUrl', vnfAdapterUrl)
- msoLogger.debug(getProcessKey(execution) + ': ' + prefix + 'vnfAdapterUrl = ' + vnfAdapterUrl)
+ logger.debug(getProcessKey(execution) + ': ' + prefix + 'vnfAdapterUrl = ' + vnfAdapterUrl)
execution.setVariable(prefix + 'vnfAdapterRequest', vnfAdapterRequest)
- msoLogger.debug(getProcessKey(execution) + ': ' + prefix + 'vnfAdapterRequest = \n' + vnfAdapterRequest)
+ logger.debug(getProcessKey(execution) + ': ' + prefix + 'vnfAdapterRequest = \n' + vnfAdapterRequest)
// Get the Basic Auth credentials for the VnfAdapter
String basicAuthValue = UrnPropertiesReader.getVariable("mso.adapters.po.auth", execution)
if (basicAuthValue == null || basicAuthValue.isEmpty()) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined", "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
} else {
try {
def encodedString = utils.getBasicAuth(basicAuthValue, UrnPropertiesReader.getVariable("mso.msoKey", execution))
execution.setVariable(prefix + 'basicAuthHeaderValue', encodedString)
} catch (IOException ex) {
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, getProcessKey(execution) + ": Unable to encode BasicAuth credentials for VnfAdapter", "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(),
+ getProcessKey(execution) + ": Unable to encode BasicAuth credentials for VnfAdapter",
+ "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
}
}
} catch (BpmnError e) {
- msoLogger.debug(" Rethrowing MSOWorkflowException")
+ logger.debug(" Rethrowing MSOWorkflowException")
throw e
} catch (Exception e) {
String msg = 'Caught exception in ' + method + ": " + e
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
- msoLogger.debug(msg)
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
}
@@ -302,7 +326,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
def method = getClass().getSimpleName() + '.sendRequestToVnfAdapter(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
String prefix = execution.getVariable('prefix')
@@ -331,7 +355,8 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
response = httpClient.delete(vnfAdapterRequest)
} else {
String msg = 'Unsupported HTTP method "' + vnfAdapterMethod + '" in ' + method + ": " + e
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
@@ -343,7 +368,8 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
throw e
} catch (Exception e) {
String msg = 'Caught exception in ' + method + ": " + e
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION_ARG, msg, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, "");
+ logger.error("{} {} {} {} {}", MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
+ MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError.getValue());
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
}
@@ -352,12 +378,12 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
def method = getClass().getSimpleName() + '.processCallback(' +
'execution=' + execution.getId() +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
String callback = execution.getVariable('VNFAResponse_MESSAGE')
try {
- msoLogger.debug(getProcessKey(execution) + ": received callback:\n" + callback)
+ logger.debug(getProcessKey(execution) + ": received callback:\n" + callback)
// The XML callback is available to the calling flow in any case,
// even if a WorkflowException is generated.
@@ -372,7 +398,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
vnfAdapterWorkflowException(execution, callback)
}
} catch (Exception e) {
- msoLogger.debug("Error encountered within VnfAdapterRest ProcessCallback method", e)
+ logger.debug("Error encountered within VnfAdapterRest ProcessCallback method", e)
exceptionUtil.buildAndThrowWorkflowException(execution, 7020, "Error encountered within VnfAdapterRest ProcessCallback method")
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterUtils.groovy
index 8c979fca0b..f459b641eb 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterUtils.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
@@ -25,11 +27,13 @@ import org.camunda.bpm.engine.delegate.DelegateExecution;
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
class VnfAdapterUtils {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, VnfAdapterUtils.class);
+ private static final Logger logger = LoggerFactory.getLogger( VnfAdapterUtils.class);
private AbstractServiceTaskProcessor taskProcessor
@@ -47,7 +51,7 @@ class VnfAdapterUtils {
', responseCodeVar=' + responseCodeVar +
', errorResponseVar=' + errorResponseVar +
')'
- msoLogger.trace('Entered ' + method)
+ logger.trace('Entered ' + method)
try {
def prefix = execution.getVariable('prefix')
@@ -62,27 +66,29 @@ class VnfAdapterUtils {
if (response.contains("WorkflowException")) {
execution.setVariable(prefix + "ErrorResponse", response)
//execution.setVariable(prefix + "ResponseCode", responseCode)
- msoLogger.debug(" Sub Vnf flow Error WorkflowException Response - " + "\n" + response)
+ logger.debug(" Sub Vnf flow Error WorkflowException Response - " + "\n" + response)
throw new BpmnError("MSOWorkflowException")
} else if (errorResponse != null && errorResponse instanceof WorkflowException) {
// Not sure the variables with the associated prefix are still used
execution.setVariable(prefix + "ErrorResponse", errorResponse.getErrorMessage())
execution.setVariable(prefix + "ResponseCode", errorResponse.getErrorCode())
- msoLogger.debug("Sub Vnf flow Error WorkflowException " + prefix + "ErrorResponse" + " - " + errorResponse.getErrorMessage())
+ logger.debug("Sub Vnf flow Error WorkflowException " + prefix + "ErrorResponse" + " - " + errorResponse.getErrorMessage())
// this is the important part to ensure we hit the Fallout Handler
throw new BpmnError("MSOWorkflowException")
} else if (errorResponse != null && errorResponse instanceof WorkflowException) {
// Not sure the variables with the associated prefix are still used
execution.setVariable(prefix + "ErrorResponse", errorResponse.getErrorMessage())
execution.setVariable(prefix + "ResponseCode", errorResponse.getErrorCode())
- msoLogger.debug("Sub Vnf flow Error WorkflowException " + prefix + "ErrorResponse" + " - " + errorResponse.getErrorMessage())
+ logger.debug("Sub Vnf flow Error WorkflowException " + prefix + "ErrorResponse" + " - " + errorResponse.getErrorMessage())
// this is the important part to ensure we hit the Fallout Handler
throw new BpmnError("MSOWorkflowException")
}
} 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, 5000, 'Internal Error- Unable to validate VNF Response ' + e.getMessage())
}
}