X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=bpmn%2Fso-bpmn-infrastructure-common%2Fsrc%2Fmain%2Fgroovy%2Forg%2Fonap%2Fso%2Fbpmn%2Finfrastructure%2Fscripts%2FActivateSDNCNetworkResource.groovy;h=f4bdde5e801d8e095a851db1118aec38aa58acde;hb=e14f792af587cb181b2f7fc1357985a908d978d3;hp=c48d000ab3c7b2906045814a201c4bc9d515f012;hpb=1031c50e4e31731d0ab3fc5120b158749027e92a;p=so.git
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy
index c48d000ab3..f4bdde5e80 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.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
@@ -22,25 +24,26 @@ package org.onap.so.bpmn.infrastructure.scripts
import org.apache.commons.lang3.StringUtils
import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
import org.json.JSONObject
import org.json.XML
import org.onap.so.bpmn.common.recipe.ResourceInput
import org.onap.so.bpmn.common.resource.ResourceRequestBuilder
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
-import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.bpmn.common.scripts.ExceptionUtil
-import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils
-import org.onap.so.logger.MsoLogger
import org.onap.so.bpmn.common.scripts.MsoUtils
-import org.onap.so.logger.MsoLogger
+import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.bpmn.core.UrnPropertiesReader
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
/**
* This groovy class supports the ActivateSDNCCNetworkResource.bpmn process.
* flow for SDNC Network Resource Activate
*/
public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ActivateSDNCNetworkResource.class);
+ private static final Logger logger = LoggerFactory.getLogger( ActivateSDNCNetworkResource.class);
String Prefix = "ACTSDNCRES_"
@@ -49,13 +52,11 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
JsonUtils jsonUtil = new JsonUtils()
SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils()
-
+
MsoUtils msoUtils = new MsoUtils()
-
public void preProcessRequest(DelegateExecution execution) {
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- msoLogger.info(" ***** Started preProcessRequest *****")
+ logger.info(" ***** Started preProcessRequest *****")
try {
//get bpmn inputs from resource request.
@@ -65,7 +66,7 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
String resourceInput = execution.getVariable("resourceInput")
//Get ResourceInput Object
ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class)
- execution.setVariable(Prefix + "resourceInput", resourceInputObj)
+ execution.setVariable(Prefix + "resourceInput", resourceInputObj.toString())
//Deal with recipeParams
String recipeParamsFromWf = execution.getVariable("recipeParamXsd")
@@ -126,17 +127,16 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception ex){
- msg = "Exception in preProcessRequest " + ex.getMessage()
- msoLogger.debug( msg)
+ String msg = "Exception in preProcessRequest " + ex.getMessage()
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
}
public void prepareUpdateAfterActivateSDNCResource(DelegateExecution execution) {
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- msoLogger.info("started prepareUpdateAfterActivateSDNCResource ")
+ logger.info("started prepareUpdateAfterActivateSDNCResource ")
- ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput")
+ ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(execution.getVariable(Prefix + "resourceInput"), ResourceInput.class)
String operType = resourceInputObj.getOperationType()
String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid()
String ServiceInstanceId = resourceInputObj.getServiceInstanceId()
@@ -149,17 +149,17 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
String body = """
+ xmlns:ns="http://org.onap.so/requestsdb">
- ${msoUtils.xmlEncode(operType)}
- ${msoUtils.xmlEncode(operationId)}
-
- ${msoUtils.xmlEncode(resourceCustomizationUuid)}
- ${msoUtils.xmlEncode(ServiceInstanceId)}
- ${msoUtils.xmlEncode(status)}
- ${msoUtils.xmlEncode(statusDescription)}
+ ${msoUtils.xmlEscape(operType)}
+ ${msoUtils.xmlEscape(operationId)}
+
+ ${msoUtils.xmlEscape(resourceCustomizationUuid)}
+ ${msoUtils.xmlEscape(ServiceInstanceId)}
+ ${msoUtils.xmlEscape(status)}
+ ${msoUtils.xmlEscape(statusDescription)}
""";
@@ -168,7 +168,7 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
}
private void setProgressUpdateVariables(DelegateExecution execution, String body) {
- def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint")
+ def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint", execution)
execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
execution.setVariable("CVFMI_updateResOperStatusRequest", body)
}
@@ -191,8 +191,7 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
}
public void prepareSDNCRequest (DelegateExecution execution) {
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- msoLogger.info("Started prepareSDNCRequest ")
+ logger.info("Started prepareSDNCRequest ")
try {
// get variables
@@ -206,7 +205,7 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
String serviceInstanceId = execution.getVariable(Prefix + "serviceInstanceId")
String source = execution.getVariable("source")
String sdnc_service_id = execution.getVariable(Prefix + "sdncServiceId")
- ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput")
+ ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(execution.getVariable(Prefix + "resourceInput"), ResourceInput.class)
String networkInstanceId = execution.getVariable("networkInstanceId")
String serviceType = resourceInputObj.getServiceType()
String serviceModelInvariantUuid = resourceInputObj.getServiceModelInfo().getModelInvariantUuid()
@@ -234,44 +233,44 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1"
xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1">
- ${msoUtils.xmlEncode(hdrRequestId)}
- ${msoUtils.xmlEncode(serviceInstanceId)}
- ${msoUtils.xmlEncode(sdnc_svcAction)}
+ ${msoUtils.xmlEscape(hdrRequestId)}
+ ${msoUtils.xmlEscape(serviceInstanceId)}
+ ${msoUtils.xmlEscape(sdnc_svcAction)}
vnf-topology-operation
sdncCallback
generic-resource
- ${msoUtils.xmlEncode(hdrRequestId)}
- ${msoUtils.xmlEncode(sdnc_requestAction)}
- ${msoUtils.xmlEncode(source)}
+ ${msoUtils.xmlEscape(hdrRequestId)}
+ ${msoUtils.xmlEscape(sdnc_requestAction)}
+ ${msoUtils.xmlEscape(source)}
- ${msoUtils.xmlEncode(serviceInstanceId)}
- ${msoUtils.xmlEncode(serviceType)}
+ ${msoUtils.xmlEscape(serviceInstanceId)}
+ ${msoUtils.xmlEscape(serviceType)}
- ${msoUtils.xmlEncode(serviceModelInvariantUuid)}
- ${msoUtils.xmlEncode(serviceModelUuid)}
- ${msoUtils.xmlEncode(serviceModelVersion)}
- ${msoUtils.xmlEncode(serviceModelName)}
+ ${msoUtils.xmlEscape(serviceModelInvariantUuid)}
+ ${msoUtils.xmlEscape(serviceModelUuid)}
+ ${msoUtils.xmlEscape(serviceModelVersion)}
+ ${msoUtils.xmlEscape(serviceModelName)}
- ${msoUtils.xmlEncode(serviceInstanceId)}
- ${msoUtils.xmlEncode(globalCustomerId)}
- ${msoUtils.xmlEncode(globalCustomerId)}
+ ${msoUtils.xmlEscape(serviceInstanceId)}
+ ${msoUtils.xmlEscape(globalCustomerId)}
+ ${msoUtils.xmlEscape(globalCustomerId)}
- ${msoUtils.xmlEncode(networkInstanceId)}
+ ${msoUtils.xmlEscape(networkInstanceId)}
- ${msoUtils.xmlEncode(modelInvariantUuid)}
- ${msoUtils.xmlEncode(modelCustomizationUuid)}
- ${msoUtils.xmlEncode(modelUuid)}
- ${msoUtils.xmlEncode(modelVersion)}
- ${msoUtils.xmlEncode(modelName)}
+ ${msoUtils.xmlEscape(modelInvariantUuid)}
+ ${msoUtils.xmlEscape(modelCustomizationUuid)}
+ ${msoUtils.xmlEscape(modelUuid)}
+ ${msoUtils.xmlEscape(modelVersion)}
+ ${msoUtils.xmlEscape(modelName)}
@@ -294,45 +293,45 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1"
xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1">
- ${msoUtils.xmlEncode(hdrRequestId)}
- ${msoUtils.xmlEncode(serviceInstanceId)}
- ${msoUtils.xmlEncode(sdnc_svcAction)}
+ ${msoUtils.xmlEscape(hdrRequestId)}
+ ${msoUtils.xmlEscape(serviceInstanceId)}
+ ${msoUtils.xmlEscape(sdnc_svcAction)}
connection-attachment-topology-operation
sdncCallback
generic-resource
- ${msoUtils.xmlEncode(hdrRequestId)}
- ${msoUtils.xmlEncode(sdnc_requestAction)}
- ${msoUtils.xmlEncode(source)}
+ ${msoUtils.xmlEscape(hdrRequestId)}
+ ${msoUtils.xmlEscape(sdnc_requestAction)}
+ ${msoUtils.xmlEscape(source)}
- ${msoUtils.xmlEncode(serviceInstanceId)}
- ${msoUtils.xmlEncode(serviceType)}
+ ${msoUtils.xmlEscape(serviceInstanceId)}
+ ${msoUtils.xmlEscape(serviceType)}
- ${msoUtils.xmlEncode(serviceModelInvariantUuid)}
- ${msoUtils.xmlEncode(serviceModelUuid)}
- ${msoUtils.xmlEncode(serviceModelVersion)}
- ${msoUtils.xmlEncode(serviceModelName)}
+ ${msoUtils.xmlEscape(serviceModelInvariantUuid)}
+ ${msoUtils.xmlEscape(serviceModelUuid)}
+ ${msoUtils.xmlEscape(serviceModelVersion)}
+ ${msoUtils.xmlEscape(serviceModelName)}
- ${msoUtils.xmlEncode(serviceInstanceId)}
- ${msoUtils.xmlEncode(globalCustomerId)}
+ ${msoUtils.xmlEscape(serviceInstanceId)}
+ ${msoUtils.xmlEscape(globalCustomerId)}
- ${msoUtils.xmlEncode(networkInstanceId)}
+ ${msoUtils.xmlEscape(networkInstanceId)}
$parentServiceInstanceId
- ${msoUtils.xmlEncode(modelInvariantUuid)}
- ${msoUtils.xmlEncode(modelCustomizationUuid)}
- ${msoUtils.xmlEncode(modelUuid)}
- ${msoUtils.xmlEncode(modelVersion)}
- ${msoUtils.xmlEncode(modelName)}
+ ${msoUtils.xmlEscape(modelInvariantUuid)}
+ ${msoUtils.xmlEscape(modelCustomizationUuid)}
+ ${msoUtils.xmlEscape(modelUuid)}
+ ${msoUtils.xmlEscape(modelVersion)}
+ ${msoUtils.xmlEscape(modelName)}
@@ -349,43 +348,43 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1"
xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1">
- ${msoUtils.xmlEncode(hdrRequestId)}
- ${msoUtils.xmlEncode(serviceInstanceId)}
- ${msoUtils.xmlEncode(sdnc_svcAction)}
+ ${msoUtils.xmlEscape(hdrRequestId)}
+ ${msoUtils.xmlEscape(serviceInstanceId)}
+ ${msoUtils.xmlEscape(sdnc_svcAction)}
network-topology-operation
sdncCallback
generic-resource
- ${msoUtils.xmlEncode(hdrRequestId)}
- ${msoUtils.xmlEncode(sdnc_requestAction)}
- ${msoUtils.xmlEncode(source)}
+ ${msoUtils.xmlEscape(hdrRequestId)}
+ ${msoUtils.xmlEscape(sdnc_requestAction)}
+ ${msoUtils.xmlEscape(source)}
- ${msoUtils.xmlEncode(serviceInstanceId)}
- ${msoUtils.xmlEncode(serviceType)}
+ ${msoUtils.xmlEscape(serviceInstanceId)}
+ ${msoUtils.xmlEscape(serviceType)}
- ${msoUtils.xmlEncode(serviceModelInvariantUuid)}
- ${msoUtils.xmlEncode(serviceModelUuid)}
- ${msoUtils.xmlEncode(serviceModelVersion)}
- ${msoUtils.xmlEncode(serviceModelName)}
+ ${msoUtils.xmlEscape(serviceModelInvariantUuid)}
+ ${msoUtils.xmlEscape(serviceModelUuid)}
+ ${msoUtils.xmlEscape(serviceModelVersion)}
+ ${msoUtils.xmlEscape(serviceModelName)}
- ${msoUtils.xmlEncode(serviceInstanceId)}
- ${msoUtils.xmlEncode(globalCustomerId)}
+ ${msoUtils.xmlEscape(serviceInstanceId)}
+ ${msoUtils.xmlEscape(globalCustomerId)}
- ${msoUtils.xmlEncode(networkInstanceId)}
+ ${msoUtils.xmlEscape(networkInstanceId)}
- ${msoUtils.xmlEncode(modelInvariantUuid)}
- ${msoUtils.xmlEncode(modelCustomizationUuid)}
- ${msoUtils.xmlEncode(modelUuid)}
- ${msoUtils.xmlEncode(modelVersion)}
- ${msoUtils.xmlEncode(modelName)}
+ ${msoUtils.xmlEscape(modelInvariantUuid)}
+ ${msoUtils.xmlEscape(modelCustomizationUuid)}
+ ${msoUtils.xmlEscape(modelUuid)}
+ ${msoUtils.xmlEscape(modelVersion)}
+ ${msoUtils.xmlEscape(modelName)}
@@ -401,40 +400,38 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
} catch (Exception ex) {
String exceptionMessage = " Bpmn error encountered in CreateSDNCCNetworkResource flow. prepareSDNCRequest() - " + ex.getMessage()
- msoLogger.debug( exceptionMessage)
+ logger.debug(exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
- msoLogger.info(" ***** Exit prepareSDNCRequest *****")
+ logger.info(" ***** Exit prepareSDNCRequest *****")
}
public void postActivateSDNCCall(DelegateExecution execution) {
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- msoLogger.info("started postCreateSDNCCall ")
+ logger.info("started postCreateSDNCCall ")
String responseCode = execution.getVariable(Prefix + "sdncCreateReturnCode")
String responseObj = execution.getVariable(Prefix + "SuccessIndicator")
- msoLogger.info("response from sdnc, response code :" + responseCode + " response object :" + responseObj)
+ logger.info("response from sdnc, response code :" + responseCode + " response object :" + responseObj)
}
public void sendSyncResponse(DelegateExecution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- msoLogger.dubug(" *** sendSyncResponse *** ")
+ logger.info("started sendsyncResp")
try {
String operationStatus = "finished"
// RESTResponse for main flow
String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim()
- msoLogger.dubug(" sendSyncResponse to APIH:" + "\n" + resourceOperationResp)
+ logger.debug(" sendSyncResponse to APIH:" + "\n" + resourceOperationResp)
sendWorkflowResponse(execution, 202, resourceOperationResp)
execution.setVariable("sentSyncResponse", true)
} catch (Exception ex) {
- String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage()
- msoLogger.debug( msg)
+ String msg = "Exception in sendSyncResponse:" + ex.getMessage()
+ logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.dubug(" ***** Exit sendSyncResopnse *****")
+ logger.info("exited send sync Resp")
}
-}
\ No newline at end of file
+}