aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DoHandleOofRequest.groovy103
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy36
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.groovy409
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/oof/adapter/beans/payload/OofRequest.java49
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/HomingSolution.java9
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy76
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy70
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSliceService.bpmn454
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceOption.bpmn220
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoHandleOofRequest.bpmn122
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/ServiceLevelUpgradeTest.java20
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/ServiceLevelPreparable.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/AbstractServiceLevelPreparable.java)40
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelConstants.java48
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelPreparation.java55
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelUpgrade.java69
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/service/level/ServiceLevelPreparationTest.java100
16 files changed, 1132 insertions, 748 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DoHandleOofRequest.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DoHandleOofRequest.groovy
new file mode 100644
index 0000000000..ebc5f4ac58
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/DoHandleOofRequest.groovy
@@ -0,0 +1,103 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Wipro Limited. 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.onap.so.bpmn.common.scripts
+
+import javax.ws.rs.core.Response
+
+import org.apache.commons.lang3.StringUtils
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.logging.filter.base.ONAPComponents
+import org.onap.so.bpmn.core.UrnPropertiesReader
+import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.client.HttpClient
+import org.onap.so.client.HttpClientFactory
+import org.onap.so.client.oof.adapter.beans.payload.OofRequest
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+import com.fasterxml.jackson.databind.ObjectMapper
+
+
+import static org.onap.so.bpmn.common.scripts.GenericUtils.*
+
+
+class DoHandleOofRequest extends AbstractServiceTaskProcessor {
+
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ JsonUtils jsonUtil = new JsonUtils()
+ private static final Logger logger = LoggerFactory.getLogger(DoHandleOofRequest.class)
+
+ @Override
+ public void preProcessRequest(DelegateExecution execution) {
+ logger.debug("In Preprocess Oof Request Handler")
+ String apiPath = execution.getVariable("apiPath")
+ if (isBlank(apiPath)) {
+ String msg = "Cannot process OOF adapter call : API PATH is null"
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ }
+
+ //msoRequestId is used for correlation
+ String requestId = execution.getVariable("correlator")
+ if (isBlank(requestId)) {
+ String msg = "Cannot process OOF adapter call : correlator is null"
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ }
+
+ String messageType = execution.getVariable("messageType")
+ if (isBlank(messageType)) {
+ String msg = "Cannot process OOF adapter call : messageType is null"
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ }
+
+ String timeout = execution.getVariable("timeout")
+ if (isBlank(timeout)) {
+ timeout = UrnPropertiesReader.getVariable("mso.adapters.oof.timeout", execution);
+ if (isBlank(timeout)) {
+ logger.debug("Setting OOF timeout to default : PT30M")
+ timeout = "PT30M"
+ }
+ }
+
+ Object requestDetails = execution.getVariable("oofRequest")
+ OofRequest oofRequestPayload = new OofRequest()
+ oofRequestPayload.setApiPath(apiPath)
+ oofRequestPayload.setRequestDetails(requestDetails)
+ ObjectMapper objectMapper = new ObjectMapper()
+ String requestJson = objectMapper.writeValueAsString(oofRequestPayload)
+ execution.setVariable("oofRequestPayload", requestJson)
+ }
+
+ public void callOofAdapter(DelegateExecution execution) {
+ logger.debug("Start callOofAdapter")
+ String requestId = execution.getVariable("msoRequestId")
+ String oofAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.oof.endpoint", execution)
+ String basicAuthCred = execution.getVariable("BasicAuthHeaderValue")
+ URL requestUrl = new URL(oofAdapterEndpoint)
+ String oofRequest = execution.getVariable("oofRequestPayload")
+ logger.debug("oofRequest : " + oofRequest)
+ HttpClient httpClient = new HttpClientFactory().newJsonClient(requestUrl, ONAPComponents.EXTERNAL)
+ Response httpResponse = httpClient.post(oofRequest)
+ int responseCode = httpResponse.getStatus()
+ logger.debug("OOF sync response code is: " + responseCode)
+ if(responseCode != 200){
+ exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from OOF.")
+ }
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy
index 69dfacd9bc..2c96e7d3bb 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy
@@ -22,42 +22,28 @@
package org.onap.so.bpmn.common.scripts
-import com.fasterxml.jackson.databind.ObjectMapper
+import static org.onap.so.bpmn.common.scripts.GenericUtils.*
+
+import javax.ws.rs.core.UriBuilder
+
import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
-import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.util.OofInfraUtils
import org.onap.so.bpmn.core.UrnPropertiesReader
+import org.onap.so.bpmn.core.domain.AllottedResource
import org.onap.so.bpmn.core.domain.HomingSolution
import org.onap.so.bpmn.core.domain.ModelInfo
import org.onap.so.bpmn.core.domain.Resource
-import org.onap.so.bpmn.core.domain.AllottedResource
import org.onap.so.bpmn.core.domain.ServiceDecomposition
import org.onap.so.bpmn.core.domain.ServiceInstance
import org.onap.so.bpmn.core.domain.Subscriber
import org.onap.so.bpmn.core.domain.VnfResource
import org.onap.so.bpmn.core.json.JsonUtils
-import org.onap.so.client.HttpClient
-import org.onap.so.client.HttpClientFactory
import org.onap.so.db.catalog.beans.CloudSite
import org.onap.so.db.catalog.beans.HomingInstance
-import org.onap.logging.filter.base.ONAPComponents;
-import org.springframework.http.HttpEntity
-import org.springframework.http.HttpHeaders
-import org.springframework.http.HttpMethod
-import org.springframework.http.ResponseEntity
-import org.springframework.http.client.BufferingClientHttpRequestFactory
-import org.springframework.http.client.HttpComponentsClientHttpRequestFactory
-import org.springframework.web.client.RestTemplate
-import org.springframework.web.util.UriComponentsBuilder
import org.slf4j.Logger
import org.slf4j.LoggerFactory
-import javax.ws.rs.core.MediaType
-import javax.ws.rs.core.Response
-import javax.ws.rs.core.UriBuilder
-
-import static org.onap.so.bpmn.common.scripts.GenericUtils.*
+import com.fasterxml.jackson.databind.ObjectMapper
class OofUtils {
private static final Logger logger = LoggerFactory.getLogger( OofUtils.class);
@@ -530,10 +516,11 @@ class OofUtils {
return UriBuilder.fromPath("").host(msbHost).port(msbPort).scheme("http").build().toString()
}
- public String buildSelectNSTRequest(String requestId, Map<String, Object> profileInfo) {
+ public String buildSelectNSTRequest(String requestId,String messageType, Map<String, Object> profileInfo) {
def transactionId = requestId
logger.debug( "transactionId is: " + transactionId)
- String callbackUrl = "http://0.0.0.0:9000/callback/"
+ String correlator = requestId
+ String callbackUrl = UrnPropertiesReader.getVariable("mso.adapters.oof.callback.endpoint") + "/" + messageType + "/" + correlator
ObjectMapper objectMapper = new ObjectMapper()
String json = objectMapper.writeValueAsString(profileInfo)
StringBuilder response = new StringBuilder()
@@ -554,11 +541,12 @@ class OofUtils {
return response.toString()
}
- public String buildSelectNSIRequest(String requestId, String nstInfo, Map<String, Object> profileInfo){
+ public String buildSelectNSIRequest(String requestId, String nstInfo,String messageType, Map<String, Object> profileInfo){
def transactionId = requestId
logger.debug( "transactionId is: " + transactionId)
- String callbackUrl = "http://0.0.0.0:9000/callback/"
+ String correlator = requestId
+ String callbackUrl = UrnPropertiesReader.getVariable("mso.adapters.oof.callback.endpoint") + "/" + messageType + "/" + correlator
ObjectMapper objectMapper = new ObjectMapper();
String json = objectMapper.writeValueAsString(profileInfo);
StringBuilder response = new StringBuilder();
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.groovy
index 08c032fba3..146889351a 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.groovy
@@ -64,208 +64,211 @@ import org.slf4j.LoggerFactory
class SniroHomingV1 extends AbstractServiceTaskProcessor{
private static final Logger logger = LoggerFactory.getLogger( SniroHomingV1.class);
- ExceptionUtil exceptionUtil = new ExceptionUtil()
- JsonUtils jsonUtil = new JsonUtils()
- SniroUtils sniroUtils = new SniroUtils(this)
-
- /**
- * This method validates the incoming variables.
- * The method then prepares the sniro request
- * and posts it to sniro's rest api.
- *
- * @param execution
- *
- * @author cb645j
- */
- public void callSniro(DelegateExecution execution){
- execution.setVariable("prefix","HOME_")
- logger.trace("Started Sniro Homing Call Sniro ")
- try{
- execution.setVariable("rollbackData", null)
- execution.setVariable("rolledBack", false)
-
- String requestId = execution.getVariable("msoRequestId")
- logger.debug("Incoming Request Id is: " + requestId)
- String serviceInstanceId = execution.getVariable("serviceInstanceId")
- logger.debug("Incoming Service Instance Id is: " + serviceInstanceId)
- ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
- logger.debug("Incoming Service Decomposition is: " + serviceDecomposition)
- String subscriberInfo = execution.getVariable("subscriberInfo")
- logger.debug("Incoming Subscriber Information is: " + subscriberInfo)
-
- if(isBlank(requestId) || isBlank(serviceInstanceId) || isBlank(serviceDecomposition.toString()) || isBlank(subscriberInfo)){
- exceptionUtil.buildAndThrowWorkflowException(execution, 4000, "A required input variable is missing or null")
- }else{
- String subId = jsonUtil.getJsonValue(subscriberInfo, "globalSubscriberId")
- String subName = jsonUtil.getJsonValue(subscriberInfo, "subscriberName")
- String subCommonSiteId = ""
- if(jsonUtil.jsonElementExist(subscriberInfo, "subscriberCommonSiteId")){
- subCommonSiteId = jsonUtil.getJsonValue(subscriberInfo, "subscriberCommonSiteId")
- }
- Subscriber subscriber = new Subscriber(subId, subName, subCommonSiteId)
-
- String cloudConfiguration = execution.getVariable("cloudConfiguration") // TODO Currently not being used
- String homingParameters = execution.getVariable("homingParameters") // (aka. request parameters) Should be json format. TODO confirm its json format
-
- //Authentication
- String authHeader = UrnPropertiesReader.getVariable("sniro.manager.headers.auth", execution)
- execution.setVariable("BasicAuthHeaderValue", authHeader)
-
- //Prepare Callback
- String timeout = execution.getVariable("timeout")
- if(isBlank(timeout)){
- timeout = UrnPropertiesReader.getVariable("sniro.manager.timeout", execution)
- if(isBlank(timeout)) {
- timeout = "PT30M";
- }
- }
- logger.debug("Async Callback Timeout will be: " + timeout)
-
- execution.setVariable("timeout", timeout);
- execution.setVariable("correlator", requestId);
- execution.setVariable("messageType", "SNIROResponse");
-
- //Build Request & Call Sniro
- String sniroRequest = sniroUtils.buildRequest(execution, requestId, serviceDecomposition, subscriber, homingParameters)
- execution.setVariable("sniroRequest", sniroRequest)
- logger.debug("SNIRO Request is: " + sniroRequest)
-
- String endpoint = UrnPropertiesReader.getVariable("sniro.manager.uri.v1", execution)
- String host = UrnPropertiesReader.getVariable("sniro.manager.host", execution)
- String urlString = host + endpoint
- logger.debug("Sniro Url is: " + urlString)
-
- URL url = new URL(urlString);
- HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.SNIRO)
- httpClient.addAdditionalHeader("Authorization", authHeader)
- Response httpResponse = httpClient.post(sniroRequest)
-
- int responseCode = httpResponse.getStatus()
-
- logger.debug("Sniro sync response code is: " + responseCode)
- if(httpResponse.hasEntity()){
- logger.debug("Sniro sync response is: " + httpResponse.readEntity(String.class))
- }
-
- if(responseCode != 202){
- exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from Sniro.")
- }
-
- logger.trace("Completed Sniro Homing Call Sniro")
- }
- }catch(BpmnError b){
- throw b
- }catch(Exception e){
- logger.debug("Error encountered within Homing CallSniro method: " + e)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in Homing CallSniro: " + e.getMessage())
- }
- }
-
- /**
- * This method processes the callback response
- * and the contained homing solution. It sets
- * homing solution assignment and license
- * information to the corresponding resources
- *
- * @param execution
- *
- * @author cb645j
- */
- public void processHomingSolution(DelegateExecution execution){
- logger.trace("Started Sniro Homing Process Homing Solution")
- try{
- String response = execution.getVariable("asyncCallbackResponse")
- logger.debug("Sniro Async Callback Response is: " + response)
-
- sniroUtils.validateCallbackResponse(execution, response)
-
- ServiceDecomposition decomposition = execution.getVariable("serviceDecomposition")
- List<Resource> resourceList = decomposition.getServiceResources()
-
- if(JsonUtils.jsonElementExist(response, "solutionInfo.placementInfo")){
- String placements = jsonUtil.getJsonValue(response, "solutionInfo.placementInfo")
- JSONArray arr = new JSONArray(placements)
- for(int i = 0; i < arr.length(); i++){
- JSONObject placement = arr.getJSONObject(i)
- String jsonServiceResourceId = placement.getString("serviceResourceId")
- for(Resource resource:resourceList){
- String serviceResourceId = resource.getResourceId()
- if(serviceResourceId.equalsIgnoreCase(jsonServiceResourceId)){
- //match
- String inventoryType = placement.getString("inventoryType")
- resource.getHomingSolution().setInventoryType(InventoryType.valueOf(inventoryType))
- resource.getHomingSolution().setCloudRegionId(placement.getString("cloudRegionId"))
- resource.getHomingSolution().setRehome(placement.getBoolean("isRehome"))
- JSONArray assignmentArr = placement.getJSONArray("assignmentInfo")
- Map<String, String> assignmentMap = jsonUtil.entryArrayToMap(execution, assignmentArr.toString(), "variableName", "variableValue")
- resource.getHomingSolution().setCloudOwner(assignmentMap.get("cloudOwner"))
- resource.getHomingSolution().setAicClli(assignmentMap.get("aicClli"))
- resource.getHomingSolution().setAicVersion(assignmentMap.get("aicVersion"))
- if(inventoryType.equalsIgnoreCase("service")){
- VnfResource vnf = new VnfResource()
- vnf.setVnfHostname(assignmentMap.get("vnfHostName"))
- resource.getHomingSolution().setVnf(vnf)
- resource.getHomingSolution().setServiceInstanceId(placement.getString("serviceInstanceId"))
- }
- }
- }
- }
- }
-
- if(JsonUtils.jsonElementExist(response, "solutionInfo.licenseInfo")){
- String licenseInfo = jsonUtil.getJsonValue(response, "solutionInfo.licenseInfo")
- JSONArray licenseArr = new JSONArray(licenseInfo)
- for(int l = 0; l < licenseArr.length(); l++){
- JSONObject license = licenseArr.getJSONObject(l)
- String jsonServiceResourceId = license.getString("serviceResourceId")
- for(Resource resource:resourceList){
- String serviceResourceId = resource.getResourceId()
- if(serviceResourceId.equalsIgnoreCase(jsonServiceResourceId)){
- //match
- String jsonEntitlementPoolList = jsonUtil.getJsonValue(license.toString(), "entitlementPoolList")
- List<String> entitlementPoolList = jsonUtil.StringArrayToList(execution, jsonEntitlementPoolList)
- resource.getHomingSolution().getLicense().setEntitlementPoolList(entitlementPoolList)
-
- String jsonLicenseKeyGroupList = jsonUtil.getJsonValue(license.toString(), "licenseKeyGroupList")
- List<String> licenseKeyGroupList = jsonUtil.StringArrayToList(execution, jsonLicenseKeyGroupList)
- resource.getHomingSolution().getLicense().setLicenseKeyGroupList(licenseKeyGroupList)
- }
- }
- }
- }
- execution.setVariable("serviceDecomposition", decomposition)
-
- logger.trace("Completed Sniro Homing Process Homing Solution")
- }catch(BpmnError b){
- throw b
- }catch(Exception e){
- logger.debug("Error encountered within Homing ProcessHomingSolution method: " + e)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in Sniro Homing Process Solution")
- }
- }
-
- /**
- * This method logs the start of DHVCreateService
- * to make debugging easier.
- *
- * @param - execution
- * @author cb645j
- */
- public String logStart(DelegateExecution execution){
- String requestId = execution.getVariable("testReqId")
- if(isBlank(requestId)){
- requestId = execution.getVariable("msoRequestId")
- }
- execution.setVariable("DHVCS_requestId", requestId)
- logger.trace("STARTED Homing Subflow for request: " + requestId + " ")
- logger.debug("****** Homing Subflow Global Debug Enabled: " + execution.getVariable("isDebugLogEnabled") + " *****")
- logger.trace("STARTED Homing Subflow for request: " + requestId + " ")
- }
-
-
- /**
- * Auto-generated method stub
- */
- public void preProcessRequest(DelegateExecution execution){}
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ JsonUtils jsonUtil = new JsonUtils()
+ SniroUtils sniroUtils = new SniroUtils(this)
+
+ /**
+ * This method validates the incoming variables.
+ * The method then prepares the sniro request
+ * and posts it to sniro's rest api.
+ *
+ * @param execution
+ *
+ * @author cb645j
+ */
+ public void callSniro(DelegateExecution execution){
+ execution.setVariable("prefix","HOME_")
+ logger.trace("Started Sniro Homing Call Sniro ")
+ try{
+ execution.setVariable("rollbackData", null)
+ execution.setVariable("rolledBack", false)
+
+ String requestId = execution.getVariable("msoRequestId")
+ logger.debug("Incoming Request Id is: " + requestId)
+ String serviceInstanceId = execution.getVariable("serviceInstanceId")
+ logger.debug("Incoming Service Instance Id is: " + serviceInstanceId)
+ ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
+ logger.debug("Incoming Service Decomposition is: " + serviceDecomposition)
+ String subscriberInfo = execution.getVariable("subscriberInfo")
+ logger.debug("Incoming Subscriber Information is: " + subscriberInfo)
+
+ if(isBlank(requestId) || isBlank(serviceInstanceId) || isBlank(serviceDecomposition.toString()) || isBlank(subscriberInfo)){
+ exceptionUtil.buildAndThrowWorkflowException(execution, 4000, "A required input variable is missing or null")
+ }else{
+ String subId = jsonUtil.getJsonValue(subscriberInfo, "globalSubscriberId")
+ String subName = jsonUtil.getJsonValue(subscriberInfo, "subscriberName")
+ String subCommonSiteId = ""
+ if(jsonUtil.jsonElementExist(subscriberInfo, "subscriberCommonSiteId")){
+ subCommonSiteId = jsonUtil.getJsonValue(subscriberInfo, "subscriberCommonSiteId")
+ }
+ Subscriber subscriber = new Subscriber(subId, subName, subCommonSiteId)
+
+ String cloudConfiguration = execution.getVariable("cloudConfiguration") // TODO Currently not being used
+ String homingParameters = execution.getVariable("homingParameters") // (aka. request parameters) Should be json format. TODO confirm its json format
+
+ //Authentication
+ String authHeader = UrnPropertiesReader.getVariable("sniro.manager.headers.auth", execution)
+ execution.setVariable("BasicAuthHeaderValue", authHeader)
+
+ //Prepare Callback
+ String timeout = execution.getVariable("timeout")
+ if(isBlank(timeout)){
+ timeout = UrnPropertiesReader.getVariable("sniro.manager.timeout", execution)
+ if(isBlank(timeout)) {
+ timeout = "PT30M";
+ }
+ }
+ logger.debug("Async Callback Timeout will be: " + timeout)
+
+ execution.setVariable("timeout", timeout);
+ execution.setVariable("correlator", requestId);
+ execution.setVariable("messageType", "SNIROResponse");
+
+ //Build Request & Call Sniro
+ String sniroRequest = sniroUtils.buildRequest(execution, requestId, serviceDecomposition, subscriber, homingParameters)
+ execution.setVariable("sniroRequest", sniroRequest)
+ logger.debug("SNIRO Request is: " + sniroRequest)
+
+ String endpoint = UrnPropertiesReader.getVariable("sniro.manager.uri.v1", execution)
+ String host = UrnPropertiesReader.getVariable("sniro.manager.host", execution)
+ String urlString = host + endpoint
+ logger.debug("Sniro Url is: " + urlString)
+
+ URL url = new URL(urlString);
+ HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.SNIRO)
+ httpClient.addAdditionalHeader("Authorization", authHeader)
+ Response httpResponse = httpClient.post(sniroRequest)
+
+ int responseCode = httpResponse.getStatus()
+
+ logger.debug("Sniro sync response code is: " + responseCode)
+ if(httpResponse.hasEntity()){
+ logger.debug("Sniro sync response is: " + httpResponse.readEntity(String.class))
+ }
+
+ if(responseCode != 202){
+ exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from Sniro.")
+ }
+
+ logger.trace("Completed Sniro Homing Call Sniro")
+ }
+ }catch(BpmnError b){
+ throw b
+ }catch(Exception e){
+ logger.debug("Error encountered within Homing CallSniro method: " + e)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in Homing CallSniro: " + e.getMessage())
+ }
+ }
+
+ /**
+ * This method processes the callback response
+ * and the contained homing solution. It sets
+ * homing solution assignment and license
+ * information to the corresponding resources
+ *
+ * @param execution
+ *
+ * @author cb645j
+ */
+ public void processHomingSolution(DelegateExecution execution){
+ logger.trace("Started Sniro Homing Process Homing Solution")
+ try{
+ String response = execution.getVariable("asyncCallbackResponse")
+ logger.debug("Sniro Async Callback Response is: " + response)
+
+ sniroUtils.validateCallbackResponse(execution, response)
+
+ ServiceDecomposition decomposition = execution.getVariable("serviceDecomposition")
+ List<Resource> resourceList = decomposition.getServiceResources()
+
+ if(JsonUtils.jsonElementExist(response, "solutionInfo.placementInfo")){
+ String placements = jsonUtil.getJsonValue(response, "solutionInfo.placementInfo")
+ JSONArray arr = new JSONArray(placements)
+ for(int i = 0; i < arr.length(); i++){
+ JSONObject placement = arr.getJSONObject(i)
+ String jsonServiceResourceId = placement.getString("serviceResourceId")
+ for(Resource resource:resourceList){
+ String serviceResourceId = resource.getResourceId()
+ if(serviceResourceId.equalsIgnoreCase(jsonServiceResourceId)){
+ //match
+ String inventoryType = placement.getString("inventoryType")
+ resource.getHomingSolution().setInventoryType(InventoryType.valueOf(inventoryType))
+ resource.getHomingSolution().setCloudRegionId(placement.getString("cloudRegionId"))
+ resource.getHomingSolution().setRehome(placement.getBoolean("isRehome"))
+ JSONArray assignmentArr = placement.getJSONArray("assignmentInfo")
+ Map<String, String> assignmentMap = jsonUtil.entryArrayToMap(execution, assignmentArr.toString(), "variableName", "variableValue")
+ resource.getHomingSolution().setCloudOwner(assignmentMap.get("cloudOwner"))
+ resource.getHomingSolution().setAicClli(assignmentMap.get("aicClli"))
+ resource.getHomingSolution().setAicVersion(assignmentMap.get("aicVersion"))
+ if(inventoryType.equalsIgnoreCase("service")){
+ VnfResource vnf = new VnfResource()
+ vnf.setVnfHostname(assignmentMap.get("vnfHostName"))
+ resource.getHomingSolution().setVnf(vnf)
+ resource.getHomingSolution().setServiceInstanceId(placement.getString("serviceInstanceId"))
+ }
+ if(placement.getBoolean("isRehome")) {
+ resource.getHomingSolution().setAllottedResourceId(assignmentMap.get("serviceResourceId"))
+ }
+ }
+ }
+ }
+ }
+
+ if(JsonUtils.jsonElementExist(response, "solutionInfo.licenseInfo")){
+ String licenseInfo = jsonUtil.getJsonValue(response, "solutionInfo.licenseInfo")
+ JSONArray licenseArr = new JSONArray(licenseInfo)
+ for(int l = 0; l < licenseArr.length(); l++){
+ JSONObject license = licenseArr.getJSONObject(l)
+ String jsonServiceResourceId = license.getString("serviceResourceId")
+ for(Resource resource:resourceList){
+ String serviceResourceId = resource.getResourceId()
+ if(serviceResourceId.equalsIgnoreCase(jsonServiceResourceId)){
+ //match
+ String jsonEntitlementPoolList = jsonUtil.getJsonValue(license.toString(), "entitlementPoolList")
+ List<String> entitlementPoolList = jsonUtil.StringArrayToList(execution, jsonEntitlementPoolList)
+ resource.getHomingSolution().getLicense().setEntitlementPoolList(entitlementPoolList)
+
+ String jsonLicenseKeyGroupList = jsonUtil.getJsonValue(license.toString(), "licenseKeyGroupList")
+ List<String> licenseKeyGroupList = jsonUtil.StringArrayToList(execution, jsonLicenseKeyGroupList)
+ resource.getHomingSolution().getLicense().setLicenseKeyGroupList(licenseKeyGroupList)
+ }
+ }
+ }
+ }
+ execution.setVariable("serviceDecomposition", decomposition)
+
+ logger.trace("Completed Sniro Homing Process Homing Solution")
+ }catch(BpmnError b){
+ throw b
+ }catch(Exception e){
+ logger.debug("Error encountered within Homing ProcessHomingSolution method: " + e)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in Sniro Homing Process Solution")
+ }
+ }
+
+ /**
+ * This method logs the start of DHVCreateService
+ * to make debugging easier.
+ *
+ * @param - execution
+ * @author cb645j
+ */
+ public String logStart(DelegateExecution execution){
+ String requestId = execution.getVariable("testReqId")
+ if(isBlank(requestId)){
+ requestId = execution.getVariable("msoRequestId")
+ }
+ execution.setVariable("DHVCS_requestId", requestId)
+ logger.trace("STARTED Homing Subflow for request: " + requestId + " ")
+ logger.debug("****** Homing Subflow Global Debug Enabled: " + execution.getVariable("isDebugLogEnabled") + " *****")
+ logger.trace("STARTED Homing Subflow for request: " + requestId + " ")
+ }
+
+
+ /**
+ * Auto-generated method stub
+ */
+ public void preProcessRequest(DelegateExecution execution){}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/oof/adapter/beans/payload/OofRequest.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/oof/adapter/beans/payload/OofRequest.java
new file mode 100644
index 0000000000..9d81332ed7
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/oof/adapter/beans/payload/OofRequest.java
@@ -0,0 +1,49 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Wipro Limited. 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.onap.so.client.oof.adapter.beans.payload;
+
+public class OofRequest {
+
+ private String apiPath;
+
+ private Object requestDetails;
+
+ public String getApiPath() {
+ return apiPath;
+ }
+
+ public void setApiPath(String apiPath) {
+ this.apiPath = apiPath;
+ }
+
+ public Object getRequestDetails() {
+ return requestDetails;
+ }
+
+ public void setRequestDetails(Object requestDetails) {
+ this.requestDetails = requestDetails;
+ }
+
+ @Override
+ public String toString() {
+ return "OofRequest [apiPath=" + apiPath + ", requestDetails=" + requestDetails + "]";
+ }
+
+}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/HomingSolution.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/HomingSolution.java
index 309b053589..ddfb29e97e 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/HomingSolution.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/HomingSolution.java
@@ -37,6 +37,7 @@ public class HomingSolution extends JsonWrapper implements Serializable {
private InventoryType inventoryType;
private boolean isRehome;
private String serviceInstanceId; // TODO should start using si object instead
+ private String allottedResourceId;
private String cloudOwner;
private String cloudRegionId;
private String aicClli;
@@ -74,6 +75,14 @@ public class HomingSolution extends JsonWrapper implements Serializable {
this.serviceInstanceId = serviceInstanceId;
}
+ public String getAllottedResourceId() {
+ return allottedResourceId;
+ }
+
+ public void setAllottedResourceId(String allottedResourceId) {
+ this.allottedResourceId = allottedResourceId;
+ }
+
public String getCloudOwner() {
return cloudOwner;
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy
index 15a0f34482..389f0a089c 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy
@@ -178,60 +178,36 @@ public class CreateSliceService extends AbstractServiceTaskProcessor {
logger.debug("Finish preProcessRequest")
}
- public void getNSTSelection(DelegateExecution execution) {
- logger.debug("Start getNSTSelection")
+ public void prepareSelectNSTRequest(DelegateExecution execution) {
+ logger.debug("Start prepareSelectNSTRequest")
String requestId = execution.getVariable("msoRequestId")
+ String messageType = "NSTSelectionResponse"
Map<String, Object> serviceProfile = execution.getVariable("serviceProfile")
- String oofUrl = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution)
-
- def authHeader = ""
- String basicAuth = UrnPropertiesReader.getVariable("mso.oof.auth", execution)
- String msokey = UrnPropertiesReader.getVariable("mso.msoKey", execution)
-
- String basicAuthValue = utils.encrypt(basicAuth, msokey)
- if (basicAuthValue != null) {
- logger.debug( "Obtained BasicAuth username and password for OOF: " + basicAuthValue)
- try {
- authHeader = utils.getBasicAuth(basicAuthValue, msokey)
- execution.setVariable("BasicAuthHeaderValue", authHeader)
- } catch (Exception ex) {
- logger.debug( "Unable to encode username and password string: " + ex)
- exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - Unable to " +
- "encode username and password string")
- }
- } else {
- logger.debug( "Unable to obtain BasicAuth - BasicAuth value null")
- exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - BasicAuth " +
- "value null")
- }
-
- URL requestUrl = new URL(oofUrl + "/api/oof/v1/selection/nst")
- String oofRequest = oofUtils.buildSelectNSTRequest(requestId, serviceProfile)
- HttpClient httpClient = new HttpClientFactory().newJsonClient(requestUrl, ONAPComponents.OOF)
- httpClient.addAdditionalHeader("Authorization", authHeader)
- Response httpResponse = httpClient.post(oofRequest)
-
- int responseCode = httpResponse.getStatus()
- logger.debug("OOF sync response code is: " + responseCode)
-
- if(responseCode != 200){
- exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from OOF.")
- }
-
- Map<String, Object> nstSolution
- try {
- Map<String, Object> resMap = httpResponse.readEntity(Map.class)
- List<Map<String, Object>> nstSolutions = (List<Map<String, Object>>) resMap.get("solutions")
- nstSolution = nstSolutions.get(0)
- execution.setVariable("nstSolution", nstSolution)
- } catch (Exception ex) {
- logger.debug( "Failed to get NST solution suggested by OOF.")
- exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Failed to get NST solution suggested by OOF.")
- }
-
- logger.debug("Finish getNSTSelection")
+ execution.setVariable("nstSelectionUrl", "/api/oof/v1/selection/nst")
+ execution.setVariable("nstSelection_messageType",messageType)
+ execution.setVariable("nstSelection_correlator",requestId)
+ String timeout = UrnPropertiesReader.getVariable("mso.adapters.oof.timeout", execution);
+ execution.setVariable("nstSelection_timeout",timeout)
+ String oofRequest = oofUtils.buildSelectNSTRequest(requestId,messageType, serviceProfile)
+ execution.setVariable("nstSelection_oofRequest",oofRequest)
+ logger.debug("Finish prepareSelectNSTRequest")
}
+
+ public void processNSTSolutions(DelegateExecution execution) {
+ Map<String, Object> nstSolution
+ try {
+ logger.debug("Start processing NSTSolutions")
+ Map<String, Object> resMap = objectMapper.readValue(execution.getVariable("nstSelection_oofResponse"),Map.class)
+ List<Map<String, Object>> nstSolutions = (List<Map<String, Object>>) resMap.get("solutions")
+ nstSolution = nstSolutions.get(0)
+ execution.setVariable("nstSolution", nstSolution)
+ } catch (Exception ex) {
+ logger.debug( "Failed to get NST solution suggested by OOF.")
+ exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Failed to get NST solution suggested by OOF.")
+ }
+
+ }
public void prepareDecomposeService(DelegateExecution execution) {
logger.debug("Start prepareDecomposeService")
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy
index ec9596e7f3..9b78afba03 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy
@@ -64,38 +64,16 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
}
- void getNSIOptionfromOOF(DelegateExecution execution) {
+ void prepareSelectNSIRequest(DelegateExecution execution) {
String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution)
logger.debug( "get NSI option OOF Url: " + urlString)
boolean isNSISuggested = true
execution.setVariable("isNSISuggested",isNSISuggested)
-
- //Prepare auth for OOF - Begin
- def authHeader = ""
- String basicAuth = UrnPropertiesReader.getVariable("mso.oof.auth", execution)
- String msokey = UrnPropertiesReader.getVariable("mso.msoKey", execution)
-
- String basicAuthValue = utils.encrypt(basicAuth, msokey)
- if (basicAuthValue != null) {
- logger.debug( "Obtained BasicAuth username and password for OOF: " + basicAuthValue)
- try {
- authHeader = utils.getBasicAuth(basicAuthValue, msokey)
- execution.setVariable("BasicAuthHeaderValue", authHeader)
- } catch (Exception ex) {
- logger.debug( "Unable to encode username and password string: " + ex)
- exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - Unable to " +
- "encode username and password string")
- }
- } else {
- logger.debug( "Unable to obtain BasicAuth - BasicAuth value null")
- exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - BasicAuth " +
- "value null")
- }
- //Prepare auth for OOF - End
-
String requestId = execution.getVariable("msoRequestId")
+ String messageType = "NSISelectionResponse"
+
Map<String, Object> profileInfo = execution.getVariable("serviceProfile")
Map<String, Object> nstSolution = execution.getVariable("nstSolution")
logger.debug("Get NST selection from OOF: " + nstSolution.toString())
@@ -104,36 +82,21 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
"modelVersionId":"${nstSolution.UUID}",
"modelName":"${nstSolution.NSTName}"
}"""
-
- String oofRequest = oofUtils.buildSelectNSIRequest(requestId, nstInfo, profileInfo)
- logger.debug("Sending request to OOF: " + oofRequest)
-
- //send request to get NSI option - Begin
- URL url = new URL(urlString+"/api/oof/selection/nsi/v1")
- HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.OOF)
- httpClient.addAdditionalHeader("Authorization", authHeader)
- Response httpResponse = httpClient.post(oofRequest)
-
- processOOFResponse(httpResponse, execution)
-
- //解析sliceProfile
- logger.debug("start parseServiceProfile")
- parseServiceProfile(execution)
- logger.debug("end parseServiceProfile")
+
+ execution.setVariable("nsiSelectionUrl", "/api/oof/selection/nsi/v1")
+ execution.setVariable("nsiSelection_messageType",messageType)
+ execution.setVariable("nsiSelection_correlator",requestId)
+ String timeout = UrnPropertiesReader.getVariable("mso.adapters.oof.timeout", execution);
+ execution.setVariable("nsiSelection_timeout",timeout)
+ String oofRequest = oofUtils.buildSelectNSIRequest(requestId, nstInfo,messageType, profileInfo)
+ execution.setVariable("nsiSelection_oofRequest",oofRequest)
+ logger.debug("Sending request to OOF: " + oofRequest)
}
- private void processOOFResponse(Response httpResponse, DelegateExecution execution) {
+ void processOOFResponse(Response httpResponse, DelegateExecution execution) {
int responseCode = httpResponse.getStatus()
- logger.debug("OOF sync response code is: " + responseCode)
-
- if (responseCode != 200) {
- exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from OOF.")
- logger.debug("Info: No NSI suggested by OOF")
- }
-
SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams")
- if (httpResponse.hasEntity()) {
- String OOFResponse = httpResponse.readEntity(String.class)
+ String OOFResponse = execution.getVariable("nsiSelection_oofResponse")
logger.debug("NSI OOFResponse is: " + OOFResponse)
execution.setVariable("OOFResponse", OOFResponse)
//This needs to be changed to derive a value when we add policy to decide the solution options.
@@ -154,8 +117,11 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
}
execution.setVariable("sliceTaskParams", sliceTaskParams)
logger.debug("sliceTaskParams: "+sliceTaskParams.convertToJson())
- }
logger.debug("*** Completed options Call to OOF ***")
+ //解析sliceProfile
+ logger.debug("start parseServiceProfile")
+ parseServiceProfile(execution)
+ logger.debug("end parseServiceProfile")
}
private boolean hasSharedNSIsolutions( Map solutions){
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSliceService.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSliceService.bpmn
index f27794a389..27bd01bda9 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSliceService.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSliceService.bpmn
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1wio50w" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1">
+<bpmn:definitions xmlns:bpmn="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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1wio50w" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.1.1">
<bpmn:process id="CreateSliceService" name="CreateSliceService" isExecutable="true">
<bpmn:startEvent id="StartEvent_1nbljfd" name="Create Slice Service Creation Flow">
<bpmn:outgoing>SequenceFlow_03s744c</bpmn:outgoing>
@@ -34,12 +34,12 @@ css.processUserOptions(execution)</bpmn:script>
def css = new CreateSliceService()
css.processDecomposition(execution)</bpmn:script>
</bpmn:scriptTask>
- <bpmn:scriptTask id="ScriptTask_1eo3m4q" name="Get NST Selection" scriptFormat="groovy">
+ <bpmn:scriptTask id="ScriptTask_1eo3m4q" name="Prepare NST Selection" scriptFormat="groovy">
<bpmn:incoming>SequenceFlow_046irye</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_1o23s0i</bpmn:outgoing>
+ <bpmn:outgoing>Flow_1l8mfej</bpmn:outgoing>
<bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
def css = new CreateSliceService()
-css.getNSTSelection(execution)</bpmn:script>
+css.prepareSelectNSTRequest(execution)</bpmn:script>
</bpmn:scriptTask>
<bpmn:callActivity id="CallActivity_139l55g" name="Call DoCreateSliceServiceInstance&#10;" calledElement="DoCreateSliceServiceInstance">
<bpmn:extensionElements>
@@ -176,7 +176,7 @@ css.prepareUpdateServiceOperationStatus(execution)</bpmn:script>
<bpmn:outgoing>SequenceFlow_1t19ips</bpmn:outgoing>
</bpmn:callActivity>
<bpmn:scriptTask id="ScriptTask_0o2r07o" name="Prepare&#10;Decompose&#10;Service&#10;" scriptFormat="groovy">
- <bpmn:incoming>SequenceFlow_1o23s0i</bpmn:incoming>
+ <bpmn:incoming>Flow_1u4srgq</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0q7yc2c</bpmn:outgoing>
<bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
def dcsi= new CreateSliceService()
@@ -446,7 +446,6 @@ css.sendSyncResponse(execution)</bpmn:script>
</bpmn:callActivity>
<bpmn:sequenceFlow id="SequenceFlow_1aaozcg" sourceRef="CallActivity_0v4mw2x" targetRef="ScriptTask_0gb975b" />
<bpmn:sequenceFlow id="SequenceFlow_046irye" sourceRef="ServiceTask_0kd6p6p" targetRef="ScriptTask_1eo3m4q" />
- <bpmn:sequenceFlow id="SequenceFlow_1o23s0i" sourceRef="ScriptTask_1eo3m4q" targetRef="ScriptTask_0o2r07o" />
<bpmn:sequenceFlow id="SequenceFlow_0jrclmc" sourceRef="ScriptTask_0l3d1ai" targetRef="IntermediateThrowEvent_1ex8ke9" />
<bpmn:scriptTask id="ScriptTask_19uxoi8" name="Update AAI Status" scriptFormat="groovy">
<bpmn:incoming>SequenceFlow_0n4xku8</bpmn:incoming>
@@ -457,12 +456,205 @@ def css = new CreateSliceService()
css.updateAAIOrchStatus(execution)</bpmn:script>
</bpmn:scriptTask>
<bpmn:sequenceFlow id="SequenceFlow_0kixzdj" sourceRef="ScriptTask_19uxoi8" targetRef="ScriptTask_1ef3voz" />
+ <bpmn:sequenceFlow id="Flow_1l8mfej" sourceRef="ScriptTask_1eo3m4q" targetRef="Activity_1ge49xu" />
+ <bpmn:callActivity id="Activity_1ge49xu" name="Handle NST Selection OOF request" calledElement="DoHandleOofRequest">
+ <bpmn:extensionElements>
+ <camunda:in source="nstSelectionUrl" target="apiPath" />
+ <camunda:in source="nstSelection_correlator" target="correlator" />
+ <camunda:in source="nstSelection_messageType" target="messageType" />
+ <camunda:in source="nstSelection_timeout" target="timeout" />
+ <camunda:out source="WorkflowException" target="WorkflowException" />
+ <camunda:out source="asyncCallbackResponse" target="nstSelection_oofResponse" />
+ <camunda:in source="nstSelection_oofRequest" target="oofRequest" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>Flow_1l8mfej</bpmn:incoming>
+ <bpmn:outgoing>Flow_0vq2rmw</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:sequenceFlow id="Flow_0vq2rmw" sourceRef="Activity_1ge49xu" targetRef="Activity_12v8ykp" />
+ <bpmn:scriptTask id="Activity_12v8ykp" name="Process NST Solutions" scriptFormat="groovy">
+ <bpmn:incoming>Flow_0vq2rmw</bpmn:incoming>
+ <bpmn:outgoing>Flow_1u4srgq</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def css = new CreateSliceService()
+css.processNSTSolutions(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="Flow_1u4srgq" sourceRef="Activity_12v8ykp" targetRef="ScriptTask_0o2r07o" />
</bpmn:process>
<bpmn:message id="Message_0c4b2r5" name="SliceServiceTask" />
<bpmn:error id="Error_03akl5v" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
<bpmn:error id="Error_0p2naox" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="CreateSliceService">
+ <bpmndi:BPMNEdge id="SequenceFlow_0kixzdj_di" bpmnElement="SequenceFlow_0kixzdj">
+ <di:waypoint x="745" y="801" />
+ <di:waypoint x="823" y="801" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0jrclmc_di" bpmnElement="SequenceFlow_0jrclmc">
+ <di:waypoint x="1540" y="121" />
+ <di:waypoint x="1584" y="121" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_046irye_di" bpmnElement="SequenceFlow_046irye">
+ <di:waypoint x="650" y="121" />
+ <di:waypoint x="685" y="121" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1aaozcg_di" bpmnElement="SequenceFlow_1aaozcg">
+ <di:waypoint x="1115" y="289" />
+ <di:waypoint x="1193" y="289" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_12qt5ci_di" bpmnElement="SequenceFlow_12qt5ci">
+ <di:waypoint x="335" y="514" />
+ <di:waypoint x="335" y="611" />
+ <di:waypoint x="335" y="593" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_16uz2t9_di" bpmnElement="SequenceFlow_16uz2t9">
+ <di:waypoint x="385" y="456" />
+ <di:waypoint x="467" y="456" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1fk37v7_di" bpmnElement="SequenceFlow_1fk37v7">
+ <di:waypoint x="214" y="456" />
+ <di:waypoint x="285" y="456" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1ey6m1e_di" bpmnElement="SequenceFlow_1ey6m1e">
+ <di:waypoint x="930" y="289" />
+ <di:waypoint x="1015" y="289" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1bevt3a_di" bpmnElement="SequenceFlow_1bevt3a">
+ <di:waypoint x="214" y="801" />
+ <di:waypoint x="285" y="801" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_10ng1vx_di" bpmnElement="SequenceFlow_10ng1vx">
+ <di:waypoint x="1471" y="645" />
+ <di:waypoint x="1584" y="645" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_19lsayh_di" bpmnElement="SequenceFlow_19lsayh">
+ <di:waypoint x="1293" y="645" />
+ <di:waypoint x="1371" y="645" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0h2oree_di" bpmnElement="SequenceFlow_0h2oree">
+ <di:waypoint x="567" y="456" />
+ <di:waypoint x="645" y="456" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0477975_di" bpmnElement="SequenceFlow_0477975">
+ <di:waypoint x="1471" y="456" />
+ <di:waypoint x="1584" y="456" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0thd6ny_di" bpmnElement="SequenceFlow_0thd6ny">
+ <di:waypoint x="1293" y="456" />
+ <di:waypoint x="1371" y="456" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1sq6kp6_di" bpmnElement="SequenceFlow_1sq6kp6">
+ <di:waypoint x="385" y="289" />
+ <di:waypoint x="467" y="289" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0q7yc2c_di" bpmnElement="SequenceFlow_0q7yc2c">
+ <di:waypoint x="1240" y="121" />
+ <di:waypoint x="1280" y="121" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1qv8qw1_di" bpmnElement="SequenceFlow_1qv8qw1">
+ <di:waypoint x="1297" y="801" />
+ <di:waypoint x="1375" y="801" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0lbdfmt_di" bpmnElement="SequenceFlow_0lbdfmt">
+ <di:waypoint x="1105" y="801" />
+ <di:waypoint x="1197" y="801" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1o1tu0f_di" bpmnElement="SequenceFlow_1o1tu0f">
+ <di:waypoint x="214" y="289" />
+ <di:waypoint x="285" y="289" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0t094g7_di" bpmnElement="SequenceFlow_0t094g7">
+ <di:waypoint x="510" y="121" />
+ <di:waypoint x="550" y="121" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_11rbv41_di" bpmnElement="SequenceFlow_11rbv41">
+ <di:waypoint x="1475" y="801" />
+ <di:waypoint x="1585" y="801" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0klb3ey_di" bpmnElement="SequenceFlow_0klb3ey">
+ <di:waypoint x="923" y="801" />
+ <di:waypoint x="1005" y="801" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0n4xku8_di" bpmnElement="SequenceFlow_0n4xku8">
+ <di:waypoint x="538" y="801" />
+ <di:waypoint x="645" y="801" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="584" y="783" width="18" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1c6ka9h_di" bpmnElement="SequenceFlow_1c6ka9h">
+ <di:waypoint x="513" y="826" />
+ <di:waypoint x="513" y="926" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="521" y="832" width="15" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0mlrlbv_di" bpmnElement="SequenceFlow_0mlrlbv">
+ <di:waypoint x="385" y="801" />
+ <di:waypoint x="488" y="801" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_18kur12_di" bpmnElement="SequenceFlow_18kur12">
+ <di:waypoint x="1293" y="289" />
+ <di:waypoint x="1371" y="289" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0it2g9j_di" bpmnElement="SequenceFlow_0it2g9j">
+ <di:waypoint x="1471" y="289" />
+ <di:waypoint x="1584" y="289" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1g8m7tq_di" bpmnElement="SequenceFlow_1g8m7tq">
+ <di:waypoint x="745" y="289" />
+ <di:waypoint x="830" y="289" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1p8vxo5_di" bpmnElement="SequenceFlow_1p8vxo5">
+ <di:waypoint x="567" y="289" />
+ <di:waypoint x="645" y="289" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1t19ips_di" bpmnElement="SequenceFlow_1t19ips">
+ <di:waypoint x="1380" y="121" />
+ <di:waypoint x="1440" y="121" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_038lb9m_di" bpmnElement="SequenceFlow_038lb9m">
+ <di:waypoint x="1065" y="481" />
+ <di:waypoint x="1065" y="645" />
+ <di:waypoint x="1193" y="645" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1067" y="560" width="27" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_12t5exy_di" bpmnElement="SequenceFlow_12t5exy">
+ <di:waypoint x="1090" y="456" />
+ <di:waypoint x="1193" y="456" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1121.5" y="438" width="42" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_197cm2e_di" bpmnElement="SequenceFlow_197cm2e">
+ <di:waypoint x="930" y="456" />
+ <di:waypoint x="1040" y="456" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1cv0wop_di" bpmnElement="SequenceFlow_1cv0wop">
+ <di:waypoint x="745" y="456" />
+ <di:waypoint x="830" y="456" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_07e12rt_di" bpmnElement="SequenceFlow_07e12rt">
+ <di:waypoint x="350" y="121" />
+ <di:waypoint x="410" y="121" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_03s744c_di" bpmnElement="SequenceFlow_03s744c">
+ <di:waypoint x="214" y="121" />
+ <di:waypoint x="250" y="121" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1l8mfej_di" bpmnElement="Flow_1l8mfej">
+ <di:waypoint x="785" y="121" />
+ <di:waypoint x="830" y="121" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_0vq2rmw_di" bpmnElement="Flow_0vq2rmw">
+ <di:waypoint x="930" y="121" />
+ <di:waypoint x="1000" y="121" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1u4srgq_di" bpmnElement="Flow_1u4srgq">
+ <di:waypoint x="1100" y="121" />
+ <di:waypoint x="1140" y="121" />
+ </bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="StartEvent_1nbljfd_di" bpmnElement="StartEvent_1nbljfd">
<dc:Bounds x="178" y="103" width="36" height="36" />
<bpmndi:BPMNLabel>
@@ -475,9 +667,6 @@ css.updateAAIOrchStatus(execution)</bpmn:script>
<dc:Bounds x="168" y="481" width="60" height="27" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="ScriptTask_1tc44ge_di" bpmnElement="ScriptTask_1tc44ge">
- <dc:Bounds x="285" y="81" width="100" height="80" />
- </bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_1jgtb0y_di" bpmnElement="ScriptTask_1jgtb0y">
<dc:Bounds x="830" y="416" width="100" height="80" />
</bpmndi:BPMNShape>
@@ -487,12 +676,6 @@ css.updateAAIOrchStatus(execution)</bpmn:script>
<dc:Bounds x="1027" y="413" width="78" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="ScriptTask_0l3d1ai_di" bpmnElement="ScriptTask_0l3d1ai">
- <dc:Bounds x="1370" y="81" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="ScriptTask_1eo3m4q_di" bpmnElement="ScriptTask_1eo3m4q">
- <dc:Bounds x="830" y="81" width="100" height="80" />
- </bpmndi:BPMNShape>
<bpmndi:BPMNShape id="CallActivity_139l55g_di" bpmnElement="CallActivity_139l55g">
<dc:Bounds x="645" y="249" width="100" height="80" />
</bpmndi:BPMNShape>
@@ -514,9 +697,53 @@ css.updateAAIOrchStatus(execution)</bpmn:script>
<bpmndi:BPMNShape id="EndEvent_0x406rw_di" bpmnElement="EndEvent_0x406rw">
<dc:Bounds x="495" y="926" width="36" height="36" />
</bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_0l3d1ai_di" bpmnElement="ScriptTask_0l3d1ai">
+ <dc:Bounds x="1440" y="81" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="CallActivity_1bnkmaz_di" bpmnElement="CallActivity_1bnkmaz">
+ <dc:Bounds x="1280" y="81" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_0o2r07o_di" bpmnElement="ScriptTask_0o2r07o">
+ <dc:Bounds x="1140" y="81" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1tc44ge_di" bpmnElement="ScriptTask_1tc44ge">
+ <dc:Bounds x="250" y="81" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_0yce5sp_di" bpmnElement="Activity_12v8ykp">
+ <dc:Bounds x="1000" y="81" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_0uymgnp_di" bpmnElement="Activity_1ge49xu">
+ <dc:Bounds x="830" y="81" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1eo3m4q_di" bpmnElement="ScriptTask_1eo3m4q">
+ <dc:Bounds x="685" y="81" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_0kd6p6p_di" bpmnElement="ServiceTask_0kd6p6p">
+ <dc:Bounds x="550" y="81" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1xxag1o_di" bpmnElement="ScriptTask_1xxag1o">
+ <dc:Bounds x="410" y="81" width="100" height="80" />
+ </bpmndi:BPMNShape>
<bpmndi:BPMNShape id="SubProcess_1yv9i68_di" bpmnElement="SubProcess_1yv9i68" isExpanded="true">
<dc:Bounds x="685" y="1080" width="781" height="196" />
</bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_08mlzwz_di" bpmnElement="SequenceFlow_08mlzwz">
+ <di:waypoint x="1079" y="1184" />
+ <di:waypoint x="1353" y="1184" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1w67v6s_di" bpmnElement="SequenceFlow_1w67v6s">
+ <di:waypoint x="751" y="1184" />
+ <di:waypoint x="979" y="1184" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="StartEvent_1omdx56_di" bpmnElement="StartEvent_1omdx56">
+ <dc:Bounds x="715" y="1166" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1jx3026_di" bpmnElement="EndEvent_1jx3026">
+ <dc:Bounds x="1353" y="1166" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1swzdpw_di" bpmnElement="ScriptTask_1swzdpw">
+ <dc:Bounds x="979" y="1144" width="100" height="80" />
+ </bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_1ef3voz_di" bpmnElement="ScriptTask_1ef3voz">
<dc:Bounds x="823" y="761" width="100" height="80" />
</bpmndi:BPMNShape>
@@ -526,9 +753,6 @@ css.updateAAIOrchStatus(execution)</bpmn:script>
<dc:Bounds x="1593" y="826" width="20" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="ScriptTask_1xxag1o_di" bpmnElement="ScriptTask_1xxag1o">
- <dc:Bounds x="468" y="81" width="100" height="80" />
- </bpmndi:BPMNShape>
<bpmndi:BPMNShape id="IntermediateThrowEvent_1ex8ke9_di" bpmnElement="IntermediateThrowEvent_1ex8ke9">
<dc:Bounds x="1584" y="103" width="36" height="36" />
<bpmndi:BPMNLabel>
@@ -544,15 +768,6 @@ css.updateAAIOrchStatus(execution)</bpmn:script>
<bpmndi:BPMNShape id="ScriptTask_1ssh2l9_di" bpmnElement="ScriptTask_1ssh2l9">
<dc:Bounds x="1197" y="761" width="100" height="80" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="ServiceTask_0kd6p6p_di" bpmnElement="ServiceTask_0kd6p6p">
- <dc:Bounds x="645" y="81" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="CallActivity_1bnkmaz_di" bpmnElement="CallActivity_1bnkmaz">
- <dc:Bounds x="1193" y="81" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="ScriptTask_0o2r07o_di" bpmnElement="ScriptTask_0o2r07o">
- <dc:Bounds x="1015" y="81" width="100" height="80" />
- </bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_0b7senu_di" bpmnElement="ScriptTask_0b7senu">
<dc:Bounds x="285" y="249" width="100" height="80" />
</bpmndi:BPMNShape>
@@ -613,197 +828,18 @@ css.updateAAIOrchStatus(execution)</bpmn:script>
<bpmndi:BPMNShape id="EndEvent_0bh0kwx_di" bpmnElement="EndEvent_0bh0kwx">
<dc:Bounds x="317" y="593" width="36" height="36" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_03s744c_di" bpmnElement="SequenceFlow_03s744c">
- <di:waypoint x="214" y="121" />
- <di:waypoint x="285" y="121" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_07e12rt_di" bpmnElement="SequenceFlow_07e12rt">
- <di:waypoint x="385" y="121" />
- <di:waypoint x="468" y="121" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_1cv0wop_di" bpmnElement="SequenceFlow_1cv0wop">
- <di:waypoint x="745" y="456" />
- <di:waypoint x="830" y="456" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_197cm2e_di" bpmnElement="SequenceFlow_197cm2e">
- <di:waypoint x="930" y="456" />
- <di:waypoint x="1040" y="456" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_12t5exy_di" bpmnElement="SequenceFlow_12t5exy">
- <di:waypoint x="1090" y="456" />
- <di:waypoint x="1193" y="456" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="1121.5" y="438" width="42" height="14" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_038lb9m_di" bpmnElement="SequenceFlow_038lb9m">
- <di:waypoint x="1065" y="481" />
- <di:waypoint x="1065" y="645" />
- <di:waypoint x="1193" y="645" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="1067" y="560" width="27" height="14" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_1t19ips_di" bpmnElement="SequenceFlow_1t19ips">
- <di:waypoint x="1293" y="121" />
- <di:waypoint x="1370" y="121" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_1p8vxo5_di" bpmnElement="SequenceFlow_1p8vxo5">
- <di:waypoint x="567" y="289" />
- <di:waypoint x="645" y="289" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_1g8m7tq_di" bpmnElement="SequenceFlow_1g8m7tq">
- <di:waypoint x="745" y="289" />
- <di:waypoint x="830" y="289" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_0it2g9j_di" bpmnElement="SequenceFlow_0it2g9j">
- <di:waypoint x="1471" y="289" />
- <di:waypoint x="1584" y="289" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_18kur12_di" bpmnElement="SequenceFlow_18kur12">
- <di:waypoint x="1293" y="289" />
- <di:waypoint x="1371" y="289" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_0mlrlbv_di" bpmnElement="SequenceFlow_0mlrlbv">
- <di:waypoint x="385" y="801" />
- <di:waypoint x="488" y="801" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_1c6ka9h_di" bpmnElement="SequenceFlow_1c6ka9h">
- <di:waypoint x="513" y="826" />
- <di:waypoint x="513" y="926" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="521" y="832" width="15" height="14" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_0n4xku8_di" bpmnElement="SequenceFlow_0n4xku8">
- <di:waypoint x="538" y="801" />
- <di:waypoint x="645" y="801" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="584" y="783" width="18" height="14" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_0klb3ey_di" bpmnElement="SequenceFlow_0klb3ey">
- <di:waypoint x="923" y="801" />
- <di:waypoint x="1005" y="801" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_11rbv41_di" bpmnElement="SequenceFlow_11rbv41">
- <di:waypoint x="1475" y="801" />
- <di:waypoint x="1585" y="801" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_0t094g7_di" bpmnElement="SequenceFlow_0t094g7">
- <di:waypoint x="568" y="121" />
- <di:waypoint x="645" y="121" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_1o1tu0f_di" bpmnElement="SequenceFlow_1o1tu0f">
- <di:waypoint x="214" y="289" />
- <di:waypoint x="285" y="289" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_0lbdfmt_di" bpmnElement="SequenceFlow_0lbdfmt">
- <di:waypoint x="1105" y="801" />
- <di:waypoint x="1197" y="801" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_1qv8qw1_di" bpmnElement="SequenceFlow_1qv8qw1">
- <di:waypoint x="1297" y="801" />
- <di:waypoint x="1375" y="801" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_0q7yc2c_di" bpmnElement="SequenceFlow_0q7yc2c">
- <di:waypoint x="1115" y="121" />
- <di:waypoint x="1193" y="121" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_1sq6kp6_di" bpmnElement="SequenceFlow_1sq6kp6">
- <di:waypoint x="385" y="289" />
- <di:waypoint x="467" y="289" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_0thd6ny_di" bpmnElement="SequenceFlow_0thd6ny">
- <di:waypoint x="1293" y="456" />
- <di:waypoint x="1371" y="456" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_0477975_di" bpmnElement="SequenceFlow_0477975">
- <di:waypoint x="1471" y="456" />
- <di:waypoint x="1584" y="456" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_0h2oree_di" bpmnElement="SequenceFlow_0h2oree">
- <di:waypoint x="567" y="456" />
- <di:waypoint x="645" y="456" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_19lsayh_di" bpmnElement="SequenceFlow_19lsayh">
- <di:waypoint x="1293" y="645" />
- <di:waypoint x="1371" y="645" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_10ng1vx_di" bpmnElement="SequenceFlow_10ng1vx">
- <di:waypoint x="1471" y="645" />
- <di:waypoint x="1584" y="645" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_1bevt3a_di" bpmnElement="SequenceFlow_1bevt3a">
- <di:waypoint x="214" y="801" />
- <di:waypoint x="285" y="801" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_1ey6m1e_di" bpmnElement="SequenceFlow_1ey6m1e">
- <di:waypoint x="930" y="289" />
- <di:waypoint x="1015" y="289" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="StartEvent_1omdx56_di" bpmnElement="StartEvent_1omdx56">
- <dc:Bounds x="715" y="1166" width="36" height="36" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="EndEvent_1jx3026_di" bpmnElement="EndEvent_1jx3026">
- <dc:Bounds x="1353" y="1166" width="36" height="36" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="ScriptTask_1swzdpw_di" bpmnElement="ScriptTask_1swzdpw">
- <dc:Bounds x="979" y="1144" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_1w67v6s_di" bpmnElement="SequenceFlow_1w67v6s">
- <di:waypoint x="751" y="1184" />
- <di:waypoint x="979" y="1184" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_08mlzwz_di" bpmnElement="SequenceFlow_08mlzwz">
- <di:waypoint x="1079" y="1184" />
- <di:waypoint x="1353" y="1184" />
- </bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ReceiveTask_0zkpdpa_di" bpmnElement="Task_1b5t88h">
<dc:Bounds x="285" y="416" width="100" height="80" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_1fk37v7_di" bpmnElement="SequenceFlow_1fk37v7">
- <di:waypoint x="214" y="456" />
- <di:waypoint x="285" y="456" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_16uz2t9_di" bpmnElement="SequenceFlow_16uz2t9">
- <di:waypoint x="385" y="456" />
- <di:waypoint x="467" y="456" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="BoundaryEvent_15igwk2_di" bpmnElement="BoundaryEvent_0clo9pv">
- <dc:Bounds x="317" y="478" width="36" height="36" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_12qt5ci_di" bpmnElement="SequenceFlow_12qt5ci">
- <di:waypoint x="335" y="514" />
- <di:waypoint x="335" y="611" />
- <di:waypoint x="335" y="593" />
- </bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="CallActivity_0v4mw2x_di" bpmnElement="CallActivity_0v4mw2x">
<dc:Bounds x="1015" y="249" width="100" height="80" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_1aaozcg_di" bpmnElement="SequenceFlow_1aaozcg">
- <di:waypoint x="1115" y="289" />
- <di:waypoint x="1193" y="289" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_046irye_di" bpmnElement="SequenceFlow_046irye">
- <di:waypoint x="745" y="121" />
- <di:waypoint x="830" y="121" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_1o23s0i_di" bpmnElement="SequenceFlow_1o23s0i">
- <di:waypoint x="930" y="121" />
- <di:waypoint x="1015" y="121" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_0jrclmc_di" bpmnElement="SequenceFlow_0jrclmc">
- <di:waypoint x="1470" y="121" />
- <di:waypoint x="1584" y="121" />
- </bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ScriptTask_19uxoi8_di" bpmnElement="ScriptTask_19uxoi8">
<dc:Bounds x="645" y="761" width="100" height="80" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_0kixzdj_di" bpmnElement="SequenceFlow_0kixzdj">
- <di:waypoint x="745" y="801" />
- <di:waypoint x="823" y="801" />
- </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="BoundaryEvent_15igwk2_di" bpmnElement="BoundaryEvent_0clo9pv">
+ <dc:Bounds x="317" y="478" width="36" height="36" />
+ </bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceOption.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceOption.bpmn
index ad0732df4d..3ed1999d9a 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceOption.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceOption.bpmn
@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1">
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.1.1">
<bpmn:process id="DoCreateSliceServiceOption" name="DoCreateSliceServiceOption" isExecutable="true">
<bpmn:startEvent id="createNS_StartEvent" name="createOption_StartEvent">
<bpmn:outgoing>SequenceFlow_1qo2pln</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:sequenceFlow id="SequenceFlow_1qo2pln" sourceRef="createNS_StartEvent" targetRef="PreprocessIncomingRequest_task" />
<bpmn:sequenceFlow id="SequenceFlow_0khtova" sourceRef="PreprocessIncomingRequest_task" targetRef="Task_09nzhwk" />
- <bpmn:scriptTask id="Task_09nzhwk" name="send request to OOF for NSI options" scriptFormat="groovy">
+ <bpmn:scriptTask id="Task_09nzhwk" name="Prepare OOF Select NSI options request" scriptFormat="groovy">
<bpmn:incoming>SequenceFlow_0khtova</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_1utpplq</bpmn:outgoing>
+ <bpmn:outgoing>Flow_15c2jcx</bpmn:outgoing>
<bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
def dcso = new DoCreateSliceServiceOption()
-dcso.getNSIOptionfromOOF(execution)</bpmn:script>
+dcso.prepareSelectNSIRequest(execution)</bpmn:script>
</bpmn:scriptTask>
<bpmn:scriptTask id="PreprocessIncomingRequest_task" name="Preprocess Request" scriptFormat="groovy">
<bpmn:incoming>SequenceFlow_1qo2pln</bpmn:incoming>
@@ -73,7 +73,6 @@ dcso.prepareNSSTDecompose(execution)</bpmn:script>
<bpmn:outgoing>SequenceFlow_0a5f5y6</bpmn:outgoing>
</bpmn:callActivity>
<bpmn:sequenceFlow id="SequenceFlow_0a5f5y6" sourceRef="CallActivity_1rfnoe2" targetRef="ScriptTask_1mlytov" />
- <bpmn:sequenceFlow id="SequenceFlow_1utpplq" sourceRef="Task_09nzhwk" targetRef="ScriptTask_1umbyel" />
<bpmn:exclusiveGateway id="ExclusiveGateway_1skfk7w" default="SequenceFlow_0wy6oag">
<bpmn:incoming>SequenceFlow_0d774n5</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0wy6oag</bpmn:outgoing>
@@ -84,7 +83,7 @@ dcso.prepareNSSTDecompose(execution)</bpmn:script>
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isNSISuggested" ) == true)}</bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:scriptTask id="ScriptTask_1umbyel" name="prepare NST decomposition" scriptFormat="groovy">
- <bpmn:incoming>SequenceFlow_1utpplq</bpmn:incoming>
+ <bpmn:incoming>Flow_07ustqm</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0piifl1</bpmn:outgoing>
<bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
def dcso = new DoCreateSliceServiceOption()
@@ -112,124 +111,159 @@ dcso.prepareNSTDecompose(execution)</bpmn:script>
def dcso = new DoCreateSliceServiceOption()
dcso.processDecomposition(execution)</bpmn:script>
</bpmn:scriptTask>
+ <bpmn:callActivity id="Activity_0dlr4ra" name="Handle NSI Selection OOF request" calledElement="DoHandleOofRequest">
+ <bpmn:extensionElements>
+ <camunda:in source="nsiSelectionUrl" target="apiPath" />
+ <camunda:in source="nsiSelection_correlator" target="correlator" />
+ <camunda:in source="nsiSelection_messageType" target="messageType" />
+ <camunda:in source="nsiSelection_timeout" target="timeout" />
+ <camunda:out source="WorkflowException" target="WorkflowException" />
+ <camunda:out source="asyncCallbackResponse" target="nsiSelection_oofResponse" />
+ <camunda:in source="nsiSelection_oofRequest" target="oofRequest" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>Flow_15c2jcx</bpmn:incoming>
+ <bpmn:outgoing>Flow_1mcx2ja</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:scriptTask id="Activity_049mjag" name="Process OOF response " scriptFormat="groovy">
+ <bpmn:incoming>Flow_1mcx2ja</bpmn:incoming>
+ <bpmn:outgoing>Flow_07ustqm</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def dcso = new DoCreateSliceServiceOption()
+dcso.processOOFResponse(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="Flow_1mcx2ja" sourceRef="Activity_0dlr4ra" targetRef="Activity_049mjag" />
+ <bpmn:sequenceFlow id="Flow_15c2jcx" sourceRef="Task_09nzhwk" targetRef="Activity_0dlr4ra" />
+ <bpmn:sequenceFlow id="Flow_07ustqm" sourceRef="Activity_049mjag" targetRef="ScriptTask_1umbyel" />
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoCreateSliceServiceOption">
- <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="createNS_StartEvent">
- <dc:Bounds x="175" y="107" width="36" height="36" />
+ <bpmndi:BPMNEdge id="SequenceFlow_0d774n5_di" bpmnElement="SequenceFlow_0d774n5">
+ <di:waypoint x="1220" y="125" />
+ <di:waypoint x="1275" y="125" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_086yszq_di" bpmnElement="SequenceFlow_086yszq">
+ <di:waypoint x="1060" y="125" />
+ <di:waypoint x="1120" y="125" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0piifl1_di" bpmnElement="SequenceFlow_0piifl1">
+ <di:waypoint x="920" y="125" />
+ <di:waypoint x="960" y="125" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0hnsycl_di" bpmnElement="SequenceFlow_0hnsycl">
+ <di:waypoint x="1325" y="125" />
+ <di:waypoint x="1993" y="125" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0wy6oag_di" bpmnElement="SequenceFlow_0wy6oag">
+ <di:waypoint x="1300" y="150" />
+ <di:waypoint x="1300" y="351" />
+ <di:waypoint x="1430" y="351" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0a5f5y6_di" bpmnElement="SequenceFlow_0a5f5y6">
+ <di:waypoint x="2061" y="351" />
+ <di:waypoint x="2148" y="351" />
+ <di:waypoint x="2148" y="493" />
+ <di:waypoint x="1960" y="493" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_016vi3s_di" bpmnElement="SequenceFlow_016vi3s">
+ <di:waypoint x="1872" y="351" />
+ <di:waypoint x="1961" y="351" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1r9n9ef_di" bpmnElement="SequenceFlow_1r9n9ef">
+ <di:waypoint x="1860" y="493" />
+ <di:waypoint x="1666" y="493" />
+ <di:waypoint x="1666" y="376" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0m2mr0o_di" bpmnElement="SequenceFlow_0m2mr0o">
+ <di:waypoint x="1691" y="351" />
+ <di:waypoint x="1772" y="351" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0lt2cdo_di" bpmnElement="SequenceFlow_0lt2cdo">
+ <di:waypoint x="1530" y="351" />
+ <di:waypoint x="1641" y="351" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1ap8kar_di" bpmnElement="SequenceFlow_1ap8kar">
+ <di:waypoint x="1666" y="326" />
+ <di:waypoint x="1666" y="235" />
+ <di:waypoint x="2011" y="235" />
+ <di:waypoint x="2011" y="143" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0khtova_di" bpmnElement="SequenceFlow_0khtova">
+ <di:waypoint x="350" y="125" />
+ <di:waypoint x="390" y="125" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="151" y="143" width="86" height="27" />
+ <dc:Bounds x="436" y="108" width="0" height="12" />
</bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
+ </bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1qo2pln_di" bpmnElement="SequenceFlow_1qo2pln">
- <di:waypoint x="211" y="125" />
- <di:waypoint x="251" y="125" />
- <di:waypoint x="251" y="125" />
- <di:waypoint x="293" y="125" />
+ <di:waypoint x="218" y="125" />
+ <di:waypoint x="250" y="125" />
<bpmndi:BPMNLabel>
<dc:Bounds x="266" y="123" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_0khtova_di" bpmnElement="SequenceFlow_0khtova">
- <di:waypoint x="393" y="125" />
- <di:waypoint x="460" y="125" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="436" y="108" width="0" height="12" />
- </bpmndi:BPMNLabel>
+ <bpmndi:BPMNEdge id="Flow_1mcx2ja_di" bpmnElement="Flow_1mcx2ja">
+ <di:waypoint x="640" y="125" />
+ <di:waypoint x="680" y="125" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_15c2jcx_di" bpmnElement="Flow_15c2jcx">
+ <di:waypoint x="490" y="122" />
+ <di:waypoint x="540" y="120" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_07ustqm_di" bpmnElement="Flow_07ustqm">
+ <di:waypoint x="780" y="125" />
+ <di:waypoint x="820" y="125" />
</bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="ScriptTask_1dw39hg_di" bpmnElement="Task_09nzhwk">
- <dc:Bounds x="460" y="85" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="ScriptTask_03j6ogo_di" bpmnElement="PreprocessIncomingRequest_task">
- <dc:Bounds x="293" y="85" width="100" height="80" />
- </bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c">
- <dc:Bounds x="1813" y="107" width="36" height="36" />
+ <dc:Bounds x="1993" y="107" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="412" y="617" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_0kecvrc_di" bpmnElement="ScriptTask_0kecvrc">
- <dc:Bounds x="1250" y="311" width="100" height="80" />
+ <dc:Bounds x="1430" y="311" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_1mlytov_di" bpmnElement="ScriptTask_1mlytov">
- <dc:Bounds x="1680" y="453" width="100" height="80" />
+ <dc:Bounds x="1860" y="453" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ExclusiveGateway_1y1wzs9_di" bpmnElement="ExclusiveGateway_1y1wzs9" isMarkerVisible="true">
- <dc:Bounds x="1461" y="326" width="50" height="50" />
+ <dc:Bounds x="1641" y="326" width="50" height="50" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_1ap8kar_di" bpmnElement="SequenceFlow_1ap8kar">
- <di:waypoint x="1486" y="326" />
- <di:waypoint x="1486" y="235" />
- <di:waypoint x="1831" y="235" />
- <di:waypoint x="1831" y="143" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_0lt2cdo_di" bpmnElement="SequenceFlow_0lt2cdo">
- <di:waypoint x="1350" y="351" />
- <di:waypoint x="1461" y="351" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_0m2mr0o_di" bpmnElement="SequenceFlow_0m2mr0o">
- <di:waypoint x="1511" y="351" />
- <di:waypoint x="1592" y="351" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_1r9n9ef_di" bpmnElement="SequenceFlow_1r9n9ef">
- <di:waypoint x="1680" y="493" />
- <di:waypoint x="1486" y="493" />
- <di:waypoint x="1486" y="376" />
- </bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ScriptTask_1e5ysya_di" bpmnElement="ScriptTask_1e5ysya">
- <dc:Bounds x="1592" y="311" width="100" height="80" />
+ <dc:Bounds x="1772" y="311" width="100" height="80" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_016vi3s_di" bpmnElement="SequenceFlow_016vi3s">
- <di:waypoint x="1692" y="351" />
- <di:waypoint x="1781" y="351" />
- </bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="CallActivity_1rfnoe2_di" bpmnElement="CallActivity_1rfnoe2">
- <dc:Bounds x="1781" y="311" width="100" height="80" />
+ <dc:Bounds x="1961" y="311" width="100" height="80" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_0a5f5y6_di" bpmnElement="SequenceFlow_0a5f5y6">
- <di:waypoint x="1881" y="351" />
- <di:waypoint x="1968" y="351" />
- <di:waypoint x="1968" y="493" />
- <di:waypoint x="1780" y="493" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_1utpplq_di" bpmnElement="SequenceFlow_1utpplq">
- <di:waypoint x="560" y="125" />
- <di:waypoint x="620" y="125" />
- </bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ExclusiveGateway_1skfk7w_di" bpmnElement="ExclusiveGateway_1skfk7w" isMarkerVisible="true">
- <dc:Bounds x="1095" y="100" width="50" height="50" />
+ <dc:Bounds x="1275" y="100" width="50" height="50" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_0wy6oag_di" bpmnElement="SequenceFlow_0wy6oag">
- <di:waypoint x="1120" y="150" />
- <di:waypoint x="1120" y="351" />
- <di:waypoint x="1250" y="351" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_0hnsycl_di" bpmnElement="SequenceFlow_0hnsycl">
- <di:waypoint x="1145" y="125" />
- <di:waypoint x="1813" y="125" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="ScriptTask_1umbyel_di" bpmnElement="ScriptTask_1umbyel">
- <dc:Bounds x="620" y="85" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_0piifl1_di" bpmnElement="SequenceFlow_0piifl1">
- <di:waypoint x="720" y="125" />
- <di:waypoint x="780" y="125" />
- </bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="CallActivity_0ly8xiw_di" bpmnElement="CallActivity_0ly8xiw">
- <dc:Bounds x="780" y="85" width="100" height="80" />
+ <dc:Bounds x="960" y="85" width="100" height="80" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_086yszq_di" bpmnElement="SequenceFlow_086yszq">
- <di:waypoint x="880" y="125" />
- <di:waypoint x="940" y="125" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_0d774n5_di" bpmnElement="SequenceFlow_0d774n5">
- <di:waypoint x="1040" y="125" />
- <di:waypoint x="1095" y="125" />
- </bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ScriptTask_1895p18_di" bpmnElement="Task_1k2ypj0">
- <dc:Bounds x="940" y="85" width="100" height="80" />
+ <dc:Bounds x="1120" y="85" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="createNS_StartEvent">
+ <dc:Bounds x="182" y="107" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="158" y="143" width="86" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_03j6ogo_di" bpmnElement="PreprocessIncomingRequest_task">
+ <dc:Bounds x="250" y="85" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1dw39hg_di" bpmnElement="Task_09nzhwk">
+ <dc:Bounds x="390" y="85" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_049mjag_di" bpmnElement="Activity_049mjag">
+ <dc:Bounds x="680" y="85" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_0dlr4ra_di" bpmnElement="Activity_0dlr4ra">
+ <dc:Bounds x="540" y="85" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1umbyel_di" bpmnElement="ScriptTask_1umbyel">
+ <dc:Bounds x="820" y="85" width="100" height="80" />
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
-</bpmn:definitions> \ No newline at end of file
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoHandleOofRequest.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoHandleOofRequest.bpmn
new file mode 100644
index 0000000000..7ca1a62312
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoHandleOofRequest.bpmn
@@ -0,0 +1,122 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_0nlt5gi" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.1.1">
+ <bpmn:process id="DoHandleOofRequest" name="DoHandleOofRequest" isExecutable="true">
+ <bpmn:startEvent id="StartEvent_1">
+ <bpmn:outgoing>Flow_1jorico</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:sequenceFlow id="Flow_1fbzzqg" sourceRef="Activity_0tki17o" targetRef="Activity_08ozlfa" />
+ <bpmn:scriptTask id="Activity_08ozlfa" name="Call Oof Adapter" scriptFormat="groovy">
+ <bpmn:incoming>Flow_1fbzzqg</bpmn:incoming>
+ <bpmn:outgoing>Flow_013jfci</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.common.scripts.*
+def oofHandler = new DoHandleOofRequest()
+oofHandler .callOofAdapter(execution)
+</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="Flow_1jorico" sourceRef="StartEvent_1" targetRef="Activity_0tki17o" />
+ <bpmn:scriptTask id="Activity_0tki17o" name="Preprocess Request" scriptFormat="groovy">
+ <bpmn:incoming>Flow_1jorico</bpmn:incoming>
+ <bpmn:outgoing>Flow_1fbzzqg</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.common.scripts.*
+def oofHandler = new DoHandleOofRequest()
+oofHandler .preProcessRequest(execution)
+</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:subProcess id="Activity_02ru8n9" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true">
+ <bpmn:startEvent id="Event_1r00tca">
+ <bpmn:outgoing>Flow_072knve</bpmn:outgoing>
+ <bpmn:errorEventDefinition id="ErrorEventDefinition_1sy4yh2" />
+ </bpmn:startEvent>
+ <bpmn:endEvent id="Event_1rwmekw">
+ <bpmn:incoming>Flow_0ykpxpc</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:scriptTask id="Activity_11rvko0" name="Handle Unexpected Error" scriptFormat="groovy">
+ <bpmn:incoming>Flow_072knve</bpmn:incoming>
+ <bpmn:outgoing>Flow_0ykpxpc</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.common.scripts.*
+ExceptionUtil ex = new ExceptionUtil()
+ex.processJavaException(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="Flow_0ykpxpc" sourceRef="Activity_11rvko0" targetRef="Event_1rwmekw" />
+ <bpmn:sequenceFlow id="Flow_072knve" sourceRef="Event_1r00tca" targetRef="Activity_11rvko0" />
+ </bpmn:subProcess>
+ <bpmn:callActivity id="Activity_1yq993l" name="Receive Async Callback" camunda:modelerTemplate="receiveWorkflowMessage" calledElement="ReceiveWorkflowMessage">
+ <bpmn:extensionElements>
+ <camunda:in source="true" target="isDebugLogEnabled" />
+ <camunda:out source="WorkflowException" target="WorkflowException" />
+ <camunda:in source="messageType" target="RCVWFMSG_messageType" />
+ <camunda:in source="correlator" target="RCVWFMSG_correlator" />
+ <camunda:in source="timeout" target="RCVWFMSG_timeout" />
+ <camunda:out source="WorkflowResponse" target="asyncCallbackResponse" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>Flow_013jfci</bpmn:incoming>
+ <bpmn:outgoing>Flow_1nmoiqi</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:sequenceFlow id="Flow_013jfci" sourceRef="Activity_08ozlfa" targetRef="Activity_1yq993l" />
+ <bpmn:endEvent id="Event_179tp7r" name="End event">
+ <bpmn:incoming>Flow_1nmoiqi</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="Flow_1nmoiqi" sourceRef="Activity_1yq993l" targetRef="Event_179tp7r" />
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoHandleOofRequest">
+ <bpmndi:BPMNEdge id="Flow_1jorico_di" bpmnElement="Flow_1jorico">
+ <di:waypoint x="218" y="130" />
+ <di:waypoint x="270" y="130" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1fbzzqg_di" bpmnElement="Flow_1fbzzqg">
+ <di:waypoint x="370" y="130" />
+ <di:waypoint x="450" y="130" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_013jfci_di" bpmnElement="Flow_013jfci">
+ <di:waypoint x="550" y="130" />
+ <di:waypoint x="641" y="130" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_1nmoiqi_di" bpmnElement="Flow_1nmoiqi">
+ <di:waypoint x="741" y="127" />
+ <di:waypoint x="832" y="127" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
+ <dc:Bounds x="182" y="112" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="154" y="142" width="87" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_1nfzvjq_di" bpmnElement="Activity_0tki17o">
+ <dc:Bounds x="270" y="90" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_0wi75kt_di" bpmnElement="Activity_08ozlfa">
+ <dc:Bounds x="450" y="90" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_1yq993l_di" bpmnElement="Activity_1yq993l">
+ <dc:Bounds x="641" y="87" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Event_179tp7r_di" bpmnElement="Event_179tp7r">
+ <dc:Bounds x="832" y="109" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="826" y="152" width="50" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_02ru8n9_di" bpmnElement="Activity_02ru8n9" isExpanded="true">
+ <dc:Bounds x="160" y="420" width="781" height="196" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="Flow_0ykpxpc_di" bpmnElement="Flow_0ykpxpc">
+ <di:waypoint x="554" y="524" />
+ <di:waypoint x="828" y="524" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_072knve_di" bpmnElement="Flow_072knve">
+ <di:waypoint x="226" y="524" />
+ <di:waypoint x="454" y="524" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="Event_1r00tca_di" bpmnElement="Event_1r00tca">
+ <dc:Bounds x="190" y="506" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Event_1rwmekw_di" bpmnElement="Event_1rwmekw">
+ <dc:Bounds x="828" y="506" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Activity_11rvko0_di" bpmnElement="Activity_11rvko0">
+ <dc:Bounds x="454" y="484" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/ServiceLevelUpgradeTest.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/ServiceLevelUpgradeTest.java
index 805597cd12..00dda299b6 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/ServiceLevelUpgradeTest.java
+++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/ServiceLevelUpgradeTest.java
@@ -20,7 +20,19 @@
package org.onap.so.bpmn.infrastructure.process;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.okJson;
+import static com.github.tomakehurst.wiremock.client.WireMock.post;
+import static com.github.tomakehurst.wiremock.client.WireMock.put;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
+import static org.assertj.core.api.Assertions.fail;
+import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat;
import com.google.protobuf.Struct;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
import org.camunda.bpm.engine.runtime.ProcessInstance;
import org.junit.Before;
import org.junit.Test;
@@ -35,14 +47,6 @@ import org.onap.so.bpmn.mock.FileUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-import static com.github.tomakehurst.wiremock.client.WireMock.*;
-import static org.assertj.core.api.Assertions.fail;
-import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat;
/**
* Basic Integration test for ServiceLevelUpgrade.bpmn workflow.
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/AbstractServiceLevelPreparable.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/ServiceLevelPreparable.java
index 0671354bd6..e26195158d 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/AbstractServiceLevelPreparable.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/ServiceLevelPreparable.java
@@ -20,32 +20,58 @@
package org.onap.so.bpmn.infrastructure.service.level;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.onap.so.bpmn.infrastructure.service.level.impl.ServiceLevelConstants;
import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.db.catalog.beans.Workflow;
+import org.onap.so.db.catalog.client.CatalogDbClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
-import java.util.ArrayList;
-import java.util.List;
/**
- * Abstract class for Service level upgrade Execution, it should be extended for service level upgrade tasks.
+ * Parent class for Service level upgrade Execution, it should be extended for service level upgrade tasks.
*/
-public abstract class AbstractServiceLevelPreparable {
+public class ServiceLevelPreparable {
- protected static final Logger LOG = LoggerFactory.getLogger(AbstractServiceLevelPreparable.class);
+ protected static final Logger LOG = LoggerFactory.getLogger(ServiceLevelPreparable.class);
@Autowired
protected ExceptionBuilder exceptionBuilder;
+ @Autowired
+ protected CatalogDbClient catalogDbClient;
+
/**
- * This method fetches workflow names to be invoked based on the controller scope .
+ * Fetches workflow names based on the controller scope and operation name.
*
* @param scope Controller scope
+ * @param operationName healthcheck/softwareUpgrade
* @return String value of Workflow name
*/
- protected abstract String fetchWorkflowUsingScope(DelegateExecution execution, final String scope);
+ protected String fetchWorkflowUsingScope(final String scope, String operationName) {
+ Optional<String> wflName = Optional.empty();
+ try {
+ List<Workflow> workflows = catalogDbClient.findWorkflowByOperationName(operationName);
+ if (!workflows.isEmpty()) {
+ wflName = Optional.ofNullable(
+ workflows.stream().filter(workflow -> workflow.getResourceTarget().equalsIgnoreCase(scope))
+ .findFirst().get().getName());
+ }
+ } catch (Exception e) {
+ // do nothing and assign the default workflow in finally
+ LOG.error("Error occurred while fetching workflow name from CatalogDb {}", e);
+ } finally {
+ if (wflName.isEmpty()) {
+ wflName = Optional.of(ServiceLevelConstants.WORKFLOW_OPERATIONS_MAP.get(operationName).get(scope));
+ }
+ }
+ return wflName.get();
+
+ }
/**
* This method validates the execution parameters to be passed for health check workflow.
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelConstants.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelConstants.java
index 34ebb308c3..d94641846d 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelConstants.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelConstants.java
@@ -1,5 +1,29 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
package org.onap.so.bpmn.infrastructure.service.level.impl;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
public class ServiceLevelConstants {
public static final String BPMN_REQUEST = "bpmnRequest";
public static final String RESOURCE_TYPE = "resourceType";
@@ -8,13 +32,27 @@ public class ServiceLevelConstants {
public static final String PNF = "pnf";
public static final String VNF = "vnf";
public static final String EMPTY_STRING = "";
- public static final String WORKFLOW_TO_INVOKE = "healthCheckWorkflow";
+ public static final String HEALTH_CHECK_WORKFLOW_TO_INVOKE = "healthCheckWorkflow";
public static final String SOFTWARE_WORKFLOW_TO_INVOKE = "softwareUpgradeWorkflow";
- public static final String GENERIC_PNF_HEALTH_CHECK_WORKFLOW = "GenericPnfHealthCheck";
- public static final String PNF_SOFTWARE_UPGRADE_WORKFLOW = "PNFSoftwareUpgrade";
+ public static final String HEALTH_CHECK_OPERATION = "ResourceHealthCheck";
+ public static final String SW_UP_OPERATION = "ResourceSoftwareUpgrade";
public static final String CONTROLLER_STATUS = "ControllerStatus";
public static final int ERROR_CODE = 601;
- // TODO This value needs to be updated once vnf health check workflow is available
- protected static final String GENERIC_VNF_HEALTH_CHECK_WORKFLOW = "GenericVNFHealthCheck";
+
+ // TODO GenericVNFHealthCheck and GenericVnfSoftwareUpgrade workflow names should be updated once the workflow is
+ // implemented.
+ public static final Map<String, String> DEFAULT_HEALTH_CHECK_WORKFLOWS =
+ Map.of(PNF, "GenericPnfHealthCheck", VNF, "GenericVNFHealthCheck");
+
+ public static final Map<String, String> DEFAULT_SOFTWARE_UP_WORKFLOWS =
+ Map.of(PNF, "PNFSoftwareUpgrade", VNF, "GenericVnfSoftwareUpgrade");
+
+ // Maps operation name with workflows
+ public static final Map<String, Map<String, String>> WORKFLOW_OPERATIONS_MAP = Map.of(HEALTH_CHECK_OPERATION,
+ DEFAULT_HEALTH_CHECK_WORKFLOWS, SW_UP_OPERATION, DEFAULT_SOFTWARE_UP_WORKFLOWS);
+
+ public static final List<String> VALID_CONTROLLER_SCOPE = Arrays.asList(PNF, VNF);
+
+
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelPreparation.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelPreparation.java
index 5b772760f0..59884ecbc2 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelPreparation.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelPreparation.java
@@ -20,59 +20,54 @@
package org.onap.so.bpmn.infrastructure.service.level.impl;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
-import org.onap.so.bpmn.infrastructure.service.level.AbstractServiceLevelPreparable;
+import org.onap.so.bpmn.infrastructure.service.level.ServiceLevelPreparable;
import org.springframework.stereotype.Component;
-import java.util.Arrays;
-import java.util.List;
+
/**
* Fetches health check workflow based on the controller_scope. Invoke the corresponding health check workflow after
* validation.
*/
@Component("ServiceLevelPreparation")
-public class ServiceLevelPreparation extends AbstractServiceLevelPreparable implements JavaDelegate {
+public class ServiceLevelPreparation extends ServiceLevelPreparable implements JavaDelegate {
- private static final List<String> PNF_HC_PARAMS = Arrays.asList(ServiceLevelConstants.SERVICE_INSTANCE_ID,
+ private static final List<String> PNF_HEALTH_CHECK_PARAMS = Arrays.asList(ServiceLevelConstants.SERVICE_INSTANCE_ID,
ServiceLevelConstants.RESOURCE_TYPE, ServiceLevelConstants.BPMN_REQUEST, ServiceLevelConstants.PNF_NAME);
+ // TODO Update the list with vnf health check parameters if any validation needed
+ private static final List<String> VNF_HEALTH_CHECK_PARAMS = Collections.emptyList();
+
+ private static final Map<String, List<String>> HEALTH_CHECK_PARAMS_MAP = Map.of(ServiceLevelConstants.PNF,
+ PNF_HEALTH_CHECK_PARAMS, ServiceLevelConstants.VNF, VNF_HEALTH_CHECK_PARAMS);
+
@Override
public void execute(DelegateExecution execution) throws Exception {
if (execution.hasVariable(ServiceLevelConstants.RESOURCE_TYPE)
&& execution.getVariable(ServiceLevelConstants.RESOURCE_TYPE) != null) {
final String controllerScope = (String) execution.getVariable(ServiceLevelConstants.RESOURCE_TYPE);
LOG.debug("Scope retrieved from delegate execution: " + controllerScope);
- final String wflName = fetchWorkflowUsingScope(execution, controllerScope);
- LOG.debug("Health check workflow fetched for the scope: {} is: {}", controllerScope, wflName);
-
- if (ServiceLevelConstants.PNF.equalsIgnoreCase(controllerScope)) {
- validateParamsWithScope(execution, controllerScope, PNF_HC_PARAMS);
+ if (ServiceLevelConstants.VALID_CONTROLLER_SCOPE.contains(controllerScope)) {
+ final String wflName =
+ fetchWorkflowUsingScope(controllerScope, ServiceLevelConstants.HEALTH_CHECK_OPERATION);
+ LOG.debug("Health check workflow fetched for the scope: {} is: {}", controllerScope, wflName);
+ validateParamsWithScope(execution, controllerScope, HEALTH_CHECK_PARAMS_MAP.get(controllerScope));
LOG.info("Parameters validated successfully for {}", wflName);
+ execution.setVariable(ServiceLevelConstants.HEALTH_CHECK_WORKFLOW_TO_INVOKE, wflName);
+ execution.setVariable(ServiceLevelConstants.CONTROLLER_STATUS, ServiceLevelConstants.EMPTY_STRING);
+ } else {
+ exceptionBuilder.buildAndThrowWorkflowException(execution, ServiceLevelConstants.ERROR_CODE,
+ "Invalid Controller scope to prepare resource level health check");
}
- execution.setVariable(ServiceLevelConstants.WORKFLOW_TO_INVOKE, wflName);
- execution.setVariable(ServiceLevelConstants.CONTROLLER_STATUS, ServiceLevelConstants.EMPTY_STRING);
} else {
exceptionBuilder.buildAndThrowWorkflowException(execution, ServiceLevelConstants.ERROR_CODE,
- "Controller scope not found to invoke resource level health check");
- }
- }
-
- @Override
- public String fetchWorkflowUsingScope(DelegateExecution execution, final String scope) {
- String wflName = null;
- switch (scope.toLowerCase()) {
- case ServiceLevelConstants.PNF:
- wflName = ServiceLevelConstants.GENERIC_PNF_HEALTH_CHECK_WORKFLOW;
- break;
- case ServiceLevelConstants.VNF:
- wflName = ServiceLevelConstants.GENERIC_VNF_HEALTH_CHECK_WORKFLOW;
- break;
- default:
- exceptionBuilder.buildAndThrowWorkflowException(execution, ServiceLevelConstants.ERROR_CODE,
- "No valid health check work flow retrieved for the scope: " + scope);
+ "Resource type not found in the execution to invoke resource level health check");
}
- return wflName;
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelUpgrade.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelUpgrade.java
index dfc77d6f0c..9d7d8efb65 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelUpgrade.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelUpgrade.java
@@ -1,34 +1,46 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix Foundation.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
package org.onap.so.bpmn.infrastructure.service.level.impl;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
-import org.onap.so.bpmn.infrastructure.service.level.AbstractServiceLevelPreparable;
+import org.onap.so.bpmn.infrastructure.service.level.ServiceLevelPreparable;
import org.springframework.stereotype.Component;
-import java.util.Arrays;
-import java.util.List;
@Component
-public class ServiceLevelUpgrade extends AbstractServiceLevelPreparable implements JavaDelegate {
+public class ServiceLevelUpgrade extends ServiceLevelPreparable implements JavaDelegate {
- private static final List<String> PNF_SWU_PARAMS = Arrays.asList(ServiceLevelConstants.SERVICE_INSTANCE_ID,
+ private static final List<String> PNF_SOFTWARE_UP_PARAMS = Arrays.asList(ServiceLevelConstants.SERVICE_INSTANCE_ID,
ServiceLevelConstants.RESOURCE_TYPE, ServiceLevelConstants.BPMN_REQUEST, ServiceLevelConstants.PNF_NAME);
- @Override
- protected String fetchWorkflowUsingScope(DelegateExecution execution, String scope) {
- String wflName = null;
- switch (scope.toLowerCase()) {
- case ServiceLevelConstants.PNF:
- wflName = ServiceLevelConstants.PNF_SOFTWARE_UPGRADE_WORKFLOW;
- break;
- case ServiceLevelConstants.VNF:
- wflName = ServiceLevelConstants.GENERIC_VNF_HEALTH_CHECK_WORKFLOW;
- break;
- default:
- exceptionBuilder.buildAndThrowWorkflowException(execution, ServiceLevelConstants.ERROR_CODE,
- "No valid health check work flow retrieved for the scope: " + scope);
- }
- return wflName;
- }
+ // TODO Update the list with vnf software upgrade parameters if any validation needed
+ private static final List<String> VNF_SOFTWARE_UP_PARAMS = Collections.emptyList();
+
+ private static final Map<String, List<String>> SOFTWARE_UP_PARAMS_MAP = Map.of(ServiceLevelConstants.PNF,
+ PNF_SOFTWARE_UP_PARAMS, ServiceLevelConstants.VNF, VNF_SOFTWARE_UP_PARAMS);
+
@Override
public void execute(DelegateExecution execution) throws Exception {
@@ -36,19 +48,20 @@ public class ServiceLevelUpgrade extends AbstractServiceLevelPreparable implemen
&& execution.getVariable(ServiceLevelConstants.RESOURCE_TYPE) != null) {
final String controllerScope = (String) execution.getVariable(ServiceLevelConstants.RESOURCE_TYPE);
LOG.debug("Scope retrieved from delegate execution: " + controllerScope);
- final String wflName = fetchWorkflowUsingScope(execution, controllerScope);
- LOG.debug("Health check workflow fetched for the scope: {} is: {}", controllerScope, wflName);
-
- if ("pnf".equalsIgnoreCase(controllerScope)) {
- validateParamsWithScope(execution, controllerScope, PNF_SWU_PARAMS);
+ if (ServiceLevelConstants.VALID_CONTROLLER_SCOPE.contains(controllerScope)) {
+ final String wflName = fetchWorkflowUsingScope(controllerScope, ServiceLevelConstants.SW_UP_OPERATION);
+ LOG.debug("Software Upgrade workflow fetched for the scope: {} is: {}", controllerScope, wflName);
+ validateParamsWithScope(execution, controllerScope, SOFTWARE_UP_PARAMS_MAP.get(controllerScope));
LOG.info("Parameters validated successfully for {}", wflName);
execution.setVariable(ServiceLevelConstants.SOFTWARE_WORKFLOW_TO_INVOKE, wflName);
execution.setVariable(ServiceLevelConstants.CONTROLLER_STATUS, "");
+ } else {
+ exceptionBuilder.buildAndThrowWorkflowException(execution, ServiceLevelConstants.ERROR_CODE,
+ "Invalid Controller scope for resource level software upgrade");
}
-
} else {
exceptionBuilder.buildAndThrowWorkflowException(execution, ServiceLevelConstants.ERROR_CODE,
- "Controller scope not found to invoke resource level health check");
+ "Resource type not found in the execution to invoke resource level software upgrade");
}
}
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/service/level/ServiceLevelPreparationTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/service/level/ServiceLevelPreparationTest.java
index 340b2776a4..0b1c5b0f5e 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/service/level/ServiceLevelPreparationTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/service/level/ServiceLevelPreparationTest.java
@@ -20,6 +20,13 @@
package org.onap.so.bpmn.infrastructure.service.level;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.when;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
@@ -27,23 +34,16 @@ import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
-import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Spy;
+import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.bpmn.infrastructure.service.level.impl.ServiceLevelConstants;
import org.onap.so.bpmn.infrastructure.service.level.impl.ServiceLevelPreparation;
import org.onap.so.client.exception.ExceptionBuilder;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import static org.assertj.core.api.Assertions.assertThat;
+import org.onap.so.db.catalog.beans.Workflow;
-@RunWith(SpringJUnit4ClassRunner.class)
-@ContextConfiguration(classes = {ServiceLevelPreparation.class, ExceptionBuilder.class})
-public class ServiceLevelPreparationTest {
+public class ServiceLevelPreparationTest extends BaseTaskTest {
private static final String TEST_PNF_SCOPE = "pnf";
private static final String TEST_PROCESS_KEY = "testProcessKey";
@@ -52,42 +52,29 @@ public class ServiceLevelPreparationTest {
private static final String RESOURCE_TYPE = "resourceType";
private static final String SERVICE_INSTANCE_ID = "serviceInstanceId";
private static final String PNF_NAME = "pnfName";
- private static final List<String> PNF_HEALTH_CHECK_PARAMS = Arrays.asList(ServiceLevelConstants.SERVICE_INSTANCE_ID,
- ServiceLevelConstants.RESOURCE_TYPE, ServiceLevelConstants.BPMN_REQUEST, ServiceLevelConstants.PNF_NAME);
+ private static final String HEALTH_CHECK_OPERATION = "ResourceHealthCheck";
+ private static final String PNF_HEALTH_CHECK_WORKFLOW = "PNFHealthCheck";
+ private static final Map<String, List<String>> HEALTH_CHECK_PARAMS_MAP = Map.of(TEST_PNF_SCOPE,
+ Arrays.asList(SERVICE_INSTANCE_ID, RESOURCE_TYPE, BPMN_REQUEST, PNF_NAME), "vnf", Collections.emptyList());
+
+ private List<Workflow> workflowList = new ArrayList<>();
- private Map<String, String> pnfHealthCheckTestParams = new HashMap<>();
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
- @Autowired
+ @InjectMocks
private ServiceLevelPreparation serviceLevelPrepare;
- @Autowired
+ @InjectMocks
+ @Spy
private ExceptionBuilder exceptionBuilder;
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
private DelegateExecution execution = new DelegateExecutionFake();
private DelegateExecution invalidExecution = new DelegateExecutionFake();
@Before
public void setUpPnfUpgradeTest() {
- pnfHealthCheckTestParams.put("TEST_SERVICE_MODEL_INFO", "d4c6855e-3be2-5dtu-9390-c999a38829bc");
- pnfHealthCheckTestParams.put("TEST_SERVICE_INSTANCE_NAME", "test_service_id");
- pnfHealthCheckTestParams.put("TEST_PNF_CORRELATION_ID", "pnfCorrelationId");
- pnfHealthCheckTestParams.put("TEST_MODEL_UUID", "6bc0b04d-1873-4721-b53d-6615225b2a28");
- pnfHealthCheckTestParams.put("TEST_PNF_UUID", "c93g70d9-8de3-57f1-7de1-f5690ac2b005");
- pnfHealthCheckTestParams.put("TEST_PRC_BLUEPRINT_NAME", "serviceUpgrade");
- pnfHealthCheckTestParams.put("TEST_PRC_BLUEPRINT_VERSION", "1.0.2");
- pnfHealthCheckTestParams.put("TEST_PRC_CUSTOMIZATION_UUID", "PRC_customizationUuid");
- pnfHealthCheckTestParams.put("TEST_RESOURCE_CUSTOMIZATION_UUID_PARAM", "9acb3a83-8a52-412c-9a45-901764938144");
- pnfHealthCheckTestParams.put("TEST_PRC_INSTANCE_NAME", "Demo_pnf");
- pnfHealthCheckTestParams.put("TEST_PRC_CONTROLLER_ACTOR", "cds");
- pnfHealthCheckTestParams.put("TEST_REQUEST_PAYLOAD", "test_payload");
-
- for (String param : PNF_HEALTH_CHECK_PARAMS) {
- execution.setVariable(param, pnfHealthCheckTestParams.get("TEST_" + param));
- }
execution.setVariable(RESOURCE_TYPE, TEST_PNF_SCOPE);
execution.setVariable(TEST_PROCESS_KEY, PROCESS_KEY_VALUE);
execution.setVariable(BPMN_REQUEST, "bpmnRequestValue");
@@ -95,14 +82,22 @@ public class ServiceLevelPreparationTest {
execution.setVariable(PNF_NAME, "PnfDemo");
invalidExecution.setVariables(execution.getVariables());
+
+ Workflow pnfWorkflow = new Workflow();
+ pnfWorkflow.setName(PNF_HEALTH_CHECK_WORKFLOW);
+ pnfWorkflow.setOperationName(HEALTH_CHECK_OPERATION);
+ pnfWorkflow.setResourceTarget(TEST_PNF_SCOPE);
+ workflowList.add(pnfWorkflow);
+
+ when(catalogDbClient.findWorkflowByOperationName(HEALTH_CHECK_OPERATION)).thenReturn(workflowList);
}
@Test
public void executePnfUpgradeSuccessTest() throws Exception {
serviceLevelPrepare.execute(execution);
// Expect the pnf health check workflow to be set in to execution if validation is successful
- assertThat(String.valueOf(execution.getVariable(ServiceLevelConstants.WORKFLOW_TO_INVOKE)))
- .isEqualTo("GenericPnfHealthCheck");
+ assertThat(String.valueOf(execution.getVariable(ServiceLevelConstants.HEALTH_CHECK_WORKFLOW_TO_INVOKE)))
+ .isEqualTo("PNFHealthCheck");
}
@Test
@@ -110,7 +105,8 @@ public class ServiceLevelPreparationTest {
invalidExecution.removeVariable(BPMN_REQUEST);
// BPMN exception is thrown in case of validation failure or invalid execution
thrown.expect(BpmnError.class);
- serviceLevelPrepare.validateParamsWithScope(invalidExecution, TEST_PNF_SCOPE, PNF_HEALTH_CHECK_PARAMS);
+ serviceLevelPrepare.validateParamsWithScope(invalidExecution, TEST_PNF_SCOPE,
+ HEALTH_CHECK_PARAMS_MAP.get(TEST_PNF_SCOPE));
}
@Test
@@ -129,6 +125,32 @@ public class ServiceLevelPreparationTest {
}
+ @Test
+ public void validateDefaultWorkflowIsSetWithoutDBData() throws Exception {
+ // Mock empty workflow list in db response
+ when(catalogDbClient.findWorkflowByOperationName(HEALTH_CHECK_OPERATION)).thenReturn(new ArrayList<Workflow>());
+ serviceLevelPrepare.execute(execution);
+ // Expect default workflow gets assigned when workflow name not found in db.
+ assertThat(String.valueOf(execution.getVariable(ServiceLevelConstants.HEALTH_CHECK_WORKFLOW_TO_INVOKE)))
+ .isEqualTo(ServiceLevelConstants.DEFAULT_HEALTH_CHECK_WORKFLOWS.get(TEST_PNF_SCOPE));
+ }
+
+ @Test
+ public void validateWorkflowSetFromDb() throws Exception {
+ Workflow vnfWorkflow = new Workflow();
+ vnfWorkflow.setName("VNFHealthCheck");
+ vnfWorkflow.setOperationName(HEALTH_CHECK_OPERATION);
+ vnfWorkflow.setResourceTarget("vnf");
+ workflowList.add(vnfWorkflow);
+ // Mock db response with multiple worklfows mapped with same operation name
+ when(catalogDbClient.findWorkflowByOperationName(HEALTH_CHECK_OPERATION)).thenReturn(workflowList);
+ serviceLevelPrepare.execute(execution);
+
+ // Expect right workflow gets assigned from db based on the controller scope.
+ assertThat(String.valueOf(execution.getVariable(ServiceLevelConstants.HEALTH_CHECK_WORKFLOW_TO_INVOKE)))
+ .isEqualTo(PNF_HEALTH_CHECK_WORKFLOW);
+ }
+
}