aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOCommonBPMN/src/main
diff options
context:
space:
mode:
authorDeterme, Sebastien (sd378r) <sd378r@intl.att.com>2017-05-09 03:55:30 -0700
committerDeterme, Sebastien (sd378r) <sd378r@intl.att.com>2017-05-09 05:18:51 -0700
commitb1e5734ef566af5d49ba17d05ca0ab7b56d6666d (patch)
tree92a232e908ae587cb244fd102e9c2c5648c66a9f /bpmn/MSOCommonBPMN/src/main
parentd4f2190943216278826f39e7010d57f872bda90d (diff)
[MSO-8] Additional fixes for the second rebase
DB fixes + BPMN flows and groovy fixes + Fix issue with CloudConfig file not reloaded properly when it's wrong (JSON error or model hierarchy mistake) at MSO startup Change-Id: I2853030b78499e2a761706b643ea210955e72de3 Signed-off-by: Determe, Sebastien (sd378r) <sd378r@intl.att.com> [MSO-8] Restore files removed in patch set 2 Those groovy files must be there Change-Id: I9a47ac3d9c8fc06774a1b8f518491b1b0b00af04 Signed-off-by: Determe, Sebastien (sd378r) <sd378r@intl.att.com>
Diffstat (limited to 'bpmn/MSOCommonBPMN/src/main')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AaiUtil.groovy198
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AbstractServiceTaskProcessor.groovy30
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AllottedResourceUtils.groovy312
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CreateAAIVfModule.groovy27
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CreateGenericVNFUtils.groovy164
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenerateVfModuleName.groovy6
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericDeleteVnf.groovy1
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericGetService.groovy111
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericGetVnf.groovy2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericPutService.groovy6
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericUtils.groovy20
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SDNCAdapterUtils.groovy2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/UpdateAAIGenericVnf.groovy31
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/UpdateAAIVfModule.groovy8
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/VfModuleBase.groovy246
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/AbstractCallbackService.java352
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java235
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java763
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowMessageResource.java103
-rw-r--r--bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericGetService.bpmn210
20 files changed, 1472 insertions, 1355 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 95a577c946..b50bf68207 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
@@ -27,17 +27,19 @@ import org.openecomp.mso.rest.RESTClient
import org.openecomp.mso.rest.RESTConfig
class AaiUtil {
-
+
public MsoUtils utils = new MsoUtils()
- public static final String AAI_NAMESPACE_STRING = 'http://org.openecomp.aai.inventory/'
+ public static final String AAI_NAMESPACE_STRING_KEY = 'URN_mso_workflow_global_default_aai_namespace'
public static final String DEFAULT_VERSION_KEY = 'URN_mso_workflow_global_default_aai_version'
-
+
+ private String aaiNamespace = null;
+
private AbstractServiceTaskProcessor taskProcessor
public AaiUtil(AbstractServiceTaskProcessor taskProcessor) {
this.taskProcessor = taskProcessor
}
-
+
public String getNetworkGenericVnfEndpoint(Execution execution) {
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
String endpoint = execution.getVariable("URN_aai_endpoint")
@@ -52,7 +54,7 @@ class AaiUtil {
taskProcessor.logDebug('AaiUtil.getNetworkGenericVnfUri() - AAI URI: ' + uri, isDebugLogEnabled)
return uri
}
-
+
public String getNetworkVpnBindingUri(Execution execution) {
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
def uri = getUri(execution, 'vpn_binding')
@@ -73,7 +75,7 @@ class AaiUtil {
taskProcessor.logDebug('AaiUtil.getNetworkTableReferencesUri() - AAI URI: ' + uri, isDebugLogEnabled)
return uri
}
-
+
public String getNetworkVceUri(Execution execution) {
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
def uri = getUri(execution, 'vce')
@@ -110,7 +112,7 @@ class AaiUtil {
taskProcessor.logDebug('AaiUtil.getCloudInfrastructureCloudRegionEndpoint() - AAI endpoint: ' + endpoint + uri, isDebugLogEnabled)
return endpoint + uri
}
-
+
public String getCloudInfrastructureCloudRegionUri(Execution execution) {
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
def uri = getUri(execution, 'cloud_region')
@@ -131,7 +133,7 @@ class AaiUtil {
taskProcessor.logDebug('AaiUtil.getSearchNodesQueryUri() - AAI URI: ' + uri, isDebugLogEnabled)
return uri
}
-
+
public String getSearchNodesQueryEndpoint(Execution execution) {
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
String endpoint = execution.getVariable("URN_aai_endpoint")
@@ -139,7 +141,7 @@ class AaiUtil {
taskProcessor.logDebug('AaiUtil.getSearchNodesQueryEndpoint() - AAI endpoint: ' + endpoint + uri, isDebugLogEnabled)
return endpoint + uri
}
-
+
public String getSearchGenericQueryUri(Execution execution) {
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
def uri = getUri(execution, 'generic_query')
@@ -151,37 +153,39 @@ class AaiUtil {
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
resourceName = resourceName.replaceAll('-', '_')
-
+
def versionWithResourceKey = "URN_mso_workflow_default_aai_${resourceName}_version"
def versionWithProcessKey = "URN_mso_workflow_custom_${processKey}_aai_version"
def version = execution.getVariable(versionWithProcessKey)
if (version) {
taskProcessor.logDebug("AaiUtil.getVersion() - using flow specific ${versionWithProcessKey}=${version}", isDebugLogEnabled)
- return version
+ return version
}
-
+
version = execution.getVariable(versionWithResourceKey)
if (version) {
taskProcessor.logDebug("AaiUtil.getVersion() - using resource specific ${versionWithResourceKey}=${version}", isDebugLogEnabled)
return version
}
-
+
version = execution.getVariable(DEFAULT_VERSION_KEY)
if (version) {
taskProcessor.logDebug("AaiUtil.getVersion() - using default version ${DEFAULT_VERSION_KEY}=${version}", isDebugLogEnabled)
return version
}
-
+
(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) {
def isDebugLogEnabled = execution.getVariable('isDebugLogEnabled')
def processKey = taskProcessor.getMainProcessKey(execution)
-
resourceName = resourceName.replaceAll('-', '_')
+
+ //set namespace
+ setNamespace(execution)
// Check for flow+resource specific first
def key = "URN_mso_workflow_${processKey}_aai_${resourceName}_uri"
@@ -190,7 +194,7 @@ class AaiUtil {
taskProcessor.logDebug("AaiUtil.getUri() - using flow+resource specific key: ${key}=${uri}", isDebugLogEnabled)
return uri
}
-
+
// Check for versioned key
def version = getVersion(execution, resourceName, processKey)
key = "URN_mso_workflow_default_aai_v${version}_${resourceName}_uri"
@@ -204,17 +208,80 @@ 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) {
+ def key = AAI_NAMESPACE_STRING_KEY
+ aaiNamespace = execution.getVariable(key)
+ if (aaiNamespace == null ) {
+ (new ExceptionUtil()).buildAndThrowWorkflowException(execution, 9999, 'Internal Error: AAI URI entry for ' + key + ' not defined in the MSO URN properties file')
+ }
+ }
+
+ /**
+ * 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)
+ * return namespace (plus version from uri)
+ *
+ * @param url
+ *
+ * @return namespace
+ */
+
public String getNamespaceFromUri(String uri) {
- String namespace = AAI_NAMESPACE_STRING
+ if (aaiNamespace == null) {
+ throw new Exception('Internal Error: AAI Namespace has not been set yet. A getUri() method needs to be invoked first.')
+ }
+ String namespace = aaiNamespace
if(uri!=null){
- return namespace + uri.substring(uri.indexOf("v"), uri.indexOf("v")+2)
+ String version = getVersionFromUri(uri)
+ return namespace + "v"+version
}else{
return namespace
}
}
-
+ /**
+ * This method can be used for building namespace with aai version out of uri.
+ * NOTE: 2 arguments: Execution execution & String uri
+ * @param execution
+ * @param url
+ *
+ * @return namespace
+ */
+ public String getNamespaceFromUri(Execution 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')
+ }
+ if(uri!=null){
+ String version = getVersionFromUri(uri)
+ return namespace + "v"+version
+ }else{
+ return namespace
+ }
+ }
+
+ /**
+ * This is used to extract the version from uri.
+ *
+ * @param uri
+ *
+ * @return version
+ */
+ private String getVersionFromUri(String uri) {
+ def version = ""
+ def savedVersion = ""
+ for (int x=2; x<6; x++) {
+ version = uri.substring(uri.indexOf("v")+1, uri.indexOf("v")+x)
+ if (!Character.isDigit(version.charAt(version.size()-1))) {
+ break
+ }
+ savedVersion = version
+ }
+ return savedVersion
+ }
+
/**
* This reusable method can be used for making AAI Get Calls. The url should
* be passed as a parameter along with the execution. The method will
@@ -232,16 +299,16 @@ class AaiUtil {
String uuid = UUID.randomUUID()
taskProcessor.logDebug( "Generated uuid is: " + uuid, isDebugEnabled)
taskProcessor.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).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Accept","application/xml");
-
+
if (basicAuthCred != null && !"".equals(basicAuthCred)) {
client.addAuthorizationHeader(basicAuthCred)
}
-
+
APIResponse apiResponse = client.get()
return apiResponse
@@ -252,6 +319,7 @@ class AaiUtil {
taskProcessor.logDebug( "======== COMPLETED Execute AAI Get Process ======== ", isDebugEnabled)
}
+
/**
* This reusable method can be used for making AAI httpPut Calls. The url should
* be passed as a parameter along with the execution and payload. The method will
@@ -287,7 +355,7 @@ class AaiUtil {
}
taskProcessor.logDebug( "======== Completed Execute AAI Put Process ======== ", isDebugEnabled)
}
-
+
/**
* This reusable method can be used for making AAI httpPatch Calls. The url should
* be passed as a parameter along with the execution and payload. The method will
@@ -345,7 +413,7 @@ class AaiUtil {
taskProcessor.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).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Accept","application/xml");
if (basicAuthCred != null && !"".equals(basicAuthCred)) {
@@ -379,8 +447,9 @@ class AaiUtil {
try{
String uuid = UUID.randomUUID()
taskProcessor.logDebug( "Generated uuid is: " + uuid, isDebugEnabled)
+
taskProcessor.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).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Accept","application/xml").addAuthorizationHeader(authHeader);
@@ -398,11 +467,11 @@ class AaiUtil {
}
taskProcessor.logDebug( "======== Completed Execute AAI Delete Process ======== ", isDebugEnabled)
}
-
+
/**
- * This reusable method can be used for making AAI Post Calls. The url should
- * be passed as a parameter along with the execution. The method will
- * return an APIResponse.
+ * This reusable method can be used for making AAI Post Calls. The url
+ * and payload should be passed as a parameters along with the execution.
+ * The method will return an APIResponse.
*
* @param execution
* @param url
@@ -421,6 +490,7 @@ class AaiUtil {
String basicAuthCred = utils.getBasicAuth(execution.getVariable("URN_aai_auth"),execution.getVariable("URN_mso_msoKey"))
RESTConfig config = new RESTConfig(url);
RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Accept","application/xml");
+
if (basicAuthCred != null && !"".equals(basicAuthCred)) {
client.addAuthorizationHeader(basicAuthCred)
}
@@ -435,7 +505,49 @@ class AaiUtil {
taskProcessor.logDebug( "======== Completed Execute AAI Post Process ======== ", isDebugEnabled)
}
- /** Utilitty to get the Cloud Region from AAI
+ /**
+ * This reusable method can be used for making AAI Post Calls. The url
+ * and payload should be passed as a parameters along with the execution.
+ * The method will return an APIResponse.
+ *
+ * @param execution
+ * @param url
+ * @param payload
+ * @param authenticationHeader - addAuthenticationHeader value
+ * @param headerName - name of header you want to add, i.e. addHeader(headerName, headerValue)
+ * @param headerValue - the header's value, i.e. addHeader(headerName, headerValue)
+ *
+ * @return APIResponse
+ */
+ public APIResponse executeAAIPostCall(Execution execution, String url, String payload, String authenticationHeaderValue, String headerName, String headerValue){
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ taskProcessor.logDebug( " ======== Started Execute AAI Post Process ======== ", isDebugEnabled)
+ try{
+ taskProcessor.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(authenticationHeaderValue).addHeader(headerName, headerValue)
+ if (basicAuthCred != null && !"".equals(basicAuthCred)) {
+ client.addAuthorizationHeader(basicAuthCred)
+ }
+ APIResponse apiResponse = client.httpPost(payload)
+
+ return apiResponse
+
+ }catch(Exception e){
+ taskProcessor.utils.log("ERROR", "Exception occured while executing AAI Post Call. Exception is: \n" + e, isDebugEnabled)
+ return e
+ }
+ taskProcessor.logDebug( "======== Completed Execute AAI Post Process ======== ", isDebugEnabled)
+ }
+
+
+
+
+
+ /* Utility to get the Cloud Region from AAI
* Returns String cloud region id, (ie, cloud-region-id)
* @param execution
* @param url - url for AAI get cloud region
@@ -479,7 +591,7 @@ class AaiUtil {
return "ERROR"
}
} else { // not 200
- if (returnCode == "404") {
+ if (returnCode == "404") {
if (backend == "PO") {
regionId = inputCloudRegion
} else { // backend not "PO"
@@ -487,10 +599,10 @@ class AaiUtil {
}
taskProcessor.utils.log("DEBUG", "Cloud Region value for code='404' of " + backend + " is: " + regionId, isDebugEnabled)
return regionId
- } else {
- taskProcessor.utils.log("ERROR", "Call AAI Cloud Region is NOT Successful.", isDebugEnabled)
- return "ERROR"
- }
+ } else {
+ taskProcessor.utils.log("ERROR", "Call AAI Cloud Region is NOT Successful.", isDebugEnabled)
+ return "ERROR"
+ }
}
}catch(Exception e) {
taskProcessor.utils.log("ERROR", "Exception occured while getting the Cloud Reqion. Exception is: \n" + e, isDebugEnabled)
@@ -511,19 +623,18 @@ class AaiUtil {
return ret
}
-
/**
- * Get the lowest unused VF Module index from AAI response for a given module type. The criteria for
+ * Get the lowest unused VF Module index from AAI response for a given module type. The criteria for
* determining module type is specified by "key" parameter (for example, "persona-model-id"),
* the value for filtering is specified in "value" parameter
- *
+ *
* @param execution
* @param aaiVnfResponse
* @param key
* @param value
*
* @return moduleIndex
- *
+ *
*/
public int getLowestUnusedVfModuleIndexFromAAIVnfResponse(Execution execution, String aaiVnfResponse, String key, String value) {
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
@@ -531,7 +642,7 @@ class AaiUtil {
String vfModulesText = taskProcessor.utils.getNodeXml(aaiVnfResponse, "vf-modules")
if (vfModulesText == null || vfModulesText.isEmpty()) {
taskProcessor.utils.log("DEBUG", "There are no VF modules in this VNF yet", isDebugEnabled)
- return 0
+ return 0
}
else {
def xmlVfModules= new XmlSlurper().parseText(vfModulesText)
@@ -548,15 +659,14 @@ class AaiUtil {
matchingVfModules = matchingVfModules + taskProcessor.utils.removeXmlPreamble(vfModuleXml)
}
}
- matchingVfModules = matchingVfModules + "</vfModules>"
+ matchingVfModules = matchingVfModules + "</vfModules>"
taskProcessor.utils.log("DEBUG", "Matching VF Modules: " + matchingVfModules, isDebugEnabled)
String lowestUnusedIndex = taskProcessor.utils.getLowestUnusedIndex(matchingVfModules)
return Integer.parseInt(lowestUnusedIndex)
- }
+ }
}
else {
return 0
}
}
-
} \ No newline at end of file
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 d7aa97906c..e86f77c890 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
@@ -697,6 +697,10 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
/**
* Constructs a workflow message callback URL for the specified message type and correlator.
+ * This type of callback URL is used when a workflow wants an MSO adapter (like the SDNC
+ * adapter) to call it back. In other words, this is for callbacks internal to the MSO
+ * complex. Use <code>createWorkflowMessageAdapterCallbackURL</code> if the callback
+ * will come from outside the MSO complex.
* @param messageType the message type (e.g. SDNCAResponse or VNFAResponse)
* @param correlator the correlator value (e.g. a request ID)
*/
@@ -717,4 +721,30 @@ public abstract class AbstractServiceTaskProcessor implements ServiceTaskProcess
'/' + UriUtils.encodePathSegment(messageType, 'UTF-8') +
'/' + UriUtils.encodePathSegment(correlator, 'UTF-8')
}
+
+ /**
+ *
+ * Constructs a workflow message callback URL for the specified message type and correlator.
+ * This type of callback URL is used when a workflow wants a system outside the MSO complex
+ * to call it back through the Workflow Message Adapter.
+ * @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) {
+ String endpoint = (String) execution.getVariable('URN_mso_adapters_workflow_message_endpoint')
+
+ if (endpoint == null || endpoint.isEmpty()) {
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000,
+ 'mso:adapters:workflow:message:endpoint URN mapping is not set')
+ }
+
+ while (endpoint.endsWith('/')) {
+ endpoint = endpoint.substring(0, endpoint.length()-1)
+ }
+
+ return endpoint +
+ '/' + UriUtils.encodePathSegment(messageType, 'UTF-8') +
+ '/' + UriUtils.encodePathSegment(correlator, 'UTF-8')
+ }
} \ No newline at end of file
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
new file mode 100644
index 0000000000..540fe036fc
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/AllottedResourceUtils.groovy
@@ -0,0 +1,312 @@
+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.openecomp.mso.bpmn.core.WorkflowException
+import org.openecomp.mso.rest.APIResponse;
+
+class AllottedResourceUtils {
+
+ private AbstractServiceTaskProcessor taskProcessor
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ MsoUtils utils;
+
+ public AllottedResourceUtils(AbstractServiceTaskProcessor taskProcessor) {
+ this.taskProcessor = taskProcessor
+ this.utils = taskProcessor.utils
+ }
+
+ /*Used on Create - called from DoCreate
+ * Using Consuming ServiceInstanceId get related Allotted Resources Orchestration status from AAI
+ * 1) get related AR links for CSI 2) get AR from AR links
+ * return: null -> AR Not found
+ * return: " " -> AR found with empty orchStatus
+ * return: orchStatus - > AR found with this orchStatus
+ * setsVariable aaiARGetResponse
+ */
+ public String getAROrchStatus (Execution execution) {
+
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("DEBUG"," ***** getAROrchStatus *****", isDebugEnabled)
+ String msg = ""
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ String arType = execution.getVariable("allottedResourceType")
+ String arRole = execution.getVariable("allottedResourceRole")
+ String siXml = execution.getVariable("CSI_service")
+ String ar = null
+ String orchStatus = null
+ XmlParser xmlParser = new XmlParser()
+ utils.log("DEBUG","getAROrchStatus siXml:" + siXml, isDebugEnabled)
+ try {
+ if (!isBlank(siXml)) {
+ def groovy.util.Node siNode = xmlParser.parseText(siXml)
+ def groovy.util.Node relationshipList = utils.getChildNode(siNode, 'relationship-list')
+ if (relationshipList != null) {
+ def groovy.util.NodeList relationships = utils.getIdenticalChildren(relationshipList, 'relationship')
+ for (groovy.util.Node relationship in relationships) {
+ def groovy.util.Node relatedTo = utils.getChildNode(relationship, 'related-to')
+ if ((relatedTo != null) && (relatedTo.text().equals('allotted-resource'))) {
+ utils.log("DEBUG","getARORchStatus AR found", isDebugEnabled)
+ def groovy.util.Node relatedLink = utils.getChildNode(relationship, 'related-link')
+ if (relatedLink != null){
+ ar = getARbyLink(execution, relatedLink.text(), arRole)
+ if (!isBlank(ar))
+ {
+ orchStatus = execution.getVariable("aaiAROrchStatus")
+ break
+ }
+ }
+ }
+ }
+ }
+ }
+ }catch(Exception e){
+ utils.log("DEBUG", " Error encountered in getAROrchStatus" + e.getMessage(), isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error in getAROrchStatus" + e.getMessage())
+ }
+ utils.log("DEBUG"," *****Exit getAROrchStatus **** OrchStatus:" + orchStatus, isDebugEnabled)
+ return orchStatus
+ }
+
+ // get Allotted Resource by AllottedResourceId
+ // used on Delete - called from doDeleteAR
+ // setsVariable aaiARGetResponse
+ public String getARbyId (Execution execution, String allottedResourceId) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ utils.log("DEBUG", " ***** getARbyId ***** ", isDebugEnabled)
+ String arLink = getARLinkbyId(execution, allottedResourceId)
+ String ar = null
+ if (!isBlank(arLink))
+ {
+ ar = getARbyLink(execution, arLink, "")
+ }
+ utils.log("DEBUG", " ***** Exit GetARbyId ***** AR:" + ar, isDebugEnabled)
+ return ar;
+ }
+
+ // get Allotted Resource Link by AllottedResourceId using Nodes Query
+ // used on Delete - called from getARbyId
+ public String getARLinkbyId (Execution execution, String allottedResourceId) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ utils.log("DEBUG", " ***** getARLinkbyId ***** ", isDebugEnabled)
+ String arLink = null
+ try {
+ AaiUtil aaiUriUtil = new AaiUtil(taskProcessor)
+ String aaiNQUri = aaiUriUtil.getSearchNodesQueryEndpoint(execution)
+ String aaiEndpoint = execution.getVariable("URN_aai_endpoint")
+ String aaiUrl = "${aaiNQUri}?search-node-type=allotted-resource&filter=id:EQUALS:${allottedResourceId}"
+
+ utils.log("DEBUG", "getARLinkbyId url: \n" + aaiUrl, isDebugEnabled)
+
+ APIResponse response = aaiUriUtil.executeAAIGetCall(execution, aaiUrl)
+ int responseCode = response.getStatusCode()
+ utils.log("DEBUG", " GET AR response code is: " + responseCode, isDebugEnabled)
+
+ String aaiResponse = response.getResponseBodyAsString()
+ aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse)
+ utils.log("DEBUG", "GET AR:" + aaiResponse, isDebugEnabled)
+ if(responseCode == 200 || responseCode == 202){
+ utils.log("DEBUG", "GET AR Received a Good Response Code", isDebugEnabled)
+ if(utils.nodeExists(aaiResponse, "result-data")){
+ utils.log("DEBUG", "Query for AllottedResource Url Response Does Contain Data" , isDebugEnabled)
+ arLink = utils.getNodeText1(aaiResponse, "resource-link")
+ }else{
+ utils.log("DEBUG", "GET AR Response Does NOT Contain Data" , isDebugEnabled)
+ }
+ }else if(responseCode == 404){
+ utils.log("DEBUG", "GET AR received a Not Found (404) Response", isDebugEnabled)
+ }
+ else{
+ utils.log("DEBUG", " GET AR received a Bad Response: \n" + aaiResponse, isDebugEnabled)
+ buildAAIErrorResponse(execution, aaiResponse, "Error retrieving AR from AAI")
+ }
+ }catch(Exception e){
+ utils.log("DEBUG", " Error encountered within GetAaiAR" + e.getMessage(), isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error in GetARbyId" + e.getMessage())
+ }
+ utils.log("DEBUG", " ***** Exit GetARLinkbyId ***** Link:" + arLink, isDebugEnabled)
+ return arLink
+ }
+
+ // get Allotted resource using Link
+ // 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) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ utils.log("DEBUG", " ***** getARbyLink ***** ", isDebugEnabled)
+ String ar = null
+ String arUrl = null
+ try {
+ AaiUtil aaiUriUtil = new AaiUtil(taskProcessor)
+ String aai_endpoint = execution.getVariable("URN_aai_endpoint")
+ String arEndpoint = ""
+
+ if(!isBlank(link)) {
+ utils.log("DEBUG", "Incoming AR Resource Link is: " + link, isDebugEnabled)
+ String[] split = link.split("/aai/")
+ arEndpoint = "/aai/" + split[1]
+ }
+
+ arUrl = "${aai_endpoint}" + arEndpoint
+
+ utils.log("DEBUG", "GET AR Aai Path is: \n" + arUrl, isDebugEnabled)
+
+ APIResponse response = aaiUriUtil.executeAAIGetCall(execution, arUrl)
+ int responseCode = response.getStatusCode()
+ utils.log("DEBUG", " GET AR response code is: " + responseCode, isDebugEnabled)
+
+ String aaiResponse = response.getResponseBodyAsString()
+ aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse)
+ utils.log("DEBUG", "GET AR:" + aaiResponse, isDebugEnabled)
+ if(responseCode == 200 || responseCode == 202){
+ utils.log("DEBUG", "GET AR Received a Good Response Code", isDebugEnabled)
+ if(utils.nodeExists(aaiResponse, "allotted-resource")){
+ if (!isBlank(role))
+ {
+ if (utils.nodeExists(aaiResponse, "role") && role.equals(utils.getNodeText1(aaiResponse, "role"))) {
+ ar = aaiResponse
+ }else{
+ utils.log("DEBUG", "AAI AR does not match input role:" + role, isDebugEnabled)
+ }
+ }
+ else
+ {
+ ar = aaiResponse
+ }
+ }
+ else
+ {
+ utils.log("DEBUG", "GET AR Does NOT Contain Data" , isDebugEnabled)
+ }
+ }else if(responseCode == 404){
+ utils.log("DEBUG", "GET AR received a Not Found (404) Response", isDebugEnabled)
+ }
+ else{
+ utils.log("DEBUG", " GET AR received a Bad Response: \n" + aaiResponse, isDebugEnabled)
+ buildAAIErrorResponse(execution, aaiResponse, "Error retrieving AR from AAI")
+ }
+ }catch(Exception e){
+ utils.log("DEBUG", " Error encountered within GetAaiAR" + e.getMessage(), isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error in GetAaiAR" + e.getMessage())
+ }
+ if (!isBlank(ar))
+ {
+ execution.setVariable("aaiARGetResponse", ar)
+ execution.setVariable("aaiARPath", arUrl)
+
+ String resourceVersion = null
+ if (utils.nodeExists(ar, "resource-version")) {
+ resourceVersion = utils.getNodeText1(ar, "resource-version")
+ execution.setVariable("aaiARResourceVersion", resourceVersion)
+ }
+
+ String orchStatus = null
+ if (utils.nodeExists(ar, "orchestration-status")) {
+ orchStatus= utils.getNodeText1(ar, "orchestration-status")
+ }
+ else
+ {
+ orchStatus = " "
+ }
+ execution.setVariable("aaiAROrchStatus", orchStatus)
+ }
+ utils.log("DEBUG", " ***** Exit GetARbyLink ***** AR:" + ar, isDebugEnabled)
+ return ar
+ }
+
+ public void updateAROrchStatus(Execution execution, String status, String aaiARPath){
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("DEBUG", " *** updaAROrchStatus *** ", isDebugEnabled)
+ try{
+
+ String updateReq = """
+ {
+ "orchestration-status": "Created""
+ }
+ """
+
+ utils.log("DEBUG", 'AAI AR URI: ' + aaiARPath, isDebugEnabled)
+
+ AaiUtil aaiUriUtil = new AaiUtil(taskProcessor)
+ APIResponse apiResponse = aaiUriUtil.executeAAIPatchCall(execution, aaiARPath, updateReq)
+ def aaiResponse = StringEscapeUtils.unescapeXml(apiResponse.getResponseBodyAsString())
+ def responseCode = apiResponse.getStatusCode()
+
+ utils.logAudit("AAI Response Code: " + responseCode)
+ utils.logAudit("AAI Response: " + aaiResponse)
+ if(responseCode == 200){
+ utils.log("DEBUG", "UpdateAR Good REST Response is: " + "\n" + aaiResponse, isDebugEnabled)
+ }else{
+ utils.log("DEBUG", "UpdateAROrchStatus Bad REST Response!", isDebugEnabled)
+ buildAAIErrorResponse(execution, aaiResponse, "Error updating AR OrchStatus in AAI")
+ }
+
+ }catch(BpmnError b){
+ utils.log("DEBUG", "Rethrowing MSOWorkflowException ", isDebugEnabled)
+ throw b
+ }catch(Exception e){
+ utils.log("ERROR", "Exception in updateAR. Exception is:\n" + e.getMessage(), isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, 'Internal Error in updateAROrchStatus.' + e.getMessage())
+ }
+ utils.log("DEBUG", " *** Exit updateAROrchStatus *** ", isDebugEnabled)
+ }
+
+ //Sets Variable "wasDeleted"
+ public void deleteAR(Execution execution, String aaiARPath){
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ utils.log("DEBUG", " *** deleteAR *** aaiARPath:" + aaiARPath, isDebugEnabled)
+ try {
+ AaiUtil aaiUriUtil = new AaiUtil(taskProcessor)
+ APIResponse response = aaiUriUtil.executeAAIDeleteCall(execution, aaiARPath)
+ int responseCode = response.getStatusCode()
+ execution.setVariable("deleteARResponseCode", responseCode)
+
+ utils.log("DEBUG", " Delete AR response code:" + responseCode, isDebugEnabled)
+
+ String aaiResponse = response.getResponseBodyAsString()
+ aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse)
+ execution.setVariable("aaiARDeleteResponse", aaiResponse)
+
+ utils.log("DEBUG", "Delete AR Response:" + aaiResponse)
+ //Process Response
+ if(responseCode == 204){
+ utils.log("DEBUG", " Delete AR Received a Good Response", isDebugEnabled)
+ execution.setVariable("wasDeleted", "true")
+ }else if(responseCode == 404){
+ utils.log("DEBUG", " Delete AR Received a Not Found (404) Response", isDebugEnabled)
+ }else if(responseCode == 412){
+ utils.log("DEBUG", "Delete AR Received a Resource Version Mismatch Error: \n" + aaiResponse, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 412, "DeleteAR Received a resource-version Mismatch Error Response from AAI")
+ }else{
+ utils.log("DEBUG", "Delete AR Received a BAD REST Response: \n" + aaiResponse, isDebugEnabled)
+ buildAAIErrorResponse(execution, aaiResponse, "Error deleting AR in AAI")
+ exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode)
+ }
+ }catch(BpmnError b){
+ utils.log("DEBUG", "Rethrowing MSOWorkflowException", isDebugEnabled)
+ throw b
+ }catch(Exception e){
+ utils.log("DEBUG", " Error encountered in deleteAR!" + e, isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured During Delete AR")
+ }
+ utils.log("DEBUG", " *** Exit deleteAR *** ", isDebugEnabled)
+ }
+
+ public void buildAAIErrorResponse(Execution execution, String response, String errorMessage){
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ utils.log("DEBUG", " *** BuildAAIErrorResponse*** ", isDebugEnabled)
+
+ if((response != null) && (response.contains("Fault") || response.contains("RESTFault"))){
+ WorkflowException workflowException = exceptionUtil.MapAAIExceptionToWorkflowException(response, execution)
+ execution.setVariable("WorkflowException", workflowException)
+ }else{
+ exceptionUtil.buildWorkflowException(execution, 500, errorMessage)
+ }
+
+ utils.log("DEBUG", " *** Exit BuildAAIErrorResponse Process*** ", isDebugEnabled)
+ throw new BpmnError("MSOWorkflowException")
+ }
+
+} \ No newline at end of file
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 986111ccda..9cf22aaf4a 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
@@ -159,7 +159,7 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
AaiUtil aaiUriUtil = new AaiUtil(this)
def aai_uri = aaiUriUtil.getNetworkGenericVnfUri(execution)
logDebug('AAI URI is: ' + aai_uri, isDebugEnabled)
- String aaiNamespace = aaiUriUtil.getNamespaceFromUri(aai_uri)
+ String aaiNamespace = aaiUriUtil.getNamespaceFromUri(execution, aai_uri)
logDebug('AAI namespace is: ' + aaiNamespace, isDebugEnabled)
execution.setVariable("CAAIVfMod_aaiNamespace","${aaiNamespace}")
@@ -258,8 +258,8 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
<vnf-type>${execution.getVariable("CAAIVfMod_vnfType")}</vnf-type>
<service-id>${execution.getVariable("CAAIVfMod_serviceId")}</service-id>
<orchestration-status>active</orchestration-status>
- <persona-model-id>${execution.getVariable("CAAIVfMod_vnfPersonaId")}</persona-model-id>
- <persona-model-version>${execution.getVariable("CAAIVfMod_vnfPersonaVer")}</persona-model-version>
+ <model-invariant-id>${execution.getVariable("CAAIVfMod_vnfPersonaId")}</model-invariant-id>
+ <model-version-id>${execution.getVariable("CAAIVfMod_vnfPersonaVer")}</model-version-id>
</generic-vnf>""" as String
execution.setVariable("CAAIVfMod_createGenericVnfPayload", payload)
@@ -305,8 +305,19 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
def aaiVnfResponse = execution.getVariable("CAAIVfMod_queryGenericVnfResponse")
AaiUtil aaiUtil = new AaiUtil(this)
def personaModelId = execution.getVariable("CAAIVfMod_personaId")
+
+ // Check if the response includes model-invariant-id or persona-model-id
+ // note: getRequiredNodeText() throws an exception if the field is missing
+ // need to retun a null for the subsequent "either/or" logic to work properly
+// def modelInvariantId = getRequiredNodeText(execution, aaiVnfResponse,'model-invariant-id')
+ def modelInvariantId = getNodeText(aaiVnfResponse,'model-invariant-id', null)
+ def fieldToCheck = 'model-invariant-id'
+ if (!modelInvariantId) {
+ fieldToCheck = 'persona-model-id'
+ }
+
moduleIndex = aaiUtil.getLowestUnusedVfModuleIndexFromAAIVnfResponse(execution, aaiVnfResponse,
- "persona-model-id", personaModelId)
+ fieldToCheck, personaModelId)
}
def moduleIndexString = String.valueOf(moduleIndex)
@@ -324,11 +335,11 @@ public class CreateAAIVfModule extends AbstractServiceTaskProcessor{
String payload = """<vf-module xmlns="${execution.getVariable("CAAIVfMod_aaiNamespace")}">
<vf-module-id>${newModuleId}</vf-module-id>
<vf-module-name>${execution.getVariable("CAAIVfMod_moduleName")}</vf-module-name>
- <persona-model-id>${execution.getVariable("CAAIVfMod_personaId")}</persona-model-id>
- <persona-model-version>${execution.getVariable("CAAIVfMod_personaVer")}</persona-model-version>
- <persona-model-customization-id>${execution.getVariable("CAAIVfMod_modelCustomizationId")}</persona-model-customization-id>
+ <model-invariant-id>${execution.getVariable("CAAIVfMod_personaId")}</model-invariant-id>
+ <model-version-id>${execution.getVariable("CAAIVfMod_personaVer")}</model-version-id>
+ <model-customization-id>${execution.getVariable("CAAIVfMod_modelCustomizationId")}</model-customization-id>
<is-base-vf-module>${isBaseModule}</is-base-vf-module>
- <orchestration-status>pending-create</orchestration-status>
+ <orchestration-status>PendingCreate</orchestration-status>
<module-index>${moduleIndex}</module-index>
</vf-module>""" as String
execution.setVariable("CAAIVfMod_createVfModulePayload", payload)
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CreateGenericVNFUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CreateGenericVNFUtils.groovy
deleted file mode 100644
index 887eb7456d..0000000000
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/CreateGenericVNFUtils.groovy
+++ /dev/null
@@ -1,164 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * OPENECOMP - MSO
- * ================================================================================
- * 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.openecomp.mso.bpmn.core.WorkflowException
-import org.openecomp.mso.rest.APIResponse;
-
-import org.camunda.bpm.engine.runtime.Execution;
-import org.camunda.bpm.engine.delegate.BpmnError
-
-/**
- * Please describe the CreateGenericVNFUtils.groovy class
- *
- */
-class CreateGenericVNFUtils{
-
- String Prefix="CRTGVNF_"
-
- def utils=new MsoUtils()
-
- private AbstractServiceTaskProcessor taskProcessor
-
- public CreateGenericVNFUtils(AbstractServiceTaskProcessor taskProcessor) {
- this.taskProcessor = taskProcessor
- }
-
- /**
- * This method is executed during the Initialization task of the process.
- *
- * @param execution
- *
- */
-
- public APIResponse queryAAI(Execution execution, String path){
-
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- execution.setVariable("prefix", Prefix)
- utils.log("DEBUG", " ======== STARTED queryAAI Process ======== ", isDebugEnabled)
-
- def uuid = execution.getVariable("CRTGVNF_uuid")
- utils.log("DEBUG", "UUID is: " + uuid, isDebugEnabled)
-
- //Setting request path
- String queryAAIRequestPath = execution.getVariable("URN_aai_endpoint")+path
-// execution.setVariable("CRTGVNF_queryAAIRequestPath", queryAAIRequestPath)
- utils.log("DEBUG", "QueryAAIRequest Path is: " + "\n" + queryAAIRequestPath, isDebugEnabled)
-
- try {
- AaiUtil aaiUtil = new AaiUtil(taskProcessor)
- return aaiUtil.executeAAIGetCall(execution, queryAAIRequestPath)
- }catch(Exception e){
- utils.log("ERROR", "Exception Occured Processing queryAAI. Exception is:\n" + e, isDebugEnabled)
- execution.setVariable("CRTGVNF_dataValidationFlag", false)
- execution.setVariable("CRTGVNF_ErrorResponse", "Error Occured during queryAAI Method:\n" + e.getMessage())
- }
- utils.log("DEBUG", "======== COMPLETED queryAAI Process ======== ", isDebugEnabled)
-}
-
- public String buildSDNCRequest(Execution execution, String svcInstId, String action){
-
- String uuid = execution.getVariable('testReqId') // for junits
- if(uuid==null){
- uuid = execution.getVariable("mso-request-id") + "-" + System.currentTimeMillis()
- }
- def callbackURL = execution.getVariable("CRTGVNF_sdncCallbackUrl")
- def requestId = execution.getVariable("CRTGVNF_requestId")
- def serviceType = execution.getVariable("CRTGVNF_serviceType")
- def vnfType = execution.getVariable("CRTGVNF_vnfType")
- def vnfName = execution.getVariable("CRTGVNF_vnfName")
- def tenantId = execution.getVariable("CRTGVNF_tenantId")
- def source = execution.getVariable("CRTGVNF_source")
- String vnfId = svcInstId
- String sdncVNFParamsXml = ""
-
- if(execution.getVariable("CRTGVNF_vnfParamsExistFlag") == true){
- sdncVNFParamsXml = buildSDNCParamsXml(execution)
- }else{
- sdncVNFParamsXml = ""
- }
-
- String sdncRequest =
- """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.openecomp/mso/request/types/v1"
- xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1"
- xmlns:sdncadapter="http://org.openecomp/workflow/sdnc/adapter/schema/v1">
- <sdncadapter:RequestHeader>
- <sdncadapter:RequestId>${uuid}</sdncadapter:RequestId>
- <sdncadapter:SvcInstanceId>${svcInstId}</sdncadapter:SvcInstanceId>
- <sdncadapter:SvcAction>${action}</sdncadapter:SvcAction>
- <sdncadapter:SvcOperation>vnf-topology-operation</sdncadapter:SvcOperation>
- <sdncadapter:CallbackUrl>${callbackURL}</sdncadapter:CallbackUrl>
- </sdncadapter:RequestHeader>
- <sdncadapterworkflow:SDNCRequestData>
- <request-information>
- <request-id>${requestId}</request-id>
- <request-action>VNFActivateRequest</request-action>
- <source>${source}</source>
- </request-information>
- <service-information>
- <service-type>${serviceType}</service-type>
- <service-instance-id>${vnfId}</service-instance-id>
- <subscriber-name>notsurewecare</subscriber-name>
- </service-information>
- <vnf-request-information>
- <vnf-id>${vnfId}</vnf-id>
- <vnf-type>${vnfType}</vnf-type>
- <vnf-name>${vnfName}</vnf-name>
- <tenant>${tenantId}</tenant>
-${sdncVNFParamsXml}
- </vnf-request-information>
- </sdncadapterworkflow:SDNCRequestData>
- </sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
-
- return sdncRequest
-
- }
-
- public String buildSDNCParamsXml(Execution execution){
-
- String params = ""
- StringBuilder sb = new StringBuilder()
- Map<String, String> paramsMap = execution.getVariable("CRTGVNF_vnfParamsMap")
-
- for (Map.Entry<String, String> entry : paramsMap.entrySet()) {
- String paramsXml
- String key = entry.getKey();
- if(key.endsWith("_network")){
- String requestKey = key.substring(0, key.indexOf("_network"))
- String requestValue = entry.getValue()
- paramsXml =
-"""<vnf-networks>
- <network-role>{ functx:substring-before-match(data($param/@name), '_network') }</network-role>
- <network-name>{ $param/text() }</network-name>
-</vnf-networks>"""
- }else{
- paramsXml = ""
- }
- params = sb.append(paramsXml)
- }
- return params
- }
-
-}
-
-
-
-
-
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 fba5cbe1b0..53678ec749 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
@@ -120,7 +120,11 @@ public class GenerateVfModuleName extends AbstractServiceTaskProcessor{
String matchingVfModules = "<vfModules>"
for (i in 0..vfModulesSize-1) {
def vfModuleXml = groovy.xml.XmlUtil.serialize(vfModules[i])
- def personaModelIdFromAAI = utils.getNodeText(vfModuleXml, "persona-model-id")
+ def personaModelIdFromAAI = utils.getNodeText(vfModuleXml, "model-invariant-id")
+ if (!personaModelIdFromAAI) {
+ // check old attribute name
+ personaModelIdFromAAI = utils.getNodeText(vfModuleXml, "persona-model-id")
+ }
if (personaModelIdFromAAI != null && personaModelIdFromAAI.equals(personaModelId)) {
matchingVfModules = matchingVfModules + utils.removeXmlPreamble(vfModuleXml)
}
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 1bd4383b74..344bba29bd 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
@@ -67,7 +67,6 @@ import org.springframework.web.util.UriUtils
*
*
* Out Mapping Variables:
- * @param - GENDV_vnf
* @param - GENDV_SuccessIndicator
* @param - GENDV_FoundIndicator
* @param - WorkflowException
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 70ce1ba5cf..2e65339270 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
@@ -64,6 +64,13 @@ import org.springframework.web.util.UriUtils
* Variable Mapping Below:
*
* In Mapping Variables:
+ * For Allotted-Resource:
+ * @param - GENGS_allottedResourceId
+ * @param - GENGS_type
+ * @param (Optional) - GENGS_serviceInstanceId
+ * @param (Optional) - GENGS_serviceType
+ * @param (Optional) - GENGS_globalCustomerId
+ *
* For Service-Instance:
* @param - GENGS_serviceInstanceId or @param - GENGS_serviceInstanceName
* @param - GENGS_type
@@ -82,6 +89,7 @@ import org.springframework.web.util.UriUtils
* @param - WorkflowException
*
*
+ * @author cb645j
*/
class GenericGetService extends AbstractServiceTaskProcessor{
@@ -94,20 +102,24 @@ class GenericGetService extends AbstractServiceTaskProcessor{
* variables the calling flow provided.
*
* @param - execution
+ *
+ * @author cb645j
*/
public void preProcessRequest(Execution execution) {
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
execution.setVariable("prefix",Prefix)
utils.log("DEBUG", " *** STARTED GenericGetService PreProcessRequest Process*** ", isDebugEnabled)
- execution.setVariable("GENGS_obtainServiceInstanceUrl", false)
+ execution.setVariable("GENGS_obtainObjectsUrl", false)
execution.setVariable("GENGS_obtainServiceInstanceUrlByName", false)
execution.setVariable("GENGS_SuccessIndicator", false)
execution.setVariable("GENGS_FoundIndicator", false)
+ execution.setVariable("GENGS_resourceLink", null)
execution.setVariable("GENGS_siResourceLink", null)
try{
// Get Variables
+ String allottedResourceId = execution.getVariable("GENGS_allottedResourceId")
String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId")
String serviceInstanceName = execution.getVariable("GENGS_serviceInstanceName")
String serviceType = execution.getVariable("GENGS_serviceType")
@@ -116,7 +128,21 @@ class GenericGetService extends AbstractServiceTaskProcessor{
if(type != null){
utils.log("DEBUG", "Incoming GENGS_type is: " + type, isDebugEnabled)
- if(type.equalsIgnoreCase("service-instance")){
+ if(type.equalsIgnoreCase("allotted-resource")){
+ if(isBlank(allottedResourceId)){
+ utils.log("DEBUG", "Incoming allottedResourceId is null. Allotted Resource Id is required to Get an allotted-resource.", isDebugEnabled)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming allottedResourceId is null. Allotted Resource Id is required to Get an allotted-resource.")
+ }else{
+ utils.log("DEBUG", "Incoming Allotted Resource Id is: " + allottedResourceId, isDebugEnabled)
+ if(isBlank(globalCustomerId) || isBlank(serviceType) || isBlank(serviceInstanceId)){
+ execution.setVariable("GENGS_obtainObjectsUrl", true)
+ }else{
+ utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled)
+ utils.log("DEBUG", "Incoming Service Type is: " + serviceType, isDebugEnabled)
+ utils.log("DEBUG", "Incoming Global Customer Id is: " + globalCustomerId, isDebugEnabled)
+ }
+ }
+ }else if(type.equalsIgnoreCase("service-instance")){
if(isBlank(serviceInstanceId) && isBlank(serviceInstanceName)){
utils.log("DEBUG", "Incoming serviceInstanceId and serviceInstanceName are null. ServiceInstanceId or ServiceInstanceName is required to Get a service-instance.", isDebugEnabled)
exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Incoming serviceInstanceId and serviceInstanceName are null. ServiceInstanceId or ServiceInstanceName is required to Get a service-instance.")
@@ -124,7 +150,7 @@ class GenericGetService extends AbstractServiceTaskProcessor{
utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled)
utils.log("DEBUG", "Incoming Service Instance Name is: " + serviceInstanceName, isDebugEnabled)
if(isBlank(globalCustomerId) || isBlank(serviceType)){
- execution.setVariable("GENGS_obtainServiceInstanceUrl", true)
+ execution.setVariable("GENGS_obtainObjectsUrl", true)
if(isBlank(serviceInstanceId)){
execution.setVariable("GENGS_obtainServiceInstanceUrlByName", true)
}
@@ -170,49 +196,64 @@ class GenericGetService extends AbstractServiceTaskProcessor{
execution.setVariable("prefix",Prefix)
utils.log("DEBUG", " *** STARTED GenericGetService ObtainServiceInstanceUrlById Process*** ", isDebugEnabled)
try {
- String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId")
- utils.log("DEBUG", " Querying Node for Service-Instance URL by using Service-Instance Id: " + serviceInstanceId, isDebugEnabled)
-
AaiUtil aaiUriUtil = new AaiUtil(this)
String aai_uri = aaiUriUtil.getSearchNodesQueryEndpoint(execution)
String aai_endpoint = execution.getVariable("URN_aai_endpoint")
-
- utils.logAudit("GenericGetService AAI Endpoint: " + aai_endpoint)
- String path = "${aai_uri}?search-node-type=service-instance&filter=service-instance-id:EQUALS:${serviceInstanceId}"
+
+ String type = execution.getVariable("GENGS_type")
+ String path = ""
+ if(type.equalsIgnoreCase("service-instance")){
+ String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId")
+ utils.log("DEBUG", " Querying Node for Service-Instance URL by using Service-Instance Id: " + serviceInstanceId, isDebugEnabled)
+ path = "${aai_uri}?search-node-type=service-instance&filter=service-instance-id:EQUALS:${serviceInstanceId}"
+ utils.logAudit("Service Instance Node Query Url is: " + path)
+ utils.log("DEBUG", "Service Instance Node Query Url is: " + path, isDebugEnabled)
+ }else if(type.equalsIgnoreCase("allotted-resource")){
+ String allottedResourceId = execution.getVariable("GENGS_allottedResourceId")
+ utils.log("DEBUG", " Querying Node for Service-Instance URL by using Allotted Resource Id: " + allottedResourceId, isDebugEnabled)
+ path = "${aai_uri}?search-node-type=allotted-resource&filter=id:EQUALS:${allottedResourceId}"
+ utils.logAudit("Allotted Resource Node Query Url is: " + path)
+ utils.log("DEBUG", "Allotted Resource Node Query Url is: " + path, isDebugEnabled)
+ }
//String url = "${aai_endpoint}${path}" host name needs to be removed from property
String url = "${path}"
- execution.setVariable("GENGS_obtainSIUrlPath", url)
+ execution.setVariable("GENGS_genericQueryPath", url)
APIResponse response = aaiUriUtil.executeAAIGetCall(execution, url)
int responseCode = response.getStatusCode()
- execution.setVariable("GENGS_obtainSIUrlResponseCode", responseCode)
+ execution.setVariable("GENGS_genericQueryResponseCode", responseCode)
utils.log("DEBUG", " GET Service Instance response code is: " + responseCode, isDebugEnabled)
utils.logAudit("GenericGetService AAI GET Response Code: " + responseCode)
String aaiResponse = response.getResponseBodyAsString()
+ execution.setVariable("GENGS_obtainSIUrlResponseBeforeUnescaping", aaiResponse)
+ utils.log("DEBUG", "GenericGetService AAI Response before unescaping: " + aaiResponse, isDebugEnabled)
aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse)
- execution.setVariable("GENGS_obtainSIUrlResponse", aaiResponse)
+ execution.setVariable("GENGS_genericQueryResponse", aaiResponse)
utils.logAudit("GenericGetService AAI Response: " + aaiResponse)
+ utils.log("DEBUG", "GenericGetService AAI Response: " + aaiResponse, isDebugEnabled)
+
//Process Response
if(responseCode == 200){
- utils.log("DEBUG", " Query for Service Instance Url Received a Good Response Code", isDebugEnabled)
+ utils.log("DEBUG", "Generic Query Received a Good Response Code", isDebugEnabled)
execution.setVariable("GENGS_SuccessIndicator", true)
if(utils.nodeExists(aaiResponse, "result-data")){
- utils.log("DEBUG", "Query for Service Instance Url Response Does Contain Data" , isDebugEnabled)
+ utils.log("DEBUG", "Generic Query Response Does Contain Data" , isDebugEnabled)
execution.setVariable("GENGS_FoundIndicator", true)
String resourceLink = utils.getNodeText1(aaiResponse, "resource-link")
+ execution.setVariable("GENGS_resourceLink", resourceLink)
execution.setVariable("GENGS_siResourceLink", resourceLink)
}else{
- utils.log("DEBUG", "Query for Service Instance Url Response Does NOT Contains Data" , isDebugEnabled)
+ utils.log("DEBUG", "Generic Query Response Does NOT Contains Data" , isDebugEnabled)
execution.setVariable("WorkflowResponse", " ") //for junits
}
}else if(responseCode == 404){
- utils.log("DEBUG", " Query for Service Instance Received a Not Found (404) Response", isDebugEnabled)
+ utils.log("DEBUG", "Generic Query Received a Not Found (404) Response", isDebugEnabled)
execution.setVariable("GENGS_SuccessIndicator", true)
execution.setVariable("WorkflowResponse", " ") //for junits
}else{
- utils.log("DEBUG", "Query for Service Instance Received a BAD REST Response: \n" + aaiResponse, isDebugEnabled)
+ utils.log("DEBUG", "Generic Query Received a BAD REST Response: \n" + aaiResponse, isDebugEnabled)
exceptionUtil.MapAAIExceptionToWorkflowExceptionGeneric(execution, aaiResponse, responseCode)
throw new BpmnError("MSOWorkflowException")
}
@@ -255,11 +296,11 @@ class GenericGetService extends AbstractServiceTaskProcessor{
execution.setVariable("GENGS_obtainSIUrlResponseCode", responseCode)
utils.log("DEBUG", " GET Service Instance response code is: " + responseCode, isDebugEnabled)
utils.logAudit("GenericGetService AAI Response Code: " + responseCode)
-
+
String aaiResponse = response.getResponseBodyAsString()
aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse)
execution.setVariable("GENGS_obtainSIUrlResponse", aaiResponse)
- utils.logAudit("GenericGetService AAI Response: " + aaiResponse)
+ utils.logAudit("GenericGetService AAI Response: " + aaiResponse)
//Process Response
if(responseCode == 200){
utils.log("DEBUG", " Query for Service Instance Url Received a Good Response Code", isDebugEnabled)
@@ -268,6 +309,7 @@ class GenericGetService extends AbstractServiceTaskProcessor{
utils.log("DEBUG", "Query for Service Instance Url Response Does Contain Data" , isDebugEnabled)
execution.setVariable("GENGS_FoundIndicator", true)
String resourceLink = utils.getNodeText1(aaiResponse, "resource-link")
+ execution.setVariable("GENGS_resourceLink", resourceLink)
execution.setVariable("GENGS_siResourceLink", resourceLink)
}else{
utils.log("DEBUG", "Query for Service Instance Url Response Does NOT Contains Data" , isDebugEnabled)
@@ -308,10 +350,10 @@ class GenericGetService extends AbstractServiceTaskProcessor{
AaiUtil aaiUriUtil = new AaiUtil(this)
String aai_endpoint = execution.getVariable("URN_aai_endpoint")
String serviceEndpoint = ""
-
+
utils.logAudit("GenericGetService getServiceObject AAI Endpoint: " + aai_endpoint)
if(type.equalsIgnoreCase("service-instance")){
- String siResourceLink = execution.getVariable("GENGS_siResourceLink")
+ String siResourceLink = execution.getVariable("GENGS_resourceLink")
if(isBlank(siResourceLink)){
String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId")
utils.log("DEBUG", " Incoming GENGS_serviceInstanceId is: " + serviceInstanceId, isDebugEnabled)
@@ -324,7 +366,27 @@ class GenericGetService extends AbstractServiceTaskProcessor{
logDebug('AAI URI is: ' + aai_uri, isDebugEnabled)
serviceEndpoint = "${aai_uri}/" + UriUtils.encode(globalCustomerId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8")
}else{
- utils.log("DEBUG", "Incoming Service Instance Resource Link is: " + siResourceLink, isDebugEnabled)
+ utils.log("DEBUG", "Incoming Service Instance Url is: " + siResourceLink, isDebugEnabled)
+ String[] split = siResourceLink.split("/aai/")
+ serviceEndpoint = "/aai/" + split[1]
+ }
+ }else if(type.equalsIgnoreCase("allotted-resource")){
+ String siResourceLink = execution.getVariable("GENGS_resourceLink")
+ if(isBlank(siResourceLink)){
+ String allottedResourceId = execution.getVariable("GENGS_allottedResourceId")
+ utils.log("DEBUG", " Incoming GENGS_allottedResourceId is: " + allottedResourceId, isDebugEnabled)
+ String serviceInstanceId = execution.getVariable("GENGS_serviceInstanceId")
+ utils.log("DEBUG", " Incoming GENGS_serviceInstanceId is: " + serviceInstanceId, isDebugEnabled)
+ String serviceType = execution.getVariable("GENGS_serviceType")
+ utils.log("DEBUG", " Incoming GENGS_serviceType is: " + serviceType, isDebugEnabled)
+ String globalCustomerId = execution.getVariable("GENGS_globalCustomerId")
+ utils.log("DEBUG", "Incoming Global Customer Id is: " + globalCustomerId, isDebugEnabled)
+
+ String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution)
+ logDebug('AAI URI is: ' + aai_uri, isDebugEnabled)
+ serviceEndpoint = "${aai_uri}/" + UriUtils.encode(globalCustomerId,"UTF-8") + "/service-subscriptions/service-subscription/" + UriUtils.encode(serviceType,"UTF-8") + "/service-instances/service-instance/" + UriUtils.encode(serviceInstanceId,"UTF-8") + "/allotted-resources/allotted-resource/" + UriUtils.encode(allottedResourceId,"UTF-8")
+ }else{
+ utils.log("DEBUG", "Incoming Allotted-Resource Url is: " + siResourceLink, isDebugEnabled)
String[] split = siResourceLink.split("/aai/")
serviceEndpoint = "/aai/" + split[1]
}
@@ -345,12 +407,11 @@ class GenericGetService extends AbstractServiceTaskProcessor{
execution.setVariable("GENGS_getServiceResponseCode", responseCode)
utils.log("DEBUG", " GET Service response code is: " + responseCode, isDebugEnabled)
utils.logAudit("GenericGetService AAI Response Code: " + responseCode)
-
+
String aaiResponse = response.getResponseBodyAsString()
aaiResponse = StringEscapeUtils.unescapeXml(aaiResponse)
execution.setVariable("GENGS_getServiceResponse", aaiResponse)
utils.logAudit("GenericGetService AAI Response: " + aaiResponse)
-
//Process Response
if(responseCode == 200 || responseCode == 202){
utils.log("DEBUG", "GET Service Received a Good Response Code", isDebugEnabled)
@@ -382,4 +443,4 @@ class GenericGetService extends AbstractServiceTaskProcessor{
utils.log("DEBUG", " *** COMPLETED GenericGetService GetServiceObject Process*** ", isDebugEnabled)
}
-}
+} \ No newline at end of file
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 df9a97c78c..bc787df577 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
@@ -20,7 +20,7 @@
package org.openecomp.mso.bpmn.common.scripts
-import static org.apache.commons.lang3.StringUtils.*
+import static org.openecomp.mso.bpmn.common.scripts.GenericUtils.*;
import org.apache.commons.lang3.*
import org.camunda.bpm.engine.delegate.BpmnError
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 9609103228..9f7d57f335 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
@@ -49,6 +49,7 @@ import org.springframework.web.util.UriUtils
*
*
* Incoming Required Variables:
+ * @param - GENPS_requestId
* @param - GENPS_type - Required field. This will be required field populated as service-instance or service-subscription
* @param - GENPS_globalSubscriberId - Required field
* @param - GENPS_serviceType - Required Field
@@ -58,8 +59,7 @@ import org.springframework.web.util.UriUtils
* @param - GENPS_allottedResourceId - Conditional Field. Required for allotted-resource.
* @param - GENPS_tunnelXconnectId - Conditional Field. Required for tunnel-xconnect.
*
- * @param - GENPS_requestId to trace the request id
- * @param - GENPS_serviceResourceVersion optional needs to be provided only in case of update for both service-instance and service subscription. The calling flows
+ * @param - GENPS_serviceResourceVersion - Conditional Field. Needs to be provided only in case of update for both service-instance and service subscription. The calling flows
* should check if a service-instance or servic-subscription exists by calling the subflow GenericGetService. if it exists then resourceversion should be
* obtained from aai and sent as an input parameter.
*
@@ -183,7 +183,7 @@ class GenericPutService extends AbstractServiceTaskProcessor{
AaiUtil aaiUriUtil = new AaiUtil(this)
String aai_uri = aaiUriUtil.getBusinessCustomerUri(execution)
logDebug('AAI URI is: ' + aai_uri, isDebugEnabled)
- String namespace = aaiUriUtil.getNamespaceFromUri(aai_uri)
+ String namespace = aaiUriUtil.getNamespaceFromUri(execution, aai_uri)
logDebug('AAI namespace is: ' + namespace, isDebugEnabled)
String aai_endpoint = execution.getVariable("URN_aai_endpoint")
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericUtils.groovy
new file mode 100644
index 0000000000..3397aa9b54
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/GenericUtils.groovy
@@ -0,0 +1,20 @@
+package org.openecomp.mso.bpmn.common.scripts
+
+import org.apache.commons.lang3.StringUtils;
+
+class GenericUtils extends StringUtils{
+
+ @Override
+ public static boolean isBlank(final CharSequence cs) {
+ int strLen;
+ if (cs == null || (strLen = cs.length()) == 0 || cs.equals("null")) {
+ return true;
+ }
+ for (int i = 0; i < strLen; i++) {
+ if (Character.isWhitespace(cs.charAt(i)) == false) {
+ return false;
+ }
+ }
+ return true;
+ }
+}
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 f870e30d1d..4ca0370185 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
@@ -932,7 +932,7 @@ class SDNCAdapterUtils {
if (modelVersionId == null) {
modelVersionId = ""
}
- String modelCustomizationUuid = jsonUtil.getJsonValue(jsonModelInfo, "modelCustomizationId")
+ String modelCustomizationUuid = jsonUtil.getJsonValue(jsonModelInfo, "modelCustomizationUuid")
String modelCustomizationString = ""
if (modelCustomizationUuid != null) {
modelCustomizationString = "<model-customization-uuid>${modelCustomizationUuid}</model-customization-uuid>"
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 4838a67d36..0c483388c1 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
@@ -28,7 +28,7 @@ import org.springframework.web.util.UriUtils
public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
-
+
private XmlParser xmlParser = new XmlParser()
ExceptionUtil exceptionUtil = new ExceptionUtil()
@@ -44,12 +44,13 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
execution.setVariable('UAAIGenVnf_personaModelVersion', null)
execution.setVariable("UAAIGenVnf_ipv4OamAddress", null)
execution.setVariable('UAAIGenVnf_managementV6Address', null)
+ execution.setVariable('UAAIGenVnf_orchestrationStatus', null)
execution.setVariable('UAAIGenVnf_getGenericVnfResponseCode' ,null)
execution.setVariable('UAAIGenVnf_getGenericVnfResponse', '')
execution.setVariable('UAAIGenVnf_updateGenericVnfResponseCode', null)
execution.setVariable('UAAIGenVnf_updateGenericVnfResponse', '')
}
-
+
/**
* Check for missing elements in the received request.
*
@@ -90,6 +91,11 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
if (managementV6Address != null && !managementV6Address.isEmpty()) {
execution.setVariable('UAAIGenVnf_managementV6Address', managementV6Address)
}
+
+ def orchestrationStatus = getNodeTextForce(xml, 'orchestration-status')
+ if (orchestrationStatus != null && !orchestrationStatus.isEmpty()) {
+ execution.setVariable('UAAIGenVnf_orchestrationStatus', orchestrationStatus)
+ }
logDebug('Exited ' + method, isDebugLogEnabled)
} catch (BpmnError e) {
@@ -99,7 +105,7 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
exceptionUtil.buildAndThrowWorkflowException(execution, 1002, 'Error in preProcessRequest(): ' + e.getMessage())
}
}
-
+
/**
* Using the received vnfId, query AAI to get the corresponding Generic VNF.
* A 200 response is expected with the VF Module in the response body.
@@ -182,7 +188,11 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
if (newPersonaModelId != null || newPersonaModelVersion != null) {
// Confirm "new" persona-model-id is same as "current" persona-model-id
- def Node currPersonaModelIdNode = utils.getChildNode(genericVnfNode, 'persona-model-id')
+ def Node currPersonaModelIdNode = utils.getChildNode(genericVnfNode, 'model-invariant-id')
+ if (currPersonaModelIdNode == null) {
+ // check the old attribute name
+ currPersonaModelIdNode = utils.getChildNode(genericVnfNode, 'persona-model-id')
+ }
def String currPersonaModelId = ''
if (currPersonaModelIdNode != null) {
currPersonaModelId = currPersonaModelIdNode.text()
@@ -194,7 +204,7 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
}
// Construct payload
- personaModelVersionEntry = updateGenericVnfNode(origRequest, genericVnfNode, 'persona-model-version')
+ personaModelVersionEntry = updateGenericVnfNode(origRequest, genericVnfNode, 'model-version-id')
}
// Handle ipv4-oam-address
@@ -212,11 +222,20 @@ public class UpdateAAIGenericVnf extends AbstractServiceTaskProcessor {
// Construct payload
managementV6AddressEntry = updateGenericVnfNode(origRequest, genericVnfNode, 'management-v6-address')
}
+
+ // Handle orchestration-status
+ def String orchestrationStatus = execution.getVariable('UAAIGenVnf_orchestrationStatus')
+ def String orchestrationStatusEntry = ""
+ if (orchestrationStatus != null) {
+ // Construct payload
+ orchestrationStatusEntry = updateGenericVnfNode(origRequest, genericVnfNode, 'orchestration-status')
+ }
def payload = """
{ ${personaModelVersionEntry}
${ipv4OamAddressEntry}
- ${managementV6AddressEntry}
+ ${managementV6AddressEntry}
+ ${orchestrationStatusEntry}
"vnf-id": "${vnfId}"
}
"""
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 7283a3ecfc..1f9db12b6f 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
@@ -133,7 +133,7 @@ public class UpdateAAIVfModule extends AbstractServiceTaskProcessor {
}
/**
- * Construct and send a PUT request to AAI to update the VF Module.
+ * Construct and send a PATCH request to AAI to update the VF Module.
*
* @param execution The flow's execution instance.
*/
@@ -176,7 +176,11 @@ public class UpdateAAIVfModule extends AbstractServiceTaskProcessor {
doPersonaModelVersion = false
} else {
// Confirm "new" persona-model-id is same as "current" persona-model-id
- def String currPersonaModelId = utils.getChildNodeText(vfModuleNode, 'persona-model-id')
+ def String currPersonaModelId = utils.getChildNodeText(vfModuleNode, 'model-invariant-id')
+ if (currPersonaModelId == null) {
+ // check the old attribute name
+ currPersonaModelId = utils.getChildNodeText(vfModuleNode, 'model-version-id')
+ }
if (currPersonaModelId == null) {
currPersonaModelId = ''
}
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 d48ae8f84e..7a97d5cd12 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
@@ -40,7 +40,7 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor {
/**
* Get the XmlParser.
- *
+ *
* @return the XmlParser.
*/
protected XmlParser getXmlParser() {
@@ -50,7 +50,7 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor {
/**
* Find the VF Module with specified ID in the specified Generic VF. If no such
* VF Module is found, null is returned.
- *
+ *
* @param genericVnf The Generic VNF in which to search for the specified VF Moduel.
* @param vfModuleId The ID of the VF Module for which to search.
* @return a VFModule object for the found VF Module or null if no VF Module is found.
@@ -77,7 +77,7 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor {
* element to a corresponding list of 'vnf-networks' specifications (typically used when
* invoking the VNF Rest Adpater). Each element in '*-params' whose name attribute ends
* with '_network' is used to create an 'vnf-networks' element.
- *
+ *
* @param paramsNode A Node representing a '*-params' element.
* @return a String of 'vnf-networks' elements, one for each 'param' element whose name
* attribute ends with '_network'.
@@ -189,7 +189,7 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor {
/**
* Extract the Tenant Id from the Volume Group information returned by AAI.
- *
+ *
* @param volumeGroupXml Volume Group XML returned by AAI.
* @return the Tenant Id extracted from the Volume Group information. 'null' is returned if
* the Tenant Id is missing or could not otherwise be extracted.
@@ -233,7 +233,7 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor {
*/
- protected String buildVfModuleParams(String vnfParams, String sdncGetResponse, String vnfId, String vnfName,
+ protected String buildVfModuleParams(Map<String, String> vnfParamsMap, String sdncGetResponse, String vnfId, String vnfName,
String vfModuleId, String vfModuleName, String vfModuleIndex) {
//Get SDNC Response Data
@@ -251,36 +251,19 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor {
oldVnfId = utils.removeXmlNamespaces(oldVnfId)
serviceData = serviceData.replace(oldVnfId, "")
def vnfId1 = utils.getNodeText1(serviceData, "vnf-id")
- String vfModuleIndexParam = ""
+
+ Map<String, String> paramsMap = new HashMap<String, String>()
if (vfModuleIndex != null) {
- vfModuleIndexParam = """<entry>
- <key>vf_module_index</key>
- <value>${vfModuleIndex}</value>
- </entry>"""
+ paramsMap.put("vf_module_index", "${vfModuleIndex}")
}
// Add-on data
- String vnfInfo =
- """<entry>
- <key>vnf_id</key>
- <value>${vnfId}</value>
- </entry>
- <entry>
- <key>vnf_name</key>
- <value>${vnfName}</value>
- </entry>
- <entry>
- <key>vf_module_id</key>
- <value>${vfModuleId}</value>
- </entry>
- <entry>
- <key>vf_module_name</key>
- <value>${vfModuleName}</value>
- </entry>
- ${vfModuleIndexParam}"""
-
- utils.logAudit("vnfInfo: " + vnfInfo)
+ 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)
@@ -289,8 +272,6 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor {
// Availability Zones Data
- String aZones = ""
- StringBuilder sbAZone = new StringBuilder()
NodeList aZonesList = responseXml.getElementsByTagNameNS("*", "availability-zones")
String aZonePosition = "0"
@@ -300,28 +281,14 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor {
Element eElement = (Element) node
String aZoneValue = utils.getElementText(eElement, "availability-zone")
aZonePosition = z.toString()
- String aZoneXml =
- """<entry>
- <key>availability_zone_${aZonePosition}</key>
- <value>${aZoneValue}</value>
- </entry>"""
- aZones = sbAZone.append(aZoneXml)
+ paramsMap.put("availability_zone_${aZonePosition}", "${aZoneValue}")
}
}
// VNF Networks Data
- String vnfNetworkNetId = ""
- String vnfNetworkNetName = ""
- String vnfNetworkSubNetId = ""
- String vnfNetworkV6SubNetId = ""
- String vnfNetworkNetFqdn = ""
- String vnfNetworksSriovVlanFilters = ""
+
StringBuilder sbNet = new StringBuilder()
- StringBuilder sbNet2 = new StringBuilder()
- StringBuilder sbNet3 = new StringBuilder()
- StringBuilder sbNet4 = new StringBuilder()
- StringBuilder sbNet5 = new StringBuilder()
- StringBuilder sbNet6 = new StringBuilder()
+
NodeList vnfNetworkList = responseXml.getElementsByTagNameNS("*", "vnf-networks")
for (int x = 0; x < vnfNetworkList.getLength(); x++) {
Node node = vnfNetworkList.item(x)
@@ -333,36 +300,11 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor {
String vnfNetworkSubNetIdValue = utils.getElementText(eElement, "subnet-id")
String vnfNetworkV6SubNetIdValue = utils.getElementText(eElement, "ipv6-subnet-id")
String vnfNetworkNetFqdnValue = utils.getElementText(eElement, "contrail-network-fqdn")
- String vnfNetworkNetIdXml =
- """<entry>
- <key>${vnfNetworkKey}_net_id</key>
- <value>${vnfNetworkNeutronIdValue}</value>
- </entry>"""
- vnfNetworkNetId = sbNet.append(vnfNetworkNetIdXml)
- String vnfNetworkNetNameXml =
- """<entry>
- <key>${vnfNetworkKey}_net_name</key>
- <value>${vnfNetworkNetNameValue}</value>
- </entry>"""
- vnfNetworkNetName = sbNet2.append(vnfNetworkNetNameXml)
- String vnfNetworkSubNetIdXml =
- """<entry>
- <key>${vnfNetworkKey}_subnet_id</key>
- <value>${vnfNetworkSubNetIdValue}</value>
- </entry>"""
- vnfNetworkSubNetId = sbNet3.append(vnfNetworkSubNetIdXml)
- String vnfNetworkV6SubNetIdXml =
- """<entry>
- <key>${vnfNetworkKey}_v6_subnet_id</key>
- <value>${vnfNetworkV6SubNetIdValue}</value>
- </entry>"""
- vnfNetworkV6SubNetId = sbNet5.append(vnfNetworkV6SubNetIdXml)
- String vnfNetworkNetFqdnXml =
- """<entry>
- <key>${vnfNetworkKey}_net_fqdn</key>
- <value>${vnfNetworkNetFqdnValue}</value>
- </entry>"""
- vnfNetworkNetFqdn = sbNet4.append(vnfNetworkNetFqdnXml)
+ 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()
@@ -381,23 +323,13 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor {
}
}
if (!values.isEmpty()) {
- String vnfNetworkSriovVlanFilterXml =
- """<entry>
- <key>${vnfNetworkKey}_ATT_VF_VLAN_FILTER</key>
- <value>${values}</value>
- </entry>"""
- vnfNetworksSriovVlanFilters = sbNet6.append(vnfNetworkSriovVlanFilterXml)
+ paramsMap.put("${vnfNetworkKey}_ATT_VF_VLAN_FILTER", "${values}")
}
}
}
// VNF-VMS Data
- String vnfVMS = ""
- String vnfVMSPositions = ""
- String vmNetworks = ""
- String vmNetworksPositions = ""
- String vmNetworksPositionsV6 = ""
- String interfaceRoutePrefixes = ""
+
def key
def value
def networkKey
@@ -407,11 +339,6 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor {
def floatingIPV6Key
def floatingIPV6KeyValue
StringBuilder sb = new StringBuilder()
- StringBuilder sbPositions = new StringBuilder()
- StringBuilder sbVmNetworks = new StringBuilder()
- StringBuilder sbNetworksPositions = new StringBuilder()
- StringBuilder sbInterfaceRoutePrefixes = new StringBuilder()
- StringBuilder sbNetworksPositionsV6 = new StringBuilder()
NodeList vmsList = responseXml.getElementsByTagNameNS("*","vnf-vms")
for (int x = 0; x < vmsList.getLength(); x++) {
@@ -436,12 +363,7 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor {
values = sb1.append(value);
}
position = i.toString()
- String vnfPositionXml =
- """<entry>
- <key>${key}_name_${position}</key>
- <value>${value}</value>
- </entry>"""
- vnfVMSPositions = sbPositions.append(vnfPositionXml)
+ paramsMap.put("${key}_name_${position}", "${value}")
}
}
for(int n = 0; n < vmNetworksList.getLength(); n++){
@@ -459,19 +381,13 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor {
networkKey = utils.getElementText(eElementNetworkKey, "network-role")
floatingIPKey = key + '_' + networkKey + '_floating_ip'
floatingIPKeyValue = utils.getElementText(eElementNetworkKey, "floating-ip")
- if(!floatingIPKeyValue.isEmpty()){
- floatingIpKeyValueStr = """<entry>
- <key>$floatingIPKey</key>
- <value>$floatingIPKeyValue</value>
- </entry>"""
+ if(!floatingIPKeyValue.isEmpty()){
+ paramsMap.put("$floatingIPKey", "$floatingIPKeyValue")
}
floatingIPV6Key = key + '_' + networkKey + '_floating_v6_ip'
floatingIPV6KeyValue = utils.getElementText(eElementNetworkKey, "floating-ip-v6")
- if(!floatingIPV6KeyValue.isEmpty()){
- floatingIpV6KeyValueStr = """<entry>
- <key>$floatingIPV6Key</key>
- <value>$floatingIPV6KeyValue</value>
- </entry>"""
+ if(!floatingIPV6KeyValue.isEmpty()){
+ paramsMap.put("$floatingIPV6Key", "$floatingIPV6KeyValue")
}
NodeList networkIpsList = eElementNetworkKey.getElementsByTagNameNS("*","network-ips")
for(int a = 0; a < networkIpsList.getLength(); a++){
@@ -486,50 +402,34 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor {
ipAddressValues = sb2.append(ipAddressValue);
}
networkPosition = a.toString()
- String vmNetworksPositionsXml =
- """<entry>
- <key>${key}_${networkKey}_ip_${networkPosition}</key>
- <value>${ipAddressValue}</value>
- </entry>"""
- vmNetworksPositions = sbNetworksPositions.append(vmNetworksPositionsXml)
+ paramsMap.put("${key}_${networkKey}_ip_${networkPosition}", "${ipAddressValue}")
}
}
- vmNetworksPositions = sbNetworksPositions.append(floatingIpKeyValueStr).append(floatingIpV6KeyValueStr)
-
- String vmNetworksXml =
- """<entry>
- <key>${key}_${networkKey}_ips</key>
- <value>${ipAddressValues}</value>
- </entry>"""
- vmNetworks = sbVmNetworks.append(vmNetworksXml)
+
+ 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)
+ 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) {
+ 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 + "\"}")
- }
+ }
}
}
interfaceRoutePrefixValues = sb3.append("]")
if (interfaceRoutePrefixesList.getLength() > 0) {
- String interfaceRoutePrefixesXml =
- """<entry>
- <key>${key}_${networkKey}_route_prefixes</key>
- <value>${interfaceRoutePrefixValues}</value>
- </entry>"""
- interfaceRoutePrefixes = sbInterfaceRoutePrefixes.append(interfaceRoutePrefixesXml)
+ paramsMap.put("${key}_${networkKey}_route_prefixes", "${interfaceRoutePrefixValues}")
}
NodeList networkIpsV6List = eElementNetworkKey.getElementsByTagNameNS("*","network-ips-v6")
@@ -545,28 +445,13 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor {
ipV6AddressValues = sb4.append(ipV6AddressValue);
}
networkPosition = a.toString()
- String vmNetworksPositionsV6Xml =
- """<entry>
- <key>${key}_${networkKey}_v6_ip_${networkPosition}</key>
- <value>${ipV6AddressValue}</value>
- </entry>"""
- vmNetworksPositionsV6 = sbNetworksPositionsV6.append(vmNetworksPositionsV6Xml)
+ paramsMap.put("${key}_${networkKey}_v6_ip_${networkPosition}", "${ipV6AddressValue}")
}
}
- String vmNetworksV6Xml =
- """<entry>
- <key>${key}_${networkKey}_v6_ips</key>
- <value>${ipV6AddressValues}</value>
- </entry>"""
- vmNetworks = sbVmNetworks.append(vmNetworksV6Xml)
+ paramsMap.put("${key}_${networkKey}_v6_ips", "${ipV6AddressValues}")
}
}
- String vnfXml =
- """<entry>
- <key>${key}_names</key>
- <value>${values}</value>
- </entry>"""
- vnfVMS = sb.append(vnfXml)
+ paramsMap.put("${key}_names", "${values}")
}
}
//SDNC Response Params
@@ -575,7 +460,7 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor {
String vnfParamsChildNodes = utils.getChildNodes(data, "vnf-parameters")
if(vnfParamsChildNodes == null || vnfParamsChildNodes.length() < 1){
// No SDNC params
- }else{
+ }else{
NodeList paramsList = responseXml.getElementsByTagNameNS("*", "vnf-parameters")
for (int z = 0; z < paramsList.getLength(); z++) {
Node node = paramsList.item(z)
@@ -583,34 +468,35 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor {
String vnfParameterName = utils.getElementText(eElement, "vnf-parameter-name")
if (!sdncResponseParamsToSkip.contains(vnfParameterName)) {
String vnfParameterValue = utils.getElementText(eElement, "vnf-parameter-value")
- String paraEntry =
- """<entry>
- <key>${vnfParameterName}</key>
- <value>${vnfParameterValue}</value>
- </entry>"""
- sdncResponseParams = sb.append(paraEntry)
+ 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()) {
+ String vnfKey = entry.getKey()
+ String vnfValue = entry.getValue()
+ paramsMap.put("$vnfKey", "$vnfValue")
+ }
+ }
+
+ StringBuilder sbParams = new StringBuilder()
+ def vfModuleParams = ""
+ for (Map.Entry<String, String> entry : paramsMap.entrySet()) {
+ String paramsXml
+ String paramName = entry.getKey()
+ String paramValue = entry.getValue()
+ paramsXml =
+ """<entry>
+ <key>${paramName}</key>
+ <value>${paramValue}</value>
+ </entry>
+ """
-
- def vfModuleParams = """
- ${vnfInfo}
- ${aZones}
- ${vnfNetworkNetId}
- ${vnfNetworkNetName}
- ${vnfNetworkSubNetId}
- ${vnfNetworkV6SubNetId}
- ${vnfNetworkNetFqdn}
- ${vnfNetworksSriovVlanFilters}
- ${vnfVMS}
- ${vnfVMSPositions}
- ${vmNetworks}
- ${vmNetworksPositions}
- ${vmNetworksPositionsV6}
- ${interfaceRoutePrefixes}
- ${vnfParams}
- ${sdncResponseParams}"""
+ vfModuleParams = sbParams.append(paramsXml)
+ }
return vfModuleParams
@@ -618,7 +504,7 @@ public abstract class VfModuleBase extends AbstractServiceTaskProcessor {
/*
- * VBNG specific method that parses VNF parameters passed in on the
+ * VBNG specific method that parses VNF parameters passed in on the
* incoming requests and SDNC parameters returned from SDNC get response
* and puts them into the format expected by VNF adapter.
* @param vnfParamsMap - map of VNF parameters passed in the request body
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/AbstractCallbackService.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/AbstractCallbackService.java
new file mode 100644
index 0000000000..214ae28b70
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/AbstractCallbackService.java
@@ -0,0 +1,352 @@
+package org.openecomp.mso.bpmn.common.workflow.service;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.camunda.bpm.BpmPlatform;
+import org.camunda.bpm.engine.MismatchingMessageCorrelationException;
+import org.camunda.bpm.engine.ProcessEngineServices;
+import org.camunda.bpm.engine.RuntimeService;
+import org.camunda.bpm.engine.runtime.Execution;
+import org.camunda.bpm.engine.runtime.MessageCorrelationResult;
+import org.openecomp.mso.bpmn.core.PropertyConfiguration;
+import org.openecomp.mso.logger.MessageEnum;
+import org.openecomp.mso.logger.MsoLogger;
+
+/**
+ * Abstract base class for callback services.
+ */
+public abstract class AbstractCallbackService {
+ public static final long DEFAULT_TIMEOUT_SECONDS = 60;
+ public static final long FAST_POLL_DUR_SECONDS = 5;
+ public static final long FAST_POLL_INT_MS = 100;
+ public static final long SLOW_POLL_INT_MS = 1000;
+
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
+
+ protected volatile ProcessEngineServices pes4junit = null;
+
+ /**
+ * Parameterized callback handler.
+ */
+ protected CallbackResult handleCallback(String method, Object message,
+ String messageEventName, String messageVariable,
+ String correlationVariable, String correlationValue,
+ String logMarker) {
+
+ return handleCallback(method, message, messageEventName, messageVariable,
+ correlationVariable, correlationValue, logMarker, null);
+ }
+
+ /**
+ * Parameterized callback handler.
+ */
+ protected CallbackResult handleCallback(String method, Object message,
+ String messageEventName, String messageVariable,
+ String correlationVariable, String correlationValue,
+ String logMarker, Map<String, Object> injectedVariables) {
+
+ long startTime = System.currentTimeMillis();
+
+ LOGGER.debug(logMarker + " " + method + " received message: "
+ + (message == null ? "" : System.lineSeparator()) + message);
+
+ try {
+ Map<String, Object> variables = new HashMap<String, Object>();
+
+ if (injectedVariables != null) {
+ variables.putAll(injectedVariables);
+ }
+
+ variables.put(correlationVariable, correlationValue);
+ variables.put(messageVariable, message == null ? null : message.toString());
+
+ boolean ok = correlate(messageEventName, correlationVariable,
+ correlationValue, variables, logMarker);
+
+ if (!ok) {
+ String msg = "No process is waiting for " + messageEventName
+ + " with " + correlationVariable + " = '" + correlationValue + "'";
+ logCallbackError(method, startTime, msg);
+ return new CallbackError(msg);
+ }
+
+ logCallbackSuccess(method, startTime);
+ return new CallbackSuccess();
+ } catch (Exception e) {
+ String msg = "Caught " + e.getClass().getSimpleName()
+ + " processing " + messageEventName + " with " + correlationVariable
+ + " = '" + correlationValue + "'";
+ logCallbackError(method, startTime, msg);
+ return new CallbackError(msg);
+ }
+ }
+
+ /**
+ * Performs message correlation. Waits a limited amount of time for
+ * a process to become ready for correlation. The return value indicates
+ * whether or not a process was found to receive the message. Due to the
+ * synchronous nature of message injection in Camunda, by the time this
+ * method returns, one of 3 things will have happened: (1) the process
+ * received the message and ended, (2) the process received the message
+ * and reached an activity that suspended, or (3) an exception occurred
+ * during correlation or while the process was executing. Correlation
+ * exceptions are handled differently from process execution exceptions.
+ * Correlation exceptions are thrown so the client knows something went
+ * wrong with the delivery of the message. Process execution exceptions
+ * are logged but not thrown.
+ * @param messageEventName the message event name
+ * @param correlationVariable the process variable used as the correlator
+ * @param correlationValue the correlation value
+ * @param variables variables to inject into the process
+ * @param logMarker a marker for debug logging
+ * @return true if a process could be found, false if not
+ * @throws Exception for correlation errors
+ */
+ protected boolean correlate(String messageEventName, String correlationVariable,
+ String correlationValue, Map<String, Object> variables, String logMarker)
+ throws Exception {
+
+ LOGGER.debug(logMarker + " Attempting to find process waiting"
+ + " for " + messageEventName + " with " + correlationVariable
+ + " = '" + correlationValue + "'");
+
+ RuntimeService runtimeService =
+ getProcessEngineServices().getRuntimeService();
+
+ Map<String, String> properties =
+ PropertyConfiguration.getInstance().getProperties("mso.bpmn.urn.properties");
+
+ long timeout = DEFAULT_TIMEOUT_SECONDS;
+
+ // The code is here in case we ever need to change the default.
+ String s = properties.get("mso.correlation.timeout");
+ if (s != null) {
+ try {
+ timeout = Long.parseLong(s);
+ } catch (NumberFormatException e) {
+ // Ignore
+ }
+ }
+
+ long now = System.currentTimeMillis();
+ long fastPollEndTime = now + (FAST_POLL_DUR_SECONDS * 1000);
+ long endTime = now + (timeout * 1000);
+ long sleep = FAST_POLL_INT_MS;
+
+ List<Execution> waitingProcesses = null;
+ Exception queryException = null;
+ int queryCount = 0;
+ int queryFailCount = 0;
+
+ while (true) {
+ try {
+ ++queryCount;
+ waitingProcesses = runtimeService.createExecutionQuery()
+ .messageEventSubscriptionName(messageEventName)
+ .processVariableValueEquals(correlationVariable, correlationValue)
+ .list();
+ } catch (Exception e) {
+ ++queryFailCount;
+ queryException = e;
+ }
+
+ if (waitingProcesses != null && waitingProcesses.size() > 0) {
+ break;
+ }
+
+ if (now > endTime - sleep) {
+ break;
+ }
+
+ Thread.sleep(sleep);
+ now = System.currentTimeMillis();
+
+ if (now > fastPollEndTime) {
+ sleep = SLOW_POLL_INT_MS;
+ }
+ }
+
+ if (waitingProcesses == null) {
+ waitingProcesses = new ArrayList<Execution>(0);
+ }
+
+ int count = waitingProcesses.size();
+
+ List<ExecInfo> execInfoList = new ArrayList<ExecInfo>(count);
+ for (Execution execution : waitingProcesses) {
+ execInfoList.add(new ExecInfo(execution));
+ }
+
+ LOGGER.debug(logMarker + " Found " + count + " process(es) waiting"
+ + " for " + messageEventName + " with " + correlationVariable
+ + " = '" + correlationValue + "': " + execInfoList);
+
+ if (count == 0) {
+ if (queryFailCount > 0) {
+ String msg = queryFailCount + "/" + queryCount
+ + " execution queries failed attempting to correlate "
+ + messageEventName + " with " + correlationVariable
+ + " = '" + correlationValue + "'; last exception was:"
+ + queryException;
+ LOGGER.debug(msg);
+ LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError, msg, queryException);
+ }
+
+ return false;
+ }
+
+ if (count > 1) {
+ // Only one process should be waiting. Throw an exception back to the client.
+ throw new MismatchingMessageCorrelationException(messageEventName,
+ "more than 1 process is waiting with " + correlationVariable
+ + " = '" + correlationValue + "'");
+ }
+
+ // We prototyped an asynchronous solution, i.e. resuming the process
+ // flow in a separate thread, but this affected too many existing tests,
+ // and we went back to the synchronous solution. The synchronous solution
+ // has some troublesome characteristics though. For example, the
+ // resumed flow may send request #2 to a remote system before MSO has
+ // acknowledged the notification associated with request #1.
+
+ try {
+ LOGGER.debug(logMarker + " Running " + execInfoList.get(0) + " to receive "
+ + messageEventName + " with " + correlationVariable + " = '"
+ + correlationValue + "'");
+
+ @SuppressWarnings("unused")
+ MessageCorrelationResult result = runtimeService
+ .createMessageCorrelation(messageEventName)
+ .setVariables(variables)
+ .processInstanceVariableEquals(correlationVariable, correlationValue)
+ .correlateWithResult();
+
+ } catch (MismatchingMessageCorrelationException e) {
+ // A correlation exception occurred even after we identified
+ // one waiting process. Throw it back to the client.
+ throw e;
+ } catch (Exception e) {
+ // This must be an exception from the flow itself. Log it, but don't
+ // report it back to the client.
+ String msg = "Caught " + e.getClass().getSimpleName() + " running "
+ + execInfoList.get(0) + " after receiving " + messageEventName
+ + " with " + correlationVariable + " = '" + correlationValue
+ + "': " + e;
+ LOGGER.debug(msg);
+ LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError, msg, e);
+ }
+
+ return true;
+ }
+
+ /**
+ * Records audit and metric events in the log for a callback success.
+ * @param method the method name
+ * @param startTime the request start time
+ */
+ protected void logCallbackSuccess(String method, long startTime) {
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE,
+ MsoLogger.ResponseCode.Suc, "Completed " + method);
+
+ LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE,
+ MsoLogger.ResponseCode.Suc, "Completed " + method,
+ "BPMN", MsoLogger.getServiceName(), null);
+ }
+
+ /**
+ * Records error, audit and metric events in the log for a callback
+ * internal error.
+ * @param method the method name
+ * @param startTime the request start time
+ * @param msg the error message
+ */
+ protected void logCallbackError(String method, long startTime, String msg) {
+ logCallbackError(method, startTime, msg, null);
+ }
+
+ /**
+ * Records error, audit and metric events in the log for a callback
+ * internal error.
+ * @param method the method name
+ * @param startTime the request start time
+ * @param msg the error message
+ * @param e the exception
+ */
+ protected void logCallbackError(String method, long startTime, String msg, Exception e) {
+ if (e == null) {
+ LOGGER.error(MessageEnum.BPMN_CALLBACK_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError, msg);
+ } else {
+ LOGGER.error(MessageEnum.BPMN_CALLBACK_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
+ MsoLogger.ErrorCode.UnknownError, msg, e);
+ }
+
+ LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE,
+ MsoLogger.ResponseCode.InternalError, "Completed " + method);
+
+ LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE,
+ MsoLogger.ResponseCode.InternalError, "Completed " + method,
+ "BPMN", MsoLogger.getServiceName(), null);
+ }
+
+ /**
+ * Abstract callback result object.
+ */
+ protected abstract class CallbackResult {
+ }
+
+ /**
+ * Indicates that callback handling was successful.
+ */
+ protected class CallbackSuccess extends CallbackResult {
+ }
+
+ /**
+ * Indicates that callback handling failed.
+ */
+ protected class CallbackError extends CallbackResult {
+ private final String errorMessage;
+
+ public CallbackError(String errorMessage) {
+ this.errorMessage = errorMessage;
+ }
+
+ /**
+ * Gets the error message.
+ */
+ public String getErrorMessage() {
+ return errorMessage;
+ }
+ }
+
+ private static class ExecInfo {
+ private final Execution execution;
+
+ public ExecInfo(Execution execution) {
+ this.execution = execution;
+ }
+
+ @Override
+ public String toString() {
+ return "Process[" + execution.getProcessInstanceId()
+ + ":" + execution.getId() + "]";
+ }
+ }
+
+ protected ProcessEngineServices getProcessEngineServices() {
+ if (pes4junit == null) {
+ return BpmPlatform.getDefaultProcessEngine();
+ } else {
+ return pes4junit;
+ }
+ }
+
+ public void setProcessEngineServices4junit(ProcessEngineServices pes) {
+ pes4junit = pes;
+ }
+} \ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java
index 4585d620ac..16fa51515e 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/SDNCAdapterCallbackServiceImpl.java
@@ -41,240 +41,53 @@ import org.openecomp.mso.bpmn.common.adapter.sdnc.SDNCCallbackAdapterPortType;
import org.openecomp.mso.bpmn.core.PropertyConfiguration;
import org.openecomp.mso.logger.MessageEnum;
import org.openecomp.mso.logger.MsoLogger;
+
/**
- * @version 1.0
- *
+ * Implementation of SDNCAdapterCallbackService.
*/
@WebService(serviceName="SDNCAdapterCallbackService", targetNamespace="http://org.openecomp/workflow/sdnc/adapter/schema/v1")
-public class SDNCAdapterCallbackServiceImpl implements SDNCCallbackAdapterPortType {
-
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
- private final int DEFAULT_RETRY_ATTEMPTS = 60;
- private final int DEFAULT_SLEEP_TIME = 500;
+public class SDNCAdapterCallbackServiceImpl extends AbstractCallbackService implements SDNCCallbackAdapterPortType {
private final String logMarker = "[SDNC-CALLBACK]";
@Context WebServiceContext wsContext;
- private volatile ProcessEngineServices pes4junit = null;
-
@WebMethod(operationName = "SDNCAdapterCallback")
@WebResult(name = "SDNCAdapterResponse", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackResponse")
public SDNCAdapterResponse sdncAdapterCallback(
@WebParam(name = "SDNCAdapterCallbackRequest", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackRequest")
SDNCAdapterCallbackRequest sdncAdapterCallbackRequest) {
- //Callback URL to use http://localhost:28080/mso/SDNCAdapterCallbackService
- ProcessEngineServices pes = getProcessEngineServices();
- RuntimeService runtimeService = pes.getRuntimeService();
- String receivedRequestId = sdncAdapterCallbackRequest.getCallbackHeader().getRequestId();
- MsoLogger.setServiceName("MSO." + "sdncAdapter");
- MsoLogger.setLogContext(receivedRequestId, "N/A");
- msoLogger.debug(logMarker + "Received callback response:" + sdncAdapterCallbackRequest.toString());
- SDNCAdapterResponse sdncAdapterResponse;
- long startTime = System.currentTimeMillis();
-
- /*Correlating the response with the running instance*/
-
- // NOTE: the following loop is a workaround for problems we've had
- // with reliability of the runtime service. It seems that queries
- // sometimes return results, and sometimes they don't. This might
- // be a problem in mysql only. We aren't sure if it affects camunda
- // on oracle or mariadb. The workaround is to repeat the request
- // a number of times until it succeeds. If it doesn't succeed after
- // 60 tries, then we give up.
-
- int maxAttempts = DEFAULT_RETRY_ATTEMPTS;
- int attempt = 1;
- int sleepTime = DEFAULT_SLEEP_TIME;
+ String method = "sdncAdapterCallback";
+ Object message = sdncAdapterCallbackRequest;
+ String messageEventName = "sdncAdapterCallbackRequest";
+ String messageVariable = "sdncAdapterCallbackRequest";
+ String correlationVariable = "SDNCA_requestId";
+ String correlationValue = sdncAdapterCallbackRequest.getCallbackHeader().getRequestId();
- Map<String,String> bpmnProperties = getMSOBPMNURNProperties();
- if (bpmnProperties != null) {
- try {
- maxAttempts = Integer.parseInt(bpmnProperties.get("mso.callbackRetryAttempts"));
- msoLogger.debug(logMarker + "mso.callbackRetryAttempts=" + maxAttempts);
- sleepTime = Integer.parseInt(bpmnProperties.get("mso.callbackRetrySleepTime"));
- msoLogger.debug(logMarker + "mso.callbackRetrySleepTime:" + sleepTime);
- } catch (Exception ex) {
-
- msoLogger.debug (logMarker
- + "Error parsing mso.callbackRetrySleepTime/mso.callbackRetryAttempts:"
- + sleepTime + ":"
- + maxAttempts);
-
- }
- }
-
- /* Check to make sure the process instance is reay for correlation*/
- try{
- isReadyforCorrelation(runtimeService, receivedRequestId, maxAttempts, sleepTime );
- }catch(Exception e){
- String msg =
- "SDNC Adapter Callback Service received a SDNC Adapter Callback Request with RequestId '"
- + receivedRequestId
- + "' but that RequestId doesn't exist or has timed out waiting for the callback";
- sdncAdapterResponse = new SDNCAdapterExceptionResponse(e);
-
- msoLogger.error (MessageEnum.BPMN_SDNC_CALLBACK_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.UnknownError, logMarker + ":" + msg, e);
-
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, logMarker
- + "Completed the execution of MSO SDNCAdapterCallbackService." );
-
- msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- logMarker + "Completed the execution of MSO SDNCAdapterCallbackService.", "BPMN",
- MsoLogger.getServiceName(), "sdncAdapterCallback");
-
- return sdncAdapterResponse;
- }
+ MsoLogger.setServiceName("MSO." + method);
+ MsoLogger.setLogContext(correlationValue, "N/A");
- msoLogger.debug(logMarker + "*** Received MSO sdncAdapterCallbackService ******");
-
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Call to MSO sdncAdapterCallbackService");
-
- msoLogger.debug(logMarker + "Callback response string:\n" + sdncAdapterCallbackRequest.toString());
+ CallbackResult result = handleCallback(method, message, messageEventName,
+ messageVariable, correlationVariable, correlationValue, logMarker);
- String reqId = receivedRequestId;
- Map<String,Object> variables = new HashMap<String,Object>();
- variables.put("SDNCA_requestId", reqId );
- variables.put("sdncAdapterCallbackRequest", sdncAdapterCallbackRequest.toString());
- while (true) {
- try {
- // sdncAdapterCallbackRequest is the message event name (defined in the bpmn process)
- runtimeService.createMessageCorrelation("sdncAdapterCallbackRequest")
- .setVariables(variables)
- .processInstanceVariableEquals("SDNCA_requestId", reqId).correlate();
- sdncAdapterResponse = new SDNCAdapterResponse();
- msoLogger.debug(logMarker + "***** Completed processing of MSO sdncAdapterCallbackService ******");
-
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, logMarker
- + "Completed the execution of MSO SDNCAdapterCallbackService.");
-
- msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- logMarker + "Completed the execution of MSO SDNCAdapterCallbackService.", "BPMN",
- MsoLogger.getServiceName(), "sdncAdapterCallback");
-
- return sdncAdapterResponse;
- } catch(MismatchingMessageCorrelationException e) {
- msoLogger.debug(logMarker + "[CORM]correlation id mismatch (attempt " + attempt + "/" + maxAttempts + ")");
- if (attempt == maxAttempts) {
- // Couldn't correlate requestId to any active flow
- //MsoLogger logger = MsoLogger.getMsoLogger("SDNCAdapterCallbackService");
- String msg =
- "SDNC Adapter Callback Service received a SDNC Adapter Callback Request with RequestId '"
- + receivedRequestId
- + "' but that RequestId could not be correlated to any active process - ignoring the Request";
- sdncAdapterResponse = new SDNCAdapterExceptionResponse(e);
-
- msoLogger.error (MessageEnum.BPMN_SDNC_CALLBACK_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.UnknownError, logMarker + ":" + msg, e);
-
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, logMarker
- + "Completed the execution of MSO SDNCAdapterCallbackService." );
-
- msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- logMarker + "Completed the execution of MSO SDNCAdapterCallbackService.", "BPMN",
- MsoLogger.getServiceName(), "sdncAdapterCallback");
-
- return sdncAdapterResponse;
- }
-
- try {
- Thread.sleep(sleepTime);
- } catch (InterruptedException e2) {
- String msg =
- "SDNC Adapter Callback Service received a SDNC Adapter Callback Request with RequestId '"
- + receivedRequestId
- + "' but correlation was interrupted";
- sdncAdapterResponse = new SDNCAdapterExceptionResponse(e);
-
- msoLogger.error (MessageEnum.BPMN_SDNC_CALLBACK_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.UnknownError, logMarker + ":" + msg, e);
-
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, logMarker
- + "Completed the execution of MSO SDNCAdapterCallbackService.");
-
- msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- logMarker + "Completed the execution of MSO SDNCAdapterCallbackService.", "BPMN",
- MsoLogger.getServiceName(), "sdncAdapterCallback");
-
- return sdncAdapterResponse;
- }
- }
-
- attempt++;
- }
- }
-
-
- private Map<String,String> getMSOBPMNURNProperties() {
- PropertyConfiguration propertyConfiguration = PropertyConfiguration.getInstance();
- Map<String,String> props = propertyConfiguration.getProperties("mso.bpmn.urn.properties");
- return props;
- }
-
- private void isReadyforCorrelation(RuntimeService runtimeService,
- String receivedRequestId, int retries, int sleepTime){
- ExecutionQuery waitingInstances = null;
- long waitingInstancesCount = 0;
-
- //Workaround for performance testing, explicit wait for a second for the transactions to be committed
- //Also check to make sure the process didn't timeout before trying to correlate
-
- do{
- waitingInstances = runtimeService.createExecutionQuery() //
- .messageEventSubscriptionName("sdncAdapterCallbackRequest")
- .processVariableValueEquals("SDNCA_requestId", receivedRequestId);
- waitingInstancesCount = waitingInstances.count();
- retries--;
- msoLogger.debug(logMarker + "waitingInstancesCount: " + waitingInstancesCount);
- try {
- Thread.sleep(sleepTime);
- } catch (InterruptedException e) {
-
- msoLogger.error (MessageEnum.BPMN_SDNC_CALLBACK_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.UnknownError, logMarker, e);
-
- }
- }while (waitingInstancesCount==0 && retries > 0);
- if(waitingInstancesCount > 0){
- msoLogger.debug(logMarker + "waitingInstancesCount before timeout check: " + waitingInstancesCount);
- waitingInstancesCount = waitingInstances.processVariableValueEquals("asynchronousResponseTimeout", false).count();
- msoLogger.debug(logMarker + "waitingInstancesCount after timeout check: " + waitingInstancesCount);
- if(waitingInstancesCount<=0){
- msoLogger.debug(logMarker + "detected timeout on flow to correlate");
- throw new IllegalStateException("process timed out");
- }
- }else{
- //flow may have already ended, so can't check timeout variable. Throw exception?
- msoLogger.debug(logMarker + "no flow to correlate to");
- throw new IllegalStateException("no flow to correlate to");
- }
- }
-
- private ProcessEngineServices getProcessEngineServices() {
- if (pes4junit == null) {
- return BpmPlatform.getDefaultProcessEngine();
+ if (result instanceof CallbackError) {
+ return new SDNCAdapterErrorResponse(((CallbackError)result).getErrorMessage());
} else {
- return pes4junit;
+ return new SDNCAdapterResponse();
}
}
- @WebMethod(exclude=true)
- public void setProcessEngineServices4junit(ProcessEngineServices pes) {
- pes4junit = pes;
- }
-
- public class SDNCAdapterExceptionResponse extends SDNCAdapterResponse {
- private Exception ex;
+ // This subclass allows unit tests to extract the error
+ public class SDNCAdapterErrorResponse extends SDNCAdapterResponse {
+ private String error;
- public SDNCAdapterExceptionResponse(Exception ex) {
- super();
- this.ex = ex;
+ public SDNCAdapterErrorResponse(String error) {
+ this.error = error;
}
- public Exception getException() {
- return ex;
+ public String getError() {
+ return error;
}
}
-}
+} \ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java
index 457717243a..0faf5feafc 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java
@@ -1,536 +1,249 @@
-/*-
- * ============LICENSE_START=======================================================
- * OPENECOMP - MSO
- * ================================================================================
- * 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.workflow.service;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.jws.Oneway;
-import javax.jws.WebMethod;
-import javax.jws.WebParam;
-import javax.jws.WebService;
-import javax.ws.rs.core.Context;
-import javax.xml.ws.Action;
-import javax.xml.ws.RequestWrapper;
-import javax.xml.ws.WebServiceContext;
-
-import org.camunda.bpm.BpmPlatform;
-import org.camunda.bpm.engine.MismatchingMessageCorrelationException;
-import org.camunda.bpm.engine.ProcessEngineServices;
-import org.camunda.bpm.engine.RuntimeService;
-import org.openecomp.mso.bpmn.common.adapter.vnf.CreateVnfNotification;
-import org.openecomp.mso.bpmn.common.adapter.vnf.DeleteVnfNotification;
-import org.openecomp.mso.bpmn.common.adapter.vnf.MsoExceptionCategory;
-import org.openecomp.mso.bpmn.common.adapter.vnf.QueryVnfNotification;
-import org.openecomp.mso.bpmn.common.adapter.vnf.RollbackVnfNotification;
-import org.openecomp.mso.bpmn.common.adapter.vnf.UpdateVnfNotification;
-import org.openecomp.mso.bpmn.common.adapter.vnf.VnfAdapterNotify;
-import org.openecomp.mso.bpmn.common.adapter.vnf.VnfRollback;
-import org.openecomp.mso.bpmn.common.adapter.vnf.VnfStatus;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
-
-/**
- * This is the service class for VnfAdapterNotify
- * TODO: Add addition VnfAdapterNotify Methods for remaining VnfAdapterNotify operations.
- */
-
-@WebService(serviceName = "vnfAdapterNotify", targetNamespace = "http://org.openecomp.mso/vnfNotify")
-public class VnfAdapterNotifyServiceImpl implements VnfAdapterNotify{
-
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - MSO
+ * ================================================================================
+ * 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.workflow.service;
+
+import javax.jws.Oneway;
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebService;
+import javax.ws.rs.core.Context;
+import javax.xml.ws.Action;
+import javax.xml.ws.RequestWrapper;
+import javax.xml.ws.WebServiceContext;
+
+import org.openecomp.mso.bpmn.common.adapter.vnf.CreateVnfNotification;
+import org.openecomp.mso.bpmn.common.adapter.vnf.DeleteVnfNotification;
+import org.openecomp.mso.bpmn.common.adapter.vnf.MsoExceptionCategory;
+import org.openecomp.mso.bpmn.common.adapter.vnf.QueryVnfNotification;
+import org.openecomp.mso.bpmn.common.adapter.vnf.RollbackVnfNotification;
+import org.openecomp.mso.bpmn.common.adapter.vnf.UpdateVnfNotification;
+import org.openecomp.mso.bpmn.common.adapter.vnf.VnfAdapterNotify;
+import org.openecomp.mso.bpmn.common.adapter.vnf.VnfRollback;
+import org.openecomp.mso.bpmn.common.adapter.vnf.VnfStatus;
+import org.openecomp.mso.logger.MsoLogger;
+
+/**
+ * Implementation of the VnfAdapterNotify service.
+ */
+@WebService(serviceName = "vnfAdapterNotify", targetNamespace = "http://org.openecomp.mso/vnfNotify")
+public class VnfAdapterNotifyServiceImpl extends AbstractCallbackService implements VnfAdapterNotify{
+
private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
- private final String logMarker = "[VNF-NOTIFY]";
-
- @Context WebServiceContext wsContext;
-
- private volatile ProcessEngineServices pes4junit = null;
-
- /**
- *
- * @param errorMessage
- * @param exception
- * @param messageId
- * @param completed
- */
- @WebMethod(operationName = "rollbackVnfNotification")
- @Oneway
- @RequestWrapper(localName = "rollbackVnfNotification", targetNamespace = "http://org.openecomp.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.RollbackVnfNotification")
+ private final String logMarker = "[VNF-NOTIFY]";
+
+ @Context WebServiceContext wsContext;
+
+ @WebMethod(operationName = "rollbackVnfNotification")
+ @Oneway
+ @RequestWrapper(localName = "rollbackVnfNotification", targetNamespace = "http://org.openecomp.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.RollbackVnfNotification")
@Action(input = "http://org.openecomp.mso/notify/adapterNotify/rollbackVnfNotificationRequest")
- public void rollbackVnfNotification(
- @WebParam(name = "messageId", targetNamespace = "")
- String messageId,
- @WebParam(name = "completed", targetNamespace = "")
- boolean completed,
- @WebParam(name = "exception", targetNamespace = "")
- MsoExceptionCategory exception,
- @WebParam(name = "errorMessage", targetNamespace = "")
- String errorMessage) {
-
-
-
- RollbackVnfNotification rollbackVnfNotification = new RollbackVnfNotification();
-
- rollbackVnfNotification.setMessageId(messageId);
- rollbackVnfNotification.setCompleted(completed);
- rollbackVnfNotification.setException(exception);
- rollbackVnfNotification.setErrorMessage(errorMessage);
-
- ProcessEngineServices pes = getProcessEngineServices();
- RuntimeService runtimeService = pes.getRuntimeService();
-
- MsoLogger.setServiceName("MSO." + "vnfAdapterRollback");
- MsoLogger.setLogContext(messageId, "N/A");
- msoLogger.debug(logMarker + "Received RollbackVnfNotification" + rollbackVnfNotification.toString());
-
- long startTime = System.currentTimeMillis();
- try {
-
- /* Check to make sure the process instance is ready for correlation*/
- isReadyforCorrelation(runtimeService, messageId, "rollbackVnfNotificationCallback", "VNFRB_messageId");
-
- msoLogger.debug(logMarker + "*** Received MSO rollbackVnfNotification Callback ******");
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Call to MSO VnfAdapterNotifyService ");
- msoLogger.debug(logMarker + "Rollback VNF Notification string:\n" + rollbackVnfNotification.toString());
-
- System.out.println("testing ROllbackVnfNotification : " + rollbackVnfNotification.toString());
-
- Map<String,Object> variables = new HashMap<String,Object>();
- variables.put("VNFRB_messageId", messageId );
- variables.put("rollbackVnfNotificationCallback", rollbackVnfNotification.toString());
-
- /*Correlating the response with the running instance*/
-
- runtimeService.createMessageCorrelation("rollbackVnfNotificationCallback").setVariables(variables)
- .processInstanceVariableEquals("VNFRB_messageId", messageId).correlate();
-
- msoLogger.debug(logMarker + "***** Completed processing of MSO VnfAdapterNotifyService ******");
- } catch(MismatchingMessageCorrelationException e) {
- msoLogger.debug(logMarker + "[CORM]correlation id mismatch");
- String msg =
- "VNF Adapter Notify Service received a Create VNF Notification request with RequestId '"
- + messageId
- + "' but that RequestId could not be correlated to any active process - ignoring the request";
-
- msoLogger.error (MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.UnknownError, logMarker + ":" + msg);
-
- }
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- logMarker + "Completed the execution of MSO Vnf Adapter Notify for Rollback VNF Notification.");
-
- msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- logMarker + "Completed the execution of MSO Vnf Adapter Notify for Rollback VNF Notification.", "BPMN",
- MsoLogger.getServiceName(), "rollbackVnfNotification");
-
- return;
- }
-
-
-
- /**
- *
- * @param errorMessage
- * @param vnfExists
- * @param status
- * @param exception
- * @param outputs
- * @param messageId
- * @param vnfId
- * @param completed
- */
- @WebMethod(operationName = "queryVnfNotification")
- @Oneway
+ public void rollbackVnfNotification(
+ @WebParam(name = "messageId", targetNamespace = "")
+ String messageId,
+ @WebParam(name = "completed", targetNamespace = "")
+ boolean completed,
+ @WebParam(name = "exception", targetNamespace = "")
+ MsoExceptionCategory exception,
+ @WebParam(name = "errorMessage", targetNamespace = "")
+ String errorMessage) {
+
+ RollbackVnfNotification rollbackVnfNotification = new RollbackVnfNotification();
+
+ rollbackVnfNotification.setMessageId(messageId);
+ rollbackVnfNotification.setCompleted(completed);
+ rollbackVnfNotification.setException(exception);
+ rollbackVnfNotification.setErrorMessage(errorMessage);
+
+ String method = "rollbackVnfNotification";
+ Object message = rollbackVnfNotification;
+ String messageEventName = "rollbackVnfNotificationCallback";
+ String messageVariable = "rollbackVnfNotificationCallback";
+ String correlationVariable = "VNFRB_messageId";
+ String correlationValue = messageId;
+
+ handleCallback(method, message, messageEventName, messageVariable,
+ correlationVariable, correlationValue, logMarker);
+ }
+
+ @WebMethod(operationName = "queryVnfNotification")
+ @Oneway
@RequestWrapper(localName = "queryVnfNotification", targetNamespace = "http://org.openecomp.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.QueryVnfNotification")
@Action(input = "http://org.openecomp.mso/notify/adapterNotify/queryVnfNotificationRequest")
- public void queryVnfNotification(
- @WebParam(name = "messageId", targetNamespace = "")
- String messageId,
- @WebParam(name = "completed", targetNamespace = "")
- boolean completed,
- @WebParam(name = "exception", targetNamespace = "")
- MsoExceptionCategory exception,
- @WebParam(name = "errorMessage", targetNamespace = "")
- String errorMessage,
- @WebParam(name = "vnfExists", targetNamespace = "")
- Boolean vnfExists,
- @WebParam(name = "vnfId", targetNamespace = "")
- String vnfId,
- @WebParam(name = "status", targetNamespace = "")
- VnfStatus status,
- @WebParam(name = "outputs", targetNamespace = "")
- org.openecomp.mso.bpmn.common.adapter.vnf.QueryVnfNotification.Outputs outputs){
-
- QueryVnfNotification queryVnfNotification = new QueryVnfNotification();
-
- queryVnfNotification.setMessageId(messageId);
- queryVnfNotification.setCompleted(completed);
- queryVnfNotification.setException(exception);
- queryVnfNotification.setErrorMessage(errorMessage);
- queryVnfNotification.setVnfExists(vnfExists);
- queryVnfNotification.setVnfId(vnfId);
- queryVnfNotification.setStatus(status);
- queryVnfNotification.setOutputs(outputs);
-
-
- ProcessEngineServices pes = getProcessEngineServices();
- RuntimeService runtimeService = pes.getRuntimeService();
-
- MsoLogger.setServiceName("MSO." + "vnf Adapter Query");
- MsoLogger.setLogContext(messageId, "N/A");
- msoLogger.debug(logMarker + "Received QueryVnfNotification" + queryVnfNotification.toString());
-
- System.out.println("Received QueryVnfNotification : " + queryVnfNotification.toString());
-
- long startTime = System.currentTimeMillis();
- try {
-
- /* Check to make sure the process instance is ready for correlation*/
- isReadyforCorrelation(runtimeService, messageId, "queryVnfNotificationCallback", "VNFQ_messageId");
-
- msoLogger.debug(logMarker + "*** Received MSO queryVnfNotification Callback ******");
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Call to MSO VnfAdapterNotifyService ");
- msoLogger.debug(logMarker + "Query VNF Notification string:\n" + queryVnfNotification.toString());
-
- Map<String,Object> variables = new HashMap<String,Object>();
- variables.put("VNFQ_messageId", messageId );
- variables.put("queryVnfNotificationCallback", queryVnfNotification.toString());
-
- /*Correlating the response with the running instance*/
-
- runtimeService.createMessageCorrelation("queryVnfNotificationCallback").setVariables(variables)
- .processInstanceVariableEquals("VNFQ_messageId", messageId).correlate();
-
- msoLogger.debug(logMarker + "***** Completed processing of MSO VnfAdapterNotifyService ******");
- } catch(MismatchingMessageCorrelationException e) {
- msoLogger.debug(logMarker + "[CORM]correlation id mismatch");
- String msg =
- "VNF Adapter Notify Service received a Query VNF Notification request with RequestId '"
- + messageId
- + "' but that RequestId could not be correlated to any active process - ignoring the request";
-
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.UnknownError, logMarker + ":" + msg, e);
- }
-
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- logMarker + "Completed the execution of MSO Vnf Adapter Notify for Query VNF Notification.");
-
- return;
- }
-
-
-
-
- /**
- *
- * @param errorMessage
- * @param exception
- * @param rollback
- * @param outputs
- * @param messageId
- * @param vnfId
- * @param completed
- */
- @WebMethod(operationName = "createVnfNotification")
- @Oneway
+ public void queryVnfNotification(
+ @WebParam(name = "messageId", targetNamespace = "")
+ String messageId,
+ @WebParam(name = "completed", targetNamespace = "")
+ boolean completed,
+ @WebParam(name = "exception", targetNamespace = "")
+ MsoExceptionCategory exception,
+ @WebParam(name = "errorMessage", targetNamespace = "")
+ String errorMessage,
+ @WebParam(name = "vnfExists", targetNamespace = "")
+ Boolean vnfExists,
+ @WebParam(name = "vnfId", targetNamespace = "")
+ String vnfId,
+ @WebParam(name = "status", targetNamespace = "")
+ VnfStatus status,
+ @WebParam(name = "outputs", targetNamespace = "")
+ QueryVnfNotification.Outputs outputs){
+
+ String method = "queryVnfNotification";
+ String messageEventName = "queryVnfNotificationCallback";
+ String messageVariable = "queryVnfNotificationCallback";
+ String correlationVariable = "VNFQ_messageId";
+ String correlationValue = messageId;
+
+ MsoLogger.setServiceName("MSO." + method);
+ MsoLogger.setLogContext(correlationValue, "N/A");
+
+ QueryVnfNotification message = new QueryVnfNotification();
+
+ message.setMessageId(messageId);
+ message.setCompleted(completed);
+ message.setException(exception);
+ message.setErrorMessage(errorMessage);
+ message.setVnfExists(vnfExists);
+ message.setVnfId(vnfId);
+ message.setStatus(status);
+ message.setOutputs(outputs);
+
+ handleCallback(method, message, messageEventName, messageVariable,
+ correlationVariable, correlationValue, logMarker);
+ }
+
+ @WebMethod(operationName = "createVnfNotification")
+ @Oneway
@RequestWrapper(localName = "createVnfNotification", targetNamespace = "http://org.openecomp.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.CreateVnfNotification")
@Action(input = "http://org.openecomp.mso/notify/adapterNotify/createVnfNotificationRequest")
- public void createVnfNotification(
- @WebParam(name = "messageId", targetNamespace = "")
- String messageId,
- @WebParam(name = "completed", targetNamespace = "")
- boolean completed,
- @WebParam(name = "exception", targetNamespace = "")
- MsoExceptionCategory exception,
- @WebParam(name = "errorMessage", targetNamespace = "")
- String errorMessage,
- @WebParam(name = "vnfId", targetNamespace = "")
- String vnfId,
- @WebParam(name = "outputs", targetNamespace = "")
- org.openecomp.mso.bpmn.common.adapter.vnf.CreateVnfNotification.Outputs outputs,
- @WebParam(name = "rollback", targetNamespace = "")
- VnfRollback rollback){
-
- CreateVnfNotification createVnfNotification = new CreateVnfNotification();
-
- createVnfNotification.setMessageId(messageId);
- createVnfNotification.setCompleted(completed);
- createVnfNotification.setException(exception);
- createVnfNotification.setErrorMessage(errorMessage);
- createVnfNotification.setVnfId(vnfId);
- createVnfNotification.setOutputs(outputs);
- createVnfNotification.setRollback(rollback);
-
- ProcessEngineServices pes = getProcessEngineServices();
- RuntimeService runtimeService = pes.getRuntimeService();
-
- MsoLogger.setServiceName("MSO." + "vnf Adapter Create");
- MsoLogger.setLogContext(messageId, "N/A");
- msoLogger.debug(logMarker + "Received CreateVnfNotification - " + createVnfNotification.toString());
-
- long startTime = System.currentTimeMillis();
- try {
-
- /* Check to make sure the process instance is ready for correlation*/
- isReadyforCorrelation(runtimeService, messageId, "createVnfNotificationCallback", "VNFC_messageId");
-
- msoLogger.debug(logMarker + "*** Received MSO createVnfNotification Callback ******");
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Call to MSO VnfAdapterNotifyService ");
-
- msoLogger.debug(logMarker + "Create VNF Notification string:\n" + createVnfNotification.toString());
-
- Map<String,Object> variables = new HashMap<String,Object>();
- variables.put("VNFC_messageId", messageId );
- variables.put("createVnfNotificationCallback", createVnfNotification.toString());
-
- /*Correlating the response with the running instance*/
-
- runtimeService.createMessageCorrelation("createVnfNotificationCallback").setVariables(variables)
- .processInstanceVariableEquals("VNFC_messageId", messageId).correlate();
-
- msoLogger.debug(logMarker + "***** Completed processing of MSO VnfAdapterNotifyService ******");
- } catch(MismatchingMessageCorrelationException e) {
- msoLogger.debug(logMarker + "[CORM]correlation id mismatch");
- String msg =
- "VNF Adapter Notify Service received a Create VNF Notification request with RequestId '"
- + messageId
- + "' but that RequestId could not be correlated to any active process - ignoring the request";
-
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.UnknownError, logMarker + ":" + msg, e);
-
- }
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- logMarker + "Completed the execution of MSO Vnf Adapter Notify for Query VNF Notification.");
-
- msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- logMarker + "Completed the execution of MSO Vnf Adapter Notify for Query VNF Notification.", "BPMN",
- MsoLogger.getServiceName(), "createVnfNotification");
-
- return;
- }
-
- /**
- *
- * @param errorMessage
- * @param exception
- * @param rollback
- * @param outputs
- * @param messageId
- * @param completed
- */
- @WebMethod(operationName = "updateVnfNotification")
- @Oneway
+ public void createVnfNotification(
+ @WebParam(name = "messageId", targetNamespace = "")
+ String messageId,
+ @WebParam(name = "completed", targetNamespace = "")
+ boolean completed,
+ @WebParam(name = "exception", targetNamespace = "")
+ MsoExceptionCategory exception,
+ @WebParam(name = "errorMessage", targetNamespace = "")
+ String errorMessage,
+ @WebParam(name = "vnfId", targetNamespace = "")
+ String vnfId,
+ @WebParam(name = "outputs", targetNamespace = "")
+ CreateVnfNotification.Outputs outputs,
+ @WebParam(name = "rollback", targetNamespace = "")
+ VnfRollback rollback){
+
+ String method = "createVnfNotification";
+ String messageEventName = "createVnfNotificationCallback";
+ String messageVariable = "createVnfNotificationCallback";
+ String correlationVariable = "VNFC_messageId";
+ String correlationValue = messageId;
+
+ MsoLogger.setServiceName("MSO." + method);
+ MsoLogger.setLogContext(correlationValue, "N/A");
+
+ CreateVnfNotification message = new CreateVnfNotification();
+
+ message.setMessageId(messageId);
+ message.setCompleted(completed);
+ message.setException(exception);
+ message.setErrorMessage(errorMessage);
+ message.setVnfId(vnfId);
+ message.setOutputs(outputs);
+ message.setRollback(rollback);
+
+ handleCallback(method, message, messageEventName, messageVariable,
+ correlationVariable, correlationValue, logMarker);
+ }
+
+ @WebMethod(operationName = "updateVnfNotification")
+ @Oneway
@RequestWrapper(localName = "updateVnfNotification", targetNamespace = "http://org.openecomp.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.UpdateVnfNotification")
@Action(input = "http://org.openecomp.mso/notify/adapterNotify/updateVnfNotificationRequest")
- public void updateVnfNotification(
- @WebParam(name = "messageId", targetNamespace = "")
- String messageId,
- @WebParam(name = "completed", targetNamespace = "")
- boolean completed,
- @WebParam(name = "exception", targetNamespace = "")
- MsoExceptionCategory exception,
- @WebParam(name = "errorMessage", targetNamespace = "")
- String errorMessage,
- @WebParam(name = "outputs", targetNamespace = "")
- org.openecomp.mso.bpmn.common.adapter.vnf.UpdateVnfNotification.Outputs outputs,
- @WebParam(name = "rollback", targetNamespace = "")
- VnfRollback rollback){
-
- UpdateVnfNotification updateVnfNotification = new UpdateVnfNotification();
-
- updateVnfNotification.setMessageId(messageId);
- updateVnfNotification.setCompleted(completed);
- updateVnfNotification.setException(exception);
- updateVnfNotification.setErrorMessage(errorMessage);
- updateVnfNotification.setOutputs(outputs);
- updateVnfNotification.setRollback(rollback);
-
- ProcessEngineServices pes = getProcessEngineServices();
- RuntimeService runtimeService = pes.getRuntimeService();
-
- MsoLogger.setServiceName("MSO." + "vnf Adapter Update");
- MsoLogger.setLogContext(messageId, "N/A");
- msoLogger.debug(logMarker + "Received UpdateVnfNotification - " + updateVnfNotification.toString());
-
- long startTime = System.currentTimeMillis();
- try {
-
- // Check to make sure the process instance is ready for correlation
- isReadyforCorrelation(runtimeService, messageId, "updateVnfNotificationCallback", "VNFU_messageId");
-
- msoLogger.debug(logMarker + "*** Received MSO updateVnfNotification Callback ******");
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Call to MSO VnfAdapterNotifyService ");
-
- msoLogger.debug(logMarker + "Update VNF Notification string:\n" + updateVnfNotification.toString());
-
- Map<String,Object> variables = new HashMap<String,Object>();
- variables.put("VNFU_messageId", messageId );
- variables.put("updateVnfNotificationCallback", updateVnfNotification.toString());
-
- //Correlating the response with the running instance
- runtimeService.createMessageCorrelation("updateVnfNotificationCallback").setVariables(variables)
- .processInstanceVariableEquals("VNFU_messageId", messageId).correlate();
-
- msoLogger.debug(logMarker + "***** Completed processing of MSO VnfAdapterNotifyService ******");
-
- } catch(MismatchingMessageCorrelationException e) {
- msoLogger.debug(logMarker + "[CORM]correlation id mismatch");
- String msg =
- "VNF Adapter Notify Service received a Update VNF Notification request with RequestId '"
- + messageId
- + "' but that RequestId could not be correlated to any active process - ignoring the request";
-
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.UnknownError, logMarker + ":" + msg, e);
-
- }
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- logMarker + "Completed the execution of MSO Vnf Adapter Notify for Update VNF Notification.");
-
- msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- logMarker + "Completed the execution of MSO Vnf Adapter Notify for Update VNF Notification.", "BPMN",
- MsoLogger.getServiceName(), "updateVnfNotification");
-
- return;
- }
-
- /**
- *
- * @param errorMessage
- * @param exception
- * @param messageId
- * @param completed
- */
-
- //@WebService(serviceName="VNFAdapterDeleteCallbackV1", targetNamespace="http://org.openecomp.mso/vnfNotify")
- @WebMethod(operationName = "deleteVnfNotification")
- @Oneway
+ public void updateVnfNotification(
+ @WebParam(name = "messageId", targetNamespace = "")
+ String messageId,
+ @WebParam(name = "completed", targetNamespace = "")
+ boolean completed,
+ @WebParam(name = "exception", targetNamespace = "")
+ MsoExceptionCategory exception,
+ @WebParam(name = "errorMessage", targetNamespace = "")
+ String errorMessage,
+ @WebParam(name = "outputs", targetNamespace = "")
+ UpdateVnfNotification.Outputs outputs,
+ @WebParam(name = "rollback", targetNamespace = "")
+ VnfRollback rollback){
+
+ String method = "updateVnfNotification";
+ String messageEventName = "updateVnfNotificationCallback";
+ String messageVariable = "updateVnfNotificationCallback";
+ String correlationVariable = "VNFU_messageId";
+ String correlationValue = messageId;
+
+ MsoLogger.setServiceName("MSO." + method);
+ MsoLogger.setLogContext(correlationValue, "N/A");
+
+ UpdateVnfNotification message = new UpdateVnfNotification();
+
+ message.setMessageId(messageId);
+ message.setCompleted(completed);
+ message.setException(exception);
+ message.setErrorMessage(errorMessage);
+ message.setOutputs(outputs);
+ message.setRollback(rollback);
+
+ handleCallback(method, message, messageEventName, messageVariable,
+ correlationVariable, correlationValue, logMarker);
+ }
+
+ @WebMethod(operationName = "deleteVnfNotification")
+ @Oneway
@RequestWrapper(localName = "deleteVnfNotification", targetNamespace = "http://org.openecomp.mso/vnfNotify", className = "org.openecomp.mso.adapters.vnf.async.client.DeleteVnfNotification")
@Action(input = "http://org.openecomp.mso/notify/adapterNotify/deleteVnfNotificationRequest")
- public void deleteVnfNotification(
- @WebParam(name = "messageId", targetNamespace = "")
- String messageId,
- @WebParam(name = "completed", targetNamespace = "")
- boolean completed,
- @WebParam(name = "exception", targetNamespace = "")
- MsoExceptionCategory exception,
- @WebParam(name = "errorMessage", targetNamespace = "")
- String errorMessage) {
-
- //Callback URL to use http://localhost:28080/mso/services/VNFAdapterDeleteCallbackV1
-
- //DeleteVnfNotification Class
- DeleteVnfNotification deleteVnfNotification = new DeleteVnfNotification();
- deleteVnfNotification.setMessageId(messageId);
- deleteVnfNotification.setCompleted(completed);
- deleteVnfNotification.setException(exception);
- deleteVnfNotification.setErrorMessage(errorMessage);
-
- ProcessEngineServices pes = getProcessEngineServices();
- RuntimeService runtimeService = pes.getRuntimeService();
-
- MsoLogger.setServiceName("MSO." + "vnfAdapterDelete");
- MsoLogger.setLogContext(messageId, "N/A");
- msoLogger.debug(logMarker + "Received DeleteVnfNotification callback: " + deleteVnfNotification.toString());
-
- long startTime = System.currentTimeMillis();
- try {
-
- /* Check to make sure the process instance is ready for correlation*/
- //isReadyforCorrelation(runtimeService, messageId, "deleteVnfACallback", "VNFDEL_uuid");
-
- msoLogger.debug(logMarker + " *** Received MSO deleteVnfACallback ******");
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Call to MSO deleteVnfACallback ");
- msoLogger.debug(logMarker + " Callback response string:\n" + deleteVnfNotification.toString());
-
- Map<String,Object> variables = new HashMap<String,Object>();
- variables.put("VNFDEL_uuid", messageId);
- variables.put("deleteVnfACallback", deleteVnfNotification.toString());
-
- /*Correlating the response with the running instance*/
-
- runtimeService.createMessageCorrelation("deleteVnfACallback")
- .setVariables(variables)
- .processInstanceVariableEquals("VNFDEL_uuid", messageId).correlate();
-
- msoLogger.debug(logMarker + "***** Completed processing of MSO deleteVnfACallback ******");
-
- } catch(MismatchingMessageCorrelationException e) {
-
- msoLogger.debug(logMarker + " [CORM]correlation id mismatch");
- // Couldn't correlate requestId to any active flow
- //MsoLogger logger = MsoLogger.getMsoLogger("SDNCAdapterCallbackService");
-
- String msg =
- "Vnf Adapter Callback Service received a Vnf Adapter Callback with messageId '"
- + messageId
- + "' but that messageId could not be correlated to any active process - ignoring the Request";
-
- msoLogger.error(MessageEnum.BPMN_SDNC_CALLBACK_EXCEPTION, "BPMN", MsoLogger.getServiceName(),
- MsoLogger.ErrorCode.UnknownError, logMarker + ":" + msg, e);
-
- }
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- logMarker + "Completed the execution of MSO VNFAdapterDeleteCallbackV1.");
-
- msoLogger.recordMetricEvent ( startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- logMarker + "Completed the execution of MSO VNFAdapterDeleteCallbackV1.", "BPMN",
- MsoLogger.getServiceName(), "deleteVnfNotification");
-
- return;
- }
-
- private void isReadyforCorrelation(RuntimeService runtimeService, String requestId, String responseName, String correlationValue) {
-
- long waitingInstances = runtimeService.createExecutionQuery().messageEventSubscriptionName(responseName).processVariableValueEquals(correlationValue, requestId).count();
- int retries = 50;
- while (waitingInstances==0 && retries > 0) {
- try {
- Thread.sleep(100);
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- // should I add new exception Message to MessageEnum???
- msoLogger.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, logMarker, e);
-
- } // you can still play with the numbers
- waitingInstances = runtimeService.createExecutionQuery() //
- .messageEventSubscriptionName(responseName)
- .processVariableValueEquals(correlationValue, requestId).count();
- retries--;
- }
- }
-
-
- private ProcessEngineServices getProcessEngineServices() {
- if (pes4junit == null) {
- return BpmPlatform.getDefaultProcessEngine();
- } else {
- return pes4junit;
- }
- }
-
- @WebMethod(exclude=true)
- public void setProcessEngineServices4junit(ProcessEngineServices pes) {
- pes4junit = pes;
- }
-}
+ public void deleteVnfNotification(
+ @WebParam(name = "messageId", targetNamespace = "")
+ String messageId,
+ @WebParam(name = "completed", targetNamespace = "")
+ boolean completed,
+ @WebParam(name = "exception", targetNamespace = "")
+ MsoExceptionCategory exception,
+ @WebParam(name = "errorMessage", targetNamespace = "")
+ String errorMessage) {
+
+ String method = "deleteVnfNotification";
+ String messageEventName = "deleteVnfACallback";
+ String messageVariable = "deleteVnfACallback";
+ String correlationVariable = "VNFDEL_uuid";
+ String correlationValue = messageId;
+
+ MsoLogger.setServiceName("MSO." + method);
+ MsoLogger.setLogContext(correlationValue, "N/A");
+
+ DeleteVnfNotification message = new DeleteVnfNotification();
+
+ message.setMessageId(messageId);
+ message.setCompleted(completed);
+ message.setException(exception);
+ message.setErrorMessage(errorMessage);
+
+ handleCallback(method, message, messageEventName, messageVariable,
+ correlationVariable, correlationValue, logMarker);
+ }
+} \ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowMessageResource.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowMessageResource.java
index 5afbded982..698ec13c00 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowMessageResource.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowMessageResource.java
@@ -4,6 +4,7 @@ import java.util.HashMap;
import java.util.Map;
import javax.ws.rs.Consumes;
+import javax.ws.rs.HeaderParam;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
@@ -11,10 +12,6 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-import org.camunda.bpm.BpmPlatform;
-import org.camunda.bpm.engine.ProcessEngineServices;
-import org.camunda.bpm.engine.RuntimeService;
-
import org.openecomp.mso.logger.MessageEnum;
import org.openecomp.mso.logger.MsoLogger;
@@ -27,25 +24,29 @@ import org.openecomp.mso.logger.MsoLogger;
* </pre>
*/
@Path("/")
-public class WorkflowMessageResource {
+public class WorkflowMessageResource extends AbstractCallbackService {
private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL);
private static final String LOGMARKER = "[WORKFLOW-MESSAGE]";
-
- private ProcessEngineServices pes4junit = null;
@POST
@Path("/WorkflowMessage/{messageType}/{correlator}")
@Consumes("*/*")
@Produces(MediaType.TEXT_PLAIN)
- public Response deliver(@PathParam("messageType") String messageType,
- @PathParam("correlator") String correlator, String message) {
+ public Response deliver(
+ @HeaderParam("Content-Type") String contentType,
+ @PathParam("messageType") String messageType,
+ @PathParam("correlator") String correlator,
+ String message) {
+
+ String method = "receiveWorkflowMessage";
+ MsoLogger.setServiceName("MSO." + method);
+ MsoLogger.setLogContext(correlator, "N/A");
LOGGER.debug(LOGMARKER + " Received workflow message"
+ " type='" + messageType + "'"
+ " correlator='" + correlator + "'"
- + System.lineSeparator() + message);
-
- MsoLogger.setServiceName("MSO." + "WorkflowMessage");
+ + (contentType == null ? "" : " contentType='" + contentType + "'")
+ + " message=" + System.lineSeparator() + message);
if (messageType == null || messageType.isEmpty()) {
String msg = "Missing message type";
@@ -63,79 +64,25 @@ public class WorkflowMessageResource {
return Response.status(400).entity(msg).build();
}
- String correlatorVariable = messageType + "_CORRELATOR";
+ String messageEventName = "WorkflowMessage";
String messageVariable = messageType + "_MESSAGE";
+ String correlationVariable = messageType + "_CORRELATOR";
+ String correlationValue = correlator;
+ String contentTypeVariable = messageType + "_CONTENT_TYPE";
- long startTime = System.currentTimeMillis();
-
- try {
- RuntimeService runtimeService = getProcessEngineServices().getRuntimeService();
-
- if (!isReadyforCorrelation(runtimeService, correlatorVariable, correlator)) {
- String msg = "No process is waiting to receive '" + messageType + "' WorkflowMessage with correlator '" + correlator + "'";
- LOGGER.debug(LOGMARKER + " " + msg);
- LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, LOGMARKER + ":" + msg);
- LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BusinessProcesssError, msg, "BPMN", MsoLogger.getServiceName(), messageType);
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BusinessProcesssError, msg);
- return Response.status(500).entity(msg).build();
- }
+ Map<String, Object> variables = new HashMap<String, Object>();
- Map<String, Object> variables = new HashMap<String, Object>();
- variables.put(correlatorVariable, correlator);
- variables.put(messageVariable, message);
-
- runtimeService.createMessageCorrelation("WorkflowMessage").setVariables(variables)
- .processInstanceVariableEquals(correlatorVariable, correlator).correlate();
-
- String msg = "Completed delivery of '" + messageType + "' WorkflowMessage with correlator '" + correlator + "'";
- LOGGER.debug(LOGMARKER + msg);
- LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, msg, "BPMN", MsoLogger.getServiceName(), messageType);
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, msg);
- return Response.status(204).build();
- } catch (Exception e) {
- // For example: MismatchingMessageCorrelationException
- String msg = "Caught " + e.getClass().getSimpleName() + " processing '" + messageType + "' WorkflowMessage with " + correlatorVariable + "='" + correlator + "'";
- LOGGER.debug(LOGMARKER + " " + msg);
- LOGGER.error(MessageEnum.BPMN_GENERAL_EXCEPTION, "BPMN", MsoLogger.getServiceName(), MsoLogger.ErrorCode.UnknownError, LOGMARKER + ":" + msg, e);
- LOGGER.recordMetricEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.UnknownError, msg, "BPMN", MsoLogger.getServiceName(), messageType);
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.UnknownError, msg);
- return Response.status(500).entity(msg).build();
+ if (contentType != null) {
+ variables.put(contentTypeVariable, contentType);
}
- }
-
- private boolean isReadyforCorrelation(RuntimeService runtimeService,
- String correlationVariable, String correlationValue)
- throws InterruptedException {
-
- long waitingInstances = runtimeService.createExecutionQuery()
- .messageEventSubscriptionName("WorkflowMessage")
- .processVariableValueEquals(correlationVariable, correlationValue)
- .count();
-
- int retries = 50;
- while (waitingInstances == 0 && retries > 0) {
- Thread.sleep(100);
- waitingInstances = runtimeService.createExecutionQuery()
- .messageEventSubscriptionName("WorkflowMessage")
- .processVariableValueEquals(correlationVariable, correlationValue)
- .count();
-
- retries--;
- }
+ CallbackResult result = handleCallback(method, message, messageEventName,
+ messageVariable, correlationVariable, correlationValue, LOGMARKER, variables);
- return waitingInstances != 0;
- }
-
- private ProcessEngineServices getProcessEngineServices() {
- if (pes4junit == null) {
- return BpmPlatform.getDefaultProcessEngine();
+ if (result instanceof CallbackError) {
+ return Response.status(500).entity(((CallbackError)result).getErrorMessage()).build();
} else {
- return pes4junit;
+ return Response.status(204).build();
}
}
-
- public void setProcessEngineServices4junit(ProcessEngineServices pes) {
- pes4junit = pes;
- }
} \ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericGetService.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericGetService.bpmn
index af615e379d..6f012bcb88 100644
--- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericGetService.bpmn
+++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/GenericGetService.bpmn
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd" id="_D5VzAHElEeaJwpcpVN5gXw" exporter="camunda modeler" exporterVersion="2.7.0" targetNamespace="http://camunda.org/schema/1.0/bpmn">
+<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_D5VzAHElEeaJwpcpVN5gXw" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
<bpmn2:process id="GenericGetService" name="GenericGetService" isExecutable="true">
<bpmn2:scriptTask id="intialization" name="Initialization" scriptFormat="groovy">
<bpmn2:incoming>SequenceFlow_1</bpmn2:incoming>
@@ -9,16 +9,16 @@ GenericGetService getService = new GenericGetService()
getService.preProcessRequest(execution)
]]></bpmn2:script>
</bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="intialization" targetRef="getUrl"/>
- <bpmn2:exclusiveGateway id="getUrl" name="Get Url?" default="getUrlNo">
+ <bpmn2:sequenceFlow id="SequenceFlow_2" name="" sourceRef="intialization" targetRef="getUrl" />
+ <bpmn2:exclusiveGateway id="getUrl" name="Need Object&#39;s Url?" default="getUrlNo">
<bpmn2:incoming>SequenceFlow_2</bpmn2:incoming>
<bpmn2:outgoing>getUrlYes</bpmn2:outgoing>
<bpmn2:outgoing>getUrlNo</bpmn2:outgoing>
</bpmn2:exclusiveGateway>
<bpmn2:sequenceFlow id="getUrlYes" name="Yes" sourceRef="getUrl" targetRef="obtain">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("GENGS_obtainServiceInstanceUrl" ) == true}]]></bpmn2:conditionExpression>
+ <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("GENGS_obtainObjectsUrl" ) == true}]]></bpmn2:conditionExpression>
</bpmn2:sequenceFlow>
- <bpmn2:sequenceFlow id="getUrlNo" name="No" sourceRef="getUrl" targetRef="ExclusiveGateway_2"/>
+ <bpmn2:sequenceFlow id="getUrlNo" name="No" sourceRef="getUrl" targetRef="ExclusiveGateway_2" />
<bpmn2:subProcess id="bpmnExceptionHandlingSubProcess" name="Error Handling Sub Process" triggeredByEvent="true">
<bpmn2:scriptTask id="processBPMNException" name="Process Error" scriptFormat="groovy">
<bpmn2:incoming>SequenceFlow_7</bpmn2:incoming>
@@ -28,12 +28,12 @@ getService.preProcessRequest(execution)
ExceptionUtil ex = new ExceptionUtil()
ex.processSubflowsBPMNException(execution)]]></bpmn2:script>
</bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_8" name="" sourceRef="processBPMNException" targetRef="EndEvent_2"/>
+ <bpmn2:sequenceFlow id="SequenceFlow_8" name="" sourceRef="processBPMNException" targetRef="EndEvent_2" />
<bpmn2:startEvent id="StartEvent_2">
<bpmn2:outgoing>SequenceFlow_7</bpmn2:outgoing>
- <bpmn2:errorEventDefinition id="ErrorEventDefinition_1"/>
+ <bpmn2:errorEventDefinition id="ErrorEventDefinition_1" />
</bpmn2:startEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_7" name="" sourceRef="StartEvent_2" targetRef="processBPMNException"/>
+ <bpmn2:sequenceFlow id="SequenceFlow_7" name="" sourceRef="StartEvent_2" targetRef="processBPMNException" />
<bpmn2:endEvent id="EndEvent_2">
<bpmn2:incoming>SequenceFlow_8</bpmn2:incoming>
</bpmn2:endEvent>
@@ -46,43 +46,43 @@ GenericGetService getService = new GenericGetService()
getService.setSuccessIndicator(execution, true)
]]></bpmn2:script>
</bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_6" name="" sourceRef="toggleSuccess" targetRef="EndEvent_1"/>
- <bpmn2:scriptTask id="getServiceInstance" name="GET&#xD;&#xA;Service Instance" scriptFormat="groovy">
+ <bpmn2:sequenceFlow id="SequenceFlow_6" name="" sourceRef="toggleSuccess" targetRef="EndEvent_1" />
+ <bpmn2:scriptTask id="getServiceInstance" name="GET&#10;Object" scriptFormat="groovy">
<bpmn2:incoming>SequenceFlow_5</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_3</bpmn2:outgoing>
<bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
GenericGetService getService = new GenericGetService()
getService.getServiceObject(execution)]]></bpmn2:script>
</bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_3" name="" sourceRef="getServiceInstance" targetRef="toggleSuccess"/>
+ <bpmn2:sequenceFlow id="SequenceFlow_3" name="" sourceRef="getServiceInstance" targetRef="toggleSuccess" />
<bpmn2:exclusiveGateway id="ExclusiveGateway_2">
<bpmn2:incoming>getUrlNo</bpmn2:incoming>
<bpmn2:incoming>foundYes</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_5</bpmn2:outgoing>
</bpmn2:exclusiveGateway>
- <bpmn2:sequenceFlow id="SequenceFlow_5" name="" sourceRef="ExclusiveGateway_2" targetRef="getServiceInstance"/>
- <bpmn2:scriptTask id="obtainServiceUrlById" name="Obtain Service URL Using&#xD;&#xA;Id" scriptFormat="groovy">
+ <bpmn2:sequenceFlow id="SequenceFlow_5" name="" sourceRef="ExclusiveGateway_2" targetRef="getServiceInstance" />
+ <bpmn2:scriptTask id="obtainServiceUrlById" name="Node Query Using Id&#10;" scriptFormat="groovy">
<bpmn2:incoming>obtainById</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing>
<bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
GenericGetService getService = new GenericGetService()
getService.obtainServiceInstanceUrlById(execution)]]></bpmn2:script>
</bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="obtainServiceUrlById" targetRef="ExclusiveGateway_3"/>
- <bpmn2:scriptTask id="obtainServiceUrlByName" name="Obtain Service Url Using&#xD;&#xA;Name" scriptFormat="groovy">
+ <bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="obtainServiceUrlById" targetRef="ExclusiveGateway_3" />
+ <bpmn2:scriptTask id="obtainServiceUrlByName" name="Node Query Using Name" scriptFormat="groovy">
<bpmn2:incoming>obtainByName</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_13</bpmn2:outgoing>
<bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
GenericGetService getService = new GenericGetService()
getService.obtainServiceInstanceUrlByName(execution)]]></bpmn2:script>
</bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_13" name="" sourceRef="obtainServiceUrlByName" targetRef="ExclusiveGateway_3"/>
- <bpmn2:exclusiveGateway id="obtain" name="Obtain By?" default="obtainById">
+ <bpmn2:sequenceFlow id="SequenceFlow_13" name="" sourceRef="obtainServiceUrlByName" targetRef="ExclusiveGateway_3" />
+ <bpmn2:exclusiveGateway id="obtain" name="Query By?" default="obtainById">
<bpmn2:incoming>getUrlYes</bpmn2:incoming>
<bpmn2:outgoing>obtainById</bpmn2:outgoing>
<bpmn2:outgoing>obtainByName</bpmn2:outgoing>
</bpmn2:exclusiveGateway>
- <bpmn2:sequenceFlow id="obtainById" name="Id" sourceRef="obtain" targetRef="obtainServiceUrlById"/>
+ <bpmn2:sequenceFlow id="obtainById" name="Id" sourceRef="obtain" targetRef="obtainServiceUrlById" />
<bpmn2:sequenceFlow id="obtainByName" name="Name" sourceRef="obtain" targetRef="obtainServiceUrlByName">
<bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("GENGS_obtainServiceInstanceUrlByName" ) == true}]]></bpmn2:conditionExpression>
</bpmn2:sequenceFlow>
@@ -94,226 +94,226 @@ getService.obtainServiceInstanceUrlByName(execution)]]></bpmn2:script>
<bpmn2:sequenceFlow id="foundYes" name="Yes" sourceRef="serviceFoundCheck" targetRef="ExclusiveGateway_2">
<bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("GENGS_FoundIndicator" ) == true}]]></bpmn2:conditionExpression>
</bpmn2:sequenceFlow>
- <bpmn2:sequenceFlow id="notFound" name="No" sourceRef="serviceFoundCheck" targetRef="EndEvent_3"/>
+ <bpmn2:sequenceFlow id="notFound" name="No" sourceRef="serviceFoundCheck" targetRef="EndEvent_3" />
<bpmn2:endEvent id="EndEvent_3">
<bpmn2:incoming>notFound</bpmn2:incoming>
- <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_29"/>
+ <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_29" />
</bpmn2:endEvent>
<bpmn2:exclusiveGateway id="ExclusiveGateway_3">
<bpmn2:incoming>SequenceFlow_4</bpmn2:incoming>
<bpmn2:incoming>SequenceFlow_13</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_14</bpmn2:outgoing>
</bpmn2:exclusiveGateway>
- <bpmn2:sequenceFlow id="SequenceFlow_14" name="" sourceRef="ExclusiveGateway_3" targetRef="serviceFoundCheck"/>
+ <bpmn2:sequenceFlow id="SequenceFlow_14" name="" sourceRef="ExclusiveGateway_3" targetRef="serviceFoundCheck" />
<bpmn2:endEvent id="EndEvent_1">
<bpmn2:incoming>SequenceFlow_6</bpmn2:incoming>
- <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_26"/>
+ <bpmn2:terminateEventDefinition id="_TerminateEventDefinition_26" />
</bpmn2:endEvent>
<bpmn2:startEvent id="StartEvent_1">
<bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing>
</bpmn2:startEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="StartEvent_1" targetRef="intialization"/>
+ <bpmn2:sequenceFlow id="SequenceFlow_1" name="" sourceRef="StartEvent_1" targetRef="intialization" />
</bpmn2:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="GenericGetService">
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_69" bpmnElement="StartEvent_1">
- <dc:Bounds height="36.0" width="36.0" x="108.0" y="264.0"/>
+ <dc:Bounds x="108" y="264" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="126.0" y="305.0"/>
+ <dc:Bounds x="126" y="305" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_ScriptTask_288" bpmnElement="intialization">
- <dc:Bounds height="80.0" width="100.0" x="228.0" y="242.0"/>
+ <dc:Bounds x="228" y="242" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_69" targetElement="_BPMNShape_ScriptTask_288">
- <di:waypoint xsi:type="dc:Point" x="144.0" y="282.0"/>
- <di:waypoint xsi:type="dc:Point" x="228.0" y="282.0"/>
+ <di:waypoint xsi:type="dc:Point" x="144" y="282" />
+ <di:waypoint xsi:type="dc:Point" x="228" y="282" />
<bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="177.0" y="282.0"/>
+ <dc:Bounds x="177" y="282" width="6" height="6" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_227" bpmnElement="getUrl" isMarkerVisible="true">
- <dc:Bounds height="50.0" width="50.0" x="372.0" y="256.0"/>
+ <dc:Bounds x="372" y="256" width="50" height="50" />
<bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="70.0" x="408.0" y="286.0"/>
+ <dc:Bounds x="420" y="282" width="72" height="24" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_ScriptTask_288" targetElement="_BPMNShape_ExclusiveGateway_227">
- <di:waypoint xsi:type="dc:Point" x="328.0" y="282.0"/>
- <di:waypoint xsi:type="dc:Point" x="372.0" y="281.0"/>
+ <di:waypoint xsi:type="dc:Point" x="328" y="282" />
+ <di:waypoint xsi:type="dc:Point" x="372" y="281" />
<bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="350.0" y="281.0"/>
+ <dc:Bounds x="350" y="281" width="6" height="6" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_ScriptTask_289" bpmnElement="obtainServiceUrlById">
- <dc:Bounds height="80.0" width="100.0" x="528.0" y="197.0"/>
+ <dc:Bounds x="528" y="197" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_228" bpmnElement="ExclusiveGateway_2" isMarkerVisible="true">
- <dc:Bounds height="50.0" width="50.0" x="738.0" y="256.0"/>
+ <dc:Bounds x="738" y="256" width="50" height="50" />
<bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="763.0" y="311.0"/>
+ <dc:Bounds x="763" y="311" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_ScriptTask_290" bpmnElement="getServiceInstance">
- <dc:Bounds height="80.0" width="100.0" x="820.0" y="242.0"/>
+ <dc:Bounds x="820" y="242" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="getUrlYes" sourceElement="_BPMNShape_ExclusiveGateway_227" targetElement="_BPMNShape_ExclusiveGateway_233">
- <di:waypoint xsi:type="dc:Point" x="397.0" y="256.0"/>
- <di:waypoint xsi:type="dc:Point" x="397.0" y="170.0"/>
- <di:waypoint xsi:type="dc:Point" x="446.0" y="170.0"/>
+ <di:waypoint xsi:type="dc:Point" x="397" y="256" />
+ <di:waypoint xsi:type="dc:Point" x="397" y="170" />
+ <di:waypoint xsi:type="dc:Point" x="446" y="170" />
<bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="29.0" x="397.0" y="213.0"/>
+ <dc:Bounds x="397" y="213" width="29" height="22" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="SequenceFlow_4" sourceElement="_BPMNShape_ScriptTask_289" targetElement="_BPMNShape_ExclusiveGateway_234">
- <di:waypoint xsi:type="dc:Point" x="628.0" y="237.0"/>
- <di:waypoint xsi:type="dc:Point" x="671.0" y="237.0"/>
- <di:waypoint xsi:type="dc:Point" x="671.0" y="195.0"/>
+ <di:waypoint xsi:type="dc:Point" x="628" y="237" />
+ <di:waypoint xsi:type="dc:Point" x="671" y="237" />
+ <di:waypoint xsi:type="dc:Point" x="671" y="195" />
<bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="668.0" y="221.0"/>
+ <dc:Bounds x="668" y="221" width="6" height="6" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_5" bpmnElement="SequenceFlow_5" sourceElement="_BPMNShape_ExclusiveGateway_228" targetElement="_BPMNShape_ScriptTask_290">
- <di:waypoint xsi:type="dc:Point" x="788.0" y="281.0"/>
- <di:waypoint xsi:type="dc:Point" x="820.0" y="282.0"/>
+ <di:waypoint xsi:type="dc:Point" x="788" y="281" />
+ <di:waypoint xsi:type="dc:Point" x="820" y="282" />
<bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="798.0" y="281.0"/>
+ <dc:Bounds x="798" y="281" width="6" height="6" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_6" bpmnElement="getUrlNo" sourceElement="_BPMNShape_ExclusiveGateway_227" targetElement="_BPMNShape_ExclusiveGateway_228">
- <di:waypoint xsi:type="dc:Point" x="397.0" y="306.0"/>
- <di:waypoint xsi:type="dc:Point" x="397.0" y="370.0"/>
- <di:waypoint xsi:type="dc:Point" x="763.0" y="370.0"/>
- <di:waypoint xsi:type="dc:Point" x="763.0" y="306.0"/>
+ <di:waypoint xsi:type="dc:Point" x="397" y="306" />
+ <di:waypoint xsi:type="dc:Point" x="397" y="370" />
+ <di:waypoint xsi:type="dc:Point" x="763" y="370" />
+ <di:waypoint xsi:type="dc:Point" x="763" y="306" />
<bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="22.0" x="400.0" y="324.0"/>
+ <dc:Bounds x="400" y="324" width="22" height="22" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_ScriptTask_291" bpmnElement="toggleSuccess">
- <dc:Bounds height="80.0" width="100.0" x="960.0" y="242.0"/>
+ <dc:Bounds x="960" y="242" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_7" bpmnElement="SequenceFlow_3" sourceElement="_BPMNShape_ScriptTask_290" targetElement="_BPMNShape_ScriptTask_291">
- <di:waypoint xsi:type="dc:Point" x="920.0" y="282.0"/>
- <di:waypoint xsi:type="dc:Point" x="960.0" y="282.0"/>
+ <di:waypoint xsi:type="dc:Point" x="920" y="282" />
+ <di:waypoint xsi:type="dc:Point" x="960" y="282" />
<bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="937.0" y="282.0"/>
+ <dc:Bounds x="937" y="282" width="6" height="6" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_EndEvent_223" bpmnElement="EndEvent_1">
- <dc:Bounds height="36.0" width="36.0" x="1133.0" y="264.0"/>
+ <dc:Bounds x="1133" y="264" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="1151.0" y="305.0"/>
+ <dc:Bounds x="1151" y="305" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_8" bpmnElement="SequenceFlow_6" sourceElement="_BPMNShape_ScriptTask_291" targetElement="_BPMNShape_EndEvent_223">
- <di:waypoint xsi:type="dc:Point" x="1060.0" y="282.0"/>
- <di:waypoint xsi:type="dc:Point" x="1133.0" y="282.0"/>
+ <di:waypoint xsi:type="dc:Point" x="1060" y="282" />
+ <di:waypoint xsi:type="dc:Point" x="1133" y="282" />
<bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="1100.0" y="282.0"/>
+ <dc:Bounds x="1100" y="282" width="6" height="6" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_SubProcess_25" bpmnElement="bpmnExceptionHandlingSubProcess" isExpanded="true">
- <dc:Bounds height="169.0" width="325.0" x="152.0" y="468.0"/>
+ <dc:Bounds x="152" y="468" width="325" height="169" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_70" bpmnElement="StartEvent_2">
- <dc:Bounds height="36.0" width="36.0" x="176.0" y="535.0"/>
+ <dc:Bounds x="176" y="535" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="194.0" y="576.0"/>
+ <dc:Bounds x="194" y="576" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_EndEvent_224" bpmnElement="EndEvent_2">
- <dc:Bounds height="36.0" width="36.0" x="416.0" y="535.0"/>
+ <dc:Bounds x="416" y="535" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="434.0" y="576.0"/>
+ <dc:Bounds x="434" y="576" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_ScriptTask_292" bpmnElement="processBPMNException">
- <dc:Bounds height="80.0" width="100.0" x="265.0" y="513.0"/>
+ <dc:Bounds x="265" y="513" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_9" bpmnElement="SequenceFlow_7" sourceElement="_BPMNShape_StartEvent_70" targetElement="_BPMNShape_ScriptTask_292">
- <di:waypoint xsi:type="dc:Point" x="212.0" y="553.0"/>
- <di:waypoint xsi:type="dc:Point" x="265.0" y="553.0"/>
+ <di:waypoint xsi:type="dc:Point" x="212" y="553" />
+ <di:waypoint xsi:type="dc:Point" x="265" y="553" />
<bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="233.0" y="553.0"/>
+ <dc:Bounds x="233" y="553" width="6" height="6" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_10" bpmnElement="SequenceFlow_8" sourceElement="_BPMNShape_ScriptTask_292" targetElement="_BPMNShape_EndEvent_224">
- <di:waypoint xsi:type="dc:Point" x="365.0" y="553.0"/>
- <di:waypoint xsi:type="dc:Point" x="416.0" y="553.0"/>
+ <di:waypoint xsi:type="dc:Point" x="365" y="553" />
+ <di:waypoint xsi:type="dc:Point" x="416" y="553" />
<bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="385.0" y="553.0"/>
+ <dc:Bounds x="385" y="553" width="6" height="6" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_ScriptTask_301" bpmnElement="obtainServiceUrlByName">
- <dc:Bounds height="80.0" width="100.0" x="528.0" y="59.0"/>
+ <dc:Bounds x="528" y="59" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_233" bpmnElement="obtain" isMarkerVisible="true">
- <dc:Bounds height="50.0" width="50.0" x="446.0" y="145.0"/>
+ <dc:Bounds x="446" y="145" width="50" height="50" />
<bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="71.0" x="496.0" y="162.0"/>
+ <dc:Bounds x="501" y="164" width="53" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_234" bpmnElement="ExclusiveGateway_3" isMarkerVisible="true">
- <dc:Bounds height="50.0" width="50.0" x="646.0" y="145.0"/>
+ <dc:Bounds x="646" y="145" width="50" height="50" />
<bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="671.0" y="200.0"/>
+ <dc:Bounds x="671" y="200" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_13" bpmnElement="obtainById" sourceElement="_BPMNShape_ExclusiveGateway_233" targetElement="_BPMNShape_ScriptTask_289">
- <di:waypoint xsi:type="dc:Point" x="471.0" y="195.0"/>
- <di:waypoint xsi:type="dc:Point" x="471.0" y="236.0"/>
- <di:waypoint xsi:type="dc:Point" x="528.0" y="237.0"/>
+ <di:waypoint xsi:type="dc:Point" x="471" y="195" />
+ <di:waypoint xsi:type="dc:Point" x="471" y="236" />
+ <di:waypoint xsi:type="dc:Point" x="528" y="237" />
<bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="16.0" x="476.0" y="207.0"/>
+ <dc:Bounds x="476" y="207" width="16" height="22" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_14" bpmnElement="obtainByName" sourceElement="_BPMNShape_ExclusiveGateway_233" targetElement="_BPMNShape_ScriptTask_301">
- <di:waypoint xsi:type="dc:Point" x="471.0" y="145.0"/>
- <di:waypoint xsi:type="dc:Point" x="471.0" y="99.0"/>
- <di:waypoint xsi:type="dc:Point" x="528.0" y="99.0"/>
+ <di:waypoint xsi:type="dc:Point" x="471" y="145" />
+ <di:waypoint xsi:type="dc:Point" x="471" y="99" />
+ <di:waypoint xsi:type="dc:Point" x="528" y="99" />
<bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="40.0" x="471.0" y="115.0"/>
+ <dc:Bounds x="471" y="115" width="40" height="22" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_15" bpmnElement="SequenceFlow_13" sourceElement="_BPMNShape_ScriptTask_301" targetElement="_BPMNShape_ExclusiveGateway_234">
- <di:waypoint xsi:type="dc:Point" x="628.0" y="99.0"/>
- <di:waypoint xsi:type="dc:Point" x="671.0" y="99.0"/>
- <di:waypoint xsi:type="dc:Point" x="671.0" y="145.0"/>
+ <di:waypoint xsi:type="dc:Point" x="628" y="99" />
+ <di:waypoint xsi:type="dc:Point" x="671" y="99" />
+ <di:waypoint xsi:type="dc:Point" x="671" y="145" />
<bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="665.0" y="99.0"/>
+ <dc:Bounds x="665" y="99" width="6" height="6" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_ExclusiveGateway_235" bpmnElement="serviceFoundCheck" isMarkerVisible="true">
- <dc:Bounds height="50.0" width="50.0" x="738.0" y="145.0"/>
+ <dc:Bounds x="738" y="145" width="50" height="50" />
<bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="59.0" x="735.0" y="125.0"/>
+ <dc:Bounds x="735" y="125" width="59" height="22" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_16" bpmnElement="SequenceFlow_14" sourceElement="_BPMNShape_ExclusiveGateway_234" targetElement="_BPMNShape_ExclusiveGateway_235">
- <di:waypoint xsi:type="dc:Point" x="696.0" y="170.0"/>
- <di:waypoint xsi:type="dc:Point" x="738.0" y="170.0"/>
+ <di:waypoint xsi:type="dc:Point" x="696" y="170" />
+ <di:waypoint xsi:type="dc:Point" x="738" y="170" />
<bpmndi:BPMNLabel>
- <dc:Bounds height="6.0" width="6.0" x="704.0" y="170.0"/>
+ <dc:Bounds x="704" y="170" width="6" height="6" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_17" bpmnElement="foundYes" sourceElement="_BPMNShape_ExclusiveGateway_235" targetElement="_BPMNShape_ExclusiveGateway_228">
- <di:waypoint xsi:type="dc:Point" x="763.0" y="195.0"/>
- <di:waypoint xsi:type="dc:Point" x="763.0" y="256.0"/>
+ <di:waypoint xsi:type="dc:Point" x="763" y="195" />
+ <di:waypoint xsi:type="dc:Point" x="763" y="256" />
<bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="29.0" x="762.0" y="205.0"/>
+ <dc:Bounds x="762" y="205" width="29" height="22" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_18" bpmnElement="notFound" sourceElement="_BPMNShape_ExclusiveGateway_235" targetElement="_BPMNShape_EndEvent_229">
- <di:waypoint xsi:type="dc:Point" x="788.0" y="170.0"/>
- <di:waypoint xsi:type="dc:Point" x="877.0" y="171.0"/>
+ <di:waypoint xsi:type="dc:Point" x="788" y="170" />
+ <di:waypoint xsi:type="dc:Point" x="877" y="171" />
<bpmndi:BPMNLabel>
- <dc:Bounds height="22.0" width="22.0" x="798.0" y="170.0"/>
+ <dc:Bounds x="798" y="170" width="22" height="22" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_EndEvent_229" bpmnElement="EndEvent_3">
- <dc:Bounds height="36.0" width="36.0" x="877.0" y="153.0"/>
+ <dc:Bounds x="877" y="153" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds height="0.0" width="0.0" x="895.0" y="194.0"/>
+ <dc:Bounds x="895" y="194" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>