summaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-infrastructure-common
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/so-bpmn-infrastructure-common')
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy294
-rwxr-xr-x[-rw-r--r--]bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy666
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy482
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy269
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy358
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy49
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy1
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java23
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java270
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java13
10 files changed, 1470 insertions, 955 deletions
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 545cba7f8c..c48d000ab3 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
@@ -32,14 +32,16 @@ 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
/**
* This groovy class supports the <class>ActivateSDNCCNetworkResource.bpmn</class> process.
* flow for SDNC Network Resource Activate
*/
public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateSDNCNetworkResource.class);
-
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ActivateSDNCNetworkResource.class);
+
String Prefix = "ACTSDNCRES_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -48,18 +50,19 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils()
+ MsoUtils msoUtils = new MsoUtils()
+
+
public void preProcessRequest(DelegateExecution execution) {
- msoLogger.trace("Started preProcessRequest ")
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ msoLogger.info(" ***** Started preProcessRequest *****")
try {
//get bpmn inputs from resource request.
String requestId = execution.getVariable("mso-request-id")
String requestAction = execution.getVariable("requestAction")
- msoLogger.info("The requestAction is: " + requestAction)
String recipeParamsFromRequest = execution.getVariable("recipeParams")
- msoLogger.info("The recipeParams is: " + recipeParamsFromRequest)
String resourceInput = execution.getVariable("resourceInput")
- msoLogger.info("The resourceInput is: " + resourceInput)
//Get ResourceInput Object
ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class)
execution.setVariable(Prefix + "resourceInput", resourceInputObj)
@@ -78,9 +81,41 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
operationType = jsonUtil.getJsonValue(recipeParamsFromWf, "operationType")
}
- // TODO: based on the resource type decide action and operation type
String sdnc_svcAction = "activate"
- operationType = "SOTNConnectivity"
+ switch (resourceInputObj.getResourceModelInfo().getModelName()) {
+ case ~/[\w\s\W]*SOTNConnectivity[\w\s\W]*/ :
+ operationType = "SOTNConnectivity"
+ break
+
+ case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ :
+ operationType = "SOTNAttachment"
+ break
+
+ case ~/[\w\s\W]*SiteVF[\w\s\W]*/ :
+ operationType = "Site"
+ break
+
+ case ~/[\w\s\W]*deviceVF[\w\s\W]*/ :
+ operationType = "SDWANDevice"
+ execution.setVariable("isActivateRequired", "true")
+ break
+
+ case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ :
+ operationType = "SDWANPort"
+ execution.setVariable("isActivateRequired", "true")
+ break
+
+ case ~/[\w\s\W]*SDWANConnectivity[\w\s\W]*/ :
+ operationType = "SDWANConnectivity"
+ break
+
+ case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ :
+ operationType = "SDWANAttachment"
+ break
+
+ default:
+ break
+ }
String sdnc_requestAction = StringUtils.capitalize(sdnc_svcAction) + operationType +"Instance"
execution.setVariable(Prefix + "svcAction", sdnc_svcAction)
@@ -92,38 +127,39 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
throw e;
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
- msoLogger.debug(msg)
+ msoLogger.debug( msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
}
public void prepareUpdateAfterActivateSDNCResource(DelegateExecution execution) {
- msoLogger.trace("started prepareUpdateAfterActivateSDNCResource ")
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ msoLogger.info("started prepareUpdateAfterActivateSDNCResource ")
ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput")
String operType = resourceInputObj.getOperationType()
String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid()
String ServiceInstanceId = resourceInputObj.getServiceInstanceId()
String operationId = resourceInputObj.getOperationId()
- String progress = "100"
- String status = "finished"
- String statusDescription = "SDCN resource creation completed"
+ String progress = "80"
+ String status = "activated"
+ String statusDescription = "SDCN resource activation completed"
execution.getVariable("operationId")
String body = """
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:ns="http://org.onap.so/requestsdb">
+ xmlns:ns="http://org.openecomp.mso/requestsdb">
<soapenv:Header/>
<soapenv:Body>
<ns:updateResourceOperationStatus>
- <operType>${MsoUtils.xmlEscape(operType)}</operType>
- <operationId>${MsoUtils.xmlEscape(operationId)}</operationId>
- <progress>${MsoUtils.xmlEscape(progress)}</progress>
- <resourceTemplateUUID>${MsoUtils.xmlEscape(resourceCustomizationUuid)}</resourceTemplateUUID>
- <serviceId>${MsoUtils.xmlEscape(ServiceInstanceId)}</serviceId>
- <status>${MsoUtils.xmlEscape(status)}</status>
- <statusDescription>${MsoUtils.xmlEscape(statusDescription)}</statusDescription>
+ <operType>${msoUtils.xmlEncode(operType)}</operType>
+ <operationId>${msoUtils.xmlEncode(operationId)}</operationId>
+ <progress>${msoUtils.xmlEncode(progress)}</progress>
+ <resourceTemplateUUID>${msoUtils.xmlEncode(resourceCustomizationUuid)}</resourceTemplateUUID>
+ <serviceId>${msoUtils.xmlEncode(ServiceInstanceId)}</serviceId>
+ <status>${msoUtils.xmlEncode(status)}</status>
+ <statusDescription>${msoUtils.xmlEncode(statusDescription)}</statusDescription>
</ns:updateResourceOperationStatus>
</soapenv:Body>
</soapenv:Envelope>""";
@@ -131,8 +167,32 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
setProgressUpdateVariables(execution, body)
}
+ private void setProgressUpdateVariables(DelegateExecution execution, String body) {
+ def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint")
+ execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
+ execution.setVariable("CVFMI_updateResOperStatusRequest", body)
+ }
+
+ String customizeResourceParam(String networkInputParametersJson) {
+ List<Map<String, Object>> paramList = new ArrayList();
+ JSONObject jsonObject = new JSONObject(networkInputParametersJson);
+ Iterator iterator = jsonObject.keys();
+ while (iterator.hasNext()) {
+ String key = iterator.next();
+ HashMap<String, String> hashMap = new HashMap();
+ hashMap.put("name", key);
+ hashMap.put("value", jsonObject.get(key))
+ paramList.add(hashMap)
+ }
+ Map<String, List<Map<String, Object>>> paramMap = new HashMap();
+ paramMap.put("param", paramList);
+
+ return new JSONObject(paramMap).toString();
+ }
+
public void prepareSDNCRequest (DelegateExecution execution) {
- msoLogger.trace("Started prepareSDNCRequest ")
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ msoLogger.info("Started prepareSDNCRequest ")
try {
// get variables
@@ -141,11 +201,13 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
String sdncCallback = execution.getVariable("URN_mso_workflow_sdncadapter_callback")
String createNetworkInput = execution.getVariable(Prefix + "networkRequest")
+ String parentServiceInstanceId = execution.getVariable("parentServiceInstanceId")
String hdrRequestId = execution.getVariable("mso-request-id")
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")
+ String networkInstanceId = execution.getVariable("networkInstanceId")
String serviceType = resourceInputObj.getServiceType()
String serviceModelInvariantUuid = resourceInputObj.getServiceModelInfo().getModelInvariantUuid()
String serviceModelUuid = resourceInputObj.getServiceModelInfo().getModelUuid()
@@ -165,172 +227,169 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
String sdncTopologyActivateRequest = ""
switch (modelName) {
- case ~/^Site$/:
- sdncTopologyActivateRequest =
- """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
- xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1"
+ case ~/[\w\s\W]*deviceVF[\w\s\W]*/ :
+ case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ :
+ case ~/[\w\s\W]*SiteVF[\w\s\W]*/:
+ sdncTopologyActivateRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
+ xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1"
xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1">
<sdncadapter:RequestHeader>
- <sdncadapter:RequestId>${MsoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId>
- <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId>
- <sdncadapter:SvcAction>${MsoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction>
- <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation>
+ <sdncadapter:RequestId>${msoUtils.xmlEncode(hdrRequestId)}</sdncadapter:RequestId>
+ <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId>
+ <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction>
+ <sdncadapter:SvcOperation>vnf-topology-operation</sdncadapter:SvcOperation>
<sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl>
<sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction>
</sdncadapter:RequestHeader>
<sdncadapterworkflow:SDNCRequestData>
<request-information>
- <request-id>${MsoUtils.xmlEscape(hdrRequestId)}</request-id>
- <request-action>${MsoUtils.xmlEscape(sdnc_requestAction)}</request-action>
- <source>${MsoUtils.xmlEscape(source)}</source>
+ <request-id>${msoUtils.xmlEncode(hdrRequestId)}</request-id>
+ <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action>
+ <source>${msoUtils.xmlEncode(source)}</source>
<notification-url></notification-url>
<order-number></order-number>
<order-version></order-version>
</request-information>
<service-information>
- <service-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-id>
- <subscription-service-type>${MsoUtils.xmlEscape(serviceType)}</subscription-service-type>
+ <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id>
+ <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type>
<onap-model-information>
- <model-invariant-uuid>${MsoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid>
- <model-uuid>${MsoUtils.xmlEscape(serviceModelUuid)}</model-uuid>
- <model-version>${MsoUtils.xmlEscape(serviceModelVersion)}</model-version>
- <model-name>${MsoUtils.xmlEscape(serviceModelName)}</model-name>
+ <model-invariant-uuid>${msoUtils.xmlEncode(serviceModelInvariantUuid)}</model-invariant-uuid>
+ <model-uuid>${msoUtils.xmlEncode(serviceModelUuid)}</model-uuid>
+ <model-version>${msoUtils.xmlEncode(serviceModelVersion)}</model-version>
+ <model-name>${msoUtils.xmlEncode(serviceModelName)}</model-name>
</onap-model-information>
- <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id>
- <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id>
+ <service-instance-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-instance-id>
+ <global-customer-id>${msoUtils.xmlEncode(globalCustomerId)}</global-customer-id>
+ <subscriber-name>${msoUtils.xmlEncode(globalCustomerId)}</subscriber-name>
</service-information>
<vnf-information>
- <vnf-id></vnf-id>
+ <vnf-id>${msoUtils.xmlEncode(networkInstanceId)}</vnf-id>
<vnf-type></vnf-type>
<onap-model-information>
- <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid>
- <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid>
- <model-uuid>${MsoUtils.xmlEscape(modelUuid)}</model-uuid>
- <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version>
- <model-name>${MsoUtils.xmlEscape(modelName)}</model-name>
+ <model-invariant-uuid>${msoUtils.xmlEncode(modelInvariantUuid)}</model-invariant-uuid>
+ <model-customization-uuid>${msoUtils.xmlEncode(modelCustomizationUuid)}</model-customization-uuid>
+ <model-uuid>${msoUtils.xmlEncode(modelUuid)}</model-uuid>
+ <model-version>${msoUtils.xmlEncode(modelVersion)}</model-version>
+ <model-name>${msoUtils.xmlEncode(modelName)}</model-name>
</onap-model-information>
</vnf-information>
- <vnf-input-parameters>
- <param>${MsoUtils.xmlEscape(netowrkInputParameters)}</param>
- </vnf-input-parameters>
<vnf-request-input>
- <request-version></request-version>
- <vnf-name></vnf-name>
- <neutron-id></neutron-id>
- <contrail-network-fqdn></contrail-network-fqdn>
- <subnets-data>
- <subnet-data>
- <element>
- <ip-version></ip-version>
- <subnet-id></subnet-id>
- </subnet-data>
- </subnets-data>
- </vnf-request-input>
+ <vnf-input-parameters>
+ $netowrkInputParameters
+ </vnf-input-parameters>
+ <request-version></request-version>
+ <vnf-name></vnf-name>
+ <vnf-networks>
+ </vnf-networks>
+ </vnf-request-input>
</sdncadapterworkflow:SDNCRequestData>
</aetgt:SDNCAdapterWorkflowRequest>""".trim()
break
- case ~/^SOTNAttachment$/:
+ case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ :
+ case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/:
sdncTopologyActivateRequest =
"""<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1"
xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1">
<sdncadapter:RequestHeader>
- <sdncadapter:RequestId>${MsoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId>
- <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId>
- <sdncadapter:SvcAction>${MsoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction>
- <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation>
+ <sdncadapter:RequestId>${msoUtils.xmlEncode(hdrRequestId)}</sdncadapter:RequestId>
+ <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId>
+ <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction>
+ <sdncadapter:SvcOperation>connection-attachment-topology-operation</sdncadapter:SvcOperation>
<sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl>
<sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction>
</sdncadapter:RequestHeader>
<sdncadapterworkflow:SDNCRequestData>
<request-information>
- <request-id>${MsoUtils.xmlEscape(hdrRequestId)}</request-id>
- <request-action>${MsoUtils.xmlEscape(sdnc_requestAction)}</request-action>
- <source>${MsoUtils.xmlEscape(source)}</source>
+ <request-id>${msoUtils.xmlEncode(hdrRequestId)}</request-id>
+ <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action>
+ <source>${msoUtils.xmlEncode(source)}</source>
<notification-url></notification-url>
<order-number></order-number>
<order-version></order-version>
</request-information>
<service-information>
- <service-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-id>
- <subscription-service-type>${MsoUtils.xmlEscape(serviceType)}</subscription-service-type>
+ <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id>
+ <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type>
<onap-model-information>
- <model-invariant-uuid>${MsoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid>
- <model-uuid>${MsoUtils.xmlEscape(serviceModelUuid)}</model-uuid>
- <model-version>${MsoUtils.xmlEscape(serviceModelVersion)}</model-version>
- <model-name>${MsoUtils.xmlEscape(serviceModelName)}</model-name>
+ <model-invariant-uuid>${msoUtils.xmlEncode(serviceModelInvariantUuid)}</model-invariant-uuid>
+ <model-uuid>${msoUtils.xmlEncode(serviceModelUuid)}</model-uuid>
+ <model-version>${msoUtils.xmlEncode(serviceModelVersion)}</model-version>
+ <model-name>${msoUtils.xmlEncode(serviceModelName)}</model-name>
</onap-model-information>
- <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id>
- <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id>
+ <service-instance-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-instance-id>
+ <global-customer-id>${msoUtils.xmlEncode(globalCustomerId)}</global-customer-id>
</service-information>
<allotted-resource-information>
<!-- TODO: to be filled as per the request input -->
- <allotted-resource-input></allotted-resource-input>
+ <allotted-resource-id>${msoUtils.xmlEncode(networkInstanceId)}</allotted-resource-id>
<allotted-resource-type></allotted-resource-type>
- <parent-service-instance-id><parent-service-instance-id>
+ <parent-service-instance-id>$parentServiceInstanceId</parent-service-instance-id>
<onap-model-information>
- <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid>
- <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid>
- <model-uuid>${MsoUtils.xmlEscape(modelUuid)}</model-uuid>
- <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version>
- <model-name>${MsoUtils.xmlEscape(modelName)}</model-name>
+ <model-invariant-uuid>${msoUtils.xmlEncode(modelInvariantUuid)}</model-invariant-uuid>
+ <model-customization-uuid>${msoUtils.xmlEncode(modelCustomizationUuid)}</model-customization-uuid>
+ <model-uuid>${msoUtils.xmlEncode(modelUuid)}</model-uuid>
+ <model-version>${msoUtils.xmlEncode(modelVersion)}</model-version>
+ <model-name>${msoUtils.xmlEncode(modelName)}</model-name>
</onap-model-information>
</allotted-resource-information>
<connection-attachment-request-input>
- <param>${MsoUtils.xmlEscape(netowrkInputParameters)}</param>
+ $netowrkInputParameters
</connection-attachment-request-input>
</sdncadapterworkflow:SDNCRequestData>
</aetgt:SDNCAdapterWorkflowRequest>""".trim()
break
+ // for SDWANConnectivity and SOTN Connectivity
default:
sdncTopologyActivateRequest =
"""<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1"
xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1">
<sdncadapter:RequestHeader>
- <sdncadapter:RequestId>${MsoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId>
- <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId>
- <sdncadapter:SvcAction>${MsoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction>
+ <sdncadapter:RequestId>${msoUtils.xmlEncode(hdrRequestId)}</sdncadapter:RequestId>
+ <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId>
+ <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction>
<sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation>
<sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl>
<sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction>
</sdncadapter:RequestHeader>
<sdncadapterworkflow:SDNCRequestData>
<request-information>
- <request-id>${MsoUtils.xmlEscape(hdrRequestId)}</request-id>
- <request-action>${MsoUtils.xmlEscape(sdnc_requestAction)}</request-action>
- <source>${MsoUtils.xmlEscape(source)}</source>
+ <request-id>${msoUtils.xmlEncode(hdrRequestId)}</request-id>
+ <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action>
+ <source>${msoUtils.xmlEncode(source)}</source>
<notification-url></notification-url>
<order-number></order-number>
<order-version></order-version>
</request-information>
<service-information>
- <service-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-id>
- <subscription-service-type>${MsoUtils.xmlEscape(serviceType)}</subscription-service-type>
+ <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id>
+ <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type>
<onap-model-information>
- <model-invariant-uuid>${MsoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid>
- <model-uuid>${MsoUtils.xmlEscape(serviceModelUuid)}</model-uuid>
- <model-version>${MsoUtils.xmlEscape(serviceModelVersion)}</model-version>
- <model-name>${MsoUtils.xmlEscape(serviceModelName)}</model-name>
+ <model-invariant-uuid>${msoUtils.xmlEncode(serviceModelInvariantUuid)}</model-invariant-uuid>
+ <model-uuid>${msoUtils.xmlEncode(serviceModelUuid)}</model-uuid>
+ <model-version>${msoUtils.xmlEncode(serviceModelVersion)}</model-version>
+ <model-name>${msoUtils.xmlEncode(serviceModelName)}</model-name>
</onap-model-information>
- <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id>
- <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id>
+ <service-instance-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-instance-id>
+ <global-customer-id>${msoUtils.xmlEncode(globalCustomerId)}</global-customer-id>
</service-information>
<network-information>
<!-- TODO: to be filled by response from create -->
- <network-id></network-id>
+ <network-id>${msoUtils.xmlEncode(networkInstanceId)}</network-id>
<onap-model-information>
- <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid>
- <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid>
- <model-uuid>${MsoUtils.xmlEscape(modelUuid)}</model-uuid>
- <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version>
- <model-name>${MsoUtils.xmlEscape(modelName)}</model-name>
+ <model-invariant-uuid>${msoUtils.xmlEncode(modelInvariantUuid)}</model-invariant-uuid>
+ <model-customization-uuid>${msoUtils.xmlEncode(modelCustomizationUuid)}</model-customization-uuid>
+ <model-uuid>${msoUtils.xmlEncode(modelUuid)}</model-uuid>
+ <model-version>${msoUtils.xmlEncode(modelVersion)}</model-version>
+ <model-name>${msoUtils.xmlEncode(modelName)}</model-name>
</onap-model-information>
</network-information>
<network-request-input>
- <network-input-parameters>${MsoUtils.xmlEscape(netowrkInputParameters)}</network-input-parameters>
+ <network-input-parameters>$netowrkInputParameters</network-input-parameters>
</network-request-input>
</sdncadapterworkflow:SDNCRequestData>
</aetgt:SDNCAdapterWorkflowRequest>""".trim()
@@ -338,21 +397,20 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
}
String sdncTopologyActivateRequesAsString = utils.formatXml(sdncTopologyActivateRequest)
- msoLogger.debug(sdncTopologyActivateRequesAsString)
execution.setVariable("sdncAdapterWorkflowRequest", sdncTopologyActivateRequesAsString)
- msoLogger.debug("sdncAdapterWorkflowRequest - " + "\n" + sdncTopologyActivateRequesAsString)
} catch (Exception ex) {
String exceptionMessage = " Bpmn error encountered in CreateSDNCCNetworkResource flow. prepareSDNCRequest() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ msoLogger.debug( exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
- msoLogger.trace("Exit prepareSDNCRequest ")
+ msoLogger.info(" ***** Exit prepareSDNCRequest *****")
}
- public void postCreateSDNCCall(DelegateExecution execution) {
- msoLogger.trace("started postCreateSDNCCall ")
+ public void postActivateSDNCCall(DelegateExecution execution) {
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ msoLogger.info("started postCreateSDNCCall ")
String responseCode = execution.getVariable(Prefix + "sdncCreateReturnCode")
String responseObj = execution.getVariable(Prefix + "SuccessIndicator")
@@ -361,24 +419,22 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
}
public void sendSyncResponse(DelegateExecution execution) {
- msoLogger.trace("started sendSyncResponse ")
-
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- utils.log("DEBUG", " *** sendSyncResponse *** ", isDebugEnabled)
+ msoLogger.dubug(" *** sendSyncResponse *** ")
try {
String operationStatus = "finished"
// RESTResponse for main flow
String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim()
- utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + resourceOperationResp, isDebugEnabled)
+ msoLogger.dubug(" sendSyncResponse to APIH:" + "\n" + resourceOperationResp)
sendWorkflowResponse(execution, 202, resourceOperationResp)
execution.setVariable("sentSyncResponse", true)
} catch (Exception ex) {
String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage()
- utils.log("DEBUG", msg, isDebugEnabled)
+ msoLogger.debug( msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- utils.log("DEBUG"," ***** Exit sendSyncResopnse *****", isDebugEnabled)
+ msoLogger.dubug(" ***** Exit sendSyncResopnse *****")
}
} \ No newline at end of file
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy
index 4405718c57..968612301d 100644..100755
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateGenericALaCarteServiceInstance.groovy
@@ -18,7 +18,10 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.infrastructure.scripts;
+package org.onap.so.bpmn.infrastructure.scripts
+
+import org.onap.so.bpmn.core.domain.ModelInfo
+import org.onap.so.bpmn.core.domain.VnfResource;
import static org.apache.commons.lang3.StringUtils.*;
@@ -43,315 +46,358 @@ import groovy.json.*
*
*/
public class CreateGenericALaCarteServiceInstance extends AbstractServiceTaskProcessor {
- String Prefix="CRESI_"
- ExceptionUtil exceptionUtil = new ExceptionUtil()
- JsonUtils jsonUtil = new JsonUtils()
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateGenericALaCarteServiceInstance.class);
-
- public void preProcessRequest (DelegateExecution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- execution.setVariable("prefix",Prefix)
- String msg = ""
-
- try {
-
- String siRequest = execution.getVariable("bpmnRequest")
- msoLogger.debug(siRequest)
-
- String requestId = execution.getVariable("mso-request-id")
- execution.setVariable("msoRequestId", requestId)
- msoLogger.debug("Input Request:" + siRequest + " reqId:" + requestId)
-
- String serviceInstanceId = execution.getVariable("serviceInstanceId")
- if (isBlank(serviceInstanceId)) {
- serviceInstanceId = UUID.randomUUID().toString()
- msoLogger.debug("Generated new Service Instance ID:" + serviceInstanceId)
- } else {
- msoLogger.debug("Using provided Service Instance ID:" + serviceInstanceId)
- }
-
- serviceInstanceId = UriUtils.encode(serviceInstanceId,"UTF-8")
- execution.setVariable("serviceInstanceId", serviceInstanceId)
-
- //subscriberInfo
- String globalSubscriberId = jsonUtil.getJsonValue(siRequest, "requestDetails.subscriberInfo.globalSubscriberId")
- if (isBlank(globalSubscriberId)) {
- msg = "Input globalSubscriberId' is null"
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else {
- execution.setVariable("globalSubscriberId", globalSubscriberId)
- }
-
- //requestInfo
- execution.setVariable("source", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.source"))
- execution.setVariable("serviceInstanceName", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.instanceName"))
- execution.setVariable("disableRollback", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.suppressRollback"))
- String productFamilyId = null;
- try {
- productFamilyId = jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.productFamilyId")
- } catch (JSONException e) {
- productFamilyId = null;
- }
- if (isBlank(productFamilyId))
- {
- msg = "Input productFamilyId is null"
- msoLogger.debug(msg)
- //exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else {
- execution.setVariable("productFamilyId", productFamilyId)
- }
-
- //modelInfo
- String serviceModelInfo = jsonUtil.getJsonValue(siRequest, "requestDetails.modelInfo")
- if (isBlank(serviceModelInfo)) {
- msg = "Input serviceModelInfo is null"
- msoLogger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else
- {
- execution.setVariable("serviceModelInfo", serviceModelInfo)
- }
-
- msoLogger.debug("modelInfo" + serviceModelInfo)
-
- //requestParameters
- String subscriptionServiceType = jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.subscriptionServiceType")
- if (isBlank(subscriptionServiceType)) {
- msg = "Input subscriptionServiceType is null"
- msoLogger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- } else {
- execution.setVariable("subscriptionServiceType", subscriptionServiceType)
- }
-
-
- /*
- * Extracting User Parameters from incoming Request and converting into a Map
- */
- def jsonSlurper = new JsonSlurper()
- def jsonOutput = new JsonOutput()
-
- Map reqMap = jsonSlurper.parseText(siRequest)
-
- //InputParams
- def userParams = reqMap.requestDetails?.requestParameters?.userParams
-
- Map<String, String> inputMap = [:]
- if (userParams) {
- userParams.each {
- userParam -> inputMap.put(userParam.name, userParam.value.toString())
- }
- }
-
- msoLogger.debug("User Input Parameters map: " + userParams.toString())
- execution.setVariable("serviceInputParams", inputMap)
-
- //TODO
- //execution.setVariable("failExists", true)
-
- } catch (BpmnError e) {
- throw e;
- } catch (Exception ex){
- msg = "Exception in preProcessRequest " + ex.getMessage()
- msoLogger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
- }
- msoLogger.trace("Exit preProcessRequest")
- }
-
- public void sendSyncResponse (DelegateExecution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- msoLogger.trace("Start sendSyncResponse")
-
- try {
- String requestId = execution.getVariable("msoRequestId")
- String serviceInstanceId = execution.getVariable("serviceInstanceId")
- // RESTResponse for API Handler (APIH) Reply Task
- String createServiceRestRequest = """{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${requestId}"}}""".trim()
- msoLogger.debug(" sendSyncResponse to APIH:" + "\n" + createServiceRestRequest)
- sendWorkflowResponse(execution, 202, createServiceRestRequest)
- execution.setVariable("sentSyncResponse", true)
-
- } catch (Exception ex) {
- String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage()
- msoLogger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
- }
- msoLogger.trace("Exit sendSyncResopnse")
- }
-
-
- public void sendSyncError (DelegateExecution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- msoLogger.trace("Start sendSyncError")
-
- try {
- String errorMessage = ""
- if (execution.getVariable("WorkflowException") instanceof WorkflowException) {
- WorkflowException wfe = execution.getVariable("WorkflowException")
- errorMessage = wfe.getErrorMessage()
- } else {
- errorMessage = "Sending Sync Error."
- }
-
- String buildworkflowException =
- """<aetgt:WorkflowException xmlns:aetgt="http://org.onap/so/workflow/schema/v1">
- <aetgt:ErrorMessage>${MsoUtils.xmlEscape(errorMessage)}</aetgt:ErrorMessage>
- <aetgt:ErrorCode>7000</aetgt:ErrorCode>
- </aetgt:WorkflowException>"""
-
- msoLogger.debug(buildworkflowException)
- sendWorkflowResponse(execution, 500, buildworkflowException)
-
- } catch (Exception ex) {
- msoLogger.debug(" Sending Sync Error Activity Failed. " + "\n" + ex.getMessage())
- }
-
- }
-
- // *******************************
- //
- // *******************************
- public void prepareDecomposeService(DelegateExecution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- msoLogger.trace("Inside prepareDecomposeService of CreateGenericALaCarteServiceInstance ")
- try {
- String siRequest = execution.getVariable("bpmnRequest")
- String serviceModelInfo = jsonUtil.getJsonValue(siRequest, "requestDetails.modelInfo")
- execution.setVariable("serviceModelInfo", serviceModelInfo)
- } catch (Exception ex) {
- // try error in method block
- String exceptionMessage = "Bpmn error encountered in CreateGenericALaCarteServiceInstance flow. Unexpected Error from method prepareDecomposeService() - " + ex.getMessage()
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
- }
- msoLogger.trace("Completed prepareDecomposeService of CreateGenericALaCarteServiceInstance")
- }
-
-
- // *******************************
- //
- // *******************************
- public void prepareCreateServiceInstance(DelegateExecution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ String Prefix="CRESI_"
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ JsonUtils jsonUtil = new JsonUtils()
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateGenericALaCarteServiceInstance.class);
+
+ public void preProcessRequest (DelegateExecution execution) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ execution.setVariable("prefix",Prefix)
+ String msg = ""
+
+ try {
+
+ String siRequest = execution.getVariable("bpmnRequest")
+ msoLogger.debug(siRequest)
+
+ String requestId = execution.getVariable("mso-request-id")
+ execution.setVariable("msoRequestId", requestId)
+ msoLogger.debug("Input Request:" + siRequest + " reqId:" + requestId)
+
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ if (isBlank(serviceInstanceId)) {
+ serviceInstanceId = UUID.randomUUID().toString()
+ msoLogger.debug("Generated new Service Instance ID:" + serviceInstanceId)
+ } else {
+ msoLogger.debug("Using provided Service Instance ID:" + serviceInstanceId)
+ }
+
+ serviceInstanceId = UriUtils.encode(serviceInstanceId,"UTF-8")
+ execution.setVariable("serviceInstanceId", serviceInstanceId)
+
+ //subscriberInfo
+ String globalSubscriberId = jsonUtil.getJsonValue(siRequest, "requestDetails.subscriberInfo.globalSubscriberId")
+ if (isBlank(globalSubscriberId)) {
+ msg = "Input globalSubscriberId' is null"
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else {
+ execution.setVariable("globalSubscriberId", globalSubscriberId)
+ }
+
+ //requestInfo
+ execution.setVariable("source", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.source"))
+ execution.setVariable("serviceInstanceName", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.instanceName"))
+ execution.setVariable("disableRollback", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.suppressRollback"))
+ String productFamilyId = null;
+ try {
+ productFamilyId = jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.productFamilyId")
+ } catch (JSONException e) {
+ productFamilyId = null;
+ }
+ if (isBlank(productFamilyId))
+ {
+ msg = "Input productFamilyId is null"
+ msoLogger.debug(msg)
+ //exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else {
+ execution.setVariable("productFamilyId", productFamilyId)
+ }
+
+ //modelInfo
+ String serviceModelInfo = jsonUtil.getJsonValue(siRequest, "requestDetails.modelInfo")
+ if (isBlank(serviceModelInfo)) {
+ msg = "Input serviceModelInfo is null"
+ msoLogger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else
+ {
+ execution.setVariable("serviceModelInfo", serviceModelInfo)
+ }
+
+ msoLogger.debug("modelInfo" + serviceModelInfo)
+
+ //requestParameters
+ String subscriptionServiceType = jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.subscriptionServiceType")
+ if (isBlank(subscriptionServiceType)) {
+ msg = "Input subscriptionServiceType is null"
+ msoLogger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ } else {
+ execution.setVariable("subscriptionServiceType", subscriptionServiceType)
+ }
+
+
+ /*
+ * Extracting User Parameters from incoming Request and converting into a Map
+ */
+ def jsonSlurper = new JsonSlurper()
+ def jsonOutput = new JsonOutput()
+
+ Map reqMap = jsonSlurper.parseText(siRequest)
+
+ //InputParams
+ def userParams = reqMap.requestDetails?.requestParameters?.userParams
+
+ Map<String, String> inputMap = [:]
+ if (userParams) {
+ userParams.each {
+ userParam -> inputMap.put(userParam.name, userParam.value.toString())
+ }
+ }
+
+ msoLogger.debug("User Input Parameters map: " + userParams.toString())
+ execution.setVariable("serviceInputParams", inputMap)
+
+ //TODO
+ //execution.setVariable("failExists", true)
+
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception ex){
+ msg = "Exception in preProcessRequest " + ex.getMessage()
+ msoLogger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ msoLogger.trace("Exit preProcessRequest")
+ }
+
+ public void sendSyncResponse (DelegateExecution execution) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ msoLogger.trace("Start sendSyncResponse")
+
+ try {
+ String requestId = execution.getVariable("msoRequestId")
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ // RESTResponse for API Handler (APIH) Reply Task
+ String createServiceRestRequest = """{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${requestId}"}}""".trim()
+ msoLogger.debug(" sendSyncResponse to APIH:" + "\n" + createServiceRestRequest)
+ sendWorkflowResponse(execution, 202, createServiceRestRequest)
+ execution.setVariable("sentSyncResponse", true)
+
+ } catch (Exception ex) {
+ String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage()
+ msoLogger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ msoLogger.trace("Exit sendSyncResopnse")
+ }
+
+
+ public void sendSyncError (DelegateExecution execution) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ msoLogger.trace("Start sendSyncError")
+
+ try {
+ String errorMessage = ""
+ if (execution.getVariable("WorkflowException") instanceof WorkflowException) {
+ WorkflowException wfe = execution.getVariable("WorkflowException")
+ errorMessage = wfe.getErrorMessage()
+ } else {
+ errorMessage = "Sending Sync Error."
+ }
+
+ String buildworkflowException =
+ """<aetgt:WorkflowException xmlns:aetgt="http://org.onap/so/workflow/schema/v1">
+ <aetgt:ErrorMessage>${MsoUtils.xmlEscape(errorMessage)}</aetgt:ErrorMessage>
+ <aetgt:ErrorCode>7000</aetgt:ErrorCode>
+ </aetgt:WorkflowException>"""
+
+ msoLogger.debug(buildworkflowException)
+ sendWorkflowResponse(execution, 500, buildworkflowException)
+
+ } catch (Exception ex) {
+ msoLogger.debug(" Sending Sync Error Activity Failed. " + "\n" + ex.getMessage())
+ }
+
+ }
+
+ // *******************************
+ //
+ // *******************************
+ public void prepareDecomposeService(DelegateExecution execution) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ msoLogger.trace("Inside prepareDecomposeService of CreateGenericALaCarteServiceInstance ")
+ try {
+ String siRequest = execution.getVariable("bpmnRequest")
+ String serviceModelInfo = jsonUtil.getJsonValue(siRequest, "requestDetails.modelInfo")
+ execution.setVariable("serviceModelInfo", serviceModelInfo)
+ } catch (Exception ex) {
+ // try error in method block
+ String exceptionMessage = "Bpmn error encountered in CreateGenericALaCarteServiceInstance flow. Unexpected Error from method prepareDecomposeService() - " + ex.getMessage()
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
+ }
+ msoLogger.trace("Completed prepareDecomposeService of CreateGenericALaCarteServiceInstance")
+ }
+
+ public void processDecomposition(DelegateExecution execution) {
+ def isDebugEnabled = execution.getVariable(DebugFlag)
+
+ msoLogger.trace("Inside processDecomposition() of CreateGenericALaCarteServiceInstance ")
+
+ try {
+
+ ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
+
+ // VNFs
+ List<VnfResource> vnfList = serviceDecomposition.getVnfResources()
+ filterVnfs(vnfList)
+ serviceDecomposition.setVnfResources(vnfList)
+
+ execution.setVariable("vnfList", vnfList)
+ execution.setVariable("vnfListString", vnfList.toString())
+
+ String vnfModelInfoString = ""
+ if (vnfList != null && vnfList.size() > 0) {
+ execution.setVariable(Prefix + "VNFsCount", vnfList.size())
+ msoLogger.debug("vnfs to create: " + vnfList.size())
+ ModelInfo vnfModelInfo = vnfList[0].getModelInfo()
+
+ vnfModelInfoString = vnfModelInfo.toString()
+ String vnfModelInfoWithRoot = vnfModelInfo.toString()
+ vnfModelInfoString = jsonUtil.getJsonValue(vnfModelInfoWithRoot, "modelInfo")
+ } else {
+ execution.setVariable(Prefix + "VNFsCount", 0)
+ msoLogger.debug("no vnfs to create based upon serviceDecomposition content")
+ }
+
+ execution.setVariable("vnfModelInfo", vnfModelInfoString)
+ execution.setVariable("vnfModelInfoString", vnfModelInfoString)
+ msoLogger.debug(" vnfModelInfoString :" + vnfModelInfoString)
+
+ msoLogger.trace("Completed processDecomposition() of CreateGenericALaCarteServiceInstance ")
+ } catch (Exception ex) {
+ sendSyncError(execution)
+ String exceptionMessage = "Bpmn error encountered in CreateGenericALaCarteServiceInstance flow. processDecomposition() - " + ex.getMessage()
+ msoLogger.debug(exceptionMessage)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
+ }
+ }
+
+ // *******************************
+ //
+ // *******************************
+ public void prepareCreateServiceInstance(DelegateExecution execution) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- try {
- msoLogger.trace("Inside prepareCreateServiceInstance of CreateGenericALaCarteServiceInstance")
+ try {
+ msoLogger.trace("Inside prepareCreateServiceInstance of CreateGenericALaCarteServiceInstance")
- /*
- * Extracting User Parameters from incoming Request and converting into a Map
- */
- def jsonSlurper = new JsonSlurper()
- def jsonOutput = new JsonOutput()
- def siRequest = execution.getVariable("bpmnRequest")
- Map reqMap = jsonSlurper.parseText(siRequest)
- //InputParams
- def userParams = reqMap.requestDetails?.requestParameters?.userParams
- Map<String, String> inputMap = [:]
- if (userParams != null) {
- userParams.each {
- userParam -> inputMap.put(userParam.name, userParam.value)
- }
- }
-
- msoLogger.debug("User Input Parameters map: " + userParams.toString())
- execution.setVariable("serviceInputParams", inputMap)
-
- ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
-
- String serviceInstanceId = execution.getVariable("serviceInstanceId")
- serviceDecomposition.getServiceInstance().setInstanceId(serviceInstanceId)
-
- String serviceInstanceName = jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.instanceName")
- serviceDecomposition.getServiceInstance().setInstanceName(serviceInstanceName)
- execution.setVariable("serviceInstanceName", serviceInstanceName)
- execution.setVariable("serviceDecomposition", serviceDecomposition)
- execution.setVariable("serviceDecompositionString", serviceDecomposition.toJsonString())
- msoLogger.debug("serviceDecomposition.serviceInstanceName: " + serviceDecomposition.getServiceInstance().getInstanceName())
-
- msoLogger.trace("Completed prepareCreateServiceInstance of CreateGenericALaCarteServiceInstance ***** ")
- } catch (Exception ex) {
- // try error in method block
- String exceptionMessage = "Bpmn error encountered in CreateGenericALaCarteServiceInstance flow. Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage()
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
- }
- }
-
-
- public void prepareCompletionRequest (DelegateExecution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- msoLogger.trace("prepareCompletion *** ")
-
- try {
- String requestId = execution.getVariable("msoRequestId")
- String serviceInstanceId = execution.getVariable("serviceInstanceId")
- String source = execution.getVariable("source")
-
- String msoCompletionRequest =
- """<aetgt:MsoCompletionRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
- xmlns:ns="http://org.onap/so/request/types/v1">
- <request-info xmlns="http://org.onap/so/infra/vnf-request/v1">
- <request-id>${MsoUtils.xmlEscape(requestId)}</request-id>
- <action>CREATE</action>
- <source>${MsoUtils.xmlEscape(source)}</source>
- </request-info>
- <status-message>Service Instance was created successfully.</status-message>
- <serviceInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</serviceInstanceId>
- <mso-bpel-name>CreateGenericALaCarteServiceInstance</mso-bpel-name>
- </aetgt:MsoCompletionRequest>"""
-
- // Format Response
- String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest)
-
- execution.setVariable("completionRequest", xmlMsoCompletionRequest)
- msoLogger.debug(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest)
-
- } catch (Exception ex) {
- String msg = " Exception in prepareCompletion:" + ex.getMessage()
- msoLogger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
- }
- msoLogger.trace("Exit prepareCompletionRequest")
- }
-
- public void prepareFalloutRequest(DelegateExecution execution){
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- msoLogger.trace("prepareFalloutRequest")
-
- try {
- WorkflowException wfex = execution.getVariable("WorkflowException")
- msoLogger.debug(" Input Workflow Exception: " + wfex.toString())
- String requestId = execution.getVariable("msoRequestId")
- String source = execution.getVariable("source")
- String requestInfo =
- """<request-info xmlns="http://org.onap/so/infra/vnf-request/v1">
- <request-id>${MsoUtils.xmlEscape(requestId)}</request-id>
- <action>CREATE</action>
- <source>${MsoUtils.xmlEscape(source)}</source>
- </request-info>"""
-
- String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo)
- execution.setVariable("falloutRequest", falloutRequest)
- } catch (Exception ex) {
- msoLogger.debug("Exception prepareFalloutRequest:" + ex.getMessage())
- String errorException = " Bpmn error encountered in CreateGenericALaCarteServiceInstance flow. FalloutHandlerRequest, buildErrorResponse() - " + ex.getMessage()
- String requestId = execution.getVariable("msoRequestId")
- String falloutRequest =
- """<aetgt:FalloutHandlerRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
- xmlns:ns="http://org.onap/so/request/types/v1"
- xmlns:wfsch="http://org.onap/so/workflow/schema/v1">
- <request-info xmlns="http://org.onap/so/infra/vnf-request/v1">
- <request-id>${MsoUtils.xmlEscape(requestId)}</request-id>
- <action>CREATE</action>
- <source>VID</source>
- </request-info>
- <aetgt:WorkflowException xmlns:aetgt="http://org.onap/so/workflow/schema/v1">
- <aetgt:ErrorMessage>${MsoUtils.xmlEscape(errorException)}</aetgt:ErrorMessage>
- <aetgt:ErrorCode>7000</aetgt:ErrorCode>
- </aetgt:WorkflowException>
- </aetgt:FalloutHandlerRequest>"""
-
- execution.setVariable("falloutRequest", falloutRequest)
- }
- msoLogger.trace("Exit prepareFalloutRequest")
- }
+ /*
+ * Extracting User Parameters from incoming Request and converting into a Map
+ */
+ def jsonSlurper = new JsonSlurper()
+ def jsonOutput = new JsonOutput()
+ def siRequest = execution.getVariable("bpmnRequest")
+ Map reqMap = jsonSlurper.parseText(siRequest)
+ //InputParams
+ def userParams = reqMap.requestDetails?.requestParameters?.userParams
+ Map<String, String> inputMap = [:]
+ if (userParams != null) {
+ userParams.each {
+ userParam -> inputMap.put(userParam.name, userParam.value)
+ }
+ }
+
+ msoLogger.debug("User Input Parameters map: " + userParams.toString())
+ execution.setVariable("serviceInputParams", inputMap)
+
+ ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
+
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ serviceDecomposition.getServiceInstance().setInstanceId(serviceInstanceId)
+
+ String serviceInstanceName = jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.instanceName")
+ serviceDecomposition.getServiceInstance().setInstanceName(serviceInstanceName)
+ execution.setVariable("serviceInstanceName", serviceInstanceName)
+ execution.setVariable("serviceDecomposition", serviceDecomposition)
+ execution.setVariable("serviceDecompositionString", serviceDecomposition.toJsonString())
+ msoLogger.debug("serviceDecomposition.serviceInstanceName: " + serviceDecomposition.getServiceInstance().getInstanceName())
+
+ msoLogger.trace("Completed prepareCreateServiceInstance of CreateGenericALaCarteServiceInstance ***** ")
+ } catch (Exception ex) {
+ // try error in method block
+ String exceptionMessage = "Bpmn error encountered in CreateGenericALaCarteServiceInstance flow. Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage()
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
+ }
+ }
+
+
+ public void prepareCompletionRequest (DelegateExecution execution) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ msoLogger.trace("prepareCompletion *** ")
+
+ try {
+ String requestId = execution.getVariable("msoRequestId")
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ String source = execution.getVariable("source")
+
+ String msoCompletionRequest =
+ """<aetgt:MsoCompletionRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
+ xmlns:ns="http://org.onap/so/request/types/v1">
+ <request-info xmlns="http://org.onap/so/infra/vnf-request/v1">
+ <request-id>${MsoUtils.xmlEscape(requestId)}</request-id>
+ <action>CREATE</action>
+ <source>${MsoUtils.xmlEscape(source)}</source>
+ </request-info>
+ <status-message>Service Instance was created successfully.</status-message>
+ <serviceInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</serviceInstanceId>
+ <mso-bpel-name>CreateGenericALaCarteServiceInstance</mso-bpel-name>
+ </aetgt:MsoCompletionRequest>"""
+
+ // Format Response
+ String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest)
+
+ execution.setVariable("completionRequest", xmlMsoCompletionRequest)
+ msoLogger.debug(" Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest)
+
+ } catch (Exception ex) {
+ String msg = " Exception in prepareCompletion:" + ex.getMessage()
+ msoLogger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ msoLogger.trace("Exit prepareCompletionRequest")
+ }
+
+ public void prepareFalloutRequest(DelegateExecution execution){
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ msoLogger.trace("prepareFalloutRequest")
+
+ try {
+ WorkflowException wfex = execution.getVariable("WorkflowException")
+ msoLogger.debug(" Input Workflow Exception: " + wfex.toString())
+ String requestId = execution.getVariable("msoRequestId")
+ String source = execution.getVariable("source")
+ String requestInfo =
+ """<request-info xmlns="http://org.onap/so/infra/vnf-request/v1">
+ <request-id>${MsoUtils.xmlEscape(requestId)}</request-id>
+ <action>CREATE</action>
+ <source>${MsoUtils.xmlEscape(source)}</source>
+ </request-info>"""
+
+ String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo)
+ execution.setVariable("falloutRequest", falloutRequest)
+ } catch (Exception ex) {
+ msoLogger.debug("Exception prepareFalloutRequest:" + ex.getMessage())
+ String errorException = " Bpmn error encountered in CreateGenericALaCarteServiceInstance flow. FalloutHandlerRequest, buildErrorResponse() - " + ex.getMessage()
+ String requestId = execution.getVariable("msoRequestId")
+ String falloutRequest =
+ """<aetgt:FalloutHandlerRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
+ xmlns:ns="http://org.onap/so/request/types/v1"
+ xmlns:wfsch="http://org.onap/so/workflow/schema/v1">
+ <request-info xmlns="http://org.onap/so/infra/vnf-request/v1">
+ <request-id>${MsoUtils.xmlEscape(requestId)}</request-id>
+ <action>CREATE</action>
+ <source>VID</source>
+ </request-info>
+ <aetgt:WorkflowException xmlns:aetgt="http://org.onap/so/workflow/schema/v1">
+ <aetgt:ErrorMessage>${MsoUtils.xmlEscape(errorException)}</aetgt:ErrorMessage>
+ <aetgt:ErrorCode>7000</aetgt:ErrorCode>
+ </aetgt:WorkflowException>
+ </aetgt:FalloutHandlerRequest>"""
+
+ execution.setVariable("falloutRequest", falloutRequest)
+ }
+ msoLogger.trace("Exit prepareFalloutRequest")
+ }
} \ No newline at end of file
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy
index c819da4be4..5255b37bb0 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy
@@ -20,40 +20,54 @@
package org.onap.so.bpmn.infrastructure.scripts
+import org.json.JSONObject
+import org.json.XML
+import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiResponse;
+
import static org.apache.commons.lang3.StringUtils.*;
+import groovy.xml.XmlUtil
+import groovy.json.*
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.recipe.ResourceInput;
+import org.onap.so.bpmn.common.resource.ResourceRequestBuilder
+import org.onap.so.bpmn.core.WorkflowException
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder.AbstractBuilder
+import org.onap.so.rest.APIResponse
+import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils
+import org.onap.so.bpmn.common.scripts.MsoUtils
+import org.onap.so.bpmn.common.scripts.AaiUtil
-import org.apache.commons.lang3.*
-import org.camunda.bpm.engine.delegate.BpmnError
+import java.util.UUID;
+
+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.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.apache.commons.lang3.*
import org.onap.so.bpmn.common.scripts.MsoUtils
-import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.logger.MsoLogger
-import groovy.json.*
-
/**
* This groovy class supports the <class>CreateSDNCCNetworkResource.bpmn</class> process.
* flow for SDNC Network Resource Create
*/
public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateSDNCNetworkResource.class);
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateSDNCNetworkResource.class);
String Prefix="CRESDNCRES_"
-
+
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
-
+
+ MsoUtils msoUtils = new MsoUtils()
+
public void preProcessRequest(DelegateExecution execution){
- msoLogger.trace("Started preProcessRequest ")
- try {
-
+
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ msoLogger.info(" ***** Started preProcessRequest *****")
+ try {
+
//get bpmn inputs from resource request.
String requestId = execution.getVariable("mso-request-id")
String requestAction = execution.getVariable("requestAction")
@@ -65,12 +79,12 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
//Get ResourceInput Object
ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class)
execution.setVariable(Prefix + "resourceInput", resourceInputObj)
-
+
//Deal with recipeParams
String recipeParamsFromWf = execution.getVariable("recipeParamXsd")
- String resourceName = resourceInputObj.getResourceInstanceName()
+ String resourceName = resourceInputObj.getResourceInstanceName()
//For sdnc requestAction default is "createNetworkInstance"
- String operationType = "Network"
+ String operationType = "Network"
if(!StringUtils.isBlank(recipeParamsFromRequest)){
//the operationType from worflow(first node) is second priority.
operationType = jsonUtil.getJsonValue(recipeParamsFromRequest, "operationType")
@@ -79,27 +93,70 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
//the operationType from worflow(first node) is highest priority.
operationType = jsonUtil.getJsonValue(recipeParamsFromWf, "operationType")
}
-
-
+
+
//For sdnc, generate svc_action and request_action
String sdnc_svcAction = "create"
- if(StringUtils.containsIgnoreCase(resourceInputObj.getResourceInstanceName(), "overlay")){
- //This will be resolved in R3.
- sdnc_svcAction ="activate"
- operationType = "NCINetwork"
+ switch (resourceInputObj.getResourceInstanceName()) {
+
+ case ~/[\w\s\W]*overlay[\w\s\W]*/ :
+ //This will be resolved in R3.
+ sdnc_svcAction ="activate"
+ operationType = "NCINetwork"
+ break
+
+ case ~/[\w\s\W]*underlay[\w\s\W]*/ :
+ //This will be resolved in R3.
+ operationType ="Network"
+ break
+
+ case ~/[\w\s\W]*SOTNConnectivity[\w\s\W]*/ :
+ operationType = "SOTNConnectivity"
+ execution.setVariable("isActivateRequired", "true")
+ break
+
+ case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ :
+ operationType = "SOTNAttachment"
+ execution.setVariable("isActivateRequired", "true")
+ break
+
+ case ~/[\w\s\W]*SiteVF[\w\s\W]*/ :
+ operationType = "Site"
+ execution.setVariable("isActivateRequired", "true")
+ break
+
+ case ~/[\w\s\W]*deviceVF[\w\s\W]*/ :
+ operationType = "SDWANDevice"
+ execution.setVariable("isActivateRequired", "true")
+ break
+
+ case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ :
+ operationType = "SDWANPort"
+ execution.setVariable("isActivateRequired", "true")
+ break
+
+ case ~/[\w\s\W]*SDWANConnectivity[\w\s\W]*/ :
+ operationType = "SDWANConnectivity"
+ execution.setVariable("isActivateRequired", "true")
+ break
+
+ case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ :
+ operationType = "SDWANAttachment"
+ execution.setVariable("isActivateRequired", "true")
+ break
+
+ default:
+ break
}
- if(StringUtils.containsIgnoreCase(resourceInputObj.getResourceInstanceName(), "underlay")){
- //This will be resolved in R3.
- operationType ="Network"
- }
- String sdnc_requestAction = StringUtils.capitalize(sdnc_svcAction) + operationType +"Instance"
- execution.setVariable(Prefix + "svcAction", sdnc_svcAction)
+
+ String sdnc_requestAction = StringUtils.capitalize(sdnc_svcAction) + operationType +"Instance"
+ execution.setVariable(Prefix + "svcAction", sdnc_svcAction)
execution.setVariable(Prefix + "requestAction", sdnc_requestAction)
execution.setVariable(Prefix + "serviceInstanceId", resourceInputObj.getServiceInstanceId())
execution.setVariable("mso-request-id", requestId)
execution.setVariable("mso-service-instance-id", resourceInputObj.getServiceInstanceId())
//TODO Here build networkrequest
-
+
} catch (BpmnError e) {
throw e;
} catch (Exception ex){
@@ -108,7 +165,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
}
-
+
String customizeResourceParam(String networkInputParametersJson) {
List<Map<String, Object>> paramList = new ArrayList();
JSONObject jsonObject = new JSONObject(networkInputParametersJson);
@@ -125,7 +182,65 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
return new JSONObject(paramMap).toString();
}
-
+
+ /**
+ * This method updates the resource input by collecting required info from AAI
+ * @param execution
+ */
+ public void updateResourceInput(DelegateExecution execution) {
+ ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput")
+ String modelName = resourceInputObj.getResourceModelInfo().getModelName()
+
+ switch (modelName) {
+ case ~/[\w\s\W]*SOTNConnectivity[\w\s\W]*/:
+
+ def resourceInput = resourceInputObj.getResourceParameters()
+ String incomingRequest = resourceInputObj.getRequestsInputs()
+ String serviceParameters = JsonUtils.getJsonValue(incomingRequest, "service.parameters")
+ String requestInputs = JsonUtils.getJsonValue(serviceParameters, "requestInputs")
+ JSONObject inputParameters = new JSONObject(requestInputs)
+ if(inputParameters.has("local-access-provider-id")) {
+ String uResourceInput = jsonUtil.addJsonValue(resourceInput, "requestInputs.access-provider-id", inputParameters.get("local-access-provider-id"))
+ uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.access-client-id", inputParameters.get("local-access-client-id"))
+ uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.access-topology-id", inputParameters.get("local-access-topology-id"))
+ uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.access-ltp-id", inputParameters.get("local-access-ltp-id"))
+ uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.access-node-id", inputParameters.get("local-access-node-id"))
+ resourceInputObj.setResourceParameters(uResourceInput)
+ execution.setVariable(Prefix + "resourceInput", resourceInputObj)
+ }
+
+ break
+
+ case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ :
+ case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ :
+ // fill attachment TP in networkInputParamJson
+ String customer = resourceInputObj.getGlobalSubscriberId()
+ String serviceType = resourceInputObj.getServiceType()
+
+ def vpnName = StringUtils.containsIgnoreCase(modelName, "sotnvpnattachment") ? "sotnvpnattachmentvf_sotncondition_sotnVpnName" : "sdwanvpnattachmentvf_sdwancondition_sdwanVpnName"
+ String parentServiceName = jsonUtil.getJsonValueForKey(resourceInputObj.getRequestsInputs(), vpnName)
+
+ AaiUtil aaiUtil = new AaiUtil(this)
+ String aai_endpoint = execution.getVariable("URN_aai_endpoint")
+ String customerUri = aaiUtil.getBusinessCustomerUri(execution) + "/" + customer
+ String aai_service_query_url = aai_endpoint + customerUri + "/service-subscriptions/service-subscription/" + serviceType + "/service-instances?service-instance-name=" + parentServiceName
+
+ APIResponse aaiResponse = aaiUtil.executeAAIGetCall(execution, aai_service_query_url)
+ def parentServiceInstanceId = getParentServiceInstnaceId(aaiResponse)
+ execution.setVariable("parentServiceInstanceId", parentServiceInstanceId)
+ break
+
+ default:
+ break
+ }
+ }
+
+ private String getParentServiceInstnaceId(APIResponse aaiResponse) {
+ String response = aaiResponse.getResponseBodyAsString()
+ def xmlResp = new XmlParser().parseText(response)
+ return "${xmlResp?."service-instance"[0]?."service-instance-id"[0]?.text()}"
+ }
+
/**
* Pre Process the BPMN Flow Request
* Inclouds:
@@ -133,15 +248,17 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
* generate the nsParameters
*/
public void prepareSDNCRequest (DelegateExecution execution) {
- msoLogger.trace("Started prepareSDNCRequest ")
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ msoLogger.info(" ***** Started prepareSDNCRequest *****")
try {
// get variables
- String sdnc_svcAction = execution.getVariable(Prefix + "svcAction")
+ String sdnc_svcAction = execution.getVariable(Prefix + "svcAction")
String sdnc_requestAction = execution.getVariable(Prefix + "requestAction")
String sdncCallback = execution.getVariable("URN_mso_workflow_sdncadapter_callback")
String createNetworkInput = execution.getVariable(Prefix + "networkRequest")
+ String parentServiceInstanceId = execution.getVariable("parentServiceInstanceId")
String hdrRequestId = execution.getVariable("mso-request-id")
String serviceInstanceId = execution.getVariable(Prefix + "serviceInstanceId")
String source = execution.getVariable("source")
@@ -166,176 +283,173 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
String sdncTopologyCreateRequest = ""
switch (modelName) {
- case ~/^Site$/:
+ case ~/[\w\s\W]*deviceVF[\w\s\W]*/ :
+ case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ :
+ case ~/[\w\s\W]*SiteVF[\w\s\W]*/:
sdncTopologyCreateRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1"
xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1">
<sdncadapter:RequestHeader>
- <sdncadapter:RequestId>${MsoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId>
- <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId>
- <sdncadapter:SvcAction>${MsoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction>
- <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation>
+ <sdncadapter:RequestId>${msoUtils.xmlEncode(hdrRequestId)}</sdncadapter:RequestId>
+ <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId>
+ <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction>
+ <sdncadapter:SvcOperation>vnf-topology-operation</sdncadapter:SvcOperation>
<sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl>
<sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction>
</sdncadapter:RequestHeader>
<sdncadapterworkflow:SDNCRequestData>
<request-information>
- <request-id>${MsoUtils.xmlEscape(hdrRequestId)}</request-id>
- <request-action>${MsoUtils.xmlEscape(sdnc_requestAction)}</request-action>
- <source>${MsoUtils.xmlEscape(source)}</source>
+ <request-id>${msoUtils.xmlEncode(hdrRequestId)}</request-id>
+ <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action>
+ <source>${msoUtils.xmlEncode(source)}</source>
<notification-url></notification-url>
<order-number></order-number>
<order-version></order-version>
</request-information>
<service-information>
- <service-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-id>
- <subscription-service-type>${MsoUtils.xmlEscape(serviceType)}</subscription-service-type>
+ <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id>
+ <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type>
<onap-model-information>
- <model-invariant-uuid>${MsoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid>
- <model-uuid>${MsoUtils.xmlEscape(serviceModelUuid)}</model-uuid>
- <model-version>${MsoUtils.xmlEscape(serviceModelVersion)}</model-version>
- <model-name>${MsoUtils.xmlEscape(serviceModelName)}</model-name>
+ <model-invariant-uuid>${msoUtils.xmlEncode(serviceModelInvariantUuid)}</model-invariant-uuid>
+ <model-uuid>${msoUtils.xmlEncode(serviceModelUuid)}</model-uuid>
+ <model-version>${msoUtils.xmlEncode(serviceModelVersion)}</model-version>
+ <model-name>${msoUtils.xmlEncode(serviceModelName)}</model-name>
</onap-model-information>
- <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id>
- <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id>
+ <service-instance-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-instance-id>
+ <global-customer-id>${msoUtils.xmlEncode(globalCustomerId)}</global-customer-id>
+ <subscriber-name>${msoUtils.xmlEncode(globalCustomerId)}</subscriber-name>
</service-information>
- <subscriber-name>${MsoUtils.xmlEscape(globalCustomerId)}</subscriber-name>
<vnf-information>
- <!-- TODO: to be filled as per the request input -->
<vnf-id></vnf-id>
<vnf-type></vnf-type>
<onap-model-information>
- <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid>
- <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid>
- <model-uuid>${MsoUtils.xmlEscape(modelUuid)}</model-uuid>
- <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version>
- <model-name>${MsoUtils.xmlEscape(modelName)}</model-name>
+ <model-invariant-uuid>${msoUtils.xmlEncode(modelInvariantUuid)}</model-invariant-uuid>
+ <model-customization-uuid>${msoUtils.xmlEncode(modelCustomizationUuid)}</model-customization-uuid>
+ <model-uuid>${msoUtils.xmlEncode(modelUuid)}</model-uuid>
+ <model-version>${msoUtils.xmlEncode(modelVersion)}</model-version>
+ <model-name>${msoUtils.xmlEncode(modelName)}</model-name>
</onap-model-information>
- </network-information>
- <vnf-input-parameters>
- <network-input-parameters>${MsoUtils.xmlEscape(netowrkInputParameters)}</network-input-parameters>
- </vnf-input-parameters>
+ </vnf-information>
<vnf-request-input>
- <request-version></request-version>
- <vnf-name></vnf-name>
- <neutron-id></neutron-id>
- <contrail-network-fqdn></contrail-network-fqdn>
- <subnets-data>
- <subnet-data>
- <element>
- <ip-version></ip-version>
- <subnet-id></subnet-id>
- </subnet-data>
- </subnets-data>
- </vnf-request-input>
+ <vnf-input-parameters>
+ $netowrkInputParameters
+ </vnf-input-parameters>
+ <request-version></request-version>
+ <vnf-name></vnf-name>
+ <vnf-networks>
+ </vnf-networks>
+ </vnf-request-input>
</sdncadapterworkflow:SDNCRequestData>
</aetgt:SDNCAdapterWorkflowRequest>""".trim()
break
- case ~/^SOTNAttachment$/:
+ case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ :
+ case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ :
sdncTopologyCreateRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1"
xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1">
<sdncadapter:RequestHeader>
- <sdncadapter:RequestId>${MsoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId>
- <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId>
- <sdncadapter:SvcAction>${MsoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction>
- <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation>
+ <sdncadapter:RequestId>${msoUtils.xmlEncode(hdrRequestId)}</sdncadapter:RequestId>
+ <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId>
+ <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction>
+ <sdncadapter:SvcOperation>connection-attachment-topology-operation</sdncadapter:SvcOperation>
<sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl>
<sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction>
</sdncadapter:RequestHeader>
<sdncadapterworkflow:SDNCRequestData>
<request-information>
- <request-id>${MsoUtils.xmlEscape(hdrRequestId)}</request-id>
- <request-action>${MsoUtils.xmlEscape(sdnc_requestAction)}</request-action>
- <source>${MsoUtils.xmlEscape(source)}</source>
+ <request-id>${msoUtils.xmlEncode(hdrRequestId)}</request-id>
+ <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action>
+ <source>${msoUtils.xmlEncode(source)}</source>
<notification-url></notification-url>
<order-number></order-number>
<order-version></order-version>
</request-information>
<service-information>
- <service-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-id>
- <subscription-service-type>${MsoUtils.xmlEscape(serviceType)}</subscription-service-type>
+ <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id>
+ <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type>
<onap-model-information>
- <model-invariant-uuid>${MsoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid>
- <model-uuid>${MsoUtils.xmlEscape(serviceModelUuid)}</model-uuid>
- <model-version>${MsoUtils.xmlEscape(serviceModelVersion)}</model-version>
- <model-name>${MsoUtils.xmlEscape(serviceModelName)}</model-name>
+ <model-invariant-uuid>${msoUtils.xmlEncode(serviceModelInvariantUuid)}</model-invariant-uuid>
+ <model-uuid>${msoUtils.xmlEncode(serviceModelUuid)}</model-uuid>
+ <model-version>${msoUtils.xmlEncode(serviceModelVersion)}</model-version>
+ <model-name>${msoUtils.xmlEncode(serviceModelName)}</model-name>
</onap-model-information>
- <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id>
- <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id>
+ <service-instance-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-instance-id>
+ <global-customer-id>${msoUtils.xmlEncode(globalCustomerId)}</global-customer-id>
+ <subscriber-name>${msoUtils.xmlEncode(globalCustomerId)}</subscriber-name>
</service-information>
- <subscriber-name>${MsoUtils.xmlEscape(globalCustomerId)}</subscriber-name>
<allotted-resource-information>
<!-- TODO: to be filled as per the request input -->
+ <allotted-resource-id></allotted-resource-id>
<allotted-resource-type></allotted-resource-type>
- <parent-service-instance-id><parent-service-instance-id>
+ <parent-service-instance-id>$parentServiceInstanceId</parent-service-instance-id>
<onap-model-information>
- <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid>
- <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid>
- <model-uuid>${MsoUtils.xmlEscape(modelUuid)}</model-uuid>
- <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version>
- <model-name>${MsoUtils.xmlEscape(modelName)}</model-name>
+ <model-invariant-uuid>${msoUtils.xmlEncode(modelInvariantUuid)}</model-invariant-uuid>
+ <model-customization-uuid>${msoUtils.xmlEncode(modelCustomizationUuid)}</model-customization-uuid>
+ <model-uuid>${msoUtils.xmlEncode(modelUuid)}</model-uuid>
+ <model-version>${msoUtils.xmlEncode(modelVersion)}</model-version>
+ <model-name>${msoUtils.xmlEncode(modelName)}</model-name>
</onap-model-information>
</allotted-resource-information>
<connection-attachment-request-input>
- <param>${MsoUtils.xmlEscape(netowrkInputParameters)}</param>
+ $netowrkInputParameters
</connection-attachment-request-input>
</sdncadapterworkflow:SDNCRequestData>
</aetgt:SDNCAdapterWorkflowRequest>""".trim()
break
+ // for SDWANConnectivity and SOTNConnectivity:
default:
sdncTopologyCreateRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1"
xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1">
<sdncadapter:RequestHeader>
- <sdncadapter:RequestId>${MsoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId>
- <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId>
- <sdncadapter:SvcAction>${MsoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction>
+ <sdncadapter:RequestId>${hdrRequestId}</sdncadapter:RequestId>
+ <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId>
+ <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction>
<sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation>
<sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl>
<sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction>
</sdncadapter:RequestHeader>
<sdncadapterworkflow:SDNCRequestData>
<request-information>
- <request-id>${MsoUtils.xmlEscape(hdrRequestId)}</request-id>
- <request-action>${MsoUtils.xmlEscape(sdnc_requestAction)}</request-action>
- <source>${MsoUtils.xmlEscape(source)}</source>
+ <request-id>${msoUtils.xmlEncode(hdrRequestId)}</request-id>
+ <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action>
+ <source>${msoUtils.xmlEncode(source)}</source>
<notification-url></notification-url>
<order-number></order-number>
<order-version></order-version>
</request-information>
<service-information>
- <service-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-id>
- <subscription-service-type>${MsoUtils.xmlEscape(serviceType)}</subscription-service-type>
+ <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id>
+ <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type>
<onap-model-information>
- <model-invariant-uuid>${MsoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid>
- <model-uuid>${MsoUtils.xmlEscape(serviceModelUuid)}</model-uuid>
- <model-version>${MsoUtils.xmlEscape(serviceModelVersion)}</model-version>
- <model-name>${MsoUtils.xmlEscape(serviceModelName)}</model-name>
+ <model-invariant-uuid>${msoUtils.xmlEncode(serviceModelInvariantUuid)}</model-invariant-uuid>
+ <model-uuid>${msoUtils.xmlEncode(serviceModelUuid)}</model-uuid>
+ <model-version>${msoUtils.xmlEncode(serviceModelVersion)}</model-version>
+ <model-name>${msoUtils.xmlEncode(serviceModelName)}</model-name>
</onap-model-information>
- <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id>
- <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id>
+ <service-instance-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-instance-id>
+ <global-customer-id>${msoUtils.xmlEncode(globalCustomerId)}</global-customer-id>
</service-information>
<network-information>
<onap-model-information>
- <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid>
- <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid>
- <model-uuid>${MsoUtils.xmlEscape(modelUuid)}</model-uuid>
- <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version>
- <model-name>${MsoUtils.xmlEscape(modelName)}</model-name>
+ <model-invariant-uuid>${msoUtils.xmlEncode(modelInvariantUuid)}</model-invariant-uuid>
+ <model-customization-uuid>${msoUtils.xmlEncode(modelCustomizationUuid)}</model-customization-uuid>
+ <model-uuid>${msoUtils.xmlEncode(modelUuid)}</model-uuid>
+ <model-version>${msoUtils.xmlEncode(modelVersion)}</model-version>
+ <model-name>${msoUtils.xmlEncode(modelName)}</model-name>
</onap-model-information>
</network-information>
<network-request-input>
- <network-input-parameters>${MsoUtils.xmlEscape(netowrkInputParameters)}</network-input-parameters>
+ <network-input-parameters>$netowrkInputParameters</network-input-parameters>
</network-request-input>
</sdncadapterworkflow:SDNCRequestData>
</aetgt:SDNCAdapterWorkflowRequest>""".trim()
}
-
+
String sndcTopologyCreateRequesAsString = utils.formatXml(sdncTopologyCreateRequest)
- msoLogger.debug(sndcTopologyCreateRequesAsString)
+ utils.logAudit(sndcTopologyCreateRequesAsString)
execution.setVariable("sdncAdapterWorkflowRequest", sndcTopologyCreateRequesAsString)
msoLogger.debug("sdncAdapterWorkflowRequest - " + "\n" + sndcTopologyCreateRequesAsString)
@@ -345,8 +459,8 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
- msoLogger.trace("Exit prepareSDNCRequest ")
- }
+ msoLogger.info(" ***** Exit prepareSDNCRequest *****")
+ }
private void setProgressUpdateVariables(DelegateExecution execution, String body) {
def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint")
@@ -368,17 +482,17 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
String body = """
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:ns="http://org.onap.so/requestsdb">
+ xmlns:ns="http://org.openecomp.mso/requestsdb">
<soapenv:Header/>
<soapenv:Body>
<ns:updateResourceOperationStatus>
- <operType>${MsoUtils.xmlEscape(operType)}</operType>
- <operationId>${MsoUtils.xmlEscape(operationId)}</operationId>
- <progress>${MsoUtils.xmlEscape(progress)}</progress>
- <resourceTemplateUUID>${MsoUtils.xmlEscape(resourceCustomizationUuid)}</resourceTemplateUUID>
- <serviceId>${MsoUtils.xmlEscape(ServiceInstanceId)}</serviceId>
- <status>${MsoUtils.xmlEscape(status)}</status>
- <statusDescription>${MsoUtils.xmlEscape(statusDescription)}</statusDescription>
+ <operType>${msoUtils.xmlEncode(operType)}</operType>
+ <operationId>${msoUtils.xmlEncode(operationId)}</operationId>
+ <progress>${msoUtils.xmlEncode(progress)}</progress>
+ <resourceTemplateUUID>${msoUtils.xmlEncode(resourceCustomizationUuid)}</resourceTemplateUUID>
+ <serviceId>${msoUtils.xmlEncode(ServiceInstanceId)}</serviceId>
+ <status>${msoUtils.xmlEncode(status)}</status>
+ <statusDescription>${msoUtils.xmlEncode(statusDescription)}</statusDescription>
</ns:updateResourceOperationStatus>
</soapenv:Body>
</soapenv:Envelope>""";
@@ -395,23 +509,23 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
String operationId = resourceInputObj.getOperationId()
String progress = "100"
String status = "finished"
- String statusDescription = "SDCN resource creation completed"
+ String statusDescription = "SDCN resource creation and activation completed"
execution.getVariable("operationId")
String body = """
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:ns="http://org.onap.so/requestsdb">
+ xmlns:ns="http://org.openecomp.mso/requestsdb">
<soapenv:Header/>
<soapenv:Body>
<ns:updateResourceOperationStatus>
- <operType>${MsoUtils.xmlEscape(operType)}</operType>
- <operationId>${MsoUtils.xmlEscape(operationId)}</operationId>
- <progress>${MsoUtils.xmlEscape(progress)}</progress>
- <resourceTemplateUUID>${MsoUtils.xmlEscape(resourceCustomizationUuid)}</resourceTemplateUUID>
- <serviceId>${MsoUtils.xmlEscape(ServiceInstanceId)}</serviceId>
- <status>${MsoUtils.xmlEscape(status)}</status>
- <statusDescription>${MsoUtils.xmlEscape(statusDescription)}</statusDescription>
+ <operType>${msoUtils.xmlEncode(operType)}</operType>
+ <operationId>${msoUtils.xmlEncode(operationId)}</operationId>
+ <progress>${msoUtils.xmlEncode(progress)}</progress>
+ <resourceTemplateUUID>${msoUtils.xmlEncode(resourceCustomizationUuid)}</resourceTemplateUUID>
+ <serviceId>${msoUtils.xmlEncode(ServiceInstanceId)}</serviceId>
+ <status>${msoUtils.xmlEncode(status)}</status>
+ <statusDescription>${msoUtils.xmlEncode(statusDescription)}</statusDescription>
</ns:updateResourceOperationStatus>
</soapenv:Body>
</soapenv:Envelope>""";
@@ -419,32 +533,70 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor {
setProgressUpdateVariables(execution, body)
}
- public void postCreateSDNCCall(DelegateExecution execution){
- msoLogger.trace("Started prepareSDNCRequest ")
+ public void afterCreateSDNCCall(DelegateExecution execution){
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ msoLogger.info(" ***** Started prepareSDNCRequest *****")
String responseCode = execution.getVariable(Prefix + "sdncCreateReturnCode")
String responseObj = execution.getVariable(Prefix + "SuccessIndicator")
-
+
+ def isActivateRequried = execution.getVariable("isActivateRequired")
+ if (StringUtils.equalsIgnoreCase(isActivateRequried, "true")) {
+ def instnaceId = getInstnaceId(execution)
+ execution.setVariable("networkInstanceId", instnaceId)
+ }
+
msoLogger.info("response from sdnc, response code :" + responseCode + " response object :" + responseObj)
- msoLogger.trace("Exit prepareSDNCRequest ")
+ msoLogger.info(" ***** Exit prepareSDNCRequest *****")
+ }
+
+ private def getInstnaceId(DelegateExecution execution) {
+ def responce = new XmlSlurper().parseText(execution.getVariable("CRENWKI_createSDNCResponse"))
+ def data = responce.toString()
+ data = data.substring(data.indexOf("<"))
+
+ def resp = new XmlSlurper().parseText(data)
+ ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput")
+ String modelName = resourceInputObj.getResourceModelInfo().getModelName()
+ def val = ""
+
+ switch (modelName) {
+ case ~/[\w\s\W]*SOTNConnectivity[\w\s\W]*/ :
+ case ~/[\w\s\W]*SDWANConnectivity[\w\s\W]*/ :
+ val = resp."network-response-information"."instance-id"
+ break
+
+ case ~/[\w\s\W]*deviceVF[\w\s\W]*/ :
+ case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ :
+ case ~/[\w\s\W]*Site[\w\s\W]*/:
+ val = resp."vnf-response-information"."instance-id"
+ break
+
+ case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ :
+ case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/:
+ val = resp."connection-attachment-response-information"."instance-id"
+ break
+ }
+
+ return val.toString()
+ }
+
+ public void sendSyncResponse (DelegateExecution execution) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ msoLogger.debug(" *** sendSyncResponse *** ")
+
+ try {
+ String operationStatus = "finished"
+ // RESTResponse for main flow
+ String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim()
+ msoLogger.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)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ msoLogger.debug(" ***** Exit sendSyncResopnse *****")
}
-
- public void sendSyncResponse (DelegateExecution execution) {
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- utils.log("DEBUG", " *** sendSyncResponse *** ", isDebugEnabled)
-
- try {
- String operationStatus = "finished"
- // RESTResponse for main flow
- String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim()
- utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + resourceOperationResp, isDebugEnabled)
- sendWorkflowResponse(execution, 202, resourceOperationResp)
- execution.setVariable("sentSyncResponse", true)
-
- } catch (Exception ex) {
- String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage()
- utils.log("DEBUG", msg, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
- }
- utils.log("DEBUG"," ***** Exit sendSyncResopnse *****", isDebugEnabled)
- }
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy
index a63aad14a2..b6ea9f3fef 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy
@@ -32,14 +32,15 @@ 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.bpmn.common.scripts.MsoUtils
+import org.onap.so.logger.MsoLogger
/**
* This groovy class supports the <class>ActivateSDNCCNetworkResource.bpmn</class> process.
* flow for SDNC Network Resource Activate
*/
public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,
- CreateSDNCNetworkResource.class);
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DeActivateSDNCNetworkResource.class);
String Prefix = "DEACTSDNCRES_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -48,21 +49,22 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor
SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils()
+ MsoUtils msoUtils = new MsoUtils()
+
public void preProcessRequest(DelegateExecution execution) {
- msoLogger.info(" ***** started preProcessRequest*****")
+
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ msoLogger.info(" ***** Started preProcessRequest *****")
try {
//get bpmn inputs from resource request.
String requestId = execution.getVariable("mso-request-id")
String requestAction = execution.getVariable("requestAction")
- msoLogger.info("The requestAction is: " + requestAction)
String recipeParamsFromRequest = execution.getVariable("recipeParams")
- msoLogger.info("The recipeParams is: " + recipeParamsFromRequest)
String resourceInput = execution.getVariable("resourceInput")
- msoLogger.info("The resourceInput is: " + resourceInput)
//Get ResourceInput Object
- org.onap.so.bpmn.common.recipe.ResourceInput resourceInputObj = org.onap.so.bpmn.common.resource.ResourceRequestBuilder.getJsonObject(resourceInput, org.onap.so.bpmn.common.recipe.ResourceInput.class)
+ ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class)
execution.setVariable(Prefix + "resourceInput", resourceInputObj)
//Deal with recipeParams
@@ -82,7 +84,40 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor
// TODO: based on the resource type decide action and operation type
String sdnc_svcAction = "deactivate"
- operationType = "SOTNConnectivity"
+ switch (resourceInputObj.getResourceModelInfo().getModelName()) {
+ case ~/[\w\s\W]*SOTNConnectivity[\w\s\W]*/ :
+ operationType = "SOTNConnectivity"
+ break
+
+ case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ :
+ operationType = "SOTNAttachment"
+ break
+
+ case ~/[\w\s\W]*SiteVF[\w\s\W]*/ :
+ operationType = "Site"
+ break
+
+ case ~/[\w\s\W]*deviceVF[\w\s\W]*/ :
+ operationType = "SDWANDevice"
+ execution.setVariable("isActivateRequired", "true")
+ break
+
+ case ~/[\w\s\W]*SDWANConnectivity[\w\s\W]*/ :
+ operationType = "SDWANConnectivity"
+ break
+
+ case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ :
+ operationType = "SDWANAttachment"
+ break
+
+ case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ :
+ operationType = "SDWANPort"
+ execution.setVariable("isActivateRequired", "true")
+ break
+
+ default:
+ break
+ }
String sdnc_requestAction = StringUtils.capitalize(sdnc_svcAction) + operationType +"Instance"
execution.setVariable(Prefix + "svcAction", sdnc_svcAction)
@@ -102,7 +137,8 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor
}
public void prepareSDNCRequest(DelegateExecution execution) {
- msoLogger.info(" ***** started prepareSDNCRequest *****")
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ msoLogger.info(" ***** Started prepareSDNCRequest *****")
try {
// get variables
@@ -115,7 +151,7 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor
String serviceInstanceId = execution.getVariable(Prefix + "serviceInstanceId")
String source = execution.getVariable("source")
String sdnc_service_id = execution.getVariable(Prefix + "sdncServiceId")
- org.onap.so.bpmn.common.recipe.ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput")
+ ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput")
String serviceType = resourceInputObj.getServiceType()
String serviceModelInvariantUuid = resourceInputObj.getServiceModelInfo().getModelInvariantUuid()
String serviceModelUuid = resourceInputObj.getServiceModelInfo().getModelUuid()
@@ -127,175 +163,164 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor
String modelUuid = resourceInputObj.getResourceModelInfo().getModelUuid()
String modelName = resourceInputObj.getResourceModelInfo().getModelName()
String modelVersion = resourceInputObj.getResourceModelInfo().getModelVersion()
+ String resourceInstnaceId = resourceInputObj.getResourceInstancenUuid()
// 1. prepare assign topology via SDNC Adapter SUBFLOW call
String sdncTopologyDeleteRequest = ""
switch (modelName) {
- case ~/^Site$/:
+ case ~/[\w\s\W]*deviceVF[\w\s\W]*/ :
+ case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ :
+ case ~/[\w\s\W]*SiteVF[\w\s\W]*/:
sdncTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1"
xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1">
<sdncadapter:RequestHeader>
- <sdncadapter:RequestId>${MsoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId>
- <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId>
- <sdncadapter:SvcAction>${MsoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction>
- <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation>
+ <sdncadapter:RequestId>${msoUtils.xmlEncode(hdrRequestId)}</sdncadapter:RequestId>
+ <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId>
+ <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction>
+ <sdncadapter:SvcOperation>vnf-topology-operation</sdncadapter:SvcOperation>
<sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl>
<sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction>
</sdncadapter:RequestHeader>
<sdncadapterworkflow:SDNCRequestData>
<request-information>
- <request-id>${MsoUtils.xmlEscape(hdrRequestId)}</request-id>
- <request-action>${MsoUtils.xmlEscape(sdnc_requestAction)}</request-action>
- <source>${MsoUtils.xmlEscape(source)}</source>
+ <request-id>${msoUtils.xmlEncode(hdrRequestId)}</request-id>
+ <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action>
+ <source>${msoUtils.xmlEncode(source)}</source>
<notification-url></notification-url>
<order-number></order-number>
<order-version></order-version>
</request-information>
<service-information>
- <service-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-id>
- <subscription-service-type>${MsoUtils.xmlEscape(serviceType)}</subscription-service-type>
+ <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id>
+ <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type>
<onap-model-information>
- <model-invariant-uuid>${MsoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid>
- <model-uuid>${MsoUtils.xmlEscape(serviceModelUuid)}</model-uuid>
- <model-version>${MsoUtils.xmlEscape(serviceModelVersion)}</model-version>
- <model-name>${MsoUtils.xmlEscape(serviceModelName)}</model-name>
+ <model-invariant-uuid>${msoUtils.xmlEncode(serviceModelInvariantUuid)}</model-invariant-uuid>
+ <model-uuid>${msoUtils.xmlEncode(serviceModelUuid)}</model-uuid>
+ <model-version>${msoUtils.xmlEncode(serviceModelVersion)}</model-version>
+ <model-name>${msoUtils.xmlEncode(serviceModelName)}</model-name>
</onap-model-information>
- <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id>
- <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id>
- <subscriber-name></subscriber-name>
+ <service-instance-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-instance-id>
+ <global-customer-id>${msoUtils.xmlEncode(globalCustomerId)}</global-customer-id>
+ <subscriber-name>${msoUtils.xmlEncode(globalCustomerId)}</subscriber-name>
</service-information>
<vnf-information>
- <!-- TODO: to be filled as per the request input -->
- <vnf-id></vnf-id>
+ <vnf-id>$resourceInstnaceId</vnf-id>
<vnf-type></vnf-type>
<onap-model-information>
- <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid>
- <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid>
- <model-uuid>${MsoUtils.xmlEscape(modelUuid)}</model-uuid>
- <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version>
- <model-name>${MsoUtils.xmlEscape(modelName)}</model-name>
+ <model-invariant-uuid>${msoUtils.xmlEncode(modelInvariantUuid)}</model-invariant-uuid>
+ <model-customization-uuid>${msoUtils.xmlEncode(modelCustomizationUuid)}</model-customization-uuid>
+ <model-uuid>${msoUtils.xmlEncode(modelUuid)}</model-uuid>
+ <model-version>${msoUtils.xmlEncode(modelVersion)}</model-version>
+ <model-name>${msoUtils.xmlEncode(modelName)}</model-name>
</onap-model-information>
- </network-information>
+ </vnf-information>
<vnf-request-input>
- <request-version></request-version>
- <vnf-name></vnf-name>
- <vnf-networks>
- <vnf-network>
- <network-role></network-role>
- <network-name></network-name>
- <neutron-id></neutron-id>
- <network-id></network-id>
- <contrail-network-fqdn></contrail-network-fqdn>
- <subnets-data>
- <subnet-data>
- <ip-version></ip-version>
- <subnet-id></subnet-id>
- </subnet-data>
- </subnets-data>
- </vnf-network>
+ <vnf-input-parameters>
+ </vnf-input-parameters>
+ <request-version></request-version>
+ <vnf-name></vnf-name>
+ <vnf-networks>
</vnf-networks>
- </vnf-request-input>
- <vnf-input-parameters>
- <param></param>
- </vnf-input-parameters>
+ </vnf-request-input>
</sdncadapterworkflow:SDNCRequestData>
</aetgt:SDNCAdapterWorkflowRequest>""".trim()
break
- case ~/^SOTNAttachment$/:
+ case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ :
+ case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ :
sdncTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1"
xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1">
<sdncadapter:RequestHeader>
- <sdncadapter:RequestId>${MsoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId>
- <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId>
- <sdncadapter:SvcAction>${MsoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction>
- <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation>
+ <sdncadapter:RequestId>${msoUtils.xmlEncode(hdrRequestId)}</sdncadapter:RequestId>
+ <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId>
+ <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction>
+ <sdncadapter:SvcOperation>connection-attachment-topology-operation</sdncadapter:SvcOperation>
<sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl>
<sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction>
</sdncadapter:RequestHeader>
<sdncadapterworkflow:SDNCRequestData>
<request-information>
- <request-id>${MsoUtils.xmlEscape(hdrRequestId)}</request-id>
- <request-action>${MsoUtils.xmlEscape(sdnc_requestAction)}</request-action>
- <source>${MsoUtils.xmlEscape(source)}</source>
+ <request-id>${msoUtils.xmlEncode(hdrRequestId)}</request-id>
+ <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action>
+ <source>${msoUtils.xmlEncode(source)}</source>
<notification-url></notification-url>
<order-number></order-number>
<order-version></order-version>
</request-information>
<service-information>
- <service-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-id>
- <subscription-service-type>${MsoUtils.xmlEscape(serviceType)}</subscription-service-type>
+ <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id>
+ <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type>
<onap-model-information>
- <model-invariant-uuid>${MsoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid>
- <model-uuid>${MsoUtils.xmlEscape(serviceModelUuid)}</model-uuid>
- <model-version>${MsoUtils.xmlEscape(serviceModelVersion)}</model-version>
- <model-name>${MsoUtils.xmlEscape(serviceModelName)}</model-name>
+ <model-invariant-uuid>${msoUtils.xmlEncode(serviceModelInvariantUuid)}</model-invariant-uuid>
+ <model-uuid>${msoUtils.xmlEncode(serviceModelUuid)}</model-uuid>
+ <model-version>${msoUtils.xmlEncode(serviceModelVersion)}</model-version>
+ <model-name>${msoUtils.xmlEncode(serviceModelName)}</model-name>
</onap-model-information>
- <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id>
- <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id>
+ <service-instance-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-instance-id>
+ <global-customer-id>${msoUtils.xmlEncode(globalCustomerId)}</global-customer-id>
<subscriber-name></subscriber-name>
</service-information>
<allotted-resource-information>
- <!-- TODO: to be filled as per the request input -->
- <allotted-resource-id></allotted-resource-id>
+ <allotted-resource-id>$resourceInstnaceId</allotted-resource-id>
<allotted-resource-type></allotted-resource-type>
<parent-service-instance-id></parent-service-instance-id>
<onap-model-information>
- <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid>
- <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid>
- <model-uuid>${MsoUtils.xmlEscape(modelUuid)}</model-uuid>
- <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version>
- <model-name>${MsoUtils.xmlEscape(modelName)}</model-name>
+ <model-invariant-uuid>${msoUtils.xmlEncode(modelInvariantUuid)}</model-invariant-uuid>
+ <model-customization-uuid>${msoUtils.xmlEncode(modelCustomizationUuid)}</model-customization-uuid>
+ <model-uuid>${msoUtils.xmlEncode(modelUuid)}</model-uuid>
+ <model-version>${msoUtils.xmlEncode(modelVersion)}</model-version>
+ <model-name>${msoUtils.xmlEncode(modelName)}</model-name>
</onap-model-information>
</allotted-resource-information>
<connection-attachment-request-input>
- <param></param>
</connection-attachment-request-input>
</sdncadapterworkflow:SDNCRequestData>
</aetgt:SDNCAdapterWorkflowRequest>""".trim()
break
+
default:
sdncTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1"
xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1">
<sdncadapter:RequestHeader>
- <sdncadapter:RequestId>${MsoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId>
- <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId>
- <sdncadapter:SvcAction>${MsoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction>
+ <sdncadapter:RequestId>${msoUtils.xmlEncode(hdrRequestId)}</sdncadapter:RequestId>
+ <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId>
+ <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction>
<sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation>
<sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl>
<sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction>
</sdncadapter:RequestHeader>
<sdncadapterworkflow:SDNCRequestData>
<request-information>
- <request-id>${MsoUtils.xmlEscape(hdrRequestId)}</request-id>
- <request-action>${MsoUtils.xmlEscape(sdnc_requestAction)}</request-action>
- <source>${MsoUtils.xmlEscape(source)}</source>
+ <request-id>${msoUtils.xmlEncode(hdrRequestId)}</request-id>
+ <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action>
+ <source>${msoUtils.xmlEncode(source)}</source>
<notification-url></notification-url>
<order-number></order-number>
<order-version></order-version>
</request-information>
<service-information>
- <service-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-id>
- <subscription-service-type>${MsoUtils.xmlEscape(serviceType)}</subscription-service-type>
+ <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id>
+ <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type>
<onap-model-information>
- <model-invariant-uuid>${MsoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid>
- <model-uuid>${MsoUtils.xmlEscape(serviceModelUuid)}</model-uuid>
- <model-version>${MsoUtils.xmlEscape(serviceModelVersion)}</model-version>
- <model-name>${MsoUtils.xmlEscape(serviceModelName)}</model-name>
+ <model-invariant-uuid>${msoUtils.xmlEncode(serviceModelInvariantUuid)}</model-invariant-uuid>
+ <model-uuid>${msoUtils.xmlEncode(serviceModelUuid)}</model-uuid>
+ <model-version>${msoUtils.xmlEncode(serviceModelVersion)}</model-version>
+ <model-name>${msoUtils.xmlEncode(serviceModelName)}</model-name>
</onap-model-information>
- <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id>
- <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id>
+ <service-instance-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-instance-id>
+ <global-customer-id>${msoUtils.xmlEncode(globalCustomerId)}</global-customer-id>
</service-information>
<network-information>
+ <network-id>$resourceInstnaceId</network-id>
<onap-model-information>
- <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid>
- <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid>
- <model-uuid>${MsoUtils.xmlEscape(modelUuid)}</model-uuid>
- <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version>
- <model-name>${MsoUtils.xmlEscape(modelName)}</model-name>
+ <model-invariant-uuid>${msoUtils.xmlEncode(modelInvariantUuid)}</model-invariant-uuid>
+ <model-customization-uuid>${msoUtils.xmlEncode(modelCustomizationUuid)}</model-customization-uuid>
+ <model-uuid>${msoUtils.xmlEncode(modelUuid)}</model-uuid>
+ <model-version>${msoUtils.xmlEncode(modelVersion)}</model-version>
+ <model-name>${msoUtils.xmlEncode(modelName)}</model-name>
</onap-model-information>
</network-information>
<network-request-input>
@@ -305,10 +330,10 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor
</aetgt:SDNCAdapterWorkflowRequest>""".trim()
}
- String sndcTopologyDeleteRequesAsString = utils.formatXml(sdncTopologyDeleteRequest)
- utils.logAudit(sndcTopologyDeleteRequesAsString)
- execution.setVariable("sdncAdapterWorkflowRequest", sndcTopologyDeleteRequesAsString)
- msoLogger.info("sdncAdapterWorkflowRequest - " + "\n" + sndcTopologyDeleteRequesAsString)
+ String sdncTopologyDeleteRequesAsString = utils.formatXml(sdncTopologyDeleteRequest)
+ utils.logAudit(sdncTopologyDeleteRequesAsString)
+ execution.setVariable("sdncAdapterWorkflowRequest", sdncTopologyDeleteRequesAsString)
+ msoLogger.info("sdncAdapterWorkflowRequest - " + "\n" + sdncTopologyDeleteRequesAsString)
} catch (Exception ex) {
String exceptionMessage = " Bpmn error encountered in DeleteSDNCCNetworkResource flow. prepareSDNCRequest() - " + ex.getMessage()
@@ -320,32 +345,30 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor
}
public void prepareUpdateAfterDeActivateSDNCResource(DelegateExecution execution) {
- msoLogger.info("***** started prepareUpdateAfterDeActivateSDNCResource *****")
-
ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput")
String operType = resourceInputObj.getOperationType()
String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid()
String serviceInstanceId = resourceInputObj.getServiceInstanceId()
String operationId = resourceInputObj.getOperationId()
- String progress = "100"
- String status = "finished"
- String statusDescription = "SDCN resource delete completed"
+ String progress = "50"
+ String status = "deactivated"
+ String statusDescription = "SDCN resource deactivation completed"
//String operationId = execution.getVariable("operationId")
String body = """
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:ns="http://org.onap.so/requestsdb">
+ xmlns:ns="http://org.openecomp.mso/requestsdb">
<soapenv:Header/>
<soapenv:Body>
<ns:updateResourceOperationStatus>
- <operType>${MsoUtils.xmlEscape(operType)}</operType>
- <operationId>${MsoUtils.xmlEscape(operationId)}</operationId>
- <progress>${MsoUtils.xmlEscape(progress)}</progress>
- <resourceTemplateUUID>${MsoUtils.xmlEscape(resourceCustomizationUuid)}</resourceTemplateUUID>
- <serviceId>${MsoUtils.xmlEscape(serviceInstanceId)}</serviceId>
- <status>${MsoUtils.xmlEscape(status)}</status>
- <statusDescription>${MsoUtils.xmlEscape(statusDescription)}</statusDescription>
+ <operType>${msoUtils.xmlEncode(operType)}</operType>
+ <operationId>${msoUtils.xmlEncode(operationId)}</operationId>
+ <progress>${msoUtils.xmlEncode(progress)}</progress>
+ <resourceTemplateUUID>${msoUtils.xmlEncode(resourceCustomizationUuid)}</resourceTemplateUUID>
+ <serviceId>${msoUtils.xmlEncode(serviceInstanceId)}</serviceId>
+ <status>${msoUtils.xmlEncode(status)}</status>
+ <statusDescription>${msoUtils.xmlEncode(statusDescription)}</statusDescription>
</ns:updateResourceOperationStatus>
</soapenv:Body>
</soapenv:Envelope>""";
@@ -353,9 +376,15 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor
setProgressUpdateVariables(execution, body)
}
+ private void setProgressUpdateVariables(DelegateExecution execution, String body) {
+ def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint")
+ execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
+ execution.setVariable("CVFMI_updateResOperStatusRequest", body)
+ }
+
public void postDeactivateSDNCCall(DelegateExecution execution) {
- msoLogger.info(" ***** started postDeactivateSDNCCall *****")
- String responseCode = execution.getVariable(Prefix + "sdncDeleteReturnCode")
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ msoLogger.info(" ***** Started prepareSDNCRequest *****") String responseCode = execution.getVariable(Prefix + "sdncDeleteReturnCode")
String responseObj = execution.getVariable(Prefix + "SuccessIndicator")
msoLogger.info("response from sdnc, response code :" + responseCode + " response object :" + responseObj)
@@ -363,8 +392,8 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor
}
public void sendSyncResponse(DelegateExecution execution) {
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- msoLogger.info(" ***** started sendSyncResponse *****")
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ msoLogger.debug(" *** sendSyncResponse *** ")
try {
String operationStatus = "finished"
@@ -379,7 +408,7 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor
msoLogger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- msoLogger.debug(" ***** Exit sendSyncResopnse *****")
+ msoLogger("DEBUG"," ***** Exit sendSyncResopnse *****")
}
} \ No newline at end of file
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy
index 04b62d7f73..192788a4ca 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy
@@ -34,6 +34,8 @@ import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils
import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.bpmn.common.scripts.MsoUtils
+import org.onap.so.logger.MsoLogger
import groovy.json.*
@@ -42,21 +44,23 @@ import groovy.json.*
* flow for SDNC Network Resource
*/
public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor {
- private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,
- CreateSDNCNetworkResource.class);
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DeleteSDNCNetworkResource.class);
String Prefix="DELSDNCRES_"
-
+
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils()
-
+
+ MsoUtils msoUtils = new MsoUtils()
+
public void preProcessRequest(DelegateExecution execution){
- msoLogger.info("***** Started preProcessRequest *****")
- try {
-
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ msoLogger.info(" ***** Started preProcessRequest *****")
+ try {
+
//get bpmn inputs from resource request.
String requestId = execution.getVariable("mso-request-id")
String requestAction = execution.getVariable("requestAction")
@@ -68,12 +72,12 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor {
//Get ResourceInput Object
ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class)
execution.setVariable(Prefix + "resourceInput", resourceInputObj)
-
+
//Deal with recipeParams
String recipeParamsFromWf = execution.getVariable("recipeParamXsd")
- String resourceModelName = resourceInputObj.getResourceModelInfo().getModelName()
+ String resourceModelName = resourceInputObj.getResourceModelInfo().getModelName()
//For sdnc requestAction default is "NetworkInstance"
- String operationType = "Network"
+ String operationType = "Network"
if(!StringUtils.isBlank(recipeParamsFromRequest) && "null" != recipeParamsFromRequest){
//the operationType from worflow(first node) is second priority.
operationType = jsonUtil.getJsonValue(recipeParamsFromRequest, "operationType")
@@ -82,36 +86,78 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor {
//the operationType from worflow(first node) is highest priority.
operationType = jsonUtil.getJsonValue(recipeParamsFromWf, "operationType")
}
-
-
+
+
//For sdnc, generate svc_action and request_action
String sdnc_svcAction = "delete"
- if(StringUtils.containsIgnoreCase(resourceModelName, "overlay")){
- //This will be resolved in R3.
- sdnc_svcAction ="deactivate"
- operationType = "NCINetwork"
+ switch (resourceInputObj.getResourceModelInfo().getModelName()) {
+
+ case ~/[\w\s\W]*overlay[\w\s\W]*/ :
+ ///This will be resolved in R3.
+ sdnc_svcAction ="deactivate"
+ operationType = "NCINetwork"
+ break
+
+ case ~/[\w\s\W]*underlay[\w\s\W]*/ :
+ //This will be resolved in R3.
+ operationType ="Network"
+ break
+
+ case ~/[\w\s\W]*SOTNConnectivity[\w\s\W]*/ :
+ operationType = "SOTNConnectivity"
+ execution.setVariable("isActivateRequired", "true")
+ break
+
+ case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ :
+ operationType = "SOTNAttachment"
+ execution.setVariable("isActivateRequired", "true")
+ break
+
+ case ~/[\w\s\W]*SiteVF[\w\s\W]*/ :
+ operationType = "Site"
+ execution.setVariable("isActivateRequired", "true")
+ break
+
+ case ~/[\w\s\W]*deviceVF[\w\s\W]*/ :
+ operationType = "SDWANDevice"
+ execution.setVariable("isActivateRequired", "true")
+ break
+
+ case ~/[\w\s\W]*SDWANConnectivity[\w\s\W]*/ :
+ operationType = "SDWANConnectivity"
+ execution.setVariable("isActivateRequired", "true")
+ break
+
+ case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ :
+ operationType = "SDWANAttachment"
+ execution.setVariable("isActivateRequired", "true")
+ break
+
+ case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ :
+ operationType = "SDWANPort"
+ execution.setVariable("isActivateRequired", "true")
+ break
+
+ default:
+ break
}
- if(StringUtils.containsIgnoreCase(resourceModelName, "underlay")){
- //This will be resolved in R3.
- operationType ="Network"
- }
- String sdnc_requestAction = StringUtils.capitalize(sdnc_svcAction) + operationType +"Instance"
- execution.setVariable(Prefix + "svcAction", sdnc_svcAction)
+ String sdnc_requestAction = StringUtils.capitalize(sdnc_svcAction) + operationType +"Instance"
+ execution.setVariable(Prefix + "svcAction", sdnc_svcAction)
execution.setVariable(Prefix + "requestAction", sdnc_requestAction)
execution.setVariable(Prefix + "serviceInstanceId", resourceInputObj.getServiceInstanceId())
execution.setVariable("mso-request-id", requestId)
execution.setVariable("mso-service-instance-id", resourceInputObj.getServiceInstanceId())
//TODO Here build networkrequest
-
+
} catch (BpmnError e) {
throw e;
} catch (Exception ex){
msg = "Exception in preProcessRequest " + ex.getMessage()
- msoLogger.debug(msg)
+ msoLogger.debug( msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
}
-
+
/**
* Pre Process the BPMN Flow Request
* Inclouds:
@@ -119,11 +165,12 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor {
* generate the nsParameters
*/
public void prepareSDNCRequest (DelegateExecution execution) {
- msoLogger.info("***** Started prepareSDNCRequest *****")
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ msoLogger.info(" ***** Started prepareSDNCRequest *****")
try {
// get variables
- String sdnc_svcAction = execution.getVariable(Prefix + "svcAction")
+ String sdnc_svcAction = execution.getVariable(Prefix + "svcAction")
String sdnc_requestAction = execution.getVariable(Prefix + "requestAction")
String sdncCallback = execution.getVariable("URN_mso_workflow_sdncadapter_callback")
String deleteNetworkInput = execution.getVariable(Prefix + "networkRequest")
@@ -144,177 +191,164 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor {
String modelUuid = resourceInputObj.getResourceModelInfo().getModelUuid()
String modelName = resourceInputObj.getResourceModelInfo().getModelName()
String modelVersion = resourceInputObj.getResourceModelInfo().getModelVersion()
+ String resourceInstnaceId = resourceInputObj.getResourceInstancenUuid()
// 1. prepare assign topology via SDNC Adapter SUBFLOW call
- String sndcTopologyDeleteRequest = ""
+ String sdncTopologyDeleteRequest = ""
switch (modelName) {
- case ~/^Site$/:
- sndcTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
+ case ~/[\w\s\W]*deviceVF[\w\s\W]*/ :
+ case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ :
+ case ~/[\w\s\W]*SiteVF[\w\s\W]*/:
+ sdncTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1"
xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1">
<sdncadapter:RequestHeader>
- <sdncadapter:RequestId>${MsoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId>
- <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId>
- <sdncadapter:SvcAction>${MsoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction>
- <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation>
+ <sdncadapter:RequestId>${msoUtils.xmlEncode(hdrRequestId)}</sdncadapter:RequestId>
+ <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId>
+ <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction>
+ <sdncadapter:SvcOperation>vnf-topology-operation</sdncadapter:SvcOperation>
<sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl>
<sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction>
</sdncadapter:RequestHeader>
<sdncadapterworkflow:SDNCRequestData>
<request-information>
- <request-id>${MsoUtils.xmlEscape(hdrRequestId)}</request-id>
- <request-action>${MsoUtils.xmlEscape(sdnc_requestAction)}</request-action>
- <source>${MsoUtils.xmlEscape(source)}</source>
+ <request-id>${msoUtils.xmlEncode(hdrRequestId)}</request-id>
+ <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action>
+ <source>${msoUtils.xmlEncode(source)}</source>
<notification-url></notification-url>
<order-number></order-number>
<order-version></order-version>
</request-information>
<service-information>
- <service-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-id>
- <subscription-service-type>${MsoUtils.xmlEscape(serviceType)}</subscription-service-type>
+ <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id>
+ <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type>
<onap-model-information>
- <model-invariant-uuid>${MsoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid>
- <model-uuid>${MsoUtils.xmlEscape(serviceModelUuid)}</model-uuid>
- <model-version>${MsoUtils.xmlEscape(serviceModelVersion)}</model-version>
- <model-name>${MsoUtils.xmlEscape(serviceModelName)}</model-name>
+ <model-invariant-uuid>${msoUtils.xmlEncode(serviceModelInvariantUuid)}</model-invariant-uuid>
+ <model-uuid>${msoUtils.xmlEncode(serviceModelUuid)}</model-uuid>
+ <model-version>${msoUtils.xmlEncode(serviceModelVersion)}</model-version>
+ <model-name>${msoUtils.xmlEncode(serviceModelName)}</model-name>
</onap-model-information>
- <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id>
- <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id>
- <subscriber-name></subscriber-name>
+ <service-instance-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-instance-id>
+ <global-customer-id>${msoUtils.xmlEncode(globalCustomerId)}</global-customer-id>
+ <subscriber-name>${msoUtils.xmlEncode(globalCustomerId)}</subscriber-name>
</service-information>
<vnf-information>
- <!-- TODO: to be filled as per the request input -->
- <vnf-id></vnf-id>
+ <vnf-id>$resourceInstnaceId</vnf-id>
<vnf-type></vnf-type>
<onap-model-information>
- <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid>
- <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid>
- <model-uuid>${MsoUtils.xmlEscape(modelUuid)}</model-uuid>
- <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version>
- <model-name>${MsoUtils.xmlEscape(modelName)}</model-name>
+ <model-invariant-uuid>${msoUtils.xmlEncode(modelInvariantUuid)}</model-invariant-uuid>
+ <model-customization-uuid>${msoUtils.xmlEncode(modelCustomizationUuid)}</model-customization-uuid>
+ <model-uuid>${msoUtils.xmlEncode(modelUuid)}</model-uuid>
+ <model-version>${msoUtils.xmlEncode(modelVersion)}</model-version>
+ <model-name>${msoUtils.xmlEncode(modelName)}</model-name>
</onap-model-information>
</vnf-information>
<vnf-request-input>
- <request-version></request-version>
- <vnf-name></vnf-name>
- <vnf-networks>
- <vnf-network>
- <network-role></network-role>
- <network-name></network-name>
- <neutron-id></neutron-id>
- <network-id></network-id>
- <contrail-network-fqdn></contrail-network-fqdn>
- <subnets-data>
- <subnet-data>
- <ip-version></ip-version>
- <subnet-id></subnet-id>
- </subnet-data>
- </subnets-data>
- </vnf-network>
+ <vnf-input-parameters>
+ </vnf-input-parameters>
+ <request-version></request-version>
+ <vnf-name></vnf-name>
+ <vnf-networks>
</vnf-networks>
- </vnf-request-input>
- <vnf-input-parameters>
- <param></param>
- </vnf-input-parameters>
+ </vnf-request-input>
</sdncadapterworkflow:SDNCRequestData>
</aetgt:SDNCAdapterWorkflowRequest>""".trim()
break
- case ~/^SOTNAttachment$/:
- sndcTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
+ case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ :
+ case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ :
+ sdncTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1"
xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1">
<sdncadapter:RequestHeader>
- <sdncadapter:RequestId>${MsoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId>
- <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId>
- <sdncadapter:SvcAction>${MsoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction>
- <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation>
+ <sdncadapter:RequestId>${msoUtils.xmlEncode(hdrRequestId)}</sdncadapter:RequestId>
+ <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId>
+ <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction>
+ <sdncadapter:SvcOperation>connection-attachment-topology-operation</sdncadapter:SvcOperation>
<sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl>
<sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction>
</sdncadapter:RequestHeader>
<sdncadapterworkflow:SDNCRequestData>
<request-information>
- <request-id>${MsoUtils.xmlEscape(hdrRequestId)}</request-id>
- <request-action>${MsoUtils.xmlEscape(sdnc_requestAction)}</request-action>
- <source>${MsoUtils.xmlEscape(source)}</source>
+ <request-id>${msoUtils.xmlEncode(hdrRequestId)}</request-id>
+ <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action>
+ <source>${msoUtils.xmlEncode(source)}</source>
<notification-url></notification-url>
<order-number></order-number>
<order-version></order-version>
</request-information>
<service-information>
- <service-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-id>
- <subscription-service-type>${MsoUtils.xmlEscape(serviceType)}</subscription-service-type>
+ <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id>
+ <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type>
<onap-model-information>
- <model-invariant-uuid>${MsoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid>
- <model-uuid>${MsoUtils.xmlEscape(serviceModelUuid)}</model-uuid>
- <model-version>${MsoUtils.xmlEscape(serviceModelVersion)}</model-version>
- <model-name>${MsoUtils.xmlEscape(serviceModelName)}</model-name>
+ <model-invariant-uuid>${msoUtils.xmlEncode(serviceModelInvariantUuid)}</model-invariant-uuid>
+ <model-uuid>${msoUtils.xmlEncode(serviceModelUuid)}</model-uuid>
+ <model-version>${msoUtils.xmlEncode(serviceModelVersion)}</model-version>
+ <model-name>${msoUtils.xmlEncode(serviceModelName)}</model-name>
</onap-model-information>
- <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id>
- <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id>
+ <service-instance-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-instance-id>
+ <global-customer-id>${msoUtils.xmlEncode(globalCustomerId)}</global-customer-id>
<subscriber-name></subscriber-name>
</service-information>
<allotted-resource-information>
- <allotted-resource-id></allotted-resource-id>
+ <allotted-resource-id>$resourceInstnaceId</allotted-resource-id>
<allotted-resource-type></allotted-resource-type>
<parent-service-instance-id></parent-service-instance-id>
<onap-model-information>
- <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid>
- <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid>
- <model-uuid>${MsoUtils.xmlEscape(modelUuid)}</model-uuid>
- <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version>
- <model-name>${MsoUtils.xmlEscape(modelName)}</model-name>
+ <model-invariant-uuid>${msoUtils.xmlEncode(modelInvariantUuid)}</model-invariant-uuid>
+ <model-customization-uuid>${msoUtils.xmlEncode(modelCustomizationUuid)}</model-customization-uuid>
+ <model-uuid>${msoUtils.xmlEncode(modelUuid)}</model-uuid>
+ <model-version>${msoUtils.xmlEncode(modelVersion)}</model-version>
+ <model-name>${msoUtils.xmlEncode(modelName)}</model-name>
</onap-model-information>
</allotted-resource-information>
<connection-attachment-request-input>
- <param></param>
</connection-attachment-request-input>
</sdncadapterworkflow:SDNCRequestData>
</aetgt:SDNCAdapterWorkflowRequest>""".trim()
break
default:
- sndcTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
+ sdncTopologyDeleteRequest = """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1"
xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1">
<sdncadapter:RequestHeader>
- <sdncadapter:RequestId>${MsoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId>
- <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(serviceInstanceId)}</sdncadapter:SvcInstanceId>
- <sdncadapter:SvcAction>${MsoUtils.xmlEscape(sdnc_svcAction)}</sdncadapter:SvcAction>
+ <sdncadapter:RequestId>${msoUtils.xmlEncode(hdrRequestId)}</sdncadapter:RequestId>
+ <sdncadapter:SvcInstanceId>${msoUtils.xmlEncode(serviceInstanceId)}</sdncadapter:SvcInstanceId>
+ <sdncadapter:SvcAction>${msoUtils.xmlEncode(sdnc_svcAction)}</sdncadapter:SvcAction>
<sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation>
<sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl>
<sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction>
</sdncadapter:RequestHeader>
<sdncadapterworkflow:SDNCRequestData>
<request-information>
- <request-id>${MsoUtils.xmlEscape(hdrRequestId)}</request-id>
- <request-action>${MsoUtils.xmlEscape(sdnc_requestAction)}</request-action>
- <source>${MsoUtils.xmlEscape(source)}</source>
+ <request-id>${msoUtils.xmlEncode(hdrRequestId)}</request-id>
+ <request-action>${msoUtils.xmlEncode(sdnc_requestAction)}</request-action>
+ <source>${msoUtils.xmlEncode(source)}</source>
<notification-url></notification-url>
<order-number></order-number>
<order-version></order-version>
</request-information>
<service-information>
- <service-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-id>
- <subscription-service-type>${MsoUtils.xmlEscape(serviceType)}</subscription-service-type>
+ <service-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-id>
+ <subscription-service-type>${msoUtils.xmlEncode(serviceType)}</subscription-service-type>
<onap-model-information>
- <model-invariant-uuid>${MsoUtils.xmlEscape(serviceModelInvariantUuid)}</model-invariant-uuid>
- <model-uuid>${MsoUtils.xmlEscape(serviceModelUuid)}</model-uuid>
- <model-version>${MsoUtils.xmlEscape(serviceModelVersion)}</model-version>
- <model-name>${MsoUtils.xmlEscape(serviceModelName)}</model-name>
+ <model-invariant-uuid>${msoUtils.xmlEncode(serviceModelInvariantUuid)}</model-invariant-uuid>
+ <model-uuid>${msoUtils.xmlEncode(serviceModelUuid)}</model-uuid>
+ <model-version>${msoUtils.xmlEncode(serviceModelVersion)}</model-version>
+ <model-name>${msoUtils.xmlEncode(serviceModelName)}</model-name>
</onap-model-information>
- <service-instance-id>${MsoUtils.xmlEscape(serviceInstanceId)}</service-instance-id>
- <global-customer-id>${MsoUtils.xmlEscape(globalCustomerId)}</global-customer-id>
+ <service-instance-id>${msoUtils.xmlEncode(serviceInstanceId)}</service-instance-id>
+ <global-customer-id>${msoUtils.xmlEncode(globalCustomerId)}</global-customer-id>
</service-information>
<network-information>
- <!-- TODO: to be filled as per the request input -->
- <network-id></network-id>
+ <network-id>$resourceInstnaceId</network-id>
<onap-model-information>
- <model-invariant-uuid>${MsoUtils.xmlEscape(modelInvariantUuid)}</model-invariant-uuid>
- <model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid>
- <model-uuid>${MsoUtils.xmlEscape(modelUuid)}</model-uuid>
- <model-version>${MsoUtils.xmlEscape(modelVersion)}</model-version>
- <model-name>${MsoUtils.xmlEscape(modelName)}</model-name>
+ <model-invariant-uuid>${msoUtils.xmlEncode(modelInvariantUuid)}</model-invariant-uuid>
+ <model-customization-uuid>${msoUtils.xmlEncode(modelCustomizationUuid)}</model-customization-uuid>
+ <model-uuid>${msoUtils.xmlEncode(modelUuid)}</model-uuid>
+ <model-version>${msoUtils.xmlEncode(modelVersion)}</model-version>
+ <model-name>${msoUtils.xmlEncode(modelName)}</model-name>
</onap-model-information>
</network-information>
<network-request-input>
@@ -324,19 +358,19 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor {
</aetgt:SDNCAdapterWorkflowRequest>""".trim()
}
- String sndcTopologyDeleteRequesAsString = utils.formatXml(sndcTopologyDeleteRequest)
- utils.logAudit(sndcTopologyDeleteRequesAsString)
- execution.setVariable("sdncAdapterWorkflowRequest", sndcTopologyDeleteRequesAsString)
- msoLogger.info("sdncAdapterWorkflowRequest - " + "\n" + sndcTopologyDeleteRequesAsString)
+ String sdncTopologyDeleteRequesAsString = utils.formatXml(sdncTopologyDeleteRequest)
+ utils.logAudit(sdncTopologyDeleteRequesAsString)
+ execution.setVariable("sdncAdapterWorkflowRequest", sdncTopologyDeleteRequesAsString)
+ msoLogger.info("sdncAdapterWorkflowRequest - " + "\n" + sdncTopologyDeleteRequesAsString)
} catch (Exception ex) {
String exceptionMessage = " Bpmn error encountered in DeleteSDNCCNetworkResource flow. prepareSDNCRequest() - " + ex.getMessage()
- msoLogger.debug(exceptionMessage)
+ msoLogger.debug( exceptionMessage)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage)
}
msoLogger.info(" ***** Exit prepareSDNCRequest *****")
- }
+ }
private void setProgressUpdateVariables(DelegateExecution execution, String body) {
def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint")
@@ -358,17 +392,17 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor {
String body = """
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:ns="http://org.onap.so/requestsdb">
+ xmlns:ns="http://org.openecomp.mso/requestsdb">
<soapenv:Header/>
<soapenv:Body>
<ns:updateResourceOperationStatus>
- <operType>${MsoUtils.xmlEscape(operType)}</operType>
- <operationId>${MsoUtils.xmlEscape(operationId)}</operationId>
- <progress>${MsoUtils.xmlEscape(progress)}</progress>
- <resourceTemplateUUID>${MsoUtils.xmlEscape(resourceCustomizationUuid)}</resourceTemplateUUID>
- <serviceId>${MsoUtils.xmlEscape(serviceInstanceId)}</serviceId>
- <status>${MsoUtils.xmlEscape(status)}</status>
- <statusDescription>${MsoUtils.xmlEscape(statusDescription)}</statusDescription>
+ <operType>${msoUtils.xmlEncode(operType)}</operType>
+ <operationId>${msoUtils.xmlEncode(operationId)}</operationId>
+ <progress>${msoUtils.xmlEncode(progress)}</progress>
+ <resourceTemplateUUID>${msoUtils.xmlEncode(resourceCustomizationUuid)}</resourceTemplateUUID>
+ <serviceId>${msoUtils.xmlEncode(serviceInstanceId)}</serviceId>
+ <status>${msoUtils.xmlEncode(status)}</status>
+ <statusDescription>${msoUtils.xmlEncode(statusDescription)}</statusDescription>
</ns:updateResourceOperationStatus>
</soapenv:Body>
</soapenv:Envelope>""";
@@ -385,23 +419,23 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor {
String operationId = resourceInputObj.getOperationId()
String progress = "100"
String status = "finished"
- String statusDescription = "SDCN resource delete completed"
+ String statusDescription = "SDCN resource delete and deactivation completed"
//String operationId = execution.getVariable("operationId")
String body = """
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:ns="http://org.onap.so/requestsdb">
+ xmlns:ns="http://org.openecomp.mso/requestsdb">
<soapenv:Header/>
<soapenv:Body>
<ns:updateResourceOperationStatus>
- <operType>${MsoUtils.xmlEscape(operType)}</operType>
- <operationId>${MsoUtils.xmlEscape(operationId)}</operationId>
- <progress>${MsoUtils.xmlEscape(progress)}</progress>
- <resourceTemplateUUID>${MsoUtils.xmlEscape(resourceCustomizationUuid)}</resourceTemplateUUID>
- <serviceId>${MsoUtils.xmlEscape(serviceInstanceId)}</serviceId>
- <status>${MsoUtils.xmlEscape(status)}</status>
- <statusDescription>${MsoUtils.xmlEscape(statusDescription)}</statusDescription>
+ <operType>${msoUtils.xmlEncode(operType)}</operType>
+ <operationId>${msoUtils.xmlEncode(operationId)}</operationId>
+ <progress>${msoUtils.xmlEncode(progress)}</progress>
+ <resourceTemplateUUID>${msoUtils.xmlEncode(resourceCustomizationUuid)}</resourceTemplateUUID>
+ <serviceId>${msoUtils.xmlEncode(serviceInstanceId)}</serviceId>
+ <status>${msoUtils.xmlEncode(status)}</status>
+ <statusDescription>${msoUtils.xmlEncode(statusDescription)}</statusDescription>
</ns:updateResourceOperationStatus>
</soapenv:Body>
</soapenv:Envelope>""";
@@ -410,6 +444,7 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor {
}
public void postDeleteSDNCCall(DelegateExecution execution){
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
msoLogger.info(" ***** Started prepareSDNCRequest *****")
String responseCode = execution.getVariable(Prefix + "sdncDeleteReturnCode")
String responseObj = execution.getVariable(Prefix + "SuccessIndicator")
@@ -417,23 +452,24 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor {
msoLogger.info("response from sdnc, response code :" + responseCode + " response object :" + responseObj)
msoLogger.info(" ***** Exit prepareSDNCRequest *****")
}
-
- public void sendSyncResponse (DelegateExecution execution) {
- msoLogger.info(" *** sendSyncResponse *** ")
-
- try {
- String operationStatus = "finished"
- // RESTResponse for main flow
- String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim()
- utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + resourceOperationResp, isDebugEnabled)
- sendWorkflowResponse(execution, 202, resourceOperationResp)
- execution.setVariable("sentSyncResponse", true)
-
- } catch (Exception ex) {
- String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage()
- msoLogger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
- }
- msoLogger.info(" ***** Exit sendSyncResopnse *****")
- }
+
+ public void sendSyncResponse (DelegateExecution execution) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ msoLogger.debug( " *** sendSyncResponse *** ")
+
+ try {
+ String operationStatus = "finished"
+ // RESTResponse for main flow
+ String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim()
+ msoLogger.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)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ msoLogger.debug(" ***** Exit sendSyncResopnse *****")
+ }
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy
index 913970b051..26b0fea6a2 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy
@@ -42,9 +42,11 @@ import org.onap.so.client.aai.AAIObjectType
import org.onap.so.client.aai.AAIResourcesClient
import org.onap.so.client.aai.entities.AAIResultWrapper
import org.onap.so.client.aai.entities.uri.AAIResourceUri
+import org.onap.so.bpmn.infrastructure.workflow.service.ServicePluginFactory
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.onap.so.logger.MessageEnum
import org.onap.so.logger.MsoLogger
+import org.onap.so.rest.APIResponse
import org.springframework.web.util.UriUtils;
import groovy.json.*
@@ -331,6 +333,37 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
}
+ public void saveServiceInputToAAI(DelegateExecution execution) {
+ AaiUtil aaiUriUtil = new AaiUtil(this)
+
+ // create url for AAI requestInput
+ String aai_uri = aaiUriUtil.getAAIServiceInstanceUri(execution)
+ String namespace = aaiUriUtil.getNamespaceFromUri(aai_uri)
+
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ String serviceInstanceName = execution.getVariable("serviceInstanceName")
+ String serviceType = execution.getVariable("serviceType")
+ String uuiRequest = execution.getVariable("uuiRequest")
+
+ String payload =
+ """< xmlns=\"${namespace}\">
+ <service-instance>
+ <service-instance-id>${serviceInstanceId}</service-instance-id>
+ <service-instance-name>${serviceInstanceName}</service-instance-name>
+ <service-type>${serviceType}</service-type>
+ <customer-request>${uuiRequest}</customer-request>
+ </service-instance>""".trim()
+ utils.logAudit(payload)
+
+ String aai_endpoint = execution.getVariable("URN_aai_endpoint")
+ String serviceAaiPath = "${aai_endpoint}${aai_uri}/" + UriUtils.encode(serviceInstanceId,"UTF-8")
+
+ APIResponse response = aaiUriUtil.executeAAIPutCall(execution, serviceAaiPath, payload)
+ int responseCode = response.getStatusCode()
+ execution.setVariable(Prefix + "PutSppartnerResponseCode", responseCode)
+ }
+
+
public void postProcessAAIGET2(DelegateExecution execution) {
msoLogger.trace("postProcessAAIGET2 ")
String msg = ""
@@ -469,15 +502,25 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
// if site location is in local Operator, create all resources in local ONAP;
// if site location is in 3rd Operator, only process sp-partner to create all resources in 3rd ONAP
public void doProcessSiteLocation(DelegateExecution execution){
-
msoLogger.trace("======== Start doProcessSiteLocation Process ======== ")
ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
String uuiRequest = execution.getVariable("uuiRequest")
- ServiceDecomposition serviceDecompositionforLocal = ServicePluginFactory.getInstance().doProcessSiteLocation(serviceDecomposition, uuiRequest);
- execution.setVariable("serviceDecomposition", serviceDecompositionforLocal)
+ uuiRequest = ServicePluginFactory.getInstance().doProcessSiteLocation(serviceDecomposition, uuiRequest);
+ execution.setVariable("uuiRequest", uuiRequest)
+ execution.setVariable("serviceDecomposition", serviceDecomposition)
msoLogger.trace("======== COMPLETED doProcessSiteLocation Process ======== ")
}
+
+ // Allocate cross link TPs(terminal points) for sotn network only
+ public void doTPResourcesAllocation(DelegateExecution execution){
+ msoLogger.trace("======== Start doTPResourcesAllocation Process ======== ")
+ ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
+ String uuiRequest = execution.getVariable("uuiRequest")
+ uuiRequest = ServicePluginFactory.getInstance().doTPResourcesAllocation(execution, uuiRequest);
+ execution.setVariable("uuiRequest", uuiRequest)
+ msoLogger.trace("======== COMPLETED doTPResourcesAllocation Process ======== ")
+ }
// prepare input param for using DoCreateResources.bpmn
public void preProcessForAddResource(DelegateExecution execution) {
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy
index 3d8b2571aa..17dbe50cc5 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy
@@ -20,7 +20,6 @@
package org.onap.so.bpmn.infrastructure.scripts
-import org.codehaus.jackson.map.ObjectMapper
import org.onap.so.bpmn.infrastructure.properties.BPMNProperties
import java.util.ArrayList
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java
index 353b4e32c5..70323b726c 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java
@@ -26,8 +26,7 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import javax.ws.rs.core.UriBuilder;
@@ -49,10 +48,7 @@ public class PnfEventReadyDmaapClient implements DmaapClient {
private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, PnfEventReadyDmaapClient.class);
- private static final String JSON_PATH_CORRELATION_ID = "$.pnfRegistrationFields.correlationId";
-
- @Autowired
- private Environment env;
+ private final Environment env;
private HttpClient httpClient;
private String dmaapHost;
private int dmaapPort;
@@ -63,10 +59,15 @@ public class PnfEventReadyDmaapClient implements DmaapClient {
private String consumerGroup;
private Map<String, Runnable> pnfCorrelationIdToThreadMap;
private HttpGet getRequest;
- private ScheduledExecutorService executor;
private int dmaapClientDelayInSeconds;
+ private volatile ScheduledThreadPoolExecutor executor;
private volatile boolean dmaapThreadListenerIsRunning;
+ @Autowired
+ public PnfEventReadyDmaapClient(Environment env) {
+ this.env = env;
+ }
+
public void init() {
httpClient = HttpClientBuilder.create().build();
pnfCorrelationIdToThreadMap = new ConcurrentHashMap<>();
@@ -97,7 +98,9 @@ public class PnfEventReadyDmaapClient implements DmaapClient {
private synchronized void startDmaapThreadListener() {
if (!dmaapThreadListenerIsRunning) {
- executor = Executors.newScheduledThreadPool(1);
+ executor = new ScheduledThreadPoolExecutor(1);
+ executor.setContinueExistingPeriodicTasksAfterShutdownPolicy(false);
+ executor.setExecuteExistingDelayedTasksAfterShutdownPolicy(false);
executor.scheduleWithFixedDelay(new DmaapTopicListenerThread(), 0,
dmaapClientDelayInSeconds, TimeUnit.SECONDS);
dmaapThreadListenerIsRunning = true;
@@ -106,7 +109,7 @@ public class PnfEventReadyDmaapClient implements DmaapClient {
private synchronized void stopDmaapThreadListener() {
if (dmaapThreadListenerIsRunning) {
- executor.shutdownNow();
+ executor.shutdown();
dmaapThreadListenerIsRunning = false;
executor = null;
}
@@ -166,7 +169,7 @@ public class PnfEventReadyDmaapClient implements DmaapClient {
return Collections.emptyList();
}
- private synchronized void informAboutPnfReadyIfCorrelationIdFound(String correlationId) {
+ private void informAboutPnfReadyIfCorrelationIdFound(String correlationId) {
Runnable runnable = unregister(correlationId);
if (runnable != null) {
LOGGER.debug("pnf ready event got from dmaap for correlationId: " + correlationId);
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java
index 80b64ddc7c..39df3d62ae 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/service/ServicePluginFactory.java
@@ -20,7 +20,6 @@
package org.onap.so.bpmn.infrastructure.workflow.service;
-import org.json.JSONObject;
import java.io.IOException;
import java.net.SocketTimeoutException;
import java.util.ArrayList;
@@ -43,6 +42,7 @@ import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.runtime.Execution;
import org.onap.so.bpmn.core.UrnPropertiesReader;
import org.onap.so.bpmn.core.domain.ServiceDecomposition;
@@ -50,9 +50,7 @@ import org.onap.so.bpmn.core.domain.Resource;
import org.onap.so.bpmn.core.json.JsonUtils;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.env.Environment;
-
+import org.onap.so.bpmn.common.scripts.AaiUtil;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
@@ -60,17 +58,17 @@ import com.fasterxml.jackson.databind.SerializationFeature;
public class ServicePluginFactory {
// SOTN calculate route
- public static final String OOF_Default_EndPoint = "http://192.168.1.223:8443/oof/sotncalc";
+ public static final String OOF_DEFAULT_ENDPOINT = "http://192.168.1.223:8443/oof/sotncalc";
- public static final String Third_SP_Default_EndPoint = "http://192.168.1.223:8443/sp/resourcemgr/querytps";
+ public static final String THIRD_SP_DEFAULT_ENDPOINT = "http://192.168.1.223:8443/sp/resourcemgr/querytps";
- public static final String Inventory_OSS_Default_EndPoint = "http://192.168.1.199:8443/oss/inventory";
+ public static final String INVENTORY_OSS_DEFAULT_ENDPOINT = "http://192.168.1.199:8443/oss/inventory";
private static final int DEFAULT_TIME_OUT = 60000;
static JsonUtils jsonUtil = new JsonUtils();
- private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, ServicePluginFactory.class);
+ private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ServicePluginFactory.class);
private static ServicePluginFactory instance;
@@ -81,76 +79,230 @@ public class ServicePluginFactory {
}
return instance;
}
-
- private ServicePluginFactory() {
-
- }
-
private String getInventoryOSSEndPoint(){
- return UrnPropertiesReader.getVariable("mso.service-plugin.inventory-oss-endpoint", Inventory_OSS_Default_EndPoint);
+ return UrnPropertiesReader.getVariable("mso.service-plugin.inventory-oss-endpoint", INVENTORY_OSS_DEFAULT_ENDPOINT);
}
+
private String getThirdSPEndPoint(){
- return UrnPropertiesReader.getVariable("mso.service-plugin.third-sp-endpoint", Third_SP_Default_EndPoint);
+ return UrnPropertiesReader.getVariable("mso.service-plugin.third-sp-endpoint", THIRD_SP_DEFAULT_ENDPOINT);
}
private String getOOFCalcEndPoint(){
- return UrnPropertiesReader.getVariable("mso.service-plugin.oof-calc-endpoint", OOF_Default_EndPoint);
+ return UrnPropertiesReader.getVariable("mso.service-plugin.oof-calc-endpoint", OOF_DEFAULT_ENDPOINT);
}
+
+ @SuppressWarnings("unchecked")
+ public String doProcessSiteLocation(ServiceDecomposition serviceDecomposition, String uuiRequest) {
+ if(!isNeedProcessSite(uuiRequest)) {
+ return uuiRequest;
+ }
- public ServiceDecomposition doProcessSiteLocation(ServiceDecomposition serviceDecomposition, String uuiRequest) {
- ServiceDecomposition serviceDecompositionforLocal = serviceDecomposition;
+ Map<String, Object> uuiObject = getJsonObject(uuiRequest, Map.class);
+ Map<String, Object> serviceObject = (Map<String, Object>) uuiObject.get("service");
+ Map<String, Object> serviceParametersObject = (Map<String, Object>) serviceObject.get("parameters");
+ Map<String, Object> serviceRequestInputs = (Map<String, Object>) serviceParametersObject.get("requestInputs");
+ List<Object> resources = (List<Object>) serviceParametersObject.get("resources");
- if (isSiteLocationLocal(serviceDecomposition, uuiRequest)) {
- return serviceDecomposition;
+ if (isSiteLocationLocal(serviceRequestInputs, resources)) {
+ // resources changed : added TP info
+ String newRequest = getJsonString(uuiObject);
+ return newRequest;
}
List<Resource> addResourceList = serviceDecomposition.getServiceResources();
for (Resource resource : addResourceList) {
String resourcemodelName = resource.getModelInfo().getModelName();
- if (!StringUtils.containsIgnoreCase(resourcemodelName, "sp-partner")) {
- serviceDecompositionforLocal.deleteResource(resource);
+ if (!StringUtils.containsIgnoreCase(resourcemodelName, "sp-partner")
+ || !StringUtils.containsIgnoreCase(resourcemodelName, "sppartner")) {
+ // change serviceDecomposition
+ serviceDecomposition.deleteResource(resource);
break;
}
- if (!StringUtils.containsIgnoreCase(resourcemodelName, "sppartner")) {
- serviceDecompositionforLocal.deleteResource(resource);
+ }
+
+ return uuiRequest;
+ }
+
+ private boolean isNeedProcessSite(String uuiRequest) {
+ return uuiRequest.toLowerCase().contains("site_address") && uuiRequest.toLowerCase().contains("sotncondition_clientsignal");
+ }
+
+ @SuppressWarnings("unchecked")
+ private boolean isSiteLocationLocal(Map<String, Object> serviceRequestInputs, List<Object> resources) {
+ Map<String, Object> tpInfoMap = getTPforVPNAttachment(serviceRequestInputs);
+
+ if(tpInfoMap.isEmpty()) {
+ return true;
+ }
+ String host = (String) tpInfoMap.get("host");
+ // host is empty means TP is in local, not empty means TP is in remote ONAP
+ if (!host.isEmpty()) {
+ return false;
+ }
+
+ Map<String, Object> accessTPInfo = new HashMap<String, Object>();
+ accessTPInfo.put("access-provider-id", tpInfoMap.get("access-provider-id"));
+ accessTPInfo.put("access-client-id", tpInfoMap.get("access-client-id"));
+ accessTPInfo.put("access-topology-id", tpInfoMap.get("access-topology-id"));
+ accessTPInfo.put("access-node-id", tpInfoMap.get("access-node-id"));
+ accessTPInfo.put("access-ltp-id", tpInfoMap.get("access-ltp-id"));
+
+ // change resources
+ String resourceName = (String) accessTPInfo.get("resourceName");
+ for(Object curResource : resources) {
+ Map<String, Object> resource = (Map<String, Object>)curResource;
+ String curResourceName = (String) resource.get("resourceName");
+ curResourceName = curResourceName.replaceAll(" ", "");
+ if(resourceName.equalsIgnoreCase(curResourceName)) {
+ putResourceRequestInputs(resource, accessTPInfo);
break;
}
}
- return serviceDecompositionforLocal;
+ return true;
}
+
+ @SuppressWarnings("unchecked")
+ private Map<String, Object> getTPforVPNAttachment(Map<String, Object> serviceRequestInputs) {
+ Object location = "";
+ Object clientSignal = "";
+ String vpnAttachmentResourceName = "";
- public boolean isSiteLocationLocal(ServiceDecomposition serviceDecomposition, String uuiRequest) {
- boolean isSiteLocationLocal = true;
-
- String serviceModelName = serviceDecomposition.getModelInfo().getModelName();
- String serviceParameters = JsonUtils.getJsonValue(uuiRequest, "service.parameters");
- String requestInputs = JsonUtils.getJsonValue(serviceParameters, "requestInputs");
- JSONObject inputParameters = new JSONObject(requestInputs);
-
- if(StringUtils.containsIgnoreCase(serviceModelName, "site") && inputParameters.has("location"))
- {
- Object location = inputParameters.get("location");
- JSONObject locationObj = new JSONObject(location);
- String locationONAP = queryLocationFromInventoryOSS(locationObj);
- if(StringUtils.containsIgnoreCase(locationONAP, "remote")) {
- isSiteLocationLocal = false;
+ // support R2 uuiReq and R1 uuiReq
+ // logic for R2 uuiRequest params in service level
+ for (Entry<String, Object> entry : serviceRequestInputs.entrySet()) {
+ String key = entry.getKey();
+ if (key.toLowerCase().contains("site_address")) {
+ location = entry.getValue();
+ }
+ if (key.toLowerCase().contains("sotncondition_clientsignal")) {
+ clientSignal = entry.getValue();
+ vpnAttachmentResourceName = key.substring(0, key.indexOf("_"));
}
}
- return isSiteLocationLocal;
+ Map<String, Object> tpInfoMap = new HashMap<String, Object>();
+
+ // Site resource has location param and SOTNAttachment resource has clientSignal param
+ if("".equals(location) || "".equals(clientSignal) ) {
+ return tpInfoMap;
+ }
+
+ // Query terminal points from InventoryOSS system by location.
+ String locationAddress = (String) location;
+ List<Object> locationTPList = queryAccessTPbyLocationFromInventoryOSS(locationAddress);
+ if(locationTPList != null && !locationTPList.isEmpty()) {
+ tpInfoMap = (Map<String, Object>) locationTPList.get(0);
+ // add resourceName
+ tpInfoMap.put("resourceName", vpnAttachmentResourceName);
+ LOGGER.debug("Get Terminal TP from InventoryOSS");
+ return tpInfoMap;
+ }
+
+ return tpInfoMap;
}
- private String queryLocationFromInventoryOSS(JSONObject locationObj) {
- String reqContent = getJsonString(locationObj);
+ @SuppressWarnings("unchecked")
+ private List<Object> queryAccessTPbyLocationFromInventoryOSS(String locationAddress) {
+ Map<String, String> locationSrc = new HashMap<String, String>();
+ locationSrc.put("location", locationAddress);
+ String reqContent = getJsonString(locationSrc);
String url = getInventoryOSSEndPoint();
String responseContent = sendRequest(url, "POST", reqContent);
- String locationONAP = "";
+ List<Object> accessTPs = new ArrayList<Object>();
if (null != responseContent) {
- locationONAP = getJsonObject(responseContent, String.class);
+ accessTPs = getJsonObject(responseContent, List.class);
+ }
+ return accessTPs;
+ }
+
+ @SuppressWarnings("unchecked")
+ private void putResourceRequestInputs(Map<String, Object> resource, Map<String, Object> resourceInputs) {
+ Map<String, Object> resourceParametersObject = new HashMap<String, Object>();
+ Map<String, Object> resourceRequestInputs = new HashMap<String, Object>();
+ resourceRequestInputs.put("requestInputs", resourceInputs);
+ resourceParametersObject.put("parameters", resourceRequestInputs);
+
+ if(resource.containsKey("parameters")) {
+ Map<String, Object> resParametersObject = (Map<String, Object>) resource.get("parameters");
+ if(resParametersObject.containsKey("requestInputs")) {
+ Map<String, Object> resRequestInputs = (Map<String, Object>) resourceParametersObject.get("requestInputs");
+ resRequestInputs.putAll(resourceInputs);
+ }
+ else {
+ resParametersObject.putAll(resourceRequestInputs);
+ }
}
- return locationONAP;
+ else {
+ resource.putAll(resourceParametersObject);
+ }
+
+ return;
+ }
+
+
+
+ @SuppressWarnings("unchecked")
+ public String doTPResourcesAllocation(DelegateExecution execution, String uuiRequest) {
+ Map<String, Object> uuiObject = getJsonObject(uuiRequest, Map.class);
+ Map<String, Object> serviceObject = (Map<String, Object>) uuiObject.get("service");
+ Map<String, Object> serviceParametersObject = (Map<String, Object>) serviceObject.get("parameters");
+ Map<String, Object> serviceRequestInputs = (Map<String, Object>) serviceParametersObject.get("requestInputs");
+
+ if(!isNeedAllocateCrossTPResources(serviceRequestInputs)) {
+ return uuiRequest;
+ }
+
+ allocateCrossTPResources(execution, serviceRequestInputs);
+ String newRequest = getJsonString(uuiObject);
+ return newRequest;
+ }
+
+ @SuppressWarnings("unchecked")
+ private boolean isNeedAllocateCrossTPResources(Map<String, Object> serviceRequestInputs) {
+ if(serviceRequestInputs.containsKey("CallSource"))
+ {
+ String callSource = (String) serviceRequestInputs.get("CallSource");
+ if("ExternalAPI".equalsIgnoreCase(callSource)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ private void allocateCrossTPResources(DelegateExecution execution, Map<String, Object> serviceRequestInputs) {
+
+ AaiUtil aai = new AaiUtil(null);
+ Map<String, Object> crossTPs = aai.getTPsfromAAI(execution);
+
+ if(crossTPs == null || crossTPs.isEmpty()) {
+ serviceRequestInputs.put("local-access-provider-id", "");
+ serviceRequestInputs.put("local-access-client-id", "");
+ serviceRequestInputs.put("local-access-topology-id", "");
+ serviceRequestInputs.put("local-access-node-id", "");
+ serviceRequestInputs.put("local-access-ltp-id", "");
+ serviceRequestInputs.put("remote-access-provider-id", "");
+ serviceRequestInputs.put("remote-access-client-id", "");
+ serviceRequestInputs.put("remote-access-topology-id", "");
+ serviceRequestInputs.put("remote-access-node-id", "");
+ serviceRequestInputs.put("remote-access-ltp-id", "");
+ }
+ else {
+ serviceRequestInputs.put("local-access-provider-id", crossTPs.get("local-access-provider-id"));
+ serviceRequestInputs.put("local-access-client-id", crossTPs.get("local-access-client-id"));
+ serviceRequestInputs.put("local-access-topology-id", crossTPs.get("local-access-topology-id"));
+ serviceRequestInputs.put("local-access-node-id", crossTPs.get("local-access-node-id"));
+ serviceRequestInputs.put("local-access-ltp-id", crossTPs.get("local-access-ltp-id"));
+ serviceRequestInputs.put("remote-access-provider-id", crossTPs.get("remote-access-provider-id"));
+ serviceRequestInputs.put("remote-access-client-id", crossTPs.get("remote-client-id"));
+ serviceRequestInputs.put("remote-access-topology-id", crossTPs.get("remote-topology-id"));
+ serviceRequestInputs.put("remote-access-node-id", crossTPs.get("remote-node-id"));
+ serviceRequestInputs.put("remote-access-ltp-id", crossTPs.get("remote-ltp-id"));
+ }
+
+ return;
}
public String preProcessService(ServiceDecomposition serviceDecomposition, String uuiRequest) {
@@ -211,8 +363,7 @@ public class ServicePluginFactory {
for (Object resource : resources) {
Map<String, Object> resourceObject = (Map<String, Object>) resource;
Map<String, Object> resourceParametersObject = (Map<String, Object>) resourceObject.get("parameters");
- Map<String, Object> resourceRequestInputs = (Map<String, Object>) resourceParametersObject
- .get("requestInputs");
+ Map<String, Object> resourceRequestInputs = (Map<String, Object>) resourceParametersObject.get("requestInputs");
for (Entry<String, Object> entry : resourceRequestInputs.entrySet()) {
if (entry.getKey().toLowerCase().contains("location")) {
if ("".equals(srcLocation)) {
@@ -261,14 +412,14 @@ public class ServicePluginFactory {
}
private List<Object> queryTerminalPointsFromServiceProviderSystem(String srcLocation, String dstLocation) {
- Map<String, String> locationSrc = new HashMap<>();
+ Map<String, String> locationSrc = new HashMap<String, String>();
locationSrc.put("location", srcLocation);
- Map<String, String> locationDst = new HashMap<>();
+ Map<String, String> locationDst = new HashMap<String, String>();
locationDst.put("location", dstLocation);
- List<Map<String, String>> locations = new ArrayList<>();
+ List<Map<String, String>> locations = new ArrayList<Map<String, String>>();
locations.add(locationSrc);
locations.add(locationDst);
- List<Object> returnList = new ArrayList<>();
+ List<Object> returnList = new ArrayList<Object>();
String reqContent = getJsonString(locations);
String url = getThirdSPEndPoint();
String responseContent = sendRequest(url, "POST", reqContent);
@@ -278,12 +429,12 @@ public class ServicePluginFactory {
return returnList;
}
+ @SuppressWarnings("unchecked")
private Map<String, Object> getVPNResourceRequestInputs(List<Object> resources) {
for (Object resource : resources) {
Map<String, Object> resourceObject = (Map<String, Object>) resource;
Map<String, Object> resourceParametersObject = (Map<String, Object>) resourceObject.get("parameters");
- Map<String, Object> resourceRequestInputs = (Map<String, Object>) resourceParametersObject
- .get("requestInputs");
+ Map<String, Object> resourceRequestInputs = (Map<String, Object>) resourceParametersObject.get("requestInputs");
for (Entry<String, Object> entry : resourceRequestInputs.entrySet()) {
if (entry.getKey().toLowerCase().contains("vpntype")) {
return resourceRequestInputs;
@@ -310,7 +461,7 @@ public class ServicePluginFactory {
Map<String, Object> serviceObject = (Map<String, Object>) uuiObject.get("service");
Map<String, Object> serviceParametersObject = (Map<String, Object>) serviceObject.get("parameters");
Map<String, Object> serviceRequestInputs = (Map<String, Object>) serviceParametersObject.get("requestInputs");
- Map<String, Object> oofQueryObject = new HashMap<>();
+ Map<String, Object> oofQueryObject = new HashMap<String, Object>();
List<Object> resources = (List<Object>) serviceParametersObject.get("resources");
oofQueryObject.put("src-access-provider-id", serviceRequestInputs.get("inner-src-access-provider-id"));
oofQueryObject.put("src-access-client-id", serviceRequestInputs.get("inner-src-access-client-id"));
@@ -326,7 +477,7 @@ public class ServicePluginFactory {
String url = getOOFCalcEndPoint();
String responseContent = sendRequest(url, "POST", oofRequestReq);
- List<Object> returnList = new ArrayList<>();
+ List<Object> returnList = new ArrayList<Object>();
if (null != responseContent) {
returnList = getJsonObject(responseContent, List.class);
}
@@ -339,7 +490,7 @@ public class ServicePluginFactory {
}
private Map<String, Object> getReturnRoute(List<Object> returnList){
- Map<String, Object> returnRoute = new HashMap<>();
+ Map<String, Object> returnRoute = new HashMap<String,Object>();
for(Object returnVpn :returnList){
Map<String, Object> returnVpnInfo = (Map<String, Object>) returnVpn;
String accessTopoId = (String)returnVpnInfo.get("access-topology-id");
@@ -402,7 +553,6 @@ public class ServicePluginFactory {
jsonStr = mapper.writeValueAsString(srcObj);
} catch (JsonProcessingException e) {
LOGGER.debug("SdcToscaParserException", e);
- e.printStackTrace();
}
return jsonStr;
}
@@ -455,9 +605,9 @@ public class ServicePluginFactory {
try {
responseContent = EntityUtils.toString(httpResponse.getEntity(), "UTF-8");
} catch (ParseException e) {
- e.printStackTrace();
+ LOGGER.debug("ParseException in sendrequest", e);
} catch (IOException e) {
- e.printStackTrace();
+ LOGGER.debug("IOException in sendrequest", e);
}
}
if (null != method) {
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java
index 08ac9b6948..9ae7ad9bdc 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java
@@ -34,6 +34,7 @@ import java.lang.reflect.Field;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.ScheduledThreadPoolExecutor;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
@@ -82,16 +83,16 @@ public class PnfEventReadyDmaapClientTest {
private static final String CONSUMER_GROUP = "consumerGroupTest";
@Mock
private Environment env;
- @InjectMocks
- private PnfEventReadyDmaapClient testedObject = new PnfEventReadyDmaapClient();
-;
+ private PnfEventReadyDmaapClient testedObject;
+
private DmaapTopicListenerThread testedObjectInnerClassThread;
private HttpClient httpClientMock;
private Runnable threadMockToNotifyCamundaFlow;
- private ScheduledExecutorService executorMock;
+ private ScheduledThreadPoolExecutor executorMock;
@Before
public void init() throws NoSuchFieldException, IllegalAccessException {
+ testedObject = new PnfEventReadyDmaapClient(env);
when(env.getProperty(eq("pnf.dmaap.port"), eq(Integer.class))).thenReturn(PORT);
when(env.getProperty(eq("pnf.dmaap.host"))).thenReturn(HOST);
testedObject.setDmaapProtocol(PROTOCOL);
@@ -104,7 +105,7 @@ public class PnfEventReadyDmaapClientTest {
testedObjectInnerClassThread = testedObject.new DmaapTopicListenerThread();
httpClientMock = mock(HttpClient.class);
threadMockToNotifyCamundaFlow = mock(Runnable.class);
- executorMock = mock(ScheduledExecutorService.class);
+ executorMock = mock(ScheduledThreadPoolExecutor.class);
setPrivateField();
}
@@ -127,7 +128,7 @@ public class PnfEventReadyDmaapClientTest {
.hasPath(
"/" + URI_PATH_PREFIX + "/" + EVENT_TOPIC_TEST + "/" + CONSUMER_GROUP + "/" + CONSUMER_ID + "");
verify(threadMockToNotifyCamundaFlow).run();
- verify(executorMock).shutdownNow();
+ verify(executorMock).shutdown();
}
/**