summaryrefslogtreecommitdiffstats
path: root/bpmn/MSOCommonBPMN/src/main/groovy
diff options
context:
space:
mode:
authorRob Daugherty <rd472p@att.com>2018-03-14 02:07:32 -0400
committerRob Daugherty <rd472p@att.com>2018-03-14 04:08:41 -0400
commit38f720752af4d4aad8c4e467a288d9048659f688 (patch)
treee81066a8b5c77272e30fb57a64999573c4db4d86 /bpmn/MSOCommonBPMN/src/main/groovy
parentaee3d223f92a6f250f43e17558a2dfd576ff7294 (diff)
AT&T 1712 and 1802 release code
This is code from AT&T's 1712 and 1802 releases. Change-Id: Ie1e85851e94bc66c4d9514a0226c221939531a04 Issue-ID: SO-425 Signed-off-by: Rob Daugherty <rd472p@att.com>
Diffstat (limited to 'bpmn/MSOCommonBPMN/src/main/groovy')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AaiUtil.groovy78
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy44
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AllottedResourceUtils.groovy20
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AppCClient.groovy135
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CatalogDbUtils.groovy264
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CompleteMsoProcess.groovy622
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ConfirmVolumeGroupName.groovy18
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy8
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CreateAAIVfModule.groovy26
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy14
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CustomE2EGetService.groovy10
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CustomE2EPutService.groovy6
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/DecomposeService.groovy27
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/DeleteAAIVfModule.groovy24
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ExceptionUtil.groovy34
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/FalloutHandler.groovy18
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenerateVfModuleName.groovy8
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericDeleteService.groovy9
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericDeleteVnf.groovy8
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericGetService.groovy11
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericGetVnf.groovy8
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericNotificationService.groovy4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericPutService.groovy18
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericPutVnf.groovy6
-rwxr-xr-xbpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/Homing.groovy39
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ManualHandling.groovy100
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/NetworkUtils.groovy79
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy18
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/RainyDayHandler.groovy85
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ReceiveWorkflowMessage.groovy18
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapter.groovy20
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterRestV1.groovy14
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterRestV2.groovy254
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterUtils.groovy123
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SNIROUtils.groovy98
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ServiceTaskProcessor.groovy5
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/TrinityExceptionUtil.groovy12
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/UpdateAAIGenericVnf.groovy14
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/UpdateAAIVfModule.groovy14
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VfModuleBase.groovy572
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VnfAdapterRestV1.groovy20
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VnfAdapterUtils.groovy4
42 files changed, 1871 insertions, 1038 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AaiUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AaiUtil.groovy
index f5f011fd0c..5a4b25dca9 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AaiUtil.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AaiUtil.groovy
@@ -20,7 +20,7 @@
package org.openecomp.mso.bpmn.common.scripts
import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.runtime.Execution
+import org.camunda.bpm.engine.delegate.DelegateExecution
import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor;
import org.openecomp.mso.rest.APIResponse;
import org.openecomp.mso.rest.RESTClient
@@ -40,7 +40,7 @@ class AaiUtil {
this.taskProcessor = taskProcessor
}
- public String getNetworkGenericVnfEndpoint(Execution execution) {
+ public String getNetworkGenericVnfEndpoint(DelegateExecution execution) {
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
String endpoint = execution.getVariable("URN_aai_endpoint")
def uri = getNetworkGenericVnfUri(execution)
@@ -48,56 +48,56 @@ class AaiUtil {
return endpoint + uri
}
- public String getNetworkGenericVnfUri(Execution execution) {
+ public String getNetworkGenericVnfUri(DelegateExecution execution) {
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
def uri = getUri(execution, 'generic_vnf')
taskProcessor.logDebug('AaiUtil.getNetworkGenericVnfUri() - AAI URI: ' + uri, isDebugLogEnabled)
return uri
}
- public String getNetworkVpnBindingUri(Execution execution) {
+ public String getNetworkVpnBindingUri(DelegateExecution execution) {
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
def uri = getUri(execution, 'vpn_binding')
taskProcessor.logDebug('AaiUtil.getNetworkVpnBindingUri() - AAI URI: ' + uri, isDebugLogEnabled)
return uri
}
- public String getNetworkPolicyUri(Execution execution) {
+ public String getNetworkPolicyUri(DelegateExecution execution) {
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
def uri = getUri(execution, 'network_policy')
taskProcessor.logDebug('AaiUtil.getNetworkPolicyUri() - AAI URI: ' + uri, isDebugLogEnabled)
return uri
}
- public String getNetworkTableReferencesUri(Execution execution) {
+ public String getNetworkTableReferencesUri(DelegateExecution execution) {
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
def uri = getUri(execution, 'route_table_reference')
taskProcessor.logDebug('AaiUtil.getNetworkTableReferencesUri() - AAI URI: ' + uri, isDebugLogEnabled)
return uri
}
- public String getNetworkVceUri(Execution execution) {
+ public String getNetworkVceUri(DelegateExecution execution) {
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
def uri = getUri(execution, 'vce')
taskProcessor.logDebug('AaiUtil.getNetworkVceUri() - AAI URI: ' + uri, isDebugLogEnabled)
return uri
}
- public String getNetworkL3NetworkUri(Execution execution) {
+ public String getNetworkL3NetworkUri(DelegateExecution execution) {
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
def uri = getUri(execution, 'l3_network')
taskProcessor.logDebug('AaiUtil.getNetworkL3NetworkUri() - AAI URI: ' + uri, isDebugLogEnabled)
return uri
}
- public String getBusinessCustomerUri(Execution execution) {
+ public String getBusinessCustomerUri(DelegateExecution execution) {
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
def uri = getUri(execution, 'customer')
taskProcessor.logDebug('AaiUtil.getBusinessCustomerUri() - AAI URI: ' + uri, isDebugLogEnabled)
return uri
}
- //public String getBusinessCustomerUriv7(Execution execution) {
+ //public String getBusinessCustomerUriv7(DelegateExecution execution) {
// def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
// //def uri = getUri(execution, BUSINESS_CUSTOMERV7)
// def uri = getUri(execution, 'Customer')
@@ -105,7 +105,7 @@ class AaiUtil {
// return uri
//}
- public String getCloudInfrastructureCloudRegionEndpoint(Execution execution) {
+ public String getCloudInfrastructureCloudRegionEndpoint(DelegateExecution execution) {
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
String endpoint = execution.getVariable("URN_aai_endpoint")
def uri = getCloudInfrastructureCloudRegionUri(execution)
@@ -113,28 +113,28 @@ class AaiUtil {
return endpoint + uri
}
- public String getCloudInfrastructureCloudRegionUri(Execution execution) {
+ public String getCloudInfrastructureCloudRegionUri(DelegateExecution execution) {
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
def uri = getUri(execution, 'cloud_region')
taskProcessor.logDebug('AaiUtil.getCloudInfrastructureCloudRegionUri() - AAI URI: ' + uri, isDebugLogEnabled)
return uri
}
- public String getCloudInfrastructureTenantUri(Execution execution) {
+ public String getCloudInfrastructureTenantUri(DelegateExecution execution) {
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
def uri = getUri(execution, 'tenant')
taskProcessor.logDebug('AaiUtil.getCloudInfrastructureTenantUri() - AAI URI: ' + uri, isDebugLogEnabled)
return uri
}
- public String getSearchNodesQueryUri(Execution execution) {
+ public String getSearchNodesQueryUri(DelegateExecution execution) {
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
def uri = getUri(execution, 'nodes_query')
taskProcessor.logDebug('AaiUtil.getSearchNodesQueryUri() - AAI URI: ' + uri, isDebugLogEnabled)
return uri
}
- public String getSearchNodesQueryEndpoint(Execution execution) {
+ public String getSearchNodesQueryEndpoint(DelegateExecution execution) {
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
String endpoint = execution.getVariable("URN_aai_endpoint")
def uri = getSearchNodesQueryUri(execution)
@@ -142,14 +142,14 @@ class AaiUtil {
return endpoint + uri
}
- public String getSearchGenericQueryUri(Execution execution) {
+ public String getSearchGenericQueryUri(DelegateExecution execution) {
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
def uri = getUri(execution, 'generic_query')
taskProcessor.logDebug('AaiUtil.getSearchGenericQueryUri() - AAI URI: ' + uri, isDebugLogEnabled)
return uri
}
- public String getVersion(Execution execution, resourceName, processKey) {
+ public String getVersion(DelegateExecution execution, resourceName, processKey) {
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
resourceName = resourceName.replaceAll('-', '_')
@@ -178,7 +178,7 @@ class AaiUtil {
(new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, "Internal Error: One of the following should be defined in MSO URN properties file: ${versionWithResourceKey}, ${versionWithProcessKey}, ${DEFAULT_VERSION_KEY}")
}
- public String getUri(Execution execution, resourceName) {
+ public String getUri(DelegateExecution execution, resourceName) {
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
def processKey = taskProcessor.getMainProcessKey(execution)
@@ -208,7 +208,7 @@ class AaiUtil {
(new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, 'Internal Error: AAI URI entry for ' + key + ' not defined in the MSO URN properties file')
}
- public String setNamespace(Execution execution) {
+ public String setNamespace(DelegateExecution execution) {
def key = AAI_NAMESPACE_STRING_KEY
aaiNamespace = execution.getVariable(key)
if (aaiNamespace == null ) {
@@ -219,7 +219,7 @@ class AaiUtil {
/**
* This method can be used for getting the building namespace out of uri.
* NOTE: A getUri() method needs to be invoked first.
- * Alternative method is the getNamespaceFromUri(Execution execution, String uri)
+ * Alternative method is the getNamespaceFromUri(DelegateExecution execution, String uri)
* return namespace (plus version from uri)
*
* @param url
@@ -242,13 +242,13 @@ class AaiUtil {
/**
* This method can be used for building namespace with aai version out of uri.
- * NOTE: 2 arguments: Execution execution & String uri
+ * NOTE: 2 arguments: DelegateExecution execution & String uri
* @param execution
* @param url
*
* @return namespace
*/
- public String getNamespaceFromUri(Execution execution, String uri) {
+ public String getNamespaceFromUri(DelegateExecution execution, String uri) {
String namespace = execution.getVariable(AAI_NAMESPACE_STRING_KEY)
if (namespace == null ) {
(new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, 'Internal Error: AAI URI entry for ' + AAI_NAMESPACE_STRING_KEY + ' not defined in the MSO URN properties file')
@@ -293,7 +293,7 @@ class AaiUtil {
* @return APIResponse
*
*/
- public APIResponse executeAAIGetCall(Execution execution, String url){
+ public APIResponse executeAAIGetCall(DelegateExecution execution, String url){
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
taskProcessor.logDebug(" ======== STARTED Execute AAI Get Process ======== ", isDebugEnabled)
APIResponse apiResponse = null
@@ -315,7 +315,7 @@ class AaiUtil {
taskProcessor.logDebug( "======== COMPLETED Execute AAI Get Process ======== ", isDebugEnabled)
}catch(Exception e){
taskProcessor.logDebug("Exception occured while executing AAI Get Call. Exception is: \n" + e, isDebugEnabled)
- throw new BpmnError("MSOWorkflowException")
+ (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage())
}
return apiResponse
}
@@ -333,7 +333,7 @@ class AaiUtil {
* @return APIResponse
*
*/
- public APIResponse executeAAIPutCall(Execution execution, String url, String payload){
+ public APIResponse executeAAIPutCall(DelegateExecution execution, String url, String payload){
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
taskProcessor.logDebug( " ======== Started Execute AAI Put Process ======== ", isDebugEnabled)
APIResponse apiResponse = null
@@ -354,7 +354,7 @@ class AaiUtil {
taskProcessor.logDebug( "======== Completed Execute AAI Put Process ======== ", isDebugEnabled)
}catch(Exception e){
taskProcessor.utils.log("ERROR", "Exception occured while executing AAI Put Call. Exception is: \n" + e, isDebugEnabled)
- throw new BpmnError("MSOWorkflowException")
+ (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage())
}
return apiResponse
}
@@ -371,7 +371,7 @@ class AaiUtil {
* @return APIResponse
*
*/
- public APIResponse executeAAIPatchCall(Execution execution, String url, String payload){
+ public APIResponse executeAAIPatchCall(DelegateExecution execution, String url, String payload){
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
taskProcessor.logDebug( " ======== Started Execute AAI Patch Process ======== ", isDebugEnabled)
APIResponse apiResponse = null
@@ -393,7 +393,7 @@ class AaiUtil {
taskProcessor.logDebug( "======== Completed Execute AAI Patch Process ======== ", isDebugEnabled)
}catch(Exception e){
taskProcessor.utils.log("ERROR", "Exception occured while executing AAI Patch Call. Exception is: \n" + e, isDebugEnabled)
- throw new BpmnError("MSOWorkflowException")
+ (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage())
}
return apiResponse
}
@@ -410,7 +410,7 @@ class AaiUtil {
* @return APIResponse
*
*/
- public APIResponse executeAAIDeleteCall(Execution execution, String url){
+ public APIResponse executeAAIDeleteCall(DelegateExecution execution, String url){
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
taskProcessor.logDebug( " ======== Started Execute AAI Delete Process ======== ", isDebugEnabled)
APIResponse apiResponse = null
@@ -431,7 +431,7 @@ class AaiUtil {
taskProcessor.logDebug( "======== Completed Execute AAI Delete Process ======== ", isDebugEnabled)
}catch(Exception e){
taskProcessor.utils.log("ERROR", "Exception occured while executing AAI Delete Call. Exception is: \n" + e, isDebugEnabled)
- throw new BpmnError("MSOWorkflowException")
+ (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage())
}
return apiResponse
}
@@ -448,7 +448,7 @@ class AaiUtil {
* @return APIResponse
*
*/
- public APIResponse executeAAIDeleteCall(Execution execution, String url, String payload, String authHeader){
+ public APIResponse executeAAIDeleteCall(DelegateExecution execution, String url, String payload, String authHeader){
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
taskProcessor.logDebug( " ======== Started Execute AAI Delete Process ======== ", isDebugEnabled)
APIResponse apiResponse = null
@@ -469,7 +469,7 @@ class AaiUtil {
taskProcessor.logDebug( "======== Completed Execute AAI Delete Process ======== ", isDebugEnabled)
}catch(Exception e){
taskProcessor.utils.log("ERROR", "Exception occured while executing AAI Delete Call. Exception is: \n" + e, isDebugEnabled)
- throw new BpmnError("MSOWorkflowException")
+ (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage())
}
return apiResponse
}
@@ -486,7 +486,7 @@ class AaiUtil {
* @return APIResponse
*
*/
- public APIResponse executeAAIPostCall(Execution execution, String url, String payload){
+ public APIResponse executeAAIPostCall(DelegateExecution execution, String url, String payload){
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
taskProcessor.logDebug( " ======== Started Execute AAI Post Process ======== ", isDebugEnabled)
APIResponse apiResponse = null
@@ -507,7 +507,7 @@ class AaiUtil {
taskProcessor.logDebug( "======== Completed Execute AAI Post Process ======== ", isDebugEnabled)
}catch(Exception e){
taskProcessor.utils.log("ERROR", "Exception occured while executing AAI Post Call. Exception is: \n" + e, isDebugEnabled)
- throw new BpmnError("MSOWorkflowException")
+ (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage())
}
return apiResponse
}
@@ -527,7 +527,7 @@ class AaiUtil {
* @return APIResponse
*
*/
- public APIResponse executeAAIPostCall(Execution execution, String url, String payload, String authenticationHeaderValue, String headerName, String headerValue){
+ public APIResponse executeAAIPostCall(DelegateExecution execution, String url, String payload, String authenticationHeaderValue, String headerName, String headerValue){
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
taskProcessor.logDebug( " ======== Started Execute AAI Post Process ======== ", isDebugEnabled)
APIResponse apiResponse = null
@@ -546,7 +546,7 @@ class AaiUtil {
taskProcessor.logDebug( "======== Completed Execute AAI Post Process ======== ", isDebugEnabled)
}catch(Exception e){
taskProcessor.utils.log("ERROR", "Exception occured while executing AAI Post Call. Exception is: \n" + e, isDebugEnabled)
- throw new BpmnError("MSOWorkflowException")
+ (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage())
}
return apiResponse
}
@@ -559,7 +559,7 @@ class AaiUtil {
* @param backend - "PO" - real region, or "SDNC" - v2.5 (fake region).
*/
- public String getAAICloudReqion(Execution execution, String url, String backend, inputCloudRegion){
+ public String getAAICloudReqion(DelegateExecution execution, String url, String backend, inputCloudRegion){
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
String regionId = ""
try{
@@ -600,7 +600,7 @@ class AaiUtil {
}
}catch(Exception e) {
taskProcessor.utils.log("ERROR", "Exception occured while getting the Cloud Reqion. Exception is: \n" + e, isDebugEnabled)
- throw new BpmnError("MSOWorkflowException")
+ (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, e.getMessage())
}
return regionId
}
@@ -631,7 +631,7 @@ class AaiUtil {
* @return moduleIndex
*
*/
- public int getLowestUnusedVfModuleIndexFromAAIVnfResponse(Execution execution, String aaiVnfResponse, String key, String value) {
+ public int getLowestUnusedVfModuleIndexFromAAIVnfResponse(DelegateExecution execution, String aaiVnfResponse, String key, String value) {
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
if (aaiVnfResponse != null) {
String vfModulesText = taskProcessor.utils.getNodeXml(aaiVnfResponse, "vf-modules")
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy
index 32925f0619..d3f3696fcf 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy
@@ -23,7 +23,7 @@ package org.openecomp.mso.bpmn.common.scripts;
import groovy.json.JsonSlurper
import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.runtime.Execution
+import org.camunda.bpm.engine.delegate.DelegateExecution
import org.camunda.bpm.engine.variable.VariableMap
import org.camunda.bpm.engine.variable.Variables
import org.camunda.bpm.engine.variable.Variables.SerializationDataFormats
@@ -126,7 +126,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
* Logs a WorkflowException at the ERROR level with the specified message.
* @param execution the execution
*/
- public void logWorkflowException(Execution execution, String message) {
+ public void logWorkflowException(DelegateExecution execution, String message) {
def workflowException = execution.getVariable("WorkflowException")
if (workflowException == null) {
@@ -143,7 +143,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
* @param execution the execution
* @return the name of the destination variable
*/
- public saveWorkflowException(Execution execution, String variable) {
+ public saveWorkflowException(DelegateExecution execution, String variable) {
if (variable == null) {
throw new NullPointerException();
}
@@ -164,7 +164,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
* @param execution the execution
* @return the validated request
*/
- public String validateRequest(Execution execution, String... requiredVariables) {
+ public String validateRequest(DelegateExecution execution, String... requiredVariables) {
ExceptionUtil exceptionUtil = new ExceptionUtil()
def method = getClass().getSimpleName() + '.validateRequest(' +
'execution=' + execution.getId() +
@@ -252,7 +252,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
* @param execution the execution
* @return the inputVars
*/
- public Map validateJSONReq(Execution execution) {
+ public Map validateJSONReq(DelegateExecution execution) {
def method = getClass().getSimpleName() + '.validateJSONReq(' +
'execution=' + execution.getId() +
')'
@@ -303,7 +303,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
* top-level process
* @throws IllegalStateException if a response has already been sent
*/
- protected void sendWorkflowResponse(Execution execution, Object responseCode, String response) {
+ protected void sendWorkflowResponse(DelegateExecution execution, Object responseCode, String response) {
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
try {
String processKey = getProcessKey(execution);
@@ -376,7 +376,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
* Returns true if a workflow response has already been sent.
* @param execution the execution
*/
- protected boolean isWorkflowResponseSent(Execution execution) {
+ protected boolean isWorkflowResponseSent(DelegateExecution execution) {
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
String processKey = getProcessKey(execution);
return String.valueOf(execution.getVariable(processKey + "WorkflowResponseSent")).equals("true");
@@ -388,7 +388,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
*
* @param execution the execution
*/
- public String getProcessKey(Execution execution) {
+ public String getProcessKey(DelegateExecution execution) {
def testKey = execution.getVariable("testProcessKey")
if(testKey!=null){
return testKey
@@ -402,11 +402,11 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
* top-level process.
* @param execution the execution
*/
- public String getMainProcessKey(Execution execution) {
- Execution exec = execution
+ public String getMainProcessKey(DelegateExecution execution) {
+ DelegateExecution exec = execution
while (true) {
- Execution parent = exec.getSuperExecution()
+ DelegateExecution parent = exec.getSuperExecution()
if (parent == null) {
parent = exec.getParent()
@@ -433,7 +433,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
* @param elementName Name of element to search for.
* @return The element node, if found in the xml.
*/
- protected String getRequiredNodeXml(Execution execution, String xml, String elementName) {
+ protected String getRequiredNodeXml(DelegateExecution execution, String xml, String elementName) {
ExceptionUtil exceptionUtil = new ExceptionUtil()
def element = utils.getNodeXml(xml, elementName, false)
if (element.trim().isEmpty()) {
@@ -455,7 +455,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
* @param elementName Name of element to whose value to get.
* @return The non-empty value of the element, if found in the xml.
*/
- protected String getRequiredNodeText(Execution execution, String xml, String elementName) {
+ protected String getRequiredNodeText(DelegateExecution execution, String xml, String elementName) {
ExceptionUtil exceptionUtil = new ExceptionUtil()
def elementText = utils.getNodeText1(xml, elementName)
if ((elementText == null) || (elementText.isEmpty())) {
@@ -501,7 +501,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
*@param name
*@param value
*/
- public void setVariable(Execution execution, String name, Object value) {
+ public void setVariable(DelegateExecution execution, String name, Object value) {
VariableMap variables = Variables.createVariables()
variables.putValueTyped('payload', Variables.objectValue(value)
.serializationDataFormat(SerializationDataFormats.JAVA) // tells the engine to use java serialization for persisting the value
@@ -517,7 +517,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
*@param name
*@return
**/
- public String getVariable(Execution execution, String name) {
+ public String getVariable(DelegateExecution execution, String name) {
def myObj = execution.getVariable(name)
if(myObj instanceof VariableMap){
VariableMap serializedObjectMap = (VariableMap) myObj
@@ -571,7 +571,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
* Sets flows success indicator variable.
*
*/
- public void setSuccessIndicator(Execution execution, boolean isSuccess) {
+ public void setSuccessIndicator(DelegateExecution execution, boolean isSuccess) {
String prefix = execution.getVariable('prefix')
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
@@ -584,7 +584,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
* Sends a Error Sync Response
*
*/
- public void sendSyncError(Execution execution) {
+ public void sendSyncError(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
String requestId = execution.getVariable("mso-request-id")
logDebug('sendSyncError, requestId: ' + requestId, isDebugEnabled)
@@ -605,7 +605,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
if (args != null && args.size() > 0) {
// First argument of method to call is always the execution object
- Execution execution = (Execution) args[0]
+ DelegateExecution execution = (DelegateExecution) args[0]
def classAndMethod = getClass().getSimpleName() + '.' + methodName + '(execution=' + execution.getId() + ')'
def isDebugEnabled = execution.getVariable('isDebugLogEnabled')
@@ -693,7 +693,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
* @param messageType the message type (e.g. SDNCAResponse or VNFAResponse)
* @param correlator the correlator value (e.g. a request ID)
*/
- public String createCallbackURL(Execution execution, String messageType, String correlator) {
+ public String createCallbackURL(DelegateExecution execution, String messageType, String correlator) {
String endpoint = (String) execution.getVariable('URN_mso_workflow_message_endpoint')
if (endpoint == null || endpoint.isEmpty()) {
@@ -719,7 +719,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
* @param messageType the message type (e.g. SNIROResponse)
* @param correlator the correlator value (e.g. a request ID)
*/
- public String createWorkflowMessageAdapterCallbackURL(Execution execution, String messageType, String correlator) {
+ public String createWorkflowMessageAdapterCallbackURL(DelegateExecution execution, String messageType, String correlator) {
String endpoint = (String) execution.getVariable('URN_mso_adapters_workflow_message_endpoint')
if (endpoint == null || endpoint.isEmpty()) {
@@ -737,7 +737,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
'/' + UriUtils.encodePathSegment(correlator, 'UTF-8')
}
- public void setRollbackEnabled(Execution execution, isDebugLogEnabled) {
+ public void setRollbackEnabled(DelegateExecution execution, isDebugLogEnabled) {
// Rollback settings
def prefix = execution.getVariable('prefix')
@@ -771,7 +771,7 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
logDebug('rollbackEnabled (aka backoutOnFailure): ' + rollbackEnabled, isDebugLogEnabled)
}
- public void setBasicDBAuthHeader(Execution execution, isDebugLogEnabled) {
+ public void setBasicDBAuthHeader(DelegateExecution execution, isDebugLogEnabled) {
try {
String basicAuthValueDB = execution.getVariable("URN_mso_adapters_db_auth")
utils.log("DEBUG", " Obtained BasicAuth userid password for Catalog DB adapter: " + basicAuthValueDB, isDebugLogEnabled)
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AllottedResourceUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AllottedResourceUtils.groovy
index 8e2403ceea..fc099caa5f 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AllottedResourceUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AllottedResourceUtils.groovy
@@ -2,14 +2,14 @@ package org.openecomp.mso.bpmn.common.scripts
import org.apache.commons.lang3.StringEscapeUtils;
import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.runtime.Execution;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.openecomp.mso.bpmn.core.WorkflowException
import org.openecomp.mso.rest.APIResponse;
import org.apache.commons.lang3.*
import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.runtime.Execution;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
import groovy.util.XmlParser
import groovy.util.Node
@@ -34,7 +34,7 @@ class AllottedResourceUtils {
* return: orchStatus - > AR found with this orchStatus
* setsVariable aaiARGetResponse
*/
- public String getAROrchStatus (Execution execution) {
+ public String getAROrchStatus (DelegateExecution execution) {
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
utils.log("DEBUG"," ***** getAROrchStatus *****", isDebugEnabled)
@@ -81,7 +81,7 @@ class AllottedResourceUtils {
// get Allotted Resource by AllottedResourceId
// used on Delete - called from doDeleteAR
// setsVariable aaiARGetResponse
- public String getARbyId (Execution execution, String allottedResourceId) {
+ public String getARbyId (DelegateExecution execution, String allottedResourceId) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
utils.log("DEBUG", " ***** getARbyId ***** ", isDebugEnabled)
String arLink = getARLinkbyId(execution, allottedResourceId)
@@ -94,7 +94,7 @@ class AllottedResourceUtils {
return ar;
}
- public String getPSIFmARLink(Execution execution, String arLink)
+ public String getPSIFmARLink(DelegateExecution execution, String arLink)
{
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
// Path: /aai/{version}/business/customers/customer/{cust}/service-subscriptions/service-subscription/{subs}/service-instances/service-instance/{psiid}/allotted-resources/allotted-resource/{arid}
@@ -108,7 +108,7 @@ class AllottedResourceUtils {
// get Allotted Resource Link by AllottedResourceId using Nodes Query
// used on Delete - called from getARbyId
- public String getARLinkbyId (Execution execution, String allottedResourceId) {
+ public String getARLinkbyId (DelegateExecution execution, String allottedResourceId) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
utils.log("DEBUG", " ***** getARLinkbyId ***** ", isDebugEnabled)
String arLink = null
@@ -154,7 +154,7 @@ class AllottedResourceUtils {
// used on Create called from getARORchStatus
// used on Delete called from getARbyId
// setsVariable aaiARPath - used for Patch in create
- public String getARbyLink (Execution execution, String link, String role) {
+ public String getARbyLink (DelegateExecution execution, String link, String role) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
utils.log("DEBUG", " ***** getARbyLink ***** ", isDebugEnabled)
String ar = null
@@ -237,7 +237,7 @@ class AllottedResourceUtils {
return ar
}
- public void updateAROrchStatus(Execution execution, String status, String aaiARPath){
+ public void updateAROrchStatus(DelegateExecution execution, String status, String aaiARPath){
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
utils.log("DEBUG", " *** updaAROrchStatus *** ", isDebugEnabled)
try{
@@ -275,7 +275,7 @@ class AllottedResourceUtils {
}
//Sets Variable "wasDeleted"
- public void deleteAR(Execution execution, String aaiARPath){
+ public void deleteAR(DelegateExecution execution, String aaiARPath){
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
utils.log("DEBUG", " *** deleteAR *** aaiARPath:" + aaiARPath, isDebugEnabled)
try {
@@ -315,7 +315,7 @@ class AllottedResourceUtils {
utils.log("DEBUG", " *** Exit deleteAR *** ", isDebugEnabled)
}
- public void buildAAIErrorResponse(Execution execution, String response, String errorMessage){
+ public void buildAAIErrorResponse(DelegateExecution execution, String response, String errorMessage){
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
utils.log("DEBUG", " *** BuildAAIErrorResponse*** ", isDebugEnabled)
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AppCClient.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AppCClient.groovy
new file mode 100644
index 0000000000..8df6af7adb
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AppCClient.groovy
@@ -0,0 +1,135 @@
+package org.openecomp.mso.bpmn.common.scripts
+
+import java.util.HashMap;
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.hibernate.event.internal.AbstractLockUpgradeEventListener
+import org.openecomp.mso.bpmn.core.HealthCheckHandler
+import org.openecomp.mso.bpmn.core.json.JsonUtils
+import org.openecomp.mso.client.appc.ApplicationControllerOrchestrator
+import org.openecomp.mso.client.appc.ApplicationControllerOrchestratorException
+import org.onap.appc.client.lcm.model.Action
+import org.onap.appc.client.lcm.model.Status
+import org.openecomp.mso.bpmn.appc.payload.PayloadClient
+import org.openecomp.mso.bpmn.common.adapter.vnf.CreateVnfNotification.Outputs
+import org.openecomp.mso.client.appc.ApplicationControllerAction;
+import groovy.transform.TypeChecked;
+import java.util.UUID;
+
+/**
+ * This groovy class supports the <class>AppCClient.bpmn</class> process.
+ *
+ * Inputs:
+ * @param - msoRequestId
+ * @param - mso-request-Id
+ * @param - isDebugLogEnabled
+ * @param - requestId
+ * @param - vnfId
+ * @param - action
+ * @param - payload
+ *
+ * Outputs:
+ * @param - errorcode
+ * @param - errorText
+ * @param - responsePayload
+ * @param - healthCheckIndex
+ * @param - workstep
+ * @param - rollbackVnfStop
+ * @param - rollbackVnfLock
+ * @param - rollbackQuiesceTraffic
+ */
+
+public class AppCClient extends AbstractServiceTaskProcessor{
+
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ JsonUtils jsonUtils = new JsonUtils()
+ def prefix = "UPDVnfI_"
+
+ public void preProcessRequest(DelegateExecution execution){
+
+ }
+
+ public void runAppcCommand(DelegateExecution execution) {
+ String isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ utils.log("DEBUG", "***** Start runCommand *****", isDebugLogEnabled)
+ def method = getClass().getSimpleName() + '.runAppcCommand(' +
+ 'execution=' + execution.getId() +
+ ')'
+ logDebug('Entered ' + method, isDebugLogEnabled)
+ execution.setVariable("rollbackVnfStop", false)
+ execution.setVariable("rollbackVnfLock", false)
+ execution.setVariable("rollbackQuiesceTraffic", false)
+ String appcCode = "1002"
+ String responsePayload = ""
+ String appcMessage = ""
+ Action action = null
+ try {
+ action = (Action) execution.getVariable("action")
+ String vnfId = execution.getVariable('vnfId')
+ String msoRequestId = execution.getVariable('msoRequestId')
+ String vnfName = execution.getVariable('vnfName')
+ String aicIdentity = execution.getVariable('aicIdentity')
+ String vnfHostIpAddress = execution.getVariable('vnfHostIpAddress')
+ String vmIdList = execution.getVariable("vmIdList")
+ String identityUrl = execution.getVariable("identityUrl")
+ HashMap<String, String> payloadInfo = new HashMap<String, String>();
+ payloadInfo.put("vnfName", vnfName)
+ payloadInfo.put("aicIdentity", aicIdentity)
+ payloadInfo.put("vnfHostIpAddress", vnfHostIpAddress)
+ payloadInfo.put("vmIdList", vmIdList)
+ payloadInfo.put("identityUrl", identityUrl)
+ Optional<String> payload
+ logDebug("Running APP-C action: " + action.toString(), isDebugLogEnabled)
+ utils.log("DEBUG", "VNFID: " + vnfId, isDebugLogEnabled)
+ execution.setVariable('msoRequestId', msoRequestId)
+ execution.setVariable("failedActivity", "APP-C")
+ execution.setVariable('workStep', action.toString())
+ if(execution.getVariable("payload") != null){
+ String pay = execution.getVariable("payload")
+ payload = Optional.of(pay)
+ }
+ if(action.equals(Action.HealthCheck)){
+ String healthCheckIndex = execution.getVariable('healthCheckIndex')
+ execution.setVariable('workStep', action.toString() + healthCheckIndex)
+ execution.setVariable('healthCheckIndex', healthCheckIndex + 1)
+ }
+ ApplicationControllerAction client = new ApplicationControllerAction()
+ utils.log("DEBUG", "Created Application Controller Action Object", isDebugLogEnabled)
+ //PayloadInfo contains extra information that adds on to payload before making request to appc
+ client.runAppCCommand(action, msoRequestId, vnfId, payload, payloadInfo)
+ utils.log("DEBUG", "ran through the main method for Application Contoller", isDebugLogEnabled)
+ appcCode = client.getErrorCode()
+ appcMessage = client.getErrorMessage()
+ }
+ catch (BpmnError e) {
+ logError('Caught exception in ' + method, e)
+ appcMessage = e.getMessage()
+ }
+ execution.setVariable("errorCode", appcCode)
+ if (appcCode == '0' && action != null) {
+ if (action.equals(Action.Lock)) {
+ execution.setVariable("rollbackVnfLock", true)
+ }
+ if (action.equals(Action.Unlock)) {
+ execution.setVariable("rollbackVnfLock", false)
+ }
+ if (action.equals(Action.Start)) {
+ execution.setVariable("rollbackVnfStop", true)
+ }
+ if (action.equals(Action.Stop)) {
+ execution.setVariable("rollbackVnfStop", false)
+ }
+ if (action.equals(Action.QuiesceTraffic)) {
+ execution.setVariable("rollbackQuiesceTraffic", true)
+ }
+ if (action.equals(Action.ResumeTraffic)) {
+ execution.setVariable("rollbackQuiesceTraffic", false)
+ }
+ }
+ execution.setVariable("errorText", appcMessage)
+ execution.setVariable("responsePayload", responsePayload)
+ utils.log("DEBUG", "Error Message: " + appcMessage, isDebugLogEnabled)
+ utils.log("DEBUG","ERROR CODE: " + execution.getVariable("errorCode"), isDebugLogEnabled)
+ utils.log("DEBUG", "***** End of runCommand *****", isDebugLogEnabled)
+ }
+} \ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CatalogDbUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CatalogDbUtils.groovy
index 921e0ee00d..7fcf310210 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CatalogDbUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CatalogDbUtils.groovy
@@ -33,7 +33,7 @@ import groovy.json.JsonSlurper
import groovy.util.slurpersupport.GPathResult
import groovy.xml.QName;
-import org.camunda.bpm.engine.runtime.Execution
+import org.camunda.bpm.engine.delegate.DelegateExecution
import org.openecomp.mso.logger.MsoLogger;
import org.openecomp.mso.rest.APIResponse;
@@ -47,14 +47,14 @@ import org.openecomp.mso.rest.RESTConfig
*/
class CatalogDbUtils {
-
+
MsoUtils utils = new MsoUtils()
JsonUtils jsonUtils = new JsonUtils()
MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
static private String defaultDbAdapterVersion = "v2"
- public JSONArray getAllNetworksByServiceModelUuid(Execution execution, String serviceModelUuid) {
- JSONArray networksList = null
+ public JSONArray getAllNetworksByServiceModelUuid(DelegateExecution execution, String serviceModelUuid) {
+ JSONArray networksList = null
String endPoint = "/serviceNetworks?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8")
try {
String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
@@ -71,8 +71,8 @@ class CatalogDbUtils {
return networksList
}
- public JSONArray getAllNetworksByServiceModelUuid(Execution execution, String serviceModelUuid, String catalogUtilsVersion) {
- JSONArray networksList = null
+ public JSONArray getAllNetworksByServiceModelUuid(DelegateExecution execution, String serviceModelUuid, String catalogUtilsVersion) {
+ JSONArray networksList = null
String endPoint = "/serviceNetworks?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8")
try {
String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
@@ -95,8 +95,8 @@ class CatalogDbUtils {
return networksList
}
- public JSONArray getAllNetworksByServiceModelInvariantUuid(Execution execution, String serviceModelInvariantUuid) {
- JSONArray networksList = null
+ public JSONArray getAllNetworksByServiceModelInvariantUuid(DelegateExecution execution, String serviceModelInvariantUuid) {
+ JSONArray networksList = null
String endPoint = "/serviceNetworks?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8")
try {
String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
@@ -113,8 +113,8 @@ class CatalogDbUtils {
return networksList
}
- public JSONArray getAllNetworksByServiceModelInvariantUuid(Execution execution, String serviceModelInvariantUuid, String catalogUtilsVersion) {
- JSONArray networksList = null
+ public JSONArray getAllNetworksByServiceModelInvariantUuid(DelegateExecution execution, String serviceModelInvariantUuid, String catalogUtilsVersion) {
+ JSONArray networksList = null
String endPoint = "/serviceNetworks?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8")
try {
String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
@@ -137,8 +137,8 @@ class CatalogDbUtils {
return networksList
}
- public JSONArray getAllNetworksByServiceModelInvariantUuidAndServiceModelVersion(Execution execution, String serviceModelInvariantUuid, String serviceModelVersion) {
- JSONArray networksList = null
+ public JSONArray getAllNetworksByServiceModelInvariantUuidAndServiceModelVersion(DelegateExecution execution, String serviceModelInvariantUuid, String serviceModelVersion) {
+ JSONArray networksList = null
String endPoint = "/serviceNetworks?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8")
try {
String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
@@ -155,8 +155,8 @@ class CatalogDbUtils {
return networksList
}
- public JSONArray getAllNetworksByServiceModelInvariantUuidAndServiceModelVersion(Execution execution, String serviceModelInvariantUuid, String serviceModelVersion, String catalogUtilsVersion) {
- JSONArray networksList = null
+ public JSONArray getAllNetworksByServiceModelInvariantUuidAndServiceModelVersion(DelegateExecution execution, String serviceModelInvariantUuid, String serviceModelVersion, String catalogUtilsVersion) {
+ JSONArray networksList = null
String endPoint = "/serviceNetworks?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8")
try {
String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
@@ -179,8 +179,8 @@ class CatalogDbUtils {
return networksList
}
- public JSONArray getAllNetworksByNetworkModelCustomizationUuid(Execution execution, String networkModelCustomizationUuid) {
- JSONArray networksList = null
+ public JSONArray getAllNetworksByNetworkModelCustomizationUuid(DelegateExecution execution, String networkModelCustomizationUuid) {
+ JSONArray networksList = null
String endPoint = "/serviceNetworks?networkModelCustomizationUuid=" + UriUtils.encode(networkModelCustomizationUuid, "UTF-8")
try {
String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
@@ -197,8 +197,8 @@ class CatalogDbUtils {
return networksList
}
- public JSONArray getAllNetworksByNetworkModelCustomizationUuid(Execution execution, String networkModelCustomizationUuid, String catalogUtilsVersion) {
- JSONArray networksList = null
+ public JSONArray getAllNetworksByNetworkModelCustomizationUuid(DelegateExecution execution, String networkModelCustomizationUuid, String catalogUtilsVersion) {
+ JSONArray networksList = null
String endPoint = "/serviceNetworks?networkModelCustomizationUuid=" + UriUtils.encode(networkModelCustomizationUuid, "UTF-8")
try {
String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
@@ -221,8 +221,8 @@ class CatalogDbUtils {
return networksList
}
- public JSONArray getAllNetworksByNetworkType(Execution execution, String networkType) {
- JSONArray networksList = null
+ public JSONArray getAllNetworksByNetworkType(DelegateExecution execution, String networkType) {
+ JSONArray networksList = null
String endPoint = "/serviceNetworks?networkType=" + UriUtils.encode(networkType, "UTF-8")
try {
String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
@@ -239,8 +239,8 @@ class CatalogDbUtils {
return networksList
}
- public JSONArray getAllNetworksByNetworkType(Execution execution, String networkType, String catalogUtilsVersion) {
- JSONArray networksList = null
+ public JSONArray getAllNetworksByNetworkType(DelegateExecution execution, String networkType, String catalogUtilsVersion) {
+ JSONArray networksList = null
String endPoint = "/serviceNetworks?networkType=" + UriUtils.encode(networkType, "UTF-8")
try {
String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
@@ -264,8 +264,8 @@ class CatalogDbUtils {
}
- public JSONArray getAllVnfsByServiceModelUuid(Execution execution, String serviceModelUuid) {
- JSONArray vnfsList = null
+ public JSONArray getAllVnfsByServiceModelUuid(DelegateExecution execution, String serviceModelUuid) {
+ JSONArray vnfsList = null
String endPoint = "/serviceVnfs?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8")
try {
msoLogger.debug("ENDPOINT: " + endPoint)
@@ -283,8 +283,8 @@ class CatalogDbUtils {
return vnfsList
}
- public JSONArray getAllVnfsByServiceModelUuid(Execution execution, String serviceModelUuid, String catalogUtilsVersion) {
- JSONArray vnfsList = null
+ public JSONArray getAllVnfsByServiceModelUuid(DelegateExecution execution, String serviceModelUuid, String catalogUtilsVersion) {
+ JSONArray vnfsList = null
String endPoint = "/serviceVnfs?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8")
try {
msoLogger.debug("ENDPOINT: " + endPoint)
@@ -308,8 +308,8 @@ class CatalogDbUtils {
return vnfsList
}
- public JSONArray getAllVnfsByServiceModelInvariantUuid(Execution execution, String serviceModelInvariantUuid) {
- JSONArray vnfsList = null
+ public JSONArray getAllVnfsByServiceModelInvariantUuid(DelegateExecution execution, String serviceModelInvariantUuid) {
+ JSONArray vnfsList = null
String endPoint ="/serviceVnfs?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8")
try {
msoLogger.debug("ENDPOINT: " + endPoint)
@@ -327,8 +327,8 @@ class CatalogDbUtils {
return vnfsList
}
- public JSONArray getAllVnfsByServiceModelInvariantUuid(Execution execution, String serviceModelInvariantUuid, String catalogUtilsVersion) {
- JSONArray vnfsList = null
+ public JSONArray getAllVnfsByServiceModelInvariantUuid(DelegateExecution execution, String serviceModelInvariantUuid, String catalogUtilsVersion) {
+ JSONArray vnfsList = null
String endPoint = "/serviceVnfs?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8")
try {
msoLogger.debug("ENDPOINT: " + endPoint)
@@ -352,8 +352,8 @@ class CatalogDbUtils {
return vnfsList
}
- public JSONArray getAllVnfsByServiceModelInvariantUuidAndServiceModelVersion(Execution execution, String serviceModelInvariantUuid, String serviceModelVersion) {
- JSONArray vnfsList = null
+ public JSONArray getAllVnfsByServiceModelInvariantUuidAndServiceModelVersion(DelegateExecution execution, String serviceModelInvariantUuid, String serviceModelVersion) {
+ JSONArray vnfsList = null
String endPoint = "/serviceVnfs?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8")
try {
msoLogger.debug("ENDPOINT: " + endPoint)
@@ -371,8 +371,8 @@ class CatalogDbUtils {
return vnfsList
}
- public JSONArray getAllVnfsByServiceModelInvariantUuidAndServiceModelVersion(Execution execution, String serviceModelInvariantUuid, String serviceModelVersion, String catalogUtilsVersion) {
- JSONArray vnfsList = null
+ public JSONArray getAllVnfsByServiceModelInvariantUuidAndServiceModelVersion(DelegateExecution execution, String serviceModelInvariantUuid, String serviceModelVersion, String catalogUtilsVersion) {
+ JSONArray vnfsList = null
String endPoint = "/serviceVnfs?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8")
try {
msoLogger.debug("ENDPOINT: " + endPoint)
@@ -396,8 +396,8 @@ class CatalogDbUtils {
return vnfsList
}
- public JSONArray getAllVnfsByVnfModelCustomizationUuid(Execution execution, String vnfModelCustomizationUuid) {
- JSONArray vnfsList = null
+ public JSONArray getAllVnfsByVnfModelCustomizationUuid(DelegateExecution execution, String vnfModelCustomizationUuid) {
+ JSONArray vnfsList = null
String endPoint = "/serviceVnfs?vnfModelCustomizationUuid=" + UriUtils.encode(vnfModelCustomizationUuid, "UTF-8")
try {
msoLogger.debug("ENDPOINT: " + endPoint)
@@ -414,7 +414,7 @@ class CatalogDbUtils {
return vnfsList
}
-
+
/**
* This method gets a all vnfs for a particular
* service from the catalog database using the
@@ -423,9 +423,9 @@ class CatalogDbUtils {
* @param catalogDbEndpoint
* @param serviceModelModelName
* @return vnfsList *
- *
+ *
*/
- public JSONArray getAllVnfsByServiceModelModelName(Execution execution, String serviceModelModelName) {
+ public JSONArray getAllVnfsByServiceModelModelName(DelegateExecution execution, String serviceModelModelName) {
JSONArray vnfsList = null
String endPoint = "/serviceVnfs?serviceModelName=" + UriUtils.encode(serviceModelModelName, "UTF-8")
try {
@@ -441,8 +441,8 @@ class CatalogDbUtils {
return vnfsList
}
- public JSONArray getAllVnfsByVnfModelCustomizationUuid(Execution execution, String vnfModelCustomizationUuid, String catalogUtilsVersion) {
- JSONArray vnfsList = null
+ public JSONArray getAllVnfsByVnfModelCustomizationUuid(DelegateExecution execution, String vnfModelCustomizationUuid, String catalogUtilsVersion) {
+ JSONArray vnfsList = null
String endPoint = "/serviceVnfs?vnfModelCustomizationUuid=" + UriUtils.encode(vnfModelCustomizationUuid, "UTF-8")
try {
msoLogger.debug("ENDPOINT: " + endPoint)
@@ -476,8 +476,8 @@ class CatalogDbUtils {
* @param vfModuleModelName
* @return vfModule
*/
- public JSONObject getVfModuleByVfModuleModelName(Execution execution, String vfModuleModelName) {
- JSONObject vfModule = null
+ public JSONObject getVfModuleByVfModuleModelName(DelegateExecution execution, String vfModuleModelName) {
+ JSONObject vfModule = null
String endPoint = "/vfModules?vfModuleModelName=" + UriUtils.encode(vfModuleModelName, "UTF-8")
try{
msoLogger.debug("Get VfModule By VfModule ModelName Endpoint is: " + endPoint)
@@ -505,7 +505,7 @@ class CatalogDbUtils {
* @param catalogUtilsVersion
* @return vfModules
*/
- public JSONObject getVfModuleByVfModuleModelName(Execution execution, String vfModuleModelName, String catalogUtilsVersion) {
+ public JSONObject getVfModuleByVfModuleModelName(DelegateExecution execution, String vfModuleModelName, String catalogUtilsVersion) {
JSONObject vfModule = null
String endPoint = "/vfModules?vfModuleModelName=" + UriUtils.encode(vfModuleModelName, "UTF-8")
try{
@@ -524,7 +524,7 @@ class CatalogDbUtils {
}
- public JSONArray getAllottedResourcesByServiceModelUuid(Execution execution, String serviceModelUuid) {
+ public JSONArray getAllottedResourcesByServiceModelUuid(DelegateExecution execution, String serviceModelUuid) {
JSONArray vnfsList = null
String endPoint = "/ServiceAllottedResources?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8")
try {
@@ -542,7 +542,7 @@ class CatalogDbUtils {
return vnfsList
}
- public JSONArray getAllottedResourcesByServiceModelUuid(Execution execution, String serviceModelUuid, String catalogUtilsVersion) {
+ public JSONArray getAllottedResourcesByServiceModelUuid(DelegateExecution execution, String serviceModelUuid, String catalogUtilsVersion) {
JSONArray vnfsList = null
String endPoint = "/ServiceAllottedResources?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8")
try {
@@ -566,7 +566,7 @@ class CatalogDbUtils {
return vnfsList
}
- public JSONArray getAllottedResourcesByServiceModelInvariantUuid(Execution execution, String serviceModelInvariantUuid) {
+ public JSONArray getAllottedResourcesByServiceModelInvariantUuid(DelegateExecution execution, String serviceModelInvariantUuid) {
JSONArray vnfsList = null
String endPoint = "/serviceAllottedResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8")
try {
@@ -584,7 +584,7 @@ class CatalogDbUtils {
return vnfsList
}
- public JSONArray getAllottedResourcesByServiceModelInvariantUuid(Execution execution, String serviceModelInvariantUuid, String catalogUtilsVersion) {
+ public JSONArray getAllottedResourcesByServiceModelInvariantUuid(DelegateExecution execution, String serviceModelInvariantUuid, String catalogUtilsVersion) {
JSONArray vnfsList = null
String endPoint = "/serviceAllottedResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8")
try {
@@ -609,7 +609,7 @@ class CatalogDbUtils {
return vnfsList
}
- public JSONArray getAllottedResourcesByServiceModelInvariantUuidAndServiceModelVersion(Execution execution, String serviceModelInvariantUuid, String serviceModelVersion) {
+ public JSONArray getAllottedResourcesByServiceModelInvariantUuidAndServiceModelVersion(DelegateExecution execution, String serviceModelInvariantUuid, String serviceModelVersion) {
JSONArray vnfsList = null
String endPoint = "/serviceAllottedResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8")
try {
@@ -627,7 +627,7 @@ class CatalogDbUtils {
return vnfsList
}
- public JSONArray getAllottedResourcesByServiceModelInvariantUuidAndServiceModelVersion(Execution execution, String serviceModelInvariantUuid, String serviceModelVersion, String catalogUtilsVersion) {
+ public JSONArray getAllottedResourcesByServiceModelInvariantUuidAndServiceModelVersion(DelegateExecution execution, String serviceModelInvariantUuid, String serviceModelVersion, String catalogUtilsVersion) {
JSONArray vnfsList = null
String endPoint = "/serviceAllottedResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8")
try {
@@ -652,7 +652,7 @@ class CatalogDbUtils {
}
- public JSONArray getAllottedResourcesByArModelCustomizationUuid(Execution execution, String arModelCustomizationUuid) {
+ public JSONArray getAllottedResourcesByArModelCustomizationUuid(DelegateExecution execution, String arModelCustomizationUuid) {
JSONArray vnfsList = null
String endPoint = "/serviceAllottedResources?serviceModelCustomizationUuid=" + UriUtils.encode(arModelCustomizationUuid, "UTF-8")
try {
@@ -670,7 +670,7 @@ class CatalogDbUtils {
return vnfsList
}
- public JSONArray getAllottedResourcesByArModelCustomizationUuid(Execution execution, String arModelCustomizationUuid, String catalogUtilsVersion) {
+ public JSONArray getAllottedResourcesByArModelCustomizationUuid(DelegateExecution execution, String arModelCustomizationUuid, String catalogUtilsVersion) {
JSONArray vnfsList = null
String endPoint = "/serviceAllottedResources?serviceModelCustomizationUuid=" + UriUtils.encode(arModelCustomizationUuid, "UTF-8")
try {
@@ -694,58 +694,75 @@ class CatalogDbUtils {
return vnfsList
}
- public JSONObject getServiceResourcesByServiceModelUuid(Execution execution, String serviceModelUuid) {
- JSONObject resources = null
- String endPoint = "/serviceResources?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8")
- try {
- String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
+ public JSONObject getServiceResourcesByServiceModelUuid(DelegateExecution execution, String serviceModelUuid) {
+ JSONObject resources = null
+ String endPoint = "/serviceResources?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8")
+ try {
+ String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
+
+ if (catalogDbResponse != null) {
+
+ resources = parseServiceResourcesJson(catalogDbResponse, "v1")
+ }
+
+ }
+ catch (Exception e) {
+ utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
+ }
+
+ return resources
+ }
- if (catalogDbResponse != null) {
+ public JSONObject getServiceResourcesByServiceModelUuid(DelegateExecution execution, String serviceModelUuid, String catalogUtilsVersion) {
+ JSONObject resources = null
+ String endPoint = "/serviceResources?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8")
+ try {
+ String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
- resources = parseServiceResourcesJson(catalogDbResponse, "v1")
- }
+ if (catalogDbResponse != null) {
+ if (!catalogUtilsVersion.equals("v1")) {
+ resources = new JSONObject(catalogDbResponse)
+ }
+ else {
+ resources = parseServiceResourcesJson(catalogDbResponse, catalogUtilsVersion)
+ }
+ }
+ }
+ catch (Exception e) {
+ utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
+ }
- }
- catch (Exception e) {
- utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
- }
+ return resources
+ }
- return resources
- }
+ public JSONObject getServiceResourcesByServiceModelInvariantUuid(DelegateExecution execution, String serviceModelInvariantUuid) {
+ JSONObject resources = null
+ String endPoint = "/serviceResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8")
+ try {
+ String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
- public JSONObject getServiceResourcesByServiceModelUuid(Execution execution, String serviceModelUuid, String catalogUtilsVersion) {
- JSONObject resources = null
- String endPoint = "/serviceResources?serviceModelUuid=" + UriUtils.encode(serviceModelUuid, "UTF-8")
- try {
- String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
+ if (catalogDbResponse != null) {
- if (catalogDbResponse != null) {
- if (!catalogUtilsVersion.equals("v1")) {
- resources = new JSONObject(catalogDbResponse)
- }
- else {
- resources = parseServiceResourcesJson(catalogDbResponse, catalogUtilsVersion)
- }
- }
+ resources = parseServiceResourcesJson(catalogDbResponse, "v1")
+ }
- }
- catch (Exception e) {
- utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
- }
+ }
+ catch (Exception e) {
+ utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
+ }
- return resources
- }
+ return resources
+ }
-
- public JSONObject getServiceResourcesByServiceModelInvariantUuid(Execution execution, String serviceModelInvariantUuid) {
- JSONObject resources = null
+ public String getServiceResourcesByServiceModelInvariantUuidString(DelegateExecution execution, String serviceModelInvariantUuid) {
+ String resources = null
String endPoint = "/serviceResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8")
try {
String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
if (catalogDbResponse != null) {
- resources = parseServiceResourcesJson(catalogDbResponse, "v1")
+ resources = catalogDbResponse
}
}
@@ -756,7 +773,7 @@ class CatalogDbUtils {
return resources
}
- public JSONObject getServiceResourcesByServiceModelInvariantUuid(Execution execution, String serviceModelInvariantUuid, String catalogUtilsVersion) {
+ public JSONObject getServiceResourcesByServiceModelInvariantUuid(DelegateExecution execution, String serviceModelInvariantUuid, String catalogUtilsVersion) {
JSONObject resources = null
String endPoint = "/serviceResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8")
try {
@@ -780,13 +797,14 @@ class CatalogDbUtils {
}
- public JSONObject getServiceResourcesByServiceModelInvariantUuidAndServiceModelVersion(Execution execution, String serviceModelInvariantUuid, String serviceModelVersion) {
+ public JSONObject getServiceResourcesByServiceModelInvariantUuidAndServiceModelVersion(DelegateExecution execution, String serviceModelInvariantUuid, String serviceModelVersion) {
JSONObject resources = null
String endPoint = "/serviceResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8")
try {
String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
if (catalogDbResponse != null) {
+ //TODO this is wrong
resources = parseServiceResourcesJson(catalogDbResponse)
}
@@ -798,7 +816,7 @@ class CatalogDbUtils {
return resources
}
- public JSONObject getServiceResourcesByServiceModelInvariantUuidAndServiceModelVersion(Execution execution, String serviceModelInvariantUuid, String serviceModelVersion, String catalogUtilsVersion) {
+ public JSONObject getServiceResourcesByServiceModelInvariantUuidAndServiceModelVersion(DelegateExecution execution, String serviceModelInvariantUuid, String serviceModelVersion, String catalogUtilsVersion) {
JSONObject resources = null
String endPoint = "/serviceResources?serviceModelInvariantUuid=" + UriUtils.encode(serviceModelInvariantUuid, "UTF-8") + "&serviceModelVersion=" + UriUtils.encode(serviceModelVersion, "UTF-8")
try {
@@ -903,9 +921,11 @@ class CatalogDbUtils {
modelJson.put("nfNamingCode", nfCode)
String nfFunction = jsonUtils.getJsonValueForKey(vnf, "nfFunction")
modelJson.put("nfFunction", nfFunction)
+ String multiStageDesign = jsonUtils.getJsonValueForKey(vnf, "multiStageDesign")
+ modelJson.put("multiStageDesign", multiStageDesign)
break
}
-
+
JSONArray vfModules = null
try {
vfModules = vnf.getJSONArray("vfModules")
@@ -925,6 +945,7 @@ class CatalogDbUtils {
vfModuleModelJson.put("vfModuleType", vfModuleType)
switch(catalogUtilsVersion) {
case "v1":
+ //TODO this does not work, isBase is not a integer.
Integer isBase = jsonUtils.getJsonIntValueForKey(vfModule, "isBase")
if (isBase.intValue() == 1) {
vfModuleModelJson.put("isBase", "true")
@@ -1042,8 +1063,10 @@ class CatalogDbUtils {
modelJson.put("nfNamingCode", nfCode)
String nfFunction = jsonUtils.getJsonValueForKey(allottedResource, "nfFunction")
modelJson.put("nfFunction", nfFunction)
- String parentServiceModelUuid = jsonUtils.getJsonValueForKey(allottedResource, "parentServiceModelUuid")
- modelJson.put("parentServiceModelUuid", parentServiceModelUuid)
+ String providingServiceModelName = jsonUtils.getJsonValueForKey(allottedResource, "providingServiceModelName")
+ modelJson.put("providingServiceModelName", providingServiceModelName)
+ String providingServiceModelUuid = jsonUtils.getJsonValueForKey(allottedResource, "providingServiceModelUuid")
+ modelJson.put("providingServiceModelUuid", providingServiceModelUuid)
break
}
@@ -1061,6 +1084,7 @@ class CatalogDbUtils {
return modelInfos
}
+ //TODO this is wrong
private JSONObject parseServiceResourcesJson (String catalogDbResponse) {
JSONObject serviceResources = new JSONObject()
String catalogUtilsVersion = "v1"
@@ -1124,7 +1148,7 @@ class CatalogDbUtils {
modelInfo.put("modelType", modelType)
String modelInvariantId = jsonUtils.getJsonValueForKey(modelFromDb, "modelInvariantUuid")
modelInfo.put("modelInvariantId", modelInvariantId)
- if(modelType.equalsIgnoreCase("allottedResource")){
+ if(modelType.equalsIgnoreCase("allottedResource") || modelType.equalsIgnoreCase("vnf")){
String modelInstanceName = jsonUtils.getJsonValueForKey(modelFromDb, "modelInstanceName")
modelInfo.put("modelInstanceName", modelInstanceName)
}
@@ -1162,7 +1186,7 @@ class CatalogDbUtils {
return modelInfo
}
- private String getResponseFromCatalogDb (Execution execution, String endPoint) {
+ private String getResponseFromCatalogDb (DelegateExecution execution, String endPoint) {
try {
String catalogDbEndpoint = execution.getVariable("URN_mso_catalog_db_endpoint")
String queryEndpoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + endPoint
@@ -1174,7 +1198,7 @@ class CatalogDbUtils {
addHeader('X-FromAppId', 'BPMN').
addHeader('Content-Type', 'application/json').
addHeader('Accept','application/json');
-
+
String basicAuthCred = execution.getVariable("BasicAuthHeaderValueDB")
if (basicAuthCred != null && !"".equals(basicAuthCred)) {
client.addAuthorizationHeader(basicAuthCred)
@@ -1203,25 +1227,25 @@ class CatalogDbUtils {
}
}
-
- /**
- * get resource recipe by resource model uuid and action
- */
- public JSONObject getResourceRecipe(Execution execution, String resourceModelUuid, String action) {
- String endPoint = "/resourceRecipe?resourceModelUuid=" + UriUtils.encode(resourceModelUuid, "UTF-8")+ "&action=" + UriUtils.encode(action, "UTF-8")
- JSONObject responseJson = null
- try {
- msoLogger.debug("ENDPOINT: " + endPoint)
- String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
-
- if (catalogDbResponse != null) {
- responseJson = new JSONObject(catalogDbResponse)
- }
- }
- catch (Exception e) {
- utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
- }
-
- return responseJson
- }
-} \ No newline at end of file
+
+ /**
+ * get resource recipe by resource model uuid and action
+ */
+ public JSONObject getResourceRecipe(DelegateExecution execution, String resourceModelUuid, String action) {
+ String endPoint = "/resourceRecipe?resourceModelUuid=" + UriUtils.encode(resourceModelUuid, "UTF-8")+ "&action=" + UriUtils.encode(action, "UTF-8")
+ JSONObject responseJson = null
+ try {
+ msoLogger.debug("ENDPOINT: " + endPoint)
+ String catalogDbResponse = getResponseFromCatalogDb(execution, endPoint)
+
+ if (catalogDbResponse != null) {
+ responseJson = new JSONObject(catalogDbResponse)
+ }
+ }
+ catch (Exception e) {
+ utils.log("ERROR", "Exception in Querying Catalog DB: " + e.message)
+ }
+
+ return responseJson
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CompleteMsoProcess.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CompleteMsoProcess.groovy
index 66a7c8e2b5..57a04e5439 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CompleteMsoProcess.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CompleteMsoProcess.groovy
@@ -1,308 +1,314 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.bpmn.common.scripts
-
-import org.apache.commons.lang3.*
-import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.runtime.Execution
-
-
-public class CompleteMsoProcess extends AbstractServiceTaskProcessor {
-
- String Prefix="CMSO_"
- ExceptionUtil exceptionUtil = new ExceptionUtil()
-
- // Complete MSO Request processing
- public initializeProcessVariables(Execution execution){
-
- def method = getClass().getSimpleName() + '.initializeProcessVariables(' +'execution=' + execution.getId() +')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
- try {
-
- /* Initialize all the process request variables in this block */
- execution.setVariable("prefix",Prefix)
- execution.setVariable("CMSO_request_id","")
- execution.setVariable("CMSO_notification-url","")
- execution.setVariable("CMSO_mso-bpel-name","")
- execution.setVariable("CMSO_request_action","")
- execution.setVariable("CMSO_notification-url-Ok", false)
- execution.setVariable("CMSO_request_id-Ok", false)
-
- //updateRequest Adapter process variables
- execution.setVariable("CMSO_updateRequestResponse", "")
- execution.setVariable("CMSO_updateRequestResponseCode", "")
- execution.setVariable("CMSO_updateFinalNotifyAckStatusFailedPayload", "")
-
- //Set DB adapter variables here
- execution.setVariable("CMSO_updateDBStatusToSuccessPayload", "")
- execution.setVariable("CMSO_updateInfraRequestDBPayload", "")
- execution.setVariable("CMSO_setUpdateDBstatustoSuccessPayload", "")
-
- //Auth variables
- execution.setVariable("BasicAuthHeaderValue","")
-
- //Response variables
- execution.setVariable("CompletionHandlerResponse","")
- execution.setVariable("CMSO_ErrorResponse", null)
- execution.setVariable("CMSO_ResponseCode", "")
-
- setSuccessIndicator(execution, false)
-
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method)
- }
-
- }
-
- public void preProcessRequest (Execution execution) {
-
- initializeProcessVariables(execution)
- def method = getClass().getSimpleName() + '.preProcessRequest(' +'execution=' + execution.getId() +')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
-// utils.log("DEBUG", "*** Started CompleteMsoProcess preProcessRequest Method ***", isDebugLogEnabled);
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- setBasicDBAuthHeader(execution, isDebugLogEnabled)
-
- try {
- def xml = execution.getVariable("CompleteMsoProcessRequest")
-
- utils.logAudit("CompleteMsoProcess Request: " + xml)
- utils.log("DEBUG", "Incoming Request is: "+ xml, isDebugLogEnabled)
-
- //mso-bpel-name from the incoming request
- def msoBpelName = utils.getNodeText1(xml,"mso-bpel-name")
- execution.setVariable("CMSO_mso-bpel-name",msoBpelName)
-
- //Check the incoming request type
- //Incoming request can be ACTIVE_REQUESTS (request-information node) or INFRA_ACTIVE_REQUESTS (request-info node)
- if (utils.nodeExists(xml, "request-information")) {
- execution.setVariable("CMSO_request_id-Ok", true) // Incoming request is for ACTIVE_REQUESTS
- }
-
- //Check notification-url for the incoming request type
- //ACTIVE_REQUESTS may have notificationurl node
- //INFRA_ACTIVE_REQUESTS notificationurl node does not exist
- def notificationurl = ""
- if (utils.nodeExists(xml, "notification-url")) {
- notificationurl = utils.getNodeText(xml,"notification-url")
- if(notificationurl != null && !notificationurl.isEmpty()) {
- execution.setVariable("CMSO_notification-url-Ok", true)
- execution.setVariable("CMSO_notification-url",notificationurl)
- }
- }
-
- //Check request_id for the incoming request type
- //For INFRA_ACTIVE_REQUESTS payload request-id IS optional (Not sure why this is option since req id is primary key ... also tried exe through SOAP UI to check if MSO code handles null like auto generated seq not it does not)
- //For ACTIVE_REQUESTS payload request-id is NOT optional
- def request_id = ""
- if (utils.nodeExists(xml, "request-id")) {
- execution.setVariable("CMSO_request_id",utils.getNodeText(xml,"request-id"))
- }
-
-
- // INFRA_ACTIVE_REQUESTS have "action" element ... mandatory
- // ACTIVE_REQUEST have "request-action" ... mandatory
- if (utils.nodeExists(xml, "request-action")) {
- execution.setVariable("CMSO_request_action",utils.getNodeText(xml,"request-action"))
- } else if (utils.nodeExists(xml, "action")) {
- execution.setVariable("CMSO_request_action",utils.getNodeText(xml,"action"))
- }
-
- //Check source for the incoming request type
- //For INFRA_ACTIVE_REQUESTS payload source IS optional
- //For ACTIVE_REQUESTS payload source is NOT optional
- def source = ""
- if (utils.nodeExists(xml, "source")) {
- execution.setVariable("CMSO_source",utils.getNodeText(xml,"source"))
- }
-
- utils.log("DEBUG", "CMSO_notification-url-Ok --> " + execution.getVariable("CMSO_notification-url-Ok"), isDebugLogEnabled)
- utils.log("DEBUG", "CMSO_request_id-Ok --> " + execution.getVariable("CMSO_request_id-Ok"), isDebugLogEnabled)
-
- // set the DHV/Service Instantiation values if specified in the request
- execution.setVariable("CMSO_is_srv_inst_req", String.valueOf("true".equals(utils.getNodeText1(xml, "is-srv-inst-req"))))
- utils.log("DEBUG", "CMSO_is_srv_inst_req --> " + execution.getVariable("CMSO_is_srv_inst_req"), isDebugLogEnabled)
- execution.setVariable("CMSO_is_json_content", String.valueOf("JSON".equals(utils.getNodeText1(xml, "resp-content-type"))))
- utils.log("DEBUG", "CMSO_is_json_content --> " + execution.getVariable("CMSO_is_json_content"), isDebugLogEnabled)
- execution.setVariable("CMSO_service_inst_id", utils.getNodeText1(xml, "service-instance-id"))
- utils.log("DEBUG", "CMSO_service_inst_id --> " + execution.getVariable("CMSO_service_inst_id"), isDebugLogEnabled)
- execution.setVariable("CMSO_start_time", utils.getNodeText1(xml, "start-time"))
- utils.log("DEBUG", "CMSO_start_time --> " + execution.getVariable("CMSO_start_time"), isDebugLogEnabled)
- // this variable is used by the camunda flow to set the Content-Type for the async response
- if (execution.getVariable("CMSO_is_srv_inst_req").equals("true") &&
- execution.getVariable("CMSO_is_json_content").equals("true")) {
- execution.setVariable("CMSO_content_type", "application/json")
- } else {
- execution.setVariable("CMSO_content_type", "text/xml")
- }
-
- logDebug('Exited ' + method, isDebugLogEnabled)
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- utils.log("DEBUG", "Exception Occured During PreProcessRequest: " + e, isDebugLogEnabled);
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in " + method)
- }
-
-// utils.log("DEBUG", "*** Completed CompleteMsoProcess preProcessRequest Method ***", isDebugLogEnabled);
- }
-
- public void setUpdateDBstatustoSuccessPayload (Execution execution){
-
- def method = getClass().getSimpleName() + '.setUpdateDBstatustoSuccessPayload(' +'execution=' + execution.getId() +')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
-
- try {
-
- def xml = execution.getVariable("CompleteMsoProcessRequest")
-
- //Get statusMessage if exists
- def statusMessage
- if(utils.nodeExists(xml, "status-message")){
- statusMessage = utils.getNodeText1(xml, "status-message")
- }else{
- statusMessage = "Resource Completed Successfully"
- }
-
- //Get instance Id if exist
- String idXml = ""
- if(utils.nodeExists(xml, "vnfId")){
- idXml = utils.getNodeXml(xml, "vnfId")
- }else if(utils.nodeExists(xml, "networkId")){
- idXml = utils.getNodeXml(xml, "networkId")
- }else if(utils.nodeExists(xml, "serviceInstanceId")){
- idXml = utils.getNodeXml(xml, "serviceInstanceId")
- }else if(utils.nodeExists(xml, "vfModuleId")){
- idXml = utils.getNodeXml(xml, "vfModuleId")
- }else if(utils.nodeExists(xml, "volumeGroupId")){
- idXml = utils.getNodeXml(xml, "volumeGroupId")
- }else{
- idXml = ""
- }
- idXml = utils.removeXmlPreamble(idXml)
- utils.log("DEBUG", "Incoming Instance Id Xml: " + idXml, isDebugLogEnabled)
-
- String payload = """
- <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.openecomp.mso/requestsdb">
- <soapenv:Header/>
- <soapenv:Body>
- <req:updateInfraRequest>
- <requestId>${execution.getVariable("CMSO_request_id")}</requestId>
- <lastModifiedBy>${execution.getVariable("CMSO_mso-bpel-name")}</lastModifiedBy>
- <statusMessage>${statusMessage}</statusMessage>
- <requestStatus>COMPLETE</requestStatus>
- <progress>100</progress>
- ${idXml}
- </req:updateInfraRequest>
- </soapenv:Body>
- </soapenv:Envelope>"""
-
- execution.setVariable("CMSO_setUpdateDBstatustoSuccessPayload", payload)
- utils.log("DEBUG", "Outgoing Update Mso Request Payload is: " + payload, isDebugLogEnabled)
- utils.logAudit("setUpdateDBstatustoSuccessPayload: " + payload)
-
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method)
- }
- logDebug('Exited ' + method, isDebugLogEnabled)
- }
-
- public void buildDataError (Execution execution, String message) {
-
- def method = getClass().getSimpleName() + '.buildDataError(' +'execution=' + execution.getId() +')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
- try {
-
- def msoCompletionResponse = """
- <sdncadapterworkflow:MsoCompletionResponse xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1">
- <sdncadapterworkflow:out>BPEL ${execution.getVariable("CMSO_mso-bpel-name")} FAILED</sdncadapterworkflow:out>
- </sdncadapterworkflow:MsoCompletionResponse>
- """.trim()
-
- // Format Response
- def xmlMsoCompletionResponse = utils.formatXml(msoCompletionResponse)
- String buildMsoCompletionResponseAsString = xmlMsoCompletionResponse.drop(38).trim()
- utils.logAudit("CompleteMsoProcess Response: " + buildMsoCompletionResponseAsString)
- execution.setVariable("CompleteMsoProcessResponse", buildMsoCompletionResponseAsString)
- utils.log("DEBUG", "@@ CompleteMsoProcess Response @@ " + "\n" + execution.getVariable("CompletionHandlerResponse"), isDebugLogEnabled)
-
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, message)
-
- } catch (BpmnError e) {
- utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugLogEnabled)
- throw e;
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method)
- }
-
- }
-
- public void postProcessResponse (Execution execution) {
-
- def method = getClass().getSimpleName() + '.postProcessResponse(' +'execution=' + execution.getId() +')'
- def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
- logDebug('Entered ' + method, isDebugLogEnabled)
- // utils.log("DEBUG", "*** Started CompleteMsoProcess PostProcessRequest Method ***", isDebugLogEnabled);
- try {
-
- def msoCompletionResponse = """
- <sdncadapterworkflow:MsoCompletionResponse xmlns:sdncadapterworkflow="http://ecomp.com/mso/workflow/schema/v1">
- <sdncadapterworkflow:out>BPEL ${execution.getVariable("CMSO_mso-bpel-name")} completed</sdncadapterworkflow:out>
- </sdncadapterworkflow:MsoCompletionResponse>
- """.trim()
-
- // Format Response
- def xmlMsoCompletionResponse = utils.formatXML(msoCompletionResponse)
- String buildMsoCompletionResponseAsString = xmlMsoCompletionResponse.drop(38).trim()
- // TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead
- execution.setVariable("WorkflowResponse", buildMsoCompletionResponseAsString)
- utils.logAudit("CompleteMsoProcess Response: " + buildMsoCompletionResponseAsString)
- execution.setVariable("CompleteMsoProcessResponse", buildMsoCompletionResponseAsString)
- execution.setVariable("CMSO_ResponseCode", "200")
-
- setSuccessIndicator(execution, true)
-
- utils.log("DEBUG", "@@ CompleteMsoProcess Response @@ " + "\n" + execution.getVariable("CompleteMsoProcessResponse"), isDebugLogEnabled)
-
- logDebug('Exited ' + method, isDebugLogEnabled)
- } catch (BpmnError e) {
- throw e;
- } catch (Exception e) {
- logError('Caught exception in ' + method, e)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method)
- }
- // utils.log("DEBUG", "*** Completed CompleteMsoProcess PostProcessRequest Method ***", isDebugLogEnabled);
-
- }
-
-
-}
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.openecomp.mso.bpmn.common.scripts
+
+import org.apache.commons.lang3.*
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
+
+
+public class CompleteMsoProcess extends AbstractServiceTaskProcessor {
+
+ String Prefix="CMSO_"
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+
+ // Complete MSO Request processing
+ public initializeProcessVariables(DelegateExecution execution){
+
+ def method = getClass().getSimpleName() + '.initializeProcessVariables(' +'execution=' + execution.getId() +')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logDebug('Entered ' + method, isDebugLogEnabled)
+ try {
+
+ /* Initialize all the process request variables in this block */
+ execution.setVariable("prefix",Prefix)
+ execution.setVariable("CMSO_request_id","")
+ execution.setVariable("CMSO_notification-url","")
+ execution.setVariable("CMSO_mso-bpel-name","")
+ execution.setVariable("CMSO_request_action","")
+ execution.setVariable("CMSO_notification-url-Ok", false)
+ execution.setVariable("CMSO_request_id-Ok", false)
+
+ //updateRequest Adapter process variables
+ execution.setVariable("CMSO_updateRequestResponse", "")
+ execution.setVariable("CMSO_updateRequestResponseCode", "")
+ execution.setVariable("CMSO_updateFinalNotifyAckStatusFailedPayload", "")
+
+ //Set DB adapter variables here
+ execution.setVariable("CMSO_updateDBStatusToSuccessPayload", "")
+ execution.setVariable("CMSO_updateInfraRequestDBPayload", "")
+ execution.setVariable("CMSO_setUpdateDBstatustoSuccessPayload", "")
+
+ //Auth variables
+ execution.setVariable("BasicAuthHeaderValue","")
+
+ //Response variables
+ execution.setVariable("CompletionHandlerResponse","")
+ execution.setVariable("CMSO_ErrorResponse", null)
+ execution.setVariable("CMSO_ResponseCode", "")
+
+ setSuccessIndicator(execution, false)
+
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception e) {
+ logError('Caught exception in ' + method, e)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method)
+ }
+
+ }
+
+ public void preProcessRequest (DelegateExecution execution) {
+
+ initializeProcessVariables(execution)
+ def method = getClass().getSimpleName() + '.preProcessRequest(' +'execution=' + execution.getId() +')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+// utils.log("DEBUG", "*** Started CompleteMsoProcess preProcessRequest Method ***", isDebugLogEnabled);
+ logDebug('Entered ' + method, isDebugLogEnabled)
+
+ setBasicDBAuthHeader(execution, isDebugLogEnabled)
+
+ try {
+ def xml = execution.getVariable("CompleteMsoProcessRequest")
+
+ utils.logAudit("CompleteMsoProcess Request: " + xml)
+ utils.log("DEBUG", "Incoming Request is: "+ xml, isDebugLogEnabled)
+
+ //mso-bpel-name from the incoming request
+ def msoBpelName = utils.getNodeText1(xml,"mso-bpel-name")
+ execution.setVariable("CMSO_mso-bpel-name",msoBpelName)
+
+ //Check the incoming request type
+ //Incoming request can be ACTIVE_REQUESTS (request-information node) or INFRA_ACTIVE_REQUESTS (request-info node)
+ if (utils.nodeExists(xml, "request-information")) {
+ execution.setVariable("CMSO_request_id-Ok", true) // Incoming request is for ACTIVE_REQUESTS
+ }
+
+ //Check for rehome indicator
+ def rehomeIndicator = utils.getNodeText1(xml,"rehomeDone")
+ execution.setVariable("rehomeDone", rehomeIndicator)
+
+ //Check notification-url for the incoming request type
+ //ACTIVE_REQUESTS may have notificationurl node
+ //INFRA_ACTIVE_REQUESTS notificationurl node does not exist
+ def notificationurl = ""
+ if (utils.nodeExists(xml, "notification-url")) {
+ notificationurl = utils.getNodeText(xml,"notification-url")
+ if(notificationurl != null && !notificationurl.isEmpty()) {
+ execution.setVariable("CMSO_notification-url-Ok", true)
+ execution.setVariable("CMSO_notification-url",notificationurl)
+ }
+ }
+
+ //Check request_id for the incoming request type
+ //For INFRA_ACTIVE_REQUESTS payload request-id IS optional (Not sure why this is option since req id is primary key ... also tried exe through SOAP UI to check if MSO code handles null like auto generated seq not it does not)
+ //For ACTIVE_REQUESTS payload request-id is NOT optional
+ def request_id = ""
+ if (utils.nodeExists(xml, "request-id")) {
+ execution.setVariable("CMSO_request_id",utils.getNodeText(xml,"request-id"))
+ }
+
+
+ // INFRA_ACTIVE_REQUESTS have "action" element ... mandatory
+ // ACTIVE_REQUEST have "request-action" ... mandatory
+ if (utils.nodeExists(xml, "request-action")) {
+ execution.setVariable("CMSO_request_action",utils.getNodeText(xml,"request-action"))
+ } else if (utils.nodeExists(xml, "action")) {
+ execution.setVariable("CMSO_request_action",utils.getNodeText(xml,"action"))
+ }
+
+ //Check source for the incoming request type
+ //For INFRA_ACTIVE_REQUESTS payload source IS optional
+ //For ACTIVE_REQUESTS payload source is NOT optional
+ def source = ""
+ if (utils.nodeExists(xml, "source")) {
+ execution.setVariable("CMSO_source",utils.getNodeText(xml,"source"))
+ }
+
+ utils.log("DEBUG", "CMSO_notification-url-Ok --> " + execution.getVariable("CMSO_notification-url-Ok"), isDebugLogEnabled)
+ utils.log("DEBUG", "CMSO_request_id-Ok --> " + execution.getVariable("CMSO_request_id-Ok"), isDebugLogEnabled)
+
+ // set the DHV/Service Instantiation values if specified in the request
+ execution.setVariable("CMSO_is_srv_inst_req", String.valueOf("true".equals(utils.getNodeText1(xml, "is-srv-inst-req"))))
+ utils.log("DEBUG", "CMSO_is_srv_inst_req --> " + execution.getVariable("CMSO_is_srv_inst_req"), isDebugLogEnabled)
+ execution.setVariable("CMSO_is_json_content", String.valueOf("JSON".equals(utils.getNodeText1(xml, "resp-content-type"))))
+ utils.log("DEBUG", "CMSO_is_json_content --> " + execution.getVariable("CMSO_is_json_content"), isDebugLogEnabled)
+ execution.setVariable("CMSO_service_inst_id", utils.getNodeText1(xml, "service-instance-id"))
+ utils.log("DEBUG", "CMSO_service_inst_id --> " + execution.getVariable("CMSO_service_inst_id"), isDebugLogEnabled)
+ execution.setVariable("CMSO_start_time", utils.getNodeText1(xml, "start-time"))
+ utils.log("DEBUG", "CMSO_start_time --> " + execution.getVariable("CMSO_start_time"), isDebugLogEnabled)
+ // this variable is used by the camunda flow to set the Content-Type for the async response
+ if (execution.getVariable("CMSO_is_srv_inst_req").equals("true") &&
+ execution.getVariable("CMSO_is_json_content").equals("true")) {
+ execution.setVariable("CMSO_content_type", "application/json")
+ } else {
+ execution.setVariable("CMSO_content_type", "text/xml")
+ }
+
+ logDebug('Exited ' + method, isDebugLogEnabled)
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception e) {
+ utils.log("DEBUG", "Exception Occured During PreProcessRequest: " + e, isDebugLogEnabled);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in " + method)
+ }
+
+// utils.log("DEBUG", "*** Completed CompleteMsoProcess preProcessRequest Method ***", isDebugLogEnabled);
+ }
+
+ public void setUpdateDBstatustoSuccessPayload (DelegateExecution execution){
+
+ def method = getClass().getSimpleName() + '.setUpdateDBstatustoSuccessPayload(' +'execution=' + execution.getId() +')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logDebug('Entered ' + method, isDebugLogEnabled)
+
+ try {
+
+ def xml = execution.getVariable("CompleteMsoProcessRequest")
+
+ //Get statusMessage if exists
+ def statusMessage
+ if(utils.nodeExists(xml, "status-message")){
+ statusMessage = utils.getNodeText1(xml, "status-message")
+ }else{
+ statusMessage = "Resource Completed Successfully"
+ }
+
+ //Get instance Id if exist
+ String idXml = ""
+ if(utils.nodeExists(xml, "vnfId")){
+ idXml = utils.getNodeXml(xml, "vnfId")
+ }else if(utils.nodeExists(xml, "networkId")){
+ idXml = utils.getNodeXml(xml, "networkId")
+ }else if(utils.nodeExists(xml, "configurationId")){
+ idXml = utils.getNodeXml(xml, "configurationId")
+ }else if(utils.nodeExists(xml, "serviceInstanceId")){
+ idXml = utils.getNodeXml(xml, "serviceInstanceId")
+ }else if(utils.nodeExists(xml, "vfModuleId")){
+ idXml = utils.getNodeXml(xml, "vfModuleId")
+ }else if(utils.nodeExists(xml, "volumeGroupId")){
+ idXml = utils.getNodeXml(xml, "volumeGroupId")
+ }else{
+ idXml = ""
+ }
+ idXml = utils.removeXmlPreamble(idXml)
+ utils.log("DEBUG", "Incoming Instance Id Xml: " + idXml, isDebugLogEnabled)
+
+ String payload = """
+ <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.openecomp.mso/requestsdb">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <req:updateInfraRequest>
+ <requestId>${execution.getVariable("CMSO_request_id")}</requestId>
+ <lastModifiedBy>${execution.getVariable("CMSO_mso-bpel-name")}</lastModifiedBy>
+ <statusMessage>${statusMessage}</statusMessage>
+ <requestStatus>COMPLETE</requestStatus>
+ <progress>100</progress>
+ ${idXml}
+ </req:updateInfraRequest>
+ </soapenv:Body>
+ </soapenv:Envelope>"""
+
+ execution.setVariable("CMSO_setUpdateDBstatustoSuccessPayload", payload)
+ utils.log("DEBUG", "Outgoing Update Mso Request Payload is: " + payload, isDebugLogEnabled)
+ utils.logAudit("setUpdateDBstatustoSuccessPayload: " + payload)
+
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception e) {
+ logError('Caught exception in ' + method, e)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method)
+ }
+ logDebug('Exited ' + method, isDebugLogEnabled)
+ }
+
+ public void buildDataError (DelegateExecution execution, String message) {
+
+ def method = getClass().getSimpleName() + '.buildDataError(' +'execution=' + execution.getId() +')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logDebug('Entered ' + method, isDebugLogEnabled)
+ try {
+
+ def msoCompletionResponse = """
+ <sdncadapterworkflow:MsoCompletionResponse xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1">
+ <sdncadapterworkflow:out>BPEL ${execution.getVariable("CMSO_mso-bpel-name")} FAILED</sdncadapterworkflow:out>
+ </sdncadapterworkflow:MsoCompletionResponse>
+ """.trim()
+
+ // Format Response
+ def xmlMsoCompletionResponse = utils.formatXml(msoCompletionResponse)
+ String buildMsoCompletionResponseAsString = xmlMsoCompletionResponse.drop(38).trim()
+ utils.logAudit("CompleteMsoProcess Response: " + buildMsoCompletionResponseAsString)
+ execution.setVariable("CompleteMsoProcessResponse", buildMsoCompletionResponseAsString)
+ utils.log("DEBUG", "@@ CompleteMsoProcess Response @@ " + "\n" + execution.getVariable("CompletionHandlerResponse"), isDebugLogEnabled)
+
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, message)
+
+ } catch (BpmnError e) {
+ utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugLogEnabled)
+ throw e;
+ } catch (Exception e) {
+ logError('Caught exception in ' + method, e)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method)
+ }
+
+ }
+
+ public void postProcessResponse (DelegateExecution execution) {
+
+ def method = getClass().getSimpleName() + '.postProcessResponse(' +'execution=' + execution.getId() +')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logDebug('Entered ' + method, isDebugLogEnabled)
+ // utils.log("DEBUG", "*** Started CompleteMsoProcess PostProcessRequest Method ***", isDebugLogEnabled);
+ try {
+
+ def msoCompletionResponse = """
+ <sdncadapterworkflow:MsoCompletionResponse xmlns:sdncadapterworkflow="http://ecomp.com/mso/workflow/schema/v1">
+ <sdncadapterworkflow:out>BPEL ${execution.getVariable("CMSO_mso-bpel-name")} completed</sdncadapterworkflow:out>
+ </sdncadapterworkflow:MsoCompletionResponse>
+ """.trim()
+
+ // Format Response
+ def xmlMsoCompletionResponse = utils.formatXML(msoCompletionResponse)
+ String buildMsoCompletionResponseAsString = xmlMsoCompletionResponse.drop(38).trim()
+ // TODO: Should deprecate use of processKey+Response variable for the response. Will use "WorkflowResponse" instead
+ execution.setVariable("WorkflowResponse", buildMsoCompletionResponseAsString)
+ utils.logAudit("CompleteMsoProcess Response: " + buildMsoCompletionResponseAsString)
+ execution.setVariable("CompleteMsoProcessResponse", buildMsoCompletionResponseAsString)
+ execution.setVariable("CMSO_ResponseCode", "200")
+
+ setSuccessIndicator(execution, true)
+
+ utils.log("DEBUG", "@@ CompleteMsoProcess Response @@ " + "\n" + execution.getVariable("CompleteMsoProcessResponse"), isDebugLogEnabled)
+
+ logDebug('Exited ' + method, isDebugLogEnabled)
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception e) {
+ logError('Caught exception in ' + method, e)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method)
+ }
+ // utils.log("DEBUG", "*** Completed CompleteMsoProcess PostProcessRequest Method ***", isDebugLogEnabled);
+
+ }
+
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ConfirmVolumeGroupName.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ConfirmVolumeGroupName.groovy
index 6c8f315193..615e25de71 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ConfirmVolumeGroupName.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ConfirmVolumeGroupName.groovy
@@ -19,7 +19,7 @@
*/
package org.openecomp.mso.bpmn.common.scripts
-import org.camunda.bpm.engine.runtime.Execution
+import org.camunda.bpm.engine.delegate.DelegateExecution
import org.openecomp.mso.rest.APIResponse
@@ -28,7 +28,7 @@ public class ConfirmVolumeGroupName extends AbstractServiceTaskProcessor{
def Prefix="CVGN_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
- public void initProcessVariables(Execution execution) {
+ public void initProcessVariables(DelegateExecution execution) {
execution.setVariable("prefix",Prefix)
execution.setVariable("CVGN_volumeGroupId",null)
execution.setVariable("CVGN_volumeGroupName",null)
@@ -44,8 +44,8 @@ public class ConfirmVolumeGroupName extends AbstractServiceTaskProcessor{
execution.setVariable("RollbackData", null)
}
- // store the incoming data in the flow Execution
- public void preProcessRequest(Execution execution) {
+ // store the incoming data in the flow DelegateExecution
+ public void preProcessRequest(DelegateExecution execution) {
def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled")
def volumeGroupId = execution.getVariable("ConfirmVolumeGroupName_volumeGroupId")
def volumeGroupName= execution.getVariable("ConfirmVolumeGroupName_volumeGroupName")
@@ -66,7 +66,7 @@ public class ConfirmVolumeGroupName extends AbstractServiceTaskProcessor{
// send a GET request to AA&I to retrieve the Volume information based on volume-group-id
// expect a 200 response with the information in the response body or a 404 if the volume group id does not exist
- public void queryAAIForVolumeGroupId(Execution execution) {
+ public void queryAAIForVolumeGroupId(DelegateExecution execution) {
def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled")
def endPoint = execution.getVariable("URN_aai_endpoint") + execution.getVariable("CVGN_volumeGroupGetEndpoint")
@@ -97,7 +97,7 @@ public class ConfirmVolumeGroupName extends AbstractServiceTaskProcessor{
// process the result from queryAAIVolumeGroupId()
- public void checkAAIQueryResult(Execution execution) {
+ public void checkAAIQueryResult(DelegateExecution execution) {
def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled")
def result = execution.getVariable("CVGN_queryVolumeGroupResponse")
@@ -123,7 +123,7 @@ public class ConfirmVolumeGroupName extends AbstractServiceTaskProcessor{
// generates a WorkflowException if the A&AI query returns a response code other than 200/404
- public void handleAAIQueryFailure(Execution execution) {
+ public void handleAAIQueryFailure(DelegateExecution execution) {
def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled")
logError("Error occurred attempting to query AAI, Response Code " +
@@ -136,7 +136,7 @@ public class ConfirmVolumeGroupName extends AbstractServiceTaskProcessor{
}
// generates a WorkflowException if the volume group name does not match AAI record for this volume group
- public void handleVolumeGroupNameNoMatch(Execution execution) {
+ public void handleVolumeGroupNameNoMatch(DelegateExecution execution) {
def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled")
def errorNotAssociated = "Error occurred - volume group id " + execution.getVariable("CVGN_volumeGroupId") +
@@ -150,7 +150,7 @@ public class ConfirmVolumeGroupName extends AbstractServiceTaskProcessor{
}
// sends a successful WorkflowResponse
- public void reportSuccess(Execution execution) {
+ public void reportSuccess(DelegateExecution execution) {
def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled")
logDebug("Sending 200 back to the caller", isDebugLogEnabled)
def responseXML = ""
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy
index b9fba52dbd..ecb18043a7 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ConfirmVolumeGroupTenant.groovy
@@ -25,7 +25,7 @@ import javax.xml.parsers.DocumentBuilderFactory
import org.apache.commons.lang3.*
import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.runtime.Execution
+import org.camunda.bpm.engine.delegate.DelegateExecution
import org.openecomp.mso.bpmn.core.WorkflowException
import org.openecomp.mso.rest.APIResponse
import org.w3c.dom.Document
@@ -48,7 +48,7 @@ class ConfirmVolumeGroupTenant extends AbstractServiceTaskProcessor{
String Prefix="CVGT_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
- public void preProcessRequest(Execution execution){
+ public void preProcessRequest(DelegateExecution execution){
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix", Prefix)
utils.log("DEBUG", " ======== STARTED Confirm Volume Group Tenant Subflow ======== ", isDebugEnabled)
@@ -148,7 +148,7 @@ class ConfirmVolumeGroupTenant extends AbstractServiceTaskProcessor{
utils.log("DEBUG", "=== COMPLETED queryAAIForVolumeGroup Process === ", isDebugEnabled)
}
- public void assignVolumeHeatId(Execution execution){
+ public void assignVolumeHeatId(DelegateExecution execution){
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix", Prefix)
try{
@@ -170,7 +170,7 @@ class ConfirmVolumeGroupTenant extends AbstractServiceTaskProcessor{
utils.log("DEBUG", "======== COMPLETED Confirm Volume Group Tenant Subflow ======== ", isDebugEnabled)
}
- public void assignWorkflowException(Execution execution, String message){
+ public void assignWorkflowException(DelegateExecution execution, String message){
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix", Prefix)
String processKey = getProcessKey(execution);
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CreateAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CreateAAIVfModule.groovy
index 5c72c33b13..41036e7f43 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CreateAAIVfModule.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CreateAAIVfModule.groovy
@@ -19,7 +19,7 @@
*/
package org.openecomp.mso.bpmn.common.scripts
-import org.camunda.bpm.engine.runtime.Execution
+import org.camunda.bpm.engine.delegate.DelegateExecution
import org.openecomp.mso.bpmn.core.RollbackData
import org.openecomp.mso.bpmn.core.WorkflowException
import org.openecomp.mso.rest.APIResponse
@@ -30,7 +30,7 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
def Prefix="CAAIVfMod_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
- public void initProcessVariables(Execution execution) {
+ public void initProcessVariables(DelegateExecution execution) {
execution.setVariable("prefix",Prefix)
execution.setVariable("CAAIVfMod_vnfId",null)
execution.setVariable("CAAIVfMod_vnfName",null)
@@ -73,8 +73,8 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
}
// parse the incoming CREATE_VF_MODULE request and store the Generic VNF
- // and VF Module data in the flow Execution
- public void preProcessRequest(Execution execution) {
+ // and VF Module data in the flow DelegateExecution
+ public void preProcessRequest(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
initProcessVariables(execution)
@@ -180,7 +180,7 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
// send a GET request to AA&I to retrieve the Generic VNF/VF Module information based on a Vnf Name
// expect a 200 response with the information in the response body or a 404 if the Generic VNF does not exist
- public void queryAAIForGenericVnf(Execution execution) {
+ public void queryAAIForGenericVnf(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
def endPoint = execution.getVariable("URN_aai_endpoint") + execution.getVariable("CAAIVfMod_genericVnfGetEndpoint")
@@ -209,7 +209,7 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
// process the result from queryAAIForGenericVnf()
// note: this method is primarily for logging as the actual decision logic is embedded in the bpmn flow
- public void processAAIGenericVnfQuery(Execution execution) {
+ public void processAAIGenericVnfQuery(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
def result = execution.getVariable("CAAIVfMod_queryGenericVnfResponse")
@@ -236,7 +236,7 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
// construct and send a PUT request to A&AI to create a new Generic VNF
// note: to get here, the vnf-id in the original CREATE_VF_MODULE request was absent or ""
- public void createGenericVnf(Execution execution) {
+ public void createGenericVnf(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
// TBD - is this how we want to generate the Id for the new Generic VNF?
def newVnfId = UUID.randomUUID().toString()
@@ -287,7 +287,7 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
}
// construct and send a PUT request to A&AI to create a Base or Add-on VF Module
- public void createVfModule(Execution execution, Boolean isBaseModule) {
+ public void createVfModule(DelegateExecution execution, Boolean isBaseModule) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
// TBD - is this how we want to generate the Id for the new (Base) VF Module?
@@ -402,7 +402,7 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
// parses the output from the result from queryAAIForGenericVnf() to determine if the vf-module-name
// requested for an Add-on VF Module does not already exist for the specified Generic VNF
// also retrieves VNF name from AAI response for existing VNF
- public void parseForAddOnModule(Execution execution) {
+ public void parseForAddOnModule(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
def xml = execution.getVariable("CAAIVfMod_queryGenericVnfResponse")
def vnfNameFromAAI = utils.getNodeText1(xml, "vnf-name")
@@ -439,7 +439,7 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
// parses the output from the result from queryAAIForGenericVnf() to determine if the vf-module-name
// requested for an Add-on VF Module does not already exist for the specified Generic VNF;
// also retrieves VNF name from AAI response for existing VNF
- public void parseForBaseModule(Execution execution) {
+ public void parseForBaseModule(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
def xml = execution.getVariable("CAAIVfMod_queryGenericVnfResponse")
def vnfNameFromAAI = utils.getNodeText1(xml, "vnf-name")
@@ -491,7 +491,7 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
}
// generates a WorkflowException when the A&AI query returns a response code other than 200 or 404
- public void handleAAIQueryFailure(Execution execution) {
+ public void handleAAIQueryFailure(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
utils.log("ERROR", "Error occurred attempting to query AAI, Response Code " +
@@ -508,7 +508,7 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
// - the requested Generic VNF does not exist but vnf-id != null
// - the A&AI VF Module PUT returns a response code other than 200 or 201
// - the requested VF Module already exists for the Generic VNF
- public void handleCreateVfModuleFailure(Execution execution) {
+ public void handleCreateVfModuleFailure(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
def errorCode
@@ -563,7 +563,7 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
* main CreateVfModule flow.
* @param execution the execution
*/
- public void rollback(Execution execution) {
+ public void rollback(DelegateExecution execution) {
def method = getClass().getSimpleName() + ".rollback(" +
"execution=" + execution.getId() +
")"
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy
index a15a86d566..5edf391bb4 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CreateAAIVfModuleVolumeGroup.groovy
@@ -21,7 +21,7 @@
package org.openecomp.mso.bpmn.common.scripts
import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.runtime.Execution
+import org.camunda.bpm.engine.delegate.DelegateExecution
import org.openecomp.mso.rest.APIResponse
@@ -35,7 +35,7 @@ public class CreateAAIVfModuleVolumeGroup extends AbstractServiceTaskProcessor {
*
* @param execution The flow's execution instance.
*/
- public void initProcessVariables(Execution execution) {
+ public void initProcessVariables(DelegateExecution execution) {
execution.setVariable('prefix', 'CAAIVfModVG_')
execution.setVariable('CAAIVfModVG_vnfId', null)
execution.setVariable('CAAIVfModVG_vfModuleId', null)
@@ -52,7 +52,7 @@ public class CreateAAIVfModuleVolumeGroup extends AbstractServiceTaskProcessor {
*
* @param execution The flow's execution instance.
*/
- public void preProcessRequest(Execution execution) {
+ public void preProcessRequest(DelegateExecution execution) {
def method = getClass().getSimpleName() + '.preProcessRequest(' +
'execution=' + execution.getId() +
')'
@@ -93,7 +93,7 @@ public class CreateAAIVfModuleVolumeGroup extends AbstractServiceTaskProcessor {
*
* @param execution The flow's execution instance.
*/
- public void getVfModule(Execution execution) {
+ public void getVfModule(DelegateExecution execution) {
def method = getClass().getSimpleName() + '.getVfModule(' +
'execution=' + execution.getId() +
')'
@@ -143,7 +143,7 @@ public class CreateAAIVfModuleVolumeGroup extends AbstractServiceTaskProcessor {
*
* @param execution The flow's execution instance.
*/
- public void updateVfModule(Execution execution) {
+ public void updateVfModule(DelegateExecution execution) {
def method = getClass().getSimpleName() + '.updateVfModule(' +
'execution=' + execution.getId() +
')'
@@ -295,7 +295,7 @@ public class CreateAAIVfModuleVolumeGroup extends AbstractServiceTaskProcessor {
*
* @param execution The flow's execution instance.
*/
- public void handleAAIQueryFailure(Execution execution) {
+ public void handleAAIQueryFailure(DelegateExecution execution) {
def method = getClass().getSimpleName() + '.handleAAIQueryFailure(' +
'execution=' + execution.getId() +
')'
@@ -316,7 +316,7 @@ public class CreateAAIVfModuleVolumeGroup extends AbstractServiceTaskProcessor {
*
* @param execution The flow's execution instance.
*/
- public void handleUpdateVfModuleFailure(Execution execution) {
+ public void handleUpdateVfModuleFailure(DelegateExecution execution) {
def method = getClass().getSimpleName() + '.handleUpdateVfModuleFailure(' +
'execution=' + execution.getId() +
')'
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CustomE2EGetService.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CustomE2EGetService.groovy
index af2da67439..86b35853ba 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CustomE2EGetService.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CustomE2EGetService.groovy
@@ -25,7 +25,7 @@ import static org.apache.commons.lang3.StringUtils.*
import org.apache.commons.lang3.*
import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.runtime.Execution
+import org.camunda.bpm.engine.delegate.DelegateExecution
import org.openecomp.mso.rest.APIResponse
import org.springframework.web.util.UriUtils
@@ -102,7 +102,7 @@ class CustomE2EGetService extends AbstractServiceTaskProcessor{
* @param - execution
*
*/
- public void preProcessRequest(Execution execution) {
+ public void preProcessRequest(DelegateExecution execution) {
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
utils.log("DEBUG", " *** STARTED GenericGetService PreProcessRequest Process*** ", isDebugEnabled)
@@ -188,7 +188,7 @@ class CustomE2EGetService extends AbstractServiceTaskProcessor{
*
* @param - execution
*/
- public void obtainServiceInstanceUrlById(Execution execution){
+ public void obtainServiceInstanceUrlById(DelegateExecution execution){
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
utils.log("DEBUG", " *** STARTED GenericGetService ObtainServiceInstanceUrlById Process*** ", isDebugEnabled)
@@ -270,7 +270,7 @@ class CustomE2EGetService extends AbstractServiceTaskProcessor{
*
* @param - execution
*/
- public void obtainServiceInstanceUrlByName(Execution execution){
+ public void obtainServiceInstanceUrlByName(DelegateExecution execution){
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
utils.log("DEBUG", " *** STARTED GenericGetService ObtainServiceInstanceUrlByName Process*** ", isDebugEnabled)
@@ -338,7 +338,7 @@ class CustomE2EGetService extends AbstractServiceTaskProcessor{
*
* @param - execution
*/
- public void getServiceObject(Execution execution){
+ public void getServiceObject(DelegateExecution execution){
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
utils.log("DEBUG", " *** STARTED GenericGetService GetServiceObject Process*** ", isDebugEnabled)
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CustomE2EPutService.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CustomE2EPutService.groovy
index 946ba1aaa0..2c42ef03b3 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CustomE2EPutService.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CustomE2EPutService.groovy
@@ -23,7 +23,7 @@ package org.openecomp.mso.bpmn.common.scripts
import static org.apache.commons.lang3.StringUtils.*;
import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.runtime.Execution;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.apache.commons.codec.binary.Base64
import org.apache.commons.lang3.*
@@ -78,7 +78,7 @@ class CustomE2EPutService extends AbstractServiceTaskProcessor{
ExceptionUtil exceptionUtil = new ExceptionUtil()
- public void preProcessRequest(Execution execution) {
+ public void preProcessRequest(DelegateExecution execution) {
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
utils.log("DEBUG", " *** STARTED GenericPutService PreProcessRequest Process*** ", isDebugEnabled)
@@ -174,7 +174,7 @@ class CustomE2EPutService extends AbstractServiceTaskProcessor{
* @param - execution
*
*/
- public void putServiceInstance(Execution execution){
+ public void putServiceInstance(DelegateExecution execution){
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
utils.log("DEBUG", " *** STARTED GenericPutService PutServiceInstance method*** ", isDebugEnabled)
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/DecomposeService.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/DecomposeService.groovy
index 8d855e9311..7a81ce519e 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/DecomposeService.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/DecomposeService.groovy
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -26,7 +26,7 @@ import static org.apache.commons.lang3.StringUtils.*;
import org.apache.commons.lang3.*
import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.runtime.Execution
+import org.camunda.bpm.engine.delegate.DelegateExecution
import org.json.JSONObject;
import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.openecomp.mso.bpmn.common.scripts.CatalogDbUtils
@@ -64,7 +64,7 @@ public class DecomposeService extends AbstractServiceTaskProcessor {
CatalogDbUtils catalogDbUtils = new CatalogDbUtils()
JsonUtils jsonUtils = new JsonUtils()
- public void preProcessRequest (Execution execution) {
+ public void preProcessRequest (DelegateExecution execution) {
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
String msg = ""
utils.log("DEBUG"," ***** preProcessRequest of DecomposeService *****", isDebugEnabled)
@@ -76,7 +76,13 @@ public class DecomposeService extends AbstractServiceTaskProcessor {
String requestId = execution.getVariable("msoRequestId")
String serviceInstanceId = execution.getVariable("serviceInstanceId")
String serviceModelInfo = execution.getVariable("serviceModelInfo")
- execution.setVariable("DDS_serviceModelInvariantId", jsonUtils.getJsonValue(serviceModelInfo, "modelInvariantUuid"))
+ String invariantId
+ if(jsonUtils.jsonElementExist(serviceModelInfo, "modelInvariantUuid")){
+ invariantId = jsonUtils.getJsonValue(serviceModelInfo, "modelInvariantUuid")
+ }else if(jsonUtils.jsonElementExist(serviceModelInfo, "modelInvariantId")){
+ invariantId = jsonUtils.getJsonValue(serviceModelInfo, "modelInvariantId")
+ }
+ execution.setVariable("DDS_serviceModelInvariantId", invariantId)
execution.setVariable("DDS_serviceModelUuid", jsonUtils.getJsonValue(serviceModelInfo, "modelUuid"))
execution.setVariable("DDS_modelVersion", jsonUtils.getJsonValue(serviceModelInfo, "modelVersion"))
} catch (BpmnError e) {
@@ -89,7 +95,7 @@ public class DecomposeService extends AbstractServiceTaskProcessor {
utils.log("DEBUG"," ***** Exit preProcessRequest of DecomposeService *****", isDebugEnabled)
}
- public void queryCatalogDb (Execution execution) {
+ public void queryCatalogDb (DelegateExecution execution) {
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
String msg = ""
utils.log("DEBUG"," ***** queryCatalogDB of DecomposeService *****", isDebugEnabled)
@@ -111,6 +117,13 @@ public class DecomposeService extends AbstractServiceTaskProcessor {
catalogDbResponse = catalogDbUtils.getServiceResourcesByServiceModelInvariantUuidAndServiceModelVersion(execution, serviceModelInvariantId, modelVersion, "v2")
else
catalogDbResponse = catalogDbUtils.getServiceResourcesByServiceModelInvariantUuid(execution, serviceModelInvariantId, "v2")
+
+ if (catalogDbResponse == null || catalogDbResponse.toString().equalsIgnoreCase("null")) {
+ msg = "No data found in Catalog DB"
+ utils.log("DEBUG", msg, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+
String catalogDbResponseString = catalogDbResponse.toString()
execution.setVariable("DDS_catalogDbResponse", catalogDbResponseString)
@@ -128,7 +141,7 @@ public class DecomposeService extends AbstractServiceTaskProcessor {
- public void actuallyDecomposeService (Execution execution) {
+ public void actuallyDecomposeService (DelegateExecution execution) {
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
String msg = ""
utils.log("DEBUG"," ***** actuallyDecomposeService of DecomposeService *****", isDebugEnabled)
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/DeleteAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/DeleteAAIVfModule.groovy
index 63f12dd9cb..54e3da54d2 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/DeleteAAIVfModule.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/DeleteAAIVfModule.groovy
@@ -19,7 +19,7 @@
*/
package org.openecomp.mso.bpmn.common.scripts
-import org.camunda.bpm.engine.runtime.Execution
+import org.camunda.bpm.engine.delegate.DelegateExecution
import org.openecomp.mso.bpmn.core.WorkflowException
import org.openecomp.mso.rest.APIResponse
import org.openecomp.mso.rest.RESTClient;
@@ -31,7 +31,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
def Prefix="DAAIVfMod_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
private MsoUtils utils = new MsoUtils()
- public void initProcessVariables(Execution execution) {
+ public void initProcessVariables(DelegateExecution execution) {
execution.setVariable("prefix",Prefix)
execution.setVariable("DAAIVfMod_vnfId",null)
execution.setVariable("DAAIVfMod_vnfName",null)
@@ -56,8 +56,8 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
}
// parse the incoming DELETE_VF_MODULE request and store the Generic Vnf
- // and Vf Module Ids in the flow Execution
- public void preProcessRequest(Execution execution) {
+ // and Vf Module Ids in the flow DelegateExecution
+ public void preProcessRequest(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
def xml = execution.getVariable("DeleteAAIVfModuleRequest")
utils.logAudit("DeleteAAIVfModule Request: " + xml)
@@ -79,7 +79,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
// send a GET request to AA&I to retrieve the Generic Vnf/Vf Module information based on a Vnf Id
// expect a 200 response with the information in the response body or a 404 if the Generic Vnf does not exist
- public void queryAAIForGenericVnf(Execution execution) {
+ public void queryAAIForGenericVnf(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
def delModuleId = execution.getVariable("DAAIVfMod_vfModuleId")
def endPoint = execution.getVariable("URN_aai_endpoint") + execution.getVariable("DAAIVfMod_genericVnfEndpoint") + "?depth=1"
@@ -117,7 +117,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
// construct and send a DELETE request to A&AI to delete a Generic Vnf
// note: to get here, all the modules associated with the Generic Vnf must already be deleted
- public void deleteGenericVnf(Execution execution) {
+ public void deleteGenericVnf(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
def aaiRequestId = utils.getRequestID()
def endPoint = execution.getVariable("URN_aai_endpoint") + execution.getVariable("DAAIVfMod_genericVnfEndpoint") +
@@ -150,7 +150,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
}
// construct and send a DELETE request to A&AI to delete the Base or Add-on Vf Module
- public void deleteVfModule(Execution execution) {
+ public void deleteVfModule(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
def endPoint = execution.getVariable("URN_aai_endpoint") + execution.getVariable("DAAIVfMod_vfModuleEndpoint") +
"/?resource-version=" + execution.getVariable("DAAIVfMod_vfModRsrcVer")
@@ -189,7 +189,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
// parses the output from the result from queryAAIForGenericVnf() to determine if the Vf Module
// to be deleted exists for the specified Generic Vnf and if it is the Base Module,
// there are no Add-on Modules present
- public void parseForVfModule(Execution execution) {
+ public void parseForVfModule(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
def xml = execution.getVariable("DAAIVfMod_queryGenericVnfResponse")
utils.logAudit("DeleteAAIVfModule - queryGenericVnfResponse" + xml)
@@ -270,7 +270,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
// parses the output from the result from queryAAIForGenericVnf() to determine if the Vf Module
// to be deleted exists for the specified Generic Vnf and if it is the Base Module,
// there are no Add-on Modules present
- public void parseForResourceVersion(Execution execution) {
+ public void parseForResourceVersion(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
def xml = execution.getVariable("DAAIVfMod_queryGenericVnfResponse")
utils.logAudit("DeleteAAIVfModule - queryGenericVnfResponse" + xml)
@@ -281,7 +281,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
// generates a WorkflowException if the A&AI query returns a response code other than 200
- public void handleAAIQueryFailure(Execution execution) {
+ public void handleAAIQueryFailure(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
utils.log("ERROR", "Error occurred attempting to query AAI, Response Code " +
@@ -300,7 +300,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
// - the A&AI Vf Module DELETE returns a response code other than 200
// - the Vf Module is a Base Module that is not the last Vf Module
// - the Vf Module does not exist for the Generic Vnf
- public void handleDeleteVfModuleFailure(Execution execution) {
+ public void handleDeleteVfModuleFailure(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
def errorCode = 2000
@@ -341,7 +341,7 @@ public class DeleteAAIVfModule extends AbstractServiceTaskProcessor{
// generates a WorkflowException if
// - the A&AI Generic Vnf DELETE returns a response code other than 200
- public void handleDeleteGenericVnfFailure(Execution execution) {
+ public void handleDeleteGenericVnfFailure(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
utils.log("ERROR", "AAI error occurred deleting the Generic Vnf: "
+ execution.getVariable("DAAIVfMod_deleteGenericVnfResponse"), isDebugEnabled)
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ExceptionUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ExceptionUtil.groovy
index 121e0c8ccb..b65ce74c70 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ExceptionUtil.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ExceptionUtil.groovy
@@ -22,9 +22,11 @@ package org.openecomp.mso.bpmn.common.scripts
import static org.apache.commons.lang3.StringUtils.*
+import com.google.common.xml.XmlEscapers
+
import org.apache.commons.lang3.*
import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.runtime.Execution
+import org.camunda.bpm.engine.delegate.DelegateExecution
import org.openecomp.mso.bpmn.core.WorkflowException
/**
@@ -44,7 +46,7 @@ class ExceptionUtil extends AbstractServiceTaskProcessor {
* @param execution the execution
* @param response the aai exception
*/
- WorkflowException MapAAIExceptionToWorkflowException(String response, Execution execution)
+ WorkflowException MapAAIExceptionToWorkflowException(String response, DelegateExecution execution)
{
def utils=new MsoUtils()
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
@@ -116,7 +118,7 @@ class ExceptionUtil extends AbstractServiceTaskProcessor {
* @param execution the execution
* @param response the aai exception
*/
- WorkflowException MapAAIExceptionToWorkflowExceptionGeneric(Execution execution, String response, int resCode){
+ WorkflowException MapAAIExceptionToWorkflowExceptionGeneric(DelegateExecution execution, String response, int resCode){
def utils=new MsoUtils()
def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled")
utils.log("DEBUG", "Start MapAAIExceptionToWorkflowExceptionGeneric Process", isDebugLogEnabled)
@@ -159,7 +161,7 @@ class ExceptionUtil extends AbstractServiceTaskProcessor {
String buildErrorResponseXml(WorkflowException wfex) {
String xml
if(wfex != null){
- String mes = wfex.getErrorMessage()
+ String mes = XmlEscapers.xmlContentEscaper().escape(wfex.getErrorMessage())
int code = wfex.getErrorCode()
xml =
"""<aetgt:WorkflowException xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1">
@@ -221,12 +223,11 @@ class ExceptionUtil extends AbstractServiceTaskProcessor {
errorMessage=""
}
if( errorCode.equals('5010')){
- return 'Could not communicate with A&amp;AI'
+ return 'Could not communicate with A&AI'
}else if (errorCode.equals('5020')){
- return 'No response from A&amp;AI'
+ return 'No response from A&AI'
}else{
- errorMessage = errorMessage.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;")
- return 'Received error from A&amp;AI (' +errorMessage +')'
+ return 'Received error from A&AI (' +errorMessage +')'
}
}
@@ -261,7 +262,7 @@ class ExceptionUtil extends AbstractServiceTaskProcessor {
* @param errorCode the error code
* @param errorMessage the error message
*/
- public void buildWorkflowException(Execution execution, int errorCode, String errorMessage) {
+ public void buildWorkflowException(DelegateExecution execution, int errorCode, String errorMessage) {
MsoUtils utils = new MsoUtils()
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
String processKey = getProcessKey(execution);
@@ -281,7 +282,7 @@ class ExceptionUtil extends AbstractServiceTaskProcessor {
* @param errorCode the error code
* @param errorMessage the error message
*/
- public void buildAndThrowWorkflowException(Execution execution, int errorCode, String errorMessage) {
+ public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, String errorMessage) {
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
String processKey = getProcessKey(execution);
utils.log("Building a WorkflowException for Subflow " + processKey, isDebugLogEnabled)
@@ -302,7 +303,7 @@ class ExceptionUtil extends AbstractServiceTaskProcessor {
* @param - execution
*
*/
- public void processSubflowsBPMNException(Execution execution){
+ public void processSubflowsBPMNException(DelegateExecution execution){
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
String processKey = getProcessKey(execution)
try{
@@ -329,7 +330,7 @@ class ExceptionUtil extends AbstractServiceTaskProcessor {
* @return - falloutHandlerRequest
*
*/
- public String processMainflowsBPMNException(Execution execution, String requestInfo){
+ public String processMainflowsBPMNException(DelegateExecution execution, String requestInfo){
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
String processKey = getProcessKey(execution)
try{
@@ -339,7 +340,7 @@ class ExceptionUtil extends AbstractServiceTaskProcessor {
}
requestInfo = utils.removeXmlPreamble(requestInfo)
WorkflowException wfex = execution.getVariable("WorkflowException")
- String errorMessage = wfex.getErrorMessage()
+ String errorMessage = XmlEscapers.xmlContentEscaper().escape(wfex.getErrorMessage())
int errorCode = wfex.getErrorCode()
String falloutHandlerRequest =
@@ -354,13 +355,14 @@ class ExceptionUtil extends AbstractServiceTaskProcessor {
</aetgt:FalloutHandlerRequest>"""
utils.log("DEBUG", processKey + " Outgoing WorkflowException is: " + execution.getVariable("WorkflowException"), isDebugEnabled)
- utils.log("DEBUG", processKey + "Completed ProcessMainflowBPMNException Outgoing FalloutHandler Request is: " + falloutHandlerRequest, isDebugEnabled)
+ utils.log("DEBUG", processKey + " Outgoing FalloutHandler Request is: " + falloutHandlerRequest, isDebugEnabled)
return falloutHandlerRequest
}catch(Exception e){
utils.log("DEBUG", "Caught Exception during ProcessMainflowBPMNException Method: " + e, isDebugEnabled)
return null
}
+ utils.log("DEBUG", "Completed ProcessMainflowBPMNException Method", isDebugEnabled)
}
/**
@@ -371,7 +373,7 @@ class ExceptionUtil extends AbstractServiceTaskProcessor {
* @param - execution
*
*/
- public void processJavaException(Execution execution){
+ public void processJavaException(DelegateExecution execution){
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
String processKey = getProcessKey(execution)
try{
@@ -389,7 +391,7 @@ class ExceptionUtil extends AbstractServiceTaskProcessor {
}
- public void preProcessRequest(Execution execution) {
+ public void preProcessRequest(DelegateExecution execution) {
// TODO Auto-generated method stub
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/FalloutHandler.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/FalloutHandler.groovy
index 8237fcfd11..0356397eaa 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/FalloutHandler.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/FalloutHandler.groovy
@@ -23,13 +23,13 @@ package org.openecomp.mso.bpmn.common.scripts
import java.text.SimpleDateFormat
import org.apache.commons.lang3.*
-import org.camunda.bpm.engine.runtime.Execution
+import org.camunda.bpm.engine.delegate.DelegateExecution
public class FalloutHandler extends AbstractServiceTaskProcessor {
String Prefix="FH_"
ExceptionUtil exceptionUtil = new ExceptionUtil()
- public initializeProcessVariables(Execution execution){
+ public initializeProcessVariables(DelegateExecution execution){
def method = getClass().getSimpleName() + '.initializeProcessVariables(' +'execution=' + execution.getId() +')'
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
logDebug('Entered ' + method, isDebugLogEnabled)
@@ -93,7 +93,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor {
}
}
- public void preProcessRequest (Execution execution) {
+ public void preProcessRequest (DelegateExecution execution) {
def method = getClass().getSimpleName() + '.preProcessRequest(' +'execution=' + execution.getId() +')'
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
logDebug('Entered ' + method, isDebugLogEnabled)
@@ -207,7 +207,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor {
utils.log("DEBUG","OUTOF --> Initialize Variables Fallout Handler #########",isDebugLogEnabled);
}
- public String updateRequestPayload (Execution execution){
+ public String updateRequestPayload (DelegateExecution execution){
def method = getClass().getSimpleName() + '.updateRequestPayload(' +'execution=' + execution.getId() +')'
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
logDebug('Entered ' + method, isDebugLogEnabled)
@@ -238,7 +238,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor {
}
}
- public String updateRequestInfraPayload (Execution execution){
+ public String updateRequestInfraPayload (DelegateExecution execution){
def method = getClass().getSimpleName() + '.updateRequestInfraPayload(' +'execution=' + execution.getId() +')'
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
logDebug('Entered ' + method, isDebugLogEnabled)
@@ -268,7 +268,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor {
}
}
- public String updateRequestGammaPayload (Execution execution){
+ public String updateRequestGammaPayload (DelegateExecution execution){
def method = getClass().getSimpleName() + '.updateRequestGammaPayload(' +'execution=' + execution.getId() +')'
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
logDebug('Entered ' + method, isDebugLogEnabled)
@@ -298,7 +298,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor {
}
}
- public String updateResponseStatusPayload (Execution execution){
+ public String updateResponseStatusPayload (DelegateExecution execution){
def method = getClass().getSimpleName() + '.updateResponseStatusPayload(' +'execution=' + execution.getId() +')'
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
logDebug('Entered ' + method, isDebugLogEnabled)
@@ -326,7 +326,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor {
}
}
- public void buildDBWorkflowException(Execution execution, String responseCodeVariable) {
+ public void buildDBWorkflowException(DelegateExecution execution, String responseCodeVariable) {
def method = getClass().getSimpleName() + '.buildDBWorkflowException(' +
'execution=' + execution.getId() +
', responseCodeVariable=' + responseCodeVariable + ')'
@@ -348,7 +348,7 @@ public class FalloutHandler extends AbstractServiceTaskProcessor {
/**
* Used to create a workflow response in success and failure cases.
*/
- public void postProcessResponse (Execution execution) {
+ public void postProcessResponse (DelegateExecution execution) {
def method = getClass().getSimpleName() + '.postProcessResponse(' +'execution=' + execution.getId() +')'
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
logDebug('Entered ' + method, isDebugLogEnabled)
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenerateVfModuleName.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenerateVfModuleName.groovy
index 9fbc7b35e0..95c258f2a4 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenerateVfModuleName.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenerateVfModuleName.groovy
@@ -21,7 +21,7 @@ package org.openecomp.mso.bpmn.common.scripts
import java.io.Serializable;
import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.runtime.Execution
+import org.camunda.bpm.engine.delegate.DelegateExecution
import org.springframework.web.util.UriUtils
import org.openecomp.mso.bpmn.core.json.JsonUtils
@@ -37,7 +37,7 @@ public class GenerateVfModuleName extends AbstractServiceTaskProcessor{
- public void preProcessRequest(Execution execution) {
+ public void preProcessRequest(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
try {
@@ -58,7 +58,7 @@ public class GenerateVfModuleName extends AbstractServiceTaskProcessor{
}
- public void queryAAI(Execution execution) {
+ public void queryAAI(DelegateExecution execution) {
def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled")
def method = getClass().getSimpleName() + '.queryAAI(' +
'execution=' + execution.getId() +
@@ -150,7 +150,7 @@ public class GenerateVfModuleName extends AbstractServiceTaskProcessor{
}
- public void generateName (Execution execution) {
+ public void generateName (DelegateExecution execution) {
def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled")
def method = getClass().getSimpleName() + '.generateName() ' +
'execution=' + execution.getId() +
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericDeleteService.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericDeleteService.groovy
index 6dd27b292f..8d9defdb86 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericDeleteService.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericDeleteService.groovy
@@ -24,7 +24,7 @@ import static org.apache.commons.lang3.StringUtils.*
import org.apache.commons.lang3.*
import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.runtime.Execution
+import org.camunda.bpm.engine.delegate.DelegateExecution
import org.openecomp.mso.rest.APIResponse
import org.springframework.web.util.UriUtils
@@ -85,7 +85,7 @@ class GenericDeleteService extends AbstractServiceTaskProcessor{
*
* @param - execution
*/
- public void preProcessRequest(Execution execution) {
+ public void preProcessRequest(DelegateExecution execution) {
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
utils.log("DEBUG", " *** STARTED GenericDeleteService PreProcessRequest Process*** ", isDebugEnabled)
@@ -153,7 +153,7 @@ class GenericDeleteService extends AbstractServiceTaskProcessor{
*
* @param - execution
*/
- public void getServiceResourceVersion(Execution execution){
+ public void getServiceResourceVersion(DelegateExecution execution){
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
utils.log("DEBUG", " *** STARTED GenericDeleteService GetServiceResourceVersion Process*** ", isDebugEnabled)
@@ -193,6 +193,7 @@ class GenericDeleteService extends AbstractServiceTaskProcessor{
String aaiResponse = response.getResponseBodyAsString()
aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse)
+ aaiResponse = aaiResponse.replaceAll("&", "&amp;")
execution.setVariable("GENDS_getServiceResponse", aaiResponse)
utils.logAudit("GET Service Instance response : " + aaiResponse)
@@ -231,7 +232,7 @@ class GenericDeleteService extends AbstractServiceTaskProcessor{
*
* @param - execution
*/
- public void deleteServiceObject(Execution execution){
+ public void deleteServiceObject(DelegateExecution execution){
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
utils.log("DEBUG", " *** STARTED GenericDeleteService DeleteServiceObject Process*** ", isDebugEnabled)
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericDeleteVnf.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericDeleteVnf.groovy
index ea7365c192..d6a49d9f51 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericDeleteVnf.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericDeleteVnf.groovy
@@ -24,7 +24,7 @@ import static org.apache.commons.lang3.StringUtils.*
import org.apache.commons.lang3.*
import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.runtime.Execution
+import org.camunda.bpm.engine.delegate.DelegateExecution
import org.openecomp.mso.rest.APIResponse
import org.springframework.web.util.UriUtils
@@ -84,7 +84,7 @@ class GenericDeleteVnf extends AbstractServiceTaskProcessor{
*
* @param - execution
*/
- public void preProcessRequest(Execution execution) {
+ public void preProcessRequest(DelegateExecution execution) {
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
utils.log("DEBUG", " *** STARTED GenericDeleteVnf PreProcessRequest Process*** ", isDebugEnabled)
@@ -130,7 +130,7 @@ class GenericDeleteVnf extends AbstractServiceTaskProcessor{
*
* @param - execution
*/
- public void getVnfResourceVersion(Execution execution){
+ public void getVnfResourceVersion(DelegateExecution execution){
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
utils.log("DEBUG", " *** STARTED GenericDeleteVnf GetVnfResourceVersion Process*** ", isDebugEnabled)
@@ -208,7 +208,7 @@ class GenericDeleteVnf extends AbstractServiceTaskProcessor{
*
* @param - execution
*/
- public void deleteVnf(Execution execution){
+ public void deleteVnf(DelegateExecution execution){
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
utils.log("DEBUG", " *** STARTED GenericDeleteVnf DeleteVnf Process*** ", isDebugEnabled)
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericGetService.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericGetService.groovy
index cfc5171dca..3b380a9164 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericGetService.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericGetService.groovy
@@ -22,7 +22,7 @@ package org.openecomp.mso.bpmn.common.scripts
import org.apache.commons.lang3.StringEscapeUtils
import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.runtime.Execution
+import org.camunda.bpm.engine.delegate.DelegateExecution
import org.openecomp.mso.rest.APIResponse
import org.springframework.web.util.UriUtils
@@ -101,7 +101,7 @@ class GenericGetService extends AbstractServiceTaskProcessor{
* @param - execution
*
*/
- public void preProcessRequest(Execution execution) {
+ public void preProcessRequest(DelegateExecution execution) {
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
utils.log("DEBUG", " *** STARTED GenericGetService PreProcessRequest Process*** ", isDebugEnabled)
@@ -187,7 +187,7 @@ class GenericGetService extends AbstractServiceTaskProcessor{
*
* @param - execution
*/
- public void obtainServiceInstanceUrlById(Execution execution){
+ public void obtainServiceInstanceUrlById(DelegateExecution execution){
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
utils.log("DEBUG", " *** STARTED GenericGetService ObtainServiceInstanceUrlById Process*** ", isDebugEnabled)
@@ -269,7 +269,7 @@ class GenericGetService extends AbstractServiceTaskProcessor{
*
* @param - execution
*/
- public void obtainServiceInstanceUrlByName(Execution execution){
+ public void obtainServiceInstanceUrlByName(DelegateExecution execution){
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
utils.log("DEBUG", " *** STARTED GenericGetService ObtainServiceInstanceUrlByName Process*** ", isDebugEnabled)
@@ -339,7 +339,7 @@ class GenericGetService extends AbstractServiceTaskProcessor{
*
* @param - execution
*/
- public void getServiceObject(Execution execution){
+ public void getServiceObject(DelegateExecution execution){
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
utils.log("DEBUG", " *** STARTED GenericGetService GetServiceObject Process*** ", isDebugEnabled)
@@ -410,6 +410,7 @@ class GenericGetService extends AbstractServiceTaskProcessor{
aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse)
execution.setVariable("GENGS_getServiceResponse", aaiResponse)
utils.logAudit("GenericGetService AAI Response: " + aaiResponse)
+ aaiResponse = aaiResponse.replaceAll("&", "&amp;")
//Process Response
if(responseCode == 200 || responseCode == 202){
utils.log("DEBUG", "GET Service Received a Good Response Code", isDebugEnabled)
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericGetVnf.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericGetVnf.groovy
index 3192971f9b..1e181a6ee9 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericGetVnf.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericGetVnf.groovy
@@ -24,7 +24,7 @@ import static org.openecomp.mso.bpmn.common.scripts.GenericUtils.*;
import org.apache.commons.lang3.*
import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.runtime.Execution
+import org.camunda.bpm.engine.delegate.DelegateExecution
import org.openecomp.mso.rest.APIResponse
import org.springframework.web.util.UriUtils
@@ -84,7 +84,7 @@ class GenericGetVnf extends AbstractServiceTaskProcessor{
*
* @param - execution
*/
- public void preProcessRequest(Execution execution) {
+ public void preProcessRequest(DelegateExecution execution) {
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
utils.log("DEBUG", " *** STARTED GenericGetVnf PreProcessRequest Process*** ", isDebugEnabled)
@@ -126,7 +126,7 @@ class GenericGetVnf extends AbstractServiceTaskProcessor{
*
* @param - execution
*/
- public void getVnfByName(Execution execution){
+ public void getVnfByName(DelegateExecution execution){
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
utils.log("DEBUG", " *** STARTED GenericGetVnf GetVnfByName Process*** ", isDebugEnabled)
@@ -199,7 +199,7 @@ class GenericGetVnf extends AbstractServiceTaskProcessor{
*
* @param - execution
*/
- public void getVnfById(Execution execution){
+ public void getVnfById(DelegateExecution execution){
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
utils.log("DEBUG", " *** STARTED GenericGetVnf GetVnfById Process*** ", isDebugEnabled)
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericNotificationService.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericNotificationService.groovy
index 62d476d294..7f3b41d6ec 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericNotificationService.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericNotificationService.groovy
@@ -1,7 +1,7 @@
package org.openecomp.mso.bpmn.common.scripts
import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.runtime.Execution
+import org.camunda.bpm.engine.delegate.DelegateExecution
import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil
import org.openecomp.mso.bpmn.core.WorkflowException
@@ -14,7 +14,7 @@ public class GenericNotificationService extends AbstractServiceTaskProcessor {
ExceptionUtil exceptionUtil = new ExceptionUtil()
- public void preProcessRequest (Execution execution) {
+ public void preProcessRequest (DelegateExecution execution) {
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericPutService.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericPutService.groovy
index cfe662f74c..d1b733aecb 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericPutService.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericPutService.groovy
@@ -22,7 +22,7 @@ package org.openecomp.mso.bpmn.common.scripts
import static org.apache.commons.lang3.StringUtils.*;
import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.runtime.Execution;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.apache.commons.codec.binary.Base64
import org.apache.commons.lang3.*
@@ -77,7 +77,8 @@ class GenericPutService extends AbstractServiceTaskProcessor{
ExceptionUtil exceptionUtil = new ExceptionUtil()
- public void preProcessRequest(Execution execution) {
+ public void preProcessRequest(DelegateExecution execution) {
+ execution.setVariable("isDebugLogEnabled","true")
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
utils.log("DEBUG", " *** STARTED GenericPutService PreProcessRequest Process*** ", isDebugEnabled)
@@ -95,7 +96,7 @@ class GenericPutService extends AbstractServiceTaskProcessor{
String allottedResourceId = execution.getVariable("GENPS_allottedResourceId")
String tunnelXconnectId = execution.getVariable("GENPS_tunnelXconnectId")
String type = execution.getVariable("GENPS_type")
-
+
if(type != null){
utils.log("DEBUG", "Incoming GENPS_type is: " + type, isDebugEnabled)
if(type.equalsIgnoreCase("service-instance")){
@@ -164,8 +165,6 @@ class GenericPutService extends AbstractServiceTaskProcessor{
}
-
-
/**
* This method executes a Put call to AAI for the provided
* service instance.
@@ -173,8 +172,8 @@ class GenericPutService extends AbstractServiceTaskProcessor{
* @param - execution
*
*/
- public void putServiceInstance(Execution execution){
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ public void putServiceInstance(DelegateExecution execution){
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
utils.log("DEBUG", " *** STARTED GenericPutService PutServiceInstance method*** ", isDebugEnabled)
try {
@@ -195,6 +194,7 @@ class GenericPutService extends AbstractServiceTaskProcessor{
String serviceType = execution.getVariable("GENPS_serviceType")
utils.log("DEBUG", " Incoming GENPS_serviceType is: " + serviceType, isDebugEnabled)
+
String globalSubscriberId = execution.getVariable("GENPS_globalSubscriberId")
utils.log("DEBUG", "Incoming Global Subscriber Id is: " + globalSubscriberId, isDebugEnabled)
@@ -241,7 +241,6 @@ class GenericPutService extends AbstractServiceTaskProcessor{
execution.setVariable("GENPS_putServiceInstanceAaiPath", serviceAaiPath)
utils.log("DEBUG", "PUT Service Instance AAI Path is: " + "\n" + serviceAaiPath, isDebugEnabled)
-
APIResponse response = aaiUriUtil.executeAAIPutCall(execution, serviceAaiPath, payload)
int responseCode = response.getStatusCode()
execution.setVariable("GENPS_putServiceInstanceResponseCode", responseCode)
@@ -251,7 +250,6 @@ class GenericPutService extends AbstractServiceTaskProcessor{
aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse)
execution.setVariable("GENPS_putServiceInstanceResponse", aaiResponse)
-
//Process Response
if(responseCode == 200 || responseCode == 201 || responseCode == 202 )
//200 OK 201 CREATED 202 ACCEPTED
@@ -275,6 +273,4 @@ class GenericPutService extends AbstractServiceTaskProcessor{
utils.log("DEBUG", " *** COMPLETED GenericPutService PutServiceInstance Process*** ", isDebugEnabled)
}
-
-
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericPutVnf.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericPutVnf.groovy
index 04f0ab7926..e814950b94 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericPutVnf.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericPutVnf.groovy
@@ -24,7 +24,7 @@ import static org.apache.commons.lang3.StringUtils.*
import org.apache.commons.lang3.*
import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.runtime.Execution
+import org.camunda.bpm.engine.delegate.DelegateExecution
import org.openecomp.mso.rest.APIResponse
import org.springframework.web.util.UriUtils
@@ -68,7 +68,7 @@ class GenericPutVnf extends AbstractServiceTaskProcessor{
*
* @param - execution
*/
- public void preProcessRequest(Execution execution) {
+ public void preProcessRequest(DelegateExecution execution) {
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
utils.log("DEBUG", " *** STARTED GenericPutVnf PreProcessRequest Process*** ", isDebugEnabled)
@@ -113,7 +113,7 @@ class GenericPutVnf extends AbstractServiceTaskProcessor{
*
* @param - execution
*/
- public void putVnf(Execution execution){
+ public void putVnf(DelegateExecution execution){
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
utils.log("DEBUG", " *** STARTED GenericPutVnf PutVnf Process*** ", isDebugEnabled)
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/Homing.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/Homing.groovy
index 0abab94597..2325e6c3d3 100755
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/Homing.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/Homing.groovy
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,7 +20,7 @@
package org.openecomp.mso.bpmn.common.scripts
import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.runtime.Execution
+import org.camunda.bpm.engine.delegate.DelegateExecution
import org.openecomp.mso.bpmn.common.scripts.AaiUtil
import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil
@@ -29,6 +29,7 @@ import org.openecomp.mso.bpmn.core.domain.InventoryType
import org.openecomp.mso.bpmn.core.domain.Resource
import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition
import org.openecomp.mso.bpmn.core.domain.Subscriber
+import org.openecomp.mso.bpmn.core.domain.VnfResource
import org.openecomp.mso.bpmn.core.json.JsonUtils
import org.openecomp.mso.rest.APIResponse
import org.openecomp.mso.rest.RESTClient
@@ -64,7 +65,7 @@ class Homing extends AbstractServiceTaskProcessor{
*
* @author cb645j
*/
- public void callSniro(Execution execution){
+ public void callSniro(DelegateExecution execution){
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix","HOME_")
utils.log("DEBUG", "*** Started Homing Call Sniro ***", isDebugEnabled)
@@ -139,16 +140,11 @@ class Homing extends AbstractServiceTaskProcessor{
utils.log("DEBUG", "Posting to Sniro Url: " + url, isDebugEnabled)
logDebug( "URL to be used is: " + url, isDebugEnabled)
-
- String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey"))
-
+
RESTConfig config = new RESTConfig(url);
RESTClient client = new RESTClient(config).addAuthorizationHeader(authHeader).addHeader("Content-Type", "application/json")
- if (basicAuthCred != null && !"".equals(basicAuthCred)) {
- client.addAuthorizationHeader(basicAuthCred)
- }
APIResponse response = client.httpPost(sniroRequest)
-
+
int responseCode = response.getStatusCode()
execution.setVariable("syncResponseCode", responseCode);
logDebug("SNIRO sync response code is: " + responseCode, isDebugEnabled)
@@ -165,7 +161,7 @@ class Homing extends AbstractServiceTaskProcessor{
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in Homing CallSniro: " + e.getMessage())
}
}
-
+
/**
* This method processes the callback response
* and the contained homing solution. It sets
@@ -176,7 +172,7 @@ class Homing extends AbstractServiceTaskProcessor{
*
* @author cb645j
*/
- public void processHomingSolution(Execution execution){
+ public void processHomingSolution(DelegateExecution execution){
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
utils.log("DEBUG", "*** Started Homing Process Homing Solution ***", isDebugEnabled)
try{
@@ -185,7 +181,7 @@ class Homing extends AbstractServiceTaskProcessor{
utils.logAudit("Sniro Async Callback Response is: " + response)
sniroUtils.validateCallbackResponse(execution, response)
- String placements = jsonUtil.getJsonValue(response, "solutionInfo.placement")
+ String placements = jsonUtil.getJsonValue(response, "solutionInfo.placementInfo")
ServiceDecomposition decomposition = execution.getVariable("serviceDecomposition")
utils.log("DEBUG", "Service Decomposition: " + decomposition, isDebugEnabled)
@@ -202,14 +198,17 @@ class Homing extends AbstractServiceTaskProcessor{
String inventoryType = placement.getString("inventoryType")
resource.getHomingSolution().setInventoryType(InventoryType.valueOf(inventoryType))
resource.getHomingSolution().setCloudRegionId(placement.getString("cloudRegionId"))
+ resource.getHomingSolution().setRehome(placement.getBoolean("isRehome"))
JSONArray assignmentArr = placement.getJSONArray("assignmentInfo")
Map<String, String> assignmentMap = jsonUtil.entryArrayToMap(execution, assignmentArr.toString(), "variableName", "variableValue")
resource.getHomingSolution().setCloudOwner(assignmentMap.get("cloudOwner"))
resource.getHomingSolution().setAicClli(assignmentMap.get("aicClli"))
resource.getHomingSolution().setAicVersion(assignmentMap.get("aicVersion"))
if(inventoryType.equalsIgnoreCase("service")){
- resource.getHomingSolution().setVnfHostname(assignmentMap.get("vnfHostName"));
- resource.getHomingSolution().setServiceInstanceId(placement.getString("serviceInstanceId"));
+ VnfResource vnf = new VnfResource()
+ vnf.setVnfHostname(assignmentMap.get("vnfHostName"))
+ resource.getHomingSolution().setVnf(vnf)
+ resource.getHomingSolution().setServiceInstanceId(placement.getString("serviceInstanceId"))
}
}
}
@@ -226,11 +225,11 @@ class Homing extends AbstractServiceTaskProcessor{
//match
String jsonEntitlementPoolList = jsonUtil.getJsonValue(license.toString(), "entitlementPoolList")
List<String> entitlementPoolList = jsonUtil.StringArrayToList(execution, jsonEntitlementPoolList)
- resource.getHomingSolution().setEntitlementPoolList(entitlementPoolList)
+ resource.getHomingSolution().getLicense().setEntitlementPoolList(entitlementPoolList)
String jsonLicenseKeyGroupList = jsonUtil.getJsonValue(license.toString(), "licenseKeyGroupList")
List<String> licenseKeyGroupList = jsonUtil.StringArrayToList(execution, jsonLicenseKeyGroupList)
- resource.getHomingSolution().setLicenseKeyGroupList(licenseKeyGroupList)
+ resource.getHomingSolution().getLicense().setLicenseKeyGroupList(licenseKeyGroupList)
}
}
}
@@ -254,7 +253,7 @@ class Homing extends AbstractServiceTaskProcessor{
* @param - execution
* @author cb645j
*/
- public String logStart(Execution execution){
+ public String logStart(DelegateExecution execution){
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
String requestId = execution.getVariable("testReqId")
if(isBlank(requestId)){
@@ -270,6 +269,6 @@ class Homing extends AbstractServiceTaskProcessor{
/**
* Auto-generated method stub
*/
- public void preProcessRequest(Execution execution){}
+ public void preProcessRequest(DelegateExecution execution){}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ManualHandling.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ManualHandling.groovy
index 59a1bcf797..e79071f1e9 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ManualHandling.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ManualHandling.groovy
@@ -23,6 +23,8 @@ import static org.apache.commons.lang3.StringUtils.*;
import java.time.chrono.AbstractChronology
import java.util.List
+import java.text.SimpleDateFormat
+import java.util.Date
import org.apache.commons.lang3.*
import org.camunda.bpm.engine.TaskService
@@ -31,12 +33,13 @@ import org.camunda.bpm.engine.task.TaskQuery
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateTask
import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.camunda.bpm.engine.runtime.Execution
+import org.camunda.bpm.engine.delegate.DelegateExecution
import org.json.JSONObject;
import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil
import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition
import org.openecomp.mso.bpmn.core.json.JsonUtils
+import org.openecomp.mso.client.ruby.*
@@ -57,6 +60,7 @@ import org.openecomp.mso.bpmn.core.json.JsonUtils
* @param - errorCode
* @param - errorText
* @param - validResponses
+ * @param - vnfName
*
* Outputs:
* @param - WorkflowException
@@ -70,13 +74,14 @@ public class ManualHandling extends AbstractServiceTaskProcessor {
JsonUtils jsonUtils = new JsonUtils()
- public void preProcessRequest (Execution execution) {
+ public void preProcessRequest (DelegateExecution execution) {
def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled")
String msg = ""
utils.log("DEBUG"," ***** preProcessRequest of ManualHandling *****", isDebugLogEnabled)
try {
execution.setVariable("prefix", Prefix)
+ setBasicDBAuthHeader(execution, isDebugLogEnabled)
// check for required input
String requestId = execution.getVariable("msoRequestId")
utils.log("DEBUG", "msoRequestId is: " + requestId, isDebugLogEnabled)
@@ -109,7 +114,7 @@ public class ManualHandling extends AbstractServiceTaskProcessor {
utils.log("DEBUG"," ***** Exit preProcessRequest of RainyDayHandler *****", isDebugLogEnabled)
}
- public void createManualTask (Execution execution) {
+ public void createManualTask (DelegateExecution execution) {
def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled")
String msg = ""
utils.log("DEBUG"," ***** createManualTask of ManualHandling *****", isDebugLogEnabled)
@@ -247,7 +252,94 @@ public class ManualHandling extends AbstractServiceTaskProcessor {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
utils.log("DEBUG"," ***** Exit completeTask of ManualHandling *****", isDebugLogEnabled)
- }
+ }
+
+ public void prepareRequestsDBStatusUpdate (DelegateExecution execution, String requestStatus){
+
+ def method = getClass().getSimpleName() + '.prepareRequestsDBStatusUpdate(' +'execution=' + execution.getId() +')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ utils.log("DEBUG"," ***** prepareRequestsDBStatusUpdate of ManualHandling *****", isDebugLogEnabled)
+ try {
+ def requestId = execution.getVariable("msoRequestId")
+ String payload = """
+ <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.openecomp.mso/requestsdb">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <req:updateInfraRequest>
+ <requestId>${requestId}</requestId>
+ <lastModifiedBy>ManualHandling</lastModifiedBy>
+ <requestStatus>${requestStatus}</requestStatus>
+ </req:updateInfraRequest>
+ </soapenv:Body>
+ </soapenv:Envelope>
+ """
+
+ execution.setVariable("setUpdateDBstatusPayload", payload)
+ utils.log("DEBUG", "Outgoing Update Mso Request Payload is: " + payload, isDebugLogEnabled)
+ utils.logAudit("setUpdateDBstatusPayload: " + payload)
+
+ } catch (BpmnError e) {
+ throw e;
+ } catch (Exception e) {
+ logError('Caught exception in ' + method, e)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method)
+ }
+
+ utils.log("DEBUG"," ***** Exit prepareRequestsDBStatusUpdate of ManualHandling *****", isDebugLogEnabled)
+ }
+
+ public void createAOTSTicket (DelegateExecution execution) {
+ def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled")
+ String msg = ""
+ utils.log("DEBUG"," ***** createAOTSTicket of ManualHandling *****", isDebugLogEnabled)
+
+ // This method will not be throwing an exception, but rather log the error
+
+ try {
+ execution.setVariable("prefix", Prefix)
+ setBasicDBAuthHeader(execution, isDebugLogEnabled)
+ // check for required input
+ String requestId = execution.getVariable("msoRequestId")
+ utils.log("DEBUG", "requestId is: " + requestId, isDebugLogEnabled)
+ def currentActivity = execution.getVariable("currentActivity")
+ utils.log("DEBUG", "currentActivity is: " + currentActivity, isDebugLogEnabled)
+ def workStep = execution.getVariable("workStep")
+ utils.log("DEBUG", "workStep is: " + workStep, isDebugLogEnabled)
+ def failedActivity = execution.getVariable("failedActivity")
+ utils.log("DEBUG", "failedActivity is: " + failedActivity, isDebugLogEnabled)
+ def errorCode = execution.getVariable("errorCode")
+ utils.log("DEBUG", "errorCode is: " + errorCode, isDebugLogEnabled)
+ def errorText = execution.getVariable("errorText")
+ utils.log("DEBUG", "errorText is: " + errorText, isDebugLogEnabled)
+ def vnfName = execution.getVariable("vnfName")
+ utils.log("DEBUG", "vnfName is: " + vnfName, isDebugLogEnabled)
+
+ String rubyRequestId = UUID.randomUUID()
+ utils.log("DEBUG", "rubyRequestId: " + rubyRequestId, isDebugLogEnabled)
+ String sourceName = vnfName
+ utils.log("DEBUG", "sourceName: " + sourceName, isDebugLogEnabled)
+ String reason = "VID Workflow failed at " + failedActivity + " " + workStep + " call with error " + errorCode
+ utils.log("DEBUG", "reason: " + reason, isDebugLogEnabled)
+ String workflowId = requestId
+ utils.log("DEBUG", "workflowId: " + workflowId, isDebugLogEnabled)
+ String notification = "Request originated from VID | Workflow fallout on " + vnfName + " | Workflow step failure: " + workStep + " failed | VID workflow ID: " + workflowId
+ utils.log("DEBUG", "notification: " + notification, isDebugLogEnabled)
+
+ utils.log("DEBUG", "Creating AOTS Ticket request")
+
+ RubyClient rubyClient = new RubyClient()
+ rubyClient.rubyCreateTicketCheckRequest(rubyRequestId, sourceName, reason, workflowId, notification)
+
+ } catch (BpmnError e) {
+ msg = "BPMN error in createAOTSTicket " + ex.getMessage()
+ utils.log("ERROR", msg, isDebugLogEnabled)
+ } catch (Exception ex){
+ msg = "Exception in createAOTSTicket " + ex.getMessage()
+ utils.log("ERROR", msg, isDebugLogEnabled)
+ }
+ utils.log("DEBUG"," ***** Exit createAOTSTicket of ManualHandling *****", isDebugLogEnabled)
+ }
+
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/NetworkUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/NetworkUtils.groovy
index 3eaed1015e..f6b36546aa 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/NetworkUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/NetworkUtils.groovy
@@ -33,7 +33,7 @@ import javax.xml.transform.dom.DOMSource
import javax.xml.transform.stream.StreamResult
import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.runtime.Execution
+import org.camunda.bpm.engine.delegate.DelegateExecution
import org.w3c.dom.Document
import org.w3c.dom.Element
@@ -43,7 +43,7 @@ import org.w3c.dom.NodeList;
import org.xml.sax.InputSource
import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.runtime.Execution
+import org.camunda.bpm.engine.delegate.DelegateExecution
import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor;
import org.w3c.dom.Document
import org.w3c.dom.Element
@@ -1010,7 +1010,7 @@ class NetworkUtils {
if (orchestrationStatus == "PendingDelete" || orchestrationStatus == "pending-delete") {
// skip, do not include in processing, remove!!!
} else {
- def subnetList = ["subnet-id", "neutron-subnet-id", "gateway-address", "network-start-address", "cidr-mask", "ip-version", "orchestration-status", "dhcp-enabled", "dhcp-start", "dhcp-end", "resource-version", "subnet-name"]
+ def subnetList = ["subnet-id", "neutron-subnet-id", "gateway-address", "network-start-address", "cidr-mask", "ip-version", "orchestration-status", "dhcp-enabled", "dhcp-start", "dhcp-end", "resource-version", "subnet-name", "ip-assignment-direction", "host-routes"]
rebuildingSubnets += buildSubNetworkElements(subnetXml, createNetworkResponse, subnetList, "subnet")
}
}
@@ -1041,7 +1041,7 @@ class NetworkUtils {
if (orchestrationStatus == "pending-delete" || orchestrationStatus == "PendingDelete") {
// skip, do not include in processing, remove!!!
} else {
- def subnetList = ["dhcp-start", "dhcp-end", "network-start-address", "cidr-mask", "dhcp-enabled", "gateway-address", "ip-version", "subnet-id", "subnet-name"]
+ def subnetList = ["dhcp-start", "dhcp-end", "network-start-address", "cidr-mask", "dhcp-enabled", "gateway-address", "ip-version", "subnet-id", "subnet-name", "ip-assignment-direction", "host-routes"]
rebuildingSubnets += buildSubNetworkElements(subnetXml, subnetList, "subnets")
//rebuildingSubnets += buildSubNetworkElements(subnetXml, subnetList, "")
}
@@ -1084,7 +1084,14 @@ class NetworkUtils {
if (element=="neutron-subnet-id") {
// skip
} else {
- xmlBuild += "<"+element+">"+var.toString()+"</"+element+">"
+ if (element=="host-routes") {
+ if (subnetXml.contains("host-routes")) {
+ List elementRoute = ["host-route-id", "route-prefix", "next-hop", "next-hop-type", "resource-version"]
+ xmlBuild += buildXMLElements(subnetXml, "host-routes", "host-route", elementRoute)
+ }
+ } else {
+ xmlBuild += "<"+element+">"+var.toString()+"</"+element+">"
+ }
}
}
}
@@ -1150,6 +1157,17 @@ class NetworkUtils {
if ((element == "subnet-name") && (var != null)) {
xmlBuild += "<subnetName>"+var.toString()+"</subnetName>"
}
+ if ((element == "ip-assignment-direction") && (var != null)) {
+ xmlBuild += "<addrFromStart>"+var.toString()+"</addrFromStart>"
+ }
+ if (element == "host-routes") {
+ def routes = ""
+ if (subnetXml.contains("host-routes")) {
+ routes = buildHostRoutes(subnetXml)
+ }
+ xmlBuild += routes
+ }
+
}
}
if (parentName != "") {
@@ -1158,6 +1176,38 @@ class NetworkUtils {
return xmlBuild
}
+ // rebuild host-routes
+ def buildHostRoutes(subnetXml) {
+ List routeElementList = ["host-route-id", "route-prefix", "next-hop", "next-hop-type", "resource-version"]
+ def hostRoutes = buildXMLElements(subnetXml, "host-routes", "host-route", routeElementList)
+ def buildHostRoutes = ""
+ def var = ""
+ if (hostRoutes!=null) {
+ def routesData = new XmlSlurper().parseText(hostRoutes)
+ def routes = routesData.'**'.findAll {it.name() == "host-route"}
+ def routesSize = routes.size()
+ for (i in 0..routesSize-1) {
+ buildHostRoutes += "<hostRoutes>"
+ def route = routes[i]
+ def routeXml = XmlUtil.serialize(route)
+ List elementList = ["route-prefix", "next-hop"]
+ for (element in elementList) {
+ def xml= new XmlSlurper().parseText(routeXml)
+ var = xml.'**'.find {it.name() == element}
+ if (element == "route-prefix") {
+ buildHostRoutes += "<prefix>"+var.toString()+"</prefix>"
+ }
+ if (element == "next-hop") {
+ buildHostRoutes += "<nextHop>"+var.toString()+"</nextHop>"
+ }
+ }
+ buildHostRoutes += "</hostRoutes>"
+ }
+ }
+ return buildHostRoutes
+
+ }
+
// rebuild ctag-assignments
def rebuildCtagAssignments(xmlInput) {
def rebuildingCtagAssignments = ""
@@ -1470,7 +1520,7 @@ class NetworkUtils {
return value
}
- public boolean isRollbackEnabled (Execution execution, String payloadXml) {
+ public boolean isRollbackEnabled (DelegateExecution execution, String payloadXml) {
def rollbackEnabled = false
def rollbackValueSet = false
@@ -1499,17 +1549,24 @@ class NetworkUtils {
/**
* This method extracts the version for the the given ip-version.
*
- * @param String ipvVersion - IP protocols version (ex: ipv4 or ipv6)
+ * @param String ipvVersion - IP protocols version (ex: ipv4 or ipv6 or 4 or 6)
* @return String version - digit version (ex: 4 or 6)
*/
public String getIpvVersion (String ipvVersion) {
String version = ""
- if (ipvVersion.isNumber()) {
- version = ipvVersion
- } else {
- version = ipvVersion.substring(ipvVersion.indexOf("ipv")+3)
+ try {
+ if (ipvVersion.isNumber()) {
+ version = ipvVersion
+ } else {
+ version = ipvVersion.substring(ipvVersion.indexOf("ipv")+3)
+ if (!version.isNumber()) {
+ version = ipvVersion
+ }
+ }
+ } catch (Exception ex) {
+ version = ipvVersion
}
return version
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy
index 95f129b7f5..bbdaab15e9 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/PrepareUpdateAAIVfModule.groovy
@@ -21,7 +21,7 @@
package org.openecomp.mso.bpmn.common.scripts
import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.runtime.Execution
+import org.camunda.bpm.engine.delegate.DelegateExecution
import org.openecomp.mso.bpmn.core.WorkflowException
import org.openecomp.mso.rest.APIResponse
import org.openecomp.mso.rest.RESTClient
@@ -37,7 +37,7 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase {
*
* @param execution The flow's execution instance.
*/
- public void initProcessVariables(Execution execution) {
+ public void initProcessVariables(DelegateExecution execution) {
execution.setVariable('prefix', 'PUAAIVfMod_')
execution.setVariable('PUAAIVfMod_vnfId', null)
execution.setVariable('PUAAIVfMod_vfModuleId', null)
@@ -58,7 +58,7 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase {
*
* @param execution The flow's execution instance.
*/
- public void preProcessRequest(Execution execution) {
+ public void preProcessRequest(DelegateExecution execution) {
def method = getClass().getSimpleName() + '.preProcessRequest(' +
'execution=' + execution.getId() +
')'
@@ -96,7 +96,7 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase {
*
* @param execution The flow's execution instance.
*/
- public void getGenericVnf(Execution execution) {
+ public void getGenericVnf(DelegateExecution execution) {
def method = getClass().getSimpleName() + '.getGenericVnf(' +
'execution=' + execution.getId() +
')'
@@ -162,7 +162,7 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase {
*
* @param execution The flow's execution instance.
*/
- public void validateVfModule(Execution execution) {
+ public void validateVfModule(DelegateExecution execution) {
def method = getClass().getSimpleName() + '.validateVfModule(' +
'execution=' + execution.getId() +
')'
@@ -212,7 +212,7 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase {
*
* @param execution The flow's execution instance.
*/
- public void updateVfModule(Execution execution) {
+ public void updateVfModule(DelegateExecution execution) {
def method = getClass().getSimpleName() + '.updateVfModule(' +
'execution=' + execution.getId() +
')'
@@ -309,7 +309,7 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase {
*
* @param execution The flow's execution instance.
*/
- public void handleVnfNotFound(Execution execution) {
+ public void handleVnfNotFound(DelegateExecution execution) {
def method = getClass().getSimpleName() + '.handleVnfNotFound(' +
'execution=' + execution.getId() +
')'
@@ -332,7 +332,7 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase {
*
* @param execution The flow's execution instance.
*/
- public void handleVfModuleValidationError(Execution execution) {
+ public void handleVfModuleValidationError(DelegateExecution execution) {
def method = getClass().getSimpleName() + '.handleVfModuleValidationError(' +
'execution=' + execution.getId() +
')'
@@ -355,7 +355,7 @@ public class PrepareUpdateAAIVfModule extends VfModuleBase {
*
* @param execution The flow's execution instance.
*/
- public void handleUpdateVfModuleFailure(Execution execution) {
+ public void handleUpdateVfModuleFailure(DelegateExecution execution) {
def method = getClass().getSimpleName() + '.handleUpdateVfModuleFailure(' +
'execution=' + execution.getId() +
')'
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/RainyDayHandler.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/RainyDayHandler.groovy
index 8b4fe10649..0f7de9a23e 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/RainyDayHandler.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/RainyDayHandler.groovy
@@ -25,13 +25,17 @@ import static org.apache.commons.lang3.StringUtils.*;
import org.apache.commons.lang3.*
import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.runtime.Execution
+import org.camunda.bpm.engine.delegate.DelegateExecution
import org.json.JSONObject;
import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil
import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition
import org.openecomp.mso.bpmn.core.json.JsonUtils
-import org.openecomp.mso.client.policy.PolicyDecision
+import org.openecomp.mso.client.policy.PolicyClient
+import org.openecomp.mso.client.policy.PolicyClientImpl
+import org.openecomp.mso.client.policy.entities.DictionaryData
+import org.openecomp.mso.client.policy.entities.PolicyDecision
+import org.openecomp.mso.client.policy.entities.Treatments
import org.openecomp.mso.client.policy.PolicyRestClient
@@ -54,6 +58,7 @@ import groovy.json.*
* @param - failedActivity
* @param - errorCode
* @param - errorText
+ * @param - vnfName
*
* Outputs:
* @param - WorkflowException
@@ -67,7 +72,7 @@ public class RainyDayHandler extends AbstractServiceTaskProcessor {
JsonUtils jsonUtils = new JsonUtils()
- public void preProcessRequest (Execution execution) {
+ public void preProcessRequest (DelegateExecution execution) {
def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled")
String msg = ""
utils.log("DEBUG"," ***** preProcessRequest of RainyDayHandler *****", isDebugLogEnabled)
@@ -91,6 +96,9 @@ public class RainyDayHandler extends AbstractServiceTaskProcessor {
utils.log("DEBUG", "errorCode is: " + errorCode, isDebugLogEnabled)
def errorText = execution.getVariable("errorText")
utils.log("DEBUG", "errorText is: " + errorText, isDebugLogEnabled)
+ String defaultPolicyDisposition = (String) execution.getVariable('URN_policy_default_disposition')
+ utils.log("DEBUG", "defaultPolicyDisposition is: " + defaultPolicyDisposition, isDebugLogEnabled)
+ execution.setVariable('defaultPolicyDisposition', defaultPolicyDisposition)
} catch (BpmnError e) {
throw e;
@@ -102,7 +110,7 @@ public class RainyDayHandler extends AbstractServiceTaskProcessor {
utils.log("DEBUG"," ***** Exit preProcessRequest of RainyDayHandler *****", isDebugLogEnabled)
}
- public void queryPolicy (Execution execution) {
+ public void queryPolicy (DelegateExecution execution) {
def isDebugLogEnabled = execution.getVariable("isDebugLogEnabled")
String msg = ""
utils.log("DEBUG"," ***** queryPolicy of RainyDayHandler *****", isDebugLogEnabled)
@@ -122,34 +130,55 @@ public class RainyDayHandler extends AbstractServiceTaskProcessor {
utils.log("DEBUG", "Before querying policy", isDebugLogEnabled)
- PolicyDecision decisionObject = null
-
- try {
- PolicyRestClient policyClient = new PolicyRestClient()
- utils.log("DEBUG", "Created policy client", isDebugLogEnabled)
- decisionObject = policyClient.getDecision(serviceType, vnfType, bbId, workStep, errorCode)
- utils.log("DEBUG", "Obtained decision object", isDebugLogEnabled)
- } catch(Exception e) {
- msg = "Exception in queryPolicy " + e.getMessage()
- utils.log("DEBUG", msg, isDebugLogEnabled)
-
- }
-
String decision = 'DENY'
- String disposition = "Abort"
- if (decisionObject != null) {
- decision = decisionObject.getDecision()
- disposition = decisionObject.getDetails()
- utils.log("DEBUG", "Obtained disposition from policy engine: " + disposition, isDebugLogEnabled)
+ String disposition = "Abort"
+ String defaultAllowedTreatments = "rollback, skip, manual, abort"
+
+ String defaultPolicyDisposition = (String) execution.getVariable('defaultPolicyDisposition')
+ if (defaultPolicyDisposition != null) {
+ utils.log("DEBUG", "Setting disposition to the configured default instead of querying Policy: " + defaultPolicyDisposition, isDebugLogEnabled)
+ disposition = defaultPolicyDisposition
+ utils.log("DEBUG", "Setting default allowed treatments: " + defaultAllowedTreatments, isDebugLogEnabled)
+ execution.setVariable("validResponses", defaultAllowedTreatments)
}
else {
- disposition = "Manual"
- }
- if (disposition == null) {
- disposition = "Manual"
+
+ PolicyDecision decisionObject = null
+
+ try {
+ PolicyClient policyClient = new PolicyClientImpl()
+ utils.log("DEBUG", "Created policy client", isDebugLogEnabled)
+ decisionObject = policyClient.getDecision(serviceType, vnfType, bbId, workStep, errorCode)
+ utils.log("DEBUG", "Obtained decision object", isDebugLogEnabled)
+ DictionaryData dictClient = policyClient.getAllowedTreatments(bbId, workStep)
+ Treatments treatments = dictClient.getTreatments()
+ String validResponses = treatments.getString()
+ if (validResponses != null) {
+ validResponses = validResponses.toLowerCase()
+ }
+ utils.log("DEBUG", "Obtained validResponses: " + validResponses, isDebugLogEnabled)
+ execution.setVariable("validResponses", validResponses)
+
+ } catch(Exception e) {
+ msg = "Exception in queryPolicy " + e.getMessage()
+ utils.log("DEBUG", msg, isDebugLogEnabled)
+ }
+
+
+ if (decisionObject != null) {
+ decision = decisionObject.getDecision()
+ disposition = decisionObject.getDetails()
+ utils.log("DEBUG", "Obtained disposition from policy engine: " + disposition, isDebugLogEnabled)
+ }
+ else {
+ disposition = "Abort"
+ }
+ if (disposition == null) {
+ disposition = "Abort"
+ }
}
- execution.setVariable("handlingCode", disposition)
- execution.setVariable("validResponses", "rollback, abort, skip, retry")
+ execution.setVariable("handlingCode", disposition)
+
utils.log("DEBUG", "Disposition: "+ disposition, isDebugLogEnabled)
} catch (BpmnError e) {
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ReceiveWorkflowMessage.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ReceiveWorkflowMessage.groovy
index 6ad03abec6..1e1afb4d5d 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ReceiveWorkflowMessage.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ReceiveWorkflowMessage.groovy
@@ -1,10 +1,10 @@
-package org.openecomp.mso.bpmn.common.scripts
+package org.openecomp.mso.bpmn.common.scripts;
import groovy.json.*
import org.apache.commons.lang3.*
import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.runtime.Execution
+import org.camunda.bpm.engine.delegate.DelegateExecution
import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil
@@ -18,7 +18,7 @@ class ReceiveWorkflowMessage extends AbstractServiceTaskProcessor {
*
* @param execution The flow's execution instance.
*/
-public void preProcessRequest (Execution execution) {
+public void preProcessRequest (DelegateExecution execution) {
def method = getClass().getSimpleName() + '.preProcessRequest(' +
'execution=' + execution.getId() +
')'
@@ -30,7 +30,7 @@ public void preProcessRequest (Execution execution) {
setSuccessIndicator(execution, false)
try {
-
+
// Confirm that timeout value has been provided in 'RCVWFMSG_timeout'.
def timeout = execution.getVariable('RCVWFMSG_timeout')
logDebug('Timeout value is \'' + timeout + '\'', isDebugLogEnabled)
@@ -40,7 +40,7 @@ public void preProcessRequest (Execution execution) {
logError(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
-
+
// Confirm that message type has been provided in 'RCVWFMSG_messageType'
def messageType = execution.getVariable('RCVWFMSG_messageType')
logDebug('Message type is \'' + messageType + '\'', isDebugLogEnabled)
@@ -50,7 +50,7 @@ public void preProcessRequest (Execution execution) {
logError(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
-
+
// Confirm that correlator value has been provided in 'RCVWFMSG_correlator'
def correlator = execution.getVariable('RCVWFMSG_correlator')
logDebug('Correlator value is \'' + correlator + '\'', isDebugLogEnabled)
@@ -61,7 +61,7 @@ public void preProcessRequest (Execution execution) {
exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
}
execution.setVariable(messageType + '_CORRELATOR', correlator)
-
+
logDebug('Exited ' + method, isDebugLogEnabled)
} catch (BpmnError e) {
throw e
@@ -78,7 +78,7 @@ public void preProcessRequest (Execution execution) {
*
* @param execution The flow's execution instance.
*/
- public void processReceivedMessage(Execution execution){
+ public void processReceivedMessage(DelegateExecution execution){
def method = getClass().getSimpleName() + '.processReceivedMessage(' +
'execution=' + execution.getId() +
')'
@@ -95,7 +95,7 @@ public void preProcessRequest (Execution execution) {
// The received message is made available to the calling flow in WorkflowResponse
execution.setVariable("WorkflowResponse", receivedMessage)
-
+
setSuccessIndicator(execution, true)
logDebug('Exited ' + method, isDebugLogEnabled)
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapter.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapter.groovy
index 850a201503..44c9f3f829 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapter.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapter.groovy
@@ -22,7 +22,7 @@ package org.openecomp.mso.bpmn.common.scripts;
import java.text.SimpleDateFormat
-import org.camunda.bpm.engine.runtime.Execution
+import org.camunda.bpm.engine.delegate.DelegateExecution
import org.openecomp.mso.bpmn.core.WorkflowException
@@ -34,10 +34,10 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor {
ExceptionUtil exceptionUtil = new ExceptionUtil()
// Script Task: Process SDNC Workflow Request
- // Params: Workflow Execution
+ // Params: Workflow DelegateExecution
// Assume: Received SDNCAdapterWorkflowRequest is in variable 'sdncAdapterWorkflowRequest'
// Put created SDNCAdapterRequest in variable 'sdncAdapterRequest'
- public void preProcessRequest (Execution execution) {
+ public void preProcessRequest (DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
try{
@@ -155,7 +155,7 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor {
utils.log("DEBUG","=========== End pre Process SDNCRequestScript ===========", isDebugEnabled)
}
- public void postProcessResponse (Execution execution) {
+ public void postProcessResponse (DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
try{
@@ -224,7 +224,7 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor {
utils.log("DEBUG","=========== End POSTProcess SDNCAdapter ===========", isDebugEnabled)
}
- public void callbackResponsecheck(Execution execution){
+ public void callbackResponsecheck(DelegateExecution execution){
def sdnccallbackreq=execution.getVariable("sdncAdapterCallbackRequest")
utils.logAudit("sdncAdapterCallbackRequest :" + sdnccallbackreq)
@@ -235,7 +235,7 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor {
}
}
- public void resetCallbackRequest(Execution execution) {
+ public void resetCallbackRequest(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
@@ -269,7 +269,7 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor {
}
- public void prepareDBMessage(Execution execution) {
+ public void prepareDBMessage(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
@@ -302,13 +302,13 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor {
return utcTime;
}
- public void toggleSuccessIndicator(Execution execution){
+ public void toggleSuccessIndicator(DelegateExecution execution){
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
execution.setVariable("SDNCA_SuccessIndicator", true)
utils.log("DEBUG","Setting SDNCA Success Indicator to True", isDebugEnabled)
}
- public void assignError(Execution execution){
+ public void assignError(DelegateExecution execution){
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
utils.log("DEBUG","=========== Started Assign Error ===========", isDebugEnabled)
WorkflowException wf = execution.getVariable("WorkflowException")
@@ -322,7 +322,7 @@ public class SDNCAdapter extends AbstractServiceTaskProcessor {
utils.log("DEBUG","=========== End Assign Error ===========", isDebugEnabled)
}
- public void setTimeout(Execution execution){
+ public void setTimeout(DelegateExecution execution){
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
utils.log("DEBUG","=========== Started SetTimeout ===========", isDebugEnabled)
utils.log("DEBUG", "Timer expired, telling correlation service to stop listening", isDebugEnabled)
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterRestV1.groovy
index 1859838f29..41fcb6d08d 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterRestV1.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterRestV1.groovy
@@ -6,7 +6,7 @@ import java.net.URLEncoder
import org.apache.commons.codec.binary.Base64
import org.apache.commons.lang3.*
import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.runtime.Execution
+import org.camunda.bpm.engine.delegate.DelegateExecution
import groovy.json.*
@@ -27,7 +27,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
/**
* Processes the incoming request.
*/
- public void preProcessRequest (Execution execution) {
+ public void preProcessRequest (DelegateExecution execution) {
def method = getClass().getSimpleName() + '.preProcessRequest(' +
'execution=' + execution.getId() +
')'
@@ -152,7 +152,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
/**
* Sends the request to the SDNC adapter.
*/
- public void sendRequestToSDNCAdapter(Execution execution) {
+ public void sendRequestToSDNCAdapter(DelegateExecution execution) {
def method = getClass().getSimpleName() + '.sendRequestToSDNCAdapter(' +
'execution=' + execution.getId() +
')'
@@ -204,7 +204,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
/**
* Processes a callback.
*/
- public void processCallback(Execution execution){
+ public void processCallback(DelegateExecution execution){
def method = getClass().getSimpleName() + '.processCallback(' +
'execution=' + execution.getId() +
')'
@@ -253,7 +253,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
* a WorkflowException. If the response cannot be parsed, a more generic
* WorkflowException is created.
*/
- public void sdncAdapterBuildWorkflowException(Execution execution, String response) {
+ public void sdncAdapterBuildWorkflowException(DelegateExecution execution, String response) {
try {
String responseType = jsonUtil.getJsonRootProperty(response)
String responseCode = jsonUtil.getJsonValue(response, responseType + ".responseCode")
@@ -282,7 +282,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
/**
* Gets the last callback request from the execution, or null if there was no callback.
*/
- public String getLastCallback(Execution execution) {
+ public String getLastCallback(DelegateExecution execution) {
def method = getClass().getSimpleName() + '.getLastCallback(' +
'execution=' + execution.getId() +
')'
@@ -318,7 +318,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
/**
* Sets the timeout value to wait for the next notification.
*/
- public void setTimeoutValue(Execution execution) {
+ public void setTimeoutValue(DelegateExecution execution) {
def method = getClass().getSimpleName() + '.setTimeoutValue(' +
'execution=' + execution.getId() +
')'
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterRestV2.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterRestV2.groovy
new file mode 100644
index 0000000000..f4a7f055bd
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterRestV2.groovy
@@ -0,0 +1,254 @@
+package org.openecomp.mso.bpmn.common.scripts
+
+import java.text.SimpleDateFormat
+import java.net.URLEncoder
+
+import org.apache.commons.codec.binary.Base64
+import org.apache.commons.lang3.*
+import org.camunda.bpm.engine.delegate.BpmnError
+import org.camunda.bpm.engine.delegate.DelegateExecution
+
+import groovy.json.*
+
+import org.json.JSONObject
+
+import org.openecomp.mso.bpmn.core.WorkflowException
+import org.openecomp.mso.bpmn.core.json.JsonUtils
+import org.openecomp.mso.rest.APIResponse
+import org.openecomp.mso.rest.RESTClient
+import org.openecomp.mso.rest.RESTConfig
+
+/**
+ * This version of SDNCAdapterRest allows for interim notifications to be sent for
+ * any non-final response received from SDNC.
+ */
+class SDNCAdapterRestV2 extends SDNCAdapterRestV1 {
+
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ JsonUtils jsonUtil = new JsonUtils()
+
+ /**
+ * Processes the incoming request.
+ */
+ public void preProcessRequest (DelegateExecution execution) {
+ def method = getClass().getSimpleName() + '.preProcessRequest(' +
+ 'execution=' + execution.getId() +
+ ')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logDebug('Entered ' + method, isDebugLogEnabled)
+
+ def prefix="SDNCREST_"
+ execution.setVariable("prefix", prefix)
+ setSuccessIndicator(execution, false)
+
+ try {
+ // Determine the request type and log the request
+
+ String request = validateRequest(execution, "mso-request-id")
+ String requestType = jsonUtil.getJsonRootProperty(request)
+ execution.setVariable(prefix + 'requestType', requestType)
+ logDebug(getProcessKey(execution) + ': ' + prefix + 'requestType = ' + requestType, isDebugLogEnabled)
+ utils.logAudit('SDNCAdapterRestV2, request: ' + request)
+
+ // Determine the SDNCAdapter endpoint
+
+ String sdncAdapterEndpoint = execution.getVariable("URN_mso_adapters_sdnc_rest_endpoint")
+
+ if (sdncAdapterEndpoint == null || sdncAdapterEndpoint.isEmpty()) {
+ String msg = getProcessKey(execution) + ': mso:adapters:sdnc:rest:endpoint URN mapping is not defined'
+ logDebug(msg, isDebugLogEnabled)
+ logError(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ }
+
+ while (sdncAdapterEndpoint.endsWith('/')) {
+ sdncAdapterEndpoint = sdncAdapterEndpoint.substring(0, sdncAdapterEndpoint.length()-1)
+ }
+
+ String sdncAdapterMethod = null
+ String sdncAdapterUrl = null
+ String sdncAdapterRequest = request
+
+ if ('SDNCServiceRequest'.equals(requestType)) {
+ // Get the sdncRequestId from the request
+
+ String sdncRequestId = jsonUtil.getJsonValue(request, requestType + ".sdncRequestId")
+
+ if (sdncRequestId == null || sdncRequestId.isEmpty()) {
+ String msg = getProcessKey(execution) + ': no sdncRequestId in ' + requestType
+ logDebug(msg, isDebugLogEnabled)
+ logError(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ }
+
+ execution.setVariable('SDNCAResponse_CORRELATOR', sdncRequestId)
+ logDebug(getProcessKey(execution) + ': SDNCAResponse_CORRELATOR = ' + sdncRequestId, isDebugLogEnabled)
+
+ // Get the bpNotificationUrl from the request (just to make sure it's there)
+
+ String bpNotificationUrl = jsonUtil.getJsonValue(request, requestType + ".bpNotificationUrl")
+
+ if (bpNotificationUrl == null || bpNotificationUrl.isEmpty()) {
+ String msg = getProcessKey(execution) + ': no bpNotificationUrl in ' + requestType
+ logDebug(msg, isDebugLogEnabled)
+ logError(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ }
+
+ sdncAdapterMethod = 'POST'
+ sdncAdapterUrl = sdncAdapterEndpoint + '/services'
+
+ } else {
+ String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType
+ logDebug(msg, isDebugLogEnabled)
+ logError(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ }
+
+ execution.setVariable(prefix + 'sdncAdapterMethod', sdncAdapterMethod)
+ logDebug(getProcessKey(execution) + ': ' + prefix + 'sdncAdapterMethod = ' + sdncAdapterMethod, isDebugLogEnabled)
+ execution.setVariable(prefix + 'sdncAdapterUrl', sdncAdapterUrl)
+ logDebug(getProcessKey(execution) + ': ' + prefix + 'sdncAdapterUrl = ' + sdncAdapterUrl, isDebugLogEnabled)
+ execution.setVariable(prefix + 'sdncAdapterRequest', sdncAdapterRequest)
+ logDebug(getProcessKey(execution) + ': ' + prefix + 'sdncAdapterRequest = \n' + sdncAdapterRequest, isDebugLogEnabled)
+
+ // Get the Basic Auth credentials for the SDNCAdapter (yes... we ARE using the PO adapters credentials)
+
+ String basicAuthValue = execution.getVariable("URN_mso_adapters_po_auth")
+
+ if (basicAuthValue == null || basicAuthValue.isEmpty()) {
+ logDebug(getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined", isDebugLogEnabled)
+ logError(getProcessKey(execution) + ": mso:adapters:po:auth URN mapping is not defined")
+ } else {
+ logDebug(getProcessKey(execution) + ": Obtained BasicAuth credentials for SDNCAdapter:" +
+ basicAuthValue, isDebugLogEnabled)
+ try {
+ def encodedString = utils.getBasicAuth(basicAuthValue, execution.getVariable("URN_mso_msoKey"))
+ execution.setVariable(prefix + 'basicAuthHeaderValue', encodedString)
+ } catch (IOException ex) {
+ logDebug(getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter", isDebugLogEnabled)
+ logError(getProcessKey(execution) + ": Unable to encode BasicAuth credentials for SDNCAdapter")
+ }
+ }
+
+ // Set the timeout value, e.g. PT5M. It may be specified in the request as the
+ // bpTimeout value. If it's not in the request, use the URN mapping value.
+
+ String timeout = jsonUtil.getJsonValue(request, requestType + ".bpTimeout")
+
+ if (timeout == null || timeout.isEmpty()) {
+ timeout = execution.getVariable("URN_mso_sdnc_timeout")
+ }
+
+ execution.setVariable(prefix + 'timeout', timeout)
+ logDebug(getProcessKey(execution) + ': ' + prefix + 'timeout = ' + timeout, isDebugLogEnabled)
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception e) {
+ String msg = 'Caught exception in ' + method + ": " + e
+ logDebug(msg, isDebugLogEnabled)
+ logError(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ }
+ }
+
+ /**
+ * Processes a callback. Check for possible interim notification.
+ */
+ public void processCallback(DelegateExecution execution){
+ def method = getClass().getSimpleName() + '.processCallback(' +
+ 'execution=' + execution.getId() +
+ ')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logDebug('Entered ' + method, isDebugLogEnabled)
+
+ String prefix = execution.getVariable('prefix')
+ String callback = execution.getVariable('SDNCAResponse_MESSAGE')
+ utils.logAudit("Incoming SDNC Rest Callback is: " + callback)
+
+ try {
+ logDebug(getProcessKey(execution) + ": received callback:\n" + callback, isDebugLogEnabled)
+
+ int callbackNumber = 1
+ while (execution.getVariable(prefix + 'callback' + callbackNumber) != null) {
+ ++callbackNumber
+ }
+
+ execution.setVariable(prefix + 'callback' + callbackNumber, callback)
+ execution.removeVariable('SDNCAResponse_MESSAGE')
+
+ String responseType = jsonUtil.getJsonRootProperty(callback)
+
+ // Get the ackFinalIndicator and make sure it's either Y or N. Default to Y.
+ String ackFinalIndicator = jsonUtil.getJsonValue(callback, responseType + ".ackFinalIndicator")
+
+ if (!'N'.equals(ackFinalIndicator)) {
+ ackFinalIndicator = 'Y'
+ }
+
+ execution.setVariable(prefix + "ackFinalIndicator", ackFinalIndicator)
+
+ if (responseType.endsWith('Error')) {
+ sdncAdapterBuildWorkflowException(execution, callback)
+ }
+
+ // Check for possible interim notification
+ execution.setVariable(prefix + "interimNotification", null)
+ execution.setVariable(prefix + "doInterimNotification", false)
+ if ('N'.equals(ackFinalIndicator)) {
+ def interimNotification = execution.getVariable(prefix + "InterimNotification" + callbackNumber)
+ if (interimNotification != null) {
+ execution.setVariable(prefix + "interimNotification", interimNotification)
+ execution.setVariable(prefix + "doInterimNotification", true)
+ }
+ }
+
+ } catch (Exception e) {
+ callback = callback == null || String.valueOf(callback).isEmpty() ? "NONE" : callback
+ String msg = "Received error from SDNCAdapter: " + callback
+ logDebug(getProcessKey(execution) + ': ' + msg, isDebugLogEnabled)
+ exceptionUtil.buildWorkflowException(execution, 5300, msg)
+ }
+ }
+
+ /**
+ * Prepare to send an interim notification by extracting the variable/value definitions
+ * in the interimNotification JSON object and placing them in the execution. These
+ * variable/value definitions will be passed to the notification service.
+ */
+ public void prepareInterimNotification(DelegateExecution execution) {
+ def method = getClass().getSimpleName() + '.prepareInterimNotification(' +
+ 'execution=' + execution.getId() +
+ ')'
+ def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
+ logDebug('Entered ' + method, isDebugLogEnabled)
+
+ String prefix = execution.getVariable('prefix')
+ utils.logAudit("Preparing Interim Notification")
+
+ try {
+ def interimNotification = execution.getVariable(prefix + "interimNotification")
+ logDebug("Preparing Interim Notification:\n" + JsonUtils.prettyJson(interimNotification), isDebugLogEnabled)
+
+ for (int i = 0; ; i++) {
+ def variable = JsonUtils.getJsonParamValue(interimNotification, 'variableList', 'variable', i)
+
+ if (variable == null) {
+ break
+ }
+
+ def String variableName = JsonUtils.getJsonValue(variable, "name")
+ if ((variableName != null) && !variableName.isEmpty()) {
+ def variableValue = JsonUtils.getJsonValue(variable, "value")
+ execution.setVariable(variableName, variableValue)
+ logDebug("Setting "+ variableName + "=" + variableValue, isDebugLogEnabled)
+ }
+ }
+
+ } catch (Exception e) {
+ String msg = "Error preparing interim notification"
+ logDebug(getProcessKey(execution) + ': ' + msg, isDebugLogEnabled)
+ exceptionUtil.buildWorkflowException(execution, 5300, msg)
+ }
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterUtils.groovy
index 9de1708b5b..20a8210c50 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterUtils.groovy
@@ -22,9 +22,9 @@ package org.openecomp.mso.bpmn.common.scripts;
import org.apache.commons.lang3.*
import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.runtime.Execution
+import org.camunda.bpm.engine.delegate.DelegateExecution
import org.openecomp.mso.bpmn.core.WorkflowException
-import org.openecomp.mso.bpmn.core.json.JsonUtils
+import org.openecomp.mso.bpmn.core.json.JsonUtils;
import org.springframework.web.util.UriUtils
@@ -43,7 +43,7 @@ class SDNCAdapterUtils {
this.taskProcessor = taskProcessor
}
- String SDNCAdapterFeatureRequest(Execution execution, String requestName, String action, String callbackURL, String serviceOperation, String timeoutValueInMinutes) {
+ String SDNCAdapterFeatureRequest(DelegateExecution execution, String requestName, String action, String callbackURL, String serviceOperation, String timeoutValueInMinutes) {
def utils=new MsoUtils()
def prefix = execution.getVariable('prefix')
@@ -88,7 +88,7 @@ class SDNCAdapterUtils {
return sdncAdapterFeatureRequest
}
- String SDNCAdapterActivateVnfRequest(Execution execution, String action, String callbackURL, String serviceOperation, String msoAction, String timeoutValueInMinutes) {
+ String SDNCAdapterActivateVnfRequest(DelegateExecution execution, String action, String callbackURL, String serviceOperation, String msoAction, String timeoutValueInMinutes) {
def utils=new MsoUtils()
def prefix = execution.getVariable('prefix')
@@ -131,7 +131,7 @@ class SDNCAdapterUtils {
return sdncAdapterActivateVnfRequest
}
- String SDNCAdapterL3ToHigherLayerRequest(Execution execution, String action, String callbackURL, String serviceOperation, String timeoutValueInMinutes) {
+ String SDNCAdapterL3ToHigherLayerRequest(DelegateExecution execution, String action, String callbackURL, String serviceOperation, String timeoutValueInMinutes) {
def utils=new MsoUtils()
def prefix = execution.getVariable('prefix')
@@ -230,7 +230,7 @@ class SDNCAdapterUtils {
- private void SDNCAdapterActivateRequest(Execution execution, String resultVar, String svcAction,
+ private void SDNCAdapterActivateRequest(DelegateExecution execution, String resultVar, String svcAction,
String svcOperation, String additionalData) {
def utils=new MsoUtils()
@@ -273,6 +273,15 @@ class SDNCAdapterUtils {
additionalData = ""
}
+ boolean isAic3 = execution.getVariable("isAic3")
+
+ if(isAic3) {
+ nnsl2HomingInformation = updateHomingInfo(nnsl2HomingInformation, "AIC3.0")
+ }
+ else {
+ nnsl2HomingInformation = updateHomingInfo(nnsl2HomingInformation, "AIC2.X")
+ }
+
String content = """
<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:sdncadapterworkflow="http://openecomp.com/mso/workflow/schema/v1"
xmlns:sdncadapter="http://domain2.openecomp.com/workflow/sdnc/adapter/schema/v1">
@@ -303,12 +312,25 @@ class SDNCAdapterUtils {
/**
* Builds an SDNC "reserve" request and stores it in the specified execution
+ * variable.
+ * @param execution the execution
+ * @param action the type of action: reserve, turnup, etc
+ * @param resultVar the execution variable in which the result will be stored
+ */
+ public void sdncReservePrep(DelegateExecution execution, String action, String resultVar) {
+ sdncReservePrep(execution, action, resultVar, false)
+ }
+
+ /**
+ * Builds an SDNC "reserve" request and stores it in the specified execution
* variable.
* @param execution the execution
+ * @param action the type of action: reserve, turnup, etc
* @param resultVar the execution variable in which the result will be stored
+ * @param isAic3 boolean to indicate whether request is for AIC3.0
*/
- public void sdncReservePrep(Execution execution, String action, String resultVar) {
- sdncPrep(execution, resultVar, action , 'service-configuration-operation', null, this.taskProcessor)
+ public void sdncReservePrep(DelegateExecution execution, String action, String resultVar, boolean isAic3) {
+ sdncPrep(execution, resultVar, action , 'service-configuration-operation', null, isAic3, this.taskProcessor)
}
/**
@@ -320,8 +342,22 @@ class SDNCAdapterUtils {
* @param additionalData additional XML content to be inserted into the
* RequestData element (may be null)
*/
- public void sdncPrep(Execution execution, String resultVar, String svcAction,
- String svcOperation, String additionalData, AbstractServiceTaskProcessor taskProcessor) {
+ public void sdncPrep(DelegateExecution execution, String resultVar, String svcAction,
+ String svcOperation, String additionalData, AbstractServiceTaskProcessor taskProcessor) {
+ sdncPrep(execution, resultVar, svcAction, svcOperation, additionalData, false, taskProcessor)
+ }
+
+ /**
+ * Builds a basic SDNC request and stores it in the specified execution variable.
+ * @param execution the execution
+ * @param resultVar the execution variable in which the result will be stored
+ * @param svcAction the svcAction element value
+ * @param svcOperation the svcOperation element value
+ * @param additionalData additional XML content to be inserted into the RequestData element (may be null)
+ * @param isAic3 boolean to indicate whether request is for AIC3.0
+ */
+ public void sdncPrep(DelegateExecution execution, String resultVar, String svcAction,
+ String svcOperation, String additionalData, boolean isAic3, AbstractServiceTaskProcessor taskProcessor) {
def method = getClass().getSimpleName() + '.sdncPrep(' +
'execution=' + execution.getId() +
', resultVar=' + resultVar +
@@ -382,6 +418,14 @@ class SDNCAdapterUtils {
if (additionalData == null) {
additionalData = ""
}
+
+ if(isAic3) {
+ nnsl2HomingInformation = updateHomingInfo(nnsl2HomingInformation, "AIC3.0")
+ }
+ else {
+ nnsl2HomingInformation = updateHomingInfo(nnsl2HomingInformation, "AIC2.X")
+ }
+
String content = """
<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:sdncadapterworkflow="http://openecomp.com/mso/workflow/schema/v1"
@@ -420,7 +464,17 @@ class SDNCAdapterUtils {
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error")
}
}
-
+
+ public String updateHomingInfo(String homingInfo, String aicVersion) {
+ String newHomingInfo
+ if(homingInfo == null || homingInfo.trim().length() == 0) {
+ newHomingInfo = "<l2-homing-information><aic-version>" + aicVersion + "</aic-version></l2-homing-information>"
+ }
+ else {
+ newHomingInfo = homingInfo.substring(0, homingInfo.indexOf("</l2-homing-information>")) + "<aic-version>" + aicVersion + "</aic-version></l2-homing-information>"
+ }
+ }
+
/**
* Builds a topology SDNC request and return String request.
* As V2 will use 1607-style request, region instead of aic clli code
@@ -435,7 +489,7 @@ class SDNCAdapterUtils {
* @param additionalData additional XML content to be inserted into the
* RequestData element (may be null)
*/
- public String sdncTopologyRequestV2 (Execution execution, String requestXML, String serviceInstanceId, String callbackUrl, String action, String requestAction, String cloudRegionId, networkId, String queryAAIResponse, String additionalData) {
+ public String sdncTopologyRequestV2 (DelegateExecution execution, String requestXML, String serviceInstanceId, String callbackUrl, String action, String requestAction, String cloudRegionId, networkId, String queryAAIResponse, String additionalData) {
def utils=new MsoUtils()
// SNDC is expecting request Id for header as unique each call.
@@ -553,7 +607,7 @@ class SDNCAdapterUtils {
* @param additionalData additional XML content to be inserted into the
* RequestData element (may be null)
*/
- public String sdncTopologyRequestRsrc (Execution execution, String requestXML, String serviceInstanceId, String callbackUrl, String action, String requestAction, String cloudRegionId, networkId, String additionalData) {
+ public String sdncTopologyRequestRsrc (DelegateExecution execution, String requestXML, String serviceInstanceId, String callbackUrl, String action, String requestAction, String cloudRegionId, networkId, String additionalData) {
def utils=new MsoUtils()
// SNDC is expecting request Id for header as unique each call.
@@ -675,12 +729,12 @@ class SDNCAdapterUtils {
<service-information>
<service-id>${serviceId}</service-id>
<subscription-service-type>${subscriptionServiceType}</subscription-service-type>
- <onap-model-information>
+ <ecomp-model-information>
<model-invariant-uuid>${serviceModelInvariantUuid}</model-invariant-uuid>
<model-uuid>${serviceModelUuid}</model-uuid>
<model-version>${serviceModelVersion}</model-version>
<model-name>${serviceModelName}</model-name>
- </onap-model-information>
+ </ecomp-model-information>
<service-instance-id>${serviceInstanceId}</service-instance-id>
<global-customer-id>${globalCustomerId}</global-customer-id>
<subscriber-name>${subscriberName}</subscriber-name>
@@ -688,13 +742,13 @@ class SDNCAdapterUtils {
<network-information>
<network-id>${networkId}</network-id>
<network-type>${networkType}</network-type>
- <onap-model-information>
+ <ecomp-model-information>
<model-invariant-uuid>${modelInvariantUuid}</model-invariant-uuid>
<model-customization-uuid>${modelCustomizationUuid}</model-customization-uuid>
<model-uuid>${modelUuid}</model-uuid>
<model-version>${modelVersion}</model-version>
<model-name>${modelName}</model-name>
- </onap-model-information>
+ </ecomp-model-information>
</network-information>
<network-request-input>
<network-name>${networkName}</network-name>
@@ -715,7 +769,7 @@ class SDNCAdapterUtils {
* @param responseVar the execution variable in which the response is stored
* @param workflowException the WorkflowException Object returned from sdnc call
*/
- public void validateSDNCResponse(Execution execution, String response, WorkflowException workflowException, boolean successIndicator){
+ public void validateSDNCResponse(DelegateExecution execution, String response, WorkflowException workflowException, boolean successIndicator){
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
taskProcessor.utils.log("DEBUG", "SDNC Response is: " + response, isDebugLogEnabled)
taskProcessor.utils.log("DEBUG", "SuccessIndicator is: " + successIndicator, isDebugLogEnabled)
@@ -730,8 +784,13 @@ class SDNCAdapterUtils {
taskProcessor.utils.log("DEBUG", response + ' is empty');
exceptionUtil.buildAndThrowWorkflowException(execution, 500, "SDNCAdapter Workflow Response is Empty")
}else{
+
// we need to peer into the request data for error
- def String decodedXml = taskProcessor.utils.getNodeText1(response, "RequestData")
+ def String sdncAdapterWorkflowResponse = taskProcessor.utils.getNodeXml(response, 'response-data', false)
+ def String decodedXml = decodeXML(sdncAdapterWorkflowResponse).replace('<?xml version="1.0" encoding="UTF-8"?>', "")
+
+ // change '&' to "&amp; (if present as data, ex: subscriber-name = 'FOUR SEASONS HEATING & COOLING_8310006378683'
+ decodedXml = decodedXml.replace("&", "&amp;")
taskProcessor.utils.log("DEBUG","decodedXml:\n" + decodedXml, isDebugLogEnabled)
@@ -740,14 +799,12 @@ class SDNCAdapterUtils {
try{
if (taskProcessor.utils.nodeExists(decodedXml, "response-message")) {
- requestDataResponseMessage = taskProcessor.utils.getNodeText1(decodedXml, "response-message")
-
- // note: ResponseMessage appears within "response", not "decodedXml"
- } else if (taskProcessor.utils.nodeExists(response, "ResponseMessage")) {
- requestDataResponseMessage = taskProcessor.utils.getNodeText1(response, "ResponseMessage")
+ requestDataResponseMessage = taskProcessor.utils.getNodeText(decodedXml, "response-message")
+ } else if (taskProcessor.utils.nodeExists(decodedXml, "ResponseMessage")) {
+ requestDataResponseMessage = taskProcessor.utils.getNodeText(decodedXml, "ResponseMessage")
}
}catch(Exception e){
- taskProcessor.utils.log("DEBUG", 'Error caught while decoding response ' + e.getMessage(), isDebugLogEnabled)
+ taskProcessor.utils.log("DEBUG", 'Error caught while decoding resposne ' + e.getMessage(), isDebugLogEnabled)
}
if(taskProcessor.utils.nodeExists(decodedXml, "response-code")) {
@@ -758,20 +815,18 @@ class SDNCAdapterUtils {
taskProcessor.utils.log("DEBUG","response-code node is empty", isDebugLogEnabled)
requestDataResponseCode = 0
}else{
- requestDataResponseCode = code as Integer
+ requestDataResponseCode = code.toInteger()
taskProcessor.utils.log("DEBUG","response-code is: " + requestDataResponseCode, isDebugLogEnabled)
}
-
- // note: ResponseCode appears within "response", not "decodedXml"
- }else if(taskProcessor.utils.nodeExists(response, "ResponseCode")){
+ }else if(taskProcessor.utils.nodeExists(decodedXml, "ResponseCode")){
taskProcessor.utils.log("DEBUG","ResponseCode node Exist ", isDebugLogEnabled)
- String code = taskProcessor.utils.getNodeText1(response, "ResponseCode")
+ String code = taskProcessor.utils.getNodeText1(decodedXml, "ResponseCode")
if(code.isEmpty() || code.equals("")){
// if ResponseCode blank then Success
taskProcessor.utils.log("DEBUG","ResponseCode node is empty", isDebugLogEnabled)
requestDataResponseCode = 0
}else{
- requestDataResponseCode = code as Integer
+ requestDataResponseCode = code.toInteger()
taskProcessor.utils.log("DEBUG","ResponseCode is: " + requestDataResponseCode, isDebugLogEnabled)
}
}else{
@@ -828,7 +883,7 @@ class SDNCAdapterUtils {
* @param responseCodeVar the execution variable in which the response code is stored
* @param errorResponseVar the execution variable in which the error response is stored
*/
- public void validateL3BondingSDNCResp(Execution execution, String response, WorkflowException workflowException, boolean success) {
+ public void validateL3BondingSDNCResp(DelegateExecution execution, String response, WorkflowException workflowException, boolean success) {
def method = getClass().getSimpleName() + '.validateL3BondingSDNCResp(' +
'execution=' + execution.getId() +
', response=' + response +
@@ -951,13 +1006,13 @@ class SDNCAdapterUtils {
}
String modelName = jsonUtil.getJsonValue(jsonModelInfo, "modelName")
String ecompModelInformation =
- """<onap-model-information>
+ """<ecomp-model-information>
<model-invariant-uuid>${modelInvariantUuid}</model-invariant-uuid>
<model-uuid>${modelUuid}</model-uuid>
${modelCustomizationString}
<model-version>${modelVersion}</model-version>
<model-name>${modelName}</model-name>
- </onap-model-information>"""
+ </ecomp-model-information>"""
return ecompModelInformation
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SNIROUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SNIROUtils.groovy
index aba2b783e5..ab215c9949 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SNIROUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SNIROUtils.groovy
@@ -1,6 +1,27 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
package org.openecomp.mso.bpmn.common.scripts
-import org.camunda.bpm.engine.runtime.Execution
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.json.JSONArray
import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil
import org.openecomp.mso.bpmn.common.scripts.MsoUtils
@@ -38,7 +59,7 @@ class SNIROUtils{
*
* @author cb645j
*/
- public String buildRequest(Execution execution, String requestId, ServiceDecomposition decomposition, Subscriber subscriber, String homingParams){
+ public String buildRequest(DelegateExecution execution, String requestId, ServiceDecomposition decomposition, Subscriber subscriber, String homingParams){
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
utils.log("DEBUG", "Started Building Sniro Request", isDebugEnabled)
def callbackUrl = utils.createWorkflowMessageAdapterCallbackURL(execution, "SNIROResponse", requestId)
@@ -70,6 +91,25 @@ class SNIROUtils{
orderInfo = StringUtils.normalizeSpace(orderInfo)
}
+ //Determine RequestType
+ //TODO Figure out better way to determine this
+ String requestType = "initial"
+ List<Resource> resources = decomposition.getServiceResources()
+ for(Resource r:resources){
+ HomingSolution currentSolution = r.getCurrentHomingSolution()
+ if(currentSolution != null){
+ requestType = "speed changed"
+ }
+ }
+
+ int timeoutSeconds = 1800
+ String timeout = execution.getVariable("timeout")
+ if(isNotBlank(timeout)){
+ String subT = timeout.substring(2, timeout.length() - 1)
+ int timeoutInt = Integer.parseInt(subT)
+ timeoutSeconds = timeoutInt * 60
+ }
+
//Demands
String placementDemands = ""
StringBuilder sb = new StringBuilder()
@@ -81,7 +121,7 @@ class SNIROUtils{
utils.log("DEBUG", "Allotted Resources List is empty - will try to get service VNFs instead.", isDebugEnabled)
resourceList = decomposition.getServiceVnfs()
}
-
+
if(resourceList.isEmpty() || resourceList == null){
utils.log("DEBUG", "Resources List is Empty", isDebugEnabled)
}else{
@@ -99,7 +139,19 @@ class SNIROUtils{
def resouceModelType = resourceModelInfo.getModelType()
def tenantId = "" //Optional
def tenantName = "" //Optional
-
+
+
+ String existingPlacement = ""
+ HomingSolution currentPlacement = resource.getCurrentHomingSolution()
+ if(currentPlacement != null){
+ String homedServiceInstanceId = currentPlacement.getServiceInstanceId()
+ existingPlacement =
+ ""","existingPlacement": {
+ "serviceInstanceId": "${homedServiceInstanceId}"
+ }"""
+ }
+
+
String demand =
"""{
"resourceInstanceType": "${resourceInstanceType}",
@@ -115,8 +167,9 @@ class SNIROUtils{
},
"tenantId": "${tenantId}",
"tenantName": "${tenantName}"
+ ${existingPlacement}
},"""
-
+
placementDemands = sb.append(demand)
}
placementDemands = placementDemands.substring(0, placementDemands.length() - 1);
@@ -126,7 +179,7 @@ class SNIROUtils{
sb = new StringBuilder()
if(vnfResourceList.isEmpty() || vnfResourceList == null){
utils.log("DEBUG", "Vnf Resources List is Empty", isDebugEnabled)
- }else{
+ }else{
for(VnfResource vnfResource:vnfResourceList){
ModelInfo vnfResourceModelInfo = vnfResource.getModelInfo()
ResourceInstance vnfResourceInstance = vnfResource.getResourceInstance()
@@ -139,7 +192,24 @@ class SNIROUtils{
def resouceModelVersion = vnfResourceModelInfo.getModelVersion()
def resouceModelVersionId = vnfResourceModelInfo.getModelUuid()
def resouceModelType = vnfResourceModelInfo.getModelType()
-
+
+ String curentLicenseJson = ""
+ HomingSolution currentSol = vnfResource.getCurrentHomingSolution()
+ if(currentSol != null){
+ JSONArray entitlementPoolList = currentSol.getLicense().getEntitlementPoolListAsString()
+ JSONArray licenseKeyGroupList = currentSol.getLicense().getLicenseKeyGroupListAsString()
+ curentLicenseJson =
+ """ ,"existingLicense": [
+ {
+ "entitlementPoolUUID":
+ ${entitlementPoolList},
+ "licenseKeyGroupUUID":
+ ${licenseKeyGroupList}
+
+ }
+ ]"""
+ }
+
String demand =
"""{
"resourceInstanceType": "${resourceInstanceType}",
@@ -153,13 +223,14 @@ class SNIROUtils{
"modelVersionId": "${resouceModelVersionId}",
"modelType": "${resouceModelType}"
}
+ ${curentLicenseJson}
},"""
-
+
licenseDemands = sb.append(demand)
}
licenseDemands = licenseDemands.substring(0, licenseDemands.length() - 1);
}
-
+
String request =
"""{
"requestInfo": {
@@ -167,12 +238,13 @@ class SNIROUtils{
"requestId": "${requestId}",
"callbackUrl": "${callbackUrl}",
"sourceId": "mso",
+ "requestType": "${requestType}",
"optimizer": [
"placement",
"license"
],
"numSolutions": 1,
- "timeout": 600
+ "timeout": ${timeoutSeconds}
},
"placementInfo": {
"serviceModelInfo": {
@@ -216,14 +288,14 @@ class SNIROUtils{
*
* @author cb645j
*/
- public void validateCallbackResponse(Execution execution, String response){
+ public void validateCallbackResponse(DelegateExecution execution, String response){
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
String placements = ""
if(isBlank(response)){
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Sniro Async Callback Response is Empty")
}else{
- if(JsonUtils.jsonElementExist(response, "solutionInfo.placement")){
- placements = jsonUtil.getJsonValue(response, "solutionInfo.placement")
+ if(JsonUtils.jsonElementExist(response, "solutionInfo.placementInfo")){
+ placements = jsonUtil.getJsonValue(response, "solutionInfo.placementInfo")
if(isBlank(placements) || placements.equalsIgnoreCase("[]")){
String statusMessage = jsonUtil.getJsonValue(response, "statusMessage")
if(isBlank(statusMessage)){
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ServiceTaskProcessor.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ServiceTaskProcessor.groovy
index d127bd0d62..0b5d013fe0 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ServiceTaskProcessor.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/ServiceTaskProcessor.groovy
@@ -20,7 +20,8 @@
package org.openecomp.mso.bpmn.common.scripts;
-import org.camunda.bpm.engine.runtime.Execution
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.camunda.bpm.engine.delegate.DelegateExecution
/**
@@ -28,5 +29,5 @@ import org.camunda.bpm.engine.runtime.Execution
*
*/
public interface ServiceTaskProcessor {
- public void preProcessRequest(Execution execution);
+ public void preProcessRequest(DelegateExecution execution);
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/TrinityExceptionUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/TrinityExceptionUtil.groovy
index db1cc1ddc3..e75b115b63 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/TrinityExceptionUtil.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/TrinityExceptionUtil.groovy
@@ -20,7 +20,7 @@
package org.openecomp.mso.bpmn.common.scripts
-import org.camunda.bpm.engine.runtime.Execution
+import org.camunda.bpm.engine.delegate.DelegateExecution
import org.apache.commons.lang3.*
class TrinityExceptionUtil {
@@ -60,7 +60,7 @@ class TrinityExceptionUtil {
- String mapAdapterExecptionToCommonException(String response, Execution execution)
+ String mapAdapterExecptionToCommonException(String response, DelegateExecution execution)
{
def utils=new MsoUtils()
def method = getClass().getSimpleName() + '.mapAdapterExecptionToCommonException(' +
@@ -93,7 +93,7 @@ class TrinityExceptionUtil {
* @param execution
* @return mapped exception
*/
- String mapAOTSExecptionToCommonException(String response, Execution execution)
+ String mapAOTSExecptionToCommonException(String response, DelegateExecution execution)
{
def utils=new MsoUtils()
@@ -128,7 +128,7 @@ class TrinityExceptionUtil {
}
}
- String mapSDNCAdapterExceptionToErrorResponse(String sdncAdapterCallbackRequest, Execution execution) {
+ String mapSDNCAdapterExceptionToErrorResponse(String sdncAdapterCallbackRequest, DelegateExecution execution) {
def utils=new MsoUtils()
def prefix=execution.getVariable("prefix")
def method = getClass().getSimpleName() + '.mapSDNCAdapterExceptionToErrorResponse(' +
@@ -182,7 +182,7 @@ class TrinityExceptionUtil {
* @param execution
* @return an error response conforming to the common
*/
- String mapAAIExceptionTCommonException(String response, Execution execution)
+ String mapAAIExceptionTCommonException(String response, DelegateExecution execution)
{
def utils=new MsoUtils()
def isDebugLogEnabled=execution.getVariable("isDebugLogEnabled")
@@ -315,7 +315,7 @@ class TrinityExceptionUtil {
}
- String parseError(Execution execution){
+ String parseError(DelegateExecution execution){
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
def utils=new MsoUtils()
def prefix=execution.getVariable("prefix")
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/UpdateAAIGenericVnf.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/UpdateAAIGenericVnf.groovy
index f137d8d00a..84d9ffdb6b 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/UpdateAAIGenericVnf.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/UpdateAAIGenericVnf.groovy
@@ -21,7 +21,7 @@
package org.openecomp.mso.bpmn.common.scripts
import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.runtime.Execution
+import org.camunda.bpm.engine.delegate.DelegateExecution
import org.openecomp.mso.bpmn.core.WorkflowException
import org.openecomp.mso.rest.APIResponse
import org.springframework.web.util.UriUtils
@@ -37,7 +37,7 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
*
* @param execution The flow's execution instance.
*/
- public void initProcessVariables(Execution execution) {
+ public void initProcessVariables(DelegateExecution execution) {
execution.setVariable('prefix', 'UAAIGenVnf_')
execution.setVariable('UAAIGenVnf_vnfId', null)
execution.setVariable('UAAIGenVnf_personaModelId', null)
@@ -56,7 +56,7 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
*
* @param execution The flow's execution instance.
*/
- public void preProcessRequest(Execution execution) {
+ public void preProcessRequest(DelegateExecution execution) {
def method = getClass().getSimpleName() + '.preProcessRequest(' +
'execution=' + execution.getId() +
')'
@@ -112,7 +112,7 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
*
* @param execution The flow's execution instance.
*/
- public void getGenericVnf(Execution execution) {
+ public void getGenericVnf(DelegateExecution execution) {
def method = getClass().getSimpleName() + '.getGenericVnf(' +
'execution=' + execution.getId() +
')'
@@ -159,7 +159,7 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
*
* @param execution The flow's execution instance.
*/
- public void updateGenericVnf(Execution execution) {
+ public void updateGenericVnf(DelegateExecution execution) {
def method = getClass().getSimpleName() + '.updateGenericVnf(' +
'execution=' + execution.getId() +
')'
@@ -301,7 +301,7 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
*
* @param execution The flow's execution instance.
*/
- public void handleAAIQueryFailure(Execution execution) {
+ public void handleAAIQueryFailure(DelegateExecution execution) {
def method = getClass().getSimpleName() + '.handleAAIQueryFailure(' +
'execution=' + execution.getId() +
')'
@@ -325,7 +325,7 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
*
* @param execution The flow's execution instance.
*/
- public void handleUpdateGenericVnfFailure(Execution execution) {
+ public void handleUpdateGenericVnfFailure(DelegateExecution execution) {
def method = getClass().getSimpleName() + '.handleUpdateGenericVnfFailure(' +
'execution=' + execution.getId() +
')'
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/UpdateAAIVfModule.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/UpdateAAIVfModule.groovy
index c16f0faf74..b3a9423727 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/UpdateAAIVfModule.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/UpdateAAIVfModule.groovy
@@ -21,7 +21,7 @@
package org.openecomp.mso.bpmn.common.scripts
import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.runtime.Execution
+import org.camunda.bpm.engine.delegate.DelegateExecution
import org.openecomp.mso.bpmn.core.WorkflowException
import org.openecomp.mso.rest.APIResponse
import org.springframework.web.util.UriUtils
@@ -37,7 +37,7 @@ public class UpdateAAIVfModule extends AbstractServiceTaskProcessor {
*
* @param execution The flow's execution instance.
*/
- public void initProcessVariables(Execution execution) {
+ public void initProcessVariables(DelegateExecution execution) {
execution.setVariable('prefix', 'UAAIVfMod_')
execution.setVariable('UAAIVfMod_vnfId', null)
execution.setVariable('UAAIVfMod_vfModuleId', null)
@@ -55,7 +55,7 @@ public class UpdateAAIVfModule extends AbstractServiceTaskProcessor {
*
* @param execution The flow's execution instance.
*/
- public void preProcessRequest(Execution execution) {
+ public void preProcessRequest(DelegateExecution execution) {
def method = getClass().getSimpleName() + '.preProcessRequest(' +
'execution=' + execution.getId() +
')'
@@ -89,7 +89,7 @@ public class UpdateAAIVfModule extends AbstractServiceTaskProcessor {
*
* @param execution The flow's execution instance.
*/
- public void getVfModule(Execution execution) {
+ public void getVfModule(DelegateExecution execution) {
def method = getClass().getSimpleName() + '.getVfModule(' +
'execution=' + execution.getId() +
')'
@@ -137,7 +137,7 @@ public class UpdateAAIVfModule extends AbstractServiceTaskProcessor {
*
* @param execution The flow's execution instance.
*/
- public void updateVfModule(Execution execution) {
+ public void updateVfModule(DelegateExecution execution) {
def method = getClass().getSimpleName() + '.updateVfModule(' +
'execution=' + execution.getId() +
')'
@@ -338,7 +338,7 @@ public class UpdateAAIVfModule extends AbstractServiceTaskProcessor {
*
* @param execution The flow's execution instance.
*/
- public void handleAAIQueryFailure(Execution execution) {
+ public void handleAAIQueryFailure(DelegateExecution execution) {
def method = getClass().getSimpleName() + '.handleAAIQueryFailure(' +
'execution=' + execution.getId() +
')'
@@ -361,7 +361,7 @@ public class UpdateAAIVfModule extends AbstractServiceTaskProcessor {
*
* @param execution The flow's execution instance.
*/
- public void handleUpdateVfModuleFailure(Execution execution) {
+ public void handleUpdateVfModuleFailure(DelegateExecution execution) {
def method = getClass().getSimpleName() + '.handleUpdateVfModuleFailure(' +
'execution=' + execution.getId() +
')'
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VfModuleBase.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VfModuleBase.groovy
index 473b71120b..e0b9c3020c 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VfModuleBase.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VfModuleBase.groovy
@@ -20,13 +20,14 @@
package org.openecomp.mso.bpmn.common.scripts;
+import java.io.ObjectInputStream.BlockDataInputStream
+
//import groovy.util.Node;
import javax.xml.parsers.DocumentBuilder
import javax.xml.parsers.DocumentBuilderFactory
import org.apache.commons.lang3.*
-import org.camunda.bpm.engine.runtime.Execution
import org.w3c.dom.Document
import org.w3c.dom.Element
import org.w3c.dom.Node
@@ -234,245 +235,274 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor {
protected String buildVfModuleParams(Map<String, String> vnfParamsMap, String sdncGetResponse, String vnfId, String vnfName,
- String vfModuleId, String vfModuleName, String vfModuleIndex) {
-
- //Get SDNC Response Data
-
- String data = utils.getNodeXml(sdncGetResponse, "response-data")
- data = data.replaceAll("&lt;", "<")
- data = data.replaceAll("&gt;", ">")
+ String vfModuleId, String vfModuleName, String vfModuleIndex, String environmentContext, String workloadContext) {
+
+ //Get SDNC Response Data
+
+ String data = utils.getNodeXml(sdncGetResponse, "response-data")
+ data = data.replaceAll("&lt;", "<")
+ data = data.replaceAll("&gt;", ">")
- String serviceData = utils.getNodeXml(data, "service-data")
- serviceData = utils.removeXmlPreamble(serviceData)
- serviceData = utils.removeXmlNamespaces(serviceData)
- String vnfRequestInfo = utils.getNodeXml(serviceData, "vnf-request-information")
- String oldVnfId = utils.getNodeXml(vnfRequestInfo, "vnf-id")
- oldVnfId = utils.removeXmlPreamble(oldVnfId)
- oldVnfId = utils.removeXmlNamespaces(oldVnfId)
- serviceData = serviceData.replace(oldVnfId, "")
- def vnfId1 = utils.getNodeText1(serviceData, "vnf-id")
-
- Map<String, String> paramsMap = new HashMap<String, String>()
-
- if (vfModuleIndex != null) {
- paramsMap.put("vf_module_index", "${vfModuleIndex}")
- }
+ String serviceData = utils.getNodeXml(data, "service-data")
+ serviceData = utils.removeXmlPreamble(serviceData)
+ serviceData = utils.removeXmlNamespaces(serviceData)
+ String vnfRequestInfo = utils.getNodeXml(serviceData, "vnf-request-information")
+ String oldVnfId = utils.getNodeXml(vnfRequestInfo, "vnf-id")
+ oldVnfId = utils.removeXmlPreamble(oldVnfId)
+ oldVnfId = utils.removeXmlNamespaces(oldVnfId)
+ serviceData = serviceData.replace(oldVnfId, "")
+ def vnfId1 = utils.getNodeText1(serviceData, "vnf-id")
+
+ Map<String, String> paramsMap = new HashMap<String, String>()
+
+ if (vfModuleIndex != null) {
+ paramsMap.put("vf_module_index", "${vfModuleIndex}")
+ }
- // Add-on data
- paramsMap.put("vnf_id", "${vnfId}")
- paramsMap.put("vnf_name", "${vnfName}")
- paramsMap.put("vf_module_id", "${vfModuleId}")
- paramsMap.put("vf_module_name", "${vfModuleName}")
-
- InputSource source = new InputSource(new StringReader(data));
- DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
- docFactory.setNamespaceAware(true)
- DocumentBuilder docBuilder = docFactory.newDocumentBuilder()
- Document responseXml = docBuilder.parse(source)
+ // Add-on data
+ paramsMap.put("vnf_id", "${vnfId}")
+ paramsMap.put("vnf_name", "${vnfName}")
+ paramsMap.put("vf_module_id", "${vfModuleId}")
+ paramsMap.put("vf_module_name", "${vfModuleName}")
+ paramsMap.put("environment_context", "${environmentContext}")
+ paramsMap.put("workload_context", "${workloadContext}")
+
+ InputSource source = new InputSource(new StringReader(data));
+ DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
+ docFactory.setNamespaceAware(true)
+ DocumentBuilder docBuilder = docFactory.newDocumentBuilder()
+ Document responseXml = docBuilder.parse(source)
- // Availability Zones Data
-
- NodeList aZonesList = responseXml.getElementsByTagNameNS("*", "availability-zones")
- String aZonePosition = "0"
- for (int z = 0; z < aZonesList.getLength(); z++) {
- Node node = aZonesList.item(z)
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Element eElement = (Element) node
- String aZoneValue = utils.getElementText(eElement, "availability-zone")
- aZonePosition = z.toString()
- paramsMap.put("availability_zone_${aZonePosition}", "${aZoneValue}")
+ // Availability Zones Data
+
+ NodeList aZonesList = responseXml.getElementsByTagNameNS("*", "availability-zones")
+ String aZonePosition = "0"
+ for (int z = 0; z < aZonesList.getLength(); z++) {
+ Node node = aZonesList.item(z)
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElement = (Element) node
+ String aZoneValue = utils.getElementText(eElement, "availability-zone")
+ aZonePosition = z.toString()
+ paramsMap.put("availability_zone_${aZonePosition}", "${aZoneValue}")
+ }
+ }
+
+ // Map of network-roles and network-tags from vm-networks
+
+ NodeList vmNetworksListGlobal = responseXml.getElementsByTagNameNS("*", "vm-networks")
+ Map<String, String> networkRoleMap = new HashMap<String, String>()
+ for(int n = 0; n < vmNetworksListGlobal.getLength(); n++){
+ Node nodeNetworkKey = vmNetworksListGlobal.item(n)
+ if (nodeNetworkKey.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElementNetworkKey = (Element) nodeNetworkKey
+ String networkRole = utils.getElementText(eElementNetworkKey, "network-role")
+ String networkRoleValue = utils.getElementText(eElementNetworkKey, "network-role-tag")
+ if (networkRoleValue.isEmpty()) {
+ networkRoleValue = networkRole
}
+ networkRoleMap.put(networkRole, networkRoleValue)
}
+ }
- // VNF Networks Data
-
- StringBuilder sbNet = new StringBuilder()
-
- NodeList vnfNetworkList = responseXml.getElementsByTagNameNS("*", "vnf-networks")
- for (int x = 0; x < vnfNetworkList.getLength(); x++) {
- Node node = vnfNetworkList.item(x)
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Element eElement = (Element) node
- String vnfNetworkKey = utils.getElementText(eElement, "network-role")
- String vnfNetworkNeutronIdValue = utils.getElementText(eElement, "neutron-id")
- String vnfNetworkNetNameValue = utils.getElementText(eElement, "network-name")
- String vnfNetworkSubNetIdValue = utils.getElementText(eElement, "subnet-id")
- String vnfNetworkV6SubNetIdValue = utils.getElementText(eElement, "ipv6-subnet-id")
- String vnfNetworkNetFqdnValue = utils.getElementText(eElement, "contrail-network-fqdn")
- paramsMap.put("${vnfNetworkKey}_net_id", "${vnfNetworkNeutronIdValue}")
- paramsMap.put("${vnfNetworkKey}_net_name", "${vnfNetworkNetNameValue}")
- paramsMap.put("${vnfNetworkKey}_subnet_id", "${vnfNetworkSubNetIdValue}")
- paramsMap.put("${vnfNetworkKey}_v6_subnet_id", "${vnfNetworkV6SubNetIdValue}")
- paramsMap.put("${vnfNetworkKey}_net_fqdn", "${vnfNetworkNetFqdnValue}")
-
- NodeList sriovVlanFilterList = eElement.getElementsByTagNameNS("*","sriov-vlan-filter-list")
- StringBuffer sriovFilterBuf = new StringBuffer()
- String values = ""
- for(int i = 0; i < sriovVlanFilterList.getLength(); i++){
- Node node1 = sriovVlanFilterList.item(i)
- if (node1.getNodeType() == Node.ELEMENT_NODE) {
- Element eElement1 = (Element) node1
- String value = utils.getElementText(eElement1, "sriov-vlan-filter")
- if (i != sriovVlanFilterList.getLength() - 1) {
- values = sriovFilterBuf.append(value + ",")
- }
- else {
- values = sriovFilterBuf.append(value);
- }
+ // VNF Networks Data
+
+ StringBuilder sbNet = new StringBuilder()
+
+ NodeList vnfNetworkList = responseXml.getElementsByTagNameNS("*", "vnf-networks")
+ for (int x = 0; x < vnfNetworkList.getLength(); x++) {
+ Node node = vnfNetworkList.item(x)
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElement = (Element) node
+ String vnfNetworkKey = utils.getElementText(eElement, "network-role-tag")
+ String networkRole = utils.getElementText(eElement, "network-role")
+ if (vnfNetworkKey.isEmpty()) {
+ vnfNetworkKey = networkRoleMap.get(networkRole)
+ if (vnfNetworkKey == null || vnfNetworkKey.isEmpty()) {
+ vnfNetworkKey = networkRole
+ }
+ }
+ String vnfNetworkNeutronIdValue = utils.getElementText(eElement, "neutron-id")
+ String vnfNetworkNetNameValue = utils.getElementText(eElement, "network-name")
+ String vnfNetworkSubNetIdValue = utils.getElementText(eElement, "subnet-id")
+ String vnfNetworkV6SubNetIdValue = utils.getElementText(eElement, "ipv6-subnet-id")
+ String vnfNetworkNetFqdnValue = utils.getElementText(eElement, "contrail-network-fqdn")
+ paramsMap.put("${vnfNetworkKey}_net_id", "${vnfNetworkNeutronIdValue}")
+ paramsMap.put("${vnfNetworkKey}_net_name", "${vnfNetworkNetNameValue}")
+ paramsMap.put("${vnfNetworkKey}_subnet_id", "${vnfNetworkSubNetIdValue}")
+ paramsMap.put("${vnfNetworkKey}_v6_subnet_id", "${vnfNetworkV6SubNetIdValue}")
+ paramsMap.put("${vnfNetworkKey}_net_fqdn", "${vnfNetworkNetFqdnValue}")
+
+ NodeList sriovVlanFilterList = eElement.getElementsByTagNameNS("*","sriov-vlan-filter-list")
+ StringBuffer sriovFilterBuf = new StringBuffer()
+ String values = ""
+ for(int i = 0; i < sriovVlanFilterList.getLength(); i++){
+ Node node1 = sriovVlanFilterList.item(i)
+ if (node1.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElement1 = (Element) node1
+ String value = utils.getElementText(eElement1, "sriov-vlan-filter")
+ if (i != sriovVlanFilterList.getLength() - 1) {
+ values = sriovFilterBuf.append(value + ",")
}
- }
- if (!values.isEmpty()) {
- paramsMap.put("${vnfNetworkKey}_ATT_VF_VLAN_FILTER", "${values}")
+ else {
+ values = sriovFilterBuf.append(value);
}
}
- }
+ }
+ if (!values.isEmpty()) {
+ paramsMap.put("${vnfNetworkKey}_ATT_VF_VLAN_FILTER", "${values}")
+ }
+ }
+ }
- // VNF-VMS Data
-
- def key
- def value
- def networkKey
- def networkValue
- def floatingIPKey
- def floatingIPKeyValue
- def floatingIPV6Key
- def floatingIPV6KeyValue
- StringBuilder sb = new StringBuilder()
+ // VNF-VMS Data
+
+ def key
+ def value
+ def networkKey
+ def networkValue
+ def floatingIPKey
+ def floatingIPKeyValue
+ def floatingIPV6Key
+ def floatingIPV6KeyValue
+ StringBuilder sb = new StringBuilder()
- NodeList vmsList = responseXml.getElementsByTagNameNS("*","vnf-vms")
- for (int x = 0; x < vmsList.getLength(); x++) {
- Node node = vmsList.item(x)
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Element eElement = (Element) node
- key = utils.getElementText(eElement, "vm-type")
- String values
- String position = "0"
- StringBuilder sb1 = new StringBuilder()
- NodeList valueList = eElement.getElementsByTagNameNS("*","vm-names")
- NodeList vmNetworksList = eElement.getElementsByTagNameNS("*","vm-networks")
- for(int i = 0; i < valueList.getLength(); i++){
- Node node1 = valueList.item(i)
- if (node1.getNodeType() == Node.ELEMENT_NODE) {
- Element eElement1 = (Element) node1
- value = utils.getElementText(eElement1, "vm-name")
- if (i != valueList.getLength() - 1) {
- values = sb1.append(value + ",")
- }
- else {
- values = sb1.append(value);
- }
- position = i.toString()
- paramsMap.put("${key}_name_${position}", "${value}")
+ NodeList vmsList = responseXml.getElementsByTagNameNS("*","vnf-vms")
+ for (int x = 0; x < vmsList.getLength(); x++) {
+ Node node = vmsList.item(x)
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElement = (Element) node
+ key = utils.getElementText(eElement, "vm-type")
+ String values
+ String position = "0"
+ StringBuilder sb1 = new StringBuilder()
+ NodeList valueList = eElement.getElementsByTagNameNS("*","vm-names")
+ NodeList vmNetworksList = eElement.getElementsByTagNameNS("*","vm-networks")
+ for(int i = 0; i < valueList.getLength(); i++){
+ Node node1 = valueList.item(i)
+ if (node1.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElement1 = (Element) node1
+ value = utils.getElementText(eElement1, "vm-name")
+ if (i != valueList.getLength() - 1) {
+ values = sb1.append(value + ",")
}
+ else {
+ values = sb1.append(value);
+ }
+ position = i.toString()
+ paramsMap.put("${key}_name_${position}", "${value}")
}
- for(int n = 0; n < vmNetworksList.getLength(); n++){
- String floatingIpKeyValueStr = ""
- String floatingIpV6KeyValueStr = ""
- Node nodeNetworkKey = vmNetworksList.item(n)
- if (nodeNetworkKey.getNodeType() == Node.ELEMENT_NODE) {
- Element eElementNetworkKey = (Element) nodeNetworkKey
- String ipAddressValues
- String ipV6AddressValues
- String networkPosition = "0"
- StringBuilder sb2 = new StringBuilder()
- StringBuilder sb3 = new StringBuilder()
- StringBuilder sb4 = new StringBuilder()
+ }
+ for(int n = 0; n < vmNetworksList.getLength(); n++){
+ String floatingIpKeyValueStr = ""
+ String floatingIpV6KeyValueStr = ""
+ Node nodeNetworkKey = vmNetworksList.item(n)
+ if (nodeNetworkKey.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElementNetworkKey = (Element) nodeNetworkKey
+ String ipAddressValues
+ String ipV6AddressValues
+ String networkPosition = "0"
+ StringBuilder sb2 = new StringBuilder()
+ StringBuilder sb3 = new StringBuilder()
+ StringBuilder sb4 = new StringBuilder()
+ networkKey = utils.getElementText(eElementNetworkKey, "network-role-tag")
+ if (networkKey.isEmpty()) {
networkKey = utils.getElementText(eElementNetworkKey, "network-role")
- floatingIPKey = key + '_' + networkKey + '_floating_ip'
- floatingIPKeyValue = utils.getElementText(eElementNetworkKey, "floating-ip")
- if(!floatingIPKeyValue.isEmpty()){
- paramsMap.put("$floatingIPKey", "$floatingIPKeyValue")
- }
- floatingIPV6Key = key + '_' + networkKey + '_floating_v6_ip'
- floatingIPV6KeyValue = utils.getElementText(eElementNetworkKey, "floating-ip-v6")
- if(!floatingIPV6KeyValue.isEmpty()){
- paramsMap.put("$floatingIPV6Key", "$floatingIPV6KeyValue")
- }
- NodeList networkIpsList = eElementNetworkKey.getElementsByTagNameNS("*","network-ips")
- for(int a = 0; a < networkIpsList.getLength(); a++){
- Node ipAddress = networkIpsList.item(a)
- if (ipAddress.getNodeType() == Node.ELEMENT_NODE) {
- Element eElementIpAddress = (Element) ipAddress
- String ipAddressValue = utils.getElementText(eElementIpAddress, "ip-address")
- if (a != networkIpsList.getLength() - 1) {
- ipAddressValues = sb2.append(ipAddressValue + ",")
- }
- else {
- ipAddressValues = sb2.append(ipAddressValue);
- }
- networkPosition = a.toString()
- paramsMap.put("${key}_${networkKey}_ip_${networkPosition}", "${ipAddressValue}")
+ }
+ floatingIPKey = key + '_' + networkKey + '_floating_ip'
+ floatingIPKeyValue = utils.getElementText(eElementNetworkKey, "floating-ip")
+ if(!floatingIPKeyValue.isEmpty()){
+ paramsMap.put("$floatingIPKey", "$floatingIPKeyValue")
+ }
+ floatingIPV6Key = key + '_' + networkKey + '_floating_v6_ip'
+ floatingIPV6KeyValue = utils.getElementText(eElementNetworkKey, "floating-ip-v6")
+ if(!floatingIPV6KeyValue.isEmpty()){
+ paramsMap.put("$floatingIPV6Key", "$floatingIPV6KeyValue")
+ }
+ NodeList networkIpsList = eElementNetworkKey.getElementsByTagNameNS("*","network-ips")
+ for(int a = 0; a < networkIpsList.getLength(); a++){
+ Node ipAddress = networkIpsList.item(a)
+ if (ipAddress.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElementIpAddress = (Element) ipAddress
+ String ipAddressValue = utils.getElementText(eElementIpAddress, "ip-address")
+ if (a != networkIpsList.getLength() - 1) {
+ ipAddressValues = sb2.append(ipAddressValue + ",")
}
- }
-
- paramsMap.put("${key}_${networkKey}_ips", "${ipAddressValues}")
-
- NodeList interfaceRoutePrefixesList = eElementNetworkKey.getElementsByTagNameNS("*","interface-route-prefixes")
- String interfaceRoutePrefixValues = sb3.append("[")
-
- for(int a = 0; a < interfaceRoutePrefixesList.getLength(); a++){
- Node interfaceRoutePrefix = interfaceRoutePrefixesList.item(a)
- if (interfaceRoutePrefix.getNodeType() == Node.ELEMENT_NODE) {
- Element eElementInterfaceRoutePrefix = (Element) interfaceRoutePrefix
- String interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix-cidr")
- if (interfaceRoutePrefixValue == null || interfaceRoutePrefixValue.isEmpty()) {
- interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix")
- }
- if (a != interfaceRoutePrefixesList.getLength() - 1) {
- interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}" + ",")
- }
- else {
- interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}")
- }
+ else {
+ ipAddressValues = sb2.append(ipAddressValue);
}
+ networkPosition = a.toString()
+ paramsMap.put("${key}_${networkKey}_ip_${networkPosition}", "${ipAddressValue}")
}
- interfaceRoutePrefixValues = sb3.append("]")
- if (interfaceRoutePrefixesList.getLength() > 0) {
- paramsMap.put("${key}_${networkKey}_route_prefixes", "${interfaceRoutePrefixValues}")
+ }
+
+ paramsMap.put("${key}_${networkKey}_ips", "${ipAddressValues}")
+
+ NodeList interfaceRoutePrefixesList = eElementNetworkKey.getElementsByTagNameNS("*","interface-route-prefixes")
+ String interfaceRoutePrefixValues = sb3.append("[")
+
+ for(int a = 0; a < interfaceRoutePrefixesList.getLength(); a++){
+ Node interfaceRoutePrefix = interfaceRoutePrefixesList.item(a)
+ if (interfaceRoutePrefix.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElementInterfaceRoutePrefix = (Element) interfaceRoutePrefix
+ String interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix-cidr")
+ if (interfaceRoutePrefixValue == null || interfaceRoutePrefixValue.isEmpty()) {
+ interfaceRoutePrefixValue = utils.getElementText(eElementInterfaceRoutePrefix, "interface-route-prefix")
+ }
+ if (a != interfaceRoutePrefixesList.getLength() - 1) {
+ interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}" + ",")
+ }
+ else {
+ interfaceRoutePrefixValues = sb3.append("{\"interface_route_table_routes_route_prefix\": \"" + interfaceRoutePrefixValue + "\"}")
+ }
}
-
- NodeList networkIpsV6List = eElementNetworkKey.getElementsByTagNameNS("*","network-ips-v6")
- for(int a = 0; a < networkIpsV6List.getLength(); a++){
- Node ipV6Address = networkIpsV6List.item(a)
- if (ipV6Address.getNodeType() == Node.ELEMENT_NODE) {
- Element eElementIpV6Address = (Element) ipV6Address
- String ipV6AddressValue = utils.getElementText(eElementIpV6Address, "ip-address-ipv6")
- if (a != networkIpsV6List.getLength() - 1) {
- ipV6AddressValues = sb4.append(ipV6AddressValue + ",")
- }
- else {
- ipV6AddressValues = sb4.append(ipV6AddressValue);
- }
- networkPosition = a.toString()
- paramsMap.put("${key}_${networkKey}_v6_ip_${networkPosition}", "${ipV6AddressValue}")
+ }
+ interfaceRoutePrefixValues = sb3.append("]")
+ if (interfaceRoutePrefixesList.getLength() > 0) {
+ paramsMap.put("${key}_${networkKey}_route_prefixes", "${interfaceRoutePrefixValues}")
+ }
+
+ NodeList networkIpsV6List = eElementNetworkKey.getElementsByTagNameNS("*","network-ips-v6")
+ for(int a = 0; a < networkIpsV6List.getLength(); a++){
+ Node ipV6Address = networkIpsV6List.item(a)
+ if (ipV6Address.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElementIpV6Address = (Element) ipV6Address
+ String ipV6AddressValue = utils.getElementText(eElementIpV6Address, "ip-address-ipv6")
+ if (a != networkIpsV6List.getLength() - 1) {
+ ipV6AddressValues = sb4.append(ipV6AddressValue + ",")
}
+ else {
+ ipV6AddressValues = sb4.append(ipV6AddressValue);
+ }
+ networkPosition = a.toString()
+ paramsMap.put("${key}_${networkKey}_v6_ip_${networkPosition}", "${ipV6AddressValue}")
}
- paramsMap.put("${key}_${networkKey}_v6_ips", "${ipV6AddressValues}")
}
+ paramsMap.put("${key}_${networkKey}_v6_ips", "${ipV6AddressValues}")
}
- paramsMap.put("${key}_names", "${values}")
}
+ paramsMap.put("${key}_names", "${values}")
}
- //SDNC Response Params
- String sdncResponseParams = ""
- List<String> sdncResponseParamsToSkip = ["vnf_id", "vf_module_id", "vnf_name", "vf_module_name"]
- String vnfParamsChildNodes = utils.getChildNodes(data, "vnf-parameters")
- if(vnfParamsChildNodes == null || vnfParamsChildNodes.length() < 1){
- // No SDNC params
- }else{
- NodeList paramsList = responseXml.getElementsByTagNameNS("*", "vnf-parameters")
- for (int z = 0; z < paramsList.getLength(); z++) {
- Node node = paramsList.item(z)
- Element eElement = (Element) node
- String vnfParameterName = utils.getElementText(eElement, "vnf-parameter-name")
- if (!sdncResponseParamsToSkip.contains(vnfParameterName)) {
- String vnfParameterValue = utils.getElementText(eElement, "vnf-parameter-value")
- paramsMap.put("${vnfParameterName}", "${vnfParameterValue}")
- }
+ }
+ //SDNC Response Params
+ String sdncResponseParams = ""
+ List<String> sdncResponseParamsToSkip = ["vnf_id", "vf_module_id", "vnf_name", "vf_module_name"]
+ String vnfParamsChildNodes = utils.getChildNodes(data, "vnf-parameters")
+ if(vnfParamsChildNodes == null || vnfParamsChildNodes.length() < 1){
+ // No SDNC params
+ }else{
+ NodeList paramsList = responseXml.getElementsByTagNameNS("*", "vnf-parameters")
+ for (int z = 0; z < paramsList.getLength(); z++) {
+ Node node = paramsList.item(z)
+ Element eElement = (Element) node
+ String vnfParameterName = utils.getElementText(eElement, "vnf-parameter-name")
+ if (!sdncResponseParamsToSkip.contains(vnfParameterName)) {
+ String vnfParameterValue = utils.getElementText(eElement, "vnf-parameter-value")
+ paramsMap.put("${vnfParameterName}", "${vnfParameterValue}")
}
}
-
+ }
+
// Parameters received from the request should overwrite any parameters received from SDNC
if (vnfParamsMap != null) {
for (Map.Entry<String, String> entry : vnfParamsMap.entrySet()) {
@@ -490,18 +520,18 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor {
String paramValue = entry.getValue()
paramsXml =
"""<entry>
- <key>${paramName}</key>
- <value>${paramValue}</value>
- </entry>
- """
-
+ <key>${paramName}</key>
+ <value>${paramValue}</value>
+ </entry>
+ """
+
vfModuleParams = sbParams.append(paramsXml)
}
return vfModuleParams
-
+
}
-
+
/*
* Parses VNF parameters passed in on the incoming requests and SDNC parameters returned from SDNC get response
@@ -519,7 +549,7 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor {
*/
protected String buildVfModuleParamsFromCombinedTopologies(Map<String, String> vnfParamsMap, String vnfSdncGetResponse, String vfmoduleSdncGetResponse, String vnfId, String vnfName,
- String vfModuleId, String vfModuleName, String vfModuleIndex) {
+ String vfModuleId, String vfModuleName, String vfModuleIndex, String environmentContext, String workloadContext) {
// Set up initial parameters
@@ -533,7 +563,9 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor {
paramsMap.put("vnf_id", "${vnfId}")
paramsMap.put("vnf_name", "${vnfName}")
paramsMap.put("vf_module_id", "${vfModuleId}")
- paramsMap.put("vf_module_name", "${vfModuleName}")
+ paramsMap.put("vf_module_name", "${vfModuleName}")
+ paramsMap.put("environment_context","${environmentContext}")
+ paramsMap.put("workload_context", "${workloadContext}")
//Get SDNC Response Data for VNF
@@ -564,6 +596,40 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor {
paramsMap.put("availability_zone_${aZonePosition}", "${aZoneValue}")
}
}
+
+ //Get SDNC Response Data for VF Module
+
+ String vfModuleData = utils.getNodeXml(vfmoduleSdncGetResponse, "response-data")
+ vfModuleData = vfModuleData.replaceAll("&lt;", "<")
+ vfModuleData = vfModuleData.replaceAll("&gt;", ">")
+
+ String vfModuleTopology = utils.getNodeXml(vfModuleData, "vf-module-topology")
+ vfModuleTopology = utils.removeXmlPreamble(vfModuleTopology)
+ vfModuleTopology = utils.removeXmlNamespaces(vfModuleTopology)
+ String vfModuleTopologyIdentifier = utils.getNodeXml(vfModuleTopology, "vf-module-topology-identifier")
+
+ InputSource sourceVfModule = new InputSource(new StringReader(vfModuleData));
+ DocumentBuilderFactory docFactoryVfModule = DocumentBuilderFactory.newInstance();
+ docFactoryVfModule.setNamespaceAware(true)
+ DocumentBuilder docBuilderVfModule = docFactoryVfModule.newDocumentBuilder()
+ Document responseXmlVfModule = docBuilderVfModule.parse(sourceVfModule)
+
+ // Map of network-roles and network-tags from vm-networks
+
+ NodeList vmNetworksListGlobal = responseXmlVfModule.getElementsByTagNameNS("*", "vm-networks")
+ Map<String, String> networkRoleMap = new HashMap<String, String>()
+ for(int n = 0; n < vmNetworksListGlobal.getLength(); n++){
+ Node nodeNetworkKey = vmNetworksListGlobal.item(n)
+ if (nodeNetworkKey.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElementNetworkKey = (Element) nodeNetworkKey
+ String networkRole = utils.getElementText(eElementNetworkKey, "network-role")
+ String networkRoleValue = utils.getElementText(eElementNetworkKey, "network-role-tag")
+ if (networkRoleValue.isEmpty()) {
+ networkRoleValue = networkRole
+ }
+ networkRoleMap.put(networkRole, networkRoleValue)
+ }
+ }
// VNF Networks Data
@@ -573,8 +639,15 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor {
for (int x = 0; x < vnfNetworkList.getLength(); x++) {
Node node = vnfNetworkList.item(x)
if (node.getNodeType() == Node.ELEMENT_NODE) {
- Element eElement = (Element) node
- String vnfNetworkKey = utils.getElementText(eElement, "network-role")
+ Element eElement = (Element) node
+ String vnfNetworkKey = utils.getElementText(eElement, "network-role-tag")
+ String networkRole = utils.getElementText(eElement, "network-role")
+ if (vnfNetworkKey.isEmpty()) {
+ vnfNetworkKey = networkRoleMap.get(networkRole)
+ if (vnfNetworkKey == null || vnfNetworkKey.isEmpty()) {
+ vnfNetworkKey = networkRole
+ }
+ }
String vnfNetworkNeutronIdValue = utils.getElementText(eElement, "neutron-id")
String vnfNetworkNetNameValue = utils.getElementText(eElement, "network-name")
String vnfNetworkSubNetIdValue = utils.getElementText(eElement, "subnet-id")
@@ -608,22 +681,7 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor {
}
}
- //Get SDNC Response Data for VF Module
-
- String vfModuleData = utils.getNodeXml(vfmoduleSdncGetResponse, "response-data")
- vfModuleData = vfModuleData.replaceAll("&lt;", "<")
- vfModuleData = vfModuleData.replaceAll("&gt;", ">")
-
- String vfModuleTopology = utils.getNodeXml(vfModuleData, "vf-module-topology")
- vfModuleTopology = utils.removeXmlPreamble(vfModuleTopology)
- vfModuleTopology = utils.removeXmlNamespaces(vfModuleTopology)
- String vfModuleTopologyIdentifier = utils.getNodeXml(vfModuleTopology, "vf-module-topology-identifier")
- InputSource sourceVfModule = new InputSource(new StringReader(vfModuleData));
- DocumentBuilderFactory docFactoryVfModule = DocumentBuilderFactory.newInstance();
- docFactoryVfModule.setNamespaceAware(true)
- DocumentBuilder docBuilderVfModule = docFactoryVfModule.newDocumentBuilder()
- Document responseXmlVfModule = docBuilderVfModule.parse(sourceVfModule)
// VMS Data
@@ -675,7 +733,10 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor {
StringBuilder sb2 = new StringBuilder()
StringBuilder sb3 = new StringBuilder()
StringBuilder sb4 = new StringBuilder()
- networkKey = utils.getElementText(eElementNetworkKey, "network-role")
+ networkKey = utils.getElementText(eElementNetworkKey, "network-role-tag")
+ if (networkKey.isEmpty()) {
+ networkKey = utils.getElementText(eElementNetworkKey, "network-role")
+ }
floatingIPKey = key + '_' + networkKey + '_floating_ip'
floatingIPKeyValue = utils.getElementText(eElementNetworkKey, "floating-ip")
if(!floatingIPKeyValue.isEmpty()){
@@ -886,6 +947,23 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor {
aZones = sbAZone.append(aZoneXml)
}
}
+
+ // Map of network-roles and network-tags from vm-networks
+
+ NodeList vmNetworksListGlobal = responseXml.getElementsByTagNameNS("*", "vm-networks")
+ Map<String, String> networkRoleMap = new HashMap<String, String>()
+ for(int n = 0; n < vmNetworksListGlobal.getLength(); n++){
+ Node nodeNetworkKey = vmNetworksListGlobal.item(n)
+ if (nodeNetworkKey.getNodeType() == Node.ELEMENT_NODE) {
+ Element eElementNetworkKey = (Element) nodeNetworkKey
+ String networkRole = utils.getElementText(eElementNetworkKey, "network-role")
+ String networkRoleValue = utils.getElementText(eElementNetworkKey, "network-role-tag")
+ if (networkRoleValue.isEmpty()) {
+ networkRoleValue = networkRole
+ }
+ networkRoleMap.put(networkRole, networkRoleValue)
+ }
+ }
// VNF Networks Data
String vnfNetworkNetId = ""
@@ -905,7 +983,14 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor {
Node node = vnfNetworkList.item(x)
if (node.getNodeType() == Node.ELEMENT_NODE) {
Element eElement = (Element) node
- String vnfNetworkKey = utils.getElementText(eElement, "network-role")
+ String vnfNetworkKey = utils.getElementText(eElement, "network-role-tag")
+ String networkRole = utils.getElementText(eElement, "network-role")
+ if (vnfNetworkKey.isEmpty()) {
+ vnfNetworkKey = networkRoleMap.get(networkRole)
+ if (vnfNetworkKey == null || vnfNetworkKey.isEmpty()) {
+ vnfNetworkKey = networkRole
+ }
+ }
String vnfNetworkNeutronIdValue = utils.getElementText(eElement, "neutron-id")
String vnfNetworkNetNameValue = utils.getElementText(eElement, "network-name")
String vnfNetworkSubNetIdValue = utils.getElementText(eElement, "subnet-id")
@@ -1034,7 +1119,10 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor {
StringBuilder sb2 = new StringBuilder()
StringBuilder sb3 = new StringBuilder()
StringBuilder sb4 = new StringBuilder()
- networkKey = utils.getElementText(eElementNetworkKey, "network-role")
+ networkKey = utils.getElementText(eElementNetworkKey, "network-role-tag")
+ if (networkKey.isEmpty()) {
+ networkKey = utils.getElementText(eElementNetworkKey, "network-role")
+ }
floatingIPKey = key + '_' + networkKey + '_floating_ip'
floatingIPKeyValue = utils.getElementText(eElementNetworkKey, "floating-ip")
if(!floatingIPKeyValue.isEmpty()){
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VnfAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VnfAdapterRestV1.groovy
index dbcab28df3..5f2a845ef2 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VnfAdapterRestV1.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VnfAdapterRestV1.groovy
@@ -22,7 +22,7 @@ package org.openecomp.mso.bpmn.common.scripts
import org.apache.commons.lang3.*
import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.runtime.Execution
+import org.camunda.bpm.engine.delegate.DelegateExecution
import org.openecomp.mso.rest.APIResponse
import org.openecomp.mso.rest.RESTClient
import org.openecomp.mso.rest.RESTConfig
@@ -32,7 +32,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
ExceptionUtil exceptionUtil = new ExceptionUtil()
// VNF Response Processing
- public void preProcessRequest (Execution execution) {
+ public void preProcessRequest (DelegateExecution execution) {
def method = getClass().getSimpleName() + '.preProcessRequest(' +
'execution=' + execution.getId() +
')'
@@ -58,6 +58,10 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String messageId = getChildText(root, 'messageId')
+ if ('rollbackVolumeGroupRequest'.equals(requestType)) {
+ messageId = getMessageIdForVolumeGroupRollback(root)
+ }
+
if (messageId == null || messageId.isEmpty()) {
String msg = getProcessKey(execution) + ': no messageId in ' + requestType
logError(msg)
@@ -219,7 +223,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
vnfAdapterUrl = vnfAdapterEndpoint + '/volume-groups/' + URLEncoder.encode(volumeGroupId, 'UTF-8')
} else if ('rollbackVolumeGroupRequest'.equals(requestType)) {
- String volumeGroupId = getChildText(root, 'volumeGroupId')
+ String volumeGroupId = root.'volumeGroupRollback'.'volumeGroupId'.text()
if (volumeGroupId == null || volumeGroupId.isEmpty()) {
String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType
@@ -274,11 +278,15 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
}
}
+ public String getMessageIdForVolumeGroupRollback(Node root) {
+ return root.'volumeGroupRollback'.'messageId'.text()
+ }
+
/**
* This method is used instead of an HTTP Connector task because the
* connector does not allow DELETE with a body.
*/
- public void sendRequestToVnfAdapter(Execution execution) {
+ public void sendRequestToVnfAdapter(DelegateExecution execution) {
def method = getClass().getSimpleName() + '.sendRequestToVnfAdapter(' +
'execution=' + execution.getId() +
')'
@@ -324,7 +332,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
}
}
- public void processCallback(Execution execution){
+ public void processCallback(DelegateExecution execution){
def method = getClass().getSimpleName() + '.processCallback(' +
'execution=' + execution.getId() +
')'
@@ -360,7 +368,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
* a WorkflowException. If the response cannot be parsed, a more generic
* WorkflowException is created.
*/
- public void vnfAdapterWorkflowException(Execution execution, Object response) {
+ public void vnfAdapterWorkflowException(DelegateExecution execution, Object response) {
try {
Node root = new XmlParser().parseText(response)
String category = getChildText(root, "category")
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VnfAdapterUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VnfAdapterUtils.groovy
index cb173660cd..9c1a472a67 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VnfAdapterUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VnfAdapterUtils.groovy
@@ -20,7 +20,7 @@
package org.openecomp.mso.bpmn.common.scripts
import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.runtime.Execution;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.openecomp.mso.bpmn.core.WorkflowException
class VnfAdapterUtils {
@@ -33,7 +33,7 @@ class VnfAdapterUtils {
ExceptionUtil exceptionUtil = new ExceptionUtil()
- public void validateVnfResponse(Execution execution, String responseVar, String responseCodeVar, String errorResponseVar) {
+ public void validateVnfResponse(DelegateExecution execution, String responseVar, String responseCodeVar, String errorResponseVar) {
def method = getClass().getSimpleName() + '.validateVnfResponse(' +
'execution=' + execution.getId() +
', responseVar=' + responseVar +