diff options
Diffstat (limited to 'bpmn')
68 files changed, 7545 insertions, 2264 deletions
diff --git a/bpmn/MSOCommonBPMN/pom.xml b/bpmn/MSOCommonBPMN/pom.xml index 669a3cb353..32e7d4a6ac 100644 --- a/bpmn/MSOCommonBPMN/pom.xml +++ b/bpmn/MSOCommonBPMN/pom.xml @@ -15,7 +15,7 @@ <properties> <camunda.version>7.8.0</camunda.version> <spring.version>4.3.2.RELEASE</spring.version> - <httpclient.version>3.1</httpclient.version> + <httpclient.version>4.5.5</httpclient.version> <jax.ws.rs>2.0.1</jax.ws.rs> <jackson.version>1.1.1</jackson.version> <maven.compiler.target>1.8</maven.compiler.target> @@ -350,11 +350,26 @@ <artifactId>spring-test</artifactId> <version>4.3.14.RELEASE</version> </dependency> - <dependency> - <groupId>org.onap.sdc.sdc-tosca</groupId> - <artifactId>sdc-tosca</artifactId> - <version>1.3.3</version> - </dependency> + <dependency> + <groupId>org.onap.sdc.sdc-tosca</groupId> + <artifactId>sdc-tosca</artifactId> + <version>1.3.3</version> + <!-- sdc-tosca:1.3.3 depends on jtosca:1.3.4-SNAPSHOT, + which must be excluded, and the release version + of jtosca must be pulled in using an additional + dependency, below --> + <exclusions> + <exclusion> + <groupId>org.onap.sdc.jtosca</groupId> + <artifactId>jtosca</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.onap.sdc.jtosca</groupId> + <artifactId>jtosca</artifactId> + <version>1.3.4</version> + </dependency> <dependency> <groupId>org.camunda.bpm</groupId> <artifactId>camunda-engine-spring</artifactId> @@ -371,8 +386,8 @@ <version>1.6.12</version> </dependency> <dependency> - <groupId>commons-httpclient</groupId> - <artifactId>commons-httpclient</artifactId> + <groupId>org.apache.httpcomponents</groupId> + <artifactId>httpclient</artifactId> <version>${httpclient.version}</version> </dependency> <dependency> @@ -395,15 +410,18 @@ <artifactId>spring-web</artifactId> <version>${spring.version}</version> </dependency> + <!-- bwj: duplicated one <dependency> <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId> <version>${spring.version}</version> </dependency> + --> + <!-- bwj: added --> <dependency> - <groupId>commons-httpclient</groupId> - <artifactId>commons-httpclient</artifactId> - <version>${httpclient.version}</version> + <groupId>com.googlecode.libphonenumber</groupId> + <artifactId>libphonenumber</artifactId> + <version>8.9.1</version> </dependency> <dependency> <groupId>javax.ws.rs</groupId> @@ -413,7 +431,7 @@ <dependency> <groupId>org.onap.appc.client</groupId> <artifactId>client-lib</artifactId> - <version>1.3.0-SNAPSHOT</version> + <version>1.3.0</version> </dependency> <dependency> <groupId>org.onap.appc.client</groupId> diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/Homing.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/Homing.groovy deleted file mode 100755 index 2325e6c3d3..0000000000 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/Homing.groovy +++ /dev/null @@ -1,274 +0,0 @@ -/*
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-package org.openecomp.mso.bpmn.common.scripts
-
-import org.camunda.bpm.engine.delegate.BpmnError
-import org.camunda.bpm.engine.delegate.DelegateExecution
-
-import org.openecomp.mso.bpmn.common.scripts.AaiUtil
-import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil
-import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils
-import org.openecomp.mso.bpmn.core.domain.InventoryType
-import org.openecomp.mso.bpmn.core.domain.Resource
-import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition
-import org.openecomp.mso.bpmn.core.domain.Subscriber
-import org.openecomp.mso.bpmn.core.domain.VnfResource
-import org.openecomp.mso.bpmn.core.json.JsonUtils
-import org.openecomp.mso.rest.APIResponse
-import org.openecomp.mso.rest.RESTClient
-import org.openecomp.mso.rest.RESTConfig
-import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor
-
-import org.json.JSONArray
-import org.json.JSONObject
-
-import static org.openecomp.mso.bpmn.common.scripts.GenericUtils.*;
-
-/**
- * This class is contains the scripts used
- * by the Homing Subflow building block. The
- * subflow attempts to home the provided
- * resources by calling sniro.
- *
- * @author cb645j
- *
- */
-class Homing extends AbstractServiceTaskProcessor{
-
- 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){
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- execution.setVariable("prefix","HOME_")
- utils.log("DEBUG", "*** Started Homing Call Sniro ***", isDebugEnabled)
- try{
- execution.setVariable("rollbackData", null)
- execution.setVariable("rolledBack", false)
-
- String requestId = execution.getVariable("msoRequestId")
- utils.log("DEBUG", "Incoming Request Id is: " + requestId, isDebugEnabled)
- String serviceInstanceId = execution.getVariable("serviceInstanceId")
- utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled)
- ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
- utils.log("DEBUG", "Incoming Service Decomposition is: " + serviceDecomposition, isDebugEnabled)
- String subscriberInfo = execution.getVariable("subscriberInfo")
- utils.log("DEBUG", "Incoming Subscriber Information is: " + subscriberInfo, isDebugEnabled)
-
- 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
- def authHeader = ""
- String basicAuth = execution.getVariable("URN_mso_sniro_auth")
- String msokey = execution.getVariable("URN_mso_msoKey")
- String basicAuthValue = utils.encrypt(basicAuth, msokey)
- if(basicAuthValue != null){
- utils.log("DEBUG", "Obtained BasicAuth username and password for SNIRO Adapter: " + basicAuthValue, isDebugEnabled)
- try {
- authHeader = utils.getBasicAuth(basicAuthValue, msokey)
- execution.setVariable("BasicAuthHeaderValue",authHeader)
- } catch (Exception ex) {
- utils.log("DEBUG", "Unable to encode username and password string: " + ex, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - Unable to encode username and password string")
- }
- }else{
- utils.log("DEBUG", "Unable to obtain BasicAuth - BasicAuth value null" , isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - BasicAuth value null")
- }
-
- //Prepare Callback
- String timeout = execution.getVariable("timeout")
- if(isBlank(timeout)){
- timeout = execution.getVariable("URN_mso_sniro_timeout");
- if(isBlank(timeout)) {
- timeout = "PT30M";
- }
- }
- utils.log("DEBUG", "Async Callback Timeout will be: " + timeout, isDebugEnabled)
-
- 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)
- utils.log("DEBUG", "SNIRO Request is: " + sniroRequest, isDebugEnabled)
-
- String endpoint = execution.getVariable("URN_mso_service_agnostic_sniro_endpoint")
- String host = execution.getVariable("URN_mso_service_agnostic_sniro_host")
- String url = host + endpoint
- utils.log("DEBUG", "Posting to Sniro Url: " + url, isDebugEnabled)
-
- logDebug( "URL to be used is: " + url, isDebugEnabled)
-
- RESTConfig config = new RESTConfig(url);
- RESTClient client = new RESTClient(config).addAuthorizationHeader(authHeader).addHeader("Content-Type", "application/json")
- APIResponse response = client.httpPost(sniroRequest)
-
- int responseCode = response.getStatusCode()
- execution.setVariable("syncResponseCode", responseCode);
- logDebug("SNIRO sync response code is: " + responseCode, isDebugEnabled)
- String syncResponse = response.getResponseBodyAsString()
- execution.setVariable("syncResponse", syncResponse);
- logDebug("SNIRO sync response is: " + syncResponse, isDebugEnabled)
-
- utils.log("DEBUG", "*** Completed Homing Call Sniro ***", isDebugEnabled)
- }
- }catch(BpmnError b){
- throw b
- }catch(Exception e){
- utils.log("DEBUG", "Error encountered within Homing CallSniro method: " + e, isDebugEnabled)
- 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){
- def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
- utils.log("DEBUG", "*** Started Homing Process Homing Solution ***", isDebugEnabled)
- try{
- String response = execution.getVariable("asyncCallbackResponse")
- utils.log("DEBUG", "Sniro Async Callback Response is: " + response, isDebugEnabled)
- utils.logAudit("Sniro Async Callback Response is: " + response)
-
- sniroUtils.validateCallbackResponse(execution, response)
- String placements = jsonUtil.getJsonValue(response, "solutionInfo.placementInfo")
-
- ServiceDecomposition decomposition = execution.getVariable("serviceDecomposition")
- utils.log("DEBUG", "Service Decomposition: " + decomposition, isDebugEnabled)
-
- List<Resource> resourceList = decomposition.getServiceResources()
- 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)
- execution.setVariable("homingSolution", placements) //TODO - can be removed as output variable
-
- utils.log("DEBUG", "*** Completed Homing Process Homing Solution ***", isDebugEnabled)
- }catch(BpmnError b){
- throw b
- }catch(Exception e){
- utils.log("DEBUG", "Error encountered within Homing ProcessHomingSolution method: " + e, isDebugEnabled)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in Homing ProcessHomingSolution")
- }
- }
-
- /**
- * This method logs the start of DHVCreateService
- * to make debugging easier.
- *
- * @param - execution
- * @author cb645j
- */
- public String logStart(DelegateExecution execution){
- def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
- String requestId = execution.getVariable("testReqId")
- if(isBlank(requestId)){
- requestId = execution.getVariable("msoRequestId")
- }
- execution.setVariable("DHVCS_requestId", requestId)
- utils.log("DEBUG", "***** STARTED Homing Subflow for request: " + requestId + " *****", "true")
- utils.log("DEBUG", "****** Homing Subflow Global Debug Enabled: " + isDebugEnabled + " *****", "true")
- utils.logAudit("***** STARTED Homing Subflow for request: " + requestId + " *****")
- }
-
-
- /**
- * Auto-generated method stub
- */
- public void preProcessRequest(DelegateExecution execution){}
-
-}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/OofHoming.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/OofHoming.groovy new file mode 100644 index 0000000000..5e7ed982a6 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/OofHoming.groovy @@ -0,0 +1,289 @@ +/* + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.openecomp.mso.bpmn.common.scripts + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution; + +import org.openecomp.mso.bpmn.common.scripts.AaiUtil +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil +import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils +import org.openecomp.mso.bpmn.core.domain.InventoryType +import org.openecomp.mso.bpmn.core.domain.Resource +import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition +import org.openecomp.mso.bpmn.core.domain.Subscriber +import org.openecomp.mso.bpmn.core.domain.VnfResource +import org.openecomp.mso.bpmn.core.json.JsonUtils +import org.openecomp.mso.rest.APIResponse +import org.openecomp.mso.rest.RESTClient +import org.openecomp.mso.rest.RESTConfig +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor + +import org.json.JSONArray +import org.json.JSONObject + +import static org.openecomp.mso.bpmn.common.scripts.GenericUtils.* + +/** + * This class contains the scripts used + * by the OOF Homing Subflow building block. The + * subflow attempts to home the provided + * resources by calling OOF. + */ +class OofHoming extends AbstractServiceTaskProcessor { + + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + OofUtils oofUtils = new OofUtils(this) + + /** + * This method validates the incoming variables. + * The method then prepares the OOF request + * and posts it to OOF's rest api. + * + * @param execution + */ + public void callOof(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix", "HOME_") + utils.log("DEBUG", "*** Started Homing Call OOF ***", isDebugEnabled) + try { + execution.setVariable("rollbackData", null) + execution.setVariable("rolledBack", false) + + String requestId = execution.getVariable("msoRequestId") + utils.log("DEBUG", "Incoming Request Id is: " + requestId, isDebugEnabled) + String serviceInstanceId = execution.getVariable("serviceInstanceId") + utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled) + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + utils.log("DEBUG", "Incoming Service Decomposition is: " + serviceDecomposition, isDebugEnabled) + String subscriberInfo = execution.getVariable("subscriberInfo") + utils.log("DEBUG", "Incoming Subscriber Information is: " + subscriberInfo, isDebugEnabled) + Map customerLocation = execution.getVariable("customerLocation") + utils.log("DEBUG", "Incoming Customer Location is: " + customerLocation.toString(), isDebugEnabled) + String cloudOwner = execution.getVariable("cloudOwner") + utils.log("DEBUG", "Incoming cloudOwner is: " + cloudOwner, isDebugEnabled) + String cloudRegionId = execution.getVariable("cloudRegionId") + utils.log("DEBUG", "Incoming cloudRegionId is: " + cloudRegionId, isDebugEnabled) + + if (isBlank(requestId) || + isBlank(serviceInstanceId) || + isBlank(serviceDecomposition.toString()) || + isBlank(subscriberInfo) || + isBlank(customerLocation.toString()) || + isBlank(cloudOwner) || + isBlank(cloudRegionId)) { + 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) + + //Authentication + def authHeader = "" + String basicAuth = execution.getVariable("URN_mso_oof_auth") + String msokey = execution.getVariable("URN_mso_msoKey") + String basicAuthValue = utils.encrypt(basicAuth, msokey) + if (basicAuthValue != null) { + utils.log("DEBUG", "Obtained BasicAuth username and password for OOF Adapter: " + basicAuthValue, + isDebugEnabled) + try { + authHeader = utils.getBasicAuth(basicAuthValue, msokey) + execution.setVariable("BasicAuthHeaderValue", authHeader) + } catch (Exception ex) { + utils.log("DEBUG", "Unable to encode username and password string: " + ex, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - Unable to " + + "encode username and password string") + } + } else { + utils.log("DEBUG", "Unable to obtain BasicAuth - BasicAuth value null", isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - BasicAuth " + + "value null") + } + + //Prepare Callback + String timeout = execution.getVariable("timeout") + if (isBlank(timeout)) { + timeout = execution.getVariable("URN_mso_oof_timeout"); + if (isBlank(timeout)) { + timeout = "PT30M" + } + } + utils.log("DEBUG", "Async Callback Timeout will be: " + timeout, isDebugEnabled) + + execution.setVariable("timeout", timeout) + execution.setVariable("correlator", requestId) + execution.setVariable("messageType", "oofResponse") + + //Build Request & Call OOF + String oofRequest = oofUtils.buildRequest(execution, requestId, serviceDecomposition, + subscriber, customerLocation) + execution.setVariable("oofRequest", oofRequest) + utils.log("DEBUG", "OOF Request is: " + oofRequest, isDebugEnabled) + + String endpoint = execution.getVariable("URN_mso_service_agnostic_oof_endpoint") + String host = execution.getVariable("URN_mso_service_agnostic_oof_host") + String url = host + endpoint + utils.log("DEBUG", "Posting to OOF Url: " + url, isDebugEnabled) + + logDebug("URL to be used is: " + url, isDebugEnabled) + + RESTConfig config = new RESTConfig(url) + RESTClient client = new RESTClient(config).addAuthorizationHeader(authHeader). + addHeader("Content-Type", "application/json") + APIResponse response = client.httpPost(oofRequest) + + int responseCode = response.getStatusCode() + execution.setVariable("syncResponseCode", responseCode) + logDebug("OOF sync response code is: " + responseCode, isDebugEnabled) + String syncResponse = response.getResponseBodyAsString() + execution.setVariable("syncResponse", syncResponse) + logDebug("OOF sync response is: " + syncResponse, isDebugEnabled) + + utils.log("DEBUG", "*** Completed Homing Call OOF ***", isDebugEnabled) + } + } catch (BpmnError b) { + throw b + } catch (Exception e) { + utils.log("DEBUG", "Error encountered within Homing callOof method: " + e, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, + "Internal Error - Occured in Homing callOof: " + 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 + */ + public void processHomingSolution(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", "*** Started Homing Process Homing Solution ***", isDebugEnabled) + try { + String response = execution.getVariable("asyncCallbackResponse") + utils.log("DEBUG", "OOF Async Callback Response is: " + response, isDebugEnabled) + utils.logAudit("OOF Async Callback Response is: " + response) + + oofUtils.validateCallbackResponse(execution, response) + String placements = jsonUtil.getJsonValue(response, "solutions.placementSolutions") + utils.log("DEBUG", "****** Solution Placements: " + placements + " *****", isDebugEnabled) + + ServiceDecomposition decomposition = execution.getVariable("serviceDecomposition") + utils.log("DEBUG", "Service Decomposition: " + decomposition, isDebugEnabled) + + List<Resource> resourceList = decomposition.getServiceResources() + JSONArray arr = new JSONArray(placements) + for (int i = 0; i < arr.length(); i++) { + JSONObject placement = arr.getJSONObject(i) + utils.log("DEBUG", "****** JSONObject is: " + placement + " *****", "true") + String jsonServiceResourceId = placement.getString("serviceResourceId") + for (Resource resource : resourceList) { + String serviceResourceId = resource.getResourceId() + if (serviceResourceId.equalsIgnoreCase(jsonServiceResourceId)) { + JSONObject solution = placement.getJSONObject("solution") + String solutionType = solution.getString("identifierType") + String inventoryType = "" + if (solutionType.equalsIgnoreCase("serviceInstanceId")) { + inventoryType = "service" + } else { + inventoryType = "cloud" + + } + resource.getHomingSolution().setInventoryType(InventoryType.valueOf(inventoryType)) + + // TODO Deal with Placement Solutions & Assignment Info here + JSONArray assignmentArr = placement.getJSONArray("assignmentInfo") + Map<String, String> assignmentMap = jsonUtil.entryArrayToMap(execution, assignmentArr.toString(), "key", "value") + resource.getHomingSolution().setCloudOwner(assignmentMap.get("cloudOwner")) + resource.getHomingSolution().setCloudRegionId(assignmentMap.get("cloudRegionId")) + if (inventoryType.equalsIgnoreCase("service")) { + resource.getHomingSolution().setRehome(assignmentMap.get("isRehome").toBoolean()) + VnfResource vnf = new VnfResource() + vnf.setVnfHostname(assignmentMap.get("vnfHostName")) + resource.getHomingSolution().setVnf(vnf) + resource.getHomingSolution().setServiceInstanceId(solution.getJSONArray("identifiers")[0].toString()) + } + } + } + } + if (JsonUtils.jsonElementExist(response, "solutions.licenseSolutions")) { + String licenseSolutions = jsonUtil.getJsonValue(response, "solutions.licenseSolutions") + JSONArray licenseArr = new JSONArray(licenseSolutions) + 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)) { + String jsonEntitlementPoolList = jsonUtil.getJsonValue(license.toString(), "entitlementPoolUUID") + List<String> entitlementPoolList = jsonUtil.StringArrayToList(execution, jsonEntitlementPoolList) + resource.getHomingSolution().getLicense().setEntitlementPoolList(entitlementPoolList) + + String jsonLicenseKeyGroupList = jsonUtil.getJsonValue(license.toString(), "licenseKeyGroupUUID") + List<String> licenseKeyGroupList = jsonUtil.StringArrayToList(execution, jsonLicenseKeyGroupList) + resource.getHomingSolution().getLicense().setLicenseKeyGroupList(licenseKeyGroupList) + } + } + } + } + execution.setVariable("serviceDecomposition", decomposition) + execution.setVariable("homingSolution", placements) //TODO - can be removed as output variable + + utils.log("DEBUG", "*** Completed Homing Process Homing Solution ***", isDebugEnabled) + } catch (BpmnError b) { + throw b + } catch (Exception e) { + utils.log("DEBUG", "Error encountered within Homing ProcessHomingSolution method: " + e, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occurred in Homing ProcessHomingSolution") + } + } + + /** + * This method logs the start of DHVCreateService + * to make debugging easier. + * + * @param - execution + */ + public String logStart(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + String requestId = execution.getVariable("testReqId") + if (isBlank(requestId)) { + requestId = execution.getVariable("msoRequestId") + } + execution.setVariable("DHVCS_requestId", requestId) + utils.log("DEBUG", "***** STARTED Homing Subflow for request: " + requestId + " *****", "true") + utils.log("DEBUG", "****** Homing Subflow Global Debug Enabled: " + isDebugEnabled + " *****", "true") + utils.logAudit("***** STARTED Homing Subflow for request: " + requestId + " *****") + } + + /** + * Auto-generated method stub + */ + public void preProcessRequest(DelegateExecution execution) {} + // Not Implemented Method +} diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/OofUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/OofUtils.groovy new file mode 100644 index 0000000000..fc7c62baa7 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/OofUtils.groovy @@ -0,0 +1,405 @@ +package org.openecomp.mso.bpmn.common.scripts + +import org.apache.commons.lang3.StringUtils +import org.camunda.bpm.engine.delegate.DelegateExecution; +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil +import org.openecomp.mso.bpmn.common.scripts.MsoUtils +import org.openecomp.mso.bpmn.core.domain.HomingSolution +import org.openecomp.mso.bpmn.core.domain.ModelInfo +import org.openecomp.mso.bpmn.core.domain.Resource +import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition +import org.openecomp.mso.bpmn.core.domain.ServiceInstance +import org.openecomp.mso.bpmn.core.domain.Subscriber +import org.openecomp.mso.bpmn.core.domain.VnfResource +import org.openecomp.mso.bpmn.core.json.JsonUtils + +import static org.openecomp.mso.bpmn.common.scripts.GenericUtils.* + +class OofUtils { + + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + + private AbstractServiceTaskProcessor utils + + public MsoUtils msoUtils = new MsoUtils() + + public OofUtils(AbstractServiceTaskProcessor taskProcessor) { + this.utils = taskProcessor + } + + /** + * This method builds the service-agnostic + * OOF json request to get a homing solution + * and license solution + * + * @param execution + * @param requestId + * @param decomposition - ServiceDecomposition object + * @param customerLocation - + * @param existingCandidates - + * @param excludedCandidates - + * @param requiredCandidates - + * + * @return request - OOF v1 payload - https://wiki.onap.org/pages/viewpage.action?pageId=25435066 + */ + String buildRequest(DelegateExecution execution, + String requestId, + ServiceDecomposition decomposition, + Subscriber subscriber, + Map customerLocation, + ArrayList existingCandidates = null, + ArrayList excludedCandidates = null, + ArrayList requiredCandidates = null) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", "Started Building OOF Request", isDebugEnabled) + def callbackUrl = utils.createWorkflowMessageAdapterCallbackURL(execution, "oofResponse", requestId) + def transactionId = requestId + //ServiceInstance Info + ServiceInstance serviceInstance = decomposition.getServiceInstance() + def serviceInstanceId = "" + def serviceInstanceName = "" + if (serviceInstance == null) { + utils.log("DEBUG", "Unable to obtain Service Instance Id, ServiceInstance Object is null", isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - Unable to " + + "obtain Service Instance Id, ServiceInstance Object is null") + } else { + serviceInstanceId = serviceInstance.getInstanceId() + serviceInstanceName = serviceInstance.getInstanceName() + } + //Model Info + ModelInfo model = decomposition.getModelInfo() + String modelType = model.getModelType() + String modelInvariantId = model.getModelInvariantUuid() + String modelVersionId = model.getModelUuid() + String modelName = model.getModelName() + String modelVersion = model.getModelVersion() + //Subscriber Info + String subscriberId = subscriber.getGlobalId() + String subscriberName = subscriber.getName() + String commonSiteId = subscriber.getCommonSiteId() + + //Determine RequestType + //TODO Figure out better way to determine this + String requestType = "create" + List<Resource> resources = decomposition.getServiceResources() + for(Resource r:resources){ + HomingSolution currentSolution = (HomingSolution) r.getCurrentHomingSolution() + if(currentSolution != null){ + requestType = "speed changed" + } + } + + //Demands + String placementDemands = "" + StringBuilder sb = new StringBuilder() + List<Resource> resourceList = decomposition.getServiceAllottedResources() + List<VnfResource> vnfResourceList = decomposition.getServiceVnfs() + + if (resourceList.isEmpty() || resourceList == null) { + utils.log("DEBUG", "Allotted Resources List is empty - will try to get service VNFs instead.", + isDebugEnabled) + resourceList = decomposition.getServiceVnfs() + } + + if (resourceList.isEmpty() || resourceList == null) { + utils.log("DEBUG", "Resources List is Empty", isDebugEnabled) + } else { + for (Resource resource : resourceList) { + ModelInfo resourceModelInfo = resource.getModelInfo() + def serviceResourceId = resource.getResourceId() + def resourceModuleName = resource.getResourceType() + def resouceModelInvariantId = resourceModelInfo.getModelInvariantUuid() + def resouceModelName = resourceModelInfo.getModelName() + def resouceModelVersion = resourceModelInfo.getModelVersion() + def resouceModelVersionId = resourceModelInfo.getModelUuid() + def resouceModelType = resourceModelInfo.getModelType() + def tenantId = execution.getTenantId() + def requiredCandidatesJson = "" + + requiredCandidatesJson = createCandidateJson( + existingCandidates, + excludedCandidates, + requiredCandidates) + + String demand = + "{\n" + + "\"resourceModuleName\": \"${resourceModuleName}\",\n" + + "\"serviceResourceId\": \"${serviceResourceId}\",\n" + + "\"tenantId\": \"${tenantId}\",\n" + + "\"resourceModelInfo\": {\n" + + " \"modelInvariantId\": \"${resouceModelInvariantId}\",\n" + + " \"modelVersionId\": \"${resouceModelVersionId}\",\n" + + " \"modelName\": \"${resouceModelName}\",\n" + + " \"modelType\": \"${resouceModelType}\",\n" + + " \"modelVersion\": \"${resouceModelVersion}\",\n" + + " \"modelCustomizationName\": \"\"\n" + + " }" + requiredCandidatesJson + "\n" + + "}," + + placementDemands = sb.append(demand) + } + placementDemands = placementDemands.substring(0, placementDemands.length() - 1) + } + + String licenseDemands = "" + sb = new StringBuilder() + if (vnfResourceList.isEmpty() || vnfResourceList == null) { + utils.log("DEBUG", "Vnf Resources List is Empty", isDebugEnabled) + } else { + for (VnfResource vnfResource : vnfResourceList) { + ModelInfo vnfResourceModelInfo = vnfResource.getModelInfo() + def resourceInstanceType = vnfResource.getResourceType() + def serviceResourceId = vnfResource.getResourceId() + def resourceModuleName = vnfResource.getResourceType() + def resouceModelInvariantId = vnfResourceModelInfo.getModelInvariantUuid() + def resouceModelName = vnfResourceModelInfo.getModelName() + def resouceModelVersion = vnfResourceModelInfo.getModelVersion() + def resouceModelVersionId = vnfResourceModelInfo.getModelUuid() + def resouceModelType = vnfResourceModelInfo.getModelType() + + // TODO Add Existing Licenses to demand + //"existingLicenses": { + //"entitlementPoolUUID": ["87257b49-9602-4ca1-9817-094e52bc873b", + // "43257b49-9602-4fe5-9337-094e52bc9435"], + //"licenseKeyGroupUUID": ["87257b49-9602-4ca1-9817-094e52bc873b", + // "43257b49-9602-4fe5-9337-094e52bc9435"] + //} + + String licenseDemand = + "{\n" + + "\"resourceModuleName\": \"${resourceModuleName}\",\n" + + "\"serviceResourceId\": \"${serviceResourceId}\",\n" + + "\"resourceInstanceType\": \"${resourceInstanceType}\",\n" + + "\"resourceModelInfo\": {\n" + + " \"modelInvariantId\": \"${resouceModelInvariantId}\",\n" + + " \"modelVersionId\": \"${resouceModelVersionId}\",\n" + + " \"modelName\": \"${resouceModelName}\",\n" + + " \"modelType\": \"${resouceModelType}\",\n" + + " \"modelVersion\": \"${resouceModelVersion}\",\n" + + " \"modelCustomizationName\": \"\"\n" + + " }\n" + "}," + + licenseDemands = sb.append(licenseDemand) + } + licenseDemands = licenseDemands.substring(0, licenseDemands.length() - 1) + } + + String request = + "{\n" + + " \"requestInfo\": {\n" + + " \"transactionId\": \"${transactionId}\",\n" + + " \"requestId\": \"${requestId}\",\n" + + " \"callbackUrl\": \"${callbackUrl}\",\n" + + " \"sourceId\": \"so\",\n" + + " \"requestType\": \"${requestType}\"," + + " \"numSolutions\": 1,\n" + + " \"optimizers\": [\"placement\"],\n" + + " \"timeout\": 600\n" + + " },\n" + + " \"placementInfo\": {\n" + + " \"requestParameters\": {\n" + + " \"customerLatitude\": \"${customerLocation.customerLatitude}\",\n" + + " \"customerLongitude\": \"${customerLocation.customerLongitude}\",\n" + + " \"customerName\": \"${customerLocation.customerName}\"\n" + + " }," + + " \"subscriberInfo\": { \n" + + " \"globalSubscriberId\": \"${subscriberId}\",\n" + + " \"subscriberName\": \"${subscriberName}\",\n" + + " \"subscriberCommonSiteId\": \"${commonSiteId}\"\n" + + " },\n" + + " \"placementDemands\": [\n" + + " ${placementDemands}\n" + + " ]\n" + + " },\n" + + " \"serviceInfo\": {\n" + + " \"serviceInstanceId\": \"${serviceInstanceId}\",\n" + + " \"serviceName\": \"${serviceInstanceName}\",\n" + + " \"modelInfo\": {\n" + + " \"modelType\": \"${modelType}\",\n" + + " \"modelInvariantId\": \"${modelInvariantId}\",\n" + + " \"modelVersionId\": \"${modelVersionId}\",\n" + + " \"modelName\": \"${modelName}\",\n" + + " \"modelVersion\": \"${modelVersion}\",\n" + + " \"modelCustomizationName\": \"\"\n" + + " }\n" + + " },\n" + + " \"licenseInfo\": {\n" + + " \"licenseDemands\": [\n" + + " ${licenseDemands}\n" + + " }]\n" + + " }\n" + + "}" + + + utils.log("DEBUG", "Completed Building OOF Request", isDebugEnabled) + return request + } + + /** + * This method validates the callback response + * from OOF. If the response contains an + * exception the method will build and throw + * a workflow exception. + * + * @param execution + * @param response - the async callback response from oof + */ + Void validateCallbackResponse(DelegateExecution execution, String response) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + String placements = "" + if (isBlank(response)) { + exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "OOF Async Callback Response is Empty") + } else { + if (JsonUtils.jsonElementExist(response, "solutions.placementSolutions")) { + placements = jsonUtil.getJsonValue(response, "solutions.placementSolutions") + if (isBlank(placements) || placements.equalsIgnoreCase("[]")) { + String statusMessage = jsonUtil.getJsonValue(response, "statusMessage") + if (isBlank(statusMessage)) { + utils.log("DEBUG", "Error Occurred in Homing: OOF Async Callback Response does " + + "not contain placement solution.", isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 400, + "OOF Async Callback Response does not contain placement solution.") + } else { + utils.log("DEBUG", "Error Occurred in Homing: " + statusMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 400, statusMessage) + } + } else { + return + } + } else if (JsonUtils.jsonElementExist(response, "requestError") == true) { + String errorMessage = "" + if (response.contains("policyException")) { + String text = jsonUtil.getJsonValue(response, "requestError.policyException.text") + errorMessage = "OOF Async Callback Response contains a Request Error Policy Exception: " + text + } else if (response.contains("serviceException")) { + String text = jsonUtil.getJsonValue(response, "requestError.serviceException.text") + errorMessage = "OOF Async Callback Response contains a Request Error Service Exception: " + text + } else { + errorMessage = "OOF Async Callback Response contains a Request Error. Unable to determine the Request Error Exception." + } + utils.log("DEBUG", "Error Occurred in Homing: " + errorMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 400, errorMessage) + + } else { + utils.log("DEBUG", "Error Occurred in Homing: Received an Unknown Async Callback Response from OOF.", isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Received an Unknown Async Callback Response from OOF.") + } + } + + } + + /** + * This method creates candidates json for placement Demands. + * + * @param execution + * @param existingCandidates - + * @param excludedCandidates - + * @param requiredCandidates - + * + * @return candidatesJson - a JSON string with candidates + */ + String createCandidateJson(ArrayList existingCandidates = null, + ArrayList excludedCandidates = null, + ArrayList requiredCandidates = null) { + def candidatesJson = "" + def type = "" + if (existingCandidates != null && existingCandidates != {}) { + sb = new StringBuilder() + sb.append(",\n" + + " \"existingCandidates\": [\n") + def existingCandidateJson = "" + existingCandidates.each { + type = existingCandidate.get('identifierType') + if (type == 'vimId') { + def cloudOwner = existingCandidate.get('cloudOwner') + def cloudRegionId = existingCandidate.get('identifiers') + existingCandidateJson = "{\n" + + " \"identifierType\": \"vimId\",\n" + + " \"cloudOwner\": \"${cloudOwner}\",\n" + + " \"identifiers\": [\"${cloudRegionId}\"]\n" + + " }," + sb.append(existingCandidateJson) + } + if (type == 'serviceInstanceId') { + def serviceInstanceId = existingCandidate.get('identifiers') + existingCandidateJson += "{\n" + + " \"identifierType\": \"serviceInstanceId\",\n" + + " \"identifiers\": [\"${serviceInstanceId}\"]\n" + + " }," + sb.append(existingCandidateJson) + } + } + if (existingCandidateJson != "") { + sb.setLength(sb.length() - 1) + candidatesJson = sb.append(",\n],") + } + } + if (excludedCandidates != null && excludedCandidates != {}) { + sb = new StringBuilder() + sb.append(",\n" + + " \"excludedCandidates\": [\n") + def excludedCandidateJson = "" + excludedCandidates.each { + type = excludedCandidate.get('identifierType') + if (type == 'vimId') { + def cloudOwner = excludedCandidate.get('cloudOwner') + def cloudRegionId = excludedCandidate.get('identifiers') + excludedCandidateJson = "{\n" + + " \"identifierType\": \"vimId\",\n" + + " \"cloudOwner\": \"${cloudOwner}\",\n" + + " \"identifiers\": [\"${cloudRegionId}\"]\n" + + " }," + sb.append(excludedCandidateJson) + } + if (type == 'serviceInstanceId') { + def serviceInstanceId = excludedCandidate.get('identifiers') + excludedCandidateJson += "{\n" + + " \"identifierType\": \"serviceInstanceId\",\n" + + " \"identifiers\": [\"${serviceInstanceId}\"]\n" + + " }," + sb.append(excludedCandidateJson) + } + } + if (excludedCandidateJson != "") { + sb.setLength(sb.length() - 1) + candidatesJson = sb.append(",\n],") + } + } + if (requiredCandidates != null && requiredCandidates != {}) { + sb = new StringBuilder() + sb.append(",\n" + + " \"requiredCandidates\": [\n") + def requiredCandidatesJson = "" + requiredCandidates.each { + type = requiredCandidate.get('identifierType') + if (type == 'vimId') { + def cloudOwner = requiredCandidate.get('cloudOwner') + def cloudRegionId = requiredCandidate.get('identifiers') + requiredCandidatesJson = "{\n" + + " \"identifierType\": \"vimId\",\n" + + " \"cloudOwner\": \"${cloudOwner}\",\n" + + " \"identifiers\": [\"${cloudRegionId}\"]\n" + + " }," + sb.append(requiredCandidatesJson) + } + if (type == 'serviceInstanceId') { + def serviceInstanceId = requiredCandidate.get('identifiers') + requiredCandidatesJson += "{\n" + + " \"identifierType\": \"serviceInstanceId\",\n" + + " \"identifiers\": [\"${serviceInstanceId}\"]\n" + + " }," + sb.append(requiredCandidatesJson) + } + } + if (requiredCandidatesJson != "") { + sb.setLength(sb.length() - 1) + candidatesJson = sb.append(",\n],") + } + } + if (candidatesJson != "") {candidatesJson = candidatesJson.substring(0, candidatesJson.length() - 1)} + return candidatesJson + } +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SNIROUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SNIROUtils.groovy index ab215c9949..88ed9fb330 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SNIROUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SNIROUtils.groovy @@ -96,7 +96,7 @@ class SNIROUtils{ String requestType = "initial"
List<Resource> resources = decomposition.getServiceResources()
for(Resource r:resources){
- HomingSolution currentSolution = r.getCurrentHomingSolution()
+ HomingSolution currentSolution = (HomingSolution) r.getCurrentHomingSolution()
if(currentSolution != null){
requestType = "speed changed"
}
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SniroHoming.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SniroHoming.groovy new file mode 100755 index 0000000000..3f534377d8 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/openecomp/mso/bpmn/common/scripts/SniroHoming.groovy @@ -0,0 +1,274 @@ +/* + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.openecomp.mso.bpmn.common.scripts + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution; + +import org.openecomp.mso.bpmn.common.scripts.AaiUtil +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil +import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils +import org.openecomp.mso.bpmn.core.domain.InventoryType +import org.openecomp.mso.bpmn.core.domain.Resource +import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition +import org.openecomp.mso.bpmn.core.domain.Subscriber +import org.openecomp.mso.bpmn.core.domain.VnfResource +import org.openecomp.mso.bpmn.core.json.JsonUtils +import org.openecomp.mso.rest.APIResponse +import org.openecomp.mso.rest.RESTClient +import org.openecomp.mso.rest.RESTConfig +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor + +import org.json.JSONArray +import org.json.JSONObject + +import static org.openecomp.mso.bpmn.common.scripts.GenericUtils.*; + +/** + * This class is contains the scripts used + * by the Homing Subflow building block. The + * subflow attempts to home the provided + * resources by calling sniro. + * + * @author cb645j + * + */ +class SniroHoming extends AbstractServiceTaskProcessor { + + 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) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix", "HOME_") + utils.log("DEBUG", "*** Started Homing Call Sniro ***", isDebugEnabled) + try { + execution.setVariable("rollbackData", null) + execution.setVariable("rolledBack", false) + + String requestId = execution.getVariable("msoRequestId") + utils.log("DEBUG", "Incoming Request Id is: " + requestId, isDebugEnabled) + String serviceInstanceId = execution.getVariable("serviceInstanceId") + utils.log("DEBUG", "Incoming Service Instance Id is: " + serviceInstanceId, isDebugEnabled) + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + utils.log("DEBUG", "Incoming Service Decomposition is: " + serviceDecomposition, isDebugEnabled) + String subscriberInfo = execution.getVariable("subscriberInfo") + utils.log("DEBUG", "Incoming Subscriber Information is: " + subscriberInfo, isDebugEnabled) + + 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 + def authHeader = "" + String basicAuth = execution.getVariable("URN_mso_sniro_auth") + String msokey = execution.getVariable("URN_mso_msoKey") + String basicAuthValue = utils.encrypt(basicAuth, msokey) + if (basicAuthValue != null) { + utils.log("DEBUG", "Obtained BasicAuth username and password for SNIRO Adapter: " + basicAuthValue, isDebugEnabled) + try { + authHeader = utils.getBasicAuth(basicAuthValue, msokey) + execution.setVariable("BasicAuthHeaderValue", authHeader) + } catch (Exception ex) { + utils.log("DEBUG", "Unable to encode username and password string: " + ex, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - Unable to encode username and password string") + } + } else { + utils.log("DEBUG", "Unable to obtain BasicAuth - BasicAuth value null", isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - BasicAuth value null") + } + + //Prepare Callback + String timeout = execution.getVariable("timeout") + if (isBlank(timeout)) { + timeout = execution.getVariable("URN_mso_sniro_timeout"); + if (isBlank(timeout)) { + timeout = "PT30M"; + } + } + utils.log("DEBUG", "Async Callback Timeout will be: " + timeout, isDebugEnabled) + + 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) + utils.log("DEBUG", "SNIRO Request is: " + sniroRequest, isDebugEnabled) + + String endpoint = execution.getVariable("URN_mso_service_agnostic_sniro_endpoint") + String host = execution.getVariable("URN_mso_service_agnostic_sniro_host") + String url = host + endpoint + utils.log("DEBUG", "Posting to Sniro Url: " + url, isDebugEnabled) + + logDebug("URL to be used is: " + url, isDebugEnabled) + + RESTConfig config = new RESTConfig(url) + RESTClient client = new RESTClient(config).addAuthorizationHeader(authHeader).addHeader("Content-Type", "application/json") + APIResponse response = client.httpPost(sniroRequest) + + int responseCode = response.getStatusCode() + execution.setVariable("syncResponseCode", responseCode); + logDebug("SNIRO sync response code is: " + responseCode, isDebugEnabled) + String syncResponse = response.getResponseBodyAsString() + execution.setVariable("syncResponse", syncResponse); + logDebug("SNIRO sync response is: " + syncResponse, isDebugEnabled) + + utils.log("DEBUG", "*** Completed Homing Call Sniro ***", isDebugEnabled) + } + } catch (BpmnError b) { + throw b + } catch (Exception e) { + utils.log("DEBUG", "Error encountered within Homing CallSniro method: " + e, isDebugEnabled) + 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) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", "*** Started Homing Process Homing Solution ***", isDebugEnabled) + try { + String response = execution.getVariable("asyncCallbackResponse") + utils.log("DEBUG", "Sniro Async Callback Response is: " + response, isDebugEnabled) + utils.logAudit("Sniro Async Callback Response is: " + response) + + sniroUtils.validateCallbackResponse(execution, response) + String placements = jsonUtil.getJsonValue(response, "solutionInfo.placementInfo") + + ServiceDecomposition decomposition = execution.getVariable("serviceDecomposition") + utils.log("DEBUG", "Service Decomposition: " + decomposition, isDebugEnabled) + + List<Resource> resourceList = decomposition.getServiceResources() + 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) + execution.setVariable("homingSolution", placements) //TODO - can be removed as output variable + + utils.log("DEBUG", "*** Completed Homing Process Homing Solution ***", isDebugEnabled) + } catch (BpmnError b) { + throw b + } catch (Exception e) { + utils.log("DEBUG", "Error encountered within Homing ProcessHomingSolution method: " + e, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in Homing ProcessHomingSolution") + } + } + + /** + * This method logs the start of DHVCreateService + * to make debugging easier. + * + * @param - execution + * @author cb645j + */ + public String logStart(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + String requestId = execution.getVariable("testReqId") + if (isBlank(requestId)) { + requestId = execution.getVariable("msoRequestId") + } + execution.setVariable("DHVCS_requestId", requestId) + utils.log("DEBUG", "***** STARTED Homing Subflow for request: " + requestId + " *****", "true") + utils.log("DEBUG", "****** Homing Subflow Global Debug Enabled: " + isDebugEnabled + " *****", "true") + utils.logAudit("***** STARTED Homing Subflow for request: " + requestId + " *****") + } + + /** + * Auto-generated method stub + */ + public void preProcessRequest(DelegateExecution execution) {} + +} diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/Homing.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/Homing.bpmn index 481d1dfa6f..91a6546621 100644 --- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/Homing.bpmn +++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/BuildingBlock/Homing.bpmn @@ -1,259 +1,404 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="_vwRmIBsREeeIQtzUKIjH4g" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
- <bpmn2:process id="Homing" name="Homing" isExecutable="true">
- <bpmn2:startEvent id="StartEvent_1">
- <bpmn2:outgoing>SequenceFlow_1x9usa6</bpmn2:outgoing>
- </bpmn2:startEvent>
- <bpmn2:scriptTask id="callSniro" name="Call Sniro" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_1x9usa6</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_10x3ocp</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-Homing sniro = new Homing()
-sniro.callSniro(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_1x9usa6" sourceRef="StartEvent_1" targetRef="callSniro" />
- <bpmn2:subProcess id="bpmnErrorSubprocess" name="Error Handling Subprocess" triggeredByEvent="true">
- <bpmn2:endEvent id="EndEvent_07tjq3v">
- <bpmn2:incoming>SequenceFlow_1rf4vs8</bpmn2:incoming>
- <bpmn2:terminateEventDefinition />
- </bpmn2:endEvent>
- <bpmn2:startEvent id="StartEvent_1qiitb2">
- <bpmn2:outgoing>SequenceFlow_00nlh7l</bpmn2:outgoing>
- <bpmn2:errorEventDefinition />
- </bpmn2:startEvent>
- <bpmn2:scriptTask id="processMsoWorkflowException" name="Process Error" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_00nlh7l</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_1rf4vs8</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-ExceptionUtil ex = new ExceptionUtil()
-ex.processSubflowsBPMNException(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="SequenceFlow_1rf4vs8" sourceRef="processMsoWorkflowException" targetRef="EndEvent_07tjq3v" />
- <bpmn2:sequenceFlow id="SequenceFlow_00nlh7l" sourceRef="StartEvent_1qiitb2" targetRef="processMsoWorkflowException" />
- </bpmn2:subProcess>
- <bpmn2:subProcess id="javaExceptionSubProcess" name="Java Exception Sub Process" triggeredByEvent="true">
- <bpmn2:scriptTask id="processJavaException" name="Process Error" scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_0kamg53</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_1o7154s</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-ExceptionUtil ex = new ExceptionUtil()
-ex.processJavaException(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:startEvent id="StartEvent_1fbpeuw">
- <bpmn2:outgoing>SequenceFlow_0kamg53</bpmn2:outgoing>
- <bpmn2:errorEventDefinition errorRef="Error_1lwpypa" />
- </bpmn2:startEvent>
- <bpmn2:endEvent id="EndEvent_0jbvnr0">
- <bpmn2:incoming>SequenceFlow_1o7154s</bpmn2:incoming>
- <bpmn2:terminateEventDefinition />
- </bpmn2:endEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_0kamg53" name="" sourceRef="StartEvent_1fbpeuw" targetRef="processJavaException" />
- <bpmn2:sequenceFlow id="SequenceFlow_1o7154s" name="" sourceRef="processJavaException" targetRef="EndEvent_0jbvnr0" />
- </bpmn2:subProcess>
- <bpmn2:scriptTask id="processHomingSolution" name="Process Solution " scriptFormat="groovy">
- <bpmn2:incoming>SequenceFlow_043r3j8</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_1h9opg9</bpmn2:outgoing>
- <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.*
-Homing homing = new Homing()
-homing.processHomingSolution(execution)]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:exclusiveGateway id="responseCheck" name="Response Ok?" default="badResponse">
- <bpmn2:incoming>SequenceFlow_10x3ocp</bpmn2:incoming>
- <bpmn2:outgoing>badResponse</bpmn2:outgoing>
- <bpmn2:outgoing>goodResponse</bpmn2:outgoing>
- </bpmn2:exclusiveGateway>
- <bpmn2:sequenceFlow id="SequenceFlow_10x3ocp" sourceRef="callSniro" targetRef="responseCheck" />
- <bpmn2:scriptTask id="assignError" name="Assign Error" scriptFormat="groovy">
- <bpmn2:incoming>badResponse</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_0clfkld</bpmn2:outgoing>
- <bpmn2:script><![CDATA[int responseCode = execution.getVariable("syncResponseCode")
-
-import org.openecomp.mso.bpmn.common.scripts.*
-ExceptionUtil ex = new ExceptionUtil()
-ex.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from Sniro.")]]></bpmn2:script>
- </bpmn2:scriptTask>
- <bpmn2:sequenceFlow id="badResponse" name="No" sourceRef="responseCheck" targetRef="assignError" />
- <bpmn2:sequenceFlow id="SequenceFlow_0clfkld" sourceRef="assignError" targetRef="throwMSOWorkflowException" />
- <bpmn2:endEvent id="throwMSOWorkflowException">
- <bpmn2:incoming>SequenceFlow_0clfkld</bpmn2:incoming>
- <bpmn2:errorEventDefinition errorRef="Error_10hit0u" />
- </bpmn2:endEvent>
- <bpmn2:sequenceFlow id="goodResponse" name="Yes" sourceRef="responseCheck" targetRef="receiveAsyncCallback">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("syncResponseCode") == 202}]]></bpmn2:conditionExpression>
- </bpmn2:sequenceFlow>
- <bpmn2:sequenceFlow id="SequenceFlow_043r3j8" sourceRef="receiveAsyncCallback" targetRef="processHomingSolution" />
- <bpmn2:callActivity id="receiveAsyncCallback" name="Receive Async Callback" calledElement="ReceiveWorkflowMessage" camunda:modelerTemplate="receiveWorkflowMessage">
- <bpmn2: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" />
- </bpmn2:extensionElements>
- <bpmn2:incoming>goodResponse</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_043r3j8</bpmn2:outgoing>
- </bpmn2:callActivity>
- <bpmn2:sequenceFlow id="SequenceFlow_1h9opg9" sourceRef="processHomingSolution" targetRef="EndEvent_0n56tas" />
- <bpmn2:endEvent id="EndEvent_0n56tas">
- <bpmn2:incoming>SequenceFlow_1h9opg9</bpmn2:incoming>
- <bpmn2:terminateEventDefinition />
- </bpmn2:endEvent>
- </bpmn2:process>
- <bpmn2:error id="Error_10hit0u" name="MSO Workflow Exception" errorCode="MSOWorkflowException" />
- <bpmn2:error id="Error_1lwpypa" name="Java Lang Exception" errorCode="java.lang.Exception" />
- <bpmndi:BPMNDiagram id="BPMNDiagram_1">
- <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Homing">
- <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
- <dc:Bounds x="147" y="275" width="36" height="36" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="ScriptTask_0qmfpdr_di" bpmnElement="callSniro">
- <dc:Bounds x="286" y="253" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_1x9usa6_di" bpmnElement="SequenceFlow_1x9usa6">
- <di:waypoint xsi:type="dc:Point" x="183" y="293" />
- <di:waypoint xsi:type="dc:Point" x="286" y="293" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="235" y="278" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="SubProcess_16p12qo_di" bpmnElement="bpmnErrorSubprocess" isExpanded="true">
- <dc:Bounds x="254" y="496" width="409" height="168" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="SubProcess_12gjiy8_di" bpmnElement="javaExceptionSubProcess" isExpanded="true">
- <dc:Bounds x="284" y="679" width="350" height="159" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="EndEvent_07tjq3v_di" bpmnElement="EndEvent_07tjq3v">
- <dc:Bounds x="579" y="570" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="597" y="611" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="StartEvent_1qiitb2_di" bpmnElement="StartEvent_1qiitb2">
- <dc:Bounds x="299" y="570" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="317" y="611" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="ScriptTask_03hs6s9_di" bpmnElement="processMsoWorkflowException">
- <dc:Bounds x="406" y="548" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="ScriptTask_19gqykh_di" bpmnElement="processJavaException">
- <dc:Bounds x="410" y="727" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="StartEvent_1fbpeuw_di" bpmnElement="StartEvent_1fbpeuw">
- <dc:Bounds x="318" y="749" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="336" y="790" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="EndEvent_0jbvnr0_di" bpmnElement="EndEvent_0jbvnr0">
- <dc:Bounds x="567" y="749" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="585" y="790" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_1rf4vs8_di" bpmnElement="SequenceFlow_1rf4vs8">
- <di:waypoint xsi:type="dc:Point" x="506" y="588" />
- <di:waypoint xsi:type="dc:Point" x="579" y="588" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="543" y="573" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_00nlh7l_di" bpmnElement="SequenceFlow_00nlh7l">
- <di:waypoint xsi:type="dc:Point" x="335" y="588" />
- <di:waypoint xsi:type="dc:Point" x="363" y="588" />
- <di:waypoint xsi:type="dc:Point" x="363" y="588" />
- <di:waypoint xsi:type="dc:Point" x="406" y="588" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="378" y="588" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_0kamg53_di" bpmnElement="SequenceFlow_0kamg53">
- <di:waypoint xsi:type="dc:Point" x="354" y="767" />
- <di:waypoint xsi:type="dc:Point" x="410" y="767" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="382" y="752" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_1o7154s_di" bpmnElement="SequenceFlow_1o7154s">
- <di:waypoint xsi:type="dc:Point" x="510" y="767" />
- <di:waypoint xsi:type="dc:Point" x="567" y="767" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="539" y="752" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="ScriptTask_1aapkvq_di" bpmnElement="processHomingSolution">
- <dc:Bounds x="630" y="325" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="ExclusiveGateway_03gt5b8_di" bpmnElement="responseCheck" isMarkerVisible="true">
- <dc:Bounds x="419" y="268" width="50" height="50" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="474" y="287" width="74" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_10x3ocp_di" bpmnElement="SequenceFlow_10x3ocp">
- <di:waypoint xsi:type="dc:Point" x="386" y="293" />
- <di:waypoint xsi:type="dc:Point" x="419" y="293" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="403" y="278" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="ScriptTask_0ikcqeo_di" bpmnElement="assignError">
- <dc:Bounds x="490" y="176" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_1m1c9nu_di" bpmnElement="badResponse">
- <di:waypoint xsi:type="dc:Point" x="444" y="268" />
- <di:waypoint xsi:type="dc:Point" x="444" y="216" />
- <di:waypoint xsi:type="dc:Point" x="490" y="216" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="451" y="226" width="14" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_0clfkld_di" bpmnElement="SequenceFlow_0clfkld">
- <di:waypoint xsi:type="dc:Point" x="590" y="216" />
- <di:waypoint xsi:type="dc:Point" x="662" y="216" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="626" y="201" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="EndEvent_13ejfwp_di" bpmnElement="throwMSOWorkflowException">
- <dc:Bounds x="662" y="198" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="680" y="234" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_1o3br3u_di" bpmnElement="goodResponse">
- <di:waypoint xsi:type="dc:Point" x="444" y="318" />
- <di:waypoint xsi:type="dc:Point" x="444" y="365" />
- <di:waypoint xsi:type="dc:Point" x="490" y="365" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="447" y="339.5" width="18" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_043r3j8_di" bpmnElement="SequenceFlow_043r3j8">
- <di:waypoint xsi:type="dc:Point" x="590" y="365" />
- <di:waypoint xsi:type="dc:Point" x="630" y="365" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="610" y="350" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="CallActivity_031b5m3_di" bpmnElement="receiveAsyncCallback">
- <dc:Bounds x="490" y="325" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_1h9opg9_di" bpmnElement="SequenceFlow_1h9opg9">
- <di:waypoint xsi:type="dc:Point" x="730" y="365" />
- <di:waypoint xsi:type="dc:Point" x="825" y="365" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="778" y="350" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="EndEvent_0ougemc_di" bpmnElement="EndEvent_0n56tas">
- <dc:Bounds x="825" y="347" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="843" y="383" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- </bpmndi:BPMNPlane>
- </bpmndi:BPMNDiagram>
-</bpmn2:definitions>
+<?xml version="1.0" encoding="UTF-8"?> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="_vwRmIBsREeeIQtzUKIjH4g" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.11.3" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> + <bpmn2:process id="Homing" name="Homing" isExecutable="true"> + <bpmn2:startEvent id="StartEvent_1"> + <bpmn2:outgoing>SequenceFlow_1x9usa6</bpmn2:outgoing> + </bpmn2:startEvent> + <bpmn2:scriptTask id="callSniro" name="Call Sniro" scriptFormat="groovy"> + <bpmn2:incoming>sniroCall</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0gajic6</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* +SniroHoming homing = new SniroHoming() +homing.callSniro(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_1x9usa6" sourceRef="StartEvent_1" targetRef="homingSolutionCheck" /> + <bpmn2:subProcess id="bpmnErrorSubprocess" name="Error Handling Subprocess" triggeredByEvent="true"> + <bpmn2:endEvent id="EndEvent_07tjq3v"> + <bpmn2:incoming>SequenceFlow_1rf4vs8</bpmn2:incoming> + <bpmn2:terminateEventDefinition /> + </bpmn2:endEvent> + <bpmn2:startEvent id="StartEvent_1qiitb2"> + <bpmn2:outgoing>SequenceFlow_00nlh7l</bpmn2:outgoing> + <bpmn2:errorEventDefinition /> + </bpmn2:startEvent> + <bpmn2:scriptTask id="processMsoWorkflowException" name="Process Error" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_00nlh7l</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1rf4vs8</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* +ExceptionUtil ex = new ExceptionUtil() +ex.processSubflowsBPMNException(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_1rf4vs8" sourceRef="processMsoWorkflowException" targetRef="EndEvent_07tjq3v" /> + <bpmn2:sequenceFlow id="SequenceFlow_00nlh7l" sourceRef="StartEvent_1qiitb2" targetRef="processMsoWorkflowException" /> + </bpmn2:subProcess> + <bpmn2:subProcess id="javaExceptionSubProcess" name="Java Exception Sub Process" triggeredByEvent="true"> + <bpmn2:scriptTask id="processJavaException" name="Process Error" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_0kamg53</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1o7154s</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* +ExceptionUtil ex = new ExceptionUtil() +ex.processJavaException(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:startEvent id="StartEvent_1fbpeuw"> + <bpmn2:outgoing>SequenceFlow_0kamg53</bpmn2:outgoing> + <bpmn2:errorEventDefinition errorRef="Error_1lwpypa" /> + </bpmn2:startEvent> + <bpmn2:endEvent id="EndEvent_0jbvnr0"> + <bpmn2:incoming>SequenceFlow_1o7154s</bpmn2:incoming> + <bpmn2:terminateEventDefinition /> + </bpmn2:endEvent> + <bpmn2:sequenceFlow id="SequenceFlow_0kamg53" name="" sourceRef="StartEvent_1fbpeuw" targetRef="processJavaException" /> + <bpmn2:sequenceFlow id="SequenceFlow_1o7154s" name="" sourceRef="processJavaException" targetRef="EndEvent_0jbvnr0" /> + </bpmn2:subProcess> + <bpmn2:scriptTask id="processSniroHomingSolution" name="Process Sniro Homing Solution " scriptFormat="groovy"> + <bpmn2:incoming>sniroProcess</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1h9opg9</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* +SniroHoming homing = new SniroHoming() +homing.processHomingSolution(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:exclusiveGateway id="responseCheck" name="Response Ok?" default="badResponse"> + <bpmn2:incoming>SequenceFlow_12t0lqb</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_0gajic6</bpmn2:incoming> + <bpmn2:outgoing>badResponse</bpmn2:outgoing> + <bpmn2:outgoing>goodResponse</bpmn2:outgoing> + </bpmn2:exclusiveGateway> + <bpmn2:scriptTask id="assignError" name="Assign Error" scriptFormat="groovy"> + <bpmn2:incoming>badResponse</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0clfkld</bpmn2:outgoing> + <bpmn2:script><![CDATA[int responseCode = execution.getVariable("syncResponseCode") + +import org.openecomp.mso.bpmn.common.scripts.* +ExceptionUtil ex = new ExceptionUtil() +ex.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from Sniro/OOF.")]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="badResponse" name="No" sourceRef="responseCheck" targetRef="assignError" /> + <bpmn2:sequenceFlow id="SequenceFlow_0clfkld" sourceRef="assignError" targetRef="throwMSOWorkflowException2" /> + <bpmn2:endEvent id="throwMSOWorkflowException2"> + <bpmn2:incoming>SequenceFlow_0clfkld</bpmn2:incoming> + <bpmn2:errorEventDefinition errorRef="Error_10hit0u" /> + </bpmn2:endEvent> + <bpmn2:sequenceFlow id="goodResponse" name="Yes" sourceRef="responseCheck" targetRef="receiveAsyncCallback"> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("syncResponseCode") == 202}]]></bpmn2:conditionExpression> + </bpmn2:sequenceFlow> + <bpmn2:callActivity id="receiveAsyncCallback" name="Receive Async Callback" camunda:modelerTemplate="receiveWorkflowMessage" calledElement="ReceiveWorkflowMessage"> + <bpmn2: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" /> + </bpmn2:extensionElements> + <bpmn2:incoming>goodResponse</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1fipbmk</bpmn2:outgoing> + </bpmn2:callActivity> + <bpmn2:sequenceFlow id="SequenceFlow_1h9opg9" sourceRef="processSniroHomingSolution" targetRef="EndEvent_0n56tas" /> + <bpmn2:endEvent id="EndEvent_0n56tas"> + <bpmn2:incoming>SequenceFlow_1h9opg9</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_07u9d7f</bpmn2:incoming> + <bpmn2:terminateEventDefinition /> + </bpmn2:endEvent> + <bpmn2:exclusiveGateway id="homingSolutionCheck" name="Which homing Solution?" default="SequenceFlow_02eywxz"> + <bpmn2:incoming>SequenceFlow_1x9usa6</bpmn2:incoming> + <bpmn2:outgoing>sniroCall</bpmn2:outgoing> + <bpmn2:outgoing>oofCall</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_02eywxz</bpmn2:outgoing> + </bpmn2:exclusiveGateway> + <bpmn2:scriptTask id="ScriptTask_1pkjo1d" name="Call OOF" scriptFormat="groovy"> + <bpmn2:incoming>oofCall</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_12t0lqb</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* +OofHoming homing = new OofHoming() +homing.callOof(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="sniroCall" name="Sniro" sourceRef="homingSolutionCheck" targetRef="callSniro"> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("homingService") == "sniro"}]]></bpmn2:conditionExpression> + </bpmn2:sequenceFlow> + <bpmn2:sequenceFlow id="oofCall" name="OOF" sourceRef="homingSolutionCheck" targetRef="ScriptTask_1pkjo1d"> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("homingService") == "oof"}]]></bpmn2:conditionExpression> + </bpmn2:sequenceFlow> + <bpmn2:sequenceFlow id="SequenceFlow_12t0lqb" sourceRef="ScriptTask_1pkjo1d" targetRef="responseCheck" /> + <bpmn2:sequenceFlow id="SequenceFlow_0gajic6" sourceRef="callSniro" targetRef="responseCheck" /> + <bpmn2:exclusiveGateway id="processHomingCheck" name="Which homing Solution?"> + <bpmn2:incoming>SequenceFlow_1fipbmk</bpmn2:incoming> + <bpmn2:outgoing>sniroProcess</bpmn2:outgoing> + <bpmn2:outgoing>oofProcess</bpmn2:outgoing> + </bpmn2:exclusiveGateway> + <bpmn2:sequenceFlow id="SequenceFlow_1fipbmk" sourceRef="receiveAsyncCallback" targetRef="processHomingCheck" /> + <bpmn2:sequenceFlow id="sniroProcess" name="Sniro" sourceRef="processHomingCheck" targetRef="processSniroHomingSolution"> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("homingService") == "sniro"}]]></bpmn2:conditionExpression> + </bpmn2:sequenceFlow> + <bpmn2:sequenceFlow id="oofProcess" name="OOF" sourceRef="processHomingCheck" targetRef="processOofHomingSolution"> + <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{execution.getVariable("homingService") == "oof"}]]></bpmn2:conditionExpression> + </bpmn2:sequenceFlow> + <bpmn2:scriptTask id="processOofHomingSolution" name="Process OOF Homing Solution " scriptFormat="groovy"> + <bpmn2:incoming>oofProcess</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_07u9d7f</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* +OofHoming homing = new OofHoming() +homing.processHomingSolution(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_07u9d7f" sourceRef="processOofHomingSolution" targetRef="EndEvent_0n56tas" /> + <bpmn2:endEvent id="throwMSOWorkflowException1"> + <bpmn2:incoming>SequenceFlow_1bub8mj</bpmn2:incoming> + <bpmn2:errorEventDefinition errorRef="Error_10hit0u" /> + </bpmn2:endEvent> + <bpmn2:scriptTask id="ScriptTask_0t0fs4n" name="Assign Error" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_02eywxz</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_1bub8mj</bpmn2:outgoing> + <bpmn2:script><![CDATA[int responseCode = execution.getVariable("sniroHomingSolution") + +import org.openecomp.mso.bpmn.common.scripts.* +ExceptionUtil ex = new ExceptionUtil() +ex.buildAndThrowWorkflowException(execution, responseCode, "No sniroHomingSolution found for Sniro/OOF.")]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_1bub8mj" sourceRef="ScriptTask_0t0fs4n" targetRef="throwMSOWorkflowException1" /> + <bpmn2:sequenceFlow id="SequenceFlow_02eywxz" sourceRef="homingSolutionCheck" targetRef="ScriptTask_0t0fs4n" /> + </bpmn2:process> + <bpmn2:error id="Error_10hit0u" name="MSO Workflow Exception" errorCode="MSOWorkflowException" /> + <bpmn2:error id="Error_1lwpypa" name="Java Lang Exception" errorCode="java.lang.Exception" /> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Homing"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"> + <dc:Bounds x="147" y="275" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0qmfpdr_di" bpmnElement="callSniro"> + <dc:Bounds x="391" y="137" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1x9usa6_di" bpmnElement="SequenceFlow_1x9usa6"> + <di:waypoint xsi:type="dc:Point" x="183" y="293" /> + <di:waypoint xsi:type="dc:Point" x="274" y="293" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="183.5" y="278" width="90" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="SubProcess_16p12qo_di" bpmnElement="bpmnErrorSubprocess" isExpanded="true"> + <dc:Bounds x="254" y="496" width="409" height="168" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="SubProcess_12gjiy8_di" bpmnElement="javaExceptionSubProcess" isExpanded="true"> + <dc:Bounds x="284" y="679" width="350" height="159" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_07tjq3v_di" bpmnElement="EndEvent_07tjq3v"> + <dc:Bounds x="579" y="570" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="597" y="611" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_1qiitb2_di" bpmnElement="StartEvent_1qiitb2"> + <dc:Bounds x="299" y="570" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="317" y="611" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_03hs6s9_di" bpmnElement="processMsoWorkflowException"> + <dc:Bounds x="406" y="548" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_19gqykh_di" bpmnElement="processJavaException"> + <dc:Bounds x="410" y="727" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_1fbpeuw_di" bpmnElement="StartEvent_1fbpeuw"> + <dc:Bounds x="318" y="749" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="336" y="790" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_0jbvnr0_di" bpmnElement="EndEvent_0jbvnr0"> + <dc:Bounds x="567" y="749" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="585" y="790" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1rf4vs8_di" bpmnElement="SequenceFlow_1rf4vs8"> + <di:waypoint xsi:type="dc:Point" x="506" y="588" /> + <di:waypoint xsi:type="dc:Point" x="579" y="588" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="543" y="573" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_00nlh7l_di" bpmnElement="SequenceFlow_00nlh7l"> + <di:waypoint xsi:type="dc:Point" x="335" y="588" /> + <di:waypoint xsi:type="dc:Point" x="363" y="588" /> + <di:waypoint xsi:type="dc:Point" x="363" y="588" /> + <di:waypoint xsi:type="dc:Point" x="406" y="588" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="378" y="588" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0kamg53_di" bpmnElement="SequenceFlow_0kamg53"> + <di:waypoint xsi:type="dc:Point" x="354" y="767" /> + <di:waypoint xsi:type="dc:Point" x="410" y="767" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="382" y="752" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1o7154s_di" bpmnElement="SequenceFlow_1o7154s"> + <di:waypoint xsi:type="dc:Point" x="510" y="767" /> + <di:waypoint xsi:type="dc:Point" x="567" y="767" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="539" y="752" width="0" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1aapkvq_di" bpmnElement="processSniroHomingSolution"> + <dc:Bounds x="1293" y="253" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_03gt5b8_di" bpmnElement="responseCheck" isMarkerVisible="true"> + <dc:Bounds x="566" y="268" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="554" y="328" width="74" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0ikcqeo_di" bpmnElement="assignError"> + <dc:Bounds x="777" y="184" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1m1c9nu_di" bpmnElement="badResponse"> + <di:waypoint xsi:type="dc:Point" x="610" y="287" /> + <di:waypoint xsi:type="dc:Point" x="777" y="239" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="665.309770337371" y="246.39875517690592" width="14" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0clfkld_di" bpmnElement="SequenceFlow_0clfkld"> + <di:waypoint xsi:type="dc:Point" x="877" y="224" /> + <di:waypoint xsi:type="dc:Point" x="949" y="224" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="868" y="209" width="90" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="EndEvent_13ejfwp_di" bpmnElement="throwMSOWorkflowException2"> + <dc:Bounds x="949" y="206" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="922" y="242" width="90" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1o3br3u_di" bpmnElement="goodResponse"> + <di:waypoint xsi:type="dc:Point" x="610" y="299" /> + <di:waypoint xsi:type="dc:Point" x="777" y="356" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="667.027112499105" y="300.1275453507" width="19" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_031b5m3_di" bpmnElement="receiveAsyncCallback"> + <dc:Bounds x="777" y="333" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1h9opg9_di" bpmnElement="SequenceFlow_1h9opg9"> + <di:waypoint xsi:type="dc:Point" x="1393" y="293" /> + <di:waypoint xsi:type="dc:Point" x="1509" y="293" /> + <di:waypoint xsi:type="dc:Point" x="1509" y="355" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1406" y="278" width="90" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="EndEvent_0ougemc_di" bpmnElement="EndEvent_0n56tas"> + <dc:Bounds x="1491" y="355" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1464" y="391" width="90" height="0" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_03vhlpt_di" bpmnElement="homingSolutionCheck" isMarkerVisible="true"> + <dc:Bounds x="274" y="268" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="266" y="322" width="69" height="24" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1pkjo1d_di" bpmnElement="ScriptTask_1pkjo1d"> + <dc:Bounds x="391" y="370" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1x12ld7_di" bpmnElement="sniroCall"> + <di:waypoint xsi:type="dc:Point" x="299" y="268" /> + <di:waypoint xsi:type="dc:Point" x="299" y="177" /> + <di:waypoint xsi:type="dc:Point" x="391" y="177" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="329" y="192" width="25" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0iu4ms3_di" bpmnElement="oofCall"> + <di:waypoint xsi:type="dc:Point" x="299" y="318" /> + <di:waypoint xsi:type="dc:Point" x="299" y="410" /> + <di:waypoint xsi:type="dc:Point" x="391" y="410" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="333" y="378" width="25" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_12t0lqb_di" bpmnElement="SequenceFlow_12t0lqb"> + <di:waypoint xsi:type="dc:Point" x="491" y="410" /> + <di:waypoint xsi:type="dc:Point" x="591" y="410" /> + <di:waypoint xsi:type="dc:Point" x="591" y="318" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="496" y="389" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0gajic6_di" bpmnElement="SequenceFlow_0gajic6"> + <di:waypoint xsi:type="dc:Point" x="491" y="177" /> + <di:waypoint xsi:type="dc:Point" x="591" y="177" /> + <di:waypoint xsi:type="dc:Point" x="591" y="268" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="496" y="156" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ExclusiveGateway_0dwcgfe_di" bpmnElement="processHomingCheck" isMarkerVisible="true"> + <dc:Bounds x="942" y="348" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="934" y="402" width="69" height="24" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1fipbmk_di" bpmnElement="SequenceFlow_1fipbmk"> + <di:waypoint xsi:type="dc:Point" x="877" y="373" /> + <di:waypoint xsi:type="dc:Point" x="942" y="373" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="909.5" y="352" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_14jzswu_di" bpmnElement="sniroProcess"> + <di:waypoint xsi:type="dc:Point" x="967" y="348" /> + <di:waypoint xsi:type="dc:Point" x="967" y="293" /> + <di:waypoint xsi:type="dc:Point" x="1293" y="293" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1034" y="312" width="25" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_158imry_di" bpmnElement="oofProcess"> + <di:waypoint xsi:type="dc:Point" x="967" y="398" /> + <di:waypoint xsi:type="dc:Point" x="967" y="469" /> + <di:waypoint xsi:type="dc:Point" x="1293" y="469" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1039" y="432" width="25" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0ihb64o_di" bpmnElement="processOofHomingSolution"> + <dc:Bounds x="1293" y="429" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_07u9d7f_di" bpmnElement="SequenceFlow_07u9d7f"> + <di:waypoint xsi:type="dc:Point" x="1393" y="469" /> + <di:waypoint xsi:type="dc:Point" x="1509" y="469" /> + <di:waypoint xsi:type="dc:Point" x="1509" y="391" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1451" y="448" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="EndEvent_1rxyas7_di" bpmnElement="throwMSOWorkflowException1"> + <dc:Bounds x="507" y="275" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="480" y="311" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0t0fs4n_di" bpmnElement="ScriptTask_0t0fs4n"> + <dc:Bounds x="364" y="253" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1bub8mj_di" bpmnElement="SequenceFlow_1bub8mj"> + <di:waypoint xsi:type="dc:Point" x="464" y="293" /> + <di:waypoint xsi:type="dc:Point" x="507" y="293" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="485.5" y="272" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_02eywxz_di" bpmnElement="SequenceFlow_02eywxz"> + <di:waypoint xsi:type="dc:Point" x="324" y="293" /> + <di:waypoint xsi:type="dc:Point" x="364" y="293" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="344" y="272" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn2:definitions> diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/OofHomingTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/OofHomingTest.java new file mode 100644 index 0000000000..45645be7cd --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/OofHomingTest.java @@ -0,0 +1,824 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +/* + * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property. + */ +package org.openecomp.mso.bpmn.common; + +import org.camunda.bpm.engine.test.Deployment; +import org.junit.Ignore; +import org.junit.Test; +import org.openecomp.mso.bpmn.core.WorkflowException; +import org.openecomp.mso.bpmn.core.domain.AllottedResource; +import org.openecomp.mso.bpmn.core.domain.HomingSolution; +import org.openecomp.mso.bpmn.core.domain.ModelInfo; +import org.openecomp.mso.bpmn.core.domain.NetworkResource; +import org.openecomp.mso.bpmn.core.domain.Resource; +import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition; +import org.openecomp.mso.bpmn.core.domain.ServiceInstance; +import org.openecomp.mso.bpmn.core.domain.VnfResource; +import org.openecomp.mso.bpmn.mock.FileUtil; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; +import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.MockGetServiceResourcesCatalogDataByModelUuid; +import static org.openecomp.mso.bpmn.mock.StubResponseOof.mockOof; +import static org.openecomp.mso.bpmn.mock.StubResponseOof.mockOof_500; + + +/** + * Test the OOF Homing subflow building block. + */ +public class OofHomingTest extends WorkflowTest { + + ServiceDecomposition serviceDecomposition = new ServiceDecomposition(); + String subscriber = ""; + String subscriber2 = ""; + + private final CallbackSet callbacks = new CallbackSet(); + + public OofHomingTest() throws IOException { + String oofCallback = FileUtil.readResourceFile("__files/BuildingBlocks/oofCallbackInfraVnf"); + String oofCallback2 = FileUtil.readResourceFile("__files/BuildingBlocks/oofCallback2AR1Vnf"); + String oofCallback3 = FileUtil.readResourceFile("__files/BuildingBlocks/oofCallback2AR1Vnf2Net"); + + String oofCallbackNoSolution = FileUtil. + readResourceFile("__files/BuildingBlocks/oofCallbackNoSolutionFound"); + String oofCallbackPolicyException = FileUtil. + readResourceFile("__files/BuildingBlocks/oofCallbackPolicyException"); + String oofCallbackServiceException = FileUtil. + readResourceFile("__files/BuildingBlocks/oofCallbackServiceException"); + + callbacks.put("oof", JSON, "oofResponse", oofCallback); + callbacks.put("oof2", JSON, "oofResponse", oofCallback2); + callbacks.put("oof3", JSON, "oofResponse", oofCallback3); + callbacks.put("oofNoSol", JSON, "oofResponse", oofCallbackNoSolution); + callbacks.put("oofPolicyEx", JSON, "oofResponse", oofCallbackPolicyException); + callbacks.put("oofServiceEx", JSON, "oofResponse", oofCallbackServiceException); + + // Service Model + ModelInfo sModel = new ModelInfo(); + sModel.setModelCustomizationName("testModelCustomizationName"); + sModel.setModelInstanceName("testModelInstanceName"); + sModel.setModelInvariantUuid("testModelInvariantId"); + sModel.setModelName("testModelName"); + sModel.setModelUuid("testModelUuid"); + sModel.setModelVersion("testModelVersion"); + // Service Instance + ServiceInstance si = new ServiceInstance(); + si.setInstanceId("testServiceInstanceId123"); + // Allotted Resources + List<AllottedResource> arList = new ArrayList<AllottedResource>(); + AllottedResource ar = new AllottedResource(); + ar.setResourceId("testResourceIdAR"); + ar.setResourceInstanceName("testARInstanceName"); + ModelInfo arModel = new ModelInfo(); + arModel.setModelCustomizationUuid("testModelCustomizationUuidAR"); + arModel.setModelInvariantUuid("testModelInvariantIdAR"); + arModel.setModelName("testModelNameAR"); + arModel.setModelVersion("testModelVersionAR"); + arModel.setModelUuid("testARModelUuid"); + arModel.setModelType("testModelTypeAR"); + ar.setModelInfo(arModel); + AllottedResource ar2 = new AllottedResource(); + ar2.setResourceId("testResourceIdAR2"); + ar2.setResourceInstanceName("testAR2InstanceName"); + ModelInfo arModel2 = new ModelInfo(); + arModel2.setModelCustomizationUuid("testModelCustomizationUuidAR2"); + arModel2.setModelInvariantUuid("testModelInvariantIdAR2"); + arModel2.setModelName("testModelNameAR2"); + arModel2.setModelVersion("testModelVersionAR2"); + arModel2.setModelUuid("testAr2ModelUuid"); + arModel2.setModelType("testModelTypeAR2"); + ar2.setModelInfo(arModel2); + arList.add(ar); + arList.add(ar2); + // Vnfs + List<VnfResource> vnfList = new ArrayList<VnfResource>(); + VnfResource vnf = new VnfResource(); + vnf.setResourceId("testResourceIdVNF"); + vnf.setResourceInstanceName("testVnfInstanceName"); + ModelInfo vnfModel = new ModelInfo(); + vnfModel.setModelCustomizationUuid("testModelCustomizationUuidVNF"); + vnfModel.setModelInvariantUuid("testModelInvariantIdVNF"); + vnfModel.setModelName("testModelNameVNF"); + vnfModel.setModelVersion("testModelVersionVNF"); + vnfModel.setModelUuid("testVnfModelUuid"); + vnfModel.setModelType("testModelTypeVNF"); + vnf.setModelInfo(vnfModel); + vnfList.add(vnf); + System.out.println("SERVICE DECOMP: " + serviceDecomposition.getServiceResourcesJsonString()); + serviceDecomposition.setModelInfo(sModel); + serviceDecomposition.setServiceAllottedResources(arList); + serviceDecomposition.setServiceVnfs(vnfList); + serviceDecomposition.setServiceInstance(si); + + // Subscriber + subscriber = "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberCommonSiteId\": \"DALTX0101\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}"; + subscriber2 = "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}"; + } + + @Test + @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"}) + public void testHoming_success_2AR1Vnf() throws Exception { + + mockOof(); + + String businessKey = UUID.randomUUID().toString(); + Map<String, Object> variables = new HashMap<>(); + setVariables(variables); + + invokeSubProcess("Homing", businessKey, variables); + + injectWorkflowMessages(callbacks, "oof2"); + + waitForProcessEnd(businessKey, 10000); + + //Get Variables + WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, + "WorkflowException"); + ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, + "serviceDecomposition"); + String expectedOofRequest = (String) getVariableFromHistory(businessKey, "oofRequest"); + + Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR"); + HomingSolution resourceARHoming = resourceAR.getHomingSolution(); + Resource resourceAR2 = serviceDecompositionExp.getServiceResource("testResourceIdAR2"); + HomingSolution resourceARHoming2 = resourceAR2.getHomingSolution(); + Resource resourceVNF = serviceDecompositionExp.getServiceResource("testResourceIdVNF"); + HomingSolution resourceVNFHoming = resourceVNF.getHomingSolution(); + String resourceARHomingString = resourceARHoming.toString(); + resourceARHomingString = resourceARHomingString.replaceAll("\\s+", " "); + String resourceARHoming2String = resourceARHoming2.toString(); + resourceARHoming2String = resourceARHoming2String.replaceAll("\\s+", " "); + String resourceVNFHomingString = resourceVNFHoming.toString(); + resourceVNFHomingString = resourceVNFHomingString.replaceAll("\\s+", " "); + expectedOofRequest = expectedOofRequest.replaceAll("\\s+", ""); + + assertNull(workflowException); + assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01", + resourceARHoming.getVnf().getResourceId(),"aic", "dfwtx", + "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"", + "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""), + resourceARHomingString); + assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2", + resourceARHoming2.getVnf().getResourceId(),"aic", "testCloudRegionId2", + null, null), resourceARHoming2String); + assertEquals(homingSolutionCloud("cloud","aic", "testCloudRegionId3", + "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"", + "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""), + resourceVNFHomingString); + assertEquals(verifyOofRequest(), expectedOofRequest); + } + + @Test + @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"}) + public void testHoming_success_2AR1Vnf2Net() throws Exception { + + mockOof(); + + String businessKey = UUID.randomUUID().toString(); + Map<String, Object> variables = new HashMap<>(); + setVariables2(variables); + + invokeSubProcess("Homing", businessKey, variables); + + injectWorkflowMessages(callbacks, "oof3"); + + waitForProcessEnd(businessKey, 10000); + + //Get Variables + WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, + "WorkflowException"); + ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, + "serviceDecomposition"); + String expectedOofRequest = (String) getVariableFromHistory(businessKey, "oofRequest"); + + Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR"); + HomingSolution resourceARHoming = resourceAR.getHomingSolution(); + Resource resourceAR2 = serviceDecompositionExp.getServiceResource("testResourceIdAR2"); + HomingSolution resourceARHoming2 = resourceAR2.getHomingSolution(); + Resource resourceVNF = serviceDecompositionExp.getServiceResource("testResourceIdVNF"); + HomingSolution resourceVNFHoming = resourceVNF.getHomingSolution(); + Resource resourceNet = serviceDecompositionExp.getServiceResource("testResourceIdNet"); + HomingSolution resourceNetHoming = resourceNet.getHomingSolution(); + Resource resourceNet2 = serviceDecompositionExp.getServiceResource("testResourceIdNet2"); + HomingSolution resourceNetHoming2 = resourceNet2.getHomingSolution(); + + String resourceARHomingString = resourceARHoming.toString(); + resourceARHomingString = resourceARHomingString.replaceAll("\\s+", " "); + String resourceARHoming2String = resourceARHoming2.toString(); + resourceARHoming2String = resourceARHoming2String.replaceAll("\\s+", " "); + String resourceVNFHomingString = resourceVNFHoming.toString(); + resourceVNFHomingString = resourceVNFHomingString.replaceAll("\\s+", " "); + String resourceNetHomingString = resourceNetHoming.toString(); + resourceNetHomingString = resourceNetHomingString.replaceAll("\\s+", " "); + String resourceNetHoming2String = resourceNetHoming2.toString(); + resourceNetHoming2String = resourceNetHoming2String.replaceAll("\\s+", " "); + expectedOofRequest = expectedOofRequest.replaceAll("\\s+", ""); + + + assertNull(workflowException); + assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01", + resourceARHoming.getVnf().getResourceId(),"aic", "dfwtx", + "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"", + "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""), + resourceARHomingString); + assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2", + resourceARHoming2.getVnf().getResourceId(), + "aic", "testCloudRegionId2", + null, null), resourceARHoming2String); + assertEquals(homingSolutionCloud("cloud","aic", + "testCloudRegionId3", + "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"", + "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""), + resourceVNFHomingString); + assertEquals(homingSolutionService("service", "testServiceInstanceIdNet", + "testVnfHostNameNet", resourceNetHoming.getVnf().getResourceId(),"aic", + "testCloudRegionIdNet", + null, null), resourceNetHomingString); + assertEquals(homingSolutionCloud("cloud", "aic", + "testCloudRegionIdNet2", + "\"f1d563e8-e714-4393-8f99-cc480144a05n\", \"j1d563e8-e714-4393-8f99-cc480144a05n\"", + "\"s1d563e8-e714-4393-8f99-cc480144a05n\", \"b1d563e8-e714-4393-8f99-cc480144a05n\""), + resourceNetHoming2String); + assertEquals(verifyOofRequest(), expectedOofRequest); + + } + + @Test + @Ignore + @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/BuildingBlock/DecomposeService.bpmn", + "subprocess/ReceiveWorkflowMessage.bpmn"}) + public void testHoming_success_vnfResourceList() throws Exception { + + // Create a Service Decomposition + MockGetServiceResourcesCatalogDataByModelUuid("2f7f309d-c842-4644-a2e4-34167be5eeb4", + "/BuildingBlocks/oofCatalogResp.json"); + String busKey = UUID.randomUUID().toString(); + Map<String, Object> vars = new HashMap<>(); + setVariablesForServiceDecomposition(vars, "testRequestId123", + "ff5256d2-5a33-55df-13ab-12abad84e7ff"); + invokeSubProcess("DecomposeService", busKey, vars); + + ServiceDecomposition sd = (ServiceDecomposition) getVariableFromHistory(busKey, + "serviceDecomposition"); + System.out.println("In testHoming_success_vnfResourceList, ServiceDecomposition = " + sd); + List<VnfResource> vnfResourceList = sd.getServiceVnfs(); +//System.out.println(" vnfResourceList = " + vnfResourceList); + vnfResourceList.get(0).setResourceId("test-resource-id-000"); + + // Invoke Homing + + mockOof(); + + String businessKey = UUID.randomUUID().toString(); + Map<String, Object> variables = new HashMap<>(); + variables.put("homingService", "oof"); + variables.put("isDebugLogEnabled", "true"); + variables.put("msoRequestId", "testRequestId"); + variables.put("serviceInstanceId", "testServiceInstanceId"); + variables.put("serviceDecomposition", sd); + variables.put("subscriberInfo", subscriber2); + HashMap customerLocation = new HashMap<String, Object>(); + customerLocation.put("customerLatitude", "32.89748"); + customerLocation.put("customerLongitude", "-97.040443"); + customerLocation.put("customerName", "xyz"); + variables.put("customerLatitude", "32.89748"); + variables.put("customerLongitude", "-97.040443"); + variables.put("customerName", "xyz"); + variables.put("customerLocation", customerLocation); + variables.put("cloudOwner", "amazon"); + variables.put("cloudRegionId", "TNZED"); + + invokeSubProcess("Homing", businessKey, variables); + injectWorkflowMessages(callbacks, "oof3"); + waitForProcessEnd(businessKey, 10000); + + //Get Variables + + WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, + "WorkflowException"); + ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, + "serviceDecomposition"); + System.out.println("serviceDecompositionExp is: " + serviceDecompositionExp); + + Resource resourceVnf = serviceDecompositionExp.getServiceResource("test-resource-id-000"); + System.out.println("resourceVnf is: " + resourceVnf); + HomingSolution resourceVnfHoming = resourceVnf.getHomingSolution(); + + String resourceVnfHomingString = resourceVnfHoming.toString(); + System.out.println("resourceVnfHomingString is: " + resourceVnfHomingString); + resourceVnfHomingString = resourceVnfHomingString.replaceAll("\\s+", " "); + System.out.println("Now resourceVnfHomingString is: " + resourceVnfHomingString); + + assertNull(workflowException); + + //Verify request + String oofRequest = (String) getVariableFromHistory(businessKey, "oofRequest"); + System.out.println("oofRequest is: " + oofRequest); + assertEquals(FileUtil.readResourceFile("__files/BuildingBlocks/oofRequest_infravnf"). + replaceAll("\n", "").replaceAll("\r", ""). + replaceAll("\t", ""), oofRequest.replaceAll("\n", ""). + replaceAll("\r", "").replaceAll("\t", "")); + + //System.out.println("resourceVnfHoming.getVnf().getResourceId() is: " + resourceVnfHoming.getVnf().getResourceId()); + + assertEquals(homingSolutionService("service", "service-instance-01234", + "MDTNJ01", "test-resource-id-000","att-aic", + "mtmnj1a", + "\"f1d563e8-e714-4393-8f99-cc480144a05e\"," + + " \"j1d563e8-e714-4393-8f99-cc480144a05e\"", + "\"s1d563e8-e714-4393-8f99-cc480144a05e\"," + + " \"b1d563e8-e714-4393-8f99-cc480144a05e\""), resourceVnfHomingString); + } + + @Test + @Ignore // 1802 merge + @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"}) + public void testHoming_success_existingLicense() throws Exception { + + mockOof(); + + String businessKey = UUID.randomUUID().toString(); + Map<String, Object> variables = new HashMap<String, Object>(); + setVariablesExistingLicense(variables); + + invokeSubProcess("Homing", businessKey, variables); + + injectWorkflowMessages(callbacks, "sniro"); + + waitForProcessEnd(businessKey, 10000); + + //Get Variables + WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); + ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition"); + String oofRequest = (String) getVariableFromHistory(businessKey, "sniroRequest"); + + Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR"); + HomingSolution resourceARHoming = (HomingSolution) resourceAR.getHomingSolution(); + Resource resourceAR2 = serviceDecompositionExp.getServiceResource("testResourceIdAR2"); + HomingSolution resourceARHoming2 = (HomingSolution) resourceAR2.getHomingSolution(); + Resource resourceVNF = serviceDecompositionExp.getServiceResource("testResourceIdVNF"); + HomingSolution resourceVNFHoming = (HomingSolution) resourceVNF.getHomingSolution(); + String resourceARHomingString = resourceARHoming.toString(); + resourceARHomingString = resourceARHomingString.replaceAll("\\s+", " "); + String resourceARHoming2String = resourceARHoming2.toString(); + resourceARHoming2String = resourceARHoming2String.replaceAll("\\s+", " "); + String resourceVNFHomingString = resourceVNFHoming.toString(); + resourceVNFHomingString = resourceVNFHomingString.replaceAll("\\s+", " "); + oofRequest = oofRequest.replaceAll("\\s+", ""); + + assertNull(workflowException); + assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01", + "aic", "dfwtx", "KDTNJ01", + "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"", + "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""), + resourceARHomingString); + assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2", + resourceARHoming2.getVnf().getResourceId(),"aic", "testCloudRegionId2", + null, null), resourceARHoming2String); + assertEquals(homingSolutionCloud("cloud", "aic", + "testCloudRegionId3", + "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"", + "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""), + resourceVNFHomingString); + assertEquals(verifyOofRequestExistingLicense(), oofRequest); + + } + + @Test + @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"}) + public void testHoming_error_inputVariable() throws Exception { + + String businessKey = UUID.randomUUID().toString(); + Map<String, Object> variables = new HashMap<>(); + setVariables3(variables); + + invokeSubProcess("Homing", businessKey, variables); + + waitForProcessEnd(businessKey, 10000); + + //Get Variables + WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, + "WorkflowException"); + + assertEquals("WorkflowException[processKey=Homing,errorCode=4000,errorMessage=A required " + + "input variable is missing or null]", workflowException.toString()); + } + + @Test + @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"}) + public void testHoming_error_badResponse() throws Exception { + mockOof_500(); + + String businessKey = UUID.randomUUID().toString(); + Map<String, Object> variables = new HashMap<>(); + setVariables(variables); + + invokeSubProcess("Homing", businessKey, variables); + + waitForProcessEnd(businessKey, 10000); + + //Get Variables + WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, + "WorkflowException"); + + assertEquals("WorkflowException[processKey=Homing,errorCode=500,errorMessage=Received a " + + "Bad Sync Response from Sniro/OOF.]", workflowException.toString()); + } + + @Test + @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"}) + public void testHoming_error_oofNoSolution() throws Exception { + mockOof(); + + String businessKey = UUID.randomUUID().toString(); + Map<String, Object> variables = new HashMap<>(); + setVariables(variables); + + invokeSubProcess("Homing", businessKey, variables); + + injectWorkflowMessages(callbacks, "oofNoSol"); + + waitForProcessEnd(businessKey, 10000); + + //Get Variables + WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, + "WorkflowException"); + + assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=No solution found " + + "for plan 08e1b8cf-144a-4bac-b293-d5e2eedc97e8]", workflowException.toString()); + } + + @Test + @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"}) + public void testHoming_error_oofPolicyException() throws Exception { + mockOof(); + + String businessKey = UUID.randomUUID().toString(); + Map<String, Object> variables = new HashMap<>(); + setVariables(variables); + + invokeSubProcess("Homing", businessKey, variables); + + injectWorkflowMessages(callbacks, "oofPolicyEx"); + + waitForProcessEnd(businessKey, 10000); + + //Get Variables + WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, + "WorkflowException"); + + assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=OOF Async Callback " + + "Response contains a Request Error Policy Exception: Message content size exceeds the allowable " + + "limit]", workflowException.toString()); + } + + @Test + @Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"}) + public void testHoming_error_oofServiceException() throws Exception { + mockOof(); + + String businessKey = UUID.randomUUID().toString(); + Map<String, Object> variables = new HashMap<>(); + setVariables(variables); + + invokeSubProcess("Homing", businessKey, variables); + + injectWorkflowMessages(callbacks, "oofServiceEx"); + + waitForProcessEnd(businessKey, 10000); + + //Get Variables + WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, + "WorkflowException"); + + assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=OOF Async Callback " + + "Response contains a Request Error Service Exception: OOF PlacementError: " + + "requests.exceptions.HTTPError: 404 Client Error: Not Found for " + + "url: http://135.21.171.200:8091/v1/plans/97b4e303-5f75-492c-8fb2-21098281c8b8]", + workflowException.toString()); + } + + + private void setVariables(Map<String, Object> variables) { + variables.put("homingService", "oof"); + HashMap customerLocation = new HashMap<String, Object>(); + customerLocation.put("customerLatitude", "32.89748"); + customerLocation.put("customerLongitude", "-97.040443"); + customerLocation.put("customerName", "xyz"); + variables.put("customerLatitude", "32.89748"); + variables.put("customerLongitude", "-97.040443"); + variables.put("customerName", "xyz"); + variables.put("customerLocation", customerLocation); + variables.put("cloudOwner", "amazon"); + variables.put("cloudRegionId", "TNZED"); + variables.put("isDebugLogEnabled", "true"); + // variables.put("mso-request-id", "testRequestId"); + variables.put("msoRequestId", "testRequestId"); + variables.put("serviceInstanceId", "testServiceInstanceId"); + variables.put("serviceDecomposition", serviceDecomposition); + variables.put("subscriberInfo", subscriber2); + } + + private void setVariables2(Map<String, Object> variables) { + List<NetworkResource> netList = new ArrayList<NetworkResource>(); + NetworkResource net = new NetworkResource(); + net.setResourceId("testResourceIdNet"); + ModelInfo netModel = new ModelInfo(); + netModel.setModelCustomizationUuid("testModelCustomizationUuidNet"); + netModel.setModelInvariantUuid("testModelInvariantIdNet"); + netModel.setModelName("testModelNameNet"); + netModel.setModelVersion("testModelVersionNet"); + net.setModelInfo(netModel); + netList.add(net); + NetworkResource net2 = new NetworkResource(); + net2.setResourceId("testResourceIdNet2"); + ModelInfo netModel2 = new ModelInfo(); + netModel2.setModelCustomizationUuid("testModelCustomizationUuidNet2"); + netModel2.setModelCustomizationName("testModelCustomizationNameNet2"); + netModel2.setModelInvariantUuid("testModelInvariantIdNet2"); + netModel2.setModelName("testModelNameNet2"); + netModel2.setModelVersion("testModelVersionNet2"); + net2.setModelInfo(netModel2); + netList.add(net2); + serviceDecomposition.setServiceNetworks(netList); + + variables.put("homingService", "oof"); + HashMap customerLocation = new HashMap<String, Object>(); + customerLocation.put("customerLatitude", "32.89748"); + customerLocation.put("customerLongitude", "-97.040443"); + customerLocation.put("customerName", "xyz"); + variables.put("customerLatitude", "32.89748"); + variables.put("customerLongitude", "-97.040443"); + variables.put("customerName", "xyz"); + variables.put("customerLocation", customerLocation); + variables.put("cloudOwner", "amazon"); + variables.put("cloudRegionId", "TNZED"); + variables.put("isDebugLogEnabled", "true"); + variables.put("msoRequestId", "testRequestId"); + variables.put("serviceInstanceId", "testServiceInstanceId"); + variables.put("serviceDecomposition", serviceDecomposition); + variables.put("subscriberInfo", subscriber2); + } + + private void setVariables3(Map<String, Object> variables) { + variables.put("homingService", "oof"); + HashMap customerLocation = new HashMap<String, Object>(); + customerLocation.put("customerLatitude", "32.89748"); + customerLocation.put("customerLongitude", "-97.040443"); + customerLocation.put("customerName", "xyz"); + variables.put("customerLatitude", "32.89748"); + variables.put("customerLongitude", "-97.040443"); + variables.put("customerName", "xyz"); + variables.put("customerLocation", customerLocation); + variables.put("cloudOwner", "amazon"); + variables.put("cloudRegionId", "TNZED"); + variables.put("isDebugLogEnabled", "true"); + // variables.put("mso-request-id", "testRequestId"); + variables.put("msoRequestId", "testRequestId"); + variables.put("serviceInstanceId", "testServiceInstanceId"); + variables.put("serviceDecomposition", null); + variables.put("subscriberInfo", subscriber2); + } + + private void setVariablesExistingLicense(Map<String, Object> variables) { + HomingSolution currentHomingSolution = new HomingSolution(); + serviceDecomposition.getServiceVnfs().get(0).setCurrentHomingSolution(currentHomingSolution); + serviceDecomposition.getServiceVnfs().get(0).getCurrentHomingSolution().getLicense().addEntitlementPool("testEntitlementPoolId1"); + serviceDecomposition.getServiceVnfs().get(0).getCurrentHomingSolution().getLicense().addEntitlementPool("testEntitlementPoolId2"); + + serviceDecomposition.getServiceVnfs().get(0).getCurrentHomingSolution().getLicense().addLicenseKeyGroup("testLicenseKeyGroupId1"); + serviceDecomposition.getServiceVnfs().get(0).getCurrentHomingSolution().getLicense().addLicenseKeyGroup("testLicenseKeyGroupId2"); + + variables.put("isDebugLogEnabled", "true"); + variables.put("msoRequestId", "testRequestId"); + variables.put("serviceInstanceId", "testServiceInstanceId"); + variables.put("serviceDecomposition", serviceDecomposition); + variables.put("subscriberInfo", subscriber2); + + } + + /*private String homingSolutionService(String resourceModuleName, String serviceInstanceId, String vnfHostname, String cloudOwner, + String cloudRegionId, String licenseList) { + String solution = ""; + if (licenseList == null || licenseList == "") { + solution = "{\n" + + " \"resourceModuleName\": \"" + resourceModuleName + "\",\n" + + " \"serviceResourceId\": \"some_resource_id\",\n" + + " \"solution\": {\n" + + " \"identifierType\": \"serviceInstanceId\",\n" + + " \"identifiers\": [\"" + serviceInstanceId + "\"]\n" + + " }\n" + + " \"assignmentInfo\": [\n" + + " { \"key\": \"cloudOwner\", \"value\": \"" + cloudOwner + "\" },\n" + + " { \"key\": \"vnfHostName\", \"value\": \"" + vnfHostname + "\" },\n" + + " { \"key\": \"isRehome\", \"value\": \"False\" },\n" + + " { \"key\": \"cloudRegionId\", \"value\": \"" + cloudRegionId + "\" }\n" + + " ]\n" + + " }"; + } else { + solution = "{\n" + + " \"resourceModuleName\": \"" + resourceModuleName + "\",\n" + + " \"serviceResourceId\": \"some_resource_id\",\n" + + " \"solution\": {\n" + + " \"identifierType\": \"service_instance_id\",\n" + + " \"identifiers\": [\"" + serviceInstanceId + "\"]\n" + + " }\n" + + " \"assignmentInfo\": [\n" + + " { \"key\": \"cloudOwner\", \"value\": \"" + cloudOwner + "\" },\n" + + " { \"key\": \"vnfHostName\", \"value\": \"" + vnfHostname + "\" },\n" + + " { \"key\": \"isRehome\", \"value\": \"False\" },\n" + + " { \"key\": \"cloudRegionId\", \"value\": \"" + cloudRegionId + "\" }\n" + + " ], " + + " \"licenseSolutions\" : [ {\"licenseKeyGroupUUID\": [" + licenseList + "]} ] " + + "}"; + } + return solution; + }*/ + private String homingSolutionService(String type, String serviceInstanceId, String vnfHostname, + String vnfResourceId, String cloudOwner, + String cloudRegionId, String enList, + String licenseList){ + + String solution = ""; + if(enList == null){ + solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"serviceInstanceId\" : \"" + + serviceInstanceId + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" + + cloudRegionId + "\", " + "\"vnf\" : { \"resourceId\" : \"" + vnfResourceId + + "\", \"resourceType\" : \"VNF\", \"resourceInstance\" : { }, \"homingSolution\" : { \"license\" :" + + " { }, \"rehome\" : false }, \"vnfHostname\" : \"" + vnfHostname + "\" }, \"license\" : { }," + + " \"rehome\" : false } }"; + }else{ + //language=JSON + solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"serviceInstanceId\" : \"" + + serviceInstanceId + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" + + cloudRegionId + "\", \"vnf\" : { \"resourceId\" : \"" + vnfResourceId + "\", \"resourceType\" :" + + " \"VNF\", \"resourceInstance\" : { }, \"homingSolution\" : { \"license\" : { }, \"rehome\" :" + + " false }, \"vnfHostname\" : \"" + vnfHostname + "\" }, \"license\" : { \"entitlementPoolList\" :" + + " [ " + enList + " ], \"licenseKeyGroupList\" : [ " + licenseList + " ] }, \"rehome\" : false } }"; + } + return solution; + } + + /*private String homingSolutionCloud(String resourceModuleName, String cloudOwner, + String cloudRegionId, String licenseList) { + String solution = ""; + if (licenseList == null || licenseList == "") { + solution = "{\n" + + " \"resourceModuleName\": \"" + resourceModuleName + "\",\n" + + " \"serviceResourceId\": \"some_resource_id\",\n" + + " \"solution\": {\n" + + " \"identifierType\": \"cloudRegionId\",\n" + + " \"cloudOwner\": \"" + cloudOwner + "\",\n" + + " \"identifiers\": [\"" + cloudRegionId + "\"]\n" + + " }\n" + + " \"assignmentInfo\": [\n" + + " { \"key\": \"cloudOwner\", \"value\": \"" + cloudOwner + "\" },\n" + + " { \"key\": \"cloudRegionId\", \"value\": \"" + cloudRegionId + "\" }\n" + + " ]\n" + + "}"; + } else { + solution = "{\n" + + " \"resourceModuleName\": \"" + resourceModuleName + "\",\n" + + " \"serviceResourceId\": \"some_resource_id\",\n" + + " \"solution\": {\n" + + " \"identifierType\": \"cloudRegionId\",\n" + + " \"cloudOwner\": \"" + cloudOwner + "\",\n" + + " \"identifiers\": [\"" + cloudRegionId + "\"]\n" + + " }\n" + + " \"assignmentInfo\": [\n" + + " { \"key\": \"cloudOwner\", \"value\": \"" + cloudOwner + "\" },\n" + + " { \"key\": \"cloudRegionId\", \"value\": \"" + cloudRegionId + "\" }\n" + + " ]," + + " \"licenseSolutions\" : [ {\"licenseKeyGroupUUID\": [" + licenseList + "]} ] } " + + "}"; + } + return solution; + }*/ + private String homingSolutionCloud(String type, String cloudOwner, + String cloudRegionId, String enList, + String licenseList){ + String solution = ""; + if(enList == null){ + solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" + + cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId + + "\", \"license\" : { }, \"rehome\" : false } }"; + }else{ + solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" + + cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId + + "\", \"license\" : { \"entitlementPoolList\" : [ " + enList + " ], \"licenseKeyGroupList\" : [ " + + licenseList + " ] }, \"rehome\" : false } }"; + } + return solution; + } + + private void setVariablesForServiceDecomposition(Map<String, Object> variables, String requestId, String siId) { + variables.put("homingService", "oof"); + variables.put("isDebugLogEnabled", "true"); + variables.put("mso-request-id", requestId); + variables.put("msoRequestId", requestId); + variables.put("serviceInstanceId", siId); + HashMap customerLocation = new HashMap<String, Object>(); + customerLocation.put("customerLatitude", "32.89748"); + customerLocation.put("customerLongitude", "-97.040443"); + customerLocation.put("customerName", "xyz"); + variables.put("customerLatitude", "32.89748"); + variables.put("customerLongitude", "-97.040443"); + variables.put("customerName", "xyz"); + variables.put("customerLocation", customerLocation); + variables.put("cloudOwner", "amazon"); + variables.put("cloudRegionId", "TNZED"); + + + String serviceModelInfo = "{\"modelInvariantId\":\"1cc4e2e4-eb6e-404d-a66f-c8733cedcce8\",\"modelUuid\":" + + "\"2f7f309d-c842-4644-a2e4-34167be5eeb4\",\"modelName\":\"vCPE Service\",\"modelVersion\":\"2.0\",}"; + variables.put("serviceModelInfo", serviceModelInfo); + } + + private String verifyOofRequest() { + String request = "{\"requestInfo\":{\"transactionId\":\"testRequestId\",\"requestId\":\"testRequestId\"," + + "\"callbackUrl\":\"http://localhost:28090/workflows/messages/message/oofResponse/testRequestId\"," + + "\"sourceId\":\"so\",\"requestType\":\"create\",\"numSolutions\":1,\"optimizers\":[\"placement\"]," + + "\"timeout\":600},\"placementInfo\":{\"requestParameters\":{\"customerLatitude\":" + + "\"32.89748\",\"customerLongitude\":\"-97.040443\",\"customerName\":\"xyz\"},\"subscriberInfo\":" + + "{\"globalSubscriberId\":\"SUB12_0322_DS_1201\",\"subscriberName\":\"SUB_12_0322_DS_1201\"," + + "\"subscriberCommonSiteId\":\"\"},\"placementDemands\":[{\"resourceModuleName\":\"ALLOTTED_RESOURCE\"" + + ",\"serviceResourceId\":\"testResourceIdAR\",\"tenantId\":" + + "\"null\",\"resourceModelInfo\":{\"modelInvariantId\":\"testModelInvariantIdAR\"," + + "\"modelVersionId\":\"testARModelUuid\",\"modelName\":\"testModelNameAR\",\"modelType\":" + + "\"testModelTypeAR\",\"modelVersion\":\"testModelVersionAR\",\"modelCustomizationName\":\"\"}}," + + "{\"resourceModuleName\":\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR2\"," + + "\"tenantId\":\"null\",\"resourceModelInfo\":{\"modelInvariantId\":\"testModelInvariantIdAR2\"," + + "\"modelVersionId\":\"testAr2ModelUuid\",\"modelName\":\"testModelNameAR2\"," + + "\"modelType\":\"testModelTypeAR2\",\"modelVersion\":\"testModelVersionAR2\"," + + "\"modelCustomizationName\":\"\"}}]},\"serviceInfo\":" + + "{\"serviceInstanceId\":\"testServiceInstanceId123\"," + + "\"serviceName\":\"null\",\"modelInfo\":{\"modelType\":\"\",\"modelInvariantId\":" + + "\"testModelInvariantId\",\"modelVersionId\":\"testModelUuid\",\"modelName\":\"testModelName\"," + + "\"modelVersion\":\"testModelVersion\",\"modelCustomizationName\":\"" + + "\"}},\"licenseInfo\":{\"licenseDemands\":[{\"resourceModuleName\":\"VNF\",\"serviceResourceId\":" + + "\"testResourceIdVNF\",\"resourceInstanceType\":\"VNF\",\"resourceModelInfo\":{\"modelInvariantId\":" + + "\"testModelInvariantIdVNF\",\"modelVersionId\":\"testVnfModelUuid\",\"modelName\":" + + "\"testModelNameVNF\",\"modelType\":\"testModelTypeVNF\",\"modelVersion\":\"testModelVersionVNF\"," + + "\"modelCustomizationName\":\"\"}}]}}"; + return request; + } + + private String verifyOofRequestExistingLicense(){ + String request = "{\"requestInfo\":{\"transactionId\":\"testRequestId\",\"requestId\":\"testRequestId\"," + + "\"callbackUrl\":\"http://localhost:28090/workflows/messages/message/SNIROResponse/testRequestId\"," + + "\"sourceId\":\"mso\",\"requestType\":\"speedchanged\",\"optimizer\":[\"placement\",\"license\"]," + + "\"numSolutions\":1,\"timeout\":1800},\"placementInfo\":{\"serviceModelInfo\":{\"modelType\":\"\"," + + "\"modelInvariantId\":\"testModelInvariantId\",\"modelVersionId\":\"testModelUuid\",\"modelName\":" + + "\"testModelName\",\"modelVersion\":\"testModelVersion\"},\"subscriberInfo\":" + + "{\"globalSubscriberId\":\"SUB12_0322_DS_1201\",\"subscriberName\":\"SUB_12_0322_DS_1201\"," + + "\"subscriberCommonSiteId\":\"\"},\"demandInfo\":{\"placementDemand\":[{\"resourceInstanceType\":" + + "\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR\",\"resourceModuleName\":\"\"," + + "\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR\"," + + "\"modelInvariantId\":\"testModelInvariantIdAR\",\"modelName\":\"testModelNameAR\"," + + "\"modelVersion\":\"testModelVersionAR\",\"modelVersionId\":\"testARModelUuid\",\"modelType\":" + + "\"testModelTypeAR\"},\"tenantId\":\"\",\"tenantName\":\"\"},{\"resourceInstanceType\":" + + "\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR2\",\"resourceModuleName\":" + + "\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR2\"," + + "\"modelInvariantId\":\"testModelInvariantIdAR2\",\"modelName\":\"testModelNameAR2\"," + + "\"modelVersion\":\"testModelVersionAR2\",\"modelVersionId\":\"testAr2ModelUuid\"," + + "\"modelType\":\"testModelTypeAR2\"},\"tenantId\":\"\",\"tenantName\":\"\"}],\"licenseDemand\":" + + "[{\"resourceInstanceType\":\"VNF\",\"serviceResourceId\":\"testResourceIdVNF\"," + + "\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":" + + "\"testModelCustomizationUuidVNF\",\"modelInvariantId\":\"testModelInvariantIdVNF\"," + + "\"modelName\":\"testModelNameVNF\",\"modelVersion\":\"testModelVersionVNF\"," + + "\"modelVersionId\":\"testVnfModelUuid\",\"modelType\":\"testModelTypeVNF\"}," + + "\"existingLicense\":[{\"entitlementPoolUUID\":[\"testEntitlementPoolId1\"," + + "\"testEntitlementPoolId2\"],\"licenseKeyGroupUUID\":[\"testLicenseKeyGroupId1\"," + + "\"testLicenseKeyGroupId2\"]}]}]},\"policyId\":[],\"serviceInstanceId\":" + + "\"testServiceInstanceId123\",\"orderInfo\":\"{\\\"requestParameters\\\":null}\"}}"; + return request; + } +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/HomingTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SniroHomingTest.java index 79bc96d6fd..541dc6e7a9 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/HomingTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/SniroHomingTest.java @@ -41,15 +41,12 @@ import org.junit.Test; import org.openecomp.mso.bpmn.core.WorkflowException; import org.openecomp.mso.bpmn.core.domain.*; import org.openecomp.mso.bpmn.mock.FileUtil; -import org.openecomp.mso.bpmn.common.WorkflowTest; /** - * Test the Homing subflow building block. - * - * @author cb645j + * Test the SNIRO Homing subflow building block. */ -public class HomingTest extends WorkflowTest { +public class SniroHomingTest extends WorkflowTest { ServiceDecomposition serviceDecomposition = new ServiceDecomposition(); String subscriber = ""; @@ -57,7 +54,7 @@ public class HomingTest extends WorkflowTest { private final CallbackSet callbacks = new CallbackSet(); - public HomingTest() throws IOException { + public SniroHomingTest() throws IOException { String sniroCallback = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallback2AR1Vnf"); String sniroCallback2 = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallback2AR1Vnf2Net"); String sniroCallback3 = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallbackInfraVnf"); @@ -253,6 +250,7 @@ public class HomingTest extends WorkflowTest { String businessKey = UUID.randomUUID().toString(); Map<String, Object> variables = new HashMap<>(); + variables.put("homingService", "sniro"); variables.put("isDebugLogEnabled", "true"); variables.put("msoRequestId", "testRequestId"); variables.put("serviceInstanceId", "testServiceInstanceId"); @@ -362,7 +360,7 @@ public class HomingTest extends WorkflowTest { //Get Variables WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException"); - assertEquals("WorkflowException[processKey=Homing,errorCode=500,errorMessage=Received a Bad Sync Response from Sniro.]", workflowException.toString()); + assertEquals("WorkflowException[processKey=Homing,errorCode=500,errorMessage=Received a Bad Sync Response from Sniro/OOF.]", workflowException.toString()); } @Test @@ -432,6 +430,7 @@ public class HomingTest extends WorkflowTest { private void setVariables(Map<String, Object> variables) { + variables.put("homingService", "sniro"); variables.put("isDebugLogEnabled", "true"); // variables.put("mso-request-id", "testRequestId"); variables.put("msoRequestId", "testRequestId"); @@ -463,6 +462,7 @@ public class HomingTest extends WorkflowTest { netList.add(net2); serviceDecomposition.setServiceNetworks(netList); + variables.put("homingService", "sniro"); variables.put("isDebugLogEnabled", "true"); variables.put("msoRequestId", "testRequestId"); variables.put("serviceInstanceId", "testServiceInstanceId"); @@ -471,6 +471,7 @@ public class HomingTest extends WorkflowTest { } private void setVariables3(Map<String, Object> variables) { + variables.put("homingService", "sniro"); variables.put("isDebugLogEnabled", "true"); // variables.put("mso-request-id", "testRequestId"); variables.put("msoRequestId", "testRequestId"); @@ -519,6 +520,7 @@ public class HomingTest extends WorkflowTest { } private void setVariablesForServiceDecomposition(Map<String, Object> variables, String requestId, String siId) { + variables.put("homingService", "sniro"); variables.put("isDebugLogEnabled", "true"); variables.put("mso-request-id", requestId); variables.put("msoRequestId", requestId); diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/VnfAdapterRestV1Test.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/VnfAdapterRestV1Test.java index b143204fc9..ea49176df0 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/VnfAdapterRestV1Test.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/VnfAdapterRestV1Test.java @@ -229,7 +229,6 @@ public class VnfAdapterRestV1Test extends WorkflowTest { } @Test - @Ignore // 1802 merge @Deployment(resources = { "subprocess/VnfAdapterRestV1.bpmn" }) @@ -261,7 +260,6 @@ public class VnfAdapterRestV1Test extends WorkflowTest { } @Test - @Ignore // 1802 merge @Deployment(resources = { "subprocess/VnfAdapterRestV1.bpmn" }) @@ -293,7 +291,6 @@ public class VnfAdapterRestV1Test extends WorkflowTest { } @Test - @Ignore // 1802 merge @Deployment(resources = { "subprocess/VnfAdapterRestV1.bpmn" }) @@ -324,7 +321,6 @@ public class VnfAdapterRestV1Test extends WorkflowTest { logEnd(); } - @Ignore // 1802 merge @Test @Deployment(resources = { "subprocess/VnfAdapterRestV1.bpmn" @@ -357,7 +353,6 @@ public class VnfAdapterRestV1Test extends WorkflowTest { } @Test - @Ignore // 1802 merge @Deployment(resources = { "subprocess/VnfAdapterRestV1.bpmn" }) diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseOof.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseOof.java new file mode 100644 index 0000000000..b969b382c0 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseOof.java @@ -0,0 +1,67 @@ +/* + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * 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========================================================= + */ + +/* + * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property. + */ +package org.openecomp.mso.bpmn.mock; + +import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; +import static com.github.tomakehurst.wiremock.client.WireMock.post; +import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; +import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; + +/** + * StubResponseOof.java class + */ +public class StubResponseOof { + + public static void setupAllMocks() { + + } + + public static void mockOof() { + stubFor(post(urlEqualTo("/api/oof/v1/placement")) + .willReturn(aResponse() + .withStatus(202) + .withHeader("Content-Type", "application/json"))); + } + + public static void mockOof(String responseFile) { + stubFor(post(urlEqualTo("/api/oof/v1/placement")) + .willReturn(aResponse() + .withStatus(202) + .withHeader("Content-Type", "application/json") + .withBodyFile(responseFile))); + } + + public static void mockOof_400() { + stubFor(post(urlEqualTo("/api/oof/v1/placement")) + .willReturn(aResponse() + .withStatus(400) + .withHeader("Content-Type", "application/json"))); + } + + public static void mockOof_500() { + stubFor(post(urlEqualTo("/api/oof/v1/placement")) + .willReturn(aResponse() + .withStatus(500) + .withHeader("Content-Type", "application/json"))); + } + +} diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseVNFAdapter.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseVNFAdapter.java index b4aca5081e..d518ab0b1c 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseVNFAdapter.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/mock/StubResponseVNFAdapter.java @@ -80,6 +80,10 @@ public class StubResponseVNFAdapter { .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "application/xml"))); + stubFor(post(urlEqualTo("/vnfs/rest/v1/vnfs/" + vnfId + "/vf-modules" + vfModuleId)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "application/xml"))); } public static void mockVNFPut(String vfModuleId, int statusCode) { @@ -87,6 +91,10 @@ public class StubResponseVNFAdapter { .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "application/xml"))); + stubFor(put(urlEqualTo("/vnfs/rest/v1/vnfs/vnfId/vf-modules" + vfModuleId)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "application/xml"))); } public static void mockVNFPut(String vnfId, String vfModuleId, int statusCode) { @@ -94,6 +102,10 @@ public class StubResponseVNFAdapter { .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "application/xml"))); + stubFor(put(urlEqualTo("/vnfs/rest/v1/vnfs/" + vnfId + "/vf-modules" + vfModuleId)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "application/xml"))); } public static void mockVNFDelete(String vnfId, String vfModuleId, int statusCode) { @@ -101,6 +113,10 @@ public class StubResponseVNFAdapter { .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "application/xml"))); + stubFor(delete(urlEqualTo("/vnfs/rest/v1/vnfs/" + vnfId + "/vf-modules" + vfModuleId)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "application/xml"))); } public static void mockVNFRollbackDelete(String vfModuleId, int statusCode) { @@ -108,6 +124,10 @@ public class StubResponseVNFAdapter { .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "application/xml"))); + stubFor(delete(urlEqualTo("/vnfs/rest/v1/vnfs/vnfId/vf-modules" + vfModuleId + "/rollback")) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "application/xml"))); } public static void mockPutVNFVolumeGroup(String volumeGroupId, int statusCode) { @@ -115,6 +135,10 @@ public class StubResponseVNFAdapter { .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "application/xml"))); + stubFor(put(urlEqualTo("/vnfs/rest/v1/volume-groups/" + volumeGroupId)) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "application/xml"))); } public static void mockPutVNFVolumeGroupRollback(String volumeGroupId, int statusCode) { @@ -122,24 +146,38 @@ public class StubResponseVNFAdapter { .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "application/xml"))); + stubFor(delete(urlMatching("/vnfs/rest/v1/volume-groups/" + volumeGroupId + "/rollback")) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "application/xml"))); } public static void mockPostVNFVolumeGroup(int statusCode) { stubFor(post(urlEqualTo("/vnfs/v1/volume-groups")) .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "application/xml"))); + stubFor(post(urlEqualTo("/vnfs/rest/v1/volume-groups")) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "application/xml"))); } public static void mockVNFAdapterRest(String vnfId) { stubFor(post(urlEqualTo("/vnfs/v1/vnfs/" + vnfId + "/vf-modules")) .willReturn(aResponse() .withStatus(200))); + stubFor(post(urlEqualTo("/vnfs/rest/v1/vnfs/" + vnfId + "/vf-modules")) + .willReturn(aResponse() + .withStatus(200))); } public static void mockVNFAdapterRest_500(String vnfId) { stubFor(post(urlEqualTo("/vnfs/v1/vnfs/" + vnfId + "/vf-modules")) .willReturn(aResponse() .withStatus(500))); + stubFor(post(urlEqualTo("/vnfs/rest/v1/vnfs/" + vnfId + "/vf-modules")) + .willReturn(aResponse() + .withStatus(500))); } public static void mockVfModuleDelete(String volumeGroupId) { @@ -147,6 +185,10 @@ public class StubResponseVNFAdapter { .willReturn(aResponse() .withStatus(202) .withHeader("Content-Type", "application/xml"))); + stubFor(delete(urlMatching("/vnfs/rest/v1/volume-groups/"+ volumeGroupId)) + .willReturn(aResponse() + .withStatus(202) + .withHeader("Content-Type", "application/xml"))); } public static void mockVfModuleDelete(String volumeGroupId, int statusCode) { @@ -154,5 +196,9 @@ public class StubResponseVNFAdapter { .willReturn(aResponse() .withStatus(statusCode) .withHeader("Content-Type", "application/xml"))); + stubFor(delete(urlMatching("/vnfs/rest/v1/volume-groups/78987")) + .willReturn(aResponse() + .withStatus(statusCode) + .withHeader("Content-Type", "application/xml"))); } } diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/CallbackHeaderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/CallbackHeaderTest.java new file mode 100644 index 0000000000..995bb5b19c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/CallbackHeaderTest.java @@ -0,0 +1,42 @@ +/*
+* ============LICENSE_START=======================================================
+* ONAP : SO
+* ================================================================================
+* Copyright 2018 TechMahindra
+*=================================================================================
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+* ============LICENSE_END=========================================================
+*/
+package org.openecomp.mso.client.sdnc.sync;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class CallbackHeaderTest {
+
+ CallbackHeader cbh = new CallbackHeader();
+ CallbackHeader cbh1 = new CallbackHeader("reqId", "respCode", "respMsg");
+
+ @Test
+ public void testCallbackHeader() {
+ cbh.setRequestId("requestId");
+ cbh.setResponseCode("responseCode");
+ cbh.setResponseMessage("responseMessage");
+ assertEquals(cbh.getRequestId(), "requestId");
+ assertEquals(cbh.getResponseCode(), "responseCode");
+ assertEquals(cbh.getResponseMessage(), "responseMessage");
+ assert(cbh.toString()!=null);
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/ObjectFactoryTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/ObjectFactoryTest.java new file mode 100644 index 0000000000..04bc7dc132 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/ObjectFactoryTest.java @@ -0,0 +1,39 @@ +/*
+* ============LICENSE_START=======================================================
+* ONAP : SO
+* ================================================================================
+* Copyright 2018 TechMahindra
+*=================================================================================
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+* ============LICENSE_END=========================================================
+*/
+
+package org.openecomp.mso.client.sdnc.sync;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class ObjectFactoryTest {
+ ObjectFactory of = new ObjectFactory();
+
+ @Test
+ public void testObjectFactory() {
+ of.createRequestHeader();
+ of.createSDNCAdapterRequest();
+ of.createSDNCAdapterResponse();
+
+
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/RequestHeaderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/RequestHeaderTest.java new file mode 100644 index 0000000000..1d04572207 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/RequestHeaderTest.java @@ -0,0 +1,45 @@ +/*
+* ============LICENSE_START=======================================================
+* ONAP : SO
+* ================================================================================
+* Copyright 2018 TechMahindra
+*=================================================================================
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+* ============LICENSE_END=========================================================
+*/
+package org.openecomp.mso.client.sdnc.sync;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class RequestHeaderTest {
+ RequestHeader rh = new RequestHeader();
+
+ @Test
+ public void testRequestHeader() {
+ rh.setRequestId("requestId");
+ rh.setSvcInstanceId("svcInstanceId");
+ rh.setSvcAction("svcAction");
+ rh.setSvcOperation("svcOperation");
+ rh.setCallbackUrl("callbackUrl");
+ rh.setMsoAction("msoAction");
+ assertEquals(rh.getRequestId(), "requestId");
+ assertEquals(rh.getSvcInstanceId(), "svcInstanceId");
+ assertEquals(rh.getSvcAction(), "svcAction");
+ assertEquals(rh.getSvcOperation(), "svcOperation");
+ assertEquals(rh.getCallbackUrl(), "callbackUrl");
+ assertEquals(rh.getMsoAction(), "msoAction");
+ assert(rh.toString()!=null);
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/RequestTunablesTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/RequestTunablesTest.java new file mode 100644 index 0000000000..1219f69874 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/RequestTunablesTest.java @@ -0,0 +1,58 @@ +/*
+* ============LICENSE_START=======================================================
+* ONAP : SO
+* ================================================================================
+* Copyright 2018 TechMahindra
+*=================================================================================
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+* ============LICENSE_END=========================================================
+*/
+package org.openecomp.mso.client.sdnc.sync;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+import org.openecomp.mso.properties.MsoPropertiesFactory;
+
+public class RequestTunablesTest {
+ MsoPropertiesFactory mpf = new MsoPropertiesFactory();
+
+ RequestTunables rt = new RequestTunables("reqId", "msoAction", "operation", "action", mpf);
+
+ @Test
+ public void testRequestTunables() {
+ rt.setReqId("reqId");
+ rt.setReqMethod("reqMethod");
+ rt.setMsoAction("msoAction");
+ rt.setAction("action");
+ rt.setOperation("operation");
+ rt.setSdncUrl("sdncUrl");
+ rt.setTimeout("timeout");
+ rt.setAsyncInd("asyncInd");
+ rt.setHeaderName("headerName");
+ rt.setSdncaNotificationUrl("sdncaNotificationUrl");
+ rt.setNamespace("namespace");
+ assertEquals(rt.getReqId(), "reqId");
+ assertEquals(rt.getReqMethod(), "reqMethod");
+ assertEquals(rt.getMsoAction(), "msoAction");
+ assertEquals(rt.getAction(), "action");
+ assertEquals(rt.getOperation(), "operation");
+ assertEquals(rt.getSdncUrl(), "sdncUrl");
+ assertEquals(rt.getTimeout(), "timeout");
+ assertEquals(rt.getAsyncInd(), "asyncInd");
+ assertEquals(rt.getHeaderName(), "headerName");
+ assertEquals(rt.getSdncaNotificationUrl(), "sdncaNotificationUrl");
+ assertEquals(rt.getNamespace(), "namespace");
+ assert(rt.toString()!=null);
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterCallbackRequestTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterCallbackRequestTest.java new file mode 100644 index 0000000000..53fbb0a4aa --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterCallbackRequestTest.java @@ -0,0 +1,41 @@ +/*
+* ============LICENSE_START=======================================================
+* ONAP : SO
+* ================================================================================
+* Copyright 2018 TechMahindra
+*=================================================================================
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+* ============LICENSE_END=========================================================
+*/
+package org.openecomp.mso.client.sdnc.sync;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class SDNCAdapterCallbackRequestTest {
+
+ SDNCAdapterCallbackRequest sdnccall = new SDNCAdapterCallbackRequest();
+ CallbackHeader cbh = new CallbackHeader();
+ Object o = new Object();
+
+ @Test
+ public void testSDNCAdapterCallbackRequest() {
+ sdnccall.setCallbackHeader(cbh);
+ sdnccall.setRequestData(o);
+ assertEquals(sdnccall.getCallbackHeader(), cbh);
+ assertEquals(sdnccall.getRequestData(), o);
+ assert(sdnccall.toString()!=null);
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterRequestTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterRequestTest.java new file mode 100644 index 0000000000..6b10f25e70 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/SDNCAdapterRequestTest.java @@ -0,0 +1,39 @@ +/*
+* ============LICENSE_START=======================================================
+* ONAP : SO
+* ================================================================================
+* Copyright 2018 TechMahindra
+*=================================================================================
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+* ============LICENSE_END=========================================================
+*/
+package org.openecomp.mso.client.sdnc.sync;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class SDNCAdapterRequestTest {
+
+ SDNCAdapterRequest adapter = new SDNCAdapterRequest();
+ RequestHeader rh = new RequestHeader();
+ Object o = new Object();
+
+ @Test
+ public void testSDNCAdapterRequest() {
+ adapter.setRequestHeader(rh);
+ adapter.setRequestData(o);
+ assertEquals(adapter.getRequestHeader(), rh);
+ assertEquals(adapter.getRequestData(), o);
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/SDNCResponseTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/SDNCResponseTest.java new file mode 100644 index 0000000000..d8c23249c4 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/client/sdnc/sync/SDNCResponseTest.java @@ -0,0 +1,43 @@ +/*
+* ============LICENSE_START=======================================================
+* ONAP : SO
+* ================================================================================
+* Copyright 2018 TechMahindra
+*=================================================================================
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+* ============LICENSE_END=========================================================
+*/
+package org.openecomp.mso.client.sdnc.sync;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class SDNCResponseTest {
+
+ SDNCResponse sdnc = new SDNCResponse("reqId");
+ SDNCResponse sdnc1 = new SDNCResponse("reqId", 0, "respMsg");
+
+ @Test
+ public void testSDNCResponse() {
+ sdnc.setReqId("reqId");
+ sdnc.setRespCode(0);
+ sdnc.setRespMsg("respMsg");
+ sdnc.setSdncResp("sdncResp");
+ assertEquals(sdnc.getReqId(), "reqId");
+ assertEquals(sdnc.getRespCode(), 0);
+ assertEquals(sdnc.getRespMsg(), "respMsg");
+ assertEquals(sdnc.getSdncResp(), "sdncResp");
+ assert(sdnc.toString()!= null);
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf new file mode 100644 index 0000000000..3559708728 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf @@ -0,0 +1,109 @@ +{ + "transactionId": "testRequestId", + "requestId": "testRequestId", + "requestState": "complete", + "statusMessage": "success", + "solutions": { + "licenseSolutions": [ + { + "entitlementPoolUUID": [ + "f1d563e8-e714-4393-8f99-cc480144a05e", + "j1d563e8-e714-4393-8f99-cc480144a05e" + ], + "licenseKeyGroupUUID": [ + "s1d563e8-e714-4393-8f99-cc480144a05e", + "b1d563e8-e714-4393-8f99-cc480144a05e" + ], + "resourceModuleName": "vHNPortalaaS_primary_1", + "serviceResourceId": "testResourceIdAR" + }, + { + "entitlementPoolUUID": [ + "91d563e8-e714-4393-8f99-cc480144a05e", + "21d563e8-e714-4393-8f99-cc480144a05e" + ], + "licenseKeyGroupUUID": [ + "31d563e8-e714-4393-8f99-cc480144a05e", + "71d563e8-e714-4393-8f99-cc480144a05e" + ], + "resourceModuleName": "vHNPortalaaS_secondary_1", + "serviceResourceId": "testResourceIdVNF" + } + ], + "placementSolutions": [ + { + "resourceModuleName": "ALLOTTED_RESOURCE", + "serviceInstanceId": "testSIID1", + "serviceResourceId": "testResourceIdAR", + "solution": { + "identifierType": "serviceInstanceId", + "identifiers": ["testSIID1"] + }, + "assignmentInfo": [ + { + "key": "cloudOwner", + "value": "aic" + }, + { + "key": "vnfHostName", + "value": "MDTNJ01" + }, + { + "key": "isRehome", + "value": "False" + }, + { + "key": "cloudRegionId", + "value": "dfwtx" + } + ] + }, + { "resourceModuleName": "ALLOTTED_RESOURCE", + "serviceResourceId": "testResourceIdAR2", + "solution": { + "identifierType": "serviceInstanceId", + "identifiers": ["testSIID2"] + }, + "assignmentInfo": [ + { + "key": "cloudOwner", + "value": "aic" + }, + { + "key": "vnfHostName", + "value": "testVnfHostname2" + }, + { + "key": "isRehome", + "value": "False" + }, + { + "key": "cloudRegionId", + "value": "testCloudRegionId2" + } + ] + }, + { + "resourceModuleName": "VNF", + "serviceResourceId": "testResourceIdVNF", + "solution": { + "identifierType": "cloudRegionId", + "cloudOwner": "aic", + "identifiers": [ + "testCloudRegionId3" + ] + }, + "assignmentInfo": [ + { + "key": "cloudOwner", + "value": "aic" + }, + { + "key": "cloudRegionId", + "value": "testCloudRegionId3" + } + ] + } + ] + } +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf2Net b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf2Net new file mode 100644 index 0000000000..30fa09afd9 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallback2AR1Vnf2Net @@ -0,0 +1,116 @@ +{ + "transactionId": "testRequestId", + "requestId": "testRequestId", + "requestState": "completed", + "statusMessage": "success", + "solutions": { + "licenseSolutions": [ + { + "resourceModuleName": "vHNPortalaaS_primary_1", + "serviceResourceId": "testResourceIdAR", + "entitlementPoolUUID": ["f1d563e8-e714-4393-8f99-cc480144a05e", + "j1d563e8-e714-4393-8f99-cc480144a05e"], + "licenseKeyGroupUUID": ["s1d563e8-e714-4393-8f99-cc480144a05e", + "b1d563e8-e714-4393-8f99-cc480144a05e"], + "entitlementPoolInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", + "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"], + "licenseKeyGroupInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", + "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"] + }, + { + "resourceModuleName": "net", + "serviceResourceId": "testResourceIdNet2", + "entitlementPoolUUID": ["f1d563e8-e714-4393-8f99-cc480144a05n", + "j1d563e8-e714-4393-8f99-cc480144a05n"], + "licenseKeyGroupUUID": ["s1d563e8-e714-4393-8f99-cc480144a05n", + "b1d563e8-e714-4393-8f99-cc480144a05n"], + "entitlementPoolInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", + "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"], + "licenseKeyGroupInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", + "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"] + }, + { + "resourceModuleName": "vHNPortalaaS_secondary_1", + "serviceResourceId": "testResourceIdVNF", + "entitlementPoolUUID": ["91d563e8-e714-4393-8f99-cc480144a05e", + "21d563e8-e714-4393-8f99-cc480144a05e"], + "licenseKeyGroupUUID": [ "31d563e8-e714-4393-8f99-cc480144a05e", + "71d563e8-e714-4393-8f99-cc480144a05e"], + "entitlementPoolInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", + "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"], + "licenseKeyGroupInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", + "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"] + }, + ], + "placementSolutions": [ + { + "resourceModuleName": "ALLOTTED_RESOURCE", + "serviceResourceId": "testResourceIdAR", + "solution": { + "identifierType": "serviceInstanceId", + "identifiers": ["testSIID1"] + }, + "assignmentInfo": [ + { "key": "cloudOwner", "value": "aic" }, + { "key": "vnfHostName", "value": "MDTNJ01" }, + { "key": "isRehome", "value": "False" }, + { "key": "cloudRegionId", "value": "dfwtx" } + ] + }, + { + "resourceModuleName": "ALLOTTED_RESOURCE", + "serviceResourceId": "testResourceIdAR2", + "solution": { + "identifierType": "serviceInstanceId", + "identifiers": ["testSIID2"] + }, + "assignmentInfo": [ + { "key": "cloudOwner", "value": "aic" }, + { "key": "vnfHostName", "value": "testVnfHostname2" }, + { "key": "isRehome", "value": "False" }, + { "key": "cloudRegionId", "value": "testCloudRegionId2" } + ] + }, + { + "resourceModuleName": "NETWORK", + "serviceResourceId": "testResourceIdNet", + "solution": { + "identifierType": "serviceInstanceId", + "identifiers": ["testServiceInstanceIdNet"] + }, + "assignmentInfo": [ + { "key": "cloudOwner", "value": "aic" }, + { "key": "vnfHostName", "value": "testVnfHostNameNet" }, + { "key": "isRehome", "value": "False" }, + { "key": "cloudRegionId", "value": "testCloudRegionIdNet" } + ] + }, + { + "resourceModuleName": "NETWORK", + "serviceResourceId": "testResourceIdNet2", + "solution": { + "identifierType": "cloudRegionId", + "cloudOwner": "aic", + "identifiers": ["testCloudRegionIdNet2"] + }, + "assignmentInfo": [ + { "key": "cloudOwner", "value": "aic" }, + { "key": "cloudRegionId", "value": "testCloudRegionIdNet2" } + ] + }, + { + "resourceModuleName": "VNF", + "serviceResourceId": "testResourceIdVNF", + "solution": { + "identifierType": "cloudRegionId", + "cloudOwner": "aic", + "identifiers": ["testCloudRegionId3"] + }, + "assignmentInfo": [ + { "key": "cloudOwner", "value": "aic" }, + { "key": "cloudRegionId", "value": "testCloudRegionId3" } + ] + } + ] + } +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackInfraVnf b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackInfraVnf new file mode 100644 index 0000000000..b4e748c6e7 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackInfraVnf @@ -0,0 +1,47 @@ +{ + "transactionId": "xxx-xxx-xxxx", + "requestId": "yyy-yyy-yyyy", + "requestStatus": "completed", + "statusMessage": "success", + "solutions": { + "placementSolutions": [ + { + "resourceModuleName": "vGMuxInfra", + "serviceResourceId": "some_resource_id", + "solution": { + "identifierType": "serviceInstanceId", + "identifiers": ["gjhd-098-fhd-987"] + }, + "assignmentInfo": [ + { "key": "cloudOwner", "value": "amazon" }, + { "key": "vnfHostName", "value": "ahr344gh" }, + { "key": "isRehome", "value": "False" }, + { "key": "cloudRegionId", "value": "1ac71fb8-ad43-4e16-9459-c3f372b8236d" } + ] + }, + { + "resourceModuleName": "vG", + "serviceResourceId": "some_resource_id", + "solution": { + "identifierType": "cloudRegionId", + "cloudOwner": "amazon", + "identifiers": ["gjhd-098-fhd-987"] + }, + "assignmentInfo": [ + { "key": "cloudOwner", "value": "amazon" }, + { "key": "cloudRegionId", "value": "1ac71fb8-ad43-4e16-9459-c3f372b8236d" } + ] + } + ], + "licenseSolutions": [ + { + "resourceModuleName": "vGMuxInfra", + "serviceResourceId": "some_resource_id", + "entitlementPoolUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"], + "licenseKeyGroupUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"], + "entitlementPoolInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"], + "licenseKeyGroupInvariantUUID": ["1ac71fb8-ad43-4e16-9459-c3f372b8236d", "834fc71fb8-ad43-4fh7-9459-c3f372b8236f"] + } + ] + } +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackNoSolutionFound b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackNoSolutionFound new file mode 100644 index 0000000000..8bb29f0c0a --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackNoSolutionFound @@ -0,0 +1,10 @@ +{ + "solutions": { + "placementSolutions": [], + "licenseSolutions": [] + }, + "transactionId": "08e1b8cf-144a-4bac-b293-d5e2eedc97e8", + "requestId": "02c2e322-5839-4c97-9d46-0a5fa6bb642e", + "requestStatus": "completed", + "statusMessage": "No solution found for plan 08e1b8cf-144a-4bac-b293-d5e2eedc97e8" +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackPolicyException b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackPolicyException new file mode 100644 index 0000000000..b82688428e --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackPolicyException @@ -0,0 +1,9 @@ +{ + "requestError": { + "policyException": { + "requestId": "ae81d9a8-c949-493a-999c-f76c80503233", + "text": "Message content size exceeds the allowable limit", + "messageId": "SVC0001" + } + } +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackServiceException b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackServiceException new file mode 100644 index 0000000000..de43e82c9e --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCallbackServiceException @@ -0,0 +1,12 @@ +{ + "requestError": { + "serviceException": { + "variables": [ + "severity", 400 + ], + "requestId": "ae81d9a8-c949-493a-999c-f76c80503233", + "text": "OOF PlacementError: requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http://135.21.171.200:8091/v1/plans/97b4e303-5f75-492c-8fb2-21098281c8b8", + "messageId": "SVC0001" + } + } +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCatalogResp.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCatalogResp.json new file mode 100644 index 0000000000..09026d1d8c --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofCatalogResp.json @@ -0,0 +1,47 @@ +{ + "serviceResources": { + "serviceType": null, + "serviceAllottedResources": [], + "modelInfo": { + "modelInvariantUuid": "1cc4e2e4-eb6e-404d-a66f-c8733cedcce8", + "modelName": "ADIOD vRouter vCE 011017 Service", + "modelVersion": "5.0", + "modelUuid": "2f7f309d-c842-4644-a2e4-34167be5eeb4" + }, + "serviceRole": null, + "serviceVnfs": [ + { + "toscaNodeType": "org.openecomp.resource.vf.AdiodVce", + "vfModules": [ + { + "initialCount": null, + "vfModuleLabel": null, + "modelInfo": { + "modelInvariantUuid": "7fb428e1-8000-4800-a71a-f21b946973c5", + "modelName": "AdiodVce..base_vCE..module-0", + "modelVersion": "2", + "modelCustomizationUuid": "1126e7e2-b377-4fd2-ad48-660a20caa829", + "modelUuid": "435d57e1-93a2-4d58-aa5d-f2df2d126276" + }, + "hasVolumeGroup": true, + "isBase": true + } + ], + "modelInfo": { + "modelInvariantUuid": "fc72435b-4366-4257-a2f7-c70a3a998a7b", + "modelName": "ADIoD vCE", + "modelVersion": "2.0", + "modelCustomizationUuid": "bdaeed40-c964-4966-bdb8-51320dcaf587", + "modelInstanceName": "ADIoD vCE 0", + "modelUuid": "ec2bd873-5b2c-47e4-8858-f0495fa1dae1" + }, + "nfRole": "", + "nfType": "", + "nfFunction": "", + "nfNamingCode": "", + "multiStageDesign": "N" + } + ], + "serviceNetworks": [] + } +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofRequest b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofRequest new file mode 100644 index 0000000000..42b2a0f24a --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofRequest @@ -0,0 +1,99 @@ +{ + "requestInfo": { + "transactionId": "testRequestId-xxx-xxx", + "requestId": "testRequestId-yyy-yyy", + "callbackUrl": "http://localhost:28090/workflows/messages/message/oofResponse/testRequestId", + "sourceId": "so", + "requestType": "create", + "numSolutions": 1, + "optimizers": ["placement"], + "timeout": 600 + }, + "placementInfo": { + "requestParameters": { "customerLatitude": 32.89748, "customerLongitude": -97.040443, "customerName": "xyz" }, + "placementDemands": [ + { + "resourceModuleName": "vGMuxInfra", + "serviceResourceId": "vGMuxInfra-xx", + "tenantId": "vGMuxInfra-tenant", + "resourceModelInfo": { + "modelInvariantId": "vGMuxInfra-modelInvariantId", + "modelVersionId": "vGMuxInfra-versionId", + "modelName": "vGMuxInfra-model", + "modelType": "resource", + "modelVersion": "1.0", + "modelCustomizationName": "vGMuxInfra-customeModelName" + } + }, + { + "resourceModuleName": "vG", + "serviceResourceId": "71d563e8-e714-4393-8f99-cc480144a05e", + "tenantId": "vG-tenant", + "resourceModelInfo": { + "modelInvariantId": "vG-modelInvariantId", + "modelVersionId": "vG-versionId", + "modelName": "vG-model", + "modelType": "resource", + "modelVersion": "1.0", + "modelCustomizationName": "vG-customeModelName" + }, + "existingCandidates": [ + { + "identifierType": "service_instance_id", + "cloudOwner": "", + "identifiers": ["gjhd-098-fhd-987"] + } + ], + "excludedCandidates": [ + { + "identifierType": "service_instance_id", + "cloudOwner": "", + "identifiers": ["gjhd-098-fhd-987"] + }, + { + "identifierType": "vimId", + "cloudOwner": "vmware", + "identifiers": ["NYMDT67"] + } + ], + "requiredCandidates": [ + { + "identifierType": "vimId", + "cloudOwner": "amazon", + "identifiers": ["TXAUS219"] + } + ] + } + ] + }, + "serviceInfo": { + "serviceInstanceId": "d61b2543-5914-4b8f-8e81-81e38575b8ec", + "serviceName": "vCPE", + "modelInfo": { + "modelInvariantId": "vCPE-invariantId", + "modelVersionId": "vCPE-versionId", + "modelName": "vCPE-model", + "modelType": "service", + "modelVersion": "1.0", + "modelCustomizationName": "" + } + }, + "licenseDemands": [ + { + "resourceModuleName": "vGMuxInfra", + "serviceResourceId": "vGMuxInfra-xx", + "resourceModelInfo": { + "modelInvariantId": "vGMuxInfra-modelInvariantId", + "modelVersionId": "vGMuxInfra-versionId", + "modelName": "vGMuxInfra-model", + "modelType": "resource", + "modelVersion": "1.0", + "modelCustomizationName": "" + }, + "existingLicenses": { + "entitlementPoolUUID": ["87257b49-9602-4ca1-9817-094e52bc873b", "43257b49-9602-4fe5-9337-094e52bc9435"], + "licenseKeyGroupUUID": ["87257b49-9602-4ca1-9817-094e52bc873b", "43257b49-9602-4fe5-9337-094e52bc9435"] + } + } + ] +}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofRequest_infravnf b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofRequest_infravnf new file mode 100644 index 0000000000..67c9fbedc9 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/BuildingBlocks/oofRequest_infravnf @@ -0,0 +1,56 @@ +{ + "requestInfo": { + "transactionId": "testRequestId", + "requestId": "testRequestId", + "callbackUrl": "http://localhost:28090/workflows/messages/message/oofResponse/testRequestId", + "sourceId": "so", + "requestType": "create", + "numSolutions": 1, + "optimizers": ["placement"], + "timeout": 600 }, + "placementInfo": { + "requestParameters": { + "customerLatitude": "32.89748", + "customerLongitude": "-97.040443", + "customerName": "xyz" }, + "subscriberInfo": { "globalSubscriberId": "SUB12_0322_DS_1201", + "subscriberName": "SUB_12_0322_DS_1201", + "subscriberCommonSiteId": "" }, + "placementDemands": [ + {"resourceModuleName": "VNF","serviceResourceId": "test-resource-id-000","tenantId": "null","resourceModelInfo": { + "modelInvariantId": "fc72435b-4366-4257-a2f7-c70a3a998a7b", + "modelVersionId": "ec2bd873-5b2c-47e4-8858-f0495fa1dae1", + "modelName": "ADIoD vCE", + "modelType": "", + "modelVersion": "2.0", + "modelCustomizationName": "" }} + ] + }, + "serviceInfo": { + "serviceInstanceId": "ff5256d2-5a33-55df-13ab-12abad84e7ff", + "serviceName": "null", + "modelInfo": { + "modelType": "", + "modelInvariantId": "1cc4e2e4-eb6e-404d-a66f-c8733cedcce8", + "modelVersionId": "2f7f309d-c842-4644-a2e4-34167be5eeb4", + "modelName": "ADIOD vRouter vCE 011017 Service", + "modelVersion": "5.0", + "modelCustomizationName": "" + } + }, + "licenseInfo": { + "licenseDemands": [ + { +"resourceModuleName": "VNF", +"serviceResourceId": "test-resource-id-000", +"resourceInstanceType": "VNF", +"resourceModelInfo": { + "modelInvariantId": "fc72435b-4366-4257-a2f7-c70a3a998a7b", + "modelVersionId": "ec2bd873-5b2c-47e4-8858-f0495fa1dae1", + "modelName": "ADIoD vCE", + "modelType": "", + "modelVersion": "2.0", + "modelCustomizationName": "" + } + }] + }}
\ No newline at end of file diff --git a/bpmn/MSOCommonBPMN/src/test/resources/mso.bpmn.urn.properties b/bpmn/MSOCommonBPMN/src/test/resources/mso.bpmn.urn.properties index 049fc7c551..539d365150 100644 --- a/bpmn/MSOCommonBPMN/src/test/resources/mso.bpmn.urn.properties +++ b/bpmn/MSOCommonBPMN/src/test/resources/mso.bpmn.urn.properties @@ -1,131 +1,137 @@ -# Default URN Mappings for unit tests
-
-mso.rollback=true
-
-canopi.auth=757A94191D685FD2092AC1490730A4FC
-csi.aots.addincidentmanagement.endpoint=http://localhost:28090/AddIncidentManagementTicketRequest
-csi.networkstatus.endpoint=http://localhost:28090/SendManagedNetworkStatusNotification
-mso.csi.pwd=4EA237303511EFBBC37F17A351562131
-mso.csi.usrname=mso
-mso.msoKey=07a7159d3bf51a0e53be7a8f89699be7
-
-mso.healthcheck.log.debug=false
-
-mso.adapters.completemsoprocess.endpoint=http://localhost:28090/CompleteMsoProcess
-
-mso.adapters.db.endpoint=http://localhost:28090/dbadapters/RequestsDbAdapter
-mso.adapters.openecomp.db.endpoint=http://localhost:28090/dbadapters/RequestsDbAdapter
-mso.adapters.db.auth=757A94191D685FD2092AC1490730A4FC
-
-mso.adapters.network.endpoint=http://localhost:28090/networks/NetworkAdapter
-mso.adapters.network.rest.endpoint=http://localhost:28090/networks/rest/v1/networks
-
-mso.adapters.po.auth=757A94191D685FD2092AC1490730A4FC
-mso.adapters.po.password=3141634BF7E070AA289CF2892C986C0B
-mso.po.timeout=PT60S
-mso.default.adapter.namespace=http://org.openecomp.mso
-mso.adapters.workflow.message.endpoint=http://localhost:28090/workflows/messages/message
-
-aai.auth=26AFB797A6A57960D5D718491925C50F77CDC22AC394B3DBA09950D8FD1C0764
-
-policy.endpoint=https://mtanjvsgcvm02.nvp.cip.att.com:8081/pdp/api/
-policy.client.auth=Basic bTAzNzQzOnBvbGljeVIwY2sk
-policy.auth=Basic dGVzdHBkcDphbHBoYTEyMw==
-policy.environment=TEST
-
-appc.topic.read=APPC-TEST-AMDOCS2
-appc.topic.write=APPC-TEST-AMDOCS1-DEV3
-appc.topic.read.timeout=120000
-appc.client.response.timeout=120000
-appc.service=ueb
-appc.poolMembers=uebsb93kcdc.it.att.com:3904,uebsb92kcdc.it.att.com:3904,uebsb91kcdc.it.att.com:3904
-appc.client.key=iaEMAfjsVsZnraBP
-appc.client.secret=wcivUjsjXzmGFBfxMmyJu9dz
-
-mso.adapters.sdnc.endpoint=http://localhost:28090/SDNCAdapter
-mso.adapters.sdnc.rest.endpoint=http://localhost:28090/SDNCAdapter/v1/sdnc
-mso.adapters.sdnc.timeout=PT60S
-mso.sdnc.firewall.yang.model=http://com/openecomp/svc/mis/firewall-lite-gui
-mso.sdnc.firewall.yang.model.version=2015-05-15
-mso.sdnc.password=3141634BF7E070AA289CF2892C986C0B
-mso.sdnc.timeout.firewall.minutes=20
-mso.callbackRetryAttempts=5
-mso.sdnc.timeout=PT10S
-mso.sdnc.timeout.ucpe.async.hours=120
-mso.sdnc.timeout.ucpe.async.minutes=5
-mso.workflow.message.endpoint=http://localhost:28080/mso/WorkflowMesssage
-mso.workflow.sdncadapter.callback=http://localhost:28080/mso/SDNCAdapterCallbackService
-
-mso.sniro.auth=test:testpwd
-mso.sniro.timeout=PT30M
-mso.sniro.policies.dhv.2vvig=SNIRO.DistanceToLocationPolicy_vhngw,SNIRO.VNFPolicy_vhngatewayprimary1_v1,SNIRO.ResourceInstancePolicy_hngateway,SNIRO.ResourceRegionPolicy_hngateway_v1,SNIRO.VNFPolicy_vhngatewaysecondary1_v1,SNIRO.ZonePolicy_vhngw,SNIRO.PlacementOptimizationPolicy_dhv_v3,SNIRO.VNFPolicy_vhnportal_primary1_v1,SNIRO.ResourceInstancePolicy_vhnportal_v3,SNIRO.ResourceRegionPolicy_vhnportal_v1,SNIRO.VNFPolicy_vhnportalsecondary1_v1,SNIRO.ZonePolicy_vhnportal,SNIRO.DistanceToLocationPolicy_vvig,SNIRO.InventoryGroupPolicy_vvig,SNIRO.VNFPolicy_vvigprimary1_v1,SNIRO.ResourceInstancePolicy_vvig,SNIRO.VNFPolicy_vvigsecondary1_v1
-mso.sniro.policies.dhv.4vvig=SNIRO.DistanceToLocationPolicy_vhngw,SNIRO.VNFPolicy_vhngatewayprimary1_v1,SNIRO.ResourceInstancePolicy_hngateway,SNIRO.ResourceRegionPolicy_hngateway_v1,SNIRO.VNFPolicy_vhngatewaysecondary1_v1,SNIRO.ZonePolicy_vhngw,SNIRO.PlacementOptimizationPolicy_dhv_v3,SNIRO.VNFPolicy_vhnportal_primary1_v1,SNIRO.ResourceInstancePolicy_vhnportal_v3,SNIRO.ResourceRegionPolicy_vhnportal_v1,SNIRO.VNFPolicy_vhnportalsecondary1_v1,SNIRO.ZonePolicy_vhnportal,SNIRO.VNFPolicy_vvigprimary2_v1,SNIRO.VNFPolicy_vvigsecondary2_v1,SNIRO.DistanceToLocationPolicy_vvig,SNIRO.InventoryGroupPolicy_vvig,SNIRO.VNFPolicy_vvigprimary1_v1,SNIRO.ResourceInstancePolicy_vvig,SNIRO.VNFPolicy_vvigsecondary1_v1
-
-mso.service.agnostic.sniro.host=http://localhost:28090
-mso.service.agnostic.sniro.endpoint=/sniro/api/v2/placement
-
-mso.catalog.db.endpoint=http://localhost:28090/
-
-ruby.create-ticket-request.dmaap.username=m04768@mso.ecomp.att.com
-ruby.create-ticket-request.dmaap.password=eHQ1cUJrOUc
-ruby.create-ticket-request.publisher.topic=com.att.pdas.st1.msoCMFallout-v1
-
-
-mso.adapters.tenant.endpoint=http://localhost:28090/tenantAdapterMock
-mso.adapters.vnf-async.endpoint=http://localhost:28090/vnfs/VnfAdapterAsync
-mso.adapters.vnf.endpoint=http://localhost:28090/vnfs/VnfAdapter
-mso.adapters.vnf.rest.endpoint=http://localhost:28090/vnfs/rest/v1/vnfs
-mso.workflow.vnfadapter.create.callback=http://localhost:28080/mso/vnfAdapterNotify
-mso.workflow.vnfadapter.delete.callback=http://localhost:28080/mso/vnfAdapterNotify
-mso.workflow.vnfadapter.query.callback=http://localhost:28080/mso/services/VNFAdapterQuerCallbackV1
-mso.workflow.vnfadapter.rollback.callback=http://localhost:28080/mso/vnfAdapterNotify
-mso.workflow.createvce.delay.seconds=1
-mso.infra.customer.id=testCustIdInfra
-
-aai.endpoint=http://localhost:28090
-
-# AAI version mappings
-
-# Example to override default version for a resource:
-#mso.workflow.default.aai.vce.version=6
-#mso.workflow.default.aai.v6.vce.uri=/aai/v6/network/vces/vce
-mso.workflow.global.default.aai.namespace=http://org.openecomp.aai.inventory/
-mso.workflow.global.default.aai.version=8
-mso.workflow.default.aai.cloud-region.version=9
-mso.workflow.default.aai.generic-vnf.version=9
-
-mso.workflow.default.aai.v9.cloud-region.uri=/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic
-mso.workflow.default.aai.v8.customer.uri=/aai/v8/business/customers/customer
-mso.workflow.default.aai.v8.generic-query.uri=/aai/v8/search/generic-query
-mso.workflow.default.aai.v9.generic-vnf.uri=/aai/v9/network/generic-vnfs/generic-vnf
-mso.workflow.default.aai.v8.l3-network.uri=/aai/v8/network/l3-networks/l3-network
-mso.workflow.default.aai.v8.network-policy.uri=/aai/v8/network/network-policies/network-policy
-mso.workflow.default.aai.v8.nodes-query.uri=/aai/v8/search/nodes-query
-mso.workflow.default.aai.v8.route-table-reference.uri=/aai/v8/network/route-table-references/route-table-reference
-mso.workflow.default.aai.v8.tenant.uri=/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant
-mso.workflow.default.aai.v8.vce.uri=/aai/v8/network/vces/vce
-mso.workflow.default.aai.v8.vpn-binding.uri=/aai/v8/network/vpn-bindings/vpn-binding
-mso.workflow.notification.name=GenericNotificationService
-mso.bpmn.optimisticlockingexception.retrycount=3
-
-log.debug.CompleteMsoProcess=true
-log.debug.CreateNetworkInstanceInfra=true
-log.debug.CreateServiceInstanceInfra=true
-log.debug.DeleteNetworkInstanceInfra=true
-log.debug.FalloutHandler=true
-log.debug.GenericGetService=true
-log.debug.sdncAdapter=true
-log.debug.UpdateNetworkInstanceInfra=true
-log.debug.VnfAdapterRestV1=true
-log.debug.GenericGetNetwork=true
-log.debug.GenericGetVnf=true
-log.debug.GenericDeleteService=true
-log.debug.GenericDeleteNetwork=true
-log.debug.GenericDeleteVnf=true
-log.debug.vnfAdapterCreateV1=true
-log.debug.vnfAdapterRestV1=true
-
-sdno.health-check.dmaap.username=m04768@mso.ecomp.att.com
-sdno.health-check.dmaap.password=eHQ1cUJrOUc
-sdno.health-check.dmaap.subscriber.topic=com.att.sdno.test-health-diagnostic-v02
+# Default URN Mappings for unit tests + +mso.rollback=true + +canopi.auth=757A94191D685FD2092AC1490730A4FC +csi.aots.addincidentmanagement.endpoint=http://localhost:28090/AddIncidentManagementTicketRequest +csi.networkstatus.endpoint=http://localhost:28090/SendManagedNetworkStatusNotification +mso.csi.pwd=4EA237303511EFBBC37F17A351562131 +mso.csi.usrname=mso +mso.msoKey=07a7159d3bf51a0e53be7a8f89699be7 + +mso.healthcheck.log.debug=false + +mso.adapters.completemsoprocess.endpoint=http://localhost:28090/CompleteMsoProcess + +mso.adapters.db.endpoint=http://localhost:28090/dbadapters/RequestsDbAdapter +mso.adapters.openecomp.db.endpoint=http://localhost:28090/dbadapters/RequestsDbAdapter +mso.adapters.db.auth=757A94191D685FD2092AC1490730A4FC + +mso.adapters.network.endpoint=http://localhost:28090/networks/NetworkAdapter +mso.adapters.network.rest.endpoint=http://localhost:28090/networks/rest/v1/networks + +mso.adapters.po.auth=757A94191D685FD2092AC1490730A4FC +mso.adapters.po.password=3141634BF7E070AA289CF2892C986C0B +mso.po.timeout=PT60S +mso.default.adapter.namespace=http://org.openecomp.mso +mso.adapters.workflow.message.endpoint=http://localhost:28090/workflows/messages/message + +aai.auth=26AFB797A6A57960D5D718491925C50F77CDC22AC394B3DBA09950D8FD1C0764 + +policy.endpoint=https://mtanjvsgcvm02.nvp.cip.att.com:8081/pdp/api/ +policy.client.auth=Basic bTAzNzQzOnBvbGljeVIwY2sk +policy.auth=Basic dGVzdHBkcDphbHBoYTEyMw== +policy.environment=TEST + +appc.topic.read=APPC-TEST-AMDOCS2 +appc.topic.write=APPC-TEST-AMDOCS1-DEV3 +appc.topic.read.timeout=120000 +appc.client.response.timeout=120000 +appc.service=ueb +appc.poolMembers=uebsb93kcdc.it.att.com:3904,uebsb92kcdc.it.att.com:3904,uebsb91kcdc.it.att.com:3904 +appc.client.key=iaEMAfjsVsZnraBP +appc.client.secret=wcivUjsjXzmGFBfxMmyJu9dz + +mso.adapters.sdnc.endpoint=http://localhost:28090/SDNCAdapter +mso.adapters.sdnc.rest.endpoint=http://localhost:28090/SDNCAdapter/v1/sdnc +mso.adapters.sdnc.timeout=PT60S +mso.sdnc.firewall.yang.model=http://com/openecomp/svc/mis/firewall-lite-gui +mso.sdnc.firewall.yang.model.version=2015-05-15 +mso.sdnc.password=3141634BF7E070AA289CF2892C986C0B +mso.sdnc.timeout.firewall.minutes=20 +mso.callbackRetryAttempts=5 +mso.sdnc.timeout=PT10S +mso.sdnc.timeout.ucpe.async.hours=120 +mso.sdnc.timeout.ucpe.async.minutes=5 +mso.workflow.message.endpoint=http://localhost:28080/mso/WorkflowMesssage +mso.workflow.sdncadapter.callback=http://localhost:28080/mso/SDNCAdapterCallbackService + +mso.sniro.auth=test:testpwd +mso.sniro.timeout=PT30M +mso.sniro.policies.dhv.2vvig=SNIRO.DistanceToLocationPolicy_vhngw,SNIRO.VNFPolicy_vhngatewayprimary1_v1,SNIRO.ResourceInstancePolicy_hngateway,SNIRO.ResourceRegionPolicy_hngateway_v1,SNIRO.VNFPolicy_vhngatewaysecondary1_v1,SNIRO.ZonePolicy_vhngw,SNIRO.PlacementOptimizationPolicy_dhv_v3,SNIRO.VNFPolicy_vhnportal_primary1_v1,SNIRO.ResourceInstancePolicy_vhnportal_v3,SNIRO.ResourceRegionPolicy_vhnportal_v1,SNIRO.VNFPolicy_vhnportalsecondary1_v1,SNIRO.ZonePolicy_vhnportal,SNIRO.DistanceToLocationPolicy_vvig,SNIRO.InventoryGroupPolicy_vvig,SNIRO.VNFPolicy_vvigprimary1_v1,SNIRO.ResourceInstancePolicy_vvig,SNIRO.VNFPolicy_vvigsecondary1_v1 +mso.sniro.policies.dhv.4vvig=SNIRO.DistanceToLocationPolicy_vhngw,SNIRO.VNFPolicy_vhngatewayprimary1_v1,SNIRO.ResourceInstancePolicy_hngateway,SNIRO.ResourceRegionPolicy_hngateway_v1,SNIRO.VNFPolicy_vhngatewaysecondary1_v1,SNIRO.ZonePolicy_vhngw,SNIRO.PlacementOptimizationPolicy_dhv_v3,SNIRO.VNFPolicy_vhnportal_primary1_v1,SNIRO.ResourceInstancePolicy_vhnportal_v3,SNIRO.ResourceRegionPolicy_vhnportal_v1,SNIRO.VNFPolicy_vhnportalsecondary1_v1,SNIRO.ZonePolicy_vhnportal,SNIRO.VNFPolicy_vvigprimary2_v1,SNIRO.VNFPolicy_vvigsecondary2_v1,SNIRO.DistanceToLocationPolicy_vvig,SNIRO.InventoryGroupPolicy_vvig,SNIRO.VNFPolicy_vvigprimary1_v1,SNIRO.ResourceInstancePolicy_vvig,SNIRO.VNFPolicy_vvigsecondary1_v1 + +mso.service.agnostic.sniro.host=http://localhost:28090 +mso.service.agnostic.sniro.endpoint=/sniro/api/v2/placement + +mso.oof.auth=test:testpwd +mso.oof.endpoint=http://localhost:28090/api/oof/v1/placement +mso.oof.timeout=PT30M +mso.service.agnostic.oof.host=http://localhost:28090 +mso.service.agnostic.oof.endpoint=/api/oof/v1/placement + +mso.catalog.db.endpoint=http://localhost:28090/ + +ruby.create-ticket-request.dmaap.username=m04768@mso.ecomp.att.com +ruby.create-ticket-request.dmaap.password=eHQ1cUJrOUc +ruby.create-ticket-request.publisher.topic=com.att.pdas.st1.msoCMFallout-v1 + + +mso.adapters.tenant.endpoint=http://localhost:28090/tenantAdapterMock +mso.adapters.vnf-async.endpoint=http://localhost:28090/vnfs/VnfAdapterAsync +mso.adapters.vnf.endpoint=http://localhost:28090/vnfs/VnfAdapter +mso.adapters.vnf.rest.endpoint=http://localhost:28090/vnfs/rest/v1/vnfs +mso.workflow.vnfadapter.create.callback=http://localhost:28080/mso/vnfAdapterNotify +mso.workflow.vnfadapter.delete.callback=http://localhost:28080/mso/vnfAdapterNotify +mso.workflow.vnfadapter.query.callback=http://localhost:28080/mso/services/VNFAdapterQuerCallbackV1 +mso.workflow.vnfadapter.rollback.callback=http://localhost:28080/mso/vnfAdapterNotify +mso.workflow.createvce.delay.seconds=1 +mso.infra.customer.id=testCustIdInfra + +aai.endpoint=http://localhost:28090 + +# AAI version mappings + +# Example to override default version for a resource: +#mso.workflow.default.aai.vce.version=6 +#mso.workflow.default.aai.v6.vce.uri=/aai/v6/network/vces/vce +mso.workflow.global.default.aai.namespace=http://org.openecomp.aai.inventory/ +mso.workflow.global.default.aai.version=8 +mso.workflow.default.aai.cloud-region.version=9 +mso.workflow.default.aai.generic-vnf.version=9 + +mso.workflow.default.aai.v9.cloud-region.uri=/aai/v9/cloud-infrastructure/cloud-regions/cloud-region/att-aic +mso.workflow.default.aai.v8.customer.uri=/aai/v8/business/customers/customer +mso.workflow.default.aai.v8.generic-query.uri=/aai/v8/search/generic-query +mso.workflow.default.aai.v9.generic-vnf.uri=/aai/v9/network/generic-vnfs/generic-vnf +mso.workflow.default.aai.v8.l3-network.uri=/aai/v8/network/l3-networks/l3-network +mso.workflow.default.aai.v8.network-policy.uri=/aai/v8/network/network-policies/network-policy +mso.workflow.default.aai.v8.nodes-query.uri=/aai/v8/search/nodes-query +mso.workflow.default.aai.v8.route-table-reference.uri=/aai/v8/network/route-table-references/route-table-reference +mso.workflow.default.aai.v8.tenant.uri=/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant +mso.workflow.default.aai.v8.vce.uri=/aai/v8/network/vces/vce +mso.workflow.default.aai.v8.vpn-binding.uri=/aai/v8/network/vpn-bindings/vpn-binding +mso.workflow.notification.name=GenericNotificationService +mso.bpmn.optimisticlockingexception.retrycount=3 + +log.debug.CompleteMsoProcess=true +log.debug.CreateNetworkInstanceInfra=true +log.debug.CreateServiceInstanceInfra=true +log.debug.DeleteNetworkInstanceInfra=true +log.debug.FalloutHandler=true +log.debug.GenericGetService=true +log.debug.sdncAdapter=true +log.debug.UpdateNetworkInstanceInfra=true +log.debug.VnfAdapterRestV1=true +log.debug.GenericGetNetwork=true +log.debug.GenericGetVnf=true +log.debug.GenericDeleteService=true +log.debug.GenericDeleteNetwork=true +log.debug.GenericDeleteVnf=true +log.debug.vnfAdapterCreateV1=true +log.debug.vnfAdapterRestV1=true + +sdno.health-check.dmaap.username=m04768@mso.ecomp.att.com +sdno.health-check.dmaap.password=eHQ1cUJrOUc +sdno.health-check.dmaap.subscriber.topic=com.att.sdno.test-health-diagnostic-v02 sdno.health-check.dmaap.publisher.topic=com.att.sdno.test-health-diagnostic-v02
\ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/HomingSolution.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/HomingSolution.java index 40506576a5..611c8dfff9 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/HomingSolution.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/HomingSolution.java @@ -1,143 +1,143 @@ -/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.bpmn.core.domain;
-
-import java.io.Serializable;
-import java.util.List;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonRootName;
-
-/**
- * Stores resources placement and licensing information
- *
- */
-@JsonRootName("homingSolution")
-@JsonInclude(JsonInclude.Include.NON_NULL)
-public class HomingSolution extends JsonWrapper implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- private InventoryType inventoryType;
- private boolean isRehome;
- private String serviceInstanceId; //TODO should start using si object instead
- private String cloudOwner;
- private String cloudRegionId;
- private String aicClli;
- private String aicVersion;
- private String tenant;
- private VnfResource vnf;
- private License license = new License();
-
-
- /**
- * @return the inventoryType which indicates the solution type
- */
- public InventoryType getInventoryType() {
- return inventoryType;
- }
-
- public void setInventoryType(InventoryType inventoryType) {
- this.inventoryType = inventoryType;
- }
- public boolean isRehome() {
- return isRehome;
- }
- public void setRehome(boolean isRehome) {
- this.isRehome = isRehome;
- }
-
- public String getServiceInstanceId() {
- return serviceInstanceId;
- }
-
- public void setServiceInstanceId(String serviceInstanceId) {
- this.serviceInstanceId = serviceInstanceId;
- }
-
- public String getCloudOwner() {
- return cloudOwner;
- }
-
- public void setCloudOwner(String cloudOwner) {
- this.cloudOwner = cloudOwner;
- }
-
- public String getCloudRegionId() {
- return cloudRegionId;
- }
-
- public void setCloudRegionId(String cloudRegionId) {
- this.cloudRegionId = cloudRegionId;
- }
- /**
- * @return the aicClli (aka aic site, physical location id)
- */
- public String getAicClli() {
- return aicClli;
- }
-
- public void setAicClli(String aicClli) {
- this.aicClli = aicClli;
- }
-
- public String getAicVersion() {
- return aicVersion;
- }
-
- public void setAicVersion(String aicVersion) {
- this.aicVersion = aicVersion;
- }
-
- public String getTenant() {
- return tenant;
- }
-
- public void setTenant(String tenant) {
- this.tenant = tenant;
- }
-
- /**
- * @return the vnf that the resource was homed too.
- */
- public VnfResource getVnf() {
- return vnf;
- }
-
- public void setVnf(VnfResource vnf) {
- this.vnf = vnf;
- }
-
- public License getLicense() {
- return license;
- }
-
- public void setLicense(License license) {
- this.license = license;
- }
-
-
- public static long getSerialversionuid() {
- return serialVersionUID;
- }
-
-
+/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.core.domain; + +import java.io.Serializable; +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonRootName; + +/** + * Stores resources placement and licensing information + * + */ +@JsonRootName("homingSolution") +@JsonInclude(JsonInclude.Include.NON_NULL) +public class HomingSolution extends JsonWrapper implements Serializable { + + private static final long serialVersionUID = 1L; + + private InventoryType inventoryType; + private boolean isRehome; + private String serviceInstanceId; //TODO should start using si object instead + private String cloudOwner; + private String cloudRegionId; + private String aicClli; + private String aicVersion; + private String tenant; + private VnfResource vnf; + private License license = new License(); + + + /** + * @return the inventoryType which indicates the solution type + */ + public InventoryType getInventoryType() { + return inventoryType; + } + + public void setInventoryType(InventoryType inventoryType) { + this.inventoryType = inventoryType; + } + public boolean isRehome() { + return isRehome; + } + public void setRehome(boolean isRehome) { + this.isRehome = isRehome; + } + + public String getServiceInstanceId() { + return serviceInstanceId; + } + + public void setServiceInstanceId(String serviceInstanceId) { + this.serviceInstanceId = serviceInstanceId; + } + + public String getCloudOwner() { + return cloudOwner; + } + + public void setCloudOwner(String cloudOwner) { + this.cloudOwner = cloudOwner; + } + + public String getCloudRegionId() { + return cloudRegionId; + } + + public void setCloudRegionId(String cloudRegionId) { + this.cloudRegionId = cloudRegionId; + } + /** + * @return the aicClli (aka aic site, physical location id) + */ + public String getAicClli() { + return aicClli; + } + + public void setAicClli(String aicClli) { + this.aicClli = aicClli; + } + + public String getAicVersion() { + return aicVersion; + } + + public void setAicVersion(String aicVersion) { + this.aicVersion = aicVersion; + } + + public String getTenant() { + return tenant; + } + + public void setTenant(String tenant) { + this.tenant = tenant; + } + + /** + * @return the vnf that the resource was homed too. + */ + public VnfResource getVnf() { + return vnf; + } + + public void setVnf(VnfResource vnf) { + this.vnf = vnf; + } + + public License getLicense() { + return license; + } + + public void setLicense(License license) { + this.license = license; + } + + + public static long getSerialversionuid() { + return serialVersionUID; + } + + }
\ No newline at end of file diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ModelInfo.java b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ModelInfo.java index cae5bf81af..a5bb2bc159 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ModelInfo.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/openecomp/mso/bpmn/core/domain/ModelInfo.java @@ -39,6 +39,7 @@ public class ModelInfo extends JsonWrapper implements Serializable { private String modelVersion = "";
//additionally on resource level
private String modelCustomizationUuid = "";
+ private String modelCustomizationName = "";
private String modelInstanceName = "";
private String modelType = "";
@@ -74,6 +75,12 @@ public class ModelInfo extends JsonWrapper implements Serializable { public void setModelCustomizationUuid(String modelCustomizationUuid) {
this.modelCustomizationUuid = modelCustomizationUuid;
}
+ public String getModelCustomizationName() {
+ return modelCustomizationName;
+ }
+ public void setModelCustomizationName(String modelCustomizationName) {
+ this.modelCustomizationName = modelCustomizationName;
+ }
public String getModelInstanceName() {
return modelInstanceName;
}
diff --git a/bpmn/MSOInfrastructureBPMN/pom.xml b/bpmn/MSOInfrastructureBPMN/pom.xml index 11253869d7..e6434092e1 100644 --- a/bpmn/MSOInfrastructureBPMN/pom.xml +++ b/bpmn/MSOInfrastructureBPMN/pom.xml @@ -366,6 +366,19 @@ <artifactId>libphonenumber</artifactId> <version>8.9.1</version> </dependency> - + <dependency> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-classic</artifactId> + <version>1.2.3</version> + </dependency> + <dependency> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-core</artifactId> + <version>1.2.3</version> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + </dependency> </dependencies> </project> diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CompareModelofE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CompareModelofE2EServiceInstance.groovy new file mode 100644 index 0000000000..c70c971bc7 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CompareModelofE2EServiceInstance.groovy @@ -0,0 +1,261 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.openecomp.mso.bpmn.infrastructure.scripts; + +import static org.apache.commons.lang3.StringUtils.*; +import groovy.xml.XmlUtil +import groovy.json.* + +import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition +import org.openecomp.mso.bpmn.core.domain.ServiceInstance +import org.openecomp.mso.bpmn.core.domain.CompareModelsResult +import org.openecomp.mso.bpmn.core.domain.ModelInfo +import org.openecomp.mso.bpmn.core.json.JsonUtils +import org.openecomp.mso.bpmn.common.scripts.AaiUtil +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil +import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils +import org.openecomp.mso.bpmn.common.scripts.VidUtils +import org.openecomp.mso.bpmn.core.RollbackData +import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.rest.APIResponse; +import org.openecomp.mso.rest.RESTClient +import org.openecomp.mso.rest.RESTConfig + +import java.util.UUID; +import javax.xml.parsers.DocumentBuilder +import javax.xml.parsers.DocumentBuilderFactory + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.json.JSONObject; +import org.json.JSONArray; +import org.apache.commons.lang3.* +import org.apache.commons.codec.binary.Base64; +import org.springframework.web.util.UriUtils; + +import org.w3c.dom.Document +import org.w3c.dom.Element +import org.w3c.dom.Node +import org.w3c.dom.NodeList +import org.xml.sax.InputSource +/** + * This groovy class supports the <class>CompareModelofE2EServiceInstance.bpmn</class> process. + * + * Inputs: + * @param - msoRequestId + * @param - globalSubscriberId + * @param - subscriptionServiceType + * @param - serviceInstanceId + * @param - modelInvariantIdTarget + * @param - modelVersionIdTarget + + * + * Outputs: + * @param - WorkflowException + */ +public class CompareModelofE2EServiceInstance extends AbstractServiceTaskProcessor { + + String Prefix="CMPMDSI_" + private static final String DebugFlag = "isDebugEnabled" + + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + VidUtils vidUtils = new VidUtils() + + public void preProcessRequest (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix",Prefix) + String msg = "" + + utils.log("INFO", " *** preProcessRequest Request *** ", isDebugEnabled) + + try { + // check for incoming json message/input + String siRequest = execution.getVariable("bpmnRequest") + utils.logAudit(siRequest) + + + String requestId = execution.getVariable("mso-request-id") + execution.setVariable("msoRequestId", requestId) + utils.log("INFO", "Input Request:" + siRequest + " reqId:" + requestId, isDebugEnabled) + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + if (isBlank(serviceInstanceId)) { + msg = "Input serviceInstanceId' is null" + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + /* + * Extracting User Parameters from incoming Request and converting into a Map + */ + def jsonSlurper = new JsonSlurper() + def jsonOutput = new JsonOutput() + + Map reqMap = jsonSlurper.parseText(siRequest) + + //InputParams + def userParams = reqMap.requestDetails?.requestParameters?.userParams + + Map<String, String> inputMap = [:] + if (userParams) { + userParams.each { + userParam -> inputMap.put(userParam.name, userParam.value.toString()) + } + } + execution.setVariable("operationType", "CompareModel") + + utils.log("DEBUG", "User Input Parameters map: " + userParams.toString(), isDebugEnabled) + execution.setVariable("serviceInputParams", inputMap) + + } catch (BpmnError e) { + throw e; + } catch (Exception ex){ + msg = "Exception in preProcessRequest " + ex.getMessage() + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("INFO"," ***** Exit preProcessRequest *****", isDebugEnabled) + } + + public void sendSyncResponse (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("INFO", " *** sendSyncResponse *** ", isDebugEnabled) + + try { + CompareModelsResult compareModelsResult = execution.getVariable("compareModelsResult") + + // RESTResponse (for API Handler(APIH) Reply Task) + String syncResponse = compareModelsResult.toString() + utils.log("INFO", " sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse, isDebugEnabled) + sendWorkflowResponse(execution, 202, syncResponse) + + } catch (Exception ex) { + String msg = "Exception in sendSyncResponse: " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + utils.log("INFO"," ***** Exit sendSyncResopnse *****", isDebugEnabled) + } + + public void sendSyncError (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("INFO", " *** sendSyncError *** ", isDebugEnabled) + + try { + String errorMessage = "" + if (execution.getVariable("WorkflowException") instanceof WorkflowException) { + WorkflowException wfe = execution.getVariable("WorkflowException") + errorMessage = wfe.getErrorMessage() + } else { + errorMessage = "Sending Sync Error." + } + + String buildworkflowException = + """<aetgt:WorkflowException xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1"> + <aetgt:ErrorMessage>${errorMessage}</aetgt:ErrorMessage> + <aetgt:ErrorCode>7000</aetgt:ErrorCode> + </aetgt:WorkflowException>""" + + utils.logAudit(buildworkflowException) + sendWorkflowResponse(execution, 500, buildworkflowException) + + } catch (Exception ex) { + utils.log("INFO", " Sending Sync Error Activity Failed. " + "\n" + ex.getMessage(), isDebugEnabled) + } + + } + + public void prepareCompletionRequest (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("INFO", " *** prepareCompletion *** ", isDebugEnabled) + + try { + String requestId = execution.getVariable("msoRequestId") + String source = execution.getVariable("source") + String msoCompletionRequest = + """<aetgt:MsoCompletionRequest xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1" + xmlns:ns="http://org.openecomp/mso/request/types/v1"> + <request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1"> + <request-id>${requestId}</request-id> + <action>COMPAREMODEL</action> + <source>${source}</source> + </request-info> + <aetgt:status-message>E2E Service Instance Compare model successfully.</aetgt:status-message> + <aetgt:mso-bpel-name>CompareModelofE2EServiceInstance</aetgt:mso-bpel-name> + </aetgt:MsoCompletionRequest>""" + + // Format Response + String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) + + execution.setVariable("completionRequest", xmlMsoCompletionRequest) + utils.log("INFO", " Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled) + + } catch (Exception ex) { + String msg = " Exception in prepareCompletion:" + ex.getMessage() + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("INFO", "*** Exit prepareCompletionRequest ***", isDebugEnabled) + } + + public void prepareFalloutRequest(DelegateExecution execution){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("INFO", " *** prepareFalloutRequest *** ", isDebugEnabled) + + try { + WorkflowException wfex = execution.getVariable("WorkflowException") + utils.log("INFO", " Input Workflow Exception: " + wfex.toString(), isDebugEnabled) + String requestId = execution.getVariable("msoRequestId") + String source = execution.getVariable("source") + String requestInfo = + """<request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1"> + <request-id>${requestId}</request-id> + <action>COMPAREMODEL</action> + <source>${source}</source> + </request-info>""" + + String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo) + execution.setVariable("falloutRequest", falloutRequest) + } catch (Exception ex) { + utils.log("INFO", "Exception prepareFalloutRequest:" + ex.getMessage(), isDebugEnabled) + String errorException = " Bpmn error encountered in CompareModelofE2EServiceInstance flow. FalloutHandlerRequest, buildErrorResponse() - " + ex.getMessage() + String requestId = execution.getVariable("msoRequestId") + String falloutRequest = + """<aetgt:FalloutHandlerRequest xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1" + xmlns:ns="http://org.openecomp/mso/request/types/v1" + xmlns:wfsch="http://org.openecomp/mso/workflow/schema/v1"> + <request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1"> + <request-id>${requestId}</request-id> + <action>COMPAREMODEL</action> + <source>UUI</source> + </request-info> + <aetgt:WorkflowException xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1"> + <aetgt:ErrorMessage>${errorException}</aetgt:ErrorMessage> + <aetgt:ErrorCode>7000</aetgt:ErrorCode> + </aetgt:WorkflowException> + </aetgt:FalloutHandlerRequest>""" + + execution.setVariable("falloutRequest", falloutRequest) + } + utils.log("INFO", "*** Exit prepareFalloutRequest ***", isDebugEnabled) + } + +} + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy index 6d5249e4d6..a49a0664e8 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCompareModelVersions.groovy @@ -136,7 +136,7 @@ public class DoCompareModelVersions extends AbstractServiceTaskProcessor { utils.log("INFO"," ***** Exit preProcessRequest *****", isDebugEnabled)
}
- public void prepareDecomposeService_Target(Execution execution) {
+ public void prepareDecomposeService_Target(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
try {
@@ -160,7 +160,7 @@ public class DoCompareModelVersions extends AbstractServiceTaskProcessor { }
}
- public void processDecomposition_Target(Execution execution) {
+ public void processDecomposition_Target(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
utils.log("DEBUG", " ***** Inside processDecomposition_Target() of update generic e2e service flow ***** ", isDebugEnabled)
@@ -174,7 +174,7 @@ public class DoCompareModelVersions extends AbstractServiceTaskProcessor { }
}
- public void prepareDecomposeService_Original(Execution execution) {
+ public void prepareDecomposeService_Original(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
try {
@@ -198,7 +198,7 @@ public class DoCompareModelVersions extends AbstractServiceTaskProcessor { }
}
- public void processDecomposition_Original(Execution execution) {
+ public void processDecomposition_Original(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
utils.log("DEBUG", " ***** Inside processDecomposition_Original() of update generic e2e service flow ***** ", isDebugEnabled)
@@ -212,7 +212,7 @@ public class DoCompareModelVersions extends AbstractServiceTaskProcessor { }
}
- public void doCompareModelVersions(execution){
+ public void doCompareModelVersions(DelegateExecution execution){
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
utils.log("INFO", "======== Start doCompareModelVersions Process ======== ", isDebugEnabled)
@@ -222,8 +222,8 @@ public class DoCompareModelVersions extends AbstractServiceTaskProcessor { List<Resource> allSR_target = serviceDecomposition_Target.getServiceResources();
List<Resource> allSR_original = serviceDecomposition_Original.getServiceResources();
- List<Resource> addedResource = new ArrayList<String>()
- List<Resource> delResource = new ArrayList<String>()
+ List<Resource> addResourceList = new ArrayList<String>()
+ List<Resource> delResourceList = new ArrayList<String>()
addResourceList.addAll(allSR_target)
delResourceList.addAll(allSR_original)
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy new file mode 100644 index 0000000000..30db8c53eb --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy @@ -0,0 +1,260 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.openecomp.mso.bpmn.infrastructure.scripts; + +import static org.apache.commons.lang3.StringUtils.*; +import groovy.xml.XmlUtil +import groovy.json.* + +import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition +import org.openecomp.mso.bpmn.core.domain.ServiceInstance +import org.openecomp.mso.bpmn.core.domain.ModelInfo +import org.openecomp.mso.bpmn.core.domain.Resource +import org.openecomp.mso.bpmn.core.domain.CompareModelsResult +import org.openecomp.mso.bpmn.core.domain.ResourceModelInfo +import org.openecomp.mso.bpmn.core.json.JsonUtils +import org.openecomp.mso.bpmn.common.scripts.AaiUtil +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil +import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils +import org.openecomp.mso.bpmn.core.RollbackData +import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.rest.APIResponse; +import org.openecomp.mso.rest.RESTClient +import org.openecomp.mso.rest.RESTConfig + + +import java.util.List +import java.util.Map +import java.util.UUID; +import javax.xml.parsers.DocumentBuilder +import javax.xml.parsers.DocumentBuilderFactory + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.json.JSONObject; +import org.json.JSONArray; +import org.apache.commons.lang3.* +import org.apache.commons.codec.binary.Base64; +import org.springframework.web.util.UriUtils; + +import org.w3c.dom.Document +import org.w3c.dom.Element +import org.w3c.dom.Node +import org.w3c.dom.NodeList +import org.xml.sax.InputSource +/** + * This groovy class supports the <class>DoCompareModelofE2EServiceInstance.bpmn</class> process. + * + * Inputs: + * @param - msoRequestId + * @param - globalSubscriberId + * @param - subscriptionServiceType + * @param - serviceInstanceId + * @param - modelInvariantIdTarget + * @param - modelVersionIdTarget + * + * Outputs: + * @param - compareModelsResult CompareModelsResult + + */ +public class DoCompareModelofE2EServiceInstance extends AbstractServiceTaskProcessor { + + String Prefix="DCMPMDSI_" + private static final String DebugFlag = "isDebugEnabled" + + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + + public void preProcessRequest (DelegateExecution execution) { + execution.setVariable("isDebugLogEnabled","true") + + def method = getClass().getSimpleName() + '.preProcessRequest(' +'execution=' + execution.getId() +')' + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("INFO","Entered " + method, isDebugEnabled) + String msg = "" + utils.log("INFO"," ***** Enter CompareModelofE2EServiceInstance preProcessRequest *****", isDebugEnabled) + + execution.setVariable("prefix", Prefix) + //Inputs + + //subscriberInfo. for AAI GET + String globalSubscriberId = execution.getVariable("globalSubscriberId") + utils.log("INFO"," ***** globalSubscriberId *****" + globalSubscriberId, isDebugEnabled) + + String serviceType = execution.getVariable("serviceType") + utils.log("INFO"," ***** serviceType *****" + serviceType, isDebugEnabled) + + if (isBlank(globalSubscriberId)) { + msg = "Input globalSubscriberId is null" + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + if (isBlank(serviceType)) { + msg = "Input serviceType is null" + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + if (isBlank(serviceInstanceId)){ + msg = "Input serviceInstanceId is null" + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + String modelInvariantUuid = execution.getVariable('modelInvariantIdTarget') + if (isBlank(modelInvariantUuid)){ + msg = "Input modelInvariantUuid is null" + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + String modelUuid = execution.getVariable('modelVersionIdTarget') + if (isBlank(modelUuid)){ + msg = "Input modelUuid is null" + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + // Set Target Template info + execution.setVariable("model-invariant-id-target", modelInvariantUuid) + execution.setVariable("model-version-id-target", modelUuid) + + + utils.log("INFO", "Exited " + method, isDebugEnabled) + } + + public void postProcessAAIGET(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("INFO"," ***** postProcessAAIGET ***** ", isDebugEnabled) + String msg = "" + + try { + String serviceInstanceId = execution.getVariable("serviceInstanceId") + boolean foundInAAI = execution.getVariable("GENGS_FoundIndicator") + String serviceType = "" + + if(foundInAAI){ + utils.log("INFO","Found Service-instance in AAI", isDebugEnabled) + + String siData = execution.getVariable("GENGS_service") + utils.log("INFO", "SI Data", isDebugEnabled) + if (isBlank(siData)) + { + msg = "Could not retrive ServiceInstance data from AAI, Id:" + serviceInstanceId + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + else + { + utils.log("INFO", "SI Data" + siData, isDebugEnabled) + + // Get Template uuid and version + if (utils.nodeExists(siData, "model-invariant-id") && utils.nodeExists(siData, "model-version-id") ) { + utils.log("INFO", "SI Data model-invariant-id and model-version-id exist", isDebugEnabled) + + def modelInvariantId = utils.getNodeText1(siData, "model-invariant-id") + def modelVersionId = utils.getNodeText1(siData, "model-version-id") + + // Set Original Template info + execution.setVariable("model-invariant-id-original", modelInvariantId) + execution.setVariable("model-version-id-original", modelVersionId) + } + } + }else{ + boolean succInAAI = execution.getVariable("GENGS_SuccessIndicator") + if(!succInAAI){ + utils.log("INFO","Error getting Service-instance from AAI", + serviceInstanceId, isDebugEnabled) + WorkflowException workflowException = execution.getVariable("WorkflowException") + utils.logAudit("workflowException: " + workflowException) + if(workflowException != null){ + exceptionUtil.buildAndThrowWorkflowException(execution, workflowException.getErrorCode(), workflowException.getErrorMessage()) + } + else + { + msg = "Failure in postProcessAAIGET GENGS_SuccessIndicator:" + succInAAI + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg) + } + } + + utils.log("INFO","Service-instance NOT found in AAI. Silent Success", isDebugEnabled) + } + }catch (BpmnError e) { + throw e; + } catch (Exception ex) { + msg = "Exception in DoDeleteE2EServiceInstance.postProcessAAIGET. " + ex.getMessage() + utils.log("INFO", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("INFO"," *** Exit postProcessAAIGET *** ", isDebugEnabled) + } + + public void postCompareModelVersions(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + + + List<Resource> addResourceList = execution.getVariable("addResourceList") + List<Resource> delResourceList = execution.getVariable("delResourceList") + + CompareModelsResult cmpResult = new CompareModelsResult() + List<ResourceModelInfo> addedResourceList = new ArrayList<ResourceModelInfo>() + List<ResourceModelInfo> deletedResourceList = new ArrayList<ResourceModelInfo>() + + + String serviceModelUuid = execution.getVariable("model-version-id-target") + List<String> requestInputs = new ArrayList<String>() + ModelInfo mi = null; + for(Resource rc : addResourceList) { + mi = rc.getModelInfo() + String resourceCustomizationUuid = mi.getModelCustomizationUuid() + ResourceModelInfo rmodel = new ResourceModelInfo() + rmodel.setResourceName(mi.getModelName()) + rmodel.setResourceInvariantUuid(mi.getModelInvariantUuid()) + rmodel.setResourceUuid(mi.getModelUuid()) + rmodel.setResourceCustomizationUuid(resourceCustomizationUuid) + addedResourceList.add(rmodel) + + Map<String, Object> resourceParameters = ResourceRequestBuilder.buildResouceRequest(serviceModelUuid, resourceCustomizationUuid, null) + requestInputs.addAll(resourceParameters.keySet()) + } + + for(Resource rc : deletedResourceList) { + mi = rc.getModelInfo() + String resourceCustomizationUuid = mi.getModelCustomizationUuid() + ResourceModelInfo rmodel = new ResourceModelInfo() + rmodel.setResourceName(mi.getModelName()) + rmodel.setResourceInvariantUuid(mi.getModelInvariantUuid()) + rmodel.setResourceUuid(mi.getModelUuid()) + rmodel.setResourceCustomizationUuid(resourceCustomizationUuid) + deletedResourceList.add(rmodel) + } + + cmpResult.setAddedResourceList(addedResourceList) + cmpResult.setDeletedResourceList(deletedResourceList) + cmpResult.setRequestInputs(requestInputs) + + execution.setVariable("compareModelsResult", cmpResult) + } + +} + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy index 47ad795e25..4ad58fb669 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy @@ -411,8 +411,8 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") List<Resource> resourceList = serviceDecomposition.getServiceResources() - for(String resource : resourceList){ - resourceTemplateUUIDs = resourceTemplateUUIDs + resource.getModelInfo().getModelCustomizationUuid() + ":" + for(Resource resource : resourceList){ + resourceTemplateUUIDs = resourceTemplateUUIDs + resource.getModelInfo().getModelCustomizationUuid() + ":" } def dbAdapterEndpoint = "http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter" @@ -425,13 +425,13 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { <soapenv:Header/> <soapenv:Body> <ns:initResourceOperationStatus xmlns:ns="http://org.openecomp.mso/requestsdb"> - <serviceId>${serviceId}</serviceId> - <operationId>${operationId}</operationId> - <operationType>${operationType}</operationType> - <resourceTemplateUUIDs>${resourceTemplateUUIDs}</resourceTemplateUUIDs> - </ns:initResourceOperationStatus> - </soapenv:Body> - </soapenv:Envelope>""" + <serviceId>${serviceId}</serviceId> + <operationId>${operationId}</operationId> + <operationType>${operationType}</operationType> + <resourceTemplateUUIDs>${resourceTemplateUUIDs}</resourceTemplateUUIDs> + </ns:initResourceOperationStatus> + </soapenv:Body> + </soapenv:Envelope>""" payload = utils.formatXml(payload) execution.setVariable("CVFMI_initResOperStatusRequest", payload) @@ -444,135 +444,23 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor { } utils.log("INFO", "======== COMPLETED preInitResourcesOperStatus Process ======== ", isDebugEnabled) } - - /** - * sequence resource. we should analyze resource sequence from service template - * Here we make VF first, and then network for E2E service. - */ - public void sequenceResoure(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO", "======== Start sequenceResoure Process ======== ", isDebugEnabled) - String serviceModelUUID = execution.getVariable("modelUuid") - JSONArray networks = cutils.getAllNetworksByServiceModelUuid(execution, serviceModelUUID) - utils.log("DEBUG", "obtained Network list: " + networks, isDebugEnabled) - if (networks == null) { - utils.log("INFO", "No matching networks in Catalog DB for serviceModelUUID=" + serviceModelUUID, isDebugEnabled) - } - ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - - //we use VF to define a network service - List<VnfResource> vnfResourceList= serviceDecomposition.getServiceVnfs() - - //here wan is defined as a network resource - List<NetworkResource> networkResourceList = serviceDecomposition.getServiceNetworks() - - //allotted resource - List<AllottedResource> arResourceList= serviceDecomposition.getServiceAllottedResources() - //define sequenced resource list, we deploy vf first and then network and then ar - //this is defaule sequence - List<Resource> sequencedResourceList = new ArrayList<Resource>(); - if(null != vnfResourceList){ - sequencedResourceList.addAll(vnfResourceList) - } - if(null != networkResourceList){ - sequencedResourceList.addAll(networkResourceList) - } - if(null != arResourceList){ - sequencedResourceList.addAll(arResourceList) - } - - String isContainsWanResource = networkResourceList.isEmpty() ? "false" : "true" - execution.setVariable("isContainsWanResource", isContainsWanResource) - execution.setVariable("currentResourceIndex", 0) - execution.setVariable("sequencedResourceList", sequencedResourceList) - utils.log("INFO", "sequencedResourceList: " + sequencedResourceList, isDebugEnabled) - utils.log("INFO", "======== COMPLETED sequenceResoure Process ======== ", isDebugEnabled) + // prepare input param for using DoCreateResources.bpmn + public void preProcessForAddResource(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("INFO", " ======== STARTED preProcessForAddResource Process ======== ", isDebugEnabled) + + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + List<Resource> addResourceList = serviceDecomposition.getServiceResources() + execution.setVariable("addResourceList", addResourceList) + + utils.log("INFO", "======== COMPLETED preProcessForAddResource Process ======== ", isDebugEnabled) } + + public void postProcessForAddResource(DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + // do nothing now - public void getCurrentResoure(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO", "======== Start getCurrentResoure Process ======== ", isDebugEnabled) - def currentIndex = execution.getVariable("currentResourceIndex") - List<Resource> sequencedResourceList = execution.getVariable("sequencedResourceList") - Resource currentResource = sequencedResourceList.get(currentIndex) - utils.log("INFO", "Now we deal with resouce:" + currentResource.getModelInfo().getModelName(), isDebugEnabled) - utils.log("INFO", "======== COMPLETED getCurrentResoure Process ======== ", isDebugEnabled) - } + } - /** - * sequence resource - */ - public void parseNextResource(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO", "======== Start parseNextResource Process ======== ", isDebugEnabled) - def currentIndex = execution.getVariable("currentResourceIndex") - def nextIndex = currentIndex + 1 - execution.setVariable("currentResourceIndex", nextIndex) - List<String> sequencedResourceList = execution.getVariable("sequencedResourceList") - if(nextIndex >= sequencedResourceList.size()){ - execution.setVariable("allResourceFinished", "true") - }else{ - execution.setVariable("allResourceFinished", "false") - } - utils.log("INFO", "======== COMPLETED parseNextResource Process ======== ", isDebugEnabled) - } - - /** - * post config request. - */ - public void postConfigRequest(DelegateExecution execution){ - //now do noting - } - - public void prepareResourceRecipeRequest(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO", "======== Start prepareResourceRecipeRequest Process ======== ", isDebugEnabled) - ResourceInput resourceInput = new ResourceInput() - String serviceInstanceName = execution.getVariable("serviceInstanceName") - String resourceInstanceName = resourceType + "_" + serviceInstanceName - resourceInput.setResourceInstanceName(resourceInstanceName) - utils.log("INFO", "Prepare Resource Request resourceInstanceName:" + resourceInstanceName, isDebugEnabled) - String globalSubscriberId = execution.getVariable("globalSubscriberId") - String serviceType = execution.getVariable("serviceType") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - String operationId = execution.getVariable("operationId") - String operationType = execution.getVariable("operationType") - resourceInput.setGlobalSubscriberId(globalSubscriberId) - resourceInput.setServiceType(serviceType) - resourceInput.setServiceInstanceId(serviceInstanceId) - resourceInput.setOperationId(operationId) - resourceInput.setOperationType(operationType); - def currentIndex = execution.getVariable("currentResourceIndex") - List<Resource> sequencedResourceList = execution.getVariable("sequencedResourceList") - Resource currentResource = sequencedResourceList.get(currentIndex) - resourceInput.setResourceModelInfo(currentResource.getModelInfo()); - ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - resourceInput.setServiceModelInfo(serviceDecomposition.getModelInfo()); - - String incomingRequest = execution.getVariable("uuiRequest") - //set the requestInputs from tempalte To Be Done - String serviceModelUuid = execution.getVariable("modelUuid") - String serviceParameters = jsonUtil.getJsonValue(incomingRequest, "service.parameters") - String resourceParameters = ResourceRequestBuilder.buildResourceRequestParameters(execution, serviceModelUuid, resourceCustomizationUuid, serviceParameters) - resourceInput.setResourceParameters(resourceParameters) - execution.setVariable("resourceInput", resourceInput) - utils.log("INFO", "======== COMPLETED prepareResourceRecipeRequest Process ======== ", isDebugEnabled) - } - - public void executeResourceRecipe(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO", "======== Start executeResourceRecipe Process ======== ", isDebugEnabled) - String requestId = execution.getVariable("msoRequestId") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - String serviceType = execution.getVariable("serviceType") - ResourceInput resourceInput = execution.getVariable("resourceInput") - String requestAction = resourceInput.getOperationType() - JSONObject resourceRecipe = cutils.getResourceRecipe(execution, resourceInput.getResourceUuid(), requestAction) - String recipeUri = resourceRecipe.getString("orchestrationUri") - String recipeTimeOut = resourceRecipe.getString("recipeTimeout") - String recipeParamXsd = resourceRecipe.get("paramXSD") - HttpResponse resp = BpmnRestClient.post(recipeUri, requestId, recipeTimeout, requestAction, serviceInstanceId, serviceType, resourceInput.toString(), recipeParamXsd) - - } } diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateResources.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateResources.groovy index 07f13767ba..a53540ac89 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateResources.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoCreateResources.groovy @@ -23,7 +23,6 @@ package org.openecomp.mso.bpmn.infrastructure.scripts import java.util.ArrayList import java.util.Iterator import java.util.List -import javax.mail.Quota.Resource import org.apache.commons.lang3.StringUtils import org.apache.http.HttpResponse import org.camunda.bpm.engine.delegate.DelegateExecution @@ -41,8 +40,11 @@ import org.openecomp.mso.bpmn.common.scripts.CatalogDbUtils import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil import org.openecomp.mso.bpmn.core.domain.AllottedResource import org.openecomp.mso.bpmn.core.domain.NetworkResource +import org.openecomp.mso.bpmn.core.domain.Resource +import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition import org.openecomp.mso.bpmn.core.domain.VnfResource import org.openecomp.mso.bpmn.core.json.JsonUtils +import org.openecomp.mso.bpmn.common.resource.ResourceRequestBuilder /** * This groovy class supports the <class>DoCreateResources.bpmn</class> process. @@ -66,6 +68,7 @@ public class DoCreateResources extends AbstractServiceTaskProcessor { ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() + CatalogDbUtils cutils = new CatalogDbUtils() public void preProcessRequest(DelegateExecution execution) { @@ -88,7 +91,7 @@ public class DoCreateResources extends AbstractServiceTaskProcessor utils.log("INFO", " ***** Exit preProcessRequest *****", isDebugEnabled) } - public void sequenceResoure(Object execution) + public void sequenceResoure(DelegateExecution execution) { def isDebugEnabled = execution.getVariable("isDebugLogEnabled") utils.log("INFO", "======== Start sequenceResoure Process ======== ", isDebugEnabled) @@ -111,9 +114,9 @@ public class DoCreateResources extends AbstractServiceTaskProcessor if (rc instanceof VnfResource) { vnfResourceList.add(rc) } else if (rc instanceof NetworkResource) { - NetworkResource.add(rc) + networkResourceList.add(rc) } else if (rc instanceof AllottedResource) { - AllottedResource.add(rc) + arResourceList.add(rc) } } sequencedResourceList.addAll(vnfResourceList) @@ -128,7 +131,7 @@ public class DoCreateResources extends AbstractServiceTaskProcessor utils.log("INFO", "======== COMPLETED sequenceResoure Process ======== ", isDebugEnabled) } - public void getCurrentResoure(execution){ + public void getCurrentResoure(DelegateExecution execution){ def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("INFO", "======== Start getCurrentResoure Process ======== ", isDebugEnabled) def currentIndex = execution.getVariable("currentResourceIndex") @@ -138,7 +141,7 @@ public class DoCreateResources extends AbstractServiceTaskProcessor utils.log("INFO", "======== COMPLETED getCurrentResoure Process ======== ", isDebugEnabled) } - public void parseNextResource(execution){ + public void parseNextResource(DelegateExecution execution){ def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("INFO", "======== Start parseNextResource Process ======== ", isDebugEnabled) def currentIndex = execution.getVariable("currentResourceIndex") @@ -152,62 +155,59 @@ public class DoCreateResources extends AbstractServiceTaskProcessor } utils.log("INFO", "======== COMPLETED parseNextResource Process ======== ", isDebugEnabled) } + + public void prepareResourceRecipeRequest(DelegateExecution execution){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("INFO", "======== Start prepareResourceRecipeRequest Process ======== ", isDebugEnabled) + ResourceInput resourceInput = new ResourceInput() + String serviceInstanceName = execution.getVariable("serviceInstanceName") + String resourceInstanceName = resourceType + "_" + serviceInstanceName + resourceInput.setResourceInstanceName(resourceInstanceName) + utils.log("INFO", "Prepare Resource Request resourceInstanceName:" + resourceInstanceName, isDebugEnabled) + String globalSubscriberId = execution.getVariable("globalSubscriberId") + String serviceType = execution.getVariable("serviceType") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String operationId = execution.getVariable("operationId") + String operationType = execution.getVariable("operationType") + resourceInput.setGlobalSubscriberId(globalSubscriberId) + resourceInput.setServiceType(serviceType) + resourceInput.setServiceInstanceId(serviceInstanceId) + resourceInput.setOperationId(operationId) + resourceInput.setOperationType(operationType); + def currentIndex = execution.getVariable("currentResourceIndex") + List<Resource> sequencedResourceList = execution.getVariable("sequencedResourceList") + Resource currentResource = sequencedResourceList.get(currentIndex) + resourceInput.setResourceModelInfo(currentResource.getModelInfo()); + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + resourceInput.setServiceModelInfo(serviceDecomposition.getModelInfo()); + + String incomingRequest = execution.getVariable("uuiRequest") + //set the requestInputs from tempalte To Be Done + String serviceModelUuid = execution.getVariable("modelUuid") + String serviceParameters = jsonUtil.getJsonValue(incomingRequest, "service.parameters") + String resourceParameters = ResourceRequestBuilder.buildResourceRequestParameters(execution, serviceModelUuid, resourceCustomizationUuid, serviceParameters) + resourceInput.setResourceParameters(resourceParameters) + execution.setVariable("resourceInput", resourceInput) + utils.log("INFO", "======== COMPLETED prepareResourceRecipeRequest Process ======== ", isDebugEnabled) + } + + public void executeResourceRecipe(DelegateExecution execution){ + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + utils.log("INFO", "======== Start executeResourceRecipe Process ======== ", isDebugEnabled) + String requestId = execution.getVariable("msoRequestId") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String serviceType = execution.getVariable("serviceType") + ResourceInput resourceInput = execution.getVariable("resourceInput") + String requestAction = resourceInput.getOperationType() + JSONObject resourceRecipe = cutils.getResourceRecipe(execution, resourceInput.getResourceModelInfo().getModelUuid(), requestAction) + String recipeUri = resourceRecipe.getString("orchestrationUri") + String recipeTimeOut = resourceRecipe.getString("recipeTimeout") + String recipeParamXsd = resourceRecipe.get("paramXSD") + HttpResponse resp = BpmnRestClient.post(recipeUri, requestId, recipeTimeOut, requestAction, serviceInstanceId, serviceType, resourceInput.toString(), recipeParamXsd) + + } - public void prepareResourceRecipeRequest(execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO", "======== Start prepareResourceRecipeRequest Process ======== ", isDebugEnabled) - ResourceInput resourceInput = new ResourceInput() - String serviceInstanceName = execution.getVariable("serviceInstanceName") - String resourceInstanceName = resourceType + "_" + serviceInstanceName - resourceInput.setResourceInstanceName(resourceInstanceName) - utils.log("INFO", "Prepare Resource Request resourceInstanceName:" + resourceInstanceName, isDebugEnabled) - String globalSubscriberId = execution.getVariable("globalSubscriberId") - String serviceType = execution.getVariable("serviceType") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - String operationId = execution.getVariable("operationId") - String operationType = execution.getVariable("operationType") - resourceInput.setGlobalSubscriberId(globalSubscriberId) - resourceInput.setServiceType(serviceType) - resourceInput.setServiceInstanceId(serviceInstanceId) - resourceInput.setOperationId(operationId) - resourceInput.setOperationType(operationType); - def currentIndex = execution.getVariable("currentResourceIndex") - List<Resource> sequencedResourceList = execution.getVariable("sequencedResourceList") - Resource currentResource = sequencedResourceList.get(currentIndex) - String resourceCustomizationUuid = currentResource.getModelInfo().getModelCustomizationUuid() - resourceInput.setResourceCustomizationUuid(resourceCustomizationUuid); - String resourceInvariantUuid = currentResource.getModelInfo().getModelInvariantUuid() - resourceInput.setResourceInvariantUuid(resourceInvariantUuid) - String resourceUuid = currentResource.getModelInfo().getModelUuid() - resourceInput.setResourceUuid(resourceUuid) - - String incomingRequest = execution.getVariable("uuiRequest") - //set the requestInputs from tempalte To Be Done - String serviceModelUuid = execution.getVariable("modelUuid") - String serviceParameters = jsonUtil.getJsonValue(incomingRequest, "service.parameters") - String resourceParameters = ResourceRequestBuilder.buildResourceRequestParameters(execution, serviceModelUuid, resourceCustomizationUuid, serviceParameters) - resourceInput.setResourceParameters(resourceParameters) - execution.setVariable("resourceInput", resourceInput) - utils.log("INFO", "======== COMPLETED prepareResourceRecipeRequest Process ======== ", isDebugEnabled) - } - - public void executeResourceRecipe(execution){ - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO", "======== Start executeResourceRecipe Process ======== ", isDebugEnabled) - String requestId = execution.getVariable("msoRequestId") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - String serviceType = execution.getVariable("serviceType") - ResourceInput resourceInput = execution.getVariable("resourceInput") - String requestAction = resourceInput.getOperationType() - JSONObject resourceRecipe = cutils.getResourceRecipe(execution, resourceInput.getResourceUuid(), requestAction) - String recipeUri = resourceRecipe.getString("orchestrationUri") - String recipeTimeOut = resourceRecipe.getString("recipeTimeout") - String recipeParamXsd = resourceRecipe.get("paramXSD") - HttpResponse resp = BpmnRestClient.post(recipeUri, requestId, recipeTimeout, requestAction, serviceInstanceId, serviceType, resourceInput.toString(), recipeParamXsd) - - } - - public void postConfigRequest(execution){ + public void postConfigRequest(DelegateExecution execution){ //now do noting } } diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy new file mode 100644 index 0000000000..b45a52b352 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoScaleE2EServiceInstance.groovy @@ -0,0 +1,138 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 CMCC All rights reserved. * + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.openecomp.mso.bpmn.infrastructure.scripts + +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.json.JSONArray; +import static org.apache.commons.lang3.StringUtils.*; +import org.openecomp.mso.bpmn.core.json.JsonUtils +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.runtime.Execution +import org.json.JSONObject; +import org.springframework.web.util.UriUtils; + +/** + * This groovy class supports the <class>DoScaleServiceInstance.bpmn</class> process. + * + */ +public class DoScaleE2EServiceInstance extends AbstractServiceTaskProcessor { + + String Prefix = "DCRESI_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + + public void preProcessRequest(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + String msg = "" + utils.log("DEBUG", " ***** preProcessRequest *****", isDebugEnabled) + + try { + String requestId = execution.getVariable("msoRequestId") + execution.setVariable("prefix", Prefix) + + //Inputs + String globalSubscriberId = execution.getVariable("globalSubscriberId") + + String serviceType = execution.getVariable("serviceType") + String serviceInstanceName = execution.getVariable("serviceInstanceName") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + + execution.setVariable("serviceType", serviceType) + + String resourceTemplateUUIDs = "" + String scaleNsRequest = execution.getVariable("bpmnRequest") + JSONObject jsonObject = new JSONObject(scaleNsRequest).getJSONObject("service") + JSONArray jsonArray = jsonObject.getJSONArray("resources") + + for (int i = 0; i < jsonArray.size(); i++) { + JSONObject reqBodyJsonObj = jsonArray.getJSONObject(i) + String nsInstanceId = reqBodyJsonObj.getString("resourceInstanceId") + resourceTemplateUUIDs = resourceTemplateUUIDs + nsInstanceId + ":" + } + + execution.setVariable("resourceTemplateUUIDs", resourceTemplateUUIDs) + + if (serviceInstanceName == null) { + execution.setVariable("serviceInstanceName", "") + } + if (isBlank(serviceInstanceId)) { + msg = "Input serviceInstanceId is null" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + } catch (BpmnError e) { + throw e; + } catch (Exception ex) { + msg = "Exception in preProcessRequest " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG", " ***** Exit preProcessRequest *****", isDebugEnabled) + } + + + public void preInitResourcesOperStatus(DelegateExecution execution){ + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + + utils.log("INFO", " ======== STARTED preInitResourcesOperStatus Process ======== ", isDebugEnabled) + try{ + String serviceId = execution.getVariable("serviceInstanceId") + String operationId = execution.getVariable("operationId") + String operationType = "SCALE" + + // resourceTemplateUUIDs should be created ?? + String resourceTemplateUUIDs = execution.getVariable("resourceTemplateUUIDs") + utils.log("INFO", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType, isDebugEnabled) + serviceId = UriUtils.encode(serviceId,"UTF-8") + execution.setVariable("serviceInstanceId", serviceId) + execution.setVariable("operationId", operationId) + execution.setVariable("operationType", operationType) + + execution.setVariable("URN_mso_openecomp_adapters_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter") + + String payload = + """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" + xmlns:ns="http://org.openecomp.mso/requestsdb"> + <soapenv:Header/> + <soapenv:Body> + <ns:initResourceOperationStatus xmlns:ns="http://org.openecomp.mso/requestsdb"> + <serviceId>${serviceId}</serviceId> + <operationId>${operationId}</operationId> + <operationType>${operationType}</operationType> + <resourceTemplateUUIDs>${resourceTemplateUUIDs}</resourceTemplateUUIDs> + </ns:initResourceOperationStatus> + </soapenv:Body> + </soapenv:Envelope>""" + + payload = utils.formatXml(payload) + execution.setVariable("CVFMI_initResOperStatusRequest", payload) + utils.log("INFO", "Outgoing initResourceOperationStatus: \n" + payload, isDebugEnabled) + utils.logAudit("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload) + + }catch(Exception e){ + utils.log("ERROR", "Exception Occured Processing preInitResourcesOperStatus. Exception is:\n" + e, isDebugEnabled) + execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during preInitResourcesOperStatus Method:\n" + e.getMessage()) + } + utils.log("INFO", "======== COMPLETED preInitResourcesOperStatus Process ======== ", isDebugEnabled) + } + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy new file mode 100644 index 0000000000..9e3f78bbda --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy @@ -0,0 +1,324 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 CMCC. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.infrastructure.scripts + +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.json.JSONArray +import org.json.JSONObject; + +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil +import org.openecomp.mso.bpmn.core.json.JsonUtils + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.runtime.Execution +import org.codehaus.jackson.map.ObjectMapper + +import org.openecomp.mso.rest.RESTClient +import org.openecomp.mso.rest.RESTConfig +import org.openecomp.mso.rest.APIResponse; + +import org.openecomp.mso.bpmn.infrastructure.vfcmodel.ScaleResource +import org.openecomp.mso.bpmn.infrastructure.vfcmodel.ScaleNsByStepsData +import org.openecomp.mso.bpmn.infrastructure.vfcmodel.ScaleNsData + +import org.openecomp.mso.bpmn.infrastructure.vfcmodel.NSResourceInputParameter +import org.openecomp.mso.bpmn.infrastructure.vfcmodel.NsOperationKey +import org.openecomp.mso.bpmn.infrastructure.vfcmodel.NsScaleParameters +import org.openecomp.mso.bpmn.infrastructure.vfcmodel.NsParameters +import org.openecomp.mso.bpmn.infrastructure.vfcmodel.LocationConstraint + + +/** + * This groovy class supports the <class>DoScaleVFCNetworkServiceInstance.bpmn</class> process. + * flow for VFC Network Service Scale + */ +public class DoScaleVFCNetworkServiceInstance extends AbstractServiceTaskProcessor { + + String host = "http://mso.mso.testlab.openecomp.org:8080" + + String scaleUrl = "/vfc/rest/v1/vfcadapter/ns/{nsInstanceId}/scale" + + String queryJobUrl = "/vfc/rest/v1/vfcadapter/jobs/{jobId}" + + ExceptionUtil exceptionUtil = new ExceptionUtil() + + JsonUtils jsonUtil = new JsonUtils() + + /** + * Pre Process the BPMN Flow Request + * Inclouds: + * generate the nsOperationKey + * generate the nsParameters + */ + public void preProcessRequest(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " *** preProcessRequest() *** ", isDebugEnabled) + + List<NSResourceInputParameter> nsRIPList = convertScaleNsReq2NSResInputParamList(execution) + String requestJsonStr = "" + int size = nsRIPList.size() + for (int i = 0; i < size; i++) { + NSResourceInputParameter nsRIP = nsRIPList.get(i) + + if (i == size - 1) { + requestJsonStr += objectToJsonStr(nsRIP) + } else { + requestJsonStr += objectToJsonStr(nsRIP) + "|" + } + } + + execution.setVariable("reqBody", requestJsonStr) + + utils.log("DEBUG", " ***** Exit preProcessRequest *****", isDebugEnabled) + } + + /** + * scale NS task + */ + public void scaleNetworkService(DelegateExecution execution) { + + String saleNsRequest = execution.getVariable("reqBody") + String[] nsReqStr = saleNsRequest.split("\\|") + + def jobIdArray = ['jobId001', 'jobId002'] as String[] + + for (int i = 0; i < nsReqStr.length; i++) { + JSONObject reqBodyJsonObj = new JSONObject(nsReqStr[i]) + String nsInstanceId = reqBodyJsonObj.getJSONObject("nsScaleParameters").getString("nsInstanceId") + reqBodyJsonObj.getJSONObject("nsScaleParameters").remove("nsInstanceId") + String reqBody = reqBodyJsonObj.toString() + + String url = host + scaleUrl.replaceAll("\\{nsInstanceId\\}", nsInstanceId) + + APIResponse apiResponse = postRequest(execution, url, reqBody) + + String returnCode = apiResponse.getStatusCode() + String aaiResponseAsString = apiResponse.getResponseBodyAsString() + String jobId = ""; + if (returnCode == "200") { + jobId = jsonUtil.getJsonValue(aaiResponseAsString, "jobId") + } + + execution.setVariable("jobId", jobIdArray[i]) + + String isScaleFinished = "" + + // query the requested network service scale status, if finished, then start the next one, otherwise, wait + while (isScaleFinished != "finished"){ + timeDelay() + queryNSProgress(execution) + isScaleFinished = execution.getVariable("operationStatus") + } + } + } + + /** + * query NS task + */ + private void queryNSProgress(DelegateExecution execution) { + String jobId = execution.getVariable("jobId") + String url = host + queryJobUrl.replaceAll("\\{jobId\\}", jobId) + + NsOperationKey nsOperationKey = new NsOperationKey() + // is this net work service ID or E2E service ID? + nsOperationKey.setServiceId(execution.getVariable("serviceId")) + nsOperationKey.setServiceType(execution.getVariable("serviceType")) + nsOperationKey.setGlobalSubscriberId(execution.getVariable("globalSubscriberId")) + nsOperationKey.setNodeTemplateUUID(execution.getVariable("nodeTemplateUUID")) + nsOperationKey.setOperationId(execution.getVariable("operationId")) + String queryReqBody = objectToJsonStr(nsOperationKey) + + APIResponse apiResponse = postRequest(execution,url, queryReqBody) + + String returnCode = apiResponse.getStatusCode() + String aaiResponseAsString = apiResponse.getResponseBodyAsString() + + String operationStatus = "error" + + if (returnCode == "200") { + operationStatus = jsonUtil.getJsonValue(aaiResponseAsString, "responseDescriptor.status") + } + + execution.setVariable("operationStatus", operationStatus) + } + + /** + * delay 5 sec + * + */ + private void timeDelay() { + try { + Thread.sleep(5000) + } catch (InterruptedException e) { + taskProcessor.utils.log("ERROR", "Time Delay exception" + e, isDebugEnabled) + } + } + + /** + * finish NS task + */ + public void finishNSScale(DelegateExecution execution) { + //no need to do anything util now + System.out.println("Scale finished.") + } + + /** + * post request + * url: the url of the request + * requestBody: the body of the request + */ + private APIResponse postRequest(DelegateExecution execution, String url, String requestBody){ + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("INFO"," ***** Started Execute VFC adapter Post Process *****", isDebugEnabled) + utils.log("INFO","url:"+url +"\nrequestBody:"+ requestBody, isDebugEnabled) + APIResponse apiResponse = null + try{ + RESTConfig config = new RESTConfig(url) + RESTClient client = new RESTClient(config).addHeader("Content-Type", "application/json").addHeader("Authorization","Basic QlBFTENsaWVudDpwYXNzd29yZDEk") +// RESTClient client = new RESTClient(config).addHeader("Content-Type", "application/json").addHeader("Accept","application/json").addHeader("Authorization","Basic QlBFTENsaWVudDpwYXNzd29yZDEk") + apiResponse = client.httpPost(requestBody) + utils.log("INFO","response code:"+ apiResponse.getStatusCode() +"\nresponse body:"+ apiResponse.getResponseBodyAsString(), isDebugEnabled) + utils.log("INFO","======== Completed Execute VF-C adapter Post Process ======== ", isDebugEnabled) + }catch(Exception e){ + utils.log("ERROR","Exception occured while executing VFC Post Call. Exception is: \n" + e, isDebugEnabled) + throw new BpmnError("MSOWorkflowException") + } + return apiResponse + } + + /** + * create a Scale Resource object list from a NSScaleRequestJso nString + * This method is for the specific request from Scale Network Service BPMN workflow + * @param nsScaleRequestJsonString , a specific request Json string which conform to ?? class + * @return List < ScaleResource > + */ + private List<ScaleResource> jsonGetNsResourceList(String nsScaleRequestJsonString) { + List<ScaleResource> list = new ArrayList<ScaleResource>() + JSONObject jsonObject = new JSONObject(nsScaleRequestJsonString) + + JSONObject jsonResource = jsonObject.getJSONObject("service") + JSONArray arr = jsonResource.getJSONArray("resources") + + for (int i = 0; i < arr.length(); i++) { + JSONObject tempResource = arr.getJSONObject(i) + ScaleResource resource = new ScaleResource() + resource.setResourceInstanceId(tempResource.getString("resourceInstanceId")) + resource.setScaleType(tempResource.getString("scaleType")) + + JSONObject jsonScaleNsData = tempResource.getJSONObject("scaleNsData") + JSONObject jsonScaleNsByStepData = jsonScaleNsData.getJSONObject("scaleNsByStepsData") + + ScaleNsData scaleNsData = new ScaleNsData() + ScaleNsByStepsData stepsData = new ScaleNsByStepsData() + + stepsData.setAspectId(jsonScaleNsByStepData.getString("aspectId")) + stepsData.setScalingDirection(jsonScaleNsByStepData.getString("scalingDirection")) + stepsData.setNumberOfSteps(Integer.parseInt(jsonScaleNsByStepData.getString("numberOfSteps"))) + + scaleNsData.setScaleNsByStepsData(stepsData) + resource.setScaleNsData(scaleNsData) + list.add(resource) + } + + return list + } + + /** + * Convert a java class to JSON string + * @param obj + * @return + */ + private String objectToJsonStr(Object obj) { + ObjectMapper mapper = new ObjectMapper() + String jsonStr = null + try { + jsonStr = mapper.writeValueAsString(obj) + } catch (IOException ioe) { + System.out.println(ioe.getMessage()) + } + return jsonStr + + } + + /** + * create a NSResourceInputParameter list from a Scale Network request Json string + * @return + */ + private List<NSResourceInputParameter> convertScaleNsReq2NSResInputParamList(DelegateExecution execution) { + String saleNsRequest = execution.getVariable("bpmnRequest") + + //String requestId = execution.getVariable("msoRequestId") + //String serviceInstanceId = execution.getVariable("serviceInstanceId") + String serviceInstanceName = execution.getVariable("serviceInstanceName") + //String nodeTemplateUUID = execution.getVariable("nodeTemplateUUID") + String serviceType = execution.getVariable("serviceType") + String globalSubscriberId = execution.getVariable("globalSubscriberId") + String operationId = execution.getVariable("operationId") + String serviceId = execution.getVariable("serviceId") + String nsServiceDescription = execution.getVariable("requestDescription") + + String resource = JsonUtils.getJsonValue(saleNsRequest, "service.resources") + + // set nsScaleParameters properties + List<ScaleResource> scaleResourcesList = jsonGetNsResourceList(saleNsRequest) + List<NSResourceInputParameter> nsResourceInputParameterList = new ArrayList<NSResourceInputParameter>() + + for (ScaleResource sr : scaleResourcesList) { + NSResourceInputParameter nsResourceInputParameter = new NSResourceInputParameter() + NsOperationKey nsOperationKey = new NsOperationKey() + NsParameters nsParameters = new NsParameters() + NsScaleParameters nsScaleParameters = new NsScaleParameters() + nsParameters.setLocationConstraints(new ArrayList<LocationConstraint>()) + nsParameters.setAdditionalParamForNs(new HashMap<String, Object>()) + + // set NsOperationKey properties + nsOperationKey.setGlobalSubscriberId(globalSubscriberId) + nsOperationKey.setServiceId(serviceId) + nsOperationKey.setServiceType(serviceType) + // for ns scale the resourceInstanceId is the nodeTemplateUUID + nsOperationKey.setNodeTemplateUUID(sr.getResourceInstanceId()) + nsOperationKey.setOperationId(operationId) + + nsScaleParameters.setScaleType(sr.getScaleType()) + nsScaleParameters.setNsInstanceId(sr.getResourceInstanceId()) + + ScaleNsByStepsData scaleNsByStepsData = new ScaleNsByStepsData() + scaleNsByStepsData.setScalingDirection(sr.getScaleNsData().getScaleNsByStepsData().getScalingDirection()) + scaleNsByStepsData.setNumberOfSteps(sr.getScaleNsData().getScaleNsByStepsData().getNumberOfSteps()) + scaleNsByStepsData.setAspectId(sr.getScaleNsData().getScaleNsByStepsData().getAspectId()) + + List<ScaleNsByStepsData> scaleNsByStepsDataList = new ArrayList<ScaleNsByStepsData>() + scaleNsByStepsDataList.add(scaleNsByStepsData) + nsScaleParameters.setScaleNsByStepsData(scaleNsByStepsDataList) + + nsResourceInputParameter.setNsOperationKey(nsOperationKey) + nsResourceInputParameter.setNsServiceName(serviceInstanceName) + nsResourceInputParameter.setNsServiceDescription(nsServiceDescription) + nsResourceInputParameter.setNsParameters(nsParameters) + nsResourceInputParameter.setNsScaleParameters(nsScaleParameters) + + nsResourceInputParameterList.add(nsResourceInputParameter) + } + return nsResourceInputParameterList + } +} + diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy index bf2d6bcc36..44e3b73697 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoUpdateE2EServiceInstance.groovy @@ -26,6 +26,7 @@ import groovy.json.* import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition
import org.openecomp.mso.bpmn.core.domain.ServiceInstance
import org.openecomp.mso.bpmn.core.domain.ModelInfo
+import org.openecomp.mso.bpmn.core.domain.Resource
import org.openecomp.mso.bpmn.core.json.JsonUtils
import org.openecomp.mso.bpmn.common.scripts.AaiUtil
import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor
@@ -172,7 +173,7 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { execution.setVariable("modelInvariantUuid", modelInvariantUuid)
execution.setVariable("model-invariant-id-target", modelInvariantUuid)
execution.setVariable("modelUuid", modelUuid)
- execution.setVariable("model-version-id-target", modelUuid_target)
+ execution.setVariable("model-version-id-target", modelUuid)
//AAI PUT
String oStatus = execution.getVariable("initialStatus") ?: ""
@@ -388,7 +389,7 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { String operationType = execution.getVariable("operationType")
String resourceTemplateUUIDs = ""
String result = "processing"
- String progress = "0"
+ String progress = "10"
String reason = ""
String operationContent = "Prepare service updating"
utils.log("INFO", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId + " operationType:" + operationType, isDebugEnabled)
@@ -396,38 +397,38 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { execution.setVariable("serviceInstanceId", serviceId)
execution.setVariable("operationId", operationId)
execution.setVariable("operationType", operationType)
-
- String serviceRelationShip = execution.getVariable("serviceRelationShip")
-
- def jsonSlurper = new JsonSlurper()
- def jsonOutput = new JsonOutput()
- List relationShipList = jsonSlurper.parseText(serviceRelationShip)
-
- if (relationShipList != null) {
- relationShipList.each {
- resourceTemplateUUIDs = resourceTemplateUUIDs + it.resourceInstanceId + ":"
- }
- }
- execution.setVariable("URN_mso_openecomp_adapters_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter")
- String payload =
- """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+ List<Resource> resourceList = new ArrayList<String>()
+ List<Resource> addResourceList = execution.getVariable("addResourceList")
+ List<Resource> delResourceList = execution.setVariable("delResourceList")
+ resourceList.addAll(addResourceList)
+ resourceList.addAll(delResourceList)
+ for(Resource resource : resourceList){
+ resourceTemplateUUIDs = resourceTemplateUUIDs + resource.getModelInfo().getModelCustomizationUuid() + ":"
+ }
+
+ def dbAdapterEndpoint = "http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter"
+ execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
+ utils.log("INFO", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled)
+
+ String payload =
+ """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns="http://org.openecomp.mso/requestsdb">
<soapenv:Header/>
<soapenv:Body>
<ns:initResourceOperationStatus xmlns:ns="http://org.openecomp.mso/requestsdb">
- <serviceId>${serviceId}</serviceId>
- <operationId>${operationId}</operationId>
- <operationType>${operationType}</operationType>
- <resourceTemplateUUIDs>${resourceTemplateUUIDs}</resourceTemplateUUIDs>
- </ns:initResourceOperationStatus>
- </soapenv:Body>
- </soapenv:Envelope>"""
-
- payload = utils.formatXml(payload)
- execution.setVariable("CVFMI_initResOperStatusRequest", payload)
- utils.log("INFO", "Outgoing initResourceOperationStatus: \n" + payload, isDebugEnabled)
- utils.logAudit("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload)
+ <serviceId>${serviceId}</serviceId>
+ <operationId>${operationId}</operationId>
+ <operationType>${operationType}</operationType>
+ <resourceTemplateUUIDs>${resourceTemplateUUIDs}</resourceTemplateUUIDs>
+ </ns:initResourceOperationStatus>
+ </soapenv:Body>
+ </soapenv:Envelope>"""
+
+ payload = utils.formatXml(payload)
+ execution.setVariable("CVFMI_initResOperStatusRequest", payload)
+ utils.log("INFO", "Outgoing initResourceOperationStatus: \n" + payload, isDebugEnabled)
+ utils.logAudit("CreateVfModuleInfra Outgoing initResourceOperationStatus Request: " + payload)
}catch(Exception e){
utils.log("ERROR", "Exception Occured Processing preInitResourcesOperStatus. Exception is:\n" + e, isDebugEnabled)
@@ -447,6 +448,7 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { try{
String serviceId = execution.getVariable("serviceInstanceId")
String operationId = execution.getVariable("operationId")
+ String operationType = execution.getVariable("operationType")
String serviceName = execution.getVariable("serviceInstanceName")
String userId = ""
String result = "processing"
@@ -523,7 +525,12 @@ public class DoUpdateE2EServiceInstance extends AbstractServiceTaskProcessor { public void postProcessForAddResource(DelegateExecution execution) {
def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO"," ***** postProcessForAddResource ***** ", isDebugEnabled)
+
+ ServiceDecomposition serviceDecomposition_Target = execution.getVariable("serviceDecomposition_Target")
+ execution.setVariable("serviceDecomposition", serviceDecomposition_Target)
+ utils.log("INFO"," *** Exit postProcessForAddResource *** ", isDebugEnabled)
}
public void preProcessForDeleteResource(DelegateExecution execution) {
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy new file mode 100644 index 0000000000..58f644d53f --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstance.groovy @@ -0,0 +1,305 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 CMCC. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.infrastructure.scripts + +import org.camunda.bpm.engine.delegate.DelegateExecution + +import static org.apache.commons.lang3.StringUtils.* +import org.openecomp.mso.logger.MsoLogger +import org.openecomp.mso.utils.UUIDChecker +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil +import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.bpmn.core.json.JsonUtils +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.runtime.Execution + +import org.springframework.web.util.UriUtils + + +/** + * This groovy class supports the <class>ScaleCustomE2EServiceInstance.bpmn</class> process. + * + */ +public class ScaleCustomE2EServiceInstance extends AbstractServiceTaskProcessor { + String Prefix = "CRESI_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + private MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH); + + public void preProcessRequest(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + execution.setVariable("prefix", Prefix) + String msg = "" + utils.log("DEBUG", " *** preProcessRequest() *** ", isDebugEnabled) + + try { + + String siRequest = execution.getVariable("bpmnRequest") + utils.logAudit(siRequest) + + String requestId = execution.getVariable("mso-request-id") + execution.setVariable("msoRequestId", requestId) + utils.log("DEBUG", "Input Request:" + siRequest + " reqId:" + requestId, isDebugEnabled) + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + if (isBlank(serviceInstanceId)) { + serviceInstanceId = "NULL".toString() + } + utils.log("DEBUG", "Generated new Service Instance:" + serviceInstanceId, isDebugEnabled) + serviceInstanceId = UriUtils.encode(serviceInstanceId, "UTF-8") + execution.setVariable("serviceInstanceId", serviceInstanceId) + + // service instance ID is also service ID + execution.setVariable("serviceId", serviceInstanceId) + // service instance name + String serviceInstanceName = jsonUtil.getJsonValue(siRequest, "service.serviceInstanceName") + execution.setVariable("serviceInstanceName", serviceInstanceName) + + // service instance name + String serviceType = jsonUtil.getJsonValue(siRequest, "service.serviceType") + execution.setVariable("serviceType", serviceType) + + // operationa ID (key) + //String operationKey = UUIDChecker.generateUUID(msoLogger) + String operationId = jsonUtil.getJsonValue(siRequest, "operationId") + execution.setVariable("operationId", operationId) + utils.log("DEBUG", "Input Request:" + siRequest + " operationId:" + operationId, isDebugEnabled) + + + String resources = jsonUtil.getJsonValue(siRequest, "service.resources") + execution.setVariable("resources", resources) + + // node template UUID + String nodeTemplateUUID = UUIDChecker.generateUUID(msoLogger) + execution.setVariable("nodeTemplateUUID", nodeTemplateUUID) + + //subscriberInfo + String globalSubscriberId = jsonUtil.getJsonValue(siRequest, "service.globalSubscriberId") + if (isBlank(globalSubscriberId)) { + msg = "Input globalSubscriberId' is null" + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("globalSubscriberId", globalSubscriberId) + } + + String requestDescription = "request description for test" + execution.setVariable("requestDescription", requestDescription) + execution.setVariable("URN_mso_adapters_openecomp_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter") + + } catch (BpmnError e) { + throw e; + } catch (Exception ex) { + msg = "Exception in preProcessRequest " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG", " ***** Exit preProcessRequest *****", isDebugEnabled) + } + + public void sendSyncResponse(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " *** sendSyncResponse *** ", isDebugEnabled) + + try { + String operationId = execution.getVariable("operationId") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + // RESTResponse for API Handler (APIH) Reply Task + String scaleServiceRestRequest = """{"service":{"serviceId":"${serviceInstanceId}","operationId":"${ + operationId + }"}}""".trim() + utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + scaleServiceRestRequest, isDebugEnabled) + sendWorkflowResponse(execution, 202, scaleServiceRestRequest) + execution.setVariable("sentSyncResponse", true) + + } catch (Exception ex) { + String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG", " ***** Exit sendSyncResopnse *****", isDebugEnabled) + } + + + public void sendSyncError(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " *** sendSyncError *** ", isDebugEnabled) + + try { + String errorMessage = "" + if (execution.getVariable("WorkflowException") instanceof WorkflowException) { + WorkflowException wfe = execution.getVariable("WorkflowException") + errorMessage = wfe.getErrorMessage() + } else { + errorMessage = "Sending Sync Error." + } + + String buildworkflowException = + """<aetgt:WorkflowException xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1"> + <aetgt:ErrorMessage>${errorMessage}</aetgt:ErrorMessage> + <aetgt:ErrorCode>7000</aetgt:ErrorCode> + </aetgt:WorkflowException>""" + + utils.logAudit(buildworkflowException) + sendWorkflowResponse(execution, 500, buildworkflowException) + + } catch (Exception ex) { + utils.log("DEBUG", " Sending Sync Error Activity Failed. " + "\n" + ex.getMessage(), isDebugEnabled) + } + + } + + public void prepareCompletionRequest(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " *** prepareCompletion *** ", isDebugEnabled) + + try { + String requestId = execution.getVariable("msoRequestId") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String source = execution.getVariable("source") + + String msoCompletionRequest = + """<aetgt:MsoCompletionRequest xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1" + xmlns:ns="http://org.openecomp/mso/request/types/v1"> + <request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1"> + <request-id>${requestId}</request-id> + <action>SCALE</action> + <source>${source}</source> + </request-info> + <status-message>Service Instance was scaled successfully.</status-message> + <serviceInstanceId>${serviceInstanceId}</serviceInstanceId> + <mso-bpel-name>ScaleGenericALaCarteServiceInstance</mso-bpel-name> + </aetgt:MsoCompletionRequest>""" + + // Format Response + String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) + + execution.setVariable("CompleteMsoProcessRequest", xmlMsoCompletionRequest) + utils.log("DEBUG", " Overall SUCCESS Response going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled) + + } catch (Exception ex) { + String msg = " Exception in prepareCompletion:" + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + utils.log("DEBUG", "*** Exit prepareCompletionRequest ***", isDebugEnabled) + } + + public void prepareFalloutRequest(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " *** prepareFalloutRequest *** ", isDebugEnabled) + + try { + WorkflowException wfex = execution.getVariable("WorkflowException") + utils.log("DEBUG", " Input Workflow Exception: " + wfex.toString(), isDebugEnabled) + String requestId = execution.getVariable("msoRequestId") + String source = execution.getVariable("source") + String requestInfo = + """<request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1"> + <request-id>${requestId}</request-id> + <action>SCALE</action> + <source>${source}</source> + </request-info>""" + + String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo) + execution.setVariable("falloutRequest", falloutRequest) + } catch (Exception ex) { + utils.log("DEBUG", "Exception prepareFalloutRequest:" + ex.getMessage(), isDebugEnabled) + String errorException = " Bpmn error encountered in ScaleGenericALaCarteServiceInstance flow. FalloutHandlerRequest, buildErrorResponse() - " + ex.getMessage() + String requestId = execution.getVariable("msoRequestId") + String falloutRequest = + """<aetgt:FalloutHandlerRequest xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1" + xmlns:ns="http://org.openecomp/mso/request/types/v1" + xmlns:wfsch="http://org.openecomp/mso/workflow/schema/v1"> + <request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1"> + <request-id>${requestId}</request-id> + <action>SCALE</action> + <source>UUI</source> + </request-info> + <aetgt:WorkflowException xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1"> + <aetgt:ErrorMessage>${errorException}</aetgt:ErrorMessage> + <aetgt:ErrorCode>7000</aetgt:ErrorCode> + </aetgt:WorkflowException> + </aetgt:FalloutHandlerRequest>""" + + execution.setVariable("falloutRequest", falloutRequest) + } + utils.log("DEBUG", "*** Exit prepareFalloutRequest ***", isDebugEnabled) + } + + + /** + * Init the service Operation Status + */ + public void prepareInitServiceOperationStatus(DelegateExecution execution){ + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("INFO", " ======== STARTED prepareInitServiceOperationStatus Process ======== ", isDebugEnabled) + try{ + String serviceId = execution.getVariable("serviceInstanceId") + String serviceName = execution.getVariable("serviceInstanceName") + String operationId = execution.getVariable("operationId") + String operationType = "SCALE" + String userId = "" + String result = "processing" + String progress = "0" + String reason = "" + String operationContent = "Prepare service scaling" + execution.setVariable("serviceInstanceId", serviceId) + execution.setVariable("operationId", operationId) + execution.setVariable("operationType", operationType) + + def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") + execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) + utils.log("INFO", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled) + + String payload = + """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" + xmlns:ns="http://org.openecomp.mso/requestsdb"> + <soapenv:Header/> + <soapenv:Body> + <ns:updateServiceOperationStatus xmlns:ns="http://org.openecomp.mso/requestsdb"> + <serviceId>${serviceId}</serviceId> + <operationId>${operationId}</operationId> + <serviceName>${serviceName}</serviceName> + <operationType>${operationType}</operationType> + <userId>${userId}</userId> + <result>${result}</result> + <operationContent>${operationContent}</operationContent> + <progress>${progress}</progress> + <reason>${reason}</reason> + </ns:updateServiceOperationStatus> + </soapenv:Body> + </soapenv:Envelope>""" + + payload = utils.formatXml(payload) + execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload) + utils.log("INFO", "Outgoing updateServiceOperStatusRequest: \n" + payload, isDebugEnabled) + utils.logAudit("Scale network service updateServiceOperStatusRequest Request: " + payload) + + }catch(Exception e){ + utils.log("ERROR", "Exception Occured Processing prepareInitServiceOperationStatus. Exception is:\n" + e, isDebugEnabled) + execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareInitServiceOperationStatus Method:\n" + e.getMessage()) + } + utils.log("INFO", "======== COMPLETED prepareInitServiceOperationStatus Process ======== ", isDebugEnabled) + } +}
\ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy index 1c87c11ff3..240b8d089b 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy @@ -138,6 +138,61 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor } utils.log("INFO"," ***** Exit preProcessRequest *****", isDebugEnabled) } + + /** + * Init the service Operation Status + */ + public void prepareInitServiceOperationStatus(DelegateExecution execution){ + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("DEBUG", " ======== STARTED prepareInitServiceOperationStatus Process ======== ", isDebugEnabled) + try{ + String serviceId = execution.getVariable("serviceInstanceId") + String operationId = UUID.randomUUID().toString() + String operationType = execution.getVariable("operationType") + String userId = "" + String result = "processing" + String progress = "0" + String reason = "" + String operationContent = "Prepare service updating" + utils.log("DEBUG", "Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId, isDebugEnabled) + serviceId = UriUtils.encode(serviceId,"UTF-8") + execution.setVariable("serviceInstanceId", serviceId) + execution.setVariable("operationId", operationId) + execution.setVariable("operationType", operationType) + + def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") + execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) + utils.log("DEBUG", "DB Adapter Endpoint is: " + dbAdapterEndpoint, isDebugEnabled) + + String payload = + """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" + xmlns:ns="http://org.openecomp.mso/requestsdb"> + <soapenv:Header/> + <soapenv:Body> + <ns:updateServiceOperationStatus xmlns:ns="http://org.openecomp.mso/requestsdb"> + <serviceId>${serviceId}</serviceId> + <operationId>${operationId}</operationId> + <operationType>${operationType}</operationType> + <userId>${userId}</userId> + <result>${result}</result> + <operationContent>${operationContent}</operationContent> + <progress>${progress}</progress> + <reason>${reason}</reason> + </ns:updateServiceOperationStatus> + </soapenv:Body> + </soapenv:Envelope>""" + + payload = utils.formatXml(payload) + execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload) + utils.log("DEBUG", "Outgoing updateServiceOperStatusRequest: \n" + payload, isDebugEnabled) + utils.logAudit("CreateVfModuleInfra Outgoing updateServiceOperStatusRequest Request: " + payload) + + }catch(Exception e){ + utils.log("ERROR", "Exception Occured Processing prepareInitServiceOperationStatus. Exception is:\n" + e, isDebugEnabled) + execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during prepareInitServiceOperationStatus Method:\n" + e.getMessage()) + } + utils.log("DEBUG", "======== COMPLETED prepareInitServiceOperationStatus Process ======== ", isDebugEnabled) + } public void sendSyncResponse (DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy index 503cdfd034..05c3fa2d5b 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy @@ -50,704 +50,728 @@ import static org.apache.commons.lang3.StringUtils.* */ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor { - private static final String DebugFlag = "isDebugLogEnabled" - - String Prefix="CVRCS_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - VidUtils vidUtils = new VidUtils() - CatalogDbUtils catalogDbUtils = new CatalogDbUtils() - - /** - * This method is executed during the preProcessRequest task of the <class>CreateServiceInstance.bpmn</class> process. - * @param execution - */ - public InitializeProcessVariables(DelegateExecution execution){ - /* Initialize all the process variables in this block */ - - execution.setVariable("createVcpeServiceRequest", "") - execution.setVariable("globalSubscriberId", "") - execution.setVariable("serviceInstanceName", "") - execution.setVariable("msoRequestId", "") - execution.setVariable(Prefix+"VnfsCreatedCount", 0) - execution.setVariable("productFamilyId", "") - execution.setVariable("brgWanMacAddress", "") - - //TODO - execution.setVariable("sdncVersion", "1707") - } - - // ************************************************** - // Pre or Prepare Request Section - // ************************************************** - /** - * This method is executed during the preProcessRequest task of the <class>CreateServiceInstance.bpmn</class> process. - * @param execution - */ - public void preProcessRequest (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable(DebugFlag) - execution.setVariable("prefix",Prefix) - - utils.log("DEBUG", " ***** Inside preProcessRequest CreateVcpeResCustService Request ***** ", isDebugEnabled) - - try { - // initialize flow variables - InitializeProcessVariables(execution) - - //Config Inputs - String aaiDistDelay = execution.getVariable('URN_mso_workflow_aai_distribution_delay') - if (isBlank(aaiDistDelay)) { - msg = "URN_mso_workflow_aai_distribution_delay is null" - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } - execution.setVariable("aaiDistDelay", aaiDistDelay) - utils.log("DEBUG","AAI distribution delay: " + aaiDistDelay, isDebugEnabled) - - // check for incoming json message/input - String createVcpeServiceRequest = execution.getVariable("bpmnRequest") - utils.logAudit(createVcpeServiceRequest) - execution.setVariable("createVcpeServiceRequest", createVcpeServiceRequest); - println 'createVcpeServiceRequest - ' + createVcpeServiceRequest - - // extract requestId - String requestId = execution.getVariable("mso-request-id") - execution.setVariable("msoRequestId", requestId) - - String serviceInstanceId = execution.getVariable("serviceInstanceId") - - if ((serviceInstanceId == null) || (serviceInstanceId.isEmpty())) { - serviceInstanceId = UUID.randomUUID().toString() - utils.log("DEBUG", " Generated new Service Instance: " + serviceInstanceId , isDebugEnabled) - } else { - utils.log("DEBUG", "Using provided Service Instance ID: " + serviceInstanceId , isDebugEnabled) - } - - serviceInstanceId = UriUtils.encode(serviceInstanceId,"UTF-8") - execution.setVariable("serviceInstanceId", serviceInstanceId) - - String requestAction = execution.getVariable("requestAction") - execution.setVariable("requestAction", requestAction) - - setBasicDBAuthHeader(execution, isDebugEnabled) - - String source = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.source") - if ((source == null) || (source.isEmpty())) { - source = "VID" - } - execution.setVariable("source", source) - - // extract globalSubscriberId - String globalSubscriberId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.subscriberInfo.globalSubscriberId") - - // verify element global-customer-id is sent from JSON input, throw exception if missing - if ((globalSubscriberId == null) || (globalSubscriberId.isEmpty())) { - String dataErrorMessage = " Element 'globalSubscriberId' is missing. " - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) - - } else { - execution.setVariable("globalSubscriberId", globalSubscriberId) - execution.setVariable("globalCustomerId", globalSubscriberId) - } - - // extract subscriptionServiceType - String subscriptionServiceType = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestParameters.subscriptionServiceType") - execution.setVariable("subscriptionServiceType", subscriptionServiceType) - utils.log("DEBUG", "Incoming subscriptionServiceType is: " + subscriptionServiceType, isDebugEnabled) - - String suppressRollback = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.suppressRollback") - execution.setVariable("disableRollback", suppressRollback) - utils.log("DEBUG", "Incoming Suppress/Disable Rollback is: " + suppressRollback, isDebugEnabled) - - String productFamilyId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.productFamilyId") - execution.setVariable("productFamilyId", productFamilyId) - utils.log("DEBUG", "Incoming productFamilyId is: " + productFamilyId, isDebugEnabled) - - String subscriberInfo = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.subscriberInfo") - execution.setVariable("subscriberInfo", subscriberInfo) - utils.log("DEBUG", "Incoming subscriberInfo is: " + subscriberInfo, isDebugEnabled) - - /* - * Extracting User Parameters from incoming Request and converting into a Map - */ - def jsonSlurper = new JsonSlurper() - def jsonOutput = new JsonOutput() - - Map reqMap = jsonSlurper.parseText(createVcpeServiceRequest) -
- //InputParams - def userParams = reqMap.requestDetails?.requestParameters?.userParams - - Map<String, String> inputMap = [:] - - - if (userParams) { - userParams.each { - userParam -> - if("BRG_WAN_MAC_Address".equals(userParam?.name)) { - execution.setVariable("brgWanMacAddress", userParam.value) - inputMap.put("BRG_WAN_MAC_Address", userParam.value) - } - } - } - - utils.log("DEBUG", "User Input Parameters map: " + userParams.toString(), isDebugEnabled) - execution.setVariable("serviceInputParams", inputMap) - - utils.log("DEBUG", "Incoming brgWanMacAddress is: " + execution.getVariable('brgWanMacAddress'), isDebugEnabled) - - //For Completion Handler & Fallout Handler - String requestInfo = - """<request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1"> - <request-id>${requestId}</request-id> - <action>CREATE</action> - <source>${source}</source> - </request-info>""" - - execution.setVariable(Prefix+"requestInfo", requestInfo) - - utils.log("DEBUG", " ***** Completed preProcessRequest CreateVcpeResCustService Request ***** ", isDebugEnabled) - - } catch (BpmnError e) { - throw e; - - } catch (Exception ex){ - String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected from method preProcessRequest() - " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - } - - public void sendSyncResponse(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable(DebugFlag) - - utils.log("DEBUG", " ***** Inside sendSyncResponse of CreateVcpeResCustService ***** ", isDebugEnabled) - - try { - String serviceInstanceId = execution.getVariable("serviceInstanceId") - String requestId = execution.getVariable("mso-request-id") - - // RESTResponse (for API Handler (APIH) Reply Task) - String syncResponse ="""{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${requestId}"}}""".trim() - - utils.log("DEBUG", " sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse, isDebugEnabled) - sendWorkflowResponse(execution, 202, syncResponse) - - } catch (Exception ex) { - String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected from method sendSyncResponse() - " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - } - - // ******************************* - // - // ******************************* - public void prepareDecomposeService(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable(DebugFlag) - - try { - utils.log("DEBUG", " ***** Inside prepareDecomposeService of CreateVcpeResCustService ***** ", isDebugEnabled) - - String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest") - - //serviceModelInfo JSON string will be used as-is for DoCreateServiceInstance BB - String serviceModelInfo = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.modelInfo") - execution.setVariable("serviceModelInfo", serviceModelInfo) - - utils.log("DEBUG", " ***** Completed prepareDecomposeService of CreateVcpeResCustService ***** ", isDebugEnabled) - } catch (Exception ex) { - // try error in method block - String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method prepareDecomposeService() - " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - } - - // ******************************* - // - // ******************************* - public void prepareCreateServiceInstance(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable(DebugFlag) - - try { - utils.log("DEBUG", " ***** Inside prepareCreateServiceInstance of CreateVcpeResCustService ***** ", isDebugEnabled) - - /* - * Service modelInfo is created in earlier step. This flow can use it as-is ... or, extract from DecompositionObject - * ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - * ModelInfo modelInfo = serviceDecomposition.getModelInfo() - * - */ - String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest") -// String serviceInputParams = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestParameters") -// execution.setVariable("serviceInputParams", serviceInputParams) - - - String serviceInstanceName = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.instanceName") - execution.setVariable("serviceInstanceName", serviceInstanceName) - - ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - execution.setVariable("serviceDecompositionString", serviceDecomposition.toJsonStringNoRootName()) - - utils.log("DEBUG", " ***** Completed prepareCreateServiceInstance of CreateVcpeResCustService ***** ", isDebugEnabled) - } catch (Exception ex) { - // try error in method block - String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - } - - public void postProcessServiceInstanceCreate (DelegateExecution execution){ - def method = getClass().getSimpleName() + '.postProcessServiceInstanceCreate(' +'execution=' + execution.getId() +')' - def isDebugLogEnabled = execution.getVariable(DebugFlag) - logDebug('Entered ' + method, isDebugLogEnabled) - - String requestId = execution.getVariable("mso-request-id") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - String serviceInstanceName = execution.getVariable("serviceInstanceName") - - try { - - String payload = """ - <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.openecomp.mso/requestsdb"> - <soapenv:Header/> - <soapenv:Body> - <req:updateInfraRequest> - <requestId>${requestId}</requestId> - <lastModifiedBy>BPEL</lastModifiedBy> - <serviceInstanceId>${serviceInstanceId}</serviceInstanceId> - <serviceInstanceName>${serviceInstanceName}</serviceInstanceName> - </req:updateInfraRequest> - </soapenv:Body> - </soapenv:Envelope> - """ - execution.setVariable(Prefix+"setUpdateDbInstancePayload", payload) - utils.logAudit(Prefix+"setUpdateDbInstancePayload: " + payload) - logDebug('Exited ' + method, isDebugLogEnabled) - - } catch (BpmnError e) { - throw e; - } catch (Exception e) { - logError('Caught exception in ' + method, e) - exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method) - } - } - - - public void processDecomposition (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable(DebugFlag) - - utils.log("DEBUG", " ***** Inside processDecomposition() of CreateVcpeResCustService ***** ", isDebugEnabled) - - try { - - ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - - // VNFs - List<VnfResource> vnfList = serviceDecomposition.getServiceVnfs() - filterVnfs(vnfList) - serviceDecomposition.setServiceVnfs(vnfList) - - execution.setVariable("vnfList", vnfList) - execution.setVariable("vnfListString", vnfList.toString()) - - String vnfModelInfoString = "" - if (vnfList != null && vnfList.size() > 0) { - execution.setVariable(Prefix+"VNFsCount", vnfList.size()) - utils.log("DEBUG", "vnfs to create: "+ vnfList.size(), isDebugEnabled) - ModelInfo vnfModelInfo = vnfList[0].getModelInfo() - - vnfModelInfoString = vnfModelInfo.toString() - String vnfModelInfoWithRoot = vnfModelInfo.toString() - vnfModelInfoString = jsonUtil.getJsonValue(vnfModelInfoWithRoot, "modelInfo") - } else { - execution.setVariable(Prefix+"VNFsCount", 0) - utils.log("DEBUG", "no vnfs to create based upon serviceDecomposition content", isDebugEnabled) - } - - execution.setVariable("vnfModelInfo", vnfModelInfoString) - execution.setVariable("vnfModelInfoString", vnfModelInfoString) - utils.log("DEBUG", " vnfModelInfoString :" + vnfModelInfoString, isDebugEnabled) - - utils.log("DEBUG", " ***** Completed processDecomposition() of CreateVcpeResCustService ***** ", isDebugEnabled) - } catch (Exception ex) { - sendSyncError(execution) - String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. processDecomposition() - " + ex.getMessage() - utils.log("DEBUG", exceptionMessage, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - } - - private void filterVnfs(List<VnfResource> vnfList) { - if(vnfList == null) { - return - } - - // remove BRG & TXC from VNF list - - Iterator<VnfResource> it = vnfList.iterator() - while(it.hasNext()) { - VnfResource vr = it.next() - - String role = vr.getNfRole() - if(role == "BRG" || role == "TunnelXConn") { - it.remove() - } - } - } - - - public void prepareCreateAllottedResourceTXC(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable(DebugFlag) - - try { - utils.log("DEBUG", " ***** Inside prepareCreateAllottedResourceTXC of CreateVcpeResCustService ***** ", isDebugEnabled) - - /* - * Service modelInfo is created in earlier step. This flow can use it as-is ... or, extract from DecompositionObject - * ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - * ModelInfo modelInfo = serviceDecomposition.getModelInfo() - * - */ - String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest") - ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - - //allottedResourceModelInfo - //allottedResourceRole - //The model Info parameters are a JSON structure as defined in the Service Instantiation API. - //It would be sufficient to only include the service model UUID (i.e. the modelVersionId), since this BB will query the full model from the Catalog DB. - List<AllottedResource> allottedResources = serviceDecomposition.getServiceAllottedResources() - if (allottedResources != null) { - Iterator iter = allottedResources.iterator(); - while (iter.hasNext()){ - AllottedResource allottedResource = (AllottedResource)iter.next(); - - utils.log("DEBUG", " getting model info for AllottedResource # :" + allottedResource.toJsonStringNoRootName(), isDebugEnabled) - utils.log("DEBUG", " allottedResource.getAllottedResourceType() :" + allottedResource.getAllottedResourceType(), isDebugEnabled) - if("TunnelXConn".equalsIgnoreCase(allottedResource.getAllottedResourceType())){ - //set create flag to true - execution.setVariable("createTXCAR", true) - ModelInfo allottedResourceModelInfo = allottedResource.getModelInfo() - execution.setVariable("allottedResourceModelInfoTXC", allottedResourceModelInfo.toJsonStringNoRootName()) - execution.setVariable("allottedResourceRoleTXC", allottedResource.getAllottedResourceRole()) - execution.setVariable("allottedResourceTypeTXC", allottedResource.getAllottedResourceType()) - //After decomposition and homing BBs, there should be an allotted resource object in the decomposition that represents the TXC, - //and in its homingSolution section should be found the infraServiceInstanceId (i.e. infraServiceInstanceId in TXC Allotted Resource structure) (which the Homing BB would have populated). - execution.setVariable("parentServiceInstanceIdTXC", allottedResource.getHomingSolution().getServiceInstanceId()) - } - } - } - - //unit test only - String allottedResourceId = execution.getVariable("allottedResourceId") - execution.setVariable("allottedResourceIdTXC", allottedResourceId) - utils.log("DEBUG", "setting allottedResourceId CreateVcpeResCustService "+allottedResourceId, isDebugEnabled) - - utils.log("DEBUG", " ***** Completed prepareCreateAllottedResourceTXC of CreateVcpeResCustService ***** ", isDebugEnabled) - } catch (Exception ex) { - // try error in method block - String exceptionMessage = "Bpmn error encountered in prepareCreateAllottedResourceTXC flow. Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - } - public void prepareCreateAllottedResourceBRG(DelegateExecution execution) { - def isDebugEnabled=execution.getVariable(DebugFlag) - - try { - utils.log("DEBUG", " ***** Inside prepareCreateAllottedResourceBRG of CreateVcpeResCustService ***** ", isDebugEnabled) - - /* - * Service modelInfo is created in earlier step. This flow can use it as-is ... or, extract from DecompositionObject - * ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - * ModelInfo modelInfo = serviceDecomposition.getModelInfo() - * - */ - String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest") - ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") - - //allottedResourceModelInfo - //allottedResourceRole - //The model Info parameters are a JSON structure as defined in the Service Instantiation API. - //It would be sufficient to only include the service model UUID (i.e. the modelVersionId), since this BB will query the full model from the Catalog DB. - List<AllottedResource> allottedResources = serviceDecomposition.getServiceAllottedResources() - if (allottedResources != null) { - Iterator iter = allottedResources.iterator(); - while (iter.hasNext()){ - AllottedResource allottedResource = (AllottedResource)iter.next(); - - utils.log("DEBUG", " getting model info for AllottedResource # :" + allottedResource.toJsonStringNoRootName(), isDebugEnabled) - utils.log("DEBUG", " allottedResource.getAllottedResourceType() :" + allottedResource.getAllottedResourceType(), isDebugEnabled) - if("BRG".equalsIgnoreCase(allottedResource.getAllottedResourceType())){ - //set create flag to true - execution.setVariable("createBRGAR", true) - ModelInfo allottedResourceModelInfo = allottedResource.getModelInfo() - execution.setVariable("allottedResourceModelInfoBRG", allottedResourceModelInfo.toJsonStringNoRootName()) - execution.setVariable("allottedResourceRoleBRG", allottedResource.getAllottedResourceRole()) - execution.setVariable("allottedResourceTypeBRG", allottedResource.getAllottedResourceType()) - //After decomposition and homing BBs, there should be an allotted resource object in the decomposition that represents the BRG, - //and in its homingSolution section should be found the infraServiceInstanceId (i.e. infraServiceInstanceId in BRG Allotted Resource structure) (which the Homing BB would have populated). - execution.setVariable("parentServiceInstanceIdBRG", allottedResource.getHomingSolution().getServiceInstanceId()) - } - } - } - - //unit test only - String allottedResourceId = execution.getVariable("allottedResourceId") - execution.setVariable("allottedResourceIdBRG", allottedResourceId) - utils.log("DEBUG", "setting allottedResourceId CreateVcpeResCustService "+allottedResourceId, isDebugEnabled) - - utils.log("DEBUG", " ***** Completed prepareCreateAllottedResourceBRG of CreateVcpeResCustService ***** ", isDebugEnabled) - } catch (Exception ex) { - // try error in method block - String exceptionMessage = "Bpmn error encountered in prepareCreateAllottedResourceBRG flow. Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - } - - - - // ******************************* - // Generate Network request Section - // ******************************* - public void prepareVnfAndModulesCreate (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable(DebugFlag) - - try { - utils.log("DEBUG", " ***** Inside prepareVnfAndModulesCreate of CreateVcpeResCustService ***** ", isDebugEnabled) - - // String disableRollback = execution.getVariable("disableRollback") - // def backoutOnFailure = "" - // if(disableRollback != null){ - // if ( disableRollback == true) { - // backoutOnFailure = "false" - // } else if ( disableRollback == false) { - // backoutOnFailure = "true" - // } - // } - //failIfExists - optional - - String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest") - String productFamilyId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.productFamilyId") - execution.setVariable("productFamilyId", productFamilyId) - utils.log("DEBUG","productFamilyId: "+ productFamilyId, isDebugEnabled) - - List<VnfResource> vnfList = execution.getVariable("vnfList") - - Integer vnfsCreatedCount = execution.getVariable(Prefix+"VnfsCreatedCount") - String vnfModelInfoString = null; - - if (vnfList != null && vnfList.size() > 0 ) { - utils.log("DEBUG", "getting model info for vnf # " + vnfsCreatedCount, isDebugEnabled) - ModelInfo vnfModelInfo1 = vnfList[0].getModelInfo() - utils.log("DEBUG", "got 0 ", isDebugEnabled) - ModelInfo vnfModelInfo = vnfList[vnfsCreatedCount.intValue()].getModelInfo() - vnfModelInfoString = vnfModelInfo.toString() - } else { - //TODO: vnfList does not contain data. Need to investigate why ... . Fro VCPE use model stored - vnfModelInfoString = execution.getVariable("vnfModelInfo") - } - - utils.log("DEBUG", " vnfModelInfoString :" + vnfModelInfoString, isDebugEnabled) - - // extract cloud configuration - String lcpCloudRegionId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.cloudConfiguration.lcpCloudRegionId") - execution.setVariable("lcpCloudRegionId", lcpCloudRegionId) - utils.log("DEBUG","lcpCloudRegionId: "+ lcpCloudRegionId, isDebugEnabled) - String tenantId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.cloudConfiguration.tenantId") - execution.setVariable("tenantId", tenantId) - utils.log("DEBUG","tenantId: "+ tenantId, isDebugEnabled) - - String sdncVersion = execution.getVariable("sdncVersion") - utils.log("DEBUG","sdncVersion: "+ sdncVersion, isDebugEnabled) - - utils.log("DEBUG", " ***** Completed prepareVnfAndModulesCreate of CreateVcpeResCustService ***** ", isDebugEnabled) - } catch (Exception ex) { - // try error in method block - String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method prepareVnfAndModulesCreate() - " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - } - - // ******************************* - // Validate Vnf request Section -> increment count - // ******************************* - public void validateVnfCreate (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable(DebugFlag) - - try { - utils.log("DEBUG", " ***** Inside validateVnfCreate of CreateVcpeResCustService ***** ", isDebugEnabled) - - Integer vnfsCreatedCount = execution.getVariable(Prefix+"VnfsCreatedCount") - vnfsCreatedCount++ - - execution.setVariable(Prefix+"VnfsCreatedCount", vnfsCreatedCount) - - utils.log("DEBUG", " ***** Completed validateVnfCreate of CreateVcpeResCustService ***** "+" vnf # "+vnfsCreatedCount, isDebugEnabled) - } catch (Exception ex) { - // try error in method block - String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method validateVnfCreate() - " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - } - - // ***************************************** - // Prepare Completion request Section - // ***************************************** - public void postProcessResponse (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable(DebugFlag) - - utils.log("DEBUG", " ***** Inside postProcessResponse of CreateVcpeResCustService ***** ", isDebugEnabled) - - try { - String source = execution.getVariable("source") - String requestId = execution.getVariable("mso-request-id") - String serviceInstanceId = execution.getVariable("serviceInstanceId") - - String msoCompletionRequest = - """<aetgt:MsoCompletionRequest xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1" - xmlns:ns="http://org.openecomp/mso/request/types/v1"> - <request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1"> - <request-id>${requestId}</request-id> - <action>CREATE</action> - <source>${source}</source> - </request-info> - <status-message>Service Instance has been created successfully via macro orchestration</status-message> - <serviceInstanceId>${serviceInstanceId}</serviceInstanceId> - <mso-bpel-name>BPMN macro create</mso-bpel-name> - </aetgt:MsoCompletionRequest>""" - - // Format Response - String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) - - utils.logAudit(xmlMsoCompletionRequest) - execution.setVariable(Prefix+"Success", true) - execution.setVariable(Prefix+"CompleteMsoProcessRequest", xmlMsoCompletionRequest) - utils.log("DEBUG", " SUCCESS flow, going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled) - } catch (BpmnError e) { - throw e; - } catch (Exception ex) { - // try error in method block - String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method postProcessResponse() - " + ex.getMessage() - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - } - - public void preProcessRollback (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable(DebugFlag) - utils.log("DEBUG"," ***** preProcessRollback of CreateVcpeResCustService ***** ", isDebugEnabled) - try { - - Object workflowException = execution.getVariable("WorkflowException"); - - if (workflowException instanceof WorkflowException) { - utils.log("DEBUG", "Prev workflowException: " + workflowException.getErrorMessage(), isDebugEnabled) - execution.setVariable("prevWorkflowException", workflowException); - //execution.setVariable("WorkflowException", null); - } - } catch (BpmnError e) { - utils.log("DEBUG", "BPMN Error during preProcessRollback", isDebugEnabled) - } catch(Exception ex) { - String msg = "Exception in preProcessRollback. " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - } - utils.log("DEBUG"," *** Exit preProcessRollback of CreateVcpeResCustService *** ", isDebugEnabled) - } - - public void postProcessRollback (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable(DebugFlag) - utils.log("DEBUG"," ***** postProcessRollback of CreateVcpeResCustService ***** ", isDebugEnabled) - String msg = "" - try { - Object workflowException = execution.getVariable("prevWorkflowException"); - if (workflowException instanceof WorkflowException) { - utils.log("DEBUG", "Setting prevException to WorkflowException: ", isDebugEnabled) - execution.setVariable("WorkflowException", workflowException); - } - } catch (BpmnError b) { - utils.log("DEBUG", "BPMN Error during postProcessRollback", isDebugEnabled) - throw b; - } catch(Exception ex) { - msg = "Exception in postProcessRollback. " + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - } - utils.log("DEBUG"," *** Exit postProcessRollback of CreateVcpeResCustService *** ", isDebugEnabled) - } - - public void prepareFalloutRequest(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable(DebugFlag) - - utils.log("DEBUG", " *** STARTED CreateVcpeResCustService prepareFalloutRequest Process *** ", isDebugEnabled) - - try { - WorkflowException wfex = execution.getVariable("WorkflowException") - utils.log("DEBUG", " Incoming Workflow Exception: " + wfex.toString(), isDebugEnabled) - String requestInfo = execution.getVariable(Prefix+"requestInfo") - utils.log("DEBUG", " Incoming Request Info: " + requestInfo, isDebugEnabled) - - //TODO. hmmm. there is no way to UPDATE error message. -// String errorMessage = wfex.getErrorMessage() -// boolean successIndicator = execution.getVariable("DCRESI_rolledBack") -// if (successIndicator){ -// errorMessage = errorMessage + ". Rollback successful." -// } else { -// errorMessage = errorMessage + ". Rollback not completed." -// } - - String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo) - - execution.setVariable(Prefix+"falloutRequest", falloutRequest) - - } catch (Exception ex) { - utils.log("DEBUG", "Error Occured in CreateVcpeResCustService prepareFalloutRequest Process " + ex.getMessage(), isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVcpeResCustService prepareFalloutRequest Process") - } - utils.log("DEBUG", "*** COMPLETED CreateVcpeResCustService prepareFalloutRequest Process ***", isDebugEnabled) - } - - - public void sendSyncError (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable(DebugFlag) - execution.setVariable("prefix", Prefix) - - utils.log("DEBUG", " ***** Inside sendSyncError() of CreateVcpeResCustService ***** ", isDebugEnabled) - - try { - String errorMessage = "" - def wfe = execution.getVariable("WorkflowException") - if (wfe instanceof WorkflowException) { - errorMessage = wfe.getErrorMessage() - } else { - errorMessage = "Sending Sync Error." - } - - String buildworkflowException = - """<aetgt:WorkflowException xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1"> - <aetgt:ErrorMessage>${errorMessage}</aetgt:ErrorMessage> - <aetgt:ErrorCode>7000</aetgt:ErrorCode> - </aetgt:WorkflowException>""" - - utils.logAudit(buildworkflowException) - sendWorkflowResponse(execution, 500, buildworkflowException) - } catch (Exception ex) { - utils.log("DEBUG", " Sending Sync Error Activity Failed. " + "\n" + ex.getMessage(), isDebugEnabled) - } - } - - public void processJavaException(DelegateExecution execution){ - def isDebugEnabled=execution.getVariable(DebugFlag) - execution.setVariable("prefix",Prefix) - try{ - utils.log("DEBUG", "Caught a Java Exception", isDebugEnabled) - utils.log("DEBUG", "Started processJavaException Method", isDebugEnabled) - utils.log("DEBUG", "Variables List: " + execution.getVariables(), isDebugEnabled) - execution.setVariable(Prefix+"unexpectedError", "Caught a Java Lang Exception") // Adding this line temporarily until this flows error handling gets updated - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Caught a Java Lang Exception") - }catch(BpmnError b){ - utils.log("ERROR", "Rethrowing MSOWorkflowException", isDebugEnabled) - throw b - }catch(Exception e){ - utils.log("DEBUG", "Caught Exception during processJavaException Method: " + e, isDebugEnabled) - execution.setVariable(Prefix+"unexpectedError", "Exception in processJavaException method") // Adding this line temporarily until this flows error handling gets updated - exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception in processJavaException method") - } - utils.log("DEBUG", "Completed processJavaException Method", isDebugEnabled) - } + private static final String DebugFlag = "isDebugLogEnabled" + + String Prefix = "CVRCS_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + VidUtils vidUtils = new VidUtils() + CatalogDbUtils catalogDbUtils = new CatalogDbUtils() + + /** + * This method is executed during the preProcessRequest task of the <class>CreateServiceInstance.bpmn</class> process. + * @param execution + */ + public InitializeProcessVariables(DelegateExecution execution) { + /* Initialize all the process variables in this block */ + + execution.setVariable("createVcpeServiceRequest", "") + execution.setVariable("globalSubscriberId", "") + execution.setVariable("serviceInstanceName", "") + execution.setVariable("msoRequestId", "") + execution.setVariable(Prefix + "VnfsCreatedCount", 0) + execution.setVariable("productFamilyId", "") + execution.setVariable("brgWanMacAddress", "") + execution.setVariable("customerLocation", "") + execution.setVariable("homingService", "") + + //TODO + execution.setVariable("sdncVersion", "1707") + } + + // ************************************************** + // Pre or Prepare Request Section + // ************************************************** + /** + * This method is executed during the preProcessRequest task of the <class>CreateServiceInstance.bpmn</class> process. + * @param execution + */ + public void preProcessRequest(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable(DebugFlag) + execution.setVariable("prefix", Prefix) + + utils.log("DEBUG", " ***** Inside preProcessRequest CreateVcpeResCustService Request ***** ", isDebugEnabled) + + try { + // initialize flow variables + InitializeProcessVariables(execution) + + //Config Inputs + String aaiDistDelay = execution.getVariable('URN_mso_workflow_aai_distribution_delay') + if (isBlank(aaiDistDelay)) { + msg = "URN_mso_workflow_aai_distribution_delay is null" + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + execution.setVariable("aaiDistDelay", aaiDistDelay) + utils.log("DEBUG", "AAI distribution delay: " + aaiDistDelay, isDebugEnabled) + + // check for incoming json message/input + String createVcpeServiceRequest = execution.getVariable("bpmnRequest") + utils.logAudit(createVcpeServiceRequest) + execution.setVariable("createVcpeServiceRequest", createVcpeServiceRequest); + println 'createVcpeServiceRequest - ' + createVcpeServiceRequest + + // extract requestId + String requestId = execution.getVariable("mso-request-id") + execution.setVariable("msoRequestId", requestId) + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + + if ((serviceInstanceId == null) || (serviceInstanceId.isEmpty())) { + serviceInstanceId = UUID.randomUUID().toString() + utils.log("DEBUG", " Generated new Service Instance: " + serviceInstanceId, isDebugEnabled) + } else { + utils.log("DEBUG", "Using provided Service Instance ID: " + serviceInstanceId, isDebugEnabled) + } + + serviceInstanceId = UriUtils.encode(serviceInstanceId, "UTF-8") + execution.setVariable("serviceInstanceId", serviceInstanceId) + + String requestAction = execution.getVariable("requestAction") + execution.setVariable("requestAction", requestAction) + + setBasicDBAuthHeader(execution, isDebugEnabled) + + String source = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.source") + if ((source == null) || (source.isEmpty())) { + source = "VID" + } + execution.setVariable("source", source) + + // extract globalSubscriberId + String globalSubscriberId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.subscriberInfo.globalSubscriberId") + + // verify element global-customer-id is sent from JSON input, throw exception if missing + if ((globalSubscriberId == null) || (globalSubscriberId.isEmpty())) { + String dataErrorMessage = " Element 'globalSubscriberId' is missing. " + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, dataErrorMessage) + + } else { + execution.setVariable("globalSubscriberId", globalSubscriberId) + execution.setVariable("globalCustomerId", globalSubscriberId) + } + + // extract subscriptionServiceType + String subscriptionServiceType = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestParameters.subscriptionServiceType") + execution.setVariable("subscriptionServiceType", subscriptionServiceType) + utils.log("DEBUG", "Incoming subscriptionServiceType is: " + subscriptionServiceType, isDebugEnabled) + + String suppressRollback = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.suppressRollback") + execution.setVariable("disableRollback", suppressRollback) + utils.log("DEBUG", "Incoming Suppress/Disable Rollback is: " + suppressRollback, isDebugEnabled) + + String productFamilyId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.productFamilyId") + execution.setVariable("productFamilyId", productFamilyId) + utils.log("DEBUG", "Incoming productFamilyId is: " + productFamilyId, isDebugEnabled) + + String subscriberInfo = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.subscriberInfo") + execution.setVariable("subscriberInfo", subscriberInfo) + utils.log("DEBUG", "Incoming subscriberInfo is: " + subscriberInfo, isDebugEnabled) + + /* + * Extracting User Parameters from incoming Request and converting into a Map + */ + def jsonSlurper = new JsonSlurper() + def jsonOutput = new JsonOutput() + + Map reqMap = jsonSlurper.parseText(createVcpeServiceRequest) + + //InputParams + def userParams = reqMap.requestDetails?.requestParameters?.userParams + + Map<String, String> inputMap = [:] + + if (userParams) { + userParams.each { + userParam -> + if("BRG_WAN_MAC_Address".equals(userParam?.name)) { + execution.setVariable("brgWanMacAddress", userParam.value) + inputMap.put("BRG_WAN_MAC_Address", userParam.value) + } + if("Customer_Location".equals(userParam?.name)) { + execution.setVariable("customerLocation", userParam.value) + userParam.value.each { + customerLocParam -> + inputMap.put(customerLocParam.key, customerLocParam.value) + } + } + if("Homing_Solution".equals(userParam?.name)) { + execution.setVariable("homingService", userParam.value) + inputMap.put("Homing_Solution", userParam.value) + } else { + execution.setVariable("homingService", "oof") + } + } + } + + utils.log("DEBUG", "User Input Parameters map: " + userParams.toString(), isDebugEnabled) + execution.setVariable("serviceInputParams", inputMap) + + utils.log("DEBUG", "Incoming brgWanMacAddress is: " + execution.getVariable('brgWanMacAddress'), isDebugEnabled) + + //For Completion Handler & Fallout Handler + String requestInfo = + """<request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1"> + <request-id>${requestId}</request-id> + <action>CREATE</action> + <source>${source}</source> + </request-info>""" + + execution.setVariable(Prefix + "requestInfo", requestInfo) + + utils.log("DEBUG", " ***** Completed preProcessRequest CreateVcpeResCustService Request ***** ", isDebugEnabled) + + } catch (BpmnError e) { + throw e; + + } catch (Exception ex) { + String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected from method preProcessRequest() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + public void sendSyncResponse(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable(DebugFlag) + + utils.log("DEBUG", " ***** Inside sendSyncResponse of CreateVcpeResCustService ***** ", isDebugEnabled) + + try { + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String requestId = execution.getVariable("mso-request-id") + + // RESTResponse (for API Handler (APIH) Reply Task) + String syncResponse = """{"requestReferences":{"instanceId":"${serviceInstanceId}","requestId":"${ + requestId + }"}}""".trim() + + utils.log("DEBUG", " sendSynchResponse: xmlSyncResponse - " + "\n" + syncResponse, isDebugEnabled) + sendWorkflowResponse(execution, 202, syncResponse) + + } catch (Exception ex) { + String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected from method sendSyncResponse() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + // ******************************* + // + // ******************************* + public void prepareDecomposeService(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable(DebugFlag) + + try { + utils.log("DEBUG", " ***** Inside prepareDecomposeService of CreateVcpeResCustService ***** ", isDebugEnabled) + + String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest") + + //serviceModelInfo JSON string will be used as-is for DoCreateServiceInstance BB + String serviceModelInfo = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.modelInfo") + execution.setVariable("serviceModelInfo", serviceModelInfo) + + utils.log("DEBUG", " ***** Completed prepareDecomposeService of CreateVcpeResCustService ***** ", isDebugEnabled) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method prepareDecomposeService() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + // ******************************* + // + // ******************************* + public void prepareCreateServiceInstance(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable(DebugFlag) + + try { + utils.log("DEBUG", " ***** Inside prepareCreateServiceInstance of CreateVcpeResCustService ***** ", isDebugEnabled) + + /* + * Service modelInfo is created in earlier step. This flow can use it as-is ... or, extract from DecompositionObject + * ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + * ModelInfo modelInfo = serviceDecomposition.getModelInfo() + * + */ + String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest") +// String serviceInputParams = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestParameters") +// execution.setVariable("serviceInputParams", serviceInputParams) + + + String serviceInstanceName = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.instanceName") + execution.setVariable("serviceInstanceName", serviceInstanceName) + + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + execution.setVariable("serviceDecompositionString", serviceDecomposition.toJsonStringNoRootName()) + + utils.log("DEBUG", " ***** Completed prepareCreateServiceInstance of CreateVcpeResCustService ***** ", isDebugEnabled) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + public void postProcessServiceInstanceCreate(DelegateExecution execution) { + def method = getClass().getSimpleName() + '.postProcessServiceInstanceCreate(' + 'execution=' + execution.getId() + ')' + def isDebugLogEnabled = execution.getVariable(DebugFlag) + logDebug('Entered ' + method, isDebugLogEnabled) + + String requestId = execution.getVariable("mso-request-id") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String serviceInstanceName = execution.getVariable("serviceInstanceName") + + try { + + String payload = """ + <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://org.openecomp.mso/requestsdb"> + <soapenv:Header/> + <soapenv:Body> + <req:updateInfraRequest> + <requestId>${requestId}</requestId> + <lastModifiedBy>BPEL</lastModifiedBy> + <serviceInstanceId>${serviceInstanceId}</serviceInstanceId> + <serviceInstanceName>${serviceInstanceName}</serviceInstanceName> + </req:updateInfraRequest> + </soapenv:Body> + </soapenv:Envelope> + """ + execution.setVariable(Prefix + "setUpdateDbInstancePayload", payload) + utils.logAudit(Prefix + "setUpdateDbInstancePayload: " + payload) + logDebug('Exited ' + method, isDebugLogEnabled) + + } catch (BpmnError e) { + throw e; + } catch (Exception e) { + logError('Caught exception in ' + method, e) + exceptionUtil.buildAndThrowWorkflowException(execution, 2000, "Internal Error - Occured in" + method) + } + } + + + public void processDecomposition(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable(DebugFlag) + + utils.log("DEBUG", " ***** Inside processDecomposition() of CreateVcpeResCustService ***** ", isDebugEnabled) + + try { + + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + + // VNFs + List<VnfResource> vnfList = serviceDecomposition.getServiceVnfs() + filterVnfs(vnfList) + serviceDecomposition.setServiceVnfs(vnfList) + + execution.setVariable("vnfList", vnfList) + execution.setVariable("vnfListString", vnfList.toString()) + + String vnfModelInfoString = "" + if (vnfList != null && vnfList.size() > 0) { + execution.setVariable(Prefix + "VNFsCount", vnfList.size()) + utils.log("DEBUG", "vnfs to create: " + vnfList.size(), isDebugEnabled) + ModelInfo vnfModelInfo = vnfList[0].getModelInfo() + + vnfModelInfoString = vnfModelInfo.toString() + String vnfModelInfoWithRoot = vnfModelInfo.toString() + vnfModelInfoString = jsonUtil.getJsonValue(vnfModelInfoWithRoot, "modelInfo") + } else { + execution.setVariable(Prefix + "VNFsCount", 0) + utils.log("DEBUG", "no vnfs to create based upon serviceDecomposition content", isDebugEnabled) + } + + execution.setVariable("vnfModelInfo", vnfModelInfoString) + execution.setVariable("vnfModelInfoString", vnfModelInfoString) + utils.log("DEBUG", " vnfModelInfoString :" + vnfModelInfoString, isDebugEnabled) + + utils.log("DEBUG", " ***** Completed processDecomposition() of CreateVcpeResCustService ***** ", isDebugEnabled) + } catch (Exception ex) { + sendSyncError(execution) + String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. processDecomposition() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + private void filterVnfs(List<VnfResource> vnfList) { + if (vnfList == null) { + return + } + + // remove BRG & TXC from VNF list + + Iterator<VnfResource> it = vnfList.iterator() + while (it.hasNext()) { + VnfResource vr = it.next() + + String role = vr.getNfRole() + if (role == "BRG" || role == "TunnelXConn") { + it.remove() + } + } + } + + + public void prepareCreateAllottedResourceTXC(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable(DebugFlag) + + try { + utils.log("DEBUG", " ***** Inside prepareCreateAllottedResourceTXC of CreateVcpeResCustService ***** ", isDebugEnabled) + + /* + * Service modelInfo is created in earlier step. This flow can use it as-is ... or, extract from DecompositionObject + * ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + * ModelInfo modelInfo = serviceDecomposition.getModelInfo() + * + */ + String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest") + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + + //allottedResourceModelInfo + //allottedResourceRole + //The model Info parameters are a JSON structure as defined in the Service Instantiation API. + //It would be sufficient to only include the service model UUID (i.e. the modelVersionId), since this BB will query the full model from the Catalog DB. + List<AllottedResource> allottedResources = serviceDecomposition.getServiceAllottedResources() + if (allottedResources != null) { + Iterator iter = allottedResources.iterator(); + while (iter.hasNext()) { + AllottedResource allottedResource = (AllottedResource) iter.next(); + + utils.log("DEBUG", " getting model info for AllottedResource # :" + allottedResource.toJsonStringNoRootName(), isDebugEnabled) + utils.log("DEBUG", " allottedResource.getAllottedResourceType() :" + allottedResource.getAllottedResourceType(), isDebugEnabled) + if ("TunnelXConn".equalsIgnoreCase(allottedResource.getAllottedResourceType())) { + //set create flag to true + execution.setVariable("createTXCAR", true) + ModelInfo allottedResourceModelInfo = allottedResource.getModelInfo() + execution.setVariable("allottedResourceModelInfoTXC", allottedResourceModelInfo.toJsonStringNoRootName()) + execution.setVariable("allottedResourceRoleTXC", allottedResource.getAllottedResourceRole()) + execution.setVariable("allottedResourceTypeTXC", allottedResource.getAllottedResourceType()) + //After decomposition and homing BBs, there should be an allotted resource object in the decomposition that represents the TXC, + //and in its homingSolution section should be found the infraServiceInstanceId (i.e. infraServiceInstanceId in TXC Allotted Resource structure) (which the Homing BB would have populated). + execution.setVariable("parentServiceInstanceIdTXC", allottedResource.getHomingSolution().getServiceInstanceId()) + } + } + } + + //unit test only + String allottedResourceId = execution.getVariable("allottedResourceId") + execution.setVariable("allottedResourceIdTXC", allottedResourceId) + utils.log("DEBUG", "setting allottedResourceId CreateVcpeResCustService " + allottedResourceId, isDebugEnabled) + + utils.log("DEBUG", " ***** Completed prepareCreateAllottedResourceTXC of CreateVcpeResCustService ***** ", isDebugEnabled) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in prepareCreateAllottedResourceTXC flow. Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + public void prepareCreateAllottedResourceBRG(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable(DebugFlag) + + try { + utils.log("DEBUG", " ***** Inside prepareCreateAllottedResourceBRG of CreateVcpeResCustService ***** ", isDebugEnabled) + + /* + * Service modelInfo is created in earlier step. This flow can use it as-is ... or, extract from DecompositionObject + * ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + * ModelInfo modelInfo = serviceDecomposition.getModelInfo() + * + */ + String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest") + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + + //allottedResourceModelInfo + //allottedResourceRole + //The model Info parameters are a JSON structure as defined in the Service Instantiation API. + //It would be sufficient to only include the service model UUID (i.e. the modelVersionId), since this BB will query the full model from the Catalog DB. + List<AllottedResource> allottedResources = serviceDecomposition.getServiceAllottedResources() + if (allottedResources != null) { + Iterator iter = allottedResources.iterator(); + while (iter.hasNext()) { + AllottedResource allottedResource = (AllottedResource) iter.next(); + + utils.log("DEBUG", " getting model info for AllottedResource # :" + allottedResource.toJsonStringNoRootName(), isDebugEnabled) + utils.log("DEBUG", " allottedResource.getAllottedResourceType() :" + allottedResource.getAllottedResourceType(), isDebugEnabled) + if ("BRG".equalsIgnoreCase(allottedResource.getAllottedResourceType())) { + //set create flag to true + execution.setVariable("createBRGAR", true) + ModelInfo allottedResourceModelInfo = allottedResource.getModelInfo() + execution.setVariable("allottedResourceModelInfoBRG", allottedResourceModelInfo.toJsonStringNoRootName()) + execution.setVariable("allottedResourceRoleBRG", allottedResource.getAllottedResourceRole()) + execution.setVariable("allottedResourceTypeBRG", allottedResource.getAllottedResourceType()) + //After decomposition and homing BBs, there should be an allotted resource object in the decomposition that represents the BRG, + //and in its homingSolution section should be found the infraServiceInstanceId (i.e. infraServiceInstanceId in BRG Allotted Resource structure) (which the Homing BB would have populated). + execution.setVariable("parentServiceInstanceIdBRG", allottedResource.getHomingSolution().getServiceInstanceId()) + } + } + } + + //unit test only + String allottedResourceId = execution.getVariable("allottedResourceId") + execution.setVariable("allottedResourceIdBRG", allottedResourceId) + utils.log("DEBUG", "setting allottedResourceId CreateVcpeResCustService " + allottedResourceId, isDebugEnabled) + + utils.log("DEBUG", " ***** Completed prepareCreateAllottedResourceBRG of CreateVcpeResCustService ***** ", isDebugEnabled) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in prepareCreateAllottedResourceBRG flow. Unexpected Error from method prepareCreateServiceInstance() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + // ******************************* + // Generate Network request Section + // ******************************* + public void prepareVnfAndModulesCreate(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable(DebugFlag) + + try { + utils.log("DEBUG", " ***** Inside prepareVnfAndModulesCreate of CreateVcpeResCustService ***** ", isDebugEnabled) + + // String disableRollback = execution.getVariable("disableRollback") + // def backoutOnFailure = "" + // if(disableRollback != null){ + // if ( disableRollback == true) { + // backoutOnFailure = "false" + // } else if ( disableRollback == false) { + // backoutOnFailure = "true" + // } + // } + //failIfExists - optional + + String createVcpeServiceRequest = execution.getVariable("createVcpeServiceRequest") + String productFamilyId = jsonUtil.getJsonValue(createVcpeServiceRequest, "requestDetails.requestInfo.productFamilyId") + execution.setVariable("productFamilyId", productFamilyId) + utils.log("DEBUG", "productFamilyId: " + productFamilyId, isDebugEnabled) + + List<VnfResource> vnfList = execution.getVariable("vnfList") + + Integer vnfsCreatedCount = execution.getVariable(Prefix + "VnfsCreatedCount") + String vnfModelInfoString = null; + + if (vnfList != null && vnfList.size() > 0) { + utils.log("DEBUG", "getting model info for vnf # " + vnfsCreatedCount, isDebugEnabled) + ModelInfo vnfModelInfo1 = vnfList[0].getModelInfo() + utils.log("DEBUG", "got 0 ", isDebugEnabled) + ModelInfo vnfModelInfo = vnfList[vnfsCreatedCount.intValue()].getModelInfo() + vnfModelInfoString = vnfModelInfo.toString() + } else { + //TODO: vnfList does not contain data. Need to investigate why ... . Fro VCPE use model stored + vnfModelInfoString = execution.getVariable("vnfModelInfo") + } + + utils.log("DEBUG", " vnfModelInfoString :" + vnfModelInfoString, isDebugEnabled) + + // extract cloud configuration + String vimId = jsonUtil.getJsonValue(createVcpeServiceRequest, + "requestDetails.cloudConfiguration.lcpCloudRegionId") + def cloudRegion = vimId.split("_") + execution.setVariable("cloudOwner", cloudRegion[0]) + utils.log("DEBUG","cloudOwner: "+ cloudRegion[0], isDebugEnabled) + execution.setVariable("cloudRegionId", cloudRegion[1]) + utils.log("DEBUG","cloudRegionId: "+ cloudRegion[1], isDebugEnabled) + execution.setVariable("lcpCloudRegionId", cloudRegion[1]) + utils.log("DEBUG","lcpCloudRegionId: "+ cloudRegion[1], isDebugEnabled) + String tenantId = jsonUtil.getJsonValue(createVcpeServiceRequest, + "requestDetails.cloudConfiguration.tenantId") + execution.setVariable("tenantId", tenantId) + utils.log("DEBUG", "tenantId: " + tenantId, isDebugEnabled) + + String sdncVersion = execution.getVariable("sdncVersion") + utils.log("DEBUG", "sdncVersion: " + sdncVersion, isDebugEnabled) + + utils.log("DEBUG", " ***** Completed prepareVnfAndModulesCreate of CreateVcpeResCustService ***** ", isDebugEnabled) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method prepareVnfAndModulesCreate() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + // ******************************* + // Validate Vnf request Section -> increment count + // ******************************* + public void validateVnfCreate(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable(DebugFlag) + + try { + utils.log("DEBUG", " ***** Inside validateVnfCreate of CreateVcpeResCustService ***** ", isDebugEnabled) + + Integer vnfsCreatedCount = execution.getVariable(Prefix + "VnfsCreatedCount") + vnfsCreatedCount++ + + execution.setVariable(Prefix + "VnfsCreatedCount", vnfsCreatedCount) + + utils.log("DEBUG", " ***** Completed validateVnfCreate of CreateVcpeResCustService ***** " + " vnf # " + vnfsCreatedCount, isDebugEnabled) + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method validateVnfCreate() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + // ***************************************** + // Prepare Completion request Section + // ***************************************** + public void postProcessResponse(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable(DebugFlag) + + utils.log("DEBUG", " ***** Inside postProcessResponse of CreateVcpeResCustService ***** ", isDebugEnabled) + + try { + String source = execution.getVariable("source") + String requestId = execution.getVariable("mso-request-id") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + + String msoCompletionRequest = + """<aetgt:MsoCompletionRequest xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1" + xmlns:ns="http://org.openecomp/mso/request/types/v1"> + <request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1"> + <request-id>${requestId}</request-id> + <action>CREATE</action> + <source>${source}</source> + </request-info> + <status-message>Service Instance has been created successfully via macro orchestration</status-message> + <serviceInstanceId>${serviceInstanceId}</serviceInstanceId> + <mso-bpel-name>BPMN macro create</mso-bpel-name> + </aetgt:MsoCompletionRequest>""" + + // Format Response + String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest) + + utils.logAudit(xmlMsoCompletionRequest) + execution.setVariable(Prefix + "Success", true) + execution.setVariable(Prefix + "CompleteMsoProcessRequest", xmlMsoCompletionRequest) + utils.log("DEBUG", " SUCCESS flow, going to CompleteMsoProcess - " + "\n" + xmlMsoCompletionRequest, isDebugEnabled) + } catch (BpmnError e) { + throw e; + } catch (Exception ex) { + // try error in method block + String exceptionMessage = "Bpmn error encountered in CreateVcpeResCustService flow. Unexpected Error from method postProcessResponse() - " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + } + + public void preProcessRollback(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable(DebugFlag) + utils.log("DEBUG", " ***** preProcessRollback of CreateVcpeResCustService ***** ", isDebugEnabled) + try { + + Object workflowException = execution.getVariable("WorkflowException"); + + if (workflowException instanceof WorkflowException) { + utils.log("DEBUG", "Prev workflowException: " + workflowException.getErrorMessage(), isDebugEnabled) + execution.setVariable("prevWorkflowException", workflowException); + //execution.setVariable("WorkflowException", null); + } + } catch (BpmnError e) { + utils.log("DEBUG", "BPMN Error during preProcessRollback", isDebugEnabled) + } catch (Exception ex) { + String msg = "Exception in preProcessRollback. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + } + utils.log("DEBUG", " *** Exit preProcessRollback of CreateVcpeResCustService *** ", isDebugEnabled) + } + + public void postProcessRollback(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable(DebugFlag) + utils.log("DEBUG", " ***** postProcessRollback of CreateVcpeResCustService ***** ", isDebugEnabled) + String msg = "" + try { + Object workflowException = execution.getVariable("prevWorkflowException"); + if (workflowException instanceof WorkflowException) { + utils.log("DEBUG", "Setting prevException to WorkflowException: ", isDebugEnabled) + execution.setVariable("WorkflowException", workflowException); + } + } catch (BpmnError b) { + utils.log("DEBUG", "BPMN Error during postProcessRollback", isDebugEnabled) + throw b; + } catch (Exception ex) { + msg = "Exception in postProcessRollback. " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + } + utils.log("DEBUG", " *** Exit postProcessRollback of CreateVcpeResCustService *** ", isDebugEnabled) + } + + public void prepareFalloutRequest(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable(DebugFlag) + + utils.log("DEBUG", " *** STARTED CreateVcpeResCustService prepareFalloutRequest Process *** ", isDebugEnabled) + + try { + WorkflowException wfex = execution.getVariable("WorkflowException") + utils.log("DEBUG", " Incoming Workflow Exception: " + wfex.toString(), isDebugEnabled) + String requestInfo = execution.getVariable(Prefix + "requestInfo") + utils.log("DEBUG", " Incoming Request Info: " + requestInfo, isDebugEnabled) + + //TODO. hmmm. there is no way to UPDATE error message. +// String errorMessage = wfex.getErrorMessage() +// boolean successIndicator = execution.getVariable("DCRESI_rolledBack") +// if (successIndicator){ +// errorMessage = errorMessage + ". Rollback successful." +// } else { +// errorMessage = errorMessage + ". Rollback not completed." +// } + + String falloutRequest = exceptionUtil.processMainflowsBPMNException(execution, requestInfo) + + execution.setVariable(Prefix + "falloutRequest", falloutRequest) + + } catch (Exception ex) { + utils.log("DEBUG", "Error Occured in CreateVcpeResCustService prepareFalloutRequest Process " + ex.getMessage(), isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in CreateVcpeResCustService prepareFalloutRequest Process") + } + utils.log("DEBUG", "*** COMPLETED CreateVcpeResCustService prepareFalloutRequest Process ***", isDebugEnabled) + } + + + public void sendSyncError(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable(DebugFlag) + execution.setVariable("prefix", Prefix) + + utils.log("DEBUG", " ***** Inside sendSyncError() of CreateVcpeResCustService ***** ", isDebugEnabled) + + try { + String errorMessage = "" + def wfe = execution.getVariable("WorkflowException") + if (wfe instanceof WorkflowException) { + errorMessage = wfe.getErrorMessage() + } else { + errorMessage = "Sending Sync Error." + } + + String buildworkflowException = + """<aetgt:WorkflowException xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1"> + <aetgt:ErrorMessage>${errorMessage}</aetgt:ErrorMessage> + <aetgt:ErrorCode>7000</aetgt:ErrorCode> + </aetgt:WorkflowException>""" + + utils.logAudit(buildworkflowException) + sendWorkflowResponse(execution, 500, buildworkflowException) + } catch (Exception ex) { + utils.log("DEBUG", " Sending Sync Error Activity Failed. " + "\n" + ex.getMessage(), isDebugEnabled) + } + } + + public void processJavaException(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable(DebugFlag) + execution.setVariable("prefix", Prefix) + try { + utils.log("DEBUG", "Caught a Java Exception", isDebugEnabled) + utils.log("DEBUG", "Started processJavaException Method", isDebugEnabled) + utils.log("DEBUG", "Variables List: " + execution.getVariables(), isDebugEnabled) + execution.setVariable(Prefix + "unexpectedError", "Caught a Java Lang Exception") + // Adding this line temporarily until this flows error handling gets updated + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Caught a Java Lang Exception") + } catch (BpmnError b) { + utils.log("ERROR", "Rethrowing MSOWorkflowException", isDebugEnabled) + throw b + } catch (Exception e) { + utils.log("DEBUG", "Caught Exception during processJavaException Method: " + e, isDebugEnabled) + execution.setVariable(Prefix + "unexpectedError", "Exception in processJavaException method") + // Adding this line temporarily until this flows error handling gets updated + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Exception in processJavaException method") + } + utils.log("DEBUG", "Completed processJavaException Method", isDebugEnabled) + } } diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/LocationConstraint.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/LocationConstraint.java new file mode 100644 index 0000000000..4185808b91 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/LocationConstraint.java @@ -0,0 +1,73 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 CMCC All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.openecomp.mso.bpmn.infrastructure.vfcmodel; + + +/** + * <br> + * <p> + * </p> + * + * @author + * @version ONAP Amsterdam Release 2017-9-6 + */ +public class LocationConstraint { + + /** + * vnf profile id + */ + private String vnfProfileId; + + /** + * location constraints: vimId + */ + private VimLocation locationConstraints; + + /** + * @return Returns the vnfProfileId. + */ + public String getVnfProfileId() { + return vnfProfileId; + } + + /** + * @param vnfProfileId The vnfProfileId to set. + */ + public void setVnfProfileId(String vnfProfileId) { + this.vnfProfileId = vnfProfileId; + } + + + /** + * @return Returns the locationConstraints. + */ + public VimLocation getLocationConstraints() { + return locationConstraints; + } + + + /** + * @param locationConstraints The locationConstraints to set. + */ + public void setLocationConstraints(VimLocation locationConstraints) { + this.locationConstraints = locationConstraints; + } + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/NSResourceInputParameter.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/NSResourceInputParameter.java new file mode 100644 index 0000000000..272f3fb71a --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/NSResourceInputParameter.java @@ -0,0 +1,118 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 CMCC All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.infrastructure.vfcmodel; + + +import org.openecomp.mso.logger.MsoLogger; + + +/** + * NS Create Input Parameter For VFC Adapter<br> + * <p> + * </p> + * + * @version ONAP Beijing Release 2018/2/5 + */ +public class NSResourceInputParameter { + + private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA); + + private NsOperationKey nsOperationKey; + + private String nsServiceName; + + private String nsServiceDescription; + + private NsParameters nsParameters; + + private NsScaleParameters nsScaleParameters; + + + + + /** + * @return Returns the nsServiceName. + */ + public String getNsServiceName() { + return nsServiceName; + } + + + /** + * @param nsServiceName The nsServiceName to set. + */ + public void setNsServiceName(String nsServiceName) { + this.nsServiceName = nsServiceName; + } + + + /** + * @return Returns the nsServiceDescription. + */ + public String getNsServiceDescription() { + return nsServiceDescription; + } + + + /** + * @param nsServiceDescription The nsServiceDescription to set. + */ + public void setNsServiceDescription(String nsServiceDescription) { + this.nsServiceDescription = nsServiceDescription; + } + + /** + * @return Returns the nsParameters. + */ + public NsParameters getNsParameters() { + return nsParameters; + } + + /** + * @param nsParameters The nsParameters to set. + */ + public void setNsParameters(NsParameters nsParameters) { + this.nsParameters = nsParameters; + } + + public NsOperationKey getNsOperationKey() { + return nsOperationKey; + } + + public void setNsOperationKey(NsOperationKey nsOperationKey) { + this.nsOperationKey = nsOperationKey; + } + + /** + * @return Returns the nsScaleParameters. + */ + public NsScaleParameters getNsScaleParameters() { + return nsScaleParameters; + } + + /** + * @param nsScaleParameters The nsScaleParameters to set. + */ + public void setNsScaleParameters(NsScaleParameters nsScaleParameters) { + this.nsScaleParameters = nsScaleParameters; + } + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/NsOperationKey.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/NsOperationKey.java new file mode 100644 index 0000000000..7783d7ab92 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/NsOperationKey.java @@ -0,0 +1,141 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 CMCC All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.openecomp.mso.bpmn.infrastructure.vfcmodel; + + +/** + * The operation key object for NS + * <br> + * <p> + * </p> + * + * @author + * @version ONAP Amsterdam Release 2017-09-15 + */ +public class NsOperationKey { + + /** + * The subscriber id + */ + private String globalSubscriberId; + + /** + * The serviceType + */ + private String serviceType; + + /** + * The service ID + */ + private String serviceId; + + /** + * The Operation ID + */ + private String operationId; + + /** + * the NS template uuid + */ + private String nodeTemplateUUID; + + /** + * @return Returns the globalSubscriberId. + */ + public String getGlobalSubscriberId() { + return globalSubscriberId; + } + + /** + * @param globalSubscriberId The globalSubscriberId to set. + */ + public void setGlobalSubscriberId(String globalSubscriberId) { + this.globalSubscriberId = globalSubscriberId; + } + + /** + * @return Returns the serviceType. + */ + public String getServiceType() { + return serviceType; + } + + /** + * @param serviceType The serviceType to set. + */ + public void setServiceType(String serviceType) { + this.serviceType = serviceType; + } + + /** + * <br> + * + * @return + * @since ONAP Amsterdam Release + */ + public String getServiceId() { + return serviceId; + } + + /** + * <br> + * + * @param serviceId + * @since ONAP Amsterdam Release + */ + public void setServiceId(String serviceId) { + this.serviceId = serviceId; + } + + /** + * <br> + * + * @return + * @since ONAP Amsterdam Release + */ + public String getOperationId() { + return operationId; + } + + /** + * <br> + * + * @param operationId + * @since ONAP Amsterdam Release + */ + public void setOperationId(String operationId) { + this.operationId = operationId; + } + + /** + * @return Returns the nodeTemplateUUID. + */ + public String getNodeTemplateUUID() { + return nodeTemplateUUID; + } + + /** + * @param nodeTemplateUUID The nodeTemplateUUID to set. + */ + public void setNodeTemplateUUID(String nodeTemplateUUID) { + this.nodeTemplateUUID = nodeTemplateUUID; + } + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/NsParameters.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/NsParameters.java new file mode 100644 index 0000000000..9d38feeef9 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/NsParameters.java @@ -0,0 +1,70 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 CMCC All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.infrastructure.vfcmodel; + + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * <br> + * <p> + * </p> + * + * @author + * @version ONAP Amsterdam Release 2017-9-6 + */ +public class NsParameters { + + private List<LocationConstraint> locationConstraints; + + private Map<String, Object> additionalParamForNs = new HashMap<String,Object>(); + /** + * @return Returns the locationConstraints. + */ + public List<LocationConstraint> getLocationConstraints() { + return locationConstraints; + } + + /** + * @param locationConstraints The locationConstraints to set. + */ + public void setLocationConstraints(List<LocationConstraint> locationConstraints) { + this.locationConstraints = locationConstraints; + } + + + /** + * @return Returns the additionalParamForNs. + */ + public Map<String, Object> getAdditionalParamForNs() { + return additionalParamForNs; + } + + + /** + * @param additionalParamForNs The additionalParamForNs to set. + */ + public void setAdditionalParamForNs(Map<String, Object> additionalParamForNs) { + this.additionalParamForNs = additionalParamForNs; + } +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/NsScaleParameters.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/NsScaleParameters.java new file mode 100644 index 0000000000..bdc16195b5 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/NsScaleParameters.java @@ -0,0 +1,78 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 CMCC All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.infrastructure.vfcmodel; + +import java.util.List; + +/** + * <br> + * <p> + * </p> + * + * @author + * @version ONAP Amsterdam Release 2017-9-26 + */ +public class NsScaleParameters { + + private List<ScaleNsByStepsData> scaleNsByStepsData; + + private String scaleType; + + + private String nsInstanceId; + + /** + * @return Returns the scaleNsByStepsData. + */ + public List<ScaleNsByStepsData> getScaleNsByStepsData() { + return scaleNsByStepsData; + } + + /** + * @param scaleNsByStepsData The scaleNsByStepsData to set. + */ + public void setScaleNsByStepsData(List<ScaleNsByStepsData> scaleNsByStepsData) { + this.scaleNsByStepsData = scaleNsByStepsData; + } + + /** + * @return Returns the scale Type. + */ + public String getScaleType() { + return scaleType; + } + + /** + * @param scaleType The scaleType to set. + */ + public void setScaleType(String scaleType) { + this.scaleType = scaleType; + } + + public String getNsInstanceId() { + return nsInstanceId; + } + + public void setNsInstanceId(String nsInstanceId) { + this.nsInstanceId = nsInstanceId; + } + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/ScaleNsByStepsData.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/ScaleNsByStepsData.java new file mode 100644 index 0000000000..a0798c8e4f --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/ScaleNsByStepsData.java @@ -0,0 +1,91 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 CMCC All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.infrastructure.vfcmodel; + + + +/** + * <br> + * <p> + * </p> + * + * @author + * @version ONAP Amsterdam Release 2017-9-26 + */ +public class ScaleNsByStepsData { + + /** + * scaling Direction + */ + private String scalingDirection; + + /** + * aspect ID + */ + private String aspectId; + + /** + * number of Steps + */ + private int numberOfSteps; + + /** + * @return Returns the scalingDirection. + */ + public String getScalingDirection() { + return scalingDirection; + } + + /** + * @param scalingDirection The scalingDirection to set. + */ + public void setScalingDirection(String scalingDirection) { + this.scalingDirection = scalingDirection; + } + + /** + * @return Returns the aspectId. + */ + public String getAspectId() { + return aspectId; + } + + /** + * @param aspectId The aspectId to set. + */ + public void setAspectId(String aspectId) { + this.aspectId = aspectId; + } + + /** + * @return Returns the numberofSteps. + */ + public int getNumberOfSteps() { + return numberOfSteps; + } + + /** + * @param numberOfSteps The numberofSteps to set. + */ + public void setNumberOfSteps(int numberOfSteps) { + this.numberOfSteps = numberOfSteps; + } +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/ScaleNsData.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/ScaleNsData.java new file mode 100644 index 0000000000..02e42ea994 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/ScaleNsData.java @@ -0,0 +1,34 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 CMCC. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.openecomp.mso.bpmn.infrastructure.vfcmodel; + + +public class ScaleNsData { + + private ScaleNsByStepsData scaleNsByStepsData; + + public ScaleNsByStepsData getScaleNsByStepsData() { + return scaleNsByStepsData; + } + + public void setScaleNsByStepsData(ScaleNsByStepsData scaleNsByStepsData) { + this.scaleNsByStepsData = scaleNsByStepsData; + } +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/ScaleResource.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/ScaleResource.java new file mode 100644 index 0000000000..1f49b02569 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/ScaleResource.java @@ -0,0 +1,55 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 CMCC. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.infrastructure.vfcmodel; + + +public class ScaleResource { + + private String resourceInstanceId; + + private String scaleType; + + private ScaleNsData scaleNsData; + + public String getResourceInstanceId() { + return resourceInstanceId; + } + + public void setResourceInstanceId(String resourceInstanceId) { + this.resourceInstanceId = resourceInstanceId; + } + + public String getScaleType() { + return scaleType; + } + + public void setScaleType(String scaleType) { + this.scaleType = scaleType; + } + + public ScaleNsData getScaleNsData() { + return scaleNsData; + } + + public void setScaleNsData(ScaleNsData scaleNsData) { + this.scaleNsData = scaleNsData; + } +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/VimLocation.java b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/VimLocation.java new file mode 100644 index 0000000000..67252b4b96 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/java/org/openecomp/mso/bpmn/infrastructure/vfcmodel/VimLocation.java @@ -0,0 +1,52 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 CMCC. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.mso.bpmn.infrastructure.vfcmodel; + + +/** + * + * <br> + * <p> + * </p> + * + * @author + * @version ONAP Amsterdam Release 2017-10-18 + */ +public class VimLocation { + private String vimId; + + + /** + * @return Returns the vimId. + */ + public String getVimId() { + return vimId; + } + + + /** + * @param vimId The vimId to set. + */ + public void setVimId(String vimId) { + this.vimId = vimId; + } + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/ScaleCustomE2EServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/ScaleCustomE2EServiceInstance.bpmn new file mode 100644 index 0000000000..4ce646273c --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/ScaleCustomE2EServiceInstance.bpmn @@ -0,0 +1,379 @@ +<?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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> + <bpmn:process id="ScaleCustomE2EServiceInstance" name="ScaleCustomE2EServiceInstance" isExecutable="true"> + <bpmn:startEvent id="StartEvent_1" name="Scale SI Start Flow"> + <bpmn:outgoing>SequenceFlow_0c2denm</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:scriptTask id="Task_03ivdxi" name="Pre Process Incoming Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0c2denm</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1ntnafv</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def csi= new ScaleCustomE2EServiceInstance() +csi.preProcessRequest(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="Task_0oezp57" name="Send Sync Ack Response" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_14zd9we</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0er6ddi</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def csi = new ScaleCustomE2EServiceInstance() +csi.sendSyncResponse(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:exclusiveGateway id="ExclusiveGateway_13jdprk" name="success ?"> + <bpmn:incoming>SequenceFlow_1fis1j1</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_06f0dx5</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_19b0pmt</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:scriptTask id="Task_1ogtanl" name="Prepare Completion Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_06f0dx5</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1q6spfu</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def csi = new ScaleCustomE2EServiceInstance() +csi.prepareCompletionRequest(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:callActivity id="Task_1p5x1em" name="Call CompleteMsoProcess" calledElement="CompleteMsoProcess"> + <bpmn:extensionElements> + <camunda:in source="msoRequestId" target="msoRequestId" /> + <camunda:in source="serviceInstanceId" target="serviceInstanceId" /> + <camunda:out source="CMSO_ResponseCode" target="CMSO_ResponseCode" /> + <camunda:out source="CompleteMsoProcessResponse" target="CompleteMsoProcessResponse" /> + <camunda:out source="CMSO_ErrorResponse" target="CMSO_ErrorResponse" /> + <camunda:in source="CompleteMsoProcessRequest" target="CompleteMsoProcessRequest" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1q6spfu</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0mm4eqd</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:endEvent id="EndEvent_116d9ds" name="End"> + <bpmn:incoming>SequenceFlow_0mm4eqd</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_0mm4eqd" sourceRef="Task_1p5x1em" targetRef="EndEvent_116d9ds" /> + <bpmn:sequenceFlow id="SequenceFlow_0c2denm" sourceRef="StartEvent_1" targetRef="Task_03ivdxi" /> + <bpmn:sequenceFlow id="SequenceFlow_1ntnafv" sourceRef="Task_03ivdxi" targetRef="Task_1rsd8qa" /> + <bpmn:sequenceFlow id="SequenceFlow_0er6ddi" sourceRef="Task_0oezp57" targetRef="CallActivity_1vpyqzt" /> + <bpmn:sequenceFlow id="SequenceFlow_06f0dx5" name="yes" sourceRef="ExclusiveGateway_13jdprk" targetRef="Task_1ogtanl"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{(execution.getVariable("jobId" ) != null && execution.getVariable("jobId" ) != "" )}]]></bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_19b0pmt" name="no" sourceRef="ExclusiveGateway_13jdprk" targetRef="EndEvent_1sz49w7"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{(execution.getVariable("jobId" ) == null || execution.getVariable("jobId" ) == "" )}]]></bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:endEvent id="EndEvent_1sz49w7"> + <bpmn:incoming>SequenceFlow_19b0pmt</bpmn:incoming> + <bpmn:errorEventDefinition errorRef="Error_196t4z3" /> + </bpmn:endEvent> + <bpmn:subProcess id="SubProcess_0bwngpt" name="Sub-process for FalloutHandler and Rollback" triggeredByEvent="true"> + <bpmn:startEvent id="StartEvent_0yncnrj"> + <bpmn:outgoing>SequenceFlow_04f826i</bpmn:outgoing> + <bpmn:errorEventDefinition /> + </bpmn:startEvent> + <bpmn:endEvent id="EndEvent_1lp2j7l"> + <bpmn:incoming>SequenceFlow_1t2ijcu</bpmn:incoming> + </bpmn:endEvent> + <bpmn:scriptTask id="ScriptTask_01p0bqh" name="Prepare Fallout Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_09z92mf</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1sooz22</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def csi = new ScaleCustomE2EServiceInstance() +csi.prepareFalloutRequest(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="ScriptTask_1quc7x4" name="Send Error Response" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_04f826i</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_09z92mf</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def csi = new ScaleCustomE2EServiceInstance() +csi.sendSyncError(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_04f826i" sourceRef="StartEvent_0yncnrj" targetRef="ScriptTask_1quc7x4" /> + <bpmn:sequenceFlow id="SequenceFlow_09z92mf" sourceRef="ScriptTask_1quc7x4" targetRef="ScriptTask_01p0bqh" /> + <bpmn:sequenceFlow id="SequenceFlow_1t2ijcu" sourceRef="CallActivity_0miglgb" targetRef="EndEvent_1lp2j7l" /> + <bpmn:sequenceFlow id="SequenceFlow_1sooz22" sourceRef="ScriptTask_01p0bqh" targetRef="CallActivity_0miglgb" /> + <bpmn:callActivity id="CallActivity_0miglgb" name="Call FalloutHandler" calledElement="FalloutHandler"> + <bpmn:extensionElements> + <camunda:in source="falloutRequest" target="FalloutHandlerRequest" /> + <camunda:in source="mso-request-id" target="mso-request-id" /> + <camunda:in source="mso-service-instance-id" target="mso-service-instance-id" /> + <camunda:out source="FH_ResponseCode" target="FH_ResponseCode" /> + <camunda:out source="FalloutHandlerResponse" target="FalloutHandlerResponse" /> + <camunda:out source="FH_ErrorResponse" target="FH_ErrorResponse" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1sooz22</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1t2ijcu</bpmn:outgoing> + </bpmn:callActivity> + </bpmn:subProcess> + <bpmn:subProcess id="SubProcess_10vzjzh" name="Sub-process for UnexpectedErrors" triggeredByEvent="true"> + <bpmn:scriptTask id="ScriptTask_1jgr212" name="Handle Unexpected Error" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0gna7ys</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0re5dm7</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* +ExceptionUtil ex = new ExceptionUtil() +ex.processJavaException(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:startEvent id="StartEvent_1awfo4s"> + <bpmn:outgoing>SequenceFlow_0gna7ys</bpmn:outgoing> + <bpmn:errorEventDefinition /> + </bpmn:startEvent> + <bpmn:endEvent id="EndEvent_04azej9"> + <bpmn:incoming>SequenceFlow_0re5dm7</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_0gna7ys" name="" sourceRef="StartEvent_1awfo4s" targetRef="ScriptTask_1jgr212" /> + <bpmn:sequenceFlow id="SequenceFlow_0re5dm7" name="" sourceRef="ScriptTask_1jgr212" targetRef="EndEvent_04azej9" /> + </bpmn:subProcess> + <bpmn:callActivity id="CallActivity_1vpyqzt" name="Call DoScaleE2EServiceInstance " calledElement="DoScaleE2EServiceInstance"> + <bpmn:extensionElements> + <camunda:out source="jobId" target="jobId" /> + <camunda:in source="bpmnRequest" target="bpmnRequest" /> + <camunda:out source="operationId" target="operationId" /> + <camunda:in source="serviceInstanceId" target="serviceInstanceId" /> + <camunda:in source="serviceInstanceName" target="serviceInstanceName" /> + <camunda:in source="serviceId" target="serviceId" /> + <camunda:in source="serviceType" target="serviceType" /> + <camunda:in source="globalSubscriberId" target="globalSubscriberId" /> + <camunda:in source="nodeTemplateUUID" target="nodeTemplateUUID" /> + <camunda:in source="msoRequestId" target="msoRequestId" /> + <camunda:in source="requestDescription" target="requestDescription" /> + <camunda:in source="operationId" target="operationId" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0er6ddi</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1fis1j1</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_1fis1j1" sourceRef="CallActivity_1vpyqzt" targetRef="ExclusiveGateway_13jdprk" /> + <bpmn:sequenceFlow id="SequenceFlow_1q6spfu" sourceRef="Task_1ogtanl" targetRef="Task_1p5x1em" /> + <bpmn:sequenceFlow id="SequenceFlow_030pfun" sourceRef="Task_1rsd8qa" targetRef="Task_01n9mqa" /> + <bpmn:scriptTask id="Task_1rsd8qa" name="Init Service Operation Status" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1ntnafv</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_030pfun</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def csi= new ScaleCustomE2EServiceInstance() +csi.prepareInitServiceOperationStatus(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_14zd9we" sourceRef="Task_01n9mqa" targetRef="Task_0oezp57" /> + <bpmn:serviceTask id="Task_01n9mqa" name="Update Service Operation Status"> + <bpmn:extensionElements> + <camunda:connector> + <camunda:inputOutput> + <camunda:inputParameter name="url">${CVFMI_dbAdapterEndpoint}</camunda:inputParameter> + <camunda:inputParameter name="headers"> + <camunda:map> + <camunda:entry key="content-type">application/soap+xml</camunda:entry> + <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + </camunda:map> + </camunda:inputParameter> + <camunda:inputParameter name="payload">${CVFMI_updateServiceOperStatusRequest}</camunda:inputParameter> + <camunda:inputParameter name="method">POST</camunda:inputParameter> + <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter> + <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter> + </camunda:inputOutput> + <camunda:connectorId>http-connector</camunda:connectorId> + </camunda:connector> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_030pfun</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_14zd9we</bpmn:outgoing> + </bpmn:serviceTask> + </bpmn:process> + <bpmn:error id="Error_196t4z3" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="ScaleCustomE2EServiceInstance"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"> + <dc:Bounds x="-13" y="102" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="-28" y="138" width="67" height="24" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0nye5g4_di" bpmnElement="Task_03ivdxi"> + <dc:Bounds x="87" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_08uouf4_di" bpmnElement="Task_0oezp57"> + <dc:Bounds x="560" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_13jdprk_di" bpmnElement="ExclusiveGateway_13jdprk" isMarkerVisible="true"> + <dc:Bounds x="928" y="95" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="927" y="73" width="51" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_11xceoj_di" bpmnElement="Task_1ogtanl"> + <dc:Bounds x="1068" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_1qhplvz_di" bpmnElement="Task_1p5x1em"> + <dc:Bounds x="1068" y="281" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_116d9ds_di" bpmnElement="EndEvent_116d9ds"> + <dc:Bounds x="1100" y="554" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1109" y="594" width="19" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0mm4eqd_di" bpmnElement="SequenceFlow_0mm4eqd"> + <di:waypoint xsi:type="dc:Point" x="1118" y="361" /> + <di:waypoint xsi:type="dc:Point" x="1118" y="554" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1088" y="451.5" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0c2denm_di" bpmnElement="SequenceFlow_0c2denm"> + <di:waypoint xsi:type="dc:Point" x="23" y="120" /> + <di:waypoint xsi:type="dc:Point" x="87" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="10" y="99" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1ntnafv_di" bpmnElement="SequenceFlow_1ntnafv"> + <di:waypoint xsi:type="dc:Point" x="187" y="120" /> + <di:waypoint xsi:type="dc:Point" x="249" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="173" y="99" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0er6ddi_di" bpmnElement="SequenceFlow_0er6ddi"> + <di:waypoint xsi:type="dc:Point" x="660" y="120" /> + <di:waypoint xsi:type="dc:Point" x="729" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="649.5" y="99" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_06f0dx5_di" bpmnElement="SequenceFlow_06f0dx5"> + <di:waypoint xsi:type="dc:Point" x="978" y="120" /> + <di:waypoint xsi:type="dc:Point" x="1068" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1014" y="99" width="19" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_19b0pmt_di" bpmnElement="SequenceFlow_19b0pmt"> + <di:waypoint xsi:type="dc:Point" x="953" y="145" /> + <di:waypoint xsi:type="dc:Point" x="953" y="232" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="962" y="183" width="12" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="EndEvent_00ekif2_di" bpmnElement="EndEvent_1sz49w7"> + <dc:Bounds x="935" y="232" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="953" y="272" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="SubProcess_0bwngpt_di" bpmnElement="SubProcess_0bwngpt" isExpanded="true"> + <dc:Bounds x="168" y="326" width="679" height="194" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_0yncnrj_di" bpmnElement="StartEvent_0yncnrj"> + <dc:Bounds x="183" y="412" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="66" y="453" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_1lp2j7l_di" bpmnElement="EndEvent_1lp2j7l"> + <dc:Bounds x="762" y="412" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="645" y="453" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_01p0bqh_di" bpmnElement="ScriptTask_01p0bqh"> + <dc:Bounds x="441" y="390" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_0miglgb_di" bpmnElement="CallActivity_0miglgb"> + <dc:Bounds x="618" y="390" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1quc7x4_di" bpmnElement="ScriptTask_1quc7x4"> + <dc:Bounds x="263" y="390" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_04f826i_di" bpmnElement="SequenceFlow_04f826i"> + <di:waypoint xsi:type="dc:Point" x="219" y="430" /> + <di:waypoint xsi:type="dc:Point" x="241" y="430" /> + <di:waypoint xsi:type="dc:Point" x="241" y="430" /> + <di:waypoint xsi:type="dc:Point" x="262" y="430" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="121" y="430" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_09z92mf_di" bpmnElement="SequenceFlow_09z92mf"> + <di:waypoint xsi:type="dc:Point" x="363" y="430" /> + <di:waypoint xsi:type="dc:Point" x="390" y="430" /> + <di:waypoint xsi:type="dc:Point" x="390" y="430" /> + <di:waypoint xsi:type="dc:Point" x="441" y="430" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="270" y="430" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1t2ijcu_di" bpmnElement="SequenceFlow_1t2ijcu"> + <di:waypoint xsi:type="dc:Point" x="718" y="430" /> + <di:waypoint xsi:type="dc:Point" x="762" y="430" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="605" y="415" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1sooz22_di" bpmnElement="SequenceFlow_1sooz22"> + <di:waypoint xsi:type="dc:Point" x="541" y="430" /> + <di:waypoint xsi:type="dc:Point" x="618" y="430" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="447" y="415" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="SubProcess_10vzjzh_di" bpmnElement="SubProcess_10vzjzh" isExpanded="true"> + <dc:Bounds x="294" y="593" width="394" height="188" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1jgr212_di" bpmnElement="ScriptTask_1jgr212"> + <dc:Bounds x="442" y="648" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_1awfo4s_di" bpmnElement="StartEvent_1awfo4s"> + <dc:Bounds x="327" y="670" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="210" y="711" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_04azej9_di" bpmnElement="EndEvent_04azej9"> + <dc:Bounds x="603" y="670" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="486" y="711" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0gna7ys_di" bpmnElement="SequenceFlow_0gna7ys"> + <di:waypoint xsi:type="dc:Point" x="363" y="688" /> + <di:waypoint xsi:type="dc:Point" x="442" y="688" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="272" y="688" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0re5dm7_di" bpmnElement="SequenceFlow_0re5dm7"> + <di:waypoint xsi:type="dc:Point" x="542" y="688" /> + <di:waypoint xsi:type="dc:Point" x="603" y="688" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="444" y="688" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_1vpyqzt_di" bpmnElement="CallActivity_1vpyqzt"> + <dc:Bounds x="729" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1fis1j1_di" bpmnElement="SequenceFlow_1fis1j1"> + <di:waypoint xsi:type="dc:Point" x="829" y="120" /> + <di:waypoint xsi:type="dc:Point" x="928" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="878.5" y="99" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1q6spfu_di" bpmnElement="SequenceFlow_1q6spfu"> + <di:waypoint xsi:type="dc:Point" x="1118" y="160" /> + <di:waypoint xsi:type="dc:Point" x="1118" y="281" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1088" y="214.5" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_030pfun_di" bpmnElement="SequenceFlow_030pfun"> + <di:waypoint xsi:type="dc:Point" x="349" y="120" /> + <di:waypoint xsi:type="dc:Point" x="393" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="371" y="99" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_16ll9yo_di" bpmnElement="Task_1rsd8qa"> + <dc:Bounds x="249" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_14zd9we_di" bpmnElement="SequenceFlow_14zd9we"> + <di:waypoint xsi:type="dc:Point" x="493" y="120" /> + <di:waypoint xsi:type="dc:Point" x="560" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="526.5" y="99" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ServiceTask_1kpeoxt_di" bpmnElement="Task_01n9mqa"> + <dc:Bounds x="393" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateCustomE2EServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateCustomE2EServiceInstance.bpmn index e7a88be5b8..3071d1c20d 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateCustomE2EServiceInstance.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/UpdateCustomE2EServiceInstance.bpmn @@ -114,7 +114,7 @@ csi.sendSyncError(execution)]]></bpmn:script> <bpmn:sequenceFlow id="SequenceFlow_01umodj" sourceRef="ScriptTask_0u8o9p2" targetRef="CallActivity_1ang7q8" /> </bpmn:subProcess> <bpmn:scriptTask id="ScriptTask_0xupxj9" name="Send Sync Ack Response" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0z4faf9</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1853xxi</bpmn:incoming> <bpmn:outgoing>SequenceFlow_19eilro</bpmn:outgoing> <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
def csi = new UpdateCustomE2EServiceInstance()
@@ -133,7 +133,7 @@ csi.sendSyncResponse(execution)]]></bpmn:script> <bpmn:sequenceFlow id="SequenceFlow_19eilro" sourceRef="ScriptTask_0xupxj9" targetRef="DoUpdateE2EServiceInstance" /> <bpmn:sequenceFlow id="SequenceFlow_0klbpxx" sourceRef="DoUpdateE2EServiceInstance" targetRef="ExclusiveGateway_0aqn64l" /> <bpmn:sequenceFlow id="SequenceFlow_0yayvrf" sourceRef="CallActivity_02fyxz0" targetRef="EndEvent_0bpd6c0" /> - <bpmn:sequenceFlow id="SequenceFlow_0z4faf9" sourceRef="ScriptTask_1s09c7d" targetRef="ScriptTask_0xupxj9" /> + <bpmn:sequenceFlow id="SequenceFlow_0z4faf9" sourceRef="ScriptTask_1s09c7d" targetRef="ScriptTask_09rx901" /> <bpmn:sequenceFlow id="SequenceFlow_14zu6wr" name="yes" sourceRef="ExclusiveGateway_0aqn64l" targetRef="ScriptTask_0ttvn8r"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{execution.getVariable("WorkflowException") == null}]]></bpmn:conditionExpression> </bpmn:sequenceFlow> @@ -141,6 +141,37 @@ csi.sendSyncResponse(execution)]]></bpmn:script> <bpmn:sequenceFlow id="SequenceFlow_1fueo69" name="no" sourceRef="ExclusiveGateway_0aqn64l" targetRef="EndEvent_07uk5iy"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{execution.getVariable("WorkflowException") != null}]]></bpmn:conditionExpression> </bpmn:sequenceFlow> + <bpmn:scriptTask id="ScriptTask_09rx901" name="Init Service Operation Status" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0z4faf9</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0utlsnd</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def csi= new UpdateCustomE2EServiceInstance() +csi.prepareInitServiceOperationStatus(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:serviceTask id="ServiceTask_0mr5k9q" name="Update Service Operation Status"> + <bpmn:extensionElements> + <camunda:connector> + <camunda:inputOutput> + <camunda:inputParameter name="url">${CVFMI_dbAdapterEndpoint}</camunda:inputParameter> + <camunda:inputParameter name="headers"> + <camunda:map> + <camunda:entry key="content-type">application/soap+xml</camunda:entry> + <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + </camunda:map> + </camunda:inputParameter> + <camunda:inputParameter name="payload">${CVFMI_updateServiceOperStatusRequest}</camunda:inputParameter> + <camunda:inputParameter name="method">POST</camunda:inputParameter> + <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter> + <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter> + </camunda:inputOutput> + <camunda:connectorId>http-connector</camunda:connectorId> + </camunda:connector> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0utlsnd</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1853xxi</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:sequenceFlow id="SequenceFlow_0utlsnd" sourceRef="ScriptTask_09rx901" targetRef="ServiceTask_0mr5k9q" /> + <bpmn:sequenceFlow id="SequenceFlow_1853xxi" sourceRef="ServiceTask_0mr5k9q" targetRef="ScriptTask_0xupxj9" /> </bpmn:process> <bpmn:error id="Error_0nbdy47" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> @@ -155,7 +186,7 @@ csi.sendSyncResponse(execution)]]></bpmn:script> <dc:Bounds x="463" y="632" width="394" height="188" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="CallActivity_0rhljy8_di" bpmnElement="DoUpdateE2EServiceInstance"> - <dc:Bounds x="717" y="158" width="100" height="80" /> + <dc:Bounds x="767" y="158" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_0bpd6c0_di" bpmnElement="EndEvent_0bpd6c0"> <dc:Bounds x="1258" y="286" width="36" height="36" /> @@ -164,10 +195,10 @@ csi.sendSyncResponse(execution)]]></bpmn:script> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_1s09c7d_di" bpmnElement="ScriptTask_1s09c7d"> - <dc:Bounds x="214" y="158" width="100" height="80" /> + <dc:Bounds x="105" y="158" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_0ttvn8r_di" bpmnElement="ScriptTask_0ttvn8r"> - <dc:Bounds x="1038" y="158" width="100" height="80" /> + <dc:Bounds x="1073" y="158" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="CallActivity_02fyxz0_di" bpmnElement="CallActivity_02fyxz0"> <dc:Bounds x="1226" y="158" width="100" height="80" /> @@ -176,39 +207,39 @@ csi.sendSyncResponse(execution)]]></bpmn:script> <dc:Bounds x="348" y="370" width="679" height="194" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_0xupxj9_di" bpmnElement="ScriptTask_0xupxj9"> - <dc:Bounds x="459" y="158" width="100" height="80" /> + <dc:Bounds x="600" y="158" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_0aqn64l_di" bpmnElement="ExclusiveGateway_0aqn64l" isMarkerVisible="true"> - <dc:Bounds x="903" y="173" width="50" height="50" /> + <dc:Bounds x="942" y="173" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="903" y="145" width="50" height="12" /> + <dc:Bounds x="943" y="145" width="49" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_07uk5iy_di" bpmnElement="EndEvent_07uk5iy"> - <dc:Bounds x="910" y="286" width="36" height="36" /> + <dc:Bounds x="949" y="286" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="883" y="322" width="0" height="12" /> + <dc:Bounds x="877" y="322" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0s2spoq_di" bpmnElement="SequenceFlow_0s2spoq"> <di:waypoint xsi:type="dc:Point" x="30" y="198" /> - <di:waypoint xsi:type="dc:Point" x="214" y="198" /> + <di:waypoint xsi:type="dc:Point" x="105" y="198" /> <bpmndi:BPMNLabel> - <dc:Bounds x="77" y="177" width="90" height="12" /> + <dc:Bounds x="22.5" y="177" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_19eilro_di" bpmnElement="SequenceFlow_19eilro"> - <di:waypoint xsi:type="dc:Point" x="559" y="198" /> - <di:waypoint xsi:type="dc:Point" x="717" y="198" /> + <di:waypoint xsi:type="dc:Point" x="700" y="198" /> + <di:waypoint xsi:type="dc:Point" x="767" y="198" /> <bpmndi:BPMNLabel> - <dc:Bounds x="593" y="177" width="90" height="12" /> + <dc:Bounds x="688.5" y="177" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0klbpxx_di" bpmnElement="SequenceFlow_0klbpxx"> - <di:waypoint xsi:type="dc:Point" x="817" y="198" /> - <di:waypoint xsi:type="dc:Point" x="903" y="198" /> + <di:waypoint xsi:type="dc:Point" x="867" y="198" /> + <di:waypoint xsi:type="dc:Point" x="942" y="198" /> <bpmndi:BPMNLabel> - <dc:Bounds x="815" y="177" width="90" height="12" /> + <dc:Bounds x="859.5" y="177" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0yayvrf_di" bpmnElement="SequenceFlow_0yayvrf"> @@ -219,35 +250,33 @@ csi.sendSyncResponse(execution)]]></bpmn:script> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0z4faf9_di" bpmnElement="SequenceFlow_0z4faf9"> - <di:waypoint xsi:type="dc:Point" x="314" y="198" /> - <di:waypoint xsi:type="dc:Point" x="459" y="198" /> + <di:waypoint xsi:type="dc:Point" x="205" y="198" /> + <di:waypoint xsi:type="dc:Point" x="274" y="198" /> <bpmndi:BPMNLabel> - <dc:Bounds x="341.5" y="177" width="90" height="12" /> + <dc:Bounds x="194.5" y="177" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_14zu6wr_di" bpmnElement="SequenceFlow_14zu6wr"> - <di:waypoint xsi:type="dc:Point" x="953" y="198" /> - <di:waypoint xsi:type="dc:Point" x="990" y="198" /> - <di:waypoint xsi:type="dc:Point" x="990" y="198" /> - <di:waypoint xsi:type="dc:Point" x="1038" y="198" /> + <di:waypoint xsi:type="dc:Point" x="992" y="198" /> + <di:waypoint xsi:type="dc:Point" x="1073" y="198" /> <bpmndi:BPMNLabel> - <dc:Bounds x="987" y="195" width="20" height="12" /> + <dc:Bounds x="1023.5062499999999" y="195" width="19" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0je30si_di" bpmnElement="SequenceFlow_0je30si"> - <di:waypoint xsi:type="dc:Point" x="1138" y="198" /> + <di:waypoint xsi:type="dc:Point" x="1173" y="198" /> <di:waypoint xsi:type="dc:Point" x="1226" y="198" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1137" y="183" width="0" height="12" /> + <dc:Bounds x="1154.5" y="177" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1fueo69_di" bpmnElement="SequenceFlow_1fueo69"> - <di:waypoint xsi:type="dc:Point" x="928" y="223" /> - <di:waypoint xsi:type="dc:Point" x="928" y="250" /> - <di:waypoint xsi:type="dc:Point" x="928" y="250" /> - <di:waypoint xsi:type="dc:Point" x="928" y="286" /> + <di:waypoint xsi:type="dc:Point" x="967" y="223" /> + <di:waypoint xsi:type="dc:Point" x="967" y="250" /> + <di:waypoint xsi:type="dc:Point" x="967" y="250" /> + <di:waypoint xsi:type="dc:Point" x="967" y="286" /> <bpmndi:BPMNLabel> - <dc:Bounds x="901" y="228" width="15" height="12" /> + <dc:Bounds x="942" y="228" width="12" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_0u3lw39_di" bpmnElement="ScriptTask_0u3lw39"> @@ -332,6 +361,26 @@ csi.sendSyncResponse(execution)]]></bpmn:script> <dc:Bounds x="715.5" y="459" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_09rx901_di" bpmnElement="ScriptTask_09rx901"> + <dc:Bounds x="274" y="158" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_0mr5k9q_di" bpmnElement="ServiceTask_0mr5k9q"> + <dc:Bounds x="444" y="158" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0utlsnd_di" bpmnElement="SequenceFlow_0utlsnd"> + <di:waypoint xsi:type="dc:Point" x="374" y="198" /> + <di:waypoint xsi:type="dc:Point" x="444" y="198" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="409" y="177" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1853xxi_di" bpmnElement="SequenceFlow_1853xxi"> + <di:waypoint xsi:type="dc:Point" x="544" y="198" /> + <di:waypoint xsi:type="dc:Point" x="600" y="198" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="572" y="177" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn index ddc87c7d55..d6dbf58594 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoCreateE2EServiceInstance.bpmn @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> +<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.11.3" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"> <bpmn2:process id="DoCreateE2EServiceInstanceV3" name="DoCreateE2EServiceInstanceV3" isExecutable="true"> <bpmn2:startEvent id="createSI_startEvent" name="Start Flow"> <bpmn2:outgoing>SequenceFlow_1qiiycn</bpmn2:outgoing> @@ -96,16 +96,6 @@ dcsi.postProcessAAIGET(execution)]]></bpmn2:script> def ddsi = new DoCreateE2EServiceInstance() ddsi.postProcessAAIPUT(execution)]]></bpmn2:script> </bpmn2:scriptTask> - <bpmn2:scriptTask id="ScriptTask_1xdjlzm" name="Post Config Service Instance Creation" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_16nxl6h</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_0vbznai</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* -def csi = new DoCreateE2EServiceInstance() -csi.postConfigRequest(execution)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:endEvent id="EndEvent_0kbbt94"> - <bpmn2:incoming>SequenceFlow_0vbznai</bpmn2:incoming> - </bpmn2:endEvent> <bpmn2:sequenceFlow id="SequenceFlow_1qctzm0" sourceRef="Task_0uiekmn" targetRef="Task_0raqlqc" /> <bpmn2:scriptTask id="Task_0uiekmn" name="Prepare Resource Oper Status" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_1hbesp9</bpmn2:incoming> @@ -134,68 +124,8 @@ ddsi.preInitResourcesOperStatus(execution)]]></bpmn2:script> </camunda:connector> </bpmn2:extensionElements> <bpmn2:incoming>SequenceFlow_1qctzm0</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_10reo7r</bpmn2:outgoing> + <bpmn2:outgoing>SequenceFlow_13xfsff</bpmn2:outgoing> </bpmn2:serviceTask> - <bpmn2:serviceTask id="Task_0io5qby" name="Call Sync SDNC service Create " camunda:class="org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.SdncServiceTopologyOperationTask"> - <bpmn2:incoming>SequenceFlow_1vprtt9</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_11f2zuu</bpmn2:outgoing> - </bpmn2:serviceTask> - <bpmn2:sequenceFlow id="SequenceFlow_10reo7r" sourceRef="Task_0raqlqc" targetRef="ScriptTask_1y0los4" /> - <bpmn2:sequenceFlow id="SequenceFlow_11f2zuu" sourceRef="Task_0io5qby" targetRef="IntermediateThrowEvent_0f2w7aj" /> - <bpmn2:scriptTask id="ScriptTask_1y0los4" name="Sequence Resource" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_10reo7r</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_13d9g1n</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* -def ddsi = new DoCreateE2EServiceInstance() -ddsi.sequenceResoure(execution)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_13d9g1n" sourceRef="ScriptTask_1y0los4" targetRef="ExclusiveGateway_07rr3wp" /> - <bpmn2:exclusiveGateway id="ExclusiveGateway_0n9y4du" name="All ResourceFinished?"> - <bpmn2:incoming>SequenceFlow_1jenxlp</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_0q6uy30</bpmn2:outgoing> - <bpmn2:outgoing>SequenceFlow_16nxl6h</bpmn2:outgoing> - </bpmn2:exclusiveGateway> - <bpmn2:sequenceFlow id="SequenceFlow_0q6uy30" name="no" sourceRef="ExclusiveGateway_0n9y4du" targetRef="ScriptTask_0l4nkqr"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{(execution.getVariable("allResourceFinished" ) == "false" )}]]></bpmn2:conditionExpression> - </bpmn2:sequenceFlow> - <bpmn2:scriptTask id="ScriptTask_0y4u2ty" name="Parse Next Resource" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_13c7bhn</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_1jenxlp</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* -def ddsi = new DoCreateE2EServiceInstance() -ddsi.parseNextResource(execution)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_1jenxlp" sourceRef="ScriptTask_0y4u2ty" targetRef="ExclusiveGateway_0n9y4du" /> - <bpmn2:scriptTask id="ScriptTask_0l4nkqr" name="Get Current Resource" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_0q6uy30</bpmn2:incoming> - <bpmn2:incoming>SequenceFlow_1qozd66</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_0uiygod</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* -def ddsi = new DoCreateE2EServiceInstance() -ddsi.getCurrentResoure(execution)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:exclusiveGateway id="ExclusiveGateway_07rr3wp" name="Is SDN-C Service Needed"> - <bpmn2:incoming>SequenceFlow_13d9g1n</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_18wj44x</bpmn2:outgoing> - <bpmn2:outgoing>SequenceFlow_1vprtt9</bpmn2:outgoing> - </bpmn2:exclusiveGateway> - <bpmn2:sequenceFlow id="SequenceFlow_18wj44x" name="no" sourceRef="ExclusiveGateway_07rr3wp" targetRef="IntermediateThrowEvent_0f2w7aj"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{(execution.getVariable("isContainsWanResource" ) == "false" )}]]></bpmn2:conditionExpression> - </bpmn2:sequenceFlow> - <bpmn2:scriptTask id="Task_0qlkmvt" name="Prepare resource recipe Request" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_0uiygod</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_1u9k0dm</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* -def ddsi = new DoCreateE2EServiceInstance() -ddsi.prepareResourceRecipeRequest(execution)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:scriptTask id="Task_12ghoph" name="Execute Resource Recipe"> - <bpmn2:incoming>SequenceFlow_1u9k0dm</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_13c7bhn</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* -def ddsi = new DoCreateE2EServiceInstance() -ddsi.executeResourceRecipe(execution)]]></bpmn2:script> - </bpmn2:scriptTask> <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_0bq4fxs" name="Go to Decompose_Service"> <bpmn2:incoming>SequenceFlow_0w9t6tc</bpmn2:incoming> <bpmn2:linkEventDefinition name="Decompose_Service" /> @@ -250,31 +180,11 @@ dcsi.prepareDecomposeService(execution)]]></bpmn2:script> <bpmn2:linkEventDefinition name="StartService" /> </bpmn2:intermediateCatchEvent> <bpmn2:sequenceFlow id="SequenceFlow_1i7t9hq" sourceRef="IntermediateCatchEvent_0jrb3xu" targetRef="CustomE2EGetService" /> - <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_0f2w7aj" name="GoTo ResourceLoop"> - <bpmn2:incoming>SequenceFlow_18wj44x</bpmn2:incoming> - <bpmn2:incoming>SequenceFlow_11f2zuu</bpmn2:incoming> - <bpmn2:linkEventDefinition name="ResourceLoop" /> - </bpmn2:intermediateThrowEvent> - <bpmn2:sequenceFlow id="SequenceFlow_1vprtt9" name="yes" sourceRef="ExclusiveGateway_07rr3wp" targetRef="Task_0io5qby"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{(execution.getVariable("isContainsWanResource" ) == "true" )}]]></bpmn2:conditionExpression> - </bpmn2:sequenceFlow> <bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_05dus9b" name="StartPrepareResource"> <bpmn2:outgoing>SequenceFlow_1hbesp9</bpmn2:outgoing> <bpmn2:linkEventDefinition name="StartPrepareResource" /> </bpmn2:intermediateCatchEvent> <bpmn2:sequenceFlow id="SequenceFlow_1hbesp9" sourceRef="IntermediateCatchEvent_05dus9b" targetRef="Task_0uiekmn" /> - <bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_02bah5m" name="ResourceLoop"> - <bpmn2:outgoing>SequenceFlow_1qozd66</bpmn2:outgoing> - <bpmn2:linkEventDefinition name="ResourceLoop" /> - </bpmn2:intermediateCatchEvent> - <bpmn2:sequenceFlow id="SequenceFlow_16nxl6h" name="yes" sourceRef="ExclusiveGateway_0n9y4du" targetRef="ScriptTask_1xdjlzm"> - <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{(execution.getVariable("allResourceFinished" ) == "true" )}]]></bpmn2:conditionExpression> - </bpmn2:sequenceFlow> - <bpmn2:sequenceFlow id="SequenceFlow_0uiygod" sourceRef="ScriptTask_0l4nkqr" targetRef="Task_0qlkmvt" /> - <bpmn2:sequenceFlow id="SequenceFlow_1u9k0dm" sourceRef="Task_0qlkmvt" targetRef="Task_12ghoph" /> - <bpmn2:sequenceFlow id="SequenceFlow_13c7bhn" sourceRef="Task_12ghoph" targetRef="ScriptTask_0y4u2ty" /> - <bpmn2:sequenceFlow id="SequenceFlow_0vbznai" sourceRef="ScriptTask_1xdjlzm" targetRef="EndEvent_0kbbt94" /> - <bpmn2:sequenceFlow id="SequenceFlow_1qozd66" sourceRef="IntermediateCatchEvent_02bah5m" targetRef="ScriptTask_0l4nkqr" /> <bpmn2:sequenceFlow id="SequenceFlow_1gusrvp" sourceRef="Task_0ush1g4" targetRef="IntermediateThrowEvent_1mlbhmt" /> <bpmn2:scriptTask id="Task_0ush1g4" name="Call Homing(To be Done)" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_027owbf</bpmn2:incoming> @@ -283,6 +193,43 @@ dcsi.prepareDecomposeService(execution)]]></bpmn2:script> def dcsi= new DoCreateE2EServiceInstance() dcsi.doServiceHoming(execution)]]></bpmn2:script> </bpmn2:scriptTask> + <bpmn2:callActivity id="CallActivity_1ojtwas" name="Call DoCreateResources" calledElement="DoCreateResources"> + <bpmn2:extensionElements> + <camunda:in source="nsServiceName" target="nsServiceName" /> + <camunda:in source="nsServiceDescription" target="nsServiceDescription" /> + <camunda:in source="globalSubscriberId" target="globalSubscriberId" /> + <camunda:in source="serviceType" target="serviceType" /> + <camunda:in source="serviceId" target="serviceId" /> + <camunda:in source="operationId" target="operationId" /> + <camunda:in source="resourceType" target="resourceType" /> + <camunda:in source="resourceUUID" target="resourceUUID" /> + <camunda:in source="resourceParameters" target="resourceParameters" /> + <camunda:in source="operationType" target="operationType" /> + </bpmn2:extensionElements> + <bpmn2:incoming>SequenceFlow_0bf6bzp</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0d0c20n</bpmn2:outgoing> + </bpmn2:callActivity> + <bpmn2:scriptTask id="ScriptTask_04b21gb" name="PreProcess for Add Resources" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_13xfsff</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0bf6bzp</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def csi = new DoCreateE2EServiceInstance() +csi.preProcessForAddResource(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:scriptTask id="ScriptTask_1y7jr4t" name="PostProcess for Add Resource" scriptFormat="groovy"> + <bpmn2:incoming>SequenceFlow_0d0c20n</bpmn2:incoming> + <bpmn2:outgoing>SequenceFlow_0a6vgsu</bpmn2:outgoing> + <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def csi = new DoCreateE2EServiceInstance() +csi.postProcessForAddResource(execution)]]></bpmn2:script> + </bpmn2:scriptTask> + <bpmn2:sequenceFlow id="SequenceFlow_13xfsff" sourceRef="Task_0raqlqc" targetRef="ScriptTask_04b21gb" /> + <bpmn2:sequenceFlow id="SequenceFlow_0bf6bzp" sourceRef="ScriptTask_04b21gb" targetRef="CallActivity_1ojtwas" /> + <bpmn2:sequenceFlow id="SequenceFlow_0d0c20n" sourceRef="CallActivity_1ojtwas" targetRef="ScriptTask_1y7jr4t" /> + <bpmn2:endEvent id="EndEvent_0hzmoug"> + <bpmn2:incoming>SequenceFlow_0a6vgsu</bpmn2:incoming> + </bpmn2:endEvent> + <bpmn2:sequenceFlow id="SequenceFlow_0a6vgsu" sourceRef="ScriptTask_1y7jr4t" targetRef="EndEvent_0hzmoug" /> </bpmn2:process> <bpmn2:error id="Error_2" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> <bpmn2:error id="Error_1" name="java.lang.Exception" errorCode="java.lang.Exception" /> @@ -390,15 +337,6 @@ dcsi.doServiceHoming(execution)]]></bpmn2:script> <dc:Bounds x="679" y="960" width="90" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_1xdjlzm_di" bpmnElement="ScriptTask_1xdjlzm"> - <dc:Bounds x="1119" y="485" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_01p249c_di" bpmnElement="EndEvent_0kbbt94"> - <dc:Bounds x="1315" y="507" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1197" y="547" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1qctzm0_di" bpmnElement="SequenceFlow_1qctzm0"> <di:waypoint xsi:type="dc:Point" x="296" y="300" /> <di:waypoint xsi:type="dc:Point" x="402" y="300" /> @@ -412,82 +350,6 @@ dcsi.doServiceHoming(execution)]]></bpmn2:script> <bpmndi:BPMNShape id="ServiceTask_14tnuxf_di" bpmnElement="Task_0raqlqc"> <dc:Bounds x="402" y="260" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_0qi8cgg_di" bpmnElement="Task_0io5qby"> - <dc:Bounds x="944" y="353" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_10reo7r_di" bpmnElement="SequenceFlow_10reo7r"> - <di:waypoint xsi:type="dc:Point" x="502" y="300" /> - <di:waypoint xsi:type="dc:Point" x="583" y="300" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="497.5" y="279" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_11f2zuu_di" bpmnElement="SequenceFlow_11f2zuu"> - <di:waypoint xsi:type="dc:Point" x="1044" y="393" /> - <di:waypoint xsi:type="dc:Point" x="1090" y="393" /> - <di:waypoint xsi:type="dc:Point" x="1090" y="300" /> - <di:waypoint xsi:type="dc:Point" x="1315" y="300" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1060" y="340.5" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_1y0los4_di" bpmnElement="ScriptTask_1y0los4"> - <dc:Bounds x="583" y="260" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_13d9g1n_di" bpmnElement="SequenceFlow_13d9g1n"> - <di:waypoint xsi:type="dc:Point" x="683" y="300" /> - <di:waypoint xsi:type="dc:Point" x="753" y="300" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="673" y="279" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ExclusiveGateway_0n9y4du_di" bpmnElement="ExclusiveGateway_0n9y4du" isMarkerVisible="true"> - <dc:Bounds x="929" y="500" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="912" y="554" width="83" height="36" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0q6uy30_di" bpmnElement="SequenceFlow_0q6uy30"> - <di:waypoint xsi:type="dc:Point" x="954" y="550" /> - <di:waypoint xsi:type="dc:Point" x="954" y="691" /> - <di:waypoint xsi:type="dc:Point" x="246" y="691" /> - <di:waypoint xsi:type="dc:Point" x="246" y="565" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="594" y="670" width="12" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_0y4u2ty_di" bpmnElement="ScriptTask_0y4u2ty"> - <dc:Bounds x="728" y="485" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1jenxlp_di" bpmnElement="SequenceFlow_1jenxlp"> - <di:waypoint xsi:type="dc:Point" x="828" y="525" /> - <di:waypoint xsi:type="dc:Point" x="929" y="525" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="833.5" y="504" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_0l4nkqr_di" bpmnElement="ScriptTask_0l4nkqr"> - <dc:Bounds x="196" y="485" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ExclusiveGateway_07rr3wp_di" bpmnElement="ExclusiveGateway_07rr3wp" isMarkerVisible="true"> - <dc:Bounds x="753" y="275" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="736" y="329" width="87" height="24" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_18wj44x_di" bpmnElement="SequenceFlow_18wj44x"> - <di:waypoint xsi:type="dc:Point" x="803" y="300" /> - <di:waypoint xsi:type="dc:Point" x="1315" y="300" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="832.3633633633633" y="294" width="12" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_0u88n0f_di" bpmnElement="Task_0qlkmvt"> - <dc:Bounds x="357" y="485" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_1y17r20_di" bpmnElement="Task_12ghoph"> - <dc:Bounds x="551" y="485" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="IntermediateThrowEvent_11saqvj_di" bpmnElement="IntermediateThrowEvent_0bq4fxs"> <dc:Bounds x="1315" y="-207" width="36" height="36" /> <bpmndi:BPMNLabel> @@ -587,20 +449,6 @@ dcsi.doServiceHoming(execution)]]></bpmn2:script> <dc:Bounds x="125" y="76" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="IntermediateThrowEvent_0f2w7aj_di" bpmnElement="IntermediateThrowEvent_0f2w7aj"> - <dc:Bounds x="1315" y="282" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1299" y="323" width="73" height="24" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1vprtt9_di" bpmnElement="SequenceFlow_1vprtt9"> - <di:waypoint xsi:type="dc:Point" x="778" y="325" /> - <di:waypoint xsi:type="dc:Point" x="778" y="393" /> - <di:waypoint xsi:type="dc:Point" x="944" y="393" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="784" y="353" width="19" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="IntermediateCatchEvent_05dus9b_di" bpmnElement="IntermediateCatchEvent_05dus9b"> <dc:Bounds x="18" y="282" width="36" height="36" /> <bpmndi:BPMNLabel> @@ -614,64 +462,65 @@ dcsi.doServiceHoming(execution)]]></bpmn2:script> <dc:Bounds x="125" y="279" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="IntermediateCatchEvent_02bah5m_di" bpmnElement="IntermediateCatchEvent_02bah5m"> - <dc:Bounds x="18" y="507" width="36" height="36" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="2" y="543" width="73" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_16nxl6h_di" bpmnElement="SequenceFlow_16nxl6h"> - <di:waypoint xsi:type="dc:Point" x="979" y="525" /> - <di:waypoint xsi:type="dc:Point" x="1119" y="525" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1040" y="504" width="19" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0uiygod_di" bpmnElement="SequenceFlow_0uiygod"> - <di:waypoint xsi:type="dc:Point" x="296" y="525" /> - <di:waypoint xsi:type="dc:Point" x="357" y="525" /> + <bpmndi:BPMNEdge id="SequenceFlow_1gusrvp_di" bpmnElement="SequenceFlow_1gusrvp"> + <di:waypoint xsi:type="dc:Point" x="1157" y="-39" /> + <di:waypoint xsi:type="dc:Point" x="1315" y="-39" /> <bpmndi:BPMNLabel> - <dc:Bounds x="326.5" y="504" width="0" height="12" /> + <dc:Bounds x="1236" y="-60" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1u9k0dm_di" bpmnElement="SequenceFlow_1u9k0dm"> - <di:waypoint xsi:type="dc:Point" x="457" y="525" /> - <di:waypoint xsi:type="dc:Point" x="551" y="525" /> + <bpmndi:BPMNShape id="ScriptTask_0wr11dt_di" bpmnElement="Task_0ush1g4"> + <dc:Bounds x="1057" y="-79" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_1ojtwas_di" bpmnElement="CallActivity_1ojtwas"> + <dc:Bounds x="852" y="260" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_04b21gb_di" bpmnElement="ScriptTask_04b21gb"> + <dc:Bounds x="629" y="260" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1y7jr4t_di" bpmnElement="ScriptTask_1y7jr4t"> + <dc:Bounds x="1068" y="260" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_13xfsff_di" bpmnElement="SequenceFlow_13xfsff"> + <di:waypoint xsi:type="dc:Point" x="502" y="300" /> + <di:waypoint xsi:type="dc:Point" x="629" y="300" /> <bpmndi:BPMNLabel> - <dc:Bounds x="504" y="504" width="0" height="12" /> + <dc:Bounds x="565.5" y="279" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_13c7bhn_di" bpmnElement="SequenceFlow_13c7bhn"> - <di:waypoint xsi:type="dc:Point" x="651" y="525" /> - <di:waypoint xsi:type="dc:Point" x="728" y="525" /> + <bpmndi:BPMNEdge id="SequenceFlow_0bf6bzp_di" bpmnElement="SequenceFlow_0bf6bzp"> + <di:waypoint xsi:type="dc:Point" x="729" y="300" /> + <di:waypoint xsi:type="dc:Point" x="789" y="300" /> + <di:waypoint xsi:type="dc:Point" x="789" y="300" /> + <di:waypoint xsi:type="dc:Point" x="852" y="300" /> <bpmndi:BPMNLabel> - <dc:Bounds x="689.5" y="504" width="0" height="12" /> + <dc:Bounds x="804" y="294" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0vbznai_di" bpmnElement="SequenceFlow_0vbznai"> - <di:waypoint xsi:type="dc:Point" x="1219" y="525" /> - <di:waypoint xsi:type="dc:Point" x="1315" y="525" /> + <bpmndi:BPMNEdge id="SequenceFlow_0d0c20n_di" bpmnElement="SequenceFlow_0d0c20n"> + <di:waypoint xsi:type="dc:Point" x="952" y="300" /> + <di:waypoint xsi:type="dc:Point" x="1009" y="300" /> + <di:waypoint xsi:type="dc:Point" x="1009" y="300" /> + <di:waypoint xsi:type="dc:Point" x="1068" y="300" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1267" y="504" width="0" height="12" /> + <dc:Bounds x="1024" y="294" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1qozd66_di" bpmnElement="SequenceFlow_1qozd66"> - <di:waypoint xsi:type="dc:Point" x="54" y="525" /> - <di:waypoint xsi:type="dc:Point" x="196" y="525" /> + <bpmndi:BPMNShape id="EndEvent_0hzmoug_di" bpmnElement="EndEvent_0hzmoug"> + <dc:Bounds x="1315" y="282.4076655052265" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="125" y="504" width="0" height="12" /> + <dc:Bounds x="1333" y="322.4076655052265" width="0" height="12" /> </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1gusrvp_di" bpmnElement="SequenceFlow_1gusrvp"> - <di:waypoint xsi:type="dc:Point" x="1157" y="-39" /> - <di:waypoint xsi:type="dc:Point" x="1315" y="-39" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0a6vgsu_di" bpmnElement="SequenceFlow_0a6vgsu"> + <di:waypoint xsi:type="dc:Point" x="1168" y="300" /> + <di:waypoint xsi:type="dc:Point" x="1242" y="300" /> + <di:waypoint xsi:type="dc:Point" x="1242" y="300" /> + <di:waypoint xsi:type="dc:Point" x="1315" y="300" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1236" y="-60" width="0" height="12" /> + <dc:Bounds x="1257" y="294" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_0wr11dt_di" bpmnElement="Task_0ush1g4"> - <dc:Bounds x="1057" y="-79" width="100" height="80" /> - </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn2:definitions> diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoScaleE2EServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoScaleE2EServiceInstance.bpmn new file mode 100644 index 0000000000..fbb52a9cdf --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoScaleE2EServiceInstance.bpmn @@ -0,0 +1,187 @@ +<?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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> + <bpmn:process id="DoScaleE2EServiceInstance" name="DoScaleE2EServiceInstance" isExecutable="true"> + <bpmn:startEvent id="StartEvent_08ndnk6" name="Start Flow"> + <bpmn:outgoing>SequenceFlow_1fhno84</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:scriptTask id="ScriptTask_16yrgke" name="PreProcess Incoming Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1fhno84</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_194bhkx</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def ddsi = new DoScaleE2EServiceInstance() +ddsi.preProcessRequest(execution) +]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:endEvent id="EndEvent_1f5ursk"> + <bpmn:incoming>SequenceFlow_1yee730</bpmn:incoming> + </bpmn:endEvent> + <bpmn:scriptTask id="ScriptTask_0vmzliy" name="Prepare Resource Oper Status" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_194bhkx</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0b5p6gy</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def ddsi = new DoScaleE2EServiceInstance() +ddsi.preInitResourcesOperStatus(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:serviceTask id="ServiceTask_17d588b" name="Init Resource Oper Status"> + <bpmn:extensionElements> + <camunda:connector> + <camunda:inputOutput> + <camunda:inputParameter name="url">${URN_mso_openecomp_adapters_db_endpoint}</camunda:inputParameter> + <camunda:inputParameter name="headers"> + <camunda:map> + <camunda:entry key="content-type">application/soap+xml</camunda:entry> + <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> + </camunda:map> + </camunda:inputParameter> + <camunda:inputParameter name="payload">${CVFMI_initResOperStatusRequest}</camunda:inputParameter> + <camunda:inputParameter name="method">POST</camunda:inputParameter> + <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter> + <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter> + </camunda:inputOutput> + <camunda:connectorId>http-connector</camunda:connectorId> + </camunda:connector> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0b5p6gy</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0nqrq1k</bpmn:outgoing> + </bpmn:serviceTask> + <bpmn:callActivity id="CallActivity_1jkl1i3" name="Call Network Service Scale" calledElement="DoScaleVFCServiceInstance"> + <bpmn:extensionElements> + <camunda:in source="globalSubscriberId" target="globalSubscriberId" /> + <camunda:in source="serviceType" target="serviceType" /> + <camunda:in source="serviceId" target="serviceId" /> + <camunda:in source="operationId" target="operationId" /> + <camunda:in source="resouceTemplateUUID" target="resouceTemplateUUID" /> + <camunda:in source="resouceInstanceId" target="resouceInstanceId" /> + <camunda:in source="resourceType" target="resourceType" /> + <camunda:in source="operationType" target="operationType" /> + <camunda:in source="nsScaleParams" target="nsScaleParams" /> + <camunda:in source="bpmnRequest" target="bpmnRequest" /> + <camunda:in source="serviceInstanceId" target="serviceInstanceId" /> + <camunda:in source="serviceInstanceName" target="serviceInstanceName" /> + <camunda:in source="nodeTemplateUUID" target="nodeTemplateUUID" /> + <camunda:in source="msoRequestId" target="msoRequestId" /> + <camunda:in source="requestDescription" target="requestDescription" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0nqrq1k</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1yee730</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_1fhno84" sourceRef="StartEvent_08ndnk6" targetRef="ScriptTask_16yrgke" /> + <bpmn:sequenceFlow id="SequenceFlow_194bhkx" sourceRef="ScriptTask_16yrgke" targetRef="ScriptTask_0vmzliy" /> + <bpmn:sequenceFlow id="SequenceFlow_1yee730" sourceRef="CallActivity_1jkl1i3" targetRef="EndEvent_1f5ursk" /> + <bpmn:sequenceFlow id="SequenceFlow_0nqrq1k" sourceRef="ServiceTask_17d588b" targetRef="CallActivity_1jkl1i3" /> + <bpmn:sequenceFlow id="SequenceFlow_0b5p6gy" sourceRef="ScriptTask_0vmzliy" targetRef="ServiceTask_17d588b" /> + <bpmn:subProcess id="SubProcess_19qmltk" name="Sub-process for UnexpectedErrors" triggeredByEvent="true"> + <bpmn:startEvent id="StartEvent_0581c7y"> + <bpmn:outgoing>SequenceFlow_0yyws1p</bpmn:outgoing> + <bpmn:errorEventDefinition /> + </bpmn:startEvent> + <bpmn:endEvent id="EndEvent_0k146bt"> + <bpmn:incoming>SequenceFlow_0i814ke</bpmn:incoming> + </bpmn:endEvent> + <bpmn:scriptTask id="ScriptTask_0l79kxj" name="Log / Print Unexpected Error" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0yyws1p</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0i814ke</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.common.scripts.* +ExceptionUtil ex = new ExceptionUtil() +ex.processJavaException(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0yyws1p" name="" sourceRef="StartEvent_0581c7y" targetRef="ScriptTask_0l79kxj" /> + <bpmn:sequenceFlow id="SequenceFlow_0i814ke" name="" sourceRef="ScriptTask_0l79kxj" targetRef="EndEvent_0k146bt" /> + </bpmn:subProcess> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoScaleE2EServiceInstance"> + <bpmndi:BPMNShape id="StartEvent_08ndnk6_di" bpmnElement="StartEvent_08ndnk6"> + <dc:Bounds x="96" y="129" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="90" y="170" width="50" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_16yrgke_di" bpmnElement="ScriptTask_16yrgke"> + <dc:Bounds x="189" y="107" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_1f5ursk_di" bpmnElement="EndEvent_1f5ursk"> + <dc:Bounds x="1016" y="279" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="899" y="320" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0vmzliy_di" bpmnElement="ScriptTask_0vmzliy"> + <dc:Bounds x="436" y="107" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ServiceTask_17d588b_di" bpmnElement="ServiceTask_17d588b"> + <dc:Bounds x="695" y="107" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_1jkl1i3_di" bpmnElement="CallActivity_1jkl1i3"> + <dc:Bounds x="984" y="107" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1fhno84_di" bpmnElement="SequenceFlow_1fhno84"> + <di:waypoint xsi:type="dc:Point" x="132" y="147" /> + <di:waypoint xsi:type="dc:Point" x="189" y="147" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="72" y="126" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_194bhkx_di" bpmnElement="SequenceFlow_194bhkx"> + <di:waypoint xsi:type="dc:Point" x="289" y="147" /> + <di:waypoint xsi:type="dc:Point" x="436" y="147" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="317.5" y="126" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1yee730_di" bpmnElement="SequenceFlow_1yee730"> + <di:waypoint xsi:type="dc:Point" x="1033" y="187" /> + <di:waypoint xsi:type="dc:Point" x="1034" y="279" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="988.5" y="212" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0nqrq1k_di" bpmnElement="SequenceFlow_0nqrq1k"> + <di:waypoint xsi:type="dc:Point" x="795" y="147" /> + <di:waypoint xsi:type="dc:Point" x="984" y="147" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="844.5" y="126" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0b5p6gy_di" bpmnElement="SequenceFlow_0b5p6gy"> + <di:waypoint xsi:type="dc:Point" x="536" y="147" /> + <di:waypoint xsi:type="dc:Point" x="695" y="147" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="570.5" y="126" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="SubProcess_19qmltk_di" bpmnElement="SubProcess_19qmltk" isExpanded="true"> + <dc:Bounds x="132" y="351" width="467" height="193" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_0581c7y_di" bpmnElement="StartEvent_0581c7y"> + <dc:Bounds x="201" y="419" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="84" y="460" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_0k146bt_di" bpmnElement="EndEvent_0k146bt"> + <dc:Bounds x="494" y="419" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="377" y="460" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0l79kxj_di" bpmnElement="ScriptTask_0l79kxj"> + <dc:Bounds x="305" y="397" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0yyws1p_di" bpmnElement="SequenceFlow_0yyws1p"> + <di:waypoint xsi:type="dc:Point" x="237" y="437" /> + <di:waypoint xsi:type="dc:Point" x="305" y="437" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="136" y="422" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0i814ke_di" bpmnElement="SequenceFlow_0i814ke"> + <di:waypoint xsi:type="dc:Point" x="405" y="437" /> + <di:waypoint xsi:type="dc:Point" x="494" y="437" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="317" y="422" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoScaleVFCServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoScaleVFCServiceInstance.bpmn new file mode 100644 index 0000000000..7e8b63e719 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoScaleVFCServiceInstance.bpmn @@ -0,0 +1,89 @@ +<?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" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0"> + <bpmn:process id="DoScaleVFCServiceInstance" name="DoScaleVFCServiceInstance" isExecutable="true"> + <bpmn:startEvent id="scaleNS_StartEvent" name="scaleNS_StartEvent"> + <bpmn:outgoing>SequenceFlow_00w1ntj</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:scriptTask id="PreprocessIncomingRequest_task" name="PreprocessIncomingRequest" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_00w1ntj</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0izumqq</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def dcsi = new DoScaleVFCNetworkServiceInstance() +dcsi.preProcessRequest(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="Task_0ia872k" name="Scale Network Service" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0izumqq</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0hzy01n</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def dcsi = new DoScaleVFCNetworkServiceInstance() +dcsi.scaleNetworkService(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_00w1ntj" sourceRef="scaleNS_StartEvent" targetRef="PreprocessIncomingRequest_task" /> + <bpmn:sequenceFlow id="SequenceFlow_0izumqq" sourceRef="PreprocessIncomingRequest_task" targetRef="Task_0ia872k" /> + <bpmn:endEvent id="EndEvent_1r0dxhy"> + <bpmn:incoming>SequenceFlow_18hdal9</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_18hdal9" sourceRef="finishNSScale_Task" targetRef="EndEvent_1r0dxhy" /> + <bpmn:scriptTask id="finishNSScale_Task" name="Finish NS Scale" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0hzy01n</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_18hdal9</bpmn:outgoing> + <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* +def dcsi = new DoScaleVFCNetworkServiceInstance() +dcsi.finishNSScale(execution)]]></bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0hzy01n" sourceRef="Task_0ia872k" targetRef="finishNSScale_Task" /> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoScaleVFCServiceInstance"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="scaleNS_StartEvent"> + <dc:Bounds x="-33" y="182" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="-56" y="218" width="83" height="24" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0fxwmkv_di" bpmnElement="PreprocessIncomingRequest_task"> + <dc:Bounds x="117" y="160" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_14ppugf_di" bpmnElement="Task_0ia872k"> + <dc:Bounds x="739" y="160" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_00w1ntj_di" bpmnElement="SequenceFlow_00w1ntj"> + <di:waypoint xsi:type="dc:Point" x="3" y="200" /> + <di:waypoint xsi:type="dc:Point" x="117" y="200" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="15" y="179" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0izumqq_di" bpmnElement="SequenceFlow_0izumqq"> + <di:waypoint xsi:type="dc:Point" x="217" y="200" /> + <di:waypoint xsi:type="dc:Point" x="739" y="200" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="433" y="179" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="EndEvent_1r0dxhy_di" bpmnElement="EndEvent_1r0dxhy"> + <dc:Bounds x="771" y="676" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="744" y="716" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_18hdal9_di" bpmnElement="SequenceFlow_18hdal9"> + <di:waypoint xsi:type="dc:Point" x="789" y="451" /> + <di:waypoint xsi:type="dc:Point" x="789" y="676" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="759" y="557.5" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1elwlqc_di" bpmnElement="finishNSScale_Task"> + <dc:Bounds x="739" y="371" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0hzy01n_di" bpmnElement="SequenceFlow_0hzy01n"> + <di:waypoint xsi:type="dc:Point" x="789" y="240" /> + <di:waypoint xsi:type="dc:Point" x="789" y="371" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="759" y="299.5" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateE2EServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateE2EServiceInstance.bpmn index 53450fcb8e..86b422632f 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateE2EServiceInstance.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoUpdateE2EServiceInstance.bpmn @@ -51,84 +51,14 @@ csi.preProcessForAddResource(execution)]]></bpmn2:script> def csi = new DoUpdateE2EServiceInstance() csi.postProcessForAddResource(execution)]]></bpmn2:script> </bpmn2:scriptTask> - <bpmn2:scriptTask id="ScriptTask_04rn9mp" name="Post Config Service Instance Update" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_0cnuo36</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_1ryg78h</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* -def csi = new DoUpdateE2EServiceInstance() -csi.postConfigRequest(execution)]]></bpmn2:script> - </bpmn2:scriptTask> <bpmn2:intermediateCatchEvent id="StartEvent_StartResource" name="StartAddResources"> <bpmn2:outgoing>SequenceFlow_115mdln</bpmn2:outgoing> <bpmn2:linkEventDefinition name="StartAddResource" /> </bpmn2:intermediateCatchEvent> <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_1dwg5lz" name="GoToStartCompareModelVersions"> - <bpmn2:incoming>SequenceFlow_1i45vfx</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_167wc99</bpmn2:incoming> <bpmn2:linkEventDefinition name="StartCompareModelVersions" /> </bpmn2:intermediateThrowEvent> - <bpmn2:scriptTask id="ScriptTask_1wk7zcu" name="Prepare Update Service Oper Status(90%)" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_1uu6uiu</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_0gr3l25</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* -execution.setVariable("progress", "90") -def ddsi = new DoUpdateE2EServiceInstance() -ddsi.preUpdateServiceOperationStatus(execution)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:serviceTask id="ServiceTask_1a6cmdu" name="Update Service Oper Status"> - <bpmn2:extensionElements> - <camunda:connector> - <camunda:inputOutput> - <camunda:inputParameter name="url">${URN_mso_openecomp_adapters_db_endpoint}</camunda:inputParameter> - <camunda:inputParameter name="headers"> - <camunda:map> - <camunda:entry key="content-type">application/soap+xml</camunda:entry> - <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> - </camunda:map> - </camunda:inputParameter> - <camunda:inputParameter name="payload">${CVFMI_updateServiceOperStatusRequest}</camunda:inputParameter> - <camunda:inputParameter name="method">POST</camunda:inputParameter> - <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter> - <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter> - </camunda:inputOutput> - <camunda:connectorId>http-connector</camunda:connectorId> - </camunda:connector> - </bpmn2:extensionElements> - <bpmn2:incoming>SequenceFlow_0gr3l25</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_0cnuo36</bpmn2:outgoing> - </bpmn2:serviceTask> - <bpmn2:sequenceFlow id="SequenceFlow_0gr3l25" sourceRef="ScriptTask_1wk7zcu" targetRef="ServiceTask_1a6cmdu" /> - <bpmn2:sequenceFlow id="SequenceFlow_0cnuo36" sourceRef="ServiceTask_1a6cmdu" targetRef="ScriptTask_04rn9mp" /> - <bpmn2:scriptTask id="ScriptTask_1pwo0jp" name="Prepare Resource Oper Status" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_167wc99</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_0aylb6e</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* -def ddsi = new DoUpdateE2EServiceInstance() -ddsi.preInitResourcesOperStatus(execution)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_0aylb6e" sourceRef="ScriptTask_1pwo0jp" targetRef="ServiceTask_1dqzdko" /> - <bpmn2:serviceTask id="ServiceTask_1dqzdko" name="Init Resource Oper Status"> - <bpmn2:extensionElements> - <camunda:connector> - <camunda:inputOutput> - <camunda:inputParameter name="url">${CVFMI_dbAdapterEndpoint}</camunda:inputParameter> - <camunda:inputParameter name="headers"> - <camunda:map> - <camunda:entry key="content-type">application/soap+xml</camunda:entry> - <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> - </camunda:map> - </camunda:inputParameter> - <camunda:inputParameter name="payload">${CVFMI_initResOperStatusRequest}</camunda:inputParameter> - <camunda:inputParameter name="method">POST</camunda:inputParameter> - <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter> - <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter> - </camunda:inputOutput> - <camunda:connectorId>http-connector</camunda:connectorId> - </camunda:connector> - </bpmn2:extensionElements> - <bpmn2:incoming>SequenceFlow_0aylb6e</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_1r1hl23</bpmn2:outgoing> - </bpmn2:serviceTask> - <bpmn2:sequenceFlow id="SequenceFlow_1r1hl23" sourceRef="ServiceTask_1dqzdko" targetRef="ScriptTask_17ssed5" /> <bpmn2:sequenceFlow id="SequenceFlow_115mdln" sourceRef="StartEvent_StartResource" targetRef="Task_09laxun" /> <bpmn2:sequenceFlow id="SequenceFlow_0yztz2p" sourceRef="Task_09laxun" targetRef="Task_1wyyy33" /> <bpmn2:sequenceFlow id="SequenceFlow_0lblyhi" sourceRef="Task_1wyyy33" targetRef="Task_0ag30bf" /> @@ -210,21 +140,12 @@ ddsi.preCompareModelVersions(execution)]]></bpmn2:script> <bpmn2:outgoing>SequenceFlow_0qg0uyn</bpmn2:outgoing> </bpmn2:callActivity> <bpmn2:sequenceFlow id="SequenceFlow_0qg0uyn" sourceRef="CallActivity_18nvmnn" targetRef="ScriptTask_0i8cqdy_PostProcessAAIGET" /> - <bpmn2:scriptTask id="ScriptTask_17ssed5" name="Post Resource Oper Status" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_1r1hl23</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_1i45vfx</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* -def dcsi = new DoUpdateE2EServiceInstance() -dcsi.postResourcesOperStatus(execution)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_1i45vfx" sourceRef="ScriptTask_17ssed5" targetRef="IntermediateThrowEvent_1dwg5lz" /> - <bpmn2:scriptTask id="ScriptTask_0acnvkp" name="Prepare Resource Oper Status(10%)" scriptFormat="groovy"> + <bpmn2:scriptTask id="ScriptTask_0acnvkp" name="Prepare Resource Oper Status" scriptFormat="groovy"> <bpmn2:incoming>SequenceFlow_0l4gosl</bpmn2:incoming> <bpmn2:outgoing>SequenceFlow_0r6c0ci</bpmn2:outgoing> <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* -execution.setVariable("progress", "10") def ddsi = new DoUpdateE2EServiceInstance() -ddsi.preUpdateServiceOperationStatus(execution)]]></bpmn2:script> +ddsi.preInitResourcesOperStatus(execution)]]></bpmn2:script> </bpmn2:scriptTask> <bpmn2:serviceTask id="ServiceTask_17u9q9u" name="Init Resource Oper Status"> <bpmn2:extensionElements> @@ -258,48 +179,9 @@ dcsi.postResourcesOperStatus(execution)]]></bpmn2:script> <bpmn2:sequenceFlow id="SequenceFlow_0r6c0ci" sourceRef="ScriptTask_0acnvkp" targetRef="ServiceTask_17u9q9u" /> <bpmn2:sequenceFlow id="SequenceFlow_1muxopq" sourceRef="ServiceTask_17u9q9u" targetRef="ScriptTask_0r74c3c" /> <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_0vneaao" name="GoTo StartDeleteResources"> - <bpmn2:incoming>SequenceFlow_0s57qft</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_1nqfgvs</bpmn2:incoming> <bpmn2:linkEventDefinition name="StartDeleteResources" /> </bpmn2:intermediateThrowEvent> - <bpmn2:scriptTask id="ScriptTask_1na4qzo" name="Prepare Resource Oper Status(60%)" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_1nqfgvs</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_1fa1yjd</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* -execution.setVariable("progress", "60") -def ddsi = new DoUpdateE2EServiceInstance() -ddsi.preUpdateServiceOperationStatus(execution)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:serviceTask id="ServiceTask_0c13nyt" name="Init Resource Oper Status"> - <bpmn2:extensionElements> - <camunda:connector> - <camunda:inputOutput> - <camunda:inputParameter name="url">${CVFMI_dbAdapterEndpoint}</camunda:inputParameter> - <camunda:inputParameter name="headers"> - <camunda:map> - <camunda:entry key="content-type">application/soap+xml</camunda:entry> - <camunda:entry key="Authorization">Basic QlBFTENsaWVudDpwYXNzd29yZDEk</camunda:entry> - </camunda:map> - </camunda:inputParameter> - <camunda:inputParameter name="payload">${CVFMI_initResOperStatusRequest}</camunda:inputParameter> - <camunda:inputParameter name="method">POST</camunda:inputParameter> - <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter> - <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter> - </camunda:inputOutput> - <camunda:connectorId>http-connector</camunda:connectorId> - </camunda:connector> - </bpmn2:extensionElements> - <bpmn2:incoming>SequenceFlow_1fa1yjd</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_1eg944u</bpmn2:outgoing> - </bpmn2:serviceTask> - <bpmn2:scriptTask id="ScriptTask_0iq531p" name="Post Resource Oper Status" scriptFormat="groovy"> - <bpmn2:incoming>SequenceFlow_1eg944u</bpmn2:incoming> - <bpmn2:outgoing>SequenceFlow_0s57qft</bpmn2:outgoing> - <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.* -def dcsi = new DoUpdateE2EServiceInstance() -dcsi.postResourcesOperStatus(execution)]]></bpmn2:script> - </bpmn2:scriptTask> - <bpmn2:sequenceFlow id="SequenceFlow_0s57qft" sourceRef="ScriptTask_0iq531p" targetRef="IntermediateThrowEvent_0vneaao" /> - <bpmn2:sequenceFlow id="SequenceFlow_1eg944u" sourceRef="ServiceTask_0c13nyt" targetRef="ScriptTask_0iq531p" /> <bpmn2:callActivity id="CallActivity_1nm9zq7" name="Call Custom E2E Put Service" calledElement="CustomE2EPutService"> <bpmn2:extensionElements> <camunda:in source="globalSubscriberId" target="GENPS_globalSubscriberId" /> @@ -377,25 +259,23 @@ ddsi.preUpdateServiceOperationStatus(execution)]]></bpmn2:script> <bpmn2:sequenceFlow id="SequenceFlow_0ku36oy" sourceRef="IntermediateCatchEvent_0z04o3s" targetRef="ScriptTask_0jsblrq" /> <bpmn2:sequenceFlow id="SequenceFlow_0mwh16g" sourceRef="ScriptTask_0jsblrq" targetRef="ServiceTask_1ydxyw0" /> <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_06lo96a" name="GoTo UpdateAAI"> - <bpmn2:incoming>SequenceFlow_1ryg78h</bpmn2:incoming> + <bpmn2:incoming>SequenceFlow_1uu6uiu</bpmn2:incoming> <bpmn2:linkEventDefinition name="UpdateAAI" /> </bpmn2:intermediateThrowEvent> - <bpmn2:sequenceFlow id="SequenceFlow_1ryg78h" sourceRef="ScriptTask_04rn9mp" targetRef="IntermediateThrowEvent_06lo96a" /> <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_0hucdtk" name="GoTo FinishProcess"> <bpmn2:incoming>SequenceFlow_0x0mhlj</bpmn2:incoming> <bpmn2:linkEventDefinition name="FinishProcess" /> </bpmn2:intermediateThrowEvent> <bpmn2:sequenceFlow id="SequenceFlow_0x0mhlj" sourceRef="ScriptTask_0xtabf8" targetRef="IntermediateThrowEvent_0hucdtk" /> - <bpmn2:sequenceFlow id="SequenceFlow_167wc99" sourceRef="ScriptTask_0i8cqdy_PostProcessAAIGET" targetRef="ScriptTask_1pwo0jp" /> + <bpmn2:sequenceFlow id="SequenceFlow_167wc99" sourceRef="ScriptTask_0i8cqdy_PostProcessAAIGET" targetRef="IntermediateThrowEvent_1dwg5lz" /> <bpmn2:intermediateThrowEvent id="IntermediateThrowEvent_09ur9ds" name="GoTo StartAddResources"> <bpmn2:incoming>SequenceFlow_1sgsysh</bpmn2:incoming> <bpmn2:linkEventDefinition name="StartAddResource" /> </bpmn2:intermediateThrowEvent> <bpmn2:sequenceFlow id="SequenceFlow_0l4gosl" sourceRef="ScriptTask_0wl77h6" targetRef="ScriptTask_0acnvkp" /> <bpmn2:sequenceFlow id="SequenceFlow_1sgsysh" sourceRef="ScriptTask_0r74c3c" targetRef="IntermediateThrowEvent_09ur9ds" /> - <bpmn2:sequenceFlow id="SequenceFlow_1fa1yjd" sourceRef="ScriptTask_1na4qzo" targetRef="ServiceTask_0c13nyt" /> - <bpmn2:sequenceFlow id="SequenceFlow_1nqfgvs" sourceRef="Task_0ag30bf" targetRef="ScriptTask_1na4qzo" /> - <bpmn2:sequenceFlow id="SequenceFlow_1uu6uiu" sourceRef="ScriptTask_00wgfrc" targetRef="ScriptTask_1wk7zcu" /> + <bpmn2:sequenceFlow id="SequenceFlow_1nqfgvs" sourceRef="Task_0ag30bf" targetRef="IntermediateThrowEvent_0vneaao" /> + <bpmn2:sequenceFlow id="SequenceFlow_1uu6uiu" sourceRef="ScriptTask_00wgfrc" targetRef="IntermediateThrowEvent_06lo96a" /> <bpmn2:subProcess id="SubProcess_0jo0nms" name="Sub-process for Application Errors" triggeredByEvent="true"> <bpmn2:startEvent id="StartEvent_06768u3"> <bpmn2:outgoing>SequenceFlow_05j3sat</bpmn2:outgoing> @@ -516,9 +396,6 @@ dcsi.preProcessAAIPUT(execution)]]></bpmn2:script> <bpmndi:BPMNShape id="ScriptTask_1fj89ew_di" bpmnElement="Task_0ag30bf"> <dc:Bounds x="858" y="828" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_04rn9mp_di" bpmnElement="ScriptTask_04rn9mp"> - <dc:Bounds x="1675" y="1081" width="100" height="80" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="IntermediateCatchEvent_0jks7by_di" bpmnElement="StartEvent_StartResource"> <dc:Bounds x="74" y="850" width="36" height="36" /> <bpmndi:BPMNLabel> @@ -531,50 +408,6 @@ dcsi.preProcessAAIPUT(execution)]]></bpmn2:script> <dc:Bounds x="1925" y="444" width="90" height="24" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_1wk7zcu_di" bpmnElement="ScriptTask_1wk7zcu"> - <dc:Bounds x="1152" y="1081" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_1a6cmdu_di" bpmnElement="ServiceTask_1a6cmdu"> - <dc:Bounds x="1421" y="1081" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0gr3l25_di" bpmnElement="SequenceFlow_0gr3l25"> - <di:waypoint xsi:type="dc:Point" x="1252" y="1121" /> - <di:waypoint xsi:type="dc:Point" x="1421" y="1121" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1291.5" y="1100" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0cnuo36_di" bpmnElement="SequenceFlow_0cnuo36"> - <di:waypoint xsi:type="dc:Point" x="1521" y="1121" /> - <di:waypoint xsi:type="dc:Point" x="1675" y="1121" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1553" y="1100" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_1pwo0jp_di" bpmnElement="ScriptTask_1pwo0jp"> - <dc:Bounds x="1152" y="382" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0aylb6e_di" bpmnElement="SequenceFlow_0aylb6e"> - <di:waypoint xsi:type="dc:Point" x="1252" y="422" /> - <di:waypoint xsi:type="dc:Point" x="1337" y="422" /> - <di:waypoint xsi:type="dc:Point" x="1337" y="422" /> - <di:waypoint xsi:type="dc:Point" x="1421" y="422" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1307" y="416" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ServiceTask_1dqzdko_di" bpmnElement="ServiceTask_1dqzdko"> - <dc:Bounds x="1421" y="382" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1r1hl23_di" bpmnElement="SequenceFlow_1r1hl23"> - <di:waypoint xsi:type="dc:Point" x="1521" y="422" /> - <di:waypoint xsi:type="dc:Point" x="1598" y="422" /> - <di:waypoint xsi:type="dc:Point" x="1598" y="422" /> - <di:waypoint xsi:type="dc:Point" x="1675" y="422" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1568" y="416" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_115mdln_di" bpmnElement="SequenceFlow_115mdln"> <di:waypoint xsi:type="dc:Point" x="110" y="868" /> <di:waypoint xsi:type="dc:Point" x="293" y="868" /> @@ -682,16 +515,6 @@ dcsi.preProcessAAIPUT(execution)]]></bpmn2:script> <dc:Bounds x="724.5" y="400" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_17ssed5_di" bpmnElement="ScriptTask_17ssed5"> - <dc:Bounds x="1675" y="382" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1i45vfx_di" bpmnElement="SequenceFlow_1i45vfx"> - <di:waypoint xsi:type="dc:Point" x="1775" y="422" /> - <di:waypoint xsi:type="dc:Point" x="1951" y="422" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1818" y="401" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ScriptTask_0acnvkp_di" bpmnElement="ScriptTask_0acnvkp"> <dc:Bounds x="1152" y="600" width="100" height="80" /> </bpmndi:BPMNShape> @@ -721,29 +544,6 @@ dcsi.preProcessAAIPUT(execution)]]></bpmn2:script> <dc:Bounds x="1925" y="890" width="90" height="24" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_1na4qzo_di" bpmnElement="ScriptTask_1na4qzo"> - <dc:Bounds x="1152" y="828" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_0c13nyt_di" bpmnElement="ServiceTask_0c13nyt"> - <dc:Bounds x="1421" y="828" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_0iq531p_di" bpmnElement="ScriptTask_0iq531p"> - <dc:Bounds x="1675" y="828" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0s57qft_di" bpmnElement="SequenceFlow_0s57qft"> - <di:waypoint xsi:type="dc:Point" x="1775" y="868" /> - <di:waypoint xsi:type="dc:Point" x="1951" y="868" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1818" y="847" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1eg944u_di" bpmnElement="SequenceFlow_1eg944u"> - <di:waypoint xsi:type="dc:Point" x="1521" y="868" /> - <di:waypoint xsi:type="dc:Point" x="1675" y="868" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1553" y="847" width="90" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="CallActivity_1nm9zq7_di" bpmnElement="CallActivity_1nm9zq7"> <dc:Bounds x="1410" y="1333" width="100" height="80" /> </bpmndi:BPMNShape> @@ -829,13 +629,6 @@ dcsi.preProcessAAIPUT(execution)]]></bpmn2:script> <dc:Bounds x="1939" y="1143" width="82" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1ryg78h_di" bpmnElement="SequenceFlow_1ryg78h"> - <di:waypoint xsi:type="dc:Point" x="1775" y="1121" /> - <di:waypoint xsi:type="dc:Point" x="1951" y="1121" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1863" y="1100" width="0" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="IntermediateThrowEvent_0hucdtk_di" bpmnElement="IntermediateThrowEvent_0hucdtk"> <dc:Bounds x="1951" y="1355" width="36" height="36" /> <bpmndi:BPMNLabel> @@ -853,9 +646,9 @@ dcsi.preProcessAAIPUT(execution)]]></bpmn2:script> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_167wc99_di" bpmnElement="SequenceFlow_167wc99"> <di:waypoint xsi:type="dc:Point" x="958" y="422" /> - <di:waypoint xsi:type="dc:Point" x="1152" y="422" /> + <di:waypoint xsi:type="dc:Point" x="1951" y="422" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1055" y="401" width="0" height="12" /> + <dc:Bounds x="1409.5" y="401" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="IntermediateThrowEvent_09ur9ds_di" bpmnElement="IntermediateThrowEvent_09ur9ds"> @@ -878,25 +671,18 @@ dcsi.preProcessAAIPUT(execution)]]></bpmn2:script> <dc:Bounds x="1863" y="619" width="0" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1fa1yjd_di" bpmnElement="SequenceFlow_1fa1yjd"> - <di:waypoint xsi:type="dc:Point" x="1252" y="868" /> - <di:waypoint xsi:type="dc:Point" x="1421" y="868" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1336.5" y="847" width="0" height="12" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1nqfgvs_di" bpmnElement="SequenceFlow_1nqfgvs"> <di:waypoint xsi:type="dc:Point" x="958" y="868" /> - <di:waypoint xsi:type="dc:Point" x="1152" y="868" /> + <di:waypoint xsi:type="dc:Point" x="1951" y="868" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1055" y="847" width="0" height="12" /> + <dc:Bounds x="1409.5" y="847" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1uu6uiu_di" bpmnElement="SequenceFlow_1uu6uiu"> <di:waypoint xsi:type="dc:Point" x="958" y="1121" /> - <di:waypoint xsi:type="dc:Point" x="1152" y="1121" /> + <di:waypoint xsi:type="dc:Point" x="1951" y="1121" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1055" y="1100" width="0" height="12" /> + <dc:Bounds x="1409.5" y="1100" width="90" height="12" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="SubProcess_0jo0nms_di" bpmnElement="SubProcess_0jo0nms" isExpanded="true"> diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoScaleE2EServiceInstanceTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoScaleE2EServiceInstanceTest.groovy new file mode 100644 index 0000000000..2dc3157e57 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoScaleE2EServiceInstanceTest.groovy @@ -0,0 +1,110 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2018 CMCC All rights reserved. * + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ +package org.openecomp.mso.bpmn.infrastructure.scripts + +import com.github.tomakehurst.wiremock.junit.WireMockRule +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.junit.Before +import org.junit.BeforeClass +import org.junit.Rule +import org.junit.Test +import org.mockito.MockitoAnnotations +import org.openecomp.mso.bpmn.mock.FileUtil +import org.openecomp.mso.bpmn.vcpe.scripts.GroovyTestBase + +import static org.mockito.Mockito.verify +import static org.mockito.Mockito.when + +class DoScaleE2EServiceInstanceTest extends GroovyTestBase { + + private static String request + + @Rule + public WireMockRule wireMockRule = new WireMockRule(GroovyTestBase.PORT) + + String Prefix = "CVRCS_" + + @BeforeClass + public static void setUpBeforeClass() { + request = FileUtil.readResourceFile("__files/InfrastructureFlows/DoScaleE2EServiceInstance.json") + } + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + } + public DoScaleE2EServiceInstanceTest(){ + super("DoScaleE2EServiceInstance") + } + + @Test + public void preProcessRequestTest(){ + + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPreProcess(mex) + + DoScaleE2EServiceInstance instance = new DoScaleE2EServiceInstance() + instance.preProcessRequest(mex) + verify(mex).setVariable("resourceTemplateUUIDs", "ns111:ns333:") + } + + @Test + public void preInitResourcesOperStatusTest(){ + ExecutionEntity mex = setupMock() + def map = setupMap(mex) + initPreProcess(mex) + DoScaleE2EServiceInstance instance = new DoScaleE2EServiceInstance() + instance.preInitResourcesOperStatus(mex) + + verify(mex).setVariable("serviceInstanceId","e151059a-d924-4629-845f-264db19e50b4") + verify(mex).setVariable("operationId", "59960003992") + verify(mex).setVariable("operationType", "SCALE") + verify(mex).setVariable("URN_mso_openecomp_adapters_db_endpoint","http://mso.mso.testlab.openecomp.org:8080/dbadapters/RequestsDbAdapter") + + String payload = + """<soapenv:Envelope xmlns:ns="http://org.openecomp.mso/requestsdb" + xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> + <soapenv:Header/> + <soapenv:Body> + <ns:initResourceOperationStatus> + <serviceId>e151059a-d924-4629-845f-264db19e50b4</serviceId> + <operationId>59960003992</operationId> + <operationType>SCALE</operationType> + <resourceTemplateUUIDs>ns111:ns333:</resourceTemplateUUIDs> + </ns:initResourceOperationStatus> + </soapenv:Body> +</soapenv:Envelope>""" + verify(mex).setVariable("CVFMI_initResOperStatusRequest", payload) + } + + private void initPreProcess(ExecutionEntity mex) { + when(mex.getVariable(GroovyTestBase.DBGFLAG)).thenReturn("true") + when(mex.getVariable("bpmnRequest")).thenReturn(request) + when(mex.getVariable("msoRequestId")).thenReturn("mri") + when(mex.getVariable("serviceType")).thenReturn("VoLTE") + when(mex.getVariable("serviceInstanceId")).thenReturn("e151059a-d924-4629-845f-264db19e50b4") + when(mex.getVariable("serviceInstanceName")).thenReturn("ra") + when(mex.getVariable("operationId")).thenReturn("59960003992") + when(mex.getVariable("globalSubscriberId")).thenReturn("4993921112123") + when(mex.getVariable("resourceTemplateUUIDs")).thenReturn("ns111:ns333:") + } +}
\ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstanceTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstanceTest.groovy new file mode 100644 index 0000000000..e7ffe05424 --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/ScaleCustomE2EServiceInstanceTest.groovy @@ -0,0 +1,176 @@ +package org.openecomp.mso.bpmn.infrastructure.scripts + +import static org.mockito.Mockito.* + +import org.apache.commons.lang3.* +import org.camunda.bpm.engine.ProcessEngineServices +import org.camunda.bpm.engine.RepositoryService +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.camunda.bpm.engine.repository.ProcessDefinition +import org.camunda.bpm.engine.runtime.Execution +import org.junit.Before +import org.junit.Rule +import org.junit.Test +import org.junit.runner.RunWith +import org.mockito.MockitoAnnotations +import org.mockito.runners.MockitoJUnitRunner +import org.openecomp.mso.bpmn.common.scripts.MsoUtils +import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil + + +import com.github.tomakehurst.wiremock.junit.WireMockRule + +@RunWith(MockitoJUnitRunner.class) +class SacleCustomE2EServiceInstanceTest{ + @Rule + public WireMockRule wireMockRule = new WireMockRule(8090); + + String Prefix="CRESI_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + String globalSubscriberId="test_custormer" + String requestDescription = "request description for test" + def utils = new MsoUtils() + + String jsonIncomingRequest = """{"service":{ + "serviceType":"example-service-type", + "globalSubscriberId":"test_custormer", + "resources":[ + { + "resourceInstanceId":"ns111", + "scaleType":"SCALE_NS", + "scaleNsData":{ + "scaleNsByStepsData":{ + "numberOfSteps":"4", + "aspectId":"TIC_EDGE_HW", + "scalingDirection":"UP" + } + } + }, + { + "resourceInstanceId":"ns333", + "scaleType":"SCALE_NS", + "scaleNsData":{ + "scaleNsByStepsData":{ + "numberOfSteps":"4", + "aspectId":"TIC_EDGE_HW", + "scalingDirection":"UP" + } + } + }], + "serviceInstanceName":"XXXX" + }, + "operationId":"0a5b1651-c56e-4263-8c26-c8f8a6ef72d8" + }""" + + String xmlMsoCompletionRequest = """<aetgt:MsoCompletionRequest xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1" + xmlns:ns="http://org.openecomp/mso/request/types/v1" + xmlns:w1aaan0="http://org.openecomp/mso/infra/vnf-request/v1"> + <w1aaan0:request-info> + <w1aaan0:request-id>56c881ad-6c9d-4b79-aacc-401e5640b47f</w1aaan0:request-id> + <w1aaan0:action>SCALE</w1aaan0:action> + <w1aaan0:source>null</w1aaan0:source> + </w1aaan0:request-info> + <status-message>Service Instance was scaled successfully.</status-message> + <serviceInstanceId>56c881ad-6c9d-4b79-aacc-401e5640b47f</serviceInstanceId> + <mso-bpel-name>ScaleGenericALaCarteServiceInstance</mso-bpel-name> +</aetgt:MsoCompletionRequest>""" + + String requestInfo = """<request-info xmlns="http://org.openecomp/mso/infra/vnf-request/v1"> + <request-id>56c881ad-6c9d-4b79-aacc-401e5640b47f</request-id> + <action>SCALE</action> + <source>null</source> + </request-info>""" + + String payload ="""<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" + xmlns:ns="http://org.openecomp.mso/requestsdb"> + <soapenv:Header/> + <soapenv:Body> + <ns:updateServiceOperationStatus xmlns:ns="http://org.openecomp.mso/requestsdb"> + <serviceId>56c881ad-6c9d-4b79-aacc-401e5640b47f</serviceId> + <operationId>0a5b1651-c56e-4263-8c26-c8f8a6ef72d8</operationId> + <serviceName>XXXX</serviceName> + <operationType>SCALE</operationType> + <userId></userId> + <result>processing</result> + <operationContent>Prepare service scaling</operationContent> + <progress>0</progress> + <reason></reason> + </ns:updateServiceOperationStatus> + </soapenv:Body> + </soapenv:Envelope>""" + + @Before + public void init() + { + MockitoAnnotations.initMocks(this) + } + + @Test + public void preProcessRequestTest() { + println "************ preProcessRequest_Payload ************* " + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + + // Initialize prerequisite variables + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("bpmnRequest")).thenReturn(jsonIncomingRequest) + + when(mockExecution.getVariable("mso-request-id")).thenReturn("56c881ad-6c9d-4b79-aacc-401e5640b47f") + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("56c881ad-6c9d-4b79-aacc-401e5640b47f") + + ScaleCustomE2EServiceInstance scaleCustomE2EServiceInstance = new ScaleCustomE2EServiceInstance() + scaleCustomE2EServiceInstance.preProcessRequest(mockExecution) + + verify(mockExecution).setVariable("globalSubscriberId", globalSubscriberId) + verify(mockExecution).setVariable("prefix", Prefix) + verify(mockExecution).setVariable("requestDescription", requestDescription) + } + + @Test + public void sendSyncResponseTest() { + println "************ sendSyncResponse ************* " + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("operationId")).thenReturn("3338b250-e995-4782-8936-081b66ba4dbf") + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("56c881ad-6c9d-4b79-aacc-401e5640b47f") + + ScaleCustomE2EServiceInstance scaleCustomE2EServiceInstance = new ScaleCustomE2EServiceInstance() + scaleCustomE2EServiceInstance.sendSyncResponse(mockExecution) + + verify(mockExecution).setVariable("sentSyncResponse", true) + } + + @Test + public void prepareCompletionRequestTest() { + println "************ prepareCompletionRequest ************* " + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("msoRequestId")).thenReturn("56c881ad-6c9d-4b79-aacc-401e5640b47f") + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("56c881ad-6c9d-4b79-aacc-401e5640b47f") + + ScaleCustomE2EServiceInstance scaleCustomE2EServiceInstance = new ScaleCustomE2EServiceInstance() + scaleCustomE2EServiceInstance.prepareCompletionRequest(mockExecution) + + verify(mockExecution).setVariable("CompleteMsoProcessRequest", xmlMsoCompletionRequest) + + } + + @Test + public void prepareInitServiceOperationStatusTest() { + println "************ prepareInitServiceOperationStatus ************* " + ExecutionEntity mockExecution = mock(ExecutionEntity.class) + + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("56c881ad-6c9d-4b79-aacc-401e5640b47f") + when(mockExecution.getVariable("serviceInstanceName")).thenReturn("XXXX") + when(mockExecution.getVariable("operationId")).thenReturn("0a5b1651-c56e-4263-8c26-c8f8a6ef72d8") + + ScaleCustomE2EServiceInstance scaleCustomE2EServiceInstance = new ScaleCustomE2EServiceInstance() + scaleCustomE2EServiceInstance.prepareInitServiceOperationStatus(mockExecution) + + payload = utils.formatXml(payload) + verify(mockExecution).setVariable("CVFMI_updateServiceOperStatusRequest", payload) + } + +} diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy index 2c9d591399..a735121002 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy @@ -32,6 +32,7 @@ import org.junit.Ignore import org.mockito.MockitoAnnotations import org.camunda.bpm.engine.delegate.BpmnError import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.bpmn.core.domain.HomingSolution import org.openecomp.mso.bpmn.mock.FileUtil import static com.github.tomakehurst.wiremock.client.WireMock.aResponse @@ -109,6 +110,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { verify(mex).setVariable("brgWanMacAddress", "brgmac") verify(mex).setVariable("customerLocation", ["customerLatitude":"32.897480", "customerLongitude":"-97.040443", "customerName":"some_company"]) + verify(mex).setVariable("homingService", "sniro") assertTrue(map.containsKey("serviceInputParams")) assertTrue(map.containsKey(Prefix+"requestInfo")) @@ -166,6 +168,7 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase { assertEquals("", map.get("brgWanMacAddress")) assertEquals("", map.get("customerLocation")) + assertEquals("oof", map.get("homingService")) assertTrue(map.containsKey("serviceInputParams")) assertTrue(map.containsKey(Prefix+"requestInfo")) diff --git a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DeleteVcpeResCustServiceTest.groovy b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DeleteVcpeResCustServiceTest.groovy index fdc470f16d..b904a3f2d9 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DeleteVcpeResCustServiceTest.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/test/groovy/org/openecomp/mso/bpmn/vcpe/scripts/DeleteVcpeResCustServiceTest.groovy @@ -47,7 +47,7 @@ import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition import org.openecomp.mso.bpmn.core.domain.VnfResource import org.openecomp.mso.bpmn.core.domain.AllottedResource import org.openecomp.mso.bpmn.core.domain.ModelInfo -import org.openecomp.mso.bpmn.core.domain.HomingSolution + import org.openecomp.mso.bpmn.core.RollbackData import org.openecomp.mso.bpmn.vcpe.scripts.MapGetter import org.openecomp.mso.bpmn.vcpe.scripts.MapSetter diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/deleteVfModuleVolume_VID_request_st.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/deleteVfModuleVolume_VID_request_st.json index c6cc1ca428..52ead5f77f 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/deleteVfModuleVolume_VID_request_st.json +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/DeleteVfModuleVolumeInfraV1/deleteVfModuleVolume_VID_request_st.json @@ -7,7 +7,7 @@ "modelVersion": "1.0" }, "cloudConfiguration": { - "lcpCloudRegionId": "MDTWNJ21", + "lcpCloudRegionId": "cloudowner_MDTWNJ21", "tenantId": "fba1bd1e195a404cacb9ce17a9b2b421" }, "requestInfo": { diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/DoScaleE2EServiceInstance.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/DoScaleE2EServiceInstance.json new file mode 100644 index 0000000000..dd3ff6841e --- /dev/null +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/InfrastructureFlows/DoScaleE2EServiceInstance.json @@ -0,0 +1,38 @@ +{ + "service": + { + "serviceType":"example-service-type", + "globalSubscriberId":"test_custormer", + "resources": + [ + { + "resourceInstanceId":"ns111", + "scaleType":"SCALE_NS", + "scaleNsData": + { + "scaleNsByStepsData": + { + "numberOfSteps":"4", + "aspectId":"TIC_EDGE_HW", + "scalingDirection":"UP" + } + } + }, + { + "resourceInstanceId":"ns333", + "scaleType":"SCALE_NS", + "scaleNsData": + { + "scaleNsByStepsData": + { + "numberOfSteps":"4", + "aspectId":"TIC_EDGE_HW", + "scalingDirection":"UP" + } + } + } + ], + "serviceInstanceName":"service1" + }, + "operationId":"15c01683-4f15-45e7-b213-dcbfe6f42a1b" + }
\ No newline at end of file diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/request.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/request.json index 3e05ba0f9d..bc0a1ef491 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/request.json +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/request.json @@ -23,7 +23,7 @@ }, "cloudConfiguration": { - "lcpCloudRegionId":"mdt1", + "lcpCloudRegionId":"cloudowner_mdt1", "tenantId":"8b1df54faa3b49078e3416e21370a3ba" }, "requestParameters": @@ -43,6 +43,10 @@ "customerLongitude": "-97.040443", "customerName": "some_company" } + }, + { + "name":"Homing_Solution", + "value":"sniro" } ] } diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestNoSIName.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestNoSIName.json index cf02444705..4100ec76de 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestNoSIName.json +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestNoSIName.json @@ -22,7 +22,7 @@ }, "cloudConfiguration": { - "lcpCloudRegionId":"mdt1", + "lcpCloudRegionId":"cloudowner_mdt1", "tenantId":"8b1df54faa3b49078e3416e21370a3ba" }, "requestParameters": @@ -42,6 +42,10 @@ "customerLongitude": "-97.040443", "customerName": "some_company" } + }, + { + "name":"Homing_Solution", + "value":"sniro" } ] } diff --git a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestNoSINameNoRollback.json b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestNoSINameNoRollback.json index 39be40aedd..5fc0b04180 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestNoSINameNoRollback.json +++ b/bpmn/MSOInfrastructureBPMN/src/test/resources/__files/VCPE/CreateVcpeResCustService/requestNoSINameNoRollback.json @@ -22,7 +22,7 @@ }, "cloudConfiguration": { - "lcpCloudRegionId":"mdt1", + "lcpCloudRegionId":"cloudowner_mdt1", "tenantId":"8b1df54faa3b49078e3416e21370a3ba" }, "requestParameters": @@ -42,7 +42,11 @@ "customerLongitude": "-97.040443", "customerName": "some_company" } - } + }, + { + "name":"Homing_Solution", + "value":"sniro" + } ] } } diff --git a/bpmn/MSOURN-plugin/pom.xml b/bpmn/MSOURN-plugin/pom.xml index 0dc8d6dee5..b2db869f13 100644 --- a/bpmn/MSOURN-plugin/pom.xml +++ b/bpmn/MSOURN-plugin/pom.xml @@ -31,7 +31,7 @@ <dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
- <version>1.3.2</version>
+ <version>1.3.3</version>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
|